| 1 |
(function(){ |
| 2 |
"use strict"; |
| 3 |
var ρσ_iterator_symbol = (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") ? Symbol.iterator : "iterator-Symbol-5d0927e5554349048cf0e3762a228256"; |
| 4 |
var ρσ_kwargs_symbol = (typeof Symbol === "function") ? Symbol("kwargs-object") : "kwargs-object-Symbol-5d0927e5554349048cf0e3762a228256"; |
| 5 |
var ρσ_cond_temp, ρσ_expr_temp, ρσ_last_exception; |
| 6 |
var ρσ_object_counter = 0; |
| 7 |
if( typeof HTMLCollection !== "undefined" && typeof Symbol === "function") NodeList.prototype[Symbol.iterator] = HTMLCollection.prototype[Symbol.iterator] = NamedNodeMap.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; |
| 8 |
var ρσ_len; |
| 9 |
function ρσ_bool(val) { |
| 10 |
return !!val; |
| 11 |
}; |
| 12 |
if (!ρσ_bool.__argnames__) Object.defineProperties(ρσ_bool, { |
| 13 |
__argnames__ : {value: ["val"]}, |
| 14 |
__module__ : {value: "__main__"} |
| 15 |
}); |
| 16 |
|
| 17 |
function ρσ_print() { |
| 18 |
var parts; |
| 19 |
if (typeof console === "object") { |
| 20 |
parts = []; |
| 21 |
for (var i = 0; i < arguments.length; i++) { |
| 22 |
parts.push(ρσ_str(arguments[i])); |
| 23 |
} |
| 24 |
console.log(parts.join(" ")); |
| 25 |
} |
| 26 |
}; |
| 27 |
if (!ρσ_print.__module__) Object.defineProperties(ρσ_print, { |
| 28 |
__module__ : {value: "__main__"} |
| 29 |
}); |
| 30 |
|
| 31 |
function ρσ_int(val, base) { |
| 32 |
var ans; |
| 33 |
if (typeof val === "number") { |
| 34 |
ans = val | 0; |
| 35 |
} else { |
| 36 |
ans = parseInt(val, base || 10); |
| 37 |
} |
| 38 |
if (isNaN(ans)) { |
| 39 |
throw new ValueError("Invalid literal for int with base " + (base || 10) + ": " + val); |
| 40 |
} |
| 41 |
return ans; |
| 42 |
}; |
| 43 |
if (!ρσ_int.__argnames__) Object.defineProperties(ρσ_int, { |
| 44 |
__argnames__ : {value: ["val", "base"]}, |
| 45 |
__module__ : {value: "__main__"} |
| 46 |
}); |
| 47 |
|
| 48 |
function ρσ_float(val) { |
| 49 |
var ans; |
| 50 |
if (typeof val === "number") { |
| 51 |
ans = val; |
| 52 |
} else { |
| 53 |
ans = parseFloat(val); |
| 54 |
} |
| 55 |
if (isNaN(ans)) { |
| 56 |
throw new ValueError("Could not convert string to float: " + arguments[0]); |
| 57 |
} |
| 58 |
return ans; |
| 59 |
}; |
| 60 |
if (!ρσ_float.__argnames__) Object.defineProperties(ρσ_float, { |
| 61 |
__argnames__ : {value: ["val"]}, |
| 62 |
__module__ : {value: "__main__"} |
| 63 |
}); |
| 64 |
|
| 65 |
function ρσ_arraylike_creator() { |
| 66 |
var names; |
| 67 |
names = ("Int8Array Uint8Array Uint8ClampedArray Int16Array" + " Uint16Array Int32Array Uint32Array Float32Array" + " Float64Array").split(" "); |
| 68 |
if (typeof HTMLCollection === "function") { |
| 69 |
names = names.concat("HTMLCollection NodeList NamedNodeMap TouchList".split(" ")); |
| 70 |
} |
| 71 |
return (function() { |
| 72 |
var ρσ_anonfunc = function (x) { |
| 73 |
if (Array.isArray(x) || typeof x === "string" || names.indexOf(Object.prototype.toString.call(x).slice(8, -1)) > -1) { |
| 74 |
return true; |
| 75 |
} |
| 76 |
return false; |
| 77 |
}; |
| 78 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 79 |
__argnames__ : {value: ["x"]}, |
| 80 |
__module__ : {value: "__main__"} |
| 81 |
}); |
| 82 |
return ρσ_anonfunc; |
| 83 |
})(); |
| 84 |
}; |
| 85 |
if (!ρσ_arraylike_creator.__module__) Object.defineProperties(ρσ_arraylike_creator, { |
| 86 |
__module__ : {value: "__main__"} |
| 87 |
}); |
| 88 |
|
| 89 |
function options_object(f) { |
| 90 |
return (function() { |
| 91 |
var ρσ_anonfunc = function () { |
| 92 |
if (typeof arguments[arguments.length - 1] === "object") { |
| 93 |
arguments[ρσ_bound_index(arguments.length - 1, arguments)][ρσ_kwargs_symbol] = true; |
| 94 |
} |
| 95 |
return f.apply(this, arguments); |
| 96 |
}; |
| 97 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 98 |
__module__ : {value: "__main__"} |
| 99 |
}); |
| 100 |
return ρσ_anonfunc; |
| 101 |
})(); |
| 102 |
}; |
| 103 |
if (!options_object.__argnames__) Object.defineProperties(options_object, { |
| 104 |
__argnames__ : {value: ["f"]}, |
| 105 |
__module__ : {value: "__main__"} |
| 106 |
}); |
| 107 |
|
| 108 |
function ρσ_id(x) { |
| 109 |
return x.ρσ_object_id; |
| 110 |
}; |
| 111 |
if (!ρσ_id.__argnames__) Object.defineProperties(ρσ_id, { |
| 112 |
__argnames__ : {value: ["x"]}, |
| 113 |
__module__ : {value: "__main__"} |
| 114 |
}); |
| 115 |
|
| 116 |
function ρσ_dir(item) { |
| 117 |
var arr; |
| 118 |
arr = []; |
| 119 |
for (var i in item) { |
| 120 |
arr.push(i); |
| 121 |
} |
| 122 |
return arr; |
| 123 |
}; |
| 124 |
if (!ρσ_dir.__argnames__) Object.defineProperties(ρσ_dir, { |
| 125 |
__argnames__ : {value: ["item"]}, |
| 126 |
__module__ : {value: "__main__"} |
| 127 |
}); |
| 128 |
|
| 129 |
function ρσ_ord(x) { |
| 130 |
var ans, second; |
| 131 |
ans = x.charCodeAt(0); |
| 132 |
if (55296 <= ans && ans <= 56319) { |
| 133 |
second = x.charCodeAt(1); |
| 134 |
if (56320 <= second && second <= 57343) { |
| 135 |
return (ans - 55296) * 1024 + second - 56320 + 65536; |
| 136 |
} |
| 137 |
throw new TypeError("string is missing the low surrogate char"); |
| 138 |
} |
| 139 |
return ans; |
| 140 |
}; |
| 141 |
if (!ρσ_ord.__argnames__) Object.defineProperties(ρσ_ord, { |
| 142 |
__argnames__ : {value: ["x"]}, |
| 143 |
__module__ : {value: "__main__"} |
| 144 |
}); |
| 145 |
|
| 146 |
function ρσ_chr(code) { |
| 147 |
if (code <= 65535) { |
| 148 |
return String.fromCharCode(code); |
| 149 |
} |
| 150 |
code -= 65536; |
| 151 |
return String.fromCharCode(55296 + (code >> 10), 56320 + (code & 1023)); |
| 152 |
}; |
| 153 |
if (!ρσ_chr.__argnames__) Object.defineProperties(ρσ_chr, { |
| 154 |
__argnames__ : {value: ["code"]}, |
| 155 |
__module__ : {value: "__main__"} |
| 156 |
}); |
| 157 |
|
| 158 |
function ρσ_callable(x) { |
| 159 |
return typeof x === "function"; |
| 160 |
}; |
| 161 |
if (!ρσ_callable.__argnames__) Object.defineProperties(ρσ_callable, { |
| 162 |
__argnames__ : {value: ["x"]}, |
| 163 |
__module__ : {value: "__main__"} |
| 164 |
}); |
| 165 |
|
| 166 |
function ρσ_bin(x) { |
| 167 |
var ans; |
| 168 |
if (typeof x !== "number" || x % 1 !== 0) { |
| 169 |
throw new TypeError("integer required"); |
| 170 |
} |
| 171 |
ans = x.toString(2); |
| 172 |
if (ans[0] === "-") { |
| 173 |
ans = "-" + "0b" + ans.slice(1); |
| 174 |
} else { |
| 175 |
ans = "0b" + ans; |
| 176 |
} |
| 177 |
return ans; |
| 178 |
}; |
| 179 |
if (!ρσ_bin.__argnames__) Object.defineProperties(ρσ_bin, { |
| 180 |
__argnames__ : {value: ["x"]}, |
| 181 |
__module__ : {value: "__main__"} |
| 182 |
}); |
| 183 |
|
| 184 |
function ρσ_hex(x) { |
| 185 |
var ans; |
| 186 |
if (typeof x !== "number" || x % 1 !== 0) { |
| 187 |
throw new TypeError("integer required"); |
| 188 |
} |
| 189 |
ans = x.toString(16); |
| 190 |
if (ans[0] === "-") { |
| 191 |
ans = "-" + "0x" + ans.slice(1); |
| 192 |
} else { |
| 193 |
ans = "0x" + ans; |
| 194 |
} |
| 195 |
return ans; |
| 196 |
}; |
| 197 |
if (!ρσ_hex.__argnames__) Object.defineProperties(ρσ_hex, { |
| 198 |
__argnames__ : {value: ["x"]}, |
| 199 |
__module__ : {value: "__main__"} |
| 200 |
}); |
| 201 |
|
| 202 |
function ρσ_enumerate(iterable) { |
| 203 |
var ans, iterator; |
| 204 |
ans = {"_i":-1}; |
| 205 |
ans[ρσ_iterator_symbol] = (function() { |
| 206 |
var ρσ_anonfunc = function () { |
| 207 |
return this; |
| 208 |
}; |
| 209 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 210 |
__module__ : {value: "__main__"} |
| 211 |
}); |
| 212 |
return ρσ_anonfunc; |
| 213 |
})(); |
| 214 |
if (ρσ_arraylike(iterable)) { |
| 215 |
ans["next"] = (function() { |
| 216 |
var ρσ_anonfunc = function () { |
| 217 |
this._i += 1; |
| 218 |
if (this._i < iterable.length) { |
| 219 |
return {'done':false, 'value':[this._i, iterable[this._i]]}; |
| 220 |
} |
| 221 |
return {'done':true}; |
| 222 |
}; |
| 223 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 224 |
__module__ : {value: "__main__"} |
| 225 |
}); |
| 226 |
return ρσ_anonfunc; |
| 227 |
})(); |
| 228 |
return ans; |
| 229 |
} |
| 230 |
if (typeof iterable[ρσ_iterator_symbol] === "function") { |
| 231 |
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol](); |
| 232 |
ans["_iterator"] = iterator; |
| 233 |
ans["next"] = (function() { |
| 234 |
var ρσ_anonfunc = function () { |
| 235 |
var r; |
| 236 |
r = this._iterator.next(); |
| 237 |
if (r.done) { |
| 238 |
return {'done':true}; |
| 239 |
} |
| 240 |
this._i += 1; |
| 241 |
return {'done':false, 'value':[this._i, r.value]}; |
| 242 |
}; |
| 243 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 244 |
__module__ : {value: "__main__"} |
| 245 |
}); |
| 246 |
return ρσ_anonfunc; |
| 247 |
})(); |
| 248 |
return ans; |
| 249 |
} |
| 250 |
return ρσ_enumerate(Object.keys(iterable)); |
| 251 |
}; |
| 252 |
if (!ρσ_enumerate.__argnames__) Object.defineProperties(ρσ_enumerate, { |
| 253 |
__argnames__ : {value: ["iterable"]}, |
| 254 |
__module__ : {value: "__main__"} |
| 255 |
}); |
| 256 |
|
| 257 |
function ρσ_reversed(iterable) { |
| 258 |
var ans; |
| 259 |
if (ρσ_arraylike(iterable)) { |
| 260 |
ans = {"_i": iterable.length}; |
| 261 |
ans["next"] = (function() { |
| 262 |
var ρσ_anonfunc = function () { |
| 263 |
this._i -= 1; |
| 264 |
if (this._i > -1) { |
| 265 |
return {'done':false, 'value':iterable[this._i]}; |
| 266 |
} |
| 267 |
return {'done':true}; |
| 268 |
}; |
| 269 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 270 |
__module__ : {value: "__main__"} |
| 271 |
}); |
| 272 |
return ρσ_anonfunc; |
| 273 |
})(); |
| 274 |
ans[ρσ_iterator_symbol] = (function() { |
| 275 |
var ρσ_anonfunc = function () { |
| 276 |
return this; |
| 277 |
}; |
| 278 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 279 |
__module__ : {value: "__main__"} |
| 280 |
}); |
| 281 |
return ρσ_anonfunc; |
| 282 |
})(); |
| 283 |
return ans; |
| 284 |
} |
| 285 |
throw new TypeError("reversed() can only be called on arrays or strings"); |
| 286 |
}; |
| 287 |
if (!ρσ_reversed.__argnames__) Object.defineProperties(ρσ_reversed, { |
| 288 |
__argnames__ : {value: ["iterable"]}, |
| 289 |
__module__ : {value: "__main__"} |
| 290 |
}); |
| 291 |
|
| 292 |
function ρσ_iter(iterable) { |
| 293 |
var ans; |
| 294 |
if (typeof iterable[ρσ_iterator_symbol] === "function") { |
| 295 |
return (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol](); |
| 296 |
} |
| 297 |
if (ρσ_arraylike(iterable)) { |
| 298 |
ans = {"_i":-1}; |
| 299 |
ans[ρσ_iterator_symbol] = (function() { |
| 300 |
var ρσ_anonfunc = function () { |
| 301 |
return this; |
| 302 |
}; |
| 303 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 304 |
__module__ : {value: "__main__"} |
| 305 |
}); |
| 306 |
return ρσ_anonfunc; |
| 307 |
})(); |
| 308 |
ans["next"] = (function() { |
| 309 |
var ρσ_anonfunc = function () { |
| 310 |
this._i += 1; |
| 311 |
if (this._i < iterable.length) { |
| 312 |
return {'done':false, 'value':iterable[this._i]}; |
| 313 |
} |
| 314 |
return {'done':true}; |
| 315 |
}; |
| 316 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 317 |
__module__ : {value: "__main__"} |
| 318 |
}); |
| 319 |
return ρσ_anonfunc; |
| 320 |
})(); |
| 321 |
return ans; |
| 322 |
} |
| 323 |
return ρσ_iter(Object.keys(iterable)); |
| 324 |
}; |
| 325 |
if (!ρσ_iter.__argnames__) Object.defineProperties(ρσ_iter, { |
| 326 |
__argnames__ : {value: ["iterable"]}, |
| 327 |
__module__ : {value: "__main__"} |
| 328 |
}); |
| 329 |
|
| 330 |
function ρσ_range_next(step, length) { |
| 331 |
var ρσ_unpack; |
| 332 |
this._i += step; |
| 333 |
this._idx += 1; |
| 334 |
if (this._idx >= length) { |
| 335 |
ρσ_unpack = [this.__i, -1]; |
| 336 |
this._i = ρσ_unpack[0]; |
| 337 |
this._idx = ρσ_unpack[1]; |
| 338 |
return {'done':true}; |
| 339 |
} |
| 340 |
return {'done':false, 'value':this._i}; |
| 341 |
}; |
| 342 |
if (!ρσ_range_next.__argnames__) Object.defineProperties(ρσ_range_next, { |
| 343 |
__argnames__ : {value: ["step", "length"]}, |
| 344 |
__module__ : {value: "__main__"} |
| 345 |
}); |
| 346 |
|
| 347 |
function ρσ_range(start, stop, step) { |
| 348 |
var length, ans; |
| 349 |
if (arguments.length <= 1) { |
| 350 |
stop = start || 0; |
| 351 |
start = 0; |
| 352 |
} |
| 353 |
step = arguments[2] || 1; |
| 354 |
length = Math.max(Math.ceil((stop - start) / step), 0); |
| 355 |
ans = {start:start, step:step, stop:stop}; |
| 356 |
ans[ρσ_iterator_symbol] = (function() { |
| 357 |
var ρσ_anonfunc = function () { |
| 358 |
var it; |
| 359 |
it = {"_i": start - step, "_idx": -1}; |
| 360 |
it.next = ρσ_range_next.bind(it, step, length); |
| 361 |
it[ρσ_iterator_symbol] = (function() { |
| 362 |
var ρσ_anonfunc = function () { |
| 363 |
return this; |
| 364 |
}; |
| 365 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 366 |
__module__ : {value: "__main__"} |
| 367 |
}); |
| 368 |
return ρσ_anonfunc; |
| 369 |
})(); |
| 370 |
return it; |
| 371 |
}; |
| 372 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 373 |
__module__ : {value: "__main__"} |
| 374 |
}); |
| 375 |
return ρσ_anonfunc; |
| 376 |
})(); |
| 377 |
ans.count = (function() { |
| 378 |
var ρσ_anonfunc = function (val) { |
| 379 |
if (!this._cached) { |
| 380 |
this._cached = list(this); |
| 381 |
} |
| 382 |
return this._cached.count(val); |
| 383 |
}; |
| 384 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 385 |
__argnames__ : {value: ["val"]}, |
| 386 |
__module__ : {value: "__main__"} |
| 387 |
}); |
| 388 |
return ρσ_anonfunc; |
| 389 |
})(); |
| 390 |
ans.index = (function() { |
| 391 |
var ρσ_anonfunc = function (val) { |
| 392 |
if (!this._cached) { |
| 393 |
this._cached = list(this); |
| 394 |
} |
| 395 |
return this._cached.index(val); |
| 396 |
}; |
| 397 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 398 |
__argnames__ : {value: ["val"]}, |
| 399 |
__module__ : {value: "__main__"} |
| 400 |
}); |
| 401 |
return ρσ_anonfunc; |
| 402 |
})(); |
| 403 |
ans.__len__ = (function() { |
| 404 |
var ρσ_anonfunc = function () { |
| 405 |
return length; |
| 406 |
}; |
| 407 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 408 |
__module__ : {value: "__main__"} |
| 409 |
}); |
| 410 |
return ρσ_anonfunc; |
| 411 |
})(); |
| 412 |
ans.__repr__ = (function() { |
| 413 |
var ρσ_anonfunc = function () { |
| 414 |
return "range(" + ρσ_str.format("{}", start) + ", " + ρσ_str.format("{}", stop) + ", " + ρσ_str.format("{}", step) + ")"; |
| 415 |
}; |
| 416 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 417 |
__module__ : {value: "__main__"} |
| 418 |
}); |
| 419 |
return ρσ_anonfunc; |
| 420 |
})(); |
| 421 |
ans.__str__ = ans.toString = ans.__repr__; |
| 422 |
if (typeof Proxy === "function") { |
| 423 |
ans = new Proxy(ans, (function(){ |
| 424 |
var ρσ_d = {}; |
| 425 |
ρσ_d["get"] = (function() { |
| 426 |
var ρσ_anonfunc = function (obj, prop) { |
| 427 |
var iprop; |
| 428 |
if (typeof prop === "string") { |
| 429 |
iprop = parseInt(prop); |
| 430 |
if (!isNaN(iprop)) { |
| 431 |
prop = iprop; |
| 432 |
} |
| 433 |
} |
| 434 |
if (typeof prop === "number") { |
| 435 |
if (!obj._cached) { |
| 436 |
obj._cached = list(obj); |
| 437 |
} |
| 438 |
return (ρσ_expr_temp = obj._cached)[(typeof prop === "number" && prop < 0) ? ρσ_expr_temp.length + prop : prop]; |
| 439 |
} |
| 440 |
return obj[(typeof prop === "number" && prop < 0) ? obj.length + prop : prop]; |
| 441 |
}; |
| 442 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 443 |
__argnames__ : {value: ["obj", "prop"]}, |
| 444 |
__module__ : {value: "__main__"} |
| 445 |
}); |
| 446 |
return ρσ_anonfunc; |
| 447 |
})(); |
| 448 |
return ρσ_d; |
| 449 |
}).call(this)); |
| 450 |
} |
| 451 |
return ans; |
| 452 |
}; |
| 453 |
if (!ρσ_range.__argnames__) Object.defineProperties(ρσ_range, { |
| 454 |
__argnames__ : {value: ["start", "stop", "step"]}, |
| 455 |
__module__ : {value: "__main__"} |
| 456 |
}); |
| 457 |
|
| 458 |
function ρσ_getattr(obj, name, defval) { |
| 459 |
var ret; |
| 460 |
try { |
| 461 |
ret = obj[(typeof name === "number" && name < 0) ? obj.length + name : name]; |
| 462 |
} catch (ρσ_Exception) { |
| 463 |
ρσ_last_exception = ρσ_Exception; |
| 464 |
if (ρσ_Exception instanceof TypeError) { |
| 465 |
if (defval === undefined) { |
| 466 |
throw new AttributeError("The attribute " + name + " is not present"); |
| 467 |
} |
| 468 |
return defval; |
| 469 |
} else { |
| 470 |
throw ρσ_Exception; |
| 471 |
} |
| 472 |
} |
| 473 |
if (ret === undefined && !(name in obj)) { |
| 474 |
if (defval === undefined) { |
| 475 |
throw new AttributeError("The attribute " + name + " is not present"); |
| 476 |
} |
| 477 |
ret = defval; |
| 478 |
} |
| 479 |
return ret; |
| 480 |
}; |
| 481 |
if (!ρσ_getattr.__argnames__) Object.defineProperties(ρσ_getattr, { |
| 482 |
__argnames__ : {value: ["obj", "name", "defval"]}, |
| 483 |
__module__ : {value: "__main__"} |
| 484 |
}); |
| 485 |
|
| 486 |
function ρσ_setattr(obj, name, value) { |
| 487 |
obj[(typeof name === "number" && name < 0) ? obj.length + name : name] = value; |
| 488 |
}; |
| 489 |
if (!ρσ_setattr.__argnames__) Object.defineProperties(ρσ_setattr, { |
| 490 |
__argnames__ : {value: ["obj", "name", "value"]}, |
| 491 |
__module__ : {value: "__main__"} |
| 492 |
}); |
| 493 |
|
| 494 |
function ρσ_hasattr(obj, name) { |
| 495 |
return name in obj; |
| 496 |
}; |
| 497 |
if (!ρσ_hasattr.__argnames__) Object.defineProperties(ρσ_hasattr, { |
| 498 |
__argnames__ : {value: ["obj", "name"]}, |
| 499 |
__module__ : {value: "__main__"} |
| 500 |
}); |
| 501 |
|
| 502 |
ρσ_len = (function() { |
| 503 |
var ρσ_anonfunc = function () { |
| 504 |
function len(obj) { |
| 505 |
if (ρσ_arraylike(obj)) { |
| 506 |
return obj.length; |
| 507 |
} |
| 508 |
if (typeof obj.__len__ === "function") { |
| 509 |
return obj.__len__(); |
| 510 |
} |
| 511 |
if (obj instanceof Set || obj instanceof Map) { |
| 512 |
return obj.size; |
| 513 |
} |
| 514 |
return Object.keys(obj).length; |
| 515 |
}; |
| 516 |
if (!len.__argnames__) Object.defineProperties(len, { |
| 517 |
__argnames__ : {value: ["obj"]}, |
| 518 |
__module__ : {value: "__main__"} |
| 519 |
}); |
| 520 |
|
| 521 |
function len5(obj) { |
| 522 |
if (ρσ_arraylike(obj)) { |
| 523 |
return obj.length; |
| 524 |
} |
| 525 |
if (typeof obj.__len__ === "function") { |
| 526 |
return obj.__len__(); |
| 527 |
} |
| 528 |
return Object.keys(obj).length; |
| 529 |
}; |
| 530 |
if (!len5.__argnames__) Object.defineProperties(len5, { |
| 531 |
__argnames__ : {value: ["obj"]}, |
| 532 |
__module__ : {value: "__main__"} |
| 533 |
}); |
| 534 |
|
| 535 |
return (typeof Set === "function" && typeof Map === "function") ? len : len5; |
| 536 |
}; |
| 537 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 538 |
__module__ : {value: "__main__"} |
| 539 |
}); |
| 540 |
return ρσ_anonfunc; |
| 541 |
})()(); |
| 542 |
function ρσ_get_module(name) { |
| 543 |
return ρσ_modules[(typeof name === "number" && name < 0) ? ρσ_modules.length + name : name]; |
| 544 |
}; |
| 545 |
if (!ρσ_get_module.__argnames__) Object.defineProperties(ρσ_get_module, { |
| 546 |
__argnames__ : {value: ["name"]}, |
| 547 |
__module__ : {value: "__main__"} |
| 548 |
}); |
| 549 |
|
| 550 |
function ρσ_pow(x, y, z) { |
| 551 |
var ans; |
| 552 |
ans = Math.pow(x, y); |
| 553 |
if (z !== undefined) { |
| 554 |
ans %= z; |
| 555 |
} |
| 556 |
return ans; |
| 557 |
}; |
| 558 |
if (!ρσ_pow.__argnames__) Object.defineProperties(ρσ_pow, { |
| 559 |
__argnames__ : {value: ["x", "y", "z"]}, |
| 560 |
__module__ : {value: "__main__"} |
| 561 |
}); |
| 562 |
|
| 563 |
function ρσ_type(x) { |
| 564 |
return x.constructor; |
| 565 |
}; |
| 566 |
if (!ρσ_type.__argnames__) Object.defineProperties(ρσ_type, { |
| 567 |
__argnames__ : {value: ["x"]}, |
| 568 |
__module__ : {value: "__main__"} |
| 569 |
}); |
| 570 |
|
| 571 |
function ρσ_divmod(x, y) { |
| 572 |
var d; |
| 573 |
if (y === 0) { |
| 574 |
throw new ZeroDivisionError("integer division or modulo by zero"); |
| 575 |
} |
| 576 |
d = Math.floor(x / y); |
| 577 |
return [d, x - d * y]; |
| 578 |
}; |
| 579 |
if (!ρσ_divmod.__argnames__) Object.defineProperties(ρσ_divmod, { |
| 580 |
__argnames__ : {value: ["x", "y"]}, |
| 581 |
__module__ : {value: "__main__"} |
| 582 |
}); |
| 583 |
|
| 584 |
function ρσ_max() { |
| 585 |
var kwargs = arguments[arguments.length-1]; |
| 586 |
if (kwargs === null || typeof kwargs !== "object" || kwargs [ρσ_kwargs_symbol] !== true) kwargs = {}; |
| 587 |
var args = Array.prototype.slice.call(arguments, 0); |
| 588 |
if (kwargs !== null && typeof kwargs === "object" && kwargs [ρσ_kwargs_symbol] === true) args.pop(); |
| 589 |
var args, x; |
| 590 |
if (args.length === 0) { |
| 591 |
if (kwargs.defval !== undefined) { |
| 592 |
return kwargs.defval; |
| 593 |
} |
| 594 |
throw new TypeError("expected at least one argument"); |
| 595 |
} |
| 596 |
if (args.length === 1) { |
| 597 |
args = args[0]; |
| 598 |
} |
| 599 |
if (kwargs.key) { |
| 600 |
args = (function() { |
| 601 |
var ρσ_Iter = args, ρσ_Result = [], x; |
| 602 |
ρσ_Iter = ((typeof ρσ_Iter[Symbol.iterator] === "function") ? (ρσ_Iter instanceof Map ? ρσ_Iter.keys() : ρσ_Iter) : Object.keys(ρσ_Iter)); |
| 603 |
for (var ρσ_Index of ρσ_Iter) { |
| 604 |
x = ρσ_Index; |
| 605 |
ρσ_Result.push(kwargs.key(x)); |
| 606 |
} |
| 607 |
ρσ_Result = ρσ_list_constructor(ρσ_Result); |
| 608 |
return ρσ_Result; |
| 609 |
})(); |
| 610 |
} |
| 611 |
if (!Array.isArray(args)) { |
| 612 |
args = list(args); |
| 613 |
} |
| 614 |
if (args.length) { |
| 615 |
return this.apply(null, args); |
| 616 |
} |
| 617 |
if (kwargs.defval !== undefined) { |
| 618 |
return kwargs.defval; |
| 619 |
} |
| 620 |
throw new TypeError("expected at least one argument"); |
| 621 |
}; |
| 622 |
if (!ρσ_max.__handles_kwarg_interpolation__) Object.defineProperties(ρσ_max, { |
| 623 |
__handles_kwarg_interpolation__ : {value: true}, |
| 624 |
__module__ : {value: "__main__"} |
| 625 |
}); |
| 626 |
|
| 627 |
var abs = Math.abs, max = ρσ_max.bind(Math.max); |
| 628 |
var min = ρσ_max.bind(Math.min), bool = ρσ_bool, type = ρσ_type; |
| 629 |
var float = ρσ_float, int = ρσ_int, arraylike = ρσ_arraylike_creator(); |
| 630 |
var ρσ_arraylike = arraylike; |
| 631 |
var print = ρσ_print, id = ρσ_id, get_module = ρσ_get_module; |
| 632 |
var pow = ρσ_pow, divmod = ρσ_divmod; |
| 633 |
var dir = ρσ_dir, ord = ρσ_ord, chr = ρσ_chr, bin = ρσ_bin; |
| 634 |
var hex = ρσ_hex, callable = ρσ_callable; |
| 635 |
var enumerate = ρσ_enumerate, iter = ρσ_iter, reversed = ρσ_reversed; |
| 636 |
var len = ρσ_len; |
| 637 |
var range = ρσ_range, getattr = ρσ_getattr, setattr = ρσ_setattr; |
| 638 |
var hasattr = ρσ_hasattr;function ρσ_equals(a, b) { |
| 639 |
var ρσ_unpack, akeys, bkeys, key; |
| 640 |
if (a === b) { |
| 641 |
return true; |
| 642 |
} |
| 643 |
if (a && typeof a.__eq__ === "function") { |
| 644 |
return a.__eq__(b); |
| 645 |
} |
| 646 |
if (b && typeof b.__eq__ === "function") { |
| 647 |
return b.__eq__(a); |
| 648 |
} |
| 649 |
if (ρσ_arraylike(a) && ρσ_arraylike(b)) { |
| 650 |
if ((a.length !== b.length && (typeof a.length !== "object" || ρσ_not_equals(a.length, b.length)))) { |
| 651 |
return false; |
| 652 |
} |
| 653 |
for (var i=0; i < a.length; i++) { |
| 654 |
if (!(((a[(typeof i === "number" && i < 0) ? a.length + i : i] === b[(typeof i === "number" && i < 0) ? b.length + i : i] || typeof a[(typeof i === "number" && i < 0) ? a.length + i : i] === "object" && ρσ_equals(a[(typeof i === "number" && i < 0) ? a.length + i : i], b[(typeof i === "number" && i < 0) ? b.length + i : i]))))) { |
| 655 |
return false; |
| 656 |
} |
| 657 |
} |
| 658 |
return true; |
| 659 |
} |
| 660 |
if (typeof a === "object" && typeof b === "object" && a !== null && b !== null && (a.constructor === Object && b.constructor === Object || Object.getPrototypeOf(a) === null && Object.getPrototypeOf(b) === null)) { |
| 661 |
ρσ_unpack = [Object.keys(a), Object.keys(b)]; |
| 662 |
akeys = ρσ_unpack[0]; |
| 663 |
bkeys = ρσ_unpack[1]; |
| 664 |
if (akeys.length !== bkeys.length) { |
| 665 |
return false; |
| 666 |
} |
| 667 |
for (var j=0; j < akeys.length; j++) { |
| 668 |
key = akeys[(typeof j === "number" && j < 0) ? akeys.length + j : j]; |
| 669 |
if (!(((a[(typeof key === "number" && key < 0) ? a.length + key : key] === b[(typeof key === "number" && key < 0) ? b.length + key : key] || typeof a[(typeof key === "number" && key < 0) ? a.length + key : key] === "object" && ρσ_equals(a[(typeof key === "number" && key < 0) ? a.length + key : key], b[(typeof key === "number" && key < 0) ? b.length + key : key]))))) { |
| 670 |
return false; |
| 671 |
} |
| 672 |
} |
| 673 |
return true; |
| 674 |
} |
| 675 |
return false; |
| 676 |
}; |
| 677 |
if (!ρσ_equals.__argnames__) Object.defineProperties(ρσ_equals, { |
| 678 |
__argnames__ : {value: ["a", "b"]}, |
| 679 |
__module__ : {value: "__main__"} |
| 680 |
}); |
| 681 |
|
| 682 |
function ρσ_not_equals(a, b) { |
| 683 |
if (a === b) { |
| 684 |
return false; |
| 685 |
} |
| 686 |
if (a && typeof a.__ne__ === "function") { |
| 687 |
return a.__ne__(b); |
| 688 |
} |
| 689 |
if (b && typeof b.__ne__ === "function") { |
| 690 |
return b.__ne__(a); |
| 691 |
} |
| 692 |
return !ρσ_equals(a, b); |
| 693 |
}; |
| 694 |
if (!ρσ_not_equals.__argnames__) Object.defineProperties(ρσ_not_equals, { |
| 695 |
__argnames__ : {value: ["a", "b"]}, |
| 696 |
__module__ : {value: "__main__"} |
| 697 |
}); |
| 698 |
|
| 699 |
var equals = ρσ_equals; |
| 700 |
function ρσ_list_iterator(value) { |
| 701 |
var self; |
| 702 |
self = this; |
| 703 |
return (function(){ |
| 704 |
var ρσ_d = {}; |
| 705 |
ρσ_d["_i"] = -1; |
| 706 |
ρσ_d["_list"] = self; |
| 707 |
ρσ_d["next"] = (function() { |
| 708 |
var ρσ_anonfunc = function () { |
| 709 |
this._i += 1; |
| 710 |
if (this._i >= this._list.length) { |
| 711 |
return (function(){ |
| 712 |
var ρσ_d = {}; |
| 713 |
ρσ_d["done"] = true; |
| 714 |
return ρσ_d; |
| 715 |
}).call(this); |
| 716 |
} |
| 717 |
return (function(){ |
| 718 |
var ρσ_d = {}; |
| 719 |
ρσ_d["done"] = false; |
| 720 |
ρσ_d["value"] = (ρσ_expr_temp = this._list)[ρσ_bound_index(this._i, ρσ_expr_temp)]; |
| 721 |
return ρσ_d; |
| 722 |
}).call(this); |
| 723 |
}; |
| 724 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 725 |
__module__ : {value: "__main__"} |
| 726 |
}); |
| 727 |
return ρσ_anonfunc; |
| 728 |
})(); |
| 729 |
return ρσ_d; |
| 730 |
}).call(this); |
| 731 |
}; |
| 732 |
if (!ρσ_list_iterator.__argnames__) Object.defineProperties(ρσ_list_iterator, { |
| 733 |
__argnames__ : {value: ["value"]}, |
| 734 |
__module__ : {value: "__main__"} |
| 735 |
}); |
| 736 |
|
| 737 |
function ρσ_list_constructor(iterable) { |
| 738 |
var ans, iterator, result; |
| 739 |
if (iterable === undefined) { |
| 740 |
ans = []; |
| 741 |
} else if (ρσ_arraylike(iterable)) { |
| 742 |
ans = new Array(iterable.length); |
| 743 |
for (var i = 0; i < iterable.length; i++) { |
| 744 |
ans[(typeof i === "number" && i < 0) ? ans.length + i : i] = iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i]; |
| 745 |
} |
| 746 |
} else if (typeof iterable[ρσ_iterator_symbol] === "function") { |
| 747 |
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol](); |
| 748 |
ans = []; |
| 749 |
result = iterator.next(); |
| 750 |
while (!result.done) { |
| 751 |
ans.push(result.value); |
| 752 |
result = iterator.next(); |
| 753 |
} |
| 754 |
} else if (typeof iterable === "number") { |
| 755 |
ans = new Array(iterable); |
| 756 |
} else { |
| 757 |
ans = Object.keys(iterable); |
| 758 |
} |
| 759 |
return ans; |
| 760 |
}; |
| 761 |
if (!ρσ_list_constructor.__argnames__) Object.defineProperties(ρσ_list_constructor, { |
| 762 |
__argnames__ : {value: ["iterable"]}, |
| 763 |
__module__ : {value: "__main__"} |
| 764 |
}); |
| 765 |
|
| 766 |
ρσ_list_constructor.__name__ = "list"; |
| 767 |
if (typeof Array.prototype.append !== "function") { |
| 768 |
Object.defineProperty(Array.prototype, "append", (function(){ |
| 769 |
var ρσ_d = {}; |
| 770 |
ρσ_d["writable"] = false; |
| 771 |
ρσ_d["configurable"] = false; |
| 772 |
ρσ_d["enumerable"] = false; |
| 773 |
ρσ_d["value"] = Array.prototype.push; |
| 774 |
return ρσ_d; |
| 775 |
}).call(this)); |
| 776 |
Object.defineProperty(Array.prototype, "extend", (function(){ |
| 777 |
var ρσ_d = {}; |
| 778 |
ρσ_d["writable"] = false; |
| 779 |
ρσ_d["configurable"] = false; |
| 780 |
ρσ_d["enumerable"] = false; |
| 781 |
ρσ_d["value"] = (function() { |
| 782 |
var ρσ_anonfunc = function (iterable) { |
| 783 |
var start, iterator, result; |
| 784 |
if (Array.isArray(iterable) || typeof iterable === "string") { |
| 785 |
start = this.length; |
| 786 |
this.length += iterable.length; |
| 787 |
for (var i = 0; i < iterable.length; i++) { |
| 788 |
(ρσ_expr_temp = this)[ρσ_bound_index(start + i, ρσ_expr_temp)] = iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i]; |
| 789 |
} |
| 790 |
} else { |
| 791 |
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol](); |
| 792 |
result = iterator.next(); |
| 793 |
while (!result.done) { |
| 794 |
this.push(result.value); |
| 795 |
result = iterator.next(); |
| 796 |
} |
| 797 |
} |
| 798 |
}; |
| 799 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 800 |
__argnames__ : {value: ["iterable"]}, |
| 801 |
__module__ : {value: "__main__"} |
| 802 |
}); |
| 803 |
return ρσ_anonfunc; |
| 804 |
})(); |
| 805 |
return ρσ_d; |
| 806 |
}).call(this)); |
| 807 |
Object.defineProperty(Array.prototype, "index", (function(){ |
| 808 |
var ρσ_d = {}; |
| 809 |
ρσ_d["writable"] = false; |
| 810 |
ρσ_d["configurable"] = false; |
| 811 |
ρσ_d["enumerable"] = false; |
| 812 |
ρσ_d["value"] = (function() { |
| 813 |
var ρσ_anonfunc = function (val, start, stop) { |
| 814 |
start = start || 0; |
| 815 |
if (start < 0) { |
| 816 |
start = this.length + start; |
| 817 |
} |
| 818 |
if (start < 0) { |
| 819 |
throw new ValueError(val + " is not in list"); |
| 820 |
} |
| 821 |
if (stop === undefined) { |
| 822 |
stop = this.length; |
| 823 |
} |
| 824 |
if (stop < 0) { |
| 825 |
stop = this.length + stop; |
| 826 |
} |
| 827 |
for (var i = start; i < stop; i++) { |
| 828 |
if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === val || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], val))) { |
| 829 |
return i; |
| 830 |
} |
| 831 |
} |
| 832 |
throw new ValueError(val + " is not in list"); |
| 833 |
}; |
| 834 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 835 |
__argnames__ : {value: ["val", "start", "stop"]}, |
| 836 |
__module__ : {value: "__main__"} |
| 837 |
}); |
| 838 |
return ρσ_anonfunc; |
| 839 |
})(); |
| 840 |
return ρσ_d; |
| 841 |
}).call(this)); |
| 842 |
Object.defineProperty(Array.prototype, "pypop", (function(){ |
| 843 |
var ρσ_d = {}; |
| 844 |
ρσ_d["writable"] = false; |
| 845 |
ρσ_d["configurable"] = false; |
| 846 |
ρσ_d["enumerable"] = false; |
| 847 |
ρσ_d["value"] = (function() { |
| 848 |
var ρσ_anonfunc = function (index) { |
| 849 |
var ans; |
| 850 |
if (this.length === 0) { |
| 851 |
throw new IndexError("list is empty"); |
| 852 |
} |
| 853 |
if (index === undefined) { |
| 854 |
index = -1; |
| 855 |
} |
| 856 |
ans = this.splice(index, 1); |
| 857 |
if (!ans.length) { |
| 858 |
throw new IndexError("pop index out of range"); |
| 859 |
} |
| 860 |
return ans[0]; |
| 861 |
}; |
| 862 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 863 |
__argnames__ : {value: ["index"]}, |
| 864 |
__module__ : {value: "__main__"} |
| 865 |
}); |
| 866 |
return ρσ_anonfunc; |
| 867 |
})(); |
| 868 |
return ρσ_d; |
| 869 |
}).call(this)); |
| 870 |
Object.defineProperty(Array.prototype, "remove", (function(){ |
| 871 |
var ρσ_d = {}; |
| 872 |
ρσ_d["writable"] = false; |
| 873 |
ρσ_d["configurable"] = false; |
| 874 |
ρσ_d["enumerable"] = false; |
| 875 |
ρσ_d["value"] = (function() { |
| 876 |
var ρσ_anonfunc = function (value) { |
| 877 |
for (var i = 0; i < this.length; i++) { |
| 878 |
if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === value || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], value))) { |
| 879 |
this.splice(i, 1); |
| 880 |
return; |
| 881 |
} |
| 882 |
} |
| 883 |
throw new ValueError(value + " not in list"); |
| 884 |
}; |
| 885 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 886 |
__argnames__ : {value: ["value"]}, |
| 887 |
__module__ : {value: "__main__"} |
| 888 |
}); |
| 889 |
return ρσ_anonfunc; |
| 890 |
})(); |
| 891 |
return ρσ_d; |
| 892 |
}).call(this)); |
| 893 |
Object.defineProperty(Array.prototype, "toString", (function(){ |
| 894 |
var ρσ_d = {}; |
| 895 |
ρσ_d["writable"] = false; |
| 896 |
ρσ_d["configurable"] = false; |
| 897 |
ρσ_d["enumerable"] = false; |
| 898 |
ρσ_d["value"] = (function() { |
| 899 |
var ρσ_anonfunc = function () { |
| 900 |
return "[" + this.join(", ") + "]"; |
| 901 |
}; |
| 902 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 903 |
__module__ : {value: "__main__"} |
| 904 |
}); |
| 905 |
return ρσ_anonfunc; |
| 906 |
})(); |
| 907 |
return ρσ_d; |
| 908 |
}).call(this)); |
| 909 |
Object.defineProperty(Array.prototype, "inspect", (function(){ |
| 910 |
var ρσ_d = {}; |
| 911 |
ρσ_d["writable"] = false; |
| 912 |
ρσ_d["configurable"] = false; |
| 913 |
ρσ_d["enumerable"] = false; |
| 914 |
ρσ_d["value"] = (function() { |
| 915 |
var ρσ_anonfunc = function () { |
| 916 |
return "[" + this.join(", ") + "]"; |
| 917 |
}; |
| 918 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 919 |
__module__ : {value: "__main__"} |
| 920 |
}); |
| 921 |
return ρσ_anonfunc; |
| 922 |
})(); |
| 923 |
return ρσ_d; |
| 924 |
}).call(this)); |
| 925 |
Object.defineProperty(Array.prototype, "insert", (function(){ |
| 926 |
var ρσ_d = {}; |
| 927 |
ρσ_d["writable"] = false; |
| 928 |
ρσ_d["configurable"] = false; |
| 929 |
ρσ_d["enumerable"] = false; |
| 930 |
ρσ_d["value"] = (function() { |
| 931 |
var ρσ_anonfunc = function (index, val) { |
| 932 |
if (index < 0) { |
| 933 |
index += this.length; |
| 934 |
} |
| 935 |
index = min(this.length, max(index, 0)); |
| 936 |
if (index === 0) { |
| 937 |
this.unshift(val); |
| 938 |
return; |
| 939 |
} |
| 940 |
for (var i = this.length; i > index; i--) { |
| 941 |
(ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] = (ρσ_expr_temp = this)[ρσ_bound_index(i - 1, ρσ_expr_temp)]; |
| 942 |
} |
| 943 |
(ρσ_expr_temp = this)[(typeof index === "number" && index < 0) ? ρσ_expr_temp.length + index : index] = val; |
| 944 |
}; |
| 945 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 946 |
__argnames__ : {value: ["index", "val"]}, |
| 947 |
__module__ : {value: "__main__"} |
| 948 |
}); |
| 949 |
return ρσ_anonfunc; |
| 950 |
})(); |
| 951 |
return ρσ_d; |
| 952 |
}).call(this)); |
| 953 |
Object.defineProperty(Array.prototype, "copy", (function(){ |
| 954 |
var ρσ_d = {}; |
| 955 |
ρσ_d["writable"] = false; |
| 956 |
ρσ_d["configurable"] = false; |
| 957 |
ρσ_d["enumerable"] = false; |
| 958 |
ρσ_d["value"] = (function() { |
| 959 |
var ρσ_anonfunc = function () { |
| 960 |
return ρσ_list_constructor(this); |
| 961 |
}; |
| 962 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 963 |
__module__ : {value: "__main__"} |
| 964 |
}); |
| 965 |
return ρσ_anonfunc; |
| 966 |
})(); |
| 967 |
return ρσ_d; |
| 968 |
}).call(this)); |
| 969 |
Object.defineProperty(Array.prototype, "clear", (function(){ |
| 970 |
var ρσ_d = {}; |
| 971 |
ρσ_d["writable"] = false; |
| 972 |
ρσ_d["configurable"] = false; |
| 973 |
ρσ_d["enumerable"] = false; |
| 974 |
ρσ_d["value"] = (function() { |
| 975 |
var ρσ_anonfunc = function () { |
| 976 |
this.length = 0; |
| 977 |
}; |
| 978 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 979 |
__module__ : {value: "__main__"} |
| 980 |
}); |
| 981 |
return ρσ_anonfunc; |
| 982 |
})(); |
| 983 |
return ρσ_d; |
| 984 |
}).call(this)); |
| 985 |
Object.defineProperty(Array.prototype, "count", (function(){ |
| 986 |
var ρσ_d = {}; |
| 987 |
ρσ_d["writable"] = false; |
| 988 |
ρσ_d["configurable"] = false; |
| 989 |
ρσ_d["enumerable"] = false; |
| 990 |
ρσ_d["value"] = (function() { |
| 991 |
var ρσ_anonfunc = function (value) { |
| 992 |
return this.reduce((function() { |
| 993 |
var ρσ_anonfunc = function (n, val) { |
| 994 |
return n + (val === value); |
| 995 |
}; |
| 996 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 997 |
__argnames__ : {value: ["n", "val"]}, |
| 998 |
__module__ : {value: "__main__"} |
| 999 |
}); |
| 1000 |
return ρσ_anonfunc; |
| 1001 |
})(), 0); |
| 1002 |
}; |
| 1003 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1004 |
__argnames__ : {value: ["value"]}, |
| 1005 |
__module__ : {value: "__main__"} |
| 1006 |
}); |
| 1007 |
return ρσ_anonfunc; |
| 1008 |
})(); |
| 1009 |
return ρσ_d; |
| 1010 |
}).call(this)); |
| 1011 |
Object.defineProperty(Array.prototype, "pysort", (function(){ |
| 1012 |
var ρσ_d = {}; |
| 1013 |
ρσ_d["writable"] = false; |
| 1014 |
ρσ_d["configurable"] = false; |
| 1015 |
ρσ_d["enumerable"] = false; |
| 1016 |
ρσ_d["value"] = (function() { |
| 1017 |
var ρσ_anonfunc = function () { |
| 1018 |
var key = (arguments[0] === undefined || ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_anonfunc.__defaults__.key : arguments[0]; |
| 1019 |
var reverse = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_anonfunc.__defaults__.reverse : arguments[1]; |
| 1020 |
var ρσ_kwargs_obj = arguments[arguments.length-1]; |
| 1021 |
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {}; |
| 1022 |
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "key")){ |
| 1023 |
key = ρσ_kwargs_obj.key; |
| 1024 |
} |
| 1025 |
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "reverse")){ |
| 1026 |
reverse = ρσ_kwargs_obj.reverse; |
| 1027 |
} |
| 1028 |
var _sort_key, _sort_cmp, mult, keymap, posmap, k; |
| 1029 |
_sort_key = (function() { |
| 1030 |
var ρσ_anonfunc = function (value) { |
| 1031 |
var t; |
| 1032 |
t = typeof value; |
| 1033 |
if (t === "string" || t === "number") { |
| 1034 |
return value; |
| 1035 |
} |
| 1036 |
return value.toString(); |
| 1037 |
}; |
| 1038 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1039 |
__argnames__ : {value: ["value"]}, |
| 1040 |
__module__ : {value: "__main__"} |
| 1041 |
}); |
| 1042 |
return ρσ_anonfunc; |
| 1043 |
})(); |
| 1044 |
_sort_cmp = (function() { |
| 1045 |
var ρσ_anonfunc = function (a, b, ap, bp) { |
| 1046 |
if (a < b) { |
| 1047 |
return -1; |
| 1048 |
} |
| 1049 |
if (a > b) { |
| 1050 |
return 1; |
| 1051 |
} |
| 1052 |
return ap - bp; |
| 1053 |
}; |
| 1054 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1055 |
__argnames__ : {value: ["a", "b", "ap", "bp"]}, |
| 1056 |
__module__ : {value: "__main__"} |
| 1057 |
}); |
| 1058 |
return ρσ_anonfunc; |
| 1059 |
})(); |
| 1060 |
key = key || _sort_key; |
| 1061 |
mult = (reverse) ? -1 : 1; |
| 1062 |
keymap = dict(); |
| 1063 |
posmap = dict(); |
| 1064 |
for (var i=0; i < this.length; i++) { |
| 1065 |
k = (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i]; |
| 1066 |
keymap.set(k, key(k)); |
| 1067 |
posmap.set(k, i); |
| 1068 |
} |
| 1069 |
this.sort((function() { |
| 1070 |
var ρσ_anonfunc = function (a, b) { |
| 1071 |
return mult * _sort_cmp(keymap.get(a), keymap.get(b), posmap.get(a), posmap.get(b)); |
| 1072 |
}; |
| 1073 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1074 |
__argnames__ : {value: ["a", "b"]}, |
| 1075 |
__module__ : {value: "__main__"} |
| 1076 |
}); |
| 1077 |
return ρσ_anonfunc; |
| 1078 |
})()); |
| 1079 |
}; |
| 1080 |
if (!ρσ_anonfunc.__defaults__) Object.defineProperties(ρσ_anonfunc, { |
| 1081 |
__defaults__ : {value: {key:null, reverse:false}}, |
| 1082 |
__handles_kwarg_interpolation__ : {value: true}, |
| 1083 |
__argnames__ : {value: ["key", "reverse"]}, |
| 1084 |
__module__ : {value: "__main__"} |
| 1085 |
}); |
| 1086 |
return ρσ_anonfunc; |
| 1087 |
})(); |
| 1088 |
return ρσ_d; |
| 1089 |
}).call(this)); |
| 1090 |
Object.defineProperty(Array.prototype, "as_array", (function(){ |
| 1091 |
var ρσ_d = {}; |
| 1092 |
ρσ_d["writable"] = false; |
| 1093 |
ρσ_d["configurable"] = false; |
| 1094 |
ρσ_d["enumerable"] = false; |
| 1095 |
ρσ_d["value"] = (function() { |
| 1096 |
var ρσ_anonfunc = function () { |
| 1097 |
return Array.from(this); |
| 1098 |
}; |
| 1099 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1100 |
__module__ : {value: "__main__"} |
| 1101 |
}); |
| 1102 |
return ρσ_anonfunc; |
| 1103 |
})(); |
| 1104 |
return ρσ_d; |
| 1105 |
}).call(this)); |
| 1106 |
Object.defineProperty(Array.prototype, "__len__", (function(){ |
| 1107 |
var ρσ_d = {}; |
| 1108 |
ρσ_d["writable"] = false; |
| 1109 |
ρσ_d["configurable"] = false; |
| 1110 |
ρσ_d["enumerable"] = false; |
| 1111 |
ρσ_d["value"] = (function() { |
| 1112 |
var ρσ_anonfunc = function () { |
| 1113 |
return this.length; |
| 1114 |
}; |
| 1115 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1116 |
__module__ : {value: "__main__"} |
| 1117 |
}); |
| 1118 |
return ρσ_anonfunc; |
| 1119 |
})(); |
| 1120 |
return ρσ_d; |
| 1121 |
}).call(this)); |
| 1122 |
Object.defineProperty(Array.prototype, "__contains__", (function(){ |
| 1123 |
var ρσ_d = {}; |
| 1124 |
ρσ_d["writable"] = false; |
| 1125 |
ρσ_d["configurable"] = false; |
| 1126 |
ρσ_d["enumerable"] = false; |
| 1127 |
ρσ_d["value"] = (function() { |
| 1128 |
var ρσ_anonfunc = function (val) { |
| 1129 |
for (var i = 0; i < this.length; i++) { |
| 1130 |
if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === val || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], val))) { |
| 1131 |
return true; |
| 1132 |
} |
| 1133 |
} |
| 1134 |
return false; |
| 1135 |
}; |
| 1136 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1137 |
__argnames__ : {value: ["val"]}, |
| 1138 |
__module__ : {value: "__main__"} |
| 1139 |
}); |
| 1140 |
return ρσ_anonfunc; |
| 1141 |
})(); |
| 1142 |
return ρσ_d; |
| 1143 |
}).call(this)); |
| 1144 |
Object.defineProperty(Array.prototype, "__eq__", (function(){ |
| 1145 |
var ρσ_d = {}; |
| 1146 |
ρσ_d["writable"] = false; |
| 1147 |
ρσ_d["configurable"] = false; |
| 1148 |
ρσ_d["enumerable"] = false; |
| 1149 |
ρσ_d["value"] = (function() { |
| 1150 |
var ρσ_anonfunc = function (other) { |
| 1151 |
if (!ρσ_arraylike(other)) { |
| 1152 |
return false; |
| 1153 |
} |
| 1154 |
if ((this.length !== other.length && (typeof this.length !== "object" || ρσ_not_equals(this.length, other.length)))) { |
| 1155 |
return false; |
| 1156 |
} |
| 1157 |
for (var i = 0; i < this.length; i++) { |
| 1158 |
if (!((((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === other[(typeof i === "number" && i < 0) ? other.length + i : i] || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], other[(typeof i === "number" && i < 0) ? other.length + i : i]))))) { |
| 1159 |
return false; |
| 1160 |
} |
| 1161 |
} |
| 1162 |
return true; |
| 1163 |
}; |
| 1164 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1165 |
__argnames__ : {value: ["other"]}, |
| 1166 |
__module__ : {value: "__main__"} |
| 1167 |
}); |
| 1168 |
return ρσ_anonfunc; |
| 1169 |
})(); |
| 1170 |
return ρσ_d; |
| 1171 |
}).call(this)); |
| 1172 |
Object.defineProperty(Array.prototype, "constructor", (function(){ |
| 1173 |
var ρσ_d = {}; |
| 1174 |
ρσ_d["writable"] = false; |
| 1175 |
ρσ_d["configurable"] = false; |
| 1176 |
ρσ_d["enumerable"] = false; |
| 1177 |
ρσ_d["value"] = ρσ_list_constructor; |
| 1178 |
return ρσ_d; |
| 1179 |
}).call(this)); |
| 1180 |
} |
| 1181 |
function ρσ_list_decorate(ans) { |
| 1182 |
return ans; |
| 1183 |
}; |
| 1184 |
if (!ρσ_list_decorate.__argnames__) Object.defineProperties(ρσ_list_decorate, { |
| 1185 |
__argnames__ : {value: ["ans"]}, |
| 1186 |
__module__ : {value: "__main__"} |
| 1187 |
}); |
| 1188 |
|
| 1189 |
var list = ρσ_list_constructor, list_wrap = ρσ_list_decorate; |
| 1190 |
function sorted() { |
| 1191 |
var iterable = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0]; |
| 1192 |
var key = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? sorted.__defaults__.key : arguments[1]; |
| 1193 |
var reverse = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? sorted.__defaults__.reverse : arguments[2]; |
| 1194 |
var ρσ_kwargs_obj = arguments[arguments.length-1]; |
| 1195 |
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {}; |
| 1196 |
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "key")){ |
| 1197 |
key = ρσ_kwargs_obj.key; |
| 1198 |
} |
| 1199 |
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "reverse")){ |
| 1200 |
reverse = ρσ_kwargs_obj.reverse; |
| 1201 |
} |
| 1202 |
var ans; |
| 1203 |
ans = ρσ_list_constructor(iterable); |
| 1204 |
ans.pysort(key, reverse); |
| 1205 |
return ans; |
| 1206 |
}; |
| 1207 |
if (!sorted.__defaults__) Object.defineProperties(sorted, { |
| 1208 |
__defaults__ : {value: {key:null, reverse:false}}, |
| 1209 |
__handles_kwarg_interpolation__ : {value: true}, |
| 1210 |
__argnames__ : {value: ["iterable", "key", "reverse"]}, |
| 1211 |
__module__ : {value: "__main__"} |
| 1212 |
}); |
| 1213 |
|
| 1214 |
var ρσ_global_object_id = 0, ρσ_set_implementation; |
| 1215 |
function ρσ_set_keyfor(x) { |
| 1216 |
var t, ans; |
| 1217 |
t = typeof x; |
| 1218 |
if (t === "string" || t === "number" || t === "boolean") { |
| 1219 |
return "_" + t[0] + x; |
| 1220 |
} |
| 1221 |
if (x === null) { |
| 1222 |
return "__!@#$0"; |
| 1223 |
} |
| 1224 |
ans = x.ρσ_hash_key_prop; |
| 1225 |
if (ans === undefined) { |
| 1226 |
ans = "_!@#$" + (++ρσ_global_object_id); |
| 1227 |
Object.defineProperty(x, "ρσ_hash_key_prop", (function(){ |
| 1228 |
var ρσ_d = {}; |
| 1229 |
ρσ_d["value"] = ans; |
| 1230 |
return ρσ_d; |
| 1231 |
}).call(this)); |
| 1232 |
} |
| 1233 |
return ans; |
| 1234 |
}; |
| 1235 |
if (!ρσ_set_keyfor.__argnames__) Object.defineProperties(ρσ_set_keyfor, { |
| 1236 |
__argnames__ : {value: ["x"]}, |
| 1237 |
__module__ : {value: "__main__"} |
| 1238 |
}); |
| 1239 |
|
| 1240 |
function ρσ_set_polyfill() { |
| 1241 |
this._store = {}; |
| 1242 |
this.size = 0; |
| 1243 |
}; |
| 1244 |
if (!ρσ_set_polyfill.__module__) Object.defineProperties(ρσ_set_polyfill, { |
| 1245 |
__module__ : {value: "__main__"} |
| 1246 |
}); |
| 1247 |
|
| 1248 |
ρσ_set_polyfill.prototype.add = (function() { |
| 1249 |
var ρσ_anonfunc = function (x) { |
| 1250 |
var key; |
| 1251 |
key = ρσ_set_keyfor(x); |
| 1252 |
if (!Object.prototype.hasOwnProperty.call(this._store, key)) { |
| 1253 |
this.size += 1; |
| 1254 |
(ρσ_expr_temp = this._store)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key] = x; |
| 1255 |
} |
| 1256 |
return this; |
| 1257 |
}; |
| 1258 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1259 |
__argnames__ : {value: ["x"]}, |
| 1260 |
__module__ : {value: "__main__"} |
| 1261 |
}); |
| 1262 |
return ρσ_anonfunc; |
| 1263 |
})(); |
| 1264 |
ρσ_set_polyfill.prototype.clear = (function() { |
| 1265 |
var ρσ_anonfunc = function (x) { |
| 1266 |
this._store = {}; |
| 1267 |
this.size = 0; |
| 1268 |
}; |
| 1269 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1270 |
__argnames__ : {value: ["x"]}, |
| 1271 |
__module__ : {value: "__main__"} |
| 1272 |
}); |
| 1273 |
return ρσ_anonfunc; |
| 1274 |
})(); |
| 1275 |
ρσ_set_polyfill.prototype.delete = (function() { |
| 1276 |
var ρσ_anonfunc = function (x) { |
| 1277 |
var key; |
| 1278 |
key = ρσ_set_keyfor(x); |
| 1279 |
if (Object.prototype.hasOwnProperty.call(this._store, key)) { |
| 1280 |
this.size -= 1; |
| 1281 |
delete this._store[key]; |
| 1282 |
return true; |
| 1283 |
} |
| 1284 |
return false; |
| 1285 |
}; |
| 1286 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1287 |
__argnames__ : {value: ["x"]}, |
| 1288 |
__module__ : {value: "__main__"} |
| 1289 |
}); |
| 1290 |
return ρσ_anonfunc; |
| 1291 |
})(); |
| 1292 |
ρσ_set_polyfill.prototype.has = (function() { |
| 1293 |
var ρσ_anonfunc = function (x) { |
| 1294 |
return Object.prototype.hasOwnProperty.call(this._store, ρσ_set_keyfor(x)); |
| 1295 |
}; |
| 1296 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1297 |
__argnames__ : {value: ["x"]}, |
| 1298 |
__module__ : {value: "__main__"} |
| 1299 |
}); |
| 1300 |
return ρσ_anonfunc; |
| 1301 |
})(); |
| 1302 |
ρσ_set_polyfill.prototype.values = (function() { |
| 1303 |
var ρσ_anonfunc = function (x) { |
| 1304 |
var ans; |
| 1305 |
ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store}; |
| 1306 |
ans[ρσ_iterator_symbol] = (function() { |
| 1307 |
var ρσ_anonfunc = function () { |
| 1308 |
return this; |
| 1309 |
}; |
| 1310 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1311 |
__module__ : {value: "__main__"} |
| 1312 |
}); |
| 1313 |
return ρσ_anonfunc; |
| 1314 |
})(); |
| 1315 |
ans["next"] = (function() { |
| 1316 |
var ρσ_anonfunc = function () { |
| 1317 |
this._i += 1; |
| 1318 |
if (this._i >= this._keys.length) { |
| 1319 |
return {'done': true}; |
| 1320 |
} |
| 1321 |
return {'done':false, 'value':this._s[this._keys[this._i]]}; |
| 1322 |
}; |
| 1323 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1324 |
__module__ : {value: "__main__"} |
| 1325 |
}); |
| 1326 |
return ρσ_anonfunc; |
| 1327 |
})(); |
| 1328 |
return ans; |
| 1329 |
}; |
| 1330 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1331 |
__argnames__ : {value: ["x"]}, |
| 1332 |
__module__ : {value: "__main__"} |
| 1333 |
}); |
| 1334 |
return ρσ_anonfunc; |
| 1335 |
})(); |
| 1336 |
if (typeof Set !== "function" || typeof Set.prototype.delete !== "function") { |
| 1337 |
ρσ_set_implementation = ρσ_set_polyfill; |
| 1338 |
} else { |
| 1339 |
ρσ_set_implementation = Set; |
| 1340 |
} |
| 1341 |
function ρσ_set(iterable) { |
| 1342 |
var ans, s, iterator, result, keys; |
| 1343 |
if (this instanceof ρσ_set) { |
| 1344 |
this.jsset = new ρσ_set_implementation; |
| 1345 |
ans = this; |
| 1346 |
if (iterable === undefined) { |
| 1347 |
return ans; |
| 1348 |
} |
| 1349 |
s = ans.jsset; |
| 1350 |
if (ρσ_arraylike(iterable)) { |
| 1351 |
for (var i = 0; i < iterable.length; i++) { |
| 1352 |
s.add(iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i]); |
| 1353 |
} |
| 1354 |
} else if (typeof iterable[ρσ_iterator_symbol] === "function") { |
| 1355 |
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol](); |
| 1356 |
result = iterator.next(); |
| 1357 |
while (!result.done) { |
| 1358 |
s.add(result.value); |
| 1359 |
result = iterator.next(); |
| 1360 |
} |
| 1361 |
} else { |
| 1362 |
keys = Object.keys(iterable); |
| 1363 |
for (var j=0; j < keys.length; j++) { |
| 1364 |
s.add(keys[(typeof j === "number" && j < 0) ? keys.length + j : j]); |
| 1365 |
} |
| 1366 |
} |
| 1367 |
return ans; |
| 1368 |
} else { |
| 1369 |
return new ρσ_set(iterable); |
| 1370 |
} |
| 1371 |
}; |
| 1372 |
if (!ρσ_set.__argnames__) Object.defineProperties(ρσ_set, { |
| 1373 |
__argnames__ : {value: ["iterable"]}, |
| 1374 |
__module__ : {value: "__main__"} |
| 1375 |
}); |
| 1376 |
|
| 1377 |
ρσ_set.prototype.__name__ = "set"; |
| 1378 |
Object.defineProperties(ρσ_set.prototype, (function(){ |
| 1379 |
var ρσ_d = {}; |
| 1380 |
ρσ_d["length"] = (function(){ |
| 1381 |
var ρσ_d = {}; |
| 1382 |
ρσ_d["get"] = (function() { |
| 1383 |
var ρσ_anonfunc = function () { |
| 1384 |
return this.jsset.size; |
| 1385 |
}; |
| 1386 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1387 |
__module__ : {value: "__main__"} |
| 1388 |
}); |
| 1389 |
return ρσ_anonfunc; |
| 1390 |
})(); |
| 1391 |
return ρσ_d; |
| 1392 |
}).call(this); |
| 1393 |
ρσ_d["size"] = (function(){ |
| 1394 |
var ρσ_d = {}; |
| 1395 |
ρσ_d["get"] = (function() { |
| 1396 |
var ρσ_anonfunc = function () { |
| 1397 |
return this.jsset.size; |
| 1398 |
}; |
| 1399 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1400 |
__module__ : {value: "__main__"} |
| 1401 |
}); |
| 1402 |
return ρσ_anonfunc; |
| 1403 |
})(); |
| 1404 |
return ρσ_d; |
| 1405 |
}).call(this); |
| 1406 |
return ρσ_d; |
| 1407 |
}).call(this)); |
| 1408 |
ρσ_set.prototype.__len__ = (function() { |
| 1409 |
var ρσ_anonfunc = function () { |
| 1410 |
return this.jsset.size; |
| 1411 |
}; |
| 1412 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1413 |
__module__ : {value: "__main__"} |
| 1414 |
}); |
| 1415 |
return ρσ_anonfunc; |
| 1416 |
})(); |
| 1417 |
ρσ_set.prototype.has = ρσ_set.prototype.__contains__ = (function() { |
| 1418 |
var ρσ_anonfunc = function (x) { |
| 1419 |
return this.jsset.has(x); |
| 1420 |
}; |
| 1421 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1422 |
__argnames__ : {value: ["x"]}, |
| 1423 |
__module__ : {value: "__main__"} |
| 1424 |
}); |
| 1425 |
return ρσ_anonfunc; |
| 1426 |
})(); |
| 1427 |
ρσ_set.prototype.add = (function() { |
| 1428 |
var ρσ_anonfunc = function (x) { |
| 1429 |
this.jsset.add(x); |
| 1430 |
}; |
| 1431 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1432 |
__argnames__ : {value: ["x"]}, |
| 1433 |
__module__ : {value: "__main__"} |
| 1434 |
}); |
| 1435 |
return ρσ_anonfunc; |
| 1436 |
})(); |
| 1437 |
ρσ_set.prototype.clear = (function() { |
| 1438 |
var ρσ_anonfunc = function () { |
| 1439 |
this.jsset.clear(); |
| 1440 |
}; |
| 1441 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1442 |
__module__ : {value: "__main__"} |
| 1443 |
}); |
| 1444 |
return ρσ_anonfunc; |
| 1445 |
})(); |
| 1446 |
ρσ_set.prototype.copy = (function() { |
| 1447 |
var ρσ_anonfunc = function () { |
| 1448 |
return ρσ_set(this); |
| 1449 |
}; |
| 1450 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1451 |
__module__ : {value: "__main__"} |
| 1452 |
}); |
| 1453 |
return ρσ_anonfunc; |
| 1454 |
})(); |
| 1455 |
ρσ_set.prototype.discard = (function() { |
| 1456 |
var ρσ_anonfunc = function (x) { |
| 1457 |
this.jsset.delete(x); |
| 1458 |
}; |
| 1459 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1460 |
__argnames__ : {value: ["x"]}, |
| 1461 |
__module__ : {value: "__main__"} |
| 1462 |
}); |
| 1463 |
return ρσ_anonfunc; |
| 1464 |
})(); |
| 1465 |
ρσ_set.prototype[ρσ_iterator_symbol] = (function() { |
| 1466 |
var ρσ_anonfunc = function () { |
| 1467 |
return this.jsset.values(); |
| 1468 |
}; |
| 1469 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1470 |
__module__ : {value: "__main__"} |
| 1471 |
}); |
| 1472 |
return ρσ_anonfunc; |
| 1473 |
})(); |
| 1474 |
ρσ_set.prototype.difference = (function() { |
| 1475 |
var ρσ_anonfunc = function () { |
| 1476 |
var ans, s, iterator, r, x, has; |
| 1477 |
ans = new ρσ_set; |
| 1478 |
s = ans.jsset; |
| 1479 |
iterator = this.jsset.values(); |
| 1480 |
r = iterator.next(); |
| 1481 |
while (!r.done) { |
| 1482 |
x = r.value; |
| 1483 |
has = false; |
| 1484 |
for (var i = 0; i < arguments.length; i++) { |
| 1485 |
if (arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) { |
| 1486 |
has = true; |
| 1487 |
break; |
| 1488 |
} |
| 1489 |
} |
| 1490 |
if (!has) { |
| 1491 |
s.add(x); |
| 1492 |
} |
| 1493 |
r = iterator.next(); |
| 1494 |
} |
| 1495 |
return ans; |
| 1496 |
}; |
| 1497 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1498 |
__module__ : {value: "__main__"} |
| 1499 |
}); |
| 1500 |
return ρσ_anonfunc; |
| 1501 |
})(); |
| 1502 |
ρσ_set.prototype.difference_update = (function() { |
| 1503 |
var ρσ_anonfunc = function () { |
| 1504 |
var s, remove, iterator, r, x; |
| 1505 |
s = this.jsset; |
| 1506 |
remove = []; |
| 1507 |
iterator = s.values(); |
| 1508 |
r = iterator.next(); |
| 1509 |
while (!r.done) { |
| 1510 |
x = r.value; |
| 1511 |
for (var i = 0; i < arguments.length; i++) { |
| 1512 |
if (arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) { |
| 1513 |
remove.push(x); |
| 1514 |
break; |
| 1515 |
} |
| 1516 |
} |
| 1517 |
r = iterator.next(); |
| 1518 |
} |
| 1519 |
for (var j = 0; j < remove.length; j++) { |
| 1520 |
s.delete(remove[(typeof j === "number" && j < 0) ? remove.length + j : j]); |
| 1521 |
} |
| 1522 |
}; |
| 1523 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1524 |
__module__ : {value: "__main__"} |
| 1525 |
}); |
| 1526 |
return ρσ_anonfunc; |
| 1527 |
})(); |
| 1528 |
ρσ_set.prototype.intersection = (function() { |
| 1529 |
var ρσ_anonfunc = function () { |
| 1530 |
var ans, s, iterator, r, x, has; |
| 1531 |
ans = new ρσ_set; |
| 1532 |
s = ans.jsset; |
| 1533 |
iterator = this.jsset.values(); |
| 1534 |
r = iterator.next(); |
| 1535 |
while (!r.done) { |
| 1536 |
x = r.value; |
| 1537 |
has = true; |
| 1538 |
for (var i = 0; i < arguments.length; i++) { |
| 1539 |
if (!arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) { |
| 1540 |
has = false; |
| 1541 |
break; |
| 1542 |
} |
| 1543 |
} |
| 1544 |
if (has) { |
| 1545 |
s.add(x); |
| 1546 |
} |
| 1547 |
r = iterator.next(); |
| 1548 |
} |
| 1549 |
return ans; |
| 1550 |
}; |
| 1551 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1552 |
__module__ : {value: "__main__"} |
| 1553 |
}); |
| 1554 |
return ρσ_anonfunc; |
| 1555 |
})(); |
| 1556 |
ρσ_set.prototype.intersection_update = (function() { |
| 1557 |
var ρσ_anonfunc = function () { |
| 1558 |
var s, remove, iterator, r, x; |
| 1559 |
s = this.jsset; |
| 1560 |
remove = []; |
| 1561 |
iterator = s.values(); |
| 1562 |
r = iterator.next(); |
| 1563 |
while (!r.done) { |
| 1564 |
x = r.value; |
| 1565 |
for (var i = 0; i < arguments.length; i++) { |
| 1566 |
if (!arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) { |
| 1567 |
remove.push(x); |
| 1568 |
break; |
| 1569 |
} |
| 1570 |
} |
| 1571 |
r = iterator.next(); |
| 1572 |
} |
| 1573 |
for (var j = 0; j < remove.length; j++) { |
| 1574 |
s.delete(remove[(typeof j === "number" && j < 0) ? remove.length + j : j]); |
| 1575 |
} |
| 1576 |
}; |
| 1577 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1578 |
__module__ : {value: "__main__"} |
| 1579 |
}); |
| 1580 |
return ρσ_anonfunc; |
| 1581 |
})(); |
| 1582 |
ρσ_set.prototype.isdisjoint = (function() { |
| 1583 |
var ρσ_anonfunc = function (other) { |
| 1584 |
var iterator, r, x; |
| 1585 |
iterator = this.jsset.values(); |
| 1586 |
r = iterator.next(); |
| 1587 |
while (!r.done) { |
| 1588 |
x = r.value; |
| 1589 |
if (other.has(x)) { |
| 1590 |
return false; |
| 1591 |
} |
| 1592 |
r = iterator.next(); |
| 1593 |
} |
| 1594 |
return true; |
| 1595 |
}; |
| 1596 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1597 |
__argnames__ : {value: ["other"]}, |
| 1598 |
__module__ : {value: "__main__"} |
| 1599 |
}); |
| 1600 |
return ρσ_anonfunc; |
| 1601 |
})(); |
| 1602 |
ρσ_set.prototype.issubset = (function() { |
| 1603 |
var ρσ_anonfunc = function (other) { |
| 1604 |
var iterator, r, x; |
| 1605 |
iterator = this.jsset.values(); |
| 1606 |
r = iterator.next(); |
| 1607 |
while (!r.done) { |
| 1608 |
x = r.value; |
| 1609 |
if (!other.has(x)) { |
| 1610 |
return false; |
| 1611 |
} |
| 1612 |
r = iterator.next(); |
| 1613 |
} |
| 1614 |
return true; |
| 1615 |
}; |
| 1616 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1617 |
__argnames__ : {value: ["other"]}, |
| 1618 |
__module__ : {value: "__main__"} |
| 1619 |
}); |
| 1620 |
return ρσ_anonfunc; |
| 1621 |
})(); |
| 1622 |
ρσ_set.prototype.issuperset = (function() { |
| 1623 |
var ρσ_anonfunc = function (other) { |
| 1624 |
var s, iterator, r, x; |
| 1625 |
s = this.jsset; |
| 1626 |
iterator = other.jsset.values(); |
| 1627 |
r = iterator.next(); |
| 1628 |
while (!r.done) { |
| 1629 |
x = r.value; |
| 1630 |
if (!s.has(x)) { |
| 1631 |
return false; |
| 1632 |
} |
| 1633 |
r = iterator.next(); |
| 1634 |
} |
| 1635 |
return true; |
| 1636 |
}; |
| 1637 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1638 |
__argnames__ : {value: ["other"]}, |
| 1639 |
__module__ : {value: "__main__"} |
| 1640 |
}); |
| 1641 |
return ρσ_anonfunc; |
| 1642 |
})(); |
| 1643 |
ρσ_set.prototype.pop = (function() { |
| 1644 |
var ρσ_anonfunc = function () { |
| 1645 |
var iterator, r; |
| 1646 |
iterator = this.jsset.values(); |
| 1647 |
r = iterator.next(); |
| 1648 |
if (r.done) { |
| 1649 |
throw new KeyError("pop from an empty set"); |
| 1650 |
} |
| 1651 |
this.jsset.delete(r.value); |
| 1652 |
return r.value; |
| 1653 |
}; |
| 1654 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1655 |
__module__ : {value: "__main__"} |
| 1656 |
}); |
| 1657 |
return ρσ_anonfunc; |
| 1658 |
})(); |
| 1659 |
ρσ_set.prototype.remove = (function() { |
| 1660 |
var ρσ_anonfunc = function (x) { |
| 1661 |
if (!this.jsset.delete(x)) { |
| 1662 |
throw new KeyError(x.toString()); |
| 1663 |
} |
| 1664 |
}; |
| 1665 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1666 |
__argnames__ : {value: ["x"]}, |
| 1667 |
__module__ : {value: "__main__"} |
| 1668 |
}); |
| 1669 |
return ρσ_anonfunc; |
| 1670 |
})(); |
| 1671 |
ρσ_set.prototype.symmetric_difference = (function() { |
| 1672 |
var ρσ_anonfunc = function (other) { |
| 1673 |
return this.union(other).difference(this.intersection(other)); |
| 1674 |
}; |
| 1675 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1676 |
__argnames__ : {value: ["other"]}, |
| 1677 |
__module__ : {value: "__main__"} |
| 1678 |
}); |
| 1679 |
return ρσ_anonfunc; |
| 1680 |
})(); |
| 1681 |
ρσ_set.prototype.symmetric_difference_update = (function() { |
| 1682 |
var ρσ_anonfunc = function (other) { |
| 1683 |
var common; |
| 1684 |
common = this.intersection(other); |
| 1685 |
this.update(other); |
| 1686 |
this.difference_update(common); |
| 1687 |
}; |
| 1688 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1689 |
__argnames__ : {value: ["other"]}, |
| 1690 |
__module__ : {value: "__main__"} |
| 1691 |
}); |
| 1692 |
return ρσ_anonfunc; |
| 1693 |
})(); |
| 1694 |
ρσ_set.prototype.union = (function() { |
| 1695 |
var ρσ_anonfunc = function () { |
| 1696 |
var ans; |
| 1697 |
ans = ρσ_set(this); |
| 1698 |
ans.update.apply(ans, arguments); |
| 1699 |
return ans; |
| 1700 |
}; |
| 1701 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1702 |
__module__ : {value: "__main__"} |
| 1703 |
}); |
| 1704 |
return ρσ_anonfunc; |
| 1705 |
})(); |
| 1706 |
ρσ_set.prototype.update = (function() { |
| 1707 |
var ρσ_anonfunc = function () { |
| 1708 |
var s, iterator, r; |
| 1709 |
s = this.jsset; |
| 1710 |
for (var i=0; i < arguments.length; i++) { |
| 1711 |
iterator = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i][ρσ_iterator_symbol](); |
| 1712 |
r = iterator.next(); |
| 1713 |
while (!r.done) { |
| 1714 |
s.add(r.value); |
| 1715 |
r = iterator.next(); |
| 1716 |
} |
| 1717 |
} |
| 1718 |
}; |
| 1719 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1720 |
__module__ : {value: "__main__"} |
| 1721 |
}); |
| 1722 |
return ρσ_anonfunc; |
| 1723 |
})(); |
| 1724 |
ρσ_set.prototype.toString = ρσ_set.prototype.__repr__ = ρσ_set.prototype.__str__ = ρσ_set.prototype.inspect = (function() { |
| 1725 |
var ρσ_anonfunc = function () { |
| 1726 |
return "{" + list(this).join(", ") + "}"; |
| 1727 |
}; |
| 1728 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1729 |
__module__ : {value: "__main__"} |
| 1730 |
}); |
| 1731 |
return ρσ_anonfunc; |
| 1732 |
})(); |
| 1733 |
ρσ_set.prototype.__eq__ = (function() { |
| 1734 |
var ρσ_anonfunc = function (other) { |
| 1735 |
var iterator, r; |
| 1736 |
if (!other instanceof this.constructor) { |
| 1737 |
return false; |
| 1738 |
} |
| 1739 |
if (other.size !== this.size) { |
| 1740 |
return false; |
| 1741 |
} |
| 1742 |
if (other.size === 0) { |
| 1743 |
return true; |
| 1744 |
} |
| 1745 |
iterator = other[ρσ_iterator_symbol](); |
| 1746 |
r = iterator.next(); |
| 1747 |
while (!r.done) { |
| 1748 |
if (!this.has(r.value)) { |
| 1749 |
return false; |
| 1750 |
} |
| 1751 |
r = iterator.next(); |
| 1752 |
} |
| 1753 |
return true; |
| 1754 |
}; |
| 1755 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1756 |
__argnames__ : {value: ["other"]}, |
| 1757 |
__module__ : {value: "__main__"} |
| 1758 |
}); |
| 1759 |
return ρσ_anonfunc; |
| 1760 |
})(); |
| 1761 |
function ρσ_set_wrap(x) { |
| 1762 |
var ans; |
| 1763 |
ans = new ρσ_set; |
| 1764 |
ans.jsset = x; |
| 1765 |
return ans; |
| 1766 |
}; |
| 1767 |
if (!ρσ_set_wrap.__argnames__) Object.defineProperties(ρσ_set_wrap, { |
| 1768 |
__argnames__ : {value: ["x"]}, |
| 1769 |
__module__ : {value: "__main__"} |
| 1770 |
}); |
| 1771 |
|
| 1772 |
var set = ρσ_set, set_wrap = ρσ_set_wrap; |
| 1773 |
var ρσ_dict_implementation; |
| 1774 |
function ρσ_dict_polyfill() { |
| 1775 |
this._store = {}; |
| 1776 |
this.size = 0; |
| 1777 |
}; |
| 1778 |
if (!ρσ_dict_polyfill.__module__) Object.defineProperties(ρσ_dict_polyfill, { |
| 1779 |
__module__ : {value: "__main__"} |
| 1780 |
}); |
| 1781 |
|
| 1782 |
ρσ_dict_polyfill.prototype.set = (function() { |
| 1783 |
var ρσ_anonfunc = function (x, value) { |
| 1784 |
var key; |
| 1785 |
key = ρσ_set_keyfor(x); |
| 1786 |
if (!Object.prototype.hasOwnProperty.call(this._store, key)) { |
| 1787 |
this.size += 1; |
| 1788 |
} |
| 1789 |
(ρσ_expr_temp = this._store)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key] = [x, value]; |
| 1790 |
return this; |
| 1791 |
}; |
| 1792 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1793 |
__argnames__ : {value: ["x", "value"]}, |
| 1794 |
__module__ : {value: "__main__"} |
| 1795 |
}); |
| 1796 |
return ρσ_anonfunc; |
| 1797 |
})(); |
| 1798 |
ρσ_dict_polyfill.prototype.clear = (function() { |
| 1799 |
var ρσ_anonfunc = function (x) { |
| 1800 |
this._store = {}; |
| 1801 |
this.size = 0; |
| 1802 |
}; |
| 1803 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1804 |
__argnames__ : {value: ["x"]}, |
| 1805 |
__module__ : {value: "__main__"} |
| 1806 |
}); |
| 1807 |
return ρσ_anonfunc; |
| 1808 |
})(); |
| 1809 |
ρσ_dict_polyfill.prototype.delete = (function() { |
| 1810 |
var ρσ_anonfunc = function (x) { |
| 1811 |
var key; |
| 1812 |
key = ρσ_set_keyfor(x); |
| 1813 |
if (Object.prototype.hasOwnProperty.call(this._store, key)) { |
| 1814 |
this.size -= 1; |
| 1815 |
delete this._store[key]; |
| 1816 |
return true; |
| 1817 |
} |
| 1818 |
return false; |
| 1819 |
}; |
| 1820 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1821 |
__argnames__ : {value: ["x"]}, |
| 1822 |
__module__ : {value: "__main__"} |
| 1823 |
}); |
| 1824 |
return ρσ_anonfunc; |
| 1825 |
})(); |
| 1826 |
ρσ_dict_polyfill.prototype.has = (function() { |
| 1827 |
var ρσ_anonfunc = function (x) { |
| 1828 |
return Object.prototype.hasOwnProperty.call(this._store, ρσ_set_keyfor(x)); |
| 1829 |
}; |
| 1830 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1831 |
__argnames__ : {value: ["x"]}, |
| 1832 |
__module__ : {value: "__main__"} |
| 1833 |
}); |
| 1834 |
return ρσ_anonfunc; |
| 1835 |
})(); |
| 1836 |
ρσ_dict_polyfill.prototype.get = (function() { |
| 1837 |
var ρσ_anonfunc = function (x) { |
| 1838 |
try { |
| 1839 |
return (ρσ_expr_temp = this._store)[ρσ_bound_index(ρσ_set_keyfor(x), ρσ_expr_temp)][1]; |
| 1840 |
} catch (ρσ_Exception) { |
| 1841 |
ρσ_last_exception = ρσ_Exception; |
| 1842 |
if (ρσ_Exception instanceof TypeError) { |
| 1843 |
return undefined; |
| 1844 |
} else { |
| 1845 |
throw ρσ_Exception; |
| 1846 |
} |
| 1847 |
} |
| 1848 |
}; |
| 1849 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1850 |
__argnames__ : {value: ["x"]}, |
| 1851 |
__module__ : {value: "__main__"} |
| 1852 |
}); |
| 1853 |
return ρσ_anonfunc; |
| 1854 |
})(); |
| 1855 |
ρσ_dict_polyfill.prototype.values = (function() { |
| 1856 |
var ρσ_anonfunc = function (x) { |
| 1857 |
var ans; |
| 1858 |
ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store}; |
| 1859 |
ans[ρσ_iterator_symbol] = (function() { |
| 1860 |
var ρσ_anonfunc = function () { |
| 1861 |
return this; |
| 1862 |
}; |
| 1863 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1864 |
__module__ : {value: "__main__"} |
| 1865 |
}); |
| 1866 |
return ρσ_anonfunc; |
| 1867 |
})(); |
| 1868 |
ans["next"] = (function() { |
| 1869 |
var ρσ_anonfunc = function () { |
| 1870 |
this._i += 1; |
| 1871 |
if (this._i >= this._keys.length) { |
| 1872 |
return {'done': true}; |
| 1873 |
} |
| 1874 |
return {'done':false, 'value':this._s[this._keys[this._i]][1]}; |
| 1875 |
}; |
| 1876 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1877 |
__module__ : {value: "__main__"} |
| 1878 |
}); |
| 1879 |
return ρσ_anonfunc; |
| 1880 |
})(); |
| 1881 |
return ans; |
| 1882 |
}; |
| 1883 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1884 |
__argnames__ : {value: ["x"]}, |
| 1885 |
__module__ : {value: "__main__"} |
| 1886 |
}); |
| 1887 |
return ρσ_anonfunc; |
| 1888 |
})(); |
| 1889 |
ρσ_dict_polyfill.prototype.keys = (function() { |
| 1890 |
var ρσ_anonfunc = function (x) { |
| 1891 |
var ans; |
| 1892 |
ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store}; |
| 1893 |
ans[ρσ_iterator_symbol] = (function() { |
| 1894 |
var ρσ_anonfunc = function () { |
| 1895 |
return this; |
| 1896 |
}; |
| 1897 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1898 |
__module__ : {value: "__main__"} |
| 1899 |
}); |
| 1900 |
return ρσ_anonfunc; |
| 1901 |
})(); |
| 1902 |
ans["next"] = (function() { |
| 1903 |
var ρσ_anonfunc = function () { |
| 1904 |
this._i += 1; |
| 1905 |
if (this._i >= this._keys.length) { |
| 1906 |
return {'done': true}; |
| 1907 |
} |
| 1908 |
return {'done':false, 'value':this._s[this._keys[this._i]][0]}; |
| 1909 |
}; |
| 1910 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1911 |
__module__ : {value: "__main__"} |
| 1912 |
}); |
| 1913 |
return ρσ_anonfunc; |
| 1914 |
})(); |
| 1915 |
return ans; |
| 1916 |
}; |
| 1917 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1918 |
__argnames__ : {value: ["x"]}, |
| 1919 |
__module__ : {value: "__main__"} |
| 1920 |
}); |
| 1921 |
return ρσ_anonfunc; |
| 1922 |
})(); |
| 1923 |
ρσ_dict_polyfill.prototype.entries = (function() { |
| 1924 |
var ρσ_anonfunc = function (x) { |
| 1925 |
var ans; |
| 1926 |
ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store}; |
| 1927 |
ans[ρσ_iterator_symbol] = (function() { |
| 1928 |
var ρσ_anonfunc = function () { |
| 1929 |
return this; |
| 1930 |
}; |
| 1931 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1932 |
__module__ : {value: "__main__"} |
| 1933 |
}); |
| 1934 |
return ρσ_anonfunc; |
| 1935 |
})(); |
| 1936 |
ans["next"] = (function() { |
| 1937 |
var ρσ_anonfunc = function () { |
| 1938 |
this._i += 1; |
| 1939 |
if (this._i >= this._keys.length) { |
| 1940 |
return {'done': true}; |
| 1941 |
} |
| 1942 |
return {'done':false, 'value':this._s[this._keys[this._i]]}; |
| 1943 |
}; |
| 1944 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1945 |
__module__ : {value: "__main__"} |
| 1946 |
}); |
| 1947 |
return ρσ_anonfunc; |
| 1948 |
})(); |
| 1949 |
return ans; |
| 1950 |
}; |
| 1951 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 1952 |
__argnames__ : {value: ["x"]}, |
| 1953 |
__module__ : {value: "__main__"} |
| 1954 |
}); |
| 1955 |
return ρσ_anonfunc; |
| 1956 |
})(); |
| 1957 |
if (typeof Map !== "function" || typeof Map.prototype.delete !== "function") { |
| 1958 |
ρσ_dict_implementation = ρσ_dict_polyfill; |
| 1959 |
} else { |
| 1960 |
ρσ_dict_implementation = Map; |
| 1961 |
} |
| 1962 |
function ρσ_dict() { |
| 1963 |
var iterable = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0]; |
| 1964 |
var kw = arguments[arguments.length-1]; |
| 1965 |
if (kw === null || typeof kw !== "object" || kw [ρσ_kwargs_symbol] !== true) kw = {}; |
| 1966 |
if (this instanceof ρσ_dict) { |
| 1967 |
this.jsmap = new ρσ_dict_implementation; |
| 1968 |
if (iterable !== undefined) { |
| 1969 |
this.update(iterable); |
| 1970 |
} |
| 1971 |
this.update(kw); |
| 1972 |
return this; |
| 1973 |
} else { |
| 1974 |
return ρσ_interpolate_kwargs_constructor.call(Object.create(ρσ_dict.prototype), false, ρσ_dict, [iterable].concat([ρσ_desugar_kwargs(kw)])); |
| 1975 |
} |
| 1976 |
}; |
| 1977 |
if (!ρσ_dict.__handles_kwarg_interpolation__) Object.defineProperties(ρσ_dict, { |
| 1978 |
__handles_kwarg_interpolation__ : {value: true}, |
| 1979 |
__argnames__ : {value: ["iterable"]}, |
| 1980 |
__module__ : {value: "__main__"} |
| 1981 |
}); |
| 1982 |
|
| 1983 |
ρσ_dict.prototype.__name__ = "dict"; |
| 1984 |
Object.defineProperties(ρσ_dict.prototype, (function(){ |
| 1985 |
var ρσ_d = {}; |
| 1986 |
ρσ_d["length"] = (function(){ |
| 1987 |
var ρσ_d = {}; |
| 1988 |
ρσ_d["get"] = (function() { |
| 1989 |
var ρσ_anonfunc = function () { |
| 1990 |
return this.jsmap.size; |
| 1991 |
}; |
| 1992 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 1993 |
__module__ : {value: "__main__"} |
| 1994 |
}); |
| 1995 |
return ρσ_anonfunc; |
| 1996 |
})(); |
| 1997 |
return ρσ_d; |
| 1998 |
}).call(this); |
| 1999 |
ρσ_d["size"] = (function(){ |
| 2000 |
var ρσ_d = {}; |
| 2001 |
ρσ_d["get"] = (function() { |
| 2002 |
var ρσ_anonfunc = function () { |
| 2003 |
return this.jsmap.size; |
| 2004 |
}; |
| 2005 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2006 |
__module__ : {value: "__main__"} |
| 2007 |
}); |
| 2008 |
return ρσ_anonfunc; |
| 2009 |
})(); |
| 2010 |
return ρσ_d; |
| 2011 |
}).call(this); |
| 2012 |
return ρσ_d; |
| 2013 |
}).call(this)); |
| 2014 |
ρσ_dict.prototype.__len__ = (function() { |
| 2015 |
var ρσ_anonfunc = function () { |
| 2016 |
return this.jsmap.size; |
| 2017 |
}; |
| 2018 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2019 |
__module__ : {value: "__main__"} |
| 2020 |
}); |
| 2021 |
return ρσ_anonfunc; |
| 2022 |
})(); |
| 2023 |
ρσ_dict.prototype.has = ρσ_dict.prototype.__contains__ = (function() { |
| 2024 |
var ρσ_anonfunc = function (x) { |
| 2025 |
return this.jsmap.has(x); |
| 2026 |
}; |
| 2027 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2028 |
__argnames__ : {value: ["x"]}, |
| 2029 |
__module__ : {value: "__main__"} |
| 2030 |
}); |
| 2031 |
return ρσ_anonfunc; |
| 2032 |
})(); |
| 2033 |
ρσ_dict.prototype.set = ρσ_dict.prototype.__setitem__ = (function() { |
| 2034 |
var ρσ_anonfunc = function (key, value) { |
| 2035 |
this.jsmap.set(key, value); |
| 2036 |
}; |
| 2037 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2038 |
__argnames__ : {value: ["key", "value"]}, |
| 2039 |
__module__ : {value: "__main__"} |
| 2040 |
}); |
| 2041 |
return ρσ_anonfunc; |
| 2042 |
})(); |
| 2043 |
ρσ_dict.prototype.__delitem__ = (function() { |
| 2044 |
var ρσ_anonfunc = function (key) { |
| 2045 |
this.jsmap.delete(key); |
| 2046 |
}; |
| 2047 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2048 |
__argnames__ : {value: ["key"]}, |
| 2049 |
__module__ : {value: "__main__"} |
| 2050 |
}); |
| 2051 |
return ρσ_anonfunc; |
| 2052 |
})(); |
| 2053 |
ρσ_dict.prototype.clear = (function() { |
| 2054 |
var ρσ_anonfunc = function () { |
| 2055 |
this.jsmap.clear(); |
| 2056 |
}; |
| 2057 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2058 |
__module__ : {value: "__main__"} |
| 2059 |
}); |
| 2060 |
return ρσ_anonfunc; |
| 2061 |
})(); |
| 2062 |
ρσ_dict.prototype.copy = (function() { |
| 2063 |
var ρσ_anonfunc = function () { |
| 2064 |
return ρσ_dict(this); |
| 2065 |
}; |
| 2066 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2067 |
__module__ : {value: "__main__"} |
| 2068 |
}); |
| 2069 |
return ρσ_anonfunc; |
| 2070 |
})(); |
| 2071 |
ρσ_dict.prototype.keys = (function() { |
| 2072 |
var ρσ_anonfunc = function () { |
| 2073 |
return this.jsmap.keys(); |
| 2074 |
}; |
| 2075 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2076 |
__module__ : {value: "__main__"} |
| 2077 |
}); |
| 2078 |
return ρσ_anonfunc; |
| 2079 |
})(); |
| 2080 |
ρσ_dict.prototype.values = (function() { |
| 2081 |
var ρσ_anonfunc = function () { |
| 2082 |
return this.jsmap.values(); |
| 2083 |
}; |
| 2084 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2085 |
__module__ : {value: "__main__"} |
| 2086 |
}); |
| 2087 |
return ρσ_anonfunc; |
| 2088 |
})(); |
| 2089 |
ρσ_dict.prototype.items = ρσ_dict.prototype.entries = (function() { |
| 2090 |
var ρσ_anonfunc = function () { |
| 2091 |
return this.jsmap.entries(); |
| 2092 |
}; |
| 2093 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2094 |
__module__ : {value: "__main__"} |
| 2095 |
}); |
| 2096 |
return ρσ_anonfunc; |
| 2097 |
})(); |
| 2098 |
ρσ_dict.prototype[ρσ_iterator_symbol] = (function() { |
| 2099 |
var ρσ_anonfunc = function () { |
| 2100 |
return this.jsmap.keys(); |
| 2101 |
}; |
| 2102 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2103 |
__module__ : {value: "__main__"} |
| 2104 |
}); |
| 2105 |
return ρσ_anonfunc; |
| 2106 |
})(); |
| 2107 |
ρσ_dict.prototype.__getitem__ = (function() { |
| 2108 |
var ρσ_anonfunc = function (key) { |
| 2109 |
var ans; |
| 2110 |
ans = this.jsmap.get(key); |
| 2111 |
if (ans === undefined && !this.jsmap.has(key)) { |
| 2112 |
throw new KeyError(key + ""); |
| 2113 |
} |
| 2114 |
return ans; |
| 2115 |
}; |
| 2116 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2117 |
__argnames__ : {value: ["key"]}, |
| 2118 |
__module__ : {value: "__main__"} |
| 2119 |
}); |
| 2120 |
return ρσ_anonfunc; |
| 2121 |
})(); |
| 2122 |
ρσ_dict.prototype.get = (function() { |
| 2123 |
var ρσ_anonfunc = function (key, defval) { |
| 2124 |
var ans; |
| 2125 |
ans = this.jsmap.get(key); |
| 2126 |
if (ans === undefined && !this.jsmap.has(key)) { |
| 2127 |
return (defval === undefined) ? null : defval; |
| 2128 |
} |
| 2129 |
return ans; |
| 2130 |
}; |
| 2131 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2132 |
__argnames__ : {value: ["key", "defval"]}, |
| 2133 |
__module__ : {value: "__main__"} |
| 2134 |
}); |
| 2135 |
return ρσ_anonfunc; |
| 2136 |
})(); |
| 2137 |
ρσ_dict.prototype.set_default = ρσ_dict.prototype.setdefault = (function() { |
| 2138 |
var ρσ_anonfunc = function (key, defval) { |
| 2139 |
var j; |
| 2140 |
j = this.jsmap; |
| 2141 |
if (!j.has(key)) { |
| 2142 |
j.set(key, defval); |
| 2143 |
return defval; |
| 2144 |
} |
| 2145 |
return j.get(key); |
| 2146 |
}; |
| 2147 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2148 |
__argnames__ : {value: ["key", "defval"]}, |
| 2149 |
__module__ : {value: "__main__"} |
| 2150 |
}); |
| 2151 |
return ρσ_anonfunc; |
| 2152 |
})(); |
| 2153 |
ρσ_dict.fromkeys = ρσ_dict.prototype.fromkeys = (function() { |
| 2154 |
var ρσ_anonfunc = function () { |
| 2155 |
var iterable = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0]; |
| 2156 |
var value = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_anonfunc.__defaults__.value : arguments[1]; |
| 2157 |
var ρσ_kwargs_obj = arguments[arguments.length-1]; |
| 2158 |
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {}; |
| 2159 |
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "value")){ |
| 2160 |
value = ρσ_kwargs_obj.value; |
| 2161 |
} |
| 2162 |
var ans, iterator, r; |
| 2163 |
ans = ρσ_dict(); |
| 2164 |
iterator = iter(iterable); |
| 2165 |
r = iterator.next(); |
| 2166 |
while (!r.done) { |
| 2167 |
ans.set(r.value, value); |
| 2168 |
r = iterator.next(); |
| 2169 |
} |
| 2170 |
return ans; |
| 2171 |
}; |
| 2172 |
if (!ρσ_anonfunc.__defaults__) Object.defineProperties(ρσ_anonfunc, { |
| 2173 |
__defaults__ : {value: {value:null}}, |
| 2174 |
__handles_kwarg_interpolation__ : {value: true}, |
| 2175 |
__argnames__ : {value: ["iterable", "value"]}, |
| 2176 |
__module__ : {value: "__main__"} |
| 2177 |
}); |
| 2178 |
return ρσ_anonfunc; |
| 2179 |
})(); |
| 2180 |
ρσ_dict.prototype.pop = (function() { |
| 2181 |
var ρσ_anonfunc = function (key, defval) { |
| 2182 |
var ans; |
| 2183 |
ans = this.jsmap.get(key); |
| 2184 |
if (ans === undefined && !this.jsmap.has(key)) { |
| 2185 |
if (defval === undefined) { |
| 2186 |
throw new KeyError(key); |
| 2187 |
} |
| 2188 |
return defval; |
| 2189 |
} |
| 2190 |
this.jsmap.delete(key); |
| 2191 |
return ans; |
| 2192 |
}; |
| 2193 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2194 |
__argnames__ : {value: ["key", "defval"]}, |
| 2195 |
__module__ : {value: "__main__"} |
| 2196 |
}); |
| 2197 |
return ρσ_anonfunc; |
| 2198 |
})(); |
| 2199 |
ρσ_dict.prototype.popitem = (function() { |
| 2200 |
var ρσ_anonfunc = function () { |
| 2201 |
var last, e, r; |
| 2202 |
last = null; |
| 2203 |
e = this.jsmap.entries(); |
| 2204 |
while (true) { |
| 2205 |
r = e.next(); |
| 2206 |
if (r.done) { |
| 2207 |
if (last === null) { |
| 2208 |
throw new KeyError("dict is empty"); |
| 2209 |
} |
| 2210 |
this.jsmap.delete(last.value[0]); |
| 2211 |
return last.value; |
| 2212 |
} |
| 2213 |
last = r; |
| 2214 |
} |
| 2215 |
}; |
| 2216 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2217 |
__module__ : {value: "__main__"} |
| 2218 |
}); |
| 2219 |
return ρσ_anonfunc; |
| 2220 |
})(); |
| 2221 |
ρσ_dict.prototype.update = (function() { |
| 2222 |
var ρσ_anonfunc = function () { |
| 2223 |
var m, iterable, iterator, result, keys; |
| 2224 |
if (arguments.length === 0) { |
| 2225 |
return; |
| 2226 |
} |
| 2227 |
m = this.jsmap; |
| 2228 |
iterable = arguments[0]; |
| 2229 |
if (Array.isArray(iterable)) { |
| 2230 |
for (var i = 0; i < iterable.length; i++) { |
| 2231 |
m.set(iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i][0], iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i][1]); |
| 2232 |
} |
| 2233 |
} else if (iterable instanceof ρσ_dict) { |
| 2234 |
iterator = iterable.items(); |
| 2235 |
result = iterator.next(); |
| 2236 |
while (!result.done) { |
| 2237 |
m.set(result.value[0], result.value[1]); |
| 2238 |
result = iterator.next(); |
| 2239 |
} |
| 2240 |
} else if (typeof Map === "function" && iterable instanceof Map) { |
| 2241 |
iterator = iterable.entries(); |
| 2242 |
result = iterator.next(); |
| 2243 |
while (!result.done) { |
| 2244 |
m.set(result.value[0], result.value[1]); |
| 2245 |
result = iterator.next(); |
| 2246 |
} |
| 2247 |
} else if (typeof iterable[ρσ_iterator_symbol] === "function") { |
| 2248 |
iterator = iterable[ρσ_iterator_symbol](); |
| 2249 |
result = iterator.next(); |
| 2250 |
while (!result.done) { |
| 2251 |
m.set(result.value[0], result.value[1]); |
| 2252 |
result = iterator.next(); |
| 2253 |
} |
| 2254 |
} else { |
| 2255 |
keys = Object.keys(iterable); |
| 2256 |
for (var j=0; j < keys.length; j++) { |
| 2257 |
if (keys[(typeof j === "number" && j < 0) ? keys.length + j : j] !== ρσ_iterator_symbol) { |
| 2258 |
m.set(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], iterable[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], iterable)]); |
| 2259 |
} |
| 2260 |
} |
| 2261 |
} |
| 2262 |
if (arguments.length > 1) { |
| 2263 |
ρσ_dict.prototype.update.call(this, arguments[1]); |
| 2264 |
} |
| 2265 |
}; |
| 2266 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2267 |
__module__ : {value: "__main__"} |
| 2268 |
}); |
| 2269 |
return ρσ_anonfunc; |
| 2270 |
})(); |
| 2271 |
ρσ_dict.prototype.toString = ρσ_dict.prototype.inspect = ρσ_dict.prototype.__str__ = ρσ_dict.prototype.__repr__ = (function() { |
| 2272 |
var ρσ_anonfunc = function () { |
| 2273 |
var entries, iterator, r; |
| 2274 |
entries = []; |
| 2275 |
iterator = this.jsmap.entries(); |
| 2276 |
r = iterator.next(); |
| 2277 |
while (!r.done) { |
| 2278 |
entries.push(ρσ_repr(r.value[0]) + ": " + ρσ_repr(r.value[1])); |
| 2279 |
r = iterator.next(); |
| 2280 |
} |
| 2281 |
return "{" + entries.join(", ") + "}"; |
| 2282 |
}; |
| 2283 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2284 |
__module__ : {value: "__main__"} |
| 2285 |
}); |
| 2286 |
return ρσ_anonfunc; |
| 2287 |
})(); |
| 2288 |
ρσ_dict.prototype.__eq__ = (function() { |
| 2289 |
var ρσ_anonfunc = function (other) { |
| 2290 |
var iterator, r, x; |
| 2291 |
if (!(other instanceof this.constructor)) { |
| 2292 |
return false; |
| 2293 |
} |
| 2294 |
if (other.size !== this.size) { |
| 2295 |
return false; |
| 2296 |
} |
| 2297 |
if (other.size === 0) { |
| 2298 |
return true; |
| 2299 |
} |
| 2300 |
iterator = other.items(); |
| 2301 |
r = iterator.next(); |
| 2302 |
while (!r.done) { |
| 2303 |
x = this.jsmap.get(r.value[0]); |
| 2304 |
if (x === undefined && !this.jsmap.has(r.value[0]) || x !== r.value[1]) { |
| 2305 |
return false; |
| 2306 |
} |
| 2307 |
r = iterator.next(); |
| 2308 |
} |
| 2309 |
return true; |
| 2310 |
}; |
| 2311 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2312 |
__argnames__ : {value: ["other"]}, |
| 2313 |
__module__ : {value: "__main__"} |
| 2314 |
}); |
| 2315 |
return ρσ_anonfunc; |
| 2316 |
})(); |
| 2317 |
ρσ_dict.prototype.as_object = (function() { |
| 2318 |
var ρσ_anonfunc = function (other) { |
| 2319 |
var ans, iterator, r; |
| 2320 |
ans = {}; |
| 2321 |
iterator = this.jsmap.entries(); |
| 2322 |
r = iterator.next(); |
| 2323 |
while (!r.done) { |
| 2324 |
ans[ρσ_bound_index(r.value[0], ans)] = r.value[1]; |
| 2325 |
r = iterator.next(); |
| 2326 |
} |
| 2327 |
return ans; |
| 2328 |
}; |
| 2329 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2330 |
__argnames__ : {value: ["other"]}, |
| 2331 |
__module__ : {value: "__main__"} |
| 2332 |
}); |
| 2333 |
return ρσ_anonfunc; |
| 2334 |
})(); |
| 2335 |
function ρσ_dict_wrap(x) { |
| 2336 |
var ans; |
| 2337 |
ans = new ρσ_dict; |
| 2338 |
ans.jsmap = x; |
| 2339 |
return ans; |
| 2340 |
}; |
| 2341 |
if (!ρσ_dict_wrap.__argnames__) Object.defineProperties(ρσ_dict_wrap, { |
| 2342 |
__argnames__ : {value: ["x"]}, |
| 2343 |
__module__ : {value: "__main__"} |
| 2344 |
}); |
| 2345 |
|
| 2346 |
var dict = ρσ_dict, dict_wrap = ρσ_dict_wrap;// }}} |
| 2347 |
var NameError; |
| 2348 |
NameError = ReferenceError; |
| 2349 |
function Exception() { |
| 2350 |
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter}); |
| 2351 |
Exception.prototype.__init__.apply(this, arguments); |
| 2352 |
} |
| 2353 |
ρσ_extends(Exception, Error); |
| 2354 |
Exception.prototype.__init__ = function __init__(message) { |
| 2355 |
var self = this; |
| 2356 |
self.message = message; |
| 2357 |
self.stack = (new Error).stack; |
| 2358 |
self.name = self.constructor.name; |
| 2359 |
}; |
| 2360 |
if (!Exception.prototype.__init__.__argnames__) Object.defineProperties(Exception.prototype.__init__, { |
| 2361 |
__argnames__ : {value: ["message"]}, |
| 2362 |
__module__ : {value: "__main__"} |
| 2363 |
}); |
| 2364 |
Exception.__argnames__ = Exception.prototype.__init__.__argnames__; |
| 2365 |
Exception.__handles_kwarg_interpolation__ = Exception.prototype.__init__.__handles_kwarg_interpolation__; |
| 2366 |
Exception.prototype.__repr__ = function __repr__() { |
| 2367 |
var self = this; |
| 2368 |
return self.name + ": " + self.message; |
| 2369 |
}; |
| 2370 |
if (!Exception.prototype.__repr__.__module__) Object.defineProperties(Exception.prototype.__repr__, { |
| 2371 |
__module__ : {value: "__main__"} |
| 2372 |
}); |
| 2373 |
Exception.prototype.__str__ = function __str__ () { |
| 2374 |
if(Error.prototype.__str__) return Error.prototype.__str__.call(this); |
| 2375 |
return this.__repr__(); |
| 2376 |
}; |
| 2377 |
Object.defineProperty(Exception.prototype, "__bases__", {value: [Error]}); |
| 2378 |
|
| 2379 |
function AttributeError() { |
| 2380 |
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter}); |
| 2381 |
AttributeError.prototype.__init__.apply(this, arguments); |
| 2382 |
} |
| 2383 |
ρσ_extends(AttributeError, Exception); |
| 2384 |
AttributeError.prototype.__init__ = function __init__ () { |
| 2385 |
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments); |
| 2386 |
}; |
| 2387 |
AttributeError.prototype.__repr__ = function __repr__ () { |
| 2388 |
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this); |
| 2389 |
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">"; |
| 2390 |
}; |
| 2391 |
AttributeError.prototype.__str__ = function __str__ () { |
| 2392 |
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this); |
| 2393 |
return this.__repr__(); |
| 2394 |
}; |
| 2395 |
Object.defineProperty(AttributeError.prototype, "__bases__", {value: [Exception]}); |
| 2396 |
|
| 2397 |
|
| 2398 |
function IndexError() { |
| 2399 |
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter}); |
| 2400 |
IndexError.prototype.__init__.apply(this, arguments); |
| 2401 |
} |
| 2402 |
ρσ_extends(IndexError, Exception); |
| 2403 |
IndexError.prototype.__init__ = function __init__ () { |
| 2404 |
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments); |
| 2405 |
}; |
| 2406 |
IndexError.prototype.__repr__ = function __repr__ () { |
| 2407 |
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this); |
| 2408 |
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">"; |
| 2409 |
}; |
| 2410 |
IndexError.prototype.__str__ = function __str__ () { |
| 2411 |
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this); |
| 2412 |
return this.__repr__(); |
| 2413 |
}; |
| 2414 |
Object.defineProperty(IndexError.prototype, "__bases__", {value: [Exception]}); |
| 2415 |
|
| 2416 |
|
| 2417 |
function KeyError() { |
| 2418 |
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter}); |
| 2419 |
KeyError.prototype.__init__.apply(this, arguments); |
| 2420 |
} |
| 2421 |
ρσ_extends(KeyError, Exception); |
| 2422 |
KeyError.prototype.__init__ = function __init__ () { |
| 2423 |
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments); |
| 2424 |
}; |
| 2425 |
KeyError.prototype.__repr__ = function __repr__ () { |
| 2426 |
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this); |
| 2427 |
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">"; |
| 2428 |
}; |
| 2429 |
KeyError.prototype.__str__ = function __str__ () { |
| 2430 |
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this); |
| 2431 |
return this.__repr__(); |
| 2432 |
}; |
| 2433 |
Object.defineProperty(KeyError.prototype, "__bases__", {value: [Exception]}); |
| 2434 |
|
| 2435 |
|
| 2436 |
function ValueError() { |
| 2437 |
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter}); |
| 2438 |
ValueError.prototype.__init__.apply(this, arguments); |
| 2439 |
} |
| 2440 |
ρσ_extends(ValueError, Exception); |
| 2441 |
ValueError.prototype.__init__ = function __init__ () { |
| 2442 |
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments); |
| 2443 |
}; |
| 2444 |
ValueError.prototype.__repr__ = function __repr__ () { |
| 2445 |
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this); |
| 2446 |
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">"; |
| 2447 |
}; |
| 2448 |
ValueError.prototype.__str__ = function __str__ () { |
| 2449 |
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this); |
| 2450 |
return this.__repr__(); |
| 2451 |
}; |
| 2452 |
Object.defineProperty(ValueError.prototype, "__bases__", {value: [Exception]}); |
| 2453 |
|
| 2454 |
|
| 2455 |
function UnicodeDecodeError() { |
| 2456 |
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter}); |
| 2457 |
UnicodeDecodeError.prototype.__init__.apply(this, arguments); |
| 2458 |
} |
| 2459 |
ρσ_extends(UnicodeDecodeError, Exception); |
| 2460 |
UnicodeDecodeError.prototype.__init__ = function __init__ () { |
| 2461 |
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments); |
| 2462 |
}; |
| 2463 |
UnicodeDecodeError.prototype.__repr__ = function __repr__ () { |
| 2464 |
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this); |
| 2465 |
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">"; |
| 2466 |
}; |
| 2467 |
UnicodeDecodeError.prototype.__str__ = function __str__ () { |
| 2468 |
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this); |
| 2469 |
return this.__repr__(); |
| 2470 |
}; |
| 2471 |
Object.defineProperty(UnicodeDecodeError.prototype, "__bases__", {value: [Exception]}); |
| 2472 |
|
| 2473 |
|
| 2474 |
function AssertionError() { |
| 2475 |
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter}); |
| 2476 |
AssertionError.prototype.__init__.apply(this, arguments); |
| 2477 |
} |
| 2478 |
ρσ_extends(AssertionError, Exception); |
| 2479 |
AssertionError.prototype.__init__ = function __init__ () { |
| 2480 |
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments); |
| 2481 |
}; |
| 2482 |
AssertionError.prototype.__repr__ = function __repr__ () { |
| 2483 |
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this); |
| 2484 |
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">"; |
| 2485 |
}; |
| 2486 |
AssertionError.prototype.__str__ = function __str__ () { |
| 2487 |
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this); |
| 2488 |
return this.__repr__(); |
| 2489 |
}; |
| 2490 |
Object.defineProperty(AssertionError.prototype, "__bases__", {value: [Exception]}); |
| 2491 |
|
| 2492 |
|
| 2493 |
function ZeroDivisionError() { |
| 2494 |
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter}); |
| 2495 |
ZeroDivisionError.prototype.__init__.apply(this, arguments); |
| 2496 |
} |
| 2497 |
ρσ_extends(ZeroDivisionError, Exception); |
| 2498 |
ZeroDivisionError.prototype.__init__ = function __init__ () { |
| 2499 |
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments); |
| 2500 |
}; |
| 2501 |
ZeroDivisionError.prototype.__repr__ = function __repr__ () { |
| 2502 |
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this); |
| 2503 |
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">"; |
| 2504 |
}; |
| 2505 |
ZeroDivisionError.prototype.__str__ = function __str__ () { |
| 2506 |
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this); |
| 2507 |
return this.__repr__(); |
| 2508 |
}; |
| 2509 |
Object.defineProperty(ZeroDivisionError.prototype, "__bases__", {value: [Exception]}); |
| 2510 |
|
| 2511 |
var ρσ_in, ρσ_desugar_kwargs, ρσ_exists; |
| 2512 |
function ρσ_eslice(arr, step, start, end) { |
| 2513 |
var is_string; |
| 2514 |
if (typeof arr === "string" || arr instanceof String) { |
| 2515 |
is_string = true; |
| 2516 |
arr = arr.split(""); |
| 2517 |
} |
| 2518 |
if (step < 0) { |
| 2519 |
step = -step; |
| 2520 |
arr = arr.slice().reverse(); |
| 2521 |
if (typeof start !== "undefined") { |
| 2522 |
start = arr.length - start - 1; |
| 2523 |
} |
| 2524 |
if (typeof end !== "undefined") { |
| 2525 |
end = arr.length - end - 1; |
| 2526 |
} |
| 2527 |
} |
| 2528 |
if (typeof start === "undefined") { |
| 2529 |
start = 0; |
| 2530 |
} |
| 2531 |
if (typeof end === "undefined") { |
| 2532 |
end = arr.length; |
| 2533 |
} |
| 2534 |
arr = arr.slice(start, end).filter((function() { |
| 2535 |
var ρσ_anonfunc = function (e, i) { |
| 2536 |
return i % step === 0; |
| 2537 |
}; |
| 2538 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2539 |
__argnames__ : {value: ["e", "i"]}, |
| 2540 |
__module__ : {value: "__main__"} |
| 2541 |
}); |
| 2542 |
return ρσ_anonfunc; |
| 2543 |
})()); |
| 2544 |
if (is_string) { |
| 2545 |
arr = arr.join(""); |
| 2546 |
} |
| 2547 |
return arr; |
| 2548 |
}; |
| 2549 |
if (!ρσ_eslice.__argnames__) Object.defineProperties(ρσ_eslice, { |
| 2550 |
__argnames__ : {value: ["arr", "step", "start", "end"]}, |
| 2551 |
__module__ : {value: "__main__"} |
| 2552 |
}); |
| 2553 |
|
| 2554 |
function ρσ_delslice(arr, step, start, end) { |
| 2555 |
var is_string, ρσ_unpack, indices; |
| 2556 |
if (typeof arr === "string" || arr instanceof String) { |
| 2557 |
is_string = true; |
| 2558 |
arr = arr.split(""); |
| 2559 |
} |
| 2560 |
if (step < 0) { |
| 2561 |
if (typeof start === "undefined") { |
| 2562 |
start = arr.length; |
| 2563 |
} |
| 2564 |
if (typeof end === "undefined") { |
| 2565 |
end = 0; |
| 2566 |
} |
| 2567 |
ρσ_unpack = [end, start, -step]; |
| 2568 |
start = ρσ_unpack[0]; |
| 2569 |
end = ρσ_unpack[1]; |
| 2570 |
step = ρσ_unpack[2]; |
| 2571 |
} |
| 2572 |
if (typeof start === "undefined") { |
| 2573 |
start = 0; |
| 2574 |
} |
| 2575 |
if (typeof end === "undefined") { |
| 2576 |
end = arr.length; |
| 2577 |
} |
| 2578 |
if (step === 1) { |
| 2579 |
arr.splice(start, end - start); |
| 2580 |
} else { |
| 2581 |
if (end > start) { |
| 2582 |
indices = []; |
| 2583 |
for (var i = start; i < end; i += step) { |
| 2584 |
indices.push(i); |
| 2585 |
} |
| 2586 |
for (var i = indices.length - 1; i >= 0; i--) { |
| 2587 |
arr.splice(indices[(typeof i === "number" && i < 0) ? indices.length + i : i], 1); |
| 2588 |
} |
| 2589 |
} |
| 2590 |
} |
| 2591 |
if (is_string) { |
| 2592 |
arr = arr.join(""); |
| 2593 |
} |
| 2594 |
return arr; |
| 2595 |
}; |
| 2596 |
if (!ρσ_delslice.__argnames__) Object.defineProperties(ρσ_delslice, { |
| 2597 |
__argnames__ : {value: ["arr", "step", "start", "end"]}, |
| 2598 |
__module__ : {value: "__main__"} |
| 2599 |
}); |
| 2600 |
|
| 2601 |
function ρσ_flatten(arr) { |
| 2602 |
var ans, value; |
| 2603 |
ans = []; |
| 2604 |
for (var i=0; i < arr.length; i++) { |
| 2605 |
value = arr[(typeof i === "number" && i < 0) ? arr.length + i : i]; |
| 2606 |
if (Array.isArray(value)) { |
| 2607 |
ans = ans.concat(ρσ_flatten(value)); |
| 2608 |
} else { |
| 2609 |
ans.push(value); |
| 2610 |
} |
| 2611 |
} |
| 2612 |
return ans; |
| 2613 |
}; |
| 2614 |
if (!ρσ_flatten.__argnames__) Object.defineProperties(ρσ_flatten, { |
| 2615 |
__argnames__ : {value: ["arr"]}, |
| 2616 |
__module__ : {value: "__main__"} |
| 2617 |
}); |
| 2618 |
|
| 2619 |
function ρσ_unpack_asarray(num, iterable) { |
| 2620 |
var ans, iterator, result; |
| 2621 |
if (ρσ_arraylike(iterable)) { |
| 2622 |
return iterable; |
| 2623 |
} |
| 2624 |
ans = []; |
| 2625 |
if (typeof iterable[ρσ_iterator_symbol] === "function") { |
| 2626 |
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol](); |
| 2627 |
result = iterator.next(); |
| 2628 |
while (!result.done && ans.length < num) { |
| 2629 |
ans.push(result.value); |
| 2630 |
result = iterator.next(); |
| 2631 |
} |
| 2632 |
} |
| 2633 |
return ans; |
| 2634 |
}; |
| 2635 |
if (!ρσ_unpack_asarray.__argnames__) Object.defineProperties(ρσ_unpack_asarray, { |
| 2636 |
__argnames__ : {value: ["num", "iterable"]}, |
| 2637 |
__module__ : {value: "__main__"} |
| 2638 |
}); |
| 2639 |
|
| 2640 |
function ρσ_extends(child, parent) { |
| 2641 |
child.prototype = Object.create(parent.prototype); |
| 2642 |
child.prototype.constructor = child; |
| 2643 |
}; |
| 2644 |
if (!ρσ_extends.__argnames__) Object.defineProperties(ρσ_extends, { |
| 2645 |
__argnames__ : {value: ["child", "parent"]}, |
| 2646 |
__module__ : {value: "__main__"} |
| 2647 |
}); |
| 2648 |
|
| 2649 |
ρσ_in = (function() { |
| 2650 |
var ρσ_anonfunc = function () { |
| 2651 |
if (typeof Map === "function" && typeof Set === "function") { |
| 2652 |
return (function() { |
| 2653 |
var ρσ_anonfunc = function (val, arr) { |
| 2654 |
if (typeof arr === "string") { |
| 2655 |
return arr.indexOf(val) !== -1; |
| 2656 |
} |
| 2657 |
if (typeof arr.__contains__ === "function") { |
| 2658 |
return arr.__contains__(val); |
| 2659 |
} |
| 2660 |
if (arr instanceof Map || arr instanceof Set) { |
| 2661 |
return arr.has(val); |
| 2662 |
} |
| 2663 |
if (ρσ_arraylike(arr)) { |
| 2664 |
return Array.prototype.__contains__.call(arr, val); |
| 2665 |
} |
| 2666 |
return Object.prototype.hasOwnProperty.call(arr, val); |
| 2667 |
}; |
| 2668 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2669 |
__argnames__ : {value: ["val", "arr"]}, |
| 2670 |
__module__ : {value: "__main__"} |
| 2671 |
}); |
| 2672 |
return ρσ_anonfunc; |
| 2673 |
})(); |
| 2674 |
} |
| 2675 |
return (function() { |
| 2676 |
var ρσ_anonfunc = function (val, arr) { |
| 2677 |
if (typeof arr === "string") { |
| 2678 |
return arr.indexOf(val) !== -1; |
| 2679 |
} |
| 2680 |
if (typeof arr.__contains__ === "function") { |
| 2681 |
return arr.__contains__(val); |
| 2682 |
} |
| 2683 |
if (ρσ_arraylike(arr)) { |
| 2684 |
return Array.prototype.__contains__.call(arr, val); |
| 2685 |
} |
| 2686 |
return Object.prototype.hasOwnProperty.call(arr, val); |
| 2687 |
}; |
| 2688 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2689 |
__argnames__ : {value: ["val", "arr"]}, |
| 2690 |
__module__ : {value: "__main__"} |
| 2691 |
}); |
| 2692 |
return ρσ_anonfunc; |
| 2693 |
})(); |
| 2694 |
}; |
| 2695 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2696 |
__module__ : {value: "__main__"} |
| 2697 |
}); |
| 2698 |
return ρσ_anonfunc; |
| 2699 |
})()(); |
| 2700 |
function ρσ_Iterable(iterable) { |
| 2701 |
var iterator, ans, result; |
| 2702 |
if (ρσ_arraylike(iterable)) { |
| 2703 |
return iterable; |
| 2704 |
} |
| 2705 |
if (typeof iterable[ρσ_iterator_symbol] === "function") { |
| 2706 |
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol](); |
| 2707 |
ans = []; |
| 2708 |
result = iterator.next(); |
| 2709 |
while (!result.done) { |
| 2710 |
ans.push(result.value); |
| 2711 |
result = iterator.next(); |
| 2712 |
} |
| 2713 |
return ans; |
| 2714 |
} |
| 2715 |
return Object.keys(iterable); |
| 2716 |
}; |
| 2717 |
if (!ρσ_Iterable.__argnames__) Object.defineProperties(ρσ_Iterable, { |
| 2718 |
__argnames__ : {value: ["iterable"]}, |
| 2719 |
__module__ : {value: "__main__"} |
| 2720 |
}); |
| 2721 |
|
| 2722 |
ρσ_desugar_kwargs = (function() { |
| 2723 |
var ρσ_anonfunc = function () { |
| 2724 |
if (typeof Object.assign === "function") { |
| 2725 |
return (function() { |
| 2726 |
var ρσ_anonfunc = function () { |
| 2727 |
var ans; |
| 2728 |
ans = Object.create(null); |
| 2729 |
ans[ρσ_kwargs_symbol] = true; |
| 2730 |
for (var i = 0; i < arguments.length; i++) { |
| 2731 |
Object.assign(ans, arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]); |
| 2732 |
} |
| 2733 |
return ans; |
| 2734 |
}; |
| 2735 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2736 |
__module__ : {value: "__main__"} |
| 2737 |
}); |
| 2738 |
return ρσ_anonfunc; |
| 2739 |
})(); |
| 2740 |
} |
| 2741 |
return (function() { |
| 2742 |
var ρσ_anonfunc = function () { |
| 2743 |
var ans, keys; |
| 2744 |
ans = Object.create(null); |
| 2745 |
ans[ρσ_kwargs_symbol] = true; |
| 2746 |
for (var i = 0; i < arguments.length; i++) { |
| 2747 |
keys = Object.keys(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]); |
| 2748 |
for (var j = 0; j < keys.length; j++) { |
| 2749 |
ans[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], ans)] = (ρσ_expr_temp = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i])[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], ρσ_expr_temp)]; |
| 2750 |
} |
| 2751 |
} |
| 2752 |
return ans; |
| 2753 |
}; |
| 2754 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2755 |
__module__ : {value: "__main__"} |
| 2756 |
}); |
| 2757 |
return ρσ_anonfunc; |
| 2758 |
})(); |
| 2759 |
}; |
| 2760 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2761 |
__module__ : {value: "__main__"} |
| 2762 |
}); |
| 2763 |
return ρσ_anonfunc; |
| 2764 |
})()(); |
| 2765 |
function ρσ_interpolate_kwargs(f, supplied_args) { |
| 2766 |
var has_prop, kwobj, args, prop; |
| 2767 |
if (!f.__argnames__) { |
| 2768 |
return f.apply(this, supplied_args); |
| 2769 |
} |
| 2770 |
has_prop = Object.prototype.hasOwnProperty; |
| 2771 |
kwobj = supplied_args.pop(); |
| 2772 |
if (f.__handles_kwarg_interpolation__) { |
| 2773 |
args = new Array(Math.max(supplied_args.length, f.__argnames__.length) + 1); |
| 2774 |
args[args.length-1] = kwobj; |
| 2775 |
for (var i = 0; i < args.length - 1; i++) { |
| 2776 |
if (i < f.__argnames__.length) { |
| 2777 |
prop = (ρσ_expr_temp = f.__argnames__)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i]; |
| 2778 |
if (has_prop.call(kwobj, prop)) { |
| 2779 |
args[(typeof i === "number" && i < 0) ? args.length + i : i] = kwobj[(typeof prop === "number" && prop < 0) ? kwobj.length + prop : prop]; |
| 2780 |
delete kwobj[prop]; |
| 2781 |
} else if (i < supplied_args.length) { |
| 2782 |
args[(typeof i === "number" && i < 0) ? args.length + i : i] = supplied_args[(typeof i === "number" && i < 0) ? supplied_args.length + i : i]; |
| 2783 |
} |
| 2784 |
} else { |
| 2785 |
args[(typeof i === "number" && i < 0) ? args.length + i : i] = supplied_args[(typeof i === "number" && i < 0) ? supplied_args.length + i : i]; |
| 2786 |
} |
| 2787 |
} |
| 2788 |
return f.apply(this, args); |
| 2789 |
} |
| 2790 |
for (var i = 0; i < f.__argnames__.length; i++) { |
| 2791 |
prop = (ρσ_expr_temp = f.__argnames__)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i]; |
| 2792 |
if (has_prop.call(kwobj, prop)) { |
| 2793 |
supplied_args[(typeof i === "number" && i < 0) ? supplied_args.length + i : i] = kwobj[(typeof prop === "number" && prop < 0) ? kwobj.length + prop : prop]; |
| 2794 |
} |
| 2795 |
} |
| 2796 |
return f.apply(this, supplied_args); |
| 2797 |
}; |
| 2798 |
if (!ρσ_interpolate_kwargs.__argnames__) Object.defineProperties(ρσ_interpolate_kwargs, { |
| 2799 |
__argnames__ : {value: ["f", "supplied_args"]}, |
| 2800 |
__module__ : {value: "__main__"} |
| 2801 |
}); |
| 2802 |
|
| 2803 |
function ρσ_interpolate_kwargs_constructor(apply, f, supplied_args) { |
| 2804 |
if (apply) { |
| 2805 |
f.apply(this, supplied_args); |
| 2806 |
} else { |
| 2807 |
ρσ_interpolate_kwargs.call(this, f, supplied_args); |
| 2808 |
} |
| 2809 |
return this; |
| 2810 |
}; |
| 2811 |
if (!ρσ_interpolate_kwargs_constructor.__argnames__) Object.defineProperties(ρσ_interpolate_kwargs_constructor, { |
| 2812 |
__argnames__ : {value: ["apply", "f", "supplied_args"]}, |
| 2813 |
__module__ : {value: "__main__"} |
| 2814 |
}); |
| 2815 |
|
| 2816 |
function ρσ_getitem(obj, key) { |
| 2817 |
if (obj.__getitem__) { |
| 2818 |
return obj.__getitem__(key); |
| 2819 |
} |
| 2820 |
if (typeof key === "number" && key < 0) { |
| 2821 |
key += obj.length; |
| 2822 |
} |
| 2823 |
return obj[(typeof key === "number" && key < 0) ? obj.length + key : key]; |
| 2824 |
}; |
| 2825 |
if (!ρσ_getitem.__argnames__) Object.defineProperties(ρσ_getitem, { |
| 2826 |
__argnames__ : {value: ["obj", "key"]}, |
| 2827 |
__module__ : {value: "__main__"} |
| 2828 |
}); |
| 2829 |
|
| 2830 |
function ρσ_setitem(obj, key, val) { |
| 2831 |
if (obj.__setitem__) { |
| 2832 |
obj.__setitem__(key, val); |
| 2833 |
} else { |
| 2834 |
if (typeof key === "number" && key < 0) { |
| 2835 |
key += obj.length; |
| 2836 |
} |
| 2837 |
obj[(typeof key === "number" && key < 0) ? obj.length + key : key] = val; |
| 2838 |
} |
| 2839 |
return val; |
| 2840 |
}; |
| 2841 |
if (!ρσ_setitem.__argnames__) Object.defineProperties(ρσ_setitem, { |
| 2842 |
__argnames__ : {value: ["obj", "key", "val"]}, |
| 2843 |
__module__ : {value: "__main__"} |
| 2844 |
}); |
| 2845 |
|
| 2846 |
function ρσ_delitem(obj, key) { |
| 2847 |
if (obj.__delitem__) { |
| 2848 |
obj.__delitem__(key); |
| 2849 |
} else if (typeof obj.splice === "function") { |
| 2850 |
obj.splice(key, 1); |
| 2851 |
} else { |
| 2852 |
if (typeof key === "number" && key < 0) { |
| 2853 |
key += obj.length; |
| 2854 |
} |
| 2855 |
delete obj[key]; |
| 2856 |
} |
| 2857 |
}; |
| 2858 |
if (!ρσ_delitem.__argnames__) Object.defineProperties(ρσ_delitem, { |
| 2859 |
__argnames__ : {value: ["obj", "key"]}, |
| 2860 |
__module__ : {value: "__main__"} |
| 2861 |
}); |
| 2862 |
|
| 2863 |
function ρσ_bound_index(idx, arr) { |
| 2864 |
if (typeof idx === "number" && idx < 0) { |
| 2865 |
idx += arr.length; |
| 2866 |
} |
| 2867 |
return idx; |
| 2868 |
}; |
| 2869 |
if (!ρσ_bound_index.__argnames__) Object.defineProperties(ρσ_bound_index, { |
| 2870 |
__argnames__ : {value: ["idx", "arr"]}, |
| 2871 |
__module__ : {value: "__main__"} |
| 2872 |
}); |
| 2873 |
|
| 2874 |
function ρσ_splice(arr, val, start, end) { |
| 2875 |
start = start || 0; |
| 2876 |
if (start < 0) { |
| 2877 |
start += arr.length; |
| 2878 |
} |
| 2879 |
if (end === undefined) { |
| 2880 |
end = arr.length; |
| 2881 |
} |
| 2882 |
if (end < 0) { |
| 2883 |
end += arr.length; |
| 2884 |
} |
| 2885 |
Array.prototype.splice.apply(arr, [start, end - start].concat(val)); |
| 2886 |
}; |
| 2887 |
if (!ρσ_splice.__argnames__) Object.defineProperties(ρσ_splice, { |
| 2888 |
__argnames__ : {value: ["arr", "val", "start", "end"]}, |
| 2889 |
__module__ : {value: "__main__"} |
| 2890 |
}); |
| 2891 |
|
| 2892 |
ρσ_exists = (function(){ |
| 2893 |
var ρσ_d = {}; |
| 2894 |
ρσ_d["n"] = (function() { |
| 2895 |
var ρσ_anonfunc = function (expr) { |
| 2896 |
return expr !== undefined && expr !== null; |
| 2897 |
}; |
| 2898 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2899 |
__argnames__ : {value: ["expr"]}, |
| 2900 |
__module__ : {value: "__main__"} |
| 2901 |
}); |
| 2902 |
return ρσ_anonfunc; |
| 2903 |
})(); |
| 2904 |
ρσ_d["d"] = (function() { |
| 2905 |
var ρσ_anonfunc = function (expr) { |
| 2906 |
if (expr === undefined || expr === null) { |
| 2907 |
return Object.create(null); |
| 2908 |
} |
| 2909 |
return expr; |
| 2910 |
}; |
| 2911 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2912 |
__argnames__ : {value: ["expr"]}, |
| 2913 |
__module__ : {value: "__main__"} |
| 2914 |
}); |
| 2915 |
return ρσ_anonfunc; |
| 2916 |
})(); |
| 2917 |
ρσ_d["c"] = (function() { |
| 2918 |
var ρσ_anonfunc = function (expr) { |
| 2919 |
if (typeof expr === "function") { |
| 2920 |
return expr; |
| 2921 |
} |
| 2922 |
return (function() { |
| 2923 |
var ρσ_anonfunc = function () { |
| 2924 |
return undefined; |
| 2925 |
}; |
| 2926 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2927 |
__module__ : {value: "__main__"} |
| 2928 |
}); |
| 2929 |
return ρσ_anonfunc; |
| 2930 |
})(); |
| 2931 |
}; |
| 2932 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2933 |
__argnames__ : {value: ["expr"]}, |
| 2934 |
__module__ : {value: "__main__"} |
| 2935 |
}); |
| 2936 |
return ρσ_anonfunc; |
| 2937 |
})(); |
| 2938 |
ρσ_d["g"] = (function() { |
| 2939 |
var ρσ_anonfunc = function (expr) { |
| 2940 |
if (expr === undefined || expr === null || typeof expr.__getitem__ !== "function") { |
| 2941 |
return (function(){ |
| 2942 |
var ρσ_d = {}; |
| 2943 |
ρσ_d["__getitem__"] = (function() { |
| 2944 |
var ρσ_anonfunc = function () { |
| 2945 |
return undefined; |
| 2946 |
}; |
| 2947 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 2948 |
__module__ : {value: "__main__"} |
| 2949 |
}); |
| 2950 |
return ρσ_anonfunc; |
| 2951 |
})(); |
| 2952 |
return ρσ_d; |
| 2953 |
}).call(this); |
| 2954 |
} |
| 2955 |
}; |
| 2956 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2957 |
__argnames__ : {value: ["expr"]}, |
| 2958 |
__module__ : {value: "__main__"} |
| 2959 |
}); |
| 2960 |
return ρσ_anonfunc; |
| 2961 |
})(); |
| 2962 |
ρσ_d["e"] = (function() { |
| 2963 |
var ρσ_anonfunc = function (expr, alt) { |
| 2964 |
return (expr === undefined || expr === null) ? alt : expr; |
| 2965 |
}; |
| 2966 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 2967 |
__argnames__ : {value: ["expr", "alt"]}, |
| 2968 |
__module__ : {value: "__main__"} |
| 2969 |
}); |
| 2970 |
return ρσ_anonfunc; |
| 2971 |
})(); |
| 2972 |
return ρσ_d; |
| 2973 |
}).call(this); |
| 2974 |
function ρσ_mixin() { |
| 2975 |
var seen, resolved_props, p, target, props, name; |
| 2976 |
seen = Object.create(null); |
| 2977 |
seen.__argnames__ = seen.__handles_kwarg_interpolation__ = seen.__init__ = seen.__annotations__ = seen.__doc__ = seen.__bind_methods__ = seen.__bases__ = seen.constructor = seen.__class__ = true; |
| 2978 |
resolved_props = {}; |
| 2979 |
p = target = arguments[0].prototype; |
| 2980 |
while (p && p !== Object.prototype) { |
| 2981 |
props = Object.getOwnPropertyNames(p); |
| 2982 |
for (var i = 0; i < props.length; i++) { |
| 2983 |
seen[ρσ_bound_index(props[(typeof i === "number" && i < 0) ? props.length + i : i], seen)] = true; |
| 2984 |
} |
| 2985 |
p = Object.getPrototypeOf(p); |
| 2986 |
} |
| 2987 |
for (var c = 1; c < arguments.length; c++) { |
| 2988 |
p = arguments[(typeof c === "number" && c < 0) ? arguments.length + c : c].prototype; |
| 2989 |
while (p && p !== Object.prototype) { |
| 2990 |
props = Object.getOwnPropertyNames(p); |
| 2991 |
for (var i = 0; i < props.length; i++) { |
| 2992 |
name = props[(typeof i === "number" && i < 0) ? props.length + i : i]; |
| 2993 |
if (seen[(typeof name === "number" && name < 0) ? seen.length + name : name]) { |
| 2994 |
continue; |
| 2995 |
} |
| 2996 |
seen[(typeof name === "number" && name < 0) ? seen.length + name : name] = true; |
| 2997 |
resolved_props[(typeof name === "number" && name < 0) ? resolved_props.length + name : name] = Object.getOwnPropertyDescriptor(p, name); |
| 2998 |
} |
| 2999 |
p = Object.getPrototypeOf(p); |
| 3000 |
} |
| 3001 |
} |
| 3002 |
Object.defineProperties(target, resolved_props); |
| 3003 |
}; |
| 3004 |
if (!ρσ_mixin.__module__) Object.defineProperties(ρσ_mixin, { |
| 3005 |
__module__ : {value: "__main__"} |
| 3006 |
}); |
| 3007 |
|
| 3008 |
function ρσ_instanceof() { |
| 3009 |
var obj, bases, q, cls, p; |
| 3010 |
obj = arguments[0]; |
| 3011 |
bases = ""; |
| 3012 |
if (obj && obj.constructor && obj.constructor.prototype) { |
| 3013 |
bases = obj.constructor.prototype.__bases__ || ""; |
| 3014 |
} |
| 3015 |
for (var i = 1; i < arguments.length; i++) { |
| 3016 |
q = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]; |
| 3017 |
if (obj instanceof q) { |
| 3018 |
return true; |
| 3019 |
} |
| 3020 |
if ((q === Array || q === ρσ_list_constructor) && Array.isArray(obj)) { |
| 3021 |
return true; |
| 3022 |
} |
| 3023 |
if (q === ρσ_str && (typeof obj === "string" || obj instanceof String)) { |
| 3024 |
return true; |
| 3025 |
} |
| 3026 |
if (q === ρσ_int && typeof obj === "number" && Number.isInteger(obj)) { |
| 3027 |
return true; |
| 3028 |
} |
| 3029 |
if (q === ρσ_float && typeof obj === "number" && !Number.isInteger(obj)) { |
| 3030 |
return true; |
| 3031 |
} |
| 3032 |
if (bases.length > 1) { |
| 3033 |
for (var c = 1; c < bases.length; c++) { |
| 3034 |
cls = bases[(typeof c === "number" && c < 0) ? bases.length + c : c]; |
| 3035 |
while (cls) { |
| 3036 |
if (q === cls) { |
| 3037 |
return true; |
| 3038 |
} |
| 3039 |
p = Object.getPrototypeOf(cls.prototype); |
| 3040 |
if (!p) { |
| 3041 |
break; |
| 3042 |
} |
| 3043 |
cls = p.constructor; |
| 3044 |
} |
| 3045 |
} |
| 3046 |
} |
| 3047 |
} |
| 3048 |
return false; |
| 3049 |
}; |
| 3050 |
if (!ρσ_instanceof.__module__) Object.defineProperties(ρσ_instanceof, { |
| 3051 |
__module__ : {value: "__main__"} |
| 3052 |
}); |
| 3053 |
function sum(iterable, start) { |
| 3054 |
var ans, iterator, r; |
| 3055 |
if (Array.isArray(iterable)) { |
| 3056 |
return iterable.reduce((function() { |
| 3057 |
var ρσ_anonfunc = function (prev, cur) { |
| 3058 |
return prev + cur; |
| 3059 |
}; |
| 3060 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 3061 |
__argnames__ : {value: ["prev", "cur"]}, |
| 3062 |
__module__ : {value: "__main__"} |
| 3063 |
}); |
| 3064 |
return ρσ_anonfunc; |
| 3065 |
})(), start || 0); |
| 3066 |
} |
| 3067 |
ans = start || 0; |
| 3068 |
iterator = iter(iterable); |
| 3069 |
r = iterator.next(); |
| 3070 |
while (!r.done) { |
| 3071 |
ans += r.value; |
| 3072 |
r = iterator.next(); |
| 3073 |
} |
| 3074 |
return ans; |
| 3075 |
}; |
| 3076 |
if (!sum.__argnames__) Object.defineProperties(sum, { |
| 3077 |
__argnames__ : {value: ["iterable", "start"]}, |
| 3078 |
__module__ : {value: "__main__"} |
| 3079 |
}); |
| 3080 |
|
| 3081 |
function map() { |
| 3082 |
var iterators, func, args, ans; |
| 3083 |
iterators = new Array(arguments.length - 1); |
| 3084 |
func = arguments[0]; |
| 3085 |
args = new Array(arguments.length - 1); |
| 3086 |
for (var i = 1; i < arguments.length; i++) { |
| 3087 |
iterators[ρσ_bound_index(i - 1, iterators)] = iter(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]); |
| 3088 |
} |
| 3089 |
ans = {'_func':func, '_iterators':iterators, '_args':args}; |
| 3090 |
ans[ρσ_iterator_symbol] = (function() { |
| 3091 |
var ρσ_anonfunc = function () { |
| 3092 |
return this; |
| 3093 |
}; |
| 3094 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 3095 |
__module__ : {value: "__main__"} |
| 3096 |
}); |
| 3097 |
return ρσ_anonfunc; |
| 3098 |
})(); |
| 3099 |
ans["next"] = (function() { |
| 3100 |
var ρσ_anonfunc = function () { |
| 3101 |
var r; |
| 3102 |
for (var i = 0; i < this._iterators.length; i++) { |
| 3103 |
r = (ρσ_expr_temp = this._iterators)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i].next(); |
| 3104 |
if (r.done) { |
| 3105 |
return {'done':true}; |
| 3106 |
} |
| 3107 |
(ρσ_expr_temp = this._args)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] = r.value; |
| 3108 |
} |
| 3109 |
return {'done':false, 'value':this._func.apply(undefined, this._args)}; |
| 3110 |
}; |
| 3111 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 3112 |
__module__ : {value: "__main__"} |
| 3113 |
}); |
| 3114 |
return ρσ_anonfunc; |
| 3115 |
})(); |
| 3116 |
return ans; |
| 3117 |
}; |
| 3118 |
if (!map.__module__) Object.defineProperties(map, { |
| 3119 |
__module__ : {value: "__main__"} |
| 3120 |
}); |
| 3121 |
|
| 3122 |
function filter(func_or_none, iterable) { |
| 3123 |
var func, ans; |
| 3124 |
func = (func_or_none === null) ? ρσ_bool : func_or_none; |
| 3125 |
ans = {'_func':func, '_iterator':ρσ_iter(iterable)}; |
| 3126 |
ans[ρσ_iterator_symbol] = (function() { |
| 3127 |
var ρσ_anonfunc = function () { |
| 3128 |
return this; |
| 3129 |
}; |
| 3130 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 3131 |
__module__ : {value: "__main__"} |
| 3132 |
}); |
| 3133 |
return ρσ_anonfunc; |
| 3134 |
})(); |
| 3135 |
ans["next"] = (function() { |
| 3136 |
var ρσ_anonfunc = function () { |
| 3137 |
var r; |
| 3138 |
r = this._iterator.next(); |
| 3139 |
while (!r.done) { |
| 3140 |
if (this._func(r.value)) { |
| 3141 |
return r; |
| 3142 |
} |
| 3143 |
r = this._iterator.next(); |
| 3144 |
} |
| 3145 |
return {'done':true}; |
| 3146 |
}; |
| 3147 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 3148 |
__module__ : {value: "__main__"} |
| 3149 |
}); |
| 3150 |
return ρσ_anonfunc; |
| 3151 |
})(); |
| 3152 |
return ans; |
| 3153 |
}; |
| 3154 |
if (!filter.__argnames__) Object.defineProperties(filter, { |
| 3155 |
__argnames__ : {value: ["func_or_none", "iterable"]}, |
| 3156 |
__module__ : {value: "__main__"} |
| 3157 |
}); |
| 3158 |
|
| 3159 |
function zip() { |
| 3160 |
var iterators, ans; |
| 3161 |
iterators = new Array(arguments.length); |
| 3162 |
for (var i = 0; i < arguments.length; i++) { |
| 3163 |
iterators[(typeof i === "number" && i < 0) ? iterators.length + i : i] = iter(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]); |
| 3164 |
} |
| 3165 |
ans = {'_iterators':iterators}; |
| 3166 |
ans[ρσ_iterator_symbol] = (function() { |
| 3167 |
var ρσ_anonfunc = function () { |
| 3168 |
return this; |
| 3169 |
}; |
| 3170 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 3171 |
__module__ : {value: "__main__"} |
| 3172 |
}); |
| 3173 |
return ρσ_anonfunc; |
| 3174 |
})(); |
| 3175 |
ans["next"] = (function() { |
| 3176 |
var ρσ_anonfunc = function () { |
| 3177 |
var args, r; |
| 3178 |
args = new Array(this._iterators.length); |
| 3179 |
for (var i = 0; i < this._iterators.length; i++) { |
| 3180 |
r = (ρσ_expr_temp = this._iterators)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i].next(); |
| 3181 |
if (r.done) { |
| 3182 |
return {'done':true}; |
| 3183 |
} |
| 3184 |
args[(typeof i === "number" && i < 0) ? args.length + i : i] = r.value; |
| 3185 |
} |
| 3186 |
return {'done':false, 'value':args}; |
| 3187 |
}; |
| 3188 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 3189 |
__module__ : {value: "__main__"} |
| 3190 |
}); |
| 3191 |
return ρσ_anonfunc; |
| 3192 |
})(); |
| 3193 |
return ans; |
| 3194 |
}; |
| 3195 |
if (!zip.__module__) Object.defineProperties(zip, { |
| 3196 |
__module__ : {value: "__main__"} |
| 3197 |
}); |
| 3198 |
|
| 3199 |
function any(iterable) { |
| 3200 |
var i; |
| 3201 |
var ρσ_Iter0 = iterable; |
| 3202 |
ρσ_Iter0 = ((typeof ρσ_Iter0[Symbol.iterator] === "function") ? (ρσ_Iter0 instanceof Map ? ρσ_Iter0.keys() : ρσ_Iter0) : Object.keys(ρσ_Iter0)); |
| 3203 |
for (var ρσ_Index0 of ρσ_Iter0) { |
| 3204 |
i = ρσ_Index0; |
| 3205 |
if (i) { |
| 3206 |
return true; |
| 3207 |
} |
| 3208 |
} |
| 3209 |
return false; |
| 3210 |
}; |
| 3211 |
if (!any.__argnames__) Object.defineProperties(any, { |
| 3212 |
__argnames__ : {value: ["iterable"]}, |
| 3213 |
__module__ : {value: "__main__"} |
| 3214 |
}); |
| 3215 |
|
| 3216 |
function all(iterable) { |
| 3217 |
var i; |
| 3218 |
var ρσ_Iter1 = iterable; |
| 3219 |
ρσ_Iter1 = ((typeof ρσ_Iter1[Symbol.iterator] === "function") ? (ρσ_Iter1 instanceof Map ? ρσ_Iter1.keys() : ρσ_Iter1) : Object.keys(ρσ_Iter1)); |
| 3220 |
for (var ρσ_Index1 of ρσ_Iter1) { |
| 3221 |
i = ρσ_Index1; |
| 3222 |
if (!i) { |
| 3223 |
return false; |
| 3224 |
} |
| 3225 |
} |
| 3226 |
return true; |
| 3227 |
}; |
| 3228 |
if (!all.__argnames__) Object.defineProperties(all, { |
| 3229 |
__argnames__ : {value: ["iterable"]}, |
| 3230 |
__module__ : {value: "__main__"} |
| 3231 |
}); |
| 3232 |
var decimal_sep, define_str_func, ρσ_orig_split, ρσ_orig_replace; |
| 3233 |
decimal_sep = 1.1.toLocaleString()[1]; |
| 3234 |
function ρσ_repr_js_builtin(x, as_array) { |
| 3235 |
var ans, b, keys, key; |
| 3236 |
ans = []; |
| 3237 |
b = "{}"; |
| 3238 |
if (as_array) { |
| 3239 |
b = "[]"; |
| 3240 |
for (var i = 0; i < x.length; i++) { |
| 3241 |
ans.push(ρσ_repr(x[(typeof i === "number" && i < 0) ? x.length + i : i])); |
| 3242 |
} |
| 3243 |
} else { |
| 3244 |
keys = Object.keys(x); |
| 3245 |
for (var k = 0; k < keys.length; k++) { |
| 3246 |
key = keys[(typeof k === "number" && k < 0) ? keys.length + k : k]; |
| 3247 |
ans.push(JSON.stringify(key) + ":" + ρσ_repr(x[(typeof key === "number" && key < 0) ? x.length + key : key])); |
| 3248 |
} |
| 3249 |
} |
| 3250 |
return b[0] + ans.join(", ") + b[1]; |
| 3251 |
}; |
| 3252 |
if (!ρσ_repr_js_builtin.__argnames__) Object.defineProperties(ρσ_repr_js_builtin, { |
| 3253 |
__argnames__ : {value: ["x", "as_array"]}, |
| 3254 |
__module__ : {value: "__main__"} |
| 3255 |
}); |
| 3256 |
|
| 3257 |
function ρσ_html_element_to_string(elem) { |
| 3258 |
var attrs, val, attr, ans; |
| 3259 |
attrs = []; |
| 3260 |
var ρσ_Iter0 = elem.attributes; |
| 3261 |
ρσ_Iter0 = ((typeof ρσ_Iter0[Symbol.iterator] === "function") ? (ρσ_Iter0 instanceof Map ? ρσ_Iter0.keys() : ρσ_Iter0) : Object.keys(ρσ_Iter0)); |
| 3262 |
for (var ρσ_Index0 of ρσ_Iter0) { |
| 3263 |
attr = ρσ_Index0; |
| 3264 |
if (attr.specified) { |
| 3265 |
val = attr.value; |
| 3266 |
if (val.length > 10) { |
| 3267 |
val = val.slice(0, 15) + "..."; |
| 3268 |
} |
| 3269 |
val = JSON.stringify(val); |
| 3270 |
attrs.push("" + ρσ_str.format("{}", attr.name) + "=" + ρσ_str.format("{}", val) + ""); |
| 3271 |
} |
| 3272 |
} |
| 3273 |
attrs = (attrs.length) ? " " + attrs.join(" ") : ""; |
| 3274 |
ans = "<" + ρσ_str.format("{}", elem.tagName) + "" + ρσ_str.format("{}", attrs) + ">"; |
| 3275 |
return ans; |
| 3276 |
}; |
| 3277 |
if (!ρσ_html_element_to_string.__argnames__) Object.defineProperties(ρσ_html_element_to_string, { |
| 3278 |
__argnames__ : {value: ["elem"]}, |
| 3279 |
__module__ : {value: "__main__"} |
| 3280 |
}); |
| 3281 |
|
| 3282 |
function ρσ_repr(x) { |
| 3283 |
var ans, name, mapped; |
| 3284 |
if (x === null) { |
| 3285 |
return "None"; |
| 3286 |
} |
| 3287 |
if (x === undefined) { |
| 3288 |
return "undefined"; |
| 3289 |
} |
| 3290 |
ans = x; |
| 3291 |
if (typeof x.__repr__ === "function") { |
| 3292 |
ans = x.__repr__(); |
| 3293 |
} else if (x === true || x === false) { |
| 3294 |
ans = (x) ? "True" : "False"; |
| 3295 |
} else if (Array.isArray(x)) { |
| 3296 |
ans = ρσ_repr_js_builtin(x, true); |
| 3297 |
} else if (typeof x === "function") { |
| 3298 |
ans = x.toString(); |
| 3299 |
} else if (typeof x === "object" && !x.toString) { |
| 3300 |
ans = ρσ_repr_js_builtin(x); |
| 3301 |
} else { |
| 3302 |
name = Object.prototype.toString.call(x).slice(8, -1); |
| 3303 |
if (ρσ_not_equals(("Int8Array Uint8Array Uint8ClampedArray Int16Array" + " Uint16Array Int32Array Uint32Array" + " Float32Array Float64Array").indexOf(name), -1)) { |
| 3304 |
mapped = x.map((function() { |
| 3305 |
var ρσ_anonfunc = function (i) { |
| 3306 |
return str.format("0x{:02x}", i); |
| 3307 |
}; |
| 3308 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 3309 |
__argnames__ : {value: ["i"]}, |
| 3310 |
__module__ : {value: "__main__"} |
| 3311 |
}); |
| 3312 |
return ρσ_anonfunc; |
| 3313 |
})()); |
| 3314 |
return name + "([" + mapped.join(", ") + "])"; |
| 3315 |
} |
| 3316 |
if (typeof HTMLElement !== "undefined" && x instanceof HTMLElement) { |
| 3317 |
ans = ρσ_html_element_to_string(x); |
| 3318 |
} else { |
| 3319 |
ans = (typeof x.toString === "function") ? x.toString() : x; |
| 3320 |
} |
| 3321 |
if (ans === "[object Object]") { |
| 3322 |
return ρσ_repr_js_builtin(x); |
| 3323 |
} |
| 3324 |
try { |
| 3325 |
ans = JSON.stringify(x); |
| 3326 |
} catch (ρσ_Exception) { |
| 3327 |
ρσ_last_exception = ρσ_Exception; |
| 3328 |
{ |
| 3329 |
} |
| 3330 |
} |
| 3331 |
} |
| 3332 |
return ans + ""; |
| 3333 |
}; |
| 3334 |
if (!ρσ_repr.__argnames__) Object.defineProperties(ρσ_repr, { |
| 3335 |
__argnames__ : {value: ["x"]}, |
| 3336 |
__module__ : {value: "__main__"} |
| 3337 |
}); |
| 3338 |
|
| 3339 |
function ρσ_str(x) { |
| 3340 |
var ans, name, mapped; |
| 3341 |
if (x === null) { |
| 3342 |
return "None"; |
| 3343 |
} |
| 3344 |
if (x === undefined) { |
| 3345 |
return "undefined"; |
| 3346 |
} |
| 3347 |
ans = x; |
| 3348 |
if (typeof x.__str__ === "function") { |
| 3349 |
ans = x.__str__(); |
| 3350 |
} else if (typeof x.__repr__ === "function") { |
| 3351 |
ans = x.__repr__(); |
| 3352 |
} else if (x === true || x === false) { |
| 3353 |
ans = (x) ? "True" : "False"; |
| 3354 |
} else if (Array.isArray(x)) { |
| 3355 |
ans = ρσ_repr_js_builtin(x, true); |
| 3356 |
} else if (typeof x.toString === "function") { |
| 3357 |
name = Object.prototype.toString.call(x).slice(8, -1); |
| 3358 |
if (ρσ_not_equals(("Int8Array Uint8Array Uint8ClampedArray Int16Array" + " Uint16Array Int32Array Uint32Array" + " Float32Array Float64Array").indexOf(name), -1)) { |
| 3359 |
mapped = x.map((function() { |
| 3360 |
var ρσ_anonfunc = function (i) { |
| 3361 |
return str.format("0x{:02x}", i); |
| 3362 |
}; |
| 3363 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 3364 |
__argnames__ : {value: ["i"]}, |
| 3365 |
__module__ : {value: "__main__"} |
| 3366 |
}); |
| 3367 |
return ρσ_anonfunc; |
| 3368 |
})()); |
| 3369 |
return name + "([" + mapped.join(", ") + "])"; |
| 3370 |
} |
| 3371 |
if (typeof HTMLElement !== "undefined" && x instanceof HTMLElement) { |
| 3372 |
ans = ρσ_html_element_to_string(x); |
| 3373 |
} else { |
| 3374 |
ans = x.toString(); |
| 3375 |
} |
| 3376 |
if (ans === "[object Object]") { |
| 3377 |
ans = ρσ_repr_js_builtin(x); |
| 3378 |
} |
| 3379 |
} else if (typeof x === "object" && !x.toString) { |
| 3380 |
ans = ρσ_repr_js_builtin(x); |
| 3381 |
} |
| 3382 |
return ans + ""; |
| 3383 |
}; |
| 3384 |
if (!ρσ_str.__argnames__) Object.defineProperties(ρσ_str, { |
| 3385 |
__argnames__ : {value: ["x"]}, |
| 3386 |
__module__ : {value: "__main__"} |
| 3387 |
}); |
| 3388 |
|
| 3389 |
define_str_func = (function() { |
| 3390 |
var ρσ_anonfunc = function (name, func) { |
| 3391 |
var f; |
| 3392 |
(ρσ_expr_temp = ρσ_str.prototype)[(typeof name === "number" && name < 0) ? ρσ_expr_temp.length + name : name] = func; |
| 3393 |
ρσ_str[(typeof name === "number" && name < 0) ? ρσ_str.length + name : name] = f = func.call.bind(func); |
| 3394 |
if (func.__argnames__) { |
| 3395 |
Object.defineProperty(f, "__argnames__", (function(){ |
| 3396 |
var ρσ_d = {}; |
| 3397 |
ρσ_d["value"] = ['string'].concat(func.__argnames__); |
| 3398 |
return ρσ_d; |
| 3399 |
}).call(this)); |
| 3400 |
} |
| 3401 |
}; |
| 3402 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 3403 |
__argnames__ : {value: ["name", "func"]}, |
| 3404 |
__module__ : {value: "__main__"} |
| 3405 |
}); |
| 3406 |
return ρσ_anonfunc; |
| 3407 |
})(); |
| 3408 |
ρσ_orig_split = String.prototype.split.call.bind(String.prototype.split); |
| 3409 |
ρσ_orig_replace = String.prototype.replace.call.bind(String.prototype.replace); |
| 3410 |
define_str_func("format", (function() { |
| 3411 |
var ρσ_anonfunc = function () { |
| 3412 |
var template, args, kwargs, explicit, implicit, idx, split, ans, pos, in_brace, markup, ch; |
| 3413 |
template = this; |
| 3414 |
if (template === undefined) { |
| 3415 |
throw new TypeError("Template is required"); |
| 3416 |
} |
| 3417 |
args = Array.from(arguments); |
| 3418 |
kwargs = {}; |
| 3419 |
if (args[args.length-1] && args[args.length-1][ρσ_kwargs_symbol] !== undefined) { |
| 3420 |
kwargs = args[args.length-1]; |
| 3421 |
args = args.slice(0, -1); |
| 3422 |
} |
| 3423 |
explicit = implicit = false; |
| 3424 |
idx = 0; |
| 3425 |
split = ρσ_orig_split; |
| 3426 |
if (ρσ_str.format._template_resolve_pat === undefined) { |
| 3427 |
ρσ_str.format._template_resolve_pat = /[.\[]/; |
| 3428 |
} |
| 3429 |
function resolve(arg, object) { |
| 3430 |
var ρσ_unpack, first, key, rest, ans; |
| 3431 |
if (!arg) { |
| 3432 |
return object; |
| 3433 |
} |
| 3434 |
ρσ_unpack = [arg[0], arg.slice(1)]; |
| 3435 |
first = ρσ_unpack[0]; |
| 3436 |
arg = ρσ_unpack[1]; |
| 3437 |
key = split(arg, ρσ_str.format._template_resolve_pat, 1)[0]; |
| 3438 |
rest = arg.slice(key.length); |
| 3439 |
ans = (first === "[") ? object[ρσ_bound_index(key.slice(0, -1), object)] : getattr(object, key); |
| 3440 |
if (ans === undefined) { |
| 3441 |
throw new KeyError((first === "[") ? key.slice(0, -1) : key); |
| 3442 |
} |
| 3443 |
return resolve(rest, ans); |
| 3444 |
}; |
| 3445 |
if (!resolve.__argnames__) Object.defineProperties(resolve, { |
| 3446 |
__argnames__ : {value: ["arg", "object"]}, |
| 3447 |
__module__ : {value: "__main__"} |
| 3448 |
}); |
| 3449 |
|
| 3450 |
function resolve_format_spec(format_spec) { |
| 3451 |
var pat; |
| 3452 |
if (ρσ_str.format._template_resolve_fs_pat === undefined) { |
| 3453 |
ρσ_str.format._template_resolve_fs_pat = /[{]([a-zA-Z0-9_]+)[}]/g; |
| 3454 |
} |
| 3455 |
pat = ρσ_str.format._template_resolve_fs_pat; |
| 3456 |
return format_spec.replace(pat, (function() { |
| 3457 |
var ρσ_anonfunc = function (match, key) { |
| 3458 |
if (!Object.prototype.hasOwnProperty.call(kwargs, key)) { |
| 3459 |
return ""; |
| 3460 |
} |
| 3461 |
return "" + kwargs[(typeof key === "number" && key < 0) ? kwargs.length + key : key]; |
| 3462 |
}; |
| 3463 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 3464 |
__argnames__ : {value: ["match", "key"]}, |
| 3465 |
__module__ : {value: "__main__"} |
| 3466 |
}); |
| 3467 |
return ρσ_anonfunc; |
| 3468 |
})()); |
| 3469 |
}; |
| 3470 |
if (!resolve_format_spec.__argnames__) Object.defineProperties(resolve_format_spec, { |
| 3471 |
__argnames__ : {value: ["format_spec"]}, |
| 3472 |
__module__ : {value: "__main__"} |
| 3473 |
}); |
| 3474 |
|
| 3475 |
function set_comma(ans, comma) { |
| 3476 |
var sep; |
| 3477 |
if (comma !== ",") { |
| 3478 |
sep = 1234; |
| 3479 |
sep = sep.toLocaleString(undefined, {useGrouping: true})[1]; |
| 3480 |
ans = str.replace(ans, sep, comma); |
| 3481 |
} |
| 3482 |
return ans; |
| 3483 |
}; |
| 3484 |
if (!set_comma.__argnames__) Object.defineProperties(set_comma, { |
| 3485 |
__argnames__ : {value: ["ans", "comma"]}, |
| 3486 |
__module__ : {value: "__main__"} |
| 3487 |
}); |
| 3488 |
|
| 3489 |
function safe_comma(value, comma) { |
| 3490 |
try { |
| 3491 |
return set_comma(value.toLocaleString(undefined, {useGrouping: true}), comma); |
| 3492 |
} catch (ρσ_Exception) { |
| 3493 |
ρσ_last_exception = ρσ_Exception; |
| 3494 |
{ |
| 3495 |
return value.toString(10); |
| 3496 |
} |
| 3497 |
} |
| 3498 |
}; |
| 3499 |
if (!safe_comma.__argnames__) Object.defineProperties(safe_comma, { |
| 3500 |
__argnames__ : {value: ["value", "comma"]}, |
| 3501 |
__module__ : {value: "__main__"} |
| 3502 |
}); |
| 3503 |
|
| 3504 |
function safe_fixed(value, precision, comma) { |
| 3505 |
var ufmt; |
| 3506 |
if (!comma) { |
| 3507 |
return value.toFixed(precision); |
| 3508 |
} |
| 3509 |
try { |
| 3510 |
ufmt = (function(){ |
| 3511 |
var ρσ_d = {}; |
| 3512 |
ρσ_d["useGrouping"] = true; |
| 3513 |
ρσ_d["minimumFractionDigits"] = precision; |
| 3514 |
ρσ_d["maximumFractionDigits"] = precision; |
| 3515 |
return ρσ_d; |
| 3516 |
}).call(this); |
| 3517 |
return set_comma(value.toLocaleString(undefined, ufmt), comma); |
| 3518 |
} catch (ρσ_Exception) { |
| 3519 |
ρσ_last_exception = ρσ_Exception; |
| 3520 |
{ |
| 3521 |
return value.toFixed(precision); |
| 3522 |
} |
| 3523 |
} |
| 3524 |
}; |
| 3525 |
if (!safe_fixed.__argnames__) Object.defineProperties(safe_fixed, { |
| 3526 |
__argnames__ : {value: ["value", "precision", "comma"]}, |
| 3527 |
__module__ : {value: "__main__"} |
| 3528 |
}); |
| 3529 |
|
| 3530 |
function apply_formatting(value, format_spec) { |
| 3531 |
var m, ρσ_unpack, fill, align, sign, fhash, zeropad, width, comma, precision, ftype, is_numeric, is_int, lftype, code, prec, exp, nval, is_positive, left, right; |
| 3532 |
if (format_spec.indexOf("{") !== -1) { |
| 3533 |
format_spec = resolve_format_spec(format_spec); |
| 3534 |
} |
| 3535 |
if (ρσ_str.format._template_format_pat === undefined) { |
| 3536 |
ρσ_str.format._template_format_pat = /([^{}](?=[<>=^]))?([<>=^])?([-+\x20])?(\#)?(0)?(\d+)?([,_])?(?:\.(\d+))?([bcdeEfFgGnosxX%])?/; |
| 3537 |
} |
| 3538 |
try { |
| 3539 |
m = format_spec.match(ρσ_str.format._template_format_pat); |
| 3540 |
ρσ_unpack = [m[1], m[2], m[3], m[4], m[5]]; |
| 3541 |
fill = ρσ_unpack[0]; |
| 3542 |
align = ρσ_unpack[1]; |
| 3543 |
sign = ρσ_unpack[2]; |
| 3544 |
fhash = ρσ_unpack[3]; |
| 3545 |
zeropad = ρσ_unpack[4]; |
| 3546 |
ρσ_unpack = [m[6], m[7], m[8], m[9]]; |
| 3547 |
width = ρσ_unpack[0]; |
| 3548 |
comma = ρσ_unpack[1]; |
| 3549 |
precision = ρσ_unpack[2]; |
| 3550 |
ftype = ρσ_unpack[3]; |
| 3551 |
} catch (ρσ_Exception) { |
| 3552 |
ρσ_last_exception = ρσ_Exception; |
| 3553 |
if (ρσ_Exception instanceof TypeError) { |
| 3554 |
return value; |
| 3555 |
} else { |
| 3556 |
throw ρσ_Exception; |
| 3557 |
} |
| 3558 |
} |
| 3559 |
if (zeropad) { |
| 3560 |
fill = fill || "0"; |
| 3561 |
align = align || "="; |
| 3562 |
} else { |
| 3563 |
fill = fill || " "; |
| 3564 |
align = align || ">"; |
| 3565 |
} |
| 3566 |
is_numeric = Number(value) === value; |
| 3567 |
is_int = is_numeric && value % 1 === 0; |
| 3568 |
precision = parseInt(precision, 10); |
| 3569 |
lftype = (ftype || "").toLowerCase(); |
| 3570 |
if (ftype === "n") { |
| 3571 |
is_numeric = true; |
| 3572 |
if (is_int) { |
| 3573 |
if (comma) { |
| 3574 |
throw new ValueError("Cannot specify ',' with 'n'"); |
| 3575 |
} |
| 3576 |
value = parseInt(value, 10).toLocaleString(); |
| 3577 |
} else { |
| 3578 |
value = parseFloat(value).toLocaleString(); |
| 3579 |
} |
| 3580 |
} else if (['b', 'c', 'd', 'o', 'x'].indexOf(lftype) !== -1) { |
| 3581 |
value = parseInt(value, 10); |
| 3582 |
is_numeric = true; |
| 3583 |
if (!isNaN(value)) { |
| 3584 |
if (ftype === "b") { |
| 3585 |
value = (value >>> 0).toString(2); |
| 3586 |
if (fhash) { |
| 3587 |
value = "0b" + value; |
| 3588 |
} |
| 3589 |
} else if (ftype === "c") { |
| 3590 |
if (value > 65535) { |
| 3591 |
code = value - 65536; |
| 3592 |
value = String.fromCharCode(55296 + (code >> 10), 56320 + (code & 1023)); |
| 3593 |
} else { |
| 3594 |
value = String.fromCharCode(value); |
| 3595 |
} |
| 3596 |
} else if (ftype === "d") { |
| 3597 |
if (comma) { |
| 3598 |
value = safe_comma(value, comma); |
| 3599 |
} else { |
| 3600 |
value = value.toString(10); |
| 3601 |
} |
| 3602 |
} else if (ftype === "o") { |
| 3603 |
value = value.toString(8); |
| 3604 |
if (fhash) { |
| 3605 |
value = "0o" + value; |
| 3606 |
} |
| 3607 |
} else if (lftype === "x") { |
| 3608 |
value = value.toString(16); |
| 3609 |
value = (ftype === "x") ? value.toLowerCase() : value.toUpperCase(); |
| 3610 |
if (fhash) { |
| 3611 |
value = "0x" + value; |
| 3612 |
} |
| 3613 |
} |
| 3614 |
} |
| 3615 |
} else if (['e','f','g','%'].indexOf(lftype) !== -1) { |
| 3616 |
is_numeric = true; |
| 3617 |
value = parseFloat(value); |
| 3618 |
prec = (isNaN(precision)) ? 6 : precision; |
| 3619 |
if (lftype === "e") { |
| 3620 |
value = value.toExponential(prec); |
| 3621 |
value = (ftype === "E") ? value.toUpperCase() : value.toLowerCase(); |
| 3622 |
} else if (lftype === "f") { |
| 3623 |
value = safe_fixed(value, prec, comma); |
| 3624 |
value = (ftype === "F") ? value.toUpperCase() : value.toLowerCase(); |
| 3625 |
} else if (lftype === "%") { |
| 3626 |
value *= 100; |
| 3627 |
value = safe_fixed(value, prec, comma) + "%"; |
| 3628 |
} else if (lftype === "g") { |
| 3629 |
prec = max(1, prec); |
| 3630 |
exp = parseInt(split(value.toExponential(prec - 1).toLowerCase(), "e")[1], 10); |
| 3631 |
if (-4 <= exp && exp < prec) { |
| 3632 |
value = safe_fixed(value, prec - 1 - exp, comma); |
| 3633 |
} else { |
| 3634 |
value = value.toExponential(prec - 1); |
| 3635 |
} |
| 3636 |
value = value.replace(/0+$/g, ""); |
| 3637 |
if (value[value.length-1] === decimal_sep) { |
| 3638 |
value = value.slice(0, -1); |
| 3639 |
} |
| 3640 |
if (ftype === "G") { |
| 3641 |
value = value.toUpperCase(); |
| 3642 |
} |
| 3643 |
} |
| 3644 |
} else { |
| 3645 |
if (comma) { |
| 3646 |
value = parseInt(value, 10); |
| 3647 |
if (isNaN(value)) { |
| 3648 |
throw new ValueError("Must use numbers with , or _"); |
| 3649 |
} |
| 3650 |
value = safe_comma(value, comma); |
| 3651 |
} |
| 3652 |
value += ""; |
| 3653 |
if (!isNaN(precision)) { |
| 3654 |
value = value.slice(0, precision); |
| 3655 |
} |
| 3656 |
} |
| 3657 |
value += ""; |
| 3658 |
if (is_numeric && sign) { |
| 3659 |
nval = Number(value); |
| 3660 |
is_positive = !isNaN(nval) && nval >= 0; |
| 3661 |
if (is_positive && (sign === " " || sign === "+")) { |
| 3662 |
value = sign + value; |
| 3663 |
} |
| 3664 |
} |
| 3665 |
function repeat(char, num) { |
| 3666 |
return (new Array(num+1)).join(char); |
| 3667 |
}; |
| 3668 |
if (!repeat.__argnames__) Object.defineProperties(repeat, { |
| 3669 |
__argnames__ : {value: ["char", "num"]}, |
| 3670 |
__module__ : {value: "__main__"} |
| 3671 |
}); |
| 3672 |
|
| 3673 |
if (is_numeric && width && width[0] === "0") { |
| 3674 |
width = width.slice(1); |
| 3675 |
ρσ_unpack = ["0", "="]; |
| 3676 |
fill = ρσ_unpack[0]; |
| 3677 |
align = ρσ_unpack[1]; |
| 3678 |
} |
| 3679 |
width = parseInt(width || "-1", 10); |
| 3680 |
if (isNaN(width)) { |
| 3681 |
throw new ValueError("Invalid width specification: " + width); |
| 3682 |
} |
| 3683 |
if (fill && value.length < width) { |
| 3684 |
if (align === "<") { |
| 3685 |
value = value + repeat(fill, width - value.length); |
| 3686 |
} else if (align === ">") { |
| 3687 |
value = repeat(fill, width - value.length) + value; |
| 3688 |
} else if (align === "^") { |
| 3689 |
left = Math.floor((width - value.length) / 2); |
| 3690 |
right = width - left - value.length; |
| 3691 |
value = repeat(fill, left) + value + repeat(fill, right); |
| 3692 |
} else if (align === "=") { |
| 3693 |
if (ρσ_in(value[0], "+- ")) { |
| 3694 |
value = value[0] + repeat(fill, width - value.length) + value.slice(1); |
| 3695 |
} else { |
| 3696 |
value = repeat(fill, width - value.length) + value; |
| 3697 |
} |
| 3698 |
} else { |
| 3699 |
throw new ValueError("Unrecognized alignment: " + align); |
| 3700 |
} |
| 3701 |
} |
| 3702 |
return value; |
| 3703 |
}; |
| 3704 |
if (!apply_formatting.__argnames__) Object.defineProperties(apply_formatting, { |
| 3705 |
__argnames__ : {value: ["value", "format_spec"]}, |
| 3706 |
__module__ : {value: "__main__"} |
| 3707 |
}); |
| 3708 |
|
| 3709 |
function parse_markup(markup) { |
| 3710 |
var key, transformer, format_spec, pos, state, ch; |
| 3711 |
key = transformer = format_spec = ""; |
| 3712 |
pos = 0; |
| 3713 |
state = 0; |
| 3714 |
while (pos < markup.length) { |
| 3715 |
ch = markup[(typeof pos === "number" && pos < 0) ? markup.length + pos : pos]; |
| 3716 |
if (state === 0) { |
| 3717 |
if (ch === "!") { |
| 3718 |
state = 1; |
| 3719 |
} else if (ch === ":") { |
| 3720 |
state = 2; |
| 3721 |
} else { |
| 3722 |
key += ch; |
| 3723 |
} |
| 3724 |
} else if (state === 1) { |
| 3725 |
if (ch === ":") { |
| 3726 |
state = 2; |
| 3727 |
} else { |
| 3728 |
transformer += ch; |
| 3729 |
} |
| 3730 |
} else { |
| 3731 |
format_spec += ch; |
| 3732 |
} |
| 3733 |
pos += 1; |
| 3734 |
} |
| 3735 |
return [key, transformer, format_spec]; |
| 3736 |
}; |
| 3737 |
if (!parse_markup.__argnames__) Object.defineProperties(parse_markup, { |
| 3738 |
__argnames__ : {value: ["markup"]}, |
| 3739 |
__module__ : {value: "__main__"} |
| 3740 |
}); |
| 3741 |
|
| 3742 |
function render_markup(markup) { |
| 3743 |
var ρσ_unpack, key, transformer, format_spec, ends_with_equal, lkey, nvalue, object, ans; |
| 3744 |
ρσ_unpack = parse_markup(markup); |
| 3745 |
ρσ_unpack = ρσ_unpack_asarray(3, ρσ_unpack); |
| 3746 |
key = ρσ_unpack[0]; |
| 3747 |
transformer = ρσ_unpack[1]; |
| 3748 |
format_spec = ρσ_unpack[2]; |
| 3749 |
if (transformer && ['a', 'r', 's'].indexOf(transformer) === -1) { |
| 3750 |
throw new ValueError("Unknown conversion specifier: " + transformer); |
| 3751 |
} |
| 3752 |
ends_with_equal = key.endsWith("="); |
| 3753 |
if (ends_with_equal) { |
| 3754 |
key = key.slice(0, -1); |
| 3755 |
} |
| 3756 |
lkey = key.length && split(key, /[.\[]/, 1)[0]; |
| 3757 |
if (lkey) { |
| 3758 |
explicit = true; |
| 3759 |
if (implicit) { |
| 3760 |
throw new ValueError("cannot switch from automatic field numbering" + " to manual field specification"); |
| 3761 |
} |
| 3762 |
nvalue = parseInt(lkey); |
| 3763 |
object = (isNaN(nvalue)) ? kwargs[(typeof lkey === "number" && lkey < 0) ? kwargs.length + lkey : lkey] : args[(typeof nvalue === "number" && nvalue < 0) ? args.length + nvalue : nvalue]; |
| 3764 |
if (object === undefined) { |
| 3765 |
if (isNaN(nvalue)) { |
| 3766 |
throw new KeyError(lkey); |
| 3767 |
} |
| 3768 |
throw new IndexError(lkey); |
| 3769 |
} |
| 3770 |
object = resolve(key.slice(lkey.length), object); |
| 3771 |
} else { |
| 3772 |
implicit = true; |
| 3773 |
if (explicit) { |
| 3774 |
throw new ValueError("cannot switch from manual field specification" + " to automatic field numbering"); |
| 3775 |
} |
| 3776 |
if (idx >= args.length) { |
| 3777 |
throw new IndexError("Not enough arguments to match template: " + template); |
| 3778 |
} |
| 3779 |
object = args[(typeof idx === "number" && idx < 0) ? args.length + idx : idx]; |
| 3780 |
idx += 1; |
| 3781 |
} |
| 3782 |
if (typeof object === "function") { |
| 3783 |
object = object(); |
| 3784 |
} |
| 3785 |
ans = "" + object; |
| 3786 |
if (format_spec) { |
| 3787 |
ans = apply_formatting(ans, format_spec); |
| 3788 |
} |
| 3789 |
if (ends_with_equal) { |
| 3790 |
ans = "" + ρσ_str.format("{}", key) + "=" + ρσ_str.format("{}", ans) + ""; |
| 3791 |
} |
| 3792 |
return ans; |
| 3793 |
}; |
| 3794 |
if (!render_markup.__argnames__) Object.defineProperties(render_markup, { |
| 3795 |
__argnames__ : {value: ["markup"]}, |
| 3796 |
__module__ : {value: "__main__"} |
| 3797 |
}); |
| 3798 |
|
| 3799 |
ans = ""; |
| 3800 |
pos = 0; |
| 3801 |
in_brace = 0; |
| 3802 |
markup = ""; |
| 3803 |
while (pos < template.length) { |
| 3804 |
ch = template[(typeof pos === "number" && pos < 0) ? template.length + pos : pos]; |
| 3805 |
if (in_brace) { |
| 3806 |
if (ch === "{") { |
| 3807 |
in_brace += 1; |
| 3808 |
markup += "{"; |
| 3809 |
} else if (ch === "}") { |
| 3810 |
in_brace -= 1; |
| 3811 |
if (in_brace > 0) { |
| 3812 |
markup += "}"; |
| 3813 |
} else { |
| 3814 |
ans += render_markup(markup); |
| 3815 |
} |
| 3816 |
} else { |
| 3817 |
markup += ch; |
| 3818 |
} |
| 3819 |
} else { |
| 3820 |
if (ch === "{") { |
| 3821 |
if (template[ρσ_bound_index(pos + 1, template)] === "{") { |
| 3822 |
pos += 1; |
| 3823 |
ans += "{"; |
| 3824 |
} else { |
| 3825 |
in_brace = 1; |
| 3826 |
markup = ""; |
| 3827 |
} |
| 3828 |
} else { |
| 3829 |
ans += ch; |
| 3830 |
if (ch === "}" && template[ρσ_bound_index(pos + 1, template)] === "}") { |
| 3831 |
pos += 1; |
| 3832 |
} |
| 3833 |
} |
| 3834 |
} |
| 3835 |
pos += 1; |
| 3836 |
} |
| 3837 |
if (in_brace) { |
| 3838 |
throw new ValueError("expected '}' before end of string"); |
| 3839 |
} |
| 3840 |
return ans; |
| 3841 |
}; |
| 3842 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 3843 |
__module__ : {value: "__main__"} |
| 3844 |
}); |
| 3845 |
return ρσ_anonfunc; |
| 3846 |
})()); |
| 3847 |
define_str_func("capitalize", (function() { |
| 3848 |
var ρσ_anonfunc = function () { |
| 3849 |
var string; |
| 3850 |
string = this; |
| 3851 |
if (string) { |
| 3852 |
string = string[0].toUpperCase() + string.slice(1).toLowerCase(); |
| 3853 |
} |
| 3854 |
return string; |
| 3855 |
}; |
| 3856 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 3857 |
__module__ : {value: "__main__"} |
| 3858 |
}); |
| 3859 |
return ρσ_anonfunc; |
| 3860 |
})()); |
| 3861 |
define_str_func("center", (function() { |
| 3862 |
var ρσ_anonfunc = function (width, fill) { |
| 3863 |
var left, right, left_pad, right_pad; |
| 3864 |
left = Math.floor((width - this.length) / 2); |
| 3865 |
right = width - left - this.length; |
| 3866 |
fill = fill || " "; |
| 3867 |
left_pad = new Array(left+1).join(fill); |
| 3868 |
right_pad = new Array(right+1).join(fill); |
| 3869 |
return left_pad + this + right_pad; |
| 3870 |
}; |
| 3871 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 3872 |
__argnames__ : {value: ["width", "fill"]}, |
| 3873 |
__module__ : {value: "__main__"} |
| 3874 |
}); |
| 3875 |
return ρσ_anonfunc; |
| 3876 |
})()); |
| 3877 |
define_str_func("count", (function() { |
| 3878 |
var ρσ_anonfunc = function (needle, start, end) { |
| 3879 |
var string, ρσ_unpack, pos, step, ans; |
| 3880 |
string = this; |
| 3881 |
start = start || 0; |
| 3882 |
end = end || string.length; |
| 3883 |
if (start < 0 || end < 0) { |
| 3884 |
string = string.slice(start, end); |
| 3885 |
ρσ_unpack = [0, string.length]; |
| 3886 |
start = ρσ_unpack[0]; |
| 3887 |
end = ρσ_unpack[1]; |
| 3888 |
} |
| 3889 |
pos = start; |
| 3890 |
step = needle.length; |
| 3891 |
if (!step) { |
| 3892 |
return 0; |
| 3893 |
} |
| 3894 |
ans = 0; |
| 3895 |
while (pos !== -1) { |
| 3896 |
pos = string.indexOf(needle, pos); |
| 3897 |
if (pos !== -1) { |
| 3898 |
ans += 1; |
| 3899 |
pos += step; |
| 3900 |
} |
| 3901 |
} |
| 3902 |
return ans; |
| 3903 |
}; |
| 3904 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 3905 |
__argnames__ : {value: ["needle", "start", "end"]}, |
| 3906 |
__module__ : {value: "__main__"} |
| 3907 |
}); |
| 3908 |
return ρσ_anonfunc; |
| 3909 |
})()); |
| 3910 |
define_str_func("endswith", (function() { |
| 3911 |
var ρσ_anonfunc = function (suffixes, start, end) { |
| 3912 |
var string, q; |
| 3913 |
string = this; |
| 3914 |
start = start || 0; |
| 3915 |
if (typeof suffixes === "string") { |
| 3916 |
suffixes = [suffixes]; |
| 3917 |
} |
| 3918 |
if (end !== undefined) { |
| 3919 |
string = string.slice(0, end); |
| 3920 |
} |
| 3921 |
for (var i = 0; i < suffixes.length; i++) { |
| 3922 |
q = suffixes[(typeof i === "number" && i < 0) ? suffixes.length + i : i]; |
| 3923 |
if (string.indexOf(q, Math.max(start, string.length - q.length)) !== -1) { |
| 3924 |
return true; |
| 3925 |
} |
| 3926 |
} |
| 3927 |
return false; |
| 3928 |
}; |
| 3929 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 3930 |
__argnames__ : {value: ["suffixes", "start", "end"]}, |
| 3931 |
__module__ : {value: "__main__"} |
| 3932 |
}); |
| 3933 |
return ρσ_anonfunc; |
| 3934 |
})()); |
| 3935 |
define_str_func("startswith", (function() { |
| 3936 |
var ρσ_anonfunc = function (prefixes, start, end) { |
| 3937 |
var prefix; |
| 3938 |
start = start || 0; |
| 3939 |
if (typeof prefixes === "string") { |
| 3940 |
prefixes = [prefixes]; |
| 3941 |
} |
| 3942 |
for (var i = 0; i < prefixes.length; i++) { |
| 3943 |
prefix = prefixes[(typeof i === "number" && i < 0) ? prefixes.length + i : i]; |
| 3944 |
end = (end === undefined) ? this.length : end; |
| 3945 |
if (end - start >= prefix.length && prefix === this.slice(start, start + prefix.length)) { |
| 3946 |
return true; |
| 3947 |
} |
| 3948 |
} |
| 3949 |
return false; |
| 3950 |
}; |
| 3951 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 3952 |
__argnames__ : {value: ["prefixes", "start", "end"]}, |
| 3953 |
__module__ : {value: "__main__"} |
| 3954 |
}); |
| 3955 |
return ρσ_anonfunc; |
| 3956 |
})()); |
| 3957 |
define_str_func("find", (function() { |
| 3958 |
var ρσ_anonfunc = function (needle, start, end) { |
| 3959 |
var ans; |
| 3960 |
while (start < 0) { |
| 3961 |
start += this.length; |
| 3962 |
} |
| 3963 |
ans = this.indexOf(needle, start); |
| 3964 |
if (end !== undefined && ans !== -1) { |
| 3965 |
while (end < 0) { |
| 3966 |
end += this.length; |
| 3967 |
} |
| 3968 |
if (ans >= end - needle.length) { |
| 3969 |
return -1; |
| 3970 |
} |
| 3971 |
} |
| 3972 |
return ans; |
| 3973 |
}; |
| 3974 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 3975 |
__argnames__ : {value: ["needle", "start", "end"]}, |
| 3976 |
__module__ : {value: "__main__"} |
| 3977 |
}); |
| 3978 |
return ρσ_anonfunc; |
| 3979 |
})()); |
| 3980 |
define_str_func("rfind", (function() { |
| 3981 |
var ρσ_anonfunc = function (needle, start, end) { |
| 3982 |
var ans; |
| 3983 |
while (end < 0) { |
| 3984 |
end += this.length; |
| 3985 |
} |
| 3986 |
ans = this.lastIndexOf(needle, end - 1); |
| 3987 |
if (start !== undefined && ans !== -1) { |
| 3988 |
while (start < 0) { |
| 3989 |
start += this.length; |
| 3990 |
} |
| 3991 |
if (ans < start) { |
| 3992 |
return -1; |
| 3993 |
} |
| 3994 |
} |
| 3995 |
return ans; |
| 3996 |
}; |
| 3997 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 3998 |
__argnames__ : {value: ["needle", "start", "end"]}, |
| 3999 |
__module__ : {value: "__main__"} |
| 4000 |
}); |
| 4001 |
return ρσ_anonfunc; |
| 4002 |
})()); |
| 4003 |
define_str_func("index", (function() { |
| 4004 |
var ρσ_anonfunc = function (needle, start, end) { |
| 4005 |
var ans; |
| 4006 |
ans = ρσ_str.prototype.find.apply(this, arguments); |
| 4007 |
if (ans === -1) { |
| 4008 |
throw new ValueError("substring not found"); |
| 4009 |
} |
| 4010 |
return ans; |
| 4011 |
}; |
| 4012 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4013 |
__argnames__ : {value: ["needle", "start", "end"]}, |
| 4014 |
__module__ : {value: "__main__"} |
| 4015 |
}); |
| 4016 |
return ρσ_anonfunc; |
| 4017 |
})()); |
| 4018 |
define_str_func("rindex", (function() { |
| 4019 |
var ρσ_anonfunc = function (needle, start, end) { |
| 4020 |
var ans; |
| 4021 |
ans = ρσ_str.prototype.rfind.apply(this, arguments); |
| 4022 |
if (ans === -1) { |
| 4023 |
throw new ValueError("substring not found"); |
| 4024 |
} |
| 4025 |
return ans; |
| 4026 |
}; |
| 4027 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4028 |
__argnames__ : {value: ["needle", "start", "end"]}, |
| 4029 |
__module__ : {value: "__main__"} |
| 4030 |
}); |
| 4031 |
return ρσ_anonfunc; |
| 4032 |
})()); |
| 4033 |
define_str_func("islower", (function() { |
| 4034 |
var ρσ_anonfunc = function () { |
| 4035 |
return this.length > 0 && this.toLowerCase() === this.toString(); |
| 4036 |
}; |
| 4037 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 4038 |
__module__ : {value: "__main__"} |
| 4039 |
}); |
| 4040 |
return ρσ_anonfunc; |
| 4041 |
})()); |
| 4042 |
define_str_func("isupper", (function() { |
| 4043 |
var ρσ_anonfunc = function () { |
| 4044 |
return this.length > 0 && this.toUpperCase() === this.toString(); |
| 4045 |
}; |
| 4046 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 4047 |
__module__ : {value: "__main__"} |
| 4048 |
}); |
| 4049 |
return ρσ_anonfunc; |
| 4050 |
})()); |
| 4051 |
define_str_func("isspace", (function() { |
| 4052 |
var ρσ_anonfunc = function () { |
| 4053 |
return this.length > 0 && /^\s+$/.test(this); |
| 4054 |
}; |
| 4055 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 4056 |
__module__ : {value: "__main__"} |
| 4057 |
}); |
| 4058 |
return ρσ_anonfunc; |
| 4059 |
})()); |
| 4060 |
define_str_func("join", (function() { |
| 4061 |
var ρσ_anonfunc = function (iterable) { |
| 4062 |
var ans, r; |
| 4063 |
if (Array.isArray(iterable)) { |
| 4064 |
return iterable.join(this); |
| 4065 |
} |
| 4066 |
ans = ""; |
| 4067 |
r = iterable.next(); |
| 4068 |
while (!r.done) { |
| 4069 |
if (ans) { |
| 4070 |
ans += this; |
| 4071 |
} |
| 4072 |
ans += r.value; |
| 4073 |
r = iterable.next(); |
| 4074 |
} |
| 4075 |
return ans; |
| 4076 |
}; |
| 4077 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4078 |
__argnames__ : {value: ["iterable"]}, |
| 4079 |
__module__ : {value: "__main__"} |
| 4080 |
}); |
| 4081 |
return ρσ_anonfunc; |
| 4082 |
})()); |
| 4083 |
define_str_func("ljust", (function() { |
| 4084 |
var ρσ_anonfunc = function (width, fill) { |
| 4085 |
var string; |
| 4086 |
string = this; |
| 4087 |
if (width > string.length) { |
| 4088 |
fill = fill || " "; |
| 4089 |
string += new Array(width - string.length + 1).join(fill); |
| 4090 |
} |
| 4091 |
return string; |
| 4092 |
}; |
| 4093 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4094 |
__argnames__ : {value: ["width", "fill"]}, |
| 4095 |
__module__ : {value: "__main__"} |
| 4096 |
}); |
| 4097 |
return ρσ_anonfunc; |
| 4098 |
})()); |
| 4099 |
define_str_func("rjust", (function() { |
| 4100 |
var ρσ_anonfunc = function (width, fill) { |
| 4101 |
var string; |
| 4102 |
string = this; |
| 4103 |
if (width > string.length) { |
| 4104 |
fill = fill || " "; |
| 4105 |
string = new Array(width - string.length + 1).join(fill) + string; |
| 4106 |
} |
| 4107 |
return string; |
| 4108 |
}; |
| 4109 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4110 |
__argnames__ : {value: ["width", "fill"]}, |
| 4111 |
__module__ : {value: "__main__"} |
| 4112 |
}); |
| 4113 |
return ρσ_anonfunc; |
| 4114 |
})()); |
| 4115 |
define_str_func("lower", (function() { |
| 4116 |
var ρσ_anonfunc = function () { |
| 4117 |
return this.toLowerCase(); |
| 4118 |
}; |
| 4119 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 4120 |
__module__ : {value: "__main__"} |
| 4121 |
}); |
| 4122 |
return ρσ_anonfunc; |
| 4123 |
})()); |
| 4124 |
define_str_func("upper", (function() { |
| 4125 |
var ρσ_anonfunc = function () { |
| 4126 |
return this.toUpperCase(); |
| 4127 |
}; |
| 4128 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 4129 |
__module__ : {value: "__main__"} |
| 4130 |
}); |
| 4131 |
return ρσ_anonfunc; |
| 4132 |
})()); |
| 4133 |
define_str_func("lstrip", (function() { |
| 4134 |
var ρσ_anonfunc = function (chars) { |
| 4135 |
var string, pos; |
| 4136 |
string = this; |
| 4137 |
pos = 0; |
| 4138 |
chars = chars || ρσ_str.whitespace; |
| 4139 |
while (chars.indexOf(string[(typeof pos === "number" && pos < 0) ? string.length + pos : pos]) !== -1) { |
| 4140 |
pos += 1; |
| 4141 |
} |
| 4142 |
if (pos) { |
| 4143 |
string = string.slice(pos); |
| 4144 |
} |
| 4145 |
return string; |
| 4146 |
}; |
| 4147 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4148 |
__argnames__ : {value: ["chars"]}, |
| 4149 |
__module__ : {value: "__main__"} |
| 4150 |
}); |
| 4151 |
return ρσ_anonfunc; |
| 4152 |
})()); |
| 4153 |
define_str_func("rstrip", (function() { |
| 4154 |
var ρσ_anonfunc = function (chars) { |
| 4155 |
var string, pos; |
| 4156 |
string = this; |
| 4157 |
pos = string.length - 1; |
| 4158 |
chars = chars || ρσ_str.whitespace; |
| 4159 |
while (chars.indexOf(string[(typeof pos === "number" && pos < 0) ? string.length + pos : pos]) !== -1) { |
| 4160 |
pos -= 1; |
| 4161 |
} |
| 4162 |
if (pos < string.length - 1) { |
| 4163 |
string = string.slice(0, pos + 1); |
| 4164 |
} |
| 4165 |
return string; |
| 4166 |
}; |
| 4167 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4168 |
__argnames__ : {value: ["chars"]}, |
| 4169 |
__module__ : {value: "__main__"} |
| 4170 |
}); |
| 4171 |
return ρσ_anonfunc; |
| 4172 |
})()); |
| 4173 |
define_str_func("strip", (function() { |
| 4174 |
var ρσ_anonfunc = function (chars) { |
| 4175 |
return ρσ_str.prototype.lstrip.call(ρσ_str.prototype.rstrip.call(this, chars), chars); |
| 4176 |
}; |
| 4177 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4178 |
__argnames__ : {value: ["chars"]}, |
| 4179 |
__module__ : {value: "__main__"} |
| 4180 |
}); |
| 4181 |
return ρσ_anonfunc; |
| 4182 |
})()); |
| 4183 |
define_str_func("partition", (function() { |
| 4184 |
var ρσ_anonfunc = function (sep) { |
| 4185 |
var idx; |
| 4186 |
idx = this.indexOf(sep); |
| 4187 |
if (idx === -1) { |
| 4188 |
return [this, "", ""]; |
| 4189 |
} |
| 4190 |
return [this.slice(0, idx), sep, this.slice(idx + sep.length)]; |
| 4191 |
}; |
| 4192 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4193 |
__argnames__ : {value: ["sep"]}, |
| 4194 |
__module__ : {value: "__main__"} |
| 4195 |
}); |
| 4196 |
return ρσ_anonfunc; |
| 4197 |
})()); |
| 4198 |
define_str_func("rpartition", (function() { |
| 4199 |
var ρσ_anonfunc = function (sep) { |
| 4200 |
var idx; |
| 4201 |
idx = this.lastIndexOf(sep); |
| 4202 |
if (idx === -1) { |
| 4203 |
return ["", "", this]; |
| 4204 |
} |
| 4205 |
return [this.slice(0, idx), sep, this.slice(idx + sep.length)]; |
| 4206 |
}; |
| 4207 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4208 |
__argnames__ : {value: ["sep"]}, |
| 4209 |
__module__ : {value: "__main__"} |
| 4210 |
}); |
| 4211 |
return ρσ_anonfunc; |
| 4212 |
})()); |
| 4213 |
define_str_func("replace", (function() { |
| 4214 |
var ρσ_anonfunc = function (old, repl, count) { |
| 4215 |
var string, pos, idx; |
| 4216 |
string = this; |
| 4217 |
if (count === 1) { |
| 4218 |
return ρσ_orig_replace(string, old, repl); |
| 4219 |
} |
| 4220 |
if (count < 1) { |
| 4221 |
return string; |
| 4222 |
} |
| 4223 |
count = count || Number.MAX_VALUE; |
| 4224 |
pos = 0; |
| 4225 |
while (count > 0) { |
| 4226 |
count -= 1; |
| 4227 |
idx = string.indexOf(old, pos); |
| 4228 |
if (idx === -1) { |
| 4229 |
break; |
| 4230 |
} |
| 4231 |
pos = idx + repl.length; |
| 4232 |
string = string.slice(0, idx) + repl + string.slice(idx + old.length); |
| 4233 |
} |
| 4234 |
return string; |
| 4235 |
}; |
| 4236 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4237 |
__argnames__ : {value: ["old", "repl", "count"]}, |
| 4238 |
__module__ : {value: "__main__"} |
| 4239 |
}); |
| 4240 |
return ρσ_anonfunc; |
| 4241 |
})()); |
| 4242 |
define_str_func("split", (function() { |
| 4243 |
var ρσ_anonfunc = function (sep, maxsplit) { |
| 4244 |
var split, ans, extra, parts; |
| 4245 |
if (maxsplit === 0) { |
| 4246 |
return [ this ]; |
| 4247 |
} |
| 4248 |
split = ρσ_orig_split; |
| 4249 |
if (sep === undefined || sep === null) { |
| 4250 |
if (maxsplit > 0) { |
| 4251 |
ans = split(this, /(\s+)/); |
| 4252 |
extra = ""; |
| 4253 |
parts = []; |
| 4254 |
for (var i = 0; i < ans.length; i++) { |
| 4255 |
if (parts.length >= maxsplit + 1) { |
| 4256 |
extra += ans[(typeof i === "number" && i < 0) ? ans.length + i : i]; |
| 4257 |
} else if (i % 2 === 0) { |
| 4258 |
parts.push(ans[(typeof i === "number" && i < 0) ? ans.length + i : i]); |
| 4259 |
} |
| 4260 |
} |
| 4261 |
parts[parts.length-1] += extra; |
| 4262 |
ans = parts; |
| 4263 |
} else { |
| 4264 |
ans = split(this, /\s+/); |
| 4265 |
} |
| 4266 |
} else { |
| 4267 |
if (sep === "") { |
| 4268 |
throw new ValueError("empty separator"); |
| 4269 |
} |
| 4270 |
ans = split(this, sep); |
| 4271 |
if (maxsplit > 0 && ans.length > maxsplit) { |
| 4272 |
extra = ans.slice(maxsplit).join(sep); |
| 4273 |
ans = ans.slice(0, maxsplit); |
| 4274 |
ans.push(extra); |
| 4275 |
} |
| 4276 |
} |
| 4277 |
return ans; |
| 4278 |
}; |
| 4279 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4280 |
__argnames__ : {value: ["sep", "maxsplit"]}, |
| 4281 |
__module__ : {value: "__main__"} |
| 4282 |
}); |
| 4283 |
return ρσ_anonfunc; |
| 4284 |
})()); |
| 4285 |
define_str_func("rsplit", (function() { |
| 4286 |
var ρσ_anonfunc = function (sep, maxsplit) { |
| 4287 |
var split, ans, is_space, pos, current, spc, ch, end, idx; |
| 4288 |
if (!maxsplit) { |
| 4289 |
return ρσ_str.prototype.split.call(this, sep); |
| 4290 |
} |
| 4291 |
split = ρσ_orig_split; |
| 4292 |
if (sep === undefined || sep === null) { |
| 4293 |
if (maxsplit > 0) { |
| 4294 |
ans = []; |
| 4295 |
is_space = /\s/; |
| 4296 |
pos = this.length - 1; |
| 4297 |
current = ""; |
| 4298 |
while (pos > -1 && maxsplit > 0) { |
| 4299 |
spc = false; |
| 4300 |
ch = (ρσ_expr_temp = this)[(typeof pos === "number" && pos < 0) ? ρσ_expr_temp.length + pos : pos]; |
| 4301 |
while (pos > -1 && is_space.test(ch)) { |
| 4302 |
spc = true; |
| 4303 |
ch = this[--pos]; |
| 4304 |
} |
| 4305 |
if (spc) { |
| 4306 |
if (current) { |
| 4307 |
ans.push(current); |
| 4308 |
maxsplit -= 1; |
| 4309 |
} |
| 4310 |
current = ch; |
| 4311 |
} else { |
| 4312 |
current += ch; |
| 4313 |
} |
| 4314 |
pos -= 1; |
| 4315 |
} |
| 4316 |
ans.push(this.slice(0, pos + 1) + current); |
| 4317 |
ans.reverse(); |
| 4318 |
} else { |
| 4319 |
ans = split(this, /\s+/); |
| 4320 |
} |
| 4321 |
} else { |
| 4322 |
if (sep === "") { |
| 4323 |
throw new ValueError("empty separator"); |
| 4324 |
} |
| 4325 |
ans = []; |
| 4326 |
pos = end = this.length; |
| 4327 |
while (pos > -1 && maxsplit > 0) { |
| 4328 |
maxsplit -= 1; |
| 4329 |
idx = this.lastIndexOf(sep, pos); |
| 4330 |
if (idx === -1) { |
| 4331 |
break; |
| 4332 |
} |
| 4333 |
ans.push(this.slice(idx + sep.length, end)); |
| 4334 |
pos = idx - 1; |
| 4335 |
end = idx; |
| 4336 |
} |
| 4337 |
ans.push(this.slice(0, end)); |
| 4338 |
ans.reverse(); |
| 4339 |
} |
| 4340 |
return ans; |
| 4341 |
}; |
| 4342 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4343 |
__argnames__ : {value: ["sep", "maxsplit"]}, |
| 4344 |
__module__ : {value: "__main__"} |
| 4345 |
}); |
| 4346 |
return ρσ_anonfunc; |
| 4347 |
})()); |
| 4348 |
define_str_func("splitlines", (function() { |
| 4349 |
var ρσ_anonfunc = function (keepends) { |
| 4350 |
var split, parts, ans; |
| 4351 |
split = ρσ_orig_split; |
| 4352 |
if (keepends) { |
| 4353 |
parts = split(this, /((?:\r?\n)|\r)/); |
| 4354 |
ans = []; |
| 4355 |
for (var i = 0; i < parts.length; i++) { |
| 4356 |
if (i % 2 === 0) { |
| 4357 |
ans.push(parts[(typeof i === "number" && i < 0) ? parts.length + i : i]); |
| 4358 |
} else { |
| 4359 |
ans[ans.length-1] += parts[(typeof i === "number" && i < 0) ? parts.length + i : i]; |
| 4360 |
} |
| 4361 |
} |
| 4362 |
} else { |
| 4363 |
ans = split(this, /(?:\r?\n)|\r/); |
| 4364 |
} |
| 4365 |
return ans; |
| 4366 |
}; |
| 4367 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4368 |
__argnames__ : {value: ["keepends"]}, |
| 4369 |
__module__ : {value: "__main__"} |
| 4370 |
}); |
| 4371 |
return ρσ_anonfunc; |
| 4372 |
})()); |
| 4373 |
define_str_func("swapcase", (function() { |
| 4374 |
var ρσ_anonfunc = function () { |
| 4375 |
var ans, a, b; |
| 4376 |
ans = new Array(this.length); |
| 4377 |
for (var i = 0; i < ans.length; i++) { |
| 4378 |
a = (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i]; |
| 4379 |
b = a.toLowerCase(); |
| 4380 |
if (a === b) { |
| 4381 |
b = a.toUpperCase(); |
| 4382 |
} |
| 4383 |
ans[(typeof i === "number" && i < 0) ? ans.length + i : i] = b; |
| 4384 |
} |
| 4385 |
return ans.join(""); |
| 4386 |
}; |
| 4387 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 4388 |
__module__ : {value: "__main__"} |
| 4389 |
}); |
| 4390 |
return ρσ_anonfunc; |
| 4391 |
})()); |
| 4392 |
define_str_func("zfill", (function() { |
| 4393 |
var ρσ_anonfunc = function (width) { |
| 4394 |
var string; |
| 4395 |
string = this; |
| 4396 |
if (width > string.length) { |
| 4397 |
string = new Array(width - string.length + 1).join("0") + string; |
| 4398 |
} |
| 4399 |
return string; |
| 4400 |
}; |
| 4401 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4402 |
__argnames__ : {value: ["width"]}, |
| 4403 |
__module__ : {value: "__main__"} |
| 4404 |
}); |
| 4405 |
return ρσ_anonfunc; |
| 4406 |
})()); |
| 4407 |
ρσ_str.uchrs = (function() { |
| 4408 |
var ρσ_anonfunc = function (string, with_positions) { |
| 4409 |
return (function(){ |
| 4410 |
var ρσ_d = {}; |
| 4411 |
ρσ_d["_string"] = string; |
| 4412 |
ρσ_d["_pos"] = 0; |
| 4413 |
ρσ_d[ρσ_iterator_symbol] = (function() { |
| 4414 |
var ρσ_anonfunc = function () { |
| 4415 |
return this; |
| 4416 |
}; |
| 4417 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 4418 |
__module__ : {value: "__main__"} |
| 4419 |
}); |
| 4420 |
return ρσ_anonfunc; |
| 4421 |
})(); |
| 4422 |
ρσ_d["next"] = (function() { |
| 4423 |
var ρσ_anonfunc = function () { |
| 4424 |
var length, pos, value, ans, extra; |
| 4425 |
length = this._string.length; |
| 4426 |
if (this._pos >= length) { |
| 4427 |
return (function(){ |
| 4428 |
var ρσ_d = {}; |
| 4429 |
ρσ_d["done"] = true; |
| 4430 |
return ρσ_d; |
| 4431 |
}).call(this); |
| 4432 |
} |
| 4433 |
pos = this._pos; |
| 4434 |
value = this._string.charCodeAt(this._pos++); |
| 4435 |
ans = "\ufffd"; |
| 4436 |
if (55296 <= value && value <= 56319) { |
| 4437 |
if (this._pos < length) { |
| 4438 |
extra = this._string.charCodeAt(this._pos++); |
| 4439 |
if ((extra & 56320) === 56320) { |
| 4440 |
ans = String.fromCharCode(value, extra); |
| 4441 |
} |
| 4442 |
} |
| 4443 |
} else if ((value & 56320) !== 56320) { |
| 4444 |
ans = String.fromCharCode(value); |
| 4445 |
} |
| 4446 |
if (with_positions) { |
| 4447 |
return (function(){ |
| 4448 |
var ρσ_d = {}; |
| 4449 |
ρσ_d["done"] = false; |
| 4450 |
ρσ_d["value"] = [ pos, ans ]; |
| 4451 |
return ρσ_d; |
| 4452 |
}).call(this); |
| 4453 |
} else { |
| 4454 |
return (function(){ |
| 4455 |
var ρσ_d = {}; |
| 4456 |
ρσ_d["done"] = false; |
| 4457 |
ρσ_d["value"] = ans; |
| 4458 |
return ρσ_d; |
| 4459 |
}).call(this); |
| 4460 |
} |
| 4461 |
}; |
| 4462 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 4463 |
__module__ : {value: "__main__"} |
| 4464 |
}); |
| 4465 |
return ρσ_anonfunc; |
| 4466 |
})(); |
| 4467 |
return ρσ_d; |
| 4468 |
}).call(this); |
| 4469 |
}; |
| 4470 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4471 |
__argnames__ : {value: ["string", "with_positions"]}, |
| 4472 |
__module__ : {value: "__main__"} |
| 4473 |
}); |
| 4474 |
return ρσ_anonfunc; |
| 4475 |
})(); |
| 4476 |
ρσ_str.uslice = (function() { |
| 4477 |
var ρσ_anonfunc = function (string, start, end) { |
| 4478 |
var items, iterator, r; |
| 4479 |
items = []; |
| 4480 |
iterator = ρσ_str.uchrs(string); |
| 4481 |
r = iterator.next(); |
| 4482 |
while (!r.done) { |
| 4483 |
items.push(r.value); |
| 4484 |
r = iterator.next(); |
| 4485 |
} |
| 4486 |
return items.slice(start || 0, (end === undefined) ? items.length : end).join(""); |
| 4487 |
}; |
| 4488 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4489 |
__argnames__ : {value: ["string", "start", "end"]}, |
| 4490 |
__module__ : {value: "__main__"} |
| 4491 |
}); |
| 4492 |
return ρσ_anonfunc; |
| 4493 |
})(); |
| 4494 |
ρσ_str.ulen = (function() { |
| 4495 |
var ρσ_anonfunc = function (string) { |
| 4496 |
var iterator, r, ans; |
| 4497 |
iterator = ρσ_str.uchrs(string); |
| 4498 |
r = iterator.next(); |
| 4499 |
ans = 0; |
| 4500 |
while (!r.done) { |
| 4501 |
r = iterator.next(); |
| 4502 |
ans += 1; |
| 4503 |
} |
| 4504 |
return ans; |
| 4505 |
}; |
| 4506 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4507 |
__argnames__ : {value: ["string"]}, |
| 4508 |
__module__ : {value: "__main__"} |
| 4509 |
}); |
| 4510 |
return ρσ_anonfunc; |
| 4511 |
})(); |
| 4512 |
ρσ_str.ascii_lowercase = "abcdefghijklmnopqrstuvwxyz"; |
| 4513 |
ρσ_str.ascii_uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
| 4514 |
ρσ_str.ascii_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
| 4515 |
ρσ_str.digits = "0123456789"; |
| 4516 |
ρσ_str.punctuation = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"; |
| 4517 |
ρσ_str.printable = "0123456789abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\u000b\f"; |
| 4518 |
ρσ_str.whitespace = " \t\n\r\u000b\f"; |
| 4519 |
define_str_func = undefined; |
| 4520 |
var str = ρσ_str, repr = ρσ_repr;; |
| 4521 |
var ρσ_modules = {}; |
| 4522 |
ρσ_modules.elementmaker = {}; |
| 4523 |
ρσ_modules.fs_images = {}; |
| 4524 |
ρσ_modules.live_css = {}; |
| 4525 |
ρσ_modules.qt = {}; |
| 4526 |
|
| 4527 |
(function(){ |
| 4528 |
var __name__ = "elementmaker"; |
| 4529 |
var html_elements, mathml_elements, svg_elements, html5_tags, E; |
| 4530 |
html_elements = (function(){ |
| 4531 |
var s = ρσ_set(); |
| 4532 |
s.jsset.add("a"); |
| 4533 |
s.jsset.add("abbr"); |
| 4534 |
s.jsset.add("acronym"); |
| 4535 |
s.jsset.add("address"); |
| 4536 |
s.jsset.add("area"); |
| 4537 |
s.jsset.add("article"); |
| 4538 |
s.jsset.add("aside"); |
| 4539 |
s.jsset.add("audio"); |
| 4540 |
s.jsset.add("b"); |
| 4541 |
s.jsset.add("base"); |
| 4542 |
s.jsset.add("big"); |
| 4543 |
s.jsset.add("body"); |
| 4544 |
s.jsset.add("blockquote"); |
| 4545 |
s.jsset.add("br"); |
| 4546 |
s.jsset.add("button"); |
| 4547 |
s.jsset.add("canvas"); |
| 4548 |
s.jsset.add("caption"); |
| 4549 |
s.jsset.add("center"); |
| 4550 |
s.jsset.add("cite"); |
| 4551 |
s.jsset.add("code"); |
| 4552 |
s.jsset.add("col"); |
| 4553 |
s.jsset.add("colgroup"); |
| 4554 |
s.jsset.add("command"); |
| 4555 |
s.jsset.add("datagrid"); |
| 4556 |
s.jsset.add("datalist"); |
| 4557 |
s.jsset.add("dd"); |
| 4558 |
s.jsset.add("del"); |
| 4559 |
s.jsset.add("details"); |
| 4560 |
s.jsset.add("dfn"); |
| 4561 |
s.jsset.add("dialog"); |
| 4562 |
s.jsset.add("dir"); |
| 4563 |
s.jsset.add("div"); |
| 4564 |
s.jsset.add("dl"); |
| 4565 |
s.jsset.add("dt"); |
| 4566 |
s.jsset.add("em"); |
| 4567 |
s.jsset.add("event-source"); |
| 4568 |
s.jsset.add("fieldset"); |
| 4569 |
s.jsset.add("figcaption"); |
| 4570 |
s.jsset.add("figure"); |
| 4571 |
s.jsset.add("footer"); |
| 4572 |
s.jsset.add("font"); |
| 4573 |
s.jsset.add("form"); |
| 4574 |
s.jsset.add("header"); |
| 4575 |
s.jsset.add("h1"); |
| 4576 |
s.jsset.add("h2"); |
| 4577 |
s.jsset.add("h3"); |
| 4578 |
s.jsset.add("h4"); |
| 4579 |
s.jsset.add("h5"); |
| 4580 |
s.jsset.add("h6"); |
| 4581 |
s.jsset.add("hr"); |
| 4582 |
s.jsset.add("head"); |
| 4583 |
s.jsset.add("i"); |
| 4584 |
s.jsset.add("iframe"); |
| 4585 |
s.jsset.add("img"); |
| 4586 |
s.jsset.add("input"); |
| 4587 |
s.jsset.add("ins"); |
| 4588 |
s.jsset.add("keygen"); |
| 4589 |
s.jsset.add("kbd"); |
| 4590 |
s.jsset.add("label"); |
| 4591 |
s.jsset.add("legend"); |
| 4592 |
s.jsset.add("li"); |
| 4593 |
s.jsset.add("m"); |
| 4594 |
s.jsset.add("map"); |
| 4595 |
s.jsset.add("menu"); |
| 4596 |
s.jsset.add("meter"); |
| 4597 |
s.jsset.add("multicol"); |
| 4598 |
s.jsset.add("nav"); |
| 4599 |
s.jsset.add("nextid"); |
| 4600 |
s.jsset.add("ol"); |
| 4601 |
s.jsset.add("output"); |
| 4602 |
s.jsset.add("optgroup"); |
| 4603 |
s.jsset.add("option"); |
| 4604 |
s.jsset.add("p"); |
| 4605 |
s.jsset.add("pre"); |
| 4606 |
s.jsset.add("progress"); |
| 4607 |
s.jsset.add("q"); |
| 4608 |
s.jsset.add("s"); |
| 4609 |
s.jsset.add("samp"); |
| 4610 |
s.jsset.add("script"); |
| 4611 |
s.jsset.add("section"); |
| 4612 |
s.jsset.add("select"); |
| 4613 |
s.jsset.add("small"); |
| 4614 |
s.jsset.add("sound"); |
| 4615 |
s.jsset.add("source"); |
| 4616 |
s.jsset.add("spacer"); |
| 4617 |
s.jsset.add("span"); |
| 4618 |
s.jsset.add("strike"); |
| 4619 |
s.jsset.add("strong"); |
| 4620 |
s.jsset.add("style"); |
| 4621 |
s.jsset.add("sub"); |
| 4622 |
s.jsset.add("sup"); |
| 4623 |
s.jsset.add("table"); |
| 4624 |
s.jsset.add("tbody"); |
| 4625 |
s.jsset.add("td"); |
| 4626 |
s.jsset.add("textarea"); |
| 4627 |
s.jsset.add("time"); |
| 4628 |
s.jsset.add("tfoot"); |
| 4629 |
s.jsset.add("th"); |
| 4630 |
s.jsset.add("thead"); |
| 4631 |
s.jsset.add("tr"); |
| 4632 |
s.jsset.add("tt"); |
| 4633 |
s.jsset.add("u"); |
| 4634 |
s.jsset.add("ul"); |
| 4635 |
s.jsset.add("var"); |
| 4636 |
s.jsset.add("video"); |
| 4637 |
return s; |
| 4638 |
})(); |
| 4639 |
mathml_elements = (function(){ |
| 4640 |
var s = ρσ_set(); |
| 4641 |
s.jsset.add("maction"); |
| 4642 |
s.jsset.add("math"); |
| 4643 |
s.jsset.add("merror"); |
| 4644 |
s.jsset.add("mfrac"); |
| 4645 |
s.jsset.add("mi"); |
| 4646 |
s.jsset.add("mmultiscripts"); |
| 4647 |
s.jsset.add("mn"); |
| 4648 |
s.jsset.add("mo"); |
| 4649 |
s.jsset.add("mover"); |
| 4650 |
s.jsset.add("mpadded"); |
| 4651 |
s.jsset.add("mphantom"); |
| 4652 |
s.jsset.add("mprescripts"); |
| 4653 |
s.jsset.add("mroot"); |
| 4654 |
s.jsset.add("mrow"); |
| 4655 |
s.jsset.add("mspace"); |
| 4656 |
s.jsset.add("msqrt"); |
| 4657 |
s.jsset.add("mstyle"); |
| 4658 |
s.jsset.add("msub"); |
| 4659 |
s.jsset.add("msubsup"); |
| 4660 |
s.jsset.add("msup"); |
| 4661 |
s.jsset.add("mtable"); |
| 4662 |
s.jsset.add("mtd"); |
| 4663 |
s.jsset.add("mtext"); |
| 4664 |
s.jsset.add("mtr"); |
| 4665 |
s.jsset.add("munder"); |
| 4666 |
s.jsset.add("munderover"); |
| 4667 |
s.jsset.add("none"); |
| 4668 |
return s; |
| 4669 |
})(); |
| 4670 |
svg_elements = (function(){ |
| 4671 |
var s = ρσ_set(); |
| 4672 |
s.jsset.add("a"); |
| 4673 |
s.jsset.add("animate"); |
| 4674 |
s.jsset.add("animateColor"); |
| 4675 |
s.jsset.add("animateMotion"); |
| 4676 |
s.jsset.add("animateTransform"); |
| 4677 |
s.jsset.add("clipPath"); |
| 4678 |
s.jsset.add("circle"); |
| 4679 |
s.jsset.add("defs"); |
| 4680 |
s.jsset.add("desc"); |
| 4681 |
s.jsset.add("ellipse"); |
| 4682 |
s.jsset.add("font-face"); |
| 4683 |
s.jsset.add("font-face-name"); |
| 4684 |
s.jsset.add("font-face-src"); |
| 4685 |
s.jsset.add("g"); |
| 4686 |
s.jsset.add("glyph"); |
| 4687 |
s.jsset.add("hkern"); |
| 4688 |
s.jsset.add("linearGradient"); |
| 4689 |
s.jsset.add("line"); |
| 4690 |
s.jsset.add("marker"); |
| 4691 |
s.jsset.add("metadata"); |
| 4692 |
s.jsset.add("missing-glyph"); |
| 4693 |
s.jsset.add("mpath"); |
| 4694 |
s.jsset.add("path"); |
| 4695 |
s.jsset.add("polygon"); |
| 4696 |
s.jsset.add("polyline"); |
| 4697 |
s.jsset.add("radialGradient"); |
| 4698 |
s.jsset.add("rect"); |
| 4699 |
s.jsset.add("set"); |
| 4700 |
s.jsset.add("stop"); |
| 4701 |
s.jsset.add("svg"); |
| 4702 |
s.jsset.add("switch"); |
| 4703 |
s.jsset.add("text"); |
| 4704 |
s.jsset.add("title"); |
| 4705 |
s.jsset.add("tspan"); |
| 4706 |
s.jsset.add("use"); |
| 4707 |
return s; |
| 4708 |
})(); |
| 4709 |
html5_tags = html_elements.union(mathml_elements).union(svg_elements); |
| 4710 |
function _makeelement() { |
| 4711 |
var tag = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0]; |
| 4712 |
var kwargs = arguments[arguments.length-1]; |
| 4713 |
if (kwargs === null || typeof kwargs !== "object" || kwargs [ρσ_kwargs_symbol] !== true) kwargs = {}; |
| 4714 |
var args = Array.prototype.slice.call(arguments, 1); |
| 4715 |
if (kwargs !== null && typeof kwargs === "object" && kwargs [ρσ_kwargs_symbol] === true) args.pop(); |
| 4716 |
var ans, vattr, val, attr, arg; |
| 4717 |
ans = this.createElement(tag); |
| 4718 |
var ρσ_Iter0 = kwargs; |
| 4719 |
ρσ_Iter0 = ((typeof ρσ_Iter0[Symbol.iterator] === "function") ? (ρσ_Iter0 instanceof Map ? ρσ_Iter0.keys() : ρσ_Iter0) : Object.keys(ρσ_Iter0)); |
| 4720 |
for (var ρσ_Index0 of ρσ_Iter0) { |
| 4721 |
attr = ρσ_Index0; |
| 4722 |
vattr = str.replace(str.rstrip(attr, "_"), "_", "-"); |
| 4723 |
val = kwargs[(typeof attr === "number" && attr < 0) ? kwargs.length + attr : attr]; |
| 4724 |
if (callable(val)) { |
| 4725 |
if (str.startswith(attr, "on")) { |
| 4726 |
attr = attr.slice(2); |
| 4727 |
} |
| 4728 |
ans.addEventListener(attr, val); |
| 4729 |
} else if (val === true) { |
| 4730 |
ans.setAttribute(vattr, vattr); |
| 4731 |
} else if (typeof val === "string") { |
| 4732 |
ans.setAttribute(vattr, val); |
| 4733 |
} |
| 4734 |
} |
| 4735 |
var ρσ_Iter1 = args; |
| 4736 |
ρσ_Iter1 = ((typeof ρσ_Iter1[Symbol.iterator] === "function") ? (ρσ_Iter1 instanceof Map ? ρσ_Iter1.keys() : ρσ_Iter1) : Object.keys(ρσ_Iter1)); |
| 4737 |
for (var ρσ_Index1 of ρσ_Iter1) { |
| 4738 |
arg = ρσ_Index1; |
| 4739 |
if (typeof arg === "string") { |
| 4740 |
arg = this.createTextNode(arg); |
| 4741 |
} |
| 4742 |
ans.appendChild(arg); |
| 4743 |
} |
| 4744 |
return ans; |
| 4745 |
}; |
| 4746 |
if (!_makeelement.__handles_kwarg_interpolation__) Object.defineProperties(_makeelement, { |
| 4747 |
__handles_kwarg_interpolation__ : {value: true}, |
| 4748 |
__argnames__ : {value: ["tag"]}, |
| 4749 |
__module__ : {value: "elementmaker"} |
| 4750 |
}); |
| 4751 |
|
| 4752 |
function maker_for_document(document) { |
| 4753 |
var E; |
| 4754 |
E = _makeelement.bind(document); |
| 4755 |
Object.defineProperties(E, (function() { |
| 4756 |
var ρσ_Iter = html5_tags, ρσ_Result = {}, tag; |
| 4757 |
ρσ_Iter = ((typeof ρσ_Iter[Symbol.iterator] === "function") ? (ρσ_Iter instanceof Map ? ρσ_Iter.keys() : ρσ_Iter) : Object.keys(ρσ_Iter)); |
| 4758 |
for (var ρσ_Index of ρσ_Iter) { |
| 4759 |
tag = ρσ_Index; |
| 4760 |
ρσ_Result[tag] = ((function(){ |
| 4761 |
var ρσ_d = {}; |
| 4762 |
ρσ_d["value"] = _makeelement.bind(document, tag); |
| 4763 |
return ρσ_d; |
| 4764 |
}).call(this)); |
| 4765 |
} |
| 4766 |
return ρσ_Result; |
| 4767 |
})()); |
| 4768 |
return E; |
| 4769 |
}; |
| 4770 |
if (!maker_for_document.__argnames__) Object.defineProperties(maker_for_document, { |
| 4771 |
__argnames__ : {value: ["document"]}, |
| 4772 |
__module__ : {value: "elementmaker"} |
| 4773 |
}); |
| 4774 |
|
| 4775 |
if (typeof document === "undefined") { |
| 4776 |
E = maker_for_document((function(){ |
| 4777 |
var ρσ_d = {}; |
| 4778 |
ρσ_d["createTextNode"] = (function() { |
| 4779 |
var ρσ_anonfunc = function (value) { |
| 4780 |
return value; |
| 4781 |
}; |
| 4782 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4783 |
__argnames__ : {value: ["value"]}, |
| 4784 |
__module__ : {value: "elementmaker"} |
| 4785 |
}); |
| 4786 |
return ρσ_anonfunc; |
| 4787 |
})(); |
| 4788 |
ρσ_d["createElement"] = (function() { |
| 4789 |
var ρσ_anonfunc = function (name) { |
| 4790 |
return (function(){ |
| 4791 |
var ρσ_d = {}; |
| 4792 |
ρσ_d["name"] = name; |
| 4793 |
ρσ_d["children"] = []; |
| 4794 |
ρσ_d["attributes"] = {}; |
| 4795 |
ρσ_d["setAttribute"] = (function() { |
| 4796 |
var ρσ_anonfunc = function (name, val) { |
| 4797 |
(ρσ_expr_temp = this.attributes)[(typeof name === "number" && name < 0) ? ρσ_expr_temp.length + name : name] = val; |
| 4798 |
}; |
| 4799 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4800 |
__argnames__ : {value: ["name", "val"]}, |
| 4801 |
__module__ : {value: "elementmaker"} |
| 4802 |
}); |
| 4803 |
return ρσ_anonfunc; |
| 4804 |
})(); |
| 4805 |
ρσ_d["appendChild"] = (function() { |
| 4806 |
var ρσ_anonfunc = function (child) { |
| 4807 |
this.children.push(child); |
| 4808 |
}; |
| 4809 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4810 |
__argnames__ : {value: ["child"]}, |
| 4811 |
__module__ : {value: "elementmaker"} |
| 4812 |
}); |
| 4813 |
return ρσ_anonfunc; |
| 4814 |
})(); |
| 4815 |
return ρσ_d; |
| 4816 |
}).call(this); |
| 4817 |
}; |
| 4818 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 4819 |
__argnames__ : {value: ["name"]}, |
| 4820 |
__module__ : {value: "elementmaker"} |
| 4821 |
}); |
| 4822 |
return ρσ_anonfunc; |
| 4823 |
})(); |
| 4824 |
return ρσ_d; |
| 4825 |
}).call(this)); |
| 4826 |
} else { |
| 4827 |
E = maker_for_document(document); |
| 4828 |
} |
| 4829 |
ρσ_modules.elementmaker.html_elements = html_elements; |
| 4830 |
ρσ_modules.elementmaker.mathml_elements = mathml_elements; |
| 4831 |
ρσ_modules.elementmaker.svg_elements = svg_elements; |
| 4832 |
ρσ_modules.elementmaker.html5_tags = html5_tags; |
| 4833 |
ρσ_modules.elementmaker.E = E; |
| 4834 |
ρσ_modules.elementmaker._makeelement = _makeelement; |
| 4835 |
ρσ_modules.elementmaker.maker_for_document = maker_for_document; |
| 4836 |
})(); |
| 4837 |
|
| 4838 |
(function(){ |
| 4839 |
var __name__ = "fs_images"; |
| 4840 |
function is_svg_fs_markup(names, svg) { |
| 4841 |
if (svg !== null) { |
| 4842 |
if (names.length === 2 || names.length === 3) { |
| 4843 |
if (names[names.length-1] === "image" && names[names.length-2] === "svg") { |
| 4844 |
if (names.length === 2 || names[0] === "div") { |
| 4845 |
if (svg.width === "100%" && svg.height === "100%") { |
| 4846 |
return true; |
| 4847 |
} |
| 4848 |
} |
| 4849 |
} |
| 4850 |
} |
| 4851 |
} |
| 4852 |
return false; |
| 4853 |
}; |
| 4854 |
if (!is_svg_fs_markup.__argnames__) Object.defineProperties(is_svg_fs_markup, { |
| 4855 |
__argnames__ : {value: ["names", "svg"]}, |
| 4856 |
__module__ : {value: "fs_images"} |
| 4857 |
}); |
| 4858 |
|
| 4859 |
function fix_fullscreen_svg_images() { |
| 4860 |
var child_names, name, node, names, svg; |
| 4861 |
child_names = []; |
| 4862 |
var ρσ_Iter2 = document.body.childNodes; |
| 4863 |
ρσ_Iter2 = ((typeof ρσ_Iter2[Symbol.iterator] === "function") ? (ρσ_Iter2 instanceof Map ? ρσ_Iter2.keys() : ρσ_Iter2) : Object.keys(ρσ_Iter2)); |
| 4864 |
for (var ρσ_Index2 of ρσ_Iter2) { |
| 4865 |
node = ρσ_Index2; |
| 4866 |
if (node.tagName) { |
| 4867 |
name = node.tagName.toLowerCase(); |
| 4868 |
if (name !== "style" && name !== "script") { |
| 4869 |
child_names.push(name); |
| 4870 |
} |
| 4871 |
if (child_names.length > 1) { |
| 4872 |
break; |
| 4873 |
} |
| 4874 |
} |
| 4875 |
} |
| 4876 |
if (child_names.length === 1 && (child_names[0] === "div" || child_names[0] === "svg")) { |
| 4877 |
names = []; |
| 4878 |
svg = null; |
| 4879 |
var ρσ_Iter3 = document.body.querySelectorAll("*"); |
| 4880 |
ρσ_Iter3 = ((typeof ρσ_Iter3[Symbol.iterator] === "function") ? (ρσ_Iter3 instanceof Map ? ρσ_Iter3.keys() : ρσ_Iter3) : Object.keys(ρσ_Iter3)); |
| 4881 |
for (var ρσ_Index3 of ρσ_Iter3) { |
| 4882 |
node = ρσ_Index3; |
| 4883 |
if (node.tagName) { |
| 4884 |
name = node.tagName.toLowerCase(); |
| 4885 |
if (name !== "style" && name !== "script") { |
| 4886 |
names.push(name); |
| 4887 |
if (name === "svg") { |
| 4888 |
svg = node; |
| 4889 |
} |
| 4890 |
} |
| 4891 |
} |
| 4892 |
} |
| 4893 |
if (is_svg_fs_markup(names, svg)) { |
| 4894 |
svg.setAttribute("width", "100vw"); |
| 4895 |
svg.setAttribute("height", "100vh"); |
| 4896 |
} |
| 4897 |
} |
| 4898 |
}; |
| 4899 |
if (!fix_fullscreen_svg_images.__module__) Object.defineProperties(fix_fullscreen_svg_images, { |
| 4900 |
__module__ : {value: "fs_images"} |
| 4901 |
}); |
| 4902 |
|
| 4903 |
ρσ_modules.fs_images.is_svg_fs_markup = is_svg_fs_markup; |
| 4904 |
ρσ_modules.fs_images.fix_fullscreen_svg_images = fix_fullscreen_svg_images; |
| 4905 |
})(); |
| 4906 |
|
| 4907 |
(function(){ |
| 4908 |
var __name__ = "live_css"; |
| 4909 |
var INHERITED_PROPS; |
| 4910 |
INHERITED_PROPS = (function(){ |
| 4911 |
var ρσ_d = Object.create(null); |
| 4912 |
ρσ_d["azimuth"] = "2"; |
| 4913 |
ρσ_d["border-collapse"] = "2"; |
| 4914 |
ρσ_d["border-spacing"] = "2"; |
| 4915 |
ρσ_d["caption-side"] = "2"; |
| 4916 |
ρσ_d["color"] = "2"; |
| 4917 |
ρσ_d["cursor"] = "2"; |
| 4918 |
ρσ_d["direction"] = "2"; |
| 4919 |
ρσ_d["elevation"] = "2"; |
| 4920 |
ρσ_d["empty-cells"] = "2"; |
| 4921 |
ρσ_d["fit"] = "3"; |
| 4922 |
ρσ_d["fit-position"] = "3"; |
| 4923 |
ρσ_d["font"] = "2"; |
| 4924 |
ρσ_d["font-family"] = "2"; |
| 4925 |
ρσ_d["font-size"] = "2"; |
| 4926 |
ρσ_d["font-size-adjust"] = "2"; |
| 4927 |
ρσ_d["font-stretch"] = "2"; |
| 4928 |
ρσ_d["font-style"] = "2"; |
| 4929 |
ρσ_d["font-variant"] = "2"; |
| 4930 |
ρσ_d["font-weight"] = "2"; |
| 4931 |
ρσ_d["hanging-punctuation"] = "3"; |
| 4932 |
ρσ_d["hyphenate-after"] = "3"; |
| 4933 |
ρσ_d["hyphenate-before"] = "3"; |
| 4934 |
ρσ_d["hyphenate-character"] = "3"; |
| 4935 |
ρσ_d["hyphenate-lines"] = "3"; |
| 4936 |
ρσ_d["hyphenate-resource"] = "3"; |
| 4937 |
ρσ_d["hyphens"] = "3"; |
| 4938 |
ρσ_d["image-resolution"] = "3"; |
| 4939 |
ρσ_d["letter-spacing"] = "2"; |
| 4940 |
ρσ_d["line-height"] = "2"; |
| 4941 |
ρσ_d["line-stacking"] = "3"; |
| 4942 |
ρσ_d["line-stacking-ruby"] = "3"; |
| 4943 |
ρσ_d["line-stacking-shift"] = "3"; |
| 4944 |
ρσ_d["line-stacking-strategy"] = "3"; |
| 4945 |
ρσ_d["list-style"] = "2"; |
| 4946 |
ρσ_d["list-style-image"] = "2"; |
| 4947 |
ρσ_d["list-style-position"] = "2"; |
| 4948 |
ρσ_d["list-style-type"] = "2"; |
| 4949 |
ρσ_d["marquee-direction"] = "3"; |
| 4950 |
ρσ_d["orphans"] = "2"; |
| 4951 |
ρσ_d["overflow-style"] = "3"; |
| 4952 |
ρσ_d["page"] = "2"; |
| 4953 |
ρσ_d["page-break-inside"] = "2"; |
| 4954 |
ρσ_d["pitch"] = "2"; |
| 4955 |
ρσ_d["pitch-range"] = "2"; |
| 4956 |
ρσ_d["presentation-level"] = "3"; |
| 4957 |
ρσ_d["punctuation-trim"] = "3"; |
| 4958 |
ρσ_d["quotes"] = "2"; |
| 4959 |
ρσ_d["richness"] = "2"; |
| 4960 |
ρσ_d["ruby-align"] = "3"; |
| 4961 |
ρσ_d["ruby-overhang"] = "3"; |
| 4962 |
ρσ_d["ruby-position"] = "3"; |
| 4963 |
ρσ_d["speak"] = "2"; |
| 4964 |
ρσ_d["speak-header"] = "2"; |
| 4965 |
ρσ_d["speak-numeral"] = "2"; |
| 4966 |
ρσ_d["speak-punctuation"] = "2"; |
| 4967 |
ρσ_d["speech-rate"] = "2"; |
| 4968 |
ρσ_d["stress"] = "2"; |
| 4969 |
ρσ_d["text-align"] = "2"; |
| 4970 |
ρσ_d["text-align-last"] = "3"; |
| 4971 |
ρσ_d["text-emphasis"] = "3"; |
| 4972 |
ρσ_d["text-height"] = "3"; |
| 4973 |
ρσ_d["text-indent"] = "2"; |
| 4974 |
ρσ_d["text-justify"] = "3"; |
| 4975 |
ρσ_d["text-outline"] = "3"; |
| 4976 |
ρσ_d["text-replace"] = "?"; |
| 4977 |
ρσ_d["text-shadow"] = "3"; |
| 4978 |
ρσ_d["text-transform"] = "2"; |
| 4979 |
ρσ_d["text-wrap"] = "3"; |
| 4980 |
ρσ_d["visibility"] = "2"; |
| 4981 |
ρσ_d["voice-balance"] = "3"; |
| 4982 |
ρσ_d["voice-family"] = "2"; |
| 4983 |
ρσ_d["voice-rate"] = "3"; |
| 4984 |
ρσ_d["voice-pitch"] = "3"; |
| 4985 |
ρσ_d["voice-pitch-range"] = "3"; |
| 4986 |
ρσ_d["voice-stress"] = "3"; |
| 4987 |
ρσ_d["voice-volume"] = "3"; |
| 4988 |
ρσ_d["volume"] = "2"; |
| 4989 |
ρσ_d["white-space"] = "2"; |
| 4990 |
ρσ_d["white-space-collapse"] = "3"; |
| 4991 |
ρσ_d["widows"] = "2"; |
| 4992 |
ρσ_d["word-break"] = "3"; |
| 4993 |
ρσ_d["word-spacing"] = "2"; |
| 4994 |
ρσ_d["word-wrap"] = "3"; |
| 4995 |
ρσ_d["-moz-force-broken-image-icon"] = "m"; |
| 4996 |
ρσ_d["-moz-image-region"] = "m"; |
| 4997 |
ρσ_d["-moz-stack-sizing"] = "m"; |
| 4998 |
ρσ_d["-moz-user-input"] = "m"; |
| 4999 |
ρσ_d["-x-system-font"] = "m"; |
| 5000 |
ρσ_d["-xv-voice-balance"] = "o"; |
| 5001 |
ρσ_d["-xv-voice-pitch"] = "o"; |
| 5002 |
ρσ_d["-xv-voice-pitch-range"] = "o"; |
| 5003 |
ρσ_d["-xv-voice-rate"] = "o"; |
| 5004 |
ρσ_d["-xv-voice-stress"] = "o"; |
| 5005 |
ρσ_d["-xv-voice-volume"] = "o"; |
| 5006 |
ρσ_d["-ms-text-align-last"] = "e"; |
| 5007 |
ρσ_d["-ms-text-justify"] = "e"; |
| 5008 |
ρσ_d["-ms-word-break"] = "e"; |
| 5009 |
ρσ_d["-ms-word-wrap"] = "e"; |
| 5010 |
return ρσ_d; |
| 5011 |
}).call(this); |
| 5012 |
function get_sourceline_address(node) { |
| 5013 |
var sourceline, tags, elem; |
| 5014 |
sourceline = parseInt(node.dataset.lnum); |
| 5015 |
tags = []; |
| 5016 |
var ρσ_Iter4 = document.querySelectorAll("[data-lnum=\"" + ρσ_str.format("{}", sourceline) + "\"]"); |
| 5017 |
ρσ_Iter4 = ((typeof ρσ_Iter4[Symbol.iterator] === "function") ? (ρσ_Iter4 instanceof Map ? ρσ_Iter4.keys() : ρσ_Iter4) : Object.keys(ρσ_Iter4)); |
| 5018 |
for (var ρσ_Index4 of ρσ_Iter4) { |
| 5019 |
elem = ρσ_Index4; |
| 5020 |
tags.push(elem.tagName.toLowerCase()); |
| 5021 |
if (elem === node) { |
| 5022 |
break; |
| 5023 |
} |
| 5024 |
} |
| 5025 |
return [ sourceline, tags ]; |
| 5026 |
}; |
| 5027 |
if (!get_sourceline_address.__argnames__) Object.defineProperties(get_sourceline_address, { |
| 5028 |
__argnames__ : {value: ["node"]}, |
| 5029 |
__module__ : {value: "live_css"} |
| 5030 |
}); |
| 5031 |
|
| 5032 |
function get_color(property, val) { |
| 5033 |
var color; |
| 5034 |
color = null; |
| 5035 |
if (property.indexOf("color") > -1) { |
| 5036 |
try { |
| 5037 |
color = window.parseCSSColor(val); |
| 5038 |
} catch (ρσ_Exception) { |
| 5039 |
ρσ_last_exception = ρσ_Exception; |
| 5040 |
{ |
| 5041 |
} |
| 5042 |
} |
| 5043 |
} |
| 5044 |
return color; |
| 5045 |
}; |
| 5046 |
if (!get_color.__argnames__) Object.defineProperties(get_color, { |
| 5047 |
__argnames__ : {value: ["property", "val"]}, |
| 5048 |
__module__ : {value: "live_css"} |
| 5049 |
}); |
| 5050 |
|
| 5051 |
function get_style_properties(style, all_properties, node_style, is_ancestor) { |
| 5052 |
var i, properties, property, val, cval; |
| 5053 |
i = 0; |
| 5054 |
properties = []; |
| 5055 |
while (i < style.length) { |
| 5056 |
property = style.item(i); |
| 5057 |
if (property) { |
| 5058 |
property = property.toLowerCase(); |
| 5059 |
val = style.getPropertyValue(property); |
| 5060 |
} else { |
| 5061 |
val = null; |
| 5062 |
} |
| 5063 |
if (property && val && (!is_ancestor || INHERITED_PROPS[(typeof property === "number" && property < 0) ? INHERITED_PROPS.length + property : property])) { |
| 5064 |
properties.push([ property, val, style.getPropertyPriority(property), get_color(property, val) ]); |
| 5065 |
if (!all_properties[(typeof property === "number" && property < 0) ? all_properties.length + property : property]) { |
| 5066 |
cval = node_style.getPropertyValue(property); |
| 5067 |
cval; |
| 5068 |
all_properties[(typeof property === "number" && property < 0) ? all_properties.length + property : property] = [ cval, get_color(property, cval) ]; |
| 5069 |
} |
| 5070 |
} |
| 5071 |
i += 1; |
| 5072 |
} |
| 5073 |
return properties; |
| 5074 |
}; |
| 5075 |
if (!get_style_properties.__argnames__) Object.defineProperties(get_style_properties, { |
| 5076 |
__argnames__ : {value: ["style", "all_properties", "node_style", "is_ancestor"]}, |
| 5077 |
__module__ : {value: "live_css"} |
| 5078 |
}); |
| 5079 |
|
| 5080 |
function get_sheet_rules(sheet) { |
| 5081 |
var sheet_media; |
| 5082 |
if (sheet.disabled || !sheet.cssRules) { |
| 5083 |
return []; |
| 5084 |
} |
| 5085 |
sheet_media = sheet.media && sheet.media.mediaText; |
| 5086 |
if (sheet_media && sheet_media.length && !window.matchMedia(sheet_media).matches) { |
| 5087 |
return []; |
| 5088 |
} |
| 5089 |
return sheet.cssRules; |
| 5090 |
}; |
| 5091 |
if (!get_sheet_rules.__argnames__) Object.defineProperties(get_sheet_rules, { |
| 5092 |
__argnames__ : {value: ["sheet"]}, |
| 5093 |
__module__ : {value: "live_css"} |
| 5094 |
}); |
| 5095 |
|
| 5096 |
function selector_matches(node, selector) { |
| 5097 |
var sanitized_sel; |
| 5098 |
try { |
| 5099 |
return node.matches(selector); |
| 5100 |
} catch (ρσ_Exception) { |
| 5101 |
ρσ_last_exception = ρσ_Exception; |
| 5102 |
{ |
| 5103 |
if (ρσ_in("epub|", selector)) { |
| 5104 |
sanitized_sel = str.replace(selector, "epub|", "*|"); |
| 5105 |
try { |
| 5106 |
return node.matches(sanitized_sel); |
| 5107 |
} catch (ρσ_Exception) { |
| 5108 |
ρσ_last_exception = ρσ_Exception; |
| 5109 |
{ |
| 5110 |
return false; |
| 5111 |
} |
| 5112 |
} |
| 5113 |
} |
| 5114 |
return false; |
| 5115 |
} |
| 5116 |
} |
| 5117 |
}; |
| 5118 |
if (!selector_matches.__argnames__) Object.defineProperties(selector_matches, { |
| 5119 |
__argnames__ : {value: ["node", "selector"]}, |
| 5120 |
__module__ : {value: "live_css"} |
| 5121 |
}); |
| 5122 |
|
| 5123 |
function process_rules(node, rules, address, sheet, sheet_index, all_properties, node_style, is_ancestor, ans) { |
| 5124 |
var offset, rule, rule_address, st, type, href, parts, q, properties, data, rule_index; |
| 5125 |
offset = 0; |
| 5126 |
for (var ρσ_Index5 = 0; ρσ_Index5 < rules.length; ρσ_Index5++) { |
| 5127 |
rule_index = ρσ_Index5; |
| 5128 |
rule = rules[(typeof rule_index === "number" && rule_index < 0) ? rules.length + rule_index : rule_index]; |
| 5129 |
rule_address = address.concat([ rule_index - offset ]); |
| 5130 |
if (rule.type === CSSRule.MEDIA_RULE) { |
| 5131 |
process_rules(node, rule.cssRules, rule_address, sheet, sheet_index, all_properties, node_style, is_ancestor, ans); |
| 5132 |
continue; |
| 5133 |
} |
| 5134 |
if (rule.type !== CSSRule.STYLE_RULE) { |
| 5135 |
if (rule.type === CSSRule.NAMESPACE_RULE) { |
| 5136 |
offset += 1; |
| 5137 |
} |
| 5138 |
continue; |
| 5139 |
} |
| 5140 |
st = rule.selectorText; |
| 5141 |
if (!selector_matches(node, st)) { |
| 5142 |
continue; |
| 5143 |
} |
| 5144 |
type = "sheet"; |
| 5145 |
href = sheet.href; |
| 5146 |
if (!href) { |
| 5147 |
href = get_sourceline_address(sheet.ownerNode); |
| 5148 |
type = "elem"; |
| 5149 |
} |
| 5150 |
parts = st.split(","); |
| 5151 |
if (parts.length > 1) { |
| 5152 |
var ρσ_Iter6 = parts; |
| 5153 |
ρσ_Iter6 = ((typeof ρσ_Iter6[Symbol.iterator] === "function") ? (ρσ_Iter6 instanceof Map ? ρσ_Iter6.keys() : ρσ_Iter6) : Object.keys(ρσ_Iter6)); |
| 5154 |
for (var ρσ_Index6 of ρσ_Iter6) { |
| 5155 |
q = ρσ_Index6; |
| 5156 |
if (selector_matches(node, q)) { |
| 5157 |
st = q; |
| 5158 |
break; |
| 5159 |
} |
| 5160 |
} |
| 5161 |
} |
| 5162 |
properties = get_style_properties(rule.style, all_properties, node_style, is_ancestor); |
| 5163 |
if (properties.length > 0) { |
| 5164 |
data = (function(){ |
| 5165 |
var ρσ_d = Object.create(null); |
| 5166 |
ρσ_d["selector"] = st; |
| 5167 |
ρσ_d["type"] = type; |
| 5168 |
ρσ_d["href"] = href; |
| 5169 |
ρσ_d["properties"] = properties; |
| 5170 |
ρσ_d["rule_address"] = rule_address; |
| 5171 |
ρσ_d["sheet_index"] = sheet_index; |
| 5172 |
return ρσ_d; |
| 5173 |
}).call(this); |
| 5174 |
ans.push(data); |
| 5175 |
} |
| 5176 |
} |
| 5177 |
}; |
| 5178 |
if (!process_rules.__argnames__) Object.defineProperties(process_rules, { |
| 5179 |
__argnames__ : {value: ["node", "rules", "address", "sheet", "sheet_index", "all_properties", "node_style", "is_ancestor", "ans"]}, |
| 5180 |
__module__ : {value: "live_css"} |
| 5181 |
}); |
| 5182 |
|
| 5183 |
function get_matched_css(node, is_ancestor, all_properties) { |
| 5184 |
var ans, node_style, sheets, sheet, sheet_index, properties, data; |
| 5185 |
ans = []; |
| 5186 |
node_style = window.getComputedStyle(node); |
| 5187 |
sheets = document.styleSheets; |
| 5188 |
for (var ρσ_Index7 = 0; ρσ_Index7 < sheets.length; ρσ_Index7++) { |
| 5189 |
sheet_index = ρσ_Index7; |
| 5190 |
sheet = sheets[(typeof sheet_index === "number" && sheet_index < 0) ? sheets.length + sheet_index : sheet_index]; |
| 5191 |
process_rules(node, get_sheet_rules(sheet), [], sheet, sheet_index, all_properties, node_style, is_ancestor, ans); |
| 5192 |
} |
| 5193 |
if (node.getAttribute("style")) { |
| 5194 |
properties = get_style_properties(node.style, all_properties, node_style, is_ancestor); |
| 5195 |
if (properties.length > 0) { |
| 5196 |
data = (function(){ |
| 5197 |
var ρσ_d = Object.create(null); |
| 5198 |
ρσ_d["selector"] = null; |
| 5199 |
ρσ_d["type"] = "inline"; |
| 5200 |
ρσ_d["href"] = get_sourceline_address(node); |
| 5201 |
ρσ_d["properties"] = properties; |
| 5202 |
ρσ_d["rule_address"] = null; |
| 5203 |
ρσ_d["sheet_index"] = null; |
| 5204 |
return ρσ_d; |
| 5205 |
}).call(this); |
| 5206 |
ans.push(data); |
| 5207 |
} |
| 5208 |
} |
| 5209 |
return ans.reverse(); |
| 5210 |
}; |
| 5211 |
if (!get_matched_css.__argnames__) Object.defineProperties(get_matched_css, { |
| 5212 |
__argnames__ : {value: ["node", "is_ancestor", "all_properties"]}, |
| 5213 |
__module__ : {value: "live_css"} |
| 5214 |
}); |
| 5215 |
|
| 5216 |
ρσ_modules.live_css.INHERITED_PROPS = INHERITED_PROPS; |
| 5217 |
ρσ_modules.live_css.get_sourceline_address = get_sourceline_address; |
| 5218 |
ρσ_modules.live_css.get_color = get_color; |
| 5219 |
ρσ_modules.live_css.get_style_properties = get_style_properties; |
| 5220 |
ρσ_modules.live_css.get_sheet_rules = get_sheet_rules; |
| 5221 |
ρσ_modules.live_css.selector_matches = selector_matches; |
| 5222 |
ρσ_modules.live_css.process_rules = process_rules; |
| 5223 |
ρσ_modules.live_css.get_matched_css = get_matched_css; |
| 5224 |
})(); |
| 5225 |
|
| 5226 |
(function(){ |
| 5227 |
var __name__ = "qt"; |
| 5228 |
var special_title, slots, to_python; |
| 5229 |
special_title = "__webengine_messages_pending__"; |
| 5230 |
slots = Object.create(null); |
| 5231 |
function ping(suffix) { |
| 5232 |
document.title = special_title + suffix; |
| 5233 |
}; |
| 5234 |
if (!ping.__argnames__) Object.defineProperties(ping, { |
| 5235 |
__argnames__ : {value: ["suffix"]}, |
| 5236 |
__module__ : {value: "qt"} |
| 5237 |
}); |
| 5238 |
|
| 5239 |
function signal() { |
| 5240 |
var args; |
| 5241 |
args = Array.from(arguments); |
| 5242 |
to_python._queue_message((function(){ |
| 5243 |
var ρσ_d = Object.create(null); |
| 5244 |
ρσ_d["type"] = "signal"; |
| 5245 |
ρσ_d["name"] = this; |
| 5246 |
ρσ_d["args"] = args; |
| 5247 |
return ρσ_d; |
| 5248 |
}).call(this)); |
| 5249 |
}; |
| 5250 |
if (!signal.__module__) Object.defineProperties(signal, { |
| 5251 |
__module__ : {value: "qt"} |
| 5252 |
}); |
| 5253 |
|
| 5254 |
function ToPython() { |
| 5255 |
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter}); |
| 5256 |
ToPython.prototype.__bind_methods__.call(this); |
| 5257 |
ToPython.prototype.__init__.apply(this, arguments); |
| 5258 |
} |
| 5259 |
Object.defineProperty(ToPython.prototype, "__bind_methods__", {value: function () { |
| 5260 |
this._ping = ToPython.prototype._ping.bind(this); |
| 5261 |
this._queue_message = ToPython.prototype._queue_message.bind(this); |
| 5262 |
this._register_signals = ToPython.prototype._register_signals.bind(this); |
| 5263 |
this._poll = ToPython.prototype._poll.bind(this); |
| 5264 |
this._from_python = ToPython.prototype._from_python.bind(this); |
| 5265 |
}}); |
| 5266 |
ToPython.prototype.__init__ = function __init__() { |
| 5267 |
var self = this; |
| 5268 |
self._messages = []; |
| 5269 |
self._last_ping_value = 0; |
| 5270 |
self._ping_timer_id = -1; |
| 5271 |
self._queue_message((function(){ |
| 5272 |
var ρσ_d = Object.create(null); |
| 5273 |
ρσ_d["type"] = "qt-ready"; |
| 5274 |
return ρσ_d; |
| 5275 |
}).call(this)); |
| 5276 |
}; |
| 5277 |
if (!ToPython.prototype.__init__.__module__) Object.defineProperties(ToPython.prototype.__init__, { |
| 5278 |
__module__ : {value: "qt"} |
| 5279 |
}); |
| 5280 |
ToPython.__argnames__ = ToPython.prototype.__init__.__argnames__; |
| 5281 |
ToPython.__handles_kwarg_interpolation__ = ToPython.prototype.__init__.__handles_kwarg_interpolation__; |
| 5282 |
ToPython.prototype._ping = function _ping() { |
| 5283 |
var self = this; |
| 5284 |
if (self._ping_timer_id < 0) { |
| 5285 |
self._last_ping_value = (self._last_ping_value) ? 0 : 1; |
| 5286 |
self._ping_timer_id = setTimeout((function() { |
| 5287 |
var ρσ_anonfunc = function () { |
| 5288 |
ping(self._last_ping_value); |
| 5289 |
self._ping_timer_id = -1; |
| 5290 |
}; |
| 5291 |
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, { |
| 5292 |
__module__ : {value: "qt"} |
| 5293 |
}); |
| 5294 |
return ρσ_anonfunc; |
| 5295 |
})(), 0); |
| 5296 |
} |
| 5297 |
}; |
| 5298 |
if (!ToPython.prototype._ping.__module__) Object.defineProperties(ToPython.prototype._ping, { |
| 5299 |
__module__ : {value: "qt"} |
| 5300 |
}); |
| 5301 |
ToPython.prototype._queue_message = function _queue_message(msg) { |
| 5302 |
var self = this; |
| 5303 |
self._messages.push(msg); |
| 5304 |
self._ping(); |
| 5305 |
}; |
| 5306 |
if (!ToPython.prototype._queue_message.__argnames__) Object.defineProperties(ToPython.prototype._queue_message, { |
| 5307 |
__argnames__ : {value: ["msg"]}, |
| 5308 |
__module__ : {value: "qt"} |
| 5309 |
}); |
| 5310 |
ToPython.prototype._register_signals = function _register_signals(signals) { |
| 5311 |
var self = this; |
| 5312 |
var signal_name; |
| 5313 |
var ρσ_Iter8 = signals; |
| 5314 |
ρσ_Iter8 = ((typeof ρσ_Iter8[Symbol.iterator] === "function") ? (ρσ_Iter8 instanceof Map ? ρσ_Iter8.keys() : ρσ_Iter8) : Object.keys(ρσ_Iter8)); |
| 5315 |
for (var ρσ_Index8 of ρσ_Iter8) { |
| 5316 |
signal_name = ρσ_Index8; |
| 5317 |
self[(typeof signal_name === "number" && signal_name < 0) ? self.length + signal_name : signal_name] = signal.bind(signal_name); |
| 5318 |
} |
| 5319 |
}; |
| 5320 |
if (!ToPython.prototype._register_signals.__argnames__) Object.defineProperties(ToPython.prototype._register_signals, { |
| 5321 |
__argnames__ : {value: ["signals"]}, |
| 5322 |
__module__ : {value: "qt"} |
| 5323 |
}); |
| 5324 |
ToPython.prototype._poll = function _poll() { |
| 5325 |
var self = this; |
| 5326 |
var ans; |
| 5327 |
ans = self._messages; |
| 5328 |
self._messages = []; |
| 5329 |
return ans; |
| 5330 |
}; |
| 5331 |
if (!ToPython.prototype._poll.__module__) Object.defineProperties(ToPython.prototype._poll, { |
| 5332 |
__module__ : {value: "qt"} |
| 5333 |
}); |
| 5334 |
ToPython.prototype._from_python = function _from_python(name, args) { |
| 5335 |
var self = this; |
| 5336 |
var callback; |
| 5337 |
callback = slots[(typeof name === "number" && name < 0) ? slots.length + name : name]; |
| 5338 |
if (callback) { |
| 5339 |
callback.apply(null, args); |
| 5340 |
} else { |
| 5341 |
console.warn("Attempt to call non-existent python-to-js slot named: " + ρσ_str.format("{}", name) + ""); |
| 5342 |
} |
| 5343 |
}; |
| 5344 |
if (!ToPython.prototype._from_python.__argnames__) Object.defineProperties(ToPython.prototype._from_python, { |
| 5345 |
__argnames__ : {value: ["name", "args"]}, |
| 5346 |
__module__ : {value: "qt"} |
| 5347 |
}); |
| 5348 |
ToPython.prototype.__repr__ = function __repr__ () { |
| 5349 |
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">"; |
| 5350 |
}; |
| 5351 |
ToPython.prototype.__str__ = function __str__ () { |
| 5352 |
return this.__repr__(); |
| 5353 |
}; |
| 5354 |
Object.defineProperty(ToPython.prototype, "__bases__", {value: []}); |
| 5355 |
|
| 5356 |
to_python = null; |
| 5357 |
if (window === window.top) { |
| 5358 |
window.python_comm = to_python = new ToPython; |
| 5359 |
} |
| 5360 |
function from_python(func) { |
| 5361 |
slots[ρσ_bound_index(func.name, slots)] = func; |
| 5362 |
return func; |
| 5363 |
}; |
| 5364 |
if (!from_python.__argnames__) Object.defineProperties(from_python, { |
| 5365 |
__argnames__ : {value: ["func"]}, |
| 5366 |
__module__ : {value: "qt"} |
| 5367 |
}); |
| 5368 |
|
| 5369 |
ρσ_modules.qt.special_title = special_title; |
| 5370 |
ρσ_modules.qt.slots = slots; |
| 5371 |
ρσ_modules.qt.to_python = to_python; |
| 5372 |
ρσ_modules.qt.ping = ping; |
| 5373 |
ρσ_modules.qt.signal = signal; |
| 5374 |
ρσ_modules.qt.ToPython = ToPython; |
| 5375 |
ρσ_modules.qt.from_python = from_python; |
| 5376 |
})(); |
| 5377 |
|
| 5378 |
(function(){ |
| 5379 |
|
| 5380 |
var __name__ = "__main__"; |
| 5381 |
|
| 5382 |
|
| 5383 |
var FAKE_HOST, FAKE_PROTOCOL, state, settings, css; |
| 5384 |
var E = ρσ_modules.elementmaker.E; |
| 5385 |
|
| 5386 |
var fix_fullscreen_svg_images = ρσ_modules.fs_images.fix_fullscreen_svg_images; |
| 5387 |
|
| 5388 |
var get_matched_css = ρσ_modules.live_css.get_matched_css; |
| 5389 |
var get_sourceline_address = ρσ_modules.live_css.get_sourceline_address; |
| 5390 |
|
| 5391 |
var from_python = ρσ_modules.qt.from_python; |
| 5392 |
var to_python = ρσ_modules.qt.to_python; |
| 5393 |
|
| 5394 |
FAKE_HOST = "internal.invalid"; |
| 5395 |
FAKE_PROTOCOL = "clbr"; |
| 5396 |
function is_hidden(elem) { |
| 5397 |
while (elem) { |
| 5398 |
if (elem.style && (elem.style.visibility === "hidden" || elem.style.display === "none")) { |
| 5399 |
return true; |
| 5400 |
} |
| 5401 |
elem = elem.parentNode; |
| 5402 |
} |
| 5403 |
return false; |
| 5404 |
}; |
| 5405 |
if (!is_hidden.__argnames__) Object.defineProperties(is_hidden, { |
| 5406 |
__argnames__ : {value: ["elem"]}, |
| 5407 |
__module__ : {value: null} |
| 5408 |
}); |
| 5409 |
|
| 5410 |
function is_block(elem) { |
| 5411 |
var style; |
| 5412 |
style = window.getComputedStyle(elem); |
| 5413 |
return style.display === "block" || style.display === "flex-box" || style.display === "box"; |
| 5414 |
}; |
| 5415 |
if (!is_block.__argnames__) Object.defineProperties(is_block, { |
| 5416 |
__argnames__ : {value: ["elem"]}, |
| 5417 |
__module__ : {value: null} |
| 5418 |
}); |
| 5419 |
|
| 5420 |
function in_table(elem) { |
| 5421 |
var tn; |
| 5422 |
while (elem) { |
| 5423 |
tn = (elem.tagName) ? elem.tagName.toLowerCase() : ""; |
| 5424 |
if (tn === "table") { |
| 5425 |
return true; |
| 5426 |
} |
| 5427 |
elem = elem.parentNode; |
| 5428 |
} |
| 5429 |
return false; |
| 5430 |
}; |
| 5431 |
if (!in_table.__argnames__) Object.defineProperties(in_table, { |
| 5432 |
__argnames__ : {value: ["elem"]}, |
| 5433 |
__module__ : {value: null} |
| 5434 |
}); |
| 5435 |
|
| 5436 |
function find_containing_block(elem) { |
| 5437 |
while (elem && elem.dataset.isBlock !== "1") { |
| 5438 |
elem = elem.parentNode; |
| 5439 |
} |
| 5440 |
return elem; |
| 5441 |
}; |
| 5442 |
if (!find_containing_block.__argnames__) Object.defineProperties(find_containing_block, { |
| 5443 |
__argnames__ : {value: ["elem"]}, |
| 5444 |
__module__ : {value: null} |
| 5445 |
}); |
| 5446 |
|
| 5447 |
function line_height() { |
| 5448 |
var ans, ds, lh; |
| 5449 |
ans = line_height.ans; |
| 5450 |
if (!ans) { |
| 5451 |
ds = window.getComputedStyle(document.body); |
| 5452 |
try { |
| 5453 |
lh = float(ds.lineHeight); |
| 5454 |
} catch (ρσ_Exception) { |
| 5455 |
ρσ_last_exception = ρσ_Exception; |
| 5456 |
{ |
| 5457 |
try { |
| 5458 |
lh = 1.2 * float(ds.fontSize); |
| 5459 |
} catch (ρσ_Exception) { |
| 5460 |
ρσ_last_exception = ρσ_Exception; |
| 5461 |
{ |
| 5462 |
lh = 15; |
| 5463 |
} |
| 5464 |
} |
| 5465 |
} |
| 5466 |
} |
| 5467 |
ans = line_height.ans = max(5, lh); |
| 5468 |
} |
| 5469 |
return ans; |
| 5470 |
}; |
| 5471 |
if (!line_height.__module__) Object.defineProperties(line_height, { |
| 5472 |
__module__ : {value: null} |
| 5473 |
}); |
| 5474 |
|
| 5475 |
function scroll_to_node(node, sync_context) { |
| 5476 |
if (node === document.body) { |
| 5477 |
window.scrollTo(0, 0); |
| 5478 |
} else { |
| 5479 |
node.scrollIntoView(); |
| 5480 |
if (sync_context) { |
| 5481 |
window.scrollBy(0, -sync_context * line_height()); |
| 5482 |
} |
| 5483 |
} |
| 5484 |
}; |
| 5485 |
if (!scroll_to_node.__argnames__) Object.defineProperties(scroll_to_node, { |
| 5486 |
__argnames__ : {value: ["node", "sync_context"]}, |
| 5487 |
__module__ : {value: null} |
| 5488 |
}); |
| 5489 |
|
| 5490 |
state = (function(){ |
| 5491 |
var ρσ_d = Object.create(null); |
| 5492 |
ρσ_d["blocks_found"] = false; |
| 5493 |
ρσ_d["in_split_mode"] = false; |
| 5494 |
return ρσ_d; |
| 5495 |
}).call(this); |
| 5496 |
function go_to_line(lnum, sync_context) { |
| 5497 |
var node; |
| 5498 |
var ρσ_Iter9 = document.querySelectorAll("[data-lnum=\"" + ρσ_str.format("{}", lnum) + "\"]"); |
| 5499 |
ρσ_Iter9 = ((typeof ρσ_Iter9[Symbol.iterator] === "function") ? (ρσ_Iter9 instanceof Map ? ρσ_Iter9.keys() : ρσ_Iter9) : Object.keys(ρσ_Iter9)); |
| 5500 |
for (var ρσ_Index9 of ρσ_Iter9) { |
| 5501 |
node = ρσ_Index9; |
| 5502 |
if (is_hidden(node)) { |
| 5503 |
continue; |
| 5504 |
} |
| 5505 |
scroll_to_node(node, sync_context); |
| 5506 |
break; |
| 5507 |
} |
| 5508 |
}; |
| 5509 |
if (!go_to_line.__argnames__) Object.defineProperties(go_to_line, { |
| 5510 |
__argnames__ : {value: ["lnum", "sync_context"]}, |
| 5511 |
__module__ : {value: null} |
| 5512 |
}); |
| 5513 |
|
| 5514 |
|
| 5515 |
|
| 5516 |
var go_to_sourceline_address = from_python((function() { |
| 5517 |
var ρσ_anonfunc = function go_to_sourceline_address(sourceline, tags, sync_context) { |
| 5518 |
var nodes, node, index; |
| 5519 |
nodes = document.querySelectorAll("[data-lnum=\"" + ρσ_str.format("{}", sourceline) + "\"]"); |
| 5520 |
for (var ρσ_Index10 = 0; ρσ_Index10 < nodes.length; ρσ_Index10++) { |
| 5521 |
index = ρσ_Index10; |
| 5522 |
node = nodes[(typeof index === "number" && index < 0) ? nodes.length + index : index]; |
| 5523 |
if (index >= tags.length || node.tagName.toLowerCase() !== tags[(typeof index === "number" && index < 0) ? tags.length + index : index]) { |
| 5524 |
break; |
| 5525 |
} |
| 5526 |
if (ρσ_equals(index, tags.length - 1) && !is_hidden(node)) { |
| 5527 |
return scroll_to_node(node, sync_context); |
| 5528 |
} |
| 5529 |
} |
| 5530 |
go_to_line(sourceline, sync_context); |
| 5531 |
}; |
| 5532 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 5533 |
__argnames__ : {value: ["sourceline", "tags", "sync_context"]}, |
| 5534 |
__module__ : {value: null} |
| 5535 |
}); |
| 5536 |
return ρσ_anonfunc; |
| 5537 |
})()); |
| 5538 |
|
| 5539 |
function find_blocks() { |
| 5540 |
var elem; |
| 5541 |
if (state.blocks_found) { |
| 5542 |
return; |
| 5543 |
} |
| 5544 |
var ρσ_Iter11 = document.body.getElementsByTagName("*"); |
| 5545 |
ρσ_Iter11 = ((typeof ρσ_Iter11[Symbol.iterator] === "function") ? (ρσ_Iter11 instanceof Map ? ρσ_Iter11.keys() : ρσ_Iter11) : Object.keys(ρσ_Iter11)); |
| 5546 |
for (var ρσ_Index11 of ρσ_Iter11) { |
| 5547 |
elem = ρσ_Index11; |
| 5548 |
if (is_block(elem) && !in_table(elem)) { |
| 5549 |
elem.setAttribute("data-is-block", "1"); |
| 5550 |
} |
| 5551 |
} |
| 5552 |
state.blocks_found = true; |
| 5553 |
}; |
| 5554 |
if (!find_blocks.__module__) Object.defineProperties(find_blocks, { |
| 5555 |
__module__ : {value: null} |
| 5556 |
}); |
| 5557 |
|
| 5558 |
|
| 5559 |
|
| 5560 |
var set_split_mode = from_python((function() { |
| 5561 |
var ρσ_anonfunc = function set_split_mode(enabled) { |
| 5562 |
state.in_split_mode = enabled; |
| 5563 |
document.body.dataset.inSplitMode = (enabled) ? "1" : "0"; |
| 5564 |
if (enabled) { |
| 5565 |
find_blocks(); |
| 5566 |
} |
| 5567 |
}; |
| 5568 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 5569 |
__argnames__ : {value: ["enabled"]}, |
| 5570 |
__module__ : {value: null} |
| 5571 |
}); |
| 5572 |
return ρσ_anonfunc; |
| 5573 |
})()); |
| 5574 |
|
| 5575 |
function report_split(node) { |
| 5576 |
var loc, totals, parent, num, sibling; |
| 5577 |
loc = []; |
| 5578 |
totals = []; |
| 5579 |
parent = find_containing_block(node); |
| 5580 |
while (parent && parent.tagName.toLowerCase() !== "body") { |
| 5581 |
totals.push(parent.parentNode.children.length); |
| 5582 |
num = 0; |
| 5583 |
sibling = parent.previousElementSibling; |
| 5584 |
while (sibling) { |
| 5585 |
num += 1; |
| 5586 |
sibling = sibling.previousElementSibling; |
| 5587 |
} |
| 5588 |
loc.push(num); |
| 5589 |
parent = parent.parentNode; |
| 5590 |
} |
| 5591 |
loc.reverse(); |
| 5592 |
totals.reverse(); |
| 5593 |
to_python.request_split(loc, totals); |
| 5594 |
}; |
| 5595 |
if (!report_split.__argnames__) Object.defineProperties(report_split, { |
| 5596 |
__argnames__ : {value: ["node"]}, |
| 5597 |
__module__ : {value: null} |
| 5598 |
}); |
| 5599 |
|
| 5600 |
function onclick(event) { |
| 5601 |
var e, address, href, tn; |
| 5602 |
event.preventDefault(); |
| 5603 |
if (state.in_split_mode) { |
| 5604 |
report_split(event.target); |
| 5605 |
} else { |
| 5606 |
e = event.target; |
| 5607 |
address = get_sourceline_address(e); |
| 5608 |
href = tn = ""; |
| 5609 |
while (e && e !== document.body && e !== document && e !== document.documentElement && (tn !== "a" || !href)) { |
| 5610 |
tn = (e.tagName) ? e.tagName.toLowerCase() : ""; |
| 5611 |
href = e.getAttribute("href"); |
| 5612 |
e = e.parentNode; |
| 5613 |
} |
| 5614 |
if (to_python.request_sync) { |
| 5615 |
to_python.request_sync(tn, href, address); |
| 5616 |
} |
| 5617 |
} |
| 5618 |
return false; |
| 5619 |
}; |
| 5620 |
if (!onclick.__argnames__) Object.defineProperties(onclick, { |
| 5621 |
__argnames__ : {value: ["event"]}, |
| 5622 |
__module__ : {value: null} |
| 5623 |
}); |
| 5624 |
|
| 5625 |
|
| 5626 |
|
| 5627 |
var go_to_anchor = from_python((function() { |
| 5628 |
var ρσ_anonfunc = function go_to_anchor(anchor) { |
| 5629 |
var elem, address; |
| 5630 |
elem = document.getElementById(anchor); |
| 5631 |
if (!elem) { |
| 5632 |
elem = document.querySelector("[name=\"" + ρσ_str.format("{}", anchor) + "\"]"); |
| 5633 |
} |
| 5634 |
if (elem) { |
| 5635 |
elem.scrollIntoView(); |
| 5636 |
address = get_sourceline_address(elem); |
| 5637 |
if (to_python.request_sync) { |
| 5638 |
to_python.request_sync("", "", address); |
| 5639 |
} |
| 5640 |
} |
| 5641 |
}; |
| 5642 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 5643 |
__argnames__ : {value: ["anchor"]}, |
| 5644 |
__module__ : {value: null} |
| 5645 |
}); |
| 5646 |
return ρσ_anonfunc; |
| 5647 |
})()); |
| 5648 |
|
| 5649 |
|
| 5650 |
|
| 5651 |
var live_css = from_python((function() { |
| 5652 |
var ρσ_anonfunc = function live_css(editor_name, sourceline, tags) { |
| 5653 |
var all_properties, ans, target, i, tn, node, ancestor_specificity, css; |
| 5654 |
all_properties = Object.create(null); |
| 5655 |
ans = (function(){ |
| 5656 |
var ρσ_d = Object.create(null); |
| 5657 |
ρσ_d["nodes"] = []; |
| 5658 |
ρσ_d["computed_css"] = all_properties; |
| 5659 |
ρσ_d["editor_name"] = editor_name; |
| 5660 |
ρσ_d["sourceline"] = sourceline; |
| 5661 |
ρσ_d["tags"] = tags; |
| 5662 |
return ρσ_d; |
| 5663 |
}).call(this); |
| 5664 |
target = null; |
| 5665 |
i = 0; |
| 5666 |
var ρσ_Iter12 = document.querySelectorAll("[data-lnum=\"" + ρσ_str.format("{}", sourceline) + "\"]"); |
| 5667 |
ρσ_Iter12 = ((typeof ρσ_Iter12[Symbol.iterator] === "function") ? (ρσ_Iter12 instanceof Map ? ρσ_Iter12.keys() : ρσ_Iter12) : Object.keys(ρσ_Iter12)); |
| 5668 |
for (var ρσ_Index12 of ρσ_Iter12) { |
| 5669 |
node = ρσ_Index12; |
| 5670 |
tn = (node.tagName) ? node.tagName.toLowerCase() : ""; |
| 5671 |
if (tn !== tags[(typeof i === "number" && i < 0) ? tags.length + i : i]) { |
| 5672 |
if (to_python.live_css_data) { |
| 5673 |
to_python.live_css_data(ans); |
| 5674 |
} |
| 5675 |
return; |
| 5676 |
} |
| 5677 |
i += 1; |
| 5678 |
target = node; |
| 5679 |
if (i >= tags.length) { |
| 5680 |
break; |
| 5681 |
} |
| 5682 |
} |
| 5683 |
ancestor_specificity = 0; |
| 5684 |
while (target && target.ownerDocument) { |
| 5685 |
css = get_matched_css(target, ancestor_specificity !== 0, all_properties); |
| 5686 |
if (css.length > 0 || ancestor_specificity === 0) { |
| 5687 |
tn = (target.tagName) ? target.tagName.toLowerCase() : ""; |
| 5688 |
ans.nodes.push((function(){ |
| 5689 |
var ρσ_d = Object.create(null); |
| 5690 |
ρσ_d["name"] = tn; |
| 5691 |
ρσ_d["css"] = css; |
| 5692 |
ρσ_d["ancestor_specificity"] = -ancestor_specificity; |
| 5693 |
ρσ_d["sourceline"] = target.getAttribute("data-lnum"); |
| 5694 |
return ρσ_d; |
| 5695 |
}).call(this)); |
| 5696 |
} |
| 5697 |
target = target.parentNode; |
| 5698 |
ancestor_specificity += 1; |
| 5699 |
} |
| 5700 |
if (to_python.live_css_data) { |
| 5701 |
to_python.live_css_data(ans); |
| 5702 |
} |
| 5703 |
}; |
| 5704 |
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { |
| 5705 |
__argnames__ : {value: ["editor_name", "sourceline", "tags"]}, |
| 5706 |
__module__ : {value: null} |
| 5707 |
}); |
| 5708 |
return ρσ_anonfunc; |
| 5709 |
})()); |
| 5710 |
|
| 5711 |
function check_for_maths() { |
| 5712 |
var s; |
| 5713 |
if (document.body.getElementsByTagNameNS("http://www.w3.org/1998/Math/MathML", "math").length > 0) { |
| 5714 |
return true; |
| 5715 |
} |
| 5716 |
var ρσ_Iter13 = document.scripts; |
| 5717 |
ρσ_Iter13 = ((typeof ρσ_Iter13[Symbol.iterator] === "function") ? (ρσ_Iter13 instanceof Map ? ρσ_Iter13.keys() : ρσ_Iter13) : Object.keys(ρσ_Iter13)); |
| 5718 |
for (var ρσ_Index13 of ρσ_Iter13) { |
| 5719 |
s = ρσ_Index13; |
| 5720 |
if (s.type === "text/x-mathjax-config") { |
| 5721 |
return true; |
| 5722 |
} |
| 5723 |
} |
| 5724 |
return false; |
| 5725 |
}; |
| 5726 |
if (!check_for_maths.__module__) Object.defineProperties(check_for_maths, { |
| 5727 |
__module__ : {value: null} |
| 5728 |
}); |
| 5729 |
|
| 5730 |
function load_mathjax() { |
| 5731 |
var script; |
| 5732 |
script = ρσ_interpolate_kwargs.call(E, E.script, [ρσ_desugar_kwargs({type: "text/javascript"})]); |
| 5733 |
script.async = true; |
| 5734 |
script.src = "" + ρσ_str.format("{}", FAKE_PROTOCOL) + "://" + ρσ_str.format("{}", FAKE_HOST) + "/calibre_internal-mathjax/startup.js"; |
| 5735 |
document.head.appendChild(script); |
| 5736 |
}; |
| 5737 |
if (!load_mathjax.__module__) Object.defineProperties(load_mathjax, { |
| 5738 |
__module__ : {value: null} |
| 5739 |
}); |
| 5740 |
|
| 5741 |
if (document.body) { |
| 5742 |
settings = JSON.parse(window.navigator.userAgent.split("|")[1]); |
| 5743 |
css = "[data-in-split-mode=\"1\"] [data-is-block=\"1\"]:hover { cursor: pointer !important; border-top: solid 5px green !important }"; |
| 5744 |
if (settings.os === "macos") { |
| 5745 |
css += "\n* { -webkit-hyphenate-character: \"-\" !important }\n"; |
| 5746 |
} |
| 5747 |
document.body.addEventListener("click", onclick, true); |
| 5748 |
document.documentElement.appendChild(ρσ_interpolate_kwargs.call(E, E.style, [css].concat([ρσ_desugar_kwargs({type: "text/css"})]))); |
| 5749 |
fix_fullscreen_svg_images(); |
| 5750 |
if (check_for_maths()) { |
| 5751 |
load_mathjax(); |
| 5752 |
} |
| 5753 |
} |
| 5754 |
})(); |
| 5755 |
})(); |
| 5756 |
|
| 5757 |
//# sourceMappingURL=editor.js.map |