adminizer 4.1.0-build.7 → 4.1.0-build.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/{VanillaJSONEditor-FUe77pIA.js → VanillaJSONEditor-BGC0iJ01.js} +1 -1
- package/assets/add-EOP63mij.js +1 -0
- package/assets/{add-form-CYOfr0Ef.js → add-form-DofA75xF.js} +1 -1
- package/assets/add-group-CbKcu8bN.js +1 -0
- package/assets/{add-group-form-dzadPSfL.js → add-group-form-BUM07NJS.js} +1 -1
- package/assets/add-user-FQ_0_L3C.js +1 -0
- package/assets/{add-user-form-WHaw00sy.js → add-user-form-D1f_2noB.js} +1 -1
- package/assets/{app-DMmad2-f.css → app-DB4X6jGk.css} +1 -1
- package/assets/{app-layout-D1m9Kvxq.js → app-layout-YPlKN2l5.js} +1 -1
- package/assets/{app-shell-BWMRMkHM.js → app-shell-D6Uf68EA.js} +1 -1
- package/assets/{app-sidebar-header-DLAFi13E.js → app-sidebar-header-BTKq0Dr0.js} +1 -1
- package/assets/{app-sidebar-BCtaEFGb.js → app-sidebar-mh83eSsH.js} +1 -1
- package/assets/app.js +14 -14
- package/assets/{breadcrumbs-CQNon4Vl.js → breadcrumbs-B4LOvzuL.js} +1 -1
- package/assets/{button-CQ9t1kLz.js → button-CTOOfwvn.js} +1 -1
- package/assets/checkbox-D9ub-v0l.js +1 -0
- package/assets/dashboard-BiLSHuF2.js +1 -0
- package/assets/{date-picker-B__dVVqj.js → date-picker-DdGpxs8q.js} +1 -1
- package/assets/{dropdown-menu-SEBnEIiL.js → dropdown-menu-CsGmdVIn.js} +1 -1
- package/assets/{field-renderer-CapylJU9.js → field-renderer-Q3ajtfjk.js} +3 -3
- package/assets/form-D2gvtdQt.js +1 -0
- package/assets/{form-lOKv4Qbw.js → form-EPWwr8yD.js} +1 -1
- package/assets/{geo-json-CwteYDGB.js → geo-json-CFYMCghL.js} +1 -1
- package/assets/{home-BvoB5g29.js → home-Co9WBSjN.js} +2 -2
- package/assets/{index-BbXEMx9n.js → index-C5OL14ES.js} +1 -1
- package/assets/{index-DTRTjOmh.js → index-CGjCQBqR.js} +1 -1
- package/assets/{index-BcE9FUM6.js → index-Cb_qrizV.js} +1 -1
- package/assets/{index-K81GbF6O.js → index-DEzdKGnS.js} +1 -1
- package/assets/index-DUXJYtOc.js +1 -0
- package/assets/index-Dllsp4Rk.js +1 -0
- package/assets/{index-C0SL3SHw.js → index-DnbQEoxZ.js} +1 -1
- package/assets/{index-BC0yfOHo.js → index-Mx04mBJl.js} +1 -1
- package/assets/{index-DEk3sC8d.js → index-m5itSoCR.js} +1 -1
- package/assets/{init-user-D9mW-g14.js → init-user-CotD_o5_.js} +1 -1
- package/assets/{label-Z506NKsW.js → label-C2tlefOv.js} +1 -1
- package/assets/list-BrJBbAVm.js +1 -0
- package/assets/{list-table-DB1sEQLF.js → list-table-Cz8Wgfsa.js} +5 -5
- package/assets/{login-DrGaTWhY.js → login-B7br6gt5.js} +1 -1
- package/assets/manifest.json +458 -458
- package/assets/module-BA_EenoK.js +1 -0
- package/assets/{multi-select-oabtVhUP.js → multi-select-CDlcaNFy.js} +1 -1
- package/assets/{nav-footer-CM-yHiRs.js → nav-footer-CXKG3O4K.js} +1 -1
- package/assets/{nav-main-Q3xofGRT.js → nav-main-ByHRr3yf.js} +1 -1
- package/assets/{nav-user-Ds8i0Pa2.js → nav-user-BVRKiqm-.js} +1 -1
- package/assets/{pagination-render-B57pOpFy.js → pagination-render-CihJ7J2u.js} +1 -1
- package/assets/{popover-I249Gg2O.js → popover-_WN_Lj46.js} +1 -1
- package/assets/{register-C9FQIDtS.js → register-CpRFo88B.js} +1 -1
- package/assets/{select-D1N8zRPY.js → select-DYffGc49.js} +1 -1
- package/assets/{sidebar-4D-sX2l4.js → sidebar-B9HagQ6H.js} +1 -1
- package/assets/{toast-editor-FbrFd1ft.js → toast-editor-ZLOtXFu5.js} +82 -82
- package/assets/{tooltip-D2ehgLlB.js → tooltip-CWVAD5oF.js} +1 -1
- package/assets/{user-info-DBYoAJYJ.js → user-info-DA4KTAOF.js} +1 -1
- package/assets/{user-menu-content-qkvdkUVd.js → user-menu-content-Biwi4u9j.js} +1 -1
- package/assets/welcome-C1kRbbWq.js +1 -0
- package/controllers/addGroup.js +0 -2
- package/controllers/addUser.js +0 -2
- package/controllers/catalog/FrontentCatalogAdapter.js +0 -1
- package/controllers/ckeditorUpload.js +0 -1
- package/controllers/edit.js +0 -1
- package/controllers/editGroup.js +0 -2
- package/controllers/editUser.js +0 -1
- package/controllers/form.js +0 -1
- package/controllers/list.js +2 -2
- package/controllers/media-manager/mediaManagerAdapter.js +1 -2
- package/controllers/register.js +0 -2
- package/helpers/fieldsHelper.d.ts +1 -1
- package/index.d.ts +6 -0
- package/index.js +6 -0
- package/lib/Adminizer.js +0 -1
- package/lib/catalog/AbstractCatalog.js +0 -1
- package/lib/datatable/NodeTable.js +0 -3
- package/lib/inertia/inertiaAdapter.js +0 -1
- package/lib/media-manager/AbstractMediaManager.d.ts +2 -2
- package/lib/media-manager/AbstractMediaManager.js +1 -1
- package/lib/v4/DataAccessor.js +1 -1
- package/lib/v4/POWCaptcha.js +0 -1
- package/lib/v4/PolicyManager.js +0 -1
- package/lib/v4/model/AbstractModel.js +0 -2
- package/lib/v4/model/ModelHandler.js +0 -1
- package/lib/v4/model/adapter/sequelize.d.ts +3 -2
- package/lib/v4/model/adapter/sequelize.js +250 -58
- package/lib/v4/model/adapter/waterline.js +0 -1
- package/models/GroupAP.d.ts +8 -0
- package/models/MediaManagerAP.d.ts +16 -0
- package/models/MediaManagerAssociationsAP.d.ts +10 -0
- package/models/MediaManagerMetaAP.d.ts +8 -0
- package/models/NavigationAP.d.ts +5 -0
- package/models/UserAP.d.ts +19 -0
- package/package.json +1 -1
- package/system/bindInertia.js +1 -1
- package/assets/add-ZITr43GJ.js +0 -1
- package/assets/add-group-B332wN8K.js +0 -1
- package/assets/add-user-BHsqgOim.js +0 -1
- package/assets/checkbox-W0nGAXIj.js +0 -1
- package/assets/dashboard-BR602KhL.js +0 -1
- package/assets/form-DOUNk3o2.js +0 -1
- package/assets/index-Cdb9ACvz.js +0 -1
- package/assets/index-DrWfGwtf.js +0 -1
- package/assets/list-Qyd7ecQH.js +0 -1
- package/assets/module-DBaykv8l.js +0 -1
- package/assets/welcome-D2adQ8EU.js +0 -1
|
@@ -3,53 +3,110 @@ import { AbstractAdapter, AbstractModel } from "../AbstractModel";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import { pathToFileURL } from "url";
|
|
6
|
-
function
|
|
6
|
+
function resolveType(type) {
|
|
7
|
+
const sqlType = typeof type.toString === "function"
|
|
8
|
+
? type.toString().toLowerCase()
|
|
9
|
+
: "";
|
|
10
|
+
if (sqlType.includes("string") || sqlType.includes("uuid"))
|
|
11
|
+
return "string";
|
|
12
|
+
if (sqlType.includes("int") || sqlType.includes("float") || sqlType.includes("decimal"))
|
|
13
|
+
return "number";
|
|
14
|
+
if (sqlType.includes("bool"))
|
|
15
|
+
return "boolean";
|
|
16
|
+
if (sqlType.includes("json"))
|
|
17
|
+
return "json";
|
|
18
|
+
if (sqlType.includes("date"))
|
|
19
|
+
return "string";
|
|
20
|
+
return "ref";
|
|
21
|
+
}
|
|
22
|
+
export function mapSequelizeToWaterline(model) {
|
|
7
23
|
const result = {};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
result[
|
|
12
|
-
type:
|
|
13
|
-
required: !
|
|
14
|
-
|
|
15
|
-
unique: !!
|
|
24
|
+
const rawAttrs = model.getAttributes();
|
|
25
|
+
for (const name in rawAttrs) {
|
|
26
|
+
const meta = rawAttrs[name];
|
|
27
|
+
result[name] = {
|
|
28
|
+
type: resolveType(meta.type),
|
|
29
|
+
required: meta.allowNull !== undefined ? !meta.allowNull : false,
|
|
30
|
+
allowNull: meta.allowNull,
|
|
31
|
+
unique: !!meta.unique,
|
|
32
|
+
defaultsTo: meta.defaultValue,
|
|
33
|
+
columnName: meta.field || name,
|
|
16
34
|
};
|
|
17
35
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
for (const alias in model.associations) {
|
|
37
|
+
const assoc = model.associations[alias];
|
|
38
|
+
switch (assoc.associationType) {
|
|
39
|
+
case "BelongsTo": {
|
|
40
|
+
const a = assoc;
|
|
41
|
+
result[alias] = {
|
|
42
|
+
type: "association",
|
|
43
|
+
model: a.target.name.toLowerCase(),
|
|
44
|
+
via: a.foreignKey,
|
|
45
|
+
};
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
case "HasOne": {
|
|
49
|
+
const a = assoc;
|
|
50
|
+
result[alias] = {
|
|
51
|
+
type: "association",
|
|
52
|
+
model: a.target.name.toLowerCase(),
|
|
53
|
+
via: a.foreignKey,
|
|
54
|
+
};
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
case "HasMany": {
|
|
58
|
+
const a = assoc;
|
|
59
|
+
result[alias] = {
|
|
60
|
+
type: "association-many",
|
|
61
|
+
collection: a.target.name.toLowerCase(),
|
|
62
|
+
via: a.foreignKey,
|
|
63
|
+
};
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case "BelongsToMany": {
|
|
67
|
+
const a = assoc;
|
|
68
|
+
result[alias] = {
|
|
69
|
+
type: "association-many",
|
|
70
|
+
collection: a.target.name.toLowerCase(),
|
|
71
|
+
via: a.otherKey,
|
|
72
|
+
};
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
default:
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
41
78
|
}
|
|
79
|
+
return result;
|
|
42
80
|
}
|
|
81
|
+
// function resolveType(type: any): AbstractFieldType {
|
|
82
|
+
// try {
|
|
83
|
+
// const sqlType = typeof type.toString === "function"
|
|
84
|
+
// ? type.toString().toLowerCase()
|
|
85
|
+
// : "";
|
|
86
|
+
// if (sqlType.includes("string")) return "string";
|
|
87
|
+
// if (sqlType.includes("uuid")) return "string";
|
|
88
|
+
// if (sqlType.includes("int") || sqlType.includes("float") || sqlType.includes("decimal")) return "number";
|
|
89
|
+
// if (sqlType.includes("bool")) return "boolean";
|
|
90
|
+
// if (sqlType.includes("json")) return "json";
|
|
91
|
+
// if (sqlType.includes("date")) return "string";
|
|
92
|
+
// return "ref";
|
|
93
|
+
// } catch {
|
|
94
|
+
// return "ref";
|
|
95
|
+
// }
|
|
96
|
+
// }
|
|
43
97
|
/** SequelizeModel — реализация модели, совместимая с AbstractModel */
|
|
98
|
+
function capitalize(str) {
|
|
99
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
100
|
+
}
|
|
44
101
|
function convertCriteriaToSequelize(criteria) {
|
|
45
|
-
console.debug("waterline criteria", criteria)
|
|
102
|
+
// console.debug("waterline criteria", criteria)
|
|
46
103
|
const result = {};
|
|
47
104
|
for (const key in criteria) {
|
|
48
105
|
const value = criteria[key];
|
|
49
106
|
if (value === undefined ||
|
|
50
107
|
value === null ||
|
|
51
108
|
(typeof value === "object" && Object.keys(value).length === 0)) {
|
|
52
|
-
continue;
|
|
109
|
+
continue;
|
|
53
110
|
}
|
|
54
111
|
if (typeof value === "object" && !Array.isArray(value)) {
|
|
55
112
|
const operatorEntries = Object.entries(value)
|
|
@@ -80,7 +137,32 @@ function convertCriteriaToSequelize(criteria) {
|
|
|
80
137
|
return result;
|
|
81
138
|
}
|
|
82
139
|
function convertWaterlineCriteriaToSequelizeOptions(criteria) {
|
|
83
|
-
console.debug("WATERLINE CRITERIA", criteria);
|
|
140
|
+
// console.debug("WATERLINE CRITERIA (raw):", criteria);
|
|
141
|
+
const { where: nestedWhere, skip, limit, sort, ...rest } = criteria;
|
|
142
|
+
const rawWhere = (nestedWhere && Object.keys(nestedWhere).length > 0)
|
|
143
|
+
? nestedWhere
|
|
144
|
+
: rest;
|
|
145
|
+
// console.debug("WATERLINE CRITERIA: using rawWhere =", rawWhere);
|
|
146
|
+
const where = convertCriteriaToSequelize(rawWhere);
|
|
147
|
+
// console.debug("convertCriteriaToSequelize →", where);
|
|
148
|
+
const result = { where };
|
|
149
|
+
if (typeof skip === "number") {
|
|
150
|
+
result.offset = skip;
|
|
151
|
+
// console.debug("→ offset =", skip);
|
|
152
|
+
}
|
|
153
|
+
if (typeof limit === "number") {
|
|
154
|
+
result.limit = limit;
|
|
155
|
+
// console.debug("→ limit =", limit);
|
|
156
|
+
}
|
|
157
|
+
if (typeof sort === "string") {
|
|
158
|
+
const [field, dir] = sort.trim().split(/\s+/);
|
|
159
|
+
result.order = [[field, dir?.toUpperCase() === "DESC" ? "DESC" : "ASC"]];
|
|
160
|
+
// console.debug("→ order =", result.order);
|
|
161
|
+
}
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
function convertWaterlineCriteriaToSequelizeOptions____OLD(criteria) {
|
|
165
|
+
// console.debug("WATERLINE CRITERIA", criteria)
|
|
84
166
|
const { where = {}, skip, limit, sort } = criteria;
|
|
85
167
|
const result = {
|
|
86
168
|
where: convertCriteriaToSequelize(where),
|
|
@@ -100,40 +182,150 @@ function convertWaterlineCriteriaToSequelizeOptions(criteria) {
|
|
|
100
182
|
export class SequelizeModel extends AbstractModel {
|
|
101
183
|
model;
|
|
102
184
|
constructor(modelName, model) {
|
|
103
|
-
super(modelName,
|
|
185
|
+
super(modelName, mapSequelizeToWaterline(model), model.primaryKeyAttribute, model.name);
|
|
104
186
|
this.model = model;
|
|
105
187
|
}
|
|
106
188
|
// --- CREATE ---
|
|
107
189
|
async _create(data) {
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
190
|
+
// console.clear()
|
|
191
|
+
const assocNames = Object.keys(this.model.associations);
|
|
192
|
+
const plainData = {};
|
|
193
|
+
const assocData = {};
|
|
194
|
+
// console.debug(">> _create: входные данные:", data);
|
|
195
|
+
// console.debug(">> Доступные ассоциации:", assocNames);
|
|
196
|
+
for (const [key, val] of Object.entries(data)) {
|
|
197
|
+
if (assocNames.includes(key)) {
|
|
198
|
+
assocData[key] = val;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
plainData[key] = val;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// console.debug(">> Обычные поля для create():", plainData);
|
|
205
|
+
// console.debug(">> Данные ассоциаций:", assocData);
|
|
206
|
+
let instance;
|
|
207
|
+
try {
|
|
208
|
+
instance = await this.model.create(plainData);
|
|
209
|
+
// console.debug(">> Создан экземпляр (без ассоциаций):", instance.toJSON());
|
|
210
|
+
}
|
|
211
|
+
catch (err) {
|
|
212
|
+
// console.error("!! Ошибка при create(plainData):", err);
|
|
213
|
+
throw err;
|
|
214
|
+
}
|
|
215
|
+
// assocData = { example: 5, userAPs: [1,2,3], category: 7, tags: [11,22] }
|
|
216
|
+
// this.model.associations — ваш объект ассоциаций
|
|
217
|
+
for (const [alias, ids] of Object.entries(assocData)) {
|
|
218
|
+
const assoc = this.model.associations[alias];
|
|
219
|
+
if (!assoc) {
|
|
220
|
+
// console.warn(`Association "${alias}" not defined on model`);
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
// @ts-ignore accessors is present
|
|
224
|
+
const { set: setAccessor, add: addAccessor } = assoc.accessors;
|
|
225
|
+
if (Array.isArray(ids)) {
|
|
226
|
+
if (typeof instance[setAccessor] === 'function') {
|
|
227
|
+
await instance[setAccessor](ids);
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
if (typeof instance[addAccessor] === 'function') {
|
|
231
|
+
for (const id of ids) {
|
|
232
|
+
await instance[addAccessor](id);
|
|
233
|
+
}
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (typeof instance[setAccessor] === 'function') {
|
|
238
|
+
await instance[setAccessor](ids);
|
|
239
|
+
}
|
|
240
|
+
else if (typeof instance[addAccessor] === 'function') {
|
|
241
|
+
await instance[addAccessor](ids);
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
// console.warn(`No suitable accessor for "${alias}": tried set=${setAccessor}, add=${addAccessor}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
await instance.reload({ include: Object.values(this.model.associations) });
|
|
248
|
+
const pk = this.primaryKey;
|
|
249
|
+
const fresh = await this.model.findByPk(instance.get(pk), { include: assocNames.map(a => ({ association: a })) });
|
|
250
|
+
// console.debug(">> Результат после reload:", fresh?.toJSON());
|
|
251
|
+
return fresh;
|
|
111
252
|
}
|
|
112
253
|
// --- FIND ONE ---
|
|
113
254
|
async _findOne(criteria) {
|
|
255
|
+
// console.debug(">> _findOne: входные критерии:", criteria);
|
|
114
256
|
const { where } = convertWaterlineCriteriaToSequelizeOptions(criteria);
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
257
|
+
const includes = this._buildIncludes();
|
|
258
|
+
// console.debug(">> _findOne: преобразованные where:", where);
|
|
259
|
+
// console.debug(">> _findOne: includes:", includes);
|
|
260
|
+
let instance = null;
|
|
261
|
+
try {
|
|
262
|
+
instance = await this.model.findOne({ where, include: includes });
|
|
263
|
+
// console.debug(">> _findOne: сырое instance:", instance ? instance.toJSON() : null);
|
|
264
|
+
}
|
|
265
|
+
catch (err) {
|
|
266
|
+
// console.error("!! _findOne: ошибка при вызове findOne:", err);
|
|
267
|
+
throw err;
|
|
268
|
+
}
|
|
269
|
+
if (!instance) {
|
|
270
|
+
// console.debug(">> _findOne: ничего не найдено");
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
const plain = instance.get({ plain: true });
|
|
274
|
+
// console.debug(">> _findOne: plain результат:", plain);
|
|
275
|
+
return plain;
|
|
121
276
|
}
|
|
122
277
|
// --- FIND MANY ---
|
|
123
278
|
async _find(criteria = {}, options = {}) {
|
|
279
|
+
const assocNames = Object.keys(this.model.associations);
|
|
280
|
+
// console.debug(">> _find: входные criteria:", criteria, "options:", options);
|
|
124
281
|
const { where, limit, offset, order } = convertWaterlineCriteriaToSequelizeOptions(criteria);
|
|
125
|
-
const
|
|
282
|
+
const includes = options.populate
|
|
126
283
|
? options.populate.map(([field, opts]) => ({ association: field, ...opts }))
|
|
127
|
-
:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
284
|
+
: assocNames.map(a => ({ association: a }));
|
|
285
|
+
// console.debug(">> _find: where, limit, offset, order, includes:", {
|
|
286
|
+
// where,
|
|
287
|
+
// limit,
|
|
288
|
+
// offset,
|
|
289
|
+
// order,
|
|
290
|
+
// includes,
|
|
291
|
+
// });
|
|
292
|
+
let instances;
|
|
293
|
+
try {
|
|
294
|
+
instances = await this.model.findAll({
|
|
295
|
+
where,
|
|
296
|
+
limit,
|
|
297
|
+
offset,
|
|
298
|
+
order,
|
|
299
|
+
include: includes
|
|
300
|
+
});
|
|
301
|
+
// console.debug(">> _find: получено моделей:", instances.length);
|
|
302
|
+
}
|
|
303
|
+
catch (err) {
|
|
304
|
+
// console.error("!! _find: ошибка в findAll:", err);
|
|
305
|
+
throw err;
|
|
306
|
+
}
|
|
307
|
+
for (const inst of instances) {
|
|
308
|
+
//For each association, we call getxxx () once again
|
|
309
|
+
for (const alias of assocNames) {
|
|
310
|
+
// @ts-ignore accessors is present
|
|
311
|
+
const getAccessor = this.model.associations[alias].accessors.get;
|
|
312
|
+
if (typeof inst[getAccessor] === "function") {
|
|
313
|
+
try {
|
|
314
|
+
const related = await inst[getAccessor]();
|
|
315
|
+
const mapped = Array.isArray(related)
|
|
316
|
+
? related.map((r) => r.toJSON())
|
|
317
|
+
: related?.toJSON();
|
|
318
|
+
// console.debug(`---- get${alias}():`, mapped);
|
|
319
|
+
}
|
|
320
|
+
catch (e) {
|
|
321
|
+
// console.error(`!! ошибка при вызове ${getAccessor}():`, e);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const plain = instances.map(i => i.get({ plain: true }));
|
|
327
|
+
// console.debug(">> _find: plain результаты:", plain);
|
|
328
|
+
return plain;
|
|
137
329
|
}
|
|
138
330
|
// --- UPDATE ONE ---
|
|
139
331
|
async _updateOne(criteria, data) {
|
|
@@ -205,7 +397,7 @@ export class SequelizeAdapter extends AbstractAdapter {
|
|
|
205
397
|
const model = this.getModel(modelName);
|
|
206
398
|
return model?.getAttributes();
|
|
207
399
|
}
|
|
208
|
-
/**
|
|
400
|
+
/**Registration of system models*/
|
|
209
401
|
static async registerSystemModels(sequelize) {
|
|
210
402
|
const modelsDir = path.resolve(import.meta.dirname, "../../../../models");
|
|
211
403
|
const files = fs.readdirSync(modelsDir).filter(f => f.endsWith(".js"));
|
|
@@ -218,7 +410,7 @@ export class SequelizeAdapter extends AbstractAdapter {
|
|
|
218
410
|
await sequelize.sync();
|
|
219
411
|
}
|
|
220
412
|
}
|
|
221
|
-
/**
|
|
413
|
+
/**Generation of the SEQUELIZE model from the definition, analogue of Waterinecollection.extenD*/
|
|
222
414
|
function generateSequelizeModel(sequelize, modelName, rawAttributes) {
|
|
223
415
|
const attributes = {};
|
|
224
416
|
let primaryKey = null;
|
package/models/GroupAP.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UserAP } from "./UserAP";
|
|
1
2
|
declare const _default: {
|
|
2
3
|
id: {
|
|
3
4
|
type: string;
|
|
@@ -21,3 +22,10 @@ declare const _default: {
|
|
|
21
22
|
};
|
|
22
23
|
};
|
|
23
24
|
export default _default;
|
|
25
|
+
export interface GroupAP {
|
|
26
|
+
id: number;
|
|
27
|
+
name: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
tokens?: Record<string, unknown>;
|
|
30
|
+
users?: UserAP[];
|
|
31
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { MediaManagerAssociationsAP } from "./MediaManagerAssociationsAP";
|
|
2
|
+
import { MediaManagerMetaAP } from "./MediaManagerMetaAP";
|
|
1
3
|
declare const _default: {
|
|
2
4
|
id: {
|
|
3
5
|
type: string;
|
|
@@ -44,3 +46,17 @@ declare const _default: {
|
|
|
44
46
|
};
|
|
45
47
|
};
|
|
46
48
|
export default _default;
|
|
49
|
+
export interface MediaManagerAP {
|
|
50
|
+
id: string;
|
|
51
|
+
parent?: MediaManagerAP;
|
|
52
|
+
variants?: MediaManagerAP[];
|
|
53
|
+
mimeType?: string;
|
|
54
|
+
path?: string;
|
|
55
|
+
size?: number;
|
|
56
|
+
group?: string;
|
|
57
|
+
tag?: string;
|
|
58
|
+
url?: string;
|
|
59
|
+
filename?: string;
|
|
60
|
+
meta?: MediaManagerMetaAP[];
|
|
61
|
+
modelAssociation?: MediaManagerAssociationsAP[];
|
|
62
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MediaManagerAP } from "./MediaManagerAP";
|
|
1
2
|
declare const _default: {
|
|
2
3
|
id: {
|
|
3
4
|
type: string;
|
|
@@ -26,3 +27,12 @@ declare const _default: {
|
|
|
26
27
|
};
|
|
27
28
|
};
|
|
28
29
|
export default _default;
|
|
30
|
+
export interface MediaManagerAssociationsAP {
|
|
31
|
+
id: string;
|
|
32
|
+
mediaManagerId?: string;
|
|
33
|
+
model?: Record<string, unknown>;
|
|
34
|
+
modelId?: Record<string, unknown>;
|
|
35
|
+
widgetName?: string;
|
|
36
|
+
sortOrder?: number;
|
|
37
|
+
file?: MediaManagerAP;
|
|
38
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MediaManagerAP } from "./MediaManagerAP";
|
|
1
2
|
declare const _default: {
|
|
2
3
|
id: {
|
|
3
4
|
type: string;
|
|
@@ -20,3 +21,10 @@ declare const _default: {
|
|
|
20
21
|
};
|
|
21
22
|
};
|
|
22
23
|
export default _default;
|
|
24
|
+
export interface MediaManagerMetaAP {
|
|
25
|
+
id: string;
|
|
26
|
+
key?: string;
|
|
27
|
+
value?: Record<string, unknown>;
|
|
28
|
+
isPublic?: boolean;
|
|
29
|
+
parent?: MediaManagerAP;
|
|
30
|
+
}
|
package/models/NavigationAP.d.ts
CHANGED
package/models/UserAP.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GroupAP } from "./GroupAP";
|
|
1
2
|
declare const _default: {
|
|
2
3
|
id: {
|
|
3
4
|
type: string;
|
|
@@ -52,3 +53,21 @@ declare const _default: {
|
|
|
52
53
|
};
|
|
53
54
|
};
|
|
54
55
|
export default _default;
|
|
56
|
+
export interface UserAP {
|
|
57
|
+
id: number;
|
|
58
|
+
login: string;
|
|
59
|
+
fullName: string;
|
|
60
|
+
email?: string;
|
|
61
|
+
passwordHashed?: string;
|
|
62
|
+
/** @deprecated */
|
|
63
|
+
password?: string;
|
|
64
|
+
timezone?: string;
|
|
65
|
+
expires?: string;
|
|
66
|
+
locale?: string;
|
|
67
|
+
isDeleted?: boolean;
|
|
68
|
+
isActive?: boolean;
|
|
69
|
+
isAdministrator?: boolean;
|
|
70
|
+
groups?: GroupAP[];
|
|
71
|
+
widgets?: Record<string, unknown>;
|
|
72
|
+
isConfirmed?: boolean;
|
|
73
|
+
}
|
package/package.json
CHANGED
package/system/bindInertia.js
CHANGED
|
@@ -22,7 +22,7 @@ export function bindInertia(adminizer) {
|
|
|
22
22
|
else {
|
|
23
23
|
const manifestPath = path.resolve(import.meta.dirname, '../assets/manifest.json');
|
|
24
24
|
if (!fs.existsSync(manifestPath)) {
|
|
25
|
-
console.
|
|
25
|
+
console.warn('[vite]: Warning: manifest.json not found in dist folder! Please run "npm run build:assets" first.');
|
|
26
26
|
return '';
|
|
27
27
|
}
|
|
28
28
|
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
package/assets/add-ZITr43GJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./app.js";import{c as m}from"./compiler-runtime-tM4jBQ-T.js";import{A as i}from"./app-layout-D1m9Kvxq.js";import p from"./add-form-CYOfr0Ef.js";import"./sidebar-4D-sX2l4.js";import"./index-DrWfGwtf.js";import"./button-CQ9t1kLz.js";import"./utils-DjqsqOe8.js";import"./index-DTRTjOmh.js";import"./createLucideIcon-BFG25zNo.js";import"./index-Cdb9ACvz.js";import"./index-D5ir9iUV.js";import"./index-K81GbF6O.js";import"./index-C0SL3SHw.js";import"./index-BC0yfOHo.js";import"./tooltip-D2ehgLlB.js";import"./index-BcE9FUM6.js";import"./app-shell-BWMRMkHM.js";import"./app-sidebar-BCtaEFGb.js";import"./nav-main-Q3xofGRT.js";import"./material-icon-CItZiB53.js";import"./chevron-right-D5q8rF7h.js";import"./index-BbXEMx9n.js";import"./index-DEk3sC8d.js";import"./chevrons-up-down-kALltqHV.js";import"./app-sidebar-header-DLAFi13E.js";import"./breadcrumbs-CQNon4Vl.js";import"./nav-user-Ds8i0Pa2.js";import"./dropdown-menu-SEBnEIiL.js";import"./user-info-DBYoAJYJ.js";import"./user-menu-content-qkvdkUVd.js";import"./icon-Bz9BMaD0.js";import"./use-appearance-Co6mO0dV.js";import"./label-Z506NKsW.js";import"./field-renderer-CapylJU9.js";import"./checkbox-W0nGAXIj.js";import"./index-DwctwfU0.js";import"./check-LAUWAnlX.js";import"./select-D1N8zRPY.js";import"./chevron-down-B5XuAFRu.js";import"./dynamic-controls-CSVVCONh.js";import"./input-DF7Ue23C.js";import"./multi-select-oabtVhUP.js";import"./popover-I249Gg2O.js";import"./search-BspystAk.js";import"./form-state-702tb_BV.js";import"./input-error-BBygona6.js";import"./move-left-BhKZRPb4.js";import"./loader-circle-Utah5tGx.js";const e=[];function to(){const r=m.c(1);let o;return r[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(i,{breadcrumbs:e,children:t.jsx(p,{})}),r[0]=o):o=r[0],o}export{to as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./app.js";import{c as m}from"./compiler-runtime-tM4jBQ-T.js";import{A as p}from"./app-layout-D1m9Kvxq.js";import i from"./add-group-form-dzadPSfL.js";import"./sidebar-4D-sX2l4.js";import"./index-DrWfGwtf.js";import"./button-CQ9t1kLz.js";import"./utils-DjqsqOe8.js";import"./index-DTRTjOmh.js";import"./createLucideIcon-BFG25zNo.js";import"./index-Cdb9ACvz.js";import"./index-D5ir9iUV.js";import"./index-K81GbF6O.js";import"./index-C0SL3SHw.js";import"./index-BC0yfOHo.js";import"./tooltip-D2ehgLlB.js";import"./index-BcE9FUM6.js";import"./app-shell-BWMRMkHM.js";import"./app-sidebar-BCtaEFGb.js";import"./nav-main-Q3xofGRT.js";import"./material-icon-CItZiB53.js";import"./chevron-right-D5q8rF7h.js";import"./index-BbXEMx9n.js";import"./index-DEk3sC8d.js";import"./chevrons-up-down-kALltqHV.js";import"./app-sidebar-header-DLAFi13E.js";import"./breadcrumbs-CQNon4Vl.js";import"./nav-user-Ds8i0Pa2.js";import"./dropdown-menu-SEBnEIiL.js";import"./user-info-DBYoAJYJ.js";import"./user-menu-content-qkvdkUVd.js";import"./icon-Bz9BMaD0.js";import"./use-appearance-Co6mO0dV.js";import"./label-Z506NKsW.js";import"./input-DF7Ue23C.js";import"./checkbox-W0nGAXIj.js";import"./index-DwctwfU0.js";import"./check-LAUWAnlX.js";import"./move-left-BhKZRPb4.js";import"./loader-circle-Utah5tGx.js";const e=[];function T(){const r=m.c(1);let o;return r[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(p,{breadcrumbs:e,children:t.jsx(i,{})}),r[0]=o):o=r[0],o}export{T as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./app.js";import{c as m}from"./compiler-runtime-tM4jBQ-T.js";import{A as i}from"./app-layout-D1m9Kvxq.js";import p from"./add-user-form-WHaw00sy.js";import"./sidebar-4D-sX2l4.js";import"./index-DrWfGwtf.js";import"./button-CQ9t1kLz.js";import"./utils-DjqsqOe8.js";import"./index-DTRTjOmh.js";import"./createLucideIcon-BFG25zNo.js";import"./index-Cdb9ACvz.js";import"./index-D5ir9iUV.js";import"./index-K81GbF6O.js";import"./index-C0SL3SHw.js";import"./index-BC0yfOHo.js";import"./tooltip-D2ehgLlB.js";import"./index-BcE9FUM6.js";import"./app-shell-BWMRMkHM.js";import"./app-sidebar-BCtaEFGb.js";import"./nav-main-Q3xofGRT.js";import"./material-icon-CItZiB53.js";import"./chevron-right-D5q8rF7h.js";import"./index-BbXEMx9n.js";import"./index-DEk3sC8d.js";import"./chevrons-up-down-kALltqHV.js";import"./app-sidebar-header-DLAFi13E.js";import"./breadcrumbs-CQNon4Vl.js";import"./nav-user-Ds8i0Pa2.js";import"./dropdown-menu-SEBnEIiL.js";import"./user-info-DBYoAJYJ.js";import"./user-menu-content-qkvdkUVd.js";import"./icon-Bz9BMaD0.js";import"./use-appearance-Co6mO0dV.js";import"./label-Z506NKsW.js";import"./input-DF7Ue23C.js";import"./select-D1N8zRPY.js";import"./index-DwctwfU0.js";import"./chevron-down-B5XuAFRu.js";import"./check-LAUWAnlX.js";import"./checkbox-W0nGAXIj.js";import"./input-error-BBygona6.js";import"./move-left-BhKZRPb4.js";import"./loader-circle-Utah5tGx.js";const e=[];function W(){const o=m.c(1);let r;return o[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(i,{breadcrumbs:e,children:t.jsx(p,{})}),o[0]=r):r=o[0],r}export{W as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as c,j as l}from"./app.js";import{c as M}from"./compiler-runtime-tM4jBQ-T.js";import{u as w}from"./index-DrWfGwtf.js";import{c as z}from"./index-D5ir9iUV.js";import{u as A,c as j,b as L}from"./index-Cdb9ACvz.js";import{u as O}from"./index-DwctwfU0.js";import{P as H}from"./index-BC0yfOHo.js";import{P as R}from"./index-K81GbF6O.js";import{c as K}from"./utils-DjqsqOe8.js";import{C as T}from"./check-LAUWAnlX.js";var v="Checkbox",[q,se]=z(v),[U,X]=q(v),N=c.forwardRef((r,e)=>{const{__scopeCheckbox:t,name:s,checked:a,defaultChecked:o,required:d,disabled:f,value:x="on",onCheckedChange:h,form:k,...y}=r,[n,E]=c.useState(null),P=w(e,i=>E(i)),p=c.useRef(!1),C=n?k||!!n.closest("form"):!0,[m,g]=A({prop:a,defaultProp:o??!1,onChange:h,caller:v}),D=c.useRef(m);return c.useEffect(()=>{const i=n==null?void 0:n.form;if(i){const b=()=>g(D.current);return i.addEventListener("reset",b),()=>i.removeEventListener("reset",b)}},[n,g]),l.jsxs(U,{scope:t,state:m,disabled:f,children:[l.jsx(R.button,{type:"button",role:"checkbox","aria-checked":u(m)?"mixed":m,"aria-required":d,"data-state":B(m),"data-disabled":f?"":void 0,disabled:f,value:x,...y,ref:P,onKeyDown:j(r.onKeyDown,i=>{i.key==="Enter"&&i.preventDefault()}),onClick:j(r.onClick,i=>{g(b=>u(b)?!0:!b),C&&(p.current=i.isPropagationStopped(),p.current||i.stopPropagation())})}),C&&l.jsx(S,{control:n,bubbles:!p.current,name:s,value:x,checked:m,required:d,disabled:f,form:k,style:{transform:"translateX(-100%)"},defaultChecked:u(o)?!1:o})]})});N.displayName=v;var _="CheckboxIndicator",I=c.forwardRef((r,e)=>{const{__scopeCheckbox:t,forceMount:s,...a}=r,o=X(_,t);return l.jsx(H,{present:s||u(o.state)||o.state===!0,children:l.jsx(R.span,{"data-state":B(o.state),"data-disabled":o.disabled?"":void 0,...a,ref:e,style:{pointerEvents:"none",...r.style}})})});I.displayName=_;var $="CheckboxBubbleInput",S=c.forwardRef(({__scopeCheckbox:r,control:e,checked:t,bubbles:s=!0,defaultChecked:a,...o},d)=>{const f=c.useRef(null),x=w(f,d),h=O(t),k=L(e);c.useEffect(()=>{const n=f.current;if(!n)return;const E=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(E,"checked").set;if(h!==t&&p){const C=new Event("click",{bubbles:s});n.indeterminate=u(t),p.call(n,u(t)?!1:t),n.dispatchEvent(C)}},[h,t,s]);const y=c.useRef(u(t)?!1:t);return l.jsx(R.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??y.current,...o,tabIndex:-1,ref:x,style:{...o.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});S.displayName=$;function u(r){return r==="indeterminate"}function B(r){return u(r)?"indeterminate":r?"checked":"unchecked"}var F=N,G=I;function ae(r){const e=M.c(9);let t,s;e[0]!==r?({className:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=K("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),e[3]=t,e[4]=a):a=e[4];let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=l.jsx(G,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:l.jsx(T,{className:"size-3.5"})}),e[5]=o):o=e[5];let d;return e[6]!==s||e[7]!==a?(d=l.jsx(F,{"data-slot":"checkbox",className:a,...s,children:o}),e[6]=s,e[7]=a,e[8]=d):d=e[8],d}export{ae as C};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./app.js";import{c as m}from"./compiler-runtime-tM4jBQ-T.js";import{A as i}from"./app-layout-D1m9Kvxq.js";import"./sidebar-4D-sX2l4.js";import"./index-DrWfGwtf.js";import"./button-CQ9t1kLz.js";import"./utils-DjqsqOe8.js";import"./index-DTRTjOmh.js";import"./createLucideIcon-BFG25zNo.js";import"./index-Cdb9ACvz.js";import"./index-D5ir9iUV.js";import"./index-K81GbF6O.js";import"./index-C0SL3SHw.js";import"./index-BC0yfOHo.js";import"./tooltip-D2ehgLlB.js";import"./index-BcE9FUM6.js";import"./app-shell-BWMRMkHM.js";import"./app-sidebar-BCtaEFGb.js";import"./nav-main-Q3xofGRT.js";import"./material-icon-CItZiB53.js";import"./chevron-right-D5q8rF7h.js";import"./index-BbXEMx9n.js";import"./index-DEk3sC8d.js";import"./chevrons-up-down-kALltqHV.js";import"./app-sidebar-header-DLAFi13E.js";import"./breadcrumbs-CQNon4Vl.js";import"./nav-user-Ds8i0Pa2.js";import"./dropdown-menu-SEBnEIiL.js";import"./user-info-DBYoAJYJ.js";import"./user-menu-content-qkvdkUVd.js";import"./icon-Bz9BMaD0.js";import"./use-appearance-Co6mO0dV.js";const p=[];function G(){const r=m.c(1);let o;return r[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(i,{breadcrumbs:p,children:t.jsx("div",{className:"flex h-full flex-1 flex-col gap-4 rounded-xl p-4",children:"Dashboard"})}),r[0]=o):o=r[0],o}export{G as default};
|
package/assets/form-DOUNk3o2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./app.js";import{c as m}from"./compiler-runtime-tM4jBQ-T.js";import{A as p}from"./app-layout-D1m9Kvxq.js";import i from"./form-lOKv4Qbw.js";import"./sidebar-4D-sX2l4.js";import"./index-DrWfGwtf.js";import"./button-CQ9t1kLz.js";import"./utils-DjqsqOe8.js";import"./index-DTRTjOmh.js";import"./createLucideIcon-BFG25zNo.js";import"./index-Cdb9ACvz.js";import"./index-D5ir9iUV.js";import"./index-K81GbF6O.js";import"./index-C0SL3SHw.js";import"./index-BC0yfOHo.js";import"./tooltip-D2ehgLlB.js";import"./index-BcE9FUM6.js";import"./app-shell-BWMRMkHM.js";import"./app-sidebar-BCtaEFGb.js";import"./nav-main-Q3xofGRT.js";import"./material-icon-CItZiB53.js";import"./chevron-right-D5q8rF7h.js";import"./index-BbXEMx9n.js";import"./index-DEk3sC8d.js";import"./chevrons-up-down-kALltqHV.js";import"./app-sidebar-header-DLAFi13E.js";import"./breadcrumbs-CQNon4Vl.js";import"./nav-user-Ds8i0Pa2.js";import"./dropdown-menu-SEBnEIiL.js";import"./user-info-DBYoAJYJ.js";import"./user-menu-content-qkvdkUVd.js";import"./icon-Bz9BMaD0.js";import"./use-appearance-Co6mO0dV.js";import"./form-state-702tb_BV.js";import"./add-form-CYOfr0Ef.js";import"./label-Z506NKsW.js";import"./field-renderer-CapylJU9.js";import"./checkbox-W0nGAXIj.js";import"./index-DwctwfU0.js";import"./check-LAUWAnlX.js";import"./select-D1N8zRPY.js";import"./chevron-down-B5XuAFRu.js";import"./dynamic-controls-CSVVCONh.js";import"./input-DF7Ue23C.js";import"./multi-select-oabtVhUP.js";import"./popover-I249Gg2O.js";import"./search-BspystAk.js";import"./input-error-BBygona6.js";import"./move-left-BhKZRPb4.js";import"./loader-circle-Utah5tGx.js";const e=[];function mr(){const o=m.c(1);let r;return o[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(p,{breadcrumbs:e,children:t.jsx(i,{})}),o[0]=r):r=o[0],r}export{mr as default};
|
package/assets/index-Cdb9ACvz.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as m,e as te,j as _,R as Me,b as ke}from"./app.js";import{u as Q,a as gt,c as Fe}from"./index-D5ir9iUV.js";import{P as et,d as Ne}from"./index-K81GbF6O.js";import{u as wt}from"./index-DrWfGwtf.js";function bt(t,e,{checkForDefaultPrevented:n=!0}={}){return function(r){if(t==null||t(r),n===!1||!r.defaultPrevented)return e==null?void 0:e(r)}}var $e=te[" useId ".trim().toString()]||(()=>{}),We=0;function ao(t){const[e,n]=m.useState($e());return Q(()=>{n(o=>o??String(We++))},[t]),e?`radix-${e}`:""}var Be=te[" useInsertionEffect ".trim().toString()]||Q;function fo({prop:t,defaultProp:e,onChange:n=()=>{},caller:o}){const[r,i,s]=_e({defaultProp:e,onChange:n}),c=t!==void 0,f=c?t:r;{const a=m.useRef(t!==void 0);m.useEffect(()=>{const u=a.current;u!==c&&console.warn(`${o} is changing from ${u?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),a.current=c},[c,o])}const l=m.useCallback(a=>{var u;if(c){const h=ze(a)?a(t):a;h!==t&&((u=s.current)==null||u.call(s,h))}else i(a)},[c,t,i,s]);return[f,l]}function _e({defaultProp:t,onChange:e}){const[n,o]=m.useState(t),r=m.useRef(n),i=m.useRef(e);return Be(()=>{i.current=e},[e]),m.useEffect(()=>{var s;r.current!==n&&((s=i.current)==null||s.call(i,n),r.current=n)},[n,r]),[n,o,i]}function ze(t){return typeof t=="function"}function He(t,e=globalThis==null?void 0:globalThis.document){const n=gt(t);m.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return e.addEventListener("keydown",o,{capture:!0}),()=>e.removeEventListener("keydown",o,{capture:!0})},[n,e])}var Ie="DismissableLayer",Pt="dismissableLayer.update",je="dismissableLayer.pointerDownOutside",Ve="dismissableLayer.focusOutside",Vt,ee=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ye=m.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:i,onInteractOutside:s,onDismiss:c,...f}=t,l=m.useContext(ee),[a,u]=m.useState(null),h=(a==null?void 0:a.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,d]=m.useState({}),p=wt(e,x=>u(x)),g=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),w=g.indexOf(y),v=a?g.indexOf(a):-1,E=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=w,A=qe(x=>{const C=x.target,M=[...l.branches].some(O=>O.contains(C));!b||M||(r==null||r(x),s==null||s(x),x.defaultPrevented||c==null||c())},h),P=Ke(x=>{const C=x.target;[...l.branches].some(O=>O.contains(C))||(i==null||i(x),s==null||s(x),x.defaultPrevented||c==null||c())},h);return He(x=>{v===l.layers.size-1&&(o==null||o(x),!x.defaultPrevented&&c&&(x.preventDefault(),c()))},h),m.useEffect(()=>{if(a)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Vt=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(a)),l.layers.add(a),Yt(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Vt)}},[a,h,n,l]),m.useEffect(()=>()=>{a&&(l.layers.delete(a),l.layersWithOutsidePointerEventsDisabled.delete(a),Yt())},[a,l]),m.useEffect(()=>{const x=()=>d({});return document.addEventListener(Pt,x),()=>document.removeEventListener(Pt,x)},[]),_.jsx(et.div,{...f,ref:p,style:{pointerEvents:E?b?"auto":"none":void 0,...t.style},onFocusCapture:bt(t.onFocusCapture,P.onFocusCapture),onBlurCapture:bt(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:bt(t.onPointerDownCapture,A.onPointerDownCapture)})});Ye.displayName=Ie;var Ue="DismissableLayerBranch",Xe=m.forwardRef((t,e)=>{const n=m.useContext(ee),o=m.useRef(null),r=wt(e,o);return m.useEffect(()=>{const i=o.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),_.jsx(et.div,{...t,ref:r})});Xe.displayName=Ue;function qe(t,e=globalThis==null?void 0:globalThis.document){const n=gt(t),o=m.useRef(!1),r=m.useRef(()=>{});return m.useEffect(()=>{const i=c=>{if(c.target&&!o.current){let f=function(){ne(je,n,l,{discrete:!0})};const l={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",r.current),r.current=f,e.addEventListener("click",r.current,{once:!0})):f()}else e.removeEventListener("click",r.current);o.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",i),e.removeEventListener("click",r.current)}},[e,n]),{onPointerDownCapture:()=>o.current=!0}}function Ke(t,e=globalThis==null?void 0:globalThis.document){const n=gt(t),o=m.useRef(!1);return m.useEffect(()=>{const r=i=>{i.target&&!o.current&&ne(Ve,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",r),()=>e.removeEventListener("focusin",r)},[e,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Yt(){const t=new CustomEvent(Pt);document.dispatchEvent(t)}function ne(t,e,n,{discrete:o}){const r=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&r.addEventListener(t,e,{once:!0}),o?Ne(r,i):r.dispatchEvent(i)}var Ze="Portal",Ge=m.forwardRef((t,e)=>{var c;const{container:n,...o}=t,[r,i]=m.useState(!1);Q(()=>i(!0),[]);const s=n||r&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return s?Me.createPortal(_.jsx(et.div,{...o,ref:e}),s):null});Ge.displayName=Ze;const Je=["top","right","bottom","left"],q=Math.min,$=Math.max,dt=Math.round,ft=Math.floor,j=t=>({x:t,y:t}),Qe={left:"right",right:"left",bottom:"top",top:"bottom"},tn={start:"end",end:"start"};function Rt(t,e,n){return $(t,q(e,n))}function U(t,e){return typeof t=="function"?t(e):t}function X(t){return t.split("-")[0]}function nt(t){return t.split("-")[1]}function St(t){return t==="x"?"y":"x"}function Dt(t){return t==="y"?"height":"width"}function K(t){return["top","bottom"].includes(X(t))?"y":"x"}function Lt(t){return St(K(t))}function en(t,e,n){n===void 0&&(n=!1);const o=nt(t),r=Lt(t),i=Dt(r);let s=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=ht(s)),[s,ht(s)]}function nn(t){const e=ht(t);return[Ct(t),e,Ct(e)]}function Ct(t){return t.replace(/start|end/g,e=>tn[e])}function on(t,e,n){const o=["left","right"],r=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?r:o:e?o:r;case"left":case"right":return e?i:s;default:return[]}}function rn(t,e,n,o){const r=nt(t);let i=on(X(t),n==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(Ct)))),i}function ht(t){return t.replace(/left|right|bottom|top/g,e=>Qe[e])}function sn(t){return{top:0,right:0,bottom:0,left:0,...t}}function oe(t){return typeof t!="number"?sn(t):{top:t,right:t,bottom:t,left:t}}function pt(t){const{x:e,y:n,width:o,height:r}=t;return{width:o,height:r,top:n,left:e,right:e+o,bottom:n+r,x:e,y:n}}function Ut(t,e,n){let{reference:o,floating:r}=t;const i=K(e),s=Lt(e),c=Dt(s),f=X(e),l=i==="y",a=o.x+o.width/2-r.width/2,u=o.y+o.height/2-r.height/2,h=o[c]/2-r[c]/2;let d;switch(f){case"top":d={x:a,y:o.y-r.height};break;case"bottom":d={x:a,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:u};break;case"left":d={x:o.x-r.width,y:u};break;default:d={x:o.x,y:o.y}}switch(nt(e)){case"start":d[s]-=h*(n&&l?-1:1);break;case"end":d[s]+=h*(n&&l?-1:1);break}return d}const cn=async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,c=i.filter(Boolean),f=await(s.isRTL==null?void 0:s.isRTL(e));let l=await s.getElementRects({reference:t,floating:e,strategy:r}),{x:a,y:u}=Ut(l,o,f),h=o,d={},p=0;for(let g=0;g<c.length;g++){const{name:y,fn:w}=c[g],{x:v,y:E,data:b,reset:A}=await w({x:a,y:u,initialPlacement:o,placement:h,strategy:r,middlewareData:d,rects:l,platform:s,elements:{reference:t,floating:e}});a=v??a,u=E??u,d={...d,[y]:{...d[y],...b}},A&&p<=50&&(p++,typeof A=="object"&&(A.placement&&(h=A.placement),A.rects&&(l=A.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:r}):A.rects),{x:a,y:u}=Ut(l,h,f)),g=-1)}return{x:a,y:u,placement:h,strategy:r,middlewareData:d}};async function it(t,e){var n;e===void 0&&(e={});const{x:o,y:r,platform:i,rects:s,elements:c,strategy:f}=t,{boundary:l="clippingAncestors",rootBoundary:a="viewport",elementContext:u="floating",altBoundary:h=!1,padding:d=0}=U(e,t),p=oe(d),y=c[h?u==="floating"?"reference":"floating":u],w=pt(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:l,rootBoundary:a,strategy:f})),v=u==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),b=await(i.isElement==null?void 0:i.isElement(E))?await(i.getScale==null?void 0:i.getScale(E))||{x:1,y:1}:{x:1,y:1},A=pt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:E,strategy:f}):v);return{top:(w.top-A.top+p.top)/b.y,bottom:(A.bottom-w.bottom+p.bottom)/b.y,left:(w.left-A.left+p.left)/b.x,right:(A.right-w.right+p.right)/b.x}}const ln=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:r,rects:i,platform:s,elements:c,middlewareData:f}=e,{element:l,padding:a=0}=U(t,e)||{};if(l==null)return{};const u=oe(a),h={x:n,y:o},d=Lt(r),p=Dt(d),g=await s.getDimensions(l),y=d==="y",w=y?"top":"left",v=y?"bottom":"right",E=y?"clientHeight":"clientWidth",b=i.reference[p]+i.reference[d]-h[d]-i.floating[p],A=h[d]-i.reference[d],P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l));let x=P?P[E]:0;(!x||!await(s.isElement==null?void 0:s.isElement(P)))&&(x=c.floating[E]||i.floating[p]);const C=b/2-A/2,M=x/2-g[p]/2-1,O=q(u[w],M),F=q(u[v],M),N=O,D=x-g[p]-F,S=x/2-g[p]/2+C,B=Rt(N,S,D),L=!f.arrow&&nt(r)!=null&&S!==B&&i.reference[p]/2-(S<N?O:F)-g[p]/2<0,T=L?S<N?S-N:S-D:0;return{[d]:h[d]+T,data:{[d]:B,centerOffset:S-B-T,...L&&{alignmentOffset:T}},reset:L}}}),an=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:c,platform:f,elements:l}=e,{mainAxis:a=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...y}=U(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=X(r),v=K(c),E=X(c)===c,b=await(f.isRTL==null?void 0:f.isRTL(l.floating)),A=h||(E||!g?[ht(c)]:nn(c)),P=p!=="none";!h&&P&&A.push(...rn(c,g,p,b));const x=[c,...A],C=await it(e,y),M=[];let O=((o=i.flip)==null?void 0:o.overflows)||[];if(a&&M.push(C[w]),u){const S=en(r,s,b);M.push(C[S[0]],C[S[1]])}if(O=[...O,{placement:r,overflows:M}],!M.every(S=>S<=0)){var F,N;const S=(((F=i.flip)==null?void 0:F.index)||0)+1,B=x[S];if(B)return{data:{index:S,overflows:O},reset:{placement:B}};let L=(N=O.filter(T=>T.overflows[0]<=0).sort((T,R)=>T.overflows[1]-R.overflows[1])[0])==null?void 0:N.placement;if(!L)switch(d){case"bestFit":{var D;const T=(D=O.filter(R=>{if(P){const k=K(R.placement);return k===v||k==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(k=>k>0).reduce((k,I)=>k+I,0)]).sort((R,k)=>R[1]-k[1])[0])==null?void 0:D[0];T&&(L=T);break}case"initialPlacement":L=c;break}if(r!==L)return{reset:{placement:L}}}return{}}}};function Xt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function qt(t){return Je.some(e=>t[e]>=0)}const fn=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:o="referenceHidden",...r}=U(t,e);switch(o){case"referenceHidden":{const i=await it(e,{...r,elementContext:"reference"}),s=Xt(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:qt(s)}}}case"escaped":{const i=await it(e,{...r,altBoundary:!0}),s=Xt(i,n.floating);return{data:{escapedOffsets:s,escaped:qt(s)}}}default:return{}}}}};async function un(t,e){const{placement:n,platform:o,elements:r}=t,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=X(n),c=nt(n),f=K(n)==="y",l=["left","top"].includes(s)?-1:1,a=i&&f?-1:1,u=U(e,t);let{mainAxis:h,crossAxis:d,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof p=="number"&&(d=c==="end"?p*-1:p),f?{x:d*a,y:h*l}:{x:h*l,y:d*a}}const dn=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:i,placement:s,middlewareData:c}=e,f=await un(e,t);return s===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+f.x,y:i+f.y,data:{...f,placement:s}}}}},hn=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:c={fn:y=>{let{x:w,y:v}=y;return{x:w,y:v}}},...f}=U(t,e),l={x:n,y:o},a=await it(e,f),u=K(X(r)),h=St(u);let d=l[h],p=l[u];if(i){const y=h==="y"?"top":"left",w=h==="y"?"bottom":"right",v=d+a[y],E=d-a[w];d=Rt(v,d,E)}if(s){const y=u==="y"?"top":"left",w=u==="y"?"bottom":"right",v=p+a[y],E=p-a[w];p=Rt(v,p,E)}const g=c.fn({...e,[h]:d,[u]:p});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[h]:i,[u]:s}}}}}},pn=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:r,rects:i,middlewareData:s}=e,{offset:c=0,mainAxis:f=!0,crossAxis:l=!0}=U(t,e),a={x:n,y:o},u=K(r),h=St(u);let d=a[h],p=a[u];const g=U(c,e),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(f){const E=h==="y"?"height":"width",b=i.reference[h]-i.floating[E]+y.mainAxis,A=i.reference[h]+i.reference[E]-y.mainAxis;d<b?d=b:d>A&&(d=A)}if(l){var w,v;const E=h==="y"?"width":"height",b=["top","left"].includes(X(r)),A=i.reference[u]-i.floating[E]+(b&&((w=s.offset)==null?void 0:w[u])||0)+(b?0:y.crossAxis),P=i.reference[u]+i.reference[E]+(b?0:((v=s.offset)==null?void 0:v[u])||0)-(b?y.crossAxis:0);p<A?p=A:p>P&&(p=P)}return{[h]:d,[u]:p}}}},mn=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:r,rects:i,platform:s,elements:c}=e,{apply:f=()=>{},...l}=U(t,e),a=await it(e,l),u=X(r),h=nt(r),d=K(r)==="y",{width:p,height:g}=i.floating;let y,w;u==="top"||u==="bottom"?(y=u,w=h===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(w=u,y=h==="end"?"top":"bottom");const v=g-a.top-a.bottom,E=p-a.left-a.right,b=q(g-a[y],v),A=q(p-a[w],E),P=!e.middlewareData.shift;let x=b,C=A;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(C=E),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(x=v),P&&!h){const O=$(a.left,0),F=$(a.right,0),N=$(a.top,0),D=$(a.bottom,0);d?C=p-2*(O!==0||F!==0?O+F:$(a.left,a.right)):x=g-2*(N!==0||D!==0?N+D:$(a.top,a.bottom))}await f({...e,availableWidth:C,availableHeight:x});const M=await s.getDimensions(c.floating);return p!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}};function yt(){return typeof window<"u"}function ot(t){return re(t)?(t.nodeName||"").toLowerCase():"#document"}function W(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Y(t){var e;return(e=(re(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function re(t){return yt()?t instanceof Node||t instanceof W(t).Node:!1}function z(t){return yt()?t instanceof Element||t instanceof W(t).Element:!1}function V(t){return yt()?t instanceof HTMLElement||t instanceof W(t).HTMLElement:!1}function Kt(t){return!yt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof W(t).ShadowRoot}function ct(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=H(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(r)}function gn(t){return["table","td","th"].includes(ot(t))}function xt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Tt(t){const e=Mt(),n=z(t)?H(t):t;return["transform","translate","scale","rotate","perspective"].some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function wn(t){let e=Z(t);for(;V(e)&&!tt(e);){if(Tt(e))return e;if(xt(e))return null;e=Z(e)}return null}function Mt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function tt(t){return["html","body","#document"].includes(ot(t))}function H(t){return W(t).getComputedStyle(t)}function vt(t){return z(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Z(t){if(ot(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Kt(t)&&t.host||Y(t);return Kt(e)?e.host:e}function ie(t){const e=Z(t);return tt(e)?t.ownerDocument?t.ownerDocument.body:t.body:V(e)&&ct(e)?e:ie(e)}function st(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=ie(t),i=r===((o=t.ownerDocument)==null?void 0:o.body),s=W(r);if(i){const c=Ot(s);return e.concat(s,s.visualViewport||[],ct(r)?r:[],c&&n?st(c):[])}return e.concat(r,st(r,[],n))}function Ot(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function se(t){const e=H(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=V(t),i=r?t.offsetWidth:n,s=r?t.offsetHeight:o,c=dt(n)!==i||dt(o)!==s;return c&&(n=i,o=s),{width:n,height:o,$:c}}function kt(t){return z(t)?t:t.contextElement}function J(t){const e=kt(t);if(!V(e))return j(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:i}=se(e);let s=(i?dt(n.width):n.width)/o,c=(i?dt(n.height):n.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const yn=j(0);function ce(t){const e=W(t);return!Mt()||!e.visualViewport?yn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function xn(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==W(t)?!1:e}function G(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=kt(t);let s=j(1);e&&(o?z(o)&&(s=J(o)):s=J(t));const c=xn(i,n,o)?ce(i):j(0);let f=(r.left+c.x)/s.x,l=(r.top+c.y)/s.y,a=r.width/s.x,u=r.height/s.y;if(i){const h=W(i),d=o&&z(o)?W(o):o;let p=h,g=Ot(p);for(;g&&o&&d!==p;){const y=J(g),w=g.getBoundingClientRect(),v=H(g),E=w.left+(g.clientLeft+parseFloat(v.paddingLeft))*y.x,b=w.top+(g.clientTop+parseFloat(v.paddingTop))*y.y;f*=y.x,l*=y.y,a*=y.x,u*=y.y,f+=E,l+=b,p=W(g),g=Ot(p)}}return pt({width:a,height:u,x:f,y:l})}function Ft(t,e){const n=vt(t).scrollLeft;return e?e.left+n:G(Y(t)).left+n}function le(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),r=o.left+e.scrollLeft-(n?0:Ft(t,o)),i=o.top+e.scrollTop;return{x:r,y:i}}function vn(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const i=r==="fixed",s=Y(o),c=e?xt(e.floating):!1;if(o===s||c&&i)return n;let f={scrollLeft:0,scrollTop:0},l=j(1);const a=j(0),u=V(o);if((u||!u&&!i)&&((ot(o)!=="body"||ct(s))&&(f=vt(o)),V(o))){const d=G(o);l=J(o),a.x=d.x+o.clientLeft,a.y=d.y+o.clientTop}const h=s&&!u&&!i?le(s,f,!0):j(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-f.scrollLeft*l.x+a.x+h.x,y:n.y*l.y-f.scrollTop*l.y+a.y+h.y}}function bn(t){return Array.from(t.getClientRects())}function An(t){const e=Y(t),n=vt(t),o=t.ownerDocument.body,r=$(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=$(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+Ft(t);const c=-n.scrollTop;return H(o).direction==="rtl"&&(s+=$(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:c}}function En(t,e){const n=W(t),o=Y(t),r=n.visualViewport;let i=o.clientWidth,s=o.clientHeight,c=0,f=0;if(r){i=r.width,s=r.height;const l=Mt();(!l||l&&e==="fixed")&&(c=r.offsetLeft,f=r.offsetTop)}return{width:i,height:s,x:c,y:f}}function Pn(t,e){const n=G(t,!0,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft,i=V(t)?J(t):j(1),s=t.clientWidth*i.x,c=t.clientHeight*i.y,f=r*i.x,l=o*i.y;return{width:s,height:c,x:f,y:l}}function Zt(t,e,n){let o;if(e==="viewport")o=En(t,n);else if(e==="document")o=An(Y(t));else if(z(e))o=Pn(e,n);else{const r=ce(t);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return pt(o)}function ae(t,e){const n=Z(t);return n===e||!z(n)||tt(n)?!1:H(n).position==="fixed"||ae(n,e)}function Rn(t,e){const n=e.get(t);if(n)return n;let o=st(t,[],!1).filter(c=>z(c)&&ot(c)!=="body"),r=null;const i=H(t).position==="fixed";let s=i?Z(t):t;for(;z(s)&&!tt(s);){const c=H(s),f=Tt(s);!f&&c.position==="fixed"&&(r=null),(i?!f&&!r:!f&&c.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||ct(s)&&!f&&ae(t,s))?o=o.filter(a=>a!==s):r=c,s=Z(s)}return e.set(t,o),o}function Cn(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const s=[...n==="clippingAncestors"?xt(e)?[]:Rn(e,this._c):[].concat(n),o],c=s[0],f=s.reduce((l,a)=>{const u=Zt(e,a,r);return l.top=$(u.top,l.top),l.right=q(u.right,l.right),l.bottom=q(u.bottom,l.bottom),l.left=$(u.left,l.left),l},Zt(e,c,r));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function On(t){const{width:e,height:n}=se(t);return{width:e,height:n}}function Sn(t,e,n){const o=V(e),r=Y(e),i=n==="fixed",s=G(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const f=j(0);if(o||!o&&!i)if((ot(e)!=="body"||ct(r))&&(c=vt(e)),o){const h=G(e,!0,i,e);f.x=h.x+e.clientLeft,f.y=h.y+e.clientTop}else r&&(f.x=Ft(r));const l=r&&!o&&!i?le(r,c):j(0),a=s.left+c.scrollLeft-f.x-l.x,u=s.top+c.scrollTop-f.y-l.y;return{x:a,y:u,width:s.width,height:s.height}}function At(t){return H(t).position==="static"}function Gt(t,e){if(!V(t)||H(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Y(t)===n&&(n=n.ownerDocument.body),n}function fe(t,e){const n=W(t);if(xt(t))return n;if(!V(t)){let r=Z(t);for(;r&&!tt(r);){if(z(r)&&!At(r))return r;r=Z(r)}return n}let o=Gt(t,e);for(;o&&gn(o)&&At(o);)o=Gt(o,e);return o&&tt(o)&&At(o)&&!Tt(o)?n:o||wn(t)||n}const Dn=async function(t){const e=this.getOffsetParent||fe,n=this.getDimensions,o=await n(t.floating);return{reference:Sn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Ln(t){return H(t).direction==="rtl"}const Tn={convertOffsetParentRelativeRectToViewportRelativeRect:vn,getDocumentElement:Y,getClippingRect:Cn,getOffsetParent:fe,getElementRects:Dn,getClientRects:bn,getDimensions:On,getScale:J,isElement:z,isRTL:Ln};function ue(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Mn(t,e){let n=null,o;const r=Y(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function s(c,f){c===void 0&&(c=!1),f===void 0&&(f=1),i();const l=t.getBoundingClientRect(),{left:a,top:u,width:h,height:d}=l;if(c||e(),!h||!d)return;const p=ft(u),g=ft(r.clientWidth-(a+h)),y=ft(r.clientHeight-(u+d)),w=ft(a),E={rootMargin:-p+"px "+-g+"px "+-y+"px "+-w+"px",threshold:$(0,q(1,f))||1};let b=!0;function A(P){const x=P[0].intersectionRatio;if(x!==f){if(!b)return s();x?s(!1,x):o=setTimeout(()=>{s(!1,1e-7)},1e3)}x===1&&!ue(l,t.getBoundingClientRect())&&s(),b=!1}try{n=new IntersectionObserver(A,{...E,root:r.ownerDocument})}catch{n=new IntersectionObserver(A,E)}n.observe(t)}return s(!0),i}function kn(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:f=!1}=o,l=kt(t),a=r||i?[...l?st(l):[],...st(e)]:[];a.forEach(w=>{r&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const u=l&&c?Mn(l,n):null;let h=-1,d=null;s&&(d=new ResizeObserver(w=>{let[v]=w;v&&v.target===l&&d&&(d.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var E;(E=d)==null||E.observe(e)})),n()}),l&&!f&&d.observe(l),d.observe(e));let p,g=f?G(t):null;f&&y();function y(){const w=G(t);g&&!ue(g,w)&&n(),g=w,p=requestAnimationFrame(y)}return n(),()=>{var w;a.forEach(v=>{r&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),u==null||u(),(w=d)==null||w.disconnect(),d=null,f&&cancelAnimationFrame(p)}}const Fn=dn,Nn=hn,$n=an,Wn=mn,Bn=fn,Jt=ln,_n=pn,zn=(t,e,n)=>{const o=new Map,r={platform:Tn,...n},i={...r.platform,_c:o};return cn(t,e,{...r,platform:i})};var ut=typeof document<"u"?m.useLayoutEffect:m.useEffect;function mt(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,r;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!mt(t[o],e[o]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,r[o]))return!1;for(o=n;o--!==0;){const i=r[o];if(!(i==="_owner"&&t.$$typeof)&&!mt(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function de(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Qt(t,e){const n=de(t);return Math.round(e*n)/n}function Et(t){const e=m.useRef(t);return ut(()=>{e.current=t}),e}function Hn(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:f,open:l}=t,[a,u]=m.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,d]=m.useState(o);mt(h,o)||d(o);const[p,g]=m.useState(null),[y,w]=m.useState(null),v=m.useCallback(R=>{R!==P.current&&(P.current=R,g(R))},[]),E=m.useCallback(R=>{R!==x.current&&(x.current=R,w(R))},[]),b=i||p,A=s||y,P=m.useRef(null),x=m.useRef(null),C=m.useRef(a),M=f!=null,O=Et(f),F=Et(r),N=Et(l),D=m.useCallback(()=>{if(!P.current||!x.current)return;const R={placement:e,strategy:n,middleware:h};F.current&&(R.platform=F.current),zn(P.current,x.current,R).then(k=>{const I={...k,isPositioned:N.current!==!1};S.current&&!mt(C.current,I)&&(C.current=I,ke.flushSync(()=>{u(I)}))})},[h,e,n,F,N]);ut(()=>{l===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,u(R=>({...R,isPositioned:!1})))},[l]);const S=m.useRef(!1);ut(()=>(S.current=!0,()=>{S.current=!1}),[]),ut(()=>{if(b&&(P.current=b),A&&(x.current=A),b&&A){if(O.current)return O.current(b,A,D);D()}},[b,A,D,O,M]);const B=m.useMemo(()=>({reference:P,floating:x,setReference:v,setFloating:E}),[v,E]),L=m.useMemo(()=>({reference:b,floating:A}),[b,A]),T=m.useMemo(()=>{const R={position:n,left:0,top:0};if(!L.floating)return R;const k=Qt(L.floating,a.x),I=Qt(L.floating,a.y);return c?{...R,transform:"translate("+k+"px, "+I+"px)",...de(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:I}},[n,c,L.floating,a.x,a.y]);return m.useMemo(()=>({...a,update:D,refs:B,elements:L,floatingStyles:T}),[a,D,B,L,T])}const In=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:o,padding:r}=typeof t=="function"?t(n):t;return o&&e(o)?o.current!=null?Jt({element:o.current,padding:r}).fn(n):{}:o?Jt({element:o,padding:r}).fn(n):{}}}},jn=(t,e)=>({...Fn(t),options:[t,e]}),Vn=(t,e)=>({...Nn(t),options:[t,e]}),Yn=(t,e)=>({..._n(t),options:[t,e]}),Un=(t,e)=>({...$n(t),options:[t,e]}),Xn=(t,e)=>({...Wn(t),options:[t,e]}),qn=(t,e)=>({...Bn(t),options:[t,e]}),Kn=(t,e)=>({...In(t),options:[t,e]});var Zn="Arrow",he=m.forwardRef((t,e)=>{const{children:n,width:o=10,height:r=5,...i}=t;return _.jsx(et.svg,{...i,ref:e,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:_.jsx("polygon",{points:"0,0 30,0 15,10"})})});he.displayName=Zn;var Gn=he;function Jn(t){const[e,n]=m.useState(void 0);return Q(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const i=r[0];let s,c;if("borderBoxSize"in i){const f=i.borderBoxSize,l=Array.isArray(f)?f[0]:f;s=l.inlineSize,c=l.blockSize}else s=t.offsetWidth,c=t.offsetHeight;n({width:s,height:c})});return o.observe(t,{box:"border-box"}),()=>o.unobserve(t)}else n(void 0)},[t]),e}var Nt="Popper",[pe,uo]=Fe(Nt),[Qn,me]=pe(Nt),ge=t=>{const{__scopePopper:e,children:n}=t,[o,r]=m.useState(null);return _.jsx(Qn,{scope:e,anchor:o,onAnchorChange:r,children:n})};ge.displayName=Nt;var we="PopperAnchor",ye=m.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:o,...r}=t,i=me(we,n),s=m.useRef(null),c=wt(e,s);return m.useEffect(()=>{i.onAnchorChange((o==null?void 0:o.current)||s.current)}),o?null:_.jsx(et.div,{...r,ref:c})});ye.displayName=we;var $t="PopperContent",[to,eo]=pe($t),xe=m.forwardRef((t,e)=>{var Wt,Bt,_t,zt,Ht,It;const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:i="center",alignOffset:s=0,arrowPadding:c=0,avoidCollisions:f=!0,collisionBoundary:l=[],collisionPadding:a=0,sticky:u="partial",hideWhenDetached:h=!1,updatePositionStrategy:d="optimized",onPlaced:p,...g}=t,y=me($t,n),[w,v]=m.useState(null),E=wt(e,rt=>v(rt)),[b,A]=m.useState(null),P=Jn(b),x=(P==null?void 0:P.width)??0,C=(P==null?void 0:P.height)??0,M=o+(i!=="center"?"-"+i:""),O=typeof a=="number"?a:{top:0,right:0,bottom:0,left:0,...a},F=Array.isArray(l)?l:[l],N=F.length>0,D={padding:O,boundary:F.filter(oo),altBoundary:N},{refs:S,floatingStyles:B,placement:L,isPositioned:T,middlewareData:R}=Hn({strategy:"fixed",placement:M,whileElementsMounted:(...rt)=>kn(...rt,{animationFrame:d==="always"}),elements:{reference:y.anchor},middleware:[jn({mainAxis:r+C,alignmentAxis:s}),f&&Vn({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Yn():void 0,...D}),f&&Un({...D}),Xn({...D,apply:({elements:rt,rects:jt,availableWidth:Se,availableHeight:De})=>{const{width:Le,height:Te}=jt.reference,at=rt.floating.style;at.setProperty("--radix-popper-available-width",`${Se}px`),at.setProperty("--radix-popper-available-height",`${De}px`),at.setProperty("--radix-popper-anchor-width",`${Le}px`),at.setProperty("--radix-popper-anchor-height",`${Te}px`)}}),b&&Kn({element:b,padding:c}),ro({arrowWidth:x,arrowHeight:C}),h&&qn({strategy:"referenceHidden",...D})]}),[k,I]=Ae(L),lt=gt(p);Q(()=>{T&&(lt==null||lt())},[T,lt]);const Ee=(Wt=R.arrow)==null?void 0:Wt.x,Pe=(Bt=R.arrow)==null?void 0:Bt.y,Re=((_t=R.arrow)==null?void 0:_t.centerOffset)!==0,[Ce,Oe]=m.useState();return Q(()=>{w&&Oe(window.getComputedStyle(w).zIndex)},[w]),_.jsx("div",{ref:S.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:T?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ce,"--radix-popper-transform-origin":[(zt=R.transformOrigin)==null?void 0:zt.x,(Ht=R.transformOrigin)==null?void 0:Ht.y].join(" "),...((It=R.hide)==null?void 0:It.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:_.jsx(to,{scope:n,placedSide:k,onArrowChange:A,arrowX:Ee,arrowY:Pe,shouldHideArrow:Re,children:_.jsx(et.div,{"data-side":k,"data-align":I,...g,ref:E,style:{...g.style,animation:T?void 0:"none"}})})})});xe.displayName=$t;var ve="PopperArrow",no={top:"bottom",right:"left",bottom:"top",left:"right"},be=m.forwardRef(function(e,n){const{__scopePopper:o,...r}=e,i=eo(ve,o),s=no[i.placedSide];return _.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:_.jsx(Gn,{...r,ref:n,style:{...r.style,display:"block"}})})});be.displayName=ve;function oo(t){return t!==null}var ro=t=>({name:"transformOrigin",options:t,fn(e){var y,w,v;const{placement:n,rects:o,middlewareData:r}=e,s=((y=r.arrow)==null?void 0:y.centerOffset)!==0,c=s?0:t.arrowWidth,f=s?0:t.arrowHeight,[l,a]=Ae(n),u={start:"0%",center:"50%",end:"100%"}[a],h=(((w=r.arrow)==null?void 0:w.x)??0)+c/2,d=(((v=r.arrow)==null?void 0:v.y)??0)+f/2;let p="",g="";return l==="bottom"?(p=s?u:`${h}px`,g=`${-f}px`):l==="top"?(p=s?u:`${h}px`,g=`${o.floating.height+f}px`):l==="right"?(p=`${-f}px`,g=s?u:`${d}px`):l==="left"&&(p=`${o.floating.width+f}px`,g=s?u:`${d}px`),{data:{x:p,y:g}}}});function Ae(t){const[e,n="center"]=t.split("-");return[e,n]}var ho=ge,po=ye,mo=xe,go=be;export{po as A,mo as C,Ye as D,Ge as P,ho as R,ao as a,Jn as b,bt as c,uo as d,go as e,fo as u};
|