@kevisual/cli 0.0.98 → 0.0.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52746,7 +52746,7 @@ var require_extension = __commonJS((exports, module) => {
52746
52746
  else
52747
52747
  dest[name].push(elem);
52748
52748
  }
52749
- function parse3(header) {
52749
+ function parse2(header) {
52750
52750
  const offers = Object.create(null);
52751
52751
  let params = Object.create(null);
52752
52752
  let mustUnescape = false;
@@ -52884,7 +52884,7 @@ var require_extension = __commonJS((exports, module) => {
52884
52884
  }
52885
52885
  return offers;
52886
52886
  }
52887
- function format3(extensions) {
52887
+ function format2(extensions) {
52888
52888
  return Object.keys(extensions).map((extension2) => {
52889
52889
  let configurations = extensions[extension2];
52890
52890
  if (!Array.isArray(configurations))
@@ -52899,7 +52899,7 @@ var require_extension = __commonJS((exports, module) => {
52899
52899
  }).join(", ");
52900
52900
  }).join(", ");
52901
52901
  }
52902
- module.exports = { format: format3, parse: parse3 };
52902
+ module.exports = { format: format2, parse: parse2 };
52903
52903
  });
52904
52904
 
52905
52905
  // ../node_modules/.pnpm/@kevisual+ws@8.0.0/node_modules/@kevisual/ws/lib/websocket.js
@@ -52929,7 +52929,7 @@ var require_websocket = __commonJS((exports, module) => {
52929
52929
  var {
52930
52930
  EventTarget: { addEventListener, removeEventListener }
52931
52931
  } = require_event_target();
52932
- var { format: format3, parse: parse3 } = require_extension();
52932
+ var { format: format2, parse: parse2 } = require_extension();
52933
52933
  var { toBuffer } = require_buffer_util();
52934
52934
  var closeTimeout = 30 * 1000;
52935
52935
  var kAborted = Symbol("kAborted");
@@ -53337,7 +53337,7 @@ var require_websocket = __commonJS((exports, module) => {
53337
53337
  opts.timeout = opts.handshakeTimeout;
53338
53338
  if (opts.perMessageDeflate) {
53339
53339
  perMessageDeflate = new PerMessageDeflate(opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, false, opts.maxPayload);
53340
- opts.headers["Sec-WebSocket-Extensions"] = format3({
53340
+ opts.headers["Sec-WebSocket-Extensions"] = format2({
53341
53341
  [PerMessageDeflate.extensionName]: perMessageDeflate.offer()
53342
53342
  });
53343
53343
  }
@@ -53472,7 +53472,7 @@ var require_websocket = __commonJS((exports, module) => {
53472
53472
  }
53473
53473
  let extensions;
53474
53474
  try {
53475
- extensions = parse3(secWebSocketExtensions);
53475
+ extensions = parse2(secWebSocketExtensions);
53476
53476
  } catch (err) {
53477
53477
  const message = "Invalid Sec-WebSocket-Extensions header";
53478
53478
  abortHandshake(websocket2, socket, message);
@@ -53767,7 +53767,7 @@ var require_stream6 = __commonJS((exports, module) => {
53767
53767
  // ../node_modules/.pnpm/@kevisual+ws@8.0.0/node_modules/@kevisual/ws/lib/subprotocol.js
53768
53768
  var require_subprotocol = __commonJS((exports, module) => {
53769
53769
  var { tokenChars } = require_validation();
53770
- function parse3(header) {
53770
+ function parse2(header) {
53771
53771
  const protocols = new Set;
53772
53772
  let start4 = -1;
53773
53773
  let end = -1;
@@ -53806,7 +53806,7 @@ var require_subprotocol = __commonJS((exports, module) => {
53806
53806
  protocols.add(protocol);
53807
53807
  return protocols;
53808
53808
  }
53809
- module.exports = { parse: parse3 };
53809
+ module.exports = { parse: parse2 };
53810
53810
  });
53811
53811
 
53812
53812
  // ../node_modules/.pnpm/@kevisual+ws@8.0.0/node_modules/@kevisual/ws/lib/websocket-server.js
@@ -89951,1300 +89951,6 @@ var initApi = async (opts) => {
89951
89951
  message: "初始化路由成功"
89952
89952
  };
89953
89953
  };
89954
-
89955
- // ../node_modules/.pnpm/fuse.js@7.1.0/node_modules/fuse.js/dist/fuse.mjs
89956
- function isArray2(value) {
89957
- return !Array.isArray ? getTag(value) === "[object Array]" : Array.isArray(value);
89958
- }
89959
- var INFINITY = 1 / 0;
89960
- function baseToString(value) {
89961
- if (typeof value == "string") {
89962
- return value;
89963
- }
89964
- let result = value + "";
89965
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
89966
- }
89967
- function toString(value) {
89968
- return value == null ? "" : baseToString(value);
89969
- }
89970
- function isString(value) {
89971
- return typeof value === "string";
89972
- }
89973
- function isNumber2(value) {
89974
- return typeof value === "number";
89975
- }
89976
- function isBoolean(value) {
89977
- return value === true || value === false || isObjectLike2(value) && getTag(value) == "[object Boolean]";
89978
- }
89979
- function isObject3(value) {
89980
- return typeof value === "object";
89981
- }
89982
- function isObjectLike2(value) {
89983
- return isObject3(value) && value !== null;
89984
- }
89985
- function isDefined(value) {
89986
- return value !== undefined && value !== null;
89987
- }
89988
- function isBlank(value) {
89989
- return !value.trim().length;
89990
- }
89991
- function getTag(value) {
89992
- return value == null ? value === undefined ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(value);
89993
- }
89994
- var INCORRECT_INDEX_TYPE = "Incorrect 'index' type";
89995
- var LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key) => `Invalid value for key ${key}`;
89996
- var PATTERN_LENGTH_TOO_LARGE = (max) => `Pattern length exceeds max of ${max}.`;
89997
- var MISSING_KEY_PROPERTY = (name) => `Missing ${name} property in key`;
89998
- var INVALID_KEY_WEIGHT_VALUE = (key) => `Property 'weight' in key '${key}' must be a positive integer`;
89999
- var hasOwn = Object.prototype.hasOwnProperty;
90000
-
90001
- class KeyStore {
90002
- constructor(keys) {
90003
- this._keys = [];
90004
- this._keyMap = {};
90005
- let totalWeight = 0;
90006
- keys.forEach((key) => {
90007
- let obj = createKey(key);
90008
- this._keys.push(obj);
90009
- this._keyMap[obj.id] = obj;
90010
- totalWeight += obj.weight;
90011
- });
90012
- this._keys.forEach((key) => {
90013
- key.weight /= totalWeight;
90014
- });
90015
- }
90016
- get(keyId) {
90017
- return this._keyMap[keyId];
90018
- }
90019
- keys() {
90020
- return this._keys;
90021
- }
90022
- toJSON() {
90023
- return JSON.stringify(this._keys);
90024
- }
90025
- }
90026
- function createKey(key) {
90027
- let path10 = null;
90028
- let id2 = null;
90029
- let src = null;
90030
- let weight = 1;
90031
- let getFn = null;
90032
- if (isString(key) || isArray2(key)) {
90033
- src = key;
90034
- path10 = createKeyPath(key);
90035
- id2 = createKeyId(key);
90036
- } else {
90037
- if (!hasOwn.call(key, "name")) {
90038
- throw new Error(MISSING_KEY_PROPERTY("name"));
90039
- }
90040
- const name = key.name;
90041
- src = name;
90042
- if (hasOwn.call(key, "weight")) {
90043
- weight = key.weight;
90044
- if (weight <= 0) {
90045
- throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
90046
- }
90047
- }
90048
- path10 = createKeyPath(name);
90049
- id2 = createKeyId(name);
90050
- getFn = key.getFn;
90051
- }
90052
- return { path: path10, id: id2, weight, src, getFn };
90053
- }
90054
- function createKeyPath(key) {
90055
- return isArray2(key) ? key : key.split(".");
90056
- }
90057
- function createKeyId(key) {
90058
- return isArray2(key) ? key.join(".") : key;
90059
- }
90060
- function get(obj, path10) {
90061
- let list4 = [];
90062
- let arr = false;
90063
- const deepGet = (obj2, path11, index2) => {
90064
- if (!isDefined(obj2)) {
90065
- return;
90066
- }
90067
- if (!path11[index2]) {
90068
- list4.push(obj2);
90069
- } else {
90070
- let key = path11[index2];
90071
- const value = obj2[key];
90072
- if (!isDefined(value)) {
90073
- return;
90074
- }
90075
- if (index2 === path11.length - 1 && (isString(value) || isNumber2(value) || isBoolean(value))) {
90076
- list4.push(toString(value));
90077
- } else if (isArray2(value)) {
90078
- arr = true;
90079
- for (let i = 0, len = value.length;i < len; i += 1) {
90080
- deepGet(value[i], path11, index2 + 1);
90081
- }
90082
- } else if (path11.length) {
90083
- deepGet(value, path11, index2 + 1);
90084
- }
90085
- }
90086
- };
90087
- deepGet(obj, isString(path10) ? path10.split(".") : path10, 0);
90088
- return arr ? list4 : list4[0];
90089
- }
90090
- var MatchOptions = {
90091
- includeMatches: false,
90092
- findAllMatches: false,
90093
- minMatchCharLength: 1
90094
- };
90095
- var BasicOptions = {
90096
- isCaseSensitive: false,
90097
- ignoreDiacritics: false,
90098
- includeScore: false,
90099
- keys: [],
90100
- shouldSort: true,
90101
- sortFn: (a, b) => a.score === b.score ? a.idx < b.idx ? -1 : 1 : a.score < b.score ? -1 : 1
90102
- };
90103
- var FuzzyOptions = {
90104
- location: 0,
90105
- threshold: 0.6,
90106
- distance: 100
90107
- };
90108
- var AdvancedOptions = {
90109
- useExtendedSearch: false,
90110
- getFn: get,
90111
- ignoreLocation: false,
90112
- ignoreFieldNorm: false,
90113
- fieldNormWeight: 1
90114
- };
90115
- var Config = {
90116
- ...BasicOptions,
90117
- ...MatchOptions,
90118
- ...FuzzyOptions,
90119
- ...AdvancedOptions
90120
- };
90121
- var SPACE = /[^ ]+/g;
90122
- function norm(weight = 1, mantissa = 3) {
90123
- const cache = new Map;
90124
- const m = Math.pow(10, mantissa);
90125
- return {
90126
- get(value) {
90127
- const numTokens = value.match(SPACE).length;
90128
- if (cache.has(numTokens)) {
90129
- return cache.get(numTokens);
90130
- }
90131
- const norm2 = 1 / Math.pow(numTokens, 0.5 * weight);
90132
- const n = parseFloat(Math.round(norm2 * m) / m);
90133
- cache.set(numTokens, n);
90134
- return n;
90135
- },
90136
- clear() {
90137
- cache.clear();
90138
- }
90139
- };
90140
- }
90141
-
90142
- class FuseIndex {
90143
- constructor({
90144
- getFn = Config.getFn,
90145
- fieldNormWeight = Config.fieldNormWeight
90146
- } = {}) {
90147
- this.norm = norm(fieldNormWeight, 3);
90148
- this.getFn = getFn;
90149
- this.isCreated = false;
90150
- this.setIndexRecords();
90151
- }
90152
- setSources(docs = []) {
90153
- this.docs = docs;
90154
- }
90155
- setIndexRecords(records = []) {
90156
- this.records = records;
90157
- }
90158
- setKeys(keys = []) {
90159
- this.keys = keys;
90160
- this._keysMap = {};
90161
- keys.forEach((key, idx) => {
90162
- this._keysMap[key.id] = idx;
90163
- });
90164
- }
90165
- create() {
90166
- if (this.isCreated || !this.docs.length) {
90167
- return;
90168
- }
90169
- this.isCreated = true;
90170
- if (isString(this.docs[0])) {
90171
- this.docs.forEach((doc, docIndex) => {
90172
- this._addString(doc, docIndex);
90173
- });
90174
- } else {
90175
- this.docs.forEach((doc, docIndex) => {
90176
- this._addObject(doc, docIndex);
90177
- });
90178
- }
90179
- this.norm.clear();
90180
- }
90181
- add(doc) {
90182
- const idx = this.size();
90183
- if (isString(doc)) {
90184
- this._addString(doc, idx);
90185
- } else {
90186
- this._addObject(doc, idx);
90187
- }
90188
- }
90189
- removeAt(idx) {
90190
- this.records.splice(idx, 1);
90191
- for (let i = idx, len = this.size();i < len; i += 1) {
90192
- this.records[i].i -= 1;
90193
- }
90194
- }
90195
- getValueForItemAtKeyId(item, keyId) {
90196
- return item[this._keysMap[keyId]];
90197
- }
90198
- size() {
90199
- return this.records.length;
90200
- }
90201
- _addString(doc, docIndex) {
90202
- if (!isDefined(doc) || isBlank(doc)) {
90203
- return;
90204
- }
90205
- let record2 = {
90206
- v: doc,
90207
- i: docIndex,
90208
- n: this.norm.get(doc)
90209
- };
90210
- this.records.push(record2);
90211
- }
90212
- _addObject(doc, docIndex) {
90213
- let record2 = { i: docIndex, $: {} };
90214
- this.keys.forEach((key, keyIndex) => {
90215
- let value = key.getFn ? key.getFn(doc) : this.getFn(doc, key.path);
90216
- if (!isDefined(value)) {
90217
- return;
90218
- }
90219
- if (isArray2(value)) {
90220
- let subRecords = [];
90221
- const stack = [{ nestedArrIndex: -1, value }];
90222
- while (stack.length) {
90223
- const { nestedArrIndex, value: value2 } = stack.pop();
90224
- if (!isDefined(value2)) {
90225
- continue;
90226
- }
90227
- if (isString(value2) && !isBlank(value2)) {
90228
- let subRecord = {
90229
- v: value2,
90230
- i: nestedArrIndex,
90231
- n: this.norm.get(value2)
90232
- };
90233
- subRecords.push(subRecord);
90234
- } else if (isArray2(value2)) {
90235
- value2.forEach((item, k) => {
90236
- stack.push({
90237
- nestedArrIndex: k,
90238
- value: item
90239
- });
90240
- });
90241
- } else
90242
- ;
90243
- }
90244
- record2.$[keyIndex] = subRecords;
90245
- } else if (isString(value) && !isBlank(value)) {
90246
- let subRecord = {
90247
- v: value,
90248
- n: this.norm.get(value)
90249
- };
90250
- record2.$[keyIndex] = subRecord;
90251
- }
90252
- });
90253
- this.records.push(record2);
90254
- }
90255
- toJSON() {
90256
- return {
90257
- keys: this.keys,
90258
- records: this.records
90259
- };
90260
- }
90261
- }
90262
- function createIndex(keys, docs, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
90263
- const myIndex = new FuseIndex({ getFn, fieldNormWeight });
90264
- myIndex.setKeys(keys.map(createKey));
90265
- myIndex.setSources(docs);
90266
- myIndex.create();
90267
- return myIndex;
90268
- }
90269
- function parseIndex(data, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
90270
- const { keys, records } = data;
90271
- const myIndex = new FuseIndex({ getFn, fieldNormWeight });
90272
- myIndex.setKeys(keys);
90273
- myIndex.setIndexRecords(records);
90274
- return myIndex;
90275
- }
90276
- function computeScore$1(pattern2, {
90277
- errors = 0,
90278
- currentLocation = 0,
90279
- expectedLocation = 0,
90280
- distance = Config.distance,
90281
- ignoreLocation = Config.ignoreLocation
90282
- } = {}) {
90283
- const accuracy = errors / pattern2.length;
90284
- if (ignoreLocation) {
90285
- return accuracy;
90286
- }
90287
- const proximity = Math.abs(expectedLocation - currentLocation);
90288
- if (!distance) {
90289
- return proximity ? 1 : accuracy;
90290
- }
90291
- return accuracy + proximity / distance;
90292
- }
90293
- function convertMaskToIndices(matchmask = [], minMatchCharLength = Config.minMatchCharLength) {
90294
- let indices = [];
90295
- let start4 = -1;
90296
- let end = -1;
90297
- let i = 0;
90298
- for (let len = matchmask.length;i < len; i += 1) {
90299
- let match = matchmask[i];
90300
- if (match && start4 === -1) {
90301
- start4 = i;
90302
- } else if (!match && start4 !== -1) {
90303
- end = i - 1;
90304
- if (end - start4 + 1 >= minMatchCharLength) {
90305
- indices.push([start4, end]);
90306
- }
90307
- start4 = -1;
90308
- }
90309
- }
90310
- if (matchmask[i - 1] && i - start4 >= minMatchCharLength) {
90311
- indices.push([start4, i - 1]);
90312
- }
90313
- return indices;
90314
- }
90315
- var MAX_BITS = 32;
90316
- function search(text, pattern2, patternAlphabet, {
90317
- location: location2 = Config.location,
90318
- distance = Config.distance,
90319
- threshold = Config.threshold,
90320
- findAllMatches = Config.findAllMatches,
90321
- minMatchCharLength = Config.minMatchCharLength,
90322
- includeMatches = Config.includeMatches,
90323
- ignoreLocation = Config.ignoreLocation
90324
- } = {}) {
90325
- if (pattern2.length > MAX_BITS) {
90326
- throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS));
90327
- }
90328
- const patternLen = pattern2.length;
90329
- const textLen = text.length;
90330
- const expectedLocation = Math.max(0, Math.min(location2, textLen));
90331
- let currentThreshold = threshold;
90332
- let bestLocation = expectedLocation;
90333
- const computeMatches = minMatchCharLength > 1 || includeMatches;
90334
- const matchMask = computeMatches ? Array(textLen) : [];
90335
- let index2;
90336
- while ((index2 = text.indexOf(pattern2, bestLocation)) > -1) {
90337
- let score = computeScore$1(pattern2, {
90338
- currentLocation: index2,
90339
- expectedLocation,
90340
- distance,
90341
- ignoreLocation
90342
- });
90343
- currentThreshold = Math.min(score, currentThreshold);
90344
- bestLocation = index2 + patternLen;
90345
- if (computeMatches) {
90346
- let i = 0;
90347
- while (i < patternLen) {
90348
- matchMask[index2 + i] = 1;
90349
- i += 1;
90350
- }
90351
- }
90352
- }
90353
- bestLocation = -1;
90354
- let lastBitArr = [];
90355
- let finalScore = 1;
90356
- let binMax = patternLen + textLen;
90357
- const mask = 1 << patternLen - 1;
90358
- for (let i = 0;i < patternLen; i += 1) {
90359
- let binMin = 0;
90360
- let binMid = binMax;
90361
- while (binMin < binMid) {
90362
- const score2 = computeScore$1(pattern2, {
90363
- errors: i,
90364
- currentLocation: expectedLocation + binMid,
90365
- expectedLocation,
90366
- distance,
90367
- ignoreLocation
90368
- });
90369
- if (score2 <= currentThreshold) {
90370
- binMin = binMid;
90371
- } else {
90372
- binMax = binMid;
90373
- }
90374
- binMid = Math.floor((binMax - binMin) / 2 + binMin);
90375
- }
90376
- binMax = binMid;
90377
- let start4 = Math.max(1, expectedLocation - binMid + 1);
90378
- let finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen;
90379
- let bitArr = Array(finish + 2);
90380
- bitArr[finish + 1] = (1 << i) - 1;
90381
- for (let j = finish;j >= start4; j -= 1) {
90382
- let currentLocation = j - 1;
90383
- let charMatch = patternAlphabet[text.charAt(currentLocation)];
90384
- if (computeMatches) {
90385
- matchMask[currentLocation] = +!!charMatch;
90386
- }
90387
- bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch;
90388
- if (i) {
90389
- bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1];
90390
- }
90391
- if (bitArr[j] & mask) {
90392
- finalScore = computeScore$1(pattern2, {
90393
- errors: i,
90394
- currentLocation,
90395
- expectedLocation,
90396
- distance,
90397
- ignoreLocation
90398
- });
90399
- if (finalScore <= currentThreshold) {
90400
- currentThreshold = finalScore;
90401
- bestLocation = currentLocation;
90402
- if (bestLocation <= expectedLocation) {
90403
- break;
90404
- }
90405
- start4 = Math.max(1, 2 * expectedLocation - bestLocation);
90406
- }
90407
- }
90408
- }
90409
- const score = computeScore$1(pattern2, {
90410
- errors: i + 1,
90411
- currentLocation: expectedLocation,
90412
- expectedLocation,
90413
- distance,
90414
- ignoreLocation
90415
- });
90416
- if (score > currentThreshold) {
90417
- break;
90418
- }
90419
- lastBitArr = bitArr;
90420
- }
90421
- const result = {
90422
- isMatch: bestLocation >= 0,
90423
- score: Math.max(0.001, finalScore)
90424
- };
90425
- if (computeMatches) {
90426
- const indices = convertMaskToIndices(matchMask, minMatchCharLength);
90427
- if (!indices.length) {
90428
- result.isMatch = false;
90429
- } else if (includeMatches) {
90430
- result.indices = indices;
90431
- }
90432
- }
90433
- return result;
90434
- }
90435
- function createPatternAlphabet(pattern2) {
90436
- let mask = {};
90437
- for (let i = 0, len = pattern2.length;i < len; i += 1) {
90438
- const char = pattern2.charAt(i);
90439
- mask[char] = (mask[char] || 0) | 1 << len - i - 1;
90440
- }
90441
- return mask;
90442
- }
90443
- var stripDiacritics = String.prototype.normalize ? (str) => str.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, "") : (str) => str;
90444
-
90445
- class BitapSearch {
90446
- constructor(pattern2, {
90447
- location: location2 = Config.location,
90448
- threshold = Config.threshold,
90449
- distance = Config.distance,
90450
- includeMatches = Config.includeMatches,
90451
- findAllMatches = Config.findAllMatches,
90452
- minMatchCharLength = Config.minMatchCharLength,
90453
- isCaseSensitive = Config.isCaseSensitive,
90454
- ignoreDiacritics = Config.ignoreDiacritics,
90455
- ignoreLocation = Config.ignoreLocation
90456
- } = {}) {
90457
- this.options = {
90458
- location: location2,
90459
- threshold,
90460
- distance,
90461
- includeMatches,
90462
- findAllMatches,
90463
- minMatchCharLength,
90464
- isCaseSensitive,
90465
- ignoreDiacritics,
90466
- ignoreLocation
90467
- };
90468
- pattern2 = isCaseSensitive ? pattern2 : pattern2.toLowerCase();
90469
- pattern2 = ignoreDiacritics ? stripDiacritics(pattern2) : pattern2;
90470
- this.pattern = pattern2;
90471
- this.chunks = [];
90472
- if (!this.pattern.length) {
90473
- return;
90474
- }
90475
- const addChunk = (pattern3, startIndex) => {
90476
- this.chunks.push({
90477
- pattern: pattern3,
90478
- alphabet: createPatternAlphabet(pattern3),
90479
- startIndex
90480
- });
90481
- };
90482
- const len = this.pattern.length;
90483
- if (len > MAX_BITS) {
90484
- let i = 0;
90485
- const remainder = len % MAX_BITS;
90486
- const end = len - remainder;
90487
- while (i < end) {
90488
- addChunk(this.pattern.substr(i, MAX_BITS), i);
90489
- i += MAX_BITS;
90490
- }
90491
- if (remainder) {
90492
- const startIndex = len - MAX_BITS;
90493
- addChunk(this.pattern.substr(startIndex), startIndex);
90494
- }
90495
- } else {
90496
- addChunk(this.pattern, 0);
90497
- }
90498
- }
90499
- searchIn(text) {
90500
- const { isCaseSensitive, ignoreDiacritics, includeMatches } = this.options;
90501
- text = isCaseSensitive ? text : text.toLowerCase();
90502
- text = ignoreDiacritics ? stripDiacritics(text) : text;
90503
- if (this.pattern === text) {
90504
- let result2 = {
90505
- isMatch: true,
90506
- score: 0
90507
- };
90508
- if (includeMatches) {
90509
- result2.indices = [[0, text.length - 1]];
90510
- }
90511
- return result2;
90512
- }
90513
- const {
90514
- location: location2,
90515
- distance,
90516
- threshold,
90517
- findAllMatches,
90518
- minMatchCharLength,
90519
- ignoreLocation
90520
- } = this.options;
90521
- let allIndices = [];
90522
- let totalScore = 0;
90523
- let hasMatches = false;
90524
- this.chunks.forEach(({ pattern: pattern2, alphabet, startIndex }) => {
90525
- const { isMatch, score, indices } = search(text, pattern2, alphabet, {
90526
- location: location2 + startIndex,
90527
- distance,
90528
- threshold,
90529
- findAllMatches,
90530
- minMatchCharLength,
90531
- includeMatches,
90532
- ignoreLocation
90533
- });
90534
- if (isMatch) {
90535
- hasMatches = true;
90536
- }
90537
- totalScore += score;
90538
- if (isMatch && indices) {
90539
- allIndices = [...allIndices, ...indices];
90540
- }
90541
- });
90542
- let result = {
90543
- isMatch: hasMatches,
90544
- score: hasMatches ? totalScore / this.chunks.length : 1
90545
- };
90546
- if (hasMatches && includeMatches) {
90547
- result.indices = allIndices;
90548
- }
90549
- return result;
90550
- }
90551
- }
90552
-
90553
- class BaseMatch {
90554
- constructor(pattern2) {
90555
- this.pattern = pattern2;
90556
- }
90557
- static isMultiMatch(pattern2) {
90558
- return getMatch(pattern2, this.multiRegex);
90559
- }
90560
- static isSingleMatch(pattern2) {
90561
- return getMatch(pattern2, this.singleRegex);
90562
- }
90563
- search() {}
90564
- }
90565
- function getMatch(pattern2, exp) {
90566
- const matches = pattern2.match(exp);
90567
- return matches ? matches[1] : null;
90568
- }
90569
-
90570
- class ExactMatch extends BaseMatch {
90571
- constructor(pattern2) {
90572
- super(pattern2);
90573
- }
90574
- static get type() {
90575
- return "exact";
90576
- }
90577
- static get multiRegex() {
90578
- return /^="(.*)"$/;
90579
- }
90580
- static get singleRegex() {
90581
- return /^=(.*)$/;
90582
- }
90583
- search(text) {
90584
- const isMatch = text === this.pattern;
90585
- return {
90586
- isMatch,
90587
- score: isMatch ? 0 : 1,
90588
- indices: [0, this.pattern.length - 1]
90589
- };
90590
- }
90591
- }
90592
-
90593
- class InverseExactMatch extends BaseMatch {
90594
- constructor(pattern2) {
90595
- super(pattern2);
90596
- }
90597
- static get type() {
90598
- return "inverse-exact";
90599
- }
90600
- static get multiRegex() {
90601
- return /^!"(.*)"$/;
90602
- }
90603
- static get singleRegex() {
90604
- return /^!(.*)$/;
90605
- }
90606
- search(text) {
90607
- const index2 = text.indexOf(this.pattern);
90608
- const isMatch = index2 === -1;
90609
- return {
90610
- isMatch,
90611
- score: isMatch ? 0 : 1,
90612
- indices: [0, text.length - 1]
90613
- };
90614
- }
90615
- }
90616
-
90617
- class PrefixExactMatch extends BaseMatch {
90618
- constructor(pattern2) {
90619
- super(pattern2);
90620
- }
90621
- static get type() {
90622
- return "prefix-exact";
90623
- }
90624
- static get multiRegex() {
90625
- return /^\^"(.*)"$/;
90626
- }
90627
- static get singleRegex() {
90628
- return /^\^(.*)$/;
90629
- }
90630
- search(text) {
90631
- const isMatch = text.startsWith(this.pattern);
90632
- return {
90633
- isMatch,
90634
- score: isMatch ? 0 : 1,
90635
- indices: [0, this.pattern.length - 1]
90636
- };
90637
- }
90638
- }
90639
-
90640
- class InversePrefixExactMatch extends BaseMatch {
90641
- constructor(pattern2) {
90642
- super(pattern2);
90643
- }
90644
- static get type() {
90645
- return "inverse-prefix-exact";
90646
- }
90647
- static get multiRegex() {
90648
- return /^!\^"(.*)"$/;
90649
- }
90650
- static get singleRegex() {
90651
- return /^!\^(.*)$/;
90652
- }
90653
- search(text) {
90654
- const isMatch = !text.startsWith(this.pattern);
90655
- return {
90656
- isMatch,
90657
- score: isMatch ? 0 : 1,
90658
- indices: [0, text.length - 1]
90659
- };
90660
- }
90661
- }
90662
-
90663
- class SuffixExactMatch extends BaseMatch {
90664
- constructor(pattern2) {
90665
- super(pattern2);
90666
- }
90667
- static get type() {
90668
- return "suffix-exact";
90669
- }
90670
- static get multiRegex() {
90671
- return /^"(.*)"\$$/;
90672
- }
90673
- static get singleRegex() {
90674
- return /^(.*)\$$/;
90675
- }
90676
- search(text) {
90677
- const isMatch = text.endsWith(this.pattern);
90678
- return {
90679
- isMatch,
90680
- score: isMatch ? 0 : 1,
90681
- indices: [text.length - this.pattern.length, text.length - 1]
90682
- };
90683
- }
90684
- }
90685
-
90686
- class InverseSuffixExactMatch extends BaseMatch {
90687
- constructor(pattern2) {
90688
- super(pattern2);
90689
- }
90690
- static get type() {
90691
- return "inverse-suffix-exact";
90692
- }
90693
- static get multiRegex() {
90694
- return /^!"(.*)"\$$/;
90695
- }
90696
- static get singleRegex() {
90697
- return /^!(.*)\$$/;
90698
- }
90699
- search(text) {
90700
- const isMatch = !text.endsWith(this.pattern);
90701
- return {
90702
- isMatch,
90703
- score: isMatch ? 0 : 1,
90704
- indices: [0, text.length - 1]
90705
- };
90706
- }
90707
- }
90708
-
90709
- class FuzzyMatch extends BaseMatch {
90710
- constructor(pattern2, {
90711
- location: location2 = Config.location,
90712
- threshold = Config.threshold,
90713
- distance = Config.distance,
90714
- includeMatches = Config.includeMatches,
90715
- findAllMatches = Config.findAllMatches,
90716
- minMatchCharLength = Config.minMatchCharLength,
90717
- isCaseSensitive = Config.isCaseSensitive,
90718
- ignoreDiacritics = Config.ignoreDiacritics,
90719
- ignoreLocation = Config.ignoreLocation
90720
- } = {}) {
90721
- super(pattern2);
90722
- this._bitapSearch = new BitapSearch(pattern2, {
90723
- location: location2,
90724
- threshold,
90725
- distance,
90726
- includeMatches,
90727
- findAllMatches,
90728
- minMatchCharLength,
90729
- isCaseSensitive,
90730
- ignoreDiacritics,
90731
- ignoreLocation
90732
- });
90733
- }
90734
- static get type() {
90735
- return "fuzzy";
90736
- }
90737
- static get multiRegex() {
90738
- return /^"(.*)"$/;
90739
- }
90740
- static get singleRegex() {
90741
- return /^(.*)$/;
90742
- }
90743
- search(text) {
90744
- return this._bitapSearch.searchIn(text);
90745
- }
90746
- }
90747
-
90748
- class IncludeMatch extends BaseMatch {
90749
- constructor(pattern2) {
90750
- super(pattern2);
90751
- }
90752
- static get type() {
90753
- return "include";
90754
- }
90755
- static get multiRegex() {
90756
- return /^'"(.*)"$/;
90757
- }
90758
- static get singleRegex() {
90759
- return /^'(.*)$/;
90760
- }
90761
- search(text) {
90762
- let location2 = 0;
90763
- let index2;
90764
- const indices = [];
90765
- const patternLen = this.pattern.length;
90766
- while ((index2 = text.indexOf(this.pattern, location2)) > -1) {
90767
- location2 = index2 + patternLen;
90768
- indices.push([index2, location2 - 1]);
90769
- }
90770
- const isMatch = !!indices.length;
90771
- return {
90772
- isMatch,
90773
- score: isMatch ? 0 : 1,
90774
- indices
90775
- };
90776
- }
90777
- }
90778
- var searchers = [
90779
- ExactMatch,
90780
- IncludeMatch,
90781
- PrefixExactMatch,
90782
- InversePrefixExactMatch,
90783
- InverseSuffixExactMatch,
90784
- SuffixExactMatch,
90785
- InverseExactMatch,
90786
- FuzzyMatch
90787
- ];
90788
- var searchersLen = searchers.length;
90789
- var SPACE_RE = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;
90790
- var OR_TOKEN = "|";
90791
- function parseQuery(pattern2, options = {}) {
90792
- return pattern2.split(OR_TOKEN).map((item) => {
90793
- let query = item.trim().split(SPACE_RE).filter((item2) => item2 && !!item2.trim());
90794
- let results = [];
90795
- for (let i = 0, len = query.length;i < len; i += 1) {
90796
- const queryItem = query[i];
90797
- let found = false;
90798
- let idx = -1;
90799
- while (!found && ++idx < searchersLen) {
90800
- const searcher = searchers[idx];
90801
- let token = searcher.isMultiMatch(queryItem);
90802
- if (token) {
90803
- results.push(new searcher(token, options));
90804
- found = true;
90805
- }
90806
- }
90807
- if (found) {
90808
- continue;
90809
- }
90810
- idx = -1;
90811
- while (++idx < searchersLen) {
90812
- const searcher = searchers[idx];
90813
- let token = searcher.isSingleMatch(queryItem);
90814
- if (token) {
90815
- results.push(new searcher(token, options));
90816
- break;
90817
- }
90818
- }
90819
- }
90820
- return results;
90821
- });
90822
- }
90823
- var MultiMatchSet = new Set([FuzzyMatch.type, IncludeMatch.type]);
90824
-
90825
- class ExtendedSearch {
90826
- constructor(pattern2, {
90827
- isCaseSensitive = Config.isCaseSensitive,
90828
- ignoreDiacritics = Config.ignoreDiacritics,
90829
- includeMatches = Config.includeMatches,
90830
- minMatchCharLength = Config.minMatchCharLength,
90831
- ignoreLocation = Config.ignoreLocation,
90832
- findAllMatches = Config.findAllMatches,
90833
- location: location2 = Config.location,
90834
- threshold = Config.threshold,
90835
- distance = Config.distance
90836
- } = {}) {
90837
- this.query = null;
90838
- this.options = {
90839
- isCaseSensitive,
90840
- ignoreDiacritics,
90841
- includeMatches,
90842
- minMatchCharLength,
90843
- findAllMatches,
90844
- ignoreLocation,
90845
- location: location2,
90846
- threshold,
90847
- distance
90848
- };
90849
- pattern2 = isCaseSensitive ? pattern2 : pattern2.toLowerCase();
90850
- pattern2 = ignoreDiacritics ? stripDiacritics(pattern2) : pattern2;
90851
- this.pattern = pattern2;
90852
- this.query = parseQuery(this.pattern, this.options);
90853
- }
90854
- static condition(_, options) {
90855
- return options.useExtendedSearch;
90856
- }
90857
- searchIn(text) {
90858
- const query = this.query;
90859
- if (!query) {
90860
- return {
90861
- isMatch: false,
90862
- score: 1
90863
- };
90864
- }
90865
- const { includeMatches, isCaseSensitive, ignoreDiacritics } = this.options;
90866
- text = isCaseSensitive ? text : text.toLowerCase();
90867
- text = ignoreDiacritics ? stripDiacritics(text) : text;
90868
- let numMatches = 0;
90869
- let allIndices = [];
90870
- let totalScore = 0;
90871
- for (let i = 0, qLen = query.length;i < qLen; i += 1) {
90872
- const searchers2 = query[i];
90873
- allIndices.length = 0;
90874
- numMatches = 0;
90875
- for (let j = 0, pLen = searchers2.length;j < pLen; j += 1) {
90876
- const searcher = searchers2[j];
90877
- const { isMatch, indices, score } = searcher.search(text);
90878
- if (isMatch) {
90879
- numMatches += 1;
90880
- totalScore += score;
90881
- if (includeMatches) {
90882
- const type = searcher.constructor.type;
90883
- if (MultiMatchSet.has(type)) {
90884
- allIndices = [...allIndices, ...indices];
90885
- } else {
90886
- allIndices.push(indices);
90887
- }
90888
- }
90889
- } else {
90890
- totalScore = 0;
90891
- numMatches = 0;
90892
- allIndices.length = 0;
90893
- break;
90894
- }
90895
- }
90896
- if (numMatches) {
90897
- let result = {
90898
- isMatch: true,
90899
- score: totalScore / numMatches
90900
- };
90901
- if (includeMatches) {
90902
- result.indices = allIndices;
90903
- }
90904
- return result;
90905
- }
90906
- }
90907
- return {
90908
- isMatch: false,
90909
- score: 1
90910
- };
90911
- }
90912
- }
90913
- var registeredSearchers = [];
90914
- function register(...args2) {
90915
- registeredSearchers.push(...args2);
90916
- }
90917
- function createSearcher(pattern2, options) {
90918
- for (let i = 0, len = registeredSearchers.length;i < len; i += 1) {
90919
- let searcherClass = registeredSearchers[i];
90920
- if (searcherClass.condition(pattern2, options)) {
90921
- return new searcherClass(pattern2, options);
90922
- }
90923
- }
90924
- return new BitapSearch(pattern2, options);
90925
- }
90926
- var LogicalOperator = {
90927
- AND: "$and",
90928
- OR: "$or"
90929
- };
90930
- var KeyType = {
90931
- PATH: "$path",
90932
- PATTERN: "$val"
90933
- };
90934
- var isExpression = (query) => !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]);
90935
- var isPath = (query) => !!query[KeyType.PATH];
90936
- var isLeaf = (query) => !isArray2(query) && isObject3(query) && !isExpression(query);
90937
- var convertToExplicit = (query) => ({
90938
- [LogicalOperator.AND]: Object.keys(query).map((key) => ({
90939
- [key]: query[key]
90940
- }))
90941
- });
90942
- function parse2(query, options, { auto = true } = {}) {
90943
- const next = (query2) => {
90944
- let keys = Object.keys(query2);
90945
- const isQueryPath = isPath(query2);
90946
- if (!isQueryPath && keys.length > 1 && !isExpression(query2)) {
90947
- return next(convertToExplicit(query2));
90948
- }
90949
- if (isLeaf(query2)) {
90950
- const key = isQueryPath ? query2[KeyType.PATH] : keys[0];
90951
- const pattern2 = isQueryPath ? query2[KeyType.PATTERN] : query2[key];
90952
- if (!isString(pattern2)) {
90953
- throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key));
90954
- }
90955
- const obj = {
90956
- keyId: createKeyId(key),
90957
- pattern: pattern2
90958
- };
90959
- if (auto) {
90960
- obj.searcher = createSearcher(pattern2, options);
90961
- }
90962
- return obj;
90963
- }
90964
- let node = {
90965
- children: [],
90966
- operator: keys[0]
90967
- };
90968
- keys.forEach((key) => {
90969
- const value = query2[key];
90970
- if (isArray2(value)) {
90971
- value.forEach((item) => {
90972
- node.children.push(next(item));
90973
- });
90974
- }
90975
- });
90976
- return node;
90977
- };
90978
- if (!isExpression(query)) {
90979
- query = convertToExplicit(query);
90980
- }
90981
- return next(query);
90982
- }
90983
- function computeScore(results, { ignoreFieldNorm = Config.ignoreFieldNorm }) {
90984
- results.forEach((result) => {
90985
- let totalScore = 1;
90986
- result.matches.forEach(({ key, norm: norm2, score }) => {
90987
- const weight = key ? key.weight : null;
90988
- totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * (ignoreFieldNorm ? 1 : norm2));
90989
- });
90990
- result.score = totalScore;
90991
- });
90992
- }
90993
- function transformMatches(result, data) {
90994
- const matches = result.matches;
90995
- data.matches = [];
90996
- if (!isDefined(matches)) {
90997
- return;
90998
- }
90999
- matches.forEach((match) => {
91000
- if (!isDefined(match.indices) || !match.indices.length) {
91001
- return;
91002
- }
91003
- const { indices, value } = match;
91004
- let obj = {
91005
- indices,
91006
- value
91007
- };
91008
- if (match.key) {
91009
- obj.key = match.key.src;
91010
- }
91011
- if (match.idx > -1) {
91012
- obj.refIndex = match.idx;
91013
- }
91014
- data.matches.push(obj);
91015
- });
91016
- }
91017
- function transformScore(result, data) {
91018
- data.score = result.score;
91019
- }
91020
- function format(results, docs, {
91021
- includeMatches = Config.includeMatches,
91022
- includeScore = Config.includeScore
91023
- } = {}) {
91024
- const transformers = [];
91025
- if (includeMatches)
91026
- transformers.push(transformMatches);
91027
- if (includeScore)
91028
- transformers.push(transformScore);
91029
- return results.map((result) => {
91030
- const { idx } = result;
91031
- const data = {
91032
- item: docs[idx],
91033
- refIndex: idx
91034
- };
91035
- if (transformers.length) {
91036
- transformers.forEach((transformer) => {
91037
- transformer(result, data);
91038
- });
91039
- }
91040
- return data;
91041
- });
91042
- }
91043
-
91044
- class Fuse {
91045
- constructor(docs, options = {}, index2) {
91046
- this.options = { ...Config, ...options };
91047
- if (this.options.useExtendedSearch && false) {}
91048
- this._keyStore = new KeyStore(this.options.keys);
91049
- this.setCollection(docs, index2);
91050
- }
91051
- setCollection(docs, index2) {
91052
- this._docs = docs;
91053
- if (index2 && !(index2 instanceof FuseIndex)) {
91054
- throw new Error(INCORRECT_INDEX_TYPE);
91055
- }
91056
- this._myIndex = index2 || createIndex(this.options.keys, this._docs, {
91057
- getFn: this.options.getFn,
91058
- fieldNormWeight: this.options.fieldNormWeight
91059
- });
91060
- }
91061
- add(doc) {
91062
- if (!isDefined(doc)) {
91063
- return;
91064
- }
91065
- this._docs.push(doc);
91066
- this._myIndex.add(doc);
91067
- }
91068
- remove(predicate = () => false) {
91069
- const results = [];
91070
- for (let i = 0, len = this._docs.length;i < len; i += 1) {
91071
- const doc = this._docs[i];
91072
- if (predicate(doc, i)) {
91073
- this.removeAt(i);
91074
- i -= 1;
91075
- len -= 1;
91076
- results.push(doc);
91077
- }
91078
- }
91079
- return results;
91080
- }
91081
- removeAt(idx) {
91082
- this._docs.splice(idx, 1);
91083
- this._myIndex.removeAt(idx);
91084
- }
91085
- getIndex() {
91086
- return this._myIndex;
91087
- }
91088
- search(query, { limit = -1 } = {}) {
91089
- const {
91090
- includeMatches,
91091
- includeScore,
91092
- shouldSort,
91093
- sortFn,
91094
- ignoreFieldNorm
91095
- } = this.options;
91096
- let results = isString(query) ? isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query);
91097
- computeScore(results, { ignoreFieldNorm });
91098
- if (shouldSort) {
91099
- results.sort(sortFn);
91100
- }
91101
- if (isNumber2(limit) && limit > -1) {
91102
- results = results.slice(0, limit);
91103
- }
91104
- return format(results, this._docs, {
91105
- includeMatches,
91106
- includeScore
91107
- });
91108
- }
91109
- _searchStringList(query) {
91110
- const searcher = createSearcher(query, this.options);
91111
- const { records } = this._myIndex;
91112
- const results = [];
91113
- records.forEach(({ v: text, i: idx, n: norm2 }) => {
91114
- if (!isDefined(text)) {
91115
- return;
91116
- }
91117
- const { isMatch, score, indices } = searcher.searchIn(text);
91118
- if (isMatch) {
91119
- results.push({
91120
- item: text,
91121
- idx,
91122
- matches: [{ score, value: text, norm: norm2, indices }]
91123
- });
91124
- }
91125
- });
91126
- return results;
91127
- }
91128
- _searchLogical(query) {
91129
- const expression = parse2(query, this.options);
91130
- const evaluate = (node, item, idx) => {
91131
- if (!node.children) {
91132
- const { keyId, searcher } = node;
91133
- const matches = this._findMatches({
91134
- key: this._keyStore.get(keyId),
91135
- value: this._myIndex.getValueForItemAtKeyId(item, keyId),
91136
- searcher
91137
- });
91138
- if (matches && matches.length) {
91139
- return [
91140
- {
91141
- idx,
91142
- item,
91143
- matches
91144
- }
91145
- ];
91146
- }
91147
- return [];
91148
- }
91149
- const res = [];
91150
- for (let i = 0, len = node.children.length;i < len; i += 1) {
91151
- const child = node.children[i];
91152
- const result = evaluate(child, item, idx);
91153
- if (result.length) {
91154
- res.push(...result);
91155
- } else if (node.operator === LogicalOperator.AND) {
91156
- return [];
91157
- }
91158
- }
91159
- return res;
91160
- };
91161
- const records = this._myIndex.records;
91162
- const resultMap = {};
91163
- const results = [];
91164
- records.forEach(({ $: item, i: idx }) => {
91165
- if (isDefined(item)) {
91166
- let expResults = evaluate(expression, item, idx);
91167
- if (expResults.length) {
91168
- if (!resultMap[idx]) {
91169
- resultMap[idx] = { idx, item, matches: [] };
91170
- results.push(resultMap[idx]);
91171
- }
91172
- expResults.forEach(({ matches }) => {
91173
- resultMap[idx].matches.push(...matches);
91174
- });
91175
- }
91176
- }
91177
- });
91178
- return results;
91179
- }
91180
- _searchObjectList(query) {
91181
- const searcher = createSearcher(query, this.options);
91182
- const { keys, records } = this._myIndex;
91183
- const results = [];
91184
- records.forEach(({ $: item, i: idx }) => {
91185
- if (!isDefined(item)) {
91186
- return;
91187
- }
91188
- let matches = [];
91189
- keys.forEach((key, keyIndex) => {
91190
- matches.push(...this._findMatches({
91191
- key,
91192
- value: item[keyIndex],
91193
- searcher
91194
- }));
91195
- });
91196
- if (matches.length) {
91197
- results.push({
91198
- idx,
91199
- item,
91200
- matches
91201
- });
91202
- }
91203
- });
91204
- return results;
91205
- }
91206
- _findMatches({ key, value, searcher }) {
91207
- if (!isDefined(value)) {
91208
- return [];
91209
- }
91210
- let matches = [];
91211
- if (isArray2(value)) {
91212
- value.forEach(({ v: text, i: idx, n: norm2 }) => {
91213
- if (!isDefined(text)) {
91214
- return;
91215
- }
91216
- const { isMatch, score, indices } = searcher.searchIn(text);
91217
- if (isMatch) {
91218
- matches.push({
91219
- score,
91220
- key,
91221
- value: text,
91222
- idx,
91223
- norm: norm2,
91224
- indices
91225
- });
91226
- }
91227
- });
91228
- } else {
91229
- const { v: text, n: norm2 } = value;
91230
- const { isMatch, score, indices } = searcher.searchIn(text);
91231
- if (isMatch) {
91232
- matches.push({ score, key, value: text, norm: norm2, indices });
91233
- }
91234
- }
91235
- return matches;
91236
- }
91237
- }
91238
- Fuse.version = "7.1.0";
91239
- Fuse.createIndex = createIndex;
91240
- Fuse.parseIndex = parseIndex;
91241
- Fuse.config = Config;
91242
- {
91243
- Fuse.parseQuery = parse2;
91244
- }
91245
- {
91246
- register(ExtendedSearch);
91247
- }
91248
89954
  // src/module/light-code/index.ts
91249
89955
  var import_fast_glob2 = __toESM(require_out4(), 1);
91250
89956
  import path10 from "node:path";
@@ -96045,22 +94751,22 @@ __export2(exports_util, {
96045
94751
  log: () => log2,
96046
94752
  isUndefined: () => isUndefined,
96047
94753
  isSymbol: () => isSymbol,
96048
- isString: () => isString2,
94754
+ isString: () => isString,
96049
94755
  isRegExp: () => isRegExp,
96050
94756
  isPrimitive: () => isPrimitive,
96051
- isObject: () => isObject4,
96052
- isNumber: () => isNumber3,
94757
+ isObject: () => isObject3,
94758
+ isNumber: () => isNumber2,
96053
94759
  isNullOrUndefined: () => isNullOrUndefined,
96054
94760
  isNull: () => isNull,
96055
94761
  isFunction: () => isFunction2,
96056
94762
  isError: () => isError,
96057
94763
  isDate: () => isDate2,
96058
94764
  isBuffer: () => isBuffer2,
96059
- isBoolean: () => isBoolean2,
96060
- isArray: () => isArray3,
94765
+ isBoolean: () => isBoolean,
94766
+ isArray: () => isArray2,
96061
94767
  inspect: () => inspect,
96062
94768
  inherits: () => inherits,
96063
- format: () => format2,
94769
+ format: () => format,
96064
94770
  deprecate: () => deprecate,
96065
94771
  default: () => util_default,
96066
94772
  debuglog: () => debuglog,
@@ -96070,8 +94776,8 @@ __export2(exports_util, {
96070
94776
  TextEncoder: () => TextEncoder2,
96071
94777
  TextDecoder: () => TextDecoder2
96072
94778
  });
96073
- function format2(f, ...args2) {
96074
- if (!isString2(f)) {
94779
+ function format(f, ...args2) {
94780
+ if (!isString(f)) {
96075
94781
  var objects = [f];
96076
94782
  for (var i2 = 0;i2 < args2.length; i2++)
96077
94783
  objects.push(inspect(args2[i2]));
@@ -96098,7 +94804,7 @@ function format2(f, ...args2) {
96098
94804
  }
96099
94805
  });
96100
94806
  for (var x = args2[i2];i2 < len2; x = args2[++i2])
96101
- if (isNull(x) || !isObject4(x))
94807
+ if (isNull(x) || !isObject3(x))
96102
94808
  str += " " + x;
96103
94809
  else
96104
94810
  str += " " + inspect(x);
@@ -96141,7 +94847,7 @@ function arrayToHash(array3) {
96141
94847
  function formatValue(ctx, value, recurseTimes) {
96142
94848
  if (ctx.customInspect && value && isFunction2(value.inspect) && value.inspect !== inspect && !(value.constructor && value.constructor.prototype === value)) {
96143
94849
  var ret = value.inspect(recurseTimes, ctx);
96144
- if (!isString2(ret))
94850
+ if (!isString(ret))
96145
94851
  ret = formatValue(ctx, ret, recurseTimes);
96146
94852
  return ret;
96147
94853
  }
@@ -96166,7 +94872,7 @@ function formatValue(ctx, value, recurseTimes) {
96166
94872
  return formatError2(value);
96167
94873
  }
96168
94874
  var base = "", array3 = false, braces = ["{", "}"];
96169
- if (isArray3(value))
94875
+ if (isArray2(value))
96170
94876
  array3 = true, braces = ["[", "]"];
96171
94877
  if (isFunction2(value)) {
96172
94878
  var n = value.name ? ": " + value.name : "";
@@ -96198,13 +94904,13 @@ function formatValue(ctx, value, recurseTimes) {
96198
94904
  function formatPrimitive(ctx, value) {
96199
94905
  if (isUndefined(value))
96200
94906
  return ctx.stylize("undefined", "undefined");
96201
- if (isString2(value)) {
94907
+ if (isString(value)) {
96202
94908
  var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
96203
94909
  return ctx.stylize(simple, "string");
96204
94910
  }
96205
- if (isNumber3(value))
94911
+ if (isNumber2(value))
96206
94912
  return ctx.stylize("" + value, "number");
96207
- if (isBoolean2(value))
94913
+ if (isBoolean(value))
96208
94914
  return ctx.stylize("" + value, "boolean");
96209
94915
  if (isNull(value))
96210
94916
  return ctx.stylize("null", "null");
@@ -96281,10 +94987,10 @@ function reduceToSingleString(output, base, braces) {
96281
94987
  `) + " " + braces[1];
96282
94988
  return braces[0] + base + " " + output.join(", ") + " " + braces[1];
96283
94989
  }
96284
- function isArray3(ar2) {
94990
+ function isArray2(ar2) {
96285
94991
  return Array.isArray(ar2);
96286
94992
  }
96287
- function isBoolean2(arg) {
94993
+ function isBoolean(arg) {
96288
94994
  return typeof arg === "boolean";
96289
94995
  }
96290
94996
  function isNull(arg) {
@@ -96293,10 +94999,10 @@ function isNull(arg) {
96293
94999
  function isNullOrUndefined(arg) {
96294
95000
  return arg == null;
96295
95001
  }
96296
- function isNumber3(arg) {
95002
+ function isNumber2(arg) {
96297
95003
  return typeof arg === "number";
96298
95004
  }
96299
- function isString2(arg) {
95005
+ function isString(arg) {
96300
95006
  return typeof arg === "string";
96301
95007
  }
96302
95008
  function isSymbol(arg) {
@@ -96306,16 +95012,16 @@ function isUndefined(arg) {
96306
95012
  return arg === undefined;
96307
95013
  }
96308
95014
  function isRegExp(re) {
96309
- return isObject4(re) && objectToString2(re) === "[object RegExp]";
95015
+ return isObject3(re) && objectToString2(re) === "[object RegExp]";
96310
95016
  }
96311
- function isObject4(arg) {
95017
+ function isObject3(arg) {
96312
95018
  return typeof arg === "object" && arg !== null;
96313
95019
  }
96314
95020
  function isDate2(d) {
96315
- return isObject4(d) && objectToString2(d) === "[object Date]";
95021
+ return isObject3(d) && objectToString2(d) === "[object Date]";
96316
95022
  }
96317
95023
  function isError(e) {
96318
- return isObject4(e) && (objectToString2(e) === "[object Error]" || e instanceof Error);
95024
+ return isObject3(e) && (objectToString2(e) === "[object Error]" || e instanceof Error);
96319
95025
  }
96320
95026
  function isFunction2(arg) {
96321
95027
  return typeof arg === "function";
@@ -96337,14 +95043,14 @@ function timestamp() {
96337
95043
  return [d.getDate(), months[d.getMonth()], time2].join(" ");
96338
95044
  }
96339
95045
  function log2(...args2) {
96340
- console.log("%s - %s", timestamp(), format2.apply(null, args2));
95046
+ console.log("%s - %s", timestamp(), format.apply(null, args2));
96341
95047
  }
96342
95048
  function inherits(ctor, superCtor) {
96343
95049
  if (superCtor)
96344
95050
  ctor.super_ = superCtor, ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } });
96345
95051
  }
96346
95052
  function _extend(origin, add) {
96347
- if (!add || !isObject4(add))
95053
+ if (!add || !isObject3(add))
96348
95054
  return origin;
96349
95055
  var keys = Object.keys(add), i2 = keys.length;
96350
95056
  while (i2--)
@@ -96394,7 +95100,7 @@ var init_util = __esm2(() => {
96394
95100
  if (set2 = set2.toUpperCase(), !debugs[set2])
96395
95101
  if (debugEnvRegex.test(set2))
96396
95102
  debugs[set2] = function(...args2) {
96397
- console.error("%s: %s", set2, pid, format2.apply(null, ...args2));
95103
+ console.error("%s: %s", set2, pid, format.apply(null, ...args2));
96398
95104
  };
96399
95105
  else
96400
95106
  debugs[set2] = function() {};
@@ -96406,7 +95112,7 @@ var init_util = __esm2(() => {
96406
95112
  ctx.depth = rest[0];
96407
95113
  if (rest.length >= 2)
96408
95114
  ctx.colors = rest[1];
96409
- if (isBoolean2(opts))
95115
+ if (isBoolean(opts))
96410
95116
  ctx.showHidden = opts;
96411
95117
  else if (opts)
96412
95118
  _extend(ctx, opts);
@@ -96908,8 +95614,8 @@ var require_stream5 = __commonJS3((exports, module) => {
96908
95614
  }, Boolean, Uint8Array };
96909
95615
  });
96910
95616
  var require_inspect = __commonJS22((exports2, module2) => {
96911
- module2.exports = { format(format22, ...args2) {
96912
- return format22.replace(/%([sdifj])/g, function(...[_unused, type2]) {
95617
+ module2.exports = { format(format2, ...args2) {
95618
+ return format2.replace(/%([sdifj])/g, function(...[_unused, type2]) {
96913
95619
  let replacement = args2.shift();
96914
95620
  if (type2 === "f")
96915
95621
  return replacement.toFixed(6);
@@ -96947,7 +95653,7 @@ var require_stream5 = __commonJS3((exports, module) => {
96947
95653
  } };
96948
95654
  });
96949
95655
  var require_errors = __commonJS22((exports2, module2) => {
96950
- var { format: format22, inspect: inspect2 } = require_inspect(), { AggregateError: CustomAggregateError } = require_primordials(), AggregateError2 = globalThis.AggregateError || CustomAggregateError, kIsNodeError = Symbol("kIsNodeError"), kTypes = ["string", "function", "number", "object", "Function", "Object", "boolean", "bigint", "symbol"], classRegExp = /^([A-Z][a-z0-9]*)+$/, codes = {};
95656
+ var { format: format2, inspect: inspect2 } = require_inspect(), { AggregateError: CustomAggregateError } = require_primordials(), AggregateError2 = globalThis.AggregateError || CustomAggregateError, kIsNodeError = Symbol("kIsNodeError"), kTypes = ["string", "function", "number", "object", "Function", "Object", "boolean", "bigint", "symbol"], classRegExp = /^([A-Z][a-z0-9]*)+$/, codes = {};
96951
95657
  function assert2(value, message) {
96952
95658
  if (!value)
96953
95659
  throw new codes.ERR_INTERNAL_ASSERTION(message);
@@ -96964,7 +95670,7 @@ var require_stream5 = __commonJS3((exports, module) => {
96964
95670
  let expectedLength = (msg.match(/%[dfijoOs]/g) || []).length;
96965
95671
  if (assert2(expectedLength === args2.length, `Code: ${key}; The provided arguments length (${args2.length}) does not match the required ones (${expectedLength}).`), args2.length === 0)
96966
95672
  return msg;
96967
- return format22(msg, ...args2);
95673
+ return format2(msg, ...args2);
96968
95674
  }
96969
95675
  function E2(code2, message, Base) {
96970
95676
  if (!Base)
@@ -97499,7 +96205,7 @@ var require_stream5 = __commonJS3((exports, module) => {
97499
96205
  module2.exports.AbortSignal = AbortSignal;
97500
96206
  });
97501
96207
  var require_util = __commonJS22((exports2, module2) => {
97502
- var bufferModule = (init_buffer(), __toCommonJS2(exports_buffer)), { format: format22, inspect: inspect2 } = require_inspect(), { codes: { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE3 } } = require_errors(), { kResistStopPropagation, AggregateError: AggregateError2, SymbolDispose } = require_primordials(), AbortSignal = globalThis.AbortSignal || require_abort_controller().AbortSignal, AbortController2 = globalThis.AbortController || require_abort_controller().AbortController, AsyncFunction = Object.getPrototypeOf(async function() {}).constructor, Blob22 = globalThis.Blob || bufferModule.Blob, isBlob = typeof Blob22 < "u" ? function(b) {
96208
+ var bufferModule = (init_buffer(), __toCommonJS2(exports_buffer)), { format: format2, inspect: inspect2 } = require_inspect(), { codes: { ERR_INVALID_ARG_TYPE: ERR_INVALID_ARG_TYPE3 } } = require_errors(), { kResistStopPropagation, AggregateError: AggregateError2, SymbolDispose } = require_primordials(), AbortSignal = globalThis.AbortSignal || require_abort_controller().AbortSignal, AbortController2 = globalThis.AbortController || require_abort_controller().AbortController, AsyncFunction = Object.getPrototypeOf(async function() {}).constructor, Blob22 = globalThis.Blob || bufferModule.Blob, isBlob = typeof Blob22 < "u" ? function(b) {
97503
96209
  return b instanceof Blob22;
97504
96210
  } : function(b) {
97505
96211
  return false;
@@ -97532,7 +96238,7 @@ var require_stream5 = __commonJS3((exports, module) => {
97532
96238
  });
97533
96239
  }, debuglog() {
97534
96240
  return function() {};
97535
- }, format: format22, inspect: inspect2, types: { isAsyncFunction(fn) {
96241
+ }, format: format2, inspect: inspect2, types: { isAsyncFunction(fn) {
97536
96242
  return fn instanceof AsyncFunction;
97537
96243
  }, isArrayBufferView(arr) {
97538
96244
  return ArrayBuffer.isView(arr);
@@ -101099,9 +99805,9 @@ var init_crypto = __esm2(() => {
101099
99805
  };
101100
99806
  });
101101
99807
  require_isarray = __commonJS22((exports, module) => {
101102
- var toString2 = {}.toString;
99808
+ var toString = {}.toString;
101103
99809
  module.exports = Array.isArray || function(arr) {
101104
- return toString2.call(arr) == "[object Array]";
99810
+ return toString.call(arr) == "[object Array]";
101105
99811
  };
101106
99812
  });
101107
99813
  require_type = __commonJS22((exports, module) => {
@@ -101375,7 +100081,7 @@ var init_crypto = __esm2(() => {
101375
100081
  value = getProto(gen.prototype);
101376
100082
  }
101377
100083
  return INTRINSICS[name] = value, value;
101378
- }, LEGACY_ALIASES = { __proto__: null, "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], "%ArrayPrototype%": ["Array", "prototype"], "%ArrayProto_entries%": ["Array", "prototype", "entries"], "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], "%ArrayProto_keys%": ["Array", "prototype", "keys"], "%ArrayProto_values%": ["Array", "prototype", "values"], "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], "%BooleanPrototype%": ["Boolean", "prototype"], "%DataViewPrototype%": ["DataView", "prototype"], "%DatePrototype%": ["Date", "prototype"], "%ErrorPrototype%": ["Error", "prototype"], "%EvalErrorPrototype%": ["EvalError", "prototype"], "%Float32ArrayPrototype%": ["Float32Array", "prototype"], "%Float64ArrayPrototype%": ["Float64Array", "prototype"], "%FunctionPrototype%": ["Function", "prototype"], "%Generator%": ["GeneratorFunction", "prototype"], "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], "%Int8ArrayPrototype%": ["Int8Array", "prototype"], "%Int16ArrayPrototype%": ["Int16Array", "prototype"], "%Int32ArrayPrototype%": ["Int32Array", "prototype"], "%JSONParse%": ["JSON", "parse"], "%JSONStringify%": ["JSON", "stringify"], "%MapPrototype%": ["Map", "prototype"], "%NumberPrototype%": ["Number", "prototype"], "%ObjectPrototype%": ["Object", "prototype"], "%ObjProto_toString%": ["Object", "prototype", "toString"], "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], "%PromisePrototype%": ["Promise", "prototype"], "%PromiseProto_then%": ["Promise", "prototype", "then"], "%Promise_all%": ["Promise", "all"], "%Promise_reject%": ["Promise", "reject"], "%Promise_resolve%": ["Promise", "resolve"], "%RangeErrorPrototype%": ["RangeError", "prototype"], "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], "%RegExpPrototype%": ["RegExp", "prototype"], "%SetPrototype%": ["Set", "prototype"], "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], "%StringPrototype%": ["String", "prototype"], "%SymbolPrototype%": ["Symbol", "prototype"], "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], "%TypedArrayPrototype%": ["TypedArray", "prototype"], "%TypeErrorPrototype%": ["TypeError", "prototype"], "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], "%URIErrorPrototype%": ["URIError", "prototype"], "%WeakMapPrototype%": ["WeakMap", "prototype"], "%WeakSetPrototype%": ["WeakSet", "prototype"] }, bind = require_function_bind(), hasOwn2 = require_hasown(), $concat = bind.call($call, Array.prototype.concat), $spliceApply = bind.call($apply, Array.prototype.splice), $replace = bind.call($call, String.prototype.replace), $strSlice = bind.call($call, String.prototype.slice), $exec = bind.call($call, RegExp.prototype.exec), rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, reEscapeChar = /\\(\\)?/g, stringToPath = function(string3) {
100084
+ }, LEGACY_ALIASES = { __proto__: null, "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], "%ArrayPrototype%": ["Array", "prototype"], "%ArrayProto_entries%": ["Array", "prototype", "entries"], "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], "%ArrayProto_keys%": ["Array", "prototype", "keys"], "%ArrayProto_values%": ["Array", "prototype", "values"], "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], "%BooleanPrototype%": ["Boolean", "prototype"], "%DataViewPrototype%": ["DataView", "prototype"], "%DatePrototype%": ["Date", "prototype"], "%ErrorPrototype%": ["Error", "prototype"], "%EvalErrorPrototype%": ["EvalError", "prototype"], "%Float32ArrayPrototype%": ["Float32Array", "prototype"], "%Float64ArrayPrototype%": ["Float64Array", "prototype"], "%FunctionPrototype%": ["Function", "prototype"], "%Generator%": ["GeneratorFunction", "prototype"], "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], "%Int8ArrayPrototype%": ["Int8Array", "prototype"], "%Int16ArrayPrototype%": ["Int16Array", "prototype"], "%Int32ArrayPrototype%": ["Int32Array", "prototype"], "%JSONParse%": ["JSON", "parse"], "%JSONStringify%": ["JSON", "stringify"], "%MapPrototype%": ["Map", "prototype"], "%NumberPrototype%": ["Number", "prototype"], "%ObjectPrototype%": ["Object", "prototype"], "%ObjProto_toString%": ["Object", "prototype", "toString"], "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], "%PromisePrototype%": ["Promise", "prototype"], "%PromiseProto_then%": ["Promise", "prototype", "then"], "%Promise_all%": ["Promise", "all"], "%Promise_reject%": ["Promise", "reject"], "%Promise_resolve%": ["Promise", "resolve"], "%RangeErrorPrototype%": ["RangeError", "prototype"], "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], "%RegExpPrototype%": ["RegExp", "prototype"], "%SetPrototype%": ["Set", "prototype"], "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], "%StringPrototype%": ["String", "prototype"], "%SymbolPrototype%": ["Symbol", "prototype"], "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], "%TypedArrayPrototype%": ["TypedArray", "prototype"], "%TypeErrorPrototype%": ["TypeError", "prototype"], "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], "%URIErrorPrototype%": ["URIError", "prototype"], "%WeakMapPrototype%": ["WeakMap", "prototype"], "%WeakSetPrototype%": ["WeakSet", "prototype"] }, bind = require_function_bind(), hasOwn = require_hasown(), $concat = bind.call($call, Array.prototype.concat), $spliceApply = bind.call($apply, Array.prototype.splice), $replace = bind.call($call, String.prototype.replace), $strSlice = bind.call($call, String.prototype.slice), $exec = bind.call($call, RegExp.prototype.exec), rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, reEscapeChar = /\\(\\)?/g, stringToPath = function(string3) {
101379
100085
  var first = $strSlice(string3, 0, 1), last = $strSlice(string3, -1);
101380
100086
  if (first === "%" && last !== "%")
101381
100087
  throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");
@@ -101387,9 +100093,9 @@ var init_crypto = __esm2(() => {
101387
100093
  }), result;
101388
100094
  }, getBaseIntrinsic = function(name, allowMissing) {
101389
100095
  var intrinsicName = name, alias;
101390
- if (hasOwn2(LEGACY_ALIASES, intrinsicName))
100096
+ if (hasOwn(LEGACY_ALIASES, intrinsicName))
101391
100097
  alias = LEGACY_ALIASES[intrinsicName], intrinsicName = "%" + alias[0] + "%";
101392
- if (hasOwn2(INTRINSICS, intrinsicName)) {
100098
+ if (hasOwn(INTRINSICS, intrinsicName)) {
101393
100099
  var value = INTRINSICS[intrinsicName];
101394
100100
  if (value === needsEval)
101395
100101
  value = doEval(intrinsicName);
@@ -101415,7 +100121,7 @@ var init_crypto = __esm2(() => {
101415
100121
  throw new $SyntaxError("property names with quotes must have matching quotes");
101416
100122
  if (part === "constructor" || !isOwn)
101417
100123
  skipFurtherCaching = true;
101418
- if (intrinsicBaseName += "." + part, intrinsicRealName = "%" + intrinsicBaseName + "%", hasOwn2(INTRINSICS, intrinsicRealName))
100124
+ if (intrinsicBaseName += "." + part, intrinsicRealName = "%" + intrinsicBaseName + "%", hasOwn(INTRINSICS, intrinsicRealName))
101419
100125
  value = INTRINSICS[intrinsicRealName];
101420
100126
  else if (value != null) {
101421
100127
  if (!(part in value)) {
@@ -101430,7 +100136,7 @@ var init_crypto = __esm2(() => {
101430
100136
  else
101431
100137
  value = value[part];
101432
100138
  } else
101433
- isOwn = hasOwn2(value, part), value = value[part];
100139
+ isOwn = hasOwn(value, part), value = value[part];
101434
100140
  if (isOwn && !skipFurtherCaching)
101435
100141
  INTRINSICS[intrinsicRealName] = value;
101436
100142
  }
@@ -107013,8 +105719,8 @@ var init_crypto = __esm2(() => {
107013
105719
  this.curveType = { name: curve };
107014
105720
  this.curve = new elliptic.ec(this.curveType.name), this.keys = undefined;
107015
105721
  }
107016
- ECDH.prototype.generateKeys = function(enc, format22) {
107017
- return this.keys = this.curve.genKeyPair(), this.getPublicKey(enc, format22);
105722
+ ECDH.prototype.generateKeys = function(enc, format2) {
105723
+ return this.keys = this.curve.genKeyPair(), this.getPublicKey(enc, format2);
107018
105724
  };
107019
105725
  ECDH.prototype.computeSecret = function(other, inenc, enc) {
107020
105726
  if (inenc = inenc || "utf8", !Buffer.isBuffer(other))
@@ -107022,9 +105728,9 @@ var init_crypto = __esm2(() => {
107022
105728
  var otherPub = this.curve.keyFromPublic(other).getPublic(), out2 = otherPub.mul(this.keys.getPrivate()).getX();
107023
105729
  return formatReturnValue(out2, enc, this.curveType.byteLength);
107024
105730
  };
107025
- ECDH.prototype.getPublicKey = function(enc, format22) {
107026
- var key = this.keys.getPublic(format22 === "compressed", true);
107027
- if (format22 === "hybrid")
105731
+ ECDH.prototype.getPublicKey = function(enc, format2) {
105732
+ var key = this.keys.getPublic(format2 === "compressed", true);
105733
+ if (format2 === "hybrid")
107028
105734
  if (key[key.length - 1] % 2)
107029
105735
  key[0] = 7;
107030
105736
  else
@@ -113982,9 +112688,9 @@ var require_cipher_core = __commonJS3((exports, module) => {
113982
112688
  var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
113983
112689
  return plaintext;
113984
112690
  },
113985
- _parse: function(ciphertext, format22) {
112691
+ _parse: function(ciphertext, format2) {
113986
112692
  if (typeof ciphertext == "string") {
113987
- return format22.parse(ciphertext, this);
112693
+ return format2.parse(ciphertext, this);
113988
112694
  } else {
113989
112695
  return ciphertext;
113990
112696
  }
@@ -115048,12 +113754,12 @@ var getUrl = ({ baseUrl, path: path16, query: query3, querySerializer, url: _url
115048
113754
  if (path16) {
115049
113755
  url3 = defaultPathSerializer({ path: path16, url: url3 });
115050
113756
  }
115051
- let search2 = query3 ? querySerializer(query3) : "";
115052
- if (search2.startsWith("?")) {
115053
- search2 = search2.substring(1);
113757
+ let search = query3 ? querySerializer(query3) : "";
113758
+ if (search.startsWith("?")) {
113759
+ search = search.substring(1);
115054
113760
  }
115055
- if (search2) {
115056
- url3 += `?${search2}`;
113761
+ if (search) {
113762
+ url3 += `?${search}`;
115057
113763
  }
115058
113764
  return url3;
115059
113765
  };
@@ -115061,7 +113767,7 @@ var getUrl = ({ baseUrl, path: path16, query: query3, querySerializer, url: _url
115061
113767
  // ../node_modules/.pnpm/@opencode-ai+sdk@1.1.47/node_modules/@opencode-ai/sdk/dist/gen/client/utils.gen.js
115062
113768
  var createQuerySerializer = ({ allowReserved, array: array3, object: object2 } = {}) => {
115063
113769
  const querySerializer = (queryParams) => {
115064
- const search2 = [];
113770
+ const search = [];
115065
113771
  if (queryParams && typeof queryParams === "object") {
115066
113772
  for (const name in queryParams) {
115067
113773
  const value = queryParams[name];
@@ -115078,7 +113784,7 @@ var createQuerySerializer = ({ allowReserved, array: array3, object: object2 } =
115078
113784
  ...array3
115079
113785
  });
115080
113786
  if (serializedArray)
115081
- search2.push(serializedArray);
113787
+ search.push(serializedArray);
115082
113788
  } else if (typeof value === "object") {
115083
113789
  const serializedObject = serializeObjectParam({
115084
113790
  allowReserved,
@@ -115089,7 +113795,7 @@ var createQuerySerializer = ({ allowReserved, array: array3, object: object2 } =
115089
113795
  ...object2
115090
113796
  });
115091
113797
  if (serializedObject)
115092
- search2.push(serializedObject);
113798
+ search.push(serializedObject);
115093
113799
  } else {
115094
113800
  const serializedPrimitive = serializePrimitiveParam({
115095
113801
  allowReserved,
@@ -115097,11 +113803,11 @@ var createQuerySerializer = ({ allowReserved, array: array3, object: object2 } =
115097
113803
  value
115098
113804
  });
115099
113805
  if (serializedPrimitive)
115100
- search2.push(serializedPrimitive);
113806
+ search.push(serializedPrimitive);
115101
113807
  }
115102
113808
  }
115103
113809
  }
115104
- return search2.join("&");
113810
+ return search.join("&");
115105
113811
  };
115106
113812
  return querySerializer;
115107
113813
  };
@@ -115507,7 +114213,7 @@ class Pty extends _HeyApiClient {
115507
114213
  }
115508
114214
  }
115509
114215
 
115510
- class Config2 extends _HeyApiClient {
114216
+ class Config extends _HeyApiClient {
115511
114217
  get(options) {
115512
114218
  return (options?.client ?? this._client).get({
115513
114219
  url: "/config",
@@ -116077,7 +114783,7 @@ class OpencodeClient extends _HeyApiClient {
116077
114783
  global = new Global({ client: this._client });
116078
114784
  project = new Project({ client: this._client });
116079
114785
  pty = new Pty({ client: this._client });
116080
- config = new Config2({ client: this._client });
114786
+ config = new Config({ client: this._client });
116081
114787
  tool = new Tool({ client: this._client });
116082
114788
  instance = new Instance({ client: this._client });
116083
114789
  path = new Path({ client: this._client });
@@ -119091,245 +117797,6 @@ class AsrRelatime extends WSServer {
119091
117797
  this.sendBuffer(buffer || this.generateSilence(2));
119092
117798
  }
119093
117799
  }
119094
- // ../node_modules/.pnpm/@kevisual+ha-api@0.0.8/node_modules/@kevisual/ha-api/src/cache.ts
119095
- class LRUStorage {
119096
- cache;
119097
- constructor(options) {
119098
- this.cache = new LRUCache(options || { max: 500 });
119099
- }
119100
- getItem(name) {
119101
- const value = this.cache.get(name);
119102
- return value || null;
119103
- }
119104
- setItem(name, value) {
119105
- this.cache.set(name, value);
119106
- }
119107
- removeItem(name) {
119108
- this.cache.delete(name);
119109
- }
119110
- }
119111
-
119112
- class SessionStorage {
119113
- storage;
119114
- constructor(opts) {
119115
- const isBrowser5 = typeof window !== "undefined" && typeof window.sessionStorage !== "undefined";
119116
- if (opts?.storage) {
119117
- this.storage = opts.storage;
119118
- } else {
119119
- this.storage = isBrowser5 ? window.sessionStorage : new LRUStorage;
119120
- }
119121
- }
119122
- async getItem(name) {
119123
- const data = this.storage.getItem(name);
119124
- return data;
119125
- }
119126
- async setItem(name, data) {
119127
- if (typeof data === "string") {
119128
- this.storage.setItem(name, data);
119129
- return;
119130
- }
119131
- this.storage.setItem(name, JSON.stringify(data));
119132
- }
119133
- }
119134
- var sessionStorage = new SessionStorage;
119135
-
119136
- // ../node_modules/.pnpm/@kevisual+ha-api@0.0.8/node_modules/@kevisual/ha-api/src/core.ts
119137
- class HACore {
119138
- token;
119139
- homeassistantURL;
119140
- static serviceName = "";
119141
- cache;
119142
- constructor(options) {
119143
- this.token = options?.token;
119144
- if (!this.token && options.ha) {
119145
- this.token = options.ha?.token;
119146
- }
119147
- this.homeassistantURL = options?.homeassistantURL || "http://localhost:8123";
119148
- this.cache = new LRUStorage({ max: 200, ttl: options?.ttl || 1000 * 60 * 30 });
119149
- }
119150
- async get(opts) {
119151
- const _u = new URL(opts.url, this.homeassistantURL);
119152
- if (opts.params) {
119153
- Object.entries(opts.params).forEach(([key, value]) => {
119154
- _u.searchParams.append(key, value);
119155
- });
119156
- }
119157
- return fetch(_u.toString(), {
119158
- headers: {
119159
- Authorization: `Bearer ${this.token}`,
119160
- "Content-Type": "application/json"
119161
- }
119162
- }).then((response) => {
119163
- if (!response.ok) {
119164
- throw new Error(`Failed to fetch ${opts.url}: ${response.statusText}`);
119165
- }
119166
- return response.json();
119167
- });
119168
- }
119169
- async post(opts) {
119170
- return fetch(new URL(opts.url, this.homeassistantURL).toString(), {
119171
- method: "POST",
119172
- headers: {
119173
- Authorization: `Bearer ${this.token}`,
119174
- "Content-Type": "application/json"
119175
- },
119176
- body: JSON.stringify(opts.body || {})
119177
- }).then((response) => {
119178
- if (!response.ok) {
119179
- throw new Error(`Failed to post to ${opts.url}: ${response.statusText}`);
119180
- }
119181
- return response.json();
119182
- });
119183
- }
119184
- async getEntities(filter2) {
119185
- let cacheEntities = this.cache.getItem("all_entities");
119186
- let entities = cacheEntities;
119187
- if (!entities) {
119188
- entities = await this.get({ url: "/api/states" });
119189
- this.cache.setItem("all_entities", entities);
119190
- }
119191
- if (filter2) {
119192
- return entities.filter(filter2);
119193
- }
119194
- return entities;
119195
- }
119196
- async getState(entity_id) {
119197
- return this.get({ url: `/api/states/${entity_id}` });
119198
- }
119199
- async getEntityTypes() {
119200
- const entities = await this.getEntities();
119201
- const types2 = new Set;
119202
- entities.forEach((entity) => {
119203
- const [type] = entity.entity_id.split(".");
119204
- types2.add(type);
119205
- });
119206
- return Array.from(types2);
119207
- }
119208
- async getServiceEntities() {
119209
- const serviceName = this.constructor.serviceName;
119210
- return this.getEntities((entity) => entity.entity_id.startsWith(`${serviceName}.`));
119211
- }
119212
- async getInfoList() {
119213
- const lights = await this.getServiceEntities();
119214
- const infoList = lights.map((light) => {
119215
- return {
119216
- entity_id: light.entity_id,
119217
- name: light.attributes?.friendly_name || "",
119218
- state: light.state
119219
- };
119220
- });
119221
- return infoList;
119222
- }
119223
- async runService(opts) {
119224
- const serviceName = opts?.serverName || this.constructor.serviceName;
119225
- let { entity_id, service = "", data } = opts;
119226
- if (!entity_id && opts.name) {
119227
- const entities = await this.getServiceEntities();
119228
- const target = entities.find((entity) => entity.attributes?.friendly_name.includes(opts.name || ""));
119229
- if (target) {
119230
- entity_id = target.entity_id;
119231
- } else {
119232
- throw new Error(`${serviceName} 服务中名为为 "${opts.name}" 的不存在.`);
119233
- }
119234
- }
119235
- if (!service) {
119236
- const state = await this.getState(entity_id);
119237
- service = state.state === "on" ? "turn_off" : "turn_on";
119238
- }
119239
- return this.post({
119240
- url: `/api/services/${serviceName}/${service}`,
119241
- body: {
119242
- entity_id,
119243
- ...data
119244
- }
119245
- });
119246
- }
119247
- }
119248
-
119249
- // ../node_modules/.pnpm/@kevisual+ha-api@0.0.8/node_modules/@kevisual/ha-api/src/light.ts
119250
- class LightHA extends HACore {
119251
- static serviceName = "light";
119252
- text;
119253
- constructor(options) {
119254
- super(options);
119255
- this.text = new TextHA(options);
119256
- }
119257
- async searchLight(keyword) {
119258
- const devices = await this.getInfoList();
119259
- const fuse = new Fuse(devices, {
119260
- keys: ["name"],
119261
- threshold: 0.4,
119262
- includeScore: true,
119263
- minMatchCharLength: 1
119264
- });
119265
- const result = fuse.search(keyword);
119266
- const resultItems = result.map((r) => r.item);
119267
- let id2 = "";
119268
- if (resultItems.length === 1) {
119269
- id2 = resultItems[0].entity_id;
119270
- }
119271
- const hasMore = resultItems.length > 1;
119272
- return { result: resultItems, lights: devices, id: id2, hasMore };
119273
- }
119274
- async closeAllLights() {
119275
- const lights = await this.getServiceEntities();
119276
- for (const light of lights) {
119277
- if (light.state === "on") {
119278
- this.runService({ entity_id: light.entity_id, service: "turn_off" });
119279
- }
119280
- }
119281
- }
119282
- }
119283
- class TextHA extends HACore {
119284
- static serviceName = "text";
119285
- constructor(options) {
119286
- super(options);
119287
- }
119288
- getSpeakerEntities() {
119289
- return this.getEntities((entity) => entity.entity_id.startsWith(`text.`) && entity.attributes?.friendly_name?.includes?.("音箱"));
119290
- }
119291
- executeTextDirective(entity_id, value) {
119292
- return this.runService({
119293
- entity_id,
119294
- service: "set_value",
119295
- data: {
119296
- value
119297
- }
119298
- });
119299
- }
119300
- }
119301
- // src/routes/ha-api/ha.ts
119302
- var lightHA = new LightHA({ token: process.env.HAAS_TOKEN || "", homeassistantURL: process.env.HAAS_URL });
119303
- var callText = async (text) => {
119304
- const command = text?.trim().slice(0, 20);
119305
- let obj = {};
119306
- if (command.startsWith("打开")) {
119307
- obj.appName = command.replace("打开", "").trim();
119308
- obj.type = "打开";
119309
- } else if (command.startsWith("关闭")) {
119310
- obj.appName = command.replace("关闭", "").trim();
119311
- obj.type = "关闭";
119312
- }
119313
- let endTime = Date.now();
119314
- if (obj.type) {
119315
- try {
119316
- const search2 = await lightHA.searchLight(obj.appName || "");
119317
- console.log("searchTime", Date.now() - endTime);
119318
- if (search2.id) {
119319
- await lightHA.runService({ entity_id: search2.id, service: obj.type === "打开" ? "turn_on" : "turn_off" });
119320
- } else if (search2.hasMore) {
119321
- const [first] = search2.result;
119322
- await lightHA.runService({ entity_id: first.entity_id, service: obj.type === "打开" ? "turn_on" : "turn_off" });
119323
- } else {
119324
- console.log("未找到对应设备:", obj.appName);
119325
- }
119326
- console.log("解析到控制指令", obj);
119327
- } catch (e) {
119328
- console.error("控制失败", e);
119329
- }
119330
- }
119331
- };
119332
-
119333
117800
  // src/services/asr/qwen-asr.ts
119334
117801
  var func = async (req, res) => {
119335
117802
  const { ws, emitter, id: id2, data } = req;
@@ -119384,9 +117851,6 @@ var func = async (req, res) => {
119384
117851
  time: Date.now(),
119385
117852
  text
119386
117853
  }));
119387
- if (!text)
119388
- return;
119389
- await callText(text);
119390
117854
  console.log("toogle light time", Date.now() - endTime);
119391
117855
  });
119392
117856
  asr2.start();