summaryrefslogtreecommitdiff
path: root/content/resources/js/bf.js
blob: d2047c9e5834eebf2a03e0c9c05cb80780ff9379 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
// Generated by js_of_ocaml 2.5
(function(I){"use strict";var
ac=254,ab=224,Y="+",Z=65535,aa=250,o=1024,X=57343,$=512,e=128,d="",C=" : file already exists",U=56320,V=240,W=2048,a=248,T="/",_="fd ";function
J(a,b,c){var
e=new
Array(c);for(var
d=0;d<c;d++)e[d]=a[b+d];return e}function
H(a,b,c){var
e=String.fromCharCode;if(b==0&&c<=4096&&c==a.length)return e.apply(null,a);var
f=d;for(;0<c;b+=o,c-=o)f+=e.apply(null,J(a,b,Math.min(c,o)));return f}function
ad(a){var
c=new
Array(a.l),e=a.c,d=e.length,b=0;for(;b<d;b++)c[b]=e.charCodeAt(b);for(d=a.l;b<d;b++)c[b]=0;a.c=c;a.t=4;return c}function
s(a,b,c,d,e){if(e==0)return 0;if(d==0&&(e>=c.l||c.t==2&&e>=c.c.length)){c.c=a.t==4?H(a.c,b,e):b==0&&a.c.length==e?a.c:a.c.substr(b,e);c.t=c.c.length==c.l?0:2}else
if(c.t==2&&d==c.c.length){c.c+=a.t==4?H(a.c,b,e):b==0&&a.c.length==e?a.c:a.c.substr(b,e);c.t=c.c.length==c.l?0:2}else{if(c.t!=4)ad(c);var
g=a.c,h=c.c;if(a.t==4)for(var
f=0;f<e;f++)h[d+f]=g[b+f];else{var
i=Math.min(e,g.length-b);for(var
f=0;f<i;f++)h[d+f]=g.charCodeAt(b+f);for(;f<e;f++)h[d+f]=0}}return 0}function
bl(a,b){var
e=a.length,d=new
Array(e+1),c=0;for(;c<e;c++)d[c]=a[c];d[c]=b;return d}function
l(c,b){if(c.fun)return l(c.fun,b);var
a=c.length,d=b.length,e=a-d;if(e==0)return c.apply(null,b);else
if(e<0)return l(c.apply(null,J(b,0,a)),J(b,a,d-a));else
return function(a){return l(c,bl(b,a))}}function
a_(a,b){if(b.repeat)return b.repeat(a);var
c=d,e=0;if(a==0)return c;for(;;){if(a&1)c+=b;a>>=1;if(a==0)return c;b+=b;e++;if(e==9)b.slice(0,1)}}function
t(a){if(a.t==2)a.c+=a_(a.l-a.c.length,"\0");else
a.c=H(a.c,0,a.c.length);a.t=0}function
ae(a){if(a.length<24){for(var
b=0;b<a.length;b++)if(a.charCodeAt(b)>127)return false;return true}else
return!/[^\x00-\x7f]/.test(a)}function
bh(a){for(var
l=d,f=d,i,h,j,b,c=0,k=a.length;c<k;c++){h=a.charCodeAt(c);if(h<e){for(var
g=c+1;g<k&&(h=a.charCodeAt(g))<e;g++);if(g-c>$){f.substr(0,1);l+=f;f=d;l+=a.slice(c,g)}else
f+=a.slice(c,g);if(g==k)break;c=g}b=1;if(++c<k&&((j=a.charCodeAt(c))&-64)==e){i=j+(h<<6);if(h<ab){b=i-12416;if(b<e)b=1}else{b=2;if(++c<k&&((j=a.charCodeAt(c))&-64)==e){i=j+(i<<6);if(h<V){b=i-925824;if(b<W||b>=55295&&b<57344)b=2}else{b=3;if(++c<k&&((j=a.charCodeAt(c))&-64)==e&&h<245){b=j-63447168+(i<<6);if(b<65536||b>1114111)b=3}}}}}if(b<4){c-=b;f+="\ufffd"}else
if(b>Z)f+=String.fromCharCode(55232+(b>>10),U+(b&1023));else
f+=String.fromCharCode(b);if(f.length>o){f.substr(0,1);l+=f;f=d}}return l+f}function
bg(a){switch(a.t){case
9:return a.c;default:t(a);case
0:if(ae(a.c)){a.t=9;return a.c}a.t=8;case
8:return bh(a.c)}}function
g(a,b,c){this.t=a;this.c=b;this.l=c}g.prototype={toString:function(){return bg(this)}};function
a6(a,b){throw[0,a,b]}function
c(a){return new
g(0,a,a.length)}function
ai(a,b){a6(a,c(b))}var
f=[0];function
u(a){ai(f[4],a)}function
m(a){if(a<0)u("String.create");return new
g(a?2:9,d,a)}function
a5(a){throw a}function
a7(){a5(f[6])}function
aS(a,b){if(b==0)a7();return a/b|0}function
aW(a,b){var
c=a[3]<<16,d=b[3]<<16;if(c>d)return 1;if(c<d)return-1;if(a[2]>b[2])return 1;if(a[2]<b[2])return-1;if(a[1]>b[1])return 1;if(a[1]<b[1])return-1;return 0}function
aX(a,b){if(a<b)return-1;if(a==b)return 0;return 1}function
ba(a,b){a.t&6&&t(a);b.t&6&&t(b);return a.c<b.c?-1:a.c>b.c?1:0}function
D(a,b,c){var
e=[];for(;;){if(!(c&&a===b))if(a
instanceof
g)if(b
instanceof
g){if(a!==b){var
d=ba(a,b);if(d!=0)return d}}else
return 1;else
if(a
instanceof
Array&&a[0]===(a[0]|0)){var
f=a[0];if(f===ac)f=0;if(f===aa){a=a[1];continue}else
if(b
instanceof
Array&&b[0]===(b[0]|0)){var
h=b[0];if(h===ac)h=0;if(h===aa){b=b[1];continue}else
if(f!=h)return f<h?-1:1;else
switch(f){case
248:var
d=aX(a[2],b[2]);if(d!=0)return d;break;case
251:u("equal: abstract value");case
255:var
d=aW(a,b);if(d!=0)return d;break;default:if(a.length!=b.length)return a.length<b.length?-1:1;if(a.length>1)e.push(a,b,1)}}else
return 1}else
if(b
instanceof
g||b
instanceof
Array&&b[0]===(b[0]|0))return-1;else
if(typeof
a!="number"&&a&&a.compare)return a.compare(b,c);else{if(a<b)return-1;if(a>b)return 1;if(a!=b){if(!c)return NaN;if(a==a)return 1;if(b==b)return-1}}if(e.length==0)return 0;var
i=e.pop();b=e.pop();a=e.pop();if(i+1<a.length)e.push(a,b,i+1);a=a[i];b=b[i]}}function
aT(a,b){return+(D(a,b,false)==0)}function
aV(a,b){return+(D(a,b,false)>=0)}function
bi(a){for(var
h=d,c=h,b,j,f=0,i=a.length;f<i;f++){b=a.charCodeAt(f);if(b<e){for(var
g=f+1;g<i&&(b=a.charCodeAt(g))<e;g++);if(g-f>$){c.substr(0,1);h+=c;c=d;h+=a.slice(f,g)}else
c+=a.slice(f,g);if(g==i)break;f=g}if(b<W){c+=String.fromCharCode(192|b>>6);c+=String.fromCharCode(e|b&63)}else
if(b<55296||b>=X)c+=String.fromCharCode(ab|b>>12,e|b>>6&63,e|b&63);else
if(b>=56319||f+1==i||(j=a.charCodeAt(f+1))<U||j>X)c+="\xef\xbf\xbd";else{f++;b=(b<<10)+j-56613888;c+=String.fromCharCode(V|b>>18,e|b>>12&63,e|b>>6&63,e|b&63)}if(c.length>o){c.substr(0,1);h+=c;c=d}}return h+c}function
F(a){var
b=9;if(!ae(a))b=8,a=bi(a);return new
g(b,a,a.length)}function
bm(a){var
d=a.length,c=new
Array(d);for(var
b=0;b<d;b++)c[b]=a[b];return c}function
G(a){return function(){return arguments.length>0?l(a,bm(arguments)):l(a,[undefined])}}function
aY(a,b){return+(D(a,b,false)<=0)}function
h(a){ai(f[2],a)}function
aZ(a){if(!a.opened)h("Cannot flush a closed channel");if(a.buffer==d)return 0;if(a.output)switch(a.output.length){case
2:a.output(a,a.buffer);break;default:a.output(a.buffer)}a.buffer=d;return 0}function
j(a){this.data=a}j.prototype={truncate:function(){this.data=m(0)}};function
n(a){return a.l}function
ah(a){a=a
instanceof
g?a.toString():a;h(a+": No such file or directory")}var
aR=T;function
v(a){a=a
instanceof
g?a.toString():a;if(a.charCodeAt(0)!=47)a=aR+a;var
e=a.split(T),b=[];for(var
c=0;c<e.length;c++)switch(e[c]){case"..":if(b.length>1)b.pop();break;case".":break;case"":if(b.length==0)b.push(d);break;default:b.push(e[c]);break}b.orig=a;return b}function
k(){this.content={}}k.prototype={exists:function(a){return this.content[a]?1:0},mk:function(a,b){this.content[a]=b},get:function(a){return this.content[a]},list:function(){var
a=[];for(var
b
in
this.content)a.push(b);return a},remove:function(a){delete
this.content[a]}};var
x=new
k();x.mk(d,new
k());function
E(a){var
b=x;for(var
c=0;c<a.length;c++){if(!(b.exists&&b.exists(a[c])))ah(a.orig);b=b.get(a[c])}return b}function
bf(a){var
c=v(a),b=E(c);return b
instanceof
k?1:0}function
bc(a){return new
g(4,a,a.length)}function
bo(a){if(a.t!=4)ad(a);return a.c}function
aU(a,b){var
f=v(a),d=x;for(var
i=0;i<f.length-1;i++){var
e=f[i];if(!d.exists(e))d.mk(e,new
k());d=d.get(e);if(!(d
instanceof
k))h(f.orig+C)}var
e=f[f.length-1];if(d.exists(e))h(f.orig+C);if(b
instanceof
k)d.mk(e,b);else
if(b
instanceof
j)d.mk(e,b);else
if(b
instanceof
g)d.mk(e,new
j(b));else
if(b
instanceof
Array)d.mk(e,new
j(bc(b)));else
if(b.toString)d.mk(e,new
j(c(b.toString())));else
u("caml_fs_register");return 0}function
be(a){var
b=x,d=v(a),e,f;for(var
c=0;c<d.length;c++){if(b.auto){e=b.auto;f=c}if(!(b.exists&&b.exists(d[c])))return e?e(d,f):0;b=b.get(d[c])}return 1}function
q(a,b,c){if(f.fds===undefined)f.fds=new
Array();c=c?c:{};var
d={};d.file=b;d.offset=c.append?n(b.data):0;d.flags=c;f.fds[a]=d;f.fd_last_idx=a;return a}function
bp(a,b,c){var
d={};while(b){switch(b[1]){case
0:d.rdonly=1;break;case
1:d.wronly=1;break;case
2:d.append=1;break;case
3:d.create=1;break;case
4:d.truncate=1;break;case
5:d.excl=1;break;case
6:d.binary=1;break;case
7:d.text=1;break;case
8:d.nonblock=1;break}b=b[2]}var
g=a.toString(),j=v(a);if(d.rdonly&&d.wronly)h(g+" : flags Open_rdonly and Open_wronly are not compatible");if(d.text&&d.binary)h(g+" : flags Open_text and Open_binary are not compatible");if(be(a)){if(bf(a))h(g+" : is a directory");if(d.create&&d.excl)h(g+C);var
i=f.fd_last_idx?f.fd_last_idx:0,e=E(j);if(d.truncate)e.truncate();return q(i+1,e,d)}else
if(d.create){var
i=f.fd_last_idx?f.fd_last_idx:0;aU(a,m(0));var
e=E(j);return q(i+1,e,d)}else
ah(a)}q(0,new
j(m(0)));q(1,new
j(m(0)));q(2,new
j(m(0)));function
a0(a){var
b=f.fds[a];if(b.flags.wronly)h(_+a+" is writeonly");return{file:b.file,offset:b.offset,fd:a,opened:true}}function
bj(a){if(a.charCodeAt(a.length-1)==10)a=a.substr(0,a.length-1);var
b=I.console;b&&b.error&&b.error(a)}function
bk(a){if(a.charCodeAt(a.length-1)==10)a=a.substr(0,a.length-1);var
b=I.console;b&&b.log&&b.log(a)}var
w=new
Array();function
a9(a,b){var
h=c(b),d=n(h),g=n(a.file.data),f=a.offset;if(f+d>=g){var
e=m(f+d);s(a.file.data,0,e,0,g);s(h,0,e,f,d);a.file.data=e}a.offset+=d;return 0}function
af(a){var
b;switch(a){case
1:b=bk;break;case
2:b=bj;break;default:b=a9}var
e=f.fds[a];if(e.flags.rdonly)h(_+a+" is readonly");var
c={file:e.file,offset:e.offset,fd:a,opened:true,buffer:d,output:b};w[c.fd]=c;return c}function
a1(){var
a=0;for(var
b
in
w)if(w[b].opened)a=[0,w[b],a];return a}if(!Math.imul)Math.imul=function(a,b){return((a>>16)*b<<16)+(a&Z)*b|0};var
ag=Math.imul;function
a3(a){return a
instanceof
Array?a[0]:a
instanceof
g?252:1e3}function
b(a,b){f[a+1]=b}var
a2={};function
aQ(a){if((a.t&6)!=0)t(a);return a.c}function
a8(a,b){a2[aQ(a)]=b;return 0}var
a4=0;function
p(a){a[2]=a4++;return a}function
a$(){u("index out of bounds")}function
bd(a,b){switch(a.t&6){default:if(b>=a.c.length)return 0;case
0:return a.c.charCodeAt(b);case
4:return a.c[b]}}function
bb(a,b){if(b>>>0>=a.l)a$();return bd(a,b)}function
aO(a,b){return a.length==1?a(b):l(a,[b])}function
aP(a,b,c){return a.length==2?a(b,c):l(a,[b,c])}b(11,[a,c("Undefined_recursive_module"),-12]);b(10,[a,c("Assert_failure"),-11]);b(9,[a,c("Sys_blocked_io"),-10]);b(8,[a,c("Stack_overflow"),-9]);b(7,[a,c("Match_failure"),-8]);b(6,[a,c("Not_found"),-7]);b(5,[a,c("Division_by_zero"),-6]);b(4,[a,c("End_of_file"),-5]);b(3,[a,c("Invalid_argument"),-4]);b(2,[a,c("Failure"),-3]);b(1,[a,c("Sys_error"),-2]);b(0,[a,c("Out_of_memory"),-1]);p([a,c("Pervasives.Exit"),0]);var
al=c("Array.Bottom"),am=c("Sys.Break"),an=c("CamlinternalFormat.Type_mismatch"),aq=c("Js.Error"),at=[0,0,0],as=[0,4,0],au=[0,0,0,0],aE=c("Ook. Ook? "),aF=c("Ook? Ook. "),aG=c("Ook. Ook. "),aH=c("Ook! Ook! "),aI=c("Ook! Ook. "),aJ=c("Ook. Ook! "),aK=c("Ook! Ook? "),aL=c("Ook? Ook! "),aw=c(">"),ax=c("<"),ay=c(Y),az=c("-"),aA=c("."),aB=c(Y),aC=c("["),aD=c("]"),aM=c(d);function
r(a){return 0<=a?a:-a|0}var
K=2147483647,aj=-2147483648;function
i(a,b){if(a){var
c=a[1];return[0,c,i(a[2],b)]}return b}a0(0);af(1);af(2);p([a,al,0]);function
L(a,b){if(b){var
c=b[2],d=aO(a,b[1]);return[0,d,L(a,c)]}return 0}p([a,am,0]);p([a,an,0]);var
M=[0,0];function
N(a){M[1]=[0,a,M[1]];return 0}var
O=I,ap=O.Array,P=p([a,aq,0]),y=[0,P,{}],ao=a3(y)===a?y:y[0+1];a8(c("jsError"),ao);N(function(a){return a[1]===P?[0,F(a[2].toString())]:0});N(function(a){return a
instanceof
ap?0:[0,F(a.toString())]});function
Q(a,b){var
d=0,c=a;for(;;){if(0===c)return d;var
d=[0,b,d],c=c-1|0;continue}}function
z(a,b,c){var
e=b,d=0,f=n(c);for(;;){if(d===f)return e;var
e=aP(a,e,bb(c,d)),d=d+1|0;continue}}function
R(a,b,c){var
d=aS(c,a),e=c-ag(d,a)|0,f=(a/2|0)<e?[0,d+1|0,c-ag(d+1|0,a)|0]:[0,d,e],g=f[2],h=f[1],i=c-b|0,j=r(g);return((j+3|0)+h|0)<r(i)?[0,h,g]:[0,0,i]}function
ar(a,b){var
c=a[2],e=aV(c,b)?c:b,d=a[1],f=aY(d,b)?d:b;return[0,f,e]}function
A(a){var
b=a[1],c=0<b?2:3;return Q(r(b),c)}function
av(a){switch(a){case
0:return aw;case
1:return ax;case
2:return ay;case
3:return az;case
4:return aA;case
5:return aB;case
6:return aC;default:return aD}}function
S(a){switch(a){case
0:return aE;case
1:return aF;case
2:return aG;case
3:return aH;case
4:return aI;case
5:return aJ;case
6:return aK;default:return aL}}function
B(a,b){var
o=F(b),t=z(ar,[0,K,aj],o),k=[0,Math.sqrt(t[1])|0,K],c=1,C=t[2];for(;;){var
l=k[1];if(C<c){var
w=z(function(a,b){var
c=R(l,a[1],b),d=c[1],e=0!==d?1:0,g=c[2],f=e?at:e,h=i(f,i(A([0,g]),as)),j=i(a[3],h),k=i(f,A([0,d]));return[0,b,i(a[2],k),j]},au,o),x=w[2],g=0,f=x,G=0;for(;;){if(f){var
B=aT(f[1],G)?g+1|0:g,g=B,f=f[2];continue}var
H=[0,3,[0,7,w[3]]],I=i([0,6,x],i(Q(g,1),H)),e=aM,d=L(a,i(A([0,l]),I));for(;;){if(d){var
q=d[1],h=n(e),p=n(q),j=m(h+p|0),y=d[2];s(e,0,j,0,h);s(q,0,j,h,p);var
e=j,d=y;continue}return e}}}var
u=k[2],D=[0,0,c],v=z(function(c){return function(a,b){var
d=R(c,a[1],b),e=d[1],f=0===e?0:3,g=r(d[2]);return[0,b,((a[2]+e|0)+g|0)+f|0]}}(c),D,o)[2],E=v<u?[0,c,v]:[0,l,u],k=E,c=c+1|0;continue}}var
aN=G(function(a){return B(av,a)}),bn=G(function(a){return B(S,a)});O.converter={"to_bf":aN,"to_ook":G(function(a){return B(S,a)})};function
ak(a){var
b=a;for(;;){if(b){var
c=b[2],d=b[1];try{aZ(d)}catch(f){}var
b=c;continue}return 0}}ak(a1(0));return}(function(){return this}()));