libchai 0.3.0-beta.1 → 0.3.0

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.
package/README.md CHANGED
@@ -16,18 +16,21 @@
16
16
  命令行程序基本的用法为:
17
17
 
18
18
  ```bash
19
- ./chai [方案文件] -e [词信息文件] [命令]
19
+ ./chai [命令] -c [方案文件] -e [词信息文件]
20
20
  ```
21
21
 
22
- `chai` 支持两个不同的命令:`encode` 和 `optimize`:
22
+ `chai` 支持三个不同的命令:`encode` 和 `optimize`:
23
23
 
24
24
  - `encode`:使用方案文件和拆分表计算出字词编码并统计各类评测指标
25
25
  - `optimize`:基于拆分表和方案文件中的配置优化元素布局
26
+ - `server`: 启动 Web 服务
26
27
 
27
28
  例如,您可以运行
28
29
 
29
30
  ```bash
30
- ./chai examples/米十五笔.yaml -e examples/米十五笔.txt encode
31
+ ./chai encode -c examples/米十五笔.yaml -e examples/米十五笔.txt
32
+ ./chai optimize -c examples/米十五笔.yaml -e examples/米十五笔.txt -t 4
33
+ ./chai server -p 12345
31
34
  ```
32
35
 
33
36
  完整的使用说明可用 `./chai --help` 查看。
package/chai.d.ts CHANGED
@@ -10,10 +10,9 @@ export function validate(js_config: any): any;
10
10
  export class Web {
11
11
  private constructor();
12
12
  free(): void;
13
- [Symbol.dispose](): void;
13
+ encode_evaluate(前端目标函数配置: any): any;
14
14
  static new(回调: Function): Web;
15
15
  sync(前端参数: any): void;
16
- encode_evaluate(前端目标函数配置: any): any;
17
16
  optimize(): void;
18
17
  }
19
18
 
@@ -23,10 +22,10 @@ export interface InitOutput {
23
22
  readonly memory: WebAssembly.Memory;
24
23
  readonly __wbg_web_free: (a: number, b: number) => void;
25
24
  readonly validate: (a: number, b: number) => void;
26
- readonly web_new: (a: number) => number;
27
- readonly web_sync: (a: number, b: number, c: number) => void;
28
25
  readonly web_encode_evaluate: (a: number, b: number, c: number) => void;
26
+ readonly web_new: (a: number) => number;
29
27
  readonly web_optimize: (a: number, b: number) => void;
28
+ readonly web_sync: (a: number, b: number, c: number) => void;
30
29
  readonly __wbindgen_export_0: (a: number, b: number) => number;
31
30
  readonly __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
32
31
  readonly __wbindgen_export_2: (a: number) => void;
package/chai.js CHANGED
@@ -1,5 +1,13 @@
1
1
  let wasm;
2
2
 
3
+ const heap = new Array(128).fill(undefined);
4
+
5
+ heap.push(undefined, null, true, false);
6
+
7
+ function getObject(idx) { return heap[idx]; }
8
+
9
+ let WASM_VECTOR_LEN = 0;
10
+
3
11
  let cachedUint8ArrayMemory0 = null;
4
12
 
5
13
  function getUint8ArrayMemory0() {
@@ -9,58 +17,20 @@ function getUint8ArrayMemory0() {
9
17
  return cachedUint8ArrayMemory0;
10
18
  }
11
19
 
12
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
13
-
14
- cachedTextDecoder.decode();
15
-
16
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
17
- let numBytesDecoded = 0;
18
- function decodeText(ptr, len) {
19
- numBytesDecoded += len;
20
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
21
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
22
- cachedTextDecoder.decode();
23
- numBytesDecoded = len;
24
- }
25
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
26
- }
27
-
28
- function getStringFromWasm0(ptr, len) {
29
- ptr = ptr >>> 0;
30
- return decodeText(ptr, len);
31
- }
32
-
33
- let heap = new Array(128).fill(undefined);
34
-
35
- heap.push(undefined, null, true, false);
36
-
37
- let heap_next = heap.length;
38
-
39
- function addHeapObject(obj) {
40
- if (heap_next === heap.length) heap.push(heap.length + 1);
41
- const idx = heap_next;
42
- heap_next = heap[idx];
43
-
44
- heap[idx] = obj;
45
- return idx;
46
- }
47
-
48
- function getObject(idx) { return heap[idx]; }
49
-
50
- let WASM_VECTOR_LEN = 0;
51
-
52
- const cachedTextEncoder = new TextEncoder();
20
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
53
21
 
54
- if (!('encodeInto' in cachedTextEncoder)) {
55
- cachedTextEncoder.encodeInto = function (arg, view) {
56
- const buf = cachedTextEncoder.encode(arg);
57
- view.set(buf);
58
- return {
59
- read: arg.length,
60
- written: buf.length
61
- };
62
- }
22
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
23
+ ? function (arg, view) {
24
+ return cachedTextEncoder.encodeInto(arg, view);
63
25
  }
26
+ : function (arg, view) {
27
+ const buf = cachedTextEncoder.encode(arg);
28
+ view.set(buf);
29
+ return {
30
+ read: arg.length,
31
+ written: buf.length
32
+ };
33
+ });
64
34
 
65
35
  function passStringToWasm0(arg, malloc, realloc) {
66
36
 
@@ -91,7 +61,7 @@ function passStringToWasm0(arg, malloc, realloc) {
91
61
  }
92
62
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
93
63
  const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
94
- const ret = cachedTextEncoder.encodeInto(arg, view);
64
+ const ret = encodeString(arg, view);
95
65
 
96
66
  offset += ret.written;
97
67
  ptr = realloc(ptr, len, offset, 1) >>> 0;
@@ -110,6 +80,17 @@ function getDataViewMemory0() {
110
80
  return cachedDataViewMemory0;
111
81
  }
112
82
 
83
+ let heap_next = heap.length;
84
+
85
+ function addHeapObject(obj) {
86
+ if (heap_next === heap.length) heap.push(heap.length + 1);
87
+ const idx = heap_next;
88
+ heap_next = heap[idx];
89
+
90
+ heap[idx] = obj;
91
+ return idx;
92
+ }
93
+
113
94
  function handleError(f, args) {
114
95
  try {
115
96
  return f.apply(this, args);
@@ -118,6 +99,15 @@ function handleError(f, args) {
118
99
  }
119
100
  }
120
101
 
102
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
103
+
104
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
105
+
106
+ function getStringFromWasm0(ptr, len) {
107
+ ptr = ptr >>> 0;
108
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
109
+ }
110
+
121
111
  function getArrayU8FromWasm0(ptr, len) {
122
112
  ptr = ptr >>> 0;
123
113
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -251,6 +241,25 @@ export class Web {
251
241
  const ptr = this.__destroy_into_raw();
252
242
  wasm.__wbg_web_free(ptr, 0);
253
243
  }
244
+ /**
245
+ * @param {any} 前端目标函数配置
246
+ * @returns {any}
247
+ */
248
+ encode_evaluate(前端目标函数配置) {
249
+ try {
250
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
251
+ wasm.web_encode_evaluate(retptr, this.__wbg_ptr, addHeapObject(前端目标函数配置));
252
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
253
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
254
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
255
+ if (r2) {
256
+ throw takeObject(r1);
257
+ }
258
+ return takeObject(r0);
259
+ } finally {
260
+ wasm.__wbindgen_add_to_stack_pointer(16);
261
+ }
262
+ }
254
263
  /**
255
264
  * @param {Function} 回调
256
265
  * @returns {Web}
@@ -275,25 +284,6 @@ export class Web {
275
284
  wasm.__wbindgen_add_to_stack_pointer(16);
276
285
  }
277
286
  }
278
- /**
279
- * @param {any} 前端目标函数配置
280
- * @returns {any}
281
- */
282
- encode_evaluate(前端目标函数配置) {
283
- try {
284
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
285
- wasm.web_encode_evaluate(retptr, this.__wbg_ptr, addHeapObject(前端目标函数配置));
286
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
287
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
288
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
289
- if (r2) {
290
- throw takeObject(r1);
291
- }
292
- return takeObject(r0);
293
- } finally {
294
- wasm.__wbindgen_add_to_stack_pointer(16);
295
- }
296
- }
297
287
  optimize() {
298
288
  try {
299
289
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -308,9 +298,6 @@ export class Web {
308
298
  }
309
299
  }
310
300
  }
311
- if (Symbol.dispose) Web.prototype[Symbol.dispose] = Web.prototype.free;
312
-
313
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
314
301
 
315
302
  async function __wbg_load(module, imports) {
316
303
  if (typeof Response === 'function' && module instanceof Response) {
@@ -319,9 +306,7 @@ async function __wbg_load(module, imports) {
319
306
  return await WebAssembly.instantiateStreaming(module, imports);
320
307
 
321
308
  } catch (e) {
322
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
323
-
324
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
309
+ if (module.headers.get('Content-Type') != 'application/wasm') {
325
310
  console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
326
311
 
327
312
  } else {
@@ -348,14 +333,6 @@ async function __wbg_load(module, imports) {
348
333
  function __wbg_get_imports() {
349
334
  const imports = {};
350
335
  imports.wbg = {};
351
- imports.wbg.__wbg_Error_e17e777aac105295 = function(arg0, arg1) {
352
- const ret = Error(getStringFromWasm0(arg0, arg1));
353
- return addHeapObject(ret);
354
- };
355
- imports.wbg.__wbg_Number_998bea33bd87c3e0 = function(arg0) {
356
- const ret = Number(getObject(arg0));
357
- return ret;
358
- };
359
336
  imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
360
337
  const ret = String(getObject(arg1));
361
338
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
@@ -363,23 +340,27 @@ function __wbg_get_imports() {
363
340
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
364
341
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
365
342
  };
366
- imports.wbg.__wbg_call_13410aac570ffff7 = function() { return handleError(function (arg0, arg1) {
343
+ imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
344
+ const ret = getObject(arg0).buffer;
345
+ return addHeapObject(ret);
346
+ };
347
+ imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
367
348
  const ret = getObject(arg0).call(getObject(arg1));
368
349
  return addHeapObject(ret);
369
350
  }, arguments) };
370
- imports.wbg.__wbg_call_a5400b25a865cfd8 = function() { return handleError(function (arg0, arg1, arg2) {
351
+ imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
371
352
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
372
353
  return addHeapObject(ret);
373
354
  }, arguments) };
374
- imports.wbg.__wbg_codePointAt_6ee161d941249514 = function(arg0, arg1) {
355
+ imports.wbg.__wbg_codePointAt_78181f32881e5b59 = function(arg0, arg1) {
375
356
  const ret = getObject(arg0).codePointAt(arg1 >>> 0);
376
357
  return addHeapObject(ret);
377
358
  };
378
- imports.wbg.__wbg_done_75ed0ee6dd243d9d = function(arg0) {
359
+ imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
379
360
  const ret = getObject(arg0).done;
380
361
  return ret;
381
362
  };
382
- imports.wbg.__wbg_entries_2be2f15bd5554996 = function(arg0) {
363
+ imports.wbg.__wbg_entries_3265d4158b33e5dc = function(arg0) {
383
364
  const ret = Object.entries(getObject(arg0));
384
365
  return addHeapObject(ret);
385
366
  };
@@ -394,26 +375,26 @@ function __wbg_get_imports() {
394
375
  wasm.__wbindgen_export_3(deferred0_0, deferred0_1, 1);
395
376
  }
396
377
  };
397
- imports.wbg.__wbg_fromCodePoint_497220cbed07e190 = function() { return handleError(function (arg0) {
378
+ imports.wbg.__wbg_fromCodePoint_f37c25c172f2e8b5 = function() { return handleError(function (arg0) {
398
379
  const ret = String.fromCodePoint(arg0 >>> 0);
399
380
  return addHeapObject(ret);
400
381
  }, arguments) };
401
- imports.wbg.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
382
+ imports.wbg.__wbg_getRandomValues_3c9c0d586e575a16 = function() { return handleError(function (arg0, arg1) {
402
383
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
403
384
  }, arguments) };
404
- imports.wbg.__wbg_get_0da715ceaecea5c8 = function(arg0, arg1) {
405
- const ret = getObject(arg0)[arg1 >>> 0];
406
- return addHeapObject(ret);
407
- };
408
- imports.wbg.__wbg_get_458e874b43b18b25 = function() { return handleError(function (arg0, arg1) {
385
+ imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
409
386
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
410
387
  return addHeapObject(ret);
411
388
  }, arguments) };
389
+ imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
390
+ const ret = getObject(arg0)[arg1 >>> 0];
391
+ return addHeapObject(ret);
392
+ };
412
393
  imports.wbg.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
413
394
  const ret = getObject(arg0)[getObject(arg1)];
414
395
  return addHeapObject(ret);
415
396
  };
416
- imports.wbg.__wbg_instanceof_ArrayBuffer_67f3012529f6a2dd = function(arg0) {
397
+ imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
417
398
  let result;
418
399
  try {
419
400
  result = getObject(arg0) instanceof ArrayBuffer;
@@ -423,7 +404,7 @@ function __wbg_get_imports() {
423
404
  const ret = result;
424
405
  return ret;
425
406
  };
426
- imports.wbg.__wbg_instanceof_Map_ebb01a5b6b5ffd0b = function(arg0) {
407
+ imports.wbg.__wbg_instanceof_Map_f3469ce2244d2430 = function(arg0) {
427
408
  let result;
428
409
  try {
429
410
  result = getObject(arg0) instanceof Map;
@@ -433,7 +414,7 @@ function __wbg_get_imports() {
433
414
  const ret = result;
434
415
  return ret;
435
416
  };
436
- imports.wbg.__wbg_instanceof_Uint8Array_9a8378d955933db7 = function(arg0) {
417
+ imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
437
418
  let result;
438
419
  try {
439
420
  result = getObject(arg0) instanceof Uint8Array;
@@ -443,59 +424,59 @@ function __wbg_get_imports() {
443
424
  const ret = result;
444
425
  return ret;
445
426
  };
446
- imports.wbg.__wbg_isArray_030cce220591fb41 = function(arg0) {
427
+ imports.wbg.__wbg_isArray_a1eab7e0d067391b = function(arg0) {
447
428
  const ret = Array.isArray(getObject(arg0));
448
429
  return ret;
449
430
  };
450
- imports.wbg.__wbg_isSafeInteger_1c0d1af5542e102a = function(arg0) {
431
+ imports.wbg.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) {
451
432
  const ret = Number.isSafeInteger(getObject(arg0));
452
433
  return ret;
453
434
  };
454
- imports.wbg.__wbg_iterator_f370b34483c71a1c = function() {
435
+ imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {
455
436
  const ret = Symbol.iterator;
456
437
  return addHeapObject(ret);
457
438
  };
458
- imports.wbg.__wbg_length_186546c51cd61acd = function(arg0) {
439
+ imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
459
440
  const ret = getObject(arg0).length;
460
441
  return ret;
461
442
  };
462
- imports.wbg.__wbg_length_6bb7e81f9d7713e4 = function(arg0) {
443
+ imports.wbg.__wbg_length_d56737991078581b = function(arg0) {
463
444
  const ret = getObject(arg0).length;
464
445
  return ret;
465
446
  };
466
- imports.wbg.__wbg_length_9d771c54845e987f = function(arg0) {
447
+ imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
467
448
  const ret = getObject(arg0).length;
468
449
  return ret;
469
450
  };
470
- imports.wbg.__wbg_new_19c25a3f2fa63a02 = function() {
451
+ imports.wbg.__wbg_new_405e22f390576ce2 = function() {
471
452
  const ret = new Object();
472
453
  return addHeapObject(ret);
473
454
  };
474
- imports.wbg.__wbg_new_1f3a344cf3123716 = function() {
475
- const ret = new Array();
476
- return addHeapObject(ret);
477
- };
478
- imports.wbg.__wbg_new_2ff1f68f3676ea53 = function() {
455
+ imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
479
456
  const ret = new Map();
480
457
  return addHeapObject(ret);
481
458
  };
482
- imports.wbg.__wbg_new_638ebfaedbf32a5e = function(arg0) {
483
- const ret = new Uint8Array(getObject(arg0));
459
+ imports.wbg.__wbg_new_78feb108b6472713 = function() {
460
+ const ret = new Array();
484
461
  return addHeapObject(ret);
485
462
  };
486
463
  imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
487
464
  const ret = new Error();
488
465
  return addHeapObject(ret);
489
466
  };
490
- imports.wbg.__wbg_newnoargs_254190557c45b4ec = function(arg0, arg1) {
467
+ imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
468
+ const ret = new Uint8Array(getObject(arg0));
469
+ return addHeapObject(ret);
470
+ };
471
+ imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
491
472
  const ret = new Function(getStringFromWasm0(arg0, arg1));
492
473
  return addHeapObject(ret);
493
474
  };
494
- imports.wbg.__wbg_next_5b3530e612fde77d = function(arg0) {
475
+ imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
495
476
  const ret = getObject(arg0).next;
496
477
  return addHeapObject(ret);
497
478
  };
498
- imports.wbg.__wbg_next_692e82279131b03c = function() { return handleError(function (arg0) {
479
+ imports.wbg.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
499
480
  const ret = getObject(arg0).next();
500
481
  return addHeapObject(ret);
501
482
  }, arguments) };
@@ -507,16 +488,16 @@ function __wbg_get_imports() {
507
488
  const ret = getObject(arg0).performance;
508
489
  return addHeapObject(ret);
509
490
  };
510
- imports.wbg.__wbg_prototypesetcall_3d4a26c1ed734349 = function(arg0, arg1, arg2) {
511
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
491
+ imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
492
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
512
493
  };
513
494
  imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
514
495
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
515
496
  };
516
- imports.wbg.__wbg_set_90f6c0f7bd8c0415 = function(arg0, arg1, arg2) {
517
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
497
+ imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
498
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
518
499
  };
519
- imports.wbg.__wbg_set_b7f1cf4fae26fe2a = function(arg0, arg1, arg2) {
500
+ imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
520
501
  const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
521
502
  return addHeapObject(ret);
522
503
  };
@@ -527,84 +508,115 @@ function __wbg_get_imports() {
527
508
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
528
509
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
529
510
  };
530
- imports.wbg.__wbg_static_accessor_GLOBAL_8921f820c2ce3f12 = function() {
511
+ imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
531
512
  const ret = typeof global === 'undefined' ? null : global;
532
513
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
533
514
  };
534
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_f0a4409105898184 = function() {
515
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
535
516
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
536
517
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
537
518
  };
538
- imports.wbg.__wbg_static_accessor_SELF_995b214ae681ff99 = function() {
519
+ imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
539
520
  const ret = typeof self === 'undefined' ? null : self;
540
521
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
541
522
  };
542
- imports.wbg.__wbg_static_accessor_WINDOW_cde3890479c675ea = function() {
523
+ imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
543
524
  const ret = typeof window === 'undefined' ? null : window;
544
525
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
545
526
  };
546
- imports.wbg.__wbg_value_dd9372230531eade = function(arg0) {
527
+ imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
547
528
  const ret = getObject(arg0).value;
548
529
  return addHeapObject(ret);
549
530
  };
550
- imports.wbg.__wbg_wbindgenbigintgetasi64_ac743ece6ab9bba1 = function(arg0, arg1) {
531
+ imports.wbg.__wbindgen_as_number = function(arg0) {
532
+ const ret = +getObject(arg0);
533
+ return ret;
534
+ };
535
+ imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
536
+ const ret = arg0;
537
+ return addHeapObject(ret);
538
+ };
539
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
540
+ const ret = BigInt.asUintN(64, arg0);
541
+ return addHeapObject(ret);
542
+ };
543
+ imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
551
544
  const v = getObject(arg1);
552
545
  const ret = typeof(v) === 'bigint' ? v : undefined;
553
546
  getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
554
547
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
555
548
  };
556
- imports.wbg.__wbg_wbindgenbooleanget_3fe6f642c7d97746 = function(arg0) {
549
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
557
550
  const v = getObject(arg0);
558
- const ret = typeof(v) === 'boolean' ? v : undefined;
559
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
551
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
552
+ return ret;
560
553
  };
561
- imports.wbg.__wbg_wbindgendebugstring_99ef257a3ddda34d = function(arg0, arg1) {
554
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
562
555
  const ret = debugString(getObject(arg1));
563
556
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
564
557
  const len1 = WASM_VECTOR_LEN;
565
558
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
566
559
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
567
560
  };
568
- imports.wbg.__wbg_wbindgenin_d7a1ee10933d2d55 = function(arg0, arg1) {
561
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
562
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
563
+ return addHeapObject(ret);
564
+ };
565
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
569
566
  const ret = getObject(arg0) in getObject(arg1);
570
567
  return ret;
571
568
  };
572
- imports.wbg.__wbg_wbindgenisbigint_ecb90cc08a5a9154 = function(arg0) {
569
+ imports.wbg.__wbindgen_is_bigint = function(arg0) {
573
570
  const ret = typeof(getObject(arg0)) === 'bigint';
574
571
  return ret;
575
572
  };
576
- imports.wbg.__wbg_wbindgenisfunction_8cee7dce3725ae74 = function(arg0) {
573
+ imports.wbg.__wbindgen_is_function = function(arg0) {
577
574
  const ret = typeof(getObject(arg0)) === 'function';
578
575
  return ret;
579
576
  };
580
- imports.wbg.__wbg_wbindgenisobject_307a53c6bd97fbf8 = function(arg0) {
577
+ imports.wbg.__wbindgen_is_object = function(arg0) {
581
578
  const val = getObject(arg0);
582
579
  const ret = typeof(val) === 'object' && val !== null;
583
580
  return ret;
584
581
  };
585
- imports.wbg.__wbg_wbindgenisstring_d4fa939789f003b0 = function(arg0) {
582
+ imports.wbg.__wbindgen_is_string = function(arg0) {
586
583
  const ret = typeof(getObject(arg0)) === 'string';
587
584
  return ret;
588
585
  };
589
- imports.wbg.__wbg_wbindgenisundefined_c4b71d073b92f3c5 = function(arg0) {
586
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
590
587
  const ret = getObject(arg0) === undefined;
591
588
  return ret;
592
589
  };
593
- imports.wbg.__wbg_wbindgenjsvaleq_e6f2ad59ccae1b58 = function(arg0, arg1) {
590
+ imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
594
591
  const ret = getObject(arg0) === getObject(arg1);
595
592
  return ret;
596
593
  };
597
- imports.wbg.__wbg_wbindgenjsvallooseeq_9bec8c9be826bed1 = function(arg0, arg1) {
594
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
598
595
  const ret = getObject(arg0) == getObject(arg1);
599
596
  return ret;
600
597
  };
601
- imports.wbg.__wbg_wbindgennumberget_f74b4c7525ac05cb = function(arg0, arg1) {
598
+ imports.wbg.__wbindgen_memory = function() {
599
+ const ret = wasm.memory;
600
+ return addHeapObject(ret);
601
+ };
602
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
602
603
  const obj = getObject(arg1);
603
604
  const ret = typeof(obj) === 'number' ? obj : undefined;
604
605
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
605
606
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
606
607
  };
607
- imports.wbg.__wbg_wbindgenstringget_0f16a6ddddef376f = function(arg0, arg1) {
608
+ imports.wbg.__wbindgen_number_new = function(arg0) {
609
+ const ret = arg0;
610
+ return addHeapObject(ret);
611
+ };
612
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
613
+ const ret = getObject(arg0);
614
+ return addHeapObject(ret);
615
+ };
616
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
617
+ takeObject(arg0);
618
+ };
619
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
608
620
  const obj = getObject(arg1);
609
621
  const ret = typeof(obj) === 'string' ? obj : undefined;
610
622
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
@@ -612,35 +624,12 @@ function __wbg_get_imports() {
612
624
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
613
625
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
614
626
  };
615
- imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
616
- throw new Error(getStringFromWasm0(arg0, arg1));
617
- };
618
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
619
- // Cast intrinsic for `Ref(String) -> Externref`.
627
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
620
628
  const ret = getStringFromWasm0(arg0, arg1);
621
629
  return addHeapObject(ret);
622
630
  };
623
- imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
624
- // Cast intrinsic for `U64 -> Externref`.
625
- const ret = BigInt.asUintN(64, arg0);
626
- return addHeapObject(ret);
627
- };
628
- imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
629
- // Cast intrinsic for `I64 -> Externref`.
630
- const ret = arg0;
631
- return addHeapObject(ret);
632
- };
633
- imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
634
- // Cast intrinsic for `F64 -> Externref`.
635
- const ret = arg0;
636
- return addHeapObject(ret);
637
- };
638
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
639
- const ret = getObject(arg0);
640
- return addHeapObject(ret);
641
- };
642
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
643
- takeObject(arg0);
631
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
632
+ throw new Error(getStringFromWasm0(arg0, arg1));
644
633
  };
645
634
 
646
635
  return imports;
package/chai_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Songchen Tan <i@tansongchen.com>"
6
6
  ],
7
7
  "description": "汉字编码优化算法",
8
- "version": "0.3.0-beta.1",
8
+ "version": "0.3.0",
9
9
  "license": "GPL-3.0",
10
10
  "repository": {
11
11
  "type": "git",