@oj-module/cli 0.2.64 → 0.2.66

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 (193) hide show
  1. package/devkit/README.md +9 -3
  2. package/devkit/SKILL.md +5 -2
  3. package/devkit/framework-dev.md +12 -7
  4. package/devkit/manual.md +123 -56
  5. package/devkit/menu-rules.md +4 -1
  6. package/package.json +3 -2
  7. package/shell-dist/assets/ahooks.2l850ymmh0.js +18 -0
  8. package/shell-dist/assets/antd-es-locale-zh_CN.1gjjsvxbf0.js +1 -0
  9. package/shell-dist/assets/antd-img-crop.196rkty480.js +99 -0
  10. package/shell-dist/assets/antd-locale-en_US.561tozx860.js +1 -0
  11. package/shell-dist/assets/antd-locale-zh_CN.1cmpmgzh70.js +1 -0
  12. package/shell-dist/assets/antd.uw1coq15l0.js +348 -0
  13. package/shell-dist/assets/clsx.jotilrt2e0.js +1 -0
  14. package/shell-dist/assets/contract-errors.2o17vz9u50.js +1 -0
  15. package/shell-dist/assets/contract.3h327o3mj0.js +57 -0
  16. package/shell-dist/assets/cssinjs.atgmhan7m0.js +3 -0
  17. package/shell-dist/assets/dayjs-plugin-advancedFormat.3vsyd2eis0.js +1 -0
  18. package/shell-dist/assets/dayjs-plugin-customParseFormat.13xhghv1d0.js +1 -0
  19. package/shell-dist/assets/dayjs-plugin-isoWeek.1fn1tw82p0.js +1 -0
  20. package/shell-dist/assets/dayjs-plugin-localeData.2rwbjp9nk0.js +1 -0
  21. package/shell-dist/assets/dayjs-plugin-quarterOfYear.2oqo1lcx80.js +1 -0
  22. package/shell-dist/assets/dayjs-plugin-relativeTime.2pqs3et4y0.js +1 -0
  23. package/shell-dist/assets/dayjs-plugin-weekOfYear.gvn9iph080.js +1 -0
  24. package/shell-dist/assets/dayjs-plugin-weekYear.2u78l3ex10.js +1 -0
  25. package/shell-dist/assets/dayjs-plugin-weekday.2d56a4tml0.js +1 -0
  26. package/shell-dist/assets/dayjs.pa60l6wjo0.js +1 -0
  27. package/shell-dist/assets/dnd-kit-core.1xyreig6r0.js +5 -0
  28. package/shell-dist/assets/dnd-kit-sortable.s94qciuft0.js +1 -0
  29. package/shell-dist/assets/dnd-kit-utilities.1umw4xphb0.js +1 -0
  30. package/shell-dist/assets/i18next.33zqofapj0.js +1 -0
  31. package/shell-dist/assets/icons-es-components-Context.365qmflwg0.js +1 -0
  32. package/shell-dist/assets/icons.159wjwals0.js +57 -0
  33. package/shell-dist/assets/jsx-dev-runtime.3uibuc82f0.js +14 -0
  34. package/shell-dist/assets/jsx-runtime.h40xu4o5b0.js +14 -0
  35. package/shell-dist/assets/keepalive-for-react.xenu5vam70.js +1 -0
  36. package/shell-dist/assets/kit.37kr8ui390.js +1 -0
  37. package/shell-dist/assets/ky.1cgch7gu60.js +6 -0
  38. package/shell-dist/assets/motion-react.pjsxytvjs0.js +12 -0
  39. package/shell-dist/assets/motion.21tciqutg0.js +4 -0
  40. package/shell-dist/assets/nprogress.2nz76n9ny0.js +7 -0
  41. package/shell-dist/assets/ojm-dayjs-locale-zh-cn.3vr3beiyp0.js +9 -0
  42. package/shell-dist/assets/pinyin-pro.3v0mnxczn0.js +1 -0
  43. package/shell-dist/assets/pro-components.2kyot1vcl0.js +83 -0
  44. package/shell-dist/assets/react-countup.2x8idnr8y0.js +10 -0
  45. package/shell-dist/assets/react-dom-client.ick0v05ob0.js +43 -0
  46. package/shell-dist/assets/react-dom.2so9uxg3f0.js +22 -0
  47. package/shell-dist/assets/react-error-boundary.2dncdfj3b0.js +1 -0
  48. package/shell-dist/assets/react-i18next.auhvjhqv00.js +1 -0
  49. package/shell-dist/assets/react-jss.1ei6dr9e00.js +29 -0
  50. package/shell-dist/assets/react-query.3rln45ow00.js +1 -0
  51. package/shell-dist/assets/react-router-dom.3c6zld8h40.js +44 -0
  52. package/shell-dist/assets/react-router.2h9rebcv50.js +56 -0
  53. package/shell-dist/assets/react.1ew63mwts0.js +14 -0
  54. package/shell-dist/assets/runtime.1xfsxcajj0.js +21702 -0
  55. package/shell-dist/assets/simplebar-react.2g739uvai0.js +1 -0
  56. package/shell-dist/assets/spin-delay.yjeyj6iwp0.js +9 -0
  57. package/shell-dist/assets/tailwind-merge.125ehiqjw0.js +1 -0
  58. package/shell-dist/assets/use-sync-external-store-shim.1nz1pi9bb0.js +22 -0
  59. package/shell-dist/assets/zustand-middleware.1xaxjueme0.js +6 -0
  60. package/shell-dist/assets/zustand-react-shallow.pybayv1hx0.js +1 -0
  61. package/shell-dist/assets/zustand-react.9fsl9brxy0.js +1 -0
  62. package/shell-dist/assets/zustand-shallow.6cz0yyv9x0.js +1 -0
  63. package/shell-dist/assets/zustand-vanilla-shallow.3424monv50.js +1 -0
  64. package/shell-dist/assets/zustand-vanilla.1mo3ka3g30.js +1 -0
  65. package/shell-dist/assets/zustand.3gjgzlnqo0.js +1 -0
  66. package/shell-dist/index.html +67 -118
  67. package/shell-dist/versions.json +3 -3
  68. package/src/esm-exports.ts +152 -70
  69. package/src/shared-deps.ts +69 -19
  70. package/src/site-base.ts +4 -0
  71. package/templates/src/app/web/home/pages/components/bar-chart.tsx +5 -3
  72. package/templates/src/app/web/home/pages/components/echarts-setup.ts +30 -0
  73. package/templates/src/app/web/home/pages/components/line-chart.tsx +5 -3
  74. package/templates/src/app/web/home/pages/components/pie-chart.tsx +6 -3
  75. package/templates/src/app/web/home/pages/index.tsx +3 -2
  76. package/templates/src/app/web/home/routes.ts +3 -2
  77. package/vendor/host-versions.json +3 -3
  78. package/shell-dist/assets/ahooks.js +0 -6909
  79. package/shell-dist/assets/antd-es-locale-zh_CN.js +0 -257
  80. package/shell-dist/assets/antd-img-crop.js +0 -1495
  81. package/shell-dist/assets/antd-locale-en_US.js +0 -374
  82. package/shell-dist/assets/antd-locale-zh_CN.js +0 -379
  83. package/shell-dist/assets/antd.js +0 -106874
  84. package/shell-dist/assets/clsx.js +0 -33
  85. package/shell-dist/assets/contract-errors.js +0 -30
  86. package/shell-dist/assets/contract.js +0 -18900
  87. package/shell-dist/assets/cssinjs.js +0 -2595
  88. package/shell-dist/assets/dayjs-plugin-advancedFormat.js +0 -98
  89. package/shell-dist/assets/dayjs-plugin-customParseFormat.js +0 -173
  90. package/shell-dist/assets/dayjs-plugin-isoWeek.js +0 -77
  91. package/shell-dist/assets/dayjs-plugin-localeData.js +0 -126
  92. package/shell-dist/assets/dayjs-plugin-quarterOfYear.js +0 -77
  93. package/shell-dist/assets/dayjs-plugin-relativeTime.js +0 -92
  94. package/shell-dist/assets/dayjs-plugin-weekOfYear.js +0 -73
  95. package/shell-dist/assets/dayjs-plugin-weekYear.js +0 -63
  96. package/shell-dist/assets/dayjs-plugin-weekday.js +0 -63
  97. package/shell-dist/assets/dayjs.js +0 -326
  98. package/shell-dist/assets/dnd-kit-core.js +0 -3601
  99. package/shell-dist/assets/dnd-kit-sortable.js +0 -717
  100. package/shell-dist/assets/dnd-kit-utilities.js +0 -340
  101. package/shell-dist/assets/i18next.js +0 -2321
  102. package/shell-dist/assets/icons-es-components-Context.js +0 -20
  103. package/shell-dist/assets/icons.js +0 -34961
  104. package/shell-dist/assets/jsx-dev-runtime.js +0 -75
  105. package/shell-dist/assets/jsx-runtime.js +0 -97
  106. package/shell-dist/assets/keepalive-for-react.js +0 -283
  107. package/shell-dist/assets/kit.js +0 -151
  108. package/shell-dist/assets/ky.js +0 -1427
  109. package/shell-dist/assets/motion-react.js +0 -13589
  110. package/shell-dist/assets/motion.js +0 -9959
  111. package/shell-dist/assets/nprogress.js +0 -314
  112. package/shell-dist/assets/ojm--ant-design-icons-es-icons-BarsOutlined.js +0 -7
  113. package/shell-dist/assets/ojm--ant-design-icons-es-icons-CalendarOutlined.js +0 -7
  114. package/shell-dist/assets/ojm--ant-design-icons-es-icons-CaretDownFilled.js +0 -7
  115. package/shell-dist/assets/ojm--ant-design-icons-es-icons-CaretDownOutlined.js +0 -7
  116. package/shell-dist/assets/ojm--ant-design-icons-es-icons-CaretUpOutlined.js +0 -7
  117. package/shell-dist/assets/ojm--ant-design-icons-es-icons-CheckCircleFilled.js +0 -7
  118. package/shell-dist/assets/ojm--ant-design-icons-es-icons-CheckOutlined.js +0 -7
  119. package/shell-dist/assets/ojm--ant-design-icons-es-icons-ClockCircleOutlined.js +0 -7
  120. package/shell-dist/assets/ojm--ant-design-icons-es-icons-CloseCircleFilled.js +0 -7
  121. package/shell-dist/assets/ojm--ant-design-icons-es-icons-CloseOutlined.js +0 -7
  122. package/shell-dist/assets/ojm--ant-design-icons-es-icons-CopyOutlined.js +0 -7
  123. package/shell-dist/assets/ojm--ant-design-icons-es-icons-DeleteOutlined.js +0 -7
  124. package/shell-dist/assets/ojm--ant-design-icons-es-icons-DoubleLeftOutlined.js +0 -7
  125. package/shell-dist/assets/ojm--ant-design-icons-es-icons-DoubleRightOutlined.js +0 -7
  126. package/shell-dist/assets/ojm--ant-design-icons-es-icons-DownOutlined.js +0 -7
  127. package/shell-dist/assets/ojm--ant-design-icons-es-icons-DownloadOutlined.js +0 -7
  128. package/shell-dist/assets/ojm--ant-design-icons-es-icons-EditOutlined.js +0 -7
  129. package/shell-dist/assets/ojm--ant-design-icons-es-icons-EllipsisOutlined.js +0 -7
  130. package/shell-dist/assets/ojm--ant-design-icons-es-icons-EnterOutlined.js +0 -7
  131. package/shell-dist/assets/ojm--ant-design-icons-es-icons-ExclamationCircleFilled.js +0 -7
  132. package/shell-dist/assets/ojm--ant-design-icons-es-icons-EyeInvisibleOutlined.js +0 -7
  133. package/shell-dist/assets/ojm--ant-design-icons-es-icons-EyeOutlined.js +0 -7
  134. package/shell-dist/assets/ojm--ant-design-icons-es-icons-FileOutlined.js +0 -7
  135. package/shell-dist/assets/ojm--ant-design-icons-es-icons-FileTextOutlined.js +0 -7
  136. package/shell-dist/assets/ojm--ant-design-icons-es-icons-FilterFilled.js +0 -7
  137. package/shell-dist/assets/ojm--ant-design-icons-es-icons-FolderOpenOutlined.js +0 -7
  138. package/shell-dist/assets/ojm--ant-design-icons-es-icons-FolderOutlined.js +0 -7
  139. package/shell-dist/assets/ojm--ant-design-icons-es-icons-HolderOutlined.js +0 -7
  140. package/shell-dist/assets/ojm--ant-design-icons-es-icons-InfoCircleFilled.js +0 -7
  141. package/shell-dist/assets/ojm--ant-design-icons-es-icons-LeftOutlined.js +0 -7
  142. package/shell-dist/assets/ojm--ant-design-icons-es-icons-LoadingOutlined.js +0 -7
  143. package/shell-dist/assets/ojm--ant-design-icons-es-icons-MinusOutlined.js +0 -7
  144. package/shell-dist/assets/ojm--ant-design-icons-es-icons-MinusSquareOutlined.js +0 -7
  145. package/shell-dist/assets/ojm--ant-design-icons-es-icons-PaperClipOutlined.js +0 -7
  146. package/shell-dist/assets/ojm--ant-design-icons-es-icons-PictureOutlined.js +0 -7
  147. package/shell-dist/assets/ojm--ant-design-icons-es-icons-PlusOutlined.js +0 -7
  148. package/shell-dist/assets/ojm--ant-design-icons-es-icons-PlusSquareOutlined.js +0 -7
  149. package/shell-dist/assets/ojm--ant-design-icons-es-icons-QuestionCircleOutlined.js +0 -7
  150. package/shell-dist/assets/ojm--ant-design-icons-es-icons-ReloadOutlined.js +0 -7
  151. package/shell-dist/assets/ojm--ant-design-icons-es-icons-RightOutlined.js +0 -7
  152. package/shell-dist/assets/ojm--ant-design-icons-es-icons-RotateLeftOutlined.js +0 -7
  153. package/shell-dist/assets/ojm--ant-design-icons-es-icons-RotateRightOutlined.js +0 -7
  154. package/shell-dist/assets/ojm--ant-design-icons-es-icons-SearchOutlined.js +0 -7
  155. package/shell-dist/assets/ojm--ant-design-icons-es-icons-StarFilled.js +0 -7
  156. package/shell-dist/assets/ojm--ant-design-icons-es-icons-SwapOutlined.js +0 -7
  157. package/shell-dist/assets/ojm--ant-design-icons-es-icons-SwapRightOutlined.js +0 -7
  158. package/shell-dist/assets/ojm--ant-design-icons-es-icons-UpOutlined.js +0 -7
  159. package/shell-dist/assets/ojm--ant-design-icons-es-icons-VerticalAlignTopOutlined.js +0 -7
  160. package/shell-dist/assets/ojm--ant-design-icons-es-icons-WarningFilled.js +0 -7
  161. package/shell-dist/assets/ojm--ant-design-icons-es-icons-ZoomInOutlined.js +0 -7
  162. package/shell-dist/assets/ojm--ant-design-icons-es-icons-ZoomOutOutlined.js +0 -7
  163. package/shell-dist/assets/ojm-dayjs-locale-zh-cn.js +0 -81
  164. package/shell-dist/assets/pinyin-pro.js +0 -25175
  165. package/shell-dist/assets/pro-components.js +0 -44627
  166. package/shell-dist/assets/react-countup.js +0 -525
  167. package/shell-dist/assets/react-dom-client.js +0 -12134
  168. package/shell-dist/assets/react-dom.js +0 -266
  169. package/shell-dist/assets/react-error-boundary.js +0 -141
  170. package/shell-dist/assets/react-i18next.js +0 -1773
  171. package/shell-dist/assets/react-jss.js +0 -4089
  172. package/shell-dist/assets/react-query.js +0 -3072
  173. package/shell-dist/assets/react-router-dom.js +0 -9927
  174. package/shell-dist/assets/react-router.js +0 -14584
  175. package/shell-dist/assets/react.js +0 -590
  176. package/shell-dist/assets/runtime.js +0 -28311
  177. package/shell-dist/assets/simplebar-react.js +0 -1119
  178. package/shell-dist/assets/spin-delay.js +0 -111
  179. package/shell-dist/assets/tailwind-merge.js +0 -3364
  180. package/shell-dist/assets/use-sync-external-store-shim.js +0 -130
  181. package/shell-dist/assets/zustand-middleware.js +0 -513
  182. package/shell-dist/assets/zustand-react-shallow.js +0 -27
  183. package/shell-dist/assets/zustand-react.js +0 -39
  184. package/shell-dist/assets/zustand-shallow.js +0 -22
  185. package/shell-dist/assets/zustand-vanilla-shallow.js +0 -71
  186. package/shell-dist/assets/zustand-vanilla.js +0 -40
  187. package/shell-dist/assets/zustand.js +0 -32
  188. /package/shell-dist/assets/{index-xZhmujjM.js → index.i0kqbxp050.js} +0 -0
  189. /package/shell-dist/assets/{nprogress-css.js → nprogress-css.1cq2pzkre0.js} +0 -0
  190. /package/shell-dist/assets/{ojm-antd-es-button.js → ojm-antd-es-button.2uriphio50.js} +0 -0
  191. /package/shell-dist/assets/{ojm-antd-es-modal.js → ojm-antd-es-modal.bf3tgdh8v0.js} +0 -0
  192. /package/shell-dist/assets/{ojm-antd-es-slider.js → ojm-antd-es-slider.xyvptuhid0.js} +0 -0
  193. /package/shell-dist/assets/{ojm-antd-es-upload.js → ojm-antd-es-upload.13gx45e0g0.js} +0 -0
@@ -1,1495 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- try {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- } catch (e) {
11
- throw mod = 0, e;
12
- }
13
- };
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
- // If the importer is in node compatibility mode or this is not an ESM
28
- // file that has been converted to a CommonJS file using a Babel-
29
- // compatible transform (i.e. "__esModule" has not been set), then set
30
- // "default" to the CommonJS "module.exports" for node compatibility.
31
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
- mod
33
- ));
34
-
35
- // ../../node_modules/.pnpm/normalize-wheel@1.0.1/node_modules/normalize-wheel/src/UserAgent_DEPRECATED.js
36
- var require_UserAgent_DEPRECATED = __commonJS({
37
- "../../node_modules/.pnpm/normalize-wheel@1.0.1/node_modules/normalize-wheel/src/UserAgent_DEPRECATED.js"(exports, module) {
38
- var _populated = false;
39
- var _ie;
40
- var _firefox;
41
- var _opera;
42
- var _webkit;
43
- var _chrome;
44
- var _ie_real_version;
45
- var _osx;
46
- var _windows;
47
- var _linux;
48
- var _android;
49
- var _win64;
50
- var _iphone;
51
- var _ipad;
52
- var _native;
53
- var _mobile;
54
- function _populate() {
55
- if (_populated) {
56
- return;
57
- }
58
- _populated = true;
59
- var uas = navigator.userAgent;
60
- var agent = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(uas);
61
- var os = /(Mac OS X)|(Windows)|(Linux)/.exec(uas);
62
- _iphone = /\b(iPhone|iP[ao]d)/.exec(uas);
63
- _ipad = /\b(iP[ao]d)/.exec(uas);
64
- _android = /Android/i.exec(uas);
65
- _native = /FBAN\/\w+;/i.exec(uas);
66
- _mobile = /Mobile/i.exec(uas);
67
- _win64 = !!/Win64/.exec(uas);
68
- if (agent) {
69
- _ie = agent[1] ? parseFloat(agent[1]) : agent[5] ? parseFloat(agent[5]) : NaN;
70
- if (_ie && document && document.documentMode) {
71
- _ie = document.documentMode;
72
- }
73
- var trident = /(?:Trident\/(\d+.\d+))/.exec(uas);
74
- _ie_real_version = trident ? parseFloat(trident[1]) + 4 : _ie;
75
- _firefox = agent[2] ? parseFloat(agent[2]) : NaN;
76
- _opera = agent[3] ? parseFloat(agent[3]) : NaN;
77
- _webkit = agent[4] ? parseFloat(agent[4]) : NaN;
78
- if (_webkit) {
79
- agent = /(?:Chrome\/(\d+\.\d+))/.exec(uas);
80
- _chrome = agent && agent[1] ? parseFloat(agent[1]) : NaN;
81
- } else {
82
- _chrome = NaN;
83
- }
84
- } else {
85
- _ie = _firefox = _opera = _chrome = _webkit = NaN;
86
- }
87
- if (os) {
88
- if (os[1]) {
89
- var ver = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(uas);
90
- _osx = ver ? parseFloat(ver[1].replace("_", ".")) : true;
91
- } else {
92
- _osx = false;
93
- }
94
- _windows = !!os[2];
95
- _linux = !!os[3];
96
- } else {
97
- _osx = _windows = _linux = false;
98
- }
99
- }
100
- var UserAgent_DEPRECATED = {
101
- /**
102
- * Check if the UA is Internet Explorer.
103
- *
104
- *
105
- * @return float|NaN Version number (if match) or NaN.
106
- */
107
- ie: function() {
108
- return _populate() || _ie;
109
- },
110
- /**
111
- * Check if we're in Internet Explorer compatibility mode.
112
- *
113
- * @return bool true if in compatibility mode, false if
114
- * not compatibility mode or not ie
115
- */
116
- ieCompatibilityMode: function() {
117
- return _populate() || _ie_real_version > _ie;
118
- },
119
- /**
120
- * Whether the browser is 64-bit IE. Really, this is kind of weak sauce; we
121
- * only need this because Skype can't handle 64-bit IE yet. We need to remove
122
- * this when we don't need it -- tracked by #601957.
123
- */
124
- ie64: function() {
125
- return UserAgent_DEPRECATED.ie() && _win64;
126
- },
127
- /**
128
- * Check if the UA is Firefox.
129
- *
130
- *
131
- * @return float|NaN Version number (if match) or NaN.
132
- */
133
- firefox: function() {
134
- return _populate() || _firefox;
135
- },
136
- /**
137
- * Check if the UA is Opera.
138
- *
139
- *
140
- * @return float|NaN Version number (if match) or NaN.
141
- */
142
- opera: function() {
143
- return _populate() || _opera;
144
- },
145
- /**
146
- * Check if the UA is WebKit.
147
- *
148
- *
149
- * @return float|NaN Version number (if match) or NaN.
150
- */
151
- webkit: function() {
152
- return _populate() || _webkit;
153
- },
154
- /**
155
- * For Push
156
- * WILL BE REMOVED VERY SOON. Use UserAgent_DEPRECATED.webkit
157
- */
158
- safari: function() {
159
- return UserAgent_DEPRECATED.webkit();
160
- },
161
- /**
162
- * Check if the UA is a Chrome browser.
163
- *
164
- *
165
- * @return float|NaN Version number (if match) or NaN.
166
- */
167
- chrome: function() {
168
- return _populate() || _chrome;
169
- },
170
- /**
171
- * Check if the user is running Windows.
172
- *
173
- * @return bool `true' if the user's OS is Windows.
174
- */
175
- windows: function() {
176
- return _populate() || _windows;
177
- },
178
- /**
179
- * Check if the user is running Mac OS X.
180
- *
181
- * @return float|bool Returns a float if a version number is detected,
182
- * otherwise true/false.
183
- */
184
- osx: function() {
185
- return _populate() || _osx;
186
- },
187
- /**
188
- * Check if the user is running Linux.
189
- *
190
- * @return bool `true' if the user's OS is some flavor of Linux.
191
- */
192
- linux: function() {
193
- return _populate() || _linux;
194
- },
195
- /**
196
- * Check if the user is running on an iPhone or iPod platform.
197
- *
198
- * @return bool `true' if the user is running some flavor of the
199
- * iPhone OS.
200
- */
201
- iphone: function() {
202
- return _populate() || _iphone;
203
- },
204
- mobile: function() {
205
- return _populate() || (_iphone || _ipad || _android || _mobile);
206
- },
207
- nativeApp: function() {
208
- return _populate() || _native;
209
- },
210
- android: function() {
211
- return _populate() || _android;
212
- },
213
- ipad: function() {
214
- return _populate() || _ipad;
215
- }
216
- };
217
- module.exports = UserAgent_DEPRECATED;
218
- }
219
- });
220
-
221
- // ../../node_modules/.pnpm/normalize-wheel@1.0.1/node_modules/normalize-wheel/src/ExecutionEnvironment.js
222
- var require_ExecutionEnvironment = __commonJS({
223
- "../../node_modules/.pnpm/normalize-wheel@1.0.1/node_modules/normalize-wheel/src/ExecutionEnvironment.js"(exports, module) {
224
- "use strict";
225
- var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
226
- var ExecutionEnvironment = {
227
- canUseDOM,
228
- canUseWorkers: typeof Worker !== "undefined",
229
- canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
230
- canUseViewport: canUseDOM && !!window.screen,
231
- isInWorker: !canUseDOM
232
- // For now, this is true - might change in the future.
233
- };
234
- module.exports = ExecutionEnvironment;
235
- }
236
- });
237
-
238
- // ../../node_modules/.pnpm/normalize-wheel@1.0.1/node_modules/normalize-wheel/src/isEventSupported.js
239
- var require_isEventSupported = __commonJS({
240
- "../../node_modules/.pnpm/normalize-wheel@1.0.1/node_modules/normalize-wheel/src/isEventSupported.js"(exports, module) {
241
- "use strict";
242
- var ExecutionEnvironment = require_ExecutionEnvironment();
243
- var useHasFeature;
244
- if (ExecutionEnvironment.canUseDOM) {
245
- useHasFeature = document.implementation && document.implementation.hasFeature && // always returns true in newer browsers as per the standard.
246
- // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
247
- document.implementation.hasFeature("", "") !== true;
248
- }
249
- function isEventSupported(eventNameSuffix, capture) {
250
- if (!ExecutionEnvironment.canUseDOM || capture && !("addEventListener" in document)) {
251
- return false;
252
- }
253
- var eventName = "on" + eventNameSuffix;
254
- var isSupported = eventName in document;
255
- if (!isSupported) {
256
- var element = document.createElement("div");
257
- element.setAttribute(eventName, "return;");
258
- isSupported = typeof element[eventName] === "function";
259
- }
260
- if (!isSupported && useHasFeature && eventNameSuffix === "wheel") {
261
- isSupported = document.implementation.hasFeature("Events.wheel", "3.0");
262
- }
263
- return isSupported;
264
- }
265
- module.exports = isEventSupported;
266
- }
267
- });
268
-
269
- // ../../node_modules/.pnpm/normalize-wheel@1.0.1/node_modules/normalize-wheel/src/normalizeWheel.js
270
- var require_normalizeWheel = __commonJS({
271
- "../../node_modules/.pnpm/normalize-wheel@1.0.1/node_modules/normalize-wheel/src/normalizeWheel.js"(exports, module) {
272
- "use strict";
273
- var UserAgent_DEPRECATED = require_UserAgent_DEPRECATED();
274
- var isEventSupported = require_isEventSupported();
275
- var PIXEL_STEP = 10;
276
- var LINE_HEIGHT = 40;
277
- var PAGE_HEIGHT = 800;
278
- function normalizeWheel2(event) {
279
- var sX = 0, sY = 0, pX = 0, pY = 0;
280
- if ("detail" in event) {
281
- sY = event.detail;
282
- }
283
- if ("wheelDelta" in event) {
284
- sY = -event.wheelDelta / 120;
285
- }
286
- if ("wheelDeltaY" in event) {
287
- sY = -event.wheelDeltaY / 120;
288
- }
289
- if ("wheelDeltaX" in event) {
290
- sX = -event.wheelDeltaX / 120;
291
- }
292
- if ("axis" in event && event.axis === event.HORIZONTAL_AXIS) {
293
- sX = sY;
294
- sY = 0;
295
- }
296
- pX = sX * PIXEL_STEP;
297
- pY = sY * PIXEL_STEP;
298
- if ("deltaY" in event) {
299
- pY = event.deltaY;
300
- }
301
- if ("deltaX" in event) {
302
- pX = event.deltaX;
303
- }
304
- if ((pX || pY) && event.deltaMode) {
305
- if (event.deltaMode == 1) {
306
- pX *= LINE_HEIGHT;
307
- pY *= LINE_HEIGHT;
308
- } else {
309
- pX *= PAGE_HEIGHT;
310
- pY *= PAGE_HEIGHT;
311
- }
312
- }
313
- if (pX && !sX) {
314
- sX = pX < 1 ? -1 : 1;
315
- }
316
- if (pY && !sY) {
317
- sY = pY < 1 ? -1 : 1;
318
- }
319
- return {
320
- spinX: sX,
321
- spinY: sY,
322
- pixelX: pX,
323
- pixelY: pY
324
- };
325
- }
326
- normalizeWheel2.getEventType = function() {
327
- return UserAgent_DEPRECATED.firefox() ? "DOMMouseScroll" : isEventSupported("wheel") ? "wheel" : "mousewheel";
328
- };
329
- module.exports = normalizeWheel2;
330
- }
331
- });
332
-
333
- // ../../node_modules/.pnpm/normalize-wheel@1.0.1/node_modules/normalize-wheel/index.js
334
- var require_normalize_wheel = __commonJS({
335
- "../../node_modules/.pnpm/normalize-wheel@1.0.1/node_modules/normalize-wheel/index.js"(exports, module) {
336
- module.exports = require_normalizeWheel();
337
- }
338
- });
339
-
340
- // ../../node_modules/.pnpm/antd-img-crop@4.30.0_antd@6.6.1_react-dom@19.2.8_react@19.2.8__react@19.2.8__react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/antd-img-crop/dist/antd-img-crop.esm.js
341
- var antd_img_crop_esm_exports = {};
342
- __export(antd_img_crop_esm_exports, {
343
- default: () => ImgCrop
344
- });
345
-
346
- // ../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
347
- var extendStatics = function(d, b) {
348
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
349
- d2.__proto__ = b2;
350
- } || function(d2, b2) {
351
- for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
352
- };
353
- return extendStatics(d, b);
354
- };
355
- function __extends(d, b) {
356
- if (typeof b !== "function" && b !== null)
357
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
358
- extendStatics(d, b);
359
- function __() {
360
- this.constructor = d;
361
- }
362
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
363
- }
364
- var __assign = function() {
365
- __assign = Object.assign || function __assign2(t) {
366
- for (var s, i = 1, n = arguments.length; i < n; i++) {
367
- s = arguments[i];
368
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
369
- }
370
- return t;
371
- };
372
- return __assign.apply(this, arguments);
373
- };
374
- function __rest(s, e) {
375
- var t = {};
376
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
377
- t[p] = s[p];
378
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
379
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
380
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
381
- t[p[i]] = s[p[i]];
382
- }
383
- return t;
384
- }
385
- function __awaiter(thisArg, _arguments, P, generator) {
386
- function adopt(value) {
387
- return value instanceof P ? value : new P(function(resolve) {
388
- resolve(value);
389
- });
390
- }
391
- return new (P || (P = Promise))(function(resolve, reject) {
392
- function fulfilled(value) {
393
- try {
394
- step(generator.next(value));
395
- } catch (e) {
396
- reject(e);
397
- }
398
- }
399
- function rejected(value) {
400
- try {
401
- step(generator["throw"](value));
402
- } catch (e) {
403
- reject(e);
404
- }
405
- }
406
- function step(result) {
407
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
408
- }
409
- step((generator = generator.apply(thisArg, _arguments || [])).next());
410
- });
411
- }
412
-
413
- // ../../node_modules/.pnpm/antd-img-crop@4.30.0_antd@6.6.1_react-dom@19.2.8_react@19.2.8__react@19.2.8__react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/antd-img-crop/dist/antd-img-crop.esm.js
414
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
415
- import { version } from "antd";
416
- import AntModal from "antd/es/modal";
417
- import AntUpload from "antd/es/upload";
418
- import { forwardRef, useState, useRef, useCallback, useImperativeHandle, memo, useMemo } from "react";
419
- import AntButton from "antd/es/button";
420
- import AntSlider from "antd/es/slider";
421
-
422
- // ../../node_modules/.pnpm/react-easy-crop@5.5.7_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-easy-crop/index.module.mjs
423
- var import_normalize_wheel = __toESM(require_normalize_wheel(), 1);
424
- import * as React from "react";
425
- function getCropSize(mediaWidth, mediaHeight, containerWidth, containerHeight, aspect, rotation) {
426
- if (rotation === void 0) {
427
- rotation = 0;
428
- }
429
- var _a = rotateSize(mediaWidth, mediaHeight, rotation), width = _a.width, height = _a.height;
430
- var fittingWidth = Math.min(width, containerWidth);
431
- var fittingHeight = Math.min(height, containerHeight);
432
- if (fittingWidth > fittingHeight * aspect) {
433
- return {
434
- width: fittingHeight * aspect,
435
- height: fittingHeight
436
- };
437
- }
438
- return {
439
- width: fittingWidth,
440
- height: fittingWidth / aspect
441
- };
442
- }
443
- function getMediaZoom(mediaSize) {
444
- return mediaSize.width > mediaSize.height ? mediaSize.width / mediaSize.naturalWidth : mediaSize.height / mediaSize.naturalHeight;
445
- }
446
- function restrictPosition(position, mediaSize, cropSize, zoom, rotation) {
447
- if (rotation === void 0) {
448
- rotation = 0;
449
- }
450
- var _a = rotateSize(mediaSize.width, mediaSize.height, rotation), width = _a.width, height = _a.height;
451
- return {
452
- x: restrictPositionCoord(position.x, width, cropSize.width, zoom),
453
- y: restrictPositionCoord(position.y, height, cropSize.height, zoom)
454
- };
455
- }
456
- function restrictPositionCoord(position, mediaSize, cropSize, zoom) {
457
- var maxPosition = Math.abs(mediaSize * zoom / 2 - cropSize / 2);
458
- return clamp(position, -maxPosition, maxPosition);
459
- }
460
- function getDistanceBetweenPoints(pointA, pointB) {
461
- return Math.sqrt(Math.pow(pointA.y - pointB.y, 2) + Math.pow(pointA.x - pointB.x, 2));
462
- }
463
- function getRotationBetweenPoints(pointA, pointB) {
464
- return Math.atan2(pointB.y - pointA.y, pointB.x - pointA.x) * 180 / Math.PI;
465
- }
466
- function computeCroppedArea(crop, mediaSize, cropSize, aspect, zoom, rotation, restrictPosition2) {
467
- if (rotation === void 0) {
468
- rotation = 0;
469
- }
470
- if (restrictPosition2 === void 0) {
471
- restrictPosition2 = true;
472
- }
473
- var limitAreaFn = restrictPosition2 ? limitArea : noOp;
474
- var mediaBBoxSize = rotateSize(mediaSize.width, mediaSize.height, rotation);
475
- var mediaNaturalBBoxSize = rotateSize(mediaSize.naturalWidth, mediaSize.naturalHeight, rotation);
476
- var croppedAreaPercentages = {
477
- x: limitAreaFn(100, ((mediaBBoxSize.width - cropSize.width / zoom) / 2 - crop.x / zoom) / mediaBBoxSize.width * 100),
478
- y: limitAreaFn(100, ((mediaBBoxSize.height - cropSize.height / zoom) / 2 - crop.y / zoom) / mediaBBoxSize.height * 100),
479
- width: limitAreaFn(100, cropSize.width / mediaBBoxSize.width * 100 / zoom),
480
- height: limitAreaFn(100, cropSize.height / mediaBBoxSize.height * 100 / zoom)
481
- };
482
- var widthInPixels = Math.round(limitAreaFn(mediaNaturalBBoxSize.width, croppedAreaPercentages.width * mediaNaturalBBoxSize.width / 100));
483
- var heightInPixels = Math.round(limitAreaFn(mediaNaturalBBoxSize.height, croppedAreaPercentages.height * mediaNaturalBBoxSize.height / 100));
484
- var isImgWiderThanHigh = mediaNaturalBBoxSize.width >= mediaNaturalBBoxSize.height * aspect;
485
- var sizePixels = isImgWiderThanHigh ? {
486
- width: Math.round(heightInPixels * aspect),
487
- height: heightInPixels
488
- } : {
489
- width: widthInPixels,
490
- height: Math.round(widthInPixels / aspect)
491
- };
492
- var croppedAreaPixels = __assign(__assign({}, sizePixels), {
493
- x: Math.round(limitAreaFn(mediaNaturalBBoxSize.width - sizePixels.width, croppedAreaPercentages.x * mediaNaturalBBoxSize.width / 100)),
494
- y: Math.round(limitAreaFn(mediaNaturalBBoxSize.height - sizePixels.height, croppedAreaPercentages.y * mediaNaturalBBoxSize.height / 100))
495
- });
496
- return {
497
- croppedAreaPercentages,
498
- croppedAreaPixels
499
- };
500
- }
501
- function limitArea(max, value) {
502
- return Math.min(max, Math.max(0, value));
503
- }
504
- function noOp(_max, value) {
505
- return value;
506
- }
507
- function getInitialCropFromCroppedAreaPercentages(croppedAreaPercentages, mediaSize, rotation, cropSize, minZoom, maxZoom) {
508
- var mediaBBoxSize = rotateSize(mediaSize.width, mediaSize.height, rotation);
509
- var zoom = clamp(cropSize.width / mediaBBoxSize.width * (100 / croppedAreaPercentages.width), minZoom, maxZoom);
510
- var crop = {
511
- x: zoom * mediaBBoxSize.width / 2 - cropSize.width / 2 - mediaBBoxSize.width * zoom * (croppedAreaPercentages.x / 100),
512
- y: zoom * mediaBBoxSize.height / 2 - cropSize.height / 2 - mediaBBoxSize.height * zoom * (croppedAreaPercentages.y / 100)
513
- };
514
- return {
515
- crop,
516
- zoom
517
- };
518
- }
519
- function getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize) {
520
- var mediaZoom = getMediaZoom(mediaSize);
521
- return cropSize.height > cropSize.width ? cropSize.height / (croppedAreaPixels.height * mediaZoom) : cropSize.width / (croppedAreaPixels.width * mediaZoom);
522
- }
523
- function getInitialCropFromCroppedAreaPixels(croppedAreaPixels, mediaSize, rotation, cropSize, minZoom, maxZoom) {
524
- if (rotation === void 0) {
525
- rotation = 0;
526
- }
527
- var mediaNaturalBBoxSize = rotateSize(mediaSize.naturalWidth, mediaSize.naturalHeight, rotation);
528
- var zoom = clamp(getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize), minZoom, maxZoom);
529
- var cropZoom = cropSize.height > cropSize.width ? cropSize.height / croppedAreaPixels.height : cropSize.width / croppedAreaPixels.width;
530
- var crop = {
531
- x: ((mediaNaturalBBoxSize.width - croppedAreaPixels.width) / 2 - croppedAreaPixels.x) * cropZoom,
532
- y: ((mediaNaturalBBoxSize.height - croppedAreaPixels.height) / 2 - croppedAreaPixels.y) * cropZoom
533
- };
534
- return {
535
- crop,
536
- zoom
537
- };
538
- }
539
- function getCenter(a, b) {
540
- return {
541
- x: (b.x + a.x) / 2,
542
- y: (b.y + a.y) / 2
543
- };
544
- }
545
- function getRadianAngle(degreeValue) {
546
- return degreeValue * Math.PI / 180;
547
- }
548
- function rotateSize(width, height, rotation) {
549
- var rotRad = getRadianAngle(rotation);
550
- return {
551
- width: Math.abs(Math.cos(rotRad) * width) + Math.abs(Math.sin(rotRad) * height),
552
- height: Math.abs(Math.sin(rotRad) * width) + Math.abs(Math.cos(rotRad) * height)
553
- };
554
- }
555
- function clamp(value, min, max) {
556
- return Math.min(Math.max(value, min), max);
557
- }
558
- function classNames() {
559
- var args = [];
560
- for (var _i = 0; _i < arguments.length; _i++) {
561
- args[_i] = arguments[_i];
562
- }
563
- return args.filter(function(value) {
564
- if (typeof value === "string" && value.length > 0) {
565
- return true;
566
- }
567
- return false;
568
- }).join(" ").trim();
569
- }
570
- var css_248z = ".reactEasyCrop_Container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n user-select: none;\n touch-action: none;\n cursor: move;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\n will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\n}\n\n.reactEasyCrop_Contain {\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n}\n.reactEasyCrop_Cover_Horizontal {\n width: 100%;\n height: auto;\n}\n.reactEasyCrop_Cover_Vertical {\n width: auto;\n height: 100%;\n}\n\n.reactEasyCrop_CropArea {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n border: 1px solid rgba(255, 255, 255, 0.5);\n box-sizing: border-box;\n box-shadow: 0 0 0 9999em;\n color: rgba(0, 0, 0, 0.5);\n overflow: hidden;\n}\n\n.reactEasyCrop_CropAreaRound {\n border-radius: 50%;\n}\n\n.reactEasyCrop_CropAreaGrid::before {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 0;\n bottom: 0;\n left: 33.33%;\n right: 33.33%;\n border-top: 0;\n border-bottom: 0;\n}\n\n.reactEasyCrop_CropAreaGrid::after {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 33.33%;\n bottom: 33.33%;\n left: 0;\n right: 0;\n border-left: 0;\n border-right: 0;\n}\n";
571
- var MIN_ZOOM = 1;
572
- var MAX_ZOOM = 3;
573
- var KEYBOARD_STEP = 1;
574
- var Cropper = (
575
- /** @class */
576
- (function(_super) {
577
- __extends(Cropper2, _super);
578
- function Cropper2() {
579
- var _this = _super !== null && _super.apply(this, arguments) || this;
580
- _this.cropperRef = React.createRef();
581
- _this.imageRef = React.createRef();
582
- _this.videoRef = React.createRef();
583
- _this.containerPosition = {
584
- x: 0,
585
- y: 0
586
- };
587
- _this.containerRef = null;
588
- _this.styleRef = null;
589
- _this.containerRect = null;
590
- _this.mediaSize = {
591
- width: 0,
592
- height: 0,
593
- naturalWidth: 0,
594
- naturalHeight: 0
595
- };
596
- _this.dragStartPosition = {
597
- x: 0,
598
- y: 0
599
- };
600
- _this.dragStartCrop = {
601
- x: 0,
602
- y: 0
603
- };
604
- _this.gestureZoomStart = 0;
605
- _this.gestureRotationStart = 0;
606
- _this.isTouching = false;
607
- _this.lastPinchDistance = 0;
608
- _this.lastPinchRotation = 0;
609
- _this.rafDragTimeout = null;
610
- _this.rafPinchTimeout = null;
611
- _this.wheelTimer = null;
612
- _this.currentDoc = typeof document !== "undefined" ? document : null;
613
- _this.currentWindow = typeof window !== "undefined" ? window : null;
614
- _this.resizeObserver = null;
615
- _this.previousCropSize = null;
616
- _this.isInitialized = false;
617
- _this.state = {
618
- cropSize: null,
619
- hasWheelJustStarted: false,
620
- mediaObjectFit: void 0
621
- };
622
- _this.initResizeObserver = function() {
623
- if (typeof window.ResizeObserver === "undefined" || !_this.containerRef) {
624
- return;
625
- }
626
- var isFirstResize = true;
627
- _this.resizeObserver = new window.ResizeObserver(function(entries) {
628
- if (isFirstResize) {
629
- isFirstResize = false;
630
- return;
631
- }
632
- _this.computeSizes();
633
- });
634
- _this.resizeObserver.observe(_this.containerRef);
635
- };
636
- _this.preventZoomSafari = function(e) {
637
- return e.preventDefault();
638
- };
639
- _this.cleanEvents = function() {
640
- if (!_this.currentDoc) return;
641
- _this.currentDoc.removeEventListener("mousemove", _this.onMouseMove);
642
- _this.currentDoc.removeEventListener("mouseup", _this.onDragStopped);
643
- _this.currentDoc.removeEventListener("touchmove", _this.onTouchMove);
644
- _this.currentDoc.removeEventListener("touchend", _this.onDragStopped);
645
- _this.currentDoc.removeEventListener("gesturechange", _this.onGestureChange);
646
- _this.currentDoc.removeEventListener("gestureend", _this.onGestureEnd);
647
- _this.currentDoc.removeEventListener("scroll", _this.onScroll);
648
- };
649
- _this.clearScrollEvent = function() {
650
- if (_this.containerRef) _this.containerRef.removeEventListener("wheel", _this.onWheel);
651
- if (_this.wheelTimer) {
652
- clearTimeout(_this.wheelTimer);
653
- }
654
- };
655
- _this.onMediaLoad = function() {
656
- var cropSize = _this.computeSizes();
657
- if (cropSize) {
658
- _this.previousCropSize = cropSize;
659
- _this.emitCropData();
660
- _this.setInitialCrop(cropSize);
661
- _this.isInitialized = true;
662
- }
663
- if (_this.props.onMediaLoaded) {
664
- _this.props.onMediaLoaded(_this.mediaSize);
665
- }
666
- };
667
- _this.setInitialCrop = function(cropSize) {
668
- if (_this.props.initialCroppedAreaPercentages) {
669
- var _a = getInitialCropFromCroppedAreaPercentages(_this.props.initialCroppedAreaPercentages, _this.mediaSize, _this.props.rotation, cropSize, _this.props.minZoom, _this.props.maxZoom), crop = _a.crop, zoom = _a.zoom;
670
- _this.props.onCropChange(crop);
671
- _this.props.onZoomChange && _this.props.onZoomChange(zoom);
672
- } else if (_this.props.initialCroppedAreaPixels) {
673
- var _b = getInitialCropFromCroppedAreaPixels(_this.props.initialCroppedAreaPixels, _this.mediaSize, _this.props.rotation, cropSize, _this.props.minZoom, _this.props.maxZoom), crop = _b.crop, zoom = _b.zoom;
674
- _this.props.onCropChange(crop);
675
- _this.props.onZoomChange && _this.props.onZoomChange(zoom);
676
- }
677
- };
678
- _this.computeSizes = function() {
679
- var _a, _b, _c, _d, _e, _f;
680
- var mediaRef = _this.imageRef.current || _this.videoRef.current;
681
- if (mediaRef && _this.containerRef) {
682
- _this.containerRect = _this.containerRef.getBoundingClientRect();
683
- _this.saveContainerPosition();
684
- var containerAspect = _this.containerRect.width / _this.containerRect.height;
685
- var naturalWidth = ((_a = _this.imageRef.current) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = _this.videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0;
686
- var naturalHeight = ((_c = _this.imageRef.current) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = _this.videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0;
687
- var isMediaScaledDown = mediaRef.offsetWidth < naturalWidth || mediaRef.offsetHeight < naturalHeight;
688
- var mediaAspect = naturalWidth / naturalHeight;
689
- var renderedMediaSize = void 0;
690
- if (isMediaScaledDown) {
691
- switch (_this.state.mediaObjectFit) {
692
- default:
693
- case "contain":
694
- renderedMediaSize = containerAspect > mediaAspect ? {
695
- width: _this.containerRect.height * mediaAspect,
696
- height: _this.containerRect.height
697
- } : {
698
- width: _this.containerRect.width,
699
- height: _this.containerRect.width / mediaAspect
700
- };
701
- break;
702
- case "horizontal-cover":
703
- renderedMediaSize = {
704
- width: _this.containerRect.width,
705
- height: _this.containerRect.width / mediaAspect
706
- };
707
- break;
708
- case "vertical-cover":
709
- renderedMediaSize = {
710
- width: _this.containerRect.height * mediaAspect,
711
- height: _this.containerRect.height
712
- };
713
- break;
714
- }
715
- } else {
716
- renderedMediaSize = {
717
- width: mediaRef.offsetWidth,
718
- height: mediaRef.offsetHeight
719
- };
720
- }
721
- _this.mediaSize = __assign(__assign({}, renderedMediaSize), {
722
- naturalWidth,
723
- naturalHeight
724
- });
725
- if (_this.props.setMediaSize) {
726
- _this.props.setMediaSize(_this.mediaSize);
727
- }
728
- var cropSize = _this.props.cropSize ? _this.props.cropSize : getCropSize(_this.mediaSize.width, _this.mediaSize.height, _this.containerRect.width, _this.containerRect.height, _this.props.aspect, _this.props.rotation);
729
- if (((_e = _this.state.cropSize) === null || _e === void 0 ? void 0 : _e.height) !== cropSize.height || ((_f = _this.state.cropSize) === null || _f === void 0 ? void 0 : _f.width) !== cropSize.width) {
730
- _this.props.onCropSizeChange && _this.props.onCropSizeChange(cropSize);
731
- }
732
- _this.setState({
733
- cropSize
734
- }, _this.recomputeCropPosition);
735
- if (_this.props.setCropSize) {
736
- _this.props.setCropSize(cropSize);
737
- }
738
- return cropSize;
739
- }
740
- };
741
- _this.saveContainerPosition = function() {
742
- if (_this.containerRef) {
743
- var bounds = _this.containerRef.getBoundingClientRect();
744
- _this.containerPosition = {
745
- x: bounds.left,
746
- y: bounds.top
747
- };
748
- }
749
- };
750
- _this.onMouseDown = function(e) {
751
- if (!_this.currentDoc) return;
752
- e.preventDefault();
753
- _this.currentDoc.addEventListener("mousemove", _this.onMouseMove);
754
- _this.currentDoc.addEventListener("mouseup", _this.onDragStopped);
755
- _this.saveContainerPosition();
756
- _this.onDragStart(Cropper2.getMousePoint(e));
757
- };
758
- _this.onMouseMove = function(e) {
759
- return _this.onDrag(Cropper2.getMousePoint(e));
760
- };
761
- _this.onScroll = function(e) {
762
- if (!_this.currentDoc) return;
763
- e.preventDefault();
764
- _this.saveContainerPosition();
765
- };
766
- _this.onTouchStart = function(e) {
767
- if (!_this.currentDoc) return;
768
- _this.isTouching = true;
769
- if (_this.props.onTouchRequest && !_this.props.onTouchRequest(e)) {
770
- return;
771
- }
772
- _this.currentDoc.addEventListener("touchmove", _this.onTouchMove, {
773
- passive: false
774
- });
775
- _this.currentDoc.addEventListener("touchend", _this.onDragStopped);
776
- _this.saveContainerPosition();
777
- if (e.touches.length === 2) {
778
- _this.onPinchStart(e);
779
- } else if (e.touches.length === 1) {
780
- _this.onDragStart(Cropper2.getTouchPoint(e.touches[0]));
781
- }
782
- };
783
- _this.onTouchMove = function(e) {
784
- e.preventDefault();
785
- if (e.touches.length === 2) {
786
- _this.onPinchMove(e);
787
- } else if (e.touches.length === 1) {
788
- _this.onDrag(Cropper2.getTouchPoint(e.touches[0]));
789
- }
790
- };
791
- _this.onGestureStart = function(e) {
792
- if (!_this.currentDoc) return;
793
- e.preventDefault();
794
- _this.currentDoc.addEventListener("gesturechange", _this.onGestureChange);
795
- _this.currentDoc.addEventListener("gestureend", _this.onGestureEnd);
796
- _this.gestureZoomStart = _this.props.zoom;
797
- _this.gestureRotationStart = _this.props.rotation;
798
- };
799
- _this.onGestureChange = function(e) {
800
- e.preventDefault();
801
- if (_this.isTouching) {
802
- return;
803
- }
804
- var point = Cropper2.getMousePoint(e);
805
- var newZoom = _this.gestureZoomStart - 1 + e.scale;
806
- _this.setNewZoom(newZoom, point, {
807
- shouldUpdatePosition: true
808
- });
809
- if (_this.props.onRotationChange) {
810
- var newRotation = _this.gestureRotationStart + e.rotation;
811
- _this.props.onRotationChange(newRotation);
812
- }
813
- };
814
- _this.onGestureEnd = function(e) {
815
- _this.cleanEvents();
816
- };
817
- _this.onDragStart = function(_a) {
818
- var _b, _c;
819
- var x = _a.x, y = _a.y;
820
- _this.dragStartPosition = {
821
- x,
822
- y
823
- };
824
- _this.dragStartCrop = __assign({}, _this.props.crop);
825
- (_c = (_b = _this.props).onInteractionStart) === null || _c === void 0 ? void 0 : _c.call(_b);
826
- };
827
- _this.onDrag = function(_a) {
828
- var x = _a.x, y = _a.y;
829
- if (!_this.currentWindow) return;
830
- if (_this.rafDragTimeout) _this.currentWindow.cancelAnimationFrame(_this.rafDragTimeout);
831
- _this.rafDragTimeout = _this.currentWindow.requestAnimationFrame(function() {
832
- if (!_this.state.cropSize) return;
833
- if (x === void 0 || y === void 0) return;
834
- var offsetX = x - _this.dragStartPosition.x;
835
- var offsetY = y - _this.dragStartPosition.y;
836
- var requestedPosition = {
837
- x: _this.dragStartCrop.x + offsetX,
838
- y: _this.dragStartCrop.y + offsetY
839
- };
840
- var newPosition = _this.props.restrictPosition ? restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : requestedPosition;
841
- _this.props.onCropChange(newPosition);
842
- });
843
- };
844
- _this.onDragStopped = function() {
845
- var _a, _b;
846
- _this.isTouching = false;
847
- _this.cleanEvents();
848
- _this.emitCropData();
849
- (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a);
850
- };
851
- _this.onWheel = function(e) {
852
- if (!_this.currentWindow) return;
853
- if (_this.props.onWheelRequest && !_this.props.onWheelRequest(e)) {
854
- return;
855
- }
856
- e.preventDefault();
857
- var point = Cropper2.getMousePoint(e);
858
- var pixelY = (0, import_normalize_wheel.default)(e).pixelY;
859
- var newZoom = _this.props.zoom - pixelY * _this.props.zoomSpeed / 200;
860
- _this.setNewZoom(newZoom, point, {
861
- shouldUpdatePosition: true
862
- });
863
- if (!_this.state.hasWheelJustStarted) {
864
- _this.setState({
865
- hasWheelJustStarted: true
866
- }, function() {
867
- var _a, _b;
868
- return (_b = (_a = _this.props).onInteractionStart) === null || _b === void 0 ? void 0 : _b.call(_a);
869
- });
870
- }
871
- if (_this.wheelTimer) {
872
- clearTimeout(_this.wheelTimer);
873
- }
874
- _this.wheelTimer = _this.currentWindow.setTimeout(function() {
875
- return _this.setState({
876
- hasWheelJustStarted: false
877
- }, function() {
878
- var _a, _b;
879
- return (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a);
880
- });
881
- }, 250);
882
- };
883
- _this.getPointOnContainer = function(_a, containerTopLeft) {
884
- var x = _a.x, y = _a.y;
885
- if (!_this.containerRect) {
886
- throw new Error("The Cropper is not mounted");
887
- }
888
- return {
889
- x: _this.containerRect.width / 2 - (x - containerTopLeft.x),
890
- y: _this.containerRect.height / 2 - (y - containerTopLeft.y)
891
- };
892
- };
893
- _this.getPointOnMedia = function(_a) {
894
- var x = _a.x, y = _a.y;
895
- var _b = _this.props, crop = _b.crop, zoom = _b.zoom;
896
- return {
897
- x: (x + crop.x) / zoom,
898
- y: (y + crop.y) / zoom
899
- };
900
- };
901
- _this.setNewZoom = function(zoom, point, _a) {
902
- var _b = _a === void 0 ? {} : _a, _c = _b.shouldUpdatePosition, shouldUpdatePosition = _c === void 0 ? true : _c;
903
- if (!_this.state.cropSize || !_this.props.onZoomChange) return;
904
- var newZoom = clamp(zoom, _this.props.minZoom, _this.props.maxZoom);
905
- if (shouldUpdatePosition) {
906
- var zoomPoint = _this.getPointOnContainer(point, _this.containerPosition);
907
- var zoomTarget = _this.getPointOnMedia(zoomPoint);
908
- var requestedPosition = {
909
- x: zoomTarget.x * newZoom - zoomPoint.x,
910
- y: zoomTarget.y * newZoom - zoomPoint.y
911
- };
912
- var newPosition = _this.props.restrictPosition ? restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, newZoom, _this.props.rotation) : requestedPosition;
913
- _this.props.onCropChange(newPosition);
914
- }
915
- _this.props.onZoomChange(newZoom);
916
- };
917
- _this.getCropData = function() {
918
- if (!_this.state.cropSize) {
919
- return null;
920
- }
921
- var restrictedPosition = _this.props.restrictPosition ? restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop;
922
- return computeCroppedArea(restrictedPosition, _this.mediaSize, _this.state.cropSize, _this.getAspect(), _this.props.zoom, _this.props.rotation, _this.props.restrictPosition);
923
- };
924
- _this.emitCropData = function() {
925
- var cropData = _this.getCropData();
926
- if (!cropData) return;
927
- var croppedAreaPercentages = cropData.croppedAreaPercentages, croppedAreaPixels = cropData.croppedAreaPixels;
928
- if (_this.props.onCropComplete) {
929
- _this.props.onCropComplete(croppedAreaPercentages, croppedAreaPixels);
930
- }
931
- if (_this.props.onCropAreaChange) {
932
- _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels);
933
- }
934
- };
935
- _this.emitCropAreaChange = function() {
936
- var cropData = _this.getCropData();
937
- if (!cropData) return;
938
- var croppedAreaPercentages = cropData.croppedAreaPercentages, croppedAreaPixels = cropData.croppedAreaPixels;
939
- if (_this.props.onCropAreaChange) {
940
- _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels);
941
- }
942
- };
943
- _this.recomputeCropPosition = function() {
944
- var _a, _b;
945
- if (!_this.state.cropSize) return;
946
- var adjustedCrop = _this.props.crop;
947
- if (_this.isInitialized && ((_a = _this.previousCropSize) === null || _a === void 0 ? void 0 : _a.width) && ((_b = _this.previousCropSize) === null || _b === void 0 ? void 0 : _b.height)) {
948
- var sizeChanged = Math.abs(_this.previousCropSize.width - _this.state.cropSize.width) > 1e-6 || Math.abs(_this.previousCropSize.height - _this.state.cropSize.height) > 1e-6;
949
- if (sizeChanged) {
950
- var scaleX = _this.state.cropSize.width / _this.previousCropSize.width;
951
- var scaleY = _this.state.cropSize.height / _this.previousCropSize.height;
952
- adjustedCrop = {
953
- x: _this.props.crop.x * scaleX,
954
- y: _this.props.crop.y * scaleY
955
- };
956
- }
957
- }
958
- var newPosition = _this.props.restrictPosition ? restrictPosition(adjustedCrop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : adjustedCrop;
959
- _this.previousCropSize = _this.state.cropSize;
960
- _this.props.onCropChange(newPosition);
961
- _this.emitCropData();
962
- };
963
- _this.onKeyDown = function(event) {
964
- var _a, _b;
965
- var _c = _this.props, crop = _c.crop, onCropChange = _c.onCropChange, keyboardStep = _c.keyboardStep, zoom = _c.zoom, rotation = _c.rotation;
966
- var step = keyboardStep;
967
- if (!_this.state.cropSize) return;
968
- if (event.shiftKey) {
969
- step *= 0.2;
970
- }
971
- var newCrop = __assign({}, crop);
972
- switch (event.key) {
973
- case "ArrowUp":
974
- newCrop.y -= step;
975
- event.preventDefault();
976
- break;
977
- case "ArrowDown":
978
- newCrop.y += step;
979
- event.preventDefault();
980
- break;
981
- case "ArrowLeft":
982
- newCrop.x -= step;
983
- event.preventDefault();
984
- break;
985
- case "ArrowRight":
986
- newCrop.x += step;
987
- event.preventDefault();
988
- break;
989
- default:
990
- return;
991
- }
992
- if (_this.props.restrictPosition) {
993
- newCrop = restrictPosition(newCrop, _this.mediaSize, _this.state.cropSize, zoom, rotation);
994
- }
995
- if (!event.repeat) {
996
- (_b = (_a = _this.props).onInteractionStart) === null || _b === void 0 ? void 0 : _b.call(_a);
997
- }
998
- onCropChange(newCrop);
999
- };
1000
- _this.onKeyUp = function(event) {
1001
- var _a, _b;
1002
- switch (event.key) {
1003
- case "ArrowUp":
1004
- case "ArrowDown":
1005
- case "ArrowLeft":
1006
- case "ArrowRight":
1007
- event.preventDefault();
1008
- break;
1009
- default:
1010
- return;
1011
- }
1012
- _this.emitCropData();
1013
- (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a);
1014
- };
1015
- return _this;
1016
- }
1017
- Cropper2.prototype.componentDidMount = function() {
1018
- if (!this.currentDoc || !this.currentWindow) return;
1019
- if (this.containerRef) {
1020
- if (this.containerRef.ownerDocument) {
1021
- this.currentDoc = this.containerRef.ownerDocument;
1022
- }
1023
- if (this.currentDoc.defaultView) {
1024
- this.currentWindow = this.currentDoc.defaultView;
1025
- }
1026
- this.initResizeObserver();
1027
- if (typeof window.ResizeObserver === "undefined") {
1028
- this.currentWindow.addEventListener("resize", this.computeSizes);
1029
- }
1030
- this.props.zoomWithScroll && this.containerRef.addEventListener("wheel", this.onWheel, {
1031
- passive: false
1032
- });
1033
- this.containerRef.addEventListener("gesturestart", this.onGestureStart);
1034
- }
1035
- this.currentDoc.addEventListener("scroll", this.onScroll);
1036
- if (!this.props.disableAutomaticStylesInjection) {
1037
- this.styleRef = this.currentDoc.createElement("style");
1038
- this.styleRef.setAttribute("type", "text/css");
1039
- if (this.props.nonce) {
1040
- this.styleRef.setAttribute("nonce", this.props.nonce);
1041
- }
1042
- this.styleRef.innerHTML = css_248z;
1043
- this.currentDoc.head.appendChild(this.styleRef);
1044
- }
1045
- if (this.imageRef.current && this.imageRef.current.complete) {
1046
- this.onMediaLoad();
1047
- }
1048
- if (this.props.setImageRef) {
1049
- this.props.setImageRef(this.imageRef);
1050
- }
1051
- if (this.props.setVideoRef) {
1052
- this.props.setVideoRef(this.videoRef);
1053
- }
1054
- if (this.props.setCropperRef) {
1055
- this.props.setCropperRef(this.cropperRef);
1056
- }
1057
- };
1058
- Cropper2.prototype.componentWillUnmount = function() {
1059
- var _a, _b;
1060
- if (!this.currentDoc || !this.currentWindow) return;
1061
- if (typeof window.ResizeObserver === "undefined") {
1062
- this.currentWindow.removeEventListener("resize", this.computeSizes);
1063
- }
1064
- (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
1065
- if (this.containerRef) {
1066
- this.containerRef.removeEventListener("gesturestart", this.preventZoomSafari);
1067
- }
1068
- if (this.styleRef) {
1069
- (_b = this.styleRef.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(this.styleRef);
1070
- }
1071
- this.cleanEvents();
1072
- this.props.zoomWithScroll && this.clearScrollEvent();
1073
- };
1074
- Cropper2.prototype.componentDidUpdate = function(prevProps) {
1075
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1076
- if (prevProps.rotation !== this.props.rotation) {
1077
- this.computeSizes();
1078
- this.recomputeCropPosition();
1079
- } else if (prevProps.aspect !== this.props.aspect) {
1080
- this.computeSizes();
1081
- } else if (prevProps.objectFit !== this.props.objectFit) {
1082
- this.computeSizes();
1083
- } else if (prevProps.zoom !== this.props.zoom) {
1084
- this.recomputeCropPosition();
1085
- } else if (((_a = prevProps.cropSize) === null || _a === void 0 ? void 0 : _a.height) !== ((_b = this.props.cropSize) === null || _b === void 0 ? void 0 : _b.height) || ((_c = prevProps.cropSize) === null || _c === void 0 ? void 0 : _c.width) !== ((_d = this.props.cropSize) === null || _d === void 0 ? void 0 : _d.width)) {
1086
- this.computeSizes();
1087
- } else if (((_e = prevProps.crop) === null || _e === void 0 ? void 0 : _e.x) !== ((_f = this.props.crop) === null || _f === void 0 ? void 0 : _f.x) || ((_g = prevProps.crop) === null || _g === void 0 ? void 0 : _g.y) !== ((_h = this.props.crop) === null || _h === void 0 ? void 0 : _h.y)) {
1088
- this.emitCropAreaChange();
1089
- }
1090
- if (prevProps.zoomWithScroll !== this.props.zoomWithScroll && this.containerRef) {
1091
- this.props.zoomWithScroll ? this.containerRef.addEventListener("wheel", this.onWheel, {
1092
- passive: false
1093
- }) : this.clearScrollEvent();
1094
- }
1095
- if (prevProps.video !== this.props.video) {
1096
- (_j = this.videoRef.current) === null || _j === void 0 ? void 0 : _j.load();
1097
- }
1098
- var objectFit = this.getObjectFit();
1099
- if (objectFit !== this.state.mediaObjectFit) {
1100
- this.setState({
1101
- mediaObjectFit: objectFit
1102
- }, this.computeSizes);
1103
- }
1104
- };
1105
- Cropper2.prototype.getAspect = function() {
1106
- var _a = this.props, cropSize = _a.cropSize, aspect = _a.aspect;
1107
- if (cropSize) {
1108
- return cropSize.width / cropSize.height;
1109
- }
1110
- return aspect;
1111
- };
1112
- Cropper2.prototype.getObjectFit = function() {
1113
- var _a, _b, _c, _d;
1114
- if (this.props.objectFit === "cover") {
1115
- var mediaRef = this.imageRef.current || this.videoRef.current;
1116
- if (mediaRef && this.containerRef) {
1117
- this.containerRect = this.containerRef.getBoundingClientRect();
1118
- var containerAspect = this.containerRect.width / this.containerRect.height;
1119
- var naturalWidth = ((_a = this.imageRef.current) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = this.videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0;
1120
- var naturalHeight = ((_c = this.imageRef.current) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = this.videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0;
1121
- var mediaAspect = naturalWidth / naturalHeight;
1122
- return mediaAspect < containerAspect ? "horizontal-cover" : "vertical-cover";
1123
- }
1124
- return "horizontal-cover";
1125
- }
1126
- return this.props.objectFit;
1127
- };
1128
- Cropper2.prototype.onPinchStart = function(e) {
1129
- var pointA = Cropper2.getTouchPoint(e.touches[0]);
1130
- var pointB = Cropper2.getTouchPoint(e.touches[1]);
1131
- this.lastPinchDistance = getDistanceBetweenPoints(pointA, pointB);
1132
- this.lastPinchRotation = getRotationBetweenPoints(pointA, pointB);
1133
- this.onDragStart(getCenter(pointA, pointB));
1134
- };
1135
- Cropper2.prototype.onPinchMove = function(e) {
1136
- var _this = this;
1137
- if (!this.currentDoc || !this.currentWindow) return;
1138
- var pointA = Cropper2.getTouchPoint(e.touches[0]);
1139
- var pointB = Cropper2.getTouchPoint(e.touches[1]);
1140
- var center = getCenter(pointA, pointB);
1141
- this.onDrag(center);
1142
- if (this.rafPinchTimeout) this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout);
1143
- this.rafPinchTimeout = this.currentWindow.requestAnimationFrame(function() {
1144
- var distance = getDistanceBetweenPoints(pointA, pointB);
1145
- var newZoom = _this.props.zoom * (distance / _this.lastPinchDistance);
1146
- _this.setNewZoom(newZoom, center, {
1147
- shouldUpdatePosition: false
1148
- });
1149
- _this.lastPinchDistance = distance;
1150
- var rotation = getRotationBetweenPoints(pointA, pointB);
1151
- var newRotation = _this.props.rotation + (rotation - _this.lastPinchRotation);
1152
- _this.props.onRotationChange && _this.props.onRotationChange(newRotation);
1153
- _this.lastPinchRotation = rotation;
1154
- });
1155
- };
1156
- Cropper2.prototype.render = function() {
1157
- var _this = this;
1158
- var _a;
1159
- var _b = this.props, image = _b.image, video = _b.video, mediaProps = _b.mediaProps, cropperProps = _b.cropperProps, transform = _b.transform, _c = _b.crop, x = _c.x, y = _c.y, rotation = _b.rotation, zoom = _b.zoom, cropShape = _b.cropShape, showGrid = _b.showGrid, roundCropAreaPixels = _b.roundCropAreaPixels, _d = _b.style, containerStyle = _d.containerStyle, cropAreaStyle = _d.cropAreaStyle, mediaStyle = _d.mediaStyle, _e = _b.classes, containerClassName = _e.containerClassName, cropAreaClassName = _e.cropAreaClassName, mediaClassName = _e.mediaClassName;
1160
- var objectFit = (_a = this.state.mediaObjectFit) !== null && _a !== void 0 ? _a : this.getObjectFit();
1161
- return React.createElement("div", {
1162
- onMouseDown: this.onMouseDown,
1163
- onTouchStart: this.onTouchStart,
1164
- ref: function ref(el) {
1165
- return _this.containerRef = el;
1166
- },
1167
- "data-testid": "container",
1168
- style: containerStyle,
1169
- className: classNames("reactEasyCrop_Container", containerClassName)
1170
- }, image ? React.createElement("img", __assign({
1171
- alt: "",
1172
- className: classNames("reactEasyCrop_Image", objectFit === "contain" && "reactEasyCrop_Contain", objectFit === "horizontal-cover" && "reactEasyCrop_Cover_Horizontal", objectFit === "vertical-cover" && "reactEasyCrop_Cover_Vertical", mediaClassName)
1173
- }, mediaProps, {
1174
- src: image,
1175
- ref: this.imageRef,
1176
- style: __assign(__assign({}, mediaStyle), {
1177
- transform: transform || "translate(".concat(x, "px, ").concat(y, "px) rotate(").concat(rotation, "deg) scale(").concat(zoom, ")")
1178
- }),
1179
- onLoad: this.onMediaLoad
1180
- })) : video && React.createElement("video", __assign({
1181
- autoPlay: true,
1182
- playsInline: true,
1183
- loop: true,
1184
- muted: true,
1185
- className: classNames("reactEasyCrop_Video", objectFit === "contain" && "reactEasyCrop_Contain", objectFit === "horizontal-cover" && "reactEasyCrop_Cover_Horizontal", objectFit === "vertical-cover" && "reactEasyCrop_Cover_Vertical", mediaClassName)
1186
- }, mediaProps, {
1187
- ref: this.videoRef,
1188
- onLoadedMetadata: this.onMediaLoad,
1189
- style: __assign(__assign({}, mediaStyle), {
1190
- transform: transform || "translate(".concat(x, "px, ").concat(y, "px) rotate(").concat(rotation, "deg) scale(").concat(zoom, ")")
1191
- }),
1192
- controls: false
1193
- }), (Array.isArray(video) ? video : [{
1194
- src: video
1195
- }]).map(function(item) {
1196
- return React.createElement("source", __assign({
1197
- key: item.src
1198
- }, item));
1199
- })), this.state.cropSize && React.createElement("div", __assign({
1200
- ref: this.cropperRef,
1201
- style: __assign(__assign({}, cropAreaStyle), {
1202
- width: roundCropAreaPixels ? Math.round(this.state.cropSize.width) : this.state.cropSize.width,
1203
- height: roundCropAreaPixels ? Math.round(this.state.cropSize.height) : this.state.cropSize.height
1204
- }),
1205
- tabIndex: 0,
1206
- onKeyDown: this.onKeyDown,
1207
- onKeyUp: this.onKeyUp,
1208
- "data-testid": "cropper",
1209
- className: classNames("reactEasyCrop_CropArea", cropShape === "round" && "reactEasyCrop_CropAreaRound", showGrid && "reactEasyCrop_CropAreaGrid", cropAreaClassName)
1210
- }, cropperProps)));
1211
- };
1212
- Cropper2.defaultProps = {
1213
- zoom: 1,
1214
- rotation: 0,
1215
- aspect: 4 / 3,
1216
- maxZoom: MAX_ZOOM,
1217
- minZoom: MIN_ZOOM,
1218
- cropShape: "rect",
1219
- objectFit: "contain",
1220
- showGrid: true,
1221
- style: {},
1222
- classes: {},
1223
- mediaProps: {},
1224
- cropperProps: {},
1225
- zoomSpeed: 1,
1226
- restrictPosition: true,
1227
- zoomWithScroll: true,
1228
- keyboardStep: KEYBOARD_STEP
1229
- };
1230
- Cropper2.getMousePoint = function(e) {
1231
- return {
1232
- x: Number(e.clientX),
1233
- y: Number(e.clientY)
1234
- };
1235
- };
1236
- Cropper2.getTouchPoint = function(touch) {
1237
- return {
1238
- x: Number(touch.clientX),
1239
- y: Number(touch.clientY)
1240
- };
1241
- };
1242
- return Cropper2;
1243
- })(React.Component)
1244
- );
1245
-
1246
- // ../../node_modules/.pnpm/antd-img-crop@4.30.0_antd@6.6.1_react-dom@19.2.8_react@19.2.8__react@19.2.8__react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/antd-img-crop/dist/antd-img-crop.esm.js
1247
- var PREFIX = "img-crop";
1248
- var ZOOM_INITIAL = 1;
1249
- var ZOOM_STEP = 0.1;
1250
- var ROTATION_INITIAL = 0;
1251
- var ROTATION_MIN = -180;
1252
- var ROTATION_MAX = 180;
1253
- var ROTATION_STEP = 1;
1254
- var ASPECT_STEP = 0.01;
1255
- var EasyCrop = forwardRef((props, ref) => {
1256
- const { cropperRef, zoomSlider, rotationSlider, aspectSlider, showReset, resetBtnText, modalImage, aspect: propAspect, minZoom, maxZoom, minAspect, maxAspect, cropShape, showGrid, cropperProps } = props;
1257
- const [crop, setCrop] = useState({ x: 0, y: 0 });
1258
- const [zoom, setZoom] = useState(ZOOM_INITIAL);
1259
- const [rotation, setRotation] = useState(ROTATION_INITIAL);
1260
- const [aspect, setAspect] = useState(propAspect);
1261
- const cropPixelsRef = useRef({ width: 0, height: 0, x: 0, y: 0 });
1262
- const onCropComplete = useCallback((_, croppedAreaPixels) => {
1263
- cropPixelsRef.current = croppedAreaPixels;
1264
- }, []);
1265
- const prevPropAspect = useRef(propAspect);
1266
- if (prevPropAspect.current !== propAspect) {
1267
- prevPropAspect.current = propAspect;
1268
- setAspect(propAspect);
1269
- }
1270
- const isResetActive = zoom !== ZOOM_INITIAL || rotation !== ROTATION_INITIAL || aspect !== propAspect;
1271
- const onReset = () => {
1272
- setZoom(ZOOM_INITIAL);
1273
- setRotation(ROTATION_INITIAL);
1274
- setAspect(propAspect);
1275
- };
1276
- useImperativeHandle(ref, () => ({
1277
- rotation,
1278
- cropPixelsRef,
1279
- onReset
1280
- }));
1281
- const wrapperClass = "[display:flex] [align-items:center] [width:60%] [margin-inline:auto]";
1282
- const buttonClass = "[display:flex] [align-items:center] [justify-content:center] [height:32px] [width:32px] [background:transparent] [border:0] [font-family:inherit] [font-size:18px] [cursor:pointer] disabled:[opacity:20%] disabled:[cursor:default]";
1283
- const sliderClass = "[flex:1]";
1284
- return jsxs(Fragment, { children: [jsx(Cropper, Object.assign({}, cropperProps, { ref: cropperRef, image: modalImage, crop, zoom, rotation, aspect, minZoom, maxZoom, zoomWithScroll: zoomSlider, cropShape, showGrid, onCropChange: setCrop, onZoomChange: setZoom, onRotationChange: setRotation, onCropComplete, classes: {
1285
- containerClassName: `${PREFIX}-container ![position:relative] [width:100%] [height:40vh] [&~section:first-of-type]:[margin-top:16px] [&~section:last-of-type]:[margin-bottom:16px]`,
1286
- mediaClassName: `${PREFIX}-media`
1287
- } })), zoomSlider && jsxs("section", { className: `${PREFIX}-control ${PREFIX}-control-zoom ${wrapperClass}`, children: [jsx("button", { className: buttonClass, onClick: () => setZoom(+(zoom - ZOOM_STEP).toFixed(1)), disabled: zoom - ZOOM_STEP < minZoom, children: "\uFF0D" }), jsx(AntSlider, { className: sliderClass, min: minZoom, max: maxZoom, step: ZOOM_STEP, value: zoom, onChange: setZoom }), jsx("button", { className: buttonClass, onClick: () => setZoom(+(zoom + ZOOM_STEP).toFixed(1)), disabled: zoom + ZOOM_STEP > maxZoom, children: "\uFF0B" })] }), rotationSlider && jsxs("section", { className: `${PREFIX}-control ${PREFIX}-control-rotation ${wrapperClass}`, children: [jsx("button", { className: `${buttonClass} [font-size:16px]`, onClick: () => setRotation(rotation - ROTATION_STEP), disabled: rotation === ROTATION_MIN, children: "\u21BA" }), jsx(AntSlider, { className: sliderClass, min: ROTATION_MIN, max: ROTATION_MAX, step: ROTATION_STEP, value: rotation, onChange: setRotation }), jsx("button", { className: `${buttonClass} [font-size:16px]`, onClick: () => setRotation(rotation + ROTATION_STEP), disabled: rotation === ROTATION_MAX, children: "\u21BB" })] }), aspectSlider && jsxs("section", { className: `${PREFIX}-control ${PREFIX}-control-aspect ${wrapperClass}`, children: [jsx("button", { className: buttonClass, onClick: () => setAspect(+(aspect - ASPECT_STEP).toFixed(2)), disabled: aspect - ASPECT_STEP < minAspect, children: "\u2195" }), jsx(AntSlider, { className: sliderClass, min: minAspect, max: maxAspect, step: ASPECT_STEP, value: aspect, onChange: setAspect }), jsx("button", { className: buttonClass, onClick: () => setAspect(+(aspect + ASPECT_STEP).toFixed(2)), disabled: aspect + ASPECT_STEP > maxAspect, children: "\u2194" })] }), showReset && (zoomSlider || rotationSlider || aspectSlider) && jsx(AntButton, { className: "[position:absolute] [bottom:20px]", style: isResetActive ? {} : { opacity: 0.3, pointerEvents: "none" }, onClick: onReset, children: resetBtnText })] });
1288
- });
1289
- var EasyCrop$1 = memo(EasyCrop);
1290
- var css_248z2 = "/*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */.visible{visibility:visible}.\\!\\[position\\:relative\\]{position:relative!important}.\\[position\\:absolute\\]{position:absolute}.\\[bottom\\:20px\\]{bottom:20px}.container{width:100%}.\\[margin-inline\\:auto\\]{margin-inline:auto}.\\[display\\:flex\\]{display:flex}.grid{display:grid}.\\[height\\:32px\\]{height:32px}.\\[height\\:40vh\\]{height:40vh}.\\[width\\:32px\\]{width:32px}.\\[width\\:60\\%\\]{width:60%}.\\[width\\:100\\%\\]{width:100%}.\\[flex\\:1\\]{flex:1}.\\[cursor\\:pointer\\]{cursor:pointer}.\\[align-items\\:center\\]{align-items:center}.\\[justify-content\\:center\\]{justify-content:center}.\\[font-family\\:inherit\\]{font-family:inherit}.\\[font-size\\:16px\\]{font-size:16px}.\\[font-size\\:18px\\]{font-size:18px}.\\[background\\:transparent\\]{background:transparent}.\\[border\\:0\\]{border:0}.disabled\\:\\[cursor\\:default\\]{&:disabled{cursor:default}}.disabled\\:\\[opacity\\:20\\%\\]{&:disabled{opacity:20%}}.\\[\\&\\~section\\:first-of-type\\]\\:\\[margin-top\\:16px\\]{&~section:first-of-type{margin-top:16px}}.\\[\\&\\~section\\:last-of-type\\]\\:\\[margin-bottom\\:16px\\]{&~section:last-of-type{margin-bottom:16px}}";
1291
- (function() {
1292
- if (typeof document === "undefined") return;
1293
- const style = document.createElement("style");
1294
- const meta = document.querySelector('meta[name="csp-nonce"]');
1295
- if (meta && meta.content) style.setAttribute("nonce", meta.content);
1296
- style.textContent = css_248z2;
1297
- document.head.appendChild(style);
1298
- })();
1299
- var isGeThan = (v1, v2) => {
1300
- var _a, _b;
1301
- const arr1 = v1.split(".").map(Number);
1302
- const arr2 = v2.split(".").map(Number);
1303
- const len = Math.max(arr1.length, arr2.length);
1304
- for (let i = 0; i < len; i++) {
1305
- const a = (_a = arr1[i]) !== null && _a !== void 0 ? _a : 0;
1306
- const b = (_b = arr2[i]) !== null && _b !== void 0 ? _b : 0;
1307
- if (a > b)
1308
- return true;
1309
- if (a < b)
1310
- return false;
1311
- }
1312
- return true;
1313
- };
1314
- var ImgCrop = forwardRef((props, cropperRef) => {
1315
- const { quality = 0.4, fillColor = "white", zoomSlider = true, rotationSlider = false, aspectSlider = false, showReset = false, resetText, aspect = 1, minZoom = 1, maxZoom = 3, minAspect = 0.5, maxAspect = 2, cropShape = "rect", showGrid = false, cropperProps, modalClassName, modalTitle, modalWidth, modalOk, modalCancel, onModalOk, onModalCancel, modalProps, beforeCrop, children } = props;
1316
- const cb = useRef({});
1317
- cb.current.onModalOk = onModalOk;
1318
- cb.current.onModalCancel = onModalCancel;
1319
- cb.current.beforeCrop = beforeCrop;
1320
- const easyCropRef = useRef(null);
1321
- const getCropCanvas = useCallback((target) => {
1322
- var _a;
1323
- const canvas = document.createElement("canvas");
1324
- const ctx = canvas.getContext("2d");
1325
- const context = ((_a = target === null || target === void 0 ? void 0 : target.getRootNode) === null || _a === void 0 ? void 0 : _a.call(target)) || document;
1326
- const imgSource = context.querySelector(`.${PREFIX}-media`);
1327
- const { width: cropWidth, height: cropHeight, x: cropX, y: cropY } = easyCropRef.current.cropPixelsRef.current;
1328
- if (rotationSlider && easyCropRef.current.rotation !== ROTATION_INITIAL) {
1329
- const { naturalWidth: imgWidth, naturalHeight: imgHeight } = imgSource;
1330
- const angle = easyCropRef.current.rotation * (Math.PI / 180);
1331
- const sine = Math.abs(Math.sin(angle));
1332
- const cosine = Math.abs(Math.cos(angle));
1333
- const squareWidth = imgWidth * cosine + imgHeight * sine;
1334
- const squareHeight = imgHeight * cosine + imgWidth * sine;
1335
- canvas.width = squareWidth;
1336
- canvas.height = squareHeight;
1337
- ctx.fillStyle = fillColor;
1338
- ctx.fillRect(0, 0, squareWidth, squareHeight);
1339
- const squareHalfWidth = squareWidth / 2;
1340
- const squareHalfHeight = squareHeight / 2;
1341
- ctx.translate(squareHalfWidth, squareHalfHeight);
1342
- ctx.rotate(angle);
1343
- ctx.translate(-squareHalfWidth, -squareHalfHeight);
1344
- const imgX = (squareWidth - imgWidth) / 2;
1345
- const imgY = (squareHeight - imgHeight) / 2;
1346
- ctx.drawImage(imgSource, 0, 0, imgWidth, imgHeight, imgX, imgY, imgWidth, imgHeight);
1347
- const imgData = ctx.getImageData(0, 0, squareWidth, squareHeight);
1348
- canvas.width = cropWidth;
1349
- canvas.height = cropHeight;
1350
- ctx.putImageData(imgData, -cropX, -cropY);
1351
- } else {
1352
- canvas.width = cropWidth;
1353
- canvas.height = cropHeight;
1354
- ctx.fillStyle = fillColor;
1355
- ctx.fillRect(0, 0, cropWidth, cropHeight);
1356
- ctx.drawImage(imgSource, cropX, cropY, cropWidth, cropHeight, 0, 0, cropWidth, cropHeight);
1357
- }
1358
- return canvas;
1359
- }, [fillColor, rotationSlider]);
1360
- const [modalOpen, setModalOpen] = useState(false);
1361
- const [modalImage, setModalImage] = useState("");
1362
- const onCancel = useRef(void 0);
1363
- const onOk = useRef(void 0);
1364
- const runBeforeUpload = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ beforeUpload, file, resolve, reject }) {
1365
- const rawFile = file;
1366
- if (typeof beforeUpload !== "function") {
1367
- resolve(rawFile);
1368
- return;
1369
- }
1370
- try {
1371
- const result = yield beforeUpload(file, [file]);
1372
- if (result === false) {
1373
- resolve(false);
1374
- } else {
1375
- resolve(result !== true && result || rawFile);
1376
- }
1377
- } catch (err) {
1378
- reject(err);
1379
- }
1380
- }), []);
1381
- const getNewBeforeUpload = useCallback((beforeUpload) => {
1382
- return ((file, fileList) => {
1383
- return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
1384
- let processedFile = file;
1385
- if (typeof cb.current.beforeCrop === "function") {
1386
- try {
1387
- const result = yield cb.current.beforeCrop(file, fileList);
1388
- if (result === false) {
1389
- return runBeforeUpload({ beforeUpload, file, resolve, reject });
1390
- }
1391
- if (result !== true) {
1392
- processedFile = result || file;
1393
- }
1394
- } catch (err) {
1395
- return runBeforeUpload({ beforeUpload, file, resolve, reject });
1396
- }
1397
- }
1398
- const reader = new FileReader();
1399
- reader.addEventListener("load", () => {
1400
- if (typeof reader.result === "string") {
1401
- setModalOpen(true);
1402
- setTimeout(() => {
1403
- setModalImage(reader.result);
1404
- }, 10);
1405
- }
1406
- });
1407
- reader.readAsDataURL(processedFile);
1408
- onCancel.current = () => {
1409
- var _a, _b;
1410
- setModalOpen(false);
1411
- setModalImage("");
1412
- easyCropRef.current.onReset();
1413
- let hasResolveCalled = false;
1414
- (_b = (_a = cb.current).onModalCancel) === null || _b === void 0 ? void 0 : _b.call(_a, (LIST_IGNORE) => {
1415
- resolve(LIST_IGNORE);
1416
- hasResolveCalled = true;
1417
- });
1418
- if (!hasResolveCalled) {
1419
- resolve(AntUpload.LIST_IGNORE);
1420
- }
1421
- };
1422
- onOk.current = (event) => __awaiter(void 0, void 0, void 0, function* () {
1423
- setModalOpen(false);
1424
- setModalImage("");
1425
- easyCropRef.current.onReset();
1426
- const canvas = getCropCanvas(event.target);
1427
- const { type, name, uid } = processedFile;
1428
- canvas.toBlob((blob) => __awaiter(void 0, void 0, void 0, function* () {
1429
- const newFile = new File([blob], name, { type });
1430
- Object.assign(newFile, { uid });
1431
- runBeforeUpload({
1432
- beforeUpload,
1433
- file: newFile,
1434
- resolve: (file2) => {
1435
- var _a, _b;
1436
- resolve(file2);
1437
- (_b = (_a = cb.current).onModalOk) === null || _b === void 0 ? void 0 : _b.call(_a, file2);
1438
- },
1439
- reject: (err) => {
1440
- var _a, _b;
1441
- reject(err);
1442
- (_b = (_a = cb.current).onModalOk) === null || _b === void 0 ? void 0 : _b.call(_a, err);
1443
- }
1444
- });
1445
- }), type, quality);
1446
- });
1447
- }));
1448
- });
1449
- }, [getCropCanvas, quality, runBeforeUpload]);
1450
- const getNewUpload = useCallback((children2) => {
1451
- const upload = Array.isArray(children2) ? children2[0] : children2;
1452
- const _a = upload.props, { beforeUpload, accept } = _a, restUploadProps = __rest(_a, ["beforeUpload", "accept"]);
1453
- return Object.assign(Object.assign({}, upload), { props: Object.assign(Object.assign({}, restUploadProps), { accept: accept || "image/*", beforeUpload: getNewBeforeUpload(beforeUpload) }) });
1454
- }, [getNewBeforeUpload]);
1455
- const modalBaseProps = useMemo(() => {
1456
- const obj = {};
1457
- if (modalWidth !== void 0)
1458
- obj.width = modalWidth;
1459
- if (modalOk !== void 0)
1460
- obj.okText = modalOk;
1461
- if (modalCancel !== void 0)
1462
- obj.cancelText = modalCancel;
1463
- return obj;
1464
- }, [modalCancel, modalOk, modalWidth]);
1465
- const wrapClassName = `${PREFIX}-modal${modalClassName ? ` ${modalClassName}` : ""}`;
1466
- const lang = typeof window === "undefined" ? "" : window.navigator.language;
1467
- const isCN = lang === "zh-CN";
1468
- const title = modalTitle || (isCN ? "\u7F16\u8F91\u56FE\u7247" : "Edit image");
1469
- const resetBtnText = resetText || (isCN ? "\u91CD\u7F6E" : "Reset");
1470
- return jsxs(Fragment, { children: [getNewUpload(children), jsx(AntModal, Object.assign({}, modalProps, modalBaseProps, { open: modalOpen, title, onCancel: onCancel.current, onOk: onOk.current, wrapClassName, destroyOnHidden: true }, isGeThan(version, "6.3.1") ? { mask: { closable: false } } : { maskClosable: true }, { children: jsx(EasyCrop$1, { ref: easyCropRef, cropperRef, zoomSlider, rotationSlider, aspectSlider, showReset, resetBtnText, modalImage, aspect, minZoom, maxZoom, minAspect, maxAspect, cropShape, showGrid, cropperProps }) }))] });
1471
- });
1472
-
1473
- // shell/.ojm-shim-antd-img-crop.mjs
1474
- var ojm_shim_antd_img_crop_default = ImgCrop ?? antd_img_crop_esm_exports;
1475
- export {
1476
- ojm_shim_antd_img_crop_default as default
1477
- };
1478
- /*! Bundled license information:
1479
-
1480
- normalize-wheel/src/isEventSupported.js:
1481
- (**
1482
- * Checks if an event is supported in the current execution environment.
1483
- *
1484
- * NOTE: This will not work correctly for non-generic events such as `change`,
1485
- * `reset`, `load`, `error`, and `select`.
1486
- *
1487
- * Borrows from Modernizr.
1488
- *
1489
- * @param {string} eventNameSuffix Event name, e.g. "click".
1490
- * @param {?boolean} capture Check if the capture phase is supported.
1491
- * @return {boolean} True if the event is supported.
1492
- * @internal
1493
- * @license Modernizr 3.0.0pre (Custom Build) | MIT
1494
- *)
1495
- */