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