Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
/**
2
The YUI module contains the components required for building the YUI seed file.
3
This includes the script loading mechanism, a simple queue, and the core
4
utilities for the library.
5
 
6
@module yui
7
@main yui
8
@submodule yui-base
9
**/
10
 
11
/*jshint eqeqeq: false*/
12
if (typeof YUI != 'undefined') {
13
    YUI._YUI = YUI;
14
}
15
 
16
/**
17
The YUI global namespace object. This is the constructor for all YUI instances.
18
 
19
This is a self-instantiable factory function, meaning you don't need to precede
20
it with the `new` operator. You can invoke it directly like this:
21
 
22
    YUI().use('*', function (Y) {
23
        // Y is a new YUI instance.
24
    });
25
 
26
But it also works like this:
27
 
28
    var Y = YUI();
29
 
30
The `YUI` constructor accepts an optional config object, like this:
31
 
32
    YUI({
33
        debug: true,
34
        combine: false
35
    }).use('node', function (Y) {
36
        // Y.Node is ready to use.
37
    });
38
 
39
See the API docs for the <a href="config.html">Config</a> class for the complete
40
list of supported configuration properties accepted by the YUI constuctor.
41
 
42
If a global `YUI` object is already defined, the existing YUI object will not be
43
overwritten, to ensure that defined namespaces are preserved.
44
 
45
Each YUI instance has full custom event support, but only if the event system is
46
available.
47
 
48
@class YUI
49
@uses EventTarget
50
@constructor
51
@global
52
@param {Object} [config]* Zero or more optional configuration objects. Config
53
    values are stored in the `Y.config` property. See the
54
    <a href="config.html">Config</a> docs for the list of supported properties.
55
**/
56
 
57
    /*global YUI*/
58
    /*global YUI_config*/
59
    var YUI = function() {
60
        var i = 0,
61
            Y = this,
62
            args = arguments,
63
            l = args.length,
64
            instanceOf = function(o, type) {
65
                return (o && o.hasOwnProperty && (o instanceof type));
66
            },
67
            gconf = (typeof YUI_config !== 'undefined') && YUI_config;
68
 
69
        if (!(instanceOf(Y, YUI))) {
70
            Y = new YUI();
71
        } else {
72
            // set up the core environment
73
            Y._init();
74
 
75
            /**
76
            Master configuration that might span multiple contexts in a non-
77
            browser environment. It is applied first to all instances in all
78
            contexts.
79
 
80
            @example
81
 
82
                YUI.GlobalConfig = {
83
                    filter: 'debug'
84
                };
85
 
86
                YUI().use('node', function (Y) {
87
                    // debug files used here
88
                });
89
 
90
                YUI({
91
                    filter: 'min'
92
                }).use('node', function (Y) {
93
                    // min files used here
94
                });
95
 
96
            @property {Object} GlobalConfig
97
            @global
98
            @static
99
            **/
100
            if (YUI.GlobalConfig) {
101
                Y.applyConfig(YUI.GlobalConfig);
102
            }
103
 
104
            /**
105
            Page-level config applied to all YUI instances created on the
106
            current page. This is applied after `YUI.GlobalConfig` and before
107
            any instance-level configuration.
108
 
109
            @example
110
 
111
                // Single global var to include before YUI seed file
112
                YUI_config = {
113
                    filter: 'debug'
114
                };
115
 
116
                YUI().use('node', function (Y) {
117
                    // debug files used here
118
                });
119
 
120
                YUI({
121
                    filter: 'min'
122
                }).use('node', function (Y) {
123
                    // min files used here
124
                });
125
 
126
            @property {Object} YUI_config
127
            @global
128
            **/
129
            if (gconf) {
130
                Y.applyConfig(gconf);
131
            }
132
 
133
            // bind the specified additional modules for this instance
134
            if (!l) {
135
                Y._afterConfig();
136
                Y._setup();
137
            }
138
        }
139
 
140
        if (l) {
141
            // Each instance can accept one or more configuration objects.
142
            // These are applied after YUI.GlobalConfig and YUI_Config,
143
            // overriding values set in those config files if there is a
144
            // matching property.
145
            for (; i < l; i++) {
146
                Y.applyConfig(args[i]);
147
            }
148
 
149
            Y._afterConfig();
150
            Y._setup();
151
        }
152
 
153
        Y.instanceOf = instanceOf;
154
 
155
        return Y;
156
    };
157
 
158
(function() {
159
 
160
    var proto, prop,
161
        VERSION = '3.18.1',
162
        PERIOD = '.',
163
        BASE = 'http://yui.yahooapis.com/',
164
        /*
165
            These CSS class names can't be generated by
166
            getClassName since it is not available at the
167
            time they are being used.
168
        */
169
        DOC_LABEL = 'yui3-js-enabled',
170
        CSS_STAMP_EL = 'yui3-css-stamp',
171
        NOOP = function() {},
172
        SLICE = Array.prototype.slice,
173
        APPLY_TO_AUTH = { 'io.xdrReady': 1,   // the functions applyTo
174
                          'io.xdrResponse': 1,   // can call. this should
175
                          'SWF.eventHandler': 1 }, // be done at build time
176
        hasWin = (typeof window != 'undefined'),
177
        win = (hasWin) ? window : null,
178
        doc = (hasWin) ? win.document : null,
179
        docEl = doc && doc.documentElement,
180
        docClass = docEl && docEl.className,
181
        instances = {},
182
        time = new Date().getTime(),
183
        add = function(el, type, fn, capture) {
184
            if (el && el.addEventListener) {
185
                el.addEventListener(type, fn, capture);
186
            } else if (el && el.attachEvent) {
187
                el.attachEvent('on' + type, fn);
188
            }
189
        },
190
        remove = function(el, type, fn, capture) {
191
            if (el && el.removeEventListener) {
192
                // this can throw an uncaught exception in FF
193
                try {
194
                    el.removeEventListener(type, fn, capture);
195
                } catch (ex) {}
196
            } else if (el && el.detachEvent) {
197
                el.detachEvent('on' + type, fn);
198
            }
199
        },
200
        handleReady = function() {
201
            YUI.Env.DOMReady = true;
202
            if (hasWin) {
203
                remove(doc, 'DOMContentLoaded', handleReady);
204
            }
205
        },
206
        handleLoad = function() {
207
            YUI.Env.windowLoaded = true;
208
            YUI.Env.DOMReady = true;
209
            if (hasWin) {
210
                remove(window, 'load', handleLoad);
211
            }
212
        },
213
        getLoader = function(Y, o) {
214
            var loader = Y.Env._loader,
215
                lCore = [ 'loader-base' ],
216
                G_ENV = YUI.Env,
217
                mods = G_ENV.mods;
218
 
219
            if (loader) {
220
                //loader._config(Y.config);
221
                loader.ignoreRegistered = false;
222
                loader.onEnd = null;
223
                loader.data = null;
224
                loader.required = [];
225
                loader.loadType = null;
226
            } else {
227
                loader = new Y.Loader(Y.config);
228
                Y.Env._loader = loader;
229
            }
230
            if (mods && mods.loader) {
231
                lCore = [].concat(lCore, YUI.Env.loaderExtras);
232
            }
233
            YUI.Env.core = Y.Array.dedupe([].concat(YUI.Env.core, lCore));
234
 
235
            return loader;
236
        },
237
 
238
        clobber = function(r, s) {
239
            for (var i in s) {
240
                if (s.hasOwnProperty(i)) {
241
                    r[i] = s[i];
242
                }
243
            }
244
        },
245
 
246
        ALREADY_DONE = { success: true };
247
 
248
//  Stamp the documentElement (HTML) with a class of "yui-loaded" to
249
//  enable styles that need to key off of JS being enabled.
250
if (docEl && docClass.indexOf(DOC_LABEL) == -1) {
251
    if (docClass) {
252
        docClass += ' ';
253
    }
254
    docClass += DOC_LABEL;
255
    docEl.className = docClass;
256
}
257
 
258
if (VERSION.indexOf('@') > -1) {
259
    VERSION = '3.5.0'; // dev time hack for cdn test
260
}
261
 
262
proto = {
263
    /**
264
    Applies a new configuration object to the config of this YUI instance. This
265
    will merge new group/module definitions, and will also update the loader
266
    cache if necessary. Updating `Y.config` directly will not update the cache.
267
 
268
    @method applyConfig
269
    @param {Object} o the configuration object.
270
    @since 3.2.0
271
    **/
272
    applyConfig: function(o) {
273
 
274
        o = o || NOOP;
275
 
276
        var attr,
277
            name,
278
            // detail,
279
            config = this.config,
280
            mods = config.modules,
281
            groups = config.groups,
282
            aliases = config.aliases,
283
            loader = this.Env._loader;
284
 
285
        for (name in o) {
286
            if (o.hasOwnProperty(name)) {
287
                attr = o[name];
288
                if (mods && name == 'modules') {
289
                    clobber(mods, attr);
290
                } else if (aliases && name == 'aliases') {
291
                    clobber(aliases, attr);
292
                } else if (groups && name == 'groups') {
293
                    clobber(groups, attr);
294
                } else if (name == 'win') {
295
                    config[name] = (attr && attr.contentWindow) || attr;
296
                    config.doc = config[name] ? config[name].document : null;
297
                } else if (name == '_yuid') {
298
                    // preserve the guid
299
                } else {
300
                    config[name] = attr;
301
                }
302
            }
303
        }
304
 
305
        if (loader) {
306
            loader._config(o);
307
        }
308
 
309
    },
310
 
311
    /**
312
    Old way to apply a config to this instance (calls `applyConfig` under the
313
    hood).
314
 
315
    @private
316
    @method _config
317
    @param {Object} o The config to apply
318
    **/
319
    _config: function(o) {
320
        this.applyConfig(o);
321
    },
322
 
323
    /**
324
    Initializes this YUI instance.
325
 
326
    @private
327
    @method _init
328
    **/
329
    _init: function() {
330
        var filter, el,
331
            Y = this,
332
            G_ENV = YUI.Env,
333
            Env = Y.Env,
334
            prop;
335
 
336
        /**
337
        The version number of this YUI instance.
338
 
339
        This value is typically updated by a script when a YUI release is built,
340
        so it may not reflect the correct version number when YUI is run from
341
        the development source tree.
342
 
343
        @property {String} version
344
        **/
345
        Y.version = VERSION;
346
 
347
        if (!Env) {
348
            Y.Env = {
349
                core: ['get', 'features', 'intl-base', 'yui-log', 'yui-log-nodejs', 'yui-later', 'loader-base', 'loader-rollup', 'loader-yui3'],
350
                loaderExtras: ['loader-rollup', 'loader-yui3'],
351
                mods: {}, // flat module map
352
                versions: {}, // version module map
353
                base: BASE,
354
                cdn: BASE + VERSION + '/',
355
                // bootstrapped: false,
356
                _idx: 0,
357
                _used: {},
358
                _attached: {},
359
                _exported: {},
360
                _missed: [],
361
                _yidx: 0,
362
                _uidx: 0,
363
                _guidp: 'y',
364
                _loaded: {},
365
                // serviced: {},
366
                // Regex in English:
367
                // I'll start at the \b(yui).
368
                // 1. Look in the test string for "yui" or
369
                //    "yui-base" or "yui-davglass" or "yui-foobar" that comes after a word break.  That is, it
370
                //    can't match "foyui" or "i_heart_yui". This can be anywhere in the string.
371
                // 2. After #1 must come a forward slash followed by the string matched in #1, so
372
                //    "yui-base/yui-base" or "yui-pants/yui-pants".
373
                // 3. The second occurence of the #1 token can optionally be followed by "-debug" or "-min",
374
                //    so "yui/yui-min", "yui/yui-debug", "yui-base/yui-base-debug". NOT "yui/yui-tshirt".
375
                // 4. This is followed by ".js", so "yui/yui.js".
376
                // 0. Going back to the beginning, now. If all that stuff in 1-4 comes after a "?" in the string,
377
                //    then capture the junk between the LAST "&" and the string in 1-4.  So
378
                //    "blah?foo/yui/yui.js" will capture "foo/" and "blah?some/thing.js&3.3.0/build/yui-davglass/yui-davglass.js"
379
                //    will capture "3.3.0/build/"
380
                //
381
                // Regex Exploded:
382
                // (?:\?             Find a ?
383
                //   (?:[^&]*&)      followed by 0..n characters followed by an &
384
                //   *               in fact, find as many sets of characters followed by a & as you can
385
                //   ([^&]*)         capture the stuff after the last & in \1
386
                // )?                but it's ok if all this ?junk&more_junk stuff isn't even there
387
                // \b(               after a word break find either the string
388
                //    yui(?:-\w+)?   "yui" optionally followed by a -, then more characters
389
                // )                 and store the yui-* string in \2
390
                // \/\2              then comes a / followed by the yui-* string in \2
391
                // (?:-(min|debug))? optionally followed by "-min" or "-debug"
392
                // .js               and ending in ".js"
393
                _BASE_RE: /(?:\?(?:[^&]*&)*([^&]*))?\b(yui(?:-\w+)?)\/\2(?:-(min|debug))?\.js/,
394
                parseBasePath: function(src, pattern) {
395
                    var match = src.match(pattern),
396
                        path, filter;
397
 
398
                    if (match) {
399
                        path = RegExp.leftContext || src.slice(0, src.indexOf(match[0]));
400
 
401
                        // this is to set up the path to the loader.  The file
402
                        // filter for loader should match the yui include.
403
                        filter = match[3];
404
 
405
                        // extract correct path for mixed combo urls
406
                        // http://yuilibrary.com/projects/yui3/ticket/2528423
407
                        if (match[1]) {
408
                            path += '?' + match[1];
409
                        }
410
                        path = {
411
                            filter: filter,
412
                            path: path
413
                        };
414
                    }
415
                    return path;
416
                },
417
                getBase: G_ENV && G_ENV.getBase ||
418
                        function(pattern) {
419
                            var nodes = (doc && doc.getElementsByTagName('script')) || [],
420
                                path = Env.cdn, parsed,
421
                                i, len, src;
422
 
423
                            for (i = 0, len = nodes.length; i < len; ++i) {
424
                                src = nodes[i].src;
425
                                if (src) {
426
                                    parsed = Y.Env.parseBasePath(src, pattern);
427
                                    if (parsed) {
428
                                        filter = parsed.filter;
429
                                        path = parsed.path;
430
                                        break;
431
                                    }
432
                                }
433
                            }
434
 
435
                            // use CDN default
436
                            return path;
437
                        }
438
 
439
            };
440
 
441
            Env = Y.Env;
442
 
443
            Env._loaded[VERSION] = {};
444
 
445
            if (G_ENV && Y !== YUI) {
446
                Env._yidx = ++G_ENV._yidx;
447
                Env._guidp = ('yui_' + VERSION + '_' +
448
                             Env._yidx + '_' + time).replace(/[^a-z0-9_]+/g, '_');
449
            } else if (YUI._YUI) {
450
 
451
                G_ENV = YUI._YUI.Env;
452
                Env._yidx += G_ENV._yidx;
453
                Env._uidx += G_ENV._uidx;
454
 
455
                for (prop in G_ENV) {
456
                    if (!(prop in Env)) {
457
                        Env[prop] = G_ENV[prop];
458
                    }
459
                }
460
 
461
                delete YUI._YUI;
462
            }
463
 
464
            Y.id = Y.stamp(Y);
465
            instances[Y.id] = Y;
466
 
467
        }
468
 
469
        Y.constructor = YUI;
470
 
471
        // configuration defaults
472
        Y.config = Y.config || {
473
            bootstrap: true,
474
            cacheUse: true,
475
            debug: true,
476
            doc: doc,
477
            fetchCSS: true,
478
            throwFail: true,
479
            useBrowserConsole: true,
480
            useNativeES5: true,
481
            win: win
482
        };
483
 
484
        //Register the CSS stamp element
485
        if (doc && !doc.getElementById(CSS_STAMP_EL)) {
486
            el = doc.createElement('div');
487
            el.innerHTML = '<div id="' + CSS_STAMP_EL + '" style="position: absolute !important; visibility: hidden !important"></div>';
488
            YUI.Env.cssStampEl = el.firstChild;
489
            if (doc.body) {
490
                doc.body.appendChild(YUI.Env.cssStampEl);
491
            } else {
492
                docEl.insertBefore(YUI.Env.cssStampEl, docEl.firstChild);
493
            }
494
        } else if (doc && doc.getElementById(CSS_STAMP_EL) && !YUI.Env.cssStampEl) {
495
            YUI.Env.cssStampEl = doc.getElementById(CSS_STAMP_EL);
496
        }
497
 
498
        Y.config.lang = Y.config.lang || 'en-US';
499
 
500
        Y.config.base = YUI.config.base ||
501
                (YUI.config.defaultBase && YUI.config.root && YUI.config.defaultBase + YUI.config.root) ||
502
                Y.Env.getBase(Y.Env._BASE_RE);
503
 
504
        if (!filter || (!('mindebug').indexOf(filter))) {
505
            filter = 'min';
506
        }
507
        filter = (filter) ? '-' + filter : filter;
508
        Y.config.loaderPath = YUI.config.loaderPath || 'loader/loader' + filter + '.js';
509
 
510
    },
511
 
512
    /**
513
    This method is called after all other configuration has been applied to
514
    the YUI instance.
515
 
516
    @method _afterConfig
517
    @private
518
    **/
519
    _afterConfig: function () {
520
        var Y = this;
521
 
522
        // We need to set up Y.config.global after the rest of the configuration
523
        // so that setting it in user configuration prevents the library from
524
        // using eval(). This is critical for Content Security Policy enabled
525
        // sites and other environments like Chrome extensions
526
        if (!Y.config.hasOwnProperty('global')) {
527
            Y.config.global = Function('return this')();
528
        }
529
    },
530
 
531
    /**
532
    Finishes the instance setup. Attaches whatever YUI modules were defined
533
    at the time that this instance was created.
534
 
535
    @method _setup
536
    @private
537
    **/
538
    _setup: function() {
539
        var i, Y = this,
540
            core = [],
541
            mods = YUI.Env.mods,
542
            extendedCore = Y.config.extendedCore || [],
543
            extras = Y.config.core || [].concat(YUI.Env.core).concat(extendedCore); //Clone it..
544
 
545
        for (i = 0; i < extras.length; i++) {
546
            if (mods[extras[i]]) {
547
                core.push(extras[i]);
548
            }
549
        }
550
 
551
        Y._attach(['yui-base']);
552
        Y._attach(core);
553
 
554
        if (Y.Loader) {
555
            getLoader(Y);
556
        }
557
 
558
    },
559
 
560
    /**
561
    Executes the named method on the specified YUI instance if that method is
562
    whitelisted.
563
 
564
    @method applyTo
565
    @param {String} id YUI instance id.
566
    @param {String} method Name of the method to execute. For example:
567
        'Object.keys'.
568
    @param {Array} args Arguments to apply to the method.
569
    @return {Mixed} Return value from the applied method, or `null` if the
570
        specified instance was not found or the method was not whitelisted.
571
    **/
572
    applyTo: function(id, method, args) {
573
        if (!(method in APPLY_TO_AUTH)) {
574
            this.log(method + ': applyTo not allowed', 'warn', 'yui');
575
            return null;
576
        }
577
 
578
        var instance = instances[id], nest, m, i;
579
        if (instance) {
580
            nest = method.split('.');
581
            m = instance;
582
            for (i = 0; i < nest.length; i = i + 1) {
583
                m = m[nest[i]];
584
                if (!m) {
585
                    this.log('applyTo not found: ' + method, 'warn', 'yui');
586
                }
587
            }
588
            return m && m.apply(instance, args);
589
        }
590
 
591
        return null;
592
    },
593
 
594
/**
595
Registers a YUI module and makes it available for use in a `YUI().use()` call or
596
as a dependency for other modules.
597
 
598
The easiest way to create a first-class YUI module is to use
599
<a href="http://yui.github.com/shifter/">Shifter</a>, the YUI component build
600
tool.
601
 
602
Shifter will automatically wrap your module code in a `YUI.add()` call along
603
with any configuration info required for the module.
604
 
605
@example
606
 
607
    YUI.add('davglass', function (Y) {
608
        Y.davglass = function () {
609
        };
610
    }, '3.4.0', {
611
        requires: ['harley-davidson', 'mt-dew']
612
    });
613
 
614
@method add
615
@param {String} name Module name.
616
@param {Function} fn Function containing module code. This function will be
617
    executed whenever the module is attached to a specific YUI instance.
618
 
619
    @param {YUI} fn.Y The YUI instance to which this module is attached.
620
    @param {String} fn.name Name of the module
621
 
622
@param {String} version Module version number. This is currently used only for
623
    informational purposes, and is not used internally by YUI.
624
 
625
@param {Object} [details] Module config.
626
    @param {Array} [details.requires] Array of other module names that must be
627
        attached before this module can be attached.
628
    @param {Array} [details.optional] Array of optional module names that should
629
        be attached before this module is attached if they've already been
630
        loaded. If the `loadOptional` YUI option is `true`, optional modules
631
        that have not yet been loaded will be loaded just as if they were hard
632
        requirements.
633
    @param {Array} [details.use] Array of module names that are included within
634
        or otherwise provided by this module, and which should be attached
635
        automatically when this module is attached. This makes it possible to
636
        create "virtual rollup" modules that simply attach a collection of other
637
        modules or submodules.
638
 
639
@return {YUI} This YUI instance.
640
**/
641
    add: function(name, fn, version, details) {
642
        details = details || {};
643
        var env = YUI.Env,
644
            mod = {
645
                name: name,
646
                fn: fn,
647
                version: version,
648
                details: details
649
            },
650
            //Instance hash so we don't apply it to the same instance twice
651
            applied = {},
652
            loader, inst, modInfo,
653
            i, versions = env.versions;
654
 
655
        env.mods[name] = mod;
656
        versions[version] = versions[version] || {};
657
        versions[version][name] = mod;
658
 
659
        for (i in instances) {
660
            if (instances.hasOwnProperty(i)) {
661
                inst = instances[i];
662
                if (!applied[inst.id]) {
663
                    applied[inst.id] = true;
664
                    loader = inst.Env._loader;
665
                    if (loader) {
666
                        modInfo = loader.getModuleInfo(name);
667
                        if (!modInfo || modInfo.temp) {
668
                            loader.addModule(details, name);
669
                        }
670
                    }
671
                }
672
            }
673
        }
674
 
675
        return this;
676
    },
677
 
678
    /**
679
    Executes the callback function associated with each required module,
680
    attaching the module to this YUI instance.
681
 
682
    @method _attach
683
    @param {Array} r The array of modules to attach
684
    @param {Boolean} [moot=false] If `true`, don't throw a warning if the module
685
        is not attached.
686
    @private
687
    **/
688
    _attach: function(r, moot) {
689
        var i, name, mod, details, req, use, after,
690
            mods = YUI.Env.mods,
691
            aliases = YUI.Env.aliases,
692
            Y = this, j,
693
            cache = YUI.Env._renderedMods,
694
            loader = Y.Env._loader,
695
            done = Y.Env._attached,
696
            exported = Y.Env._exported,
697
            len = r.length, loader, def, go,
698
            c = [],
699
            modArgs, esCompat, reqlen, modInfo,
700
            condition,
701
            __exports__, __imports__;
702
 
703
        //Check for conditional modules (in a second+ instance) and add their requirements
704
        //TODO I hate this entire method, it needs to be fixed ASAP (3.5.0) ^davglass
705
        for (i = 0; i < len; i++) {
706
            name = r[i];
707
            mod = mods[name];
708
            c.push(name);
709
            if (loader && loader.conditions[name]) {
710
                for (j in loader.conditions[name]) {
711
                    if (loader.conditions[name].hasOwnProperty(j)) {
712
                        def = loader.conditions[name][j];
713
                        go = def && ((def.ua && Y.UA[def.ua]) || (def.test && def.test(Y)));
714
                        if (go) {
715
                            c.push(def.name);
716
                        }
717
                    }
718
                }
719
            }
720
        }
721
        r = c;
722
        len = r.length;
723
 
724
        for (i = 0; i < len; i++) {
725
            if (!done[r[i]]) {
726
                name = r[i];
727
                mod = mods[name];
728
 
729
                if (aliases && aliases[name] && !mod) {
730
                    Y._attach(aliases[name]);
731
                    continue;
732
                }
733
                if (!mod) {
734
                    modInfo = loader && loader.getModuleInfo(name);
735
                    if (modInfo) {
736
                        mod = modInfo;
737
                        moot = true;
738
                    }
739
 
740
 
741
                    //if (!loader || !loader.moduleInfo[name]) {
742
                    //if ((!loader || !loader.moduleInfo[name]) && !moot) {
743
                    if (!moot && name) {
744
                        if ((name.indexOf('skin-') === -1) && (name.indexOf('css') === -1)) {
745
                            Y.Env._missed.push(name);
746
                            Y.Env._missed = Y.Array.dedupe(Y.Env._missed);
747
                            Y.message('NOT loaded: ' + name, 'warn', 'yui');
748
                        }
749
                    }
750
                } else {
751
                    done[name] = true;
752
                    //Don't like this, but in case a mod was asked for once, then we fetch it
753
                    //We need to remove it from the missed list ^davglass
754
                    for (j = 0; j < Y.Env._missed.length; j++) {
755
                        if (Y.Env._missed[j] === name) {
756
                            Y.message('Found: ' + name + ' (was reported as missing earlier)', 'warn', 'yui');
757
                            Y.Env._missed.splice(j, 1);
758
                        }
759
                    }
760
 
761
                    // Optional dependencies normally work by modifying the
762
                    // dependency list of a module. If the dependency's test
763
                    // passes it is added to the list. If not, it's not loaded.
764
                    // This following check ensures that optional dependencies
765
                    // are not attached when they were already loaded into the
766
                    // page (when bundling for example)
767
                    if (loader && !loader._canBeAttached(name)) {
768
                        return true;
769
                    }
770
 
771
                    /*
772
                        If it's a temp module, we need to redo it's requirements if it's already loaded
773
                        since it may have been loaded by another instance and it's dependencies might
774
                        have been redefined inside the fetched file.
775
                    */
776
                    if (loader && cache && cache[name] && cache[name].temp) {
777
                        loader.getRequires(cache[name]);
778
                        req = [];
779
                        modInfo = loader.getModuleInfo(name);
780
                        for (j in modInfo.expanded_map) {
781
                            if (modInfo.expanded_map.hasOwnProperty(j)) {
782
                                req.push(j);
783
                            }
784
                        }
785
                        Y._attach(req);
786
                    }
787
 
788
                    details = mod.details;
789
                    req = details.requires;
790
                    esCompat = details.es;
791
                    use = details.use;
792
                    after = details.after;
793
                    //Force Intl load if there is a language (Loader logic) @todo fix this shit
794
                    if (details.lang) {
795
                        req = req || [];
796
                        req.unshift('intl');
797
                    }
798
 
799
                    if (req) {
800
                        reqlen = req.length;
801
                        for (j = 0; j < reqlen; j++) {
802
                            if (!done[req[j]]) {
803
                                if (!Y._attach(req)) {
804
                                    return false;
805
                                }
806
                                break;
807
                            }
808
                        }
809
                    }
810
 
811
                    if (after) {
812
                        for (j = 0; j < after.length; j++) {
813
                            if (!done[after[j]]) {
814
                                if (!Y._attach(after, true)) {
815
                                    return false;
816
                                }
817
                                break;
818
                            }
819
                        }
820
                    }
821
 
822
                    if (mod.fn) {
823
                        modArgs = [Y, name];
824
                        if (esCompat) {
825
                            __imports__ = {};
826
                            __exports__ = {};
827
                            // passing `exports` and `imports` onto the module function
828
                            modArgs.push(__imports__, __exports__);
829
                            if (req) {
830
                                reqlen = req.length;
831
                                for (j = 0; j < reqlen; j++) {
832
                                    __imports__[req[j]] = exported.hasOwnProperty(req[j]) ? exported[req[j]] : Y;
833
                                }
834
                            }
835
                        }
836
                        if (Y.config.throwFail) {
837
                            __exports__ = mod.fn.apply(esCompat ? undefined : mod, modArgs);
838
                        } else {
839
                            try {
840
                                __exports__ = mod.fn.apply(esCompat ? undefined : mod, modArgs);
841
                            } catch (e) {
842
                                Y.error('Attach error: ' + name, e, name);
843
                                return false;
844
                            }
845
                        }
846
                        if (esCompat) {
847
                            // store the `exports` in case others `es` modules requires it
848
                            exported[name] = __exports__;
849
 
850
                            // If an ES module is conditionally loaded and set
851
                            // to be used "instead" another module, replace the
852
                            // trigger module's content with the conditionally
853
                            // loaded one so the values returned by require()
854
                            // still makes sense
855
                            condition = mod.details.condition;
856
                            if (condition && condition.when === 'instead') {
857
                                exported[condition.trigger] = __exports__;
858
                            }
859
                        }
860
                    }
861
 
862
                    if (use) {
863
                        for (j = 0; j < use.length; j++) {
864
                            if (!done[use[j]]) {
865
                                if (!Y._attach(use)) {
866
                                    return false;
867
                                }
868
                                break;
869
                            }
870
                        }
871
                    }
872
 
873
 
874
 
875
                }
876
            }
877
        }
878
 
879
        return true;
880
    },
881
 
882
    /**
883
    Delays the `use` callback until another event has taken place such as
884
    `window.onload`, `domready`, `contentready`, or `available`.
885
 
886
    @private
887
    @method _delayCallback
888
    @param {Function} cb The original `use` callback.
889
    @param {String|Object} until Either an event name ('load', 'domready', etc.)
890
        or an object containing event/args keys for contentready/available.
891
    @return {Function}
892
    **/
893
    _delayCallback: function(cb, until) {
894
 
895
        var Y = this,
896
            mod = ['event-base'];
897
 
898
        until = (Y.Lang.isObject(until) ? until : { event: until });
899
 
900
        if (until.event === 'load') {
901
            mod.push('event-synthetic');
902
        }
903
 
904
        return function() {
905
            var args = arguments;
906
            Y._use(mod, function() {
907
                Y.on(until.event, function() {
908
                    args[1].delayUntil = until.event;
909
                    cb.apply(Y, args);
910
                }, until.args);
911
            });
912
        };
913
    },
914
 
915
    /**
916
    Attaches one or more modules to this YUI instance. When this is executed,
917
    the requirements of the desired modules are analyzed, and one of several
918
    things can happen:
919
 
920
 
921
      * All required modules have already been loaded, and just need to be
922
        attached to this YUI instance. In this case, the `use()` callback will
923
        be executed synchronously after the modules are attached.
924
 
925
      * One or more modules have not yet been loaded, or the Get utility is not
926
        available, or the `bootstrap` config option is `false`. In this case,
927
        a warning is issued indicating that modules are missing, but all
928
        available modules will still be attached and the `use()` callback will
929
        be executed synchronously.
930
 
931
      * One or more modules are missing and the Loader is not available but the
932
        Get utility is, and `bootstrap` is not `false`. In this case, the Get
933
        utility will be used to load the Loader, and we will then proceed to
934
        the following state:
935
 
936
      * One or more modules are missing and the Loader is available. In this
937
        case, the Loader will be used to resolve the dependency tree for the
938
        missing modules and load them and their dependencies. When the Loader is
939
        finished loading modules, the `use()` callback will be executed
940
        asynchronously.
941
 
942
    @example
943
 
944
        // Loads and attaches dd and its dependencies.
945
        YUI().use('dd', function (Y) {
946
            // ...
947
        });
948
 
949
        // Loads and attaches dd and node as well as all of their dependencies.
950
        YUI().use(['dd', 'node'], function (Y) {
951
            // ...
952
        });
953
 
954
        // Attaches all modules that have already been loaded.
955
        YUI().use('*', function (Y) {
956
            // ...
957
        });
958
 
959
        // Attaches a gallery module.
960
        YUI().use('gallery-yql', function (Y) {
961
            // ...
962
        });
963
 
964
        // Attaches a YUI 2in3 module.
965
        YUI().use('yui2-datatable', function (Y) {
966
            // ...
967
        });
968
 
969
    @method use
970
    @param {String|Array} modules* One or more module names to attach.
971
    @param {Function} [callback] Callback function to be executed once all
972
        specified modules and their dependencies have been attached.
973
    @param {YUI} callback.Y The YUI instance created for this sandbox.
974
    @param {Object} callback.status Object containing `success`, `msg` and
975
        `data` properties.
976
    @chainable
977
    **/
978
    use: function() {
979
        var args = SLICE.call(arguments, 0),
980
            callback = args[args.length - 1],
981
            Y = this,
982
            i = 0,
983
            name,
984
            Env = Y.Env,
985
            provisioned = true;
986
 
987
        // The last argument supplied to use can be a load complete callback
988
        if (Y.Lang.isFunction(callback)) {
989
            args.pop();
990
            if (Y.config.delayUntil) {
991
                callback = Y._delayCallback(callback, Y.config.delayUntil);
992
            }
993
        } else {
994
            callback = null;
995
        }
996
        if (Y.Lang.isArray(args[0])) {
997
            args = args[0];
998
        }
999
 
1000
        if (Y.config.cacheUse) {
1001
            while ((name = args[i++])) {
1002
                if (!Env._attached[name]) {
1003
                    provisioned = false;
1004
                    break;
1005
                }
1006
            }
1007
 
1008
            if (provisioned) {
1009
                if (args.length) {
1010
                }
1011
                Y._notify(callback, ALREADY_DONE, args);
1012
                return Y;
1013
            }
1014
        }
1015
 
1016
        if (Y._loading) {
1017
            Y._useQueue = Y._useQueue || new Y.Queue();
1018
            Y._useQueue.add([args, callback]);
1019
        } else {
1020
            Y._use(args, function(Y, response) {
1021
                Y._notify(callback, response, args);
1022
            });
1023
        }
1024
 
1025
        return Y;
1026
    },
1027
 
1028
    /**
1029
    Sugar for loading both legacy and ES6-based YUI modules.
1030
 
1031
    @method require
1032
    @param {String} [modules*] List of module names to import or a single
1033
        module name.
1034
    @param {Function} callback Callback that gets called once all the modules
1035
        were loaded. Each parameter of the callback is the export value of the
1036
        corresponding module in the list. If the module is a legacy YUI module,
1037
        the YUI instance is used instead of the module exports.
1038
    @example
1039
    ```
1040
    YUI().require(['es6-set'], function (Y, imports) {
1041
        var Set = imports.Set,
1042
            set = new Set();
1043
    });
1044
    ```
1045
    **/
1046
    require: function () {
1047
        var args = SLICE.call(arguments),
1048
            callback;
1049
 
1050
        if (typeof args[args.length - 1] === 'function') {
1051
            callback = args.pop();
1052
 
1053
            // only add the callback if one was provided
1054
            // YUI().require('foo'); is valid
1055
            args.push(function (Y) {
1056
                var i, length = args.length,
1057
                    exported = Y.Env._exported,
1058
                    __imports__ = {};
1059
 
1060
                // Get only the imports requested as arguments
1061
                for (i = 0; i < length; i++) {
1062
                    if (exported.hasOwnProperty(args[i])) {
1063
                        __imports__[args[i]] = exported[args[i]];
1064
                    }
1065
                }
1066
 
1067
                // Using `undefined` because:
1068
                // - Using `Y.config.global` would force the value of `this` to be
1069
                //   the global object even in strict mode
1070
                // - Using `Y` goes against the goal of moving away from a shared
1071
                //   object and start thinking in terms of imported and exported
1072
                //   objects
1073
                callback.call(undefined, Y, __imports__);
1074
            });
1075
        }
1076
        // Do not return the Y object. This makes it hard to follow this
1077
        // traditional pattern:
1078
        //   var Y = YUI().use(...);
1079
        // This is a good idea in the light of ES6 modules, to avoid working
1080
        // in the global scope.
1081
        // This also leaves the door open for returning a promise, once the
1082
        // YUI loader is based on the ES6 loader which uses
1083
        // loader.import(...).then(...)
1084
        this.use.apply(this, args);
1085
    },
1086
 
1087
    /**
1088
    Handles Loader notifications about attachment/load errors.
1089
 
1090
    @method _notify
1091
    @param {Function} callback Callback to pass to `Y.config.loadErrorFn`.
1092
    @param {Object} response Response returned from Loader.
1093
    @param {Array} args Arguments passed from Loader.
1094
    @private
1095
    **/
1096
    _notify: function(callback, response, args) {
1097
        if (!response.success && this.config.loadErrorFn) {
1098
            this.config.loadErrorFn.call(this, this, callback, response, args);
1099
        } else if (callback) {
1100
            if (this.Env._missed && this.Env._missed.length) {
1101
                response.msg = 'Missing modules: ' + this.Env._missed.join();
1102
                response.success = false;
1103
            }
1104
            if (this.config.throwFail) {
1105
                callback(this, response);
1106
            } else {
1107
                try {
1108
                    callback(this, response);
1109
                } catch (e) {
1110
                    this.error('use callback error', e, args);
1111
                }
1112
            }
1113
        }
1114
    },
1115
 
1116
    /**
1117
    Called from the `use` method queue to ensure that only one set of loading
1118
    logic is performed at a time.
1119
 
1120
    @method _use
1121
    @param {String} args* One or more modules to attach.
1122
    @param {Function} [callback] Function to call once all required modules have
1123
        been attached.
1124
    @private
1125
    **/
1126
    _use: function(args, callback) {
1127
 
1128
        if (!this.Array) {
1129
            this._attach(['yui-base']);
1130
        }
1131
 
1132
        var len, loader, handleBoot,
1133
            Y = this,
1134
            G_ENV = YUI.Env,
1135
            mods = G_ENV.mods,
1136
            Env = Y.Env,
1137
            used = Env._used,
1138
            aliases = G_ENV.aliases,
1139
            queue = G_ENV._loaderQueue,
1140
            firstArg = args[0],
1141
            YArray = Y.Array,
1142
            config = Y.config,
1143
            boot = config.bootstrap,
1144
            missing = [],
1145
            i,
1146
            r = [],
1147
            ret = true,
1148
            fetchCSS = config.fetchCSS,
1149
            process = function(names, skip) {
1150
 
1151
                var i = 0, a = [], name, len, m, req, use;
1152
 
1153
                if (!names.length) {
1154
                    return;
1155
                }
1156
 
1157
                if (aliases) {
1158
                    len = names.length;
1159
                    for (i = 0; i < len; i++) {
1160
                        if (aliases[names[i]] && !mods[names[i]]) {
1161
                            a = [].concat(a, aliases[names[i]]);
1162
                        } else {
1163
                            a.push(names[i]);
1164
                        }
1165
                    }
1166
                    names = a;
1167
                }
1168
 
1169
                len = names.length;
1170
 
1171
                for (i = 0; i < len; i++) {
1172
                    name = names[i];
1173
                    if (!skip) {
1174
                        r.push(name);
1175
                    }
1176
 
1177
                    // only attach a module once
1178
                    if (used[name]) {
1179
                        continue;
1180
                    }
1181
 
1182
                    m = mods[name];
1183
                    req = null;
1184
                    use = null;
1185
 
1186
                    if (m) {
1187
                        used[name] = true;
1188
                        req = m.details.requires;
1189
                        use = m.details.use;
1190
                    } else {
1191
                        // CSS files don't register themselves, see if it has
1192
                        // been loaded
1193
                        if (!G_ENV._loaded[VERSION][name]) {
1194
                            missing.push(name);
1195
                        } else {
1196
                            used[name] = true; // probably css
1197
                        }
1198
                    }
1199
 
1200
                    // make sure requirements are attached
1201
                    if (req && req.length) {
1202
                        process(req);
1203
                    }
1204
 
1205
                    // make sure we grab the submodule dependencies too
1206
                    if (use && use.length) {
1207
                        process(use, 1);
1208
                    }
1209
                }
1210
 
1211
            },
1212
 
1213
            handleLoader = function(fromLoader) {
1214
                var response = fromLoader || {
1215
                        success: true,
1216
                        msg: 'not dynamic'
1217
                    },
1218
                    redo, origMissing,
1219
                    ret = true,
1220
                    data = response.data;
1221
 
1222
                Y._loading = false;
1223
 
1224
                if (data) {
1225
                    origMissing = missing;
1226
                    missing = [];
1227
                    r = [];
1228
                    process(data);
1229
                    redo = missing.length;
1230
                    if (redo) {
1231
                        if ([].concat(missing).sort().join() ==
1232
                                origMissing.sort().join()) {
1233
                            redo = false;
1234
                        }
1235
                    }
1236
                }
1237
 
1238
                if (redo && data) {
1239
                    Y._loading = true;
1240
                    Y._use(missing, function() {
1241
                        if (Y._attach(data)) {
1242
                            Y._notify(callback, response, data);
1243
                        }
1244
                    });
1245
                } else {
1246
                    if (data) {
1247
                        ret = Y._attach(data);
1248
                    }
1249
                    if (ret) {
1250
                        Y._notify(callback, response, args);
1251
                    }
1252
                }
1253
 
1254
                if (Y._useQueue && Y._useQueue.size() && !Y._loading) {
1255
                    Y._use.apply(Y, Y._useQueue.next());
1256
                }
1257
 
1258
            };
1259
 
1260
 
1261
        // YUI().use('*'); // bind everything available
1262
        if (firstArg === '*') {
1263
            args = [];
1264
            for (i in mods) {
1265
                if (mods.hasOwnProperty(i)) {
1266
                    args.push(i);
1267
                }
1268
            }
1269
            ret = Y._attach(args);
1270
            if (ret) {
1271
                handleLoader();
1272
            }
1273
            return Y;
1274
        }
1275
 
1276
        if ((mods.loader || mods['loader-base']) && !Y.Loader) {
1277
            Y._attach(['loader' + ((!mods.loader) ? '-base' : '')]);
1278
        }
1279
 
1280
 
1281
        // use loader to expand dependencies and sort the
1282
        // requirements if it is available.
1283
        if (boot && Y.Loader && args.length) {
1284
            loader = getLoader(Y);
1285
            loader.require(args);
1286
            loader.ignoreRegistered = true;
1287
            loader._boot = true;
1288
            loader.calculate(null, (fetchCSS) ? null : 'js');
1289
            args = loader.sorted;
1290
            loader._boot = false;
1291
        }
1292
 
1293
        process(args);
1294
 
1295
        len = missing.length;
1296
 
1297
 
1298
        if (len) {
1299
            missing = YArray.dedupe(missing);
1300
            len = missing.length;
1301
        }
1302
 
1303
 
1304
        // dynamic load
1305
        if (boot && len && Y.Loader) {
1306
            Y._loading = true;
1307
            loader = getLoader(Y);
1308
            loader.onEnd = handleLoader;
1309
            loader.context = Y;
1310
            loader.data = args;
1311
            loader.ignoreRegistered = false;
1312
            loader.require(missing);
1313
            loader.insert(null, (fetchCSS) ? null : 'js');
1314
 
1315
        } else if (boot && len && Y.Get && !Env.bootstrapped) {
1316
 
1317
            Y._loading = true;
1318
 
1319
            handleBoot = function() {
1320
                Y._loading = false;
1321
                queue.running = false;
1322
                Env.bootstrapped = true;
1323
                G_ENV._bootstrapping = false;
1324
                if (Y._attach(['loader'])) {
1325
                    Y._use(args, callback);
1326
                }
1327
            };
1328
 
1329
            if (G_ENV._bootstrapping) {
1330
                queue.add(handleBoot);
1331
            } else {
1332
                G_ENV._bootstrapping = true;
1333
                Y.Get.script(config.base + config.loaderPath, {
1334
                    onEnd: handleBoot
1335
                });
1336
            }
1337
 
1338
        } else {
1339
            ret = Y._attach(args);
1340
            if (ret) {
1341
                handleLoader();
1342
            }
1343
        }
1344
 
1345
        return Y;
1346
    },
1347
 
1348
 
1349
    /**
1350
    Utility method for safely creating namespaces if they don't already exist.
1351
    May be called statically on the YUI global object or as a method on a YUI
1352
    instance.
1353
 
1354
    When called statically, a namespace will be created on the YUI global
1355
    object:
1356
 
1357
        // Create `YUI.your.namespace.here` as nested objects, preserving any
1358
        // objects that already exist instead of overwriting them.
1359
        YUI.namespace('your.namespace.here');
1360
 
1361
    When called as a method on a YUI instance, a namespace will be created on
1362
    that instance:
1363
 
1364
        // Creates `Y.property.package`.
1365
        Y.namespace('property.package');
1366
 
1367
    Dots in the input string cause `namespace` to create nested objects for each
1368
    token. If any part of the requested namespace already exists, the current
1369
    object will be left in place and will not be overwritten. This allows
1370
    multiple calls to `namespace` to preserve existing namespaced properties.
1371
 
1372
    If the first token in the namespace string is "YAHOO", that token is
1373
    discarded. This is legacy behavior for backwards compatibility with YUI 2.
1374
 
1375
    Be careful with namespace tokens. Reserved words may work in some browsers
1376
    and not others. For instance, the following will fail in some browsers
1377
    because the supported version of JavaScript reserves the word "long":
1378
 
1379
        Y.namespace('really.long.nested.namespace');
1380
 
1381
    Note: If you pass multiple arguments to create multiple namespaces, only the
1382
    last one created is returned from this function.
1383
 
1384
    @method namespace
1385
    @param {String} namespace* One or more namespaces to create.
1386
    @return {Object} Reference to the last namespace object created.
1387
    **/
1388
    namespace: function() {
1389
        var a = arguments, o, i = 0, j, d, arg;
1390
 
1391
        for (; i < a.length; i++) {
1392
            o = this; //Reset base object per argument or it will get reused from the last
1393
            arg = a[i];
1394
            if (arg.indexOf(PERIOD) > -1) { //Skip this if no "." is present
1395
                d = arg.split(PERIOD);
1396
                for (j = (d[0] == 'YAHOO') ? 1 : 0; j < d.length; j++) {
1397
                    o[d[j]] = o[d[j]] || {};
1398
                    o = o[d[j]];
1399
                }
1400
            } else {
1401
                o[arg] = o[arg] || {};
1402
                o = o[arg]; //Reset base object to the new object so it's returned
1403
            }
1404
        }
1405
        return o;
1406
    },
1407
 
1408
    // this is replaced if the log module is included
1409
    log: NOOP,
1410
    message: NOOP,
1411
    // this is replaced if the dump module is included
1412
    dump: function (o) { return ''+o; },
1413
 
1414
    /**
1415
    Reports an error.
1416
 
1417
    The reporting mechanism is controlled by the `throwFail` configuration
1418
    attribute. If `throwFail` is falsy, the message is logged. If `throwFail` is
1419
    truthy, a JS exception is thrown.
1420
 
1421
    If an `errorFn` is specified in the config it must return `true` to indicate
1422
    that the exception was handled and keep it from being thrown.
1423
 
1424
    @method error
1425
    @param {String} msg Error message.
1426
    @param {Error|String} [e] JavaScript error object or an error string.
1427
    @param {String} [src] Source of the error (such as the name of the module in
1428
        which the error occurred).
1429
    @chainable
1430
    **/
1431
    error: function(msg, e, src) {
1432
        //TODO Add check for window.onerror here
1433
 
1434
        var Y = this, ret;
1435
 
1436
        if (Y.config.errorFn) {
1437
            ret = Y.config.errorFn.apply(Y, arguments);
1438
        }
1439
 
1440
        if (!ret) {
1441
            throw (e || new Error(msg));
1442
        } else {
1443
            Y.message(msg, 'error', ''+src); // don't scrub this one
1444
        }
1445
 
1446
        return Y;
1447
    },
1448
 
1449
    /**
1450
    Generates an id string that is unique among all YUI instances in this
1451
    execution context.
1452
 
1453
    @method guid
1454
    @param {String} [pre] Prefix.
1455
    @return {String} Unique id.
1456
    **/
1457
    guid: function(pre) {
1458
        var id = this.Env._guidp + '_' + (++this.Env._uidx);
1459
        return (pre) ? (pre + id) : id;
1460
    },
1461
 
1462
    /**
1463
    Returns a unique id associated with the given object and (if *readOnly* is
1464
    falsy) stamps the object with that id so it can be identified in the future.
1465
 
1466
    Stamping an object involves adding a `_yuid` property to it that contains
1467
    the object's id. One exception to this is that in Internet Explorer, DOM
1468
    nodes have a `uniqueID` property that contains a browser-generated unique
1469
    id, which will be used instead of a YUI-generated id when available.
1470
 
1471
    @method stamp
1472
    @param {Object} o Object to stamp.
1473
    @param {Boolean} readOnly If truthy and the given object has not already
1474
        been stamped, the object will not be modified and `null` will be
1475
        returned.
1476
    @return {String} Object's unique id, or `null` if *readOnly* was truthy and
1477
        the given object was not already stamped.
1478
    **/
1479
    stamp: function(o, readOnly) {
1480
        var uid;
1481
        if (!o) {
1482
            return o;
1483
        }
1484
 
1485
        // IE generates its own unique ID for dom nodes
1486
        // The uniqueID property of a document node returns a new ID
1487
        if (o.uniqueID && o.nodeType && o.nodeType !== 9) {
1488
            uid = o.uniqueID;
1489
        } else {
1490
            uid = (typeof o === 'string') ? o : o._yuid;
1491
        }
1492
 
1493
        if (!uid) {
1494
            uid = this.guid();
1495
            if (!readOnly) {
1496
                try {
1497
                    o._yuid = uid;
1498
                } catch (e) {
1499
                    uid = null;
1500
                }
1501
            }
1502
        }
1503
        return uid;
1504
    },
1505
 
1506
    /**
1507
    Destroys this YUI instance.
1508
 
1509
    @method destroy
1510
    @since 3.3.0
1511
    **/
1512
    destroy: function() {
1513
        var Y = this;
1514
        if (Y.Event) {
1515
            Y.Event._unload();
1516
        }
1517
        delete instances[Y.id];
1518
        delete Y.Env;
1519
        delete Y.config;
1520
    }
1521
 
1522
    /**
1523
    Safe `instanceof` wrapper that works around a memory leak in IE when the
1524
    object being tested is `window` or `document`.
1525
 
1526
    Unless you are testing objects that may be `window` or `document`, you
1527
    should use the native `instanceof` operator instead of this method.
1528
 
1529
    @method instanceOf
1530
    @param {Object} o Object to check.
1531
    @param {Object} type Class to check against.
1532
    @since 3.3.0
1533
    **/
1534
};
1535
 
1536
    YUI.prototype = proto;
1537
 
1538
    // inheritance utilities are not available yet
1539
    for (prop in proto) {
1540
        if (proto.hasOwnProperty(prop)) {
1541
            YUI[prop] = proto[prop];
1542
        }
1543
    }
1544
 
1545
    /**
1546
    Applies a configuration to all YUI instances in this execution context.
1547
 
1548
    The main use case for this method is in "mashups" where several third-party
1549
    scripts need to write to a global YUI config, but cannot share a single
1550
    centrally-managed config object. This way they can all call
1551
    `YUI.applyConfig({})` instead of overwriting the single global config.
1552
 
1553
    @example
1554
 
1555
        YUI.applyConfig({
1556
            modules: {
1557
                davglass: {
1558
                    fullpath: './davglass.js'
1559
                }
1560
            }
1561
        });
1562
 
1563
        YUI.applyConfig({
1564
            modules: {
1565
                foo: {
1566
                    fullpath: './foo.js'
1567
                }
1568
            }
1569
        });
1570
 
1571
        YUI().use('davglass', function (Y) {
1572
            // Module davglass will be available here.
1573
        });
1574
 
1575
    @method applyConfig
1576
    @param {Object} o Configuration object to apply.
1577
    @static
1578
    @since 3.5.0
1579
    **/
1580
    YUI.applyConfig = function(o) {
1581
        if (!o) {
1582
            return;
1583
        }
1584
        //If there is a GlobalConfig, apply it first to set the defaults
1585
        if (YUI.GlobalConfig) {
1586
            this.prototype.applyConfig.call(this, YUI.GlobalConfig);
1587
        }
1588
        //Apply this config to it
1589
        this.prototype.applyConfig.call(this, o);
1590
        //Reset GlobalConfig to the combined config
1591
        YUI.GlobalConfig = this.config;
1592
    };
1593
 
1594
    // set up the environment
1595
    YUI._init();
1596
 
1597
    if (hasWin) {
1598
        add(doc, 'DOMContentLoaded', handleReady);
1599
 
1600
        // add a window load event at load time so we can capture
1601
        // the case where it fires before dynamic loading is
1602
        // complete.
1603
        add(window, 'load', handleLoad);
1604
    } else {
1605
        handleReady();
1606
        handleLoad();
1607
    }
1608
 
1609
    YUI.Env.add = add;
1610
    YUI.Env.remove = remove;
1611
 
1612
    /*global exports*/
1613
    // Support the CommonJS method for exporting our single global
1614
    if (typeof exports == 'object') {
1615
        exports.YUI = YUI;
1616
        /**
1617
        * Set a method to be called when `Get.script` is called in Node.js
1618
        * `Get` will open the file, then pass it's content and it's path
1619
        * to this method before attaching it. Commonly used for code coverage
1620
        * instrumentation. <strong>Calling this multiple times will only
1621
        * attach the last hook method</strong>. This method is only
1622
        * available in Node.js.
1623
        * @method setLoadHook
1624
        * @static
1625
        * @param {Function} fn The function to set
1626
        * @param {String} fn.data The content of the file
1627
        * @param {String} fn.path The file path of the file
1628
        */
1629
        YUI.setLoadHook = function(fn) {
1630
            YUI._getLoadHook = fn;
1631
        };
1632
        /**
1633
        * Load hook for `Y.Get.script` in Node.js, see `YUI.setLoadHook`
1634
        * @method _getLoadHook
1635
        * @private
1636
        * @param {String} data The content of the file
1637
        * @param {String} path The file path of the file
1638
        */
1639
        YUI._getLoadHook = null;
1640
    }
1641
 
1642
    YUI.Env[VERSION] = {};
1643
}());
1644
 
1645
 
1646
/**
1647
Config object that contains all of the configuration options for
1648
this `YUI` instance.
1649
 
1650
This object is supplied by the implementer when instantiating YUI. Some
1651
properties have default values if they are not supplied by the implementer.
1652
 
1653
This object should not be updated directly because some values are cached. Use
1654
`applyConfig()` to update the config object on a YUI instance that has already
1655
been configured.
1656
 
1657
@class config
1658
@static
1659
**/
1660
 
1661
/**
1662
If `true` (the default), YUI will "bootstrap" the YUI Loader and module metadata
1663
if they're needed to load additional dependencies and aren't already available.
1664
 
1665
Setting this to `false` will prevent YUI from automatically loading the Loader
1666
and module metadata, so you will need to manually ensure that they're available
1667
or handle dependency resolution yourself.
1668
 
1669
@property {Boolean} bootstrap
1670
@default true
1671
**/
1672
 
1673
/**
1674
 
1675
@property {Object} filters
1676
**/
1677
 
1678
/**
1679
If `true`, YUI will use a combo handler to load multiple modules in as few
1680
requests as possible.
1681
 
1682
The YUI CDN (which YUI uses by default) supports combo handling, but other
1683
servers may not. If the server from which you're loading YUI does not support
1684
combo handling, set this to `false`.
1685
 
1686
Providing a value for the `base` config property will cause `combine` to default
1687
to `false` instead of `true`.
1688
 
1689
@property {Boolean} combine
1690
@default true
1691
*/
1692
 
1693
/**
1694
Array of module names that should never be dynamically loaded.
1695
 
1696
@property {String[]} ignore
1697
**/
1698
 
1699
/**
1700
Array of module names that should always be loaded when required, even if
1701
already present on the page.
1702
 
1703
@property {String[]} force
1704
**/
1705
 
1706
/**
1707
DOM element or id that should be used as the insertion point for dynamically
1708
added `<script>` and `<link>` nodes.
1709
 
1710
@property {HTMLElement|String} insertBefore
1711
**/
1712
 
1713
/**
1714
Object hash containing attributes to add to dynamically added `<script>` nodes.
1715
 
1716
@property {Object} jsAttributes
1717
**/
1718
 
1719
/**
1720
Object hash containing attributes to add to dynamically added `<link>` nodes.
1721
 
1722
@property {Object} cssAttributes
1723
**/
1724
 
1725
/**
1726
Timeout in milliseconds before a dynamic JS or CSS request will be considered a
1727
failure. If not set, no timeout will be enforced.
1728
 
1729
@property {Number} timeout
1730
**/
1731
 
1732
/**
1733
A hash of module definitions to add to the list of available YUI modules. These
1734
modules can then be dynamically loaded via the `use()` method.
1735
 
1736
This is a hash in which keys are module names and values are objects containing
1737
module metadata.
1738
 
1739
See `Loader.addModule()` for the supported module metadata fields. Also see
1740
`groups`, which provides a way to configure the base and combo spec for a set of
1741
modules.
1742
 
1743
@example
1744
 
1745
    modules: {
1746
        mymod1: {
1747
            requires: ['node'],
1748
            fullpath: '/mymod1/mymod1.js'
1749
        },
1750
 
1751
        mymod2: {
1752
            requires: ['mymod1'],
1753
            fullpath: '/mymod2/mymod2.js'
1754
        },
1755
 
1756
        mymod3: '/js/mymod3.js',
1757
        mycssmod: '/css/mycssmod.css'
1758
    }
1759
 
1760
@property {Object} modules
1761
**/
1762
 
1763
/**
1764
Aliases are dynamic groups of modules that can be used as shortcuts.
1765
 
1766
@example
1767
 
1768
    YUI({
1769
        aliases: {
1770
            davglass: [ 'node', 'yql', 'dd' ],
1771
            mine: [ 'davglass', 'autocomplete']
1772
        }
1773
    }).use('mine', function (Y) {
1774
        // Node, YQL, DD & AutoComplete available here.
1775
    });
1776
 
1777
@property {Object} aliases
1778
**/
1779
 
1780
/**
1781
A hash of module group definitions.
1782
 
1783
For each group you can specify a list of modules and the base path and
1784
combo spec to use when dynamically loading the modules.
1785
 
1786
@example
1787
 
1788
    groups: {
1789
        yui2: {
1790
            // specify whether or not this group has a combo service
1791
            combine: true,
1792
 
1793
            // The comboSeperator to use with this group's combo handler
1794
            comboSep: ';',
1795
 
1796
            // The maxURLLength for this server
1797
            maxURLLength: 500,
1798
 
1799
            // the base path for non-combo paths
1800
            base: 'http://yui.yahooapis.com/2.8.0r4/build/',
1801
 
1802
            // the path to the combo service
1803
            comboBase: 'http://yui.yahooapis.com/combo?',
1804
 
1805
            // a fragment to prepend to the path attribute when
1806
            // when building combo urls
1807
            root: '2.8.0r4/build/',
1808
 
1809
            // the module definitions
1810
            modules:  {
1811
                yui2_yde: {
1812
                    path: "yahoo-dom-event/yahoo-dom-event.js"
1813
                },
1814
                yui2_anim: {
1815
                    path: "animation/animation.js",
1816
                    requires: ['yui2_yde']
1817
                }
1818
            }
1819
        }
1820
    }
1821
 
1822
@property {Object} groups
1823
**/
1824
 
1825
/**
1826
Path to the Loader JS file, relative to the `base` path.
1827
 
1828
This is used to dynamically bootstrap the Loader when it's needed and isn't yet
1829
available.
1830
 
1831
@property {String} loaderPath
1832
@default "loader/loader-min.js"
1833
**/
1834
 
1835
/**
1836
If `true`, YUI will attempt to load CSS dependencies and skins. Set this to
1837
`false` to prevent YUI from loading any CSS, or set it to the string `"force"`
1838
to force CSS dependencies to be loaded even if their associated JS modules are
1839
already loaded.
1840
 
1841
@property {Boolean|String} fetchCSS
1842
@default true
1843
**/
1844
 
1845
/**
1846
Default gallery version used to build gallery module urls.
1847
 
1848
@property {String} gallery
1849
@since 3.1.0
1850
**/
1851
 
1852
/**
1853
Default YUI 2 version used to build YUI 2 module urls.
1854
 
1855
This is used for intrinsic YUI 2 support via the 2in3 project. Also see the
1856
`2in3` config for pulling different revisions of the wrapped YUI 2 modules.
1857
 
1858
@property {String} yui2
1859
@default "2.9.0"
1860
@since 3.1.0
1861
**/
1862
 
1863
/**
1864
Revision number of YUI 2in3 modules that should be used when loading YUI 2in3.
1865
 
1866
@property {String} 2in3
1867
@default "4"
1868
@since 3.1.0
1869
**/
1870
 
1871
/**
1872
Alternate console log function that should be used in environments without a
1873
supported native console. This function is executed with the YUI instance as its
1874
`this` object.
1875
 
1876
@property {Function} logFn
1877
@since 3.1.0
1878
**/
1879
 
1880
/**
1881
The minimum log level to log messages for. Log levels are defined
1882
incrementally. Messages greater than or equal to the level specified will
1883
be shown. All others will be discarded. The order of log levels in
1884
increasing priority is:
1885
 
1886
    debug
1887
    info
1888
    warn
1889
    error
1890
 
1891
@property {String} logLevel
1892
@default 'debug'
1893
@since 3.10.0
1894
**/
1895
 
1896
/**
1897
Callback to execute when `Y.error()` is called. It receives the error message
1898
and a JavaScript error object if one was provided.
1899
 
1900
This function is executed with the YUI instance as its `this` object.
1901
 
1902
Returning `true` from this function will prevent an exception from being thrown.
1903
 
1904
@property {Function} errorFn
1905
@param {String} errorFn.msg Error message
1906
@param {Object} [errorFn.err] Error object (if one was provided).
1907
@since 3.2.0
1908
**/
1909
 
1910
/**
1911
A callback to execute when Loader fails to load one or more resources.
1912
 
1913
This could be because of a script load failure. It could also be because a
1914
module fails to register itself when the `requireRegistration` config is `true`.
1915
 
1916
If this function is defined, the `use()` callback will only be called when the
1917
loader succeeds. Otherwise, `use()` will always executes unless there was a
1918
JavaScript error when attaching a module.
1919
 
1920
@property {Function} loadErrorFn
1921
@since 3.3.0
1922
**/
1923
 
1924
/**
1925
If `true`, Loader will expect all loaded scripts to be first-class YUI modules
1926
that register themselves with the YUI global, and will trigger a failure if a
1927
loaded script does not register a YUI module.
1928
 
1929
@property {Boolean} requireRegistration
1930
@default false
1931
@since 3.3.0
1932
**/
1933
 
1934
/**
1935
Cache serviced use() requests.
1936
 
1937
@property {Boolean} cacheUse
1938
@default true
1939
@since 3.3.0
1940
@deprecated No longer used.
1941
**/
1942
 
1943
/**
1944
Whether or not YUI should use native ES5 functionality when available for
1945
features like `Y.Array.each()`, `Y.Object()`, etc.
1946
 
1947
When `false`, YUI will always use its own fallback implementations instead of
1948
relying on ES5 functionality, even when ES5 functionality is available.
1949
 
1950
@property {Boolean} useNativeES5
1951
@default true
1952
@since 3.5.0
1953
**/
1954
 
1955
/**
1956
 * Leverage native JSON stringify if the browser has a native
1957
 * implementation.  In general, this is a good idea.  See the Known Issues
1958
 * section in the JSON user guide for caveats.  The default value is true
1959
 * for browsers with native JSON support.
1960
 *
1961
 * @property useNativeJSONStringify
1962
 * @type Boolean
1963
 * @default true
1964
 * @since 3.8.0
1965
 */
1966
 
1967
 /**
1968
 * Leverage native JSON parse if the browser has a native implementation.
1969
 * In general, this is a good idea.  See the Known Issues section in the
1970
 * JSON user guide for caveats.  The default value is true for browsers with
1971
 * native JSON support.
1972
 *
1973
 * @property useNativeJSONParse
1974
 * @type Boolean
1975
 * @default true
1976
 * @since 3.8.0
1977
 */
1978
 
1979
/**
1980
Delay the `use` callback until a specific event has passed (`load`, `domready`, `contentready` or `available`)
1981
 
1982
@property {Object|String} delayUntil
1983
@since 3.6.0
1984
@example
1985
 
1986
You can use `load` or `domready` strings by default:
1987
 
1988
    YUI({
1989
        delayUntil: 'domready'
1990
    }, function (Y) {
1991
        // This will not execute until 'domeready' occurs.
1992
    });
1993
 
1994
Or you can delay until a node is available (with `available` or `contentready`):
1995
 
1996
    YUI({
1997
        delayUntil: {
1998
            event: 'available',
1999
            args : '#foo'
2000
        }
2001
    }, function (Y) {
2002
        // This will not execute until a node matching the selector "#foo" is
2003
        // available in the DOM.
2004
    });
2005
 
2006
**/
2007
YUI.add('yui-base', function (Y, NAME) {
2008
 
2009
/*
2010
 * YUI stub
2011
 * @module yui
2012
 * @submodule yui-base
2013
 */
2014
/**
2015
 * The YUI module contains the components required for building the YUI
2016
 * seed file.  This includes the script loading mechanism, a simple queue,
2017
 * and the core utilities for the library.
2018
 * @module yui
2019
 * @submodule yui-base
2020
 */
2021
 
2022
/**
2023
 * Provides core language utilites and extensions used throughout YUI.
2024
 *
2025
 * @class Lang
2026
 * @static
2027
 */
2028
 
2029
var L = Y.Lang || (Y.Lang = {}),
2030
 
2031
STRING_PROTO = String.prototype,
2032
TOSTRING     = Object.prototype.toString,
2033
 
2034
TYPES = {
2035
    'undefined'        : 'undefined',
2036
    'number'           : 'number',
2037
    'boolean'          : 'boolean',
2038
    'string'           : 'string',
2039
    '[object Function]': 'function',
2040
    '[object RegExp]'  : 'regexp',
2041
    '[object Array]'   : 'array',
2042
    '[object Date]'    : 'date',
2043
    '[object Error]'   : 'error'
2044
},
2045
 
2046
SUBREGEX         = /\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}/g,
2047
 
2048
WHITESPACE       = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF",
2049
WHITESPACE_CLASS = "[\x09-\x0D\x20\xA0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+",
2050
TRIM_LEFT_REGEX  = new RegExp("^" + WHITESPACE_CLASS),
2051
TRIM_RIGHT_REGEX = new RegExp(WHITESPACE_CLASS + "$"),
2052
TRIMREGEX        = new RegExp(TRIM_LEFT_REGEX.source + "|" + TRIM_RIGHT_REGEX.source, "g"),
2053
 
2054
NATIVE_FN_REGEX  = /\{\s*\[(?:native code|function)\]\s*\}/i;
2055
 
2056
// -- Protected Methods --------------------------------------------------------
2057
 
2058
/**
2059
Returns `true` if the given function appears to be implemented in native code,
2060
`false` otherwise. Will always return `false` -- even in ES5-capable browsers --
2061
if the `useNativeES5` YUI config option is set to `false`.
2062
 
2063
This isn't guaranteed to be 100% accurate and won't work for anything other than
2064
functions, but it can be useful for determining whether a function like
2065
`Array.prototype.forEach` is native or a JS shim provided by another library.
2066
 
2067
There's a great article by @kangax discussing certain flaws with this technique:
2068
<http://perfectionkills.com/detecting-built-in-host-methods/>
2069
 
2070
While his points are valid, it's still possible to benefit from this function
2071
as long as it's used carefully and sparingly, and in such a way that false
2072
negatives have minimal consequences. It's used internally to avoid using
2073
potentially broken non-native ES5 shims that have been added to the page by
2074
other libraries.
2075
 
2076
@method _isNative
2077
@param {Function} fn Function to test.
2078
@return {Boolean} `true` if _fn_ appears to be native, `false` otherwise.
2079
@static
2080
@protected
2081
@since 3.5.0
2082
**/
2083
L._isNative = function (fn) {
2084
    return !!(Y.config.useNativeES5 && fn && NATIVE_FN_REGEX.test(fn));
2085
};
2086
 
2087
// -- Public Methods -----------------------------------------------------------
2088
 
2089
/**
2090
 * Determines whether or not the provided item is an array.
2091
 *
2092
 * Returns `false` for array-like collections such as the function `arguments`
2093
 * collection or `HTMLElement` collections. Use `Y.Array.test()` if you want to
2094
 * test for an array-like collection.
2095
 *
2096
 * @method isArray
2097
 * @param o The object to test.
2098
 * @return {boolean} true if o is an array.
2099
 * @static
2100
 */
2101
L.isArray = L._isNative(Array.isArray) ? Array.isArray : function (o) {
2102
    return L.type(o) === 'array';
2103
};
2104
 
2105
/**
2106
 * Determines whether or not the provided item is a boolean.
2107
 * @method isBoolean
2108
 * @static
2109
 * @param o The object to test.
2110
 * @return {boolean} true if o is a boolean.
2111
 */
2112
L.isBoolean = function(o) {
2113
    return typeof o === 'boolean';
2114
};
2115
 
2116
/**
2117
 * Determines whether or not the supplied item is a date instance.
2118
 * @method isDate
2119
 * @static
2120
 * @param o The object to test.
2121
 * @return {boolean} true if o is a date.
2122
 */
2123
L.isDate = function(o) {
2124
    return L.type(o) === 'date' && o.toString() !== 'Invalid Date' && !isNaN(o);
2125
};
2126
 
2127
/**
2128
 * <p>
2129
 * Determines whether or not the provided item is a function.
2130
 * Note: Internet Explorer thinks certain functions are objects:
2131
 * </p>
2132
 *
2133
 * <pre>
2134
 * var obj = document.createElement("object");
2135
 * Y.Lang.isFunction(obj.getAttribute) // reports false in IE
2136
 * &nbsp;
2137
 * var input = document.createElement("input"); // append to body
2138
 * Y.Lang.isFunction(input.focus) // reports false in IE
2139
 * </pre>
2140
 *
2141
 * <p>
2142
 * You will have to implement additional tests if these functions
2143
 * matter to you.
2144
 * </p>
2145
 *
2146
 * @method isFunction
2147
 * @static
2148
 * @param o The object to test.
2149
 * @return {boolean} true if o is a function.
2150
 */
2151
L.isFunction = function(o) {
2152
    return L.type(o) === 'function';
2153
};
2154
 
2155
/**
2156
 * Determines whether or not the provided item is null.
2157
 * @method isNull
2158
 * @static
2159
 * @param o The object to test.
2160
 * @return {boolean} true if o is null.
2161
 */
2162
L.isNull = function(o) {
2163
    return o === null;
2164
};
2165
 
2166
/**
2167
 * Determines whether or not the provided item is a legal number.
2168
 * @method isNumber
2169
 * @static
2170
 * @param o The object to test.
2171
 * @return {boolean} true if o is a number.
2172
 */
2173
L.isNumber = function(o) {
2174
    return typeof o === 'number' && isFinite(o);
2175
};
2176
 
2177
/**
2178
 * Determines whether or not the provided item is of type object
2179
 * or function. Note that arrays are also objects, so
2180
 * <code>Y.Lang.isObject([]) === true</code>.
2181
 * @method isObject
2182
 * @static
2183
 * @param o The object to test.
2184
 * @param failfn {boolean} fail if the input is a function.
2185
 * @return {boolean} true if o is an object.
2186
 * @see isPlainObject
2187
 */
2188
L.isObject = function(o, failfn) {
2189
    var t = typeof o;
2190
    return (o && (t === 'object' ||
2191
        (!failfn && (t === 'function' || L.isFunction(o))))) || false;
2192
};
2193
 
2194
/**
2195
 * Determines whether or not the provided value is a regexp.
2196
 * @method isRegExp
2197
 * @static
2198
 * @param value The value or object to test.
2199
 * @return {boolean} true if value is a regexp.
2200
 */
2201
L.isRegExp = function(value) {
2202
    return L.type(value) === 'regexp';
2203
};
2204
 
2205
/**
2206
 * Determines whether or not the provided item is a string.
2207
 * @method isString
2208
 * @static
2209
 * @param o The object to test.
2210
 * @return {boolean} true if o is a string.
2211
 */
2212
L.isString = function(o) {
2213
    return typeof o === 'string';
2214
};
2215
 
2216
/**
2217
 * Determines whether or not the provided item is undefined.
2218
 * @method isUndefined
2219
 * @static
2220
 * @param o The object to test.
2221
 * @return {boolean} true if o is undefined.
2222
 */
2223
L.isUndefined = function(o) {
2224
    return typeof o === 'undefined';
2225
};
2226
 
2227
/**
2228
 * A convenience method for detecting a legitimate non-null value.
2229
 * Returns false for null/undefined/NaN, true for other values,
2230
 * including 0/false/''
2231
 * @method isValue
2232
 * @static
2233
 * @param o The item to test.
2234
 * @return {boolean} true if it is not null/undefined/NaN || false.
2235
 */
2236
L.isValue = function(o) {
2237
    var t = L.type(o);
2238
 
2239
    switch (t) {
2240
        case 'number':
2241
            return isFinite(o);
2242
 
2243
        case 'null': // fallthru
2244
        case 'undefined':
2245
            return false;
2246
 
2247
        default:
2248
            return !!t;
2249
    }
2250
};
2251
 
2252
/**
2253
 * Returns the current time in milliseconds.
2254
 *
2255
 * @method now
2256
 * @return {Number} Current time in milliseconds.
2257
 * @static
2258
 * @since 3.3.0
2259
 */
2260
L.now = Date.now || function () {
2261
    return new Date().getTime();
2262
};
2263
 
2264
/**
2265
 * Performs `{placeholder}` substitution on a string. The object passed as the
2266
 * second parameter provides values to replace the `{placeholder}`s.
2267
 * `{placeholder}` token names must match property names of the object. For example,
2268
 *
2269
 *`var greeting = Y.Lang.sub("Hello, {who}!", { who: "World" });`
2270
 *
2271
 * `{placeholder}` tokens that are undefined on the object map will be left
2272
 * in tact (leaving unsightly `{placeholder}`'s in the output string).
2273
 *
2274
 * @method sub
2275
 * @param {string} s String to be modified.
2276
 * @param {object} o Object containing replacement values.
2277
 * @return {string} the substitute result.
2278
 * @static
2279
 * @since 3.2.0
2280
 */
2281
L.sub = function(s, o) {
2282
 
2283
    /**
2284
    Finds the value of `key` in given object.
2285
    If the key has a 'dot' notation e.g. 'foo.bar.baz', the function will
2286
    try to resolve this path if it doesn't exist as a property
2287
    @example
2288
        value({ 'a.b': 1, a: { b: 2 } }, 'a.b'); // 1
2289
        value({ a: { b: 2 } }          , 'a.b'); // 2
2290
    @param {Object} obj A key/value pairs object
2291
    @param {String} key
2292
    @return {Any}
2293
    @private
2294
    **/
2295
    function value(obj, key) {
2296
 
2297
        var subkey;
2298
 
2299
        if ( typeof obj[key] !== 'undefined' ) {
2300
            return obj[key];
2301
        }
2302
 
2303
        key    = key.split('.');         // given 'a.b.c'
2304
        subkey = key.slice(1).join('.'); // 'b.c'
2305
        key    = key[0];                 // 'a'
2306
 
2307
        // special case for null as typeof returns object and we don't want that.
2308
        if ( subkey && typeof obj[key] === 'object' && obj[key] !== null ) {
2309
            return value(obj[key], subkey);
2310
        }
2311
    }
2312
 
2313
    return s.replace ? s.replace(SUBREGEX, function (match, key) {
2314
        var val = key.indexOf('.')>-1 ? value(o, key) : o[key];
2315
        return typeof val === 'undefined' ? match : val;
2316
    }) : s;
2317
};
2318
 
2319
/**
2320
 * Returns a string without any leading or trailing whitespace.  If
2321
 * the input is not a string, the input will be returned untouched.
2322
 * @method trim
2323
 * @static
2324
 * @param s {string} the string to trim.
2325
 * @return {string} the trimmed string.
2326
 */
2327
L.trim = L._isNative(STRING_PROTO.trim) && !WHITESPACE.trim() ? function(s) {
2328
    return s && s.trim ? s.trim() : s;
2329
} : function (s) {
2330
    try {
2331
        return s.replace(TRIMREGEX, '');
2332
    } catch (e) {
2333
        return s;
2334
    }
2335
};
2336
 
2337
/**
2338
 * Returns a string without any leading whitespace.
2339
 * @method trimLeft
2340
 * @static
2341
 * @param s {string} the string to trim.
2342
 * @return {string} the trimmed string.
2343
 */
2344
L.trimLeft = L._isNative(STRING_PROTO.trimLeft) && !WHITESPACE.trimLeft() ? function (s) {
2345
    return s.trimLeft();
2346
} : function (s) {
2347
    return s.replace(TRIM_LEFT_REGEX, '');
2348
};
2349
 
2350
/**
2351
 * Returns a string without any trailing whitespace.
2352
 * @method trimRight
2353
 * @static
2354
 * @param s {string} the string to trim.
2355
 * @return {string} the trimmed string.
2356
 */
2357
L.trimRight = L._isNative(STRING_PROTO.trimRight) && !WHITESPACE.trimRight() ? function (s) {
2358
    return s.trimRight();
2359
} : function (s) {
2360
    return s.replace(TRIM_RIGHT_REGEX, '');
2361
};
2362
 
2363
/**
2364
Returns one of the following strings, representing the type of the item passed
2365
in:
2366
 
2367
 * "array"
2368
 * "boolean"
2369
 * "date"
2370
 * "error"
2371
 * "function"
2372
 * "null"
2373
 * "number"
2374
 * "object"
2375
 * "regexp"
2376
 * "string"
2377
 * "undefined"
2378
 
2379
Known issues:
2380
 
2381
 * `typeof HTMLElementCollection` returns function in Safari, but
2382
    `Y.Lang.type()` reports "object", which could be a good thing --
2383
    but it actually caused the logic in <code>Y.Lang.isObject</code> to fail.
2384
 
2385
@method type
2386
@param o the item to test.
2387
@return {string} the detected type.
2388
@static
2389
**/
2390
L.type = function(o) {
2391
    return TYPES[typeof o] || TYPES[TOSTRING.call(o)] || (o ? 'object' : 'null');
2392
};
2393
/**
2394
@module yui
2395
@submodule yui-base
2396
*/
2397
 
2398
var Lang   = Y.Lang,
2399
    Native = Array.prototype,
2400
 
2401
    hasOwn = Object.prototype.hasOwnProperty;
2402
 
2403
/**
2404
Provides utility methods for working with arrays. Additional array helpers can
2405
be found in the `collection` and `array-extras` modules.
2406
 
2407
`Y.Array(thing)` returns a native array created from _thing_. Depending on
2408
_thing_'s type, one of the following will happen:
2409
 
2410
  * Arrays are returned unmodified unless a non-zero _startIndex_ is
2411
    specified.
2412
  * Array-like collections (see `Array.test()`) are converted to arrays.
2413
  * For everything else, a new array is created with _thing_ as the sole
2414
    item.
2415
 
2416
Note: elements that are also collections, such as `<form>` and `<select>`
2417
elements, are not automatically converted to arrays. To force a conversion,
2418
pass `true` as the value of the _force_ parameter.
2419
 
2420
@class Array
2421
@constructor
2422
@param {Any} thing The thing to arrayify.
2423
@param {Number} [startIndex=0] If non-zero and _thing_ is an array or array-like
2424
  collection, a subset of items starting at the specified index will be
2425
  returned.
2426
@param {Boolean} [force=false] If `true`, _thing_ will be treated as an
2427
  array-like collection no matter what.
2428
@return {Array} A native array created from _thing_, according to the rules
2429
  described above.
2430
**/
2431
function YArray(thing, startIndex, force) {
2432
    var len, result;
2433
 
2434
    /*jshint expr: true*/
2435
    startIndex || (startIndex = 0);
2436
 
2437
    if (force || YArray.test(thing)) {
2438
        // IE throws when trying to slice HTMLElement collections.
2439
        try {
2440
            return Native.slice.call(thing, startIndex);
2441
        } catch (ex) {
2442
            result = [];
2443
 
2444
            for (len = thing.length; startIndex < len; ++startIndex) {
2445
                result.push(thing[startIndex]);
2446
            }
2447
 
2448
            return result;
2449
        }
2450
    }
2451
 
2452
    return [thing];
2453
}
2454
 
2455
Y.Array = YArray;
2456
 
2457
/**
2458
Dedupes an array of strings, returning an array that's guaranteed to contain
2459
only one copy of a given string.
2460
 
2461
This method differs from `Array.unique()` in that it's optimized for use only
2462
with arrays consisting entirely of strings or entirely of numbers, whereas
2463
`unique` may be used with other value types (but is slower).
2464
 
2465
Using `dedupe()` with values other than strings or numbers, or with arrays
2466
containing a mix of strings and numbers, may result in unexpected behavior.
2467
 
2468
@method dedupe
2469
@param {String[]|Number[]} array Array of strings or numbers to dedupe.
2470
@return {Array} Copy of _array_ containing no duplicate values.
2471
@static
2472
@since 3.4.0
2473
**/
2474
YArray.dedupe = Lang._isNative(Object.create) ? function (array) {
2475
    var hash    = Object.create(null),
2476
        results = [],
2477
        i, item, len;
2478
 
2479
    for (i = 0, len = array.length; i < len; ++i) {
2480
        item = array[i];
2481
 
2482
        if (!hash[item]) {
2483
            hash[item] = 1;
2484
            results.push(item);
2485
        }
2486
    }
2487
 
2488
    return results;
2489
} : function (array) {
2490
    var hash    = {},
2491
        results = [],
2492
        i, item, len;
2493
 
2494
    for (i = 0, len = array.length; i < len; ++i) {
2495
        item = array[i];
2496
 
2497
        if (!hasOwn.call(hash, item)) {
2498
            hash[item] = 1;
2499
            results.push(item);
2500
        }
2501
    }
2502
 
2503
    return results;
2504
};
2505
 
2506
/**
2507
Executes the supplied function on each item in the array. This method wraps
2508
the native ES5 `Array.forEach()` method if available.
2509
 
2510
@method each
2511
@param {Array} array Array to iterate.
2512
@param {Function} fn Function to execute on each item in the array. The function
2513
  will receive the following arguments:
2514
    @param {Any} fn.item Current array item.
2515
    @param {Number} fn.index Current array index.
2516
    @param {Array} fn.array Array being iterated.
2517
@param {Object} [thisObj] `this` object to use when calling _fn_.
2518
@return {YUI} The YUI instance.
2519
@static
2520
**/
2521
YArray.each = YArray.forEach = Lang._isNative(Native.forEach) ? function (array, fn, thisObj) {
2522
    Native.forEach.call(array || [], fn, thisObj || Y);
2523
    return Y;
2524
} : function (array, fn, thisObj) {
2525
    for (var i = 0, len = (array && array.length) || 0; i < len; ++i) {
2526
        if (i in array) {
2527
            fn.call(thisObj || Y, array[i], i, array);
2528
        }
2529
    }
2530
 
2531
    return Y;
2532
};
2533
 
2534
/**
2535
Alias for `each()`.
2536
 
2537
@method forEach
2538
@static
2539
**/
2540
 
2541
/**
2542
Returns an object using the first array as keys and the second as values. If
2543
the second array is not provided, or if it doesn't contain the same number of
2544
values as the first array, then `true` will be used in place of the missing
2545
values.
2546
 
2547
@example
2548
 
2549
    Y.Array.hash(['a', 'b', 'c'], ['foo', 'bar']);
2550
    // => {a: 'foo', b: 'bar', c: true}
2551
 
2552
@method hash
2553
@param {String[]} keys Array of strings to use as keys.
2554
@param {Array} [values] Array to use as values.
2555
@return {Object} Hash using the first array as keys and the second as values.
2556
@static
2557
**/
2558
YArray.hash = function (keys, values) {
2559
    var hash = {},
2560
        vlen = (values && values.length) || 0,
2561
        i, len;
2562
 
2563
    for (i = 0, len = keys.length; i < len; ++i) {
2564
        if (i in keys) {
2565
            hash[keys[i]] = vlen > i && i in values ? values[i] : true;
2566
        }
2567
    }
2568
 
2569
    return hash;
2570
};
2571
 
2572
/**
2573
Returns the index of the first item in the array that's equal (using a strict
2574
equality check) to the specified _value_, or `-1` if the value isn't found.
2575
 
2576
This method wraps the native ES5 `Array.indexOf()` method if available.
2577
 
2578
@method indexOf
2579
@param {Array} array Array to search.
2580
@param {Any} value Value to search for.
2581
@param {Number} [from=0] The index at which to begin the search.
2582
@return {Number} Index of the item strictly equal to _value_, or `-1` if not
2583
    found.
2584
@static
2585
**/
2586
YArray.indexOf = Lang._isNative(Native.indexOf) ? function (array, value, from) {
2587
    return Native.indexOf.call(array, value, from);
2588
} : function (array, value, from) {
2589
    // http://es5.github.com/#x15.4.4.14
2590
    var len = array.length;
2591
 
2592
    from = +from || 0;
2593
    from = (from > 0 || -1) * Math.floor(Math.abs(from));
2594
 
2595
    if (from < 0) {
2596
        from += len;
2597
 
2598
        if (from < 0) {
2599
            from = 0;
2600
        }
2601
    }
2602
 
2603
    for (; from < len; ++from) {
2604
        if (from in array && array[from] === value) {
2605
            return from;
2606
        }
2607
    }
2608
 
2609
    return -1;
2610
};
2611
 
2612
/**
2613
Numeric sort convenience function.
2614
 
2615
The native `Array.prototype.sort()` function converts values to strings and
2616
sorts them in lexicographic order, which is unsuitable for sorting numeric
2617
values. Provide `Array.numericSort` as a custom sort function when you want
2618
to sort values in numeric order.
2619
 
2620
@example
2621
 
2622
    [42, 23, 8, 16, 4, 15].sort(Y.Array.numericSort);
2623
    // => [4, 8, 15, 16, 23, 42]
2624
 
2625
@method numericSort
2626
@param {Number} a First value to compare.
2627
@param {Number} b Second value to compare.
2628
@return {Number} Difference between _a_ and _b_.
2629
@static
2630
**/
2631
YArray.numericSort = function (a, b) {
2632
    return a - b;
2633
};
2634
 
2635
/**
2636
Executes the supplied function on each item in the array. Returning a truthy
2637
value from the function will stop the processing of remaining items.
2638
 
2639
@method some
2640
@param {Array} array Array to iterate over.
2641
@param {Function} fn Function to execute on each item. The function will receive
2642
  the following arguments:
2643
    @param {Any} fn.value Current array item.
2644
    @param {Number} fn.index Current array index.
2645
    @param {Array} fn.array Array being iterated over.
2646
@param {Object} [thisObj] `this` object to use when calling _fn_.
2647
@return {Boolean} `true` if the function returns a truthy value on any of the
2648
  items in the array; `false` otherwise.
2649
@static
2650
**/
2651
YArray.some = Lang._isNative(Native.some) ? function (array, fn, thisObj) {
2652
    return Native.some.call(array, fn, thisObj);
2653
} : function (array, fn, thisObj) {
2654
    for (var i = 0, len = array.length; i < len; ++i) {
2655
        if (i in array && fn.call(thisObj, array[i], i, array)) {
2656
            return true;
2657
        }
2658
    }
2659
 
2660
    return false;
2661
};
2662
 
2663
/**
2664
Evaluates _obj_ to determine if it's an array, an array-like collection, or
2665
something else. This is useful when working with the function `arguments`
2666
collection and `HTMLElement` collections.
2667
 
2668
Note: This implementation doesn't consider elements that are also
2669
collections, such as `<form>` and `<select>`, to be array-like.
2670
 
2671
@method test
2672
@param {Object} obj Object to test.
2673
@return {Number} A number indicating the results of the test:
2674
 
2675
  * 0: Neither an array nor an array-like collection.
2676
  * 1: Real array.
2677
  * 2: Array-like collection.
2678
 
2679
@static
2680
**/
2681
YArray.test = function (obj) {
2682
    var result = 0;
2683
 
2684
    if (Lang.isArray(obj)) {
2685
        result = 1;
2686
    } else if (Lang.isObject(obj)) {
2687
        try {
2688
            // indexed, but no tagName (element) or scrollTo/document (window. From DOM.isWindow test which we can't use here),
2689
            // or functions without apply/call (Safari
2690
            // HTMLElementCollection bug).
2691
            if ('length' in obj && !obj.tagName && !(obj.scrollTo && obj.document) && !obj.apply) {
2692
                result = 2;
2693
            }
2694
        } catch (ex) {}
2695
    }
2696
 
2697
    return result;
2698
};
2699
/**
2700
 * The YUI module contains the components required for building the YUI
2701
 * seed file.  This includes the script loading mechanism, a simple queue,
2702
 * and the core utilities for the library.
2703
 * @module yui
2704
 * @submodule yui-base
2705
 */
2706
 
2707
/**
2708
 * A simple FIFO queue.  Items are added to the Queue with add(1..n items) and
2709
 * removed using next().
2710
 *
2711
 * @class Queue
2712
 * @constructor
2713
 * @param {MIXED} item* 0..n items to seed the queue.
2714
 */
2715
function Queue() {
2716
    this._init();
2717
    this.add.apply(this, arguments);
2718
}
2719
 
2720
Queue.prototype = {
2721
    /**
2722
     * Initialize the queue
2723
     *
2724
     * @method _init
2725
     * @protected
2726
     */
2727
    _init: function() {
2728
        /**
2729
         * The collection of enqueued items
2730
         *
2731
         * @property _q
2732
         * @type Array
2733
         * @protected
2734
         */
2735
        this._q = [];
2736
    },
2737
 
2738
    /**
2739
     * Get the next item in the queue. FIFO support
2740
     *
2741
     * @method next
2742
     * @return {MIXED} the next item in the queue.
2743
     */
2744
    next: function() {
2745
        return this._q.shift();
2746
    },
2747
 
2748
    /**
2749
     * Get the last in the queue. LIFO support.
2750
     *
2751
     * @method last
2752
     * @return {MIXED} the last item in the queue.
2753
     */
2754
    last: function() {
2755
        return this._q.pop();
2756
    },
2757
 
2758
    /**
2759
     * Add 0..n items to the end of the queue.
2760
     *
2761
     * @method add
2762
     * @param {MIXED} item* 0..n items.
2763
     * @return {object} this queue.
2764
     */
2765
    add: function() {
2766
        this._q.push.apply(this._q, arguments);
2767
 
2768
        return this;
2769
    },
2770
 
2771
    /**
2772
     * Returns the current number of queued items.
2773
     *
2774
     * @method size
2775
     * @return {Number} The size.
2776
     */
2777
    size: function() {
2778
        return this._q.length;
2779
    }
2780
};
2781
 
2782
Y.Queue = Queue;
2783
 
2784
YUI.Env._loaderQueue = YUI.Env._loaderQueue || new Queue();
2785
 
2786
/**
2787
The YUI module contains the components required for building the YUI seed file.
2788
This includes the script loading mechanism, a simple queue, and the core
2789
utilities for the library.
2790
 
2791
@module yui
2792
@submodule yui-base
2793
**/
2794
 
2795
var CACHED_DELIMITER = '__',
2796
 
2797
    hasOwn   = Object.prototype.hasOwnProperty,
2798
    isObject = Y.Lang.isObject;
2799
 
2800
/**
2801
Returns a wrapper for a function which caches the return value of that function,
2802
keyed off of the combined string representation of the argument values provided
2803
when the wrapper is called.
2804
 
2805
Calling this function again with the same arguments will return the cached value
2806
rather than executing the wrapped function.
2807
 
2808
Note that since the cache is keyed off of the string representation of arguments
2809
passed to the wrapper function, arguments that aren't strings and don't provide
2810
a meaningful `toString()` method may result in unexpected caching behavior. For
2811
example, the objects `{}` and `{foo: 'bar'}` would both be converted to the
2812
string `[object Object]` when used as a cache key.
2813
 
2814
@method cached
2815
@param {Function} source The function to memoize.
2816
@param {Object} [cache={}] Object in which to store cached values. You may seed
2817
  this object with pre-existing cached values if desired.
2818
@param {any} [refetch] If supplied, this value is compared with the cached value
2819
  using a `==` comparison. If the values are equal, the wrapped function is
2820
  executed again even though a cached value exists.
2821
@return {Function} Wrapped function.
2822
@for YUI
2823
**/
2824
Y.cached = function (source, cache, refetch) {
2825
    /*jshint expr: true*/
2826
    cache || (cache = {});
2827
 
2828
    return function (arg) {
2829
        var key = arguments.length > 1 ?
2830
                Array.prototype.join.call(arguments, CACHED_DELIMITER) :
2831
                String(arg);
2832
 
2833
        /*jshint eqeqeq: false*/
2834
        if (!(key in cache) || (refetch && cache[key] == refetch)) {
2835
            cache[key] = source.apply(source, arguments);
2836
        }
2837
 
2838
        return cache[key];
2839
    };
2840
};
2841
 
2842
/**
2843
Returns the `location` object from the window/frame in which this YUI instance
2844
operates, or `undefined` when executing in a non-browser environment
2845
(e.g. Node.js).
2846
 
2847
It is _not_ recommended to hold references to the `window.location` object
2848
outside of the scope of a function in which its properties are being accessed or
2849
its methods are being called. This is because of a nasty bug/issue that exists
2850
in both Safari and MobileSafari browsers:
2851
[WebKit Bug 34679](https://bugs.webkit.org/show_bug.cgi?id=34679).
2852
 
2853
@method getLocation
2854
@return {location} The `location` object from the window/frame in which this YUI
2855
    instance operates.
2856
@since 3.5.0
2857
**/
2858
Y.getLocation = function () {
2859
    // It is safer to look this up every time because yui-base is attached to a
2860
    // YUI instance before a user's config is applied; i.e. `Y.config.win` does
2861
    // not point the correct window object when this file is loaded.
2862
    var win = Y.config.win;
2863
 
2864
    // It is not safe to hold a reference to the `location` object outside the
2865
    // scope in which it is being used. The WebKit engine used in Safari and
2866
    // MobileSafari will "disconnect" the `location` object from the `window`
2867
    // when a page is restored from back/forward history cache.
2868
    return win && win.location;
2869
};
2870
 
2871
/**
2872
Returns a new object containing all of the properties of all the supplied
2873
objects. The properties from later objects will overwrite those in earlier
2874
objects.
2875
 
2876
Passing in a single object will create a shallow copy of it. For a deep copy,
2877
use `clone()`.
2878
 
2879
@method merge
2880
@param {Object} objects* One or more objects to merge.
2881
@return {Object} A new merged object.
2882
**/
2883
Y.merge = function () {
2884
    var i      = 0,
2885
        len    = arguments.length,
2886
        result = {},
2887
        key,
2888
        obj;
2889
 
2890
    for (; i < len; ++i) {
2891
        obj = arguments[i];
2892
 
2893
        for (key in obj) {
2894
            if (hasOwn.call(obj, key)) {
2895
                result[key] = obj[key];
2896
            }
2897
        }
2898
    }
2899
 
2900
    return result;
2901
};
2902
 
2903
/**
2904
Mixes _supplier_'s properties into _receiver_.
2905
 
2906
Properties on _receiver_ or _receiver_'s prototype will not be overwritten or
2907
shadowed unless the _overwrite_ parameter is `true`, and will not be merged
2908
unless the _merge_ parameter is `true`.
2909
 
2910
In the default mode (0), only properties the supplier owns are copied (prototype
2911
properties are not copied). The following copying modes are available:
2912
 
2913
  * `0`: _Default_. Object to object.
2914
  * `1`: Prototype to prototype.
2915
  * `2`: Prototype to prototype and object to object.
2916
  * `3`: Prototype to object.
2917
  * `4`: Object to prototype.
2918
 
2919
@method mix
2920
@param {Function|Object} receiver The object or function to receive the mixed
2921
  properties.
2922
@param {Function|Object} supplier The object or function supplying the
2923
  properties to be mixed.
2924
@param {Boolean} [overwrite=false] If `true`, properties that already exist
2925
  on the receiver will be overwritten with properties from the supplier.
2926
@param {String[]} [whitelist] An array of property names to copy. If
2927
  specified, only the whitelisted properties will be copied, and all others
2928
  will be ignored.
2929
@param {Number} [mode=0] Mix mode to use. See above for available modes.
2930
@param {Boolean} [merge=false] If `true`, objects and arrays that already
2931
  exist on the receiver will have the corresponding object/array from the
2932
  supplier merged into them, rather than being skipped or overwritten. When
2933
  both _overwrite_ and _merge_ are `true`, _merge_ takes precedence.
2934
@return {Function|Object|YUI} The receiver, or the YUI instance if the
2935
  specified receiver is falsy.
2936
**/
2937
Y.mix = function(receiver, supplier, overwrite, whitelist, mode, merge) {
2938
    var alwaysOverwrite, exists, from, i, key, len, to;
2939
 
2940
    // If no supplier is given, we return the receiver. If no receiver is given,
2941
    // we return Y. Returning Y doesn't make much sense to me, but it's
2942
    // grandfathered in for backcompat reasons.
2943
    if (!receiver || !supplier) {
2944
        return receiver || Y;
2945
    }
2946
 
2947
    if (mode) {
2948
        // In mode 2 (prototype to prototype and object to object), we recurse
2949
        // once to do the proto to proto mix. The object to object mix will be
2950
        // handled later on.
2951
        if (mode === 2) {
2952
            Y.mix(receiver.prototype, supplier.prototype, overwrite,
2953
                    whitelist, 0, merge);
2954
        }
2955
 
2956
        // Depending on which mode is specified, we may be copying from or to
2957
        // the prototypes of the supplier and receiver.
2958
        from = mode === 1 || mode === 3 ? supplier.prototype : supplier;
2959
        to   = mode === 1 || mode === 4 ? receiver.prototype : receiver;
2960
 
2961
        // If either the supplier or receiver doesn't actually have a
2962
        // prototype property, then we could end up with an undefined `from`
2963
        // or `to`. If that happens, we abort and return the receiver.
2964
        if (!from || !to) {
2965
            return receiver;
2966
        }
2967
    } else {
2968
        from = supplier;
2969
        to   = receiver;
2970
    }
2971
 
2972
    // If `overwrite` is truthy and `merge` is falsy, then we can skip a
2973
    // property existence check on each iteration and save some time.
2974
    alwaysOverwrite = overwrite && !merge;
2975
 
2976
    if (whitelist) {
2977
        for (i = 0, len = whitelist.length; i < len; ++i) {
2978
            key = whitelist[i];
2979
 
2980
            // We call `Object.prototype.hasOwnProperty` instead of calling
2981
            // `hasOwnProperty` on the object itself, since the object's
2982
            // `hasOwnProperty` method may have been overridden or removed.
2983
            // Also, some native objects don't implement a `hasOwnProperty`
2984
            // method.
2985
            if (!hasOwn.call(from, key)) {
2986
                continue;
2987
            }
2988
 
2989
            // The `key in to` check here is (sadly) intentional for backwards
2990
            // compatibility reasons. It prevents undesired shadowing of
2991
            // prototype members on `to`.
2992
            exists = alwaysOverwrite ? false : key in to;
2993
 
2994
            if (merge && exists && isObject(to[key], true)
2995
                    && isObject(from[key], true)) {
2996
                // If we're in merge mode, and the key is present on both
2997
                // objects, and the value on both objects is either an object or
2998
                // an array (but not a function), then we recurse to merge the
2999
                // `from` value into the `to` value instead of overwriting it.
3000
                //
3001
                // Note: It's intentional that the whitelist isn't passed to the
3002
                // recursive call here. This is legacy behavior that lots of
3003
                // code still depends on.
3004
                Y.mix(to[key], from[key], overwrite, null, 0, merge);
3005
            } else if (overwrite || !exists) {
3006
                // We're not in merge mode, so we'll only copy the `from` value
3007
                // to the `to` value if we're in overwrite mode or if the
3008
                // current key doesn't exist on the `to` object.
3009
                to[key] = from[key];
3010
            }
3011
        }
3012
    } else {
3013
        for (key in from) {
3014
            // The code duplication here is for runtime performance reasons.
3015
            // Combining whitelist and non-whitelist operations into a single
3016
            // loop or breaking the shared logic out into a function both result
3017
            // in worse performance, and Y.mix is critical enough that the byte
3018
            // tradeoff is worth it.
3019
            if (!hasOwn.call(from, key)) {
3020
                continue;
3021
            }
3022
 
3023
            // The `key in to` check here is (sadly) intentional for backwards
3024
            // compatibility reasons. It prevents undesired shadowing of
3025
            // prototype members on `to`.
3026
            exists = alwaysOverwrite ? false : key in to;
3027
 
3028
            if (merge && exists && isObject(to[key], true)
3029
                    && isObject(from[key], true)) {
3030
                Y.mix(to[key], from[key], overwrite, null, 0, merge);
3031
            } else if (overwrite || !exists) {
3032
                to[key] = from[key];
3033
            }
3034
        }
3035
 
3036
        // If this is an IE browser with the JScript enumeration bug, force
3037
        // enumeration of the buggy properties by making a recursive call with
3038
        // the buggy properties as the whitelist.
3039
        if (Y.Object._hasEnumBug) {
3040
            Y.mix(to, from, overwrite, Y.Object._forceEnum, mode, merge);
3041
        }
3042
    }
3043
 
3044
    return receiver;
3045
};
3046
/**
3047
 * The YUI module contains the components required for building the YUI
3048
 * seed file.  This includes the script loading mechanism, a simple queue,
3049
 * and the core utilities for the library.
3050
 * @module yui
3051
 * @submodule yui-base
3052
 */
3053
 
3054
/**
3055
 * Adds utilities to the YUI instance for working with objects.
3056
 *
3057
 * @class Object
3058
 */
3059
 
3060
var Lang   = Y.Lang,
3061
    hasOwn = Object.prototype.hasOwnProperty,
3062
 
3063
    UNDEFINED, // <-- Note the comma. We're still declaring vars.
3064
 
3065
/**
3066
 * Returns a new object that uses _obj_ as its prototype. This method wraps the
3067
 * native ES5 `Object.create()` method if available, but doesn't currently
3068
 * pass through `Object.create()`'s second argument (properties) in order to
3069
 * ensure compatibility with older browsers.
3070
 *
3071
 * @method ()
3072
 * @param {Object} obj Prototype object.
3073
 * @return {Object} New object using _obj_ as its prototype.
3074
 * @static
3075
 */
3076
O = Y.Object = Lang._isNative(Object.create) ? function (obj) {
3077
    // We currently wrap the native Object.create instead of simply aliasing it
3078
    // to ensure consistency with our fallback shim, which currently doesn't
3079
    // support Object.create()'s second argument (properties). Once we have a
3080
    // safe fallback for the properties arg, we can stop wrapping
3081
    // Object.create().
3082
    return Object.create(obj);
3083
} : (function () {
3084
    // Reusable constructor function for the Object.create() shim.
3085
    function F() {}
3086
 
3087
    // The actual shim.
3088
    return function (obj) {
3089
        F.prototype = obj;
3090
        return new F();
3091
    };
3092
}()),
3093
 
3094
/**
3095
 * Property names that IE doesn't enumerate in for..in loops, even when they
3096
 * should be enumerable. When `_hasEnumBug` is `true`, it's necessary to
3097
 * manually enumerate these properties.
3098
 *
3099
 * @property _forceEnum
3100
 * @type String[]
3101
 * @protected
3102
 * @static
3103
 */
3104
forceEnum = O._forceEnum = [
3105
    'hasOwnProperty',
3106
    'isPrototypeOf',
3107
    'propertyIsEnumerable',
3108
    'toString',
3109
    'toLocaleString',
3110
    'valueOf'
3111
],
3112
 
3113
/**
3114
 * `true` if this browser has the JScript enumeration bug that prevents
3115
 * enumeration of the properties named in the `_forceEnum` array, `false`
3116
 * otherwise.
3117
 *
3118
 * See:
3119
 *   - <https://developer.mozilla.org/en/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug>
3120
 *   - <http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation>
3121
 *
3122
 * @property _hasEnumBug
3123
 * @type Boolean
3124
 * @protected
3125
 * @static
3126
 */
3127
hasEnumBug = O._hasEnumBug = !{valueOf: 0}.propertyIsEnumerable('valueOf'),
3128
 
3129
/**
3130
 * `true` if this browser incorrectly considers the `prototype` property of
3131
 * functions to be enumerable. Currently known to affect Opera 11.50 and Android 2.3.x.
3132
 *
3133
 * @property _hasProtoEnumBug
3134
 * @type Boolean
3135
 * @protected
3136
 * @static
3137
 */
3138
hasProtoEnumBug = O._hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'),
3139
 
3140
/**
3141
 * Returns `true` if _key_ exists on _obj_, `false` if _key_ doesn't exist or
3142
 * exists only on _obj_'s prototype. This is essentially a safer version of
3143
 * `obj.hasOwnProperty()`.
3144
 *
3145
 * @method owns
3146
 * @param {Object} obj Object to test.
3147
 * @param {String} key Property name to look for.
3148
 * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise.
3149
 * @static
3150
 */
3151
owns = O.owns = function (obj, key) {
3152
    return !!obj && hasOwn.call(obj, key);
3153
}; // <-- End of var declarations.
3154
 
3155
/**
3156
 * Alias for `owns()`.
3157
 *
3158
 * @method hasKey
3159
 * @param {Object} obj Object to test.
3160
 * @param {String} key Property name to look for.
3161
 * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise.
3162
 * @static
3163
 */
3164
O.hasKey = owns;
3165
 
3166
/**
3167
 * Returns an array containing the object's enumerable keys. Does not include
3168
 * prototype keys or non-enumerable keys.
3169
 *
3170
 * Note that keys are returned in enumeration order (that is, in the same order
3171
 * that they would be enumerated by a `for-in` loop), which may not be the same
3172
 * as the order in which they were defined.
3173
 *
3174
 * This method is an alias for the native ES5 `Object.keys()` method if
3175
 * available and non-buggy. The Opera 11.50 and Android 2.3.x versions of
3176
 * `Object.keys()` have an inconsistency as they consider `prototype` to be
3177
 * enumerable, so a non-native shim is used to rectify the difference.
3178
 *
3179
 * @example
3180
 *
3181
 *     Y.Object.keys({a: 'foo', b: 'bar', c: 'baz'});
3182
 *     // => ['a', 'b', 'c']
3183
 *
3184
 * @method keys
3185
 * @param {Object} obj An object.
3186
 * @return {String[]} Array of keys.
3187
 * @static
3188
 */
3189
O.keys = Lang._isNative(Object.keys) && !hasProtoEnumBug ? Object.keys : function (obj) {
3190
    if (!Lang.isObject(obj)) {
3191
        throw new TypeError('Object.keys called on a non-object');
3192
    }
3193
 
3194
    var keys = [],
3195
        i, key, len;
3196
 
3197
    if (hasProtoEnumBug && typeof obj === 'function') {
3198
        for (key in obj) {
3199
            if (owns(obj, key) && key !== 'prototype') {
3200
                keys.push(key);
3201
            }
3202
        }
3203
    } else {
3204
        for (key in obj) {
3205
            if (owns(obj, key)) {
3206
                keys.push(key);
3207
            }
3208
        }
3209
    }
3210
 
3211
    if (hasEnumBug) {
3212
        for (i = 0, len = forceEnum.length; i < len; ++i) {
3213
            key = forceEnum[i];
3214
 
3215
            if (owns(obj, key)) {
3216
                keys.push(key);
3217
            }
3218
        }
3219
    }
3220
 
3221
    return keys;
3222
};
3223
 
3224
/**
3225
 * Returns an array containing the values of the object's enumerable keys.
3226
 *
3227
 * Note that values are returned in enumeration order (that is, in the same
3228
 * order that they would be enumerated by a `for-in` loop), which may not be the
3229
 * same as the order in which they were defined.
3230
 *
3231
 * @example
3232
 *
3233
 *     Y.Object.values({a: 'foo', b: 'bar', c: 'baz'});
3234
 *     // => ['foo', 'bar', 'baz']
3235
 *
3236
 * @method values
3237
 * @param {Object} obj An object.
3238
 * @return {Array} Array of values.
3239
 * @static
3240
 */
3241
O.values = function (obj) {
3242
    var keys   = O.keys(obj),
3243
        i      = 0,
3244
        len    = keys.length,
3245
        values = [];
3246
 
3247
    for (; i < len; ++i) {
3248
        values.push(obj[keys[i]]);
3249
    }
3250
 
3251
    return values;
3252
};
3253
 
3254
/**
3255
 * Returns the number of enumerable keys owned by an object.
3256
 *
3257
 * @method size
3258
 * @param {Object} obj An object.
3259
 * @return {Number} The object's size.
3260
 * @static
3261
 */
3262
O.size = function (obj) {
3263
    try {
3264
        return O.keys(obj).length;
3265
    } catch (ex) {
3266
        return 0; // Legacy behavior for non-objects.
3267
    }
3268
};
3269
 
3270
/**
3271
 * Returns `true` if the object owns an enumerable property with the specified
3272
 * value.
3273
 *
3274
 * @method hasValue
3275
 * @param {Object} obj An object.
3276
 * @param {any} value The value to search for.
3277
 * @return {Boolean} `true` if _obj_ contains _value_, `false` otherwise.
3278
 * @static
3279
 */
3280
O.hasValue = function (obj, value) {
3281
    return Y.Array.indexOf(O.values(obj), value) > -1;
3282
};
3283
 
3284
/**
3285
 * Executes a function on each enumerable property in _obj_. The function
3286
 * receives the value, the key, and the object itself as parameters (in that
3287
 * order).
3288
 *
3289
 * By default, only properties owned by _obj_ are enumerated. To include
3290
 * prototype properties, set the _proto_ parameter to `true`.
3291
 *
3292
 * @method each
3293
 * @param {Object} obj Object to enumerate.
3294
 * @param {Function} fn Function to execute on each enumerable property.
3295
 *   @param {mixed} fn.value Value of the current property.
3296
 *   @param {String} fn.key Key of the current property.
3297
 *   @param {Object} fn.obj Object being enumerated.
3298
 * @param {Object} [thisObj] `this` object to use when calling _fn_.
3299
 * @param {Boolean} [proto=false] Include prototype properties.
3300
 * @return {YUI} the YUI instance.
3301
 * @chainable
3302
 * @static
3303
 */
3304
O.each = function (obj, fn, thisObj, proto) {
3305
    var key;
3306
 
3307
    for (key in obj) {
3308
        if (proto || owns(obj, key)) {
3309
            fn.call(thisObj || Y, obj[key], key, obj);
3310
        }
3311
    }
3312
 
3313
    return Y;
3314
};
3315
 
3316
/**
3317
 * Executes a function on each enumerable property in _obj_, but halts if the
3318
 * function returns a truthy value. The function receives the value, the key,
3319
 * and the object itself as paramters (in that order).
3320
 *
3321
 * By default, only properties owned by _obj_ are enumerated. To include
3322
 * prototype properties, set the _proto_ parameter to `true`.
3323
 *
3324
 * @method some
3325
 * @param {Object} obj Object to enumerate.
3326
 * @param {Function} fn Function to execute on each enumerable property.
3327
 *   @param {mixed} fn.value Value of the current property.
3328
 *   @param {String} fn.key Key of the current property.
3329
 *   @param {Object} fn.obj Object being enumerated.
3330
 * @param {Object} [thisObj] `this` object to use when calling _fn_.
3331
 * @param {Boolean} [proto=false] Include prototype properties.
3332
 * @return {Boolean} `true` if any execution of _fn_ returns a truthy value,
3333
 *   `false` otherwise.
3334
 * @static
3335
 */
3336
O.some = function (obj, fn, thisObj, proto) {
3337
    var key;
3338
 
3339
    for (key in obj) {
3340
        if (proto || owns(obj, key)) {
3341
            if (fn.call(thisObj || Y, obj[key], key, obj)) {
3342
                return true;
3343
            }
3344
        }
3345
    }
3346
 
3347
    return false;
3348
};
3349
 
3350
/**
3351
 * Retrieves the sub value at the provided path,
3352
 * from the value object provided.
3353
 *
3354
 * @method getValue
3355
 * @static
3356
 * @param o The object from which to extract the property value.
3357
 * @param path {Array} A path array, specifying the object traversal path
3358
 * from which to obtain the sub value.
3359
 * @return {Any} The value stored in the path, undefined if not found,
3360
 * undefined if the source is not an object.  Returns the source object
3361
 * if an empty path is provided.
3362
 */
3363
O.getValue = function(o, path) {
3364
    if (!Lang.isObject(o)) {
3365
        return UNDEFINED;
3366
    }
3367
 
3368
    var i,
3369
        p = Y.Array(path),
3370
        l = p.length;
3371
 
3372
    for (i = 0; o !== UNDEFINED && i < l; i++) {
3373
        o = o[p[i]];
3374
    }
3375
 
3376
    return o;
3377
};
3378
 
3379
/**
3380
 * Sets the sub-attribute value at the provided path on the
3381
 * value object.  Returns the modified value object, or
3382
 * undefined if the path is invalid.
3383
 *
3384
 * @method setValue
3385
 * @static
3386
 * @param o             The object on which to set the sub value.
3387
 * @param path {Array}  A path array, specifying the object traversal path
3388
 *                      at which to set the sub value.
3389
 * @param val {Any}     The new value for the sub-attribute.
3390
 * @return {Object}     The modified object, with the new sub value set, or
3391
 *                      undefined, if the path was invalid.
3392
 */
3393
O.setValue = function(o, path, val) {
3394
    var i,
3395
        p = Y.Array(path),
3396
        leafIdx = p.length - 1,
3397
        ref = o;
3398
 
3399
    if (leafIdx >= 0) {
3400
        for (i = 0; ref !== UNDEFINED && i < leafIdx; i++) {
3401
            ref = ref[p[i]];
3402
        }
3403
 
3404
        if (ref !== UNDEFINED) {
3405
            ref[p[i]] = val;
3406
        } else {
3407
            return UNDEFINED;
3408
        }
3409
    }
3410
 
3411
    return o;
3412
};
3413
 
3414
/**
3415
 * Returns `true` if the object has no enumerable properties of its own.
3416
 *
3417
 * @method isEmpty
3418
 * @param {Object} obj An object.
3419
 * @return {Boolean} `true` if the object is empty.
3420
 * @static
3421
 * @since 3.2.0
3422
 */
3423
O.isEmpty = function (obj) {
3424
    return !O.keys(Object(obj)).length;
3425
};
3426
/**
3427
 * The YUI module contains the components required for building the YUI seed
3428
 * file.  This includes the script loading mechanism, a simple queue, and the
3429
 * core utilities for the library.
3430
 * @module yui
3431
 * @submodule yui-base
3432
 */
3433
 
3434
/**
3435
 * YUI user agent detection.
3436
 * Do not fork for a browser if it can be avoided.  Use feature detection when
3437
 * you can.  Use the user agent as a last resort.  For all fields listed
3438
 * as @type float, UA stores a version number for the browser engine,
3439
 * 0 otherwise.  This value may or may not map to the version number of
3440
 * the browser using the engine.  The value is presented as a float so
3441
 * that it can easily be used for boolean evaluation as well as for
3442
 * looking for a particular range of versions.  Because of this,
3443
 * some of the granularity of the version info may be lost.  The fields that
3444
 * are @type string default to null.  The API docs list the values that
3445
 * these fields can have.
3446
 * @class UA
3447
 * @static
3448
 */
3449
 
3450
/**
3451
* Static method on `YUI.Env` for parsing a UA string.  Called at instantiation
3452
* to populate `Y.UA`.
3453
*
3454
* @static
3455
* @method parseUA
3456
* @param {String} [subUA=navigator.userAgent] UA string to parse
3457
* @return {Object} The Y.UA object
3458
*/
3459
YUI.Env.parseUA = function(subUA) {
3460
 
3461
    var numberify = function(s) {
3462
            var c = 0;
3463
            return parseFloat(s.replace(/\./g, function() {
3464
                return (c++ === 1) ? '' : '.';
3465
            }));
3466
        },
3467
 
3468
        win = Y.config.win,
3469
 
3470
        nav = win && win.navigator,
3471
 
3472
        o = {
3473
 
3474
        /**
3475
         * Internet Explorer version number or 0.  Example: 6
3476
         * @property ie
3477
         * @type float
3478
         * @static
3479
         */
3480
        ie: 0,
3481
 
3482
        /**
3483
         * Opera version number or 0.  Example: 9.2
3484
         * @property opera
3485
         * @type float
3486
         * @static
3487
         */
3488
        opera: 0,
3489
 
3490
        /**
3491
         * Gecko engine revision number.  Will evaluate to 1 if Gecko
3492
         * is detected but the revision could not be found. Other browsers
3493
         * will be 0.  Example: 1.8
3494
         * <pre>
3495
         * Firefox 1.0.0.4: 1.7.8   <-- Reports 1.7
3496
         * Firefox 1.5.0.9: 1.8.0.9 <-- 1.8
3497
         * Firefox 2.0.0.3: 1.8.1.3 <-- 1.81
3498
         * Firefox 3.0   <-- 1.9
3499
         * Firefox 3.5   <-- 1.91
3500
         * </pre>
3501
         * @property gecko
3502
         * @type float
3503
         * @static
3504
         */
3505
        gecko: 0,
3506
 
3507
        /**
3508
         * AppleWebKit version.  KHTML browsers that are not WebKit browsers
3509
         * will evaluate to 1, other browsers 0.  Example: 418.9
3510
         * <pre>
3511
         * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the
3512
         *                                   latest available for Mac OSX 10.3.
3513
         * Safari 2.0.2:         416     <-- hasOwnProperty introduced
3514
         * Safari 2.0.4:         418     <-- preventDefault fixed
3515
         * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
3516
         *                                   different versions of webkit
3517
         * Safari 2.0.4 (419.3): 419     <-- Tiger installations that have been
3518
         *                                   updated, but not updated
3519
         *                                   to the latest patch.
3520
         * Webkit 212 nightly:   522+    <-- Safari 3.0 precursor (with native
3521
         * SVG and many major issues fixed).
3522
         * Safari 3.0.4 (523.12) 523.12  <-- First Tiger release - automatic
3523
         * update from 2.x via the 10.4.11 OS patch.
3524
         * Webkit nightly 1/2008:525+    <-- Supports DOMContentLoaded event.
3525
         *                                   yahoo.com user agent hack removed.
3526
         * </pre>
3527
         * http://en.wikipedia.org/wiki/Safari_version_history
3528
         * @property webkit
3529
         * @type float
3530
         * @static
3531
         */
3532
        webkit: 0,
3533
 
3534
        /**
3535
         * Safari will be detected as webkit, but this property will also
3536
         * be populated with the Safari version number
3537
         * @property safari
3538
         * @type float
3539
         * @static
3540
         */
3541
        safari: 0,
3542
 
3543
        /**
3544
         * Chrome will be detected as webkit, but this property will also
3545
         * be populated with the Chrome version number
3546
         * @property chrome
3547
         * @type float
3548
         * @static
3549
         */
3550
        chrome: 0,
3551
 
3552
        /**
3553
         * The mobile property will be set to a string containing any relevant
3554
         * user agent information when a modern mobile browser is detected.
3555
         * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
3556
         * devices with the WebKit-based browser, and Opera Mini.
3557
         * @property mobile
3558
         * @type string
3559
         * @default null
3560
         * @static
3561
         */
3562
        mobile: null,
3563
 
3564
        /**
3565
         * Adobe AIR version number or 0.  Only populated if webkit is detected.
3566
         * Example: 1.0
3567
         * @property air
3568
         * @type float
3569
         */
3570
        air: 0,
3571
        /**
3572
         * PhantomJS version number or 0.  Only populated if webkit is detected.
3573
         * Example: 1.0
3574
         * @property phantomjs
3575
         * @type float
3576
         */
3577
        phantomjs: 0,
3578
        /**
3579
         * Detects Apple iPad's OS version
3580
         * @property ipad
3581
         * @type float
3582
         * @static
3583
         */
3584
        ipad: 0,
3585
        /**
3586
         * Detects Apple iPhone's OS version
3587
         * @property iphone
3588
         * @type float
3589
         * @static
3590
         */
3591
        iphone: 0,
3592
        /**
3593
         * Detects Apples iPod's OS version
3594
         * @property ipod
3595
         * @type float
3596
         * @static
3597
         */
3598
        ipod: 0,
3599
        /**
3600
         * General truthy check for iPad, iPhone or iPod
3601
         * @property ios
3602
         * @type Boolean
3603
         * @default null
3604
         * @static
3605
         */
3606
        ios: null,
3607
        /**
3608
         * Detects Googles Android OS version
3609
         * @property android
3610
         * @type float
3611
         * @static
3612
         */
3613
        android: 0,
3614
        /**
3615
         * Detects Kindle Silk
3616
         * @property silk
3617
         * @type float
3618
         * @static
3619
         */
3620
        silk: 0,
3621
        /**
3622
         * Detects Ubuntu version
3623
         * @property ubuntu
3624
         * @type float
3625
         * @static
3626
         */
3627
        ubuntu: 0,
3628
        /**
3629
         * Detects Kindle Silk Acceleration
3630
         * @property accel
3631
         * @type Boolean
3632
         * @static
3633
         */
3634
        accel: false,
3635
        /**
3636
         * Detects Palms WebOS version
3637
         * @property webos
3638
         * @type float
3639
         * @static
3640
         */
3641
        webos: 0,
3642
 
3643
        /**
3644
         * Google Caja version number or 0.
3645
         * @property caja
3646
         * @type float
3647
         */
3648
        caja: nav && nav.cajaVersion,
3649
 
3650
        /**
3651
         * Set to true if the page appears to be in SSL
3652
         * @property secure
3653
         * @type boolean
3654
         * @static
3655
         */
3656
        secure: false,
3657
 
3658
        /**
3659
         * The operating system.
3660
         *
3661
         * Possible values are `windows`, `macintosh`, `android`, `symbos`, `linux`, `rhino` and `ios`.
3662
         *
3663
         * @property os
3664
         * @type string
3665
         * @default null
3666
         * @static
3667
         */
3668
        os: null,
3669
 
3670
        /**
3671
         * The Nodejs Version
3672
         * @property nodejs
3673
         * @type float
3674
         * @default 0
3675
         * @static
3676
         */
3677
        nodejs: 0,
3678
        /**
3679
        * Window8/IE10 Application host environment
3680
        * @property winjs
3681
        * @type Boolean
3682
        * @static
3683
        */
3684
        winjs: !!((typeof Windows !== "undefined") && Windows.System),
3685
        /**
3686
        * Are touch/msPointer events available on this device
3687
        * @property touchEnabled
3688
        * @type Boolean
3689
        * @static
3690
        */
3691
        touchEnabled: false
3692
    },
3693
 
3694
    ua = subUA || nav && nav.userAgent,
3695
 
3696
    loc = win && win.location,
3697
 
3698
    href = loc && loc.href,
3699
 
3700
    m;
3701
 
3702
    /**
3703
    * The User Agent string that was parsed
3704
    * @property userAgent
3705
    * @type String
3706
    * @static
3707
    */
3708
    o.userAgent = ua;
3709
 
3710
 
3711
    o.secure = href && (href.toLowerCase().indexOf('https') === 0);
3712
 
3713
    if (ua) {
3714
 
3715
        if ((/windows|win32/i).test(ua)) {
3716
            o.os = 'windows';
3717
        } else if ((/macintosh|mac_powerpc/i).test(ua)) {
3718
            o.os = 'macintosh';
3719
        } else if ((/android/i).test(ua)) {
3720
            o.os = 'android';
3721
        } else if ((/symbos/i).test(ua)) {
3722
            o.os = 'symbos';
3723
        } else if ((/linux/i).test(ua)) {
3724
            o.os = 'linux';
3725
        } else if ((/rhino/i).test(ua)) {
3726
            o.os = 'rhino';
3727
        }
3728
 
3729
        // Modern KHTML browsers should qualify as Safari X-Grade
3730
        if ((/KHTML/).test(ua)) {
3731
            o.webkit = 1;
3732
        }
3733
        if ((/IEMobile|XBLWP7/).test(ua)) {
3734
            o.mobile = 'windows';
3735
        }
3736
        if ((/Fennec/).test(ua)) {
3737
            o.mobile = 'gecko';
3738
        }
3739
        // Modern WebKit browsers are at least X-Grade
3740
        m = ua.match(/AppleWebKit\/([^\s]*)/);
3741
        if (m && m[1]) {
3742
            o.webkit = numberify(m[1]);
3743
            o.safari = o.webkit;
3744
 
3745
            if (/PhantomJS/.test(ua)) {
3746
                m = ua.match(/PhantomJS\/([^\s]*)/);
3747
                if (m && m[1]) {
3748
                    o.phantomjs = numberify(m[1]);
3749
                }
3750
            }
3751
 
3752
            // Mobile browser check
3753
            if (/ Mobile\//.test(ua) || (/iPad|iPod|iPhone/).test(ua)) {
3754
                o.mobile = 'Apple'; // iPhone or iPod Touch
3755
 
3756
                m = ua.match(/OS ([^\s]*)/);
3757
                if (m && m[1]) {
3758
                    m = numberify(m[1].replace('_', '.'));
3759
                }
3760
                o.ios = m;
3761
                o.os = 'ios';
3762
                o.ipad = o.ipod = o.iphone = 0;
3763
 
3764
                m = ua.match(/iPad|iPod|iPhone/);
3765
                if (m && m[0]) {
3766
                    o[m[0].toLowerCase()] = o.ios;
3767
                }
3768
            } else {
3769
                m = ua.match(/NokiaN[^\/]*|webOS\/\d\.\d/);
3770
                if (m) {
3771
                    // Nokia N-series, webOS, ex: NokiaN95
3772
                    o.mobile = m[0];
3773
                }
3774
                if (/webOS/.test(ua)) {
3775
                    o.mobile = 'WebOS';
3776
                    m = ua.match(/webOS\/([^\s]*);/);
3777
                    if (m && m[1]) {
3778
                        o.webos = numberify(m[1]);
3779
                    }
3780
                }
3781
                if (/ Android/.test(ua)) {
3782
                    o.mobile = 'Android';
3783
                    m = ua.match(/Android ([^\s]*);/);
3784
                    if (m && m[1]) {
3785
                        o.android = numberify(m[1]);
3786
                    }
3787
 
3788
                }
3789
                if (/Silk/.test(ua)) {
3790
                    m = ua.match(/Silk\/([^\s]*)/);
3791
                    if (m && m[1]) {
3792
                        o.silk = numberify(m[1]);
3793
                    }
3794
                    if (!o.android) {
3795
                        o.android = 2.34; //Hack for desktop mode in Kindle
3796
                        o.os = 'Android';
3797
                    }
3798
                    if (/Accelerated=true/.test(ua)) {
3799
                        o.accel = true;
3800
                    }
3801
                }
3802
            }
3803
 
3804
            m = ua.match(/OPR\/(\d+\.\d+)/);
3805
 
3806
            if (m && m[1]) {
3807
                // Opera 15+ with Blink (pretends to be both Chrome and Safari)
3808
                o.opera = numberify(m[1]);
3809
            } else {
3810
                m = ua.match(/(Chrome|CrMo|CriOS)\/([^\s]*)/);
3811
 
3812
                if (m && m[1] && m[2]) {
3813
                    o.chrome = numberify(m[2]); // Chrome
3814
                    o.safari = 0; //Reset safari back to 0
3815
                    if (m[1] === 'CrMo') {
3816
                        o.mobile = 'chrome';
3817
                    }
3818
                } else {
3819
                    m = ua.match(/AdobeAIR\/([^\s]*)/);
3820
                    if (m) {
3821
                        o.air = m[0]; // Adobe AIR 1.0 or better
3822
                    }
3823
                }
3824
            }
3825
        }
3826
 
3827
        m = ua.match(/Ubuntu\ (\d+\.\d+)/);
3828
        if (m && m[1]) {
3829
 
3830
            o.os = 'linux';
3831
            o.ubuntu = numberify(m[1]);
3832
 
3833
            m = ua.match(/\ WebKit\/([^\s]*)/);
3834
            if (m && m[1]) {
3835
                o.webkit = numberify(m[1]);
3836
            }
3837
            m = ua.match(/\ Chromium\/([^\s]*)/);
3838
            if (m && m[1]) {
3839
                o.chrome = numberify(m[1]);
3840
            }
3841
            if (/ Mobile$/.test(ua)) {
3842
                o.mobile = 'Ubuntu';
3843
            }
3844
        }
3845
 
3846
        if (!o.webkit) { // not webkit
3847
// @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
3848
            if (/Opera/.test(ua)) {
3849
                m = ua.match(/Opera[\s\/]([^\s]*)/);
3850
                if (m && m[1]) {
3851
                    o.opera = numberify(m[1]);
3852
                }
3853
                m = ua.match(/Version\/([^\s]*)/);
3854
                if (m && m[1]) {
3855
                    o.opera = numberify(m[1]); // opera 10+
3856
                }
3857
 
3858
                if (/Opera Mobi/.test(ua)) {
3859
                    o.mobile = 'opera';
3860
                    m = ua.replace('Opera Mobi', '').match(/Opera ([^\s]*)/);
3861
                    if (m && m[1]) {
3862
                        o.opera = numberify(m[1]);
3863
                    }
3864
                }
3865
                m = ua.match(/Opera Mini[^;]*/);
3866
 
3867
                if (m) {
3868
                    o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
3869
                }
3870
            } else { // not opera or webkit
3871
                m = ua.match(/MSIE ([^;]*)|Trident.*; rv:([0-9.]+)/);
3872
 
3873
                if (m && (m[1] || m[2])) {
3874
                    o.ie = numberify(m[1] || m[2]);
3875
                } else { // not opera, webkit, or ie
3876
                    m = ua.match(/Gecko\/([^\s]*)/);
3877
 
3878
                    if (m) {
3879
                        o.gecko = 1; // Gecko detected, look for revision
3880
                        m = ua.match(/rv:([^\s\)]*)/);
3881
                        if (m && m[1]) {
3882
                            o.gecko = numberify(m[1]);
3883
                            if (/Mobile|Tablet/.test(ua)) {
3884
                                o.mobile = "ffos";
3885
                            }
3886
                        }
3887
                    }
3888
                }
3889
            }
3890
        }
3891
    }
3892
 
3893
    //Check for known properties to tell if touch events are enabled on this device or if
3894
    //the number of MSPointer touchpoints on this device is greater than 0.
3895
    if (win && nav && !(o.chrome && o.chrome < 6)) {
3896
        o.touchEnabled = (("ontouchstart" in win) || (("msMaxTouchPoints" in nav) && (nav.msMaxTouchPoints > 0)));
3897
    }
3898
 
3899
    //It was a parsed UA, do not assign the global value.
3900
    if (!subUA) {
3901
 
3902
        if (typeof process === 'object') {
3903
 
3904
            if (process.versions && process.versions.node) {
3905
                //NodeJS
3906
                o.os = process.platform;
3907
                o.nodejs = numberify(process.versions.node);
3908
            }
3909
        }
3910
 
3911
        YUI.Env.UA = o;
3912
 
3913
    }
3914
 
3915
    return o;
3916
};
3917
 
3918
 
3919
Y.UA = YUI.Env.UA || YUI.Env.parseUA();
3920
 
3921
/**
3922
Performs a simple comparison between two version numbers, accounting for
3923
standard versioning logic such as the fact that "535.8" is a lower version than
3924
"535.24", even though a simple numerical comparison would indicate that it's
3925
greater. Also accounts for cases such as "1.1" vs. "1.1.0", which are
3926
considered equivalent.
3927
 
3928
Returns -1 if version _a_ is lower than version _b_, 0 if they're equivalent,
3929
1 if _a_ is higher than _b_.
3930
 
3931
Versions may be numbers or strings containing numbers and dots. For example,
3932
both `535` and `"535.8.10"` are acceptable. A version string containing
3933
non-numeric characters, like `"535.8.beta"`, may produce unexpected results.
3934
 
3935
@method compareVersions
3936
@param {Number|String} a First version number to compare.
3937
@param {Number|String} b Second version number to compare.
3938
@return -1 if _a_ is lower than _b_, 0 if they're equivalent, 1 if _a_ is
3939
    higher than _b_.
3940
**/
3941
Y.UA.compareVersions = function (a, b) {
3942
    var aPart, aParts, bPart, bParts, i, len;
3943
 
3944
    if (a === b) {
3945
        return 0;
3946
    }
3947
 
3948
    aParts = (a + '').split('.');
3949
    bParts = (b + '').split('.');
3950
 
3951
    for (i = 0, len = Math.max(aParts.length, bParts.length); i < len; ++i) {
3952
        aPart = parseInt(aParts[i], 10);
3953
        bPart = parseInt(bParts[i], 10);
3954
 
3955
        /*jshint expr: true*/
3956
        isNaN(aPart) && (aPart = 0);
3957
        isNaN(bPart) && (bPart = 0);
3958
 
3959
        if (aPart < bPart) {
3960
            return -1;
3961
        }
3962
 
3963
        if (aPart > bPart) {
3964
            return 1;
3965
        }
3966
    }
3967
 
3968
    return 0;
3969
};
3970
YUI.Env.aliases = {
3971
    "anim": ["anim-base","anim-color","anim-curve","anim-easing","anim-node-plugin","anim-scroll","anim-xy"],
3972
    "anim-shape-transform": ["anim-shape"],
3973
    "app": ["app-base","app-content","app-transitions","lazy-model-list","model","model-list","model-sync-rest","model-sync-local","router","view","view-node-map"],
3974
    "attribute": ["attribute-base","attribute-complex"],
3975
    "attribute-events": ["attribute-observable"],
3976
    "autocomplete": ["autocomplete-base","autocomplete-sources","autocomplete-list","autocomplete-plugin"],
3977
    "axes": ["axis-numeric","axis-category","axis-time","axis-stacked"],
3978
    "axes-base": ["axis-numeric-base","axis-category-base","axis-time-base","axis-stacked-base"],
3979
    "base": ["base-base","base-pluginhost","base-build"],
3980
    "cache": ["cache-base","cache-offline","cache-plugin"],
3981
    "charts": ["charts-base"],
3982
    "collection": ["array-extras","arraylist","arraylist-add","arraylist-filter","array-invoke"],
3983
    "color": ["color-base","color-hsl","color-harmony"],
3984
    "controller": ["router"],
3985
    "dataschema": ["dataschema-base","dataschema-json","dataschema-xml","dataschema-array","dataschema-text"],
3986
    "datasource": ["datasource-local","datasource-io","datasource-get","datasource-function","datasource-cache","datasource-jsonschema","datasource-xmlschema","datasource-arrayschema","datasource-textschema","datasource-polling"],
3987
    "datatable": ["datatable-core","datatable-table","datatable-head","datatable-body","datatable-base","datatable-column-widths","datatable-message","datatable-mutable","datatable-sort","datatable-datasource"],
3988
    "datatype": ["datatype-date","datatype-number","datatype-xml"],
3989
    "datatype-date": ["datatype-date-parse","datatype-date-format","datatype-date-math"],
3990
    "datatype-number": ["datatype-number-parse","datatype-number-format"],
3991
    "datatype-xml": ["datatype-xml-parse","datatype-xml-format"],
3992
    "dd": ["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-drop","dd-scroll","dd-delegate"],
3993
    "dom": ["dom-base","dom-screen","dom-style","selector-native","selector"],
3994
    "editor": ["frame","editor-selection","exec-command","editor-base","editor-para","editor-br","editor-bidi","editor-tab","createlink-base"],
3995
    "event": ["event-base","event-delegate","event-synthetic","event-mousewheel","event-mouseenter","event-key","event-focus","event-resize","event-hover","event-outside","event-touch","event-move","event-flick","event-valuechange","event-tap"],
3996
    "event-custom": ["event-custom-base","event-custom-complex"],
3997
    "event-gestures": ["event-flick","event-move"],
3998
    "handlebars": ["handlebars-compiler"],
3999
    "highlight": ["highlight-base","highlight-accentfold"],
4000
    "history": ["history-base","history-hash","history-html5"],
4001
    "io": ["io-base","io-xdr","io-form","io-upload-iframe","io-queue"],
4002
    "json": ["json-parse","json-stringify"],
4003
    "loader": ["loader-base","loader-rollup","loader-yui3"],
4004
    "loader-pathogen-encoder": ["loader-base","loader-rollup","loader-yui3","loader-pathogen-combohandler"],
4005
    "node": ["node-base","node-event-delegate","node-pluginhost","node-screen","node-style"],
4006
    "pluginhost": ["pluginhost-base","pluginhost-config"],
4007
    "querystring": ["querystring-parse","querystring-stringify"],
4008
    "recordset": ["recordset-base","recordset-sort","recordset-filter","recordset-indexer"],
4009
    "resize": ["resize-base","resize-proxy","resize-constrain"],
4010
    "slider": ["slider-base","slider-value-range","clickable-rail","range-slider"],
4011
    "template": ["template-base","template-micro"],
4012
    "text": ["text-accentfold","text-wordbreak"],
4013
    "widget": ["widget-base","widget-htmlparser","widget-skin","widget-uievents"]
4014
};
4015
 
4016
 
4017
}, '3.18.1', {
4018
    "use": [
4019
        "yui-base",
4020
        "get",
4021
        "features",
4022
        "intl-base",
4023
        "yui-log",
4024
        "yui-log-nodejs",
4025
        "yui-later",
4026
        "loader-base",
4027
        "loader-rollup",
4028
        "loader-yui3"
4029
    ]
4030
});
4031
YUI.add('get', function (Y, NAME) {
4032
 
4033
    /**
4034
    * NodeJS specific Get module used to load remote resources.
4035
    * It contains the same signature as the default Get module so there is no code change needed.
4036
    * @module get-nodejs
4037
    * @class GetNodeJS
4038
    */
4039
 
4040
    var Module = require('module'),
4041
 
4042
        path = require('path'),
4043
        fs = require('fs'),
4044
        request = require('request'),
4045
        end = function(cb, msg, result) {
4046
            if (Y.Lang.isFunction(cb.onEnd)) {
4047
                cb.onEnd.call(Y, msg, result);
4048
            }
4049
        }, pass = function(cb) {
4050
            if (Y.Lang.isFunction(cb.onSuccess)) {
4051
                cb.onSuccess.call(Y, cb);
4052
            }
4053
            end(cb, 'success', 'success');
4054
        }, fail = function(cb, er) {
4055
            er.errors = [er];
4056
            if (Y.Lang.isFunction(cb.onFailure)) {
4057
                cb.onFailure.call(Y, er, cb);
4058
            }
4059
            end(cb, er, 'fail');
4060
        };
4061
 
4062
 
4063
    Y.Get = function() {
4064
    };
4065
 
4066
    //Setup the default config base path
4067
    Y.config.base = path.join(__dirname, '../');
4068
 
4069
    YUI.require = require;
4070
    YUI.process = process;
4071
 
4072
    /**
4073
    * Takes the raw JS files and wraps them to be executed in the YUI context so they can be loaded
4074
    * into the YUI object
4075
    * @method _exec
4076
    * @private
4077
    * @param {String} data The JS to execute
4078
    * @param {String} url The path to the file that was parsed
4079
    * @param {Function} cb The callback to execute when this is completed
4080
    * @param {Error} cb.err=null Error object
4081
    * @param {String} cb.url The URL that was just parsed
4082
    */
4083
 
4084
    Y.Get._exec = function(data, url, cb) {
4085
        if (data.charCodeAt(0) === 0xFEFF) {
4086
            data = data.slice(1);
4087
        }
4088
 
4089
        var mod = new Module(url, module);
4090
        mod.filename = url;
4091
        mod.paths = Module._nodeModulePaths(path.dirname(url));
4092
        if (typeof YUI._getLoadHook === 'function') {
4093
            data = YUI._getLoadHook(data, url);
4094
        }
4095
        mod._compile('module.exports = function (YUI) {' +
4096
            'return (function () {'+ data + '\n;return YUI;}).apply(global);' +
4097
        '};', url);
4098
 
4099
        /*global YUI:true */
4100
        YUI = mod.exports(YUI);
4101
 
4102
        mod.loaded = true;
4103
 
4104
        cb(null, url);
4105
    };
4106
 
4107
    /**
4108
    * Fetches the content from a remote URL or a file from disc and passes the content
4109
    * off to `_exec` for parsing
4110
    * @method _include
4111
    * @private
4112
    * @param {String} url The URL/File path to fetch the content from
4113
    * @param {Function} cb The callback to fire once the content has been executed via `_exec`
4114
    */
4115
    Y.Get._include = function (url, cb) {
4116
        var cfg,
4117
            mod,
4118
            self = this;
4119
 
4120
        if (url.match(/^https?:\/\//)) {
4121
            cfg = {
4122
                url: url,
4123
                timeout: self.timeout
4124
            };
4125
            request(cfg, function (err, response, body) {
4126
                if (err) {
4127
                    cb(err, url);
4128
                } else {
4129
                    Y.Get._exec(body, url, cb);
4130
                }
4131
            });
4132
        } else {
4133
            try {
4134
                // Try to resolve paths relative to the module that required yui.
4135
                url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]);
4136
 
4137
                if (Y.config.useSync) {
4138
                    //Needs to be in useSync
4139
                    mod = fs.readFileSync(url,'utf8');
4140
                } else {
4141
                    fs.readFile(url, 'utf8', function (err, mod) {
4142
                        if (err) {
4143
                            cb(err, url);
4144
                        } else {
4145
                            Y.Get._exec(mod, url, cb);
4146
                        }
4147
                    });
4148
                    return;
4149
                }
4150
            } catch (err) {
4151
                cb(err, url);
4152
                return;
4153
            }
4154
 
4155
            Y.Get._exec(mod, url, cb);
4156
        }
4157
    };
4158
 
4159
 
4160
    /**
4161
    * Override for Get.script for loading local or remote YUI modules.
4162
    * @method js
4163
    * @param {Array|String} s The URL's to load into this context
4164
    * @param {Object} options Transaction options
4165
    */
4166
    Y.Get.js = function(s, options) {
4167
        var urls = Y.Array(s), url, i, l = urls.length, c= 0,
4168
            check = function() {
4169
                if (c === l) {
4170
                    pass(options);
4171
                }
4172
            };
4173
 
4174
 
4175
        /*jshint loopfunc: true */
4176
        for (i=0; i<l; i++) {
4177
            url = urls[i];
4178
            if (Y.Lang.isObject(url)) {
4179
                url = url.url;
4180
            }
4181
 
4182
            url = url.replace(/'/g, '%27');
4183
            Y.Get._include(url, function(err, url) {
4184
                if (!Y.config) {
4185
                    Y.config = {
4186
                        debug: true
4187
                    };
4188
                }
4189
                if (options.onProgress) {
4190
                    options.onProgress.call(options.context || Y, url);
4191
                }
4192
                if (err) {
4193
                    fail(options, err);
4194
                } else {
4195
                    c++;
4196
                    check();
4197
                }
4198
            });
4199
        }
4200
 
4201
        //Keeping Signature in the browser.
4202
        return {
4203
            execute: function() {}
4204
        };
4205
    };
4206
 
4207
    /**
4208
    * Alias for `Y.Get.js`
4209
    * @method script
4210
    */
4211
    Y.Get.script = Y.Get.js;
4212
 
4213
    //Place holder for SS Dom access
4214
    Y.Get.css = function(s, cb) {
4215
        pass(cb);
4216
    };
4217
 
4218
 
4219
 
4220
}, '3.18.1');
4221
YUI.add('features', function (Y, NAME) {
4222
 
4223
var feature_tests = {};
4224
 
4225
/**
4226
Contains the core of YUI's feature test architecture.
4227
@module features
4228
*/
4229
 
4230
/**
4231
* Feature detection
4232
* @class Features
4233
* @static
4234
*/
4235
 
4236
Y.mix(Y.namespace('Features'), {
4237
 
4238
    /**
4239
    * Object hash of all registered feature tests
4240
    * @property tests
4241
    * @type Object
4242
    */
4243
    tests: feature_tests,
4244
 
4245
    /**
4246
    * Add a test to the system
4247
    *
4248
    *   ```
4249
    *   Y.Features.add("load", "1", {});
4250
    *   ```
4251
    *
4252
    * @method add
4253
    * @param {String} cat The category, right now only 'load' is supported
4254
    * @param {String} name The number sequence of the test, how it's reported in the URL or config: 1, 2, 3
4255
    * @param {Object} o Object containing test properties
4256
    * @param {String} o.name The name of the test
4257
    * @param {Function} o.test The test function to execute, the only argument to the function is the `Y` instance
4258
    * @param {String} o.trigger The module that triggers this test.
4259
    */
4260
    add: function(cat, name, o) {
4261
        feature_tests[cat] = feature_tests[cat] || {};
4262
        feature_tests[cat][name] = o;
4263
    },
4264
    /**
4265
    * Execute all tests of a given category and return the serialized results
4266
    *
4267
    *   ```
4268
    *   caps=1:1;2:1;3:0
4269
    *   ```
4270
    * @method all
4271
    * @param {String} cat The category to execute
4272
    * @param {Array} args The arguments to pass to the test function
4273
    * @return {String} A semi-colon separated string of tests and their success/failure: 1:1;2:1;3:0
4274
    */
4275
    all: function(cat, args) {
4276
        var cat_o = feature_tests[cat],
4277
            // results = {};
4278
            result = [];
4279
        if (cat_o) {
4280
            Y.Object.each(cat_o, function(v, k) {
4281
                result.push(k + ':' + (Y.Features.test(cat, k, args) ? 1 : 0));
4282
            });
4283
        }
4284
 
4285
        return (result.length) ? result.join(';') : '';
4286
    },
4287
    /**
4288
    * Run a specific test and return a Boolean response.
4289
    *
4290
    *   ```
4291
    *   Y.Features.test("load", "1");
4292
    *   ```
4293
    *
4294
    * @method test
4295
    * @param {String} cat The category of the test to run
4296
    * @param {String} name The name of the test to run
4297
    * @param {Array} args The arguments to pass to the test function
4298
    * @return {Boolean} True or false if the test passed/failed.
4299
    */
4300
    test: function(cat, name, args) {
4301
        args = args || [];
4302
        var result, ua, test,
4303
            cat_o = feature_tests[cat],
4304
            feature = cat_o && cat_o[name];
4305
 
4306
        if (!feature) {
4307
        } else {
4308
 
4309
            result = feature.result;
4310
 
4311
            if (Y.Lang.isUndefined(result)) {
4312
 
4313
                ua = feature.ua;
4314
                if (ua) {
4315
                    result = (Y.UA[ua]);
4316
                }
4317
 
4318
                test = feature.test;
4319
                if (test && ((!ua) || result)) {
4320
                    result = test.apply(Y, args);
4321
                }
4322
 
4323
                feature.result = result;
4324
            }
4325
        }
4326
 
4327
        return result;
4328
    }
4329
});
4330
 
4331
// Y.Features.add("load", "1", {});
4332
// Y.Features.test("load", "1");
4333
// caps=1:1;2:0;3:1;
4334
 
4335
/* This file is auto-generated by (yogi loader --yes --mix --start ../) */
4336
/*jshint maxlen:900, eqeqeq: false */
4337
var add = Y.Features.add;
4338
// app-transitions-native
4339
add('load', '0', {
4340
    "name": "app-transitions-native",
4341
    "test": function (Y) {
4342
    var doc  = Y.config.doc,
4343
        node = doc ? doc.documentElement : null;
4344
 
4345
    if (node && node.style) {
4346
        return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style);
4347
    }
4348
 
4349
    return false;
4350
},
4351
    "trigger": "app-transitions"
4352
});
4353
// autocomplete-list-keys
4354
add('load', '1', {
4355
    "name": "autocomplete-list-keys",
4356
    "test": function (Y) {
4357
    // Only add keyboard support to autocomplete-list if this doesn't appear to
4358
    // be an iOS or Android-based mobile device.
4359
    //
4360
    // There's currently no feasible way to actually detect whether a device has
4361
    // a hardware keyboard, so this sniff will have to do. It can easily be
4362
    // overridden by manually loading the autocomplete-list-keys module.
4363
    //
4364
    // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari
4365
    // doesn't fire the keyboard events used by AutoCompleteList, so there's
4366
    // no point loading the -keys module even when a bluetooth keyboard may be
4367
    // available.
4368
    return !(Y.UA.ios || Y.UA.android);
4369
},
4370
    "trigger": "autocomplete-list"
4371
});
4372
// dd-gestures
4373
add('load', '2', {
4374
    "name": "dd-gestures",
4375
    "trigger": "dd-drag",
4376
    "ua": "touchEnabled"
4377
});
4378
// dom-style-ie
4379
add('load', '3', {
4380
    "name": "dom-style-ie",
4381
    "test": function (Y) {
4382
 
4383
    var testFeature = Y.Features.test,
4384
        addFeature = Y.Features.add,
4385
        WINDOW = Y.config.win,
4386
        DOCUMENT = Y.config.doc,
4387
        DOCUMENT_ELEMENT = 'documentElement',
4388
        ret = false;
4389
 
4390
    addFeature('style', 'computedStyle', {
4391
        test: function() {
4392
            return WINDOW && 'getComputedStyle' in WINDOW;
4393
        }
4394
    });
4395
 
4396
    addFeature('style', 'opacity', {
4397
        test: function() {
4398
            return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style;
4399
        }
4400
    });
4401
 
4402
    ret =  (!testFeature('style', 'opacity') &&
4403
            !testFeature('style', 'computedStyle'));
4404
 
4405
    return ret;
4406
},
4407
    "trigger": "dom-style"
4408
});
4409
// editor-para-ie
4410
add('load', '4', {
4411
    "name": "editor-para-ie",
4412
    "trigger": "editor-para",
4413
    "ua": "ie",
4414
    "when": "instead"
4415
});
4416
// event-base-ie
4417
add('load', '5', {
4418
    "name": "event-base-ie",
4419
    "test": function(Y) {
4420
    var imp = Y.config.doc && Y.config.doc.implementation;
4421
    return (imp && (!imp.hasFeature('Events', '2.0')));
4422
},
4423
    "trigger": "node-base"
4424
});
4425
// graphics-canvas
4426
add('load', '6', {
4427
    "name": "graphics-canvas",
4428
    "test": function(Y) {
4429
    var DOCUMENT = Y.config.doc,
4430
        useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas",
4431
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
4432
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
4433
    return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d"));
4434
},
4435
    "trigger": "graphics"
4436
});
4437
// graphics-canvas-default
4438
add('load', '7', {
4439
    "name": "graphics-canvas-default",
4440
    "test": function(Y) {
4441
    var DOCUMENT = Y.config.doc,
4442
        useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas",
4443
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
4444
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
4445
    return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d"));
4446
},
4447
    "trigger": "graphics"
4448
});
4449
// graphics-svg
4450
add('load', '8', {
4451
    "name": "graphics-svg",
4452
    "test": function(Y) {
4453
    var DOCUMENT = Y.config.doc,
4454
        useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas",
4455
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
4456
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
4457
 
4458
    return svg && (useSVG || !canvas);
4459
},
4460
    "trigger": "graphics"
4461
});
4462
// graphics-svg-default
4463
add('load', '9', {
4464
    "name": "graphics-svg-default",
4465
    "test": function(Y) {
4466
    var DOCUMENT = Y.config.doc,
4467
        useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas",
4468
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
4469
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
4470
 
4471
    return svg && (useSVG || !canvas);
4472
},
4473
    "trigger": "graphics"
4474
});
4475
// graphics-vml
4476
add('load', '10', {
4477
    "name": "graphics-vml",
4478
    "test": function(Y) {
4479
    var DOCUMENT = Y.config.doc,
4480
		canvas = DOCUMENT && DOCUMENT.createElement("canvas");
4481
    return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
4482
},
4483
    "trigger": "graphics"
4484
});
4485
// graphics-vml-default
4486
add('load', '11', {
4487
    "name": "graphics-vml-default",
4488
    "test": function(Y) {
4489
    var DOCUMENT = Y.config.doc,
4490
		canvas = DOCUMENT && DOCUMENT.createElement("canvas");
4491
    return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
4492
},
4493
    "trigger": "graphics"
4494
});
4495
// history-hash-ie
4496
add('load', '12', {
4497
    "name": "history-hash-ie",
4498
    "test": function (Y) {
4499
    var docMode = Y.config.doc && Y.config.doc.documentMode;
4500
 
4501
    return Y.UA.ie && (!('onhashchange' in Y.config.win) ||
4502
            !docMode || docMode < 8);
4503
},
4504
    "trigger": "history-hash"
4505
});
4506
// io-nodejs
4507
add('load', '13', {
4508
    "name": "io-nodejs",
4509
    "trigger": "io-base",
4510
    "ua": "nodejs"
4511
});
4512
// json-parse-shim
4513
add('load', '14', {
4514
    "name": "json-parse-shim",
4515
    "test": function (Y) {
4516
    var _JSON = Y.config.global.JSON,
4517
        Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON,
4518
        nativeSupport = Y.config.useNativeJSONParse !== false && !!Native;
4519
 
4520
    function workingNative( k, v ) {
4521
        return k === "ok" ? true : v;
4522
    }
4523
 
4524
    // Double check basic functionality.  This is mainly to catch early broken
4525
    // implementations of the JSON API in Firefox 3.1 beta1 and beta2
4526
    if ( nativeSupport ) {
4527
        try {
4528
            nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok;
4529
        }
4530
        catch ( e ) {
4531
            nativeSupport = false;
4532
        }
4533
    }
4534
 
4535
    return !nativeSupport;
4536
},
4537
    "trigger": "json-parse"
4538
});
4539
// json-stringify-shim
4540
add('load', '15', {
4541
    "name": "json-stringify-shim",
4542
    "test": function (Y) {
4543
    var _JSON = Y.config.global.JSON,
4544
        Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON,
4545
        nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native;
4546
 
4547
    // Double check basic native functionality.  This is primarily to catch broken
4548
    // early JSON API implementations in Firefox 3.1 beta1 and beta2.
4549
    if ( nativeSupport ) {
4550
        try {
4551
            nativeSupport = ( '0' === Native.stringify(0) );
4552
        } catch ( e ) {
4553
            nativeSupport = false;
4554
        }
4555
    }
4556
 
4557
 
4558
    return !nativeSupport;
4559
},
4560
    "trigger": "json-stringify"
4561
});
4562
// scrollview-base-ie
4563
add('load', '16', {
4564
    "name": "scrollview-base-ie",
4565
    "trigger": "scrollview-base",
4566
    "ua": "ie"
4567
});
4568
// selector-css2
4569
add('load', '17', {
4570
    "name": "selector-css2",
4571
    "test": function (Y) {
4572
    var DOCUMENT = Y.config.doc,
4573
        ret = DOCUMENT && !('querySelectorAll' in DOCUMENT);
4574
 
4575
    return ret;
4576
},
4577
    "trigger": "selector"
4578
});
4579
// transition-timer
4580
add('load', '18', {
4581
    "name": "transition-timer",
4582
    "test": function (Y) {
4583
    var DOCUMENT = Y.config.doc,
4584
        node = (DOCUMENT) ? DOCUMENT.documentElement: null,
4585
        ret = true;
4586
 
4587
    if (node && node.style) {
4588
        ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style);
4589
    }
4590
 
4591
    return ret;
4592
},
4593
    "trigger": "transition"
4594
});
4595
// widget-base-ie
4596
add('load', '19', {
4597
    "name": "widget-base-ie",
4598
    "trigger": "widget-base",
4599
    "ua": "ie"
4600
});
4601
// yql-jsonp
4602
add('load', '20', {
4603
    "name": "yql-jsonp",
4604
    "test": function (Y) {
4605
    /* Only load the JSONP module when not in nodejs or winjs
4606
    TODO Make the winjs module a CORS module
4607
    */
4608
    return (!Y.UA.nodejs && !Y.UA.winjs);
4609
},
4610
    "trigger": "yql"
4611
});
4612
// yql-nodejs
4613
add('load', '21', {
4614
    "name": "yql-nodejs",
4615
    "trigger": "yql",
4616
    "ua": "nodejs"
4617
});
4618
// yql-winjs
4619
add('load', '22', {
4620
    "name": "yql-winjs",
4621
    "trigger": "yql",
4622
    "ua": "winjs"
4623
});
4624
 
4625
}, '3.18.1', {"requires": ["yui-base"]});
4626
YUI.add('intl-base', function (Y, NAME) {
4627
 
4628
/**
4629
 * The Intl utility provides a central location for managing sets of
4630
 * localized resources (strings and formatting patterns).
4631
 *
4632
 * @class Intl
4633
 * @uses EventTarget
4634
 * @static
4635
 */
4636
 
4637
var SPLIT_REGEX = /[, ]/;
4638
 
4639
Y.mix(Y.namespace('Intl'), {
4640
 
4641
 /**
4642
    * Returns the language among those available that
4643
    * best matches the preferred language list, using the Lookup
4644
    * algorithm of BCP 47.
4645
    * If none of the available languages meets the user's preferences,
4646
    * then "" is returned.
4647
    * Extended language ranges are not supported.
4648
    *
4649
    * @method lookupBestLang
4650
    * @param {String[] | String} preferredLanguages The list of preferred
4651
    * languages in descending preference order, represented as BCP 47
4652
    * language tags. A string array or a comma-separated list.
4653
    * @param {String[]} availableLanguages The list of languages
4654
    * that the application supports, represented as BCP 47 language
4655
    * tags.
4656
    *
4657
    * @return {String} The available language that best matches the
4658
    * preferred language list, or "".
4659
    * @since 3.1.0
4660
    */
4661
    lookupBestLang: function(preferredLanguages, availableLanguages) {
4662
 
4663
        var i, language, result, index;
4664
 
4665
        // check whether the list of available languages contains language;
4666
        // if so return it
4667
        function scan(language) {
4668
            var i;
4669
            for (i = 0; i < availableLanguages.length; i += 1) {
4670
                if (language.toLowerCase() ===
4671
                            availableLanguages[i].toLowerCase()) {
4672
                    return availableLanguages[i];
4673
                }
4674
            }
4675
        }
4676
 
4677
        if (Y.Lang.isString(preferredLanguages)) {
4678
            preferredLanguages = preferredLanguages.split(SPLIT_REGEX);
4679
        }
4680
 
4681
        for (i = 0; i < preferredLanguages.length; i += 1) {
4682
            language = preferredLanguages[i];
4683
            if (!language || language === '*') {
4684
                continue;
4685
            }
4686
            // check the fallback sequence for one language
4687
            while (language.length > 0) {
4688
                result = scan(language);
4689
                if (result) {
4690
                    return result;
4691
                } else {
4692
                    index = language.lastIndexOf('-');
4693
                    if (index >= 0) {
4694
                        language = language.substring(0, index);
4695
                        // one-character subtags get cut along with the
4696
                        // following subtag
4697
                        if (index >= 2 && language.charAt(index - 2) === '-') {
4698
                            language = language.substring(0, index - 2);
4699
                        }
4700
                    } else {
4701
                        // nothing available for this language
4702
                        break;
4703
                    }
4704
                }
4705
            }
4706
        }
4707
 
4708
        return '';
4709
    }
4710
});
4711
 
4712
 
4713
}, '3.18.1', {"requires": ["yui-base"]});
4714
YUI.add('yui-log', function (Y, NAME) {
4715
 
4716
/**
4717
 * Provides console log capability and exposes a custom event for
4718
 * console implementations. This module is a `core` YUI module,
4719
 * <a href="../classes/YUI.html#method_log">it's documentation is located under the YUI class</a>.
4720
 *
4721
 * @module yui
4722
 * @submodule yui-log
4723
 */
4724
 
4725
var INSTANCE = Y,
4726
    LOGEVENT = 'yui:log',
4727
    UNDEFINED = 'undefined',
4728
    LEVELS = { debug: 1,
4729
               info: 2,
4730
               warn: 4,
4731
               error: 8 };
4732
 
4733
/**
4734
 * If the 'debug' config is true, a 'yui:log' event will be
4735
 * dispatched, which the Console widget and anything else
4736
 * can consume.  If the 'useBrowserConsole' config is true, it will
4737
 * write to the browser console if available.  YUI-specific log
4738
 * messages will only be present in the -debug versions of the
4739
 * JS files.  The build system is supposed to remove log statements
4740
 * from the raw and minified versions of the files.
4741
 *
4742
 * @method log
4743
 * @for YUI
4744
 * @param  {String}  msg  The message to log.
4745
 * @param  {String}  cat  The log category for the message.  Default
4746
 *                        categories are "info", "warn", "error", "debug".
4747
 *                        Custom categories can be used as well. (opt).
4748
 * @param  {String}  src  The source of the the message (opt).
4749
 * @param  {boolean} silent If true, the log event won't fire.
4750
 * @return {YUI}      YUI instance.
4751
 */
4752
INSTANCE.log = function(msg, cat, src, silent) {
4753
    var bail, excl, incl, m, f, minlevel,
4754
        Y = INSTANCE,
4755
        c = Y.config,
4756
        publisher = (Y.fire) ? Y : YUI.Env.globalEvents;
4757
    // suppress log message if the config is off or the event stack
4758
    // or the event call stack contains a consumer of the yui:log event
4759
    if (c.debug) {
4760
        // apply source filters
4761
        src = src || "";
4762
        if (typeof src !== "undefined") {
4763
            excl = c.logExclude;
4764
            incl = c.logInclude;
4765
            if (incl && !(src in incl)) {
4766
                bail = 1;
4767
            } else if (incl && (src in incl)) {
4768
                bail = !incl[src];
4769
            } else if (excl && (src in excl)) {
4770
                bail = excl[src];
4771
            }
4772
 
4773
            // Set a default category of info if the category was not defined.
4774
            if ((typeof cat === 'undefined')) {
4775
                cat = 'info';
4776
            }
4777
 
4778
            // Determine the current minlevel as defined in configuration
4779
            Y.config.logLevel = Y.config.logLevel || 'debug';
4780
            minlevel = LEVELS[Y.config.logLevel.toLowerCase()];
4781
 
4782
            if (cat in LEVELS && LEVELS[cat] < minlevel) {
4783
                // Skip this message if the we don't meet the defined minlevel
4784
                bail = 1;
4785
            }
4786
        }
4787
        if (!bail) {
4788
            if (c.useBrowserConsole) {
4789
                m = (src) ? src + ': ' + msg : msg;
4790
                if (Y.Lang.isFunction(c.logFn)) {
4791
                    c.logFn.call(Y, msg, cat, src);
4792
                } else if (typeof console !== UNDEFINED && console.log) {
4793
                    f = (cat && console[cat] && (cat in LEVELS)) ? cat : 'log';
4794
                    console[f](m);
4795
                } else if (typeof opera !== UNDEFINED) {
4796
                    opera.postError(m);
4797
                }
4798
            }
4799
 
4800
            if (publisher && !silent) {
4801
 
4802
                if (publisher === Y && (!publisher.getEvent(LOGEVENT))) {
4803
                    publisher.publish(LOGEVENT, {
4804
                        broadcast: 2
4805
                    });
4806
                }
4807
 
4808
                publisher.fire(LOGEVENT, {
4809
                    msg: msg,
4810
                    cat: cat,
4811
                    src: src
4812
                });
4813
            }
4814
        }
4815
    }
4816
 
4817
    return Y;
4818
};
4819
 
4820
/**
4821
 * Write a system message.  This message will be preserved in the
4822
 * minified and raw versions of the YUI files, unlike log statements.
4823
 * @method message
4824
 * @for YUI
4825
 * @param  {String}  msg  The message to log.
4826
 * @param  {String}  cat  The log category for the message.  Default
4827
 *                        categories are "info", "warn", "error", "debug".
4828
 *                        Custom categories can be used as well. (opt).
4829
 * @param  {String}  src  The source of the the message (opt).
4830
 * @param  {boolean} silent If true, the log event won't fire.
4831
 * @return {YUI}      YUI instance.
4832
 */
4833
INSTANCE.message = function() {
4834
    return INSTANCE.log.apply(INSTANCE, arguments);
4835
};
4836
 
4837
 
4838
}, '3.18.1', {"requires": ["yui-base"]});
4839
YUI.add('yui-log-nodejs', function (Y, NAME) {
4840
 
4841
var sys = require(process.binding('natives').util ? 'util' : 'sys'),
4842
    hasColor = false;
4843
 
4844
try {
4845
    var stdio = require("stdio");
4846
    hasColor = stdio.isStderrATTY();
4847
} catch (ex) {
4848
    hasColor = true;
4849
}
4850
 
4851
Y.config.useColor = hasColor;
4852
 
4853
Y.consoleColor = function(str, num) {
4854
    if (!this.config.useColor) {
4855
        return str;
4856
    }
4857
    if (!num) {
4858
        num = '32';
4859
    }
4860
    return "\u001b[" + num +"m" + str + "\u001b[0m";
4861
};
4862
 
4863
 
4864
var logFn = function(str, t, m) {
4865
    var id = '', lvl, mLvl;
4866
    if (this.id) {
4867
        id = '[' + this.id + ']:';
4868
    }
4869
    t = t || 'info';
4870
    m = (m) ? this.consoleColor(' (' +  m.toLowerCase() + '):', 35) : '';
4871
 
4872
    if (str === null) {
4873
        str = 'null';
4874
    }
4875
 
4876
    if ((typeof str === 'object') || str instanceof Array) {
4877
        try {
4878
            //Should we use this?
4879
            if (str.tagName || str._yuid || str._query) {
4880
                str = str.toString();
4881
            } else {
4882
                str = sys.inspect(str);
4883
            }
4884
        } catch (e) {
4885
            //Fail catcher
4886
        }
4887
    }
4888
 
4889
    lvl = '37;40';
4890
    mLvl = ((str) ? '' : 31);
4891
    t = t+''; //Force to a string..
4892
    switch (t.toLowerCase()) {
4893
        case 'error':
4894
            lvl = mLvl = 31;
4895
            break;
4896
        case 'warn':
4897
            lvl = 33;
4898
            break;
4899
        case 'debug':
4900
            lvl = 34;
4901
            break;
4902
    }
4903
    if (typeof str === 'string') {
4904
        if (str && str.indexOf("\n") !== -1) {
4905
            str = "\n" + str;
4906
        }
4907
    }
4908
 
4909
    // output log messages to stderr
4910
    sys.error(this.consoleColor(t.toLowerCase() + ':', lvl) + m + ' ' + this.consoleColor(str, mLvl));
4911
};
4912
 
4913
if (!Y.config.logFn) {
4914
    Y.config.logFn = logFn;
4915
}
4916
 
4917
 
4918
 
4919
}, '3.18.1');
4920
YUI.add('yui-later', function (Y, NAME) {
4921
 
4922
/**
4923
 * Provides a setTimeout/setInterval wrapper. This module is a `core` YUI module,
4924
 * <a href="../classes/YUI.html#method_later">it's documentation is located under the YUI class</a>.
4925
 *
4926
 * @module yui
4927
 * @submodule yui-later
4928
 */
4929
 
4930
var NO_ARGS = [];
4931
 
4932
/**
4933
 * Executes the supplied function in the context of the supplied
4934
 * object 'when' milliseconds later.  Executes the function a
4935
 * single time unless periodic is set to true.
4936
 * @for YUI
4937
 * @method later
4938
 * @param when {Number} the number of milliseconds to wait until the fn
4939
 * is executed.
4940
 * @param o the context object.
4941
 * @param fn {Function|String} the function to execute or the name of
4942
 * the method in the 'o' object to execute.
4943
 * @param data [Array] data that is provided to the function.  This
4944
 * accepts either a single item or an array.  If an array is provided,
4945
 * the function is executed with one parameter for each array item.
4946
 * If you need to pass a single array parameter, it needs to be wrapped
4947
 * in an array [myarray].
4948
 *
4949
 * Note: native methods in IE may not have the call and apply methods.
4950
 * In this case, it will work, but you are limited to four arguments.
4951
 *
4952
 * @param periodic {boolean} if true, executes continuously at supplied
4953
 * interval until canceled.
4954
 * @return {object} a timer object. Call the cancel() method on this
4955
 * object to stop the timer.
4956
 */
4957
Y.later = function(when, o, fn, data, periodic) {
4958
    when = when || 0;
4959
    data = (!Y.Lang.isUndefined(data)) ? Y.Array(data) : NO_ARGS;
4960
    o = o || Y.config.win || Y;
4961
 
4962
    var cancelled = false,
4963
        method = (o && Y.Lang.isString(fn)) ? o[fn] : fn,
4964
        wrapper = function() {
4965
            // IE 8- may execute a setInterval callback one last time
4966
            // after clearInterval was called, so in order to preserve
4967
            // the cancel() === no more runny-run, we have to jump through
4968
            // an extra hoop.
4969
            if (!cancelled) {
4970
                if (!method.apply) {
4971
                    method(data[0], data[1], data[2], data[3]);
4972
                } else {
4973
                    method.apply(o, data || NO_ARGS);
4974
                }
4975
            }
4976
        },
4977
        id = (periodic) ? setInterval(wrapper, when) : setTimeout(wrapper, when);
4978
 
4979
    return {
4980
        id: id,
4981
        interval: periodic,
4982
        cancel: function() {
4983
            cancelled = true;
4984
            if (this.interval) {
4985
                clearInterval(id);
4986
            } else {
4987
                clearTimeout(id);
4988
            }
4989
        }
4990
    };
4991
};
4992
 
4993
Y.Lang.later = Y.later;
4994
 
4995
 
4996
 
4997
}, '3.18.1', {"requires": ["yui-base"]});
4998
YUI.add('loader-base', function (Y, NAME) {
4999
 
5000
/**
5001
 * The YUI loader core
5002
 * @module loader
5003
 * @submodule loader-base
5004
 */
5005
 
5006
(function() {
5007
    var VERSION = Y.version,
5008
        BUILD = '/build/',
5009
        ROOT = VERSION + '/',
5010
        CDN_BASE = Y.Env.base,
5011
        GALLERY_VERSION = 'gallery-2014.07.31-18-26',
5012
        TNT = '2in3',
5013
        TNT_VERSION = '4',
5014
        YUI2_VERSION = '2.9.0',
5015
        COMBO_BASE = CDN_BASE + 'combo?',
5016
        META = {
5017
            version: VERSION,
5018
            root: ROOT,
5019
            base: Y.Env.base,
5020
            comboBase: COMBO_BASE,
5021
            skin: {
5022
                defaultSkin: 'sam',
5023
                base: 'assets/skins/',
5024
                path: 'skin.css',
5025
                after: [
5026
                    'cssreset',
5027
                    'cssfonts',
5028
                    'cssgrids',
5029
                    'cssbase',
5030
                    'cssreset-context',
5031
                    'cssfonts-context'
5032
                ]
5033
            },
5034
            groups: {},
5035
            patterns: {}
5036
        },
5037
        groups = META.groups,
5038
        yui2Update = function(tnt, yui2, config) {
5039
            var root = TNT + '.' +
5040
                    (tnt || TNT_VERSION) + '/' +
5041
                    (yui2 || YUI2_VERSION) + BUILD,
5042
                base = (config && config.base) ? config.base : CDN_BASE,
5043
                combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE;
5044
 
5045
            groups.yui2.base = base + root;
5046
            groups.yui2.root = root;
5047
            groups.yui2.comboBase = combo;
5048
        },
5049
        galleryUpdate = function(tag, config) {
5050
            var root = (tag || GALLERY_VERSION) + BUILD,
5051
                base = (config && config.base) ? config.base : CDN_BASE,
5052
                combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE;
5053
 
5054
            groups.gallery.base = base + root;
5055
            groups.gallery.root = root;
5056
            groups.gallery.comboBase = combo;
5057
        };
5058
 
5059
 
5060
    groups[VERSION] = {};
5061
 
5062
    groups.gallery = {
5063
        ext: false,
5064
        combine: true,
5065
        comboBase: COMBO_BASE,
5066
        update: galleryUpdate,
5067
        patterns: {
5068
            'gallery-': {},
5069
            'lang/gallery-': {},
5070
            'gallerycss-': {
5071
                type: 'css'
5072
            }
5073
        }
5074
    };
5075
 
5076
    groups.yui2 = {
5077
        combine: true,
5078
        ext: false,
5079
        comboBase: COMBO_BASE,
5080
        update: yui2Update,
5081
        patterns: {
5082
            'yui2-': {
5083
                configFn: function(me) {
5084
                    if (/-skin|reset|fonts|grids|base/.test(me.name)) {
5085
                        me.type = 'css';
5086
                        me.path = me.path.replace(/\.js/, '.css');
5087
                        // this makes skins in builds earlier than
5088
                        // 2.6.0 work as long as combine is false
5089
                        me.path = me.path.replace(/\/yui2-skin/,
5090
                                            '/assets/skins/sam/yui2-skin');
5091
                    }
5092
                }
5093
            }
5094
        }
5095
    };
5096
 
5097
    galleryUpdate();
5098
    yui2Update();
5099
 
5100
    if (YUI.Env[VERSION]) {
5101
        Y.mix(META, YUI.Env[VERSION], false, [
5102
            'modules',
5103
            'groups',
5104
            'skin'
5105
        ], 0, true);
5106
    }
5107
 
5108
    YUI.Env[VERSION] = META;
5109
}());
5110
/*jslint forin: true, maxlen: 350 */
5111
 
5112
/**
5113
 * Loader dynamically loads script and css files.  It includes the dependency
5114
 * information for the version of the library in use, and will automatically pull in
5115
 * dependencies for the modules requested. It can also load the
5116
 * files from the Yahoo! CDN, and it can utilize the combo service provided on
5117
 * this network to reduce the number of http connections required to download
5118
 * YUI files.
5119
 *
5120
 * @module loader
5121
 * @main loader
5122
 * @submodule loader-base
5123
 */
5124
 
5125
var NOT_FOUND = {},
5126
    NO_REQUIREMENTS = [],
5127
    MAX_URL_LENGTH = 1024,
5128
    GLOBAL_ENV = YUI.Env,
5129
    GLOBAL_LOADED = GLOBAL_ENV._loaded,
5130
    CSS = 'css',
5131
    JS = 'js',
5132
    INTL = 'intl',
5133
    DEFAULT_SKIN = 'sam',
5134
    VERSION = Y.version,
5135
    ROOT_LANG = '',
5136
    YObject = Y.Object,
5137
    oeach = YObject.each,
5138
    yArray = Y.Array,
5139
    _queue = GLOBAL_ENV._loaderQueue,
5140
    META = GLOBAL_ENV[VERSION],
5141
    SKIN_PREFIX = 'skin-',
5142
    L = Y.Lang,
5143
    ON_PAGE = GLOBAL_ENV.mods,
5144
    modulekey,
5145
    _path = function(dir, file, type, nomin) {
5146
        var path = dir + '/' + file;
5147
        if (!nomin) {
5148
            path += '-min';
5149
        }
5150
        path += '.' + (type || CSS);
5151
 
5152
        return path;
5153
    };
5154
 
5155
 
5156
    if (!YUI.Env._cssLoaded) {
5157
        YUI.Env._cssLoaded = {};
5158
    }
5159
 
5160
 
5161
/**
5162
 * The component metadata is stored in Y.Env.meta.
5163
 * Part of the loader module.
5164
 * @property meta
5165
 * @for YUI
5166
 */
5167
Y.Env.meta = META;
5168
 
5169
/**
5170
 * Loader dynamically loads script and css files.  It includes the dependency
5171
 * info for the version of the library in use, and will automatically pull in
5172
 * dependencies for the modules requested. It can load the
5173
 * files from the Yahoo! CDN, and it can utilize the combo service provided on
5174
 * this network to reduce the number of http connections required to download
5175
 * YUI files. You can also specify an external, custom combo service to host
5176
 * your modules as well.
5177
 
5178
        var Y = YUI();
5179
        var loader = new Y.Loader({
5180
            filter: 'debug',
5181
            base: '../../',
5182
            root: 'build/',
5183
            combine: true,
5184
            require: ['node', 'dd', 'console']
5185
        });
5186
        var out = loader.resolve(true);
5187
 
5188
 * If the Loader needs to be patched before it is used for the first time, it
5189
 * should be done through the `doBeforeLoader` hook. Simply make the patch
5190
 * available via configuration before YUI is loaded:
5191
 
5192
        YUI_config = YUI_config || {};
5193
        YUI_config.doBeforeLoader = function (config) {
5194
            var resolve = this.context.Loader.prototype.resolve;
5195
            this.context.Loader.prototype.resolve = function () {
5196
                // do something here
5197
                return resolve.apply(this, arguments);
5198
            };
5199
        };
5200
 
5201
 * @constructor
5202
 * @class Loader
5203
 * @param {Object} config an optional set of configuration options.
5204
 * @param {String} config.base The base dir which to fetch this module from
5205
 * @param {String} config.comboBase The Combo service base path. Ex: `http://yui.yahooapis.com/combo?`
5206
 * @param {String} config.root The root path to prepend to module names for the combo service. Ex: `2.5.2/build/`
5207
 * @param {String|Object} config.filter A filter to apply to result urls. <a href="#property_filter">See filter property</a>
5208
 * @param {Object} config.filters Per-component filter specification.  If specified for a given component, this overrides the filter config.
5209
 * @param {Boolean} config.combine Use a combo service to reduce the number of http connections required to load your dependencies
5210
 * @param {Boolean} [config.async=true] Fetch files in async
5211
 * @param {Array} config.ignore: A list of modules that should never be dynamically loaded
5212
 * @param {Array} config.force A list of modules that should always be loaded when required, even if already present on the page
5213
 * @param {HTMLElement|String} config.insertBefore Node or id for a node that should be used as the insertion point for new nodes
5214
 * @param {Object} config.jsAttributes Object literal containing attributes to add to script nodes
5215
 * @param {Object} config.cssAttributes Object literal containing attributes to add to link nodes
5216
 * @param {Number} config.timeout The number of milliseconds before a timeout occurs when dynamically loading nodes.  If not set, there is no timeout
5217
 * @param {Object} config.context Execution context for all callbacks
5218
 * @param {Function} config.onSuccess Callback for the 'success' event
5219
 * @param {Function} config.onFailure Callback for the 'failure' event
5220
 * @param {Function} config.onTimeout Callback for the 'timeout' event
5221
 * @param {Function} config.onProgress Callback executed each time a script or css file is loaded
5222
 * @param {Object} config.modules A list of module definitions.  See <a href="#method_addModule">Loader.addModule</a> for the supported module metadata
5223
 * @param {Object} config.groups A list of group definitions.  Each group can contain specific definitions for `base`, `comboBase`, `combine`, and accepts a list of `modules`.
5224
 * @param {String} config.2in3 The version of the YUI 2 in 3 wrapper to use.  The intrinsic support for YUI 2 modules in YUI 3 relies on versions of the YUI 2 components inside YUI 3 module wrappers.  These wrappers change over time to accomodate the issues that arise from running YUI 2 in a YUI 3 sandbox.
5225
 * @param {String} config.yui2 When using the 2in3 project, you can select the version of YUI 2 to use.  Valid values are `2.2.2`, `2.3.1`, `2.4.1`, `2.5.2`, `2.6.0`, `2.7.0`, `2.8.0`, `2.8.1` and `2.9.0` [default] -- plus all versions of YUI 2 going forward.
5226
 * @param {Function} config.doBeforeLoader An optional hook that allows for the patching of the loader instance. The `Y` instance is available as `this.context` and the only argument to the function is the Loader configuration object.
5227
 */
5228
Y.Loader = function(o) {
5229
 
5230
    var self = this;
5231
 
5232
    //Catch no config passed.
5233
    o = o || {};
5234
 
5235
    modulekey = META.md5;
5236
 
5237
    /**
5238
     * Internal callback to handle multiple internal insert() calls
5239
     * so that css is inserted prior to js
5240
     * @property _internalCallback
5241
     * @private
5242
     */
5243
    // self._internalCallback = null;
5244
 
5245
    /**
5246
     * Callback that will be executed when the loader is finished
5247
     * with an insert
5248
     * @method onSuccess
5249
     * @type function
5250
     */
5251
    // self.onSuccess = null;
5252
 
5253
    /**
5254
     * Callback that will be executed if there is a failure
5255
     * @method onFailure
5256
     * @type function
5257
     */
5258
    // self.onFailure = null;
5259
 
5260
    /**
5261
     * Callback executed each time a script or css file is loaded
5262
     * @method onProgress
5263
     * @type function
5264
     */
5265
    // self.onProgress = null;
5266
 
5267
    /**
5268
     * Callback that will be executed if a timeout occurs
5269
     * @method onTimeout
5270
     * @type function
5271
     */
5272
    // self.onTimeout = null;
5273
 
5274
    /**
5275
     * The execution context for all callbacks
5276
     * @property context
5277
     * @default {YUI} the YUI instance
5278
     */
5279
    self.context = Y;
5280
 
5281
    // Hook that allows the patching of loader
5282
    if (o.doBeforeLoader) {
5283
        o.doBeforeLoader.apply(self, arguments);
5284
    }
5285
 
5286
    /**
5287
     * Data that is passed to all callbacks
5288
     * @property data
5289
     */
5290
    // self.data = null;
5291
 
5292
    /**
5293
     * Node reference or id where new nodes should be inserted before
5294
     * @property insertBefore
5295
     * @type string|HTMLElement
5296
     */
5297
    // self.insertBefore = null;
5298
 
5299
    /**
5300
     * The charset attribute for inserted nodes
5301
     * @property charset
5302
     * @type string
5303
     * @deprecated , use cssAttributes or jsAttributes.
5304
     */
5305
    // self.charset = null;
5306
 
5307
    /**
5308
     * An object literal containing attributes to add to link nodes
5309
     * @property cssAttributes
5310
     * @type object
5311
     */
5312
    // self.cssAttributes = null;
5313
 
5314
    /**
5315
     * An object literal containing attributes to add to script nodes
5316
     * @property jsAttributes
5317
     * @type object
5318
     */
5319
    // self.jsAttributes = null;
5320
 
5321
    /**
5322
     * The base directory.
5323
     * @property base
5324
     * @type string
5325
     * @default http://yui.yahooapis.com/[YUI VERSION]/build/
5326
     */
5327
    self.base = Y.Env.meta.base + Y.Env.meta.root;
5328
 
5329
    /**
5330
     * Base path for the combo service
5331
     * @property comboBase
5332
     * @type string
5333
     * @default http://yui.yahooapis.com/combo?
5334
     */
5335
    self.comboBase = Y.Env.meta.comboBase;
5336
 
5337
    /*
5338
     * Base path for language packs.
5339
     */
5340
    // self.langBase = Y.Env.meta.langBase;
5341
    // self.lang = "";
5342
 
5343
    /**
5344
     * If configured, the loader will attempt to use the combo
5345
     * service for YUI resources and configured external resources.
5346
     * @property combine
5347
     * @type boolean
5348
     * @default true if a base dir isn't in the config
5349
     */
5350
    self.combine = o.base &&
5351
        (o.base.indexOf(self.comboBase.substr(0, 20)) > -1);
5352
 
5353
    /**
5354
    * The default seperator to use between files in a combo URL
5355
    * @property comboSep
5356
    * @type {String}
5357
    * @default Ampersand
5358
    */
5359
    self.comboSep = '&';
5360
    /**
5361
     * Max url length for combo urls.  The default is 1024. This is the URL
5362
     * limit for the Yahoo! hosted combo servers.  If consuming
5363
     * a different combo service that has a different URL limit
5364
     * it is possible to override this default by supplying
5365
     * the maxURLLength config option.  The config option will
5366
     * only take effect if lower than the default.
5367
     *
5368
     * @property maxURLLength
5369
     * @type int
5370
     */
5371
    self.maxURLLength = MAX_URL_LENGTH;
5372
 
5373
    /**
5374
     * Ignore modules registered on the YUI global
5375
     * @property ignoreRegistered
5376
     * @default false
5377
     */
5378
    self.ignoreRegistered = o.ignoreRegistered;
5379
 
5380
    /**
5381
     * Root path to prepend to module path for the combo
5382
     * service
5383
     * @property root
5384
     * @type string
5385
     * @default [YUI VERSION]/build/
5386
     */
5387
    self.root = Y.Env.meta.root;
5388
 
5389
    /**
5390
     * Timeout value in milliseconds.  If set, self value will be used by
5391
     * the get utility.  the timeout event will fire if
5392
     * a timeout occurs.
5393
     * @property timeout
5394
     * @type int
5395
     */
5396
    self.timeout = 0;
5397
 
5398
    /**
5399
     * A list of modules that should not be loaded, even if
5400
     * they turn up in the dependency tree
5401
     * @property ignore
5402
     * @type string[]
5403
     */
5404
    // self.ignore = null;
5405
 
5406
    /**
5407
     * A list of modules that should always be loaded, even
5408
     * if they have already been inserted into the page.
5409
     * @property force
5410
     * @type string[]
5411
     */
5412
    // self.force = null;
5413
 
5414
    self.forceMap = {};
5415
 
5416
    /**
5417
     * Should we allow rollups
5418
     * @property allowRollup
5419
     * @type boolean
5420
     * @default false
5421
     */
5422
    self.allowRollup = false;
5423
 
5424
    /**
5425
     * A filter to apply to result urls.  This filter will modify the default
5426
     * path for all modules.  The default path for the YUI library is the
5427
     * minified version of the files (e.g., event-min.js).  The filter property
5428
     * can be a predefined filter or a custom filter.  The valid predefined
5429
     * filters are:
5430
     * <dl>
5431
     *  <dt>DEBUG</dt>
5432
     *  <dd>Selects the debug versions of the library (e.g., event-debug.js).
5433
     *      This option will automatically include the Logger widget</dd>
5434
     *  <dt>RAW</dt>
5435
     *  <dd>Selects the non-minified version of the library (e.g., event.js).
5436
     *  </dd>
5437
     * </dl>
5438
     * You can also define a custom filter, which must be an object literal
5439
     * containing a search expression and a replace string:
5440
     *
5441
     *      myFilter: {
5442
     *          'searchExp': "-min\\.js",
5443
     *          'replaceStr': "-debug.js"
5444
     *      }
5445
     *
5446
     * @property filter
5447
     * @type string| {searchExp: string, replaceStr: string}
5448
     */
5449
    // self.filter = null;
5450
 
5451
    /**
5452
     * per-component filter specification.  If specified for a given
5453
     * component, this overrides the filter config.
5454
     * @property filters
5455
     * @type object
5456
     */
5457
    self.filters = {};
5458
 
5459
    /**
5460
     * The list of requested modules
5461
     * @property required
5462
     * @type {string: boolean}
5463
     */
5464
    self.required = {};
5465
 
5466
    /**
5467
     * If a module name is predefined when requested, it is checked againsts
5468
     * the patterns provided in this property.  If there is a match, the
5469
     * module is added with the default configuration.
5470
     *
5471
     * At the moment only supporting module prefixes, but anticipate
5472
     * supporting at least regular expressions.
5473
     * @property patterns
5474
     * @type Object
5475
     */
5476
    // self.patterns = Y.merge(Y.Env.meta.patterns);
5477
    self.patterns = {};
5478
 
5479
    /**
5480
     * Internal loader instance metadata. Use accessor `getModuleInfo()` instead.
5481
     */
5482
    self.moduleInfo = {};
5483
 
5484
    self.groups = Y.merge(Y.Env.meta.groups);
5485
 
5486
    /**
5487
     * Provides the information used to skin the skinnable components.
5488
     * The following skin definition would result in 'skin1' and 'skin2'
5489
     * being loaded for calendar (if calendar was requested), and
5490
     * 'sam' for all other skinnable components:
5491
     *
5492
     *      skin: {
5493
     *          // The default skin, which is automatically applied if not
5494
     *          // overriden by a component-specific skin definition.
5495
     *          // Change this in to apply a different skin globally
5496
     *          defaultSkin: 'sam',
5497
     *
5498
     *          // This is combined with the loader base property to get
5499
     *          // the default root directory for a skin. ex:
5500
     *          // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/
5501
     *          base: 'assets/skins/',
5502
     *
5503
     *          // Any component-specific overrides can be specified here,
5504
     *          // making it possible to load different skins for different
5505
     *          // components.  It is possible to load more than one skin
5506
     *          // for a given component as well.
5507
     *          overrides: {
5508
     *              calendar: ['skin1', 'skin2']
5509
     *          }
5510
     *      }
5511
     * @property skin
5512
     * @type {Object}
5513
     */
5514
    self.skin = Y.merge(Y.Env.meta.skin);
5515
 
5516
    /*
5517
     * Map of conditional modules
5518
     * @since 3.2.0
5519
     */
5520
    self.conditions = {};
5521
 
5522
    // map of modules with a hash of modules that meet the requirement
5523
    // self.provides = {};
5524
 
5525
    self.config = o;
5526
    self._internal = true;
5527
 
5528
    self._populateConditionsCache();
5529
 
5530
    /**
5531
     * Set when beginning to compute the dependency tree.
5532
     * Composed of what YUI reports to be loaded combined
5533
     * with what has been loaded by any instance on the page
5534
     * with the version number specified in the metadata.
5535
     * @property loaded
5536
     * @type {string: boolean}
5537
     */
5538
    self.loaded = GLOBAL_LOADED[VERSION];
5539
 
5540
 
5541
    /**
5542
    * Should Loader fetch scripts in `async`, defaults to `true`
5543
    * @property async
5544
    */
5545
 
5546
    self.async = true;
5547
 
5548
    self._inspectPage();
5549
 
5550
    self._internal = false;
5551
 
5552
    self._config(o);
5553
 
5554
    self.forceMap = (self.force) ? Y.Array.hash(self.force) : {};
5555
 
5556
    self.testresults = null;
5557
 
5558
    if (Y.config.tests) {
5559
        self.testresults = Y.config.tests;
5560
    }
5561
 
5562
    /**
5563
     * List of rollup files found in the library metadata
5564
     * @property rollups
5565
     */
5566
    // self.rollups = null;
5567
 
5568
    /**
5569
     * Whether or not to load optional dependencies for
5570
     * the requested modules
5571
     * @property loadOptional
5572
     * @type boolean
5573
     * @default false
5574
     */
5575
    // self.loadOptional = false;
5576
 
5577
    /**
5578
     * All of the derived dependencies in sorted order, which
5579
     * will be populated when either calculate() or insert()
5580
     * is called
5581
     * @property sorted
5582
     * @type string[]
5583
     */
5584
    self.sorted = [];
5585
 
5586
    /*
5587
     * A list of modules to attach to the YUI instance when complete.
5588
     * If not supplied, the sorted list of dependencies are applied.
5589
     * @property attaching
5590
     */
5591
    // self.attaching = null;
5592
 
5593
    /**
5594
     * Flag to indicate the dependency tree needs to be recomputed
5595
     * if insert is called again.
5596
     * @property dirty
5597
     * @type boolean
5598
     * @default true
5599
     */
5600
    self.dirty = true;
5601
 
5602
    /**
5603
     * List of modules inserted by the utility
5604
     * @property inserted
5605
     * @type {string: boolean}
5606
     */
5607
    self.inserted = {};
5608
 
5609
    /**
5610
     * List of skipped modules during insert() because the module
5611
     * was not defined
5612
     * @property skipped
5613
     */
5614
    self.skipped = {};
5615
 
5616
    // Y.on('yui:load', self.loadNext, self);
5617
 
5618
    self.tested = {};
5619
 
5620
    /*
5621
     * Cached sorted calculate results
5622
     * @property results
5623
     * @since 3.2.0
5624
     */
5625
    //self.results = {};
5626
 
5627
    if (self.ignoreRegistered) {
5628
        //Clear inpage already processed modules.
5629
        self._resetModules();
5630
    }
5631
 
5632
};
5633
 
5634
Y.Loader.prototype = {
5635
    /**
5636
    * Gets the module info from the local moduleInfo hash, or from the
5637
    * default metadata and populate the local moduleInfo hash.
5638
    * @method getModuleInfo
5639
    * @param {string} name of the module
5640
    * @public
5641
    */
5642
    getModuleInfo: function(name) {
5643
 
5644
        var m = this.moduleInfo[name],
5645
            rawMetaModules, globalRenderedMods, internal, v;
5646
 
5647
        if (m) {
5648
            return m;
5649
        }
5650
 
5651
        rawMetaModules = META.modules;
5652
        globalRenderedMods = GLOBAL_ENV._renderedMods;
5653
        internal = this._internal;
5654
 
5655
        /*
5656
        The logic here is:
5657
 
5658
        - if the `moduleInfo[name]` is avilable,
5659
          then short circuit
5660
        - otherwise, if the module is in the globalCache (cross Y instance),
5661
          then port it from the global registry into `moduleInfo[name]`
5662
        - otherwise, if the module has raw metadata (from meta modules)
5663
          then add it to the global registry and to `moduleInfo[name]`
5664
 
5665
        */
5666
        if (globalRenderedMods && globalRenderedMods.hasOwnProperty(name) && !this.ignoreRegistered) {
5667
            this.moduleInfo[name] = Y.merge(globalRenderedMods[name]);
5668
        } else {
5669
            if (rawMetaModules.hasOwnProperty(name)) {
5670
                this._internal = true; // making sure that modules from raw data are marked as internal
5671
                v = this.addModule(rawMetaModules[name], name);
5672
                // Inspect the page for the CSS module and mark it as loaded.
5673
                if (v && v.type === CSS) {
5674
                    if (this.isCSSLoaded(v.name, true)) {
5675
                        this.loaded[v.name] = true;
5676
                    }
5677
                }
5678
                this._internal = internal;
5679
            }
5680
        }
5681
        return this.moduleInfo[name];
5682
    },
5683
    /**
5684
    * Expand the names that are aliases to other modules.
5685
    * @method _expandAliases
5686
    * @param {string[]} list a module name or a list of names to be expanded
5687
    * @private
5688
    * @return {array}
5689
    */
5690
    _expandAliases: function(list) {
5691
        var expanded = [],
5692
            aliases = YUI.Env.aliases,
5693
            i, name;
5694
        list = Y.Array(list);
5695
        for (i = 0; i < list.length; i += 1) {
5696
            name = list[i];
5697
            expanded.push.apply(expanded, aliases[name] ? aliases[name] : [name]);
5698
        }
5699
        return expanded;
5700
    },
5701
    /**
5702
    * Populate the conditions cache from raw modules, this is necessary
5703
    * because no other module will require a conditional module, instead
5704
    * the condition has to be executed and then the module is analyzed
5705
    * to be included in the final requirement list. Without this cache
5706
    * conditional modules will be simply ignored.
5707
    * @method _populateConditionsCache
5708
    * @private
5709
    */
5710
    _populateConditionsCache: function() {
5711
        var rawMetaModules = META.modules,
5712
            cache = GLOBAL_ENV._conditions,
5713
            i, j, t, trigger;
5714
 
5715
        // if we have conditions in cache and cache is enabled
5716
        // we should port them to this loader instance
5717
        if (cache && !this.ignoreRegistered) {
5718
            for (i in cache) {
5719
                if (cache.hasOwnProperty(i)) {
5720
                    this.conditions[i] = Y.merge(cache[i]);
5721
                }
5722
            }
5723
        } else {
5724
            for (i in rawMetaModules) {
5725
                if (rawMetaModules.hasOwnProperty(i) && rawMetaModules[i].condition) {
5726
                    t = this._expandAliases(rawMetaModules[i].condition.trigger);
5727
                    for (j = 0; j < t.length; j += 1) {
5728
                        trigger = t[j];
5729
                        this.conditions[trigger] = this.conditions[trigger] || {};
5730
                        this.conditions[trigger][rawMetaModules[i].name || i] = rawMetaModules[i].condition;
5731
                    }
5732
                }
5733
            }
5734
            GLOBAL_ENV._conditions = this.conditions;
5735
        }
5736
    },
5737
    /**
5738
    * Reset modules in the module cache to a pre-processed state so additional
5739
    * computations with a different skin or language will work as expected.
5740
    * @method _resetModules
5741
    * @private
5742
    */
5743
    _resetModules: function() {
5744
        var self = this, i, o,
5745
            mod, name, details;
5746
        for (i in self.moduleInfo) {
5747
            if (self.moduleInfo.hasOwnProperty(i) && self.moduleInfo[i]) {
5748
                mod = self.moduleInfo[i];
5749
                name = mod.name;
5750
                details  = (YUI.Env.mods[name] ? YUI.Env.mods[name].details : null);
5751
 
5752
                if (details) {
5753
                    self.moduleInfo[name]._reset = true;
5754
                    self.moduleInfo[name].requires = details.requires || [];
5755
                    self.moduleInfo[name].optional = details.optional || [];
5756
                    self.moduleInfo[name].supersedes = details.supercedes || [];
5757
                }
5758
 
5759
                if (mod.defaults) {
5760
                    for (o in mod.defaults) {
5761
                        if (mod.defaults.hasOwnProperty(o)) {
5762
                            if (mod[o]) {
5763
                                mod[o] = mod.defaults[o];
5764
                            }
5765
                        }
5766
                    }
5767
                }
5768
                mod.langCache = undefined;
5769
                mod.skinCache = undefined;
5770
                if (mod.skinnable) {
5771
                    self._addSkin(self.skin.defaultSkin, mod.name);
5772
                }
5773
            }
5774
        }
5775
    },
5776
    /**
5777
    Regex that matches a CSS URL. Used to guess the file type when it's not
5778
    specified.
5779
 
5780
    @property REGEX_CSS
5781
    @type RegExp
5782
    @final
5783
    @protected
5784
    @since 3.5.0
5785
    **/
5786
    REGEX_CSS: /\.css(?:[?;].*)?$/i,
5787
 
5788
    /**
5789
    * Default filters for raw and debug
5790
    * @property FILTER_DEFS
5791
    * @type Object
5792
    * @final
5793
    * @protected
5794
    */
5795
    FILTER_DEFS: {
5796
        RAW: {
5797
            'searchExp': '-min\\.js',
5798
            'replaceStr': '.js'
5799
        },
5800
        DEBUG: {
5801
            'searchExp': '-min\\.js',
5802
            'replaceStr': '-debug.js'
5803
        },
5804
        COVERAGE: {
5805
            'searchExp': '-min\\.js',
5806
            'replaceStr': '-coverage.js'
5807
        }
5808
    },
5809
    /*
5810
    * Check the pages meta-data and cache the result.
5811
    * @method _inspectPage
5812
    * @private
5813
    */
5814
    _inspectPage: function() {
5815
        var self = this, v, m, req, mr, i;
5816
 
5817
        for (i in ON_PAGE) {
5818
            if (ON_PAGE.hasOwnProperty(i)) {
5819
                v = ON_PAGE[i];
5820
                if (v.details) {
5821
                    m = self.getModuleInfo(v.name);
5822
                    req = v.details.requires;
5823
                    mr = m && m.requires;
5824
 
5825
                   if (m) {
5826
                       if (!m._inspected && req && mr.length !== req.length) {
5827
                           // console.log('deleting ' + m.name);
5828
                           delete m.expanded;
5829
                       }
5830
                   } else {
5831
                       m = self.addModule(v.details, i);
5832
                   }
5833
                   m._inspected = true;
5834
               }
5835
            }
5836
        }
5837
    },
5838
    /*
5839
    * returns true if b is not loaded, and is required directly or by means of modules it supersedes.
5840
    * @private
5841
    * @method _requires
5842
    * @param {String} mod1 The first module to compare
5843
    * @param {String} mod2 The second module to compare
5844
    */
5845
   _requires: function(mod1, mod2) {
5846
 
5847
        var i, rm, after_map, s,
5848
            m = this.getModuleInfo(mod1),
5849
            other = this.getModuleInfo(mod2);
5850
 
5851
        if (!m || !other) {
5852
            return false;
5853
        }
5854
 
5855
        rm = m.expanded_map;
5856
        after_map = m.after_map;
5857
 
5858
        // check if this module should be sorted after the other
5859
        // do this first to short circut circular deps
5860
        if (after_map && (mod2 in after_map)) {
5861
            return true;
5862
        }
5863
 
5864
        after_map = other.after_map;
5865
 
5866
        // and vis-versa
5867
        if (after_map && (mod1 in after_map)) {
5868
            return false;
5869
        }
5870
 
5871
        // check if this module requires one the other supersedes
5872
        s = other.supersedes;
5873
        if (s) {
5874
            for (i = 0; i < s.length; i++) {
5875
                if (this._requires(mod1, s[i])) {
5876
                    return true;
5877
                }
5878
            }
5879
        }
5880
 
5881
        s = m.supersedes;
5882
        if (s) {
5883
            for (i = 0; i < s.length; i++) {
5884
                if (this._requires(mod2, s[i])) {
5885
                    return false;
5886
                }
5887
            }
5888
        }
5889
 
5890
        // check if this module requires the other directly
5891
        // if (r && yArray.indexOf(r, mod2) > -1) {
5892
        if (rm && (mod2 in rm)) {
5893
            return true;
5894
        }
5895
 
5896
        // external css files should be sorted below yui css
5897
        if (m.ext && m.type === CSS && !other.ext && other.type === CSS) {
5898
            return true;
5899
        }
5900
 
5901
        return false;
5902
    },
5903
    /**
5904
    * Apply a new config to the Loader instance
5905
    * @method _config
5906
    * @private
5907
    * @param {Object} o The new configuration
5908
    */
5909
    _config: function(o) {
5910
        var i, j, val, a, f, group, groupName, self = this,
5911
            mods = [], mod, modInfo;
5912
        // apply config values
5913
        if (o) {
5914
            for (i in o) {
5915
                if (o.hasOwnProperty(i)) {
5916
                    val = o[i];
5917
                    //TODO This should be a case
5918
                    if (i === 'require') {
5919
                        self.require(val);
5920
                    } else if (i === 'skin') {
5921
                        //If the config.skin is a string, format to the expected object
5922
                        if (typeof val === 'string') {
5923
                            self.skin.defaultSkin = o.skin;
5924
                            val = {
5925
                                defaultSkin: val
5926
                            };
5927
                        }
5928
 
5929
                        Y.mix(self.skin, val, true);
5930
                    } else if (i === 'groups') {
5931
                        for (j in val) {
5932
                            if (val.hasOwnProperty(j)) {
5933
                                groupName = j;
5934
                                group = val[j];
5935
                                self.addGroup(group, groupName);
5936
                                if (group.aliases) {
5937
                                    for (a in group.aliases) {
5938
                                        if (group.aliases.hasOwnProperty(a)) {
5939
                                            self.addAlias(group.aliases[a], a);
5940
                                        }
5941
                                    }
5942
                                }
5943
                            }
5944
                        }
5945
 
5946
                    } else if (i === 'modules') {
5947
                        // add a hash of module definitions
5948
                        for (j in val) {
5949
                            if (val.hasOwnProperty(j)) {
5950
                                self.addModule(val[j], j);
5951
                            }
5952
                        }
5953
                    } else if (i === 'aliases') {
5954
                        for (j in val) {
5955
                            if (val.hasOwnProperty(j)) {
5956
                                self.addAlias(val[j], j);
5957
                            }
5958
                        }
5959
                    } else if (i === 'gallery') {
5960
                        if (this.groups.gallery.update) {
5961
                            this.groups.gallery.update(val, o);
5962
                        }
5963
                    } else if (i === 'yui2' || i === '2in3') {
5964
                        if (this.groups.yui2.update) {
5965
                            this.groups.yui2.update(o['2in3'], o.yui2, o);
5966
                        }
5967
                    } else {
5968
                        self[i] = val;
5969
                    }
5970
                }
5971
            }
5972
        }
5973
 
5974
        // fix filter
5975
        f = self.filter;
5976
 
5977
        if (L.isString(f)) {
5978
            f = f.toUpperCase();
5979
            self.filterName = f;
5980
            self.filter = self.FILTER_DEFS[f];
5981
            if (f === 'DEBUG') {
5982
                self.require('yui-log', 'dump');
5983
            }
5984
        }
5985
 
5986
        if (self.filterName && self.coverage) {
5987
            if (self.filterName === 'COVERAGE' && L.isArray(self.coverage) && self.coverage.length) {
5988
                for (i = 0; i < self.coverage.length; i++) {
5989
                    mod = self.coverage[i];
5990
                    modInfo = self.getModuleInfo(mod);
5991
                    if (modInfo && modInfo.use) {
5992
                        mods = mods.concat(modInfo.use);
5993
                    } else {
5994
                        mods.push(mod);
5995
                    }
5996
                }
5997
                self.filters = self.filters || {};
5998
                Y.Array.each(mods, function(mod) {
5999
                    self.filters[mod] = self.FILTER_DEFS.COVERAGE;
6000
                });
6001
                self.filterName = 'RAW';
6002
                self.filter = self.FILTER_DEFS[self.filterName];
6003
            }
6004
        }
6005
 
6006
    },
6007
 
6008
    /**
6009
     * Returns the skin module name for the specified skin name.  If a
6010
     * module name is supplied, the returned skin module name is
6011
     * specific to the module passed in.
6012
     * @method formatSkin
6013
     * @param {string} skin the name of the skin.
6014
     * @param {string} mod optional: the name of a module to skin.
6015
     * @return {string} the full skin module name.
6016
     */
6017
    formatSkin: function(skin, mod) {
6018
        var s = SKIN_PREFIX + skin;
6019
        if (mod) {
6020
            s = s + '-' + mod;
6021
        }
6022
 
6023
        return s;
6024
    },
6025
 
6026
    /**
6027
     * Adds the skin def to the module info
6028
     * @method _addSkin
6029
     * @param {string} skin the name of the skin.
6030
     * @param {string} mod the name of the module.
6031
     * @param {string} parent parent module if this is a skin of a
6032
     * submodule or plugin.
6033
     * @return {string} the module name for the skin.
6034
     * @private
6035
     */
6036
    _addSkin: function(skin, mod, parent) {
6037
        var pkg, name, nmod,
6038
            sinf = this.skin,
6039
            mdef = mod && this.getModuleInfo(mod),
6040
            ext = mdef && mdef.ext;
6041
 
6042
        // Add a module definition for the module-specific skin css
6043
        if (mod) {
6044
            name = this.formatSkin(skin, mod);
6045
            if (!this.getModuleInfo(name)) {
6046
                pkg = mdef.pkg || mod;
6047
                nmod = {
6048
                    skin: true,
6049
                    name: name,
6050
                    group: mdef.group,
6051
                    type: 'css',
6052
                    after: sinf.after,
6053
                    path: (parent || pkg) + '/' + sinf.base + skin +
6054
                          '/' + mod + '.css',
6055
                    ext: ext
6056
                };
6057
                if (mdef.base) {
6058
                    nmod.base = mdef.base;
6059
                }
6060
                if (mdef.configFn) {
6061
                    nmod.configFn = mdef.configFn;
6062
                }
6063
                this.addModule(nmod, name);
6064
 
6065
            }
6066
        }
6067
 
6068
        return name;
6069
    },
6070
    /**
6071
    * Adds an alias module to the system
6072
    * @method addAlias
6073
    * @param {Array} use An array of modules that makes up this alias
6074
    * @param {String} name The name of the alias
6075
    * @example
6076
    *       var loader = new Y.Loader({});
6077
    *       loader.addAlias([ 'node', 'yql' ], 'davglass');
6078
    *       loader.require(['davglass']);
6079
    *       var out = loader.resolve(true);
6080
    *
6081
    *       //out.js will contain Node and YQL modules
6082
    */
6083
    addAlias: function(use, name) {
6084
        YUI.Env.aliases[name] = use;
6085
        this.addModule({
6086
            name: name,
6087
            use: use
6088
        });
6089
    },
6090
    /**
6091
     * Add a new module group
6092
     * @method addGroup
6093
     * @param {Object} config An object containing the group configuration data
6094
     * @param {String} config.name required, the group name
6095
     * @param {String} config.base The base directory for this module group
6096
     * @param {String} config.root The root path to add to each combo resource path
6097
     * @param {Boolean} config.combine Should the request be combined
6098
     * @param {String} config.comboBase Combo service base path
6099
     * @param {Object} config.modules The group of modules
6100
     * @param {String} name the group name.
6101
     * @example
6102
     *      var loader = new Y.Loader({});
6103
     *      loader.addGroup({
6104
     *          name: 'davglass',
6105
     *          combine: true,
6106
     *          comboBase: '/combo?',
6107
     *          root: '',
6108
     *          modules: {
6109
     *              //Module List here
6110
     *          }
6111
     *      }, 'davglass');
6112
     */
6113
    addGroup: function(o, name) {
6114
        var mods = o.modules,
6115
            self = this,
6116
            defaultBase = o.defaultBase || Y.config.defaultBase,
6117
            i, v;
6118
 
6119
        name = name || o.name;
6120
        o.name = name;
6121
        self.groups[name] = o;
6122
 
6123
        if (!o.base && defaultBase && o.root) {
6124
            o.base = defaultBase + o.root;
6125
        }
6126
 
6127
        if (o.patterns) {
6128
            for (i in o.patterns) {
6129
                if (o.patterns.hasOwnProperty(i)) {
6130
                    o.patterns[i].group = name;
6131
                    self.patterns[i] = o.patterns[i];
6132
                }
6133
            }
6134
        }
6135
 
6136
        if (mods) {
6137
            for (i in mods) {
6138
                if (mods.hasOwnProperty(i)) {
6139
                    v = mods[i];
6140
                    if (typeof v === 'string') {
6141
                        v = { name: i, fullpath: v };
6142
                    }
6143
                    v.group = name;
6144
                    self.addModule(v, i);
6145
                }
6146
            }
6147
        }
6148
    },
6149
 
6150
    /**
6151
     * Add a new module to the component metadata.
6152
     * @method addModule
6153
     * @param {Object} config An object containing the module data.
6154
     * @param {String} config.name Required, the component name
6155
     * @param {String} config.type Required, the component type (js or css)
6156
     * @param {String} config.path Required, the path to the script from `base`
6157
     * @param {Array} config.requires Array of modules required by this component
6158
     * @param {Array} [config.optional] Array of optional modules for this component
6159
     * @param {Array} [config.supersedes] Array of the modules this component replaces
6160
     * @param {Array} [config.after] Array of modules the components which, if present, should be sorted above this one
6161
     * @param {Object} [config.after_map] Faster alternative to 'after' -- supply a hash instead of an array
6162
     * @param {Number} [config.rollup] The number of superseded modules required for automatic rollup
6163
     * @param {String} [config.fullpath] If `fullpath` is specified, this is used instead of the configured `base + path`
6164
     * @param {Boolean} [config.skinnable] Flag to determine if skin assets should automatically be pulled in
6165
     * @param {Object} [config.submodules] Hash of submodules
6166
     * @param {String} [config.group] The group the module belongs to -- this is set automatically when it is added as part of a group configuration.
6167
     * @param {Array} [config.lang] Array of BCP 47 language tags of languages for which this module has localized resource bundles, e.g., `["en-GB", "zh-Hans-CN"]`
6168
     * @param {Object} [config.condition] Specifies that the module should be loaded automatically if a condition is met. This is an object with up to four fields:
6169
     * @param {String} [config.condition.trigger] The name of a module that can trigger the auto-load
6170
     * @param {Function} [config.condition.test] A function that returns true when the module is to be loaded.
6171
     * @param {String} [config.condition.ua] The UA name of <a href="UA.html">Y.UA</a> object that returns true when the module is to be loaded. e.g., `"ie"`, `"nodejs"`.
6172
     * @param {String} [config.condition.when] Specifies the load order of the conditional module
6173
     *  with regard to the position of the trigger module.
6174
     *  This should be one of three values: `before`, `after`, or `instead`.  The default is `after`.
6175
     * @param {Object} [config.testresults] A hash of test results from `Y.Features.all()`
6176
     * @param {Function} [config.configFn] A function to exectute when configuring this module
6177
     * @param {Object} config.configFn.mod The module config, modifying this object will modify it's config. Returning false will delete the module's config.
6178
     * @param {String[]} [config.optionalRequires] List of dependencies that
6179
        may optionally be loaded by this loader. This is targeted mostly at
6180
        polyfills, since they should not be in the list of requires because
6181
        polyfills are assumed to be available in the global scope.
6182
     * @param {Function} [config.test] Test to be called when this module is
6183
        added as an optional dependency of another module. If the test function
6184
        returns `false`, the module will be ignored and will not be attached to
6185
        this YUI instance.
6186
     * @param {String} [name] The module name, required if not in the module data.
6187
     * @return {Object} the module definition or null if the object passed in did not provide all required attributes.
6188
     */
6189
    addModule: function(o, name) {
6190
        name = name || o.name;
6191
 
6192
        if (typeof o === 'string') {
6193
            o = { name: name, fullpath: o };
6194
        }
6195
 
6196
 
6197
        var subs, i, l, t, sup, s, smod, plugins, plug,
6198
            j, langs, packName, supName, flatSup, flatLang, lang, ret,
6199
            overrides, skinname, when, g, p,
6200
            modInfo = this.moduleInfo[name],
6201
            conditions = this.conditions, trigger;
6202
 
6203
        //Only merge this data if the temp flag is set
6204
        //from an earlier pass from a pattern or else
6205
        //an override module (YUI_config) can not be used to
6206
        //replace a default module.
6207
        if (modInfo && modInfo.temp) {
6208
            //This catches temp modules loaded via a pattern
6209
            // The module will be added twice, once from the pattern and
6210
            // Once from the actual add call, this ensures that properties
6211
            // that were added to the module the first time around (group: gallery)
6212
            // are also added the second time around too.
6213
            o = Y.merge(modInfo, o);
6214
        }
6215
 
6216
        o.name = name;
6217
 
6218
        if (!o || !o.name) {
6219
            return null;
6220
        }
6221
 
6222
        if (!o.type) {
6223
            //Always assume it's javascript unless the CSS pattern is matched.
6224
            o.type = JS;
6225
            p = o.path || o.fullpath;
6226
            if (p && this.REGEX_CSS.test(p)) {
6227
                o.type = CSS;
6228
            }
6229
        }
6230
 
6231
        if (!o.path && !o.fullpath) {
6232
            o.path = _path(name, name, o.type);
6233
        }
6234
        o.supersedes = o.supersedes || o.use;
6235
 
6236
        o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true;
6237
 
6238
        // Handle submodule logic
6239
        subs = o.submodules;
6240
 
6241
        this.moduleInfo[name] = o;
6242
 
6243
        o.requires = o.requires || [];
6244
 
6245
        /*
6246
        Only allowing the cascade of requires information, since
6247
        optional and supersedes are far more fine grained than
6248
        a blanket requires is.
6249
        */
6250
        if (this.requires) {
6251
            for (i = 0; i < this.requires.length; i++) {
6252
                o.requires.push(this.requires[i]);
6253
            }
6254
        }
6255
        if (o.group && this.groups && this.groups[o.group]) {
6256
            g = this.groups[o.group];
6257
            if (g.requires) {
6258
                for (i = 0; i < g.requires.length; i++) {
6259
                    o.requires.push(g.requires[i]);
6260
                }
6261
            }
6262
        }
6263
 
6264
 
6265
        if (!o.defaults) {
6266
            o.defaults = {
6267
                requires: o.requires ? [].concat(o.requires) : null,
6268
                supersedes: o.supersedes ? [].concat(o.supersedes) : null,
6269
                optional: o.optional ? [].concat(o.optional) : null
6270
            };
6271
        }
6272
 
6273
        if (o.skinnable && o.ext && o.temp) {
6274
            skinname = this._addSkin(this.skin.defaultSkin, name);
6275
            o.requires.unshift(skinname);
6276
        }
6277
 
6278
        if (o.requires.length) {
6279
            o.requires = this.filterRequires(o.requires) || [];
6280
        }
6281
 
6282
        if (!o.langPack && o.lang) {
6283
            langs = yArray(o.lang);
6284
            for (j = 0; j < langs.length; j++) {
6285
                lang = langs[j];
6286
                packName = this.getLangPackName(lang, name);
6287
                smod = this.getModuleInfo(packName);
6288
                if (!smod) {
6289
                    smod = this._addLangPack(lang, o, packName);
6290
                }
6291
            }
6292
        }
6293
 
6294
 
6295
        if (subs) {
6296
            sup = o.supersedes || [];
6297
            l = 0;
6298
 
6299
            for (i in subs) {
6300
                if (subs.hasOwnProperty(i)) {
6301
                    s = subs[i];
6302
 
6303
                    s.path = s.path || _path(name, i, o.type);
6304
                    s.pkg = name;
6305
                    s.group = o.group;
6306
 
6307
                    if (s.supersedes) {
6308
                        sup = sup.concat(s.supersedes);
6309
                    }
6310
 
6311
                    smod = this.addModule(s, i);
6312
                    sup.push(i);
6313
 
6314
                    if (smod.skinnable) {
6315
                        o.skinnable = true;
6316
                        overrides = this.skin.overrides;
6317
                        if (overrides && overrides[i]) {
6318
                            for (j = 0; j < overrides[i].length; j++) {
6319
                                skinname = this._addSkin(overrides[i][j],
6320
                                         i, name);
6321
                                sup.push(skinname);
6322
                            }
6323
                        }
6324
                        skinname = this._addSkin(this.skin.defaultSkin,
6325
                                        i, name);
6326
                        sup.push(skinname);
6327
                    }
6328
 
6329
                    // looks like we are expected to work out the metadata
6330
                    // for the parent module language packs from what is
6331
                    // specified in the child modules.
6332
                    if (s.lang && s.lang.length) {
6333
 
6334
                        langs = yArray(s.lang);
6335
                        for (j = 0; j < langs.length; j++) {
6336
                            lang = langs[j];
6337
                            packName = this.getLangPackName(lang, name);
6338
                            supName = this.getLangPackName(lang, i);
6339
                            smod = this.getModuleInfo(packName);
6340
 
6341
                            if (!smod) {
6342
                                smod = this._addLangPack(lang, o, packName);
6343
                            }
6344
 
6345
                            flatSup = flatSup || yArray.hash(smod.supersedes);
6346
 
6347
                            if (!(supName in flatSup)) {
6348
                                smod.supersedes.push(supName);
6349
                            }
6350
 
6351
                            o.lang = o.lang || [];
6352
 
6353
                            flatLang = flatLang || yArray.hash(o.lang);
6354
 
6355
                            if (!(lang in flatLang)) {
6356
                                o.lang.push(lang);
6357
                            }
6358
 
6359
// Add rollup file, need to add to supersedes list too
6360
 
6361
                            // default packages
6362
                            packName = this.getLangPackName(ROOT_LANG, name);
6363
                            supName = this.getLangPackName(ROOT_LANG, i);
6364
 
6365
                            smod = this.getModuleInfo(packName);
6366
 
6367
                            if (!smod) {
6368
                                smod = this._addLangPack(lang, o, packName);
6369
                            }
6370
 
6371
                            if (!(supName in flatSup)) {
6372
                                smod.supersedes.push(supName);
6373
                            }
6374
 
6375
// Add rollup file, need to add to supersedes list too
6376
 
6377
                        }
6378
                    }
6379
 
6380
                    l++;
6381
                }
6382
            }
6383
            //o.supersedes = YObject.keys(yArray.hash(sup));
6384
            o.supersedes = yArray.dedupe(sup);
6385
            if (this.allowRollup) {
6386
                o.rollup = (l < 4) ? l : Math.min(l - 1, 4);
6387
            }
6388
        }
6389
 
6390
        plugins = o.plugins;
6391
        if (plugins) {
6392
            for (i in plugins) {
6393
                if (plugins.hasOwnProperty(i)) {
6394
                    plug = plugins[i];
6395
                    plug.pkg = name;
6396
                    plug.path = plug.path || _path(name, i, o.type);
6397
                    plug.requires = plug.requires || [];
6398
                    plug.group = o.group;
6399
                    this.addModule(plug, i);
6400
                    if (o.skinnable) {
6401
                        this._addSkin(this.skin.defaultSkin, i, name);
6402
                    }
6403
 
6404
                }
6405
            }
6406
        }
6407
 
6408
        if (o.condition) {
6409
            t = this._expandAliases(o.condition.trigger);
6410
            for (i = 0; i < t.length; i++) {
6411
                trigger = t[i];
6412
                when = o.condition.when;
6413
                conditions[trigger] = conditions[trigger] || {};
6414
                conditions[trigger][name] = o.condition;
6415
                // the 'when' attribute can be 'before', 'after', or 'instead'
6416
                // the default is after.
6417
                if (when && when !== 'after') {
6418
                    if (when === 'instead') { // replace the trigger
6419
                        o.supersedes = o.supersedes || [];
6420
                        o.supersedes.push(trigger);
6421
                    }
6422
                    // before the trigger
6423
                        // the trigger requires the conditional mod,
6424
                        // so it should appear before the conditional
6425
                        // mod if we do not intersede.
6426
                } else { // after the trigger
6427
                    o.after = o.after || [];
6428
                    o.after.push(trigger);
6429
                }
6430
            }
6431
        }
6432
 
6433
        if (o.supersedes) {
6434
            o.supersedes = this.filterRequires(o.supersedes);
6435
        }
6436
 
6437
        if (o.after) {
6438
            o.after = this.filterRequires(o.after);
6439
            o.after_map = yArray.hash(o.after);
6440
        }
6441
 
6442
        // this.dirty = true;
6443
 
6444
        if (o.configFn) {
6445
            ret = o.configFn(o);
6446
            if (ret === false) {
6447
                delete this.moduleInfo[name];
6448
                delete GLOBAL_ENV._renderedMods[name];
6449
                o = null;
6450
            }
6451
        }
6452
        //Add to global cache
6453
        if (o) {
6454
            if (!GLOBAL_ENV._renderedMods) {
6455
                GLOBAL_ENV._renderedMods = {};
6456
            }
6457
            GLOBAL_ENV._renderedMods[name] = Y.mix(GLOBAL_ENV._renderedMods[name] || {}, o);
6458
            GLOBAL_ENV._conditions = conditions;
6459
        }
6460
 
6461
        return o;
6462
    },
6463
 
6464
    /**
6465
     * Add a requirement for one or more module
6466
     * @method require
6467
     * @param {string[] | string*} what the modules to load.
6468
     */
6469
    require: function(what) {
6470
        var a = (typeof what === 'string') ? yArray(arguments) : what;
6471
        this.dirty = true;
6472
        this.required = Y.merge(this.required, yArray.hash(this.filterRequires(a)));
6473
 
6474
        this._explodeRollups();
6475
    },
6476
    /**
6477
    * Grab all the items that were asked for, check to see if the Loader
6478
    * meta-data contains a "use" array. If it doesm remove the asked item and replace it with
6479
    * the content of the "use".
6480
    * This will make asking for: "dd"
6481
    * Actually ask for: "dd-ddm-base,dd-ddm,dd-ddm-drop,dd-drag,dd-proxy,dd-constrain,dd-drop,dd-scroll,dd-drop-plugin"
6482
    * @private
6483
    * @method _explodeRollups
6484
    */
6485
    _explodeRollups: function() {
6486
        var self = this, m, m2, i, a, v, len, len2,
6487
        r = self.required;
6488
 
6489
        if (!self.allowRollup) {
6490
            for (i in r) {
6491
                if (r.hasOwnProperty(i)) {
6492
                    m = self.getModule(i);
6493
                    if (m && m.use) {
6494
                        len = m.use.length;
6495
                        for (a = 0; a < len; a++) {
6496
                            m2 = self.getModule(m.use[a]);
6497
                            if (m2 && m2.use) {
6498
                                len2 = m2.use.length;
6499
                                for (v = 0; v < len2; v++) {
6500
                                    r[m2.use[v]] = true;
6501
                                }
6502
                            } else {
6503
                                r[m.use[a]] = true;
6504
                            }
6505
                        }
6506
                    }
6507
                }
6508
            }
6509
            self.required = r;
6510
        }
6511
 
6512
    },
6513
    /**
6514
    * Explodes the required array to remove aliases and replace them with real modules
6515
    * @method filterRequires
6516
    * @param {Array} r The original requires array
6517
    * @return {Array} The new array of exploded requirements
6518
    */
6519
    filterRequires: function(r) {
6520
        if (r) {
6521
            if (!Y.Lang.isArray(r)) {
6522
                r = [r];
6523
            }
6524
            r = Y.Array(r);
6525
            var c = [], i, mod, o, m;
6526
 
6527
            for (i = 0; i < r.length; i++) {
6528
                mod = this.getModule(r[i]);
6529
                if (mod && mod.use) {
6530
                    for (o = 0; o < mod.use.length; o++) {
6531
                        //Must walk the other modules in case a module is a rollup of rollups (datatype)
6532
                        m = this.getModule(mod.use[o]);
6533
                        if (m && m.use && (m.name !== mod.name)) {
6534
                            c = Y.Array.dedupe([].concat(c, this.filterRequires(m.use)));
6535
                        } else {
6536
                            c.push(mod.use[o]);
6537
                        }
6538
                    }
6539
                } else {
6540
                    c.push(r[i]);
6541
                }
6542
            }
6543
            r = c;
6544
        }
6545
        return r;
6546
    },
6547
 
6548
    /**
6549
    Returns `true` if the module can be attached to the YUI instance. Runs
6550
    the module's test if there is one and caches its result.
6551
 
6552
    @method _canBeAttached
6553
    @param {String} module Name of the module to check.
6554
    @return {Boolean} Result of the module's test if it has one, or `true`.
6555
    **/
6556
    _canBeAttached: function (m) {
6557
        m = this.getModule(m);
6558
        if (m && m.test) {
6559
            if (!m.hasOwnProperty('_testResult')) {
6560
                m._testResult = m.test(Y);
6561
            }
6562
            return m._testResult;
6563
        }
6564
        // return `true` for modules not registered as Loader will know what
6565
        // to do with them later on
6566
        return true;
6567
    },
6568
 
6569
    /**
6570
     * Returns an object containing properties for all modules required
6571
     * in order to load the requested module
6572
     * @method getRequires
6573
     * @param {object}  mod The module definition from moduleInfo.
6574
     * @return {array} the expanded requirement list.
6575
     */
6576
    getRequires: function(mod) {
6577
 
6578
        if (!mod) {
6579
            //console.log('returning no reqs for ' + mod.name);
6580
            return NO_REQUIREMENTS;
6581
        }
6582
 
6583
        if (mod._parsed) {
6584
            //console.log('returning requires for ' + mod.name, mod.requires);
6585
            return mod.expanded || NO_REQUIREMENTS;
6586
        }
6587
 
6588
        //TODO add modue cache here out of scope..
6589
 
6590
        var i, m, j, length, add, packName, lang, testresults = this.testresults,
6591
            name = mod.name, cond,
6592
            adddef = ON_PAGE[name] && ON_PAGE[name].details,
6593
            optReqs = mod.optionalRequires,
6594
            d, go, def,
6595
            r, old_mod,
6596
            o, skinmod, skindef, skinpar, skinname,
6597
            intl = mod.lang || mod.intl,
6598
            ftests = Y.Features && Y.Features.tests.load,
6599
            hash, reparse;
6600
 
6601
        // console.log(name);
6602
 
6603
        // pattern match leaves module stub that needs to be filled out
6604
        if (mod.temp && adddef) {
6605
            old_mod = mod;
6606
            mod = this.addModule(adddef, name);
6607
            mod.group = old_mod.group;
6608
            mod.pkg = old_mod.pkg;
6609
            delete mod.expanded;
6610
        }
6611
 
6612
        // console.log('cache: ' + mod.langCache + ' == ' + this.lang);
6613
 
6614
        //If a skin or a lang is different, reparse..
6615
        reparse = !((!this.lang || mod.langCache === this.lang) && (mod.skinCache === this.skin.defaultSkin));
6616
 
6617
        if (mod.expanded && !reparse) {
6618
            return mod.expanded;
6619
        }
6620
 
6621
        // Optional dependencies are dependencies that may or may not be
6622
        // available.
6623
        // This feature was designed specifically to be used when transpiling
6624
        // ES6 modules, in order to use polyfills and regular scripts that define
6625
        // global variables without having to import them since they should be
6626
        // available in the global scope.
6627
        if (optReqs) {
6628
            for (i = 0, length = optReqs.length; i < length; i++) {
6629
                if (this._canBeAttached(optReqs[i])) {
6630
                    mod.requires.push(optReqs[i]);
6631
                }
6632
            }
6633
        }
6634
 
6635
        d = [];
6636
        hash = {};
6637
        r = this.filterRequires(mod.requires);
6638
        if (mod.lang) {
6639
            //If a module has a lang attribute, auto add the intl requirement.
6640
            d.unshift('intl');
6641
            r.unshift('intl');
6642
            intl = true;
6643
        }
6644
        o = this.filterRequires(mod.optional);
6645
 
6646
 
6647
        mod._parsed = true;
6648
        mod.langCache = this.lang;
6649
        mod.skinCache = this.skin.defaultSkin;
6650
 
6651
        for (i = 0; i < r.length; i++) {
6652
            if (!hash[r[i]]) {
6653
                d.push(r[i]);
6654
                hash[r[i]] = true;
6655
                m = this.getModule(r[i]);
6656
                if (m) {
6657
                    add = this.getRequires(m);
6658
                    intl = intl || (m.expanded_map &&
6659
                        (INTL in m.expanded_map));
6660
                    for (j = 0; j < add.length; j++) {
6661
                        d.push(add[j]);
6662
                    }
6663
                }
6664
            }
6665
        }
6666
 
6667
        // get the requirements from superseded modules, if any
6668
        r = this.filterRequires(mod.supersedes);
6669
        if (r) {
6670
            for (i = 0; i < r.length; i++) {
6671
                if (!hash[r[i]]) {
6672
                    // if this module has submodules, the requirements list is
6673
                    // expanded to include the submodules.  This is so we can
6674
                    // prevent dups when a submodule is already loaded and the
6675
                    // parent is requested.
6676
                    if (mod.submodules) {
6677
                        d.push(r[i]);
6678
                    }
6679
 
6680
                    hash[r[i]] = true;
6681
                    m = this.getModule(r[i]);
6682
 
6683
                    if (m) {
6684
                        add = this.getRequires(m);
6685
                        intl = intl || (m.expanded_map &&
6686
                            (INTL in m.expanded_map));
6687
                        for (j = 0; j < add.length; j++) {
6688
                            d.push(add[j]);
6689
                        }
6690
                    }
6691
                }
6692
            }
6693
        }
6694
 
6695
        if (o && this.loadOptional) {
6696
            for (i = 0; i < o.length; i++) {
6697
                if (!hash[o[i]]) {
6698
                    d.push(o[i]);
6699
                    hash[o[i]] = true;
6700
                    m = this.getModuleInfo(o[i]);
6701
                    if (m) {
6702
                        add = this.getRequires(m);
6703
                        intl = intl || (m.expanded_map &&
6704
                            (INTL in m.expanded_map));
6705
                        for (j = 0; j < add.length; j++) {
6706
                            d.push(add[j]);
6707
                        }
6708
                    }
6709
                }
6710
            }
6711
        }
6712
 
6713
        cond = this.conditions[name];
6714
 
6715
        if (cond) {
6716
            //Set the module to not parsed since we have conditionals and this could change the dependency tree.
6717
            mod._parsed = false;
6718
            if (testresults && ftests) {
6719
                oeach(testresults, function(result, id) {
6720
                    var condmod = ftests[id].name;
6721
                    if (!hash[condmod] && ftests[id].trigger === name) {
6722
                        if (result && ftests[id]) {
6723
                            hash[condmod] = true;
6724
                            d.push(condmod);
6725
                        }
6726
                    }
6727
                });
6728
            } else {
6729
                for (i in cond) {
6730
                    if (cond.hasOwnProperty(i)) {
6731
                        if (!hash[i]) {
6732
                            def = cond[i];
6733
                            //first see if they've specfied a ua check
6734
                            //then see if they've got a test fn & if it returns true
6735
                            //otherwise just having a condition block is enough
6736
                            go = def && ((!def.ua && !def.test) || (def.ua && Y.UA[def.ua]) ||
6737
                                        (def.test && def.test(Y, r)));
6738
 
6739
                            if (go) {
6740
                                hash[i] = true;
6741
                                d.push(i);
6742
                                m = this.getModule(i);
6743
                                if (m) {
6744
                                    add = this.getRequires(m);
6745
                                    for (j = 0; j < add.length; j++) {
6746
                                        d.push(add[j]);
6747
                                    }
6748
 
6749
                                }
6750
                            }
6751
                        }
6752
                    }
6753
                }
6754
            }
6755
        }
6756
 
6757
        // Create skin modules
6758
        if (mod.skinnable) {
6759
            skindef = this.skin.overrides;
6760
            for (i in YUI.Env.aliases) {
6761
                if (YUI.Env.aliases.hasOwnProperty(i)) {
6762
                    if (Y.Array.indexOf(YUI.Env.aliases[i], name) > -1) {
6763
                        skinpar = i;
6764
                    }
6765
                }
6766
            }
6767
            if (skindef && (skindef[name] || (skinpar && skindef[skinpar]))) {
6768
                skinname = name;
6769
                if (skindef[skinpar]) {
6770
                    skinname = skinpar;
6771
                }
6772
                for (i = 0; i < skindef[skinname].length; i++) {
6773
                    skinmod = this._addSkin(skindef[skinname][i], name);
6774
                    if (!this.isCSSLoaded(skinmod, this._boot)) {
6775
                        d.push(skinmod);
6776
                    }
6777
                }
6778
            } else {
6779
                skinmod = this._addSkin(this.skin.defaultSkin, name);
6780
                if (!this.isCSSLoaded(skinmod, this._boot)) {
6781
                    d.push(skinmod);
6782
                }
6783
            }
6784
        }
6785
 
6786
        mod._parsed = false;
6787
 
6788
        if (intl) {
6789
 
6790
            if (mod.lang && !mod.langPack && Y.Intl) {
6791
                lang = Y.Intl.lookupBestLang(this.lang || ROOT_LANG, mod.lang);
6792
                packName = this.getLangPackName(lang, name);
6793
                if (packName) {
6794
                    d.unshift(packName);
6795
                }
6796
            }
6797
            d.unshift(INTL);
6798
        }
6799
 
6800
        mod.expanded_map = yArray.hash(d);
6801
 
6802
        mod.expanded = YObject.keys(mod.expanded_map);
6803
 
6804
        return mod.expanded;
6805
    },
6806
    /**
6807
    * Check to see if named css module is already loaded on the page
6808
    * @method isCSSLoaded
6809
    * @param {String} name The name of the css file
6810
    * @param {Boolean} skip To skip the short-circuit for ignoreRegister
6811
    * @return Boolean
6812
    */
6813
    isCSSLoaded: function(name, skip) {
6814
        //TODO - Make this call a batching call with name being an array
6815
        if (!name || !YUI.Env.cssStampEl || (!skip && this.ignoreRegistered)) {
6816
            return false;
6817
        }
6818
        var el = YUI.Env.cssStampEl,
6819
            ret = false,
6820
            mod = YUI.Env._cssLoaded[name],
6821
            style = el.currentStyle; //IE
6822
 
6823
 
6824
        if (mod !== undefined) {
6825
            return mod;
6826
        }
6827
 
6828
        //Add the classname to the element
6829
        el.className = name;
6830
 
6831
        if (!style) {
6832
            style = Y.config.doc.defaultView.getComputedStyle(el, null);
6833
        }
6834
 
6835
        if (style && style.display === 'none') {
6836
            ret = true;
6837
        }
6838
 
6839
 
6840
        el.className = ''; //Reset the classname to ''
6841
 
6842
        YUI.Env._cssLoaded[name] = ret;
6843
 
6844
        return ret;
6845
    },
6846
 
6847
    /**
6848
     * Returns a hash of module names the supplied module satisfies.
6849
     * @method getProvides
6850
     * @param {string} name The name of the module.
6851
     * @return {object} what this module provides.
6852
     */
6853
    getProvides: function(name) {
6854
        var m = this.getModule(name), o, s;
6855
            // supmap = this.provides;
6856
 
6857
        if (!m) {
6858
            return NOT_FOUND;
6859
        }
6860
 
6861
        if (m && !m.provides) {
6862
            o = {};
6863
            s = m.supersedes;
6864
 
6865
            if (s) {
6866
                yArray.each(s, function(v) {
6867
                    Y.mix(o, this.getProvides(v));
6868
                }, this);
6869
            }
6870
 
6871
            o[name] = true;
6872
            m.provides = o;
6873
 
6874
        }
6875
 
6876
        return m.provides;
6877
    },
6878
 
6879
    /**
6880
     * Calculates the dependency tree, the result is stored in the sorted
6881
     * property.
6882
     * @method calculate
6883
     * @param {object} o optional options object.
6884
     * @param {string} type optional argument to prune modules.
6885
     */
6886
    calculate: function(o, type) {
6887
        if (o || type || this.dirty) {
6888
 
6889
            if (o) {
6890
                this._config(o);
6891
            }
6892
 
6893
            if (!this._init) {
6894
                this._setup();
6895
            }
6896
 
6897
            this._explode();
6898
 
6899
            if (this.allowRollup) {
6900
                this._rollup();
6901
            } else {
6902
                this._explodeRollups();
6903
            }
6904
            this._reduce();
6905
            this._sort();
6906
        }
6907
    },
6908
    /**
6909
    * Creates a "psuedo" package for languages provided in the lang array
6910
    * @method _addLangPack
6911
    * @private
6912
    * @param {String} lang The language to create
6913
    * @param {Object} m The module definition to create the language pack around
6914
    * @param {String} packName The name of the package (e.g: lang/datatype-date-en-US)
6915
    * @return {Object} The module definition
6916
    */
6917
    _addLangPack: function(lang, m, packName) {
6918
        var name = m.name,
6919
            packPath, conf,
6920
            existing = this.getModuleInfo(packName);
6921
 
6922
        if (!existing) {
6923
 
6924
            packPath = _path((m.pkg || name), packName, JS, true);
6925
 
6926
            conf = {
6927
                path: packPath,
6928
                intl: true,
6929
                langPack: true,
6930
                ext: m.ext,
6931
                group: m.group,
6932
                supersedes: []
6933
            };
6934
            if (m.root) {
6935
                conf.root = m.root;
6936
            }
6937
            if (m.base) {
6938
                conf.base = m.base;
6939
            }
6940
 
6941
            if (m.configFn) {
6942
                conf.configFn = m.configFn;
6943
            }
6944
 
6945
            this.addModule(conf, packName);
6946
 
6947
            if (lang) {
6948
                Y.Env.lang = Y.Env.lang || {};
6949
                Y.Env.lang[lang] = Y.Env.lang[lang] || {};
6950
                Y.Env.lang[lang][name] = true;
6951
            }
6952
        }
6953
 
6954
        return this.getModuleInfo(packName);
6955
    },
6956
 
6957
    /**
6958
     * Investigates the current YUI configuration on the page.  By default,
6959
     * modules already detected will not be loaded again unless a force
6960
     * option is encountered.  Called by calculate()
6961
     * @method _setup
6962
     * @private
6963
     */
6964
    _setup: function() {
6965
        var info = this.moduleInfo, name, i, j, m, l,
6966
            packName;
6967
 
6968
        for (name in info) {
6969
            if (info.hasOwnProperty(name)) {
6970
                m = info[name];
6971
                if (m) {
6972
 
6973
                    // remove dups
6974
                    //m.requires = YObject.keys(yArray.hash(m.requires));
6975
                    m.requires = yArray.dedupe(m.requires);
6976
 
6977
                    // Create lang pack modules
6978
                    //if (m.lang && m.lang.length) {
6979
                    if (m.lang) {
6980
                        // Setup root package if the module has lang defined,
6981
                        // it needs to provide a root language pack
6982
                        packName = this.getLangPackName(ROOT_LANG, name);
6983
                        this._addLangPack(null, m, packName);
6984
                    }
6985
 
6986
                }
6987
            }
6988
        }
6989
 
6990
 
6991
        //l = Y.merge(this.inserted);
6992
        l = {};
6993
 
6994
        // available modules
6995
        if (!this.ignoreRegistered) {
6996
            Y.mix(l, GLOBAL_ENV.mods);
6997
        }
6998
 
6999
        // add the ignore list to the list of loaded packages
7000
        if (this.ignore) {
7001
            Y.mix(l, yArray.hash(this.ignore));
7002
        }
7003
 
7004
        // expand the list to include superseded modules
7005
        for (j in l) {
7006
            if (l.hasOwnProperty(j)) {
7007
                Y.mix(l, this.getProvides(j));
7008
            }
7009
        }
7010
 
7011
        // remove modules on the force list from the loaded list
7012
        if (this.force) {
7013
            for (i = 0; i < this.force.length; i++) {
7014
                if (this.force[i] in l) {
7015
                    delete l[this.force[i]];
7016
                }
7017
            }
7018
        }
7019
 
7020
        Y.mix(this.loaded, l);
7021
 
7022
        this._init = true;
7023
    },
7024
 
7025
    /**
7026
     * Builds a module name for a language pack
7027
     * @method getLangPackName
7028
     * @param {string} lang the language code.
7029
     * @param {string} mname the module to build it for.
7030
     * @return {string} the language pack module name.
7031
     */
7032
    getLangPackName: function(lang, mname) {
7033
        return ('lang/' + mname + ((lang) ? '_' + lang : ''));
7034
    },
7035
    /**
7036
     * Inspects the required modules list looking for additional
7037
     * dependencies.  Expands the required list to include all
7038
     * required modules.  Called by calculate()
7039
     * @method _explode
7040
     * @private
7041
     */
7042
    _explode: function() {
7043
        //TODO Move done out of scope
7044
        var r = this.required, m, reqs, done = {},
7045
            self = this, name, expound;
7046
 
7047
        // the setup phase is over, all modules have been created
7048
        self.dirty = false;
7049
 
7050
        self._explodeRollups();
7051
        r = self.required;
7052
 
7053
        for (name in r) {
7054
            if (r.hasOwnProperty(name)) {
7055
                if (!done[name]) {
7056
                    done[name] = true;
7057
                    m = self.getModule(name);
7058
                    if (m) {
7059
                        expound = m.expound;
7060
 
7061
                        if (expound) {
7062
                            r[expound] = self.getModule(expound);
7063
                            reqs = self.getRequires(r[expound]);
7064
                            Y.mix(r, yArray.hash(reqs));
7065
                        }
7066
 
7067
                        reqs = self.getRequires(m);
7068
                        Y.mix(r, yArray.hash(reqs));
7069
                    }
7070
                }
7071
            }
7072
        }
7073
 
7074
    },
7075
    /**
7076
    * The default method used to test a module against a pattern
7077
    * @method _patternTest
7078
    * @private
7079
    * @param {String} mname The module being tested
7080
    * @param {String} pname The pattern to match
7081
    */
7082
    _patternTest: function(mname, pname) {
7083
        return (mname.indexOf(pname) > -1);
7084
    },
7085
    /**
7086
    * Get's the loader meta data for the requested module
7087
    * @method getModule
7088
    * @param {String} mname The module name to get
7089
    * @return {Object} The module metadata
7090
    */
7091
    getModule: function(mname) {
7092
        //TODO: Remove name check - it's a quick hack to fix pattern WIP
7093
        if (!mname) {
7094
            return null;
7095
        }
7096
 
7097
        var p, found, pname,
7098
            m = this.getModuleInfo(mname),
7099
            patterns = this.patterns;
7100
 
7101
        // check the patterns library to see if we should automatically add
7102
        // the module with defaults
7103
        if (!m || (m && m.ext)) {
7104
            for (pname in patterns) {
7105
                if (patterns.hasOwnProperty(pname)) {
7106
                    p = patterns[pname];
7107
 
7108
                    //There is no test method, create a default one that tests
7109
                    // the pattern against the mod name
7110
                    if (!p.test) {
7111
                        p.test = this._patternTest;
7112
                    }
7113
 
7114
                    if (p.test(mname, pname)) {
7115
                        // use the metadata supplied for the pattern
7116
                        // as the module definition.
7117
                        found = p;
7118
                        break;
7119
                    }
7120
                }
7121
            }
7122
        }
7123
 
7124
        if (!m) {
7125
            if (found) {
7126
                if (p.action) {
7127
                    p.action.call(this, mname, pname);
7128
                } else {
7129
                    // ext true or false?
7130
                    m = this.addModule(Y.merge(found, {
7131
                        test: void 0,
7132
                        temp: true
7133
                    }), mname);
7134
                    if (m && found.configFn) {
7135
                        m.configFn = found.configFn;
7136
                    }
7137
                }
7138
            }
7139
        } else {
7140
            if (found && m && found.configFn && !m.configFn) {
7141
                m.configFn = found.configFn;
7142
                m.configFn(m);
7143
            }
7144
        }
7145
 
7146
        return m;
7147
    },
7148
 
7149
    // impl in rollup submodule
7150
    _rollup: function() { },
7151
 
7152
    /**
7153
     * Remove superceded modules and loaded modules.  Called by
7154
     * calculate() after we have the mega list of all dependencies
7155
     * @method _reduce
7156
     * @return {object} the reduced dependency hash.
7157
     * @private
7158
     */
7159
    _reduce: function(r) {
7160
 
7161
        r = r || this.required;
7162
 
7163
        var i, j, s, m, type = this.loadType,
7164
        ignore = this.ignore ? yArray.hash(this.ignore) : false;
7165
 
7166
        for (i in r) {
7167
            if (r.hasOwnProperty(i)) {
7168
                m = this.getModule(i);
7169
                // remove if already loaded
7170
                if (((this.loaded[i] || ON_PAGE[i]) &&
7171
                        !this.forceMap[i] && !this.ignoreRegistered) ||
7172
                        (type && m && m.type !== type)) {
7173
                    delete r[i];
7174
                }
7175
                if (ignore && ignore[i]) {
7176
                    delete r[i];
7177
                }
7178
                // remove anything this module supersedes
7179
                s = m && m.supersedes;
7180
                if (s) {
7181
                    for (j = 0; j < s.length; j++) {
7182
                        if (s[j] in r) {
7183
                            delete r[s[j]];
7184
                        }
7185
                    }
7186
                }
7187
            }
7188
        }
7189
 
7190
        return r;
7191
    },
7192
    /**
7193
    * Handles the queue when a module has been loaded for all cases
7194
    * @method _finish
7195
    * @private
7196
    * @param {String} msg The message from Loader
7197
    * @param {Boolean} success A boolean denoting success or failure
7198
    */
7199
    _finish: function(msg, success) {
7200
 
7201
        _queue.running = false;
7202
 
7203
        var onEnd = this.onEnd;
7204
        if (onEnd) {
7205
            onEnd.call(this.context, {
7206
                msg: msg,
7207
                data: this.data,
7208
                success: success
7209
            });
7210
        }
7211
        this._continue();
7212
    },
7213
    /**
7214
    * The default Loader onSuccess handler, calls this.onSuccess with a payload
7215
    * @method _onSuccess
7216
    * @private
7217
    */
7218
    _onSuccess: function() {
7219
        var self = this, skipped = Y.merge(self.skipped), fn,
7220
            failed = [], rreg = self.requireRegistration,
7221
            success, msg, i, mod;
7222
 
7223
        for (i in skipped) {
7224
            if (skipped.hasOwnProperty(i)) {
7225
                delete self.inserted[i];
7226
            }
7227
        }
7228
 
7229
        self.skipped = {};
7230
 
7231
        for (i in self.inserted) {
7232
            if (self.inserted.hasOwnProperty(i)) {
7233
                mod = self.getModule(i);
7234
                if (mod && rreg && mod.type === JS && !(i in YUI.Env.mods)) {
7235
                    failed.push(i);
7236
                } else {
7237
                    Y.mix(self.loaded, self.getProvides(i));
7238
                }
7239
            }
7240
        }
7241
 
7242
        fn = self.onSuccess;
7243
        msg = (failed.length) ? 'notregistered' : 'success';
7244
        success = !(failed.length);
7245
        if (fn) {
7246
            fn.call(self.context, {
7247
                msg: msg,
7248
                data: self.data,
7249
                success: success,
7250
                failed: failed,
7251
                skipped: skipped
7252
            });
7253
        }
7254
        self._finish(msg, success);
7255
    },
7256
    /**
7257
    * The default Loader onProgress handler, calls this.onProgress with a payload
7258
    * @method _onProgress
7259
    * @private
7260
    */
7261
    _onProgress: function(e) {
7262
        var self = this, i;
7263
        //set the internal cache to what just came in.
7264
        if (e.data && e.data.length) {
7265
            for (i = 0; i < e.data.length; i++) {
7266
                e.data[i] = self.getModule(e.data[i].name);
7267
            }
7268
        }
7269
        if (self.onProgress) {
7270
            self.onProgress.call(self.context, {
7271
                name: e.url,
7272
                data: e.data
7273
            });
7274
        }
7275
    },
7276
    /**
7277
    * The default Loader onFailure handler, calls this.onFailure with a payload
7278
    * @method _onFailure
7279
    * @private
7280
    */
7281
    _onFailure: function(o) {
7282
        var f = this.onFailure, msg = [], i = 0, len = o.errors.length;
7283
 
7284
        for (i; i < len; i++) {
7285
            msg.push(o.errors[i].error);
7286
        }
7287
 
7288
        msg = msg.join(',');
7289
 
7290
 
7291
        if (f) {
7292
            f.call(this.context, {
7293
                msg: msg,
7294
                data: this.data,
7295
                success: false
7296
            });
7297
        }
7298
 
7299
        this._finish(msg, false);
7300
 
7301
    },
7302
 
7303
    /**
7304
    * The default Loader onTimeout handler, calls this.onTimeout with a payload
7305
    * @method _onTimeout
7306
    * @param {Get.Transaction} transaction The Transaction object from `Y.Get`
7307
    * @private
7308
    */
7309
    _onTimeout: function(transaction) {
7310
        var f = this.onTimeout;
7311
        if (f) {
7312
            f.call(this.context, {
7313
                msg: 'timeout',
7314
                data: this.data,
7315
                success: false,
7316
                transaction: transaction
7317
            });
7318
        }
7319
    },
7320
 
7321
    /**
7322
     * Sorts the dependency tree.  The last step of calculate()
7323
     * @method _sort
7324
     * @private
7325
     */
7326
    _sort: function() {
7327
        var name,
7328
 
7329
            // Object containing module names.
7330
            required = this.required,
7331
 
7332
            // Keep track of whether we've visited a module.
7333
            visited = {};
7334
 
7335
        // Will contain modules names, in the correct order,
7336
        // according to dependencies.
7337
        this.sorted = [];
7338
 
7339
        for (name in required) {
7340
            if (!visited[name] && required.hasOwnProperty(name)) {
7341
                this._visit(name, visited);
7342
            }
7343
        }
7344
    },
7345
 
7346
    /**
7347
     * Recursively visits the dependencies of the module name
7348
     * passed in, and appends each module name to the `sorted` property.
7349
     * @param {String} name The name of a module.
7350
     * @param {Object} visited Keeps track of whether a module was visited.
7351
     * @method _visit
7352
     * @private
7353
     */
7354
    _visit: function (name, visited) {
7355
        var required, condition, moduleInfo, dependency, dependencies,
7356
            trigger, isAfter, i, l;
7357
 
7358
        visited[name] = true;
7359
        required = this.required;
7360
        moduleInfo = this.moduleInfo[name];
7361
        condition = this.conditions[name] || {};
7362
 
7363
        if (moduleInfo) {
7364
            // Recurse on each dependency of this module,
7365
            // figuring out its dependencies, and so on.
7366
            dependencies = moduleInfo.expanded || moduleInfo.requires;
7367
 
7368
            for (i = 0, l = dependencies.length; i < l; ++i) {
7369
                dependency = dependencies[i];
7370
                trigger = condition[dependency];
7371
 
7372
                // We cannot process this dependency yet if it must
7373
                // appear after our current module.
7374
                isAfter = trigger && (!trigger.when || trigger.when === "after");
7375
 
7376
                // Is this module name in the required list of modules,
7377
                // and have we not already visited it?
7378
                if (required[dependency] && !visited[dependency] && !isAfter) {
7379
                    this._visit(dependency, visited);
7380
                }
7381
            }
7382
        }
7383
 
7384
        this.sorted.push(name);
7385
    },
7386
 
7387
    /**
7388
    * Handles the actual insertion of script/link tags
7389
    * @method _insert
7390
    * @private
7391
    * @param {Object} source The YUI instance the request came from
7392
    * @param {Object} o The metadata to include
7393
    * @param {String} type JS or CSS
7394
    * @param {Boolean} [skipcalc=false] Do a Loader.calculate on the meta
7395
    */
7396
    _insert: function(source, o, type, skipcalc) {
7397
 
7398
 
7399
        // restore the state at the time of the request
7400
        if (source) {
7401
            this._config(source);
7402
        }
7403
 
7404
        // build the dependency list
7405
        // don't include type so we can process CSS and script in
7406
        // one pass when the type is not specified.
7407
 
7408
        var modules = this.resolve(!skipcalc),
7409
            self = this, comp = 0, actions = 0,
7410
            mods = {}, deps, complete;
7411
 
7412
        self._refetch = [];
7413
 
7414
        if (type) {
7415
            //Filter out the opposite type and reset the array so the checks later work
7416
            modules[((type === JS) ? CSS : JS)] = [];
7417
        }
7418
        if (!self.fetchCSS) {
7419
            modules.css = [];
7420
        }
7421
        if (modules.js.length) {
7422
            comp++;
7423
        }
7424
        if (modules.css.length) {
7425
            comp++;
7426
        }
7427
 
7428
        //console.log('Resolved Modules: ', modules);
7429
 
7430
        complete = function(d) {
7431
            actions++;
7432
            var errs = {}, i = 0, o = 0, u = '', fn,
7433
                modName, resMods;
7434
 
7435
            if (d && d.errors) {
7436
                for (i = 0; i < d.errors.length; i++) {
7437
                    if (d.errors[i].request) {
7438
                        u = d.errors[i].request.url;
7439
                    } else {
7440
                        u = d.errors[i];
7441
                    }
7442
                    errs[u] = u;
7443
                }
7444
            }
7445
 
7446
            if (d && d.data && d.data.length && (d.type === 'success')) {
7447
                for (i = 0; i < d.data.length; i++) {
7448
                    self.inserted[d.data[i].name] = true;
7449
                    //If the external module has a skin or a lang, reprocess it
7450
                    if (d.data[i].lang || d.data[i].skinnable) {
7451
                        delete self.inserted[d.data[i].name];
7452
                        self._refetch.push(d.data[i].name);
7453
                    }
7454
                }
7455
            }
7456
 
7457
            if (actions === comp) {
7458
                self._loading = null;
7459
                if (self._refetch.length) {
7460
                    //Get the deps for the new meta-data and reprocess
7461
                    for (i = 0; i < self._refetch.length; i++) {
7462
                        deps = self.getRequires(self.getModule(self._refetch[i]));
7463
                        for (o = 0; o < deps.length; o++) {
7464
                            if (!self.inserted[deps[o]]) {
7465
                                //We wouldn't be to this point without the module being here
7466
                                mods[deps[o]] = deps[o];
7467
                            }
7468
                        }
7469
                    }
7470
                    mods = Y.Object.keys(mods);
7471
                    if (mods.length) {
7472
                        self.require(mods);
7473
                        resMods = self.resolve(true);
7474
                        if (resMods.cssMods.length) {
7475
                            for (i=0; i <  resMods.cssMods.length; i++) {
7476
                                modName = resMods.cssMods[i].name;
7477
                                delete YUI.Env._cssLoaded[modName];
7478
                                if (self.isCSSLoaded(modName)) {
7479
                                    self.inserted[modName] = true;
7480
                                    delete self.required[modName];
7481
                                }
7482
                            }
7483
                            self.sorted = [];
7484
                            self._sort();
7485
                        }
7486
                        d = null; //bail
7487
                        self._insert(); //insert the new deps
7488
                    }
7489
                }
7490
                if (d && d.fn) {
7491
                    fn = d.fn;
7492
                    delete d.fn;
7493
                    fn.call(self, d);
7494
                }
7495
            }
7496
        };
7497
 
7498
        this._loading = true;
7499
 
7500
        if (!modules.js.length && !modules.css.length) {
7501
            actions = -1;
7502
            complete({
7503
                fn: self._onSuccess
7504
            });
7505
            return;
7506
        }
7507
 
7508
 
7509
        if (modules.css.length) { //Load CSS first
7510
            Y.Get.css(modules.css, {
7511
                data: modules.cssMods,
7512
                attributes: self.cssAttributes,
7513
                insertBefore: self.insertBefore,
7514
                charset: self.charset,
7515
                timeout: self.timeout,
7516
                context: self,
7517
                onProgress: function(e) {
7518
                    self._onProgress.call(self, e);
7519
                },
7520
                onTimeout: function(d) {
7521
                    self._onTimeout.call(self, d);
7522
                },
7523
                onSuccess: function(d) {
7524
                    d.type = 'success';
7525
                    d.fn = self._onSuccess;
7526
                    complete.call(self, d);
7527
                },
7528
                onFailure: function(d) {
7529
                    d.type = 'failure';
7530
                    d.fn = self._onFailure;
7531
                    complete.call(self, d);
7532
                }
7533
            });
7534
        }
7535
 
7536
        if (modules.js.length) {
7537
            Y.Get.js(modules.js, {
7538
                data: modules.jsMods,
7539
                insertBefore: self.insertBefore,
7540
                attributes: self.jsAttributes,
7541
                charset: self.charset,
7542
                timeout: self.timeout,
7543
                autopurge: false,
7544
                context: self,
7545
                async: self.async,
7546
                onProgress: function(e) {
7547
                    self._onProgress.call(self, e);
7548
                },
7549
                onTimeout: function(d) {
7550
                    self._onTimeout.call(self, d);
7551
                },
7552
                onSuccess: function(d) {
7553
                    d.type = 'success';
7554
                    d.fn = self._onSuccess;
7555
                    complete.call(self, d);
7556
                },
7557
                onFailure: function(d) {
7558
                    d.type = 'failure';
7559
                    d.fn = self._onFailure;
7560
                    complete.call(self, d);
7561
                }
7562
            });
7563
        }
7564
    },
7565
    /**
7566
    * Once a loader operation is completely finished, process any additional queued items.
7567
    * @method _continue
7568
    * @private
7569
    */
7570
    _continue: function() {
7571
        if (!(_queue.running) && _queue.size() > 0) {
7572
            _queue.running = true;
7573
            _queue.next()();
7574
        }
7575
    },
7576
 
7577
    /**
7578
     * inserts the requested modules and their dependencies.
7579
     * <code>type</code> can be "js" or "css".  Both script and
7580
     * css are inserted if type is not provided.
7581
     * @method insert
7582
     * @param {object} o optional options object.
7583
     * @param {string} type the type of dependency to insert.
7584
     */
7585
    insert: function(o, type, skipsort) {
7586
        var self = this, copy = Y.merge(this);
7587
        delete copy.require;
7588
        delete copy.dirty;
7589
        _queue.add(function() {
7590
            self._insert(copy, o, type, skipsort);
7591
        });
7592
        this._continue();
7593
    },
7594
 
7595
    /**
7596
     * Executed every time a module is loaded, and if we are in a load
7597
     * cycle, we attempt to load the next script.  Public so that it
7598
     * is possible to call this if using a method other than
7599
     * Y.register to determine when scripts are fully loaded
7600
     * @method loadNext
7601
     * @deprecated
7602
     * @param {string} mname optional the name of the module that has
7603
     * been loaded (which is usually why it is time to load the next
7604
     * one).
7605
     */
7606
    loadNext: function() {
7607
        return;
7608
    },
7609
 
7610
    /**
7611
     * Apply filter defined for this instance to a url/path
7612
     * @method _filter
7613
     * @param {string} u the string to filter.
7614
     * @param {string} name the name of the module, if we are processing
7615
     * a single module as opposed to a combined url.
7616
     * @return {string} the filtered string.
7617
     * @private
7618
     */
7619
    _filter: function(u, name, group) {
7620
        var f = this.filter,
7621
            hasFilter = name && (name in this.filters),
7622
            modFilter = hasFilter && this.filters[name],
7623
            groupName = group || (this.getModuleInfo(name) || {}).group || null;
7624
 
7625
        if (groupName && this.groups[groupName] && this.groups[groupName].filter) {
7626
            modFilter = this.groups[groupName].filter;
7627
            hasFilter = true;
7628
        }
7629
 
7630
        if (u) {
7631
            if (hasFilter) {
7632
                f = (L.isString(modFilter)) ? this.FILTER_DEFS[modFilter.toUpperCase()] || null : modFilter;
7633
            }
7634
            if (f) {
7635
                u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr);
7636
            }
7637
        }
7638
        return u;
7639
    },
7640
 
7641
    /**
7642
     * Generates the full url for a module
7643
     * @method _url
7644
     * @param {string} path the path fragment.
7645
     * @param {String} name The name of the module
7646
     * @param {String} [base] The base url to use. Defaults to self.base
7647
     * @return {string} the full url.
7648
     * @private
7649
     */
7650
    _url: function(path, name, base) {
7651
        return this._filter((base || this.base || '') + path, name);
7652
    },
7653
    /**
7654
    * Returns an Object hash of file arrays built from `loader.sorted` or from an arbitrary list of sorted modules.
7655
    * @method resolve
7656
    * @param {Boolean} [calc=false] Perform a loader.calculate() before anything else
7657
    * @param {Array} [sorted=loader.sorted] An override for the loader.sorted array
7658
    * @return {Object} Object hash (js and css) of two arrays of file lists
7659
    * @example This method can be used as an off-line dep calculator
7660
    *
7661
    *        var Y = YUI();
7662
    *        var loader = new Y.Loader({
7663
    *            filter: 'debug',
7664
    *            base: '../../',
7665
    *            root: 'build/',
7666
    *            combine: true,
7667
    *            require: ['node', 'dd', 'console']
7668
    *        });
7669
    *        var out = loader.resolve(true);
7670
    *
7671
    */
7672
    resolve: function(calc, sorted) {
7673
        var self     = this,
7674
            resolved = { js: [], jsMods: [], css: [], cssMods: [] },
7675
            addSingle,
7676
            usePathogen = Y.config.comboLoader && Y.config.customComboBase;
7677
 
7678
        if (self.skin.overrides || self.skin.defaultSkin !== DEFAULT_SKIN || self.ignoreRegistered) {
7679
            self._resetModules();
7680
        }
7681
 
7682
        if (calc) {
7683
            self.calculate();
7684
        }
7685
        sorted = sorted || self.sorted;
7686
 
7687
        addSingle = function(mod) {
7688
            if (mod) {
7689
                var group = (mod.group && self.groups[mod.group]) || NOT_FOUND,
7690
                    url;
7691
 
7692
                //Always assume it's async
7693
                if (group.async === false) {
7694
                    mod.async = group.async;
7695
                }
7696
 
7697
                url = (mod.fullpath) ? self._filter(mod.fullpath, mod.name) :
7698
                      self._url(mod.path, mod.name, group.base || mod.base);
7699
 
7700
                if (mod.attributes || mod.async === false) {
7701
                    url = {
7702
                        url: url,
7703
                        async: mod.async
7704
                    };
7705
                    if (mod.attributes) {
7706
                        url.attributes = mod.attributes;
7707
                    }
7708
                }
7709
                resolved[mod.type].push(url);
7710
                resolved[mod.type + 'Mods'].push(mod);
7711
            } else {
7712
            }
7713
 
7714
        };
7715
 
7716
        /*jslint vars: true */
7717
        var inserted     = (self.ignoreRegistered) ? {} : self.inserted,
7718
            comboSources,
7719
            maxURLLength,
7720
            comboMeta,
7721
            comboBase,
7722
            comboSep,
7723
            group,
7724
            mod,
7725
            len,
7726
            i,
7727
            hasComboModule = false;
7728
 
7729
        /*jslint vars: false */
7730
 
7731
        for (i = 0, len = sorted.length; i < len; i++) {
7732
            mod = self.getModule(sorted[i]);
7733
            if (!mod || inserted[mod.name]) {
7734
                continue;
7735
            }
7736
 
7737
            group = self.groups[mod.group];
7738
 
7739
            comboBase = self.comboBase;
7740
 
7741
            if (group) {
7742
                if (!group.combine || mod.fullpath) {
7743
                    //This is not a combo module, skip it and load it singly later.
7744
                    addSingle(mod);
7745
                    continue;
7746
                }
7747
                mod.combine = true;
7748
 
7749
                if (typeof group.root === 'string') {
7750
                    mod.root = group.root;
7751
                }
7752
 
7753
                comboBase    = group.comboBase || comboBase;
7754
                comboSep     = group.comboSep;
7755
                maxURLLength = group.maxURLLength;
7756
            } else {
7757
                if (!self.combine) {
7758
                    //This is not a combo module, skip it and load it singly later.
7759
                    addSingle(mod);
7760
                    continue;
7761
                }
7762
            }
7763
 
7764
            if (!mod.combine && mod.ext) {
7765
                addSingle(mod);
7766
                continue;
7767
            }
7768
            hasComboModule = true;
7769
            comboSources = comboSources || {};
7770
            comboSources[comboBase] = comboSources[comboBase] ||
7771
                { js: [], jsMods: [], css: [], cssMods: [] };
7772
 
7773
            comboMeta               = comboSources[comboBase];
7774
            comboMeta.group         = mod.group;
7775
            comboMeta.comboSep      = comboSep || self.comboSep;
7776
            comboMeta.maxURLLength  = maxURLLength || self.maxURLLength;
7777
 
7778
            comboMeta[mod.type + 'Mods'].push(mod);
7779
            if (mod.type === JS || mod.type === CSS) {
7780
                resolved[mod.type + 'Mods'].push(mod);
7781
            }
7782
        }
7783
        //only encode if we have something to encode
7784
        if (hasComboModule) {
7785
            if (usePathogen) {
7786
                resolved = this._pathogenEncodeComboSources(resolved);
7787
            } else {
7788
                resolved = this._encodeComboSources(resolved, comboSources);
7789
            }
7790
        }
7791
        return resolved;
7792
    },
7793
 
7794
    /**
7795
     * Encodes combo sources and appends them to an object hash of arrays from `loader.resolve`.
7796
     *
7797
     * @method _encodeComboSources
7798
     * @param {Object} resolved The object hash of arrays in which to attach the encoded combo sources.
7799
     * @param {Object} comboSources An object containing relevant data about modules.
7800
     * @return Object
7801
     * @private
7802
     */
7803
    _encodeComboSources: function(resolved, comboSources) {
7804
        var fragSubset,
7805
            modules,
7806
            tmpBase,
7807
            baseLen,
7808
            frags,
7809
            frag,
7810
            type,
7811
            mod,
7812
            maxURLLength,
7813
            comboBase,
7814
            comboMeta,
7815
            comboSep,
7816
            i,
7817
            len,
7818
            self = this;
7819
 
7820
        for (comboBase in comboSources) {
7821
            if (comboSources.hasOwnProperty(comboBase)) {
7822
                comboMeta    = comboSources[comboBase];
7823
                comboSep     = comboMeta.comboSep;
7824
                maxURLLength = comboMeta.maxURLLength;
7825
                for (type in comboMeta) {
7826
                    if (type === JS || type === CSS) {
7827
                        modules = comboMeta[type + 'Mods'];
7828
                        frags = [];
7829
                        for (i = 0, len = modules.length; i < len; i += 1) {
7830
                            mod = modules[i];
7831
                            frag = ((typeof mod.root === 'string') ? mod.root : self.root) + (mod.path || mod.fullpath);
7832
                            frags.push(
7833
                                self._filter(frag, mod.name)
7834
                            );
7835
                        }
7836
                        tmpBase = comboBase + frags.join(comboSep);
7837
                        baseLen = tmpBase.length;
7838
                        if (maxURLLength <= comboBase.length) {
7839
                            maxURLLength = MAX_URL_LENGTH;
7840
                        }
7841
 
7842
                        if (frags.length) {
7843
                            if (baseLen > maxURLLength) {
7844
                                fragSubset = [];
7845
                                for (i = 0, len = frags.length; i < len; i++) {
7846
                                    fragSubset.push(frags[i]);
7847
                                    tmpBase = comboBase + fragSubset.join(comboSep);
7848
 
7849
                                    if (tmpBase.length > maxURLLength) {
7850
                                        frag = fragSubset.pop();
7851
                                        tmpBase = comboBase + fragSubset.join(comboSep);
7852
                                        resolved[type].push(self._filter(tmpBase, null, comboMeta.group));
7853
                                        fragSubset = [];
7854
                                        if (frag) {
7855
                                            fragSubset.push(frag);
7856
                                        }
7857
                                    }
7858
                                }
7859
                                if (fragSubset.length) {
7860
                                    tmpBase = comboBase + fragSubset.join(comboSep);
7861
                                    resolved[type].push(self._filter(tmpBase, null, comboMeta.group));
7862
                                }
7863
                            } else {
7864
                                resolved[type].push(self._filter(tmpBase, null, comboMeta.group));
7865
                            }
7866
                        }
7867
                    }
7868
                }
7869
            }
7870
        }
7871
        return resolved;
7872
    },
7873
 
7874
    /**
7875
    Shortcut to calculate, resolve and load all modules.
7876
 
7877
        var loader = new Y.Loader({
7878
            ignoreRegistered: true,
7879
            modules: {
7880
                mod: {
7881
                    path: 'mod.js'
7882
                }
7883
            },
7884
            requires: [ 'mod' ]
7885
        });
7886
        loader.load(function() {
7887
            console.log('All modules have loaded..');
7888
        });
7889
 
7890
 
7891
    @method load
7892
    @param {Function} cb Executed after all load operations are complete
7893
    */
7894
    load: function(cb) {
7895
        if (!cb) {
7896
            return;
7897
        }
7898
        var self = this,
7899
            out = self.resolve(true);
7900
 
7901
        self.data = out;
7902
 
7903
        self.onEnd = function() {
7904
            cb.apply(self.context || self, arguments);
7905
        };
7906
 
7907
        self.insert();
7908
    }
7909
};
7910
 
7911
 
7912
}, '3.18.1', {"requires": ["get", "features"]});
7913
YUI.add('loader-rollup', function (Y, NAME) {
7914
 
7915
/**
7916
 * Optional automatic rollup logic for reducing http connections
7917
 * when not using a combo service.
7918
 * @module loader
7919
 * @submodule rollup
7920
 */
7921
 
7922
/**
7923
 * Look for rollup packages to determine if all of the modules a
7924
 * rollup supersedes are required.  If so, include the rollup to
7925
 * help reduce the total number of connections required.  Called
7926
 * by calculate().  This is an optional feature, and requires the
7927
 * appropriate submodule to function.
7928
 * @method _rollup
7929
 * @for Loader
7930
 * @private
7931
 */
7932
Y.Loader.prototype._rollup = function() {
7933
    var i, j, m, s, r = this.required, roll,
7934
        info = this.moduleInfo, rolled, c, smod;
7935
 
7936
    // find and cache rollup modules
7937
    if (this.dirty || !this.rollups) {
7938
        this.rollups = {};
7939
        for (i in info) {
7940
            if (info.hasOwnProperty(i)) {
7941
                m = this.getModule(i);
7942
                // if (m && m.rollup && m.supersedes) {
7943
                if (m && m.rollup) {
7944
                    this.rollups[i] = m;
7945
                }
7946
            }
7947
        }
7948
    }
7949
 
7950
    // make as many passes as needed to pick up rollup rollups
7951
    for (;;) {
7952
        rolled = false;
7953
 
7954
        // go through the rollup candidates
7955
        for (i in this.rollups) {
7956
            if (this.rollups.hasOwnProperty(i)) {
7957
                // there can be only one, unless forced
7958
                if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) {
7959
                    m = this.getModule(i);
7960
                    s = m.supersedes || [];
7961
                    roll = false;
7962
 
7963
                    // @TODO remove continue
7964
                    if (!m.rollup) {
7965
                        continue;
7966
                    }
7967
 
7968
                    c = 0;
7969
 
7970
                    // check the threshold
7971
                    for (j = 0; j < s.length; j++) {
7972
                        smod = info[s[j]];
7973
 
7974
                        // if the superseded module is loaded, we can't
7975
                        // load the rollup unless it has been forced.
7976
                        if (this.loaded[s[j]] && !this.forceMap[s[j]]) {
7977
                            roll = false;
7978
                            break;
7979
                        // increment the counter if this module is required.
7980
                        // if we are beyond the rollup threshold, we will
7981
                        // use the rollup module
7982
                        } else if (r[s[j]] && m.type === smod.type) {
7983
                            c++;
7984
                            roll = (c >= m.rollup);
7985
                            if (roll) {
7986
                                break;
7987
                            }
7988
                        }
7989
                    }
7990
 
7991
                    if (roll) {
7992
                        // add the rollup
7993
                        r[i] = true;
7994
                        rolled = true;
7995
 
7996
                        // expand the rollup's dependencies
7997
                        this.getRequires(m);
7998
                    }
7999
                }
8000
            }
8001
        }
8002
 
8003
        // if we made it here w/o rolling up something, we are done
8004
        if (!rolled) {
8005
            break;
8006
        }
8007
    }
8008
};
8009
 
8010
 
8011
}, '3.18.1', {"requires": ["loader-base"]});
8012
YUI.add('loader-yui3', function (Y, NAME) {
8013
 
8014
/* This file is auto-generated by (yogi loader --yes --mix --start ../) */
8015
 
8016
/*jshint maxlen:900, eqeqeq: false */
8017
 
8018
/**
8019
 * YUI 3 module metadata
8020
 * @module loader
8021
 * @submodule loader-yui3
8022
 */
8023
YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {};
8024
Y.mix(YUI.Env[Y.version].modules, {
8025
    "align-plugin": {
8026
        "requires": [
8027
            "node-screen",
8028
            "node-pluginhost"
8029
        ]
8030
    },
8031
    "anim": {
8032
        "use": [
8033
            "anim-base",
8034
            "anim-color",
8035
            "anim-curve",
8036
            "anim-easing",
8037
            "anim-node-plugin",
8038
            "anim-scroll",
8039
            "anim-xy"
8040
        ]
8041
    },
8042
    "anim-base": {
8043
        "requires": [
8044
            "base-base",
8045
            "node-style",
8046
            "color-base"
8047
        ]
8048
    },
8049
    "anim-color": {
8050
        "requires": [
8051
            "anim-base"
8052
        ]
8053
    },
8054
    "anim-curve": {
8055
        "requires": [
8056
            "anim-xy"
8057
        ]
8058
    },
8059
    "anim-easing": {
8060
        "requires": [
8061
            "anim-base"
8062
        ]
8063
    },
8064
    "anim-node-plugin": {
8065
        "requires": [
8066
            "node-pluginhost",
8067
            "anim-base"
8068
        ]
8069
    },
8070
    "anim-scroll": {
8071
        "requires": [
8072
            "anim-base"
8073
        ]
8074
    },
8075
    "anim-shape": {
8076
        "requires": [
8077
            "anim-base",
8078
            "anim-easing",
8079
            "anim-color",
8080
            "matrix"
8081
        ]
8082
    },
8083
    "anim-shape-transform": {
8084
        "use": [
8085
            "anim-shape"
8086
        ]
8087
    },
8088
    "anim-xy": {
8089
        "requires": [
8090
            "anim-base",
8091
            "node-screen"
8092
        ]
8093
    },
8094
    "app": {
8095
        "use": [
8096
            "app-base",
8097
            "app-content",
8098
            "app-transitions",
8099
            "lazy-model-list",
8100
            "model",
8101
            "model-list",
8102
            "model-sync-rest",
8103
            "model-sync-local",
8104
            "router",
8105
            "view",
8106
            "view-node-map"
8107
        ]
8108
    },
8109
    "app-base": {
8110
        "requires": [
8111
            "classnamemanager",
8112
            "pjax-base",
8113
            "router",
8114
            "view"
8115
        ]
8116
    },
8117
    "app-content": {
8118
        "requires": [
8119
            "app-base",
8120
            "pjax-content"
8121
        ]
8122
    },
8123
    "app-transitions": {
8124
        "requires": [
8125
            "app-base"
8126
        ]
8127
    },
8128
    "app-transitions-css": {
8129
        "type": "css"
8130
    },
8131
    "app-transitions-native": {
8132
        "condition": {
8133
            "name": "app-transitions-native",
8134
            "test": function (Y) {
8135
    var doc  = Y.config.doc,
8136
        node = doc ? doc.documentElement : null;
8137
 
8138
    if (node && node.style) {
8139
        return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style);
8140
    }
8141
 
8142
    return false;
8143
},
8144
            "trigger": "app-transitions"
8145
        },
8146
        "requires": [
8147
            "app-transitions",
8148
            "app-transitions-css",
8149
            "parallel",
8150
            "transition"
8151
        ]
8152
    },
8153
    "array-extras": {
8154
        "requires": [
8155
            "yui-base"
8156
        ]
8157
    },
8158
    "array-invoke": {
8159
        "requires": [
8160
            "yui-base"
8161
        ]
8162
    },
8163
    "arraylist": {
8164
        "requires": [
8165
            "yui-base"
8166
        ]
8167
    },
8168
    "arraylist-add": {
8169
        "requires": [
8170
            "arraylist"
8171
        ]
8172
    },
8173
    "arraylist-filter": {
8174
        "requires": [
8175
            "arraylist"
8176
        ]
8177
    },
8178
    "arraysort": {
8179
        "requires": [
8180
            "yui-base"
8181
        ]
8182
    },
8183
    "async-queue": {
8184
        "requires": [
8185
            "event-custom"
8186
        ]
8187
    },
8188
    "attribute": {
8189
        "use": [
8190
            "attribute-base",
8191
            "attribute-complex"
8192
        ]
8193
    },
8194
    "attribute-base": {
8195
        "requires": [
8196
            "attribute-core",
8197
            "attribute-observable",
8198
            "attribute-extras"
8199
        ]
8200
    },
8201
    "attribute-complex": {
8202
        "requires": [
8203
            "attribute-base"
8204
        ]
8205
    },
8206
    "attribute-core": {
8207
        "requires": [
8208
            "oop"
8209
        ]
8210
    },
8211
    "attribute-events": {
8212
        "use": [
8213
            "attribute-observable"
8214
        ]
8215
    },
8216
    "attribute-extras": {
8217
        "requires": [
8218
            "oop"
8219
        ]
8220
    },
8221
    "attribute-observable": {
8222
        "requires": [
8223
            "event-custom"
8224
        ]
8225
    },
8226
    "autocomplete": {
8227
        "use": [
8228
            "autocomplete-base",
8229
            "autocomplete-sources",
8230
            "autocomplete-list",
8231
            "autocomplete-plugin"
8232
        ]
8233
    },
8234
    "autocomplete-base": {
8235
        "optional": [
8236
            "autocomplete-sources"
8237
        ],
8238
        "requires": [
8239
            "array-extras",
8240
            "base-build",
8241
            "escape",
8242
            "event-valuechange",
8243
            "node-base"
8244
        ]
8245
    },
8246
    "autocomplete-filters": {
8247
        "requires": [
8248
            "array-extras",
8249
            "text-wordbreak"
8250
        ]
8251
    },
8252
    "autocomplete-filters-accentfold": {
8253
        "requires": [
8254
            "array-extras",
8255
            "text-accentfold",
8256
            "text-wordbreak"
8257
        ]
8258
    },
8259
    "autocomplete-highlighters": {
8260
        "requires": [
8261
            "array-extras",
8262
            "highlight-base"
8263
        ]
8264
    },
8265
    "autocomplete-highlighters-accentfold": {
8266
        "requires": [
8267
            "array-extras",
8268
            "highlight-accentfold"
8269
        ]
8270
    },
8271
    "autocomplete-list": {
8272
        "after": [
8273
            "autocomplete-sources"
8274
        ],
8275
        "lang": [
8276
            "en",
8277
            "es",
8278
            "hu",
8279
            "it"
8280
        ],
8281
        "requires": [
8282
            "autocomplete-base",
8283
            "event-resize",
8284
            "node-screen",
8285
            "selector-css3",
8286
            "shim-plugin",
8287
            "widget",
8288
            "widget-position",
8289
            "widget-position-align"
8290
        ],
8291
        "skinnable": true
8292
    },
8293
    "autocomplete-list-keys": {
8294
        "condition": {
8295
            "name": "autocomplete-list-keys",
8296
            "test": function (Y) {
8297
    // Only add keyboard support to autocomplete-list if this doesn't appear to
8298
    // be an iOS or Android-based mobile device.
8299
    //
8300
    // There's currently no feasible way to actually detect whether a device has
8301
    // a hardware keyboard, so this sniff will have to do. It can easily be
8302
    // overridden by manually loading the autocomplete-list-keys module.
8303
    //
8304
    // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari
8305
    // doesn't fire the keyboard events used by AutoCompleteList, so there's
8306
    // no point loading the -keys module even when a bluetooth keyboard may be
8307
    // available.
8308
    return !(Y.UA.ios || Y.UA.android);
8309
},
8310
            "trigger": "autocomplete-list"
8311
        },
8312
        "requires": [
8313
            "autocomplete-list",
8314
            "base-build"
8315
        ]
8316
    },
8317
    "autocomplete-plugin": {
8318
        "requires": [
8319
            "autocomplete-list",
8320
            "node-pluginhost"
8321
        ]
8322
    },
8323
    "autocomplete-sources": {
8324
        "optional": [
8325
            "io-base",
8326
            "json-parse",
8327
            "jsonp",
8328
            "yql"
8329
        ],
8330
        "requires": [
8331
            "autocomplete-base"
8332
        ]
8333
    },
8334
    "axes": {
8335
        "use": [
8336
            "axis-numeric",
8337
            "axis-category",
8338
            "axis-time",
8339
            "axis-stacked"
8340
        ]
8341
    },
8342
    "axes-base": {
8343
        "use": [
8344
            "axis-numeric-base",
8345
            "axis-category-base",
8346
            "axis-time-base",
8347
            "axis-stacked-base"
8348
        ]
8349
    },
8350
    "axis": {
8351
        "requires": [
8352
            "dom",
8353
            "widget",
8354
            "widget-position",
8355
            "widget-stack",
8356
            "graphics",
8357
            "axis-base"
8358
        ]
8359
    },
8360
    "axis-base": {
8361
        "requires": [
8362
            "classnamemanager",
8363
            "datatype-number",
8364
            "datatype-date",
8365
            "base",
8366
            "event-custom"
8367
        ]
8368
    },
8369
    "axis-category": {
8370
        "requires": [
8371
            "axis",
8372
            "axis-category-base"
8373
        ]
8374
    },
8375
    "axis-category-base": {
8376
        "requires": [
8377
            "axis-base"
8378
        ]
8379
    },
8380
    "axis-numeric": {
8381
        "requires": [
8382
            "axis",
8383
            "axis-numeric-base"
8384
        ]
8385
    },
8386
    "axis-numeric-base": {
8387
        "requires": [
8388
            "axis-base"
8389
        ]
8390
    },
8391
    "axis-stacked": {
8392
        "requires": [
8393
            "axis-numeric",
8394
            "axis-stacked-base"
8395
        ]
8396
    },
8397
    "axis-stacked-base": {
8398
        "requires": [
8399
            "axis-numeric-base"
8400
        ]
8401
    },
8402
    "axis-time": {
8403
        "requires": [
8404
            "axis",
8405
            "axis-time-base"
8406
        ]
8407
    },
8408
    "axis-time-base": {
8409
        "requires": [
8410
            "axis-base"
8411
        ]
8412
    },
8413
    "base": {
8414
        "use": [
8415
            "base-base",
8416
            "base-pluginhost",
8417
            "base-build"
8418
        ]
8419
    },
8420
    "base-base": {
8421
        "requires": [
8422
            "attribute-base",
8423
            "base-core",
8424
            "base-observable"
8425
        ]
8426
    },
8427
    "base-build": {
8428
        "requires": [
8429
            "base-base"
8430
        ]
8431
    },
8432
    "base-core": {
8433
        "requires": [
8434
            "attribute-core"
8435
        ]
8436
    },
8437
    "base-observable": {
8438
        "requires": [
8439
            "attribute-observable",
8440
            "base-core"
8441
        ]
8442
    },
8443
    "base-pluginhost": {
8444
        "requires": [
8445
            "base-base",
8446
            "pluginhost"
8447
        ]
8448
    },
8449
    "button": {
8450
        "requires": [
8451
            "button-core",
8452
            "cssbutton",
8453
            "widget"
8454
        ]
8455
    },
8456
    "button-core": {
8457
        "requires": [
8458
            "attribute-core",
8459
            "classnamemanager",
8460
            "node-base",
8461
            "escape"
8462
        ]
8463
    },
8464
    "button-group": {
8465
        "requires": [
8466
            "button-plugin",
8467
            "cssbutton",
8468
            "widget"
8469
        ]
8470
    },
8471
    "button-plugin": {
8472
        "requires": [
8473
            "button-core",
8474
            "cssbutton",
8475
            "node-pluginhost"
8476
        ]
8477
    },
8478
    "cache": {
8479
        "use": [
8480
            "cache-base",
8481
            "cache-offline",
8482
            "cache-plugin"
8483
        ]
8484
    },
8485
    "cache-base": {
8486
        "requires": [
8487
            "base"
8488
        ]
8489
    },
8490
    "cache-offline": {
8491
        "requires": [
8492
            "cache-base",
8493
            "json"
8494
        ]
8495
    },
8496
    "cache-plugin": {
8497
        "requires": [
8498
            "plugin",
8499
            "cache-base"
8500
        ]
8501
    },
8502
    "calendar": {
8503
        "requires": [
8504
            "calendar-base",
8505
            "calendarnavigator"
8506
        ],
8507
        "skinnable": true
8508
    },
8509
    "calendar-base": {
8510
        "lang": [
8511
            "de",
8512
            "en",
8513
            "es",
8514
            "es-AR",
8515
            "fr",
8516
            "hu",
8517
            "it",
8518
            "ja",
8519
            "nb-NO",
8520
            "nl",
8521
            "pt-BR",
8522
            "ru",
8523
            "zh-Hans",
8524
            "zh-Hans-CN",
8525
            "zh-Hant",
8526
            "zh-Hant-HK",
8527
            "zh-HANT-TW"
8528
        ],
8529
        "requires": [
8530
            "widget",
8531
            "datatype-date",
8532
            "datatype-date-math",
8533
            "cssgrids"
8534
        ],
8535
        "skinnable": true
8536
    },
8537
    "calendarnavigator": {
8538
        "requires": [
8539
            "plugin",
8540
            "classnamemanager",
8541
            "datatype-date",
8542
            "node"
8543
        ],
8544
        "skinnable": true
8545
    },
8546
    "charts": {
8547
        "use": [
8548
            "charts-base"
8549
        ]
8550
    },
8551
    "charts-base": {
8552
        "requires": [
8553
            "dom",
8554
            "event-mouseenter",
8555
            "event-touch",
8556
            "graphics-group",
8557
            "axes",
8558
            "series-pie",
8559
            "series-line",
8560
            "series-marker",
8561
            "series-area",
8562
            "series-spline",
8563
            "series-column",
8564
            "series-bar",
8565
            "series-areaspline",
8566
            "series-combo",
8567
            "series-combospline",
8568
            "series-line-stacked",
8569
            "series-marker-stacked",
8570
            "series-area-stacked",
8571
            "series-spline-stacked",
8572
            "series-column-stacked",
8573
            "series-bar-stacked",
8574
            "series-areaspline-stacked",
8575
            "series-combo-stacked",
8576
            "series-combospline-stacked"
8577
        ]
8578
    },
8579
    "charts-legend": {
8580
        "requires": [
8581
            "charts-base"
8582
        ]
8583
    },
8584
    "classnamemanager": {
8585
        "requires": [
8586
            "yui-base"
8587
        ]
8588
    },
8589
    "clickable-rail": {
8590
        "requires": [
8591
            "slider-base"
8592
        ]
8593
    },
8594
    "collection": {
8595
        "use": [
8596
            "array-extras",
8597
            "arraylist",
8598
            "arraylist-add",
8599
            "arraylist-filter",
8600
            "array-invoke"
8601
        ]
8602
    },
8603
    "color": {
8604
        "use": [
8605
            "color-base",
8606
            "color-hsl",
8607
            "color-harmony"
8608
        ]
8609
    },
8610
    "color-base": {
8611
        "requires": [
8612
            "yui-base"
8613
        ]
8614
    },
8615
    "color-harmony": {
8616
        "requires": [
8617
            "color-hsl"
8618
        ]
8619
    },
8620
    "color-hsl": {
8621
        "requires": [
8622
            "color-base"
8623
        ]
8624
    },
8625
    "color-hsv": {
8626
        "requires": [
8627
            "color-base"
8628
        ]
8629
    },
8630
    "console": {
8631
        "lang": [
8632
            "en",
8633
            "es",
8634
            "hu",
8635
            "it",
8636
            "ja"
8637
        ],
8638
        "requires": [
8639
            "yui-log",
8640
            "widget"
8641
        ],
8642
        "skinnable": true
8643
    },
8644
    "console-filters": {
8645
        "requires": [
8646
            "plugin",
8647
            "console"
8648
        ],
8649
        "skinnable": true
8650
    },
8651
    "content-editable": {
8652
        "requires": [
8653
            "node-base",
8654
            "editor-selection",
8655
            "stylesheet",
8656
            "plugin"
8657
        ]
8658
    },
8659
    "controller": {
8660
        "use": [
8661
            "router"
8662
        ]
8663
    },
8664
    "cookie": {
8665
        "requires": [
8666
            "yui-base"
8667
        ]
8668
    },
8669
    "createlink-base": {
8670
        "requires": [
8671
            "editor-base"
8672
        ]
8673
    },
8674
    "cssbase": {
8675
        "after": [
8676
            "cssreset",
8677
            "cssfonts",
8678
            "cssgrids",
8679
            "cssreset-context",
8680
            "cssfonts-context",
8681
            "cssgrids-context"
8682
        ],
8683
        "type": "css"
8684
    },
8685
    "cssbase-context": {
8686
        "after": [
8687
            "cssreset",
8688
            "cssfonts",
8689
            "cssgrids",
8690
            "cssreset-context",
8691
            "cssfonts-context",
8692
            "cssgrids-context"
8693
        ],
8694
        "type": "css"
8695
    },
8696
    "cssbutton": {
8697
        "type": "css"
8698
    },
8699
    "cssfonts": {
8700
        "type": "css"
8701
    },
8702
    "cssfonts-context": {
8703
        "type": "css"
8704
    },
8705
    "cssgrids": {
8706
        "optional": [
8707
            "cssnormalize"
8708
        ],
8709
        "type": "css"
8710
    },
8711
    "cssgrids-base": {
8712
        "optional": [
8713
            "cssnormalize"
8714
        ],
8715
        "type": "css"
8716
    },
8717
    "cssgrids-responsive": {
8718
        "optional": [
8719
            "cssnormalize"
8720
        ],
8721
        "requires": [
8722
            "cssgrids",
8723
            "cssgrids-responsive-base"
8724
        ],
8725
        "type": "css"
8726
    },
8727
    "cssgrids-units": {
8728
        "optional": [
8729
            "cssnormalize"
8730
        ],
8731
        "requires": [
8732
            "cssgrids-base"
8733
        ],
8734
        "type": "css"
8735
    },
8736
    "cssnormalize": {
8737
        "type": "css"
8738
    },
8739
    "cssnormalize-context": {
8740
        "type": "css"
8741
    },
8742
    "cssreset": {
8743
        "type": "css"
8744
    },
8745
    "cssreset-context": {
8746
        "type": "css"
8747
    },
8748
    "dataschema": {
8749
        "use": [
8750
            "dataschema-base",
8751
            "dataschema-json",
8752
            "dataschema-xml",
8753
            "dataschema-array",
8754
            "dataschema-text"
8755
        ]
8756
    },
8757
    "dataschema-array": {
8758
        "requires": [
8759
            "dataschema-base"
8760
        ]
8761
    },
8762
    "dataschema-base": {
8763
        "requires": [
8764
            "base"
8765
        ]
8766
    },
8767
    "dataschema-json": {
8768
        "requires": [
8769
            "dataschema-base",
8770
            "json"
8771
        ]
8772
    },
8773
    "dataschema-text": {
8774
        "requires": [
8775
            "dataschema-base"
8776
        ]
8777
    },
8778
    "dataschema-xml": {
8779
        "requires": [
8780
            "dataschema-base"
8781
        ]
8782
    },
8783
    "datasource": {
8784
        "use": [
8785
            "datasource-local",
8786
            "datasource-io",
8787
            "datasource-get",
8788
            "datasource-function",
8789
            "datasource-cache",
8790
            "datasource-jsonschema",
8791
            "datasource-xmlschema",
8792
            "datasource-arrayschema",
8793
            "datasource-textschema",
8794
            "datasource-polling"
8795
        ]
8796
    },
8797
    "datasource-arrayschema": {
8798
        "requires": [
8799
            "datasource-local",
8800
            "plugin",
8801
            "dataschema-array"
8802
        ]
8803
    },
8804
    "datasource-cache": {
8805
        "requires": [
8806
            "datasource-local",
8807
            "plugin",
8808
            "cache-base"
8809
        ]
8810
    },
8811
    "datasource-function": {
8812
        "requires": [
8813
            "datasource-local"
8814
        ]
8815
    },
8816
    "datasource-get": {
8817
        "requires": [
8818
            "datasource-local",
8819
            "get"
8820
        ]
8821
    },
8822
    "datasource-io": {
8823
        "requires": [
8824
            "datasource-local",
8825
            "io-base"
8826
        ]
8827
    },
8828
    "datasource-jsonschema": {
8829
        "requires": [
8830
            "datasource-local",
8831
            "plugin",
8832
            "dataschema-json"
8833
        ]
8834
    },
8835
    "datasource-local": {
8836
        "requires": [
8837
            "base"
8838
        ]
8839
    },
8840
    "datasource-polling": {
8841
        "requires": [
8842
            "datasource-local"
8843
        ]
8844
    },
8845
    "datasource-textschema": {
8846
        "requires": [
8847
            "datasource-local",
8848
            "plugin",
8849
            "dataschema-text"
8850
        ]
8851
    },
8852
    "datasource-xmlschema": {
8853
        "requires": [
8854
            "datasource-local",
8855
            "plugin",
8856
            "datatype-xml",
8857
            "dataschema-xml"
8858
        ]
8859
    },
8860
    "datatable": {
8861
        "use": [
8862
            "datatable-core",
8863
            "datatable-table",
8864
            "datatable-head",
8865
            "datatable-body",
8866
            "datatable-base",
8867
            "datatable-column-widths",
8868
            "datatable-message",
8869
            "datatable-mutable",
8870
            "datatable-sort",
8871
            "datatable-datasource"
8872
        ]
8873
    },
8874
    "datatable-base": {
8875
        "requires": [
8876
            "datatable-core",
8877
            "datatable-table",
8878
            "datatable-head",
8879
            "datatable-body",
8880
            "base-build",
8881
            "widget"
8882
        ],
8883
        "skinnable": true
8884
    },
8885
    "datatable-body": {
8886
        "requires": [
8887
            "datatable-core",
8888
            "view",
8889
            "classnamemanager"
8890
        ]
8891
    },
8892
    "datatable-column-widths": {
8893
        "requires": [
8894
            "datatable-base"
8895
        ]
8896
    },
8897
    "datatable-core": {
8898
        "requires": [
8899
            "escape",
8900
            "model-list",
8901
            "node-event-delegate"
8902
        ]
8903
    },
8904
    "datatable-datasource": {
8905
        "requires": [
8906
            "datatable-base",
8907
            "plugin",
8908
            "datasource-local"
8909
        ]
8910
    },
8911
    "datatable-foot": {
8912
        "requires": [
8913
            "datatable-core",
8914
            "view"
8915
        ]
8916
    },
8917
    "datatable-formatters": {
8918
        "requires": [
8919
            "datatable-body",
8920
            "datatype-number-format",
8921
            "datatype-date-format",
8922
            "escape"
8923
        ]
8924
    },
8925
    "datatable-head": {
8926
        "requires": [
8927
            "datatable-core",
8928
            "view",
8929
            "classnamemanager"
8930
        ]
8931
    },
8932
    "datatable-highlight": {
8933
        "requires": [
8934
            "datatable-base",
8935
            "event-hover"
8936
        ],
8937
        "skinnable": true
8938
    },
8939
    "datatable-keynav": {
8940
        "requires": [
8941
            "datatable-base"
8942
        ]
8943
    },
8944
    "datatable-message": {
8945
        "lang": [
8946
            "en",
8947
            "fr",
8948
            "es",
8949
            "hu",
8950
            "it"
8951
        ],
8952
        "requires": [
8953
            "datatable-base"
8954
        ],
8955
        "skinnable": true
8956
    },
8957
    "datatable-mutable": {
8958
        "requires": [
8959
            "datatable-base"
8960
        ]
8961
    },
8962
    "datatable-paginator": {
8963
        "lang": [
8964
            "en",
8965
            "fr"
8966
        ],
8967
        "requires": [
8968
            "model",
8969
            "view",
8970
            "paginator-core",
8971
            "datatable-foot",
8972
            "datatable-paginator-templates"
8973
        ],
8974
        "skinnable": true
8975
    },
8976
    "datatable-paginator-templates": {
8977
        "requires": [
8978
            "template"
8979
        ]
8980
    },
8981
    "datatable-scroll": {
8982
        "requires": [
8983
            "datatable-base",
8984
            "datatable-column-widths",
8985
            "dom-screen"
8986
        ],
8987
        "skinnable": true
8988
    },
8989
    "datatable-sort": {
8990
        "lang": [
8991
            "en",
8992
            "fr",
8993
            "es",
8994
            "hu"
8995
        ],
8996
        "requires": [
8997
            "datatable-base"
8998
        ],
8999
        "skinnable": true
9000
    },
9001
    "datatable-table": {
9002
        "requires": [
9003
            "datatable-core",
9004
            "datatable-head",
9005
            "datatable-body",
9006
            "view",
9007
            "classnamemanager"
9008
        ]
9009
    },
9010
    "datatype": {
9011
        "use": [
9012
            "datatype-date",
9013
            "datatype-number",
9014
            "datatype-xml"
9015
        ]
9016
    },
9017
    "datatype-date": {
9018
        "use": [
9019
            "datatype-date-parse",
9020
            "datatype-date-format",
9021
            "datatype-date-math"
9022
        ]
9023
    },
9024
    "datatype-date-format": {
9025
        "lang": [
9026
            "ar",
9027
            "ar-JO",
9028
            "ca",
9029
            "ca-ES",
9030
            "da",
9031
            "da-DK",
9032
            "de",
9033
            "de-AT",
9034
            "de-DE",
9035
            "el",
9036
            "el-GR",
9037
            "en",
9038
            "en-AU",
9039
            "en-CA",
9040
            "en-GB",
9041
            "en-IE",
9042
            "en-IN",
9043
            "en-JO",
9044
            "en-MY",
9045
            "en-NZ",
9046
            "en-PH",
9047
            "en-SG",
9048
            "en-US",
9049
            "es",
9050
            "es-AR",
9051
            "es-BO",
9052
            "es-CL",
9053
            "es-CO",
9054
            "es-EC",
9055
            "es-ES",
9056
            "es-MX",
9057
            "es-PE",
9058
            "es-PY",
9059
            "es-US",
9060
            "es-UY",
9061
            "es-VE",
9062
            "fi",
9063
            "fi-FI",
9064
            "fr",
9065
            "fr-BE",
9066
            "fr-CA",
9067
            "fr-FR",
9068
            "hi",
9069
            "hi-IN",
9070
            "hu",
9071
            "id",
9072
            "id-ID",
9073
            "it",
9074
            "it-IT",
9075
            "ja",
9076
            "ja-JP",
9077
            "ko",
9078
            "ko-KR",
9079
            "ms",
9080
            "ms-MY",
9081
            "nb",
9082
            "nb-NO",
9083
            "nl",
9084
            "nl-BE",
9085
            "nl-NL",
9086
            "pl",
9087
            "pl-PL",
9088
            "pt",
9089
            "pt-BR",
9090
            "ro",
9091
            "ro-RO",
9092
            "ru",
9093
            "ru-RU",
9094
            "sv",
9095
            "sv-SE",
9096
            "th",
9097
            "th-TH",
9098
            "tr",
9099
            "tr-TR",
9100
            "vi",
9101
            "vi-VN",
9102
            "zh-Hans",
9103
            "zh-Hans-CN",
9104
            "zh-Hant",
9105
            "zh-Hant-HK",
9106
            "zh-Hant-TW"
9107
        ]
9108
    },
9109
    "datatype-date-math": {
9110
        "requires": [
9111
            "yui-base"
9112
        ]
9113
    },
9114
    "datatype-date-parse": {},
9115
    "datatype-number": {
9116
        "use": [
9117
            "datatype-number-parse",
9118
            "datatype-number-format"
9119
        ]
9120
    },
9121
    "datatype-number-format": {},
9122
    "datatype-number-parse": {
9123
        "requires": [
9124
            "escape"
9125
        ]
9126
    },
9127
    "datatype-xml": {
9128
        "use": [
9129
            "datatype-xml-parse",
9130
            "datatype-xml-format"
9131
        ]
9132
    },
9133
    "datatype-xml-format": {},
9134
    "datatype-xml-parse": {},
9135
    "dd": {
9136
        "use": [
9137
            "dd-ddm-base",
9138
            "dd-ddm",
9139
            "dd-ddm-drop",
9140
            "dd-drag",
9141
            "dd-proxy",
9142
            "dd-constrain",
9143
            "dd-drop",
9144
            "dd-scroll",
9145
            "dd-delegate"
9146
        ]
9147
    },
9148
    "dd-constrain": {
9149
        "requires": [
9150
            "dd-drag"
9151
        ]
9152
    },
9153
    "dd-ddm": {
9154
        "requires": [
9155
            "dd-ddm-base",
9156
            "event-resize"
9157
        ]
9158
    },
9159
    "dd-ddm-base": {
9160
        "requires": [
9161
            "node",
9162
            "base",
9163
            "yui-throttle",
9164
            "classnamemanager"
9165
        ]
9166
    },
9167
    "dd-ddm-drop": {
9168
        "requires": [
9169
            "dd-ddm"
9170
        ]
9171
    },
9172
    "dd-delegate": {
9173
        "requires": [
9174
            "dd-drag",
9175
            "dd-drop-plugin",
9176
            "event-mouseenter"
9177
        ]
9178
    },
9179
    "dd-drag": {
9180
        "requires": [
9181
            "dd-ddm-base",
9182
            "selector-css2"
9183
        ]
9184
    },
9185
    "dd-drop": {
9186
        "requires": [
9187
            "dd-drag",
9188
            "dd-ddm-drop"
9189
        ]
9190
    },
9191
    "dd-drop-plugin": {
9192
        "requires": [
9193
            "dd-drop"
9194
        ]
9195
    },
9196
    "dd-gestures": {
9197
        "condition": {
9198
            "name": "dd-gestures",
9199
            "trigger": "dd-drag",
9200
            "ua": "touchEnabled"
9201
        },
9202
        "requires": [
9203
            "dd-drag",
9204
            "event-synthetic",
9205
            "event-gestures"
9206
        ]
9207
    },
9208
    "dd-plugin": {
9209
        "optional": [
9210
            "dd-constrain",
9211
            "dd-proxy"
9212
        ],
9213
        "requires": [
9214
            "dd-drag"
9215
        ]
9216
    },
9217
    "dd-proxy": {
9218
        "requires": [
9219
            "dd-drag"
9220
        ]
9221
    },
9222
    "dd-scroll": {
9223
        "requires": [
9224
            "dd-drag"
9225
        ]
9226
    },
9227
    "dial": {
9228
        "lang": [
9229
            "en",
9230
            "es",
9231
            "hu"
9232
        ],
9233
        "requires": [
9234
            "widget",
9235
            "dd-drag",
9236
            "event-mouseenter",
9237
            "event-move",
9238
            "event-key",
9239
            "transition",
9240
            "intl"
9241
        ],
9242
        "skinnable": true
9243
    },
9244
    "dom": {
9245
        "use": [
9246
            "dom-base",
9247
            "dom-screen",
9248
            "dom-style",
9249
            "selector-native",
9250
            "selector"
9251
        ]
9252
    },
9253
    "dom-base": {
9254
        "requires": [
9255
            "dom-core"
9256
        ]
9257
    },
9258
    "dom-core": {
9259
        "requires": [
9260
            "oop",
9261
            "features"
9262
        ]
9263
    },
9264
    "dom-screen": {
9265
        "requires": [
9266
            "dom-base",
9267
            "dom-style"
9268
        ]
9269
    },
9270
    "dom-style": {
9271
        "requires": [
9272
            "dom-base"
9273
        ]
9274
    },
9275
    "dom-style-ie": {
9276
        "condition": {
9277
            "name": "dom-style-ie",
9278
            "test": function (Y) {
9279
 
9280
    var testFeature = Y.Features.test,
9281
        addFeature = Y.Features.add,
9282
        WINDOW = Y.config.win,
9283
        DOCUMENT = Y.config.doc,
9284
        DOCUMENT_ELEMENT = 'documentElement',
9285
        ret = false;
9286
 
9287
    addFeature('style', 'computedStyle', {
9288
        test: function() {
9289
            return WINDOW && 'getComputedStyle' in WINDOW;
9290
        }
9291
    });
9292
 
9293
    addFeature('style', 'opacity', {
9294
        test: function() {
9295
            return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style;
9296
        }
9297
    });
9298
 
9299
    ret =  (!testFeature('style', 'opacity') &&
9300
            !testFeature('style', 'computedStyle'));
9301
 
9302
    return ret;
9303
},
9304
            "trigger": "dom-style"
9305
        },
9306
        "requires": [
9307
            "dom-style",
9308
            "color-base"
9309
        ]
9310
    },
9311
    "dump": {
9312
        "requires": [
9313
            "yui-base"
9314
        ]
9315
    },
9316
    "editor": {
9317
        "use": [
9318
            "frame",
9319
            "editor-selection",
9320
            "exec-command",
9321
            "editor-base",
9322
            "editor-para",
9323
            "editor-br",
9324
            "editor-bidi",
9325
            "editor-tab",
9326
            "createlink-base"
9327
        ]
9328
    },
9329
    "editor-base": {
9330
        "requires": [
9331
            "base",
9332
            "frame",
9333
            "node",
9334
            "exec-command",
9335
            "editor-selection"
9336
        ]
9337
    },
9338
    "editor-bidi": {
9339
        "requires": [
9340
            "editor-base"
9341
        ]
9342
    },
9343
    "editor-br": {
9344
        "requires": [
9345
            "editor-base"
9346
        ]
9347
    },
9348
    "editor-inline": {
9349
        "requires": [
9350
            "editor-base",
9351
            "content-editable"
9352
        ]
9353
    },
9354
    "editor-lists": {
9355
        "requires": [
9356
            "editor-base"
9357
        ]
9358
    },
9359
    "editor-para": {
9360
        "requires": [
9361
            "editor-para-base"
9362
        ]
9363
    },
9364
    "editor-para-base": {
9365
        "requires": [
9366
            "editor-base"
9367
        ]
9368
    },
9369
    "editor-para-ie": {
9370
        "condition": {
9371
            "name": "editor-para-ie",
9372
            "trigger": "editor-para",
9373
            "ua": "ie",
9374
            "when": "instead"
9375
        },
9376
        "requires": [
9377
            "editor-para-base"
9378
        ]
9379
    },
9380
    "editor-selection": {
9381
        "requires": [
9382
            "node"
9383
        ]
9384
    },
9385
    "editor-tab": {
9386
        "requires": [
9387
            "editor-base"
9388
        ]
9389
    },
9390
    "escape": {
9391
        "requires": [
9392
            "yui-base"
9393
        ]
9394
    },
9395
    "event": {
9396
        "after": [
9397
            "node-base"
9398
        ],
9399
        "use": [
9400
            "event-base",
9401
            "event-delegate",
9402
            "event-synthetic",
9403
            "event-mousewheel",
9404
            "event-mouseenter",
9405
            "event-key",
9406
            "event-focus",
9407
            "event-resize",
9408
            "event-hover",
9409
            "event-outside",
9410
            "event-touch",
9411
            "event-move",
9412
            "event-flick",
9413
            "event-valuechange",
9414
            "event-tap"
9415
        ]
9416
    },
9417
    "event-base": {
9418
        "after": [
9419
            "node-base"
9420
        ],
9421
        "requires": [
9422
            "event-custom-base"
9423
        ]
9424
    },
9425
    "event-base-ie": {
9426
        "after": [
9427
            "event-base"
9428
        ],
9429
        "condition": {
9430
            "name": "event-base-ie",
9431
            "test": function(Y) {
9432
    var imp = Y.config.doc && Y.config.doc.implementation;
9433
    return (imp && (!imp.hasFeature('Events', '2.0')));
9434
},
9435
            "trigger": "node-base"
9436
        },
9437
        "requires": [
9438
            "node-base"
9439
        ]
9440
    },
9441
    "event-contextmenu": {
9442
        "requires": [
9443
            "event-synthetic",
9444
            "dom-screen"
9445
        ]
9446
    },
9447
    "event-custom": {
9448
        "use": [
9449
            "event-custom-base",
9450
            "event-custom-complex"
9451
        ]
9452
    },
9453
    "event-custom-base": {
9454
        "requires": [
9455
            "oop"
9456
        ]
9457
    },
9458
    "event-custom-complex": {
9459
        "requires": [
9460
            "event-custom-base"
9461
        ]
9462
    },
9463
    "event-delegate": {
9464
        "requires": [
9465
            "node-base"
9466
        ]
9467
    },
9468
    "event-flick": {
9469
        "requires": [
9470
            "node-base",
9471
            "event-touch",
9472
            "event-synthetic"
9473
        ]
9474
    },
9475
    "event-focus": {
9476
        "requires": [
9477
            "event-synthetic"
9478
        ]
9479
    },
9480
    "event-gestures": {
9481
        "use": [
9482
            "event-flick",
9483
            "event-move"
9484
        ]
9485
    },
9486
    "event-hover": {
9487
        "requires": [
9488
            "event-mouseenter"
9489
        ]
9490
    },
9491
    "event-key": {
9492
        "requires": [
9493
            "event-synthetic"
9494
        ]
9495
    },
9496
    "event-mouseenter": {
9497
        "requires": [
9498
            "event-synthetic"
9499
        ]
9500
    },
9501
    "event-mousewheel": {
9502
        "requires": [
9503
            "node-base"
9504
        ]
9505
    },
9506
    "event-move": {
9507
        "requires": [
9508
            "node-base",
9509
            "event-touch",
9510
            "event-synthetic"
9511
        ]
9512
    },
9513
    "event-outside": {
9514
        "requires": [
9515
            "event-synthetic"
9516
        ]
9517
    },
9518
    "event-resize": {
9519
        "requires": [
9520
            "node-base",
9521
            "event-synthetic"
9522
        ]
9523
    },
9524
    "event-simulate": {
9525
        "requires": [
9526
            "event-base"
9527
        ]
9528
    },
9529
    "event-synthetic": {
9530
        "requires": [
9531
            "node-base",
9532
            "event-custom-complex"
9533
        ]
9534
    },
9535
    "event-tap": {
9536
        "requires": [
9537
            "node-base",
9538
            "event-base",
9539
            "event-touch",
9540
            "event-synthetic"
9541
        ]
9542
    },
9543
    "event-touch": {
9544
        "requires": [
9545
            "node-base"
9546
        ]
9547
    },
9548
    "event-valuechange": {
9549
        "requires": [
9550
            "event-focus",
9551
            "event-synthetic"
9552
        ]
9553
    },
9554
    "exec-command": {
9555
        "requires": [
9556
            "frame"
9557
        ]
9558
    },
9559
    "features": {
9560
        "requires": [
9561
            "yui-base"
9562
        ]
9563
    },
9564
    "file": {
9565
        "requires": [
9566
            "file-flash",
9567
            "file-html5"
9568
        ]
9569
    },
9570
    "file-flash": {
9571
        "requires": [
9572
            "base"
9573
        ]
9574
    },
9575
    "file-html5": {
9576
        "requires": [
9577
            "base"
9578
        ]
9579
    },
9580
    "frame": {
9581
        "requires": [
9582
            "base",
9583
            "node",
9584
            "plugin",
9585
            "selector-css3",
9586
            "yui-throttle"
9587
        ]
9588
    },
9589
    "gesture-simulate": {
9590
        "requires": [
9591
            "async-queue",
9592
            "event-simulate",
9593
            "node-screen"
9594
        ]
9595
    },
9596
    "get": {
9597
        "requires": [
9598
            "yui-base"
9599
        ]
9600
    },
9601
    "graphics": {
9602
        "requires": [
9603
            "node",
9604
            "event-custom",
9605
            "pluginhost",
9606
            "matrix",
9607
            "classnamemanager"
9608
        ]
9609
    },
9610
    "graphics-canvas": {
9611
        "condition": {
9612
            "name": "graphics-canvas",
9613
            "test": function(Y) {
9614
    var DOCUMENT = Y.config.doc,
9615
        useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas",
9616
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
9617
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
9618
    return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d"));
9619
},
9620
            "trigger": "graphics"
9621
        },
9622
        "requires": [
9623
            "graphics",
9624
            "color-base"
9625
        ]
9626
    },
9627
    "graphics-canvas-default": {
9628
        "condition": {
9629
            "name": "graphics-canvas-default",
9630
            "test": function(Y) {
9631
    var DOCUMENT = Y.config.doc,
9632
        useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas",
9633
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
9634
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
9635
    return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d"));
9636
},
9637
            "trigger": "graphics"
9638
        }
9639
    },
9640
    "graphics-group": {
9641
        "requires": [
9642
            "graphics"
9643
        ]
9644
    },
9645
    "graphics-svg": {
9646
        "condition": {
9647
            "name": "graphics-svg",
9648
            "test": function(Y) {
9649
    var DOCUMENT = Y.config.doc,
9650
        useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas",
9651
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
9652
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
9653
 
9654
    return svg && (useSVG || !canvas);
9655
},
9656
            "trigger": "graphics"
9657
        },
9658
        "requires": [
9659
            "graphics"
9660
        ]
9661
    },
9662
    "graphics-svg-default": {
9663
        "condition": {
9664
            "name": "graphics-svg-default",
9665
            "test": function(Y) {
9666
    var DOCUMENT = Y.config.doc,
9667
        useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas",
9668
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
9669
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
9670
 
9671
    return svg && (useSVG || !canvas);
9672
},
9673
            "trigger": "graphics"
9674
        }
9675
    },
9676
    "graphics-vml": {
9677
        "condition": {
9678
            "name": "graphics-vml",
9679
            "test": function(Y) {
9680
    var DOCUMENT = Y.config.doc,
9681
		canvas = DOCUMENT && DOCUMENT.createElement("canvas");
9682
    return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
9683
},
9684
            "trigger": "graphics"
9685
        },
9686
        "requires": [
9687
            "graphics",
9688
            "color-base"
9689
        ]
9690
    },
9691
    "graphics-vml-default": {
9692
        "condition": {
9693
            "name": "graphics-vml-default",
9694
            "test": function(Y) {
9695
    var DOCUMENT = Y.config.doc,
9696
		canvas = DOCUMENT && DOCUMENT.createElement("canvas");
9697
    return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
9698
},
9699
            "trigger": "graphics"
9700
        }
9701
    },
9702
    "handlebars": {
9703
        "use": [
9704
            "handlebars-compiler"
9705
        ]
9706
    },
9707
    "handlebars-base": {
9708
        "requires": []
9709
    },
9710
    "handlebars-compiler": {
9711
        "requires": [
9712
            "handlebars-base"
9713
        ]
9714
    },
9715
    "highlight": {
9716
        "use": [
9717
            "highlight-base",
9718
            "highlight-accentfold"
9719
        ]
9720
    },
9721
    "highlight-accentfold": {
9722
        "requires": [
9723
            "highlight-base",
9724
            "text-accentfold"
9725
        ]
9726
    },
9727
    "highlight-base": {
9728
        "requires": [
9729
            "array-extras",
9730
            "classnamemanager",
9731
            "escape",
9732
            "text-wordbreak"
9733
        ]
9734
    },
9735
    "history": {
9736
        "use": [
9737
            "history-base",
9738
            "history-hash",
9739
            "history-html5"
9740
        ]
9741
    },
9742
    "history-base": {
9743
        "requires": [
9744
            "event-custom-complex"
9745
        ]
9746
    },
9747
    "history-hash": {
9748
        "after": [
9749
            "history-html5"
9750
        ],
9751
        "requires": [
9752
            "event-synthetic",
9753
            "history-base",
9754
            "yui-later"
9755
        ]
9756
    },
9757
    "history-hash-ie": {
9758
        "condition": {
9759
            "name": "history-hash-ie",
9760
            "test": function (Y) {
9761
    var docMode = Y.config.doc && Y.config.doc.documentMode;
9762
 
9763
    return Y.UA.ie && (!('onhashchange' in Y.config.win) ||
9764
            !docMode || docMode < 8);
9765
},
9766
            "trigger": "history-hash"
9767
        },
9768
        "requires": [
9769
            "history-hash",
9770
            "node-base"
9771
        ]
9772
    },
9773
    "history-html5": {
9774
        "optional": [
9775
            "json"
9776
        ],
9777
        "requires": [
9778
            "event-base",
9779
            "history-base",
9780
            "node-base"
9781
        ]
9782
    },
9783
    "imageloader": {
9784
        "requires": [
9785
            "base-base",
9786
            "node-style",
9787
            "node-screen"
9788
        ]
9789
    },
9790
    "intl": {
9791
        "requires": [
9792
            "intl-base",
9793
            "event-custom"
9794
        ]
9795
    },
9796
    "intl-base": {
9797
        "requires": [
9798
            "yui-base"
9799
        ]
9800
    },
9801
    "io": {
9802
        "use": [
9803
            "io-base",
9804
            "io-xdr",
9805
            "io-form",
9806
            "io-upload-iframe",
9807
            "io-queue"
9808
        ]
9809
    },
9810
    "io-base": {
9811
        "requires": [
9812
            "event-custom-base",
9813
            "querystring-stringify-simple"
9814
        ]
9815
    },
9816
    "io-form": {
9817
        "requires": [
9818
            "io-base",
9819
            "node-base"
9820
        ]
9821
    },
9822
    "io-nodejs": {
9823
        "condition": {
9824
            "name": "io-nodejs",
9825
            "trigger": "io-base",
9826
            "ua": "nodejs"
9827
        },
9828
        "requires": [
9829
            "io-base"
9830
        ]
9831
    },
9832
    "io-queue": {
9833
        "requires": [
9834
            "io-base",
9835
            "queue-promote"
9836
        ]
9837
    },
9838
    "io-upload-iframe": {
9839
        "requires": [
9840
            "io-base",
9841
            "node-base"
9842
        ]
9843
    },
9844
    "io-xdr": {
9845
        "requires": [
9846
            "io-base",
9847
            "datatype-xml-parse"
9848
        ]
9849
    },
9850
    "json": {
9851
        "use": [
9852
            "json-parse",
9853
            "json-stringify"
9854
        ]
9855
    },
9856
    "json-parse": {
9857
        "requires": [
9858
            "yui-base"
9859
        ]
9860
    },
9861
    "json-parse-shim": {
9862
        "condition": {
9863
            "name": "json-parse-shim",
9864
            "test": function (Y) {
9865
    var _JSON = Y.config.global.JSON,
9866
        Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON,
9867
        nativeSupport = Y.config.useNativeJSONParse !== false && !!Native;
9868
 
9869
    function workingNative( k, v ) {
9870
        return k === "ok" ? true : v;
9871
    }
9872
 
9873
    // Double check basic functionality.  This is mainly to catch early broken
9874
    // implementations of the JSON API in Firefox 3.1 beta1 and beta2
9875
    if ( nativeSupport ) {
9876
        try {
9877
            nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok;
9878
        }
9879
        catch ( e ) {
9880
            nativeSupport = false;
9881
        }
9882
    }
9883
 
9884
    return !nativeSupport;
9885
},
9886
            "trigger": "json-parse"
9887
        },
9888
        "requires": [
9889
            "json-parse"
9890
        ]
9891
    },
9892
    "json-stringify": {
9893
        "requires": [
9894
            "yui-base"
9895
        ]
9896
    },
9897
    "json-stringify-shim": {
9898
        "condition": {
9899
            "name": "json-stringify-shim",
9900
            "test": function (Y) {
9901
    var _JSON = Y.config.global.JSON,
9902
        Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON,
9903
        nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native;
9904
 
9905
    // Double check basic native functionality.  This is primarily to catch broken
9906
    // early JSON API implementations in Firefox 3.1 beta1 and beta2.
9907
    if ( nativeSupport ) {
9908
        try {
9909
            nativeSupport = ( '0' === Native.stringify(0) );
9910
        } catch ( e ) {
9911
            nativeSupport = false;
9912
        }
9913
    }
9914
 
9915
 
9916
    return !nativeSupport;
9917
},
9918
            "trigger": "json-stringify"
9919
        },
9920
        "requires": [
9921
            "json-stringify"
9922
        ]
9923
    },
9924
    "jsonp": {
9925
        "requires": [
9926
            "get",
9927
            "oop"
9928
        ]
9929
    },
9930
    "jsonp-url": {
9931
        "requires": [
9932
            "jsonp"
9933
        ]
9934
    },
9935
    "lazy-model-list": {
9936
        "requires": [
9937
            "model-list"
9938
        ]
9939
    },
9940
    "loader": {
9941
        "use": [
9942
            "loader-base",
9943
            "loader-rollup",
9944
            "loader-yui3"
9945
        ]
9946
    },
9947
    "loader-base": {
9948
        "requires": [
9949
            "get",
9950
            "features"
9951
        ]
9952
    },
9953
    "loader-pathogen-combohandler": {},
9954
    "loader-pathogen-encoder": {
9955
        "use": [
9956
            "loader-base",
9957
            "loader-rollup",
9958
            "loader-yui3",
9959
            "loader-pathogen-combohandler"
9960
        ]
9961
    },
9962
    "loader-rollup": {
9963
        "requires": [
9964
            "loader-base"
9965
        ]
9966
    },
9967
    "loader-yui3": {
9968
        "requires": [
9969
            "loader-base"
9970
        ]
9971
    },
9972
    "matrix": {
9973
        "requires": [
9974
            "yui-base"
9975
        ]
9976
    },
9977
    "model": {
9978
        "requires": [
9979
            "base-build",
9980
            "escape",
9981
            "json-parse"
9982
        ]
9983
    },
9984
    "model-list": {
9985
        "requires": [
9986
            "array-extras",
9987
            "array-invoke",
9988
            "arraylist",
9989
            "base-build",
9990
            "escape",
9991
            "json-parse",
9992
            "model"
9993
        ]
9994
    },
9995
    "model-sync-local": {
9996
        "requires": [
9997
            "model",
9998
            "json-stringify"
9999
        ]
10000
    },
10001
    "model-sync-rest": {
10002
        "requires": [
10003
            "model",
10004
            "io-base",
10005
            "json-stringify"
10006
        ]
10007
    },
10008
    "node": {
10009
        "use": [
10010
            "node-base",
10011
            "node-event-delegate",
10012
            "node-pluginhost",
10013
            "node-screen",
10014
            "node-style"
10015
        ]
10016
    },
10017
    "node-base": {
10018
        "requires": [
10019
            "event-base",
10020
            "node-core",
10021
            "dom-base",
10022
            "dom-style"
10023
        ]
10024
    },
10025
    "node-core": {
10026
        "requires": [
10027
            "dom-core",
10028
            "selector"
10029
        ]
10030
    },
10031
    "node-event-delegate": {
10032
        "requires": [
10033
            "node-base",
10034
            "event-delegate"
10035
        ]
10036
    },
10037
    "node-event-html5": {
10038
        "requires": [
10039
            "node-base"
10040
        ]
10041
    },
10042
    "node-event-simulate": {
10043
        "requires": [
10044
            "node-base",
10045
            "event-simulate",
10046
            "gesture-simulate"
10047
        ]
10048
    },
10049
    "node-flick": {
10050
        "requires": [
10051
            "classnamemanager",
10052
            "transition",
10053
            "event-flick",
10054
            "plugin"
10055
        ],
10056
        "skinnable": true
10057
    },
10058
    "node-focusmanager": {
10059
        "requires": [
10060
            "attribute",
10061
            "node",
10062
            "plugin",
10063
            "node-event-simulate",
10064
            "event-key",
10065
            "event-focus"
10066
        ]
10067
    },
10068
    "node-load": {
10069
        "requires": [
10070
            "node-base",
10071
            "io-base"
10072
        ]
10073
    },
10074
    "node-menunav": {
10075
        "requires": [
10076
            "node",
10077
            "classnamemanager",
10078
            "plugin",
10079
            "node-focusmanager"
10080
        ],
10081
        "skinnable": true
10082
    },
10083
    "node-pluginhost": {
10084
        "requires": [
10085
            "node-base",
10086
            "pluginhost"
10087
        ]
10088
    },
10089
    "node-screen": {
10090
        "requires": [
10091
            "dom-screen",
10092
            "node-base"
10093
        ]
10094
    },
10095
    "node-scroll-info": {
10096
        "requires": [
10097
            "array-extras",
10098
            "base-build",
10099
            "event-resize",
10100
            "node-pluginhost",
10101
            "plugin",
10102
            "selector"
10103
        ]
10104
    },
10105
    "node-style": {
10106
        "requires": [
10107
            "dom-style",
10108
            "node-base"
10109
        ]
10110
    },
10111
    "oop": {
10112
        "requires": [
10113
            "yui-base"
10114
        ]
10115
    },
10116
    "overlay": {
10117
        "requires": [
10118
            "widget",
10119
            "widget-stdmod",
10120
            "widget-position",
10121
            "widget-position-align",
10122
            "widget-stack",
10123
            "widget-position-constrain"
10124
        ],
10125
        "skinnable": true
10126
    },
10127
    "paginator": {
10128
        "requires": [
10129
            "paginator-core"
10130
        ]
10131
    },
10132
    "paginator-core": {
10133
        "requires": [
10134
            "base"
10135
        ]
10136
    },
10137
    "paginator-url": {
10138
        "requires": [
10139
            "paginator"
10140
        ]
10141
    },
10142
    "panel": {
10143
        "requires": [
10144
            "widget",
10145
            "widget-autohide",
10146
            "widget-buttons",
10147
            "widget-modality",
10148
            "widget-position",
10149
            "widget-position-align",
10150
            "widget-position-constrain",
10151
            "widget-stack",
10152
            "widget-stdmod"
10153
        ],
10154
        "skinnable": true
10155
    },
10156
    "parallel": {
10157
        "requires": [
10158
            "yui-base"
10159
        ]
10160
    },
10161
    "pjax": {
10162
        "requires": [
10163
            "pjax-base",
10164
            "pjax-content"
10165
        ]
10166
    },
10167
    "pjax-base": {
10168
        "requires": [
10169
            "classnamemanager",
10170
            "node-event-delegate",
10171
            "router"
10172
        ]
10173
    },
10174
    "pjax-content": {
10175
        "requires": [
10176
            "io-base",
10177
            "node-base",
10178
            "router"
10179
        ]
10180
    },
10181
    "pjax-plugin": {
10182
        "requires": [
10183
            "node-pluginhost",
10184
            "pjax",
10185
            "plugin"
10186
        ]
10187
    },
10188
    "plugin": {
10189
        "requires": [
10190
            "base-base"
10191
        ]
10192
    },
10193
    "pluginhost": {
10194
        "use": [
10195
            "pluginhost-base",
10196
            "pluginhost-config"
10197
        ]
10198
    },
10199
    "pluginhost-base": {
10200
        "requires": [
10201
            "yui-base"
10202
        ]
10203
    },
10204
    "pluginhost-config": {
10205
        "requires": [
10206
            "pluginhost-base"
10207
        ]
10208
    },
10209
    "promise": {
10210
        "requires": [
10211
            "timers"
10212
        ]
10213
    },
10214
    "querystring": {
10215
        "use": [
10216
            "querystring-parse",
10217
            "querystring-stringify"
10218
        ]
10219
    },
10220
    "querystring-parse": {
10221
        "requires": [
10222
            "yui-base",
10223
            "array-extras"
10224
        ]
10225
    },
10226
    "querystring-parse-simple": {
10227
        "requires": [
10228
            "yui-base"
10229
        ]
10230
    },
10231
    "querystring-stringify": {
10232
        "requires": [
10233
            "yui-base"
10234
        ]
10235
    },
10236
    "querystring-stringify-simple": {
10237
        "requires": [
10238
            "yui-base"
10239
        ]
10240
    },
10241
    "queue-promote": {
10242
        "requires": [
10243
            "yui-base"
10244
        ]
10245
    },
10246
    "range-slider": {
10247
        "requires": [
10248
            "slider-base",
10249
            "slider-value-range",
10250
            "clickable-rail"
10251
        ]
10252
    },
10253
    "recordset": {
10254
        "use": [
10255
            "recordset-base",
10256
            "recordset-sort",
10257
            "recordset-filter",
10258
            "recordset-indexer"
10259
        ]
10260
    },
10261
    "recordset-base": {
10262
        "requires": [
10263
            "base",
10264
            "arraylist"
10265
        ]
10266
    },
10267
    "recordset-filter": {
10268
        "requires": [
10269
            "recordset-base",
10270
            "array-extras",
10271
            "plugin"
10272
        ]
10273
    },
10274
    "recordset-indexer": {
10275
        "requires": [
10276
            "recordset-base",
10277
            "plugin"
10278
        ]
10279
    },
10280
    "recordset-sort": {
10281
        "requires": [
10282
            "arraysort",
10283
            "recordset-base",
10284
            "plugin"
10285
        ]
10286
    },
10287
    "resize": {
10288
        "use": [
10289
            "resize-base",
10290
            "resize-proxy",
10291
            "resize-constrain"
10292
        ]
10293
    },
10294
    "resize-base": {
10295
        "requires": [
10296
            "base",
10297
            "widget",
10298
            "event",
10299
            "oop",
10300
            "dd-drag",
10301
            "dd-delegate",
10302
            "dd-drop"
10303
        ],
10304
        "skinnable": true
10305
    },
10306
    "resize-constrain": {
10307
        "requires": [
10308
            "plugin",
10309
            "resize-base"
10310
        ]
10311
    },
10312
    "resize-plugin": {
10313
        "optional": [
10314
            "resize-constrain"
10315
        ],
10316
        "requires": [
10317
            "resize-base",
10318
            "plugin"
10319
        ]
10320
    },
10321
    "resize-proxy": {
10322
        "requires": [
10323
            "plugin",
10324
            "resize-base"
10325
        ]
10326
    },
10327
    "router": {
10328
        "optional": [
10329
            "querystring-parse"
10330
        ],
10331
        "requires": [
10332
            "array-extras",
10333
            "base-build",
10334
            "history"
10335
        ]
10336
    },
10337
    "scrollview": {
10338
        "requires": [
10339
            "scrollview-base",
10340
            "scrollview-scrollbars"
10341
        ]
10342
    },
10343
    "scrollview-base": {
10344
        "requires": [
10345
            "widget",
10346
            "event-gestures",
10347
            "event-mousewheel",
10348
            "transition"
10349
        ],
10350
        "skinnable": true
10351
    },
10352
    "scrollview-base-ie": {
10353
        "condition": {
10354
            "name": "scrollview-base-ie",
10355
            "trigger": "scrollview-base",
10356
            "ua": "ie"
10357
        },
10358
        "requires": [
10359
            "scrollview-base"
10360
        ]
10361
    },
10362
    "scrollview-list": {
10363
        "requires": [
10364
            "plugin",
10365
            "classnamemanager"
10366
        ],
10367
        "skinnable": true
10368
    },
10369
    "scrollview-paginator": {
10370
        "requires": [
10371
            "plugin",
10372
            "classnamemanager"
10373
        ]
10374
    },
10375
    "scrollview-scrollbars": {
10376
        "requires": [
10377
            "classnamemanager",
10378
            "transition",
10379
            "plugin"
10380
        ],
10381
        "skinnable": true
10382
    },
10383
    "selector": {
10384
        "requires": [
10385
            "selector-native"
10386
        ]
10387
    },
10388
    "selector-css2": {
10389
        "condition": {
10390
            "name": "selector-css2",
10391
            "test": function (Y) {
10392
    var DOCUMENT = Y.config.doc,
10393
        ret = DOCUMENT && !('querySelectorAll' in DOCUMENT);
10394
 
10395
    return ret;
10396
},
10397
            "trigger": "selector"
10398
        },
10399
        "requires": [
10400
            "selector-native"
10401
        ]
10402
    },
10403
    "selector-css3": {
10404
        "requires": [
10405
            "selector-native",
10406
            "selector-css2"
10407
        ]
10408
    },
10409
    "selector-native": {
10410
        "requires": [
10411
            "dom-base"
10412
        ]
10413
    },
10414
    "series-area": {
10415
        "requires": [
10416
            "series-cartesian",
10417
            "series-fill-util"
10418
        ]
10419
    },
10420
    "series-area-stacked": {
10421
        "requires": [
10422
            "series-stacked",
10423
            "series-area"
10424
        ]
10425
    },
10426
    "series-areaspline": {
10427
        "requires": [
10428
            "series-area",
10429
            "series-curve-util"
10430
        ]
10431
    },
10432
    "series-areaspline-stacked": {
10433
        "requires": [
10434
            "series-stacked",
10435
            "series-areaspline"
10436
        ]
10437
    },
10438
    "series-bar": {
10439
        "requires": [
10440
            "series-marker",
10441
            "series-histogram-base"
10442
        ]
10443
    },
10444
    "series-bar-stacked": {
10445
        "requires": [
10446
            "series-stacked",
10447
            "series-bar"
10448
        ]
10449
    },
10450
    "series-base": {
10451
        "requires": [
10452
            "graphics",
10453
            "axis-base"
10454
        ]
10455
    },
10456
    "series-candlestick": {
10457
        "requires": [
10458
            "series-range"
10459
        ]
10460
    },
10461
    "series-cartesian": {
10462
        "requires": [
10463
            "series-base"
10464
        ]
10465
    },
10466
    "series-column": {
10467
        "requires": [
10468
            "series-marker",
10469
            "series-histogram-base"
10470
        ]
10471
    },
10472
    "series-column-stacked": {
10473
        "requires": [
10474
            "series-stacked",
10475
            "series-column"
10476
        ]
10477
    },
10478
    "series-combo": {
10479
        "requires": [
10480
            "series-cartesian",
10481
            "series-line-util",
10482
            "series-plot-util",
10483
            "series-fill-util"
10484
        ]
10485
    },
10486
    "series-combo-stacked": {
10487
        "requires": [
10488
            "series-stacked",
10489
            "series-combo"
10490
        ]
10491
    },
10492
    "series-combospline": {
10493
        "requires": [
10494
            "series-combo",
10495
            "series-curve-util"
10496
        ]
10497
    },
10498
    "series-combospline-stacked": {
10499
        "requires": [
10500
            "series-combo-stacked",
10501
            "series-curve-util"
10502
        ]
10503
    },
10504
    "series-curve-util": {},
10505
    "series-fill-util": {},
10506
    "series-histogram-base": {
10507
        "requires": [
10508
            "series-cartesian",
10509
            "series-plot-util"
10510
        ]
10511
    },
10512
    "series-line": {
10513
        "requires": [
10514
            "series-cartesian",
10515
            "series-line-util"
10516
        ]
10517
    },
10518
    "series-line-stacked": {
10519
        "requires": [
10520
            "series-stacked",
10521
            "series-line"
10522
        ]
10523
    },
10524
    "series-line-util": {},
10525
    "series-marker": {
10526
        "requires": [
10527
            "series-cartesian",
10528
            "series-plot-util"
10529
        ]
10530
    },
10531
    "series-marker-stacked": {
10532
        "requires": [
10533
            "series-stacked",
10534
            "series-marker"
10535
        ]
10536
    },
10537
    "series-ohlc": {
10538
        "requires": [
10539
            "series-range"
10540
        ]
10541
    },
10542
    "series-pie": {
10543
        "requires": [
10544
            "series-base",
10545
            "series-plot-util"
10546
        ]
10547
    },
10548
    "series-plot-util": {},
10549
    "series-range": {
10550
        "requires": [
10551
            "series-cartesian"
10552
        ]
10553
    },
10554
    "series-spline": {
10555
        "requires": [
10556
            "series-line",
10557
            "series-curve-util"
10558
        ]
10559
    },
10560
    "series-spline-stacked": {
10561
        "requires": [
10562
            "series-stacked",
10563
            "series-spline"
10564
        ]
10565
    },
10566
    "series-stacked": {
10567
        "requires": [
10568
            "axis-stacked"
10569
        ]
10570
    },
10571
    "shim-plugin": {
10572
        "requires": [
10573
            "node-style",
10574
            "node-pluginhost"
10575
        ]
10576
    },
10577
    "slider": {
10578
        "use": [
10579
            "slider-base",
10580
            "slider-value-range",
10581
            "clickable-rail",
10582
            "range-slider"
10583
        ]
10584
    },
10585
    "slider-base": {
10586
        "requires": [
10587
            "widget",
10588
            "dd-constrain",
10589
            "event-key"
10590
        ],
10591
        "skinnable": true
10592
    },
10593
    "slider-value-range": {
10594
        "requires": [
10595
            "slider-base"
10596
        ]
10597
    },
10598
    "sortable": {
10599
        "requires": [
10600
            "dd-delegate",
10601
            "dd-drop-plugin",
10602
            "dd-proxy"
10603
        ]
10604
    },
10605
    "sortable-scroll": {
10606
        "requires": [
10607
            "dd-scroll",
10608
            "sortable"
10609
        ]
10610
    },
10611
    "stylesheet": {
10612
        "requires": [
10613
            "yui-base"
10614
        ]
10615
    },
10616
    "substitute": {
10617
        "optional": [
10618
            "dump"
10619
        ],
10620
        "requires": [
10621
            "yui-base"
10622
        ]
10623
    },
10624
    "swf": {
10625
        "requires": [
10626
            "event-custom",
10627
            "node",
10628
            "swfdetect",
10629
            "escape"
10630
        ]
10631
    },
10632
    "swfdetect": {
10633
        "requires": [
10634
            "yui-base"
10635
        ]
10636
    },
10637
    "tabview": {
10638
        "requires": [
10639
            "widget",
10640
            "widget-parent",
10641
            "widget-child",
10642
            "tabview-base",
10643
            "node-pluginhost",
10644
            "node-focusmanager"
10645
        ],
10646
        "skinnable": true
10647
    },
10648
    "tabview-base": {
10649
        "requires": [
10650
            "node-event-delegate",
10651
            "classnamemanager"
10652
        ]
10653
    },
10654
    "tabview-plugin": {
10655
        "requires": [
10656
            "tabview-base"
10657
        ]
10658
    },
10659
    "template": {
10660
        "use": [
10661
            "template-base",
10662
            "template-micro"
10663
        ]
10664
    },
10665
    "template-base": {
10666
        "requires": [
10667
            "yui-base"
10668
        ]
10669
    },
10670
    "template-micro": {
10671
        "requires": [
10672
            "escape"
10673
        ]
10674
    },
10675
    "test": {
10676
        "requires": [
10677
            "event-simulate",
10678
            "event-custom",
10679
            "json-stringify"
10680
        ]
10681
    },
10682
    "test-console": {
10683
        "requires": [
10684
            "console-filters",
10685
            "test",
10686
            "array-extras"
10687
        ],
10688
        "skinnable": true
10689
    },
10690
    "text": {
10691
        "use": [
10692
            "text-accentfold",
10693
            "text-wordbreak"
10694
        ]
10695
    },
10696
    "text-accentfold": {
10697
        "requires": [
10698
            "array-extras",
10699
            "text-data-accentfold"
10700
        ]
10701
    },
10702
    "text-data-accentfold": {
10703
        "requires": [
10704
            "yui-base"
10705
        ]
10706
    },
10707
    "text-data-wordbreak": {
10708
        "requires": [
10709
            "yui-base"
10710
        ]
10711
    },
10712
    "text-wordbreak": {
10713
        "requires": [
10714
            "array-extras",
10715
            "text-data-wordbreak"
10716
        ]
10717
    },
10718
    "timers": {
10719
        "requires": [
10720
            "yui-base"
10721
        ]
10722
    },
10723
    "transition": {
10724
        "requires": [
10725
            "node-style"
10726
        ]
10727
    },
10728
    "transition-timer": {
10729
        "condition": {
10730
            "name": "transition-timer",
10731
            "test": function (Y) {
10732
    var DOCUMENT = Y.config.doc,
10733
        node = (DOCUMENT) ? DOCUMENT.documentElement: null,
10734
        ret = true;
10735
 
10736
    if (node && node.style) {
10737
        ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style);
10738
    }
10739
 
10740
    return ret;
10741
},
10742
            "trigger": "transition"
10743
        },
10744
        "requires": [
10745
            "transition"
10746
        ]
10747
    },
10748
    "tree": {
10749
        "requires": [
10750
            "base-build",
10751
            "tree-node"
10752
        ]
10753
    },
10754
    "tree-labelable": {
10755
        "requires": [
10756
            "tree"
10757
        ]
10758
    },
10759
    "tree-lazy": {
10760
        "requires": [
10761
            "base-pluginhost",
10762
            "plugin",
10763
            "tree"
10764
        ]
10765
    },
10766
    "tree-node": {},
10767
    "tree-openable": {
10768
        "requires": [
10769
            "tree"
10770
        ]
10771
    },
10772
    "tree-selectable": {
10773
        "requires": [
10774
            "tree"
10775
        ]
10776
    },
10777
    "tree-sortable": {
10778
        "requires": [
10779
            "tree"
10780
        ]
10781
    },
10782
    "uploader": {
10783
        "requires": [
10784
            "uploader-html5",
10785
            "uploader-flash"
10786
        ]
10787
    },
10788
    "uploader-flash": {
10789
        "requires": [
10790
            "swfdetect",
10791
            "escape",
10792
            "widget",
10793
            "base",
10794
            "cssbutton",
10795
            "node",
10796
            "event-custom",
10797
            "uploader-queue"
10798
        ]
10799
    },
10800
    "uploader-html5": {
10801
        "requires": [
10802
            "widget",
10803
            "node-event-simulate",
10804
            "file-html5",
10805
            "uploader-queue"
10806
        ]
10807
    },
10808
    "uploader-queue": {
10809
        "requires": [
10810
            "base"
10811
        ]
10812
    },
10813
    "view": {
10814
        "requires": [
10815
            "base-build",
10816
            "node-event-delegate"
10817
        ]
10818
    },
10819
    "view-node-map": {
10820
        "requires": [
10821
            "view"
10822
        ]
10823
    },
10824
    "widget": {
10825
        "use": [
10826
            "widget-base",
10827
            "widget-htmlparser",
10828
            "widget-skin",
10829
            "widget-uievents"
10830
        ]
10831
    },
10832
    "widget-anim": {
10833
        "requires": [
10834
            "anim-base",
10835
            "plugin",
10836
            "widget"
10837
        ]
10838
    },
10839
    "widget-autohide": {
10840
        "requires": [
10841
            "base-build",
10842
            "event-key",
10843
            "event-outside",
10844
            "widget"
10845
        ]
10846
    },
10847
    "widget-base": {
10848
        "requires": [
10849
            "attribute",
10850
            "base-base",
10851
            "base-pluginhost",
10852
            "classnamemanager",
10853
            "event-focus",
10854
            "node-base",
10855
            "node-style"
10856
        ],
10857
        "skinnable": true
10858
    },
10859
    "widget-base-ie": {
10860
        "condition": {
10861
            "name": "widget-base-ie",
10862
            "trigger": "widget-base",
10863
            "ua": "ie"
10864
        },
10865
        "requires": [
10866
            "widget-base"
10867
        ]
10868
    },
10869
    "widget-buttons": {
10870
        "requires": [
10871
            "button-plugin",
10872
            "cssbutton",
10873
            "widget-stdmod"
10874
        ]
10875
    },
10876
    "widget-child": {
10877
        "requires": [
10878
            "base-build",
10879
            "widget"
10880
        ]
10881
    },
10882
    "widget-htmlparser": {
10883
        "requires": [
10884
            "widget-base"
10885
        ]
10886
    },
10887
    "widget-modality": {
10888
        "requires": [
10889
            "base-build",
10890
            "event-outside",
10891
            "widget"
10892
        ],
10893
        "skinnable": true
10894
    },
10895
    "widget-parent": {
10896
        "requires": [
10897
            "arraylist",
10898
            "base-build",
10899
            "widget"
10900
        ]
10901
    },
10902
    "widget-position": {
10903
        "requires": [
10904
            "base-build",
10905
            "node-screen",
10906
            "widget"
10907
        ]
10908
    },
10909
    "widget-position-align": {
10910
        "requires": [
10911
            "widget-position"
10912
        ]
10913
    },
10914
    "widget-position-constrain": {
10915
        "requires": [
10916
            "widget-position"
10917
        ]
10918
    },
10919
    "widget-skin": {
10920
        "requires": [
10921
            "widget-base"
10922
        ]
10923
    },
10924
    "widget-stack": {
10925
        "requires": [
10926
            "base-build",
10927
            "widget"
10928
        ],
10929
        "skinnable": true
10930
    },
10931
    "widget-stdmod": {
10932
        "requires": [
10933
            "base-build",
10934
            "widget"
10935
        ]
10936
    },
10937
    "widget-uievents": {
10938
        "requires": [
10939
            "node-event-delegate",
10940
            "widget-base"
10941
        ]
10942
    },
10943
    "yql": {
10944
        "requires": [
10945
            "oop"
10946
        ]
10947
    },
10948
    "yql-jsonp": {
10949
        "condition": {
10950
            "name": "yql-jsonp",
10951
            "test": function (Y) {
10952
    /* Only load the JSONP module when not in nodejs or winjs
10953
    TODO Make the winjs module a CORS module
10954
    */
10955
    return (!Y.UA.nodejs && !Y.UA.winjs);
10956
},
10957
            "trigger": "yql"
10958
        },
10959
        "requires": [
10960
            "yql",
10961
            "jsonp",
10962
            "jsonp-url"
10963
        ]
10964
    },
10965
    "yql-nodejs": {
10966
        "condition": {
10967
            "name": "yql-nodejs",
10968
            "trigger": "yql",
10969
            "ua": "nodejs"
10970
        },
10971
        "requires": [
10972
            "yql"
10973
        ]
10974
    },
10975
    "yql-winjs": {
10976
        "condition": {
10977
            "name": "yql-winjs",
10978
            "trigger": "yql",
10979
            "ua": "winjs"
10980
        },
10981
        "requires": [
10982
            "yql"
10983
        ]
10984
    },
10985
    "yui": {},
10986
    "yui-base": {},
10987
    "yui-later": {
10988
        "requires": [
10989
            "yui-base"
10990
        ]
10991
    },
10992
    "yui-log": {
10993
        "requires": [
10994
            "yui-base"
10995
        ]
10996
    },
10997
    "yui-throttle": {
10998
        "requires": [
10999
            "yui-base"
11000
        ]
11001
    }
11002
});
11003
YUI.Env[Y.version].md5 = '2fd2be6b12ee9f999b4367499ae61aae';
11004
 
11005
 
11006
}, '3.18.1', {"requires": ["loader-base"]});
11007
YUI.add('yui', function (Y, NAME) {}, '3.18.1', {
11008
    "use": [
11009
        "get",
11010
        "features",
11011
        "intl-base",
11012
        "yui-log",
11013
        "yui-log-nodejs",
11014
        "yui-later",
11015
        "loader-base",
11016
        "loader-rollup",
11017
        "loader-yui3"
11018
    ]
11019
});