Current Dev State

This commit is contained in:
Tim Lorsbach
2025-06-23 20:13:54 +02:00
parent b4f9bb277d
commit ded50edaa2
22617 changed files with 4345095 additions and 174 deletions

15
static/js/ketcher2/node_modules/tmatch/LICENSE generated vendored Normal file
View File

@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

96
static/js/ketcher2/node_modules/tmatch/README.md generated vendored Normal file
View File

@ -0,0 +1,96 @@
# tmatch
This module exists to facilitate the `t.match()` method in
[`tap`](http://npm.im/tap).
It checks whether a value matches a given "pattern". A pattern is an
object with a set of fields that must be in the test object, or a
regular expression that a test string must match, or any combination
thereof.
The algorithm is borrowed heavily from
[`only-shallow`](http://npm.im/only-shallow), with some notable
differences with respect to the handling of missing properties and the
way that regular expressions are compared to strings.
## usage
```javascript
var matches = require('tmatch')
if (!matches(testObject, pattern)) console.log("yay! diversity!");
// somewhat more realistic example..
http.get(someUrl).on('response', function (res) {
var expect = {
statusCode: 200,
headers: {
server: /express/
}
}
if (!tmatch(res, expect)) {
throw new Error('Expect 200 status code from express server')
}
})
```
## details
Copied from the source, here are the details of `tmatch`'s algorithm:
1. If the object loosely equals the pattern, and either they're both
objects or neither objects, then return true. Note that this
covers object identity, some type coercion, and matching `null`
against `undefined`, and avoids some stuff like `1 == [1]`.
2. If the object is a RegExp and the pattern is also a RegExp, return
true if their source, global, multiline, lastIndex, and ignoreCase
fields all match.
3. If the pattern is a RegExp, then return true if
`pattern.test(object)`, casting the object to a string if it is not
already a string.
4. If the pattern is a `Set`, then return true if all the keys in
`pattern` appear in `object`.
5. If the pattern is a `Map`, then return true if all the keys in
`pattern` are in `object`, and the values match as well.
6. If the object is a string and the pattern is a non-empty string,
then return true if the string occurs within the object.
7. If the object and the pattern are both Date objects, then return
true if they represent the same date.
8. If the object is a Date object, and the pattern is a string, then
return true if the pattern is parseable as a date that is the same
date as the object.
9. If the object is an `arguments` object, or the pattern is an
`arguments` object, then cast them to arrays and compare their
contents.
10. If the pattern is the `Buffer` constructor, then return true if
the object is a Buffer.
11. If the pattern is the `Function` constructor, then return true if
the object is a function.
12. If the pattern is the String constructor, then return true if the
pattern is a string.
13. If the pattern is the Boolean constructor, then return true if the
pattern is a boolean.
14. If the pattern is the Array constructor, then return true if the
pattern is an array.
15. If the pattern is any function, and then object is an object, then
return true if the object is an `instanceof` the pattern.
16. At this point, if the object or the pattern are not objects, then
return false (because they would have matched earlier).
17. If the object is a buffer, and the pattern is also a buffer, then
return true if they contain the same bytes.
18. At this point, both object and pattern are object type values, so
compare their keys:
1. Get list of all iterable keys in pattern and object. If both
are zero (two empty objects), return true.
2. Check to see if this pattern and this object have been tested
already (to handle cycles). If so, return true, since the
check higher up in the stack will catch any mismatch.
3. For each key in the pattern, match it against the corresponding
key in object. Missing keys in object will be resolved to
`undefined`, so it's possible to use `{foo:null}` as a pattern
to ensure that the object *doesn't* have a `foo` property.
## license
ISC. Go nuts.

164
static/js/ketcher2/node_modules/tmatch/index.js generated vendored Normal file
View File

@ -0,0 +1,164 @@
'use strict'
module.exports = match
function isArguments (obj) {
return Object.prototype.toString.call(obj) === '[object Arguments]'
}
function regexpSame (a, b) {
return a.source === b.source &&
a.global === b.global &&
a.multiline === b.multiline &&
a.lastIndex === b.lastIndex &&
a.ignoreCase === b.ignoreCase
}
function arrayFrom (obj) {
return Array.isArray(obj) ? obj
: Array.from ? Array.from(obj)
: Array.prototype.slice.call(obj)
}
var hasSet = typeof Set === 'function'
function isSet (object) {
return hasSet && (object instanceof Set)
}
function isMap (object) {
return hasSet && (object instanceof Map)
}
function bufferSame (a, b) {
var ret
if (a.equals) {
ret = a.equals(b)
} else if (a.length !== b.length) {
ret = false
} else {
ret = true
for (var j = 0; j < a.length && ret; j++) {
if (a[j] != b[j])
ret = false
}
}
return ret
}
function match (obj, pattern) {
return match_(obj, pattern, [], [])
}
function setMatch (obj, pattern) {
var ret = true
if (!isSet(obj))
ret = false
else if (pattern.size === 0)
ret = true
else {
pattern.forEach(function (entry) {
if (ret)
ret = obj.has(entry)
})
}
return ret
}
function mapMatch (obj, pattern, ca, cb) {
var ret = true
if (!isMap(obj))
ret = false
else if (pattern.size === 0)
ret = true
else {
pattern.forEach(function (value, key) {
if (ret)
ret = obj.has(key)
if (ret)
ret = match_(value, obj.get(key), ca, cb)
})
}
return ret
}
function match_ (obj, pattern, ca, cb) {
return obj == pattern ? (
obj === null || pattern === null ? true
: typeof obj === 'object' && typeof pattern === 'object' ? true
: typeof obj === 'object' && typeof pattern !== 'object' ? false
: typeof obj !== 'object' && typeof pattern === 'object' ? false
: true
)
: obj === null || pattern === null ? false
: pattern instanceof RegExp ? (
typeof obj === 'string' ? pattern.test(obj)
: obj instanceof RegExp ? regexpSame(obj, pattern)
: pattern.test('' + obj)
)
: isSet(pattern) ? setMatch(obj, pattern)
: isMap(pattern) ? mapMatch(obj, pattern, ca, cb)
: typeof obj === 'string' && typeof pattern === 'string' && pattern ?
obj.indexOf(pattern) !== -1
: obj instanceof Date && pattern instanceof Date ?
obj.getTime() === pattern.getTime()
: obj instanceof Date && typeof pattern === 'string' ?
obj.getTime() === new Date(pattern).getTime()
: isArguments(obj) || isArguments(pattern) ?
match_(arrayFrom(obj), arrayFrom(pattern), ca, cb)
: pattern === Buffer ? Buffer.isBuffer(obj)
: pattern === Function ? typeof obj === 'function'
: pattern === Number ?
typeof obj === 'number' && obj === obj && isFinite(obj)
: pattern !== pattern ? obj !== obj
: pattern === String ? typeof obj === 'string'
: pattern === Boolean ? typeof obj === 'boolean'
: pattern === Array ? Array.isArray(obj)
: typeof pattern === 'function' && typeof obj === 'object' ?
obj instanceof pattern
: typeof obj !== 'object' || typeof pattern !== 'object' ? false
: Buffer.isBuffer(obj) && Buffer.isBuffer(pattern) ?
bufferSame(obj, pattern)
: matchObj(obj, pattern, Object.keys(obj), Object.keys(pattern), ca, cb)
}
function matchObj (obj, pattern, kobj, kpat, ca, cb) {
var ret = true
// don't bother with stack acrobatics if there's nothing there
if (kobj.length === 0 && kpat.length === 0)
ret = true
else {
// if we've seen this exact pattern and object already, then
// it means that pattern and obj have matching cyclicalness
// however, non-cyclical patterns can match cyclical objects
var cal = ca.length
var go = true
while (cal-- && go) {
if (ca[cal] === obj && cb[cal] === pattern) {
ret = true
go = false
}
}
if (go) {
ca.push(obj)
cb.push(pattern)
var key
for (var l = kpat.length - 1; l >= 0 && ret; l--) {
key = kpat[l]
if (!match_(obj[key], pattern[key], ca, cb))
ret = false
}
if (ret) {
ca.pop()
cb.pop()
}
}
}
return ret
}

54
static/js/ketcher2/node_modules/tmatch/package.json generated vendored Normal file
View File

@ -0,0 +1,54 @@
{
"_from": "tmatch@^3.1.0",
"_id": "tmatch@3.1.0",
"_inBundle": false,
"_integrity": "sha512-W3MSATOCN4pVu2qFxmJLIArSifeSOFqnfx9hiUaVgOmeRoI2NbU7RNga+6G+L8ojlFeQge+ZPCclWyUpQ8UeNQ==",
"_location": "/tmatch",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "tmatch@^3.1.0",
"name": "tmatch",
"escapedName": "tmatch",
"rawSpec": "^3.1.0",
"saveSpec": null,
"fetchSpec": "^3.1.0"
},
"_requiredBy": [
"/tap"
],
"_resolved": "https://registry.npmjs.org/tmatch/-/tmatch-3.1.0.tgz",
"_shasum": "701264fd7582d0144a80c85af3358cca269c71e3",
"_spec": "tmatch@^3.1.0",
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/tap",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"bugs": {
"url": "https://github.com/isaacs/tmatch/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "This module exists to facilitate the `t.match()` method in [`tap`](http://npm.im/tap).",
"devDependencies": {
"tap": "^10.4.0"
},
"homepage": "https://github.com/isaacs/tmatch#readme",
"license": "ISC",
"main": "index.js",
"name": "tmatch",
"repository": {
"type": "git",
"url": "git+https://github.com/isaacs/tmatch.git"
},
"scripts": {
"postpublish": "git push origin --all; git push origin --tags",
"postversion": "npm publish",
"preversion": "npm test",
"test": "tap --100 test/*.js -J"
},
"version": "3.1.0"
}

293
static/js/ketcher2/node_modules/tmatch/test/deep.js generated vendored Normal file
View File

@ -0,0 +1,293 @@
var tap = require('tap')
var test = tap.test
var match = require('../')
test("shouldn't care about key order and types", function (t) {
t.ok(match({ a: 1, b: 2 }, { b: 2, a: '1' }))
t.end()
})
test('should notice objects with different shapes', function (t) {
t.notOk(match(
{ a: 1, b: 'a thing' },
{ a: 1, b: undefined }
))
t.ok(match(
{ a: 1 },
{ a: 1, b: undefined }
))
t.end()
})
test('extra keys in object are ok', function (t) {
t.ok(match(
{ a: 1, b: null, c: 'ok' },
{ a: 1, b: undefined }
))
t.end()
})
test('should notice objects with different keys', function (t) {
t.notOk(match(
{ a: 1, b: 2 },
{ a: 1, c: 2 }
))
t.end()
})
test('should handle dates', function (t) {
t.notOk(match(new Date('1972-08-01'), null))
t.notOk(match(new Date('1972-08-01'), undefined))
t.ok(match(new Date('1972-08-01'), new Date('1972-08-01')))
t.ok(match({ x: new Date('1972-08-01') }, { x: new Date('1972-08-01') }))
t.end()
})
test('should handle RegExps', function (t) {
t.notOk(match(/[b]/, /[a]/))
t.notOk(match(/[a]/i, /[a]/g))
t.ok(match(/[a]/, /[a]/))
t.ok(match(/ab?[a-z]{,6}/g, /ab?[a-z]{,6}/g))
t.notOk(match([1, 2, 3], /asdf/))
t.ok(match([1, 2, 3], /,2,/))
t.ok(match({ x: 123 }, { x: /^\w+/ }))
t.ok(match({ toString: function () { return 'FooBar' }}, /^FooBar$/))
t.notOk(match({ toString: function () { return 'x' }}, /^FooBar$/))
t.end()
})
test('should handle functions', function (t) {
var fnA = function (a) { return a }
var fnB = function (a) { return a }
t.notOk(match(
function a () {},
function a () {} // but is it the _same_ a tho
))
t.notOk(match(fnA, fnB))
t.ok(match(fnA, fnA))
t.ok(match(fnB, fnB))
t.end()
})
test('should handle arguments', function (t) {
var outer = arguments
;(function (tt) {
var inner = arguments
t.ok(match(outer, outer))
t.ok(match(outer, inner))
t.ok(match(outer, [t]))
}(t))
t.end()
})
test('same arrays match', function (t) {
t.ok(match([1, 2, 3], [1, 2, 3]))
t.end()
})
test("different arrays don't match", function (t) {
t.notOk(match([1, 2, 3], [1, 2, 3, 4]))
t.notOk(match([1, 2, 3], [1, 2, 4]))
t.end()
})
test('empty arrays match', function (t) {
t.ok(match([], []))
t.ok(match({ x: [] }, { x: [] }))
t.end()
})
test("shallower shouldn't care about key order recursively and types", function (t) {
t.ok(match(
{ x: { a: 1, b: 2 }, y: { c: 3, d: 4 } },
{ y: { d: 4, c: 3 }, x: { b: '2', a: '1' } }
))
t.end()
})
test('undefined is the same as itself', function (t) {
t.ok(match(undefined, undefined))
t.ok(match({ x: undefined }, { x: undefined }))
t.ok(match({ x: [undefined] }, { x: [undefined] }))
t.end()
})
test('undefined and null are Close Enough', function (t) {
t.ok(match(undefined, null))
t.ok(match({ x: null }, { x: undefined }))
t.ok(match({ x: [undefined] }, { x: [null] }))
t.end()
})
test("null is as shallow as you'd expect", function (t) {
t.ok(match(null, null))
t.ok(match({ x: null }, { x: null }))
t.ok(match({ x: [null] }, { x: [null] }))
t.end()
})
test('the same number matches', function (t) {
t.ok(match(0, 0))
t.ok(match(1, 1))
t.ok(match(3.14, 3.14))
t.end()
})
test("different numbers don't match", function (t) {
t.notOk(match(0, 1))
t.notOk(match(1, -1))
t.notOk(match(3.14, 2.72))
t.end()
})
test("tmatch shouldn't care about key order (but still might) and types", function (t) {
t.ok(match(
[
{ foo: { z: 100, y: 200, x: 300 } },
'bar',
11,
{ baz: { d: 4, a: 1, b: 2, c: 3 } }
],
[
{ foo: { z: 100, y: 200, x: 300 } },
'bar',
11,
{ baz: { a: '1', b: '2', c: '3', d: '4' } }
]
))
t.end()
})
test("match shouldn't blow up on circular data structures", function (t) {
var x1 = { z: 4 }
var y1 = { x: x1 }
x1.y = y1
var x2 = { z: 4 }
var y2 = { x: x2 }
x2.y = y2
t.ok(match(x1, x2))
t.end()
})
test('regexps match strings', function (t) {
var x = { one: 'String' }
var y = { one: /.ring$/ }
t.ok(match(x, y))
t.ok(match(x.one, y.one))
x = [ 'String', 'String' ]
y = [ /.ring$/, /.ring$/ ]
t.ok(match(x, y))
x = [ 'Ring', /.ring$/ ]
y = [ /.ring$/ ]
t.notOk(match(x, y))
t.end()
})
test('partial strings match on indexOf', function (t) {
var x = { one: 'String' }
var y = { one: 'rin' }
t.ok(match(x, y))
t.notOk(match(y, x))
t.end()
})
test('ctors and other fun things', function (t) {
function Foo () {
this._isFoo = 'foo'
}
if (!Buffer.prototype.equals) {
Buffer.prototype.equals = function (pattern) {
var obj = this
if (obj.length !== pattern.length) return false
for (var j = 0; j < obj.length; j++) if (obj[j] != pattern[j]) return false
return true
}
}
t.notOk(match(new Buffer('asdf'), new Buffer('asdff')))
var d = new Date().toISOString()
var obj = {
buffer: new Buffer('x'),
date: new Date(d),
fn: function () {},
foo: new Foo(),
num: 1.2,
nan: NaN,
bool: true,
array: [],
str: 'asdf',
inf: Infinity,
neginf: -Infinity
}
t.ok(match(obj, {
buffer: Buffer,
date: Date,
fn: Function,
foo: Foo,
num: Number,
nan: NaN,
bool: Boolean,
array: Array,
str: String
}))
t.ok(match(obj, {
buffer: new Buffer('x'),
date: d,
foo: new Foo(),
str: 'sd'
}))
var buf = new Buffer('x')
buf.equals = null
t.ok(match(obj, {
buffer: buf
}))
var buf2 = new Buffer('y')
buf2.equals = null
t.notOk(match(buf, buf2))
var buf3 = new Buffer('xy')
buf3.equals = null
t.notOk(match(buf, buf3))
var buf4 = new Buffer('xy')
buf4.equals = null
t.ok(match(buf4, buf3))
t.notOk(match(obj, {
inf: Number
}))
t.notOk(match(obj, {
neginf: Number
}))
t.notOk(match(obj, {
nan: Number
}))
t.end()
})
test('js WAT! array/string stuff', function (t) {
t.notOk(match([1], 1))
t.notOk(match(1, [1]))
t.ok(match([1], [1]))
var o = {}
t.ok(match(o, o))
t.ok(match(1, '1'))
t.end()
})

View File

@ -0,0 +1,3 @@
'use strict'
Array.from = null
require('./deep.js')

50
static/js/ketcher2/node_modules/tmatch/test/set-map.js generated vendored Normal file
View File

@ -0,0 +1,50 @@
'use strict'
var tmatch = require('../')
var t = require('tap')
t.test('set', function (t) {
var obj = { a: 1 }
var pattern = new Set([obj, 4])
var a = new Set([1, 2, 3, 4, obj])
var b = new Set([obj, 2, 4, 3, 1])
var c = new Set([4, 3, 2, 1, { a: 1 }])
t.ok(tmatch(a, pattern))
t.ok(tmatch(b, pattern))
t.notOk(tmatch(c, pattern))
t.notOk(tmatch({not: 'a set'}, pattern))
t.ok(tmatch(a, b))
t.notOk(tmatch(a, c))
t.notOk(tmatch(b, c))
t.ok(tmatch(new Set(), new Set()))
t.notOk(tmatch(a, Array.from(a)))
t.end()
})
t.test('map', function (t) {
var obj = { a: 1 }
var pattern = new Map([[5, { a: 1 }], [obj, '6']])
var a = new Map([[1, 2], [3, 4], [5, obj], [ obj, 6 ]])
var b = new Map([[3, 4], [5, obj], [ obj, 6 ], [1, 2]])
// values match, but not strictly
var c = new Map([[3, 4], [5, { a: '1' }], [ obj, 6 ], [1, 2]])
// keys don't match
var d = new Map([[3, 4], [5, { a: 1 }], [ { a: 1 }, 6 ], [1, 2]])
t.ok(tmatch(a, pattern))
t.ok(tmatch(b, pattern))
t.ok(tmatch(c, pattern))
t.notOk(tmatch(d, pattern))
t.notOk(tmatch({not: 'a map'}, pattern))
t.ok(tmatch(a, b))
t.ok(tmatch(a, c))
t.ok(tmatch(b, c))
t.ok(tmatch(new Map(), new Map()))
t.notOk(tmatch(a, Array.from(a)))
t.notOk(tmatch(a, d))
t.notOk(tmatch(a, d))
t.end()
})