filer/dist/filer.min.js

5 lines
113 KiB
JavaScript
Raw Normal View History

/*! filer 2014-03-08 */
(function(t,e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Filer||(t.Filer=e())})(this,function(){var t,e,n;(function(r){function o(t,e){return b.call(t,e)}function i(t,e){var n,r,o,i,s,c,a,u,f,p,l=e&&e.split("/"),d=m.map,h=d&&d["*"]||{};if(t&&"."===t.charAt(0))if(e){for(l=l.slice(0,l.length-1),t=l.concat(t.split("/")),u=0;t.length>u;u+=1)if(p=t[u],"."===p)t.splice(u,1),u-=1;else if(".."===p){if(1===u&&(".."===t[2]||".."===t[0]))break;u>0&&(t.splice(u-1,2),u-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((l||h)&&d){for(n=t.split("/"),u=n.length;u>0;u-=1){if(r=n.slice(0,u).join("/"),l)for(f=l.length;f>0;f-=1)if(o=d[l.slice(0,f).join("/")],o&&(o=o[r])){i=o,s=u;break}if(i)break;!c&&h&&h[r]&&(c=h[r],a=u)}!i&&c&&(i=c,s=a),i&&(n.splice(0,s,i),t=n.join("/"))}return t}function s(t,e){return function(){return d.apply(r,w.call(arguments,0).concat([t,e]))}}function c(t){return function(e){return i(e,t)}}function a(t){return function(e){g[t]=e}}function u(t){if(o(v,t)){var e=v[t];delete v[t],E[t]=!0,l.apply(r,e)}if(!o(g,t)&&!o(E,t))throw Error("No "+t);return g[t]}function f(t){var e,n=t?t.indexOf("!"):-1;return n>-1&&(e=t.substring(0,n),t=t.substring(n+1,t.length)),[e,t]}function p(t){return function(){return m&&m.config&&m.config[t]||{}}}var l,d,h,y,g={},v={},m={},E={},b=Object.prototype.hasOwnProperty,w=[].slice;h=function(t,e){var n,r=f(t),o=r[0];return t=r[1],o&&(o=i(o,e),n=u(o)),o?t=n&&n.normalize?n.normalize(t,c(e)):i(t,e):(t=i(t,e),r=f(t),o=r[0],t=r[1],o&&(n=u(o))),{f:o?o+"!"+t:t,n:t,pr:o,p:n}},y={require:function(t){return s(t)},exports:function(t){var e=g[t];return e!==void 0?e:g[t]={}},module:function(t){return{id:t,uri:"",exports:g[t],config:p(t)}}},l=function(t,e,n,i){var c,f,p,l,d,m,b=[];if(i=i||t,"function"==typeof n){for(e=!e.length&&n.length?["require","exports","module"]:e,d=0;e.length>d;d+=1)if(l=h(e[d],i),f=l.f,"require"===f)b[d]=y.require(t);else if("exports"===f)b[d]=y.exports(t),m=!0;else if("module"===f)c=b[d]=y.module(t);else if(o(g,f)||o(v,f)||o(E,f))b[d]=u(f);else{if(!l.p)throw Error(t+" missing "+f);l.p.load(l.n,s(i,!0),a(f),{}),b[d]=g[f]}p=n.apply(g[t],b),t&&(c&&c.exports!==r&&c.exports!==g[t]?g[t]=c.exports:p===r&&m||(g[t]=p))}else t&&(g[t]=n)},t=e=d=function(t,e,n,o,i){return"string"==typeof t?y[t]?y[t](e):u(h(t,e).f):(t.splice||(m=t,e.splice?(t=e,e=n,n=null):t=r),e=e||function(){},"function"==typeof n&&(n=o,o=i),o?l(r,t,e,n):setTimeout(function(){l(r,t,e,n)},4),d)},d.config=function(t){return m=t,m.deps&&d(m.deps,m.callback),d},n=function(t,e,n){e.splice||(n=e,e=[]),o(g,t)||o(v,t)||(v[t]=[t,e,n])},n.amd={jQuery:!0}})(),n("build/almond",function(){}),n("nodash",["require"],function(){function t(t,e){return d.call(t,e)}function e(t){return null==t?0:t.length===+t.length?t.length:g(t).length}function n(t){return t}function r(t,e,n){var r,o;if(null!=t)if(u&&t.forEach===u)t.forEach(e,n);else if(t.length===+t.length){for(r=0,o=t.length;o>r;r++)if(e.call(n,t[r],r,t)===y)return}else{var i=i(t);for(r=0,o=i.length;o>r;r++)if(e.call(n,t[i[r]],i[r],t)===y)return}}function o(t,e,o){e||(e=n);var i=!1;return null==t?i:p&&t.some===p?t.some(e,o):(r(t,function(t,n,r){return i||(i=e.call(o,t,n,r))?y:void 0}),!!i)}function i(t,e){return null==t?!1:f&&t.indexOf===f?-1!=t.indexOf(e):o(t,function(t){return t===e})}function s(t){this.value=t}function c(t){return t&&"object"==typeof t&&!Array.isArray(t)&&d.call(t,"__wrapped__")?t:new s(t)}var a=Array.prototype,u=a.forEach,f=a.indexOf,p=a.some,l=Object.prototype,d=l.hasOwnProperty,h=Object.keys,y={},g=h||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var n=[];for(var r in e)t(e,r)&&n.push(r);return n};return s.prototype.has=function(e){return t(this.value,e)},s.prototype.contains=function(t){return i(this.value,t)},s.prototype.size=function(){return e(this.value)},c}),function(t){t["encoding-indexes"]=t["encoding-indexes"]||[]}(this),n("encoding-indexes-shim",function(){}),function(t){function e(t,e,n){return t>=e&&n>=t}function n(t,e){return Math.floor(t/e)}function r(t){var e=0;this.get
}function G(t){this.message=t||"too many symbolic links encountered"}function Q(t){this.message=t||"cross-device link not permitted"}function $(t){this.message=t||"directory not empty"}function J(t){this.message=t||"no space left on device"}function te(t){this.message=t||"i/o error"}function ee(t){this.message=t||"read-only file system"}function ne(t){this.message=t||"no such device"}function re(t){this.message=t||"invalid seek"}function oe(t){this.message=t||"operation canceled"}function ie(t){this.message=t||"not mounted"}function se(t){this.message=t||"missing super node"}function ce(t){this.message=t||"attribute does not exist"}return t.prototype=Error(),t.prototype.errno=-1,t.prototype.code="UNKNOWN",t.prototype.constructor=t,e.prototype=Error(),e.prototype.errno=0,e.prototype.code="OK",e.prototype.constructor=e,n.prototype=Error(),n.prototype.errno=1,n.prototype.code="EOF",n.prototype.constructor=n,r.prototype=Error(),r.prototype.errno=2,r.prototype.code="EADDRINFO",r.prototype.constructor=r,o.prototype=Error(),o.prototype.errno=3,o.prototype.code="EACCES",o.prototype.constructor=o,i.prototype=Error(),i.prototype.errno=4,i.prototype.code="EAGAIN",i.prototype.constructor=i,s.prototype=Error(),s.prototype.errno=5,s.prototype.code="EADDRINUSE",s.prototype.constructor=s,c.prototype=Error(),c.prototype.errno=6,c.prototype.code="EADDRNOTAVAIL",c.prototype.constructor=c,a.prototype=Error(),a.prototype.errno=7,a.prototype.code="EAFNOSUPPORT",a.prototype.constructor=a,u.prototype=Error(),u.prototype.errno=8,u.prototype.code="EALREADY",u.prototype.constructor=u,f.prototype=Error(),f.prototype.errno=9,f.prototype.code="EBADF",f.prototype.constructor=f,p.prototype=Error(),p.prototype.errno=10,p.prototype.code="EBUSY",p.prototype.constructor=p,l.prototype=Error(),l.prototype.errno=11,l.prototype.code="ECONNABORTED",l.prototype.constructor=l,d.prototype=Error(),d.prototype.errno=12,d.prototype.code="ECONNREFUSED",d.prototype.constructor=d,h.prototype=Error(),h.prototype.errno=13,h.prototype.code="ECONNRESET",h.prototype.constructor=h,y.prototype=Error(),y.prototype.errno=14,y.prototype.code="EDESTADDRREQ",y.prototype.constructor=y,g.prototype=Error(),g.prototype.errno=15,g.prototype.code="EFAULT",g.prototype.constructor=g,v.prototype=Error(),v.prototype.errno=16,v.prototype.code="EHOSTUNREACH",v.prototype.constructor=v,m.prototype=Error(),m.prototype.errno=17,m.prototype.code="EINTR",m.prototype.constructor=m,E.prototype=Error(),E.prototype.errno=18,E.prototype.code="EINVAL",E.prototype.constructor=E,b.prototype=Error(),b.prototype.errno=19,b.prototype.code="EISCONN",b.prototype.constructor=b,w.prototype=Error(),w.prototype.errno=20,w.prototype.code="EMFILE",w.prototype.constructor=w,x.prototype=Error(),x.prototype.errno=21,x.prototype.code="EMSGSIZE",x.prototype.constructor=x,_.prototype=Error(),_.prototype.errno=22,_.prototype.code="ENETDOWN",_.prototype.constructor=_,A.prototype=Error(),A.prototype.errno=23,A.prototype.code="ENETUNREACH",A.prototype.constructor=A,k.prototype=Error(),k.prototype.errno=24,k.prototype.code="ENFILE",k.prototype.constructor=k,S.prototype=Error(),S.prototype.errno=25,S.prototype.code="ENOBUFS",S.prototype.constructor=S,O.prototype=Error(),O.prototype.errno=26,O.prototype.code="ENOMEM",O.prototype.constructor=O,R.prototype=Error(),R.prototype.errno=27,R.prototype.code="ENOTDIR",R.prototype.constructor=R,C.prototype=Error(),C.prototype.errno=28,C.prototype.code="EISDIR",C.prototype.constructor=C,T.prototype=Error(),T.prototype.errno=29,T.prototype.code="ENONET",T.prototype.constructor=T,D.prototype=Error(),D.prototype.errno=31,D.prototype.code="ENOTCONN",D.prototype.constructor=D,I.prototype=Error(),I.prototype.errno=32,I.prototype.code="ENOTSOCK",I.prototype.constructor=I,N.prototype=Error(),N.prototype.errno=33,N.prototype.code="ENOTSUP",N.prototype.constructor=N,M.prototype=Error(),M.prototype.errno=34,M.prototype.code="ENOENT",M.prototype.constructor=M,B.prototype=Error(),B.prototype.errno=35,B.prototype.code="ENOSYS",B.prototype.constructor=B,F.prototype=Error(),F.prototype.errno=36,F.prototype
for(e=i[0],t=i[1],this.length-=2,i[0]=i[this.length],i[1]=i[this.length+1],o=0;(r=2*o+2,!(r>=this.length))&&(this.length>r+2&&i[r+2]>i[r]&&(r+=2),i[r]>i[o]);)n=i[o],i[o]=i[r],i[r]=n,n=i[o+1],i[o+1]=i[r+1],i[r+1]=n,o=r;return{index:t,value:e,length:this.length}};var T,D=2,I={NONE:0,r:1,k:D,N:3},N=[];for(T=0;288>T;T++)switch(w){case 143>=T:N.push([T+48,8]);break;case 255>=T:N.push([T-144+400,9]);break;case 279>=T:N.push([T-256+0,7]);break;case 287>=T:N.push([T-280+192,8]);break;default:t("invalid literal: "+T)}i.prototype.j=function(){var e,r,o,i,s=this.input;switch(this.h){case 0:for(o=0,i=s.length;i>o;){r=_?s.subarray(o,o+65535):s.slice(o,o+65535),o+=r.length;var a=r,f=o===i,l=b,d=b,h=b,y=b,g=b,v=this.a,m=this.b;if(_){for(v=new Uint8Array(this.a.buffer);v.length<=m+a.length+5;)v=new Uint8Array(v.length<<1);v.set(this.a)}if(l=f?1:0,v[m++]=0|l,d=a.length,h=65535&~d+65536,v[m++]=255&d,v[m++]=255&d>>>8,v[m++]=255&h,v[m++]=255&h>>>8,_)v.set(a,m),m+=a.length,v=v.subarray(0,m);else{for(y=0,g=a.length;g>y;++y)v[m++]=a[y];v.length=m}this.b=m,this.a=v}break;case 1:var E=new n(_?new Uint8Array(this.a.buffer):this.a,this.b);E.d(1,1,w),E.d(1,2,w);var x,A,k,S=c(this,s);for(x=0,A=S.length;A>x;x++)if(k=S[x],n.prototype.d.apply(E,N[k]),k>256)E.d(S[++x],S[++x],w),E.d(S[++x],5),E.d(S[++x],S[++x],w);else if(256===k)break;this.a=E.finish(),this.b=this.a.length;break;case D:var O,R,C,T,I,M,B,F,U,j,z,P,L,W,q,H=new n(_?new Uint8Array(this.a.buffer):this.a,this.b),Y=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],X=Array(19);for(O=D,H.d(1,1,w),H.d(O,2,w),R=c(this,s),M=u(this.L,15),B=p(M),F=u(this.K,7),U=p(F),C=286;C>257&&0===M[C-1];C--);for(T=30;T>1&&0===F[T-1];T--);var K,V,Z,G,Q,$,J=C,te=T,ee=new(_?Uint32Array:Array)(J+te),ne=new(_?Uint32Array:Array)(316),re=new(_?Uint8Array:Array)(19);for(K=V=0;J>K;K++)ee[V++]=M[K];for(K=0;te>K;K++)ee[V++]=F[K];if(!_)for(K=0,G=re.length;G>K;++K)re[K]=0;for(K=Q=0,G=ee.length;G>K;K+=V){for(V=1;G>K+V&&ee[K+V]===ee[K];++V);if(Z=V,0===ee[K])if(3>Z)for(;Z-->0;)ne[Q++]=0,re[0]++;else for(;Z>0;)$=138>Z?Z:138,$>Z-3&&Z>$&&($=Z-3),10>=$?(ne[Q++]=17,ne[Q++]=$-3,re[17]++):(ne[Q++]=18,ne[Q++]=$-11,re[18]++),Z-=$;else if(ne[Q++]=ee[K],re[ee[K]]++,Z--,3>Z)for(;Z-->0;)ne[Q++]=ee[K],re[ee[K]]++;else for(;Z>0;)$=6>Z?Z:6,$>Z-3&&Z>$&&($=Z-3),ne[Q++]=16,ne[Q++]=$-3,re[16]++,Z-=$}for(e=_?ne.subarray(0,Q):ne.slice(0,Q),j=u(re,7),W=0;19>W;W++)X[W]=j[Y[W]];for(I=19;I>4&&0===X[I-1];I--);for(z=p(j),H.d(C-257,5,w),H.d(T-1,5,w),H.d(I-4,4,w),W=0;I>W;W++)H.d(X[W],3,w);for(W=0,q=e.length;q>W;W++)if(P=e[W],H.d(z[P],j[P],w),P>=16){switch(W++,P){case 16:L=2;break;case 17:L=3;break;case 18:L=7;break;default:t("invalid code: "+P)}H.d(e[W],L,w)}var oe,ie,se,ce,ae,ue,fe,pe,le=[B,M],de=[U,F];for(ae=le[0],ue=le[1],fe=de[0],pe=de[1],oe=0,ie=R.length;ie>oe;++oe)if(se=R[oe],H.d(ae[se],ue[se],w),se>256)H.d(R[++oe],R[++oe],w),ce=R[++oe],H.d(fe[ce],pe[ce],w),H.d(R[++oe],R[++oe],w);else if(256===se)break;this.a=H.finish(),this.b=this.a.length;break;default:t("invalid compression type")}return this.a};var M=function(){function e(e){switch(w){case 3===e:return[257,e-3,0];case 4===e:return[258,e-4,0];case 5===e:return[259,e-5,0];case 6===e:return[260,e-6,0];case 7===e:return[261,e-7,0];case 8===e:return[262,e-8,0];case 9===e:return[263,e-9,0];case 10===e:return[264,e-10,0];case 12>=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:t("invalid length: "+e)}}var n,r,o=[];for(n=3;258>=n;n++)r=e(n),o[n]=r[2]<<24|r[1]<<16|r[0];return o}(),B=_?new Uint32Array(M):M,F=0,U=1,j={D:F,C:U};
}function p(s,a){if(s)c(s);else{h=a;var u=void 0!==i&&null!==i?i:e.position,p=Math.max(h.length,u+o),l=new Uint8Array(p);h&&l.set(h);var y=n.subarray(r,r+o);l.set(y,u),void 0===i&&(e.position+=o),d.size=p,d.version+=1,t.put(d.data,l,f)}}function l(e,n){e?c(e):(d=n,t.get(d.data,p))}var d,h;t.get(e.id,l)}function y(t,e,n,r,o,i,s){function c(t,c){if(t)s(t);else{f=c;var a=void 0!==i&&null!==i?i:e.position;o=a+o>n.length?o-a:o;var u=f.subarray(a,a+o);n.set(u,r),void 0===i&&(e.position+=o),s(null,o)}}function a(e,n){e?s(e):(u=n,t.get(u.data,c))}var u,f;t.get(e.id,a)}function g(t,e,n){function r(t,e){t?n(t):n(null,e)}e=ge(e),me(e),c(t,e,r)}function v(t,e,n){function r(t,e){t?n(t):n(null,e)}t.get(e.id,r)}function m(t,e,n){function r(e,r){e?n(e):(s=r,t.get(s.data,o))}function o(e,r){e?n(e):(a=r,ye(a).has(u)?t.get(a[u].id,i):n(new ke("a component of the path does not name an existing file")))}function i(t,e){t?n(t):n(null,e)}e=ge(e);var s,a,u=me(e),f=ve(e);Le==u?c(t,e,i):c(t,f,r)}function E(t,e,n,r){function o(e){e?r(e):s(t,n,E,{ctime:Date.now()},r)}function i(e,n){e?r(e):(E=n,E.nlinks+=1,t.put(E.id,E,o))}function a(e){e?r(e):t.get(m[b].id,i)}function u(e,n){e?r(e):(m=n,ye(m).has(b)?r(new _e("newpath resolves to an existing file")):(m[b]=g[d],t.put(v.data,m,a)))}function f(e,n){e?r(e):(v=n,t.get(v.data,u))}function p(e,n){e?r(e):(g=n,ye(g).has(d)?c(t,w,f):r(new ke("a component of either path prefix does not exist")))}function l(e,n){e?r(e):(y=n,t.get(y.data,p))}e=ge(e);var d=me(e),h=ve(e);n=ge(n);var y,g,v,m,E,b=me(n),w=ve(n);c(t,h,l)}function b(t,e,n){function r(e){e?n(e):(delete p[d],t.put(f.data,p,function(){var e=Date.now();s(t,h,f,{mtime:e,ctime:e},n)}))}function o(e){e?n(e):t.delete(l.data,r)}function i(i,c){i?n(i):(l=c,l.nlinks-=1,1>l.nlinks?t.delete(l.id,o):t.put(l.id,l,function(){s(t,e,l,{ctime:Date.now()},r)}))}function a(e,r){e?n(e):(p=r,ye(p).has(d)?t.get(p[d].id,i):n(new ke("a component of the path does not name an existing file")))}function u(e,r){e?n(e):(f=r,t.get(f.data,a))}e=ge(e);var f,p,l,d=me(e),h=ve(e);c(t,h,u)}function w(t,e,n){function r(t,e){if(t)n(t);else{s=e;var r=Object.keys(s);n(null,r)}}function o(e,o){e?n(e):(i=o,t.get(i.data,r))}e=ge(e),me(e);var i,s;c(t,e,o)}function x(t,n,r,i){function a(e,n){e?i(e):(d=n,t.get(d.data,u))}function u(t,e){t?i(t):(h=e,ye(h).has(g)?i(new _e("the destination path already exists")):f())}function f(){y=new o(void 0,ze),y.nlinks+=1,y.size=n.length,y.data=n,t.put(y.id,y,l)}function p(e){if(e)i(e);else{var n=Date.now();s(t,v,d,{mtime:n,ctime:n},i)}}function l(n){n?i(n):(h[g]=new e(y.id,ze),t.put(d.data,h,p))}r=ge(r);var d,h,y,g=me(r),v=ve(r);Le==g?i(new _e("the destination path already exists")):c(t,v,a)}function _(t,e,n){function r(e,r){e?n(e):(s=r,t.get(s.data,o))}function o(e,r){e?n(e):(a=r,ye(a).has(u)?t.get(a[u].id,i):n(new ke("a component of the path does not name an existing file")))}function i(t,e){t?n(t):e.mode!=ze?n(new Te("path not a symbolic link")):n(null,e.data)}e=ge(e);var s,a,u=me(e),f=ve(e);c(t,f,r)}function A(t,e,n,r){function o(e,n){e?r(e):n.mode==je?r(new Ae("the named file is a directory")):(f=n,t.get(f.data,i))}function i(e,o){if(e)r(e);else{var i=new Uint8Array(n);o&&i.set(o.subarray(0,n)),t.put(f.data,i,u)}}function a(n){if(n)r(n);else{var o=Date.now();s(t,e,f,{mtime:o,ctime:o},r)}}function u(e){e?r(e):(f.size=n,f.version+=1,t.put(f.id,f,a))}e=ge(e);var f;0>n?r(new Te("length cannot be negative")):c(t,e,o)}function k(t,e,n,r){function o(e,n){e?r(e):n.mode==je?r(new Ae("the named file is a directory")):(u=n,t.get(u.data,i))}function i(e,o){if(e)r(e);else{var i=new Uint8Array(n);o&&i.set(o.subarray(0,n)),t.put(u.data,i,a)}}function c(n){if(n)r(n);else{var o=Date.now();s(t,e.path,u,{mtime:o,ctime:o},r)}}function a(e){e?r(e):(u.size=n,u.version+=1,t.put(u.id,u,c))}var u;0>n?r(new Te("length cannot be negative")):t.get(e.id,o)}function S(t,e,n,r,o){function i(i,c){i?o(i):s(t,e,c,{atime:n,ctime:r,mtime:r},o)}e=ge(e),"number"!=typeof n||"number"!=typeof r?o(new Te("atime and mtime must be number")):0>n||0>r?o(new Te("atime and mtime must be positive integer