forked from stealjs/steal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
steal.production.js
4 lines (4 loc) · 21.8 KB
/
steal.production.js
1
2
3
4
/*! StealJS - 3.3.0pre - 2013-03-10
* http://javascriptmvc.com/docs.html#!stealjs
* Copyright (c) 2013 Bitovi; Licensed MIT */
(function(e){function f(e,t,n,r,i){var s=t[0],o=i.attr("types")[t.shift()];o.require(e,function(){t.length?f(e,t,n,r,i):n.apply(this,arguments)},r,i)}function y(e,t,i){var s,o={},a=function(){},l=function(){var e=n.map(arguments,function(e){if(e){var t=n.isString(e)?{id:e}:e;return t.idToUri||(t.idToUri=l.idToUri),t}return e});return e.length&&(v.pending.push.apply(v.pending,e),l.after(e)),l};i&&(n.win.steal=l),l.clone=function(){return y(!1,t.cloneContext())},l.config=function(){return l.config.called=!0,t.attr.apply(t,arguments)},l.require=function(){return t.require.apply(t,arguments)},l.config.called=!1,l._id=Math.floor(1e3*Math.random()),l.getScriptOptions=function(e){var t={},r,i,s,o,u;e=e||n.getStealScriptSrc();if(e){r=e.src.split("?"),i=r.shift(),s=r.join("?"),r=s.split(","),i.indexOf("steal.production")>-1&&(t.env="production"),o=r[0],o&&(o.indexOf(".js")==-1&&(o+="/"+o.split("/").pop()+".js"),t.startId=o),u=r[1],u&&(t.env=u),r=i.split("/"),r.pop(),r[r.length-1]=="steal"&&r.pop();var a=r.join("/");t.root=a}return t},l.id=function(e,r,i){var s=u(e);s=s.addJS().normalize(r?new u(r):null),i||(i="js"),i=="js";var o=t.attr().map||{};return n.each(o,function(e,t){n.matchesId(e,r)&&n.each(t,function(e,t){(""+s).indexOf(e)==0&&(s=u((""+s).replace(e,t)))})}),s},l.amdToId=function(e,r,i){var s=u(e);s=s.normalize(r?new u(r):null),i||(i="js"),i=="js";var o=t.attr().map||{};return n.each(o,function(e,t){n.matchesId(e,r)&&n.each(t,function(e,t){(""+s).indexOf(e)==0&&(s=u((""+s).replace(e,t)))})}),s},l.idToUri=function(e,r){var i=t.attr().paths||{},s;return n.each(i,function(t,r){s=""+e;if(n.endsInSlashRegex.test(t)&&s.indexOf(t)==0||s===t)e=u(s.replace(t,r))}),r?e:t.attr().root.join(e)},l.amdIdToUri=function(e,r){var i=t.attr().paths||{},s;return n.each(i,function(t,r){s=""+e;if(n.endsInSlashRegex.test(t)&&s.indexOf(t)==0||s===t)e=u(s.replace(t,r))}),/(^|\/)[^\/\.]+$/.test(e)&&(e=u(e+".js")),e};var h={};t.attr("amd")===!0&&(n.win.define=function(e,t,r){typeof e=="function"?h[u.cur+""]=e():!r&&t?typeof t=="function"?h[e]=t():h[e]=t:t&&r&&!t.length?h[e]=r():l.apply(null,n.map(t,function(e){return e=typeof e=="string"?{id:e}:e,e.toId=l.amdToId,e.idToUri=l.amdIdToUri,e}).concat(r))},n.win.require=function(e,t){var r=n.map(e,function(e){return e=typeof e=="string"?{id:e}:e,e.toId=l.amdToId,e.idToUri=l.amdIdToUri,e}).concat([t]);l.apply(null,r)},n.win.define.amd={jQuery:!0},define("steal",[],function(){return l}),define("require",function(){return f}));var p={},d;n.extend(l,{each:n.each,extend:n.extend,Deferred:r,isRhino:n.win.load&&n.win.readUrl&&n.win.readFile,makeOptions:function(e,n){if(!e.id)throw{message:"no id",options:e};e.id=e.toId?e.toId(e.id,n):l.id(e.id,n),e.ext=e.id.ext(),e.src=e.idToUri?e.idToUri(e.id)+"":steal.idToUri(e.id)+"";var r=t.attr().ext[e.ext];return r&&!t.attr().types[r]&&(e.needs||(e.needs=[]),e.needs.push(r)),e},then:function(){var e=n.map(arguments);return e.unshift(null),l.apply(n.win,e)},bind:function(e,t){p[e]||(p[e]=[]);var n=l.events[e];return n&&n.add&&(t=n.add(t)),t&&p[e].push(t),l},one:function(e,t){return l.bind(e,function(){t.apply(this,arguments),l.unbind(e,arguments.callee)})},events:{},unbind:function(e,t){var n=p[e]||[],r=0;while(r<n.length)t===n[r]?n.splice(r,1):r++},trigger:function(e,t){var r=p[e]||[];n.each(n.map(r),function(e,n){n(t)})},has:function(){n.support.interactive=!1,n.each(arguments,function(e,t){var n=v.make({id:t,idToUri:l.idToUri});n.loading=n.executing=!0})},make:function(e){var t=typeof e=="string"?{id:e}:e;return t.idToUri||(t.idToUri=l.idToUri),v.make(t)},preexecuted:function(){},executed:function(e){var t=v.make({id:e,idToUri:l.idToUri});return t.loading=t.executing=!0,l.preexecuted(t),t.executed(),steal.packHash[e]&&steal.executed(steal.packHash[e]),l},type:function(e,n){var r=e.split(" ");if(!n)return t.attr("types")[r.shift()].require;var r=e.split(" ");if(!n)return t.attr("types")[r.shift()].require;var i={};i[e]=n,t.attr("types",i)},request:n.request}),n.useIEShim=function(){if(l.isRhino)return!1;var e=document.createElement("div");return e.innerHTML="<!--[if lt IE 9]>ie<![endif]-->",!!n.scriptTag().readyState&&e.innerText==="ie"}(),l.packs=[],l.packHash={},l.packages=function(e){return arguments.length?(typeof e=="string"?l.packs.push.apply(l.packs,arguments):l.packHash=e,this):l.packs};var v=g(l,h,o,t);resources=v.modules,l.setupShims=function(e){for(var t in e){var r=e[t];(function(e,t){var r=t.init||t.exports;t.deps&&(t.needs=t.deps),delete t.init,delete t.exports,delete t.deps,n.extend(e.options,t),r&&(e.exports=function(){var i=[];n.each(t.needs||[],function(e,t){i.push(v.make(t).value)}),typeof r=="function"?e.value=r.apply(null,i):e.value=n.win[r]})})(v.make({id:t}),typeof r=="string"?{deps:[r]}:r.length?{deps:r}:r)}};var m=!1;n.extend(l,{mappings:{},map:function(e,t){return n.isString(e)?(l.mappings[e]={test:new RegExp("^(/?"+e+")([/.]|$)"),path:t},n.each(h,function(e,t){if(t.options.type!="fn"){var n=t.options.buildType;t.updateOptions(),t.options.buildType=n}})):n.each(e,l.map),this},after:function(){if(!m){m=new v;var e=m,t=function(){l.trigger("start",e),e.completed.then(function(){m=null,l.trigger("end",e)}),e.executed()};n.win.setTimeout?(l.pushPending(),setTimeout(function(){l.popPending(),t()},0)):t()}},_before:n.before,_after:n.after}),function(){var e;l.pushPending=function(){e=v.pending.slice(0),v.pending=[],n.each(e,function(e,t){v.make(t)})},l.popPending=function(){v.pending=v.pending.length?e.concat(null,v.pending):e}}(),function(){var e=!1,t,r=!1;v.prototype.executed=n.before(v.prototype.executed,function(){var r=n.win.jQuery;r&&"readyWait"in r&&(e||(t=r,r.readyWait+=1,e=!0))}),l.bind("end",function(){e&&!r&&(t.ready(!0),r=!0)})}();var b={load:r(),end:r()},w=!1;n.addEvent(n.win,"load",function(){b.load.resolve()}),l.one("end",function(e){b.end.resolve(e),w=e,l.trigger("done",w)}),l.firstComplete=b.end,r.when(b.load,b.end).then(function(){l.trigger("ready"),l.isReady=!0}),l.events.done={add:function(e){return w?(e(w),!1):e}},a=n.after(a,function(){var e=l.getScriptOptions(),r=n.win.location&&decodeURIComponent(n.win.location.search);r&&r.replace(/steal\[([^\]]+)\]=([^&]+)/g,function(t,n,r){e[n]=~r.indexOf(",")?r.split(","):r}),t.attr(e);var i=t.attr();n.each(i.executed||[],function(e,t){l.executed(t)});var s=[];i.startIds&&(s.push.apply(s,n.isString(i.startIds)?[i.startIds]:i.startIds),i.startIds=s.slice(0)),t.attr().env=="production"&&t.attr().loadProduction&&t.attr().productionId?l({id:t.attr().productionId,force:!0}):t.attr().env=="development"&&(s.unshift({id:"stealconfig.js",abort:!1}),i.loadDev!==!1&&s.unshift({id:"steal/dev/dev.js",ignore:!0}),i.startId&&s.push(null,i.startId)),s.length&&l.apply(n.win,s)});var E=function(){var e=n.getElementsByTagName("script"),t=e.length;while(t--)if(e[t].readyState==="interactive")return e[t]},S=function(){return s&&s.readyState==="interactive"?s:(s=E())?s:c&&c.readyState=="interactive"?c:null};n.support.interactive=n.doc&&!!E(),n.support.interactive&&(l.after=n.after(l.after,function(){if(!n.support.interactive)return;var e=S();if(!e||!e.src||/steal\.(production|production\.[a-zA-Z0-9\-\.\_]*)*js/.test(e.src))return;var t=e.src;o[t]||(o[t]=[]),t&&(o[t].push.apply(o[t],v.pending),v.pending=[])}),l.preexecuted=n.before(l.preexecuted,function(e){if(!n.support.interactive)return;var t=e.options.src,r=S().src;o[t]=o[r],o[r]=null})),t.on(function(e){n.each(resources,function(e,t){t.rewriteIdAndUpdateOptions(e)}),e.shim&&l.setupShims(e.shim),e.completed&&n.each(n.isString(e.completed)?[e.completed]:e.completed,function(e,t){v.make({id:t}).executed()})}),l.File=l.URI=u;if(e){var x=new v({id:"steal"});x.value=l,x.loaded.resolve(),x.run.resolve(),x.executing=!0,x.completed.resolve(),resources[x.options.id]=x}return a(),l.resources=resources,l.Module=v,l}var t=function(){return n.win.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest},n={win:function(){return this}.call(null),each:function(e,t){var n,r;if(typeof e.length=="number")for(n=0,r=e.length;n<r;n++)t.call(e[n],n,e[n],e);else for(n in e)e.hasOwnProperty(n)&&t.call(e[n],n,e[n],e);return e},uniquePush:function(e,t){if(n.inArray(e,t)===-1)return e.push(t)},isString:function(e){return typeof e=="string"},isFn:function(e){return typeof e=="function"},noop:function(){},endsInSlashRegex:/\/$/,createElement:function(e){return n.doc.createElement(e)},scriptTag:function(){var e=n.createElement("script");return e.type="text/javascript",e},getElementsByTagName:function(e){return n.doc.getElementsByTagName(e)},head:function(){var e=n.getElementsByTagName("head")[0];return e||(e=n.createElement("head"),n.docEl.insertBefore(e,n.docEl.firstChild)),n.head=function(){return e},e},extend:function(e,t){return t&&n.each(t,function(n){t.hasOwnProperty(n)&&(e[n]=t[n])}),e},map:function(e,t){var r=[];return n.each(e,function(e,i){r.push(t?n.isString(t)?i[t]:t.call(i,i):i)}),r},before:function(e,t,n){return n?function(){return e.apply(this,t.apply(this,arguments))}:function(){return t.apply(this,arguments),e.apply(this,arguments)}},after:function(e,t,r){return r?function(){return t.apply(this,[e.apply(this,arguments)].concat(n.map(arguments)))}:function(){var r=e.apply(this,arguments);return t.apply(this,arguments),r}},request:function(e,n,r){var i=new t,s=e.contentType||"application/x-www-form-urlencoded; charset=utf-8",o=function(){i=u=o=null},u=function(){var e;i&&i.readyState===4&&(e=i.status,e===500||e===404||e===2||i.status<0||!e&&i.responseText===""?r&&r(i.status):n(i.responseText),o())};i.open("GET",e.src+"",e.async!==!1),i.setRequestHeader("Content-type",s),i.overrideMimeType&&i.overrideMimeType(s),i.onreadystatechange=u;try{i.send(null)}catch(a){o&&(console.error(a),r&&r(),o())}},matchesId:function(e,t){if(e==="*")return!0;if(t.indexOf(e)===0)return!0},stealCheck:/steal\.(production\.)?js.*/,getStealScriptSrc:function(){if(!n.doc)return;var e=n.getElementsByTagName("script"),t;return n.each(e,function(e,r){n.stealCheck.test(r.src)&&(t=r)}),t},inArray:function(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1},addEvent:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):n()},useIEShim:!1};n.doc=n.win.document,n.docEl=n.doc&&n.doc.documentElement,n.support={error:n.doc&&function(){var e=n.scriptTag();return e.onerror=n.noop,n.isFn(e.onerror)||"onerror"in e}(),interactive:!1,attachEvent:n.doc&&n.scriptTag().attachEvent};var r=function(e){if(!(this instanceof r))return new r;this.doneFuncs=[],this.failFuncs=[],this.resultArgs=null,this.status="",e&&e.call(this,this)};r.when=function(){var e=n.map(arguments);if(e.length<2){var t=e[0];return t&&n.isFn(t.isResolved)&&n.isFn(t.isRejected)?t:r().resolve(t)}var i=r(),s=0,o=[];return n.each(e,function(t,n){n.done(function(){o[t]=arguments.length<2?arguments[0]:arguments,++s==e.length&&i.resolve.apply(i,o)}).fail(function(){i.reject(arguments)})}),i};var i=function(e,t){return function(n){var r=this.resultArgs=arguments.length>1?arguments[1]:[];return this.exec(n,this[e],r,t)}},s=function(e,t){return function(){var r=this;return n.each(arguments,function(n,i,s){if(!i)return;i.constructor===Array?s.callee.apply(r,i):(r.status===t&&i.apply(this,r.resultArgs||[]),r[e].push(i))}),this}};n.extend(r.prototype,{resolveWith:i("doneFuncs","rs"),rejectWith:i("failFuncs","rj"),done:s("doneFuncs","rs"),fail:s("failFuncs","rj"),always:function(){var e=n.map(arguments);return e.length&&e[0]&&this.done(e[0]).fail(e[0]),this},then:function(){var e=n.map(arguments);return e.length>1&&e[1]&&this.fail(e[1]),e.length&&e[0]&&this.done(e[0]),this},isResolved:function(){return this.status==="rs"},isRejected:function(){return this.status==="rj"},reject:function(){return this.rejectWith(this,arguments)},resolve:function(){return this.resolveWith(this,arguments)},exec:function(e,t,r,i){return this.status!==""?this:(this.status=i,n.each(t,function(t,n){n.apply(e,r)}),this)}});var o=function(e,t,i,s){var o=n.map(e,t);return r.when.apply(r,o).then(function(){n.isFn(i[s])?i[s]():i[s].resolve()})},u=function(e){if(this.constructor!==u)return new u(e);n.extend(this,u.parse(""+e))};n.extend(u,{parse:function(e){var t=e.split("?"),n=t.shift(),r=t.join("").split("#"),i=n.split("://"),s={query:r.shift(),fragment:r.join("#")},o;return i[1]?(s.protocol=i.shift(),o=i[0].split("/"),s.host=o.shift(),s.path="/"+o.join("/")):s.path=i[0],s}}),u.page=u(n.win.location&&location.href),u.cur=u(),n.extend(u.prototype,{dir:function(){var e=this.path.split("/");return e.pop(),u(this.domain()+e.join("/"))},filename:function(){return this.path.split("/").pop()},ext:function(){var e=this.filename();return e.indexOf(".")>-1?e.split(".").pop():""},domain:function(){return this.protocol?this.protocol+"://"+this.host:""},isCrossDomain:function(e){e=u(e||n.win.location.href);var t=this.domain(),r=e.domain();return t&&r&&t!=r||this.protocol==="file"||t&&!r},isRelativeToDomain:function(){return!this.path.indexOf("/")},hash:function(){return this.fragment?"#"+this.fragment:""},search:function(){return this.query?"?"+this.query:""},add:function(e){return this.join(e)+""},join:function(e,t){e=u(e);if(e.isCrossDomain(this))return e;if(e.isRelativeToDomain())return u(this.domain()+e);var r=this.path?this.path.split("/"):[],i=e.path.split("/"),s=i[0];this.path.match(/\/$/)&&r.pop();while(s==".."&&r.length&&r[r.length-1]!==".."){if(!r.pop())break;i.shift(),s=i[0]}return n.extend(u(this.domain()+r.concat(i).join("/")),{query:e.query})},normalize:function(e){e=e?e.dir():u.cur.dir();var t=this.path,n=u(t);return t.indexOf("//")?t.indexOf("./")?this.isRelative()&&(n=e.join(this.domain()+t)):n=e.join(t.substr(2)):n=u(t.substr(2)),n.query=this.query,n},isRelative:function(){return/^[\.|\/]/.test(this.path)},pathTo:function(e){e=u(e);var t=e.path.split("/"),r=this.path.split("/"),i=[];while(t.length&&r.length&&t[0]==r[0])t.shift(),r.shift();return n.each(r,function(){i.push("../")}),u(i.join("")+t.join("/"))},mapJoin:function(e){return this.join(u(e).insertMapping())},addJS:function(){var e=this.ext();return e||(this.isRelative()||(this.path+="/"+this.filename()),this.path+=".js"),this}}),u.prototype.toString=function(){return this.domain()+this.path+this.search()+this.hash()},u.prototype.insertMapping=function(){var e=""+this,t,n;for(t in steal.mappings){n=steal.mappings[t];if(n.test.test(e))return e.replace(t,n.path)}return u(e)};var a=function(e){this.stealConfig={},this.callbacks=[],this.attr(a.defaults),this.attr(e)};n.extend(a.prototype,{attr:function(e,t){if(!e)return this.stealConfig;if(typeof e=="string"){if(arguments.length===1)return this.stealConfig&&this.stealConfig[e];var r={};r[e]=t,e=r}this.stealConfig=this.stealConfig||{};for(var i in e){var t=e[i];this[i]?this[i](t):typeof t=="object"&&this.stealConfig[i]?n.extend(this.stealConfig[i],t):this.stealConfig[i]=t}for(var s=0;s<this.callbacks.length;s++)this.callbacks[s](this.stealConfig);return this},on:function(e){this.callbacks.push(e)},startId:function(e){this.stealConfig.startId=""+u(e).addJS(),this.stealConfig.productionId||(this.stealConfig.productionId=u(this.stealConfig.startId).dir()+"/production.js")},root:function(t){if(t!==e){var n=u(t),r=u.page,i=r.join(t);return u.cur=i.pathTo(r),this.stealConfig.root=n,this}this.stealConfig.root=n||u("")},cloneContext:function(){return new a(n.extend({},this.stealConfig))}}),a.defaults={types:{},ext:{},env:"development",loadProduction:!0,logLevel:0,root:"",amd:!1},a.prototype.types=function(e){var t=this.stealConfig.types||(this.stealConfig.types={});n.each(e,function(e,n){var r=e.split(" ");t[r.shift()]={require:n,convert:r}})},a.prototype.require=function(e,t,n){if(e.idToUri){var r=e.src;e.src=this.addSuffix(e.idToUri(e.id))}var i=this.attr().types[e.type],s;i.convert.length?(s=i.convert.slice(0),s.unshift("text",e.type)):s=[e.type],f(e,s,t,n,this)},a.prototype.addSuffix=function(e){var t=this.attr("suffix");return t&&(e=(e+"").indexOf("?")>-1?e+"&"+t:e+"?"+t),e};var l=function(e){e.onreadystatechange=e.onload=e.onerror=null,setTimeout(function(){n.head().removeChild(e)},1)},c,h=/^loade|c|u/,p=0,d=n.doc&&n.doc.createStyleSheet,v,m;a.defaults.types={js:function(e,t,r){var i=n.scriptTag(),s=function(){if(!i.readyState||h.test(i.readyState))l(i),t()},o;if(e.text)i.text=e.text;else{var u=e.src;n.useIEShim?i.onreadystatechange=function(){h.test(i.readyState)&&t()}:(i.onload=s,n.support.error&&r&&u.protocol!=="file"&&(i.onerror=r)),i.src=""+u,i.onSuccess=t}c=i,n.head().insertBefore(i,n.head().firstChild),e.text&&s()},fn:function(e,t){var n;e.skipCallbacks||(n=e.fn()),t(n)},text:function(e,t,r){n.request(e,function(n){e.text=n,t(n)},r)},css:function(e,t,r){if(e.text){var i=n.createElement("style");i.type="text/css",i.styleSheet?i.styleSheet.cssText=e.text:function(e){i.childNodes.length?i.firstChild.nodeValue!==e.nodeValue&&i.replaceChild(e,i.firstChild):i.appendChild(e)}(n.doc.createTextNode(e.text)),n.head().appendChild(i)}else{if(d){if(!(p++))v=n.doc.createStyleSheet(e.src),m=e;else{var s=""+u(u(m.src).dir()).pathTo(e.src);v.addImport(s),p==30&&(p=0)}t();return}e=e||{};var o=n.createElement("link");o.rel=e.rel||"stylesheet",o.href=e.src,o.type="text/css",n.head().appendChild(o)}t()}};var g=function(e,t,i,s){var a={},f=0,l=function(t){this.dependencies=[],this.needsDependencies=[],this.id=++f,this.orig=t,this.curId=e.cur&&e.cur.options.id,this.setOptions(t),this.loaded=r(),this.run=r(),this.completed=r()};return l.pending=[],l.make=function(e){var t=new l(e),r=t.options.id;if(t.unique&&r){if(!!a[r]||!!a[r+".js"]){existingModule=a[r];if(!n.isString(e))for(var i in e)i!=="id"&&(existingModule.options[i]=e[i]);return existingModule}a[r]=t}return t},n.extend(l.prototype,{setOptions:function(r){var i=this.options;if(!r)this.options={},this.waits=!1;else if(n.isFn(r)){var s=u.cur,o=this,a=e.cur;this.options={fn:function(){u.cur=s;var e=[],n=!1,i,f;for(var l=a.dependencies.length;l>=0;l--){i=a.dependencies[l];if(n){if(i===null)break;f=t[i.options.id]||t[i.orig]||i.value,e.unshift(f)}i===o&&(n=!0)}var c=r.apply(a,e);return c&&(a.value=c),c},id:s,type:"fn"},this.waits=!0,this.unique=!1}else this.options=e.makeOptions(n.extend({},r),this.curId),this.waits=this.options.waits||!1,this.unique=!0;for(opt in i)this.options[opt]||(this.options[opt]=i[opt]);this.options.id&&(this.options.abort=!1)},complete:function(){this.completed.resolve()},executed:function(t){var r,s,o=this.options.src,a=this.options.rootSrc;this.options.id&&(u.cur=u(this.options.id)),this.exports&&this.exports(),e.cur=this,this.run.resolve();if(n.support.interactive&&o&&i[o]){r=[];if(i.length)for(var f=0;f<i.length;f++)i[f]!==this.orig&&r.push(i[f]);else i[o]!==this.orig&&(r=i[o],delete i[o])}r||(r=l.pending.slice(0),l.pending=[]);if(!r.length){this.complete();return}this.addDependencies(r),this.loadDependencies()},addDependencies:function(t){var r=this,i=e.config().env=="production";this.queue=[],n.each(t,function(t,n){if(n===null){r.queue.push(null);return}if(i&&n.ignore||!i&&!e.isRhino&&n.prodonly)return;var s=l.make(n);e.packHash[s.options.id]&&s.options.type!=="fn"&&(e.has(""+s.options.id),s=e.make(e.packHash[""+s.options.id])),r.queue.push(s)})},loadDependencies:function(){var e=this,t=[],r=[],i=[],s=!0;n.each(this.queue,function(u,a){e.dependencies.push(a);if((a===null||a.waits)&&r.length){t=t.concat(r),r=[],s=!1;if(a===null)return}if(a===null)return;a.isSetupToExecute=!0;var f=t.slice(0);n.each(a.options.needs||[],function(t,r){var s=l.make({id:r,idToUri:e.options.idToUri});n.uniquePush(a.needsDependencies,s),f.push(s),i.push(s)}),f.length&&o(f,"completed",a,"execute"),r.push(a),s&&(a.options.needs||[]).length==0&&i.push(a),a.load()}),t=t.concat(r),o(t,"completed",e,"completed"),n.each(i,function(e,t){t.execute()})},load:function(e){if(this.loading||this.loaded.isResolved())return;this.loading=!0,this.loaded.resolve()},execute:function(){var t=this;if(this.lateNeedDependency&&!this.lateNeedDependency.completed.isResolved()){this.lateNeedDependency.completed.then(function(){t.execute()});return}var r=this.options,i=s.attr("types");if(!r.type){var o=u(r.id).ext();!o&&!i[o]&&(o="js"),r.type=o}if(!i[r.type]&&e.config().env=="development")throw"steal.js - type "+r.type+" has not been loaded.";if(!i[r.type]&&e.config().env=="production")return;var a=i[r.type].convert;r.buildType=a.length?a[a.length-1]:r.type,t.loaded.isResolved()||t.loaded.resolve(),t.executing||(t.executing=!0,s.require(t.options,function(e){t.executed(e)},function(e,r){var i=t.options.abort,s=t.options.error;s&&s.call(t.options),n.win.clearTimeout&&n.win.clearTimeout(t.completeTimeout);if(i===!1){t.executed();return}throw"steal.js : "+t.options.src+" not completed"}))},updateOptions:function(){var e=this.options.buildType,t=this.options;this.setOptions(this.orig);var n=this.options;this.options=t;for(opt in n)this.options[opt]=n[opt];this.options.buildType=e},rewriteIdAndUpdateOptions:function(e){if(this.options.type!="fn"){var t=(this.options.needs||[]).slice(0),n=this.options.buildType;this.updateOptions();var r=this.options.id;e!==r&&(a[r]=this),this.options.buildType=n,this.isSetupToExecute&&this.addLateDependencies(t)}},addLateDependencies:function(t){var r=this;n.each(this.options.needs||[],function(i,s){if(n.inArray(t,s)==-1){var o=e.make(s);o.execute(),r.needsDependencies.push(o),r.lateNeedDependency=o}})}}),n.extend(l.prototype,{load:n.after(l.prototype.load,function(t){var r=this;n.doc&&!r.completed&&!r.completeTimeout&&!e.isRhino&&(r.options.src.protocol=="file"||!n.support.error)&&(r.completeTimeout=setTimeout(function(){throw"steal.js : "+r.options.src+" not completed"},5e3))}),complete:n.after(l.prototype.complete,function(){this.completeTimeout&&clearTimeout(this.completeTimeout)}),executed:n.before(l.prototype.executed,function(){this.options.has&&this.loadHas()}),loadHas:function(){var t,r,i=u.cur;if(this.options.buildType=="js")return;n.each(this.options.has,function(t,n){u.cur=u(i),e.executed(n)})}}),l.make=n.after(l.make,function(t){return t.options.has&&(t.run.isResolved()?t.loadHas():e.has.apply(e,t.options.has)),t},!0),l.modules=a,l};y(!0,new a(typeof n.win.steal=="object"?n.win.steal:{}),!0)})();