-
Notifications
You must be signed in to change notification settings - Fork 5
/
tinyamd.min.js
1 lines (1 loc) · 2.57 KB
/
tinyamd.min.js
1
(function(b,e){var n=document;var l=n.head||n.getElementsByTagName("head")[0]||n.documentElement;var f=(function(p){return p[p.length-1]})(n.getElementsByTagName("script"));var h=f.getAttribute("data-main");var m=[];var g={baseUrl:(function(q){var p=q.split("/").slice(0,3).join("/");var r;if(h){if(h.slice(0,p.length)===p){r=h}else{if(h[0]==="/"){r=p+h}else{r=q.slice(0,q.lastIndexOf("/")+1)+h}}h=h.slice(h.lastIndexOf("/")+1)}else{r=q}return r.slice(0,r.lastIndexOf("/")+1)})(b.location.href.split("?")[0])};var i={};function c(q){if(typeof q==="object"){for(var p in q){q.hasOwnProperty(p)&&(g[p]=q[p])}}}function k(t,s,p){var r=arguments.length;if(r===1){p=t;s=["require","exports","module"];t=null}else{if(r===2){if(g.toString.call(t)==="[object Array]"){p=s;s=t;t=null}else{p=s;s=["require","exports","module"]}}}if(!t){m.push([s,p]);return}function q(){var v,y,w;if(i[t]){v=i[t].handlers;y=i[t].context}w=i[t]=typeof p==="function"?p.apply(null,m.slice.call(arguments,0))||i[t]||{}:p;w.tinyamd=2;w.context=y;for(var u=0,z=v?v.length:0;u<z;u++){v[u](w)}}d(s,q,t)}k.amd={};function d(r,w,p){var u=[],t=0,y=false;if(typeof r==="string"){if(i[r]&&i[r].tinyamd===2){return i[r]}throw new Error(r+" has not been defined. Please include it as a dependency in "+p+"'s define()");return}for(var v=0,s=r.length;v<s;v++){switch(r[v]){case"require":var q=function(x,z){return d(x,z,p)};q.toUrl=function(x){return a(x,p)};u[v]=q;t++;break;case"exports":u[v]=i[p]||(i[p]={});t++;break;case"module":u[v]={id:p,uri:a(p)};t++;break;case i[p]?i[p].context:"":u[v]=i[i[p].context];t++;break;default:(function(z){o(r[z],function(x){u[z]=x;t++;t===s&&w&&(y=true,w.apply(null,u))},p)})(v)}}!y&&t===s&&w&&w.apply(null,u)}function o(q,r,p){q=p?a(q,p):q;if(i[q]){if(i[q].tinyamd===1){r&&i[q].handlers.push(r)}else{r&&r(i[q])}return}else{i[q]={tinyamd:1,handlers:[r],context:p}}j(a(q)+".js",function(){var s;if(s=m.shift()){s.unshift(q);i[q].tinyamd===1&&k.apply(null,s)}})}var a=d.toUrl=function(t,q){var r,p,s;switch(t){case"require":case"exports":case"module":return t}r=(q||g.baseUrl).split("/");r.pop();t=t.split("/");p=t.length;while(--p){switch(t[0]){case"..":r.pop();case".":case"":t.shift();s=true}}return(r.length&&s?r.join("/")+"/":"")+t.join("/")};function j(q,r){var p=n.createElement("script");p.onload=p.onreadystatechange=function(){if(!this.readyState||this.readyState==="loaded"||this.readyState==="complete"){p.onload=p.onreadystatechange=null;l.removeChild(p);r&&r()}};p.type="text/javascript";p.async=true;p.src=q;l.appendChild(p)}b.tinyamd={config:c,inject:j,define:b.define=k,require:b.require=d,exports:i};h&&d(h)})(this);