版博士V2.0程序
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. 'use strict';
  2. const n = /[^\0-\x7E]/;
  3. const t = /[\x2E\u3002\uFF0E\uFF61]/g;
  4. const o = {
  5. overflow: "Overflow Error",
  6. "not-basic": "Illegal Input",
  7. "invalid-input": "Invalid Input"
  8. };
  9. const e = Math.floor;
  10. const r = String.fromCharCode;
  11. function s(n2) {
  12. throw new RangeError(o[n2]);
  13. }
  14. const c = function(n2, t2) {
  15. return n2 + 22 + 75 * (n2 < 26) - ((t2 != 0) << 5);
  16. };
  17. const u = function(n2, t2, o2) {
  18. let r2 = 0;
  19. for (n2 = o2 ? e(n2 / 700) : n2 >> 1, n2 += e(n2 / t2); n2 > 455; r2 += 36) {
  20. n2 = e(n2 / 35);
  21. }
  22. return e(r2 + 36 * n2 / (n2 + 38));
  23. };
  24. function toASCII(o2) {
  25. return function(n2, o3) {
  26. const e2 = n2.split("@");
  27. let r2 = "";
  28. e2.length > 1 && (r2 = e2[0] + "@", n2 = e2[1]);
  29. const s2 = function(n3, t2) {
  30. const o4 = [];
  31. let e3 = n3.length;
  32. for (; e3--; ) {
  33. o4[e3] = t2(n3[e3]);
  34. }
  35. return o4;
  36. }((n2 = n2.replace(t, ".")).split("."), o3).join(".");
  37. return r2 + s2;
  38. }(o2, function(t2) {
  39. return n.test(t2) ? "xn--" + function(n2) {
  40. const t3 = [];
  41. const o3 = (n2 = function(n3) {
  42. const t4 = [];
  43. let o4 = 0;
  44. const e2 = n3.length;
  45. for (; o4 < e2; ) {
  46. const r2 = n3.charCodeAt(o4++);
  47. if (r2 >= 55296 && r2 <= 56319 && o4 < e2) {
  48. const e3 = n3.charCodeAt(o4++);
  49. (64512 & e3) == 56320 ? t4.push(((1023 & r2) << 10) + (1023 & e3) + 65536) : (t4.push(r2), o4--);
  50. } else {
  51. t4.push(r2);
  52. }
  53. }
  54. return t4;
  55. }(n2)).length;
  56. let f = 128;
  57. let i = 0;
  58. let l = 72;
  59. for (const o4 of n2) {
  60. o4 < 128 && t3.push(r(o4));
  61. }
  62. const h = t3.length;
  63. let p = h;
  64. for (h && t3.push("-"); p < o3; ) {
  65. let o4 = 2147483647;
  66. for (const t4 of n2) {
  67. t4 >= f && t4 < o4 && (o4 = t4);
  68. }
  69. const a = p + 1;
  70. o4 - f > e((2147483647 - i) / a) && s("overflow"), i += (o4 - f) * a, f = o4;
  71. for (const o5 of n2) {
  72. if (o5 < f && ++i > 2147483647 && s("overflow"), o5 == f) {
  73. let n3 = i;
  74. for (let o6 = 36; ; o6 += 36) {
  75. const s2 = o6 <= l ? 1 : o6 >= l + 26 ? 26 : o6 - l;
  76. if (n3 < s2) {
  77. break;
  78. }
  79. const u2 = n3 - s2;
  80. const f2 = 36 - s2;
  81. t3.push(r(c(s2 + u2 % f2, 0))), n3 = e(u2 / f2);
  82. }
  83. t3.push(r(c(n3, 0))), l = u(i, a, p == h), i = 0, ++p;
  84. }
  85. }
  86. ++i, ++f;
  87. }
  88. return t3.join("");
  89. }(t2) : t2;
  90. });
  91. }
  92. const HASH_RE = /#/g;
  93. const AMPERSAND_RE = /&/g;
  94. const SLASH_RE = /\//g;
  95. const EQUAL_RE = /=/g;
  96. const IM_RE = /\?/g;
  97. const PLUS_RE = /\+/g;
  98. const ENC_CARET_RE = /%5e/gi;
  99. const ENC_BACKTICK_RE = /%60/gi;
  100. const ENC_CURLY_OPEN_RE = /%7b/gi;
  101. const ENC_PIPE_RE = /%7c/gi;
  102. const ENC_CURLY_CLOSE_RE = /%7d/gi;
  103. const ENC_SPACE_RE = /%20/gi;
  104. const ENC_SLASH_RE = /%2f/gi;
  105. const ENC_ENC_SLASH_RE = /%252f/gi;
  106. function encode(text) {
  107. return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
  108. }
  109. function encodeHash(text) {
  110. return encode(text).replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
  111. }
  112. function encodeQueryValue(input) {
  113. return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^");
  114. }
  115. function encodeQueryKey(text) {
  116. return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
  117. }
  118. function encodePath(text) {
  119. return encode(text).replace(HASH_RE, "%23").replace(IM_RE, "%3F").replace(ENC_ENC_SLASH_RE, "%2F").replace(AMPERSAND_RE, "%26").replace(PLUS_RE, "%2B");
  120. }
  121. function encodeParam(text) {
  122. return encodePath(text).replace(SLASH_RE, "%2F");
  123. }
  124. function decode(text = "") {
  125. try {
  126. return decodeURIComponent("" + text);
  127. } catch {
  128. return "" + text;
  129. }
  130. }
  131. function decodePath(text) {
  132. return decode(text.replace(ENC_SLASH_RE, "%252F"));
  133. }
  134. function decodeQueryValue(text) {
  135. return decode(text.replace(PLUS_RE, " "));
  136. }
  137. function encodeHost(name = "") {
  138. return toASCII(name);
  139. }
  140. function parseQuery(parametersString = "") {
  141. const object = {};
  142. if (parametersString[0] === "?") {
  143. parametersString = parametersString.slice(1);
  144. }
  145. for (const parameter of parametersString.split("&")) {
  146. const s = parameter.match(/([^=]+)=?(.*)/) || [];
  147. if (s.length < 2) {
  148. continue;
  149. }
  150. const key = decode(s[1]);
  151. if (key === "__proto__" || key === "constructor") {
  152. continue;
  153. }
  154. const value = decodeQueryValue(s[2] || "");
  155. if (typeof object[key] !== "undefined") {
  156. if (Array.isArray(object[key])) {
  157. object[key].push(value);
  158. } else {
  159. object[key] = [object[key], value];
  160. }
  161. } else {
  162. object[key] = value;
  163. }
  164. }
  165. return object;
  166. }
  167. function encodeQueryItem(key, value) {
  168. if (typeof value === "number" || typeof value === "boolean") {
  169. value = String(value);
  170. }
  171. if (!value) {
  172. return encodeQueryKey(key);
  173. }
  174. if (Array.isArray(value)) {
  175. return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
  176. }
  177. return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
  178. }
  179. function stringifyQuery(query) {
  180. return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).join("&");
  181. }
  182. class $URL {
  183. constructor(input = "") {
  184. this.query = {};
  185. if (typeof input !== "string") {
  186. throw new TypeError(
  187. `URL input should be string received ${typeof input} (${input})`
  188. );
  189. }
  190. const parsed = parseURL(input);
  191. this.protocol = decode(parsed.protocol);
  192. this.host = decode(parsed.host);
  193. this.auth = decode(parsed.auth);
  194. this.pathname = decodePath(parsed.pathname);
  195. this.query = parseQuery(parsed.search);
  196. this.hash = decode(parsed.hash);
  197. }
  198. get hostname() {
  199. return parseHost(this.host).hostname;
  200. }
  201. get port() {
  202. return parseHost(this.host).port || "";
  203. }
  204. get username() {
  205. return parseAuth(this.auth).username;
  206. }
  207. get password() {
  208. return parseAuth(this.auth).password || "";
  209. }
  210. get hasProtocol() {
  211. return this.protocol.length;
  212. }
  213. get isAbsolute() {
  214. return this.hasProtocol || this.pathname[0] === "/";
  215. }
  216. get search() {
  217. const q = stringifyQuery(this.query);
  218. return q.length > 0 ? "?" + q : "";
  219. }
  220. get searchParams() {
  221. const p = new URLSearchParams();
  222. for (const name in this.query) {
  223. const value = this.query[name];
  224. if (Array.isArray(value)) {
  225. for (const v of value) {
  226. p.append(name, v);
  227. }
  228. } else {
  229. p.append(
  230. name,
  231. typeof value === "string" ? value : JSON.stringify(value)
  232. );
  233. }
  234. }
  235. return p;
  236. }
  237. get origin() {
  238. return (this.protocol ? this.protocol + "//" : "") + encodeHost(this.host);
  239. }
  240. get fullpath() {
  241. return encodePath(this.pathname) + this.search + encodeHash(this.hash);
  242. }
  243. get encodedAuth() {
  244. if (!this.auth) {
  245. return "";
  246. }
  247. const { username, password } = parseAuth(this.auth);
  248. return encodeURIComponent(username) + (password ? ":" + encodeURIComponent(password) : "");
  249. }
  250. get href() {
  251. const auth = this.encodedAuth;
  252. const originWithAuth = (this.protocol ? this.protocol + "//" : "") + (auth ? auth + "@" : "") + encodeHost(this.host);
  253. return this.hasProtocol && this.isAbsolute ? originWithAuth + this.fullpath : this.fullpath;
  254. }
  255. append(url) {
  256. if (url.hasProtocol) {
  257. throw new Error("Cannot append a URL with protocol");
  258. }
  259. Object.assign(this.query, url.query);
  260. if (url.pathname) {
  261. this.pathname = withTrailingSlash(this.pathname) + withoutLeadingSlash(url.pathname);
  262. }
  263. if (url.hash) {
  264. this.hash = url.hash;
  265. }
  266. }
  267. toJSON() {
  268. return this.href;
  269. }
  270. toString() {
  271. return this.href;
  272. }
  273. }
  274. function isRelative(inputString) {
  275. return ["./", "../"].some((string_) => inputString.startsWith(string_));
  276. }
  277. const PROTOCOL_STRICT_REGEX = /^\w{2,}:([/\\]{1,2})/;
  278. const PROTOCOL_REGEX = /^\w{2,}:([/\\]{2})?/;
  279. const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
  280. function hasProtocol(inputString, opts = {}) {
  281. if (typeof opts === "boolean") {
  282. opts = { acceptRelative: opts };
  283. }
  284. if (opts.strict) {
  285. return PROTOCOL_STRICT_REGEX.test(inputString);
  286. }
  287. return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
  288. }
  289. const TRAILING_SLASH_RE = /\/$|\/\?/;
  290. function hasTrailingSlash(input = "", queryParameters = false) {
  291. if (!queryParameters) {
  292. return input.endsWith("/");
  293. }
  294. return TRAILING_SLASH_RE.test(input);
  295. }
  296. function withoutTrailingSlash(input = "", queryParameters = false) {
  297. if (!queryParameters) {
  298. return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
  299. }
  300. if (!hasTrailingSlash(input, true)) {
  301. return input || "/";
  302. }
  303. const [s0, ...s] = input.split("?");
  304. return (s0.slice(0, -1) || "/") + (s.length > 0 ? `?${s.join("?")}` : "");
  305. }
  306. function withTrailingSlash(input = "", queryParameters = false) {
  307. if (!queryParameters) {
  308. return input.endsWith("/") ? input : input + "/";
  309. }
  310. if (hasTrailingSlash(input, true)) {
  311. return input || "/";
  312. }
  313. const [s0, ...s] = input.split("?");
  314. return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "");
  315. }
  316. function hasLeadingSlash(input = "") {
  317. return input.startsWith("/");
  318. }
  319. function withoutLeadingSlash(input = "") {
  320. return (hasLeadingSlash(input) ? input.slice(1) : input) || "/";
  321. }
  322. function withLeadingSlash(input = "") {
  323. return hasLeadingSlash(input) ? input : "/" + input;
  324. }
  325. function cleanDoubleSlashes(input = "") {
  326. return input.split("://").map((string_) => string_.replace(/\/{2,}/g, "/")).join("://");
  327. }
  328. function withBase(input, base) {
  329. if (isEmptyURL(base) || hasProtocol(input)) {
  330. return input;
  331. }
  332. const _base = withoutTrailingSlash(base);
  333. if (input.startsWith(_base)) {
  334. return input;
  335. }
  336. return joinURL(_base, input);
  337. }
  338. function withoutBase(input, base) {
  339. if (isEmptyURL(base)) {
  340. return input;
  341. }
  342. const _base = withoutTrailingSlash(base);
  343. if (!input.startsWith(_base)) {
  344. return input;
  345. }
  346. const trimmed = input.slice(_base.length);
  347. return trimmed[0] === "/" ? trimmed : "/" + trimmed;
  348. }
  349. function withQuery(input, query) {
  350. const parsed = parseURL(input);
  351. const mergedQuery = { ...parseQuery(parsed.search), ...query };
  352. parsed.search = stringifyQuery(mergedQuery);
  353. return stringifyParsedURL(parsed);
  354. }
  355. function getQuery(input) {
  356. return parseQuery(parseURL(input).search);
  357. }
  358. function isEmptyURL(url) {
  359. return !url || url === "/";
  360. }
  361. function isNonEmptyURL(url) {
  362. return url && url !== "/";
  363. }
  364. function joinURL(base, ...input) {
  365. let url = base || "";
  366. for (const index of input.filter((url2) => isNonEmptyURL(url2))) {
  367. url = url ? withTrailingSlash(url) + withoutLeadingSlash(index) : index;
  368. }
  369. return url;
  370. }
  371. function withHttp(input) {
  372. return withProtocol(input, "http://");
  373. }
  374. function withHttps(input) {
  375. return withProtocol(input, "https://");
  376. }
  377. function withoutProtocol(input) {
  378. return withProtocol(input, "");
  379. }
  380. function withProtocol(input, protocol) {
  381. const match = input.match(PROTOCOL_REGEX);
  382. if (!match) {
  383. return protocol + input;
  384. }
  385. return protocol + input.slice(match[0].length);
  386. }
  387. function createURL(input) {
  388. return new $URL(input);
  389. }
  390. function normalizeURL(input) {
  391. return createURL(input).toString();
  392. }
  393. function resolveURL(base, ...input) {
  394. const url = createURL(base);
  395. for (const index of input.filter((url2) => isNonEmptyURL(url2))) {
  396. url.append(createURL(index));
  397. }
  398. return url.toString();
  399. }
  400. function isSamePath(p1, p2) {
  401. return decode(withoutTrailingSlash(p1)) === decode(withoutTrailingSlash(p2));
  402. }
  403. function isEqual(a, b, options = {}) {
  404. if (!options.trailingSlash) {
  405. a = withTrailingSlash(a);
  406. b = withTrailingSlash(b);
  407. }
  408. if (!options.leadingSlash) {
  409. a = withLeadingSlash(a);
  410. b = withLeadingSlash(b);
  411. }
  412. if (!options.encoding) {
  413. a = decode(a);
  414. b = decode(b);
  415. }
  416. return a === b;
  417. }
  418. function parseURL(input = "", defaultProto) {
  419. if (!hasProtocol(input, { acceptRelative: true })) {
  420. return defaultProto ? parseURL(defaultProto + input) : parsePath(input);
  421. }
  422. const [protocol = "", auth, hostAndPath = ""] = (input.replace(/\\/g, "/").match(/([^/:]+:)?\/\/([^/@]+@)?(.*)/) || []).splice(1);
  423. const [host = "", path = ""] = (hostAndPath.match(/([^#/?]*)(.*)?/) || []).splice(1);
  424. const { pathname, search, hash } = parsePath(
  425. path.replace(/\/(?=[A-Za-z]:)/, "")
  426. );
  427. return {
  428. protocol,
  429. auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
  430. host,
  431. pathname,
  432. search,
  433. hash
  434. };
  435. }
  436. function parsePath(input = "") {
  437. const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
  438. return {
  439. pathname,
  440. search,
  441. hash
  442. };
  443. }
  444. function parseAuth(input = "") {
  445. const [username, password] = input.split(":");
  446. return {
  447. username: decode(username),
  448. password: decode(password)
  449. };
  450. }
  451. function parseHost(input = "") {
  452. const [hostname, port] = (input.match(/([^/:]*):?(\d+)?/) || []).splice(1);
  453. return {
  454. hostname: decode(hostname),
  455. port
  456. };
  457. }
  458. function stringifyParsedURL(parsed) {
  459. const fullpath = parsed.pathname + (parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "") + parsed.hash;
  460. if (!parsed.protocol) {
  461. return fullpath;
  462. }
  463. return parsed.protocol + "//" + (parsed.auth ? parsed.auth + "@" : "") + parsed.host + fullpath;
  464. }
  465. exports.$URL = $URL;
  466. exports.cleanDoubleSlashes = cleanDoubleSlashes;
  467. exports.createURL = createURL;
  468. exports.decode = decode;
  469. exports.decodePath = decodePath;
  470. exports.decodeQueryValue = decodeQueryValue;
  471. exports.encode = encode;
  472. exports.encodeHash = encodeHash;
  473. exports.encodeHost = encodeHost;
  474. exports.encodeParam = encodeParam;
  475. exports.encodePath = encodePath;
  476. exports.encodeQueryItem = encodeQueryItem;
  477. exports.encodeQueryKey = encodeQueryKey;
  478. exports.encodeQueryValue = encodeQueryValue;
  479. exports.getQuery = getQuery;
  480. exports.hasLeadingSlash = hasLeadingSlash;
  481. exports.hasProtocol = hasProtocol;
  482. exports.hasTrailingSlash = hasTrailingSlash;
  483. exports.isEmptyURL = isEmptyURL;
  484. exports.isEqual = isEqual;
  485. exports.isNonEmptyURL = isNonEmptyURL;
  486. exports.isRelative = isRelative;
  487. exports.isSamePath = isSamePath;
  488. exports.joinURL = joinURL;
  489. exports.normalizeURL = normalizeURL;
  490. exports.parseAuth = parseAuth;
  491. exports.parseHost = parseHost;
  492. exports.parsePath = parsePath;
  493. exports.parseQuery = parseQuery;
  494. exports.parseURL = parseURL;
  495. exports.resolveURL = resolveURL;
  496. exports.stringifyParsedURL = stringifyParsedURL;
  497. exports.stringifyQuery = stringifyQuery;
  498. exports.withBase = withBase;
  499. exports.withHttp = withHttp;
  500. exports.withHttps = withHttps;
  501. exports.withLeadingSlash = withLeadingSlash;
  502. exports.withProtocol = withProtocol;
  503. exports.withQuery = withQuery;
  504. exports.withTrailingSlash = withTrailingSlash;
  505. exports.withoutBase = withoutBase;
  506. exports.withoutLeadingSlash = withoutLeadingSlash;
  507. exports.withoutProtocol = withoutProtocol;
  508. exports.withoutTrailingSlash = withoutTrailingSlash;