@xiping/react-components 1.0.20 → 1.0.21

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 (108) hide show
  1. package/dist/cjs/components/confetti-button/index.d.ts +24 -0
  2. package/dist/cjs/components/confetti-button/index.js +1 -0
  3. package/dist/cjs/components/txt-editor/TxtEditor.js +1 -1
  4. package/dist/cjs/hooks/useStayTimeReport.d.ts +6 -0
  5. package/dist/cjs/hooks/useStayTimeReport.js +1 -0
  6. package/dist/cjs/index.d.ts +2 -0
  7. package/dist/cjs/index.js +1 -1
  8. package/dist/cjs/node_modules/.pnpm/3d-force-graph@1.78.2/node_modules/3d-force-graph/dist/3d-force-graph.js +28 -0
  9. package/dist/cjs/node_modules/.pnpm/@tweenjs_tween.js@25.0.0/node_modules/@tweenjs/tween.js/dist/tween.esm.js +1 -0
  10. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/bowser.js +6 -0
  11. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/constants.js +1 -0
  12. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-browsers.js +1 -0
  13. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-engines.js +1 -0
  14. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-os.js +1 -0
  15. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-platforms.js +1 -0
  16. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser.js +1 -0
  17. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/utils.js +1 -0
  18. package/dist/cjs/node_modules/.pnpm/canvas-confetti@1.9.3/node_modules/canvas-confetti/dist/confetti.module.js +2 -0
  19. package/dist/cjs/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/max.js +1 -0
  20. package/dist/cjs/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/min.js +1 -0
  21. package/dist/cjs/node_modules/.pnpm/react-force-graph-3d@1.28.0_react@19.1.0/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js +1 -0
  22. package/dist/cjs/node_modules/.pnpm/three-forcegraph@1.43.0_three@0.178.0/node_modules/three-forcegraph/dist/three-forcegraph.js +3 -0
  23. package/dist/cjs/node_modules/.pnpm/three-render-objects@1.40.3_three@0.178.0/node_modules/three-render-objects/dist/three-render-objects.js +18 -0
  24. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.core.js +44 -0
  25. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.module.js +3784 -0
  26. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.webgpu.js +392 -0
  27. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/DragControls.js +1 -0
  28. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/FlyControls.js +1 -0
  29. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -0
  30. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/TrackballControls.js +1 -0
  31. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/ShaderPass.js +1 -0
  32. package/dist/cjs/react-components.css +1 -1
  33. package/dist/es/components/confetti-button/index.d.ts +24 -0
  34. package/dist/es/components/confetti-button/index.js +77 -0
  35. package/dist/es/components/txt-editor/TxtEditor.js +1 -1
  36. package/dist/es/hooks/useStayTimeReport.d.ts +6 -0
  37. package/dist/es/hooks/useStayTimeReport.js +31 -0
  38. package/dist/es/index.d.ts +2 -0
  39. package/dist/es/index.js +31 -26
  40. package/dist/es/node_modules/.pnpm/{3d-force-graph@1.77.0 → 3d-force-graph@1.78.2}/node_modules/3d-force-graph/dist/3d-force-graph.js +10 -10
  41. package/dist/es/node_modules/.pnpm/@tweenjs_tween.js@25.0.0/node_modules/@tweenjs/tween.js/dist/tween.esm.js +396 -0
  42. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/bowser.js +55 -0
  43. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/constants.js +113 -0
  44. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-browsers.js +404 -0
  45. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-engines.js +78 -0
  46. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-os.js +159 -0
  47. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-platforms.js +238 -0
  48. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser.js +303 -0
  49. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/utils.js +280 -0
  50. package/dist/es/node_modules/.pnpm/canvas-confetti@1.9.3/node_modules/canvas-confetti/dist/confetti.module.js +409 -0
  51. package/dist/es/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/max.js +15 -0
  52. package/dist/es/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/min.js +15 -0
  53. package/dist/es/node_modules/.pnpm/{react-force-graph-3d@1.27.0_react@18.3.1 → react-force-graph-3d@1.28.0_react@19.1.0}/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js +5 -2
  54. package/dist/es/node_modules/.pnpm/three-forcegraph@1.43.0_three@0.178.0/node_modules/three-forcegraph/dist/three-forcegraph.js +1037 -0
  55. package/dist/es/node_modules/.pnpm/{three-render-objects@1.40.2_three@0.171.0 → three-render-objects@1.40.3_three@0.178.0}/node_modules/three-render-objects/dist/three-render-objects.js +10 -10
  56. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.core.js +13236 -0
  57. package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/build/three.module.js +3379 -3325
  58. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.webgpu.js +24475 -0
  59. package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/controls/DragControls.js +15 -8
  60. package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/controls/FlyControls.js +26 -20
  61. package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/controls/OrbitControls.js +47 -10
  62. package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/controls/TrackballControls.js +16 -4
  63. package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/postprocessing/EffectComposer.js +62 -0
  64. package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/postprocessing/MaskPass.js +31 -0
  65. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/Pass.js +89 -0
  66. package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/postprocessing/RenderPass.js +21 -0
  67. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/ShaderPass.js +46 -0
  68. package/dist/es/react-components.css +1 -1
  69. package/package.json +29 -27
  70. package/dist/cjs/node_modules/.pnpm/3d-force-graph@1.77.0/node_modules/3d-force-graph/dist/3d-force-graph.js +0 -28
  71. package/dist/cjs/node_modules/.pnpm/@tweenjs_tween.js@23.1.3/node_modules/@tweenjs/tween.js/dist/tween.esm.js +0 -1
  72. package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/ascending.js +0 -1
  73. package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/bisect.js +0 -1
  74. package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/bisector.js +0 -1
  75. package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/max.js +0 -1
  76. package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/min.js +0 -1
  77. package/dist/cjs/node_modules/.pnpm/react-force-graph-3d@1.27.0_react@18.3.1/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js +0 -1
  78. package/dist/cjs/node_modules/.pnpm/three-forcegraph@1.42.13_three@0.171.0/node_modules/three-forcegraph/dist/three-forcegraph.js +0 -3
  79. package/dist/cjs/node_modules/.pnpm/three-render-objects@1.40.2_three@0.171.0/node_modules/three-render-objects/dist/three-render-objects.js +0 -18
  80. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.core.js +0 -44
  81. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.module.js +0 -3789
  82. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.webgpu.js +0 -373
  83. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/DragControls.js +0 -1
  84. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/FlyControls.js +0 -1
  85. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/OrbitControls.js +0 -1
  86. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/TrackballControls.js +0 -1
  87. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/ShaderPass.js +0 -1
  88. package/dist/es/node_modules/.pnpm/@tweenjs_tween.js@23.1.3/node_modules/@tweenjs/tween.js/dist/tween.esm.js +0 -379
  89. package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/ascending.js +0 -6
  90. package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/bisect.js +0 -3
  91. package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/bisector.js +0 -27
  92. package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/max.js +0 -17
  93. package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/min.js +0 -17
  94. package/dist/es/node_modules/.pnpm/three-forcegraph@1.42.13_three@0.171.0/node_modules/three-forcegraph/dist/three-forcegraph.js +0 -1020
  95. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.core.js +0 -6662
  96. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.webgpu.js +0 -13421
  97. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/Pass.js +0 -42
  98. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/ShaderPass.js +0 -23
  99. /package/dist/cjs/node_modules/.pnpm/{@monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@18.3.1_react@18.3.1__react@18.3.1 → @monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@19.1.0_react@19.1.0__react@19.1.0}/node_modules/@monaco-editor/react/dist/index.js +0 -0
  100. /package/dist/cjs/node_modules/.pnpm/{react-kapsule@2.5.7_react@18.3.1 → react-kapsule@2.5.7_react@19.1.0}/node_modules/react-kapsule/dist/react-kapsule.js +0 -0
  101. /package/dist/cjs/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/postprocessing/EffectComposer.js +0 -0
  102. /package/dist/cjs/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/postprocessing/MaskPass.js +0 -0
  103. /package/dist/cjs/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/postprocessing/Pass.js +0 -0
  104. /package/dist/cjs/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/postprocessing/RenderPass.js +0 -0
  105. /package/dist/cjs/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/shaders/CopyShader.js +0 -0
  106. /package/dist/es/node_modules/.pnpm/{@monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@18.3.1_react@18.3.1__react@18.3.1 → @monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@19.1.0_react@19.1.0__react@19.1.0}/node_modules/@monaco-editor/react/dist/index.js +0 -0
  107. /package/dist/es/node_modules/.pnpm/{react-kapsule@2.5.7_react@18.3.1 → react-kapsule@2.5.7_react@19.1.0}/node_modules/react-kapsule/dist/react-kapsule.js +0 -0
  108. /package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/shaders/CopyShader.js +0 -0
@@ -0,0 +1,159 @@
1
+ import s from "./utils.js";
2
+ import { OS_MAP as n } from "./constants.js";
3
+ const a = [
4
+ /* Roku */
5
+ {
6
+ test: [/Roku\/DVP/],
7
+ describe(t) {
8
+ const e = s.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i, t);
9
+ return {
10
+ name: n.Roku,
11
+ version: e
12
+ };
13
+ }
14
+ },
15
+ /* Windows Phone */
16
+ {
17
+ test: [/windows phone/i],
18
+ describe(t) {
19
+ const e = s.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, t);
20
+ return {
21
+ name: n.WindowsPhone,
22
+ version: e
23
+ };
24
+ }
25
+ },
26
+ /* Windows */
27
+ {
28
+ test: [/windows /i],
29
+ describe(t) {
30
+ const e = s.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i, t), i = s.getWindowsVersionName(e);
31
+ return {
32
+ name: n.Windows,
33
+ version: e,
34
+ versionName: i
35
+ };
36
+ }
37
+ },
38
+ /* Firefox on iPad */
39
+ {
40
+ test: [/Macintosh(.*?) FxiOS(.*?)\//],
41
+ describe(t) {
42
+ const e = {
43
+ name: n.iOS
44
+ }, i = s.getSecondMatch(/(Version\/)(\d[\d.]+)/, t);
45
+ return i && (e.version = i), e;
46
+ }
47
+ },
48
+ /* macOS */
49
+ {
50
+ test: [/macintosh/i],
51
+ describe(t) {
52
+ const e = s.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, t).replace(/[_\s]/g, "."), i = s.getMacOSVersionName(e), r = {
53
+ name: n.MacOS,
54
+ version: e
55
+ };
56
+ return i && (r.versionName = i), r;
57
+ }
58
+ },
59
+ /* iOS */
60
+ {
61
+ test: [/(ipod|iphone|ipad)/i],
62
+ describe(t) {
63
+ const e = s.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i, t).replace(/[_\s]/g, ".");
64
+ return {
65
+ name: n.iOS,
66
+ version: e
67
+ };
68
+ }
69
+ },
70
+ /* Android */
71
+ {
72
+ test(t) {
73
+ const e = !t.test(/like android/i), i = t.test(/android/i);
74
+ return e && i;
75
+ },
76
+ describe(t) {
77
+ const e = s.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, t), i = s.getAndroidVersionName(e), r = {
78
+ name: n.Android,
79
+ version: e
80
+ };
81
+ return i && (r.versionName = i), r;
82
+ }
83
+ },
84
+ /* WebOS */
85
+ {
86
+ test: [/(web|hpw)[o0]s/i],
87
+ describe(t) {
88
+ const e = s.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i, t), i = {
89
+ name: n.WebOS
90
+ };
91
+ return e && e.length && (i.version = e), i;
92
+ }
93
+ },
94
+ /* BlackBerry */
95
+ {
96
+ test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
97
+ describe(t) {
98
+ const e = s.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i, t) || s.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i, t) || s.getFirstMatch(/\bbb(\d+)/i, t);
99
+ return {
100
+ name: n.BlackBerry,
101
+ version: e
102
+ };
103
+ }
104
+ },
105
+ /* Bada */
106
+ {
107
+ test: [/bada/i],
108
+ describe(t) {
109
+ const e = s.getFirstMatch(/bada\/(\d+(\.\d+)*)/i, t);
110
+ return {
111
+ name: n.Bada,
112
+ version: e
113
+ };
114
+ }
115
+ },
116
+ /* Tizen */
117
+ {
118
+ test: [/tizen/i],
119
+ describe(t) {
120
+ const e = s.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, t);
121
+ return {
122
+ name: n.Tizen,
123
+ version: e
124
+ };
125
+ }
126
+ },
127
+ /* Linux */
128
+ {
129
+ test: [/linux/i],
130
+ describe() {
131
+ return {
132
+ name: n.Linux
133
+ };
134
+ }
135
+ },
136
+ /* Chrome OS */
137
+ {
138
+ test: [/CrOS/],
139
+ describe() {
140
+ return {
141
+ name: n.ChromeOS
142
+ };
143
+ }
144
+ },
145
+ /* Playstation 4 */
146
+ {
147
+ test: [/PlayStation 4/],
148
+ describe(t) {
149
+ const e = s.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i, t);
150
+ return {
151
+ name: n.PlayStation4,
152
+ version: e
153
+ };
154
+ }
155
+ }
156
+ ];
157
+ export {
158
+ a as default
159
+ };
@@ -0,0 +1,238 @@
1
+ import s from "./utils.js";
2
+ import { PLATFORMS_MAP as t } from "./constants.js";
3
+ const d = [
4
+ /* Googlebot */
5
+ {
6
+ test: [/googlebot/i],
7
+ describe() {
8
+ return {
9
+ type: "bot",
10
+ vendor: "Google"
11
+ };
12
+ }
13
+ },
14
+ /* Huawei */
15
+ {
16
+ test: [/huawei/i],
17
+ describe(e) {
18
+ const r = s.getFirstMatch(/(can-l01)/i, e) && "Nova", i = {
19
+ type: t.mobile,
20
+ vendor: "Huawei"
21
+ };
22
+ return r && (i.model = r), i;
23
+ }
24
+ },
25
+ /* Nexus Tablet */
26
+ {
27
+ test: [/nexus\s*(?:7|8|9|10).*/i],
28
+ describe() {
29
+ return {
30
+ type: t.tablet,
31
+ vendor: "Nexus"
32
+ };
33
+ }
34
+ },
35
+ /* iPad */
36
+ {
37
+ test: [/ipad/i],
38
+ describe() {
39
+ return {
40
+ type: t.tablet,
41
+ vendor: "Apple",
42
+ model: "iPad"
43
+ };
44
+ }
45
+ },
46
+ /* Firefox on iPad */
47
+ {
48
+ test: [/Macintosh(.*?) FxiOS(.*?)\//],
49
+ describe() {
50
+ return {
51
+ type: t.tablet,
52
+ vendor: "Apple",
53
+ model: "iPad"
54
+ };
55
+ }
56
+ },
57
+ /* Amazon Kindle Fire */
58
+ {
59
+ test: [/kftt build/i],
60
+ describe() {
61
+ return {
62
+ type: t.tablet,
63
+ vendor: "Amazon",
64
+ model: "Kindle Fire HD 7"
65
+ };
66
+ }
67
+ },
68
+ /* Another Amazon Tablet with Silk */
69
+ {
70
+ test: [/silk/i],
71
+ describe() {
72
+ return {
73
+ type: t.tablet,
74
+ vendor: "Amazon"
75
+ };
76
+ }
77
+ },
78
+ /* Tablet */
79
+ {
80
+ test: [/tablet(?! pc)/i],
81
+ describe() {
82
+ return {
83
+ type: t.tablet
84
+ };
85
+ }
86
+ },
87
+ /* iPod/iPhone */
88
+ {
89
+ test(e) {
90
+ const r = e.test(/ipod|iphone/i), i = e.test(/like (ipod|iphone)/i);
91
+ return r && !i;
92
+ },
93
+ describe(e) {
94
+ const r = s.getFirstMatch(/(ipod|iphone)/i, e);
95
+ return {
96
+ type: t.mobile,
97
+ vendor: "Apple",
98
+ model: r
99
+ };
100
+ }
101
+ },
102
+ /* Nexus Mobile */
103
+ {
104
+ test: [/nexus\s*[0-6].*/i, /galaxy nexus/i],
105
+ describe() {
106
+ return {
107
+ type: t.mobile,
108
+ vendor: "Nexus"
109
+ };
110
+ }
111
+ },
112
+ /* Mobile */
113
+ {
114
+ test: [/[^-]mobi/i],
115
+ describe() {
116
+ return {
117
+ type: t.mobile
118
+ };
119
+ }
120
+ },
121
+ /* BlackBerry */
122
+ {
123
+ test(e) {
124
+ return e.getBrowserName(!0) === "blackberry";
125
+ },
126
+ describe() {
127
+ return {
128
+ type: t.mobile,
129
+ vendor: "BlackBerry"
130
+ };
131
+ }
132
+ },
133
+ /* Bada */
134
+ {
135
+ test(e) {
136
+ return e.getBrowserName(!0) === "bada";
137
+ },
138
+ describe() {
139
+ return {
140
+ type: t.mobile
141
+ };
142
+ }
143
+ },
144
+ /* Windows Phone */
145
+ {
146
+ test(e) {
147
+ return e.getBrowserName() === "windows phone";
148
+ },
149
+ describe() {
150
+ return {
151
+ type: t.mobile,
152
+ vendor: "Microsoft"
153
+ };
154
+ }
155
+ },
156
+ /* Android Tablet */
157
+ {
158
+ test(e) {
159
+ const r = Number(String(e.getOSVersion()).split(".")[0]);
160
+ return e.getOSName(!0) === "android" && r >= 3;
161
+ },
162
+ describe() {
163
+ return {
164
+ type: t.tablet
165
+ };
166
+ }
167
+ },
168
+ /* Android Mobile */
169
+ {
170
+ test(e) {
171
+ return e.getOSName(!0) === "android";
172
+ },
173
+ describe() {
174
+ return {
175
+ type: t.mobile
176
+ };
177
+ }
178
+ },
179
+ /* desktop */
180
+ {
181
+ test(e) {
182
+ return e.getOSName(!0) === "macos";
183
+ },
184
+ describe() {
185
+ return {
186
+ type: t.desktop,
187
+ vendor: "Apple"
188
+ };
189
+ }
190
+ },
191
+ /* Windows */
192
+ {
193
+ test(e) {
194
+ return e.getOSName(!0) === "windows";
195
+ },
196
+ describe() {
197
+ return {
198
+ type: t.desktop
199
+ };
200
+ }
201
+ },
202
+ /* Linux */
203
+ {
204
+ test(e) {
205
+ return e.getOSName(!0) === "linux";
206
+ },
207
+ describe() {
208
+ return {
209
+ type: t.desktop
210
+ };
211
+ }
212
+ },
213
+ /* PlayStation 4 */
214
+ {
215
+ test(e) {
216
+ return e.getOSName(!0) === "playstation 4";
217
+ },
218
+ describe() {
219
+ return {
220
+ type: t.tv
221
+ };
222
+ }
223
+ },
224
+ /* Roku */
225
+ {
226
+ test(e) {
227
+ return e.getOSName(!0) === "roku";
228
+ },
229
+ describe() {
230
+ return {
231
+ type: t.tv
232
+ };
233
+ }
234
+ }
235
+ ];
236
+ export {
237
+ d as default
238
+ };
@@ -0,0 +1,303 @@
1
+ import h from "./parser-browsers.js";
2
+ import l from "./parser-os.js";
3
+ import p from "./parser-platforms.js";
4
+ import m from "./parser-engines.js";
5
+ import n from "./utils.js";
6
+ class B {
7
+ /**
8
+ * Create instance of Parser
9
+ *
10
+ * @param {String} UA User-Agent string
11
+ * @param {Boolean} [skipParsing=false] parser can skip parsing in purpose of performance
12
+ * improvements if you need to make a more particular parsing
13
+ * like {@link Parser#parseBrowser} or {@link Parser#parsePlatform}
14
+ *
15
+ * @throw {Error} in case of empty UA String
16
+ *
17
+ * @constructor
18
+ */
19
+ constructor(t, e = !1) {
20
+ if (t == null || t === "")
21
+ throw new Error("UserAgent parameter can't be empty");
22
+ this._ua = t, this.parsedResult = {}, e !== !0 && this.parse();
23
+ }
24
+ /**
25
+ * Get UserAgent string of current Parser instance
26
+ * @return {String} User-Agent String of the current <Parser> object
27
+ *
28
+ * @public
29
+ */
30
+ getUA() {
31
+ return this._ua;
32
+ }
33
+ /**
34
+ * Test a UA string for a regexp
35
+ * @param {RegExp} regex
36
+ * @return {Boolean}
37
+ */
38
+ test(t) {
39
+ return t.test(this._ua);
40
+ }
41
+ /**
42
+ * Get parsed browser object
43
+ * @return {Object}
44
+ */
45
+ parseBrowser() {
46
+ this.parsedResult.browser = {};
47
+ const t = n.find(h, (e) => {
48
+ if (typeof e.test == "function")
49
+ return e.test(this);
50
+ if (e.test instanceof Array)
51
+ return e.test.some((s) => this.test(s));
52
+ throw new Error("Browser's test function is not valid");
53
+ });
54
+ return t && (this.parsedResult.browser = t.describe(this.getUA())), this.parsedResult.browser;
55
+ }
56
+ /**
57
+ * Get parsed browser object
58
+ * @return {Object}
59
+ *
60
+ * @public
61
+ */
62
+ getBrowser() {
63
+ return this.parsedResult.browser ? this.parsedResult.browser : this.parseBrowser();
64
+ }
65
+ /**
66
+ * Get browser's name
67
+ * @return {String} Browser's name or an empty string
68
+ *
69
+ * @public
70
+ */
71
+ getBrowserName(t) {
72
+ return t ? String(this.getBrowser().name).toLowerCase() || "" : this.getBrowser().name || "";
73
+ }
74
+ /**
75
+ * Get browser's version
76
+ * @return {String} version of browser
77
+ *
78
+ * @public
79
+ */
80
+ getBrowserVersion() {
81
+ return this.getBrowser().version;
82
+ }
83
+ /**
84
+ * Get OS
85
+ * @return {Object}
86
+ *
87
+ * @example
88
+ * this.getOS();
89
+ * {
90
+ * name: 'macOS',
91
+ * version: '10.11.12'
92
+ * }
93
+ */
94
+ getOS() {
95
+ return this.parsedResult.os ? this.parsedResult.os : this.parseOS();
96
+ }
97
+ /**
98
+ * Parse OS and save it to this.parsedResult.os
99
+ * @return {*|{}}
100
+ */
101
+ parseOS() {
102
+ this.parsedResult.os = {};
103
+ const t = n.find(l, (e) => {
104
+ if (typeof e.test == "function")
105
+ return e.test(this);
106
+ if (e.test instanceof Array)
107
+ return e.test.some((s) => this.test(s));
108
+ throw new Error("Browser's test function is not valid");
109
+ });
110
+ return t && (this.parsedResult.os = t.describe(this.getUA())), this.parsedResult.os;
111
+ }
112
+ /**
113
+ * Get OS name
114
+ * @param {Boolean} [toLowerCase] return lower-cased value
115
+ * @return {String} name of the OS — macOS, Windows, Linux, etc.
116
+ */
117
+ getOSName(t) {
118
+ const { name: e } = this.getOS();
119
+ return t ? String(e).toLowerCase() || "" : e || "";
120
+ }
121
+ /**
122
+ * Get OS version
123
+ * @return {String} full version with dots ('10.11.12', '5.6', etc)
124
+ */
125
+ getOSVersion() {
126
+ return this.getOS().version;
127
+ }
128
+ /**
129
+ * Get parsed platform
130
+ * @return {{}}
131
+ */
132
+ getPlatform() {
133
+ return this.parsedResult.platform ? this.parsedResult.platform : this.parsePlatform();
134
+ }
135
+ /**
136
+ * Get platform name
137
+ * @param {Boolean} [toLowerCase=false]
138
+ * @return {*}
139
+ */
140
+ getPlatformType(t = !1) {
141
+ const { type: e } = this.getPlatform();
142
+ return t ? String(e).toLowerCase() || "" : e || "";
143
+ }
144
+ /**
145
+ * Get parsed platform
146
+ * @return {{}}
147
+ */
148
+ parsePlatform() {
149
+ this.parsedResult.platform = {};
150
+ const t = n.find(p, (e) => {
151
+ if (typeof e.test == "function")
152
+ return e.test(this);
153
+ if (e.test instanceof Array)
154
+ return e.test.some((s) => this.test(s));
155
+ throw new Error("Browser's test function is not valid");
156
+ });
157
+ return t && (this.parsedResult.platform = t.describe(this.getUA())), this.parsedResult.platform;
158
+ }
159
+ /**
160
+ * Get parsed engine
161
+ * @return {{}}
162
+ */
163
+ getEngine() {
164
+ return this.parsedResult.engine ? this.parsedResult.engine : this.parseEngine();
165
+ }
166
+ /**
167
+ * Get engines's name
168
+ * @return {String} Engines's name or an empty string
169
+ *
170
+ * @public
171
+ */
172
+ getEngineName(t) {
173
+ return t ? String(this.getEngine().name).toLowerCase() || "" : this.getEngine().name || "";
174
+ }
175
+ /**
176
+ * Get parsed platform
177
+ * @return {{}}
178
+ */
179
+ parseEngine() {
180
+ this.parsedResult.engine = {};
181
+ const t = n.find(m, (e) => {
182
+ if (typeof e.test == "function")
183
+ return e.test(this);
184
+ if (e.test instanceof Array)
185
+ return e.test.some((s) => this.test(s));
186
+ throw new Error("Browser's test function is not valid");
187
+ });
188
+ return t && (this.parsedResult.engine = t.describe(this.getUA())), this.parsedResult.engine;
189
+ }
190
+ /**
191
+ * Parse full information about the browser
192
+ * @returns {Parser}
193
+ */
194
+ parse() {
195
+ return this.parseBrowser(), this.parseOS(), this.parsePlatform(), this.parseEngine(), this;
196
+ }
197
+ /**
198
+ * Get parsed result
199
+ * @return {ParsedResult}
200
+ */
201
+ getResult() {
202
+ return n.assign({}, this.parsedResult);
203
+ }
204
+ /**
205
+ * Check if parsed browser matches certain conditions
206
+ *
207
+ * @param {Object} checkTree It's one or two layered object,
208
+ * which can include a platform or an OS on the first layer
209
+ * and should have browsers specs on the bottom-laying layer
210
+ *
211
+ * @returns {Boolean|undefined} Whether the browser satisfies the set conditions or not.
212
+ * Returns `undefined` when the browser is no described in the checkTree object.
213
+ *
214
+ * @example
215
+ * const browser = Bowser.getParser(window.navigator.userAgent);
216
+ * if (browser.satisfies({chrome: '>118.01.1322' }))
217
+ * // or with os
218
+ * if (browser.satisfies({windows: { chrome: '>118.01.1322' } }))
219
+ * // or with platforms
220
+ * if (browser.satisfies({desktop: { chrome: '>118.01.1322' } }))
221
+ */
222
+ satisfies(t) {
223
+ const e = {};
224
+ let s = 0;
225
+ const r = {};
226
+ let a = 0;
227
+ if (Object.keys(t).forEach((f) => {
228
+ const i = t[f];
229
+ typeof i == "string" ? (r[f] = i, a += 1) : typeof i == "object" && (e[f] = i, s += 1);
230
+ }), s > 0) {
231
+ const f = Object.keys(e), i = n.find(f, (o) => this.isOS(o));
232
+ if (i) {
233
+ const o = this.satisfies(e[i]);
234
+ if (o !== void 0)
235
+ return o;
236
+ }
237
+ const u = n.find(
238
+ f,
239
+ (o) => this.isPlatform(o)
240
+ );
241
+ if (u) {
242
+ const o = this.satisfies(e[u]);
243
+ if (o !== void 0)
244
+ return o;
245
+ }
246
+ }
247
+ if (a > 0) {
248
+ const f = Object.keys(r), i = n.find(f, (u) => this.isBrowser(u, !0));
249
+ if (i !== void 0)
250
+ return this.compareVersion(r[i]);
251
+ }
252
+ }
253
+ /**
254
+ * Check if the browser name equals the passed string
255
+ * @param browserName The string to compare with the browser name
256
+ * @param [includingAlias=false] The flag showing whether alias will be included into comparison
257
+ * @returns {boolean}
258
+ */
259
+ isBrowser(t, e = !1) {
260
+ const s = this.getBrowserName().toLowerCase();
261
+ let r = t.toLowerCase();
262
+ const a = n.getBrowserTypeByAlias(r);
263
+ return e && a && (r = a.toLowerCase()), r === s;
264
+ }
265
+ compareVersion(t) {
266
+ let e = [0], s = t, r = !1;
267
+ const a = this.getBrowserVersion();
268
+ if (typeof a == "string")
269
+ return t[0] === ">" || t[0] === "<" ? (s = t.substr(1), t[1] === "=" ? (r = !0, s = t.substr(2)) : e = [], t[0] === ">" ? e.push(1) : e.push(-1)) : t[0] === "=" ? s = t.substr(1) : t[0] === "~" && (r = !0, s = t.substr(1)), e.indexOf(
270
+ n.compareVersions(a, s, r)
271
+ ) > -1;
272
+ }
273
+ isOS(t) {
274
+ return this.getOSName(!0) === String(t).toLowerCase();
275
+ }
276
+ isPlatform(t) {
277
+ return this.getPlatformType(!0) === String(t).toLowerCase();
278
+ }
279
+ isEngine(t) {
280
+ return this.getEngineName(!0) === String(t).toLowerCase();
281
+ }
282
+ /**
283
+ * Is anything? Check if the browser is called "anything",
284
+ * the OS called "anything" or the platform called "anything"
285
+ * @param {String} anything
286
+ * @param [includingAlias=false] The flag showing whether alias will be included into comparison
287
+ * @returns {Boolean}
288
+ */
289
+ is(t, e = !1) {
290
+ return this.isBrowser(t, e) || this.isOS(t) || this.isPlatform(t);
291
+ }
292
+ /**
293
+ * Check if any of the given values satisfies this.is(anything)
294
+ * @param {String[]} anythings
295
+ * @returns {Boolean}
296
+ */
297
+ some(t = []) {
298
+ return t.some((e) => this.is(e));
299
+ }
300
+ }
301
+ export {
302
+ B as default
303
+ };