@fangzhongya/utils 0.0.66 → 0.0.68

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.
Files changed (71) hide show
  1. package/dist/basic/index.cjs +9 -9
  2. package/dist/basic/index.js +8 -8
  3. package/dist/basic/object/index.cjs +7 -7
  4. package/dist/basic/object/index.js +7 -7
  5. package/dist/basic/string/index.cjs +7 -7
  6. package/dist/basic/string/index.js +10 -10
  7. package/dist/{chunk-5WQXANBO.js → chunk-2AZDXCHJ.js} +23 -7
  8. package/dist/{chunk-HPVRBKIG.js → chunk-2HNOVV5L.js} +6 -4
  9. package/dist/chunk-2HQDHQFP.cjs +299 -0
  10. package/dist/chunk-73XBF3JW.cjs +67 -0
  11. package/dist/{chunk-6MSVNVC2.js → chunk-BQZX7DEK.js} +2 -2
  12. package/dist/{chunk-UHKL2RG3.cjs → chunk-FL2HPQ66.cjs} +5 -5
  13. package/dist/{chunk-THCKSUIJ.cjs → chunk-IBSTABZR.cjs} +4 -4
  14. package/dist/chunk-LJVOVGGV.js +299 -0
  15. package/dist/{chunk-E74ZD4NG.cjs → chunk-MDSCUXDF.cjs} +20 -4
  16. package/dist/chunk-NXHTACGW.js +67 -0
  17. package/dist/{chunk-2IWTROKK.cjs → chunk-UORFWPAM.cjs} +7 -5
  18. package/dist/{chunk-YKNGDK4I.js → chunk-X44UO4CZ.js} +4 -4
  19. package/dist/css/getSVG.cjs +5 -2
  20. package/dist/css/getSVG.d.cts +2 -1
  21. package/dist/css/getSVG.d.ts +2 -1
  22. package/dist/css/getSVG.js +4 -1
  23. package/dist/css/index.cjs +8 -6
  24. package/dist/css/index.d.cts +1 -1
  25. package/dist/css/index.d.ts +1 -1
  26. package/dist/css/index.js +7 -5
  27. package/dist/date/index.cjs +4 -4
  28. package/dist/date/index.js +4 -4
  29. package/dist/html/index.cjs +1 -1
  30. package/dist/html/index.js +1 -1
  31. package/dist/{index-Bq6WKjlK.d.ts → index-B0STkRZY.d.ts} +3 -2
  32. package/dist/index-B8ZJILol.d.cts +30 -0
  33. package/dist/index-DGgeqhym.d.ts +30 -0
  34. package/dist/{index-C0q7yBX5.d.cts → index-nli88Oxt.d.cts} +3 -2
  35. package/dist/index.cjs +59 -58
  36. package/dist/index.d.cts +3 -2
  37. package/dist/index.d.ts +3 -2
  38. package/dist/index.js +64 -63
  39. package/dist/judge/index.cjs +6 -6
  40. package/dist/judge/index.js +5 -5
  41. package/dist/judge/matchs.cjs +3 -3
  42. package/dist/judge/matchs.js +2 -2
  43. package/dist/tree/index.cjs +3 -3
  44. package/dist/tree/index.js +6 -6
  45. package/dist/urls/index.cjs +13 -13
  46. package/dist/urls/index.js +17 -17
  47. package/dist/window/index.cjs +20 -4
  48. package/dist/window/index.d.cts +1 -0
  49. package/dist/window/index.d.ts +1 -0
  50. package/dist/window/index.js +24 -8
  51. package/dist/window/storage.cjs +19 -0
  52. package/dist/window/storage.d.cts +37 -0
  53. package/dist/window/storage.d.ts +37 -0
  54. package/dist/window/storage.js +19 -0
  55. package/package.json +6 -1
  56. package/dist/chunk-GFAUQTB2.cjs +0 -33
  57. package/dist/chunk-WIYZQNGO.js +0 -33
  58. package/dist/index-9-f0oXM3.d.ts +0 -22
  59. package/dist/index-_GH04n6g.d.cts +0 -22
  60. package/dist/{chunk-T2QKEABG.js → chunk-33X65PQS.js} +3 -3
  61. package/dist/{chunk-HRBXT5L3.js → chunk-3DUFQKFF.js} +16 -16
  62. package/dist/{chunk-T22I7TJQ.cjs → chunk-3YUI42XN.cjs} +3 -3
  63. package/dist/{chunk-CGDNKEYI.js → chunk-5CHESUXV.js} +9 -9
  64. package/dist/{chunk-7NEXCOZZ.cjs → chunk-5SOPYS7L.cjs} +3 -3
  65. package/dist/{chunk-FZI44Q55.cjs → chunk-7GCUYESU.cjs} +12 -12
  66. package/dist/{chunk-PV2N6PF2.cjs → chunk-APRM3ELY.cjs} +2 -2
  67. package/dist/{chunk-JPQN3LUH.js → chunk-H22VVRP6.js} +3 -3
  68. package/dist/{chunk-XLYPGPDB.cjs → chunk-OCYQMNHW.cjs} +6 -6
  69. package/dist/{chunk-KURDD4RK.js → chunk-PRGC5MIZ.js} +6 -6
  70. package/dist/{chunk-OVHYLUAS.js → chunk-QUIZWAFR.js} +5 -5
  71. package/dist/{chunk-64UDCNFR.cjs → chunk-YUKBGZQ4.cjs} +6 -6
@@ -0,0 +1,67 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkLTVXRDTDcjs = require('./chunk-LTVXRDTD.cjs');
4
+
5
+
6
+ var _chunkTE3XNGF4cjs = require('./chunk-TE3XNGF4.cjs');
7
+
8
+ // packages/css/getSVG.ts
9
+ function getSVG(str) {
10
+ const reg2 = /<svg([^>]*)>((.|\n|\r|\t)*)<\/svg>/g;
11
+ const rs = reg2.exec(str);
12
+ if (rs && rs.length > 0) {
13
+ const css = rs[1];
14
+ const body = rs[2];
15
+ const attr = _chunkTE3XNGF4cjs.getAttrObj.call(void 0, css);
16
+ const b = attr["viewBox"] || "";
17
+ const bs = b.split(" ") || [];
18
+ const l = Number(bs[0]) || 0;
19
+ const t = Number(bs[1]) || 0;
20
+ const w = Number(attr["width"] || bs[2]);
21
+ const h = Number(attr["height"] || bs[3]);
22
+ return {
23
+ body,
24
+ viewBox: b,
25
+ left: l,
26
+ top: t,
27
+ width: w,
28
+ height: h
29
+ };
30
+ }
31
+ return;
32
+ }
33
+ var reg = /<svg([^>]*)>([\s\S]*?)<\/svg>/;
34
+ function getBasisSVG(text, name) {
35
+ const obj = getSVG(text);
36
+ const viewBox = _optionalChain([obj, 'optionalAccess', _ => _.viewBox]) || [
37
+ _optionalChain([obj, 'optionalAccess', _2 => _2.left]) || 0,
38
+ _optionalChain([obj, 'optionalAccess', _3 => _3.top]) || 0,
39
+ _optionalChain([obj, 'optionalAccess', _4 => _4.width]) || 1024,
40
+ _optionalChain([obj, 'optionalAccess', _5 => _5.height]) || 1024
41
+ ].join(" ");
42
+ const xmlns = "http://www.w3.org/2000/svg";
43
+ text = text.replace(/[\n|\r|\t]+/g, " ");
44
+ text = text.replace(/fill\=\"([a-zA-Z0-9#]+)\"/g, "");
45
+ text = text.replace(/[\n|\r|\t]+/g, " ").replace(/\s{2,}/g, " ").replace(/\s{1,}>/g, ">").replace(/\s{1,}\/>/g, "/>").trim();
46
+ const rs = reg.exec(text);
47
+ if (rs && rs.length > 0) {
48
+ const v = rs[2].trim();
49
+ if (name) {
50
+ name = _chunkLTVXRDTDcjs.humpToLine.call(void 0, name);
51
+ text = `<svg id="icon-${name}" viewBox="${viewBox}" xmlns="${xmlns}">${v}</svg>`;
52
+ } else {
53
+ text = `<svg viewBox="${viewBox}" xmlns="${xmlns}">${v}</svg>`;
54
+ }
55
+ } else {
56
+ if (name) {
57
+ name = _chunkLTVXRDTDcjs.humpToLine.call(void 0, name);
58
+ text = text.replace(/^<svg/, '<svg id="icon-' + name + '"');
59
+ }
60
+ }
61
+ return text;
62
+ }
63
+
64
+
65
+
66
+
67
+ exports.getSVG = getSVG; exports.getBasisSVG = getBasisSVG;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  string_exports
3
- } from "./chunk-CGDNKEYI.js";
3
+ } from "./chunk-5CHESUXV.js";
4
4
  import {
5
5
  object_exports
6
- } from "./chunk-KURDD4RK.js";
6
+ } from "./chunk-PRGC5MIZ.js";
7
7
  import {
8
8
  array_exports
9
9
  } from "./chunk-PVXQ2H5H.js";
@@ -27,16 +27,16 @@
27
27
  var _chunkV2DXOH6Bcjs = require('./chunk-V2DXOH6B.cjs');
28
28
 
29
29
 
30
- var _chunkT22I7TJQcjs = require('./chunk-T22I7TJQ.cjs');
30
+ var _chunk3YUI42XNcjs = require('./chunk-3YUI42XN.cjs');
31
31
 
32
32
 
33
- var _chunkYGJOBIEOcjs = require('./chunk-YGJOBIEO.cjs');
33
+ var _chunk2BY5RQHUcjs = require('./chunk-2BY5RQHU.cjs');
34
34
 
35
35
 
36
- var _chunkZZEFL2TEcjs = require('./chunk-ZZEFL2TE.cjs');
36
+ var _chunkYGJOBIEOcjs = require('./chunk-YGJOBIEO.cjs');
37
37
 
38
38
 
39
- var _chunk2BY5RQHUcjs = require('./chunk-2BY5RQHU.cjs');
39
+ var _chunkZZEFL2TEcjs = require('./chunk-ZZEFL2TE.cjs');
40
40
 
41
41
 
42
42
  var _chunk75ZPJI57cjs = require('./chunk-75ZPJI57.cjs');
@@ -69,7 +69,7 @@ _chunk75ZPJI57cjs.__export.call(void 0, judge_exports, {
69
69
  isTel: () => _chunkV2DXOH6Bcjs.isTel,
70
70
  isURL: () => _chunkV2DXOH6Bcjs.isURL,
71
71
  isWeChat: () => _chunkV2DXOH6Bcjs.isWeChat,
72
- matchs: () => _chunkT22I7TJQcjs.matchs,
72
+ matchs: () => _chunk3YUI42XNcjs.matchs,
73
73
  matchsEnd: () => _chunkYGJOBIEOcjs.matchsEnd,
74
74
  matchsStart: () => _chunkZZEFL2TEcjs.matchsStart,
75
75
  matchsWhole: () => _chunk2BY5RQHUcjs.matchsWhole
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkXLYPGPDBcjs = require('./chunk-XLYPGPDB.cjs');
3
+ var _chunkOCYQMNHWcjs = require('./chunk-OCYQMNHW.cjs');
4
4
 
5
5
 
6
- var _chunk64UDCNFRcjs = require('./chunk-64UDCNFR.cjs');
6
+ var _chunkYUKBGZQ4cjs = require('./chunk-YUKBGZQ4.cjs');
7
7
 
8
8
 
9
9
  var _chunk65O7KWP4cjs = require('./chunk-65O7KWP4.cjs');
@@ -15,8 +15,8 @@ var _chunk75ZPJI57cjs = require('./chunk-75ZPJI57.cjs');
15
15
  var basic_exports = {};
16
16
  _chunk75ZPJI57cjs.__export.call(void 0, basic_exports, {
17
17
  array: () => _chunk65O7KWP4cjs.array_exports,
18
- object: () => _chunk64UDCNFRcjs.object_exports,
19
- string: () => _chunkXLYPGPDBcjs.string_exports
18
+ object: () => _chunkYUKBGZQ4cjs.object_exports,
19
+ string: () => _chunkOCYQMNHWcjs.string_exports
20
20
  });
21
21
 
22
22
 
@@ -0,0 +1,299 @@
1
+ // packages/window/storage.ts
2
+ var STORAGE = "fang-storage";
3
+ function getKey(key, config = {}) {
4
+ const { prefix, isCom = false } = config;
5
+ if (prefix) {
6
+ return `${prefix}.${key}`;
7
+ }
8
+ return isCom ? key : `${STORAGE}.${key}`;
9
+ }
10
+ function simpleEncrypt(data) {
11
+ return btoa(encodeURIComponent(data));
12
+ }
13
+ function simpleDecrypt(encrypted) {
14
+ try {
15
+ return decodeURIComponent(atob(encrypted));
16
+ } catch {
17
+ return "";
18
+ }
19
+ }
20
+ function isExpired(expires) {
21
+ if (!expires) return false;
22
+ return Date.now() > expires;
23
+ }
24
+ function normalizeConfig(config) {
25
+ return {
26
+ isCom: false,
27
+ ...config
28
+ };
29
+ }
30
+ function setLocal(key, value = "", config = {}) {
31
+ try {
32
+ if (value === void 0 || value === null) value = "";
33
+ const normalizedConfig = normalizeConfig(config);
34
+ const storedData = {
35
+ value,
36
+ config: void 0
37
+ };
38
+ if (Object.keys(normalizedConfig).length > 0) {
39
+ storedData.config = {};
40
+ if (normalizedConfig.expires) {
41
+ let expires;
42
+ if (typeof normalizedConfig.expires === "string") {
43
+ expires = new Date(normalizedConfig.expires).getTime();
44
+ } else {
45
+ expires = Date.now() + normalizedConfig.expires;
46
+ }
47
+ storedData.config.expires = expires;
48
+ }
49
+ if (normalizedConfig.once !== void 0) {
50
+ storedData.config.once = normalizedConfig.once;
51
+ }
52
+ if (normalizedConfig.encrypt !== void 0) {
53
+ storedData.config.encrypt = normalizedConfig.encrypt;
54
+ }
55
+ if (normalizedConfig.isCom !== void 0) {
56
+ storedData.config.isCom = normalizedConfig.isCom;
57
+ }
58
+ }
59
+ let dataToStore = JSON.stringify(storedData);
60
+ if (storedData.config?.encrypt) {
61
+ dataToStore = simpleEncrypt(dataToStore);
62
+ }
63
+ localStorage.setItem(getKey(key, normalizedConfig), dataToStore);
64
+ return true;
65
+ } catch (error) {
66
+ console.error("\u5B58\u50A8\u6570\u636E\u5931\u8D25:", error);
67
+ return false;
68
+ }
69
+ }
70
+ function getLocal(key, config = {}) {
71
+ try {
72
+ const normalizedConfig = normalizeConfig(config);
73
+ const storageKey = getKey(key, normalizedConfig);
74
+ let storedItem = localStorage.getItem(storageKey);
75
+ if (!storedItem || storedItem === "null" || storedItem === "undefined") {
76
+ return null;
77
+ }
78
+ let parsedData;
79
+ try {
80
+ parsedData = JSON.parse(storedItem);
81
+ } catch {
82
+ const decrypted = simpleDecrypt(storedItem);
83
+ if (!decrypted) return null;
84
+ parsedData = JSON.parse(decrypted);
85
+ }
86
+ if (parsedData.config?.expires && isExpired(parsedData.config.expires)) {
87
+ localStorage.removeItem(storageKey);
88
+ return null;
89
+ }
90
+ if (parsedData.config?.once) {
91
+ localStorage.removeItem(storageKey);
92
+ }
93
+ return parsedData.value;
94
+ } catch (error) {
95
+ console.error("\u83B7\u53D6\u6570\u636E\u5931\u8D25:", error);
96
+ return null;
97
+ }
98
+ }
99
+ function clearLocal(key, config = {}) {
100
+ try {
101
+ const normalizedConfig = normalizeConfig(config);
102
+ if (key) {
103
+ localStorage.removeItem(getKey(key, normalizedConfig));
104
+ } else {
105
+ if (normalizedConfig.prefix) {
106
+ const prefixKey = getKey("", normalizedConfig).replace(
107
+ /\.$/,
108
+ ""
109
+ );
110
+ const keysToRemove = [];
111
+ for (let i = 0; i < localStorage.length; i++) {
112
+ const storageKey = localStorage.key(i);
113
+ if (storageKey && storageKey.startsWith(prefixKey + ".")) {
114
+ keysToRemove.push(storageKey);
115
+ }
116
+ }
117
+ keysToRemove.forEach((k) => localStorage.removeItem(k));
118
+ } else if (normalizedConfig.isCom) {
119
+ localStorage.clear();
120
+ } else {
121
+ const keysToRemove = [];
122
+ const privatePrefix = `${STORAGE}.`;
123
+ for (let i = 0; i < localStorage.length; i++) {
124
+ const storageKey = localStorage.key(i);
125
+ if (storageKey && storageKey.startsWith(privatePrefix)) {
126
+ keysToRemove.push(storageKey);
127
+ }
128
+ }
129
+ keysToRemove.forEach((k) => localStorage.removeItem(k));
130
+ }
131
+ }
132
+ return true;
133
+ } catch (error) {
134
+ console.error("\u6E05\u9664\u6570\u636E\u5931\u8D25:", error);
135
+ return false;
136
+ }
137
+ }
138
+ function setSession(key, value = "", config = {}) {
139
+ try {
140
+ if (value === void 0 || value === null) value = "";
141
+ const normalizedConfig = normalizeConfig(config);
142
+ const storedData = {
143
+ value,
144
+ config: void 0
145
+ };
146
+ if (Object.keys(normalizedConfig).length > 0) {
147
+ storedData.config = {};
148
+ if (normalizedConfig.expires) {
149
+ let expires;
150
+ if (typeof normalizedConfig.expires === "string") {
151
+ expires = new Date(normalizedConfig.expires).getTime();
152
+ } else {
153
+ expires = Date.now() + normalizedConfig.expires;
154
+ }
155
+ storedData.config.expires = expires;
156
+ }
157
+ if (normalizedConfig.once !== void 0) {
158
+ storedData.config.once = normalizedConfig.once;
159
+ }
160
+ if (normalizedConfig.encrypt !== void 0) {
161
+ storedData.config.encrypt = normalizedConfig.encrypt;
162
+ }
163
+ if (normalizedConfig.isCom !== void 0) {
164
+ storedData.config.isCom = normalizedConfig.isCom;
165
+ }
166
+ }
167
+ let dataToStore = JSON.stringify(storedData);
168
+ if (storedData.config?.encrypt) {
169
+ dataToStore = simpleEncrypt(dataToStore);
170
+ }
171
+ sessionStorage.setItem(getKey(key, normalizedConfig), dataToStore);
172
+ return true;
173
+ } catch (error) {
174
+ console.error("\u4F1A\u8BDD\u5B58\u50A8\u6570\u636E\u5931\u8D25:", error);
175
+ return false;
176
+ }
177
+ }
178
+ function getSession(key, config = {}) {
179
+ try {
180
+ const normalizedConfig = normalizeConfig(config);
181
+ const storageKey = getKey(key, normalizedConfig);
182
+ let storedItem = sessionStorage.getItem(storageKey);
183
+ if (!storedItem || storedItem === "null" || storedItem === "undefined") {
184
+ return null;
185
+ }
186
+ let parsedData;
187
+ try {
188
+ parsedData = JSON.parse(storedItem);
189
+ } catch {
190
+ const decrypted = simpleDecrypt(storedItem);
191
+ if (!decrypted) return null;
192
+ parsedData = JSON.parse(decrypted);
193
+ }
194
+ if (parsedData.config?.expires && isExpired(parsedData.config.expires)) {
195
+ sessionStorage.removeItem(storageKey);
196
+ return null;
197
+ }
198
+ if (parsedData.config?.once) {
199
+ sessionStorage.removeItem(storageKey);
200
+ }
201
+ return parsedData.value;
202
+ } catch (error) {
203
+ console.error("\u83B7\u53D6\u4F1A\u8BDD\u6570\u636E\u5931\u8D25:", error);
204
+ return null;
205
+ }
206
+ }
207
+ function clearSession(key, config = {}) {
208
+ try {
209
+ const normalizedConfig = normalizeConfig(config);
210
+ if (key) {
211
+ sessionStorage.removeItem(getKey(key, normalizedConfig));
212
+ } else {
213
+ if (normalizedConfig.prefix) {
214
+ const prefixKey = getKey("", normalizedConfig).replace(
215
+ /\.$/,
216
+ ""
217
+ );
218
+ const keysToRemove = [];
219
+ for (let i = 0; i < sessionStorage.length; i++) {
220
+ const storageKey = sessionStorage.key(i);
221
+ if (storageKey && storageKey.startsWith(prefixKey + ".")) {
222
+ keysToRemove.push(storageKey);
223
+ }
224
+ }
225
+ keysToRemove.forEach((k) => sessionStorage.removeItem(k));
226
+ } else if (normalizedConfig.isCom) {
227
+ sessionStorage.clear();
228
+ } else {
229
+ const keysToRemove = [];
230
+ const privatePrefix = `${STORAGE}.`;
231
+ for (let i = 0; i < sessionStorage.length; i++) {
232
+ const storageKey = sessionStorage.key(i);
233
+ if (storageKey && storageKey.startsWith(privatePrefix)) {
234
+ keysToRemove.push(storageKey);
235
+ }
236
+ }
237
+ keysToRemove.forEach((k) => sessionStorage.removeItem(k));
238
+ }
239
+ }
240
+ return true;
241
+ } catch (error) {
242
+ console.error("\u6E05\u9664\u4F1A\u8BDD\u6570\u636E\u5931\u8D25:", error);
243
+ return false;
244
+ }
245
+ }
246
+ function cleanupExpired() {
247
+ for (let i = 0; i < localStorage.length; i++) {
248
+ const key = localStorage.key(i);
249
+ if (key) {
250
+ try {
251
+ const item = localStorage.getItem(key);
252
+ if (item) {
253
+ let parsedData;
254
+ try {
255
+ parsedData = JSON.parse(item);
256
+ } catch {
257
+ continue;
258
+ }
259
+ if (parsedData.config?.expires && isExpired(parsedData.config.expires)) {
260
+ localStorage.removeItem(key);
261
+ }
262
+ }
263
+ } catch (error) {
264
+ console.error(`\u6E05\u7406\u8FC7\u671F\u6570\u636E\u5931\u8D25 (key: ${key}):`, error);
265
+ }
266
+ }
267
+ }
268
+ for (let i = 0; i < sessionStorage.length; i++) {
269
+ const key = sessionStorage.key(i);
270
+ if (key) {
271
+ try {
272
+ const item = sessionStorage.getItem(key);
273
+ if (item) {
274
+ let parsedData;
275
+ try {
276
+ parsedData = JSON.parse(item);
277
+ } catch {
278
+ continue;
279
+ }
280
+ if (parsedData.config?.expires && isExpired(parsedData.config.expires)) {
281
+ sessionStorage.removeItem(key);
282
+ }
283
+ }
284
+ } catch (error) {
285
+ console.error(`\u6E05\u7406\u4F1A\u8BDD\u8FC7\u671F\u6570\u636E\u5931\u8D25 (key: ${key}):`, error);
286
+ }
287
+ }
288
+ }
289
+ }
290
+
291
+ export {
292
+ setLocal,
293
+ getLocal,
294
+ clearLocal,
295
+ setSession,
296
+ getSession,
297
+ clearSession,
298
+ cleanupExpired
299
+ };
@@ -1,22 +1,31 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkVYOTXPMMcjs = require('./chunk-VYOTXPMM.cjs');
4
3
 
5
4
 
6
5
 
6
+ var _chunkZRO5GHYVcjs = require('./chunk-ZRO5GHYV.cjs');
7
7
 
8
8
 
9
9
 
10
10
 
11
11
 
12
12
 
13
- var _chunkPW76Z25Dcjs = require('./chunk-PW76Z25D.cjs');
14
13
 
15
14
 
15
+ var _chunk2HQDHQFPcjs = require('./chunk-2HQDHQFP.cjs');
16
16
 
17
17
 
18
+ var _chunkVYOTXPMMcjs = require('./chunk-VYOTXPMM.cjs');
18
19
 
19
- var _chunkZRO5GHYVcjs = require('./chunk-ZRO5GHYV.cjs');
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+ var _chunkPW76Z25Dcjs = require('./chunk-PW76Z25D.cjs');
20
29
 
21
30
 
22
31
  var _chunk75ZPJI57cjs = require('./chunk-75ZPJI57.cjs');
@@ -24,6 +33,9 @@ var _chunk75ZPJI57cjs = require('./chunk-75ZPJI57.cjs');
24
33
  // packages/window/index.ts
25
34
  var window_exports = {};
26
35
  _chunk75ZPJI57cjs.__export.call(void 0, window_exports, {
36
+ cleanupExpired: () => _chunk2HQDHQFPcjs.cleanupExpired,
37
+ clearLocal: () => _chunk2HQDHQFPcjs.clearLocal,
38
+ clearSession: () => _chunk2HQDHQFPcjs.clearSession,
27
39
  copy: () => _chunkVYOTXPMMcjs.copy,
28
40
  downloadCSV: () => _chunkPW76Z25Dcjs.downloadCSV,
29
41
  downloadFile: () => _chunkPW76Z25Dcjs.downloadFile,
@@ -34,9 +46,13 @@ _chunk75ZPJI57cjs.__export.call(void 0, window_exports, {
34
46
  downloadText: () => _chunkPW76Z25Dcjs.downloadText,
35
47
  downloadViaAJAX: () => _chunkPW76Z25Dcjs.downloadViaAJAX,
36
48
  getAllParams: () => _chunkZRO5GHYVcjs.getAllParams,
49
+ getLocal: () => _chunk2HQDHQFPcjs.getLocal,
37
50
  getParam: () => _chunkZRO5GHYVcjs.getParam,
51
+ getSession: () => _chunk2HQDHQFPcjs.getSession,
38
52
  getUrlParam: () => _chunkZRO5GHYVcjs.getUrlParam,
39
- getUrlParams: () => _chunkZRO5GHYVcjs.getUrlParams
53
+ getUrlParams: () => _chunkZRO5GHYVcjs.getUrlParams,
54
+ setLocal: () => _chunk2HQDHQFPcjs.setLocal,
55
+ setSession: () => _chunk2HQDHQFPcjs.setSession
40
56
  });
41
57
 
42
58
 
@@ -0,0 +1,67 @@
1
+ import {
2
+ humpToLine
3
+ } from "./chunk-J7CICTHH.js";
4
+ import {
5
+ getAttrObj
6
+ } from "./chunk-N3FZ4WUI.js";
7
+
8
+ // packages/css/getSVG.ts
9
+ function getSVG(str) {
10
+ const reg2 = /<svg([^>]*)>((.|\n|\r|\t)*)<\/svg>/g;
11
+ const rs = reg2.exec(str);
12
+ if (rs && rs.length > 0) {
13
+ const css = rs[1];
14
+ const body = rs[2];
15
+ const attr = getAttrObj(css);
16
+ const b = attr["viewBox"] || "";
17
+ const bs = b.split(" ") || [];
18
+ const l = Number(bs[0]) || 0;
19
+ const t = Number(bs[1]) || 0;
20
+ const w = Number(attr["width"] || bs[2]);
21
+ const h = Number(attr["height"] || bs[3]);
22
+ return {
23
+ body,
24
+ viewBox: b,
25
+ left: l,
26
+ top: t,
27
+ width: w,
28
+ height: h
29
+ };
30
+ }
31
+ return;
32
+ }
33
+ var reg = /<svg([^>]*)>([\s\S]*?)<\/svg>/;
34
+ function getBasisSVG(text, name) {
35
+ const obj = getSVG(text);
36
+ const viewBox = obj?.viewBox || [
37
+ obj?.left || 0,
38
+ obj?.top || 0,
39
+ obj?.width || 1024,
40
+ obj?.height || 1024
41
+ ].join(" ");
42
+ const xmlns = "http://www.w3.org/2000/svg";
43
+ text = text.replace(/[\n|\r|\t]+/g, " ");
44
+ text = text.replace(/fill\=\"([a-zA-Z0-9#]+)\"/g, "");
45
+ text = text.replace(/[\n|\r|\t]+/g, " ").replace(/\s{2,}/g, " ").replace(/\s{1,}>/g, ">").replace(/\s{1,}\/>/g, "/>").trim();
46
+ const rs = reg.exec(text);
47
+ if (rs && rs.length > 0) {
48
+ const v = rs[2].trim();
49
+ if (name) {
50
+ name = humpToLine(name);
51
+ text = `<svg id="icon-${name}" viewBox="${viewBox}" xmlns="${xmlns}">${v}</svg>`;
52
+ } else {
53
+ text = `<svg viewBox="${viewBox}" xmlns="${xmlns}">${v}</svg>`;
54
+ }
55
+ } else {
56
+ if (name) {
57
+ name = humpToLine(name);
58
+ text = text.replace(/^<svg/, '<svg id="icon-' + name + '"');
59
+ }
60
+ }
61
+ return text;
62
+ }
63
+
64
+ export {
65
+ getSVG,
66
+ getBasisSVG
67
+ };
@@ -1,6 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkGFAUQTB2cjs = require('./chunk-GFAUQTB2.cjs');
3
+ var _chunkSJPWB2OHcjs = require('./chunk-SJPWB2OH.cjs');
4
+
5
+
6
+
7
+ var _chunk73XBF3JWcjs = require('./chunk-73XBF3JW.cjs');
4
8
 
5
9
 
6
10
  var _chunkCTLBHJGFcjs = require('./chunk-CTLBHJGF.cjs');
@@ -31,9 +35,6 @@ var _chunkIFVVMDAWcjs = require('./chunk-IFVVMDAW.cjs');
31
35
  var _chunk6TH2K7LEcjs = require('./chunk-6TH2K7LE.cjs');
32
36
 
33
37
 
34
- var _chunkSJPWB2OHcjs = require('./chunk-SJPWB2OH.cjs');
35
-
36
-
37
38
  var _chunk75ZPJI57cjs = require('./chunk-75ZPJI57.cjs');
38
39
 
39
40
  // packages/css/index.ts
@@ -41,11 +42,12 @@ var css_exports = {};
41
42
  _chunk75ZPJI57cjs.__export.call(void 0, css_exports, {
42
43
  fetchUnitValue: () => _chunkUGFSIZ5Pcjs.fetchUnitValue,
43
44
  getAttrObj: () => _chunkTE3XNGF4cjs.getAttrObj,
45
+ getBasisSVG: () => _chunk73XBF3JWcjs.getBasisSVG,
44
46
  getCss: () => _chunkUGS2F6DKcjs.getCss,
45
47
  getPositionRelative: () => _chunkVY5VQ7WEcjs.getPositionRelative,
46
48
  getPrentClass: () => _chunkIFVVMDAWcjs.getPrentClass,
47
49
  getPrentCorres: () => _chunk6TH2K7LEcjs.getPrentCorres,
48
- getSVG: () => _chunkGFAUQTB2cjs.getSVG,
50
+ getSVG: () => _chunk73XBF3JWcjs.getSVG,
49
51
  getScssImports: () => _chunkSJPWB2OHcjs.getScssImports,
50
52
  setClassName: () => _chunkCTLBHJGFcjs.setClassName,
51
53
  setCss: () => _chunk4X7AFGTVcjs.setCss,
@@ -27,16 +27,16 @@ import {
27
27
  } from "./chunk-PLNZCEDI.js";
28
28
  import {
29
29
  matchs
30
- } from "./chunk-T2QKEABG.js";
30
+ } from "./chunk-33X65PQS.js";
31
+ import {
32
+ matchsWhole
33
+ } from "./chunk-IRGCP7KH.js";
31
34
  import {
32
35
  matchsEnd
33
36
  } from "./chunk-YNOFNHEK.js";
34
37
  import {
35
38
  matchsStart
36
39
  } from "./chunk-S6JRKYPY.js";
37
- import {
38
- matchsWhole
39
- } from "./chunk-IRGCP7KH.js";
40
40
  import {
41
41
  __export
42
42
  } from "./chunk-MLKGABMK.js";
@@ -1,8 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkGFAUQTB2cjs = require('../chunk-GFAUQTB2.cjs');
3
+
4
+ var _chunk73XBF3JWcjs = require('../chunk-73XBF3JW.cjs');
5
+ require('../chunk-LTVXRDTD.cjs');
4
6
  require('../chunk-TE3XNGF4.cjs');
5
7
  require('../chunk-75ZPJI57.cjs');
6
8
 
7
9
 
8
- exports.getSVG = _chunkGFAUQTB2cjs.getSVG;
10
+
11
+ exports.getBasisSVG = _chunk73XBF3JWcjs.getBasisSVG; exports.getSVG = _chunk73XBF3JWcjs.getSVG;
@@ -10,5 +10,6 @@ declare function getSVG(str: string): {
10
10
  width: number;
11
11
  height: number;
12
12
  } | undefined;
13
+ declare function getBasisSVG(text: string, name?: string): string;
13
14
 
14
- export { getSVG };
15
+ export { getBasisSVG, getSVG };
@@ -10,5 +10,6 @@ declare function getSVG(str: string): {
10
10
  width: number;
11
11
  height: number;
12
12
  } | undefined;
13
+ declare function getBasisSVG(text: string, name?: string): string;
13
14
 
14
- export { getSVG };
15
+ export { getBasisSVG, getSVG };
@@ -1,8 +1,11 @@
1
1
  import {
2
+ getBasisSVG,
2
3
  getSVG
3
- } from "../chunk-WIYZQNGO.js";
4
+ } from "../chunk-NXHTACGW.js";
5
+ import "../chunk-J7CICTHH.js";
4
6
  import "../chunk-N3FZ4WUI.js";
5
7
  import "../chunk-MLKGABMK.js";
6
8
  export {
9
+ getBasisSVG,
7
10
  getSVG
8
11
  };