| 1 | efrain | 1 | YUI.add('loader-base', function (Y, NAME) {
 | 
        
           |  |  | 2 |   | 
        
           |  |  | 3 | /**
 | 
        
           |  |  | 4 |  * The YUI loader core
 | 
        
           |  |  | 5 |  * @module loader
 | 
        
           |  |  | 6 |  * @submodule loader-base
 | 
        
           |  |  | 7 |  */
 | 
        
           |  |  | 8 |   | 
        
           |  |  | 9 | (function() {
 | 
        
           |  |  | 10 |     var VERSION = Y.version,
 | 
        
           |  |  | 11 |         BUILD = '/build/',
 | 
        
           |  |  | 12 |         ROOT = VERSION + '/',
 | 
        
           |  |  | 13 |         CDN_BASE = Y.Env.base,
 | 
        
           |  |  | 14 |         GALLERY_VERSION = 'gallery-2014.07.31-18-26',
 | 
        
           |  |  | 15 |         TNT = '2in3',
 | 
        
           |  |  | 16 |         TNT_VERSION = '4',
 | 
        
           |  |  | 17 |         YUI2_VERSION = '2.9.0',
 | 
        
           |  |  | 18 |         COMBO_BASE = CDN_BASE + 'combo?',
 | 
        
           |  |  | 19 |         META = {
 | 
        
           |  |  | 20 |             version: VERSION,
 | 
        
           |  |  | 21 |             root: ROOT,
 | 
        
           |  |  | 22 |             base: Y.Env.base,
 | 
        
           |  |  | 23 |             comboBase: COMBO_BASE,
 | 
        
           |  |  | 24 |             skin: {
 | 
        
           |  |  | 25 |                 defaultSkin: 'sam',
 | 
        
           |  |  | 26 |                 base: 'assets/skins/',
 | 
        
           |  |  | 27 |                 path: 'skin.css',
 | 
        
           |  |  | 28 |                 after: [
 | 
        
           |  |  | 29 |                     'cssreset',
 | 
        
           |  |  | 30 |                     'cssfonts',
 | 
        
           |  |  | 31 |                     'cssgrids',
 | 
        
           |  |  | 32 |                     'cssbase',
 | 
        
           |  |  | 33 |                     'cssreset-context',
 | 
        
           |  |  | 34 |                     'cssfonts-context'
 | 
        
           |  |  | 35 |                 ]
 | 
        
           |  |  | 36 |             },
 | 
        
           |  |  | 37 |             groups: {},
 | 
        
           |  |  | 38 |             patterns: {}
 | 
        
           |  |  | 39 |         },
 | 
        
           |  |  | 40 |         groups = META.groups,
 | 
        
           |  |  | 41 |         yui2Update = function(tnt, yui2, config) {
 | 
        
           |  |  | 42 |             var root = TNT + '.' +
 | 
        
           |  |  | 43 |                     (tnt || TNT_VERSION) + '/' +
 | 
        
           |  |  | 44 |                     (yui2 || YUI2_VERSION) + BUILD,
 | 
        
           |  |  | 45 |                 base = (config && config.base) ? config.base : CDN_BASE,
 | 
        
           |  |  | 46 |                 combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE;
 | 
        
           |  |  | 47 |   | 
        
           |  |  | 48 |             groups.yui2.base = base + root;
 | 
        
           |  |  | 49 |             groups.yui2.root = root;
 | 
        
           |  |  | 50 |             groups.yui2.comboBase = combo;
 | 
        
           |  |  | 51 |         },
 | 
        
           |  |  | 52 |         galleryUpdate = function(tag, config) {
 | 
        
           |  |  | 53 |             var root = (tag || GALLERY_VERSION) + BUILD,
 | 
        
           |  |  | 54 |                 base = (config && config.base) ? config.base : CDN_BASE,
 | 
        
           |  |  | 55 |                 combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE;
 | 
        
           |  |  | 56 |   | 
        
           |  |  | 57 |             groups.gallery.base = base + root;
 | 
        
           |  |  | 58 |             groups.gallery.root = root;
 | 
        
           |  |  | 59 |             groups.gallery.comboBase = combo;
 | 
        
           |  |  | 60 |         };
 | 
        
           |  |  | 61 |   | 
        
           |  |  | 62 |   | 
        
           |  |  | 63 |     groups[VERSION] = {};
 | 
        
           |  |  | 64 |   | 
        
           |  |  | 65 |     groups.gallery = {
 | 
        
           |  |  | 66 |         ext: false,
 | 
        
           |  |  | 67 |         combine: true,
 | 
        
           |  |  | 68 |         comboBase: COMBO_BASE,
 | 
        
           |  |  | 69 |         update: galleryUpdate,
 | 
        
           |  |  | 70 |         patterns: {
 | 
        
           |  |  | 71 |             'gallery-': {},
 | 
        
           |  |  | 72 |             'lang/gallery-': {},
 | 
        
           |  |  | 73 |             'gallerycss-': {
 | 
        
           |  |  | 74 |                 type: 'css'
 | 
        
           |  |  | 75 |             }
 | 
        
           |  |  | 76 |         }
 | 
        
           |  |  | 77 |     };
 | 
        
           |  |  | 78 |   | 
        
           |  |  | 79 |     groups.yui2 = {
 | 
        
           |  |  | 80 |         combine: true,
 | 
        
           |  |  | 81 |         ext: false,
 | 
        
           |  |  | 82 |         comboBase: COMBO_BASE,
 | 
        
           |  |  | 83 |         update: yui2Update,
 | 
        
           |  |  | 84 |         patterns: {
 | 
        
           |  |  | 85 |             'yui2-': {
 | 
        
           |  |  | 86 |                 configFn: function(me) {
 | 
        
           |  |  | 87 |                     if (/-skin|reset|fonts|grids|base/.test(me.name)) {
 | 
        
           |  |  | 88 |                         me.type = 'css';
 | 
        
           |  |  | 89 |                         me.path = me.path.replace(/\.js/, '.css');
 | 
        
           |  |  | 90 |                         // this makes skins in builds earlier than
 | 
        
           |  |  | 91 |                         // 2.6.0 work as long as combine is false
 | 
        
           |  |  | 92 |                         me.path = me.path.replace(/\/yui2-skin/,
 | 
        
           |  |  | 93 |                                             '/assets/skins/sam/yui2-skin');
 | 
        
           |  |  | 94 |                     }
 | 
        
           |  |  | 95 |                 }
 | 
        
           |  |  | 96 |             }
 | 
        
           |  |  | 97 |         }
 | 
        
           |  |  | 98 |     };
 | 
        
           |  |  | 99 |   | 
        
           |  |  | 100 |     galleryUpdate();
 | 
        
           |  |  | 101 |     yui2Update();
 | 
        
           |  |  | 102 |   | 
        
           |  |  | 103 |     if (YUI.Env[VERSION]) {
 | 
        
           |  |  | 104 |         Y.mix(META, YUI.Env[VERSION], false, [
 | 
        
           |  |  | 105 |             'modules',
 | 
        
           |  |  | 106 |             'groups',
 | 
        
           |  |  | 107 |             'skin'
 | 
        
           |  |  | 108 |         ], 0, true);
 | 
        
           |  |  | 109 |     }
 | 
        
           |  |  | 110 |   | 
        
           |  |  | 111 |     YUI.Env[VERSION] = META;
 | 
        
           |  |  | 112 | }());
 | 
        
           |  |  | 113 | /*jslint forin: true, maxlen: 350 */
 | 
        
           |  |  | 114 |   | 
        
           |  |  | 115 | /**
 | 
        
           |  |  | 116 |  * Loader dynamically loads script and css files.  It includes the dependency
 | 
        
           |  |  | 117 |  * information for the version of the library in use, and will automatically pull in
 | 
        
           |  |  | 118 |  * dependencies for the modules requested. It can also load the
 | 
        
           |  |  | 119 |  * files from the Yahoo! CDN, and it can utilize the combo service provided on
 | 
        
           |  |  | 120 |  * this network to reduce the number of http connections required to download
 | 
        
           |  |  | 121 |  * YUI files.
 | 
        
           |  |  | 122 |  *
 | 
        
           |  |  | 123 |  * @module loader
 | 
        
           |  |  | 124 |  * @main loader
 | 
        
           |  |  | 125 |  * @submodule loader-base
 | 
        
           |  |  | 126 |  */
 | 
        
           |  |  | 127 |   | 
        
           |  |  | 128 | var NOT_FOUND = {},
 | 
        
           |  |  | 129 |     NO_REQUIREMENTS = [],
 | 
        
           |  |  | 130 |     MAX_URL_LENGTH = 1024,
 | 
        
           |  |  | 131 |     GLOBAL_ENV = YUI.Env,
 | 
        
           |  |  | 132 |     GLOBAL_LOADED = GLOBAL_ENV._loaded,
 | 
        
           |  |  | 133 |     CSS = 'css',
 | 
        
           |  |  | 134 |     JS = 'js',
 | 
        
           |  |  | 135 |     INTL = 'intl',
 | 
        
           |  |  | 136 |     DEFAULT_SKIN = 'sam',
 | 
        
           |  |  | 137 |     VERSION = Y.version,
 | 
        
           |  |  | 138 |     ROOT_LANG = '',
 | 
        
           |  |  | 139 |     YObject = Y.Object,
 | 
        
           |  |  | 140 |     oeach = YObject.each,
 | 
        
           |  |  | 141 |     yArray = Y.Array,
 | 
        
           |  |  | 142 |     _queue = GLOBAL_ENV._loaderQueue,
 | 
        
           |  |  | 143 |     META = GLOBAL_ENV[VERSION],
 | 
        
           |  |  | 144 |     SKIN_PREFIX = 'skin-',
 | 
        
           |  |  | 145 |     L = Y.Lang,
 | 
        
           |  |  | 146 |     ON_PAGE = GLOBAL_ENV.mods,
 | 
        
           |  |  | 147 |     modulekey,
 | 
        
           |  |  | 148 |     _path = function(dir, file, type, nomin) {
 | 
        
           |  |  | 149 |         var path = dir + '/' + file;
 | 
        
           |  |  | 150 |         if (!nomin) {
 | 
        
           |  |  | 151 |             path += '-min';
 | 
        
           |  |  | 152 |         }
 | 
        
           |  |  | 153 |         path += '.' + (type || CSS);
 | 
        
           |  |  | 154 |   | 
        
           |  |  | 155 |         return path;
 | 
        
           |  |  | 156 |     };
 | 
        
           |  |  | 157 |   | 
        
           |  |  | 158 |   | 
        
           |  |  | 159 |     if (!YUI.Env._cssLoaded) {
 | 
        
           |  |  | 160 |         YUI.Env._cssLoaded = {};
 | 
        
           |  |  | 161 |     }
 | 
        
           |  |  | 162 |   | 
        
           |  |  | 163 |   | 
        
           |  |  | 164 | /**
 | 
        
           |  |  | 165 |  * The component metadata is stored in Y.Env.meta.
 | 
        
           |  |  | 166 |  * Part of the loader module.
 | 
        
           |  |  | 167 |  * @property meta
 | 
        
           |  |  | 168 |  * @for YUI
 | 
        
           |  |  | 169 |  */
 | 
        
           |  |  | 170 | Y.Env.meta = META;
 | 
        
           |  |  | 171 |   | 
        
           |  |  | 172 | /**
 | 
        
           |  |  | 173 |  * Loader dynamically loads script and css files.  It includes the dependency
 | 
        
           |  |  | 174 |  * info for the version of the library in use, and will automatically pull in
 | 
        
           |  |  | 175 |  * dependencies for the modules requested. It can load the
 | 
        
           |  |  | 176 |  * files from the Yahoo! CDN, and it can utilize the combo service provided on
 | 
        
           |  |  | 177 |  * this network to reduce the number of http connections required to download
 | 
        
           |  |  | 178 |  * YUI files. You can also specify an external, custom combo service to host
 | 
        
           |  |  | 179 |  * your modules as well.
 | 
        
           |  |  | 180 |   | 
        
           |  |  | 181 |         var Y = YUI();
 | 
        
           |  |  | 182 |         var loader = new Y.Loader({
 | 
        
           |  |  | 183 |             filter: 'debug',
 | 
        
           |  |  | 184 |             base: '../../',
 | 
        
           |  |  | 185 |             root: 'build/',
 | 
        
           |  |  | 186 |             combine: true,
 | 
        
           |  |  | 187 |             require: ['node', 'dd', 'console']
 | 
        
           |  |  | 188 |         });
 | 
        
           |  |  | 189 |         var out = loader.resolve(true);
 | 
        
           |  |  | 190 |   | 
        
           |  |  | 191 |  * If the Loader needs to be patched before it is used for the first time, it
 | 
        
           |  |  | 192 |  * should be done through the `doBeforeLoader` hook. Simply make the patch
 | 
        
           |  |  | 193 |  * available via configuration before YUI is loaded:
 | 
        
           |  |  | 194 |   | 
        
           |  |  | 195 |         YUI_config = YUI_config || {};
 | 
        
           |  |  | 196 |         YUI_config.doBeforeLoader = function (config) {
 | 
        
           |  |  | 197 |             var resolve = this.context.Loader.prototype.resolve;
 | 
        
           |  |  | 198 |             this.context.Loader.prototype.resolve = function () {
 | 
        
           |  |  | 199 |                 // do something here
 | 
        
           |  |  | 200 |                 return resolve.apply(this, arguments);
 | 
        
           |  |  | 201 |             };
 | 
        
           |  |  | 202 |         };
 | 
        
           |  |  | 203 |   | 
        
           |  |  | 204 |  * @constructor
 | 
        
           |  |  | 205 |  * @class Loader
 | 
        
           |  |  | 206 |  * @param {Object} config an optional set of configuration options.
 | 
        
           |  |  | 207 |  * @param {String} config.base The base dir which to fetch this module from
 | 
        
           |  |  | 208 |  * @param {String} config.comboBase The Combo service base path. Ex: `http://yui.yahooapis.com/combo?`
 | 
        
           |  |  | 209 |  * @param {String} config.root The root path to prepend to module names for the combo service. Ex: `2.5.2/build/`
 | 
        
           |  |  | 210 |  * @param {String|Object} config.filter A filter to apply to result urls. <a href="#property_filter">See filter property</a>
 | 
        
           |  |  | 211 |  * @param {Object} config.filters Per-component filter specification.  If specified for a given component, this overrides the filter config.
 | 
        
           |  |  | 212 |  * @param {Boolean} config.combine Use a combo service to reduce the number of http connections required to load your dependencies
 | 
        
           |  |  | 213 |  * @param {Boolean} [config.async=true] Fetch files in async
 | 
        
           |  |  | 214 |  * @param {Array} config.ignore: A list of modules that should never be dynamically loaded
 | 
        
           |  |  | 215 |  * @param {Array} config.force A list of modules that should always be loaded when required, even if already present on the page
 | 
        
           |  |  | 216 |  * @param {HTMLElement|String} config.insertBefore Node or id for a node that should be used as the insertion point for new nodes
 | 
        
           |  |  | 217 |  * @param {Object} config.jsAttributes Object literal containing attributes to add to script nodes
 | 
        
           |  |  | 218 |  * @param {Object} config.cssAttributes Object literal containing attributes to add to link nodes
 | 
        
           |  |  | 219 |  * @param {Number} config.timeout The number of milliseconds before a timeout occurs when dynamically loading nodes.  If not set, there is no timeout
 | 
        
           |  |  | 220 |  * @param {Object} config.context Execution context for all callbacks
 | 
        
           |  |  | 221 |  * @param {Function} config.onSuccess Callback for the 'success' event
 | 
        
           |  |  | 222 |  * @param {Function} config.onFailure Callback for the 'failure' event
 | 
        
           |  |  | 223 |  * @param {Function} config.onTimeout Callback for the 'timeout' event
 | 
        
           |  |  | 224 |  * @param {Function} config.onProgress Callback executed each time a script or css file is loaded
 | 
        
           |  |  | 225 |  * @param {Object} config.modules A list of module definitions.  See <a href="#method_addModule">Loader.addModule</a> for the supported module metadata
 | 
        
           |  |  | 226 |  * @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`.
 | 
        
           |  |  | 227 |  * @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.
 | 
        
           |  |  | 228 |  * @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.
 | 
        
           |  |  | 229 |  * @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.
 | 
        
           |  |  | 230 |  */
 | 
        
           |  |  | 231 | Y.Loader = function(o) {
 | 
        
           |  |  | 232 |   | 
        
           |  |  | 233 |     var self = this;
 | 
        
           |  |  | 234 |   | 
        
           |  |  | 235 |     //Catch no config passed.
 | 
        
           |  |  | 236 |     o = o || {};
 | 
        
           |  |  | 237 |   | 
        
           |  |  | 238 |     modulekey = META.md5;
 | 
        
           |  |  | 239 |   | 
        
           |  |  | 240 |     /**
 | 
        
           |  |  | 241 |      * Internal callback to handle multiple internal insert() calls
 | 
        
           |  |  | 242 |      * so that css is inserted prior to js
 | 
        
           |  |  | 243 |      * @property _internalCallback
 | 
        
           |  |  | 244 |      * @private
 | 
        
           |  |  | 245 |      */
 | 
        
           |  |  | 246 |     // self._internalCallback = null;
 | 
        
           |  |  | 247 |   | 
        
           |  |  | 248 |     /**
 | 
        
           |  |  | 249 |      * Callback that will be executed when the loader is finished
 | 
        
           |  |  | 250 |      * with an insert
 | 
        
           |  |  | 251 |      * @method onSuccess
 | 
        
           |  |  | 252 |      * @type function
 | 
        
           |  |  | 253 |      */
 | 
        
           |  |  | 254 |     // self.onSuccess = null;
 | 
        
           |  |  | 255 |   | 
        
           |  |  | 256 |     /**
 | 
        
           |  |  | 257 |      * Callback that will be executed if there is a failure
 | 
        
           |  |  | 258 |      * @method onFailure
 | 
        
           |  |  | 259 |      * @type function
 | 
        
           |  |  | 260 |      */
 | 
        
           |  |  | 261 |     // self.onFailure = null;
 | 
        
           |  |  | 262 |   | 
        
           |  |  | 263 |     /**
 | 
        
           |  |  | 264 |      * Callback executed each time a script or css file is loaded
 | 
        
           |  |  | 265 |      * @method onProgress
 | 
        
           |  |  | 266 |      * @type function
 | 
        
           |  |  | 267 |      */
 | 
        
           |  |  | 268 |     // self.onProgress = null;
 | 
        
           |  |  | 269 |   | 
        
           |  |  | 270 |     /**
 | 
        
           |  |  | 271 |      * Callback that will be executed if a timeout occurs
 | 
        
           |  |  | 272 |      * @method onTimeout
 | 
        
           |  |  | 273 |      * @type function
 | 
        
           |  |  | 274 |      */
 | 
        
           |  |  | 275 |     // self.onTimeout = null;
 | 
        
           |  |  | 276 |   | 
        
           |  |  | 277 |     /**
 | 
        
           |  |  | 278 |      * The execution context for all callbacks
 | 
        
           |  |  | 279 |      * @property context
 | 
        
           |  |  | 280 |      * @default {YUI} the YUI instance
 | 
        
           |  |  | 281 |      */
 | 
        
           |  |  | 282 |     self.context = Y;
 | 
        
           |  |  | 283 |   | 
        
           |  |  | 284 |     // Hook that allows the patching of loader
 | 
        
           |  |  | 285 |     if (o.doBeforeLoader) {
 | 
        
           |  |  | 286 |         o.doBeforeLoader.apply(self, arguments);
 | 
        
           |  |  | 287 |     }
 | 
        
           |  |  | 288 |   | 
        
           |  |  | 289 |     /**
 | 
        
           |  |  | 290 |      * Data that is passed to all callbacks
 | 
        
           |  |  | 291 |      * @property data
 | 
        
           |  |  | 292 |      */
 | 
        
           |  |  | 293 |     // self.data = null;
 | 
        
           |  |  | 294 |   | 
        
           |  |  | 295 |     /**
 | 
        
           |  |  | 296 |      * Node reference or id where new nodes should be inserted before
 | 
        
           |  |  | 297 |      * @property insertBefore
 | 
        
           |  |  | 298 |      * @type string|HTMLElement
 | 
        
           |  |  | 299 |      */
 | 
        
           |  |  | 300 |     // self.insertBefore = null;
 | 
        
           |  |  | 301 |   | 
        
           |  |  | 302 |     /**
 | 
        
           |  |  | 303 |      * The charset attribute for inserted nodes
 | 
        
           |  |  | 304 |      * @property charset
 | 
        
           |  |  | 305 |      * @type string
 | 
        
           |  |  | 306 |      * @deprecated , use cssAttributes or jsAttributes.
 | 
        
           |  |  | 307 |      */
 | 
        
           |  |  | 308 |     // self.charset = null;
 | 
        
           |  |  | 309 |   | 
        
           |  |  | 310 |     /**
 | 
        
           |  |  | 311 |      * An object literal containing attributes to add to link nodes
 | 
        
           |  |  | 312 |      * @property cssAttributes
 | 
        
           |  |  | 313 |      * @type object
 | 
        
           |  |  | 314 |      */
 | 
        
           |  |  | 315 |     // self.cssAttributes = null;
 | 
        
           |  |  | 316 |   | 
        
           |  |  | 317 |     /**
 | 
        
           |  |  | 318 |      * An object literal containing attributes to add to script nodes
 | 
        
           |  |  | 319 |      * @property jsAttributes
 | 
        
           |  |  | 320 |      * @type object
 | 
        
           |  |  | 321 |      */
 | 
        
           |  |  | 322 |     // self.jsAttributes = null;
 | 
        
           |  |  | 323 |   | 
        
           |  |  | 324 |     /**
 | 
        
           |  |  | 325 |      * The base directory.
 | 
        
           |  |  | 326 |      * @property base
 | 
        
           |  |  | 327 |      * @type string
 | 
        
           |  |  | 328 |      * @default http://yui.yahooapis.com/[YUI VERSION]/build/
 | 
        
           |  |  | 329 |      */
 | 
        
           |  |  | 330 |     self.base = Y.Env.meta.base + Y.Env.meta.root;
 | 
        
           |  |  | 331 |   | 
        
           |  |  | 332 |     /**
 | 
        
           |  |  | 333 |      * Base path for the combo service
 | 
        
           |  |  | 334 |      * @property comboBase
 | 
        
           |  |  | 335 |      * @type string
 | 
        
           |  |  | 336 |      * @default http://yui.yahooapis.com/combo?
 | 
        
           |  |  | 337 |      */
 | 
        
           |  |  | 338 |     self.comboBase = Y.Env.meta.comboBase;
 | 
        
           |  |  | 339 |   | 
        
           |  |  | 340 |     /*
 | 
        
           |  |  | 341 |      * Base path for language packs.
 | 
        
           |  |  | 342 |      */
 | 
        
           |  |  | 343 |     // self.langBase = Y.Env.meta.langBase;
 | 
        
           |  |  | 344 |     // self.lang = "";
 | 
        
           |  |  | 345 |   | 
        
           |  |  | 346 |     /**
 | 
        
           |  |  | 347 |      * If configured, the loader will attempt to use the combo
 | 
        
           |  |  | 348 |      * service for YUI resources and configured external resources.
 | 
        
           |  |  | 349 |      * @property combine
 | 
        
           |  |  | 350 |      * @type boolean
 | 
        
           |  |  | 351 |      * @default true if a base dir isn't in the config
 | 
        
           |  |  | 352 |      */
 | 
        
           |  |  | 353 |     self.combine = o.base &&
 | 
        
           |  |  | 354 |         (o.base.indexOf(self.comboBase.substr(0, 20)) > -1);
 | 
        
           |  |  | 355 |   | 
        
           |  |  | 356 |     /**
 | 
        
           |  |  | 357 |     * The default seperator to use between files in a combo URL
 | 
        
           |  |  | 358 |     * @property comboSep
 | 
        
           |  |  | 359 |     * @type {String}
 | 
        
           |  |  | 360 |     * @default Ampersand
 | 
        
           |  |  | 361 |     */
 | 
        
           |  |  | 362 |     self.comboSep = '&';
 | 
        
           |  |  | 363 |     /**
 | 
        
           |  |  | 364 |      * Max url length for combo urls.  The default is 1024. This is the URL
 | 
        
           |  |  | 365 |      * limit for the Yahoo! hosted combo servers.  If consuming
 | 
        
           |  |  | 366 |      * a different combo service that has a different URL limit
 | 
        
           |  |  | 367 |      * it is possible to override this default by supplying
 | 
        
           |  |  | 368 |      * the maxURLLength config option.  The config option will
 | 
        
           |  |  | 369 |      * only take effect if lower than the default.
 | 
        
           |  |  | 370 |      *
 | 
        
           |  |  | 371 |      * @property maxURLLength
 | 
        
           |  |  | 372 |      * @type int
 | 
        
           |  |  | 373 |      */
 | 
        
           |  |  | 374 |     self.maxURLLength = MAX_URL_LENGTH;
 | 
        
           |  |  | 375 |   | 
        
           |  |  | 376 |     /**
 | 
        
           |  |  | 377 |      * Ignore modules registered on the YUI global
 | 
        
           |  |  | 378 |      * @property ignoreRegistered
 | 
        
           |  |  | 379 |      * @default false
 | 
        
           |  |  | 380 |      */
 | 
        
           |  |  | 381 |     self.ignoreRegistered = o.ignoreRegistered;
 | 
        
           |  |  | 382 |   | 
        
           |  |  | 383 |     /**
 | 
        
           |  |  | 384 |      * Root path to prepend to module path for the combo
 | 
        
           |  |  | 385 |      * service
 | 
        
           |  |  | 386 |      * @property root
 | 
        
           |  |  | 387 |      * @type string
 | 
        
           |  |  | 388 |      * @default [YUI VERSION]/build/
 | 
        
           |  |  | 389 |      */
 | 
        
           |  |  | 390 |     self.root = Y.Env.meta.root;
 | 
        
           |  |  | 391 |   | 
        
           |  |  | 392 |     /**
 | 
        
           |  |  | 393 |      * Timeout value in milliseconds.  If set, self value will be used by
 | 
        
           |  |  | 394 |      * the get utility.  the timeout event will fire if
 | 
        
           |  |  | 395 |      * a timeout occurs.
 | 
        
           |  |  | 396 |      * @property timeout
 | 
        
           |  |  | 397 |      * @type int
 | 
        
           |  |  | 398 |      */
 | 
        
           |  |  | 399 |     self.timeout = 0;
 | 
        
           |  |  | 400 |   | 
        
           |  |  | 401 |     /**
 | 
        
           |  |  | 402 |      * A list of modules that should not be loaded, even if
 | 
        
           |  |  | 403 |      * they turn up in the dependency tree
 | 
        
           |  |  | 404 |      * @property ignore
 | 
        
           |  |  | 405 |      * @type string[]
 | 
        
           |  |  | 406 |      */
 | 
        
           |  |  | 407 |     // self.ignore = null;
 | 
        
           |  |  | 408 |   | 
        
           |  |  | 409 |     /**
 | 
        
           |  |  | 410 |      * A list of modules that should always be loaded, even
 | 
        
           |  |  | 411 |      * if they have already been inserted into the page.
 | 
        
           |  |  | 412 |      * @property force
 | 
        
           |  |  | 413 |      * @type string[]
 | 
        
           |  |  | 414 |      */
 | 
        
           |  |  | 415 |     // self.force = null;
 | 
        
           |  |  | 416 |   | 
        
           |  |  | 417 |     self.forceMap = {};
 | 
        
           |  |  | 418 |   | 
        
           |  |  | 419 |     /**
 | 
        
           |  |  | 420 |      * Should we allow rollups
 | 
        
           |  |  | 421 |      * @property allowRollup
 | 
        
           |  |  | 422 |      * @type boolean
 | 
        
           |  |  | 423 |      * @default false
 | 
        
           |  |  | 424 |      */
 | 
        
           |  |  | 425 |     self.allowRollup = false;
 | 
        
           |  |  | 426 |   | 
        
           |  |  | 427 |     /**
 | 
        
           |  |  | 428 |      * A filter to apply to result urls.  This filter will modify the default
 | 
        
           |  |  | 429 |      * path for all modules.  The default path for the YUI library is the
 | 
        
           |  |  | 430 |      * minified version of the files (e.g., event-min.js).  The filter property
 | 
        
           |  |  | 431 |      * can be a predefined filter or a custom filter.  The valid predefined
 | 
        
           |  |  | 432 |      * filters are:
 | 
        
           |  |  | 433 |      * <dl>
 | 
        
           |  |  | 434 |      *  <dt>DEBUG</dt>
 | 
        
           |  |  | 435 |      *  <dd>Selects the debug versions of the library (e.g., event-debug.js).
 | 
        
           |  |  | 436 |      *      This option will automatically include the Logger widget</dd>
 | 
        
           |  |  | 437 |      *  <dt>RAW</dt>
 | 
        
           |  |  | 438 |      *  <dd>Selects the non-minified version of the library (e.g., event.js).
 | 
        
           |  |  | 439 |      *  </dd>
 | 
        
           |  |  | 440 |      * </dl>
 | 
        
           |  |  | 441 |      * You can also define a custom filter, which must be an object literal
 | 
        
           |  |  | 442 |      * containing a search expression and a replace string:
 | 
        
           |  |  | 443 |      *
 | 
        
           |  |  | 444 |      *      myFilter: {
 | 
        
           |  |  | 445 |      *          'searchExp': "-min\\.js",
 | 
        
           |  |  | 446 |      *          'replaceStr': "-debug.js"
 | 
        
           |  |  | 447 |      *      }
 | 
        
           |  |  | 448 |      *
 | 
        
           |  |  | 449 |      * @property filter
 | 
        
           |  |  | 450 |      * @type string| {searchExp: string, replaceStr: string}
 | 
        
           |  |  | 451 |      */
 | 
        
           |  |  | 452 |     // self.filter = null;
 | 
        
           |  |  | 453 |   | 
        
           |  |  | 454 |     /**
 | 
        
           |  |  | 455 |      * per-component filter specification.  If specified for a given
 | 
        
           |  |  | 456 |      * component, this overrides the filter config.
 | 
        
           |  |  | 457 |      * @property filters
 | 
        
           |  |  | 458 |      * @type object
 | 
        
           |  |  | 459 |      */
 | 
        
           |  |  | 460 |     self.filters = {};
 | 
        
           |  |  | 461 |   | 
        
           |  |  | 462 |     /**
 | 
        
           |  |  | 463 |      * The list of requested modules
 | 
        
           |  |  | 464 |      * @property required
 | 
        
           |  |  | 465 |      * @type {string: boolean}
 | 
        
           |  |  | 466 |      */
 | 
        
           |  |  | 467 |     self.required = {};
 | 
        
           |  |  | 468 |   | 
        
           |  |  | 469 |     /**
 | 
        
           |  |  | 470 |      * If a module name is predefined when requested, it is checked againsts
 | 
        
           |  |  | 471 |      * the patterns provided in this property.  If there is a match, the
 | 
        
           |  |  | 472 |      * module is added with the default configuration.
 | 
        
           |  |  | 473 |      *
 | 
        
           |  |  | 474 |      * At the moment only supporting module prefixes, but anticipate
 | 
        
           |  |  | 475 |      * supporting at least regular expressions.
 | 
        
           |  |  | 476 |      * @property patterns
 | 
        
           |  |  | 477 |      * @type Object
 | 
        
           |  |  | 478 |      */
 | 
        
           |  |  | 479 |     // self.patterns = Y.merge(Y.Env.meta.patterns);
 | 
        
           |  |  | 480 |     self.patterns = {};
 | 
        
           |  |  | 481 |   | 
        
           |  |  | 482 |     /**
 | 
        
           |  |  | 483 |      * Internal loader instance metadata. Use accessor `getModuleInfo()` instead.
 | 
        
           |  |  | 484 |      */
 | 
        
           |  |  | 485 |     self.moduleInfo = {};
 | 
        
           |  |  | 486 |   | 
        
           |  |  | 487 |     self.groups = Y.merge(Y.Env.meta.groups);
 | 
        
           |  |  | 488 |   | 
        
           |  |  | 489 |     /**
 | 
        
           |  |  | 490 |      * Provides the information used to skin the skinnable components.
 | 
        
           |  |  | 491 |      * The following skin definition would result in 'skin1' and 'skin2'
 | 
        
           |  |  | 492 |      * being loaded for calendar (if calendar was requested), and
 | 
        
           |  |  | 493 |      * 'sam' for all other skinnable components:
 | 
        
           |  |  | 494 |      *
 | 
        
           |  |  | 495 |      *      skin: {
 | 
        
           |  |  | 496 |      *          // The default skin, which is automatically applied if not
 | 
        
           |  |  | 497 |      *          // overriden by a component-specific skin definition.
 | 
        
           |  |  | 498 |      *          // Change this in to apply a different skin globally
 | 
        
           |  |  | 499 |      *          defaultSkin: 'sam',
 | 
        
           |  |  | 500 |      *
 | 
        
           |  |  | 501 |      *          // This is combined with the loader base property to get
 | 
        
           |  |  | 502 |      *          // the default root directory for a skin. ex:
 | 
        
           |  |  | 503 |      *          // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/
 | 
        
           |  |  | 504 |      *          base: 'assets/skins/',
 | 
        
           |  |  | 505 |      *
 | 
        
           |  |  | 506 |      *          // Any component-specific overrides can be specified here,
 | 
        
           |  |  | 507 |      *          // making it possible to load different skins for different
 | 
        
           |  |  | 508 |      *          // components.  It is possible to load more than one skin
 | 
        
           |  |  | 509 |      *          // for a given component as well.
 | 
        
           |  |  | 510 |      *          overrides: {
 | 
        
           |  |  | 511 |      *              calendar: ['skin1', 'skin2']
 | 
        
           |  |  | 512 |      *          }
 | 
        
           |  |  | 513 |      *      }
 | 
        
           |  |  | 514 |      * @property skin
 | 
        
           |  |  | 515 |      * @type {Object}
 | 
        
           |  |  | 516 |      */
 | 
        
           |  |  | 517 |     self.skin = Y.merge(Y.Env.meta.skin);
 | 
        
           |  |  | 518 |   | 
        
           |  |  | 519 |     /*
 | 
        
           |  |  | 520 |      * Map of conditional modules
 | 
        
           |  |  | 521 |      * @since 3.2.0
 | 
        
           |  |  | 522 |      */
 | 
        
           |  |  | 523 |     self.conditions = {};
 | 
        
           |  |  | 524 |   | 
        
           |  |  | 525 |     // map of modules with a hash of modules that meet the requirement
 | 
        
           |  |  | 526 |     // self.provides = {};
 | 
        
           |  |  | 527 |   | 
        
           |  |  | 528 |     self.config = o;
 | 
        
           |  |  | 529 |     self._internal = true;
 | 
        
           |  |  | 530 |   | 
        
           |  |  | 531 |     self._populateConditionsCache();
 | 
        
           |  |  | 532 |   | 
        
           |  |  | 533 |     /**
 | 
        
           |  |  | 534 |      * Set when beginning to compute the dependency tree.
 | 
        
           |  |  | 535 |      * Composed of what YUI reports to be loaded combined
 | 
        
           |  |  | 536 |      * with what has been loaded by any instance on the page
 | 
        
           |  |  | 537 |      * with the version number specified in the metadata.
 | 
        
           |  |  | 538 |      * @property loaded
 | 
        
           |  |  | 539 |      * @type {string: boolean}
 | 
        
           |  |  | 540 |      */
 | 
        
           |  |  | 541 |     self.loaded = GLOBAL_LOADED[VERSION];
 | 
        
           |  |  | 542 |   | 
        
           |  |  | 543 |   | 
        
           |  |  | 544 |     /**
 | 
        
           |  |  | 545 |     * Should Loader fetch scripts in `async`, defaults to `true`
 | 
        
           |  |  | 546 |     * @property async
 | 
        
           |  |  | 547 |     */
 | 
        
           |  |  | 548 |   | 
        
           |  |  | 549 |     self.async = true;
 | 
        
           |  |  | 550 |   | 
        
           |  |  | 551 |     self._inspectPage();
 | 
        
           |  |  | 552 |   | 
        
           |  |  | 553 |     self._internal = false;
 | 
        
           |  |  | 554 |   | 
        
           |  |  | 555 |     self._config(o);
 | 
        
           |  |  | 556 |   | 
        
           |  |  | 557 |     self.forceMap = (self.force) ? Y.Array.hash(self.force) : {};
 | 
        
           |  |  | 558 |   | 
        
           |  |  | 559 |     self.testresults = null;
 | 
        
           |  |  | 560 |   | 
        
           |  |  | 561 |     if (Y.config.tests) {
 | 
        
           |  |  | 562 |         self.testresults = Y.config.tests;
 | 
        
           |  |  | 563 |     }
 | 
        
           |  |  | 564 |   | 
        
           |  |  | 565 |     /**
 | 
        
           |  |  | 566 |      * List of rollup files found in the library metadata
 | 
        
           |  |  | 567 |      * @property rollups
 | 
        
           |  |  | 568 |      */
 | 
        
           |  |  | 569 |     // self.rollups = null;
 | 
        
           |  |  | 570 |   | 
        
           |  |  | 571 |     /**
 | 
        
           |  |  | 572 |      * Whether or not to load optional dependencies for
 | 
        
           |  |  | 573 |      * the requested modules
 | 
        
           |  |  | 574 |      * @property loadOptional
 | 
        
           |  |  | 575 |      * @type boolean
 | 
        
           |  |  | 576 |      * @default false
 | 
        
           |  |  | 577 |      */
 | 
        
           |  |  | 578 |     // self.loadOptional = false;
 | 
        
           |  |  | 579 |   | 
        
           |  |  | 580 |     /**
 | 
        
           |  |  | 581 |      * All of the derived dependencies in sorted order, which
 | 
        
           |  |  | 582 |      * will be populated when either calculate() or insert()
 | 
        
           |  |  | 583 |      * is called
 | 
        
           |  |  | 584 |      * @property sorted
 | 
        
           |  |  | 585 |      * @type string[]
 | 
        
           |  |  | 586 |      */
 | 
        
           |  |  | 587 |     self.sorted = [];
 | 
        
           |  |  | 588 |   | 
        
           |  |  | 589 |     /*
 | 
        
           |  |  | 590 |      * A list of modules to attach to the YUI instance when complete.
 | 
        
           |  |  | 591 |      * If not supplied, the sorted list of dependencies are applied.
 | 
        
           |  |  | 592 |      * @property attaching
 | 
        
           |  |  | 593 |      */
 | 
        
           |  |  | 594 |     // self.attaching = null;
 | 
        
           |  |  | 595 |   | 
        
           |  |  | 596 |     /**
 | 
        
           |  |  | 597 |      * Flag to indicate the dependency tree needs to be recomputed
 | 
        
           |  |  | 598 |      * if insert is called again.
 | 
        
           |  |  | 599 |      * @property dirty
 | 
        
           |  |  | 600 |      * @type boolean
 | 
        
           |  |  | 601 |      * @default true
 | 
        
           |  |  | 602 |      */
 | 
        
           |  |  | 603 |     self.dirty = true;
 | 
        
           |  |  | 604 |   | 
        
           |  |  | 605 |     /**
 | 
        
           |  |  | 606 |      * List of modules inserted by the utility
 | 
        
           |  |  | 607 |      * @property inserted
 | 
        
           |  |  | 608 |      * @type {string: boolean}
 | 
        
           |  |  | 609 |      */
 | 
        
           |  |  | 610 |     self.inserted = {};
 | 
        
           |  |  | 611 |   | 
        
           |  |  | 612 |     /**
 | 
        
           |  |  | 613 |      * List of skipped modules during insert() because the module
 | 
        
           |  |  | 614 |      * was not defined
 | 
        
           |  |  | 615 |      * @property skipped
 | 
        
           |  |  | 616 |      */
 | 
        
           |  |  | 617 |     self.skipped = {};
 | 
        
           |  |  | 618 |   | 
        
           |  |  | 619 |     // Y.on('yui:load', self.loadNext, self);
 | 
        
           |  |  | 620 |   | 
        
           |  |  | 621 |     self.tested = {};
 | 
        
           |  |  | 622 |   | 
        
           |  |  | 623 |     /*
 | 
        
           |  |  | 624 |      * Cached sorted calculate results
 | 
        
           |  |  | 625 |      * @property results
 | 
        
           |  |  | 626 |      * @since 3.2.0
 | 
        
           |  |  | 627 |      */
 | 
        
           |  |  | 628 |     //self.results = {};
 | 
        
           |  |  | 629 |   | 
        
           |  |  | 630 |     if (self.ignoreRegistered) {
 | 
        
           |  |  | 631 |         //Clear inpage already processed modules.
 | 
        
           |  |  | 632 |         self._resetModules();
 | 
        
           |  |  | 633 |     }
 | 
        
           |  |  | 634 |   | 
        
           |  |  | 635 | };
 | 
        
           |  |  | 636 |   | 
        
           |  |  | 637 | Y.Loader.prototype = {
 | 
        
           |  |  | 638 |     /**
 | 
        
           |  |  | 639 |     * Gets the module info from the local moduleInfo hash, or from the
 | 
        
           |  |  | 640 |     * default metadata and populate the local moduleInfo hash.
 | 
        
           |  |  | 641 |     * @method getModuleInfo
 | 
        
           |  |  | 642 |     * @param {string} name of the module
 | 
        
           |  |  | 643 |     * @public
 | 
        
           |  |  | 644 |     */
 | 
        
           |  |  | 645 |     getModuleInfo: function(name) {
 | 
        
           |  |  | 646 |   | 
        
           |  |  | 647 |         var m = this.moduleInfo[name],
 | 
        
           |  |  | 648 |             rawMetaModules, globalRenderedMods, internal, v;
 | 
        
           |  |  | 649 |   | 
        
           |  |  | 650 |         if (m) {
 | 
        
           |  |  | 651 |             return m;
 | 
        
           |  |  | 652 |         }
 | 
        
           |  |  | 653 |   | 
        
           |  |  | 654 |         rawMetaModules = META.modules;
 | 
        
           |  |  | 655 |         globalRenderedMods = GLOBAL_ENV._renderedMods;
 | 
        
           |  |  | 656 |         internal = this._internal;
 | 
        
           |  |  | 657 |   | 
        
           |  |  | 658 |         /*
 | 
        
           |  |  | 659 |         The logic here is:
 | 
        
           |  |  | 660 |   | 
        
           |  |  | 661 |         - if the `moduleInfo[name]` is avilable,
 | 
        
           |  |  | 662 |           then short circuit
 | 
        
           |  |  | 663 |         - otherwise, if the module is in the globalCache (cross Y instance),
 | 
        
           |  |  | 664 |           then port it from the global registry into `moduleInfo[name]`
 | 
        
           |  |  | 665 |         - otherwise, if the module has raw metadata (from meta modules)
 | 
        
           |  |  | 666 |           then add it to the global registry and to `moduleInfo[name]`
 | 
        
           |  |  | 667 |   | 
        
           |  |  | 668 |         */
 | 
        
           |  |  | 669 |         if (globalRenderedMods && globalRenderedMods.hasOwnProperty(name) && !this.ignoreRegistered) {
 | 
        
           |  |  | 670 |             this.moduleInfo[name] = Y.merge(globalRenderedMods[name]);
 | 
        
           |  |  | 671 |         } else {
 | 
        
           |  |  | 672 |             if (rawMetaModules.hasOwnProperty(name)) {
 | 
        
           |  |  | 673 |                 this._internal = true; // making sure that modules from raw data are marked as internal
 | 
        
           |  |  | 674 |                 v = this.addModule(rawMetaModules[name], name);
 | 
        
           |  |  | 675 |                 // Inspect the page for the CSS module and mark it as loaded.
 | 
        
           |  |  | 676 |                 if (v && v.type === CSS) {
 | 
        
           |  |  | 677 |                     if (this.isCSSLoaded(v.name, true)) {
 | 
        
           |  |  | 678 |                         this.loaded[v.name] = true;
 | 
        
           |  |  | 679 |                     }
 | 
        
           |  |  | 680 |                 }
 | 
        
           |  |  | 681 |                 this._internal = internal;
 | 
        
           |  |  | 682 |             }
 | 
        
           |  |  | 683 |         }
 | 
        
           |  |  | 684 |         return this.moduleInfo[name];
 | 
        
           |  |  | 685 |     },
 | 
        
           |  |  | 686 |     /**
 | 
        
           |  |  | 687 |     * Expand the names that are aliases to other modules.
 | 
        
           |  |  | 688 |     * @method _expandAliases
 | 
        
           |  |  | 689 |     * @param {string[]} list a module name or a list of names to be expanded
 | 
        
           |  |  | 690 |     * @private
 | 
        
           |  |  | 691 |     * @return {array}
 | 
        
           |  |  | 692 |     */
 | 
        
           |  |  | 693 |     _expandAliases: function(list) {
 | 
        
           |  |  | 694 |         var expanded = [],
 | 
        
           |  |  | 695 |             aliases = YUI.Env.aliases,
 | 
        
           |  |  | 696 |             i, name;
 | 
        
           |  |  | 697 |         list = Y.Array(list);
 | 
        
           |  |  | 698 |         for (i = 0; i < list.length; i += 1) {
 | 
        
           |  |  | 699 |             name = list[i];
 | 
        
           |  |  | 700 |             expanded.push.apply(expanded, aliases[name] ? aliases[name] : [name]);
 | 
        
           |  |  | 701 |         }
 | 
        
           |  |  | 702 |         return expanded;
 | 
        
           |  |  | 703 |     },
 | 
        
           |  |  | 704 |     /**
 | 
        
           |  |  | 705 |     * Populate the conditions cache from raw modules, this is necessary
 | 
        
           |  |  | 706 |     * because no other module will require a conditional module, instead
 | 
        
           |  |  | 707 |     * the condition has to be executed and then the module is analyzed
 | 
        
           |  |  | 708 |     * to be included in the final requirement list. Without this cache
 | 
        
           |  |  | 709 |     * conditional modules will be simply ignored.
 | 
        
           |  |  | 710 |     * @method _populateConditionsCache
 | 
        
           |  |  | 711 |     * @private
 | 
        
           |  |  | 712 |     */
 | 
        
           |  |  | 713 |     _populateConditionsCache: function() {
 | 
        
           |  |  | 714 |         var rawMetaModules = META.modules,
 | 
        
           |  |  | 715 |             cache = GLOBAL_ENV._conditions,
 | 
        
           |  |  | 716 |             i, j, t, trigger;
 | 
        
           |  |  | 717 |   | 
        
           |  |  | 718 |         // if we have conditions in cache and cache is enabled
 | 
        
           |  |  | 719 |         // we should port them to this loader instance
 | 
        
           |  |  | 720 |         if (cache && !this.ignoreRegistered) {
 | 
        
           |  |  | 721 |             for (i in cache) {
 | 
        
           |  |  | 722 |                 if (cache.hasOwnProperty(i)) {
 | 
        
           |  |  | 723 |                     this.conditions[i] = Y.merge(cache[i]);
 | 
        
           |  |  | 724 |                 }
 | 
        
           |  |  | 725 |             }
 | 
        
           |  |  | 726 |         } else {
 | 
        
           |  |  | 727 |             for (i in rawMetaModules) {
 | 
        
           |  |  | 728 |                 if (rawMetaModules.hasOwnProperty(i) && rawMetaModules[i].condition) {
 | 
        
           |  |  | 729 |                     t = this._expandAliases(rawMetaModules[i].condition.trigger);
 | 
        
           |  |  | 730 |                     for (j = 0; j < t.length; j += 1) {
 | 
        
           |  |  | 731 |                         trigger = t[j];
 | 
        
           |  |  | 732 |                         this.conditions[trigger] = this.conditions[trigger] || {};
 | 
        
           |  |  | 733 |                         this.conditions[trigger][rawMetaModules[i].name || i] = rawMetaModules[i].condition;
 | 
        
           |  |  | 734 |                     }
 | 
        
           |  |  | 735 |                 }
 | 
        
           |  |  | 736 |             }
 | 
        
           |  |  | 737 |             GLOBAL_ENV._conditions = this.conditions;
 | 
        
           |  |  | 738 |         }
 | 
        
           |  |  | 739 |     },
 | 
        
           |  |  | 740 |     /**
 | 
        
           |  |  | 741 |     * Reset modules in the module cache to a pre-processed state so additional
 | 
        
           |  |  | 742 |     * computations with a different skin or language will work as expected.
 | 
        
           |  |  | 743 |     * @method _resetModules
 | 
        
           |  |  | 744 |     * @private
 | 
        
           |  |  | 745 |     */
 | 
        
           |  |  | 746 |     _resetModules: function() {
 | 
        
           |  |  | 747 |         var self = this, i, o,
 | 
        
           |  |  | 748 |             mod, name, details;
 | 
        
           |  |  | 749 |         for (i in self.moduleInfo) {
 | 
        
           |  |  | 750 |             if (self.moduleInfo.hasOwnProperty(i) && self.moduleInfo[i]) {
 | 
        
           |  |  | 751 |                 mod = self.moduleInfo[i];
 | 
        
           |  |  | 752 |                 name = mod.name;
 | 
        
           |  |  | 753 |                 details  = (YUI.Env.mods[name] ? YUI.Env.mods[name].details : null);
 | 
        
           |  |  | 754 |   | 
        
           |  |  | 755 |                 if (details) {
 | 
        
           |  |  | 756 |                     self.moduleInfo[name]._reset = true;
 | 
        
           |  |  | 757 |                     self.moduleInfo[name].requires = details.requires || [];
 | 
        
           |  |  | 758 |                     self.moduleInfo[name].optional = details.optional || [];
 | 
        
           |  |  | 759 |                     self.moduleInfo[name].supersedes = details.supercedes || [];
 | 
        
           |  |  | 760 |                 }
 | 
        
           |  |  | 761 |   | 
        
           |  |  | 762 |                 if (mod.defaults) {
 | 
        
           |  |  | 763 |                     for (o in mod.defaults) {
 | 
        
           |  |  | 764 |                         if (mod.defaults.hasOwnProperty(o)) {
 | 
        
           |  |  | 765 |                             if (mod[o]) {
 | 
        
           |  |  | 766 |                                 mod[o] = mod.defaults[o];
 | 
        
           |  |  | 767 |                             }
 | 
        
           |  |  | 768 |                         }
 | 
        
           |  |  | 769 |                     }
 | 
        
           |  |  | 770 |                 }
 | 
        
           |  |  | 771 |                 mod.langCache = undefined;
 | 
        
           |  |  | 772 |                 mod.skinCache = undefined;
 | 
        
           |  |  | 773 |                 if (mod.skinnable) {
 | 
        
           |  |  | 774 |                     self._addSkin(self.skin.defaultSkin, mod.name);
 | 
        
           |  |  | 775 |                 }
 | 
        
           |  |  | 776 |             }
 | 
        
           |  |  | 777 |         }
 | 
        
           |  |  | 778 |     },
 | 
        
           |  |  | 779 |     /**
 | 
        
           |  |  | 780 |     Regex that matches a CSS URL. Used to guess the file type when it's not
 | 
        
           |  |  | 781 |     specified.
 | 
        
           |  |  | 782 |   | 
        
           |  |  | 783 |     @property REGEX_CSS
 | 
        
           |  |  | 784 |     @type RegExp
 | 
        
           |  |  | 785 |     @final
 | 
        
           |  |  | 786 |     @protected
 | 
        
           |  |  | 787 |     @since 3.5.0
 | 
        
           |  |  | 788 |     **/
 | 
        
           |  |  | 789 |     REGEX_CSS: /\.css(?:[?;].*)?$/i,
 | 
        
           |  |  | 790 |   | 
        
           |  |  | 791 |     /**
 | 
        
           |  |  | 792 |     * Default filters for raw and debug
 | 
        
           |  |  | 793 |     * @property FILTER_DEFS
 | 
        
           |  |  | 794 |     * @type Object
 | 
        
           |  |  | 795 |     * @final
 | 
        
           |  |  | 796 |     * @protected
 | 
        
           |  |  | 797 |     */
 | 
        
           |  |  | 798 |     FILTER_DEFS: {
 | 
        
           |  |  | 799 |         RAW: {
 | 
        
           |  |  | 800 |             'searchExp': '-min\\.js',
 | 
        
           |  |  | 801 |             'replaceStr': '.js'
 | 
        
           |  |  | 802 |         },
 | 
        
           |  |  | 803 |         DEBUG: {
 | 
        
           |  |  | 804 |             'searchExp': '-min\\.js',
 | 
        
           |  |  | 805 |             'replaceStr': '-debug.js'
 | 
        
           |  |  | 806 |         },
 | 
        
           |  |  | 807 |         COVERAGE: {
 | 
        
           |  |  | 808 |             'searchExp': '-min\\.js',
 | 
        
           |  |  | 809 |             'replaceStr': '-coverage.js'
 | 
        
           |  |  | 810 |         }
 | 
        
           |  |  | 811 |     },
 | 
        
           |  |  | 812 |     /*
 | 
        
           |  |  | 813 |     * Check the pages meta-data and cache the result.
 | 
        
           |  |  | 814 |     * @method _inspectPage
 | 
        
           |  |  | 815 |     * @private
 | 
        
           |  |  | 816 |     */
 | 
        
           |  |  | 817 |     _inspectPage: function() {
 | 
        
           |  |  | 818 |         var self = this, v, m, req, mr, i;
 | 
        
           |  |  | 819 |   | 
        
           |  |  | 820 |         for (i in ON_PAGE) {
 | 
        
           |  |  | 821 |             if (ON_PAGE.hasOwnProperty(i)) {
 | 
        
           |  |  | 822 |                 v = ON_PAGE[i];
 | 
        
           |  |  | 823 |                 if (v.details) {
 | 
        
           |  |  | 824 |                     m = self.getModuleInfo(v.name);
 | 
        
           |  |  | 825 |                     req = v.details.requires;
 | 
        
           |  |  | 826 |                     mr = m && m.requires;
 | 
        
           |  |  | 827 |   | 
        
           |  |  | 828 |                    if (m) {
 | 
        
           |  |  | 829 |                        if (!m._inspected && req && mr.length !== req.length) {
 | 
        
           |  |  | 830 |                            // console.log('deleting ' + m.name);
 | 
        
           |  |  | 831 |                            delete m.expanded;
 | 
        
           |  |  | 832 |                        }
 | 
        
           |  |  | 833 |                    } else {
 | 
        
           |  |  | 834 |                        m = self.addModule(v.details, i);
 | 
        
           |  |  | 835 |                    }
 | 
        
           |  |  | 836 |                    m._inspected = true;
 | 
        
           |  |  | 837 |                }
 | 
        
           |  |  | 838 |             }
 | 
        
           |  |  | 839 |         }
 | 
        
           |  |  | 840 |     },
 | 
        
           |  |  | 841 |     /*
 | 
        
           |  |  | 842 |     * returns true if b is not loaded, and is required directly or by means of modules it supersedes.
 | 
        
           |  |  | 843 |     * @private
 | 
        
           |  |  | 844 |     * @method _requires
 | 
        
           |  |  | 845 |     * @param {String} mod1 The first module to compare
 | 
        
           |  |  | 846 |     * @param {String} mod2 The second module to compare
 | 
        
           |  |  | 847 |     */
 | 
        
           |  |  | 848 |    _requires: function(mod1, mod2) {
 | 
        
           |  |  | 849 |   | 
        
           |  |  | 850 |         var i, rm, after_map, s,
 | 
        
           |  |  | 851 |             m = this.getModuleInfo(mod1),
 | 
        
           |  |  | 852 |             other = this.getModuleInfo(mod2);
 | 
        
           |  |  | 853 |   | 
        
           |  |  | 854 |         if (!m || !other) {
 | 
        
           |  |  | 855 |             return false;
 | 
        
           |  |  | 856 |         }
 | 
        
           |  |  | 857 |   | 
        
           |  |  | 858 |         rm = m.expanded_map;
 | 
        
           |  |  | 859 |         after_map = m.after_map;
 | 
        
           |  |  | 860 |   | 
        
           |  |  | 861 |         // check if this module should be sorted after the other
 | 
        
           |  |  | 862 |         // do this first to short circut circular deps
 | 
        
           |  |  | 863 |         if (after_map && (mod2 in after_map)) {
 | 
        
           |  |  | 864 |             return true;
 | 
        
           |  |  | 865 |         }
 | 
        
           |  |  | 866 |   | 
        
           |  |  | 867 |         after_map = other.after_map;
 | 
        
           |  |  | 868 |   | 
        
           |  |  | 869 |         // and vis-versa
 | 
        
           |  |  | 870 |         if (after_map && (mod1 in after_map)) {
 | 
        
           |  |  | 871 |             return false;
 | 
        
           |  |  | 872 |         }
 | 
        
           |  |  | 873 |   | 
        
           |  |  | 874 |         // check if this module requires one the other supersedes
 | 
        
           |  |  | 875 |         s = other.supersedes;
 | 
        
           |  |  | 876 |         if (s) {
 | 
        
           |  |  | 877 |             for (i = 0; i < s.length; i++) {
 | 
        
           |  |  | 878 |                 if (this._requires(mod1, s[i])) {
 | 
        
           |  |  | 879 |                     return true;
 | 
        
           |  |  | 880 |                 }
 | 
        
           |  |  | 881 |             }
 | 
        
           |  |  | 882 |         }
 | 
        
           |  |  | 883 |   | 
        
           |  |  | 884 |         s = m.supersedes;
 | 
        
           |  |  | 885 |         if (s) {
 | 
        
           |  |  | 886 |             for (i = 0; i < s.length; i++) {
 | 
        
           |  |  | 887 |                 if (this._requires(mod2, s[i])) {
 | 
        
           |  |  | 888 |                     return false;
 | 
        
           |  |  | 889 |                 }
 | 
        
           |  |  | 890 |             }
 | 
        
           |  |  | 891 |         }
 | 
        
           |  |  | 892 |   | 
        
           |  |  | 893 |         // check if this module requires the other directly
 | 
        
           |  |  | 894 |         // if (r && yArray.indexOf(r, mod2) > -1) {
 | 
        
           |  |  | 895 |         if (rm && (mod2 in rm)) {
 | 
        
           |  |  | 896 |             return true;
 | 
        
           |  |  | 897 |         }
 | 
        
           |  |  | 898 |   | 
        
           |  |  | 899 |         // external css files should be sorted below yui css
 | 
        
           |  |  | 900 |         if (m.ext && m.type === CSS && !other.ext && other.type === CSS) {
 | 
        
           |  |  | 901 |             return true;
 | 
        
           |  |  | 902 |         }
 | 
        
           |  |  | 903 |   | 
        
           |  |  | 904 |         return false;
 | 
        
           |  |  | 905 |     },
 | 
        
           |  |  | 906 |     /**
 | 
        
           |  |  | 907 |     * Apply a new config to the Loader instance
 | 
        
           |  |  | 908 |     * @method _config
 | 
        
           |  |  | 909 |     * @private
 | 
        
           |  |  | 910 |     * @param {Object} o The new configuration
 | 
        
           |  |  | 911 |     */
 | 
        
           |  |  | 912 |     _config: function(o) {
 | 
        
           |  |  | 913 |         var i, j, val, a, f, group, groupName, self = this,
 | 
        
           |  |  | 914 |             mods = [], mod, modInfo;
 | 
        
           |  |  | 915 |         // apply config values
 | 
        
           |  |  | 916 |         if (o) {
 | 
        
           |  |  | 917 |             for (i in o) {
 | 
        
           |  |  | 918 |                 if (o.hasOwnProperty(i)) {
 | 
        
           |  |  | 919 |                     val = o[i];
 | 
        
           |  |  | 920 |                     //TODO This should be a case
 | 
        
           |  |  | 921 |                     if (i === 'require') {
 | 
        
           |  |  | 922 |                         self.require(val);
 | 
        
           |  |  | 923 |                     } else if (i === 'skin') {
 | 
        
           |  |  | 924 |                         //If the config.skin is a string, format to the expected object
 | 
        
           |  |  | 925 |                         if (typeof val === 'string') {
 | 
        
           |  |  | 926 |                             self.skin.defaultSkin = o.skin;
 | 
        
           |  |  | 927 |                             val = {
 | 
        
           |  |  | 928 |                                 defaultSkin: val
 | 
        
           |  |  | 929 |                             };
 | 
        
           |  |  | 930 |                         }
 | 
        
           |  |  | 931 |   | 
        
           |  |  | 932 |                         Y.mix(self.skin, val, true);
 | 
        
           |  |  | 933 |                     } else if (i === 'groups') {
 | 
        
           |  |  | 934 |                         for (j in val) {
 | 
        
           |  |  | 935 |                             if (val.hasOwnProperty(j)) {
 | 
        
           |  |  | 936 |                                 groupName = j;
 | 
        
           |  |  | 937 |                                 group = val[j];
 | 
        
           |  |  | 938 |                                 self.addGroup(group, groupName);
 | 
        
           |  |  | 939 |                                 if (group.aliases) {
 | 
        
           |  |  | 940 |                                     for (a in group.aliases) {
 | 
        
           |  |  | 941 |                                         if (group.aliases.hasOwnProperty(a)) {
 | 
        
           |  |  | 942 |                                             self.addAlias(group.aliases[a], a);
 | 
        
           |  |  | 943 |                                         }
 | 
        
           |  |  | 944 |                                     }
 | 
        
           |  |  | 945 |                                 }
 | 
        
           |  |  | 946 |                             }
 | 
        
           |  |  | 947 |                         }
 | 
        
           |  |  | 948 |   | 
        
           |  |  | 949 |                     } else if (i === 'modules') {
 | 
        
           |  |  | 950 |                         // add a hash of module definitions
 | 
        
           |  |  | 951 |                         for (j in val) {
 | 
        
           |  |  | 952 |                             if (val.hasOwnProperty(j)) {
 | 
        
           |  |  | 953 |                                 self.addModule(val[j], j);
 | 
        
           |  |  | 954 |                             }
 | 
        
           |  |  | 955 |                         }
 | 
        
           |  |  | 956 |                     } else if (i === 'aliases') {
 | 
        
           |  |  | 957 |                         for (j in val) {
 | 
        
           |  |  | 958 |                             if (val.hasOwnProperty(j)) {
 | 
        
           |  |  | 959 |                                 self.addAlias(val[j], j);
 | 
        
           |  |  | 960 |                             }
 | 
        
           |  |  | 961 |                         }
 | 
        
           |  |  | 962 |                     } else if (i === 'gallery') {
 | 
        
           |  |  | 963 |                         if (this.groups.gallery.update) {
 | 
        
           |  |  | 964 |                             this.groups.gallery.update(val, o);
 | 
        
           |  |  | 965 |                         }
 | 
        
           |  |  | 966 |                     } else if (i === 'yui2' || i === '2in3') {
 | 
        
           |  |  | 967 |                         if (this.groups.yui2.update) {
 | 
        
           |  |  | 968 |                             this.groups.yui2.update(o['2in3'], o.yui2, o);
 | 
        
           |  |  | 969 |                         }
 | 
        
           |  |  | 970 |                     } else {
 | 
        
           |  |  | 971 |                         self[i] = val;
 | 
        
           |  |  | 972 |                     }
 | 
        
           |  |  | 973 |                 }
 | 
        
           |  |  | 974 |             }
 | 
        
           |  |  | 975 |         }
 | 
        
           |  |  | 976 |   | 
        
           |  |  | 977 |         // fix filter
 | 
        
           |  |  | 978 |         f = self.filter;
 | 
        
           |  |  | 979 |   | 
        
           |  |  | 980 |         if (L.isString(f)) {
 | 
        
           |  |  | 981 |             f = f.toUpperCase();
 | 
        
           |  |  | 982 |             self.filterName = f;
 | 
        
           |  |  | 983 |             self.filter = self.FILTER_DEFS[f];
 | 
        
           |  |  | 984 |             if (f === 'DEBUG') {
 | 
        
           |  |  | 985 |                 self.require('yui-log', 'dump');
 | 
        
           |  |  | 986 |             }
 | 
        
           |  |  | 987 |         }
 | 
        
           |  |  | 988 |   | 
        
           |  |  | 989 |         if (self.filterName && self.coverage) {
 | 
        
           |  |  | 990 |             if (self.filterName === 'COVERAGE' && L.isArray(self.coverage) && self.coverage.length) {
 | 
        
           |  |  | 991 |                 for (i = 0; i < self.coverage.length; i++) {
 | 
        
           |  |  | 992 |                     mod = self.coverage[i];
 | 
        
           |  |  | 993 |                     modInfo = self.getModuleInfo(mod);
 | 
        
           |  |  | 994 |                     if (modInfo && modInfo.use) {
 | 
        
           |  |  | 995 |                         mods = mods.concat(modInfo.use);
 | 
        
           |  |  | 996 |                     } else {
 | 
        
           |  |  | 997 |                         mods.push(mod);
 | 
        
           |  |  | 998 |                     }
 | 
        
           |  |  | 999 |                 }
 | 
        
           |  |  | 1000 |                 self.filters = self.filters || {};
 | 
        
           |  |  | 1001 |                 Y.Array.each(mods, function(mod) {
 | 
        
           |  |  | 1002 |                     self.filters[mod] = self.FILTER_DEFS.COVERAGE;
 | 
        
           |  |  | 1003 |                 });
 | 
        
           |  |  | 1004 |                 self.filterName = 'RAW';
 | 
        
           |  |  | 1005 |                 self.filter = self.FILTER_DEFS[self.filterName];
 | 
        
           |  |  | 1006 |             }
 | 
        
           |  |  | 1007 |         }
 | 
        
           |  |  | 1008 |   | 
        
           |  |  | 1009 |     },
 | 
        
           |  |  | 1010 |   | 
        
           |  |  | 1011 |     /**
 | 
        
           |  |  | 1012 |      * Returns the skin module name for the specified skin name.  If a
 | 
        
           |  |  | 1013 |      * module name is supplied, the returned skin module name is
 | 
        
           |  |  | 1014 |      * specific to the module passed in.
 | 
        
           |  |  | 1015 |      * @method formatSkin
 | 
        
           |  |  | 1016 |      * @param {string} skin the name of the skin.
 | 
        
           |  |  | 1017 |      * @param {string} mod optional: the name of a module to skin.
 | 
        
           |  |  | 1018 |      * @return {string} the full skin module name.
 | 
        
           |  |  | 1019 |      */
 | 
        
           |  |  | 1020 |     formatSkin: function(skin, mod) {
 | 
        
           |  |  | 1021 |         var s = SKIN_PREFIX + skin;
 | 
        
           |  |  | 1022 |         if (mod) {
 | 
        
           |  |  | 1023 |             s = s + '-' + mod;
 | 
        
           |  |  | 1024 |         }
 | 
        
           |  |  | 1025 |   | 
        
           |  |  | 1026 |         return s;
 | 
        
           |  |  | 1027 |     },
 | 
        
           |  |  | 1028 |   | 
        
           |  |  | 1029 |     /**
 | 
        
           |  |  | 1030 |      * Adds the skin def to the module info
 | 
        
           |  |  | 1031 |      * @method _addSkin
 | 
        
           |  |  | 1032 |      * @param {string} skin the name of the skin.
 | 
        
           |  |  | 1033 |      * @param {string} mod the name of the module.
 | 
        
           |  |  | 1034 |      * @param {string} parent parent module if this is a skin of a
 | 
        
           |  |  | 1035 |      * submodule or plugin.
 | 
        
           |  |  | 1036 |      * @return {string} the module name for the skin.
 | 
        
           |  |  | 1037 |      * @private
 | 
        
           |  |  | 1038 |      */
 | 
        
           |  |  | 1039 |     _addSkin: function(skin, mod, parent) {
 | 
        
           |  |  | 1040 |         var pkg, name, nmod,
 | 
        
           |  |  | 1041 |             sinf = this.skin,
 | 
        
           |  |  | 1042 |             mdef = mod && this.getModuleInfo(mod),
 | 
        
           |  |  | 1043 |             ext = mdef && mdef.ext;
 | 
        
           |  |  | 1044 |   | 
        
           |  |  | 1045 |         // Add a module definition for the module-specific skin css
 | 
        
           |  |  | 1046 |         if (mod) {
 | 
        
           |  |  | 1047 |             name = this.formatSkin(skin, mod);
 | 
        
           |  |  | 1048 |             if (!this.getModuleInfo(name)) {
 | 
        
           |  |  | 1049 |                 pkg = mdef.pkg || mod;
 | 
        
           |  |  | 1050 |                 nmod = {
 | 
        
           |  |  | 1051 |                     skin: true,
 | 
        
           |  |  | 1052 |                     name: name,
 | 
        
           |  |  | 1053 |                     group: mdef.group,
 | 
        
           |  |  | 1054 |                     type: 'css',
 | 
        
           |  |  | 1055 |                     after: sinf.after,
 | 
        
           |  |  | 1056 |                     path: (parent || pkg) + '/' + sinf.base + skin +
 | 
        
           |  |  | 1057 |                           '/' + mod + '.css',
 | 
        
           |  |  | 1058 |                     ext: ext
 | 
        
           |  |  | 1059 |                 };
 | 
        
           |  |  | 1060 |                 if (mdef.base) {
 | 
        
           |  |  | 1061 |                     nmod.base = mdef.base;
 | 
        
           |  |  | 1062 |                 }
 | 
        
           |  |  | 1063 |                 if (mdef.configFn) {
 | 
        
           |  |  | 1064 |                     nmod.configFn = mdef.configFn;
 | 
        
           |  |  | 1065 |                 }
 | 
        
           |  |  | 1066 |                 this.addModule(nmod, name);
 | 
        
           |  |  | 1067 |   | 
        
           |  |  | 1068 |             }
 | 
        
           |  |  | 1069 |         }
 | 
        
           |  |  | 1070 |   | 
        
           |  |  | 1071 |         return name;
 | 
        
           |  |  | 1072 |     },
 | 
        
           |  |  | 1073 |     /**
 | 
        
           |  |  | 1074 |     * Adds an alias module to the system
 | 
        
           |  |  | 1075 |     * @method addAlias
 | 
        
           |  |  | 1076 |     * @param {Array} use An array of modules that makes up this alias
 | 
        
           |  |  | 1077 |     * @param {String} name The name of the alias
 | 
        
           |  |  | 1078 |     * @example
 | 
        
           |  |  | 1079 |     *       var loader = new Y.Loader({});
 | 
        
           |  |  | 1080 |     *       loader.addAlias([ 'node', 'yql' ], 'davglass');
 | 
        
           |  |  | 1081 |     *       loader.require(['davglass']);
 | 
        
           |  |  | 1082 |     *       var out = loader.resolve(true);
 | 
        
           |  |  | 1083 |     *
 | 
        
           |  |  | 1084 |     *       //out.js will contain Node and YQL modules
 | 
        
           |  |  | 1085 |     */
 | 
        
           |  |  | 1086 |     addAlias: function(use, name) {
 | 
        
           |  |  | 1087 |         YUI.Env.aliases[name] = use;
 | 
        
           |  |  | 1088 |         this.addModule({
 | 
        
           |  |  | 1089 |             name: name,
 | 
        
           |  |  | 1090 |             use: use
 | 
        
           |  |  | 1091 |         });
 | 
        
           |  |  | 1092 |     },
 | 
        
           |  |  | 1093 |     /**
 | 
        
           |  |  | 1094 |      * Add a new module group
 | 
        
           |  |  | 1095 |      * @method addGroup
 | 
        
           |  |  | 1096 |      * @param {Object} config An object containing the group configuration data
 | 
        
           |  |  | 1097 |      * @param {String} config.name required, the group name
 | 
        
           |  |  | 1098 |      * @param {String} config.base The base directory for this module group
 | 
        
           |  |  | 1099 |      * @param {String} config.root The root path to add to each combo resource path
 | 
        
           |  |  | 1100 |      * @param {Boolean} config.combine Should the request be combined
 | 
        
           |  |  | 1101 |      * @param {String} config.comboBase Combo service base path
 | 
        
           |  |  | 1102 |      * @param {Object} config.modules The group of modules
 | 
        
           |  |  | 1103 |      * @param {String} name the group name.
 | 
        
           |  |  | 1104 |      * @example
 | 
        
           |  |  | 1105 |      *      var loader = new Y.Loader({});
 | 
        
           |  |  | 1106 |      *      loader.addGroup({
 | 
        
           |  |  | 1107 |      *          name: 'davglass',
 | 
        
           |  |  | 1108 |      *          combine: true,
 | 
        
           |  |  | 1109 |      *          comboBase: '/combo?',
 | 
        
           |  |  | 1110 |      *          root: '',
 | 
        
           |  |  | 1111 |      *          modules: {
 | 
        
           |  |  | 1112 |      *              //Module List here
 | 
        
           |  |  | 1113 |      *          }
 | 
        
           |  |  | 1114 |      *      }, 'davglass');
 | 
        
           |  |  | 1115 |      */
 | 
        
           |  |  | 1116 |     addGroup: function(o, name) {
 | 
        
           |  |  | 1117 |         var mods = o.modules,
 | 
        
           |  |  | 1118 |             self = this,
 | 
        
           |  |  | 1119 |             defaultBase = o.defaultBase || Y.config.defaultBase,
 | 
        
           |  |  | 1120 |             i, v;
 | 
        
           |  |  | 1121 |   | 
        
           |  |  | 1122 |         name = name || o.name;
 | 
        
           |  |  | 1123 |         o.name = name;
 | 
        
           |  |  | 1124 |         self.groups[name] = o;
 | 
        
           |  |  | 1125 |   | 
        
           |  |  | 1126 |         if (!o.base && defaultBase && o.root) {
 | 
        
           |  |  | 1127 |             o.base = defaultBase + o.root;
 | 
        
           |  |  | 1128 |         }
 | 
        
           |  |  | 1129 |   | 
        
           |  |  | 1130 |         if (o.patterns) {
 | 
        
           |  |  | 1131 |             for (i in o.patterns) {
 | 
        
           |  |  | 1132 |                 if (o.patterns.hasOwnProperty(i)) {
 | 
        
           |  |  | 1133 |                     o.patterns[i].group = name;
 | 
        
           |  |  | 1134 |                     self.patterns[i] = o.patterns[i];
 | 
        
           |  |  | 1135 |                 }
 | 
        
           |  |  | 1136 |             }
 | 
        
           |  |  | 1137 |         }
 | 
        
           |  |  | 1138 |   | 
        
           |  |  | 1139 |         if (mods) {
 | 
        
           |  |  | 1140 |             for (i in mods) {
 | 
        
           |  |  | 1141 |                 if (mods.hasOwnProperty(i)) {
 | 
        
           |  |  | 1142 |                     v = mods[i];
 | 
        
           |  |  | 1143 |                     if (typeof v === 'string') {
 | 
        
           |  |  | 1144 |                         v = { name: i, fullpath: v };
 | 
        
           |  |  | 1145 |                     }
 | 
        
           |  |  | 1146 |                     v.group = name;
 | 
        
           |  |  | 1147 |                     self.addModule(v, i);
 | 
        
           |  |  | 1148 |                 }
 | 
        
           |  |  | 1149 |             }
 | 
        
           |  |  | 1150 |         }
 | 
        
           |  |  | 1151 |     },
 | 
        
           |  |  | 1152 |   | 
        
           |  |  | 1153 |     /**
 | 
        
           |  |  | 1154 |      * Add a new module to the component metadata.
 | 
        
           |  |  | 1155 |      * @method addModule
 | 
        
           |  |  | 1156 |      * @param {Object} config An object containing the module data.
 | 
        
           |  |  | 1157 |      * @param {String} config.name Required, the component name
 | 
        
           |  |  | 1158 |      * @param {String} config.type Required, the component type (js or css)
 | 
        
           |  |  | 1159 |      * @param {String} config.path Required, the path to the script from `base`
 | 
        
           |  |  | 1160 |      * @param {Array} config.requires Array of modules required by this component
 | 
        
           |  |  | 1161 |      * @param {Array} [config.optional] Array of optional modules for this component
 | 
        
           |  |  | 1162 |      * @param {Array} [config.supersedes] Array of the modules this component replaces
 | 
        
           |  |  | 1163 |      * @param {Array} [config.after] Array of modules the components which, if present, should be sorted above this one
 | 
        
           |  |  | 1164 |      * @param {Object} [config.after_map] Faster alternative to 'after' -- supply a hash instead of an array
 | 
        
           |  |  | 1165 |      * @param {Number} [config.rollup] The number of superseded modules required for automatic rollup
 | 
        
           |  |  | 1166 |      * @param {String} [config.fullpath] If `fullpath` is specified, this is used instead of the configured `base + path`
 | 
        
           |  |  | 1167 |      * @param {Boolean} [config.skinnable] Flag to determine if skin assets should automatically be pulled in
 | 
        
           |  |  | 1168 |      * @param {Object} [config.submodules] Hash of submodules
 | 
        
           |  |  | 1169 |      * @param {String} [config.group] The group the module belongs to -- this is set automatically when it is added as part of a group configuration.
 | 
        
           |  |  | 1170 |      * @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"]`
 | 
        
           |  |  | 1171 |      * @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:
 | 
        
           |  |  | 1172 |      * @param {String} [config.condition.trigger] The name of a module that can trigger the auto-load
 | 
        
           |  |  | 1173 |      * @param {Function} [config.condition.test] A function that returns true when the module is to be loaded.
 | 
        
           |  |  | 1174 |      * @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"`.
 | 
        
           |  |  | 1175 |      * @param {String} [config.condition.when] Specifies the load order of the conditional module
 | 
        
           |  |  | 1176 |      *  with regard to the position of the trigger module.
 | 
        
           |  |  | 1177 |      *  This should be one of three values: `before`, `after`, or `instead`.  The default is `after`.
 | 
        
           |  |  | 1178 |      * @param {Object} [config.testresults] A hash of test results from `Y.Features.all()`
 | 
        
           |  |  | 1179 |      * @param {Function} [config.configFn] A function to exectute when configuring this module
 | 
        
           |  |  | 1180 |      * @param {Object} config.configFn.mod The module config, modifying this object will modify it's config. Returning false will delete the module's config.
 | 
        
           |  |  | 1181 |      * @param {String[]} [config.optionalRequires] List of dependencies that
 | 
        
           |  |  | 1182 |         may optionally be loaded by this loader. This is targeted mostly at
 | 
        
           |  |  | 1183 |         polyfills, since they should not be in the list of requires because
 | 
        
           |  |  | 1184 |         polyfills are assumed to be available in the global scope.
 | 
        
           |  |  | 1185 |      * @param {Function} [config.test] Test to be called when this module is
 | 
        
           |  |  | 1186 |         added as an optional dependency of another module. If the test function
 | 
        
           |  |  | 1187 |         returns `false`, the module will be ignored and will not be attached to
 | 
        
           |  |  | 1188 |         this YUI instance.
 | 
        
           |  |  | 1189 |      * @param {String} [name] The module name, required if not in the module data.
 | 
        
           |  |  | 1190 |      * @return {Object} the module definition or null if the object passed in did not provide all required attributes.
 | 
        
           |  |  | 1191 |      */
 | 
        
           |  |  | 1192 |     addModule: function(o, name) {
 | 
        
           |  |  | 1193 |         name = name || o.name;
 | 
        
           |  |  | 1194 |   | 
        
           |  |  | 1195 |         if (typeof o === 'string') {
 | 
        
           |  |  | 1196 |             o = { name: name, fullpath: o };
 | 
        
           |  |  | 1197 |         }
 | 
        
           |  |  | 1198 |   | 
        
           |  |  | 1199 |   | 
        
           |  |  | 1200 |         var subs, i, l, t, sup, s, smod, plugins, plug,
 | 
        
           |  |  | 1201 |             j, langs, packName, supName, flatSup, flatLang, lang, ret,
 | 
        
           |  |  | 1202 |             overrides, skinname, when, g, p,
 | 
        
           |  |  | 1203 |             modInfo = this.moduleInfo[name],
 | 
        
           |  |  | 1204 |             conditions = this.conditions, trigger;
 | 
        
           |  |  | 1205 |   | 
        
           |  |  | 1206 |         //Only merge this data if the temp flag is set
 | 
        
           |  |  | 1207 |         //from an earlier pass from a pattern or else
 | 
        
           |  |  | 1208 |         //an override module (YUI_config) can not be used to
 | 
        
           |  |  | 1209 |         //replace a default module.
 | 
        
           |  |  | 1210 |         if (modInfo && modInfo.temp) {
 | 
        
           |  |  | 1211 |             //This catches temp modules loaded via a pattern
 | 
        
           |  |  | 1212 |             // The module will be added twice, once from the pattern and
 | 
        
           |  |  | 1213 |             // Once from the actual add call, this ensures that properties
 | 
        
           |  |  | 1214 |             // that were added to the module the first time around (group: gallery)
 | 
        
           |  |  | 1215 |             // are also added the second time around too.
 | 
        
           |  |  | 1216 |             o = Y.merge(modInfo, o);
 | 
        
           |  |  | 1217 |         }
 | 
        
           |  |  | 1218 |   | 
        
           |  |  | 1219 |         o.name = name;
 | 
        
           |  |  | 1220 |   | 
        
           |  |  | 1221 |         if (!o || !o.name) {
 | 
        
           |  |  | 1222 |             return null;
 | 
        
           |  |  | 1223 |         }
 | 
        
           |  |  | 1224 |   | 
        
           |  |  | 1225 |         if (!o.type) {
 | 
        
           |  |  | 1226 |             //Always assume it's javascript unless the CSS pattern is matched.
 | 
        
           |  |  | 1227 |             o.type = JS;
 | 
        
           |  |  | 1228 |             p = o.path || o.fullpath;
 | 
        
           |  |  | 1229 |             if (p && this.REGEX_CSS.test(p)) {
 | 
        
           |  |  | 1230 |                 o.type = CSS;
 | 
        
           |  |  | 1231 |             }
 | 
        
           |  |  | 1232 |         }
 | 
        
           |  |  | 1233 |   | 
        
           |  |  | 1234 |         if (!o.path && !o.fullpath) {
 | 
        
           |  |  | 1235 |             o.path = _path(name, name, o.type);
 | 
        
           |  |  | 1236 |         }
 | 
        
           |  |  | 1237 |         o.supersedes = o.supersedes || o.use;
 | 
        
           |  |  | 1238 |   | 
        
           |  |  | 1239 |         o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true;
 | 
        
           |  |  | 1240 |   | 
        
           |  |  | 1241 |         // Handle submodule logic
 | 
        
           |  |  | 1242 |         subs = o.submodules;
 | 
        
           |  |  | 1243 |   | 
        
           |  |  | 1244 |         this.moduleInfo[name] = o;
 | 
        
           |  |  | 1245 |   | 
        
           |  |  | 1246 |         o.requires = o.requires || [];
 | 
        
           |  |  | 1247 |   | 
        
           |  |  | 1248 |         /*
 | 
        
           |  |  | 1249 |         Only allowing the cascade of requires information, since
 | 
        
           |  |  | 1250 |         optional and supersedes are far more fine grained than
 | 
        
           |  |  | 1251 |         a blanket requires is.
 | 
        
           |  |  | 1252 |         */
 | 
        
           |  |  | 1253 |         if (this.requires) {
 | 
        
           |  |  | 1254 |             for (i = 0; i < this.requires.length; i++) {
 | 
        
           |  |  | 1255 |                 o.requires.push(this.requires[i]);
 | 
        
           |  |  | 1256 |             }
 | 
        
           |  |  | 1257 |         }
 | 
        
           |  |  | 1258 |         if (o.group && this.groups && this.groups[o.group]) {
 | 
        
           |  |  | 1259 |             g = this.groups[o.group];
 | 
        
           |  |  | 1260 |             if (g.requires) {
 | 
        
           |  |  | 1261 |                 for (i = 0; i < g.requires.length; i++) {
 | 
        
           |  |  | 1262 |                     o.requires.push(g.requires[i]);
 | 
        
           |  |  | 1263 |                 }
 | 
        
           |  |  | 1264 |             }
 | 
        
           |  |  | 1265 |         }
 | 
        
           |  |  | 1266 |   | 
        
           |  |  | 1267 |   | 
        
           |  |  | 1268 |         if (!o.defaults) {
 | 
        
           |  |  | 1269 |             o.defaults = {
 | 
        
           |  |  | 1270 |                 requires: o.requires ? [].concat(o.requires) : null,
 | 
        
           |  |  | 1271 |                 supersedes: o.supersedes ? [].concat(o.supersedes) : null,
 | 
        
           |  |  | 1272 |                 optional: o.optional ? [].concat(o.optional) : null
 | 
        
           |  |  | 1273 |             };
 | 
        
           |  |  | 1274 |         }
 | 
        
           |  |  | 1275 |   | 
        
           |  |  | 1276 |         if (o.skinnable && o.ext && o.temp) {
 | 
        
           |  |  | 1277 |             skinname = this._addSkin(this.skin.defaultSkin, name);
 | 
        
           |  |  | 1278 |             o.requires.unshift(skinname);
 | 
        
           |  |  | 1279 |         }
 | 
        
           |  |  | 1280 |   | 
        
           |  |  | 1281 |         if (o.requires.length) {
 | 
        
           |  |  | 1282 |             o.requires = this.filterRequires(o.requires) || [];
 | 
        
           |  |  | 1283 |         }
 | 
        
           |  |  | 1284 |   | 
        
           |  |  | 1285 |         if (!o.langPack && o.lang) {
 | 
        
           |  |  | 1286 |             langs = yArray(o.lang);
 | 
        
           |  |  | 1287 |             for (j = 0; j < langs.length; j++) {
 | 
        
           |  |  | 1288 |                 lang = langs[j];
 | 
        
           |  |  | 1289 |                 packName = this.getLangPackName(lang, name);
 | 
        
           |  |  | 1290 |                 smod = this.getModuleInfo(packName);
 | 
        
           |  |  | 1291 |                 if (!smod) {
 | 
        
           |  |  | 1292 |                     smod = this._addLangPack(lang, o, packName);
 | 
        
           |  |  | 1293 |                 }
 | 
        
           |  |  | 1294 |             }
 | 
        
           |  |  | 1295 |         }
 | 
        
           |  |  | 1296 |   | 
        
           |  |  | 1297 |   | 
        
           |  |  | 1298 |         if (subs) {
 | 
        
           |  |  | 1299 |             sup = o.supersedes || [];
 | 
        
           |  |  | 1300 |             l = 0;
 | 
        
           |  |  | 1301 |   | 
        
           |  |  | 1302 |             for (i in subs) {
 | 
        
           |  |  | 1303 |                 if (subs.hasOwnProperty(i)) {
 | 
        
           |  |  | 1304 |                     s = subs[i];
 | 
        
           |  |  | 1305 |   | 
        
           |  |  | 1306 |                     s.path = s.path || _path(name, i, o.type);
 | 
        
           |  |  | 1307 |                     s.pkg = name;
 | 
        
           |  |  | 1308 |                     s.group = o.group;
 | 
        
           |  |  | 1309 |   | 
        
           |  |  | 1310 |                     if (s.supersedes) {
 | 
        
           |  |  | 1311 |                         sup = sup.concat(s.supersedes);
 | 
        
           |  |  | 1312 |                     }
 | 
        
           |  |  | 1313 |   | 
        
           |  |  | 1314 |                     smod = this.addModule(s, i);
 | 
        
           |  |  | 1315 |                     sup.push(i);
 | 
        
           |  |  | 1316 |   | 
        
           |  |  | 1317 |                     if (smod.skinnable) {
 | 
        
           |  |  | 1318 |                         o.skinnable = true;
 | 
        
           |  |  | 1319 |                         overrides = this.skin.overrides;
 | 
        
           |  |  | 1320 |                         if (overrides && overrides[i]) {
 | 
        
           |  |  | 1321 |                             for (j = 0; j < overrides[i].length; j++) {
 | 
        
           |  |  | 1322 |                                 skinname = this._addSkin(overrides[i][j],
 | 
        
           |  |  | 1323 |                                          i, name);
 | 
        
           |  |  | 1324 |                                 sup.push(skinname);
 | 
        
           |  |  | 1325 |                             }
 | 
        
           |  |  | 1326 |                         }
 | 
        
           |  |  | 1327 |                         skinname = this._addSkin(this.skin.defaultSkin,
 | 
        
           |  |  | 1328 |                                         i, name);
 | 
        
           |  |  | 1329 |                         sup.push(skinname);
 | 
        
           |  |  | 1330 |                     }
 | 
        
           |  |  | 1331 |   | 
        
           |  |  | 1332 |                     // looks like we are expected to work out the metadata
 | 
        
           |  |  | 1333 |                     // for the parent module language packs from what is
 | 
        
           |  |  | 1334 |                     // specified in the child modules.
 | 
        
           |  |  | 1335 |                     if (s.lang && s.lang.length) {
 | 
        
           |  |  | 1336 |   | 
        
           |  |  | 1337 |                         langs = yArray(s.lang);
 | 
        
           |  |  | 1338 |                         for (j = 0; j < langs.length; j++) {
 | 
        
           |  |  | 1339 |                             lang = langs[j];
 | 
        
           |  |  | 1340 |                             packName = this.getLangPackName(lang, name);
 | 
        
           |  |  | 1341 |                             supName = this.getLangPackName(lang, i);
 | 
        
           |  |  | 1342 |                             smod = this.getModuleInfo(packName);
 | 
        
           |  |  | 1343 |   | 
        
           |  |  | 1344 |                             if (!smod) {
 | 
        
           |  |  | 1345 |                                 smod = this._addLangPack(lang, o, packName);
 | 
        
           |  |  | 1346 |                             }
 | 
        
           |  |  | 1347 |   | 
        
           |  |  | 1348 |                             flatSup = flatSup || yArray.hash(smod.supersedes);
 | 
        
           |  |  | 1349 |   | 
        
           |  |  | 1350 |                             if (!(supName in flatSup)) {
 | 
        
           |  |  | 1351 |                                 smod.supersedes.push(supName);
 | 
        
           |  |  | 1352 |                             }
 | 
        
           |  |  | 1353 |   | 
        
           |  |  | 1354 |                             o.lang = o.lang || [];
 | 
        
           |  |  | 1355 |   | 
        
           |  |  | 1356 |                             flatLang = flatLang || yArray.hash(o.lang);
 | 
        
           |  |  | 1357 |   | 
        
           |  |  | 1358 |                             if (!(lang in flatLang)) {
 | 
        
           |  |  | 1359 |                                 o.lang.push(lang);
 | 
        
           |  |  | 1360 |                             }
 | 
        
           |  |  | 1361 |   | 
        
           |  |  | 1362 | // Add rollup file, need to add to supersedes list too
 | 
        
           |  |  | 1363 |   | 
        
           |  |  | 1364 |                             // default packages
 | 
        
           |  |  | 1365 |                             packName = this.getLangPackName(ROOT_LANG, name);
 | 
        
           |  |  | 1366 |                             supName = this.getLangPackName(ROOT_LANG, i);
 | 
        
           |  |  | 1367 |   | 
        
           |  |  | 1368 |                             smod = this.getModuleInfo(packName);
 | 
        
           |  |  | 1369 |   | 
        
           |  |  | 1370 |                             if (!smod) {
 | 
        
           |  |  | 1371 |                                 smod = this._addLangPack(lang, o, packName);
 | 
        
           |  |  | 1372 |                             }
 | 
        
           |  |  | 1373 |   | 
        
           |  |  | 1374 |                             if (!(supName in flatSup)) {
 | 
        
           |  |  | 1375 |                                 smod.supersedes.push(supName);
 | 
        
           |  |  | 1376 |                             }
 | 
        
           |  |  | 1377 |   | 
        
           |  |  | 1378 | // Add rollup file, need to add to supersedes list too
 | 
        
           |  |  | 1379 |   | 
        
           |  |  | 1380 |                         }
 | 
        
           |  |  | 1381 |                     }
 | 
        
           |  |  | 1382 |   | 
        
           |  |  | 1383 |                     l++;
 | 
        
           |  |  | 1384 |                 }
 | 
        
           |  |  | 1385 |             }
 | 
        
           |  |  | 1386 |             //o.supersedes = YObject.keys(yArray.hash(sup));
 | 
        
           |  |  | 1387 |             o.supersedes = yArray.dedupe(sup);
 | 
        
           |  |  | 1388 |             if (this.allowRollup) {
 | 
        
           |  |  | 1389 |                 o.rollup = (l < 4) ? l : Math.min(l - 1, 4);
 | 
        
           |  |  | 1390 |             }
 | 
        
           |  |  | 1391 |         }
 | 
        
           |  |  | 1392 |   | 
        
           |  |  | 1393 |         plugins = o.plugins;
 | 
        
           |  |  | 1394 |         if (plugins) {
 | 
        
           |  |  | 1395 |             for (i in plugins) {
 | 
        
           |  |  | 1396 |                 if (plugins.hasOwnProperty(i)) {
 | 
        
           |  |  | 1397 |                     plug = plugins[i];
 | 
        
           |  |  | 1398 |                     plug.pkg = name;
 | 
        
           |  |  | 1399 |                     plug.path = plug.path || _path(name, i, o.type);
 | 
        
           |  |  | 1400 |                     plug.requires = plug.requires || [];
 | 
        
           |  |  | 1401 |                     plug.group = o.group;
 | 
        
           |  |  | 1402 |                     this.addModule(plug, i);
 | 
        
           |  |  | 1403 |                     if (o.skinnable) {
 | 
        
           |  |  | 1404 |                         this._addSkin(this.skin.defaultSkin, i, name);
 | 
        
           |  |  | 1405 |                     }
 | 
        
           |  |  | 1406 |   | 
        
           |  |  | 1407 |                 }
 | 
        
           |  |  | 1408 |             }
 | 
        
           |  |  | 1409 |         }
 | 
        
           |  |  | 1410 |   | 
        
           |  |  | 1411 |         if (o.condition) {
 | 
        
           |  |  | 1412 |             t = this._expandAliases(o.condition.trigger);
 | 
        
           |  |  | 1413 |             for (i = 0; i < t.length; i++) {
 | 
        
           |  |  | 1414 |                 trigger = t[i];
 | 
        
           |  |  | 1415 |                 when = o.condition.when;
 | 
        
           |  |  | 1416 |                 conditions[trigger] = conditions[trigger] || {};
 | 
        
           |  |  | 1417 |                 conditions[trigger][name] = o.condition;
 | 
        
           |  |  | 1418 |                 // the 'when' attribute can be 'before', 'after', or 'instead'
 | 
        
           |  |  | 1419 |                 // the default is after.
 | 
        
           |  |  | 1420 |                 if (when && when !== 'after') {
 | 
        
           |  |  | 1421 |                     if (when === 'instead') { // replace the trigger
 | 
        
           |  |  | 1422 |                         o.supersedes = o.supersedes || [];
 | 
        
           |  |  | 1423 |                         o.supersedes.push(trigger);
 | 
        
           |  |  | 1424 |                     }
 | 
        
           |  |  | 1425 |                     // before the trigger
 | 
        
           |  |  | 1426 |                         // the trigger requires the conditional mod,
 | 
        
           |  |  | 1427 |                         // so it should appear before the conditional
 | 
        
           |  |  | 1428 |                         // mod if we do not intersede.
 | 
        
           |  |  | 1429 |                 } else { // after the trigger
 | 
        
           |  |  | 1430 |                     o.after = o.after || [];
 | 
        
           |  |  | 1431 |                     o.after.push(trigger);
 | 
        
           |  |  | 1432 |                 }
 | 
        
           |  |  | 1433 |             }
 | 
        
           |  |  | 1434 |         }
 | 
        
           |  |  | 1435 |   | 
        
           |  |  | 1436 |         if (o.supersedes) {
 | 
        
           |  |  | 1437 |             o.supersedes = this.filterRequires(o.supersedes);
 | 
        
           |  |  | 1438 |         }
 | 
        
           |  |  | 1439 |   | 
        
           |  |  | 1440 |         if (o.after) {
 | 
        
           |  |  | 1441 |             o.after = this.filterRequires(o.after);
 | 
        
           |  |  | 1442 |             o.after_map = yArray.hash(o.after);
 | 
        
           |  |  | 1443 |         }
 | 
        
           |  |  | 1444 |   | 
        
           |  |  | 1445 |         // this.dirty = true;
 | 
        
           |  |  | 1446 |   | 
        
           |  |  | 1447 |         if (o.configFn) {
 | 
        
           |  |  | 1448 |             ret = o.configFn(o);
 | 
        
           |  |  | 1449 |             if (ret === false) {
 | 
        
           |  |  | 1450 |                 delete this.moduleInfo[name];
 | 
        
           |  |  | 1451 |                 delete GLOBAL_ENV._renderedMods[name];
 | 
        
           |  |  | 1452 |                 o = null;
 | 
        
           |  |  | 1453 |             }
 | 
        
           |  |  | 1454 |         }
 | 
        
           |  |  | 1455 |         //Add to global cache
 | 
        
           |  |  | 1456 |         if (o) {
 | 
        
           |  |  | 1457 |             if (!GLOBAL_ENV._renderedMods) {
 | 
        
           |  |  | 1458 |                 GLOBAL_ENV._renderedMods = {};
 | 
        
           |  |  | 1459 |             }
 | 
        
           |  |  | 1460 |             GLOBAL_ENV._renderedMods[name] = Y.mix(GLOBAL_ENV._renderedMods[name] || {}, o);
 | 
        
           |  |  | 1461 |             GLOBAL_ENV._conditions = conditions;
 | 
        
           |  |  | 1462 |         }
 | 
        
           |  |  | 1463 |   | 
        
           |  |  | 1464 |         return o;
 | 
        
           |  |  | 1465 |     },
 | 
        
           |  |  | 1466 |   | 
        
           |  |  | 1467 |     /**
 | 
        
           |  |  | 1468 |      * Add a requirement for one or more module
 | 
        
           |  |  | 1469 |      * @method require
 | 
        
           |  |  | 1470 |      * @param {string[] | string*} what the modules to load.
 | 
        
           |  |  | 1471 |      */
 | 
        
           |  |  | 1472 |     require: function(what) {
 | 
        
           |  |  | 1473 |         var a = (typeof what === 'string') ? yArray(arguments) : what;
 | 
        
           |  |  | 1474 |         this.dirty = true;
 | 
        
           |  |  | 1475 |         this.required = Y.merge(this.required, yArray.hash(this.filterRequires(a)));
 | 
        
           |  |  | 1476 |   | 
        
           |  |  | 1477 |         this._explodeRollups();
 | 
        
           |  |  | 1478 |     },
 | 
        
           |  |  | 1479 |     /**
 | 
        
           |  |  | 1480 |     * Grab all the items that were asked for, check to see if the Loader
 | 
        
           |  |  | 1481 |     * meta-data contains a "use" array. If it doesm remove the asked item and replace it with
 | 
        
           |  |  | 1482 |     * the content of the "use".
 | 
        
           |  |  | 1483 |     * This will make asking for: "dd"
 | 
        
           |  |  | 1484 |     * Actually ask for: "dd-ddm-base,dd-ddm,dd-ddm-drop,dd-drag,dd-proxy,dd-constrain,dd-drop,dd-scroll,dd-drop-plugin"
 | 
        
           |  |  | 1485 |     * @private
 | 
        
           |  |  | 1486 |     * @method _explodeRollups
 | 
        
           |  |  | 1487 |     */
 | 
        
           |  |  | 1488 |     _explodeRollups: function() {
 | 
        
           |  |  | 1489 |         var self = this, m, m2, i, a, v, len, len2,
 | 
        
           |  |  | 1490 |         r = self.required;
 | 
        
           |  |  | 1491 |   | 
        
           |  |  | 1492 |         if (!self.allowRollup) {
 | 
        
           |  |  | 1493 |             for (i in r) {
 | 
        
           |  |  | 1494 |                 if (r.hasOwnProperty(i)) {
 | 
        
           |  |  | 1495 |                     m = self.getModule(i);
 | 
        
           |  |  | 1496 |                     if (m && m.use) {
 | 
        
           |  |  | 1497 |                         len = m.use.length;
 | 
        
           |  |  | 1498 |                         for (a = 0; a < len; a++) {
 | 
        
           |  |  | 1499 |                             m2 = self.getModule(m.use[a]);
 | 
        
           |  |  | 1500 |                             if (m2 && m2.use) {
 | 
        
           |  |  | 1501 |                                 len2 = m2.use.length;
 | 
        
           |  |  | 1502 |                                 for (v = 0; v < len2; v++) {
 | 
        
           |  |  | 1503 |                                     r[m2.use[v]] = true;
 | 
        
           |  |  | 1504 |                                 }
 | 
        
           |  |  | 1505 |                             } else {
 | 
        
           |  |  | 1506 |                                 r[m.use[a]] = true;
 | 
        
           |  |  | 1507 |                             }
 | 
        
           |  |  | 1508 |                         }
 | 
        
           |  |  | 1509 |                     }
 | 
        
           |  |  | 1510 |                 }
 | 
        
           |  |  | 1511 |             }
 | 
        
           |  |  | 1512 |             self.required = r;
 | 
        
           |  |  | 1513 |         }
 | 
        
           |  |  | 1514 |   | 
        
           |  |  | 1515 |     },
 | 
        
           |  |  | 1516 |     /**
 | 
        
           |  |  | 1517 |     * Explodes the required array to remove aliases and replace them with real modules
 | 
        
           |  |  | 1518 |     * @method filterRequires
 | 
        
           |  |  | 1519 |     * @param {Array} r The original requires array
 | 
        
           |  |  | 1520 |     * @return {Array} The new array of exploded requirements
 | 
        
           |  |  | 1521 |     */
 | 
        
           |  |  | 1522 |     filterRequires: function(r) {
 | 
        
           |  |  | 1523 |         if (r) {
 | 
        
           |  |  | 1524 |             if (!Y.Lang.isArray(r)) {
 | 
        
           |  |  | 1525 |                 r = [r];
 | 
        
           |  |  | 1526 |             }
 | 
        
           |  |  | 1527 |             r = Y.Array(r);
 | 
        
           |  |  | 1528 |             var c = [], i, mod, o, m;
 | 
        
           |  |  | 1529 |   | 
        
           |  |  | 1530 |             for (i = 0; i < r.length; i++) {
 | 
        
           |  |  | 1531 |                 mod = this.getModule(r[i]);
 | 
        
           |  |  | 1532 |                 if (mod && mod.use) {
 | 
        
           |  |  | 1533 |                     for (o = 0; o < mod.use.length; o++) {
 | 
        
           |  |  | 1534 |                         //Must walk the other modules in case a module is a rollup of rollups (datatype)
 | 
        
           |  |  | 1535 |                         m = this.getModule(mod.use[o]);
 | 
        
           |  |  | 1536 |                         if (m && m.use && (m.name !== mod.name)) {
 | 
        
           |  |  | 1537 |                             c = Y.Array.dedupe([].concat(c, this.filterRequires(m.use)));
 | 
        
           |  |  | 1538 |                         } else {
 | 
        
           |  |  | 1539 |                             c.push(mod.use[o]);
 | 
        
           |  |  | 1540 |                         }
 | 
        
           |  |  | 1541 |                     }
 | 
        
           |  |  | 1542 |                 } else {
 | 
        
           |  |  | 1543 |                     c.push(r[i]);
 | 
        
           |  |  | 1544 |                 }
 | 
        
           |  |  | 1545 |             }
 | 
        
           |  |  | 1546 |             r = c;
 | 
        
           |  |  | 1547 |         }
 | 
        
           |  |  | 1548 |         return r;
 | 
        
           |  |  | 1549 |     },
 | 
        
           |  |  | 1550 |   | 
        
           |  |  | 1551 |     /**
 | 
        
           |  |  | 1552 |     Returns `true` if the module can be attached to the YUI instance. Runs
 | 
        
           |  |  | 1553 |     the module's test if there is one and caches its result.
 | 
        
           |  |  | 1554 |   | 
        
           |  |  | 1555 |     @method _canBeAttached
 | 
        
           |  |  | 1556 |     @param {String} module Name of the module to check.
 | 
        
           |  |  | 1557 |     @return {Boolean} Result of the module's test if it has one, or `true`.
 | 
        
           |  |  | 1558 |     **/
 | 
        
           |  |  | 1559 |     _canBeAttached: function (m) {
 | 
        
           |  |  | 1560 |         m = this.getModule(m);
 | 
        
           |  |  | 1561 |         if (m && m.test) {
 | 
        
           |  |  | 1562 |             if (!m.hasOwnProperty('_testResult')) {
 | 
        
           |  |  | 1563 |                 m._testResult = m.test(Y);
 | 
        
           |  |  | 1564 |             }
 | 
        
           |  |  | 1565 |             return m._testResult;
 | 
        
           |  |  | 1566 |         }
 | 
        
           |  |  | 1567 |         // return `true` for modules not registered as Loader will know what
 | 
        
           |  |  | 1568 |         // to do with them later on
 | 
        
           |  |  | 1569 |         return true;
 | 
        
           |  |  | 1570 |     },
 | 
        
           |  |  | 1571 |   | 
        
           |  |  | 1572 |     /**
 | 
        
           |  |  | 1573 |      * Returns an object containing properties for all modules required
 | 
        
           |  |  | 1574 |      * in order to load the requested module
 | 
        
           |  |  | 1575 |      * @method getRequires
 | 
        
           |  |  | 1576 |      * @param {object}  mod The module definition from moduleInfo.
 | 
        
           |  |  | 1577 |      * @return {array} the expanded requirement list.
 | 
        
           |  |  | 1578 |      */
 | 
        
           |  |  | 1579 |     getRequires: function(mod) {
 | 
        
           |  |  | 1580 |   | 
        
           |  |  | 1581 |         if (!mod) {
 | 
        
           |  |  | 1582 |             //console.log('returning no reqs for ' + mod.name);
 | 
        
           |  |  | 1583 |             return NO_REQUIREMENTS;
 | 
        
           |  |  | 1584 |         }
 | 
        
           |  |  | 1585 |   | 
        
           |  |  | 1586 |         if (mod._parsed) {
 | 
        
           |  |  | 1587 |             //console.log('returning requires for ' + mod.name, mod.requires);
 | 
        
           |  |  | 1588 |             return mod.expanded || NO_REQUIREMENTS;
 | 
        
           |  |  | 1589 |         }
 | 
        
           |  |  | 1590 |   | 
        
           |  |  | 1591 |         //TODO add modue cache here out of scope..
 | 
        
           |  |  | 1592 |   | 
        
           |  |  | 1593 |         var i, m, j, length, add, packName, lang, testresults = this.testresults,
 | 
        
           |  |  | 1594 |             name = mod.name, cond,
 | 
        
           |  |  | 1595 |             adddef = ON_PAGE[name] && ON_PAGE[name].details,
 | 
        
           |  |  | 1596 |             optReqs = mod.optionalRequires,
 | 
        
           |  |  | 1597 |             d, go, def,
 | 
        
           |  |  | 1598 |             r, old_mod,
 | 
        
           |  |  | 1599 |             o, skinmod, skindef, skinpar, skinname,
 | 
        
           |  |  | 1600 |             intl = mod.lang || mod.intl,
 | 
        
           |  |  | 1601 |             ftests = Y.Features && Y.Features.tests.load,
 | 
        
           |  |  | 1602 |             hash, reparse;
 | 
        
           |  |  | 1603 |   | 
        
           |  |  | 1604 |         // console.log(name);
 | 
        
           |  |  | 1605 |   | 
        
           |  |  | 1606 |         // pattern match leaves module stub that needs to be filled out
 | 
        
           |  |  | 1607 |         if (mod.temp && adddef) {
 | 
        
           |  |  | 1608 |             old_mod = mod;
 | 
        
           |  |  | 1609 |             mod = this.addModule(adddef, name);
 | 
        
           |  |  | 1610 |             mod.group = old_mod.group;
 | 
        
           |  |  | 1611 |             mod.pkg = old_mod.pkg;
 | 
        
           |  |  | 1612 |             delete mod.expanded;
 | 
        
           |  |  | 1613 |         }
 | 
        
           |  |  | 1614 |   | 
        
           |  |  | 1615 |         // console.log('cache: ' + mod.langCache + ' == ' + this.lang);
 | 
        
           |  |  | 1616 |   | 
        
           |  |  | 1617 |         //If a skin or a lang is different, reparse..
 | 
        
           |  |  | 1618 |         reparse = !((!this.lang || mod.langCache === this.lang) && (mod.skinCache === this.skin.defaultSkin));
 | 
        
           |  |  | 1619 |   | 
        
           |  |  | 1620 |         if (mod.expanded && !reparse) {
 | 
        
           |  |  | 1621 |             return mod.expanded;
 | 
        
           |  |  | 1622 |         }
 | 
        
           |  |  | 1623 |   | 
        
           |  |  | 1624 |         // Optional dependencies are dependencies that may or may not be
 | 
        
           |  |  | 1625 |         // available.
 | 
        
           |  |  | 1626 |         // This feature was designed specifically to be used when transpiling
 | 
        
           |  |  | 1627 |         // ES6 modules, in order to use polyfills and regular scripts that define
 | 
        
           |  |  | 1628 |         // global variables without having to import them since they should be
 | 
        
           |  |  | 1629 |         // available in the global scope.
 | 
        
           |  |  | 1630 |         if (optReqs) {
 | 
        
           |  |  | 1631 |             for (i = 0, length = optReqs.length; i < length; i++) {
 | 
        
           |  |  | 1632 |                 if (this._canBeAttached(optReqs[i])) {
 | 
        
           |  |  | 1633 |                     mod.requires.push(optReqs[i]);
 | 
        
           |  |  | 1634 |                 }
 | 
        
           |  |  | 1635 |             }
 | 
        
           |  |  | 1636 |         }
 | 
        
           |  |  | 1637 |   | 
        
           |  |  | 1638 |         d = [];
 | 
        
           |  |  | 1639 |         hash = {};
 | 
        
           |  |  | 1640 |         r = this.filterRequires(mod.requires);
 | 
        
           |  |  | 1641 |         if (mod.lang) {
 | 
        
           |  |  | 1642 |             //If a module has a lang attribute, auto add the intl requirement.
 | 
        
           |  |  | 1643 |             d.unshift('intl');
 | 
        
           |  |  | 1644 |             r.unshift('intl');
 | 
        
           |  |  | 1645 |             intl = true;
 | 
        
           |  |  | 1646 |         }
 | 
        
           |  |  | 1647 |         o = this.filterRequires(mod.optional);
 | 
        
           |  |  | 1648 |   | 
        
           |  |  | 1649 |   | 
        
           |  |  | 1650 |         mod._parsed = true;
 | 
        
           |  |  | 1651 |         mod.langCache = this.lang;
 | 
        
           |  |  | 1652 |         mod.skinCache = this.skin.defaultSkin;
 | 
        
           |  |  | 1653 |   | 
        
           |  |  | 1654 |         for (i = 0; i < r.length; i++) {
 | 
        
           |  |  | 1655 |             if (!hash[r[i]]) {
 | 
        
           |  |  | 1656 |                 d.push(r[i]);
 | 
        
           |  |  | 1657 |                 hash[r[i]] = true;
 | 
        
           |  |  | 1658 |                 m = this.getModule(r[i]);
 | 
        
           |  |  | 1659 |                 if (m) {
 | 
        
           |  |  | 1660 |                     add = this.getRequires(m);
 | 
        
           |  |  | 1661 |                     intl = intl || (m.expanded_map &&
 | 
        
           |  |  | 1662 |                         (INTL in m.expanded_map));
 | 
        
           |  |  | 1663 |                     for (j = 0; j < add.length; j++) {
 | 
        
           |  |  | 1664 |                         d.push(add[j]);
 | 
        
           |  |  | 1665 |                     }
 | 
        
           |  |  | 1666 |                 }
 | 
        
           |  |  | 1667 |             }
 | 
        
           |  |  | 1668 |         }
 | 
        
           |  |  | 1669 |   | 
        
           |  |  | 1670 |         // get the requirements from superseded modules, if any
 | 
        
           |  |  | 1671 |         r = this.filterRequires(mod.supersedes);
 | 
        
           |  |  | 1672 |         if (r) {
 | 
        
           |  |  | 1673 |             for (i = 0; i < r.length; i++) {
 | 
        
           |  |  | 1674 |                 if (!hash[r[i]]) {
 | 
        
           |  |  | 1675 |                     // if this module has submodules, the requirements list is
 | 
        
           |  |  | 1676 |                     // expanded to include the submodules.  This is so we can
 | 
        
           |  |  | 1677 |                     // prevent dups when a submodule is already loaded and the
 | 
        
           |  |  | 1678 |                     // parent is requested.
 | 
        
           |  |  | 1679 |                     if (mod.submodules) {
 | 
        
           |  |  | 1680 |                         d.push(r[i]);
 | 
        
           |  |  | 1681 |                     }
 | 
        
           |  |  | 1682 |   | 
        
           |  |  | 1683 |                     hash[r[i]] = true;
 | 
        
           |  |  | 1684 |                     m = this.getModule(r[i]);
 | 
        
           |  |  | 1685 |   | 
        
           |  |  | 1686 |                     if (m) {
 | 
        
           |  |  | 1687 |                         add = this.getRequires(m);
 | 
        
           |  |  | 1688 |                         intl = intl || (m.expanded_map &&
 | 
        
           |  |  | 1689 |                             (INTL in m.expanded_map));
 | 
        
           |  |  | 1690 |                         for (j = 0; j < add.length; j++) {
 | 
        
           |  |  | 1691 |                             d.push(add[j]);
 | 
        
           |  |  | 1692 |                         }
 | 
        
           |  |  | 1693 |                     }
 | 
        
           |  |  | 1694 |                 }
 | 
        
           |  |  | 1695 |             }
 | 
        
           |  |  | 1696 |         }
 | 
        
           |  |  | 1697 |   | 
        
           |  |  | 1698 |         if (o && this.loadOptional) {
 | 
        
           |  |  | 1699 |             for (i = 0; i < o.length; i++) {
 | 
        
           |  |  | 1700 |                 if (!hash[o[i]]) {
 | 
        
           |  |  | 1701 |                     d.push(o[i]);
 | 
        
           |  |  | 1702 |                     hash[o[i]] = true;
 | 
        
           |  |  | 1703 |                     m = this.getModuleInfo(o[i]);
 | 
        
           |  |  | 1704 |                     if (m) {
 | 
        
           |  |  | 1705 |                         add = this.getRequires(m);
 | 
        
           |  |  | 1706 |                         intl = intl || (m.expanded_map &&
 | 
        
           |  |  | 1707 |                             (INTL in m.expanded_map));
 | 
        
           |  |  | 1708 |                         for (j = 0; j < add.length; j++) {
 | 
        
           |  |  | 1709 |                             d.push(add[j]);
 | 
        
           |  |  | 1710 |                         }
 | 
        
           |  |  | 1711 |                     }
 | 
        
           |  |  | 1712 |                 }
 | 
        
           |  |  | 1713 |             }
 | 
        
           |  |  | 1714 |         }
 | 
        
           |  |  | 1715 |   | 
        
           |  |  | 1716 |         cond = this.conditions[name];
 | 
        
           |  |  | 1717 |   | 
        
           |  |  | 1718 |         if (cond) {
 | 
        
           |  |  | 1719 |             //Set the module to not parsed since we have conditionals and this could change the dependency tree.
 | 
        
           |  |  | 1720 |             mod._parsed = false;
 | 
        
           |  |  | 1721 |             if (testresults && ftests) {
 | 
        
           |  |  | 1722 |                 oeach(testresults, function(result, id) {
 | 
        
           |  |  | 1723 |                     var condmod = ftests[id].name;
 | 
        
           |  |  | 1724 |                     if (!hash[condmod] && ftests[id].trigger === name) {
 | 
        
           |  |  | 1725 |                         if (result && ftests[id]) {
 | 
        
           |  |  | 1726 |                             hash[condmod] = true;
 | 
        
           |  |  | 1727 |                             d.push(condmod);
 | 
        
           |  |  | 1728 |                         }
 | 
        
           |  |  | 1729 |                     }
 | 
        
           |  |  | 1730 |                 });
 | 
        
           |  |  | 1731 |             } else {
 | 
        
           |  |  | 1732 |                 for (i in cond) {
 | 
        
           |  |  | 1733 |                     if (cond.hasOwnProperty(i)) {
 | 
        
           |  |  | 1734 |                         if (!hash[i]) {
 | 
        
           |  |  | 1735 |                             def = cond[i];
 | 
        
           |  |  | 1736 |                             //first see if they've specfied a ua check
 | 
        
           |  |  | 1737 |                             //then see if they've got a test fn & if it returns true
 | 
        
           |  |  | 1738 |                             //otherwise just having a condition block is enough
 | 
        
           |  |  | 1739 |                             go = def && ((!def.ua && !def.test) || (def.ua && Y.UA[def.ua]) ||
 | 
        
           |  |  | 1740 |                                         (def.test && def.test(Y, r)));
 | 
        
           |  |  | 1741 |   | 
        
           |  |  | 1742 |                             if (go) {
 | 
        
           |  |  | 1743 |                                 hash[i] = true;
 | 
        
           |  |  | 1744 |                                 d.push(i);
 | 
        
           |  |  | 1745 |                                 m = this.getModule(i);
 | 
        
           |  |  | 1746 |                                 if (m) {
 | 
        
           |  |  | 1747 |                                     add = this.getRequires(m);
 | 
        
           |  |  | 1748 |                                     for (j = 0; j < add.length; j++) {
 | 
        
           |  |  | 1749 |                                         d.push(add[j]);
 | 
        
           |  |  | 1750 |                                     }
 | 
        
           |  |  | 1751 |   | 
        
           |  |  | 1752 |                                 }
 | 
        
           |  |  | 1753 |                             }
 | 
        
           |  |  | 1754 |                         }
 | 
        
           |  |  | 1755 |                     }
 | 
        
           |  |  | 1756 |                 }
 | 
        
           |  |  | 1757 |             }
 | 
        
           |  |  | 1758 |         }
 | 
        
           |  |  | 1759 |   | 
        
           |  |  | 1760 |         // Create skin modules
 | 
        
           |  |  | 1761 |         if (mod.skinnable) {
 | 
        
           |  |  | 1762 |             skindef = this.skin.overrides;
 | 
        
           |  |  | 1763 |             for (i in YUI.Env.aliases) {
 | 
        
           |  |  | 1764 |                 if (YUI.Env.aliases.hasOwnProperty(i)) {
 | 
        
           |  |  | 1765 |                     if (Y.Array.indexOf(YUI.Env.aliases[i], name) > -1) {
 | 
        
           |  |  | 1766 |                         skinpar = i;
 | 
        
           |  |  | 1767 |                     }
 | 
        
           |  |  | 1768 |                 }
 | 
        
           |  |  | 1769 |             }
 | 
        
           |  |  | 1770 |             if (skindef && (skindef[name] || (skinpar && skindef[skinpar]))) {
 | 
        
           |  |  | 1771 |                 skinname = name;
 | 
        
           |  |  | 1772 |                 if (skindef[skinpar]) {
 | 
        
           |  |  | 1773 |                     skinname = skinpar;
 | 
        
           |  |  | 1774 |                 }
 | 
        
           |  |  | 1775 |                 for (i = 0; i < skindef[skinname].length; i++) {
 | 
        
           |  |  | 1776 |                     skinmod = this._addSkin(skindef[skinname][i], name);
 | 
        
           |  |  | 1777 |                     if (!this.isCSSLoaded(skinmod, this._boot)) {
 | 
        
           |  |  | 1778 |                         d.push(skinmod);
 | 
        
           |  |  | 1779 |                     }
 | 
        
           |  |  | 1780 |                 }
 | 
        
           |  |  | 1781 |             } else {
 | 
        
           |  |  | 1782 |                 skinmod = this._addSkin(this.skin.defaultSkin, name);
 | 
        
           |  |  | 1783 |                 if (!this.isCSSLoaded(skinmod, this._boot)) {
 | 
        
           |  |  | 1784 |                     d.push(skinmod);
 | 
        
           |  |  | 1785 |                 }
 | 
        
           |  |  | 1786 |             }
 | 
        
           |  |  | 1787 |         }
 | 
        
           |  |  | 1788 |   | 
        
           |  |  | 1789 |         mod._parsed = false;
 | 
        
           |  |  | 1790 |   | 
        
           |  |  | 1791 |         if (intl) {
 | 
        
           |  |  | 1792 |   | 
        
           |  |  | 1793 |             if (mod.lang && !mod.langPack && Y.Intl) {
 | 
        
           |  |  | 1794 |                 lang = Y.Intl.lookupBestLang(this.lang || ROOT_LANG, mod.lang);
 | 
        
           |  |  | 1795 |                 packName = this.getLangPackName(lang, name);
 | 
        
           |  |  | 1796 |                 if (packName) {
 | 
        
           |  |  | 1797 |                     d.unshift(packName);
 | 
        
           |  |  | 1798 |                 }
 | 
        
           |  |  | 1799 |             }
 | 
        
           |  |  | 1800 |             d.unshift(INTL);
 | 
        
           |  |  | 1801 |         }
 | 
        
           |  |  | 1802 |   | 
        
           |  |  | 1803 |         mod.expanded_map = yArray.hash(d);
 | 
        
           |  |  | 1804 |   | 
        
           |  |  | 1805 |         mod.expanded = YObject.keys(mod.expanded_map);
 | 
        
           |  |  | 1806 |   | 
        
           |  |  | 1807 |         return mod.expanded;
 | 
        
           |  |  | 1808 |     },
 | 
        
           |  |  | 1809 |     /**
 | 
        
           |  |  | 1810 |     * Check to see if named css module is already loaded on the page
 | 
        
           |  |  | 1811 |     * @method isCSSLoaded
 | 
        
           |  |  | 1812 |     * @param {String} name The name of the css file
 | 
        
           |  |  | 1813 |     * @param {Boolean} skip To skip the short-circuit for ignoreRegister
 | 
        
           |  |  | 1814 |     * @return Boolean
 | 
        
           |  |  | 1815 |     */
 | 
        
           |  |  | 1816 |     isCSSLoaded: function(name, skip) {
 | 
        
           |  |  | 1817 |         //TODO - Make this call a batching call with name being an array
 | 
        
           |  |  | 1818 |         if (!name || !YUI.Env.cssStampEl || (!skip && this.ignoreRegistered)) {
 | 
        
           |  |  | 1819 |             return false;
 | 
        
           |  |  | 1820 |         }
 | 
        
           |  |  | 1821 |         var el = YUI.Env.cssStampEl,
 | 
        
           |  |  | 1822 |             ret = false,
 | 
        
           |  |  | 1823 |             mod = YUI.Env._cssLoaded[name],
 | 
        
           |  |  | 1824 |             style = el.currentStyle; //IE
 | 
        
           |  |  | 1825 |   | 
        
           |  |  | 1826 |   | 
        
           |  |  | 1827 |         if (mod !== undefined) {
 | 
        
           |  |  | 1828 |             return mod;
 | 
        
           |  |  | 1829 |         }
 | 
        
           |  |  | 1830 |   | 
        
           |  |  | 1831 |         //Add the classname to the element
 | 
        
           |  |  | 1832 |         el.className = name;
 | 
        
           |  |  | 1833 |   | 
        
           |  |  | 1834 |         if (!style) {
 | 
        
           |  |  | 1835 |             style = Y.config.doc.defaultView.getComputedStyle(el, null);
 | 
        
           |  |  | 1836 |         }
 | 
        
           |  |  | 1837 |   | 
        
           |  |  | 1838 |         if (style && style.display === 'none') {
 | 
        
           |  |  | 1839 |             ret = true;
 | 
        
           |  |  | 1840 |         }
 | 
        
           |  |  | 1841 |   | 
        
           |  |  | 1842 |   | 
        
           |  |  | 1843 |         el.className = ''; //Reset the classname to ''
 | 
        
           |  |  | 1844 |   | 
        
           |  |  | 1845 |         YUI.Env._cssLoaded[name] = ret;
 | 
        
           |  |  | 1846 |   | 
        
           |  |  | 1847 |         return ret;
 | 
        
           |  |  | 1848 |     },
 | 
        
           |  |  | 1849 |   | 
        
           |  |  | 1850 |     /**
 | 
        
           |  |  | 1851 |      * Returns a hash of module names the supplied module satisfies.
 | 
        
           |  |  | 1852 |      * @method getProvides
 | 
        
           |  |  | 1853 |      * @param {string} name The name of the module.
 | 
        
           |  |  | 1854 |      * @return {object} what this module provides.
 | 
        
           |  |  | 1855 |      */
 | 
        
           |  |  | 1856 |     getProvides: function(name) {
 | 
        
           |  |  | 1857 |         var m = this.getModule(name), o, s;
 | 
        
           |  |  | 1858 |             // supmap = this.provides;
 | 
        
           |  |  | 1859 |   | 
        
           |  |  | 1860 |         if (!m) {
 | 
        
           |  |  | 1861 |             return NOT_FOUND;
 | 
        
           |  |  | 1862 |         }
 | 
        
           |  |  | 1863 |   | 
        
           |  |  | 1864 |         if (m && !m.provides) {
 | 
        
           |  |  | 1865 |             o = {};
 | 
        
           |  |  | 1866 |             s = m.supersedes;
 | 
        
           |  |  | 1867 |   | 
        
           |  |  | 1868 |             if (s) {
 | 
        
           |  |  | 1869 |                 yArray.each(s, function(v) {
 | 
        
           |  |  | 1870 |                     Y.mix(o, this.getProvides(v));
 | 
        
           |  |  | 1871 |                 }, this);
 | 
        
           |  |  | 1872 |             }
 | 
        
           |  |  | 1873 |   | 
        
           |  |  | 1874 |             o[name] = true;
 | 
        
           |  |  | 1875 |             m.provides = o;
 | 
        
           |  |  | 1876 |   | 
        
           |  |  | 1877 |         }
 | 
        
           |  |  | 1878 |   | 
        
           |  |  | 1879 |         return m.provides;
 | 
        
           |  |  | 1880 |     },
 | 
        
           |  |  | 1881 |   | 
        
           |  |  | 1882 |     /**
 | 
        
           |  |  | 1883 |      * Calculates the dependency tree, the result is stored in the sorted
 | 
        
           |  |  | 1884 |      * property.
 | 
        
           |  |  | 1885 |      * @method calculate
 | 
        
           |  |  | 1886 |      * @param {object} o optional options object.
 | 
        
           |  |  | 1887 |      * @param {string} type optional argument to prune modules.
 | 
        
           |  |  | 1888 |      */
 | 
        
           |  |  | 1889 |     calculate: function(o, type) {
 | 
        
           |  |  | 1890 |         if (o || type || this.dirty) {
 | 
        
           |  |  | 1891 |   | 
        
           |  |  | 1892 |             if (o) {
 | 
        
           |  |  | 1893 |                 this._config(o);
 | 
        
           |  |  | 1894 |             }
 | 
        
           |  |  | 1895 |   | 
        
           |  |  | 1896 |             if (!this._init) {
 | 
        
           |  |  | 1897 |                 this._setup();
 | 
        
           |  |  | 1898 |             }
 | 
        
           |  |  | 1899 |   | 
        
           |  |  | 1900 |             this._explode();
 | 
        
           |  |  | 1901 |   | 
        
           |  |  | 1902 |             if (this.allowRollup) {
 | 
        
           |  |  | 1903 |                 this._rollup();
 | 
        
           |  |  | 1904 |             } else {
 | 
        
           |  |  | 1905 |                 this._explodeRollups();
 | 
        
           |  |  | 1906 |             }
 | 
        
           |  |  | 1907 |             this._reduce();
 | 
        
           |  |  | 1908 |             this._sort();
 | 
        
           |  |  | 1909 |         }
 | 
        
           |  |  | 1910 |     },
 | 
        
           |  |  | 1911 |     /**
 | 
        
           |  |  | 1912 |     * Creates a "psuedo" package for languages provided in the lang array
 | 
        
           |  |  | 1913 |     * @method _addLangPack
 | 
        
           |  |  | 1914 |     * @private
 | 
        
           |  |  | 1915 |     * @param {String} lang The language to create
 | 
        
           |  |  | 1916 |     * @param {Object} m The module definition to create the language pack around
 | 
        
           |  |  | 1917 |     * @param {String} packName The name of the package (e.g: lang/datatype-date-en-US)
 | 
        
           |  |  | 1918 |     * @return {Object} The module definition
 | 
        
           |  |  | 1919 |     */
 | 
        
           |  |  | 1920 |     _addLangPack: function(lang, m, packName) {
 | 
        
           |  |  | 1921 |         var name = m.name,
 | 
        
           |  |  | 1922 |             packPath, conf,
 | 
        
           |  |  | 1923 |             existing = this.getModuleInfo(packName);
 | 
        
           |  |  | 1924 |   | 
        
           |  |  | 1925 |         if (!existing) {
 | 
        
           |  |  | 1926 |   | 
        
           |  |  | 1927 |             packPath = _path((m.pkg || name), packName, JS, true);
 | 
        
           |  |  | 1928 |   | 
        
           |  |  | 1929 |             conf = {
 | 
        
           |  |  | 1930 |                 path: packPath,
 | 
        
           |  |  | 1931 |                 intl: true,
 | 
        
           |  |  | 1932 |                 langPack: true,
 | 
        
           |  |  | 1933 |                 ext: m.ext,
 | 
        
           |  |  | 1934 |                 group: m.group,
 | 
        
           |  |  | 1935 |                 supersedes: []
 | 
        
           |  |  | 1936 |             };
 | 
        
           |  |  | 1937 |             if (m.root) {
 | 
        
           |  |  | 1938 |                 conf.root = m.root;
 | 
        
           |  |  | 1939 |             }
 | 
        
           |  |  | 1940 |             if (m.base) {
 | 
        
           |  |  | 1941 |                 conf.base = m.base;
 | 
        
           |  |  | 1942 |             }
 | 
        
           |  |  | 1943 |   | 
        
           |  |  | 1944 |             if (m.configFn) {
 | 
        
           |  |  | 1945 |                 conf.configFn = m.configFn;
 | 
        
           |  |  | 1946 |             }
 | 
        
           |  |  | 1947 |   | 
        
           |  |  | 1948 |             this.addModule(conf, packName);
 | 
        
           |  |  | 1949 |   | 
        
           |  |  | 1950 |             if (lang) {
 | 
        
           |  |  | 1951 |                 Y.Env.lang = Y.Env.lang || {};
 | 
        
           |  |  | 1952 |                 Y.Env.lang[lang] = Y.Env.lang[lang] || {};
 | 
        
           |  |  | 1953 |                 Y.Env.lang[lang][name] = true;
 | 
        
           |  |  | 1954 |             }
 | 
        
           |  |  | 1955 |         }
 | 
        
           |  |  | 1956 |   | 
        
           |  |  | 1957 |         return this.getModuleInfo(packName);
 | 
        
           |  |  | 1958 |     },
 | 
        
           |  |  | 1959 |   | 
        
           |  |  | 1960 |     /**
 | 
        
           |  |  | 1961 |      * Investigates the current YUI configuration on the page.  By default,
 | 
        
           |  |  | 1962 |      * modules already detected will not be loaded again unless a force
 | 
        
           |  |  | 1963 |      * option is encountered.  Called by calculate()
 | 
        
           |  |  | 1964 |      * @method _setup
 | 
        
           |  |  | 1965 |      * @private
 | 
        
           |  |  | 1966 |      */
 | 
        
           |  |  | 1967 |     _setup: function() {
 | 
        
           |  |  | 1968 |         var info = this.moduleInfo, name, i, j, m, l,
 | 
        
           |  |  | 1969 |             packName;
 | 
        
           |  |  | 1970 |   | 
        
           |  |  | 1971 |         for (name in info) {
 | 
        
           |  |  | 1972 |             if (info.hasOwnProperty(name)) {
 | 
        
           |  |  | 1973 |                 m = info[name];
 | 
        
           |  |  | 1974 |                 if (m) {
 | 
        
           |  |  | 1975 |   | 
        
           |  |  | 1976 |                     // remove dups
 | 
        
           |  |  | 1977 |                     //m.requires = YObject.keys(yArray.hash(m.requires));
 | 
        
           |  |  | 1978 |                     m.requires = yArray.dedupe(m.requires);
 | 
        
           |  |  | 1979 |   | 
        
           |  |  | 1980 |                     // Create lang pack modules
 | 
        
           |  |  | 1981 |                     //if (m.lang && m.lang.length) {
 | 
        
           |  |  | 1982 |                     if (m.lang) {
 | 
        
           |  |  | 1983 |                         // Setup root package if the module has lang defined,
 | 
        
           |  |  | 1984 |                         // it needs to provide a root language pack
 | 
        
           |  |  | 1985 |                         packName = this.getLangPackName(ROOT_LANG, name);
 | 
        
           |  |  | 1986 |                         this._addLangPack(null, m, packName);
 | 
        
           |  |  | 1987 |                     }
 | 
        
           |  |  | 1988 |   | 
        
           |  |  | 1989 |                 }
 | 
        
           |  |  | 1990 |             }
 | 
        
           |  |  | 1991 |         }
 | 
        
           |  |  | 1992 |   | 
        
           |  |  | 1993 |   | 
        
           |  |  | 1994 |         //l = Y.merge(this.inserted);
 | 
        
           |  |  | 1995 |         l = {};
 | 
        
           |  |  | 1996 |   | 
        
           |  |  | 1997 |         // available modules
 | 
        
           |  |  | 1998 |         if (!this.ignoreRegistered) {
 | 
        
           |  |  | 1999 |             Y.mix(l, GLOBAL_ENV.mods);
 | 
        
           |  |  | 2000 |         }
 | 
        
           |  |  | 2001 |   | 
        
           |  |  | 2002 |         // add the ignore list to the list of loaded packages
 | 
        
           |  |  | 2003 |         if (this.ignore) {
 | 
        
           |  |  | 2004 |             Y.mix(l, yArray.hash(this.ignore));
 | 
        
           |  |  | 2005 |         }
 | 
        
           |  |  | 2006 |   | 
        
           |  |  | 2007 |         // expand the list to include superseded modules
 | 
        
           |  |  | 2008 |         for (j in l) {
 | 
        
           |  |  | 2009 |             if (l.hasOwnProperty(j)) {
 | 
        
           |  |  | 2010 |                 Y.mix(l, this.getProvides(j));
 | 
        
           |  |  | 2011 |             }
 | 
        
           |  |  | 2012 |         }
 | 
        
           |  |  | 2013 |   | 
        
           |  |  | 2014 |         // remove modules on the force list from the loaded list
 | 
        
           |  |  | 2015 |         if (this.force) {
 | 
        
           |  |  | 2016 |             for (i = 0; i < this.force.length; i++) {
 | 
        
           |  |  | 2017 |                 if (this.force[i] in l) {
 | 
        
           |  |  | 2018 |                     delete l[this.force[i]];
 | 
        
           |  |  | 2019 |                 }
 | 
        
           |  |  | 2020 |             }
 | 
        
           |  |  | 2021 |         }
 | 
        
           |  |  | 2022 |   | 
        
           |  |  | 2023 |         Y.mix(this.loaded, l);
 | 
        
           |  |  | 2024 |   | 
        
           |  |  | 2025 |         this._init = true;
 | 
        
           |  |  | 2026 |     },
 | 
        
           |  |  | 2027 |   | 
        
           |  |  | 2028 |     /**
 | 
        
           |  |  | 2029 |      * Builds a module name for a language pack
 | 
        
           |  |  | 2030 |      * @method getLangPackName
 | 
        
           |  |  | 2031 |      * @param {string} lang the language code.
 | 
        
           |  |  | 2032 |      * @param {string} mname the module to build it for.
 | 
        
           |  |  | 2033 |      * @return {string} the language pack module name.
 | 
        
           |  |  | 2034 |      */
 | 
        
           |  |  | 2035 |     getLangPackName: function(lang, mname) {
 | 
        
           |  |  | 2036 |         return ('lang/' + mname + ((lang) ? '_' + lang : ''));
 | 
        
           |  |  | 2037 |     },
 | 
        
           |  |  | 2038 |     /**
 | 
        
           |  |  | 2039 |      * Inspects the required modules list looking for additional
 | 
        
           |  |  | 2040 |      * dependencies.  Expands the required list to include all
 | 
        
           |  |  | 2041 |      * required modules.  Called by calculate()
 | 
        
           |  |  | 2042 |      * @method _explode
 | 
        
           |  |  | 2043 |      * @private
 | 
        
           |  |  | 2044 |      */
 | 
        
           |  |  | 2045 |     _explode: function() {
 | 
        
           |  |  | 2046 |         //TODO Move done out of scope
 | 
        
           |  |  | 2047 |         var r = this.required, m, reqs, done = {},
 | 
        
           |  |  | 2048 |             self = this, name, expound;
 | 
        
           |  |  | 2049 |   | 
        
           |  |  | 2050 |         // the setup phase is over, all modules have been created
 | 
        
           |  |  | 2051 |         self.dirty = false;
 | 
        
           |  |  | 2052 |   | 
        
           |  |  | 2053 |         self._explodeRollups();
 | 
        
           |  |  | 2054 |         r = self.required;
 | 
        
           |  |  | 2055 |   | 
        
           |  |  | 2056 |         for (name in r) {
 | 
        
           |  |  | 2057 |             if (r.hasOwnProperty(name)) {
 | 
        
           |  |  | 2058 |                 if (!done[name]) {
 | 
        
           |  |  | 2059 |                     done[name] = true;
 | 
        
           |  |  | 2060 |                     m = self.getModule(name);
 | 
        
           |  |  | 2061 |                     if (m) {
 | 
        
           |  |  | 2062 |                         expound = m.expound;
 | 
        
           |  |  | 2063 |   | 
        
           |  |  | 2064 |                         if (expound) {
 | 
        
           |  |  | 2065 |                             r[expound] = self.getModule(expound);
 | 
        
           |  |  | 2066 |                             reqs = self.getRequires(r[expound]);
 | 
        
           |  |  | 2067 |                             Y.mix(r, yArray.hash(reqs));
 | 
        
           |  |  | 2068 |                         }
 | 
        
           |  |  | 2069 |   | 
        
           |  |  | 2070 |                         reqs = self.getRequires(m);
 | 
        
           |  |  | 2071 |                         Y.mix(r, yArray.hash(reqs));
 | 
        
           |  |  | 2072 |                     }
 | 
        
           |  |  | 2073 |                 }
 | 
        
           |  |  | 2074 |             }
 | 
        
           |  |  | 2075 |         }
 | 
        
           |  |  | 2076 |   | 
        
           |  |  | 2077 |     },
 | 
        
           |  |  | 2078 |     /**
 | 
        
           |  |  | 2079 |     * The default method used to test a module against a pattern
 | 
        
           |  |  | 2080 |     * @method _patternTest
 | 
        
           |  |  | 2081 |     * @private
 | 
        
           |  |  | 2082 |     * @param {String} mname The module being tested
 | 
        
           |  |  | 2083 |     * @param {String} pname The pattern to match
 | 
        
           |  |  | 2084 |     */
 | 
        
           |  |  | 2085 |     _patternTest: function(mname, pname) {
 | 
        
           |  |  | 2086 |         return (mname.indexOf(pname) > -1);
 | 
        
           |  |  | 2087 |     },
 | 
        
           |  |  | 2088 |     /**
 | 
        
           |  |  | 2089 |     * Get's the loader meta data for the requested module
 | 
        
           |  |  | 2090 |     * @method getModule
 | 
        
           |  |  | 2091 |     * @param {String} mname The module name to get
 | 
        
           |  |  | 2092 |     * @return {Object} The module metadata
 | 
        
           |  |  | 2093 |     */
 | 
        
           |  |  | 2094 |     getModule: function(mname) {
 | 
        
           |  |  | 2095 |         //TODO: Remove name check - it's a quick hack to fix pattern WIP
 | 
        
           |  |  | 2096 |         if (!mname) {
 | 
        
           |  |  | 2097 |             return null;
 | 
        
           |  |  | 2098 |         }
 | 
        
           |  |  | 2099 |   | 
        
           |  |  | 2100 |         var p, found, pname,
 | 
        
           |  |  | 2101 |             m = this.getModuleInfo(mname),
 | 
        
           |  |  | 2102 |             patterns = this.patterns;
 | 
        
           |  |  | 2103 |   | 
        
           |  |  | 2104 |         // check the patterns library to see if we should automatically add
 | 
        
           |  |  | 2105 |         // the module with defaults
 | 
        
           |  |  | 2106 |         if (!m || (m && m.ext)) {
 | 
        
           |  |  | 2107 |             for (pname in patterns) {
 | 
        
           |  |  | 2108 |                 if (patterns.hasOwnProperty(pname)) {
 | 
        
           |  |  | 2109 |                     p = patterns[pname];
 | 
        
           |  |  | 2110 |   | 
        
           |  |  | 2111 |                     //There is no test method, create a default one that tests
 | 
        
           |  |  | 2112 |                     // the pattern against the mod name
 | 
        
           |  |  | 2113 |                     if (!p.test) {
 | 
        
           |  |  | 2114 |                         p.test = this._patternTest;
 | 
        
           |  |  | 2115 |                     }
 | 
        
           |  |  | 2116 |   | 
        
           |  |  | 2117 |                     if (p.test(mname, pname)) {
 | 
        
           |  |  | 2118 |                         // use the metadata supplied for the pattern
 | 
        
           |  |  | 2119 |                         // as the module definition.
 | 
        
           |  |  | 2120 |                         found = p;
 | 
        
           |  |  | 2121 |                         break;
 | 
        
           |  |  | 2122 |                     }
 | 
        
           |  |  | 2123 |                 }
 | 
        
           |  |  | 2124 |             }
 | 
        
           |  |  | 2125 |         }
 | 
        
           |  |  | 2126 |   | 
        
           |  |  | 2127 |         if (!m) {
 | 
        
           |  |  | 2128 |             if (found) {
 | 
        
           |  |  | 2129 |                 if (p.action) {
 | 
        
           |  |  | 2130 |                     p.action.call(this, mname, pname);
 | 
        
           |  |  | 2131 |                 } else {
 | 
        
           |  |  | 2132 |                     // ext true or false?
 | 
        
           |  |  | 2133 |                     m = this.addModule(Y.merge(found, {
 | 
        
           |  |  | 2134 |                         test: void 0,
 | 
        
           |  |  | 2135 |                         temp: true
 | 
        
           |  |  | 2136 |                     }), mname);
 | 
        
           |  |  | 2137 |                     if (m && found.configFn) {
 | 
        
           |  |  | 2138 |                         m.configFn = found.configFn;
 | 
        
           |  |  | 2139 |                     }
 | 
        
           |  |  | 2140 |                 }
 | 
        
           |  |  | 2141 |             }
 | 
        
           |  |  | 2142 |         } else {
 | 
        
           |  |  | 2143 |             if (found && m && found.configFn && !m.configFn) {
 | 
        
           |  |  | 2144 |                 m.configFn = found.configFn;
 | 
        
           |  |  | 2145 |                 m.configFn(m);
 | 
        
           |  |  | 2146 |             }
 | 
        
           |  |  | 2147 |         }
 | 
        
           |  |  | 2148 |   | 
        
           |  |  | 2149 |         return m;
 | 
        
           |  |  | 2150 |     },
 | 
        
           |  |  | 2151 |   | 
        
           |  |  | 2152 |     // impl in rollup submodule
 | 
        
           |  |  | 2153 |     _rollup: function() { },
 | 
        
           |  |  | 2154 |   | 
        
           |  |  | 2155 |     /**
 | 
        
           |  |  | 2156 |      * Remove superceded modules and loaded modules.  Called by
 | 
        
           |  |  | 2157 |      * calculate() after we have the mega list of all dependencies
 | 
        
           |  |  | 2158 |      * @method _reduce
 | 
        
           |  |  | 2159 |      * @return {object} the reduced dependency hash.
 | 
        
           |  |  | 2160 |      * @private
 | 
        
           |  |  | 2161 |      */
 | 
        
           |  |  | 2162 |     _reduce: function(r) {
 | 
        
           |  |  | 2163 |   | 
        
           |  |  | 2164 |         r = r || this.required;
 | 
        
           |  |  | 2165 |   | 
        
           |  |  | 2166 |         var i, j, s, m, type = this.loadType,
 | 
        
           |  |  | 2167 |         ignore = this.ignore ? yArray.hash(this.ignore) : false;
 | 
        
           |  |  | 2168 |   | 
        
           |  |  | 2169 |         for (i in r) {
 | 
        
           |  |  | 2170 |             if (r.hasOwnProperty(i)) {
 | 
        
           |  |  | 2171 |                 m = this.getModule(i);
 | 
        
           |  |  | 2172 |                 // remove if already loaded
 | 
        
           |  |  | 2173 |                 if (((this.loaded[i] || ON_PAGE[i]) &&
 | 
        
           |  |  | 2174 |                         !this.forceMap[i] && !this.ignoreRegistered) ||
 | 
        
           |  |  | 2175 |                         (type && m && m.type !== type)) {
 | 
        
           |  |  | 2176 |                     delete r[i];
 | 
        
           |  |  | 2177 |                 }
 | 
        
           |  |  | 2178 |                 if (ignore && ignore[i]) {
 | 
        
           |  |  | 2179 |                     delete r[i];
 | 
        
           |  |  | 2180 |                 }
 | 
        
           |  |  | 2181 |                 // remove anything this module supersedes
 | 
        
           |  |  | 2182 |                 s = m && m.supersedes;
 | 
        
           |  |  | 2183 |                 if (s) {
 | 
        
           |  |  | 2184 |                     for (j = 0; j < s.length; j++) {
 | 
        
           |  |  | 2185 |                         if (s[j] in r) {
 | 
        
           |  |  | 2186 |                             delete r[s[j]];
 | 
        
           |  |  | 2187 |                         }
 | 
        
           |  |  | 2188 |                     }
 | 
        
           |  |  | 2189 |                 }
 | 
        
           |  |  | 2190 |             }
 | 
        
           |  |  | 2191 |         }
 | 
        
           |  |  | 2192 |   | 
        
           |  |  | 2193 |         return r;
 | 
        
           |  |  | 2194 |     },
 | 
        
           |  |  | 2195 |     /**
 | 
        
           |  |  | 2196 |     * Handles the queue when a module has been loaded for all cases
 | 
        
           |  |  | 2197 |     * @method _finish
 | 
        
           |  |  | 2198 |     * @private
 | 
        
           |  |  | 2199 |     * @param {String} msg The message from Loader
 | 
        
           |  |  | 2200 |     * @param {Boolean} success A boolean denoting success or failure
 | 
        
           |  |  | 2201 |     */
 | 
        
           |  |  | 2202 |     _finish: function(msg, success) {
 | 
        
           |  |  | 2203 |   | 
        
           |  |  | 2204 |         _queue.running = false;
 | 
        
           |  |  | 2205 |   | 
        
           |  |  | 2206 |         var onEnd = this.onEnd;
 | 
        
           |  |  | 2207 |         if (onEnd) {
 | 
        
           |  |  | 2208 |             onEnd.call(this.context, {
 | 
        
           |  |  | 2209 |                 msg: msg,
 | 
        
           |  |  | 2210 |                 data: this.data,
 | 
        
           |  |  | 2211 |                 success: success
 | 
        
           |  |  | 2212 |             });
 | 
        
           |  |  | 2213 |         }
 | 
        
           |  |  | 2214 |         this._continue();
 | 
        
           |  |  | 2215 |     },
 | 
        
           |  |  | 2216 |     /**
 | 
        
           |  |  | 2217 |     * The default Loader onSuccess handler, calls this.onSuccess with a payload
 | 
        
           |  |  | 2218 |     * @method _onSuccess
 | 
        
           |  |  | 2219 |     * @private
 | 
        
           |  |  | 2220 |     */
 | 
        
           |  |  | 2221 |     _onSuccess: function() {
 | 
        
           |  |  | 2222 |         var self = this, skipped = Y.merge(self.skipped), fn,
 | 
        
           |  |  | 2223 |             failed = [], rreg = self.requireRegistration,
 | 
        
           |  |  | 2224 |             success, msg, i, mod;
 | 
        
           |  |  | 2225 |   | 
        
           |  |  | 2226 |         for (i in skipped) {
 | 
        
           |  |  | 2227 |             if (skipped.hasOwnProperty(i)) {
 | 
        
           |  |  | 2228 |                 delete self.inserted[i];
 | 
        
           |  |  | 2229 |             }
 | 
        
           |  |  | 2230 |         }
 | 
        
           |  |  | 2231 |   | 
        
           |  |  | 2232 |         self.skipped = {};
 | 
        
           |  |  | 2233 |   | 
        
           |  |  | 2234 |         for (i in self.inserted) {
 | 
        
           |  |  | 2235 |             if (self.inserted.hasOwnProperty(i)) {
 | 
        
           |  |  | 2236 |                 mod = self.getModule(i);
 | 
        
           |  |  | 2237 |                 if (mod && rreg && mod.type === JS && !(i in YUI.Env.mods)) {
 | 
        
           |  |  | 2238 |                     failed.push(i);
 | 
        
           |  |  | 2239 |                 } else {
 | 
        
           |  |  | 2240 |                     Y.mix(self.loaded, self.getProvides(i));
 | 
        
           |  |  | 2241 |                 }
 | 
        
           |  |  | 2242 |             }
 | 
        
           |  |  | 2243 |         }
 | 
        
           |  |  | 2244 |   | 
        
           |  |  | 2245 |         fn = self.onSuccess;
 | 
        
           |  |  | 2246 |         msg = (failed.length) ? 'notregistered' : 'success';
 | 
        
           |  |  | 2247 |         success = !(failed.length);
 | 
        
           |  |  | 2248 |         if (fn) {
 | 
        
           |  |  | 2249 |             fn.call(self.context, {
 | 
        
           |  |  | 2250 |                 msg: msg,
 | 
        
           |  |  | 2251 |                 data: self.data,
 | 
        
           |  |  | 2252 |                 success: success,
 | 
        
           |  |  | 2253 |                 failed: failed,
 | 
        
           |  |  | 2254 |                 skipped: skipped
 | 
        
           |  |  | 2255 |             });
 | 
        
           |  |  | 2256 |         }
 | 
        
           |  |  | 2257 |         self._finish(msg, success);
 | 
        
           |  |  | 2258 |     },
 | 
        
           |  |  | 2259 |     /**
 | 
        
           |  |  | 2260 |     * The default Loader onProgress handler, calls this.onProgress with a payload
 | 
        
           |  |  | 2261 |     * @method _onProgress
 | 
        
           |  |  | 2262 |     * @private
 | 
        
           |  |  | 2263 |     */
 | 
        
           |  |  | 2264 |     _onProgress: function(e) {
 | 
        
           |  |  | 2265 |         var self = this, i;
 | 
        
           |  |  | 2266 |         //set the internal cache to what just came in.
 | 
        
           |  |  | 2267 |         if (e.data && e.data.length) {
 | 
        
           |  |  | 2268 |             for (i = 0; i < e.data.length; i++) {
 | 
        
           |  |  | 2269 |                 e.data[i] = self.getModule(e.data[i].name);
 | 
        
           |  |  | 2270 |             }
 | 
        
           |  |  | 2271 |         }
 | 
        
           |  |  | 2272 |         if (self.onProgress) {
 | 
        
           |  |  | 2273 |             self.onProgress.call(self.context, {
 | 
        
           |  |  | 2274 |                 name: e.url,
 | 
        
           |  |  | 2275 |                 data: e.data
 | 
        
           |  |  | 2276 |             });
 | 
        
           |  |  | 2277 |         }
 | 
        
           |  |  | 2278 |     },
 | 
        
           |  |  | 2279 |     /**
 | 
        
           |  |  | 2280 |     * The default Loader onFailure handler, calls this.onFailure with a payload
 | 
        
           |  |  | 2281 |     * @method _onFailure
 | 
        
           |  |  | 2282 |     * @private
 | 
        
           |  |  | 2283 |     */
 | 
        
           |  |  | 2284 |     _onFailure: function(o) {
 | 
        
           |  |  | 2285 |         var f = this.onFailure, msg = [], i = 0, len = o.errors.length;
 | 
        
           |  |  | 2286 |   | 
        
           |  |  | 2287 |         for (i; i < len; i++) {
 | 
        
           |  |  | 2288 |             msg.push(o.errors[i].error);
 | 
        
           |  |  | 2289 |         }
 | 
        
           |  |  | 2290 |   | 
        
           |  |  | 2291 |         msg = msg.join(',');
 | 
        
           |  |  | 2292 |   | 
        
           |  |  | 2293 |   | 
        
           |  |  | 2294 |         if (f) {
 | 
        
           |  |  | 2295 |             f.call(this.context, {
 | 
        
           |  |  | 2296 |                 msg: msg,
 | 
        
           |  |  | 2297 |                 data: this.data,
 | 
        
           |  |  | 2298 |                 success: false
 | 
        
           |  |  | 2299 |             });
 | 
        
           |  |  | 2300 |         }
 | 
        
           |  |  | 2301 |   | 
        
           |  |  | 2302 |         this._finish(msg, false);
 | 
        
           |  |  | 2303 |   | 
        
           |  |  | 2304 |     },
 | 
        
           |  |  | 2305 |   | 
        
           |  |  | 2306 |     /**
 | 
        
           |  |  | 2307 |     * The default Loader onTimeout handler, calls this.onTimeout with a payload
 | 
        
           |  |  | 2308 |     * @method _onTimeout
 | 
        
           |  |  | 2309 |     * @param {Get.Transaction} transaction The Transaction object from `Y.Get`
 | 
        
           |  |  | 2310 |     * @private
 | 
        
           |  |  | 2311 |     */
 | 
        
           |  |  | 2312 |     _onTimeout: function(transaction) {
 | 
        
           |  |  | 2313 |         var f = this.onTimeout;
 | 
        
           |  |  | 2314 |         if (f) {
 | 
        
           |  |  | 2315 |             f.call(this.context, {
 | 
        
           |  |  | 2316 |                 msg: 'timeout',
 | 
        
           |  |  | 2317 |                 data: this.data,
 | 
        
           |  |  | 2318 |                 success: false,
 | 
        
           |  |  | 2319 |                 transaction: transaction
 | 
        
           |  |  | 2320 |             });
 | 
        
           |  |  | 2321 |         }
 | 
        
           |  |  | 2322 |     },
 | 
        
           |  |  | 2323 |   | 
        
           |  |  | 2324 |     /**
 | 
        
           |  |  | 2325 |      * Sorts the dependency tree.  The last step of calculate()
 | 
        
           |  |  | 2326 |      * @method _sort
 | 
        
           |  |  | 2327 |      * @private
 | 
        
           |  |  | 2328 |      */
 | 
        
           |  |  | 2329 |     _sort: function() {
 | 
        
           |  |  | 2330 |         var name,
 | 
        
           |  |  | 2331 |   | 
        
           |  |  | 2332 |             // Object containing module names.
 | 
        
           |  |  | 2333 |             required = this.required,
 | 
        
           |  |  | 2334 |   | 
        
           |  |  | 2335 |             // Keep track of whether we've visited a module.
 | 
        
           |  |  | 2336 |             visited = {};
 | 
        
           |  |  | 2337 |   | 
        
           |  |  | 2338 |         // Will contain modules names, in the correct order,
 | 
        
           |  |  | 2339 |         // according to dependencies.
 | 
        
           |  |  | 2340 |         this.sorted = [];
 | 
        
           |  |  | 2341 |   | 
        
           |  |  | 2342 |         for (name in required) {
 | 
        
           |  |  | 2343 |             if (!visited[name] && required.hasOwnProperty(name)) {
 | 
        
           |  |  | 2344 |                 this._visit(name, visited);
 | 
        
           |  |  | 2345 |             }
 | 
        
           |  |  | 2346 |         }
 | 
        
           |  |  | 2347 |     },
 | 
        
           |  |  | 2348 |   | 
        
           |  |  | 2349 |     /**
 | 
        
           |  |  | 2350 |      * Recursively visits the dependencies of the module name
 | 
        
           |  |  | 2351 |      * passed in, and appends each module name to the `sorted` property.
 | 
        
           |  |  | 2352 |      * @param {String} name The name of a module.
 | 
        
           |  |  | 2353 |      * @param {Object} visited Keeps track of whether a module was visited.
 | 
        
           |  |  | 2354 |      * @method _visit
 | 
        
           |  |  | 2355 |      * @private
 | 
        
           |  |  | 2356 |      */
 | 
        
           |  |  | 2357 |     _visit: function (name, visited) {
 | 
        
           |  |  | 2358 |         var required, condition, moduleInfo, dependency, dependencies,
 | 
        
           |  |  | 2359 |             trigger, isAfter, i, l;
 | 
        
           |  |  | 2360 |   | 
        
           |  |  | 2361 |         visited[name] = true;
 | 
        
           |  |  | 2362 |         required = this.required;
 | 
        
           |  |  | 2363 |         moduleInfo = this.moduleInfo[name];
 | 
        
           |  |  | 2364 |         condition = this.conditions[name] || {};
 | 
        
           |  |  | 2365 |   | 
        
           |  |  | 2366 |         if (moduleInfo) {
 | 
        
           |  |  | 2367 |             // Recurse on each dependency of this module,
 | 
        
           |  |  | 2368 |             // figuring out its dependencies, and so on.
 | 
        
           |  |  | 2369 |             dependencies = moduleInfo.expanded || moduleInfo.requires;
 | 
        
           |  |  | 2370 |   | 
        
           |  |  | 2371 |             for (i = 0, l = dependencies.length; i < l; ++i) {
 | 
        
           |  |  | 2372 |                 dependency = dependencies[i];
 | 
        
           |  |  | 2373 |                 trigger = condition[dependency];
 | 
        
           |  |  | 2374 |   | 
        
           |  |  | 2375 |                 // We cannot process this dependency yet if it must
 | 
        
           |  |  | 2376 |                 // appear after our current module.
 | 
        
           |  |  | 2377 |                 isAfter = trigger && (!trigger.when || trigger.when === "after");
 | 
        
           |  |  | 2378 |   | 
        
           |  |  | 2379 |                 // Is this module name in the required list of modules,
 | 
        
           |  |  | 2380 |                 // and have we not already visited it?
 | 
        
           |  |  | 2381 |                 if (required[dependency] && !visited[dependency] && !isAfter) {
 | 
        
           |  |  | 2382 |                     this._visit(dependency, visited);
 | 
        
           |  |  | 2383 |                 }
 | 
        
           |  |  | 2384 |             }
 | 
        
           |  |  | 2385 |         }
 | 
        
           |  |  | 2386 |   | 
        
           |  |  | 2387 |         this.sorted.push(name);
 | 
        
           |  |  | 2388 |     },
 | 
        
           |  |  | 2389 |   | 
        
           |  |  | 2390 |     /**
 | 
        
           |  |  | 2391 |     * Handles the actual insertion of script/link tags
 | 
        
           |  |  | 2392 |     * @method _insert
 | 
        
           |  |  | 2393 |     * @private
 | 
        
           |  |  | 2394 |     * @param {Object} source The YUI instance the request came from
 | 
        
           |  |  | 2395 |     * @param {Object} o The metadata to include
 | 
        
           |  |  | 2396 |     * @param {String} type JS or CSS
 | 
        
           |  |  | 2397 |     * @param {Boolean} [skipcalc=false] Do a Loader.calculate on the meta
 | 
        
           |  |  | 2398 |     */
 | 
        
           |  |  | 2399 |     _insert: function(source, o, type, skipcalc) {
 | 
        
           |  |  | 2400 |   | 
        
           |  |  | 2401 |   | 
        
           |  |  | 2402 |         // restore the state at the time of the request
 | 
        
           |  |  | 2403 |         if (source) {
 | 
        
           |  |  | 2404 |             this._config(source);
 | 
        
           |  |  | 2405 |         }
 | 
        
           |  |  | 2406 |   | 
        
           |  |  | 2407 |         // build the dependency list
 | 
        
           |  |  | 2408 |         // don't include type so we can process CSS and script in
 | 
        
           |  |  | 2409 |         // one pass when the type is not specified.
 | 
        
           |  |  | 2410 |   | 
        
           |  |  | 2411 |         var modules = this.resolve(!skipcalc),
 | 
        
           |  |  | 2412 |             self = this, comp = 0, actions = 0,
 | 
        
           |  |  | 2413 |             mods = {}, deps, complete;
 | 
        
           |  |  | 2414 |   | 
        
           |  |  | 2415 |         self._refetch = [];
 | 
        
           |  |  | 2416 |   | 
        
           |  |  | 2417 |         if (type) {
 | 
        
           |  |  | 2418 |             //Filter out the opposite type and reset the array so the checks later work
 | 
        
           |  |  | 2419 |             modules[((type === JS) ? CSS : JS)] = [];
 | 
        
           |  |  | 2420 |         }
 | 
        
           |  |  | 2421 |         if (!self.fetchCSS) {
 | 
        
           |  |  | 2422 |             modules.css = [];
 | 
        
           |  |  | 2423 |         }
 | 
        
           |  |  | 2424 |         if (modules.js.length) {
 | 
        
           |  |  | 2425 |             comp++;
 | 
        
           |  |  | 2426 |         }
 | 
        
           |  |  | 2427 |         if (modules.css.length) {
 | 
        
           |  |  | 2428 |             comp++;
 | 
        
           |  |  | 2429 |         }
 | 
        
           |  |  | 2430 |   | 
        
           |  |  | 2431 |         //console.log('Resolved Modules: ', modules);
 | 
        
           |  |  | 2432 |   | 
        
           |  |  | 2433 |         complete = function(d) {
 | 
        
           |  |  | 2434 |             actions++;
 | 
        
           |  |  | 2435 |             var errs = {}, i = 0, o = 0, u = '', fn,
 | 
        
           |  |  | 2436 |                 modName, resMods;
 | 
        
           |  |  | 2437 |   | 
        
           |  |  | 2438 |             if (d && d.errors) {
 | 
        
           |  |  | 2439 |                 for (i = 0; i < d.errors.length; i++) {
 | 
        
           |  |  | 2440 |                     if (d.errors[i].request) {
 | 
        
           |  |  | 2441 |                         u = d.errors[i].request.url;
 | 
        
           |  |  | 2442 |                     } else {
 | 
        
           |  |  | 2443 |                         u = d.errors[i];
 | 
        
           |  |  | 2444 |                     }
 | 
        
           |  |  | 2445 |                     errs[u] = u;
 | 
        
           |  |  | 2446 |                 }
 | 
        
           |  |  | 2447 |             }
 | 
        
           |  |  | 2448 |   | 
        
           |  |  | 2449 |             if (d && d.data && d.data.length && (d.type === 'success')) {
 | 
        
           |  |  | 2450 |                 for (i = 0; i < d.data.length; i++) {
 | 
        
           |  |  | 2451 |                     self.inserted[d.data[i].name] = true;
 | 
        
           |  |  | 2452 |                     //If the external module has a skin or a lang, reprocess it
 | 
        
           |  |  | 2453 |                     if (d.data[i].lang || d.data[i].skinnable) {
 | 
        
           |  |  | 2454 |                         delete self.inserted[d.data[i].name];
 | 
        
           |  |  | 2455 |                         self._refetch.push(d.data[i].name);
 | 
        
           |  |  | 2456 |                     }
 | 
        
           |  |  | 2457 |                 }
 | 
        
           |  |  | 2458 |             }
 | 
        
           |  |  | 2459 |   | 
        
           |  |  | 2460 |             if (actions === comp) {
 | 
        
           |  |  | 2461 |                 self._loading = null;
 | 
        
           |  |  | 2462 |                 if (self._refetch.length) {
 | 
        
           |  |  | 2463 |                     //Get the deps for the new meta-data and reprocess
 | 
        
           |  |  | 2464 |                     for (i = 0; i < self._refetch.length; i++) {
 | 
        
           |  |  | 2465 |                         deps = self.getRequires(self.getModule(self._refetch[i]));
 | 
        
           |  |  | 2466 |                         for (o = 0; o < deps.length; o++) {
 | 
        
           |  |  | 2467 |                             if (!self.inserted[deps[o]]) {
 | 
        
           |  |  | 2468 |                                 //We wouldn't be to this point without the module being here
 | 
        
           |  |  | 2469 |                                 mods[deps[o]] = deps[o];
 | 
        
           |  |  | 2470 |                             }
 | 
        
           |  |  | 2471 |                         }
 | 
        
           |  |  | 2472 |                     }
 | 
        
           |  |  | 2473 |                     mods = Y.Object.keys(mods);
 | 
        
           |  |  | 2474 |                     if (mods.length) {
 | 
        
           |  |  | 2475 |                         self.require(mods);
 | 
        
           |  |  | 2476 |                         resMods = self.resolve(true);
 | 
        
           |  |  | 2477 |                         if (resMods.cssMods.length) {
 | 
        
           |  |  | 2478 |                             for (i=0; i <  resMods.cssMods.length; i++) {
 | 
        
           |  |  | 2479 |                                 modName = resMods.cssMods[i].name;
 | 
        
           |  |  | 2480 |                                 delete YUI.Env._cssLoaded[modName];
 | 
        
           |  |  | 2481 |                                 if (self.isCSSLoaded(modName)) {
 | 
        
           |  |  | 2482 |                                     self.inserted[modName] = true;
 | 
        
           |  |  | 2483 |                                     delete self.required[modName];
 | 
        
           |  |  | 2484 |                                 }
 | 
        
           |  |  | 2485 |                             }
 | 
        
           |  |  | 2486 |                             self.sorted = [];
 | 
        
           |  |  | 2487 |                             self._sort();
 | 
        
           |  |  | 2488 |                         }
 | 
        
           |  |  | 2489 |                         d = null; //bail
 | 
        
           |  |  | 2490 |                         self._insert(); //insert the new deps
 | 
        
           |  |  | 2491 |                     }
 | 
        
           |  |  | 2492 |                 }
 | 
        
           |  |  | 2493 |                 if (d && d.fn) {
 | 
        
           |  |  | 2494 |                     fn = d.fn;
 | 
        
           |  |  | 2495 |                     delete d.fn;
 | 
        
           |  |  | 2496 |                     fn.call(self, d);
 | 
        
           |  |  | 2497 |                 }
 | 
        
           |  |  | 2498 |             }
 | 
        
           |  |  | 2499 |         };
 | 
        
           |  |  | 2500 |   | 
        
           |  |  | 2501 |         this._loading = true;
 | 
        
           |  |  | 2502 |   | 
        
           |  |  | 2503 |         if (!modules.js.length && !modules.css.length) {
 | 
        
           |  |  | 2504 |             actions = -1;
 | 
        
           |  |  | 2505 |             complete({
 | 
        
           |  |  | 2506 |                 fn: self._onSuccess
 | 
        
           |  |  | 2507 |             });
 | 
        
           |  |  | 2508 |             return;
 | 
        
           |  |  | 2509 |         }
 | 
        
           |  |  | 2510 |   | 
        
           |  |  | 2511 |   | 
        
           |  |  | 2512 |         if (modules.css.length) { //Load CSS first
 | 
        
           |  |  | 2513 |             Y.Get.css(modules.css, {
 | 
        
           |  |  | 2514 |                 data: modules.cssMods,
 | 
        
           |  |  | 2515 |                 attributes: self.cssAttributes,
 | 
        
           |  |  | 2516 |                 insertBefore: self.insertBefore,
 | 
        
           |  |  | 2517 |                 charset: self.charset,
 | 
        
           |  |  | 2518 |                 timeout: self.timeout,
 | 
        
           |  |  | 2519 |                 context: self,
 | 
        
           |  |  | 2520 |                 onProgress: function(e) {
 | 
        
           |  |  | 2521 |                     self._onProgress.call(self, e);
 | 
        
           |  |  | 2522 |                 },
 | 
        
           |  |  | 2523 |                 onTimeout: function(d) {
 | 
        
           |  |  | 2524 |                     self._onTimeout.call(self, d);
 | 
        
           |  |  | 2525 |                 },
 | 
        
           |  |  | 2526 |                 onSuccess: function(d) {
 | 
        
           |  |  | 2527 |                     d.type = 'success';
 | 
        
           |  |  | 2528 |                     d.fn = self._onSuccess;
 | 
        
           |  |  | 2529 |                     complete.call(self, d);
 | 
        
           |  |  | 2530 |                 },
 | 
        
           |  |  | 2531 |                 onFailure: function(d) {
 | 
        
           |  |  | 2532 |                     d.type = 'failure';
 | 
        
           |  |  | 2533 |                     d.fn = self._onFailure;
 | 
        
           |  |  | 2534 |                     complete.call(self, d);
 | 
        
           |  |  | 2535 |                 }
 | 
        
           |  |  | 2536 |             });
 | 
        
           |  |  | 2537 |         }
 | 
        
           |  |  | 2538 |   | 
        
           |  |  | 2539 |         if (modules.js.length) {
 | 
        
           |  |  | 2540 |             Y.Get.js(modules.js, {
 | 
        
           |  |  | 2541 |                 data: modules.jsMods,
 | 
        
           |  |  | 2542 |                 insertBefore: self.insertBefore,
 | 
        
           |  |  | 2543 |                 attributes: self.jsAttributes,
 | 
        
           |  |  | 2544 |                 charset: self.charset,
 | 
        
           |  |  | 2545 |                 timeout: self.timeout,
 | 
        
           |  |  | 2546 |                 autopurge: false,
 | 
        
           |  |  | 2547 |                 context: self,
 | 
        
           |  |  | 2548 |                 async: self.async,
 | 
        
           |  |  | 2549 |                 onProgress: function(e) {
 | 
        
           |  |  | 2550 |                     self._onProgress.call(self, e);
 | 
        
           |  |  | 2551 |                 },
 | 
        
           |  |  | 2552 |                 onTimeout: function(d) {
 | 
        
           |  |  | 2553 |                     self._onTimeout.call(self, d);
 | 
        
           |  |  | 2554 |                 },
 | 
        
           |  |  | 2555 |                 onSuccess: function(d) {
 | 
        
           |  |  | 2556 |                     d.type = 'success';
 | 
        
           |  |  | 2557 |                     d.fn = self._onSuccess;
 | 
        
           |  |  | 2558 |                     complete.call(self, d);
 | 
        
           |  |  | 2559 |                 },
 | 
        
           |  |  | 2560 |                 onFailure: function(d) {
 | 
        
           |  |  | 2561 |                     d.type = 'failure';
 | 
        
           |  |  | 2562 |                     d.fn = self._onFailure;
 | 
        
           |  |  | 2563 |                     complete.call(self, d);
 | 
        
           |  |  | 2564 |                 }
 | 
        
           |  |  | 2565 |             });
 | 
        
           |  |  | 2566 |         }
 | 
        
           |  |  | 2567 |     },
 | 
        
           |  |  | 2568 |     /**
 | 
        
           |  |  | 2569 |     * Once a loader operation is completely finished, process any additional queued items.
 | 
        
           |  |  | 2570 |     * @method _continue
 | 
        
           |  |  | 2571 |     * @private
 | 
        
           |  |  | 2572 |     */
 | 
        
           |  |  | 2573 |     _continue: function() {
 | 
        
           |  |  | 2574 |         if (!(_queue.running) && _queue.size() > 0) {
 | 
        
           |  |  | 2575 |             _queue.running = true;
 | 
        
           |  |  | 2576 |             _queue.next()();
 | 
        
           |  |  | 2577 |         }
 | 
        
           |  |  | 2578 |     },
 | 
        
           |  |  | 2579 |   | 
        
           |  |  | 2580 |     /**
 | 
        
           |  |  | 2581 |      * inserts the requested modules and their dependencies.
 | 
        
           |  |  | 2582 |      * <code>type</code> can be "js" or "css".  Both script and
 | 
        
           |  |  | 2583 |      * css are inserted if type is not provided.
 | 
        
           |  |  | 2584 |      * @method insert
 | 
        
           |  |  | 2585 |      * @param {object} o optional options object.
 | 
        
           |  |  | 2586 |      * @param {string} type the type of dependency to insert.
 | 
        
           |  |  | 2587 |      */
 | 
        
           |  |  | 2588 |     insert: function(o, type, skipsort) {
 | 
        
           |  |  | 2589 |         var self = this, copy = Y.merge(this);
 | 
        
           |  |  | 2590 |         delete copy.require;
 | 
        
           |  |  | 2591 |         delete copy.dirty;
 | 
        
           |  |  | 2592 |         _queue.add(function() {
 | 
        
           |  |  | 2593 |             self._insert(copy, o, type, skipsort);
 | 
        
           |  |  | 2594 |         });
 | 
        
           |  |  | 2595 |         this._continue();
 | 
        
           |  |  | 2596 |     },
 | 
        
           |  |  | 2597 |   | 
        
           |  |  | 2598 |     /**
 | 
        
           |  |  | 2599 |      * Executed every time a module is loaded, and if we are in a load
 | 
        
           |  |  | 2600 |      * cycle, we attempt to load the next script.  Public so that it
 | 
        
           |  |  | 2601 |      * is possible to call this if using a method other than
 | 
        
           |  |  | 2602 |      * Y.register to determine when scripts are fully loaded
 | 
        
           |  |  | 2603 |      * @method loadNext
 | 
        
           |  |  | 2604 |      * @deprecated
 | 
        
           |  |  | 2605 |      * @param {string} mname optional the name of the module that has
 | 
        
           |  |  | 2606 |      * been loaded (which is usually why it is time to load the next
 | 
        
           |  |  | 2607 |      * one).
 | 
        
           |  |  | 2608 |      */
 | 
        
           |  |  | 2609 |     loadNext: function() {
 | 
        
           |  |  | 2610 |         return;
 | 
        
           |  |  | 2611 |     },
 | 
        
           |  |  | 2612 |   | 
        
           |  |  | 2613 |     /**
 | 
        
           |  |  | 2614 |      * Apply filter defined for this instance to a url/path
 | 
        
           |  |  | 2615 |      * @method _filter
 | 
        
           |  |  | 2616 |      * @param {string} u the string to filter.
 | 
        
           |  |  | 2617 |      * @param {string} name the name of the module, if we are processing
 | 
        
           |  |  | 2618 |      * a single module as opposed to a combined url.
 | 
        
           |  |  | 2619 |      * @return {string} the filtered string.
 | 
        
           |  |  | 2620 |      * @private
 | 
        
           |  |  | 2621 |      */
 | 
        
           |  |  | 2622 |     _filter: function(u, name, group) {
 | 
        
           |  |  | 2623 |         var f = this.filter,
 | 
        
           |  |  | 2624 |             hasFilter = name && (name in this.filters),
 | 
        
           |  |  | 2625 |             modFilter = hasFilter && this.filters[name],
 | 
        
           |  |  | 2626 |             groupName = group || (this.getModuleInfo(name) || {}).group || null;
 | 
        
           |  |  | 2627 |   | 
        
           |  |  | 2628 |         if (groupName && this.groups[groupName] && this.groups[groupName].filter) {
 | 
        
           |  |  | 2629 |             modFilter = this.groups[groupName].filter;
 | 
        
           |  |  | 2630 |             hasFilter = true;
 | 
        
           |  |  | 2631 |         }
 | 
        
           |  |  | 2632 |   | 
        
           |  |  | 2633 |         if (u) {
 | 
        
           |  |  | 2634 |             if (hasFilter) {
 | 
        
           |  |  | 2635 |                 f = (L.isString(modFilter)) ? this.FILTER_DEFS[modFilter.toUpperCase()] || null : modFilter;
 | 
        
           |  |  | 2636 |             }
 | 
        
           |  |  | 2637 |             if (f) {
 | 
        
           |  |  | 2638 |                 u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr);
 | 
        
           |  |  | 2639 |             }
 | 
        
           |  |  | 2640 |         }
 | 
        
           |  |  | 2641 |         return u;
 | 
        
           |  |  | 2642 |     },
 | 
        
           |  |  | 2643 |   | 
        
           |  |  | 2644 |     /**
 | 
        
           |  |  | 2645 |      * Generates the full url for a module
 | 
        
           |  |  | 2646 |      * @method _url
 | 
        
           |  |  | 2647 |      * @param {string} path the path fragment.
 | 
        
           |  |  | 2648 |      * @param {String} name The name of the module
 | 
        
           |  |  | 2649 |      * @param {String} [base] The base url to use. Defaults to self.base
 | 
        
           |  |  | 2650 |      * @return {string} the full url.
 | 
        
           |  |  | 2651 |      * @private
 | 
        
           |  |  | 2652 |      */
 | 
        
           |  |  | 2653 |     _url: function(path, name, base) {
 | 
        
           |  |  | 2654 |         return this._filter((base || this.base || '') + path, name);
 | 
        
           |  |  | 2655 |     },
 | 
        
           |  |  | 2656 |     /**
 | 
        
           |  |  | 2657 |     * Returns an Object hash of file arrays built from `loader.sorted` or from an arbitrary list of sorted modules.
 | 
        
           |  |  | 2658 |     * @method resolve
 | 
        
           |  |  | 2659 |     * @param {Boolean} [calc=false] Perform a loader.calculate() before anything else
 | 
        
           |  |  | 2660 |     * @param {Array} [sorted=loader.sorted] An override for the loader.sorted array
 | 
        
           |  |  | 2661 |     * @return {Object} Object hash (js and css) of two arrays of file lists
 | 
        
           |  |  | 2662 |     * @example This method can be used as an off-line dep calculator
 | 
        
           |  |  | 2663 |     *
 | 
        
           |  |  | 2664 |     *        var Y = YUI();
 | 
        
           |  |  | 2665 |     *        var loader = new Y.Loader({
 | 
        
           |  |  | 2666 |     *            filter: 'debug',
 | 
        
           |  |  | 2667 |     *            base: '../../',
 | 
        
           |  |  | 2668 |     *            root: 'build/',
 | 
        
           |  |  | 2669 |     *            combine: true,
 | 
        
           |  |  | 2670 |     *            require: ['node', 'dd', 'console']
 | 
        
           |  |  | 2671 |     *        });
 | 
        
           |  |  | 2672 |     *        var out = loader.resolve(true);
 | 
        
           |  |  | 2673 |     *
 | 
        
           |  |  | 2674 |     */
 | 
        
           |  |  | 2675 |     resolve: function(calc, sorted) {
 | 
        
           |  |  | 2676 |         var self     = this,
 | 
        
           |  |  | 2677 |             resolved = { js: [], jsMods: [], css: [], cssMods: [] },
 | 
        
           |  |  | 2678 |             addSingle,
 | 
        
           |  |  | 2679 |             usePathogen = Y.config.comboLoader && Y.config.customComboBase;
 | 
        
           |  |  | 2680 |   | 
        
           |  |  | 2681 |         if (self.skin.overrides || self.skin.defaultSkin !== DEFAULT_SKIN || self.ignoreRegistered) {
 | 
        
           |  |  | 2682 |             self._resetModules();
 | 
        
           |  |  | 2683 |         }
 | 
        
           |  |  | 2684 |   | 
        
           |  |  | 2685 |         if (calc) {
 | 
        
           |  |  | 2686 |             self.calculate();
 | 
        
           |  |  | 2687 |         }
 | 
        
           |  |  | 2688 |         sorted = sorted || self.sorted;
 | 
        
           |  |  | 2689 |   | 
        
           |  |  | 2690 |         addSingle = function(mod) {
 | 
        
           |  |  | 2691 |             if (mod) {
 | 
        
           |  |  | 2692 |                 var group = (mod.group && self.groups[mod.group]) || NOT_FOUND,
 | 
        
           |  |  | 2693 |                     url;
 | 
        
           |  |  | 2694 |   | 
        
           |  |  | 2695 |                 //Always assume it's async
 | 
        
           |  |  | 2696 |                 if (group.async === false) {
 | 
        
           |  |  | 2697 |                     mod.async = group.async;
 | 
        
           |  |  | 2698 |                 }
 | 
        
           |  |  | 2699 |   | 
        
           |  |  | 2700 |                 url = (mod.fullpath) ? self._filter(mod.fullpath, mod.name) :
 | 
        
           |  |  | 2701 |                       self._url(mod.path, mod.name, group.base || mod.base);
 | 
        
           |  |  | 2702 |   | 
        
           |  |  | 2703 |                 if (mod.attributes || mod.async === false) {
 | 
        
           |  |  | 2704 |                     url = {
 | 
        
           |  |  | 2705 |                         url: url,
 | 
        
           |  |  | 2706 |                         async: mod.async
 | 
        
           |  |  | 2707 |                     };
 | 
        
           |  |  | 2708 |                     if (mod.attributes) {
 | 
        
           |  |  | 2709 |                         url.attributes = mod.attributes;
 | 
        
           |  |  | 2710 |                     }
 | 
        
           |  |  | 2711 |                 }
 | 
        
           |  |  | 2712 |                 resolved[mod.type].push(url);
 | 
        
           |  |  | 2713 |                 resolved[mod.type + 'Mods'].push(mod);
 | 
        
           |  |  | 2714 |             } else {
 | 
        
           |  |  | 2715 |             }
 | 
        
           |  |  | 2716 |   | 
        
           |  |  | 2717 |         };
 | 
        
           |  |  | 2718 |   | 
        
           |  |  | 2719 |         /*jslint vars: true */
 | 
        
           |  |  | 2720 |         var inserted     = (self.ignoreRegistered) ? {} : self.inserted,
 | 
        
           |  |  | 2721 |             comboSources,
 | 
        
           |  |  | 2722 |             maxURLLength,
 | 
        
           |  |  | 2723 |             comboMeta,
 | 
        
           |  |  | 2724 |             comboBase,
 | 
        
           |  |  | 2725 |             comboSep,
 | 
        
           |  |  | 2726 |             group,
 | 
        
           |  |  | 2727 |             mod,
 | 
        
           |  |  | 2728 |             len,
 | 
        
           |  |  | 2729 |             i,
 | 
        
           |  |  | 2730 |             hasComboModule = false;
 | 
        
           |  |  | 2731 |   | 
        
           |  |  | 2732 |         /*jslint vars: false */
 | 
        
           |  |  | 2733 |   | 
        
           |  |  | 2734 |         for (i = 0, len = sorted.length; i < len; i++) {
 | 
        
           |  |  | 2735 |             mod = self.getModule(sorted[i]);
 | 
        
           |  |  | 2736 |             if (!mod || inserted[mod.name]) {
 | 
        
           |  |  | 2737 |                 continue;
 | 
        
           |  |  | 2738 |             }
 | 
        
           |  |  | 2739 |   | 
        
           |  |  | 2740 |             group = self.groups[mod.group];
 | 
        
           |  |  | 2741 |   | 
        
           |  |  | 2742 |             comboBase = self.comboBase;
 | 
        
           |  |  | 2743 |   | 
        
           |  |  | 2744 |             if (group) {
 | 
        
           |  |  | 2745 |                 if (!group.combine || mod.fullpath) {
 | 
        
           |  |  | 2746 |                     //This is not a combo module, skip it and load it singly later.
 | 
        
           |  |  | 2747 |                     addSingle(mod);
 | 
        
           |  |  | 2748 |                     continue;
 | 
        
           |  |  | 2749 |                 }
 | 
        
           |  |  | 2750 |                 mod.combine = true;
 | 
        
           |  |  | 2751 |   | 
        
           |  |  | 2752 |                 if (typeof group.root === 'string') {
 | 
        
           |  |  | 2753 |                     mod.root = group.root;
 | 
        
           |  |  | 2754 |                 }
 | 
        
           |  |  | 2755 |   | 
        
           |  |  | 2756 |                 comboBase    = group.comboBase || comboBase;
 | 
        
           |  |  | 2757 |                 comboSep     = group.comboSep;
 | 
        
           |  |  | 2758 |                 maxURLLength = group.maxURLLength;
 | 
        
           |  |  | 2759 |             } else {
 | 
        
           |  |  | 2760 |                 if (!self.combine) {
 | 
        
           |  |  | 2761 |                     //This is not a combo module, skip it and load it singly later.
 | 
        
           |  |  | 2762 |                     addSingle(mod);
 | 
        
           |  |  | 2763 |                     continue;
 | 
        
           |  |  | 2764 |                 }
 | 
        
           |  |  | 2765 |             }
 | 
        
           |  |  | 2766 |   | 
        
           |  |  | 2767 |             if (!mod.combine && mod.ext) {
 | 
        
           |  |  | 2768 |                 addSingle(mod);
 | 
        
           |  |  | 2769 |                 continue;
 | 
        
           |  |  | 2770 |             }
 | 
        
           |  |  | 2771 |             hasComboModule = true;
 | 
        
           |  |  | 2772 |             comboSources = comboSources || {};
 | 
        
           |  |  | 2773 |             comboSources[comboBase] = comboSources[comboBase] ||
 | 
        
           |  |  | 2774 |                 { js: [], jsMods: [], css: [], cssMods: [] };
 | 
        
           |  |  | 2775 |   | 
        
           |  |  | 2776 |             comboMeta               = comboSources[comboBase];
 | 
        
           |  |  | 2777 |             comboMeta.group         = mod.group;
 | 
        
           |  |  | 2778 |             comboMeta.comboSep      = comboSep || self.comboSep;
 | 
        
           |  |  | 2779 |             comboMeta.maxURLLength  = maxURLLength || self.maxURLLength;
 | 
        
           |  |  | 2780 |   | 
        
           |  |  | 2781 |             comboMeta[mod.type + 'Mods'].push(mod);
 | 
        
           |  |  | 2782 |             if (mod.type === JS || mod.type === CSS) {
 | 
        
           |  |  | 2783 |                 resolved[mod.type + 'Mods'].push(mod);
 | 
        
           |  |  | 2784 |             }
 | 
        
           |  |  | 2785 |         }
 | 
        
           |  |  | 2786 |         //only encode if we have something to encode
 | 
        
           |  |  | 2787 |         if (hasComboModule) {
 | 
        
           |  |  | 2788 |             if (usePathogen) {
 | 
        
           |  |  | 2789 |                 resolved = this._pathogenEncodeComboSources(resolved);
 | 
        
           |  |  | 2790 |             } else {
 | 
        
           |  |  | 2791 |                 resolved = this._encodeComboSources(resolved, comboSources);
 | 
        
           |  |  | 2792 |             }
 | 
        
           |  |  | 2793 |         }
 | 
        
           |  |  | 2794 |         return resolved;
 | 
        
           |  |  | 2795 |     },
 | 
        
           |  |  | 2796 |   | 
        
           |  |  | 2797 |     /**
 | 
        
           |  |  | 2798 |      * Encodes combo sources and appends them to an object hash of arrays from `loader.resolve`.
 | 
        
           |  |  | 2799 |      *
 | 
        
           |  |  | 2800 |      * @method _encodeComboSources
 | 
        
           |  |  | 2801 |      * @param {Object} resolved The object hash of arrays in which to attach the encoded combo sources.
 | 
        
           |  |  | 2802 |      * @param {Object} comboSources An object containing relevant data about modules.
 | 
        
           |  |  | 2803 |      * @return Object
 | 
        
           |  |  | 2804 |      * @private
 | 
        
           |  |  | 2805 |      */
 | 
        
           |  |  | 2806 |     _encodeComboSources: function(resolved, comboSources) {
 | 
        
           |  |  | 2807 |         var fragSubset,
 | 
        
           |  |  | 2808 |             modules,
 | 
        
           |  |  | 2809 |             tmpBase,
 | 
        
           |  |  | 2810 |             baseLen,
 | 
        
           |  |  | 2811 |             frags,
 | 
        
           |  |  | 2812 |             frag,
 | 
        
           |  |  | 2813 |             type,
 | 
        
           |  |  | 2814 |             mod,
 | 
        
           |  |  | 2815 |             maxURLLength,
 | 
        
           |  |  | 2816 |             comboBase,
 | 
        
           |  |  | 2817 |             comboMeta,
 | 
        
           |  |  | 2818 |             comboSep,
 | 
        
           |  |  | 2819 |             i,
 | 
        
           |  |  | 2820 |             len,
 | 
        
           |  |  | 2821 |             self = this;
 | 
        
           |  |  | 2822 |   | 
        
           |  |  | 2823 |         for (comboBase in comboSources) {
 | 
        
           |  |  | 2824 |             if (comboSources.hasOwnProperty(comboBase)) {
 | 
        
           |  |  | 2825 |                 comboMeta    = comboSources[comboBase];
 | 
        
           |  |  | 2826 |                 comboSep     = comboMeta.comboSep;
 | 
        
           |  |  | 2827 |                 maxURLLength = comboMeta.maxURLLength;
 | 
        
           |  |  | 2828 |                 for (type in comboMeta) {
 | 
        
           |  |  | 2829 |                     if (type === JS || type === CSS) {
 | 
        
           |  |  | 2830 |                         modules = comboMeta[type + 'Mods'];
 | 
        
           |  |  | 2831 |                         frags = [];
 | 
        
           |  |  | 2832 |                         for (i = 0, len = modules.length; i < len; i += 1) {
 | 
        
           |  |  | 2833 |                             mod = modules[i];
 | 
        
           |  |  | 2834 |                             frag = ((typeof mod.root === 'string') ? mod.root : self.root) + (mod.path || mod.fullpath);
 | 
        
           |  |  | 2835 |                             frags.push(
 | 
        
           |  |  | 2836 |                                 self._filter(frag, mod.name)
 | 
        
           |  |  | 2837 |                             );
 | 
        
           |  |  | 2838 |                         }
 | 
        
           |  |  | 2839 |                         tmpBase = comboBase + frags.join(comboSep);
 | 
        
           |  |  | 2840 |                         baseLen = tmpBase.length;
 | 
        
           |  |  | 2841 |                         if (maxURLLength <= comboBase.length) {
 | 
        
           |  |  | 2842 |                             maxURLLength = MAX_URL_LENGTH;
 | 
        
           |  |  | 2843 |                         }
 | 
        
           |  |  | 2844 |   | 
        
           |  |  | 2845 |                         if (frags.length) {
 | 
        
           |  |  | 2846 |                             if (baseLen > maxURLLength) {
 | 
        
           |  |  | 2847 |                                 fragSubset = [];
 | 
        
           |  |  | 2848 |                                 for (i = 0, len = frags.length; i < len; i++) {
 | 
        
           |  |  | 2849 |                                     fragSubset.push(frags[i]);
 | 
        
           |  |  | 2850 |                                     tmpBase = comboBase + fragSubset.join(comboSep);
 | 
        
           |  |  | 2851 |   | 
        
           |  |  | 2852 |                                     if (tmpBase.length > maxURLLength) {
 | 
        
           |  |  | 2853 |                                         frag = fragSubset.pop();
 | 
        
           |  |  | 2854 |                                         tmpBase = comboBase + fragSubset.join(comboSep);
 | 
        
           |  |  | 2855 |                                         resolved[type].push(self._filter(tmpBase, null, comboMeta.group));
 | 
        
           |  |  | 2856 |                                         fragSubset = [];
 | 
        
           |  |  | 2857 |                                         if (frag) {
 | 
        
           |  |  | 2858 |                                             fragSubset.push(frag);
 | 
        
           |  |  | 2859 |                                         }
 | 
        
           |  |  | 2860 |                                     }
 | 
        
           |  |  | 2861 |                                 }
 | 
        
           |  |  | 2862 |                                 if (fragSubset.length) {
 | 
        
           |  |  | 2863 |                                     tmpBase = comboBase + fragSubset.join(comboSep);
 | 
        
           |  |  | 2864 |                                     resolved[type].push(self._filter(tmpBase, null, comboMeta.group));
 | 
        
           |  |  | 2865 |                                 }
 | 
        
           |  |  | 2866 |                             } else {
 | 
        
           |  |  | 2867 |                                 resolved[type].push(self._filter(tmpBase, null, comboMeta.group));
 | 
        
           |  |  | 2868 |                             }
 | 
        
           |  |  | 2869 |                         }
 | 
        
           |  |  | 2870 |                     }
 | 
        
           |  |  | 2871 |                 }
 | 
        
           |  |  | 2872 |             }
 | 
        
           |  |  | 2873 |         }
 | 
        
           |  |  | 2874 |         return resolved;
 | 
        
           |  |  | 2875 |     },
 | 
        
           |  |  | 2876 |   | 
        
           |  |  | 2877 |     /**
 | 
        
           |  |  | 2878 |     Shortcut to calculate, resolve and load all modules.
 | 
        
           |  |  | 2879 |   | 
        
           |  |  | 2880 |         var loader = new Y.Loader({
 | 
        
           |  |  | 2881 |             ignoreRegistered: true,
 | 
        
           |  |  | 2882 |             modules: {
 | 
        
           |  |  | 2883 |                 mod: {
 | 
        
           |  |  | 2884 |                     path: 'mod.js'
 | 
        
           |  |  | 2885 |                 }
 | 
        
           |  |  | 2886 |             },
 | 
        
           |  |  | 2887 |             requires: [ 'mod' ]
 | 
        
           |  |  | 2888 |         });
 | 
        
           |  |  | 2889 |         loader.load(function() {
 | 
        
           |  |  | 2890 |             console.log('All modules have loaded..');
 | 
        
           |  |  | 2891 |         });
 | 
        
           |  |  | 2892 |   | 
        
           |  |  | 2893 |   | 
        
           |  |  | 2894 |     @method load
 | 
        
           |  |  | 2895 |     @param {Function} cb Executed after all load operations are complete
 | 
        
           |  |  | 2896 |     */
 | 
        
           |  |  | 2897 |     load: function(cb) {
 | 
        
           |  |  | 2898 |         if (!cb) {
 | 
        
           |  |  | 2899 |             return;
 | 
        
           |  |  | 2900 |         }
 | 
        
           |  |  | 2901 |         var self = this,
 | 
        
           |  |  | 2902 |             out = self.resolve(true);
 | 
        
           |  |  | 2903 |   | 
        
           |  |  | 2904 |         self.data = out;
 | 
        
           |  |  | 2905 |   | 
        
           |  |  | 2906 |         self.onEnd = function() {
 | 
        
           |  |  | 2907 |             cb.apply(self.context || self, arguments);
 | 
        
           |  |  | 2908 |         };
 | 
        
           |  |  | 2909 |   | 
        
           |  |  | 2910 |         self.insert();
 | 
        
           |  |  | 2911 |     }
 | 
        
           |  |  | 2912 | };
 | 
        
           |  |  | 2913 |   | 
        
           |  |  | 2914 |   | 
        
           |  |  | 2915 | }, '3.18.1', {"requires": ["get", "features"]});
 |