ziko 0.51.1 → 0.53.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/dist/ziko.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Thu Dec 04 2025 12:08:41 GMT+0100 (UTC+01:00)
5
+ Date : Fri Dec 05 2025 17:08:57 GMT+0100 (UTC+01:00)
6
6
  Git-Repo : https://github.com/zakarialaoui10/ziko.js
7
7
  Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
8
8
  Released under MIT License
@@ -11,75 +11,107 @@
11
11
  const { PI: PI$2, E } = Math;
12
12
  const EPSILON=Number.EPSILON;
13
13
 
14
- const {PI: PI$1, cos: cos$3, sin: sin$3, tan: tan$1, acos: acos$2, asin: asin$1, atan: atan$1, cosh: cosh$2, sinh: sinh$2, tanh: tanh$1, acosh: acosh$1, asinh: asinh$1, atanh: atanh$1, log: log$1} = Math;
14
+ const {PI: PI$1, cos: cos$3, sin: sin$3, tan: tan$1, atan: atan$1, cosh: cosh$2, sinh: sinh$2, tanh: tanh$1, acosh: acosh$1, asinh: asinh$1, atanh: atanh$1, log: log$1} = Math;
15
15
  let Fixed={
16
- cos: cos$3,
17
- sin: sin$3,
18
- tan: tan$1,
16
+ cos : x=> {
17
+ if(x.isComplex?.()) return new x.constructor(
18
+ cos$3(x.a)*cosh$2(x.b),
19
+ -(sin$3(x.a)*sinh$2(x.b))
20
+ );
21
+ return cos$3(x)
22
+ },
23
+ sin : x=>{
24
+ if(x?.isComplex) return new x.constructor(
25
+ sin$3(x.a)*cosh$2(x.b),
26
+ cos$3(x.a)*sinh$2(x.b)
27
+ );
28
+ return sin$3(x)
29
+ },
30
+ tan : x=>{
31
+ if(x?.isComplex){
32
+ const DEN = cos$3(2*x.a)+cosh$2(2*x.b);
33
+ return new x.constructor(
34
+ sin$3(2*x.a)/DEN,
35
+ sinh$2(2*x.b)/DEN
36
+ );
37
+ }
38
+ return tan$1(x)
39
+ },
19
40
  sinc: x => sin$3(PI$1*x)/(PI$1*x),
20
41
  sec: x => 1/cos$3(x),
21
42
  csc: x => 1/sin$3(x),
22
43
  cot: x => 1/tan$1(x),
23
- acos: acos$2,
24
- asin: asin$1,
25
- atan: atan$1,
44
+ acos: x=>{
45
+ if(x?.isComplex) return
46
+ return sin$3(x)
47
+ },
48
+ asin: x=>{
49
+ if(x?.isComplex) return
50
+ return sin$3(x)
51
+ },
52
+ atan: x=>{
53
+ if(x?.isComplex) return
54
+ return sin$3(x)
55
+ },
26
56
  acot: x => PI$1/2-atan$1(x),
27
- cosh: cosh$2,
28
- sinh: sinh$2,
29
- tanh: tanh$1,
57
+ cosh: x=>{
58
+ if(x?.isComplex) return new x.constructor(
59
+ cosh$2(x.a)*cos$3(x.b),
60
+ sinh$2(x.a)*sin$3(x.b)
61
+ );
62
+ return cosh$2(x)
63
+ },
64
+ sinh: x=>{
65
+ if(x?.isComplex) return new x.constructor(
66
+ sinh$2(x.a)*cos$3(x.b),
67
+ cosh$2(x.a)*sin$3(x.b)
68
+ );
69
+ return sinh$2(x)
70
+ },
71
+ tanh: x=>{
72
+ if(x?.isComplex){
73
+ const DEN=cosh$2(2*a)+cos$3(2*b);
74
+ return new x.constructor(
75
+ sinh$2(2*a)/DEN,
76
+ sin$3(2*b)/DEN
77
+ )
78
+ }
79
+ return tanh$1(x)
80
+ },
30
81
  coth: n => (1/2*log$1((1+n)/(1-n))),
31
82
  acosh: acosh$1,
32
83
  asinh: asinh$1,
33
84
  atanh: atanh$1,
34
85
  };
35
86
 
36
- Fixed = new Proxy(Fixed, {
37
- get(target, prop) {
38
- if(prop in target){
39
- return x => + target[prop](x).toFixed(15);
40
- }
41
- return undefined;
42
- }
43
- });
87
+ // Fixed = new Proxy(Fixed, {
88
+ // get(target, prop) {
89
+ // if(prop in target){
90
+ // return x => + target[prop](x).toFixed(15);
91
+ // }
92
+ // return undefined;
93
+ // }
94
+ // })
95
+
96
+ const is_primitive = value => typeof value !== 'object' && typeof value !== 'function' || value === null;
44
97
 
45
- // To generalise
46
98
  const mapfun$1=(fun,...X)=>{
47
99
  const Y=X.map(x=>{
48
- if(x===null) return fun(null);
49
- if(["number","string","boolean","bigint","undefined"].includes(typeof x)) return fun(x);
100
+ if(is_primitive(x) || x?.__mapfun__) return fun(x)
50
101
  if(x instanceof Array) return x.map(n=>mapfun$1(fun,n));
51
102
  if(ArrayBuffer.isView(x)) return x.map(n=>fun(n));
52
103
  if(x instanceof Set) return new Set(mapfun$1(fun,...[...x]));
53
104
  if(x instanceof Map) return new Map([...x].map(n=>[n[0],mapfun$1(fun,n[1])]));
54
105
  if(x.isMatrix?.()) return new x.constructor(x.rows, x.cols, mapfun$1(x.arr.flat(1)))
55
- if(x.isComplex?.()){
56
- const complex = (...args) => new x.constructor(...args);
57
- const [a,b,z,phi]=[x.a,x.b,x.z,x.phi];
58
- switch(fun){
59
- case Math.log: return complex(ln(z),phi); // Done
60
- case Math.exp: return complex(e(a)*cos$2(b),e(a)*sin$2(b)); // Done
61
- case Math.abs: return z; // Done
62
- case Math.sqrt: return complex(sqrt$2(z)*cos$2(phi/2),sqrt$2(z)*sin$2(phi/2)); // Done
63
- case Fixed.cos: return complex(cos$2(a)*cosh$1(b),-(sin$2(a)*sinh$1(b)));
64
- case Fixed.sin: return complex(sin$2(a)*cosh$1(b),cos$2(a)*sinh$1(b));
65
- case Fixed.tan:{
66
- const DEN = cos$2(2*a)+cosh$1(2*b);
67
- return complex(sin$2(2*a)/DEN,sinh$1(2*b)/DEN);
68
- }
69
- case Fixed.cosh:return complex(cosh$1(a)*cos$2(b),sinh$1(a)*sin$2(b));
70
- case Fixed.sinh:return complex(sinh$1(a)*cos$2(b),cosh$1(a)*sin$2(b));
71
- case Fixed.tanh:{
72
- const DEN=cosh$1(2*a)+cos$2(2*b);
73
- return complex(sinh$1(2*a)/DEN,sin$2(2*b)/DEN)
74
- }
75
- default : return fun(x)
76
- }
77
- }
78
106
  else if(x instanceof Object){
79
- return Object.fromEntries(Object.entries(x).map(n=>n=[n[0],mapfun$1(fun,n[1])]))
107
+ return Object.fromEntries(
108
+ Object.entries(x).map(
109
+ n=>n=[n[0],mapfun$1(fun,n[1])]
110
+ )
111
+ )
80
112
  }
81
113
  });
82
- return Y.length==1?Y[0]:Y;
114
+ return Y.length==1? Y[0]: Y;
83
115
  };
84
116
 
85
117
  // Mixed calcul
@@ -688,8 +720,8 @@ class Complex{
688
720
  this.a=a.b/tan(a.phi);
689
721
  }
690
722
  else if(("z" in a && "phi" in a)){
691
- this.a=a.z*cos$2(a.phi);
692
- this.a=a.z*sin$2(a.phi);
723
+ this.a = +a.z*cos$2(a.phi).toFixed(15);
724
+ this.b = +a.z*sin$2(a.phi).toFixed(15);
693
725
  }
694
726
  }
695
727
  else if(typeof(a)==="number"&&typeof(b)==="number"){
@@ -697,6 +729,9 @@ class Complex{
697
729
  this.b = +b.toFixed(32);
698
730
  }
699
731
  }
732
+ get __mapfun__(){
733
+ return true
734
+ }
700
735
  isComplex(){
701
736
  return true
702
737
  }
@@ -989,6 +1024,35 @@ class UINode {
989
1024
 
990
1025
  // globalThis.node = (node) => new UINode(node);
991
1026
 
1027
+ function parseQueryParams$1(queryString) {
1028
+ const params = {};
1029
+ queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
1030
+ const [key, value] = match.split('=');
1031
+ params[key] = value;
1032
+ });
1033
+ return params;
1034
+ }
1035
+
1036
+ function defineParamsGetter$1(target ){
1037
+ Object.defineProperties(target, {
1038
+ 'QueryParams': {
1039
+ get: function() {
1040
+ return parseQueryParams$1(globalThis.location.search.substring(1));
1041
+ },
1042
+ configurable: false,
1043
+ enumerable: true
1044
+ },
1045
+ 'HashParams': {
1046
+ get: function() {
1047
+ const hash = globalThis.location.hash.substring(1);
1048
+ return hash.split("#");
1049
+ },
1050
+ configurable: false,
1051
+ enumerable: true
1052
+ }
1053
+ });
1054
+ }
1055
+
992
1056
  class UIStore extends Array {
993
1057
  constructor(...args) {
994
1058
  super(...args);
@@ -1022,202 +1086,6 @@ class UIStore extends Array {
1022
1086
  // create the singleton
1023
1087
  const __UI__ = new UIStore();
1024
1088
 
1025
- // __init__global__()
1026
- class UIElementCore extends UINode{
1027
- constructor(){
1028
- super();
1029
- }
1030
- init(element, name, type, render){
1031
- this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
1032
- if(typeof element === "string") {
1033
- switch(type){
1034
- case "html" : {
1035
- element = globalThis?.document?.createElement(element);
1036
- // console.log('1')
1037
- } break;
1038
- case "svg" : {
1039
- element = globalThis?.document?.createElementNS("http://www.w3.org/2000/svg", element);
1040
- // console.log('2')
1041
- } break;
1042
- default : throw Error("Not supported")
1043
- }
1044
- }
1045
- else this.target = element?.parentElement;
1046
- Object.assign(this.cache, {
1047
- name,
1048
- isInteractive : false,
1049
- parent:null,
1050
- isBody:false,
1051
- isRoot:false,
1052
- isHidden: false,
1053
- isFrozzen:false,
1054
- legacyParent : null,
1055
- attributes: {},
1056
- filters: {},
1057
- temp:{}
1058
- });
1059
- this.events = {
1060
- ptr:null,
1061
- mouse:null,
1062
- wheel:null,
1063
- key:null,
1064
- drag:null,
1065
- drop:null,
1066
- click:null,
1067
- clipboard:null,
1068
- focus:null,
1069
- swipe:null,
1070
- custom:null,
1071
- };
1072
- this.observer={
1073
- resize:null,
1074
- intersection:null
1075
- };
1076
- if(element) Object.assign(this.cache,{element});
1077
- // useDefaultStyle && this.style({
1078
- // position: "relative",
1079
- // boxSizing:"border-box",
1080
- // margin:0,
1081
- // padding:0,
1082
- // width : "auto",
1083
- // height : "auto"
1084
- // });
1085
- this.items = new UIStore();
1086
- globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
1087
- element && render && this?.render?.();
1088
- globalThis.__Ziko__.__UI__.push(this);
1089
- }
1090
- get element(){
1091
- return this.cache.element;
1092
- }
1093
- [Symbol.iterator]() {
1094
- return this.items[Symbol.iterator]();
1095
- }
1096
- maintain() {
1097
- for (let i = 0; i < this.items.length; i++) {
1098
- Object.defineProperty(this, i, {
1099
- value: this.items[i],
1100
- writable: true,
1101
- configurable: true,
1102
- enumerable: false
1103
- });
1104
- }
1105
- }
1106
- isInteractive(){
1107
- return this.cache.isInteractive;
1108
- }
1109
- isUIElement(){
1110
- return true;
1111
- }
1112
- }
1113
-
1114
- function register_to_class(target, ...mixins){
1115
- mixins.forEach(n => _register_to_class_(target, n));
1116
- }
1117
- function _register_to_class_(target, mixin) {
1118
- const descriptors = Object.getOwnPropertyDescriptors(mixin);
1119
- for (const key of Reflect.ownKeys(descriptors)) {
1120
- const desc = descriptors[key];
1121
- if ('get' in desc || 'set' in desc || typeof desc.value !== 'function') {
1122
- Object.defineProperty(Object.getPrototypeOf(target), key, desc);
1123
- } else if (typeof desc.value === 'function') {
1124
- if (!Object.getPrototypeOf(target).hasOwnProperty(key)) {
1125
- Object.defineProperty(Object.getPrototypeOf(target), key, desc);
1126
- }
1127
- }
1128
- }
1129
- }
1130
-
1131
- // export function mount(target = this.target) {
1132
- // if(this.isBody) return ;
1133
- // if(target?.isUIElement)target=target.element;
1134
- // this.target=target;
1135
- // this.target?.appendChild(this.element);
1136
- // return this;
1137
- // }
1138
- // export function unmount(){
1139
- // if(this.cache.parent)this.cache.parent.remove(this);
1140
- // else if(this.target?.children?.length && [...this.target?.children].includes(this.element)) this.target.removeChild(this.element);
1141
- // return this;
1142
- // }
1143
-
1144
- // export function mountAfter(target = this.target, t = 1) {
1145
- // setTimeout(() => this.mount(), t);
1146
- // return this;
1147
- // }
1148
- // export function unmountAfter(t = 1) {
1149
- // setTimeout(() => this.unmount(), t);
1150
- // return this;
1151
- // }
1152
-
1153
- function mount(target = this.target, delay = 0) {
1154
- if (delay > 0) {
1155
- setTimeout(() => this.mount(target, 0), delay);
1156
- return this;
1157
- }
1158
-
1159
- if (this.isBody) return this;
1160
-
1161
- if (target?.isUIElement) target = target.element;
1162
- this.target = target;
1163
-
1164
- this.target?.appendChild(this.element);
1165
- return this;
1166
- }
1167
-
1168
- function unmount(delay = 0) {
1169
- if (delay > 0) {
1170
- setTimeout(() => this.unmount(0), delay);
1171
- return this;
1172
- }
1173
-
1174
- if (this.cache.parent) {
1175
- this.cache.parent.remove(this);
1176
- } else if (
1177
- this.target?.children?.length &&
1178
- [...this.target.children].includes(this.element)
1179
- ) {
1180
- this.target.removeChild(this.element);
1181
- }
1182
-
1183
- return this;
1184
- }
1185
-
1186
- var LifecycleMethods = /*#__PURE__*/Object.freeze({
1187
- __proto__: null,
1188
- mount: mount,
1189
- unmount: unmount
1190
- });
1191
-
1192
- function parseQueryParams$1(queryString) {
1193
- const params = {};
1194
- queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
1195
- const [key, value] = match.split('=');
1196
- params[key] = value;
1197
- });
1198
- return params;
1199
- }
1200
-
1201
- function defineParamsGetter$1(target ){
1202
- Object.defineProperties(target, {
1203
- 'QueryParams': {
1204
- get: function() {
1205
- return parseQueryParams$1(globalThis.location.search.substring(1));
1206
- },
1207
- configurable: false,
1208
- enumerable: true
1209
- },
1210
- 'HashParams': {
1211
- get: function() {
1212
- const hash = globalThis.location.hash.substring(1);
1213
- return hash.split("#");
1214
- },
1215
- configurable: false,
1216
- enumerable: true
1217
- }
1218
- });
1219
- }
1220
-
1221
1089
  const __Config__ = {
1222
1090
  default:{
1223
1091
  target:null,
@@ -1261,384 +1129,6 @@ const __CACHE__ = {
1261
1129
  }
1262
1130
  };
1263
1131
 
1264
- const powerSet=originalSet=>{
1265
- const subSets = [];
1266
- const NUMBER_OF_COMBINATIONS = 2 ** originalSet.length;
1267
- for (let i = 0; i < NUMBER_OF_COMBINATIONS; i += 1) {
1268
- const subSet = [];
1269
- for (let j = 0; j < originalSet.length; j += 1) {
1270
- if (i & (1 << j)) {
1271
- subSet.push(originalSet[j]);
1272
- }
1273
- }
1274
- subSets.push(subSet);
1275
- }
1276
- return subSets;
1277
- };
1278
-
1279
- // const subSet = (...arr) => {
1280
- // let list = arange(0, 2 ** arr.length, 1);
1281
- // let bin = list.map((n) => n.toString(2).padStart(arr.length, '0')).map((n) => n.split("").map((n) => +n));
1282
- // let sub = bin.map((n) => n.map((m, i) => (m === 1 ? arr[i] : null))).map((n) => n.filter((x) => x !== null));
1283
- // return sub;
1284
- // };
1285
- const subSet = null;
1286
-
1287
- const Base={
1288
- _mode:Number,
1289
- _map:function(func,number,toBase){
1290
- if (number instanceof Matrix)
1291
- return new Matrix(
1292
- number.rows,
1293
- number.cols,
1294
- number.arr.flat(1).map(n=>func(n,toBase))
1295
- );
1296
- else if (number instanceof Complex) return new Complex(func(number.a,toBase),func(number.b,toBase));
1297
- else if (number instanceof Array) return number.map((n) =>func(n,toBase));
1298
- },
1299
- dec2base(dec,base){
1300
- base<=10?this._mode=Number:this._mode=String;
1301
- //this._mode=String
1302
- if (typeof dec === "number") return this._mode((dec >>> 0).toString(base));
1303
- return this._map(this.dec2base,dec,base)
1304
- },
1305
- dec2bin(dec){
1306
- return this.dec2base(dec,2);
1307
- },
1308
- dec2oct(dec){
1309
- return this.dec2base(dec,8);
1310
- },
1311
- dec2hex(dec){
1312
- return this.dec2base(dec,16);
1313
- },
1314
- bin2base(bin, base) {
1315
- return this.dec2base(this.bin2dec(bin),base)
1316
- },
1317
- bin2dec(bin){
1318
- return this._mode("0b"+bin);
1319
- },
1320
- bin2oct(bin){
1321
- return this.bin2base(bin,8);
1322
- },
1323
- bin2hex(bin){
1324
- return this.bin2base(bin,16);
1325
- },
1326
- oct2dec(oct){
1327
- return this._mode("0o"+oct);
1328
- },
1329
- oct2bin(oct){
1330
- return this.dec2bin(this.oct2dec(oct))
1331
- },
1332
- oct2hex(oct){
1333
- return this.dec2hex(this.oct2dec(oct))
1334
- },
1335
- oct2base(oct, base) {
1336
- return this.dec2base(this.oct2dec(oct),base)
1337
- },
1338
- hex2dec(hex){
1339
- return this._mode("0x"+hex);
1340
- },
1341
- hex2bin(hex){
1342
- return this.dec2bin(this.hex2dec(hex))
1343
- },
1344
- hex2oct(hex){
1345
- return this.dec2oct(this.hex2dec(hex))
1346
- },
1347
- hex2base(hex, base) {
1348
- return this.dec2base(this.hex2dec(hex),base)
1349
- },
1350
- IEEE32toDec(Bin){
1351
- let IEEE32=Bin.split(" ").join("").padEnd(32,"0");
1352
- let s=IEEE32[0];
1353
- let e=2**(+("0b"+IEEE32.slice(1,9))-127);
1354
- let m=IEEE32.slice(9,32).split("").map(n=>+n);
1355
- let M=m.map((n,i)=>n*(2**(-i-1))).reduce((a,b)=>a+b,0);
1356
- let dec=(-1)**s*(1+M)*e;
1357
- return dec
1358
- },
1359
- IEEE64toDec(Bin){
1360
- let IEEE64=Bin.split(" ").join("").padEnd(64,"0");
1361
- let s=IEEE64[0];
1362
- let e=2**(+("0b"+IEEE64.slice(1,12))-1023);
1363
- let m=IEEE64.slice(13,64).split("").map(n=>+n);
1364
- let M=m.map((n,i)=>n*(2**(-i-1))).reduce((a,b)=>a+b,0);
1365
- let dec=(-1)**s*(1+M)*e;
1366
- return dec;
1367
- }
1368
- };
1369
-
1370
- const Logic$1={
1371
- _mode:Number,
1372
- _map:function(func,a,b){
1373
- if (a instanceof Matrix)
1374
- return new Matrix(
1375
- a.rows,
1376
- a.cols,
1377
- a.arr.flat(1).map((n) => func(n, b))
1378
- );
1379
- else if (a instanceof Complex) return new Complex(func(a.a, b), func(a.b, b));
1380
- else if (a instanceof Array) return a.map((n) => func(n, b));
1381
- },
1382
- not:function(input){
1383
- if(["number","boolean"].includes(typeof input)) return Logic$1._mode(!input);
1384
- else return this._map(this.not,input)
1385
- },
1386
- and:function(a, ...b){
1387
- if(["number","boolean"].includes(typeof a))return Logic$1._mode(b.reduce((n, m) => (n &= m), a));
1388
- else return this._map(this.and,a,b)
1389
- },
1390
- or:function(a, ...b) {
1391
- if(["number","boolean"].includes(typeof a)) return Logic$1._mode(b.reduce((n, m) => (n |= m), a));
1392
- else return this._map(this.or,a,b);
1393
- },
1394
- nand:function(a, ...b) {
1395
- return this.not(this.and(a, b));
1396
- },
1397
- nor:function(a, ...b) {
1398
- return this.not(this.or(a, b));
1399
- },
1400
- xor:function(a,...b){
1401
- let arr=[a,...b];
1402
- if(["number","boolean"].includes(typeof a))return this._mode(arr.reduce((length,cur)=>{
1403
- if(+cur===1)length+=1;
1404
- return length;
1405
- },0)===1);
1406
- else return this._map(this.xor,a,b);
1407
- },
1408
- xnor:function(a,...b){
1409
- return Logic$1.not(Logic$1.xor(a,b))
1410
- }
1411
-
1412
- };
1413
-
1414
- class Permutation {
1415
- static withDiscount(arr, l = arr.length) {
1416
- if (l === 1) return arr.map((n) => [n]);
1417
- const permutations = [];
1418
- let smallerPermutations;
1419
- smallerPermutations = this.withDiscount(arr, l - 1);
1420
- arr.forEach((currentOption) => {
1421
- smallerPermutations.forEach((smallerPermutation) => {
1422
- permutations.push([currentOption].concat(smallerPermutation));
1423
- });
1424
- });
1425
- return permutations;
1426
- }
1427
- static withoutDiscount(arr) {
1428
- const l = arr.length;
1429
- if (l === 1) return arr.map((n) => [n]);
1430
- const permutations = [];
1431
- const smallerPermutations = this.withoutDiscount(arr.slice(1));
1432
- const firstOption = arr[0];
1433
- for (let i = 0; i < smallerPermutations.length; i++) {
1434
- const smallerPermutation = smallerPermutations[i];
1435
- for (let j = 0; j <= smallerPermutation.length; j++) {
1436
- const permutationPrefix = smallerPermutation.slice(0, j);
1437
- const permutationSuffix = smallerPermutation.slice(j);
1438
- permutations.push(permutationPrefix.concat([firstOption], permutationSuffix));
1439
- }
1440
- }
1441
- return permutations;
1442
- }
1443
- }
1444
-
1445
- class Combinaison {
1446
- static withDiscount(comboOptions, comboLength) {
1447
- if (comboLength === 1) {
1448
- return comboOptions.map((comboOption) => [comboOption]);
1449
- }
1450
- const combos = [];
1451
- comboOptions.forEach((currentOption, optionIndex) => {
1452
- const smallerCombos = this.withDiscount(comboOptions.slice(optionIndex), comboLength - 1);
1453
- smallerCombos.forEach((smallerCombo) => {
1454
- combos.push([currentOption].concat(smallerCombo));
1455
- });
1456
- });
1457
- return combos;
1458
- }
1459
- static withoutDiscount(comboOptions, comboLength) {
1460
- if (comboLength === 1) {
1461
- return comboOptions.map((comboOption) => [comboOption]);
1462
- }
1463
- const combos = [];
1464
- comboOptions.forEach((currentOption, optionIndex) => {
1465
- const smallerCombos = this.withoutDiscount(comboOptions.slice(optionIndex + 1), comboLength - 1);
1466
- smallerCombos.forEach((smallerCombo) => {
1467
- combos.push([currentOption].concat(smallerCombo));
1468
- });
1469
- });
1470
-
1471
- return combos;
1472
- }
1473
- }
1474
- const combinaison=(comboOptions, comboLength, discount=false)=>Combinaison[discount?"withDiscount":"withoutDiscount"](comboOptions, comboLength);
1475
-
1476
- class Random {
1477
- static float(a = 1, b) {
1478
- return b ? Math.random() * (b - a) + a : a * Math.random();
1479
- }
1480
- static int(a, b) {
1481
- return Math.floor(this.float(a, b));
1482
- }
1483
- static char(upperCase){
1484
- upperCase=upperCase??this.bool();
1485
- const Char=String.fromCharCode(this.int(97,120));
1486
- return upperCase?Char.toUpperCase():Char;
1487
- }
1488
- static bool(){
1489
- return [false,true][Math.floor(Math.random()*2)];
1490
- }
1491
- static string(length,upperCase){
1492
- return length instanceof Array?
1493
- new Array(this.int(...length)).fill(0).map(() => this.char(upperCase)).join(""):
1494
- new Array(length).fill(0).map(() => this.char(upperCase)).join("");
1495
- }
1496
- static bin() {
1497
- return this.int(2);
1498
- }
1499
- static oct() {
1500
- return this.int(8);
1501
- }
1502
- static dec() {
1503
- return this.int(8);
1504
- }
1505
- static hex() {
1506
- return this.int(16);
1507
- }
1508
- static choice(choices = [1, 2, 3], p = new Array(choices.length).fill(1 / choices.length)) {
1509
- let newchoice = new Array(100);
1510
- p=Utils.accum(...p).map(n=>n*100);
1511
- newchoice.fill(choices[0], 0, p[0]);
1512
- for (let i = 1; i < choices.length; i++) newchoice.fill(choices[i], p[i - 1], p[i]);
1513
- return newchoice[this.int(newchoice.length - 1)];
1514
- }
1515
- static shuffleArr(arr){
1516
- return arr.sort(()=>0.5-Math.random())
1517
- }
1518
- static floats(n, a, b) {
1519
- return new Array(n).fill(0).map(() => this.float(a, b));
1520
- }
1521
- static ints(n, a, b) {
1522
- return new Array(n).fill(0).map(() => this.int(a, b));
1523
- }
1524
- static bools(n){
1525
- return new Array(n).fill(0).map(() => this.bool());
1526
- }
1527
- static bins(n) {
1528
- return new Array(n).fill(0).map(() => this.int(2));
1529
- }
1530
- static octs(n) {
1531
- return new Array(n).fill(0).map(() => this.int(8));
1532
- }
1533
- static decs(n) {
1534
- return new Array(n).fill(0).map(() => this.int(10));
1535
- }
1536
- static hexs(n) {
1537
- return new Array(n).fill(0).map(() => this.int(16));
1538
- }
1539
- static choices(n, choices, p) {
1540
- return new Array(n).fill(0).map(() => this.choice(choices, p));
1541
- }
1542
- static perm(...arr) {
1543
- // permutation
1544
- return arr.permS[this.int(arr.length)];
1545
- }
1546
- static color() {
1547
- return "#" + Base.dec2hex(this.float(16777216)).padStart(6,0);
1548
- }
1549
- static colors(n) {
1550
- return new Array(n).fill(null).map(()=>this.color());
1551
- }
1552
-
1553
- // Should be Moved to Matrix and Complex to avoid Circular dependencies
1554
- // static complex(a = [0,1], b = [0,1]) {
1555
- // return a instanceof Array?
1556
- // new Complex(
1557
- // this.float(a[0], a[1]),
1558
- // this.float(b[0], b[1])
1559
- // ):
1560
- // new Complex(
1561
- // ...this.floats(2,a,b)
1562
- // )
1563
-
1564
- // }
1565
- // static complexInt(a = [0,1], b = [0,1]) {
1566
- // return new Complex(
1567
- // this.int(a[0], a[1]),
1568
- // this.int(b[0], b[1])
1569
- // );
1570
- // }
1571
- // static complexBin() {
1572
- // return new Complex(...this.bins(2));
1573
- // }
1574
- // static complexOct() {
1575
- // return new Complex(...this.octs(2));
1576
- // }
1577
- // static complexDec() {
1578
- // return new Complex(...this.decs(10));
1579
- // }
1580
- // static complexHex() {
1581
- // return new Complex(...this.octs(2));
1582
- // }
1583
- // static complexes(n, a = 0, b = 1) {
1584
- // return new Array(n).fill(0).map(() => this.complex(a, b));
1585
- // }
1586
- // static complexesInt(n, a = 0, b = 1) {
1587
- // return new Array(n).fill(0).map(() => this.complexInt(a, b));
1588
- // }
1589
- // static complexesBin(n) {
1590
- // return new Array(n).fill(0).map(() => this.complexBin());
1591
- // }
1592
- // static complexesOct(n) {
1593
- // return new Array(n).fill(0).map(() => this.complexOct());
1594
- // }
1595
- // static complexesDec(n) {
1596
- // return new Array(n).fill(0).map(() => this.complexDec());
1597
- // }
1598
- // static complexesHex(n) {
1599
- // return new Array(n).fill(0).map(() => this.complexHex());
1600
- // }
1601
- // static matrix(r,c,min,max){
1602
- // return matrix(r,c,this.floats(r*c,min,max))
1603
- // }
1604
- // static matrixInt(r,c,min,max){
1605
- // return matrix(r,c,this.ints(r*c,min,max))
1606
- // }
1607
- // static matrixBin(r,c){
1608
- // return matrix(r,c,this.bins(r*c))
1609
- // }
1610
- // static matrixOct(r,c){
1611
- // return matrix(r,c,this.octs(r*c))
1612
- // }
1613
- // static matrixDec(r,c){
1614
- // return matrix(r,c,this.decs(r*c))
1615
- // }
1616
- // static matrixHex(r,c){
1617
- // return matrix(r,c,this.hex(r*c))
1618
- // }
1619
- // static matrixColor(r,c){
1620
- // return matrix(r,c,this.colors(r*c))
1621
- // }
1622
- // static matrixComplex(r,c,a,b){
1623
- // return matrix(r,c,this.complexes(r*c,a,b))
1624
- // }
1625
- // static matrixComplexInt(r,c,a,b){
1626
- // return matrix(r,c,this.complexesInt(r*c,a,b))
1627
- // }
1628
- // static matrixComplexBin(r,c){
1629
- // return matrix(r,c,this.complexesBin(r*c))
1630
- // }
1631
- // static matrixComplexOct(r,c){
1632
- // return matrix(r,c,this.complexesBin(r*c))
1633
- // }
1634
- // static matrixComplexDec(r,c){
1635
- // return matrix(r,c,this.complexesBin(r*c))
1636
- // }
1637
- // static matrixComplexHex(r,c){
1638
- // return matrix(r,c,this.complexesBin(r*c))
1639
- // }
1640
- }
1641
-
1642
1132
  class UseIPC {
1643
1133
  #channel;
1644
1134
  #eventData;
@@ -1650,7 +1140,7 @@ class UseIPC {
1650
1140
  this.#channel = new BroadcastChannel(name);
1651
1141
  this.#eventData = new Map();
1652
1142
  this.#handlers = new Map(); // Map<event, Array<{fn, rooms}>>
1653
- this.#uuid = "ziko-channel:" + Random.string(10);
1143
+ this.#uuid = "ziko-channel:" + (Math.random()*10e16); // To Be Replaced by UUID
1654
1144
  this.#subscribers = new Set([this.#uuid]);
1655
1145
  this.#currentRooms = new Set();
1656
1146
  this.#channel.addEventListener("message", (e) => {
@@ -1834,21 +1324,188 @@ var __State__ = {
1834
1324
  }
1835
1325
  },
1836
1326
 
1837
- };
1838
-
1839
- function __init__global__(){
1840
- if ( !globalThis?.__Ziko__ ){
1841
- globalThis.__Ziko__ = {
1842
- __UI__,
1843
- __HYDRATION__,
1844
- __State__,
1845
- __Config__,
1846
- __CACHE__,
1847
- };
1848
- defineParamsGetter$1(__Ziko__);
1327
+ };
1328
+
1329
+ function __init__global__(){
1330
+ if ( !globalThis?.__Ziko__ ){
1331
+ globalThis.__Ziko__ = {
1332
+ __UI__,
1333
+ __HYDRATION__,
1334
+ __State__,
1335
+ __Config__,
1336
+ __CACHE__,
1337
+ };
1338
+ defineParamsGetter$1(__Ziko__);
1339
+ }
1340
+ }
1341
+
1342
+ __init__global__();
1343
+ class UIElementCore extends UINode{
1344
+ constructor(){
1345
+ super();
1346
+ }
1347
+ init(element, name, type, render){
1348
+ this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
1349
+ if(typeof element === "string") {
1350
+ switch(type){
1351
+ case "html" : {
1352
+ element = globalThis?.document?.createElement(element);
1353
+ // console.log('1')
1354
+ } break;
1355
+ case "svg" : {
1356
+ element = globalThis?.document?.createElementNS("http://www.w3.org/2000/svg", element);
1357
+ // console.log('2')
1358
+ } break;
1359
+ default : throw Error("Not supported")
1360
+ }
1361
+ }
1362
+ else this.target = element?.parentElement;
1363
+ Object.assign(this.cache, {
1364
+ name,
1365
+ isInteractive : false,
1366
+ parent:null,
1367
+ isBody:false,
1368
+ isRoot:false,
1369
+ isHidden: false,
1370
+ isFrozzen:false,
1371
+ legacyParent : null,
1372
+ attributes: {},
1373
+ filters: {},
1374
+ temp:{}
1375
+ });
1376
+ this.events = {
1377
+ ptr:null,
1378
+ mouse:null,
1379
+ wheel:null,
1380
+ key:null,
1381
+ drag:null,
1382
+ drop:null,
1383
+ click:null,
1384
+ clipboard:null,
1385
+ focus:null,
1386
+ swipe:null,
1387
+ custom:null,
1388
+ };
1389
+ this.observer={
1390
+ resize:null,
1391
+ intersection:null
1392
+ };
1393
+ if(element) Object.assign(this.cache,{element});
1394
+ // useDefaultStyle && this.style({
1395
+ // position: "relative",
1396
+ // boxSizing:"border-box",
1397
+ // margin:0,
1398
+ // padding:0,
1399
+ // width : "auto",
1400
+ // height : "auto"
1401
+ // });
1402
+ this.items = new UIStore();
1403
+ globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
1404
+ element && render && this?.render?.();
1405
+ globalThis.__Ziko__.__UI__.push(this);
1406
+ }
1407
+ get element(){
1408
+ return this.cache.element;
1409
+ }
1410
+ [Symbol.iterator]() {
1411
+ return this.items[Symbol.iterator]();
1412
+ }
1413
+ maintain() {
1414
+ for (let i = 0; i < this.items.length; i++) {
1415
+ Object.defineProperty(this, i, {
1416
+ value: this.items[i],
1417
+ writable: true,
1418
+ configurable: true,
1419
+ enumerable: false
1420
+ });
1421
+ }
1422
+ }
1423
+ isInteractive(){
1424
+ return this.cache.isInteractive;
1425
+ }
1426
+ isUIElement(){
1427
+ return true;
1428
+ }
1429
+ }
1430
+
1431
+ function register_to_class(target, ...mixins){
1432
+ mixins.forEach(n => _register_to_class_(target, n));
1433
+ }
1434
+ function _register_to_class_(target, mixin) {
1435
+ const descriptors = Object.getOwnPropertyDescriptors(mixin);
1436
+ for (const key of Reflect.ownKeys(descriptors)) {
1437
+ const desc = descriptors[key];
1438
+ if ('get' in desc || 'set' in desc || typeof desc.value !== 'function') {
1439
+ Object.defineProperty(Object.getPrototypeOf(target), key, desc);
1440
+ } else if (typeof desc.value === 'function') {
1441
+ if (!Object.getPrototypeOf(target).hasOwnProperty(key)) {
1442
+ Object.defineProperty(Object.getPrototypeOf(target), key, desc);
1443
+ }
1444
+ }
1445
+ }
1446
+ }
1447
+
1448
+ // export function mount(target = this.target) {
1449
+ // if(this.isBody) return ;
1450
+ // if(target?.isUIElement)target=target.element;
1451
+ // this.target=target;
1452
+ // this.target?.appendChild(this.element);
1453
+ // return this;
1454
+ // }
1455
+ // export function unmount(){
1456
+ // if(this.cache.parent)this.cache.parent.remove(this);
1457
+ // else if(this.target?.children?.length && [...this.target?.children].includes(this.element)) this.target.removeChild(this.element);
1458
+ // return this;
1459
+ // }
1460
+
1461
+ // export function mountAfter(target = this.target, t = 1) {
1462
+ // setTimeout(() => this.mount(), t);
1463
+ // return this;
1464
+ // }
1465
+ // export function unmountAfter(t = 1) {
1466
+ // setTimeout(() => this.unmount(), t);
1467
+ // return this;
1468
+ // }
1469
+
1470
+ function mount(target = this.target, delay = 0) {
1471
+ if (delay > 0) {
1472
+ setTimeout(() => this.mount(target, 0), delay);
1473
+ return this;
1474
+ }
1475
+
1476
+ if (this.isBody) return this;
1477
+
1478
+ if (target?.isUIElement) target = target.element;
1479
+ this.target = target;
1480
+
1481
+ this.target?.appendChild(this.element);
1482
+ return this;
1483
+ }
1484
+
1485
+ function unmount(delay = 0) {
1486
+ if (delay > 0) {
1487
+ setTimeout(() => this.unmount(0), delay);
1488
+ return this;
1489
+ }
1490
+
1491
+ if (this.cache.parent) {
1492
+ this.cache.parent.remove(this);
1493
+ } else if (
1494
+ this.target?.children?.length &&
1495
+ [...this.target.children].includes(this.element)
1496
+ ) {
1497
+ this.target.removeChild(this.element);
1849
1498
  }
1499
+
1500
+ return this;
1850
1501
  }
1851
1502
 
1503
+ var LifecycleMethods = /*#__PURE__*/Object.freeze({
1504
+ __proto__: null,
1505
+ mount: mount,
1506
+ unmount: unmount
1507
+ });
1508
+
1852
1509
  if(!globalThis.__Ziko__) __init__global__();
1853
1510
 
1854
1511
  function useState(initialValue) {
@@ -2845,6 +2502,14 @@ var StyleMethods = /*#__PURE__*/Object.freeze({
2845
2502
  style: style
2846
2503
  });
2847
2504
 
2505
+ // import {
2506
+ // // useCustomEvent,
2507
+ // // useSwipeEvent,
2508
+ // // watchIntersection,
2509
+ // // watchSize,
2510
+ // // watchAttr,
2511
+ // // watchChildren
2512
+ // } from "../../--reactivity-deprecated/events/custom-event.js"
2848
2513
  let UIElement$1 = class UIElement extends UIElementCore{
2849
2514
  constructor({element, name ='', type='html', render = __Ziko__.__Config__.default.render}={}){
2850
2515
  super();
@@ -4071,213 +3736,591 @@ class Matrix{
4071
3736
  filterByCols(item){
4072
3737
  return new Matrix(this.T.arr.filter(n=>n.includes(item)))
4073
3738
  }
4074
- sortAll(calback=undefined){
4075
- let newArr=this.arr.flat(1).sort(calback);
4076
- return new Matrix(this.rows, this.cols, newArr);
3739
+ sortAll(calback=undefined){
3740
+ let newArr=this.arr.flat(1).sort(calback);
3741
+ return new Matrix(this.rows, this.cols, newArr);
3742
+ }
3743
+ count(n) {
3744
+ return this.arr.flat(1).count(n);
3745
+ }
3746
+ // toBase(n) {
3747
+ // let newArr = this.arr.flat(1).toBase(n);
3748
+ // return new Matrix(this.rows, this.cols, newArr);
3749
+ // }
3750
+
3751
+ splice(r0,c0,deleteCount,...items){
3752
+
3753
+ }
3754
+ getRows(ri, rf = ri + 1) {
3755
+ return this.slice(ri, 0, rf, this.cols);
3756
+ }
3757
+ getCols(ci, cf = ci + 1) {
3758
+ return this.slice(0, ci, this.rows, cf);
3759
+ }
3760
+ static getRows(m, ri, rf = ri + 1) {
3761
+ return m.slice(ri, 0, rf, m.cols);
3762
+ }
3763
+ static getCols(m, ci, cf = ci + 1) {
3764
+ return m.slice(0, ci, m.rows, cf);
3765
+ }
3766
+ add(...matr) {
3767
+ for (let k = 0; k < matr.length; k++) {
3768
+ if (typeof matr[k] == "number"||matr[k] instanceof Complex) matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
3769
+ for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = add(this.arr[i][j],matr[k].arr[i][j]);
3770
+ }
3771
+ return new Matrix(this.rows, this.cols, this.arr.flat(1));
3772
+ }
3773
+ sub(...matr) {
3774
+ for (let k = 0; k < matr.length; k++) {
3775
+ if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
3776
+ for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = sub(this.arr[i][j],matr[k].arr[i][j]);
3777
+ }
3778
+ return new Matrix(this.rows, this.cols, this.arr.flat(1));
3779
+ }
3780
+ static add(m1, ...m2) {
3781
+ return m1.clone().add(...m2);
3782
+ }
3783
+ static sub(m1, ...m2) {
3784
+ return m1.clone().sub(...m2);
3785
+ }
3786
+ mul(...matr) {
3787
+ for (let k = 0; k < matr.length; k++) {
3788
+ if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
3789
+ for (var i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = mul(this.arr[i][j],matr[k].arr[i][j]);
3790
+ }
3791
+ return new Matrix(this.rows, this.cols, this.arr.flat(1));
3792
+ }
3793
+ div(...matr) {
3794
+ for (let k = 0; k < matr.length; k++) {
3795
+ if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
3796
+ for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = div(this.arr[i][j],matr[k].arr[i][j]);
3797
+ }
3798
+ return new Matrix(this.rows, this.cols, this.arr.flat(1));
3799
+ }
3800
+ static div(m1, ...m2) {
3801
+ return m1.clone().div(...m2);
3802
+ }
3803
+ static mul(m1, ...m2) {
3804
+ return m1.clone().mul(...m2);
3805
+ }
3806
+ modulo(...matr) {
3807
+ for (let k = 0; k < matr.length; k++) {
3808
+ if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
3809
+ for (let i = 0; i < this.rows; i++)
3810
+ for (var j = 0; j < this.cols; j++)
3811
+ this.arr[i][j]=modulo(this.arr[i][j],matr[k].arr[i][j]);
3812
+ }
3813
+ return new Matrix(this.rows, this.cols, this.arr.flat(1));
3814
+ }
3815
+ static modulo(m1, ...m2) {
3816
+ return m1.clone().modulo(...m2);
3817
+ }
3818
+ dot(matrix) {
3819
+ var res = [];
3820
+ for (var i = 0; i < this.arr.length; i++) {
3821
+ res[i] = [];
3822
+ for (var j = 0; j < matrix.arr[0].length; j++) {
3823
+ res[i][j] = 0;
3824
+ for (var k = 0; k < this.arr[0].length; k++) {
3825
+ res[i][j] = add(
3826
+ res[i][j],
3827
+ mul(this.arr[i][k],matrix.arr[k][j])
3828
+ );
3829
+ }
3830
+ }
3831
+ }
3832
+ return new Matrix(this.arr.length, matrix.arr[0].length, res.flat(1));
3833
+ }
3834
+ static dot(matrix1, matrix2) {
3835
+ return matrix1.dot(matrix2);
3836
+ }
3837
+ pow(n) {
3838
+ let a = this.clone(),
3839
+ p = this.clone();
3840
+ for (let i = 0; i < n - 1; i++) p = p.dot(a);
3841
+ return p;
3842
+ }
3843
+ static pow(m, n) {
3844
+ return m.clone().pow(n);
3845
+ }
3846
+ get somme() {
3847
+ let S = 0;
3848
+ for (let i = 0; i < this.rows; i++) for (let j = 0; j < this.cols; j++) S += this.arr[i][j];
3849
+ return S;
3850
+ }
3851
+ get hasComplex() {
3852
+ return this.arr.flat(Infinity).some((n) => n instanceof Complex);
3853
+ }
3854
+ get min() {
3855
+ if (this.hasComplex) console.error("Complex numbers are not comparable");
3856
+ let minRow = [];
3857
+ for (let i = 0; i < this.rows; i++) minRow.push(min(...this.arr[i]));
3858
+ return min(...minRow);
3859
+ }
3860
+ get max() {
3861
+ if (this.hasComplex) console.error("Complex numbers are not comparable");
3862
+ let maxRow = [];
3863
+ for (let i = 0; i < this.rows; i++) maxRow.push(max(...this.arr[i]));
3864
+ return max(...maxRow);
3865
+ }
3866
+ get minRows() {
3867
+ if (this.hasComplex) console.error("Complex numbers are not comparable");
3868
+ let minRow = [];
3869
+ for (let i = 0; i < this.rows; i++) minRow.push(min(...this.arr[i]));
3870
+ return minRow;
3871
+ }
3872
+ get maxRows() {
3873
+ if (this.hasComplex) console.error("Complex numbers are not comparable");
3874
+ let maxRow = [];
3875
+ for (let i = 0; i < this.rows; i++) maxRow.push(max(...this.arr[i]));
3876
+ return maxRow;
3877
+ }
3878
+ get minCols() {
3879
+ if (this.hasComplex) console.error("Complex numbers are not comparable");
3880
+ return this.T.minRows;
3881
+ }
3882
+ get maxCols() {
3883
+ if (this.hasComplex) console.error("Complex numbers are not comparable");
3884
+ return this.T.maxRows;
3885
+ }
3886
+ static fromVector(v) {
3887
+ return new Matrix(v.length, 1, v);
3888
+ }
3889
+ get toArray() {
3890
+ let arr = [];
3891
+ for (let i = 0; i < this.rows; i++) {
3892
+ for (let j = 0; j < this.cols; j++) {
3893
+ arr.push(this.arr[i][j]);
3894
+ }
3895
+ }
3896
+ return arr;
3897
+ }
3898
+ get serialize() {
3899
+ return JSON.stringify(this);
3900
+ }
3901
+ static deserialize(data) {
3902
+ if (typeof data == "string") data = JSON.parse(data);
3903
+ let matrix = new Matrix(data.rows, data.cols);
3904
+ matrix.arr = data.arr;
3905
+ return matrix;
3906
+ }
3907
+ sortTable(n=0,{type="num",order="asc"}={}) {
3908
+ var obj=this.T.arr.map(n=>n.map((n,i)=>Object.assign({},{x:n,y:i})));
3909
+ var newObj=this.T.arr.map(n=>n.map((n,i)=>Object.assign({},{x:n,y:i})));
3910
+ if(type==="num"){
3911
+ if(order==="asc")obj[n].sort((a,b)=>a.x-b.x);
3912
+ else if(order==="desc")obj[n].sort((a,b)=>b.x-a.x);
3913
+ else if(order==="toggle"){
3914
+ // console.log(obj[n][0])
3915
+ //console.log(obj[n][1])
3916
+ if(obj[n][0].x>obj[n][1].x)obj[n].sort((a,b)=>b.x-a.x);
3917
+ else obj[n].sort((a,b)=>a.x-b.x);
3918
+ }
3919
+ }
3920
+ else if(type==="alpha"){
3921
+ if(order==="asc")obj[n].sort((a,b)=>(""+a.x).localeCompare(""+b.x));
3922
+ else if(order==="desc")obj[n].sort((a,b)=>(""+b.x).localeCompare(""+a.x));
3923
+ }
3924
+ //var order=obj[n].map(n=>n.y);
3925
+ order=obj[n].map(n=>n.y);
3926
+ for(let i=0;i<obj.length;i++){
3927
+ if(i!==n)obj[i].map((n,j)=>n.y=order[j]);
3928
+ }
3929
+ for(let i=0;i<obj.length;i++){
3930
+ if(i!==n)newObj[i].map((n,j)=>n.x=obj[i][order[j]].x);
3931
+ }
3932
+ newObj[n]=obj[n];
3933
+ var newArr=newObj.map(n=>n.map(m=>m.x));
3934
+ return new Matrix(newArr).T;
3935
+ }
3936
+ }
3937
+
3938
+
3939
+ /**
3940
+ * @returns {Matrix}
3941
+ */
3942
+ const matrix=(r, c, element)=>new Matrix(r, c, element);
3943
+ const matrix2=(...element)=>new Matrix(2, 2, element);
3944
+ const matrix3=(...element)=>new Matrix(3, 3, element);
3945
+ const matrix4=(...element)=>new Matrix(4, 4, element);
3946
+
3947
+ const powerSet=originalSet=>{
3948
+ const subSets = [];
3949
+ const NUMBER_OF_COMBINATIONS = 2 ** originalSet.length;
3950
+ for (let i = 0; i < NUMBER_OF_COMBINATIONS; i += 1) {
3951
+ const subSet = [];
3952
+ for (let j = 0; j < originalSet.length; j += 1) {
3953
+ if (i & (1 << j)) {
3954
+ subSet.push(originalSet[j]);
3955
+ }
3956
+ }
3957
+ subSets.push(subSet);
3958
+ }
3959
+ return subSets;
3960
+ };
3961
+
3962
+ // const subSet = (...arr) => {
3963
+ // let list = arange(0, 2 ** arr.length, 1);
3964
+ // let bin = list.map((n) => n.toString(2).padStart(arr.length, '0')).map((n) => n.split("").map((n) => +n));
3965
+ // let sub = bin.map((n) => n.map((m, i) => (m === 1 ? arr[i] : null))).map((n) => n.filter((x) => x !== null));
3966
+ // return sub;
3967
+ // };
3968
+ const subSet = null;
3969
+
3970
+ const Base={
3971
+ _mode:Number,
3972
+ _map:function(func,number,toBase){
3973
+ if (number instanceof Matrix)
3974
+ return new Matrix(
3975
+ number.rows,
3976
+ number.cols,
3977
+ number.arr.flat(1).map(n=>func(n,toBase))
3978
+ );
3979
+ else if (number instanceof Complex) return new Complex(func(number.a,toBase),func(number.b,toBase));
3980
+ else if (number instanceof Array) return number.map((n) =>func(n,toBase));
3981
+ },
3982
+ dec2base(dec,base){
3983
+ base<=10?this._mode=Number:this._mode=String;
3984
+ //this._mode=String
3985
+ if (typeof dec === "number") return this._mode((dec >>> 0).toString(base));
3986
+ return this._map(this.dec2base,dec,base)
3987
+ },
3988
+ dec2bin(dec){
3989
+ return this.dec2base(dec,2);
3990
+ },
3991
+ dec2oct(dec){
3992
+ return this.dec2base(dec,8);
3993
+ },
3994
+ dec2hex(dec){
3995
+ return this.dec2base(dec,16);
3996
+ },
3997
+ bin2base(bin, base) {
3998
+ return this.dec2base(this.bin2dec(bin),base)
3999
+ },
4000
+ bin2dec(bin){
4001
+ return this._mode("0b"+bin);
4002
+ },
4003
+ bin2oct(bin){
4004
+ return this.bin2base(bin,8);
4005
+ },
4006
+ bin2hex(bin){
4007
+ return this.bin2base(bin,16);
4008
+ },
4009
+ oct2dec(oct){
4010
+ return this._mode("0o"+oct);
4011
+ },
4012
+ oct2bin(oct){
4013
+ return this.dec2bin(this.oct2dec(oct))
4014
+ },
4015
+ oct2hex(oct){
4016
+ return this.dec2hex(this.oct2dec(oct))
4017
+ },
4018
+ oct2base(oct, base) {
4019
+ return this.dec2base(this.oct2dec(oct),base)
4020
+ },
4021
+ hex2dec(hex){
4022
+ return this._mode("0x"+hex);
4023
+ },
4024
+ hex2bin(hex){
4025
+ return this.dec2bin(this.hex2dec(hex))
4026
+ },
4027
+ hex2oct(hex){
4028
+ return this.dec2oct(this.hex2dec(hex))
4029
+ },
4030
+ hex2base(hex, base) {
4031
+ return this.dec2base(this.hex2dec(hex),base)
4032
+ },
4033
+ IEEE32toDec(Bin){
4034
+ let IEEE32=Bin.split(" ").join("").padEnd(32,"0");
4035
+ let s=IEEE32[0];
4036
+ let e=2**(+("0b"+IEEE32.slice(1,9))-127);
4037
+ let m=IEEE32.slice(9,32).split("").map(n=>+n);
4038
+ let M=m.map((n,i)=>n*(2**(-i-1))).reduce((a,b)=>a+b,0);
4039
+ let dec=(-1)**s*(1+M)*e;
4040
+ return dec
4041
+ },
4042
+ IEEE64toDec(Bin){
4043
+ let IEEE64=Bin.split(" ").join("").padEnd(64,"0");
4044
+ let s=IEEE64[0];
4045
+ let e=2**(+("0b"+IEEE64.slice(1,12))-1023);
4046
+ let m=IEEE64.slice(13,64).split("").map(n=>+n);
4047
+ let M=m.map((n,i)=>n*(2**(-i-1))).reduce((a,b)=>a+b,0);
4048
+ let dec=(-1)**s*(1+M)*e;
4049
+ return dec;
4077
4050
  }
4078
- count(n) {
4079
- return this.arr.flat(1).count(n);
4051
+ };
4052
+
4053
+ const Logic$1={
4054
+ _mode:Number,
4055
+ _map:function(func,a,b){
4056
+ if (a instanceof Matrix)
4057
+ return new Matrix(
4058
+ a.rows,
4059
+ a.cols,
4060
+ a.arr.flat(1).map((n) => func(n, b))
4061
+ );
4062
+ else if (a instanceof Complex) return new Complex(func(a.a, b), func(a.b, b));
4063
+ else if (a instanceof Array) return a.map((n) => func(n, b));
4064
+ },
4065
+ not:function(input){
4066
+ if(["number","boolean"].includes(typeof input)) return Logic$1._mode(!input);
4067
+ else return this._map(this.not,input)
4068
+ },
4069
+ and:function(a, ...b){
4070
+ if(["number","boolean"].includes(typeof a))return Logic$1._mode(b.reduce((n, m) => (n &= m), a));
4071
+ else return this._map(this.and,a,b)
4072
+ },
4073
+ or:function(a, ...b) {
4074
+ if(["number","boolean"].includes(typeof a)) return Logic$1._mode(b.reduce((n, m) => (n |= m), a));
4075
+ else return this._map(this.or,a,b);
4076
+ },
4077
+ nand:function(a, ...b) {
4078
+ return this.not(this.and(a, b));
4079
+ },
4080
+ nor:function(a, ...b) {
4081
+ return this.not(this.or(a, b));
4082
+ },
4083
+ xor:function(a,...b){
4084
+ let arr=[a,...b];
4085
+ if(["number","boolean"].includes(typeof a))return this._mode(arr.reduce((length,cur)=>{
4086
+ if(+cur===1)length+=1;
4087
+ return length;
4088
+ },0)===1);
4089
+ else return this._map(this.xor,a,b);
4090
+ },
4091
+ xnor:function(a,...b){
4092
+ return Logic$1.not(Logic$1.xor(a,b))
4080
4093
  }
4081
- // toBase(n) {
4082
- // let newArr = this.arr.flat(1).toBase(n);
4083
- // return new Matrix(this.rows, this.cols, newArr);
4084
- // }
4085
4094
 
4086
- splice(r0,c0,deleteCount,...items){
4087
-
4088
- }
4089
- getRows(ri, rf = ri + 1) {
4090
- return this.slice(ri, 0, rf, this.cols);
4091
- }
4092
- getCols(ci, cf = ci + 1) {
4093
- return this.slice(0, ci, this.rows, cf);
4094
- }
4095
- static getRows(m, ri, rf = ri + 1) {
4096
- return m.slice(ri, 0, rf, m.cols);
4097
- }
4098
- static getCols(m, ci, cf = ci + 1) {
4099
- return m.slice(0, ci, m.rows, cf);
4095
+ };
4096
+
4097
+ class Permutation {
4098
+ static withDiscount(arr, l = arr.length) {
4099
+ if (l === 1) return arr.map((n) => [n]);
4100
+ const permutations = [];
4101
+ let smallerPermutations;
4102
+ smallerPermutations = this.withDiscount(arr, l - 1);
4103
+ arr.forEach((currentOption) => {
4104
+ smallerPermutations.forEach((smallerPermutation) => {
4105
+ permutations.push([currentOption].concat(smallerPermutation));
4106
+ });
4107
+ });
4108
+ return permutations;
4100
4109
  }
4101
- add(...matr) {
4102
- for (let k = 0; k < matr.length; k++) {
4103
- if (typeof matr[k] == "number"||matr[k] instanceof Complex) matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
4104
- for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = add(this.arr[i][j],matr[k].arr[i][j]);
4110
+ static withoutDiscount(arr) {
4111
+ const l = arr.length;
4112
+ if (l === 1) return arr.map((n) => [n]);
4113
+ const permutations = [];
4114
+ const smallerPermutations = this.withoutDiscount(arr.slice(1));
4115
+ const firstOption = arr[0];
4116
+ for (let i = 0; i < smallerPermutations.length; i++) {
4117
+ const smallerPermutation = smallerPermutations[i];
4118
+ for (let j = 0; j <= smallerPermutation.length; j++) {
4119
+ const permutationPrefix = smallerPermutation.slice(0, j);
4120
+ const permutationSuffix = smallerPermutation.slice(j);
4121
+ permutations.push(permutationPrefix.concat([firstOption], permutationSuffix));
4122
+ }
4105
4123
  }
4106
- return new Matrix(this.rows, this.cols, this.arr.flat(1));
4124
+ return permutations;
4107
4125
  }
4108
- sub(...matr) {
4109
- for (let k = 0; k < matr.length; k++) {
4110
- if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
4111
- for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = sub(this.arr[i][j],matr[k].arr[i][j]);
4126
+ }
4127
+
4128
+ class Combinaison {
4129
+ static withDiscount(comboOptions, comboLength) {
4130
+ if (comboLength === 1) {
4131
+ return comboOptions.map((comboOption) => [comboOption]);
4112
4132
  }
4113
- return new Matrix(this.rows, this.cols, this.arr.flat(1));
4114
- }
4115
- static add(m1, ...m2) {
4116
- return m1.clone().add(...m2);
4117
- }
4118
- static sub(m1, ...m2) {
4119
- return m1.clone().sub(...m2);
4133
+ const combos = [];
4134
+ comboOptions.forEach((currentOption, optionIndex) => {
4135
+ const smallerCombos = this.withDiscount(comboOptions.slice(optionIndex), comboLength - 1);
4136
+ smallerCombos.forEach((smallerCombo) => {
4137
+ combos.push([currentOption].concat(smallerCombo));
4138
+ });
4139
+ });
4140
+ return combos;
4120
4141
  }
4121
- mul(...matr) {
4122
- for (let k = 0; k < matr.length; k++) {
4123
- if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
4124
- for (var i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = mul(this.arr[i][j],matr[k].arr[i][j]);
4142
+ static withoutDiscount(comboOptions, comboLength) {
4143
+ if (comboLength === 1) {
4144
+ return comboOptions.map((comboOption) => [comboOption]);
4125
4145
  }
4126
- return new Matrix(this.rows, this.cols, this.arr.flat(1));
4146
+ const combos = [];
4147
+ comboOptions.forEach((currentOption, optionIndex) => {
4148
+ const smallerCombos = this.withoutDiscount(comboOptions.slice(optionIndex + 1), comboLength - 1);
4149
+ smallerCombos.forEach((smallerCombo) => {
4150
+ combos.push([currentOption].concat(smallerCombo));
4151
+ });
4152
+ });
4153
+
4154
+ return combos;
4127
4155
  }
4128
- div(...matr) {
4129
- for (let k = 0; k < matr.length; k++) {
4130
- if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
4131
- for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = div(this.arr[i][j],matr[k].arr[i][j]);
4132
- }
4133
- return new Matrix(this.rows, this.cols, this.arr.flat(1));
4156
+ }
4157
+ const combinaison=(comboOptions, comboLength, discount=false)=>Combinaison[discount?"withDiscount":"withoutDiscount"](comboOptions, comboLength);
4158
+
4159
+ class Random {
4160
+ static float(a = 1, b) {
4161
+ return b ? Math.random() * (b - a) + a : a * Math.random();
4134
4162
  }
4135
- static div(m1, ...m2) {
4136
- return m1.clone().div(...m2);
4163
+ static int(a, b) {
4164
+ return Math.floor(this.float(a, b));
4137
4165
  }
4138
- static mul(m1, ...m2) {
4139
- return m1.clone().mul(...m2);
4166
+ static char(upperCase){
4167
+ upperCase=upperCase??this.bool();
4168
+ const Char=String.fromCharCode(this.int(97,120));
4169
+ return upperCase?Char.toUpperCase():Char;
4140
4170
  }
4141
- modulo(...matr) {
4142
- for (let k = 0; k < matr.length; k++) {
4143
- if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
4144
- for (let i = 0; i < this.rows; i++)
4145
- for (var j = 0; j < this.cols; j++)
4146
- this.arr[i][j]=modulo(this.arr[i][j],matr[k].arr[i][j]);
4147
- }
4148
- return new Matrix(this.rows, this.cols, this.arr.flat(1));
4171
+ static bool(){
4172
+ return [false,true][Math.floor(Math.random()*2)];
4149
4173
  }
4150
- static modulo(m1, ...m2) {
4151
- return m1.clone().modulo(...m2);
4174
+ static string(length,upperCase){
4175
+ return length instanceof Array?
4176
+ new Array(this.int(...length)).fill(0).map(() => this.char(upperCase)).join(""):
4177
+ new Array(length).fill(0).map(() => this.char(upperCase)).join("");
4152
4178
  }
4153
- dot(matrix) {
4154
- var res = [];
4155
- for (var i = 0; i < this.arr.length; i++) {
4156
- res[i] = [];
4157
- for (var j = 0; j < matrix.arr[0].length; j++) {
4158
- res[i][j] = 0;
4159
- for (var k = 0; k < this.arr[0].length; k++) {
4160
- res[i][j] = add(
4161
- res[i][j],
4162
- mul(this.arr[i][k],matrix.arr[k][j])
4163
- );
4164
- }
4165
- }
4166
- }
4167
- return new Matrix(this.arr.length, matrix.arr[0].length, res.flat(1));
4179
+ static bin() {
4180
+ return this.int(2);
4168
4181
  }
4169
- static dot(matrix1, matrix2) {
4170
- return matrix1.dot(matrix2);
4182
+ static oct() {
4183
+ return this.int(8);
4171
4184
  }
4172
- pow(n) {
4173
- let a = this.clone(),
4174
- p = this.clone();
4175
- for (let i = 0; i < n - 1; i++) p = p.dot(a);
4176
- return p;
4185
+ static dec() {
4186
+ return this.int(8);
4177
4187
  }
4178
- static pow(m, n) {
4179
- return m.clone().pow(n);
4188
+ static hex() {
4189
+ return this.int(16);
4180
4190
  }
4181
- get somme() {
4182
- let S = 0;
4183
- for (let i = 0; i < this.rows; i++) for (let j = 0; j < this.cols; j++) S += this.arr[i][j];
4184
- return S;
4191
+ static choice(choices = [1, 2, 3], p = new Array(choices.length).fill(1 / choices.length)) {
4192
+ let newchoice = new Array(100);
4193
+ p=Utils.accum(...p).map(n=>n*100);
4194
+ newchoice.fill(choices[0], 0, p[0]);
4195
+ for (let i = 1; i < choices.length; i++) newchoice.fill(choices[i], p[i - 1], p[i]);
4196
+ return newchoice[this.int(newchoice.length - 1)];
4185
4197
  }
4186
- get hasComplex() {
4187
- return this.arr.flat(Infinity).some((n) => n instanceof Complex);
4198
+ static shuffleArr(arr){
4199
+ return arr.sort(()=>0.5-Math.random())
4188
4200
  }
4189
- get min() {
4190
- if (this.hasComplex) console.error("Complex numbers are not comparable");
4191
- let minRow = [];
4192
- for (let i = 0; i < this.rows; i++) minRow.push(min(...this.arr[i]));
4193
- return min(...minRow);
4201
+ static floats(n, a, b) {
4202
+ return new Array(n).fill(0).map(() => this.float(a, b));
4194
4203
  }
4195
- get max() {
4196
- if (this.hasComplex) console.error("Complex numbers are not comparable");
4197
- let maxRow = [];
4198
- for (let i = 0; i < this.rows; i++) maxRow.push(max(...this.arr[i]));
4199
- return max(...maxRow);
4204
+ static ints(n, a, b) {
4205
+ return new Array(n).fill(0).map(() => this.int(a, b));
4200
4206
  }
4201
- get minRows() {
4202
- if (this.hasComplex) console.error("Complex numbers are not comparable");
4203
- let minRow = [];
4204
- for (let i = 0; i < this.rows; i++) minRow.push(min(...this.arr[i]));
4205
- return minRow;
4207
+ static bools(n){
4208
+ return new Array(n).fill(0).map(() => this.bool());
4206
4209
  }
4207
- get maxRows() {
4208
- if (this.hasComplex) console.error("Complex numbers are not comparable");
4209
- let maxRow = [];
4210
- for (let i = 0; i < this.rows; i++) maxRow.push(max(...this.arr[i]));
4211
- return maxRow;
4210
+ static bins(n) {
4211
+ return new Array(n).fill(0).map(() => this.int(2));
4212
4212
  }
4213
- get minCols() {
4214
- if (this.hasComplex) console.error("Complex numbers are not comparable");
4215
- return this.T.minRows;
4213
+ static octs(n) {
4214
+ return new Array(n).fill(0).map(() => this.int(8));
4216
4215
  }
4217
- get maxCols() {
4218
- if (this.hasComplex) console.error("Complex numbers are not comparable");
4219
- return this.T.maxRows;
4216
+ static decs(n) {
4217
+ return new Array(n).fill(0).map(() => this.int(10));
4220
4218
  }
4221
- static fromVector(v) {
4222
- return new Matrix(v.length, 1, v);
4219
+ static hexs(n) {
4220
+ return new Array(n).fill(0).map(() => this.int(16));
4223
4221
  }
4224
- get toArray() {
4225
- let arr = [];
4226
- for (let i = 0; i < this.rows; i++) {
4227
- for (let j = 0; j < this.cols; j++) {
4228
- arr.push(this.arr[i][j]);
4229
- }
4230
- }
4231
- return arr;
4222
+ static choices(n, choices, p) {
4223
+ return new Array(n).fill(0).map(() => this.choice(choices, p));
4232
4224
  }
4233
- get serialize() {
4234
- return JSON.stringify(this);
4225
+ static perm(...arr) {
4226
+ // permutation
4227
+ return arr.permS[this.int(arr.length)];
4235
4228
  }
4236
- static deserialize(data) {
4237
- if (typeof data == "string") data = JSON.parse(data);
4238
- let matrix = new Matrix(data.rows, data.cols);
4239
- matrix.arr = data.arr;
4240
- return matrix;
4229
+ static color() {
4230
+ return "#" + Base.dec2hex(this.float(16777216)).padStart(6,0);
4241
4231
  }
4242
- sortTable(n=0,{type="num",order="asc"}={}) {
4243
- var obj=this.T.arr.map(n=>n.map((n,i)=>Object.assign({},{x:n,y:i})));
4244
- var newObj=this.T.arr.map(n=>n.map((n,i)=>Object.assign({},{x:n,y:i})));
4245
- if(type==="num"){
4246
- if(order==="asc")obj[n].sort((a,b)=>a.x-b.x);
4247
- else if(order==="desc")obj[n].sort((a,b)=>b.x-a.x);
4248
- else if(order==="toggle"){
4249
- // console.log(obj[n][0])
4250
- //console.log(obj[n][1])
4251
- if(obj[n][0].x>obj[n][1].x)obj[n].sort((a,b)=>b.x-a.x);
4252
- else obj[n].sort((a,b)=>a.x-b.x);
4253
- }
4254
- }
4255
- else if(type==="alpha"){
4256
- if(order==="asc")obj[n].sort((a,b)=>(""+a.x).localeCompare(""+b.x));
4257
- else if(order==="desc")obj[n].sort((a,b)=>(""+b.x).localeCompare(""+a.x));
4258
- }
4259
- //var order=obj[n].map(n=>n.y);
4260
- order=obj[n].map(n=>n.y);
4261
- for(let i=0;i<obj.length;i++){
4262
- if(i!==n)obj[i].map((n,j)=>n.y=order[j]);
4263
- }
4264
- for(let i=0;i<obj.length;i++){
4265
- if(i!==n)newObj[i].map((n,j)=>n.x=obj[i][order[j]].x);
4266
- }
4267
- newObj[n]=obj[n];
4268
- var newArr=newObj.map(n=>n.map(m=>m.x));
4269
- return new Matrix(newArr).T;
4232
+ static colors(n) {
4233
+ return new Array(n).fill(null).map(()=>this.color());
4270
4234
  }
4271
- }
4272
4235
 
4273
-
4274
- /**
4275
- * @returns {Matrix}
4276
- */
4277
- const matrix=(r, c, element)=>new Matrix(r, c, element);
4278
- const matrix2=(...element)=>new Matrix(2, 2, element);
4279
- const matrix3=(...element)=>new Matrix(3, 3, element);
4280
- const matrix4=(...element)=>new Matrix(4, 4, element);
4236
+ // Should be Moved to Matrix and Complex to avoid Circular dependencies
4237
+ // static complex(a = [0,1], b = [0,1]) {
4238
+ // return a instanceof Array?
4239
+ // new Complex(
4240
+ // this.float(a[0], a[1]),
4241
+ // this.float(b[0], b[1])
4242
+ // ):
4243
+ // new Complex(
4244
+ // ...this.floats(2,a,b)
4245
+ // )
4246
+
4247
+ // }
4248
+ // static complexInt(a = [0,1], b = [0,1]) {
4249
+ // return new Complex(
4250
+ // this.int(a[0], a[1]),
4251
+ // this.int(b[0], b[1])
4252
+ // );
4253
+ // }
4254
+ // static complexBin() {
4255
+ // return new Complex(...this.bins(2));
4256
+ // }
4257
+ // static complexOct() {
4258
+ // return new Complex(...this.octs(2));
4259
+ // }
4260
+ // static complexDec() {
4261
+ // return new Complex(...this.decs(10));
4262
+ // }
4263
+ // static complexHex() {
4264
+ // return new Complex(...this.octs(2));
4265
+ // }
4266
+ // static complexes(n, a = 0, b = 1) {
4267
+ // return new Array(n).fill(0).map(() => this.complex(a, b));
4268
+ // }
4269
+ // static complexesInt(n, a = 0, b = 1) {
4270
+ // return new Array(n).fill(0).map(() => this.complexInt(a, b));
4271
+ // }
4272
+ // static complexesBin(n) {
4273
+ // return new Array(n).fill(0).map(() => this.complexBin());
4274
+ // }
4275
+ // static complexesOct(n) {
4276
+ // return new Array(n).fill(0).map(() => this.complexOct());
4277
+ // }
4278
+ // static complexesDec(n) {
4279
+ // return new Array(n).fill(0).map(() => this.complexDec());
4280
+ // }
4281
+ // static complexesHex(n) {
4282
+ // return new Array(n).fill(0).map(() => this.complexHex());
4283
+ // }
4284
+ // static matrix(r,c,min,max){
4285
+ // return matrix(r,c,this.floats(r*c,min,max))
4286
+ // }
4287
+ // static matrixInt(r,c,min,max){
4288
+ // return matrix(r,c,this.ints(r*c,min,max))
4289
+ // }
4290
+ // static matrixBin(r,c){
4291
+ // return matrix(r,c,this.bins(r*c))
4292
+ // }
4293
+ // static matrixOct(r,c){
4294
+ // return matrix(r,c,this.octs(r*c))
4295
+ // }
4296
+ // static matrixDec(r,c){
4297
+ // return matrix(r,c,this.decs(r*c))
4298
+ // }
4299
+ // static matrixHex(r,c){
4300
+ // return matrix(r,c,this.hex(r*c))
4301
+ // }
4302
+ // static matrixColor(r,c){
4303
+ // return matrix(r,c,this.colors(r*c))
4304
+ // }
4305
+ // static matrixComplex(r,c,a,b){
4306
+ // return matrix(r,c,this.complexes(r*c,a,b))
4307
+ // }
4308
+ // static matrixComplexInt(r,c,a,b){
4309
+ // return matrix(r,c,this.complexesInt(r*c,a,b))
4310
+ // }
4311
+ // static matrixComplexBin(r,c){
4312
+ // return matrix(r,c,this.complexesBin(r*c))
4313
+ // }
4314
+ // static matrixComplexOct(r,c){
4315
+ // return matrix(r,c,this.complexesBin(r*c))
4316
+ // }
4317
+ // static matrixComplexDec(r,c){
4318
+ // return matrix(r,c,this.complexesBin(r*c))
4319
+ // }
4320
+ // static matrixComplexHex(r,c){
4321
+ // return matrix(r,c,this.complexesBin(r*c))
4322
+ // }
4323
+ }
4281
4324
 
4282
4325
  const { PI, sqrt: sqrt$1, cos: cos$1, sin: sin$1, acos, pow } = Math;
4283
4326