@duxweb/dvha-core 0.1.20 → 0.1.22

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 (116) hide show
  1. package/dist/cjs/components/auth/can.cjs +1 -1
  2. package/dist/cjs/components/loader/iframe.cjs +1 -1
  3. package/dist/cjs/components/loader/loader.cjs +1 -0
  4. package/dist/cjs/components/loader/remote/loader.cjs +1 -0
  5. package/dist/cjs/components/loader/remote/render.cjs +1 -0
  6. package/dist/cjs/components/overlay/overlay.cjs +1 -1
  7. package/dist/cjs/components/status/error.cjs +1 -1
  8. package/dist/cjs/components/status/exception.cjs +1 -0
  9. package/dist/cjs/components/status/notAuthorized.cjs +1 -1
  10. package/dist/cjs/components/status/notFound.cjs +1 -1
  11. package/dist/cjs/directive/permission.cjs +1 -1
  12. package/dist/cjs/hooks/auth.cjs +1 -1
  13. package/dist/cjs/hooks/data.cjs +1 -1
  14. package/dist/cjs/hooks/export.cjs +1 -1
  15. package/dist/cjs/hooks/form.cjs +1 -1
  16. package/dist/cjs/hooks/formExtend.cjs +1 -0
  17. package/dist/cjs/hooks/formValidate.cjs +1 -0
  18. package/dist/cjs/hooks/i18n.cjs +1 -1
  19. package/dist/cjs/hooks/importCsv.cjs +1 -1
  20. package/dist/cjs/hooks/json/utils/expressionParser.cjs +1 -1
  21. package/dist/cjs/hooks/json.cjs +1 -1
  22. package/dist/cjs/hooks/list.cjs +1 -0
  23. package/dist/cjs/hooks/manage.cjs +1 -1
  24. package/dist/cjs/hooks/menu.cjs +1 -1
  25. package/dist/cjs/hooks/overlay.cjs +1 -1
  26. package/dist/cjs/hooks/select.cjs +1 -1
  27. package/dist/cjs/hooks/theme.cjs +2 -2
  28. package/dist/cjs/hooks/upload.cjs +1 -1
  29. package/dist/cjs/index.cjs +1 -1
  30. package/dist/cjs/main.cjs +1 -1
  31. package/dist/cjs/preset/dataProvider.cjs +1 -1
  32. package/dist/cjs/preset/i18nProvider.cjs +1 -1
  33. package/dist/cjs/provider/app.cjs +1 -1
  34. package/dist/cjs/provider/tab.cjs +1 -1
  35. package/dist/cjs/stores/manage.cjs +1 -1
  36. package/dist/cjs/stores/tab.cjs +1 -1
  37. package/dist/cjs/stores/theme.cjs +1 -1
  38. package/dist/cjs/utils/theme.cjs +9 -1
  39. package/dist/esm/components/auth/can.js +9 -7
  40. package/dist/esm/components/loader/loader.js +48 -0
  41. package/dist/esm/components/loader/remote/loader.js +150 -0
  42. package/dist/esm/components/loader/remote/render.js +19 -0
  43. package/dist/esm/components/overlay/overlay.js +22 -31
  44. package/dist/esm/components/status/error.js +3 -3
  45. package/dist/esm/components/status/exception.js +23 -0
  46. package/dist/esm/components/status/notAuthorized.js +2 -2
  47. package/dist/esm/components/status/notFound.js +4 -4
  48. package/dist/esm/directive/permission.js +5 -3
  49. package/dist/esm/hooks/auth.js +67 -67
  50. package/dist/esm/hooks/data.js +164 -160
  51. package/dist/esm/hooks/export.js +26 -23
  52. package/dist/esm/hooks/form.js +38 -35
  53. package/dist/esm/hooks/formExtend.js +38 -0
  54. package/dist/esm/hooks/formValidate.js +28 -0
  55. package/dist/esm/hooks/i18n.js +16 -8
  56. package/dist/esm/hooks/json/utils/expressionParser.js +1 -1
  57. package/dist/esm/hooks/json.js +57 -57
  58. package/dist/esm/hooks/list.js +179 -0
  59. package/dist/esm/hooks/manage.js +18 -13
  60. package/dist/esm/hooks/overlay.js +6 -4
  61. package/dist/esm/hooks/theme.js +11 -11
  62. package/dist/esm/index.js +129 -113
  63. package/dist/esm/main.js +22 -12
  64. package/dist/esm/preset/i18nProvider.js +17 -18
  65. package/dist/esm/provider/app.js +61 -53
  66. package/dist/esm/provider/tab.js +1 -1
  67. package/dist/esm/stores/manage.js +34 -24
  68. package/dist/esm/stores/tab.js +58 -49
  69. package/dist/esm/stores/theme.js +36 -34
  70. package/dist/esm/utils/theme.js +89 -76
  71. package/dist/types/components/index.d.ts +2 -1
  72. package/dist/types/components/loader/loader.d.ts +2 -0
  73. package/dist/types/components/loader/remote/index.d.ts +2 -0
  74. package/dist/types/components/loader/remote/loader.d.ts +1 -0
  75. package/dist/types/components/loader/remote/render.d.ts +1 -0
  76. package/dist/types/components/status/error.d.ts +1 -2
  77. package/dist/types/components/status/exception.d.ts +3 -0
  78. package/dist/types/components/status/index.d.ts +4 -0
  79. package/dist/types/components/status/notAuthorized.d.ts +1 -2
  80. package/dist/types/components/status/notFound.d.ts +1 -2
  81. package/dist/types/config/index.d.ts +1 -0
  82. package/dist/types/hooks/auth.d.ts +6 -6
  83. package/dist/types/hooks/data.d.ts +216 -216
  84. package/dist/types/hooks/form.d.ts +6 -3
  85. package/dist/types/hooks/formExtend.d.ts +12 -0
  86. package/dist/types/hooks/formValidate.d.ts +14 -0
  87. package/dist/types/hooks/i18n.d.ts +2 -0
  88. package/dist/types/hooks/import.d.ts +1 -2
  89. package/dist/types/hooks/index.d.ts +4 -1
  90. package/dist/types/hooks/json.d.ts +1 -1
  91. package/dist/types/hooks/list.d.ts +66 -0
  92. package/dist/types/hooks/manage.d.ts +1 -0
  93. package/dist/types/hooks/menu.d.ts +1 -1
  94. package/dist/types/hooks/overlay.d.ts +1 -1
  95. package/dist/types/hooks/theme.d.ts +8 -8
  96. package/dist/types/index.d.ts +6 -5
  97. package/dist/types/preset/i18nProvider.d.ts +1 -1
  98. package/dist/types/stores/auth.d.ts +9 -24
  99. package/dist/types/stores/i18n.d.ts +7 -16
  100. package/dist/types/stores/index.d.ts +2 -2
  101. package/dist/types/stores/manage.d.ts +7 -16
  102. package/dist/types/stores/route.d.ts +12 -2538
  103. package/dist/types/stores/tab.d.ts +6 -1030
  104. package/dist/types/stores/theme.d.ts +14 -96
  105. package/dist/types/types/config.d.ts +9 -0
  106. package/dist/types/types/i18n.d.ts +1 -0
  107. package/dist/types/types/manage.d.ts +6 -0
  108. package/dist/types/types/theme.d.ts +2 -0
  109. package/dist/types/utils/index.d.ts +1 -1
  110. package/dist/types/utils/theme.d.ts +4 -49
  111. package/package.json +22 -15
  112. package/dist/cjs/node_modules/jsep/dist/jsep.cjs +0 -2
  113. package/dist/esm/node_modules/jsep/dist/jsep.js +0 -737
  114. /package/dist/cjs/{hooks/themeColor.cjs → config/color.cjs} +0 -0
  115. /package/dist/esm/{hooks/themeColor.js → config/color.js} +0 -0
  116. /package/dist/types/{hooks/themeColor.d.ts → config/color.d.ts} +0 -0
@@ -1,5 +1,16 @@
1
- import { ThemeColorName, ThemeColorType } from '../hooks';
2
- import { Ref } from 'vue';
1
+ import type { Ref } from 'vue';
2
+ import type { ThemeColorName, ThemeColorType } from '../hooks';
3
+ export interface ThemeStoreState {
4
+ mode: Ref<'light' | 'dark' | 'auto'>;
5
+ theme: Ref<ThemeState>;
6
+ cssInit: Ref<boolean>;
7
+ setMode: (newMode: 'light' | 'dark' | 'auto') => void;
8
+ setCssInit: () => void;
9
+ setThemeColor: (type: ThemeColorType, colorName: ThemeColorName) => void;
10
+ setThemeColors: (colors: Partial<ThemeState>) => void;
11
+ resetTheme: () => void;
12
+ getTheme: () => ThemeState;
13
+ }
3
14
  export interface ThemeState {
4
15
  primary: ThemeColorName;
5
16
  info: ThemeColorName;
@@ -8,97 +19,4 @@ export interface ThemeState {
8
19
  error: ThemeColorName;
9
20
  gray: ThemeColorName;
10
21
  }
11
- export declare function useThemeStore(manageName?: string): import("pinia").Store<`theme-${string}`, Pick<{
12
- mode: Ref<"light" | "dark" | "auto", "light" | "dark" | "auto">;
13
- setMode: (newMode: "light" | "dark" | "auto") => void;
14
- theme: Ref<{
15
- primary: ThemeColorName;
16
- info: ThemeColorName;
17
- success: ThemeColorName;
18
- warning: ThemeColorName;
19
- error: ThemeColorName;
20
- gray: ThemeColorName;
21
- }, ThemeState | {
22
- primary: ThemeColorName;
23
- info: ThemeColorName;
24
- success: ThemeColorName;
25
- warning: ThemeColorName;
26
- error: ThemeColorName;
27
- gray: ThemeColorName;
28
- }>;
29
- cssInit: Ref<boolean, boolean>;
30
- setCssInit: () => void;
31
- setThemeColor: (type: ThemeColorType, colorName: ThemeColorName) => void;
32
- setThemeColors: (colors: Partial<ThemeState>) => void;
33
- resetTheme: () => void;
34
- getTheme: () => {
35
- primary: ThemeColorName;
36
- info: ThemeColorName;
37
- success: ThemeColorName;
38
- warning: ThemeColorName;
39
- error: ThemeColorName;
40
- gray: ThemeColorName;
41
- };
42
- }, "theme" | "mode" | "cssInit">, Pick<{
43
- mode: Ref<"light" | "dark" | "auto", "light" | "dark" | "auto">;
44
- setMode: (newMode: "light" | "dark" | "auto") => void;
45
- theme: Ref<{
46
- primary: ThemeColorName;
47
- info: ThemeColorName;
48
- success: ThemeColorName;
49
- warning: ThemeColorName;
50
- error: ThemeColorName;
51
- gray: ThemeColorName;
52
- }, ThemeState | {
53
- primary: ThemeColorName;
54
- info: ThemeColorName;
55
- success: ThemeColorName;
56
- warning: ThemeColorName;
57
- error: ThemeColorName;
58
- gray: ThemeColorName;
59
- }>;
60
- cssInit: Ref<boolean, boolean>;
61
- setCssInit: () => void;
62
- setThemeColor: (type: ThemeColorType, colorName: ThemeColorName) => void;
63
- setThemeColors: (colors: Partial<ThemeState>) => void;
64
- resetTheme: () => void;
65
- getTheme: () => {
66
- primary: ThemeColorName;
67
- info: ThemeColorName;
68
- success: ThemeColorName;
69
- warning: ThemeColorName;
70
- error: ThemeColorName;
71
- gray: ThemeColorName;
72
- };
73
- }, never>, Pick<{
74
- mode: Ref<"light" | "dark" | "auto", "light" | "dark" | "auto">;
75
- setMode: (newMode: "light" | "dark" | "auto") => void;
76
- theme: Ref<{
77
- primary: ThemeColorName;
78
- info: ThemeColorName;
79
- success: ThemeColorName;
80
- warning: ThemeColorName;
81
- error: ThemeColorName;
82
- gray: ThemeColorName;
83
- }, ThemeState | {
84
- primary: ThemeColorName;
85
- info: ThemeColorName;
86
- success: ThemeColorName;
87
- warning: ThemeColorName;
88
- error: ThemeColorName;
89
- gray: ThemeColorName;
90
- }>;
91
- cssInit: Ref<boolean, boolean>;
92
- setCssInit: () => void;
93
- setThemeColor: (type: ThemeColorType, colorName: ThemeColorName) => void;
94
- setThemeColors: (colors: Partial<ThemeState>) => void;
95
- resetTheme: () => void;
96
- getTheme: () => {
97
- primary: ThemeColorName;
98
- info: ThemeColorName;
99
- success: ThemeColorName;
100
- warning: ThemeColorName;
101
- error: ThemeColorName;
102
- gray: ThemeColorName;
103
- };
104
- }, "setMode" | "setCssInit" | "setThemeColor" | "setThemeColors" | "resetTheme" | "getTheme">>;
22
+ export declare function useThemeStore(manageName?: string): import("pinia").Store<string, Pick<ThemeStoreState, "mode" | "theme" | "cssInit">, Pick<ThemeStoreState, never>, Pick<ThemeStoreState, "setMode" | "setCssInit" | "setThemeColor" | "setThemeColors" | "resetTheme" | "getTheme">>;
@@ -1,3 +1,4 @@
1
+ import type { Options } from 'vue3-sfc-loader';
1
2
  import type { RouteComponent, RouteRecordRaw } from 'vue-router';
2
3
  import type { IAuthProvider } from './auth';
3
4
  import type { IDataProvider } from './data';
@@ -21,6 +22,11 @@ export interface IConfig {
21
22
  components?: IConfigComponent;
22
23
  routes?: RouteRecordRaw[];
23
24
  theme?: IConfigTheme;
25
+ remote?: {
26
+ packages?: Options;
27
+ apiMethod?: string;
28
+ apiRoutePath?: string | ((path: string) => string);
29
+ };
24
30
  [key: string]: any;
25
31
  }
26
32
  export interface IConfigComponent {
@@ -29,5 +35,8 @@ export interface IConfigComponent {
29
35
  notFound?: RouteComponent;
30
36
  notAuthorized?: RouteComponent;
31
37
  error?: RouteComponent;
38
+ exception?: RouteComponent;
39
+ loading?: RouteComponent;
32
40
  iframe?: RouteComponent;
41
+ remote?: RouteComponent;
33
42
  }
@@ -6,5 +6,6 @@ export interface I18nProvider {
6
6
  t: (key: string, options?: any, defaultMessage?: string) => string;
7
7
  changeLocale: (lang: string, options?: any) => Promise<any>;
8
8
  loadLocale: (lang: string, files: Record<string, unknown>) => Promise<any>;
9
+ mergeLocale: (lang: string, messages: Record<string, unknown>) => void;
9
10
  getLocale: () => string;
10
11
  }
@@ -1,3 +1,4 @@
1
+ import type { Options } from 'vue3-sfc-loader';
1
2
  import type { RouteRecordRaw } from 'vue-router';
2
3
  import type { IAuthProvider } from './auth';
3
4
  import type { IConfigComponent } from './config';
@@ -26,5 +27,10 @@ export interface IManage {
26
27
  menus?: IMenu[];
27
28
  components?: IConfigComponent;
28
29
  theme?: IConfigTheme;
30
+ remote?: {
31
+ packages?: Options;
32
+ apiMethod?: string;
33
+ apiRoutePath?: string | ((path: string) => string);
34
+ };
29
35
  [key: string]: any;
30
36
  }
@@ -1,10 +1,12 @@
1
1
  import type { ThemeConfig } from '../hooks';
2
+ import type { ThemeState } from '../stores';
2
3
  export interface IConfigTheme {
3
4
  logo?: string;
4
5
  darkLogo?: string;
5
6
  banner?: string;
6
7
  darkBanner?: string;
7
8
  config?: ThemeConfig;
9
+ defaultTheme?: ThemeState;
8
10
  }
9
11
  export interface ITheme {
10
12
  logo?: string;
@@ -1,2 +1,2 @@
1
- export * from './tree';
2
1
  export * from './theme';
2
+ export * from './tree';
@@ -1,52 +1,7 @@
1
1
  export declare function themePreset(themeColor: Record<string, any>): {
2
- colors: Record<string, Record<string, any>>;
3
- classes: {
4
- 'text-default': {
5
- color: string;
6
- };
7
- 'text-dimmed': {
8
- color: string;
9
- };
10
- 'text-muted': {
11
- color: string;
12
- };
13
- 'text-toned': {
14
- color: string;
15
- };
16
- 'text-highlighted': {
17
- color: string;
18
- };
19
- 'text-inverted': {
20
- color: string;
21
- };
22
- 'bg-default': {
23
- 'background-color': string;
24
- };
25
- 'bg-muted': {
26
- 'background-color': string;
27
- };
28
- 'bg-elevated': {
29
- 'background-color': string;
30
- };
31
- 'bg-accented': {
32
- 'background-color': string;
33
- };
34
- 'bg-inverted': {
35
- 'background-color': string;
36
- };
37
- 'border-default': {
38
- 'border-color': string;
39
- };
40
- 'border-muted': {
41
- 'border-color': string;
42
- };
43
- 'border-accented': {
44
- 'border-color': string;
45
- };
46
- 'border-inverted': {
47
- 'border-color': string;
48
- };
2
+ name: string;
3
+ theme: {
4
+ colors: Record<string, Record<string, any>>;
49
5
  };
50
- rules: object[];
51
- utilities: Record<string, Record<string, string>>;
6
+ rules: any[];
52
7
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duxweb/dvha-core",
3
3
  "type": "module",
4
- "version": "0.1.20",
4
+ "version": "0.1.22",
5
5
  "author": "DuxWeb",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -27,33 +27,40 @@
27
27
  "README.md",
28
28
  "dist"
29
29
  ],
30
- "scripts": {
31
- "clean": "rimraf dist",
32
- "build": "bun run clean && vue-tsc --noEmit && vite build && bun run build:types",
33
- "build:types": "vue-tsc --declaration --emitDeclarationOnly --outDir dist/types",
34
- "prepublishOnly": "bun run build",
35
- "lint": "eslint .",
36
- "lint:fix": "eslint . --fix"
37
- },
38
- "peerDependencies": {},
39
30
  "dependencies": {
40
31
  "@overlastic/vue": "^0.8.1",
41
32
  "@tanstack/vue-query": "^5.76.2",
33
+ "@vee-validate/rules": "^4.15.1",
42
34
  "@vueuse/core": "^13.3.0",
43
35
  "@vueuse/integrations": "^13.3.0",
44
36
  "axios": "^1.9.0",
45
37
  "clsx": "^2.1.1",
46
38
  "colorizr": "^3.0.8",
39
+ "crypto-js": "^4.2.0",
40
+ "dayjs": "^1.11.13",
41
+ "jsep": "^1.4.0",
47
42
  "json-2-csv": "^5.5.9",
48
43
  "lodash-es": "^4.17.21",
49
- "petite-vue-i18n": "^11.1.4",
50
- "pinia": "^3.0.0",
51
- "pinia-plugin-persistedstate": "^4.0.0",
44
+ "mathjs": "^14.5.2",
45
+ "mime": "^4.0.7",
46
+ "mitt": "^3.0.1",
47
+ "pinia": "^3.0.3",
48
+ "pinia-plugin-persistedstate": "^4.3.0",
49
+ "vee-validate": "^4.15.1",
52
50
  "vue": "^3.5.0",
53
- "vue-router": "^4.0.0"
51
+ "vue-i18n": "^11.1.6",
52
+ "vue-router": "^4.5.1",
53
+ "vue3-sfc-loader": "^0.9.5"
54
54
  },
55
55
  "devDependencies": {
56
56
  "rimraf": "^6.0.1",
57
57
  "vue-tsc": "^2.2.10"
58
+ },
59
+ "scripts": {
60
+ "clean": "rimraf dist",
61
+ "build": "pnpm run clean && vue-tsc --noEmit && vite build && pnpm run build:types",
62
+ "build:types": "vue-tsc --declaration --emitDeclarationOnly --outDir dist/types",
63
+ "lint": "eslint .",
64
+ "lint:fix": "eslint . --fix"
58
65
  }
59
- }
66
+ }
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class x{add(t,i,s){if(typeof arguments[0]!="string")for(let r in arguments[0])this.add(r,arguments[0][r],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(r){this[r]=this[r]||[],i&&this[r][s?"unshift":"push"](i)},this)}run(t,i){this[t]=this[t]||[],this[t].forEach(function(s){s.call(i&&i.context?i.context:i,i)})}}class u{constructor(t){this.jsep=t,this.registered={}}register(...t){t.forEach(i=>{if(typeof i!="object"||!i.name||!i.init)throw new Error("Invalid JSEP plugin format");this.registered[i.name]||(i.init(this.jsep),this.registered[i.name]=i)})}}class e{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+e.version}static addUnaryOp(t){return e.max_unop_len=Math.max(t.length,e.max_unop_len),e.unary_ops[t]=1,e}static addBinaryOp(t,i,s){return e.max_binop_len=Math.max(t.length,e.max_binop_len),e.binary_ops[t]=i,s?e.right_associative.add(t):e.right_associative.delete(t),e}static addIdentifierChar(t){return e.additional_identifier_chars.add(t),e}static addLiteral(t,i){return e.literals[t]=i,e}static removeUnaryOp(t){return delete e.unary_ops[t],t.length===e.max_unop_len&&(e.max_unop_len=e.getMaxKeyLen(e.unary_ops)),e}static removeAllUnaryOps(){return e.unary_ops={},e.max_unop_len=0,e}static removeIdentifierChar(t){return e.additional_identifier_chars.delete(t),e}static removeBinaryOp(t){return delete e.binary_ops[t],t.length===e.max_binop_len&&(e.max_binop_len=e.getMaxKeyLen(e.binary_ops)),e.right_associative.delete(t),e}static removeAllBinaryOps(){return e.binary_ops={},e.max_binop_len=0,e}static removeLiteral(t){return delete e.literals[t],e}static removeAllLiterals(){return e.literals={},e}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new e(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(i=>i.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return e.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!e.binary_ops[String.fromCharCode(t)]||e.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return e.isIdentifierStart(t)||e.isDecimalDigit(t)}throwError(t){const i=new Error(t+" at character "+this.index);throw i.index=this.index,i.description=t,i}runHook(t,i){if(e.hooks[t]){const s={context:this,node:i};return e.hooks.run(t,s),s.node}return i}searchHook(t){if(e.hooks[t]){const i={context:this};return e.hooks[t].find(function(s){return s.call(i.context,i),i.node}),i.node}}gobbleSpaces(){let t=this.code;for(;t===e.SPACE_CODE||t===e.TAB_CODE||t===e.LF_CODE||t===e.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),i=t.length===1?t[0]:{type:e.COMPOUND,body:t};return this.runHook("after-all",i)}gobbleExpressions(t){let i=[],s,r;for(;this.index<this.expr.length;)if(s=this.code,s===e.SEMCOL_CODE||s===e.COMMA_CODE)this.index++;else if(r=this.gobbleExpression())i.push(r);else if(this.index<this.expr.length){if(s===t)break;this.throwError('Unexpected "'+this.char+'"')}return i}gobbleExpression(){const t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,e.max_binop_len),i=t.length;for(;i>0;){if(e.binary_ops.hasOwnProperty(t)&&(!e.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=i,t;t=t.substr(0,--i)}return!1}gobbleBinaryExpression(){let t,i,s,r,n,o,l,a,E;if(o=this.gobbleToken(),!o||(i=this.gobbleBinaryOp(),!i))return o;for(n={value:i,prec:e.binaryPrecedence(i),right_a:e.right_associative.has(i)},l=this.gobbleToken(),l||this.throwError("Expected expression after "+i),r=[o,n,l];i=this.gobbleBinaryOp();){if(s=e.binaryPrecedence(i),s===0){this.index-=i.length;break}n={value:i,prec:s,right_a:e.right_associative.has(i)},E=i;const b=d=>n.right_a&&d.right_a?s>d.prec:s<=d.prec;for(;r.length>2&&b(r[r.length-2]);)l=r.pop(),i=r.pop().value,o=r.pop(),t={type:e.BINARY_EXP,operator:i,left:o,right:l},r.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+E),r.push(n,t)}for(a=r.length-1,t=r[a];a>1;)t={type:e.BINARY_EXP,operator:r[a-1].value,left:r[a-2],right:t},a-=2;return t}gobbleToken(){let t,i,s,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"),r)return this.runHook("after-token",r);if(t=this.code,e.isDecimalDigit(t)||t===e.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===e.SQUOTE_CODE||t===e.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(t===e.OBRACK_CODE)r=this.gobbleArray();else{for(i=this.expr.substr(this.index,e.max_unop_len),s=i.length;s>0;){if(e.unary_ops.hasOwnProperty(i)&&(!e.isIdentifierStart(this.code)||this.index+i.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+i.length)))){this.index+=s;const n=this.gobbleToken();return n||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:e.UNARY_EXP,operator:i,argument:n,prefix:!0})}i=i.substr(0,--s)}e.isIdentifierStart(t)?(r=this.gobbleIdentifier(),e.literals.hasOwnProperty(r.name)?r={type:e.LITERAL,value:e.literals[r.name],raw:r.name}:r.name===e.this_str&&(r={type:e.THIS_EXP})):t===e.OPAREN_CODE&&(r=this.gobbleGroup())}return r?(r=this.gobbleTokenProperty(r),this.runHook("after-token",r)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let i=this.code;for(;i===e.PERIOD_CODE||i===e.OBRACK_CODE||i===e.OPAREN_CODE||i===e.QUMARK_CODE;){let s;if(i===e.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==e.PERIOD_CODE)break;s=!0,this.index+=2,this.gobbleSpaces(),i=this.code}this.index++,i===e.OBRACK_CODE?(t={type:e.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),i=this.code,i!==e.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):i===e.OPAREN_CODE?t={type:e.CALL_EXP,arguments:this.gobbleArguments(e.CPAREN_CODE),callee:t}:(i===e.PERIOD_CODE||s)&&(s&&this.index--,this.gobbleSpaces(),t={type:e.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),s&&(t.optional=!0),this.gobbleSpaces(),i=this.code}return t}gobbleNumericLiteral(){let t="",i,s;for(;e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===e.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(i=this.char,i==="e"||i==="E"){for(t+=this.expr.charAt(this.index++),i=this.char,(i==="+"||i==="-")&&(t+=this.expr.charAt(this.index++));e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return s=this.code,e.isIdentifierStart(s)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(s===e.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===e.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:e.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="";const i=this.index,s=this.expr.charAt(this.index++);let r=!1;for(;this.index<this.expr.length;){let n=this.expr.charAt(this.index++);if(n===s){r=!0;break}else if(n==="\\")switch(n=this.expr.charAt(this.index++),n){case"n":t+=`
2
- `;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=n}else t+=n}return r||this.throwError('Unclosed quote after "'+t+'"'),{type:e.LITERAL,value:t,raw:this.expr.substring(i,this.index)}}gobbleIdentifier(){let t=this.code,i=this.index;for(e.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,e.isIdentifierPart(t));)this.index++;return{type:e.IDENTIFIER,name:this.expr.slice(i,this.index)}}gobbleArguments(t){const i=[];let s=!1,r=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let n=this.code;if(n===t){s=!0,this.index++,t===e.CPAREN_CODE&&r&&r>=i.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(n===e.COMMA_CODE){if(this.index++,r++,r!==i.length){if(t===e.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===e.CBRACK_CODE)for(let o=i.length;o<r;o++)i.push(null)}}else if(i.length!==r&&r!==0)this.throwError("Expected comma");else{const o=this.gobbleExpression();(!o||o.type===e.COMPOUND)&&this.throwError("Expected comma"),i.push(o)}}return s||this.throwError("Expected "+String.fromCharCode(t)),i}gobbleGroup(){this.index++;let t=this.gobbleExpressions(e.CPAREN_CODE);if(this.code===e.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:e.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:e.ARRAY_EXP,elements:this.gobbleArguments(e.CBRACK_CODE)}}}const g=new x;Object.assign(e,{hooks:g,plugins:new u(e),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});e.max_unop_len=e.getMaxKeyLen(e.unary_ops);e.max_binop_len=e.getMaxKeyLen(e.binary_ops);const c=h=>new e(h).parse(),f=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(e).filter(h=>!f.includes(h)&&c[h]===void 0).forEach(h=>{c[h]=e[h]});c.Jsep=e;const C="ConditionalExpression";var O={name:"ternary",init(h){h.hooks.add("after-expression",function(i){if(i.node&&this.code===h.QUMARK_CODE){this.index++;const s=i.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===h.COLON_CODE){this.index++;const n=this.gobbleExpression();if(n||this.throwError("Expected expression"),i.node={type:C,test:s,consequent:r,alternate:n},s.operator&&h.binary_ops[s.operator]<=.9){let o=s;for(;o.right.operator&&h.binary_ops[o.right.operator]<=.9;)o=o.right;i.node.test=o.right,o.right=i.node,i.node=s}}else this.throwError("Expected :")}})}};c.plugins.register(O);exports.Jsep=e;exports.default=c;