This commit is contained in:
史典卓
2025-03-28 15:19:42 +08:00
parent ad4eb162a5
commit 0216f6053a
396 changed files with 18278 additions and 9899 deletions

BIN
lib/.DS_Store vendored Normal file

Binary file not shown.

9
lib/dompurify@3.2.4es.js Normal file

File diff suppressed because one or more lines are too long

10
lib/highlight/github-dark.min.css vendored Normal file
View File

@@ -0,0 +1,10 @@
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
Theme: GitHub Dark
Description: Dark theme as seen on github.com
Author: github.com
Maintainer: @Hirse
Updated: 2021-05-15
Outdated base version: https://github.com/primer/github-syntax-dark
Current colors taken from GitHub's CSS
*/.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#79c0ff}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-code,.hljs-comment,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c}

5256
lib/highlight/highlight-uni.min.js vendored Normal file

File diff suppressed because one or more lines are too long

352
lib/html-parser.js Normal file
View File

@@ -0,0 +1,352 @@
/*
* HTML5 Parser By Sam Blowes
*
* Designed for HTML5 documents
*
* Original code by John Resig (ejohn.org)
* http://ejohn.org/blog/pure-javascript-html-parser/
* Original code by Erik Arvidsson, Mozilla Public License
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
*
* ----------------------------------------------------------------------------
* License
* ----------------------------------------------------------------------------
*
* This code is triple licensed using Apache Software License 2.0,
* Mozilla Public License or GNU Public License
*
* ////////////////////////////////////////////////////////////////////////////
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* ////////////////////////////////////////////////////////////////////////////
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Simple HTML Parser.
*
* The Initial Developer of the Original Code is Erik Arvidsson.
* Portions created by Erik Arvidssson are Copyright (C) 2004. All Rights
* Reserved.
*
* ////////////////////////////////////////////////////////////////////////////
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ----------------------------------------------------------------------------
* Usage
* ----------------------------------------------------------------------------
*
* // Use like so:
* HTMLParser(htmlString, {
* start: function(tag, attrs, unary) {},
* end: function(tag) {},
* chars: function(text) {},
* comment: function(text) {}
* });
*
* // or to get an XML string:
* HTMLtoXML(htmlString);
*
* // or to get an XML DOM Document
* HTMLtoDOM(htmlString);
*
* // or to inject into an existing document/DOM node
* HTMLtoDOM(htmlString, document);
* HTMLtoDOM(htmlString, document.body);
*
*/
// Regular Expressions for parsing tags and attributes
var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; // Empty Elements - HTML 5
var empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr'); // Block Elements - HTML 5
// fixed by xxx 将 ins 标签从块级名单中移除
var block = makeMap('a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video'); // Inline Elements - HTML 5
var inline = makeMap('abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'); // Elements that you can, intentionally, leave open
// (and which close themselves)
var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); // Attributes that have their values filled in disabled="disabled"
var fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'); // Special Elements (can contain anything)
var special = makeMap('script,style');
function HTMLParser(html, handler) {
var index;
var chars;
var match;
var stack = [];
var last = html;
stack.last = function () {
return this[this.length - 1];
};
while (html) {
chars = true; // Make sure we're not in a script or style element
if (!stack.last() || !special[stack.last()]) {
// Comment
if (html.indexOf('<!--') == 0) {
index = html.indexOf('-->');
if (index >= 0) {
if (handler.comment) {
handler.comment(html.substring(4, index));
}
html = html.substring(index + 3);
chars = false;
} // end tag
} else if (html.indexOf('</') == 0) {
match = html.match(endTag);
if (match) {
html = html.substring(match[0].length);
match[0].replace(endTag, parseEndTag);
chars = false;
} // start tag
} else if (html.indexOf('<') == 0) {
match = html.match(startTag);
if (match) {
html = html.substring(match[0].length);
match[0].replace(startTag, parseStartTag);
chars = false;
}
}
if (chars) {
index = html.indexOf('<');
var text = index < 0 ? html : html.substring(0, index);
html = index < 0 ? '' : html.substring(index);
if (handler.chars) {
handler.chars(text);
}
}
} else {
html = html.replace(new RegExp('([\\s\\S]*?)<\/' + stack.last() + '[^>]*>'), function (all, text) {
text = text.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, '$1$2');
if (handler.chars) {
handler.chars(text);
}
return '';
});
parseEndTag('', stack.last());
}
if (html == last) {
throw 'Parse Error: ' + html;
}
last = html;
} // Clean up any remaining tags
parseEndTag();
function parseStartTag(tag, tagName, rest, unary) {
tagName = tagName.toLowerCase();
if (block[tagName]) {
while (stack.last() && inline[stack.last()]) {
parseEndTag('', stack.last());
}
}
if (closeSelf[tagName] && stack.last() == tagName) {
parseEndTag('', tagName);
}
unary = empty[tagName] || !!unary;
if (!unary) {
stack.push(tagName);
}
if (handler.start) {
var attrs = [];
rest.replace(attr, function (match, name) {
var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : '';
attrs.push({
name: name,
value: value,
escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') // "
});
});
if (handler.start) {
handler.start(tagName, attrs, unary);
}
}
}
function parseEndTag(tag, tagName) {
// If no tag name is provided, clean shop
if (!tagName) {
var pos = 0;
} // Find the closest opened tag of the same type
else {
for (var pos = stack.length - 1; pos >= 0; pos--) {
if (stack[pos] == tagName) {
break;
}
}
}
if (pos >= 0) {
// Close all the open elements, up the stack
for (var i = stack.length - 1; i >= pos; i--) {
if (handler.end) {
handler.end(stack[i]);
}
} // Remove the open elements from the stack
stack.length = pos;
}
}
}
function makeMap(str) {
var obj = {};
var items = str.split(',');
for (var i = 0; i < items.length; i++) {
obj[items[i]] = true;
}
return obj;
}
function removeDOCTYPE(html) {
return html.replace(/<\?xml.*\?>\n/, '').replace(/<!doctype.*>\n/, '').replace(/<!DOCTYPE.*>\n/, '');
}
function parseAttrs(attrs) {
return attrs.reduce(function (pre, attr) {
var value = attr.value;
var name = attr.name;
if (pre[name]) {
pre[name] = pre[name] + " " + value;
} else {
pre[name] = value;
}
return pre;
}, {});
}
function parseHtml(html) {
html = removeDOCTYPE(html);
var stacks = [];
var results = {
node: 'root',
children: []
};
HTMLParser(html, {
start: function start(tag, attrs, unary) {
var node = {
name: tag
};
if (attrs.length !== 0) {
node.attrs = parseAttrs(attrs);
}
if (unary) {
var parent = stacks[0] || results;
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
} else {
stacks.unshift(node);
}
},
end: function end(tag) {
var node = stacks.shift();
if (node.name !== tag) console.error('invalid state: mismatch end tag');
if (stacks.length === 0) {
results.children.push(node);
} else {
var parent = stacks[0];
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
}
},
chars: function chars(text) {
var node = {
type: 'text',
text: text
};
if (stacks.length === 0) {
results.children.push(node);
} else {
var parent = stacks[0];
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
}
},
comment: function comment(text) {
var node = {
node: 'comment',
text: text
};
var parent = stacks[0];
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
}
});
return results.children;
}
export default parseHtml;

2
lib/markdown-it.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
lib/string-similarity.min.js vendored Normal file
View File

@@ -0,0 +1 @@
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.stringSimilarity=e():t.stringSimilarity=e()}(self,(function(){return t={138:t=>{function e(t,e){if((t=t.replace(/\s+/g,""))===(e=e.replace(/\s+/g,"")))return 1;if(t.length<2||e.length<2)return 0;let r=new Map;for(let e=0;e<t.length-1;e++){const n=t.substring(e,e+2),o=r.has(n)?r.get(n)+1:1;r.set(n,o)}let n=0;for(let t=0;t<e.length-1;t++){const o=e.substring(t,t+2),s=r.has(o)?r.get(o):0;s>0&&(r.set(o,s-1),n++)}return 2*n/(t.length+e.length-2)}t.exports={compareTwoStrings:e,findBestMatch:function(t,r){if(!function(t,e){return"string"==typeof t&&!!Array.isArray(e)&&!!e.length&&!e.find((function(t){return"string"!=typeof t}))}(t,r))throw new Error("Bad arguments: First argument should be a string, second should be an array of strings");const n=[];let o=0;for(let s=0;s<r.length;s++){const i=r[s],f=e(t,i);n.push({target:i,rating:f}),f>n[o].rating&&(o=s)}return{ratings:n,bestMatch:n[o],bestMatchIndex:o}}}}},e={},function r(n){if(e[n])return e[n].exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}(138);var t,e}));

132
lib/uuid-min.js vendored Normal file
View File

@@ -0,0 +1,132 @@
/**
* Minified by jsDelivr using Terser v5.19.2.
* Original file: /npm/uuidjs@5.1.0/dist/uuid.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
/**
* UUID.js - RFC-compliant UUID Generator for JavaScript
*
* @author LiosK
* @version v5.1.0
* @license Apache License 2.0: Copyright (c) 2010-2024 LiosK
* @packageDocumentation
*/
var _a;
export class UUID {
static generate() {
var e = _a._getRandomInt,
t = _a._hexAligner;
return t(e(32), 8) + '-' + t(e(16), 4) + '-' + t(16384 | e(12), 4) + '-' + t(32768 | e(14), 4) + '-' + t(e(48), 12);
}
static _getRandomInt(e) {
if (e < 0 || e > 53) return NaN;
var t = 0 | (1073741824 * Math.random());
return e > 30 ? t + 1073741824 * (0 | (Math.random() * (1 << (e - 30)))) : t >>> (30 - e);
}
static _hexAligner(e, t) {
for (var a = e.toString(16), i = t - a.length, n = '0'; i > 0; i >>>= 1, n += n) 1 & i && (a = n + a);
return a;
}
static useMathRandom() {
_a._getRandomInt = _a._mathPRNG;
}
static genV4() {
var e = _a._getRandomInt;
return new _a(e(32), e(16), 16384 | e(12), 128 | e(6), e(8), e(48));
}
static parse(e) {
var t;
if ((t = /^\s*(urn:uuid:|\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(\})?\s*$/i.exec(e))) {
var a = t[1] || '',
i = t[8] || '';
if (a + i === '' || ('{' === a && '}' === i) || ('urn:uuid:' === a.toLowerCase() && '' === i))
return new _a(parseInt(t[2], 16), parseInt(t[3], 16), parseInt(t[4], 16), parseInt(t[5], 16), parseInt(t[6], 16), parseInt(t[7], 16));
}
return null;
}
constructor(e, t, a, i, n, s) {
var r = _a.FIELD_NAMES,
_ = _a.FIELD_SIZES,
h = _a._binAligner,
d = _a._hexAligner;
(this.intFields = new Array(6)), (this.bitFields = new Array(6)), (this.hexFields = new Array(6));
for (var o = 0; o < 6; o++) {
var u = parseInt(arguments[o] || 0);
(this.intFields[o] = this.intFields[r[o]] = u), (this.bitFields[o] = this.bitFields[r[o]] = h(u, _[o])), (this.hexFields[o] = this.hexFields[r[o]] = d(u, _[o] >>> 2));
}
(this.version = (this.intFields.timeHiAndVersion >>> 12) & 15),
(this.bitString = this.bitFields.join('')),
(this.hexNoDelim = this.hexFields.join('')),
(this.hexString = this.hexFields[0] + '-' + this.hexFields[1] + '-' + this.hexFields[2] + '-' + this.hexFields[3] + this.hexFields[4] + '-' + this.hexFields[5]),
(this.urn = 'urn:uuid:' + this.hexString);
}
static _binAligner(e, t) {
for (var a = e.toString(2), i = t - a.length, n = '0'; i > 0; i >>>= 1, n += n) 1 & i && (a = n + a);
return a;
}
toString() {
return this.hexString;
}
equals(e) {
if (!(e instanceof _a)) return !1;
for (var t = 0; t < 6; t++) if (this.intFields[t] !== e.intFields[t]) return !1;
return !0;
}
static genV1() {
null == _a._state && (_a._state = new UUIDState());
var e = new Date().getTime(),
t = _a._state;
e != t.timestamp ? (e < t.timestamp && t.sequence++, (t.timestamp = e), (t.tick = _a._getRandomInt(12))) : t.tick < 9992 ? (t.tick += 1 + _a._getRandomInt(3)) : t.sequence++;
var a = _a._getTimeFieldValues(t.timestamp),
i = a.low + t.tick,
n = (4095 & a.hi) | 4096;
t.sequence &= 16383;
var s = (t.sequence >>> 8) | 128,
r = 255 & t.sequence;
return new _a(i, a.mid, n, s, r, t.node);
}
static resetState() {
_a._state = new UUIDState();
}
static _getTimeFieldValues(e) {
var t = e - Date.UTC(1582, 9, 15),
a = ((t / 4294967296) * 1e4) & 268435455;
return { low: (1e4 * (268435455 & t)) % 4294967296, mid: 65535 & a, hi: a >>> 16, timestamp: t };
}
static genV6() {
null == _a._state && (_a._state = new UUIDState());
var e = new Date().getTime(),
t = _a._state;
e != t.timestamp ? (e < t.timestamp && t.sequence++, (t.timestamp = e), (t.tick = _a._getRandomInt(12))) : t.tick < 9992 ? (t.tick += 1 + _a._getRandomInt(3)) : t.sequence++;
var a = t.timestamp - Date.UTC(1582, 9, 15),
i = Math.floor((a / 268435456) * 1e4) % 4294967296,
n = ((1e4 * (268435455 & a)) & 268435455) + t.tick,
s = n >>> 12,
r = (4095 & n) | 24576;
t.sequence &= 16383;
var _ = (t.sequence >>> 8) | 128,
h = 255 & t.sequence;
return new _a(i, s, r, _, h, t.node);
}
}
(_a = UUID),
(UUID._mathPRNG = _a._getRandomInt),
'undefined' != typeof crypto &&
crypto.getRandomValues &&
(_a._getRandomInt = (e) => {
if (e < 0 || e > 53) return NaN;
var t = new Uint32Array(e > 32 ? 2 : 1);
return crypto.getRandomValues(t), e > 32 ? t[0] + 4294967296 * (t[1] >>> (64 - e)) : t[0] >>> (32 - e);
}),
(UUID.FIELD_NAMES = ['timeLow', 'timeMid', 'timeHiAndVersion', 'clockSeqHiAndReserved', 'clockSeqLow', 'node']),
(UUID.FIELD_SIZES = [32, 16, 16, 8, 8, 48]),
(UUID.NIL = new _a(0, 0, 0, 0, 0, 0)),
(UUID._state = null);
class UUIDState {
constructor() {
var e = UUID._getRandomInt;
(this.timestamp = 0), (this.tick = 0), (this.sequence = e(14)), (this.node = 1099511627776 * (1 | e(8)) + e(40));
}
}
//# sourceMappingURL=/sm/14547599d24239455943f4481cadea00302ff64afee28ff8598a7fb36c36ddc0.map