@mattisvensson/strapi-plugin-webatlas 0.8.0 → 0.8.2

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 (84) hide show
  1. package/dist/_chunks/FullLoader-Cmsf8xS6.js +12 -0
  2. package/dist/_chunks/FullLoader-Cmsf8xS6.js.map +1 -0
  3. package/dist/_chunks/FullLoader-CrPED_dY.mjs +1 -0
  4. package/dist/_chunks/FullLoader-CrPED_dY.mjs.map +1 -0
  5. package/dist/_chunks/SettingTitle-BaaQ_99D.mjs +69 -0
  6. package/dist/_chunks/SettingTitle-BaaQ_99D.mjs.map +1 -0
  7. package/dist/_chunks/SettingTitle-D5oNwpzC.js +67 -0
  8. package/dist/_chunks/SettingTitle-DDZxIqee.js +68 -0
  9. package/dist/_chunks/SettingTitle-DDZxIqee.js.map +1 -0
  10. package/dist/_chunks/SettingTitle-IwvX4Kb5.mjs +68 -0
  11. package/dist/_chunks/{de-C1QgkRoj.mjs → de-B9pq-AJZ.mjs} +11 -2
  12. package/dist/_chunks/de-B9pq-AJZ.mjs.map +1 -0
  13. package/dist/_chunks/de-DlQxM8Tg.js +131 -0
  14. package/dist/_chunks/de-DlQxM8Tg.js.map +1 -0
  15. package/dist/_chunks/{en--8p5hbLP.mjs → en-Dmbcf7gp.mjs} +11 -2
  16. package/dist/_chunks/en-Dmbcf7gp.mjs.map +1 -0
  17. package/dist/_chunks/en-DrhxIwOr.js +131 -0
  18. package/dist/_chunks/en-DrhxIwOr.js.map +1 -0
  19. package/dist/_chunks/index--XAogZgv.js +247 -0
  20. package/dist/_chunks/index--XAogZgv.js.map +1 -0
  21. package/dist/_chunks/index-2lVgPz4a.js +128 -0
  22. package/dist/_chunks/index-B1dEY-gs.js +246 -0
  23. package/dist/_chunks/index-B1mbYb2_.js +293 -0
  24. package/dist/_chunks/index-B2tjc_lG.mjs +247 -0
  25. package/dist/_chunks/index-B2tjc_lG.mjs.map +1 -0
  26. package/dist/_chunks/index-BFuwbmZy.js +12241 -0
  27. package/dist/_chunks/{index-DSPh-fHL.mjs → index-D2Meknib.mjs} +11 -9
  28. package/dist/_chunks/index-D2SIGcj3.mjs +12242 -0
  29. package/dist/_chunks/index-D2SIGcj3.mjs.map +1 -0
  30. package/dist/_chunks/index-DH0mFrgH.js +129 -0
  31. package/dist/_chunks/index-DH0mFrgH.js.map +1 -0
  32. package/dist/_chunks/index-DKtlnMlv.js +12242 -0
  33. package/dist/_chunks/index-DKtlnMlv.js.map +1 -0
  34. package/dist/_chunks/index-DOMrViWi.js +4207 -0
  35. package/dist/_chunks/index-DOMrViWi.js.map +1 -0
  36. package/dist/_chunks/index-DXRtXlZW.mjs +129 -0
  37. package/dist/_chunks/index-DXRtXlZW.mjs.map +1 -0
  38. package/dist/_chunks/index-Df365kgY.js +294 -0
  39. package/dist/_chunks/index-Df365kgY.js.map +1 -0
  40. package/dist/_chunks/{index-VcxUbdMO.mjs → index-Dm_GIRd4.mjs} +35 -30
  41. package/dist/_chunks/index-Dt-mlR1F.mjs +4191 -0
  42. package/dist/_chunks/index-Dt-mlR1F.mjs.map +1 -0
  43. package/dist/_chunks/index-QFbHwlyj.mjs +294 -0
  44. package/dist/_chunks/index-QFbHwlyj.mjs.map +1 -0
  45. package/dist/_chunks/{index-7rox7tGX.mjs → index-QU9SZ_H9.mjs} +93 -52
  46. package/dist/_chunks/{index-Z3qq1ab8.mjs → index-_49Fvwqq.mjs} +47 -36
  47. package/dist/_chunks/{index-DGSjLYNl.mjs → index-aAKsnALd.mjs} +1 -1
  48. package/dist/_chunks/index-g8wz2qoC.js +4206 -0
  49. package/dist/admin/index.js +5 -0
  50. package/dist/admin/index.js.map +1 -0
  51. package/dist/admin/index.mjs +2 -1
  52. package/dist/admin/index.mjs.map +1 -0
  53. package/dist/admin/src/components/modals/NavEdit.d.ts +1 -1
  54. package/dist/admin/src/pages/Navigation/RouteItem.d.ts +1 -0
  55. package/dist/admin/src/pages/Settings/ContentBox.d.ts +5 -0
  56. package/dist/admin/src/pages/Settings/PageWrapper.d.ts +2 -1
  57. package/dist/admin/src/pages/Settings/SettingTitle.d.ts +4 -0
  58. package/dist/admin/src/pages/Settings/index.d.ts +4 -0
  59. package/dist/pluginId.d.ts +2 -1
  60. package/dist/server/index.js +63 -45
  61. package/dist/server/index.js.map +1 -0
  62. package/dist/server/index.mjs +63 -45
  63. package/dist/server/index.mjs.map +1 -0
  64. package/dist/server/src/utils/index.d.ts +6 -0
  65. package/dist/server/src/utils/navItemHandler.d.ts +1 -1
  66. package/dist/server/src/utils/reduceDepthOfOrphanedItems.d.ts +2 -0
  67. package/package.json +1 -1
  68. package/dist/_chunks/PageWrapper-B6nLPFak.mjs +0 -55
  69. package/dist/_chunks/PageWrapper-BMzPDWn4.js +0 -0
  70. package/dist/_chunks/PageWrapper-BMzPDWn4.js.map +0 -0
  71. package/dist/_chunks/de-DYxCPOdb.js +0 -0
  72. package/dist/_chunks/de-DYxCPOdb.js.map +0 -0
  73. package/dist/_chunks/en-Be-athEA.js +0 -0
  74. package/dist/_chunks/en-Be-athEA.js.map +0 -0
  75. package/dist/_chunks/index-Bu-uQ9jA.js +0 -0
  76. package/dist/_chunks/index-Bu-uQ9jA.js.map +0 -0
  77. package/dist/_chunks/index-C53yDU_z.js +0 -0
  78. package/dist/_chunks/index-C53yDU_z.js.map +0 -0
  79. package/dist/_chunks/index-CAz59RSr.js +0 -0
  80. package/dist/_chunks/index-CAz59RSr.js.map +0 -0
  81. package/dist/_chunks/index-DKfUSLPc.js +0 -0
  82. package/dist/_chunks/index-DKfUSLPc.js.map +0 -0
  83. package/dist/_chunks/index-DPMhcaxW.js +0 -0
  84. package/dist/_chunks/index-DPMhcaxW.js.map +0 -0
@@ -0,0 +1,4191 @@
1
+ import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { useRef, useEffect, useState, useCallback, createContext, useMemo, createElement, useContext, Fragment, forwardRef, Children, isValidElement, cloneElement, useLayoutEffect, useReducer } from "react";
4
+ import { Link, List, Information } from "@strapi/icons";
5
+ import { useFetchClient, unstable_useContentManagerContext } from "@strapi/strapi/admin";
6
+ import { Box, Typography, Flex, Divider, Field, Checkbox, Link as Link$1 } from "@strapi/design-system";
7
+ import * as ReactDOM from "react-dom";
8
+ import ReactDOM__default, { flushSync } from "react-dom";
9
+ import { useIntl } from "react-intl";
10
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
11
+ const v = glob[path];
12
+ if (v) {
13
+ return typeof v === "function" ? v() : Promise.resolve(v);
14
+ }
15
+ return new Promise((_, reject) => {
16
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
17
+ reject.bind(
18
+ null,
19
+ new Error(
20
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
21
+ )
22
+ )
23
+ );
24
+ });
25
+ };
26
+ const version = "0.8.2";
27
+ const keywords = [];
28
+ const type = "commonjs";
29
+ const exports = {
30
+ "./package.json": "./package.json",
31
+ "./strapi-admin": {
32
+ types: "./dist/admin/src/index.d.ts",
33
+ source: "./admin/src/index.tsx",
34
+ "import": "./dist/admin/index.mjs",
35
+ require: "./dist/admin/index.js",
36
+ "default": "./dist/admin/index.js"
37
+ },
38
+ "./strapi-server": {
39
+ types: "./dist/server/src/index.d.ts",
40
+ source: "./server/src/index.ts",
41
+ "import": "./dist/server/index.mjs",
42
+ require: "./dist/server/index.js",
43
+ "default": "./dist/server/index.js"
44
+ }
45
+ };
46
+ const files = [
47
+ "dist"
48
+ ];
49
+ const scripts = {
50
+ build: "strapi-plugin build && yalc push --publish",
51
+ watch: "strapi-plugin watch",
52
+ "watch:link": "strapi-plugin watch:link",
53
+ verify: "strapi-plugin verify",
54
+ "test:ts:front": "tsc -p admin/tsconfig.json",
55
+ "test:ts:back": "tsc -p server/tsconfig.json",
56
+ "test:jest": "ENV_PATH=./playground/.env jest --verbose --runInBand --forceExit",
57
+ "test:cypress": "cypress run",
58
+ "test:cypress:open": "cypress open",
59
+ "playground:install": "yarn playground:yalc-add-link && cd playground && yarn install",
60
+ "playground:yalc-add": "cd playground && yalc add strapi-plugin-boilerplate",
61
+ "playground:yalc-add-link": "cd playground && yalc add --link strapi-plugin-boilerplate",
62
+ "playground:build": "cd playground && yarn build",
63
+ "playground:develop": "cd playground && yarn develop",
64
+ "playground:start": "cd playground && yarn start",
65
+ preversion: "yarn build",
66
+ postversion: "git push && git push --tags"
67
+ };
68
+ const dependencies = {
69
+ "@dnd-kit/core": "^6.3.1",
70
+ "@dnd-kit/sortable": "^10.0.0",
71
+ "@dnd-kit/utilities": "^3.2.2",
72
+ "@strapi/design-system": "^2.0.0-rc.14",
73
+ "@strapi/icons": "^2.0.0-rc.14",
74
+ "react-intl": "^7.1.0"
75
+ };
76
+ const devDependencies = {
77
+ "@strapi/sdk-plugin": "^5.0.0",
78
+ "@strapi/strapi": "^5.0.0",
79
+ "@strapi/typescript-utils": "^5.0.0",
80
+ "@types/react": "^19.0.0",
81
+ "@types/react-dom": "^19.0.0",
82
+ cypress: "^13.9.0",
83
+ "cypress-terminal-report": "^6.0.2",
84
+ jest: "^29.7.0",
85
+ prettier: "^3.4.2",
86
+ react: "^19.0.0",
87
+ "react-router-dom": "^6.0.0",
88
+ supertest: "^7.0.0",
89
+ typescript: "^5.7.2"
90
+ };
91
+ const peerDependencies = {
92
+ "@strapi/strapi": "^5.0.0",
93
+ react: "^17.0.0 || ^18.0.0",
94
+ "react-dom": "^17.0.0 || ^18.0.0",
95
+ "react-router-dom": "^6.0.0",
96
+ "styled-components": "^6.0.0"
97
+ };
98
+ const description = "A strapi plugin to manage URL routes and navigations.";
99
+ const strapi = {
100
+ name: "webatlas",
101
+ displayName: "Webatlas",
102
+ description: "A strapi plugin to manage URL routes and navigations.",
103
+ kind: "plugin"
104
+ };
105
+ const name = "@mattisvensson/strapi-plugin-webatlas";
106
+ const license = "MIT";
107
+ const repository = {
108
+ type: "git",
109
+ url: "git+ssh://git@github.com:mattisvensson/strapi-plugin-webatlas.git"
110
+ };
111
+ const bugs = {
112
+ url: "https://github.com/mattisvensson/strapi-plugin-webatlas/issues"
113
+ };
114
+ const homepage = "https://github.com/mattisvensson/strapi-plugin-webatlas#readme";
115
+ const author = {
116
+ name: "Matti Svensson",
117
+ email: "mattisvensson@web.de",
118
+ url: "https://mattisvensson.dev"
119
+ };
120
+ const maintainers = [
121
+ {
122
+ name: "Matti Svensson",
123
+ email: "mattisvensson@web.de",
124
+ url: "https://mattisvensson.dev"
125
+ }
126
+ ];
127
+ const packageManager = "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e";
128
+ const pluginPkg = {
129
+ version,
130
+ keywords,
131
+ type,
132
+ exports,
133
+ files,
134
+ scripts,
135
+ dependencies,
136
+ devDependencies,
137
+ peerDependencies,
138
+ description,
139
+ strapi,
140
+ name,
141
+ license,
142
+ repository,
143
+ bugs,
144
+ homepage,
145
+ author,
146
+ maintainers,
147
+ packageManager
148
+ };
149
+ const PLUGIN_ID = pluginPkg.strapi.name.replace(/^(@[^-,.][\w,-]+\/|strapi-)plugin-/i, "") || "webatlas";
150
+ const PLUGIN_NAME = pluginPkg.strapi.displayName;
151
+ const PLUGIN_VERSION = pluginPkg.version;
152
+ const Initializer = ({ setPlugin }) => {
153
+ const ref = useRef(setPlugin);
154
+ useEffect(() => {
155
+ ref.current(PLUGIN_ID);
156
+ }, []);
157
+ return null;
158
+ };
159
+ const RouteIcon = () => /* @__PURE__ */ jsx(Link, {});
160
+ const NavigationIcon = () => /* @__PURE__ */ jsx(List, {});
161
+ function useApi() {
162
+ const { get, put, del } = useFetchClient();
163
+ const fetchAllContentTypes = async () => {
164
+ const { data } = await get("/content-manager/content-types");
165
+ return data.data;
166
+ };
167
+ const fetchAllEntities = async (contentTypes) => {
168
+ try {
169
+ if (!contentTypes) {
170
+ const { data } = await get("/webatlas/config");
171
+ contentTypes = data?.selectedContentTypes || [];
172
+ }
173
+ const allContentTypes = await fetchAllContentTypes();
174
+ let entities = [];
175
+ if (contentTypes && contentTypes.length > 0) {
176
+ entities = await Promise.all(
177
+ contentTypes.map(async (contentType) => {
178
+ const { data } = await get(`/content-manager/collection-types/${contentType.uid}`);
179
+ const entity = allContentTypes.find((ct) => ct.uid === contentType.uid);
180
+ if (!entity) {
181
+ throw new Error(`Content type ${contentType} not found`);
182
+ }
183
+ return {
184
+ entities: data.results,
185
+ label: entity.info.displayName,
186
+ contentType
187
+ };
188
+ })
189
+ );
190
+ }
191
+ return entities;
192
+ } catch (err) {
193
+ console.error(err);
194
+ throw err;
195
+ }
196
+ };
197
+ const getRelatedRoute = async (relatedDocumentId) => {
198
+ const { data } = await get(`/webatlas/route/related?documentId=${relatedDocumentId}`);
199
+ return data;
200
+ };
201
+ const getRoutes = async () => {
202
+ const { data } = await get("/webatlas/route");
203
+ return data;
204
+ };
205
+ const updateRoute = async (body, documentId) => {
206
+ const { data } = await put(`/webatlas/route?documentId=${documentId}`, {
207
+ data: {
208
+ ...body
209
+ }
210
+ });
211
+ return data;
212
+ };
213
+ const getStructuredNavigation = async (documentId, variant = "nested") => {
214
+ const { data } = await get(`/webatlas/navigation?documentId=${documentId}&variant=${variant}`);
215
+ return data;
216
+ };
217
+ const getNavigation = async ({ documentId, variant } = {}) => {
218
+ const query = [];
219
+ if (documentId) query.push(`documentId=${documentId}`);
220
+ if (variant) query.push(`variant=${variant}`);
221
+ const { data } = await get(`/webatlas/navigation${query.length > 0 ? `?${query.join("&")}` : ""}`);
222
+ return data;
223
+ };
224
+ const deleteNavigation = async (documentId) => {
225
+ const { data } = await del(`/webatlas/navigation?documentId=${documentId}`);
226
+ return data;
227
+ };
228
+ const updateNavigation = async (documentId, body) => {
229
+ const { data } = await put(`/webatlas/navigation?documentId=${documentId}`, {
230
+ data: body
231
+ });
232
+ return data;
233
+ };
234
+ const updateNavigationItemStructure = async (documentId, navigationItems) => {
235
+ const { data } = await put(`/webatlas/navigation/items`, {
236
+ navigationId: documentId,
237
+ navigationItems
238
+ });
239
+ return data;
240
+ };
241
+ return {
242
+ fetchAllContentTypes,
243
+ fetchAllEntities,
244
+ getRelatedRoute,
245
+ getRoutes,
246
+ updateRoute,
247
+ getStructuredNavigation,
248
+ getNavigation,
249
+ deleteNavigation,
250
+ updateNavigation,
251
+ updateNavigationItemStructure
252
+ };
253
+ }
254
+ const useAllContentTypes = () => {
255
+ const { fetchAllContentTypes } = useApi();
256
+ const [contentTypes, setContentTypes] = useState([]);
257
+ const [loading, setLoading] = useState(true);
258
+ const [error, setError] = useState(null);
259
+ useEffect(() => {
260
+ const fetchEntities = async () => {
261
+ try {
262
+ const result = await fetchAllContentTypes();
263
+ setContentTypes(result);
264
+ setLoading(false);
265
+ } catch (err) {
266
+ setError(err);
267
+ setLoading(false);
268
+ }
269
+ };
270
+ fetchEntities();
271
+ }, []);
272
+ return { contentTypes, loading, error };
273
+ };
274
+ function usePluginConfig() {
275
+ const { put, get } = useFetchClient();
276
+ const [config, setConfigData] = useState(null);
277
+ const [loading, setLoading] = useState(true);
278
+ const [fetchError, setFetchError] = useState(null);
279
+ useEffect(() => {
280
+ const fetchData = async () => {
281
+ setLoading(true);
282
+ setFetchError(null);
283
+ try {
284
+ const { data: { data: contentTypesArray } } = await get("/content-manager/content-types");
285
+ let { data: config2 } = await get("/webatlas/config");
286
+ if (!config2 || !config2.selectedContentTypes) {
287
+ throw new Error(`Couldn't fetch plugin config`);
288
+ }
289
+ const allowedContentTypes = contentTypesArray.filter(
290
+ (type2) => type2.pluginOptions?.webatlas?.active === true
291
+ );
292
+ const contentTypeUids = new Set(allowedContentTypes.map((type2) => type2.uid));
293
+ const activeContentTypes = config2.selectedContentTypes.filter((type2) => contentTypeUids.has(type2.uid));
294
+ if (JSON.stringify(activeContentTypes) !== JSON.stringify(config2.selectedContentTypes)) {
295
+ config2 = { ...config2, selectedContentTypes: activeContentTypes };
296
+ await setConfig(config2);
297
+ }
298
+ if (config2.navigation?.maxDepth === void 0) {
299
+ config2.navigation = { ...config2.navigation, maxDepth: 3 };
300
+ await setConfig(config2);
301
+ }
302
+ setConfigData(config2);
303
+ } catch (error) {
304
+ setFetchError(error.message);
305
+ } finally {
306
+ setLoading(false);
307
+ }
308
+ };
309
+ fetchData();
310
+ }, []);
311
+ async function setConfig(body) {
312
+ try {
313
+ await put("/webatlas/config", { ...body });
314
+ } catch (error) {
315
+ throw error;
316
+ }
317
+ }
318
+ return { config, loading, fetchError, setConfig };
319
+ }
320
+ function transformToUrl(input) {
321
+ const specialCharMap = {
322
+ "ü": "ue",
323
+ "ä": "ae",
324
+ "ö": "oe"
325
+ };
326
+ if (!input || typeof input !== "string") return "";
327
+ input = input.toLowerCase();
328
+ input = input.replace(/\/+/g, "/");
329
+ input = input.startsWith("/") ? input.slice(1) : input;
330
+ input = input.endsWith("/") ? input.slice(0, -1) : input;
331
+ for (const char in specialCharMap) {
332
+ const regex = new RegExp(char, "g");
333
+ input = input.replace(regex, specialCharMap[char]);
334
+ }
335
+ input = input.trim();
336
+ input = input.replace(/\s+/g, "-");
337
+ input = input.replace(/[^A-Za-z0-9$\-_.+!*'()/]/g, "");
338
+ input = input.replace(/-+/g, "-");
339
+ return input;
340
+ }
341
+ function _extends() {
342
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
343
+ for (var e = 1; e < arguments.length; e++) {
344
+ var t = arguments[e];
345
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
346
+ }
347
+ return n;
348
+ }, _extends.apply(null, arguments);
349
+ }
350
+ function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
351
+ return function handleEvent(event) {
352
+ originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
353
+ if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
354
+ };
355
+ }
356
+ function $6ed0406888f73fc4$var$setRef(ref, value) {
357
+ if (typeof ref === "function") ref(value);
358
+ else if (ref !== null && ref !== void 0) ref.current = value;
359
+ }
360
+ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
361
+ return (node) => refs.forEach(
362
+ (ref) => $6ed0406888f73fc4$var$setRef(ref, node)
363
+ );
364
+ }
365
+ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
366
+ return useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
367
+ }
368
+ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
369
+ let defaultContexts = [];
370
+ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
371
+ const BaseContext = /* @__PURE__ */ createContext(defaultContext);
372
+ const index2 = defaultContexts.length;
373
+ defaultContexts = [
374
+ ...defaultContexts,
375
+ defaultContext
376
+ ];
377
+ function Provider(props) {
378
+ const { scope, children, ...context } = props;
379
+ const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index2]) || BaseContext;
380
+ const value = useMemo(
381
+ () => context,
382
+ Object.values(context)
383
+ );
384
+ return /* @__PURE__ */ createElement(Context.Provider, {
385
+ value
386
+ }, children);
387
+ }
388
+ function useContext$1(consumerName, scope) {
389
+ const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index2]) || BaseContext;
390
+ const context = useContext(Context);
391
+ if (context) return context;
392
+ if (defaultContext !== void 0) return defaultContext;
393
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
394
+ }
395
+ Provider.displayName = rootComponentName + "Provider";
396
+ return [
397
+ Provider,
398
+ useContext$1
399
+ ];
400
+ }
401
+ const createScope = () => {
402
+ const scopeContexts = defaultContexts.map((defaultContext) => {
403
+ return /* @__PURE__ */ createContext(defaultContext);
404
+ });
405
+ return function useScope(scope) {
406
+ const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
407
+ return useMemo(
408
+ () => ({
409
+ [`__scope${scopeName}`]: {
410
+ ...scope,
411
+ [scopeName]: contexts
412
+ }
413
+ }),
414
+ [
415
+ scope,
416
+ contexts
417
+ ]
418
+ );
419
+ };
420
+ };
421
+ createScope.scopeName = scopeName;
422
+ return [
423
+ $c512c27ab02ef895$export$fd42f52fd3ae1109,
424
+ $c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps)
425
+ ];
426
+ }
427
+ function $c512c27ab02ef895$var$composeContextScopes(...scopes) {
428
+ const baseScope = scopes[0];
429
+ if (scopes.length === 1) return baseScope;
430
+ const createScope1 = () => {
431
+ const scopeHooks = scopes.map(
432
+ (createScope) => ({
433
+ useScope: createScope(),
434
+ scopeName: createScope.scopeName
435
+ })
436
+ );
437
+ return function useComposedScopes(overrideScopes) {
438
+ const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope, scopeName }) => {
439
+ const scopeProps = useScope(overrideScopes);
440
+ const currentScope = scopeProps[`__scope${scopeName}`];
441
+ return {
442
+ ...nextScopes,
443
+ ...currentScope
444
+ };
445
+ }, {});
446
+ return useMemo(
447
+ () => ({
448
+ [`__scope${baseScope.scopeName}`]: nextScopes1
449
+ }),
450
+ [
451
+ nextScopes1
452
+ ]
453
+ );
454
+ };
455
+ };
456
+ createScope1.scopeName = baseScope.scopeName;
457
+ return createScope1;
458
+ }
459
+ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
460
+ const { children, ...slotProps } = props;
461
+ const childrenArray = Children.toArray(children);
462
+ const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);
463
+ if (slottable) {
464
+ const newElement = slottable.props.children;
465
+ const newChildren = childrenArray.map((child) => {
466
+ if (child === slottable) {
467
+ if (Children.count(newElement) > 1) return Children.only(null);
468
+ return /* @__PURE__ */ isValidElement(newElement) ? newElement.props.children : null;
469
+ } else return child;
470
+ });
471
+ return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
472
+ ref: forwardedRef
473
+ }), /* @__PURE__ */ isValidElement(newElement) ? /* @__PURE__ */ cloneElement(newElement, void 0, newChildren) : null);
474
+ }
475
+ return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
476
+ ref: forwardedRef
477
+ }), children);
478
+ });
479
+ $5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = "Slot";
480
+ const $5e63c961fc1ce211$var$SlotClone = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
481
+ const { children, ...slotProps } = props;
482
+ if (/* @__PURE__ */ isValidElement(children)) return /* @__PURE__ */ cloneElement(children, {
483
+ ...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),
484
+ ref: forwardedRef ? $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref) : children.ref
485
+ });
486
+ return Children.count(children) > 1 ? Children.only(null) : null;
487
+ });
488
+ $5e63c961fc1ce211$var$SlotClone.displayName = "SlotClone";
489
+ const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children }) => {
490
+ return /* @__PURE__ */ createElement(Fragment, null, children);
491
+ };
492
+ function $5e63c961fc1ce211$var$isSlottable(child) {
493
+ return /* @__PURE__ */ isValidElement(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;
494
+ }
495
+ function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {
496
+ const overrideProps = {
497
+ ...childProps
498
+ };
499
+ for (const propName in childProps) {
500
+ const slotPropValue = slotProps[propName];
501
+ const childPropValue = childProps[propName];
502
+ const isHandler = /^on[A-Z]/.test(propName);
503
+ if (isHandler) {
504
+ if (slotPropValue && childPropValue) overrideProps[propName] = (...args) => {
505
+ childPropValue(...args);
506
+ slotPropValue(...args);
507
+ };
508
+ else if (slotPropValue) overrideProps[propName] = slotPropValue;
509
+ } else if (propName === "style") overrideProps[propName] = {
510
+ ...slotPropValue,
511
+ ...childPropValue
512
+ };
513
+ else if (propName === "className") overrideProps[propName] = [
514
+ slotPropValue,
515
+ childPropValue
516
+ ].filter(Boolean).join(" ");
517
+ }
518
+ return {
519
+ ...slotProps,
520
+ ...overrideProps
521
+ };
522
+ }
523
+ const $8927f6f2acc4f386$var$NODES = [
524
+ "a",
525
+ "button",
526
+ "div",
527
+ "form",
528
+ "h2",
529
+ "h3",
530
+ "img",
531
+ "input",
532
+ "label",
533
+ "li",
534
+ "nav",
535
+ "ol",
536
+ "p",
537
+ "span",
538
+ "svg",
539
+ "ul"
540
+ ];
541
+ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node) => {
542
+ const Node2 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
543
+ const { asChild, ...primitiveProps } = props;
544
+ const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
545
+ useEffect(() => {
546
+ window[Symbol.for("radix-ui")] = true;
547
+ }, []);
548
+ return /* @__PURE__ */ createElement(Comp, _extends({}, primitiveProps, {
549
+ ref: forwardedRef
550
+ }));
551
+ });
552
+ Node2.displayName = `Primitive.${node}`;
553
+ return {
554
+ ...primitive,
555
+ [node]: Node2
556
+ };
557
+ }, {});
558
+ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {
559
+ if (target) flushSync(
560
+ () => target.dispatchEvent(event)
561
+ );
562
+ }
563
+ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
564
+ const callbackRef = useRef(callback);
565
+ useEffect(() => {
566
+ callbackRef.current = callback;
567
+ });
568
+ return useMemo(
569
+ () => (...args) => {
570
+ var _callbackRef$current;
571
+ return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
572
+ },
573
+ []
574
+ );
575
+ }
576
+ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
577
+ const onEscapeKeyDown = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEscapeKeyDownProp);
578
+ useEffect(() => {
579
+ const handleKeyDown = (event) => {
580
+ if (event.key === "Escape") onEscapeKeyDown(event);
581
+ };
582
+ ownerDocument.addEventListener("keydown", handleKeyDown);
583
+ return () => ownerDocument.removeEventListener("keydown", handleKeyDown);
584
+ }, [
585
+ onEscapeKeyDown,
586
+ ownerDocument
587
+ ]);
588
+ }
589
+ const $5cb92bef7577960e$var$CONTEXT_UPDATE = "dismissableLayer.update";
590
+ const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
591
+ const $5cb92bef7577960e$var$FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
592
+ let $5cb92bef7577960e$var$originalBodyPointerEvents;
593
+ const $5cb92bef7577960e$var$DismissableLayerContext = /* @__PURE__ */ createContext({
594
+ layers: /* @__PURE__ */ new Set(),
595
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
596
+ branches: /* @__PURE__ */ new Set()
597
+ });
598
+ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
599
+ var _node$ownerDocument;
600
+ const { disableOutsidePointerEvents = false, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, onDismiss, ...layerProps } = props;
601
+ const context = useContext($5cb92bef7577960e$var$DismissableLayerContext);
602
+ const [node1, setNode] = useState(null);
603
+ const ownerDocument = (_node$ownerDocument = node1 === null || node1 === void 0 ? void 0 : node1.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document;
604
+ const [, force] = useState({});
605
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(
606
+ forwardedRef,
607
+ (node) => setNode(node)
608
+ );
609
+ const layers = Array.from(context.layers);
610
+ const [highestLayerWithOutsidePointerEventsDisabled] = [
611
+ ...context.layersWithOutsidePointerEventsDisabled
612
+ ].slice(-1);
613
+ const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
614
+ const index2 = node1 ? layers.indexOf(node1) : -1;
615
+ const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
616
+ const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
617
+ const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event) => {
618
+ const target = event.target;
619
+ const isPointerDownOnBranch = [
620
+ ...context.branches
621
+ ].some(
622
+ (branch) => branch.contains(target)
623
+ );
624
+ if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
625
+ onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event);
626
+ onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
627
+ if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
628
+ }, ownerDocument);
629
+ const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event) => {
630
+ const target = event.target;
631
+ const isFocusInBranch = [
632
+ ...context.branches
633
+ ].some(
634
+ (branch) => branch.contains(target)
635
+ );
636
+ if (isFocusInBranch) return;
637
+ onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event);
638
+ onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
639
+ if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
640
+ }, ownerDocument);
641
+ $addc16e1bbe58fd0$export$3a72a57244d6e765((event) => {
642
+ const isHighestLayer = index2 === context.layers.size - 1;
643
+ if (!isHighestLayer) return;
644
+ onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);
645
+ if (!event.defaultPrevented && onDismiss) {
646
+ event.preventDefault();
647
+ onDismiss();
648
+ }
649
+ }, ownerDocument);
650
+ useEffect(() => {
651
+ if (!node1) return;
652
+ if (disableOutsidePointerEvents) {
653
+ if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
654
+ $5cb92bef7577960e$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
655
+ ownerDocument.body.style.pointerEvents = "none";
656
+ }
657
+ context.layersWithOutsidePointerEventsDisabled.add(node1);
658
+ }
659
+ context.layers.add(node1);
660
+ $5cb92bef7577960e$var$dispatchUpdate();
661
+ return () => {
662
+ if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents;
663
+ };
664
+ }, [
665
+ node1,
666
+ ownerDocument,
667
+ disableOutsidePointerEvents,
668
+ context
669
+ ]);
670
+ useEffect(() => {
671
+ return () => {
672
+ if (!node1) return;
673
+ context.layers.delete(node1);
674
+ context.layersWithOutsidePointerEventsDisabled.delete(node1);
675
+ $5cb92bef7577960e$var$dispatchUpdate();
676
+ };
677
+ }, [
678
+ node1,
679
+ context
680
+ ]);
681
+ useEffect(() => {
682
+ const handleUpdate = () => force({});
683
+ document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
684
+ return () => document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
685
+ }, []);
686
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, layerProps, {
687
+ ref: composedRefs,
688
+ style: {
689
+ pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
690
+ ...props.style
691
+ },
692
+ onFocusCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture),
693
+ onBlurCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture),
694
+ onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
695
+ }));
696
+ });
697
+ function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
698
+ const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside);
699
+ const isPointerInsideReactTreeRef = useRef(false);
700
+ const handleClickRef = useRef(() => {
701
+ });
702
+ useEffect(() => {
703
+ const handlePointerDown = (event) => {
704
+ if (event.target && !isPointerInsideReactTreeRef.current) {
705
+ let handleAndDispatchPointerDownOutsideEvent = function() {
706
+ $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {
707
+ discrete: true
708
+ });
709
+ };
710
+ const eventDetail = {
711
+ originalEvent: event
712
+ };
713
+ if (event.pointerType === "touch") {
714
+ ownerDocument.removeEventListener("click", handleClickRef.current);
715
+ handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;
716
+ ownerDocument.addEventListener("click", handleClickRef.current, {
717
+ once: true
718
+ });
719
+ } else handleAndDispatchPointerDownOutsideEvent();
720
+ } else
721
+ ownerDocument.removeEventListener("click", handleClickRef.current);
722
+ isPointerInsideReactTreeRef.current = false;
723
+ };
724
+ const timerId = window.setTimeout(() => {
725
+ ownerDocument.addEventListener("pointerdown", handlePointerDown);
726
+ }, 0);
727
+ return () => {
728
+ window.clearTimeout(timerId);
729
+ ownerDocument.removeEventListener("pointerdown", handlePointerDown);
730
+ ownerDocument.removeEventListener("click", handleClickRef.current);
731
+ };
732
+ }, [
733
+ ownerDocument,
734
+ handlePointerDownOutside
735
+ ]);
736
+ return {
737
+ // ensures we check React component tree (not just DOM tree)
738
+ onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
739
+ };
740
+ }
741
+ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
742
+ const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside);
743
+ const isFocusInsideReactTreeRef = useRef(false);
744
+ useEffect(() => {
745
+ const handleFocus = (event) => {
746
+ if (event.target && !isFocusInsideReactTreeRef.current) {
747
+ const eventDetail = {
748
+ originalEvent: event
749
+ };
750
+ $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
751
+ discrete: false
752
+ });
753
+ }
754
+ };
755
+ ownerDocument.addEventListener("focusin", handleFocus);
756
+ return () => ownerDocument.removeEventListener("focusin", handleFocus);
757
+ }, [
758
+ ownerDocument,
759
+ handleFocusOutside
760
+ ]);
761
+ return {
762
+ onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
763
+ onBlurCapture: () => isFocusInsideReactTreeRef.current = false
764
+ };
765
+ }
766
+ function $5cb92bef7577960e$var$dispatchUpdate() {
767
+ const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE);
768
+ document.dispatchEvent(event);
769
+ }
770
+ function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name2, handler, detail, { discrete }) {
771
+ const target = detail.originalEvent.target;
772
+ const event = new CustomEvent(name2, {
773
+ bubbles: false,
774
+ cancelable: true,
775
+ detail
776
+ });
777
+ if (handler) target.addEventListener(name2, handler, {
778
+ once: true
779
+ });
780
+ if (discrete) $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event);
781
+ else target.dispatchEvent(event);
782
+ }
783
+ const $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? useLayoutEffect : () => {
784
+ };
785
+ const $1746a345f3d73bb7$var$useReactId = React["useId".toString()] || (() => void 0);
786
+ let $1746a345f3d73bb7$var$count = 0;
787
+ function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
788
+ const [id, setId] = React.useState($1746a345f3d73bb7$var$useReactId());
789
+ $9f79659886946c16$export$e5c5a5f917a5871c(() => {
790
+ setId(
791
+ (reactId) => reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)
792
+ );
793
+ }, [
794
+ deterministicId
795
+ ]);
796
+ return id ? `radix-${id}` : "";
797
+ }
798
+ const sides = ["top", "right", "bottom", "left"];
799
+ const min = Math.min;
800
+ const max = Math.max;
801
+ const round = Math.round;
802
+ const floor = Math.floor;
803
+ const createCoords = (v) => ({
804
+ x: v,
805
+ y: v
806
+ });
807
+ const oppositeSideMap = {
808
+ left: "right",
809
+ right: "left",
810
+ bottom: "top",
811
+ top: "bottom"
812
+ };
813
+ const oppositeAlignmentMap = {
814
+ start: "end",
815
+ end: "start"
816
+ };
817
+ function clamp(start, value, end) {
818
+ return max(start, min(value, end));
819
+ }
820
+ function evaluate(value, param) {
821
+ return typeof value === "function" ? value(param) : value;
822
+ }
823
+ function getSide(placement) {
824
+ return placement.split("-")[0];
825
+ }
826
+ function getAlignment(placement) {
827
+ return placement.split("-")[1];
828
+ }
829
+ function getOppositeAxis(axis) {
830
+ return axis === "x" ? "y" : "x";
831
+ }
832
+ function getAxisLength(axis) {
833
+ return axis === "y" ? "height" : "width";
834
+ }
835
+ function getSideAxis(placement) {
836
+ return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
837
+ }
838
+ function getAlignmentAxis(placement) {
839
+ return getOppositeAxis(getSideAxis(placement));
840
+ }
841
+ function getAlignmentSides(placement, rects, rtl) {
842
+ if (rtl === void 0) {
843
+ rtl = false;
844
+ }
845
+ const alignment = getAlignment(placement);
846
+ const alignmentAxis = getAlignmentAxis(placement);
847
+ const length = getAxisLength(alignmentAxis);
848
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
849
+ if (rects.reference[length] > rects.floating[length]) {
850
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
851
+ }
852
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
853
+ }
854
+ function getExpandedPlacements(placement) {
855
+ const oppositePlacement = getOppositePlacement(placement);
856
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
857
+ }
858
+ function getOppositeAlignmentPlacement(placement) {
859
+ return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
860
+ }
861
+ function getSideList(side, isStart, rtl) {
862
+ const lr = ["left", "right"];
863
+ const rl = ["right", "left"];
864
+ const tb = ["top", "bottom"];
865
+ const bt = ["bottom", "top"];
866
+ switch (side) {
867
+ case "top":
868
+ case "bottom":
869
+ if (rtl) return isStart ? rl : lr;
870
+ return isStart ? lr : rl;
871
+ case "left":
872
+ case "right":
873
+ return isStart ? tb : bt;
874
+ default:
875
+ return [];
876
+ }
877
+ }
878
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
879
+ const alignment = getAlignment(placement);
880
+ let list = getSideList(getSide(placement), direction === "start", rtl);
881
+ if (alignment) {
882
+ list = list.map((side) => side + "-" + alignment);
883
+ if (flipAlignment) {
884
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
885
+ }
886
+ }
887
+ return list;
888
+ }
889
+ function getOppositePlacement(placement) {
890
+ return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
891
+ }
892
+ function expandPaddingObject(padding) {
893
+ return {
894
+ top: 0,
895
+ right: 0,
896
+ bottom: 0,
897
+ left: 0,
898
+ ...padding
899
+ };
900
+ }
901
+ function getPaddingObject(padding) {
902
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
903
+ top: padding,
904
+ right: padding,
905
+ bottom: padding,
906
+ left: padding
907
+ };
908
+ }
909
+ function rectToClientRect(rect) {
910
+ const {
911
+ x,
912
+ y,
913
+ width,
914
+ height
915
+ } = rect;
916
+ return {
917
+ width,
918
+ height,
919
+ top: y,
920
+ left: x,
921
+ right: x + width,
922
+ bottom: y + height,
923
+ x,
924
+ y
925
+ };
926
+ }
927
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
928
+ let {
929
+ reference,
930
+ floating
931
+ } = _ref;
932
+ const sideAxis = getSideAxis(placement);
933
+ const alignmentAxis = getAlignmentAxis(placement);
934
+ const alignLength = getAxisLength(alignmentAxis);
935
+ const side = getSide(placement);
936
+ const isVertical = sideAxis === "y";
937
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
938
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
939
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
940
+ let coords;
941
+ switch (side) {
942
+ case "top":
943
+ coords = {
944
+ x: commonX,
945
+ y: reference.y - floating.height
946
+ };
947
+ break;
948
+ case "bottom":
949
+ coords = {
950
+ x: commonX,
951
+ y: reference.y + reference.height
952
+ };
953
+ break;
954
+ case "right":
955
+ coords = {
956
+ x: reference.x + reference.width,
957
+ y: commonY
958
+ };
959
+ break;
960
+ case "left":
961
+ coords = {
962
+ x: reference.x - floating.width,
963
+ y: commonY
964
+ };
965
+ break;
966
+ default:
967
+ coords = {
968
+ x: reference.x,
969
+ y: reference.y
970
+ };
971
+ }
972
+ switch (getAlignment(placement)) {
973
+ case "start":
974
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
975
+ break;
976
+ case "end":
977
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
978
+ break;
979
+ }
980
+ return coords;
981
+ }
982
+ const computePosition$1 = async (reference, floating, config) => {
983
+ const {
984
+ placement = "bottom",
985
+ strategy = "absolute",
986
+ middleware = [],
987
+ platform: platform2
988
+ } = config;
989
+ const validMiddleware = middleware.filter(Boolean);
990
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
991
+ let rects = await platform2.getElementRects({
992
+ reference,
993
+ floating,
994
+ strategy
995
+ });
996
+ let {
997
+ x,
998
+ y
999
+ } = computeCoordsFromPlacement(rects, placement, rtl);
1000
+ let statefulPlacement = placement;
1001
+ let middlewareData = {};
1002
+ let resetCount = 0;
1003
+ for (let i = 0; i < validMiddleware.length; i++) {
1004
+ const {
1005
+ name: name2,
1006
+ fn
1007
+ } = validMiddleware[i];
1008
+ const {
1009
+ x: nextX,
1010
+ y: nextY,
1011
+ data,
1012
+ reset
1013
+ } = await fn({
1014
+ x,
1015
+ y,
1016
+ initialPlacement: placement,
1017
+ placement: statefulPlacement,
1018
+ strategy,
1019
+ middlewareData,
1020
+ rects,
1021
+ platform: platform2,
1022
+ elements: {
1023
+ reference,
1024
+ floating
1025
+ }
1026
+ });
1027
+ x = nextX != null ? nextX : x;
1028
+ y = nextY != null ? nextY : y;
1029
+ middlewareData = {
1030
+ ...middlewareData,
1031
+ [name2]: {
1032
+ ...middlewareData[name2],
1033
+ ...data
1034
+ }
1035
+ };
1036
+ if (reset && resetCount <= 50) {
1037
+ resetCount++;
1038
+ if (typeof reset === "object") {
1039
+ if (reset.placement) {
1040
+ statefulPlacement = reset.placement;
1041
+ }
1042
+ if (reset.rects) {
1043
+ rects = reset.rects === true ? await platform2.getElementRects({
1044
+ reference,
1045
+ floating,
1046
+ strategy
1047
+ }) : reset.rects;
1048
+ }
1049
+ ({
1050
+ x,
1051
+ y
1052
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
1053
+ }
1054
+ i = -1;
1055
+ }
1056
+ }
1057
+ return {
1058
+ x,
1059
+ y,
1060
+ placement: statefulPlacement,
1061
+ strategy,
1062
+ middlewareData
1063
+ };
1064
+ };
1065
+ async function detectOverflow(state, options) {
1066
+ var _await$platform$isEle;
1067
+ if (options === void 0) {
1068
+ options = {};
1069
+ }
1070
+ const {
1071
+ x,
1072
+ y,
1073
+ platform: platform2,
1074
+ rects,
1075
+ elements,
1076
+ strategy
1077
+ } = state;
1078
+ const {
1079
+ boundary = "clippingAncestors",
1080
+ rootBoundary = "viewport",
1081
+ elementContext = "floating",
1082
+ altBoundary = false,
1083
+ padding = 0
1084
+ } = evaluate(options, state);
1085
+ const paddingObject = getPaddingObject(padding);
1086
+ const altContext = elementContext === "floating" ? "reference" : "floating";
1087
+ const element = elements[altBoundary ? altContext : elementContext];
1088
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
1089
+ element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
1090
+ boundary,
1091
+ rootBoundary,
1092
+ strategy
1093
+ }));
1094
+ const rect = elementContext === "floating" ? {
1095
+ x,
1096
+ y,
1097
+ width: rects.floating.width,
1098
+ height: rects.floating.height
1099
+ } : rects.reference;
1100
+ const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
1101
+ const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
1102
+ x: 1,
1103
+ y: 1
1104
+ } : {
1105
+ x: 1,
1106
+ y: 1
1107
+ };
1108
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
1109
+ elements,
1110
+ rect,
1111
+ offsetParent,
1112
+ strategy
1113
+ }) : rect);
1114
+ return {
1115
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
1116
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
1117
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
1118
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
1119
+ };
1120
+ }
1121
+ const arrow$3 = (options) => ({
1122
+ name: "arrow",
1123
+ options,
1124
+ async fn(state) {
1125
+ const {
1126
+ x,
1127
+ y,
1128
+ placement,
1129
+ rects,
1130
+ platform: platform2,
1131
+ elements,
1132
+ middlewareData
1133
+ } = state;
1134
+ const {
1135
+ element,
1136
+ padding = 0
1137
+ } = evaluate(options, state) || {};
1138
+ if (element == null) {
1139
+ return {};
1140
+ }
1141
+ const paddingObject = getPaddingObject(padding);
1142
+ const coords = {
1143
+ x,
1144
+ y
1145
+ };
1146
+ const axis = getAlignmentAxis(placement);
1147
+ const length = getAxisLength(axis);
1148
+ const arrowDimensions = await platform2.getDimensions(element);
1149
+ const isYAxis = axis === "y";
1150
+ const minProp = isYAxis ? "top" : "left";
1151
+ const maxProp = isYAxis ? "bottom" : "right";
1152
+ const clientProp = isYAxis ? "clientHeight" : "clientWidth";
1153
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1154
+ const startDiff = coords[axis] - rects.reference[axis];
1155
+ const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
1156
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
1157
+ if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
1158
+ clientSize = elements.floating[clientProp] || rects.floating[length];
1159
+ }
1160
+ const centerToReference = endDiff / 2 - startDiff / 2;
1161
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
1162
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
1163
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
1164
+ const min$1 = minPadding;
1165
+ const max2 = clientSize - arrowDimensions[length] - maxPadding;
1166
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1167
+ const offset2 = clamp(min$1, center, max2);
1168
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
1169
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
1170
+ return {
1171
+ [axis]: coords[axis] + alignmentOffset,
1172
+ data: {
1173
+ [axis]: offset2,
1174
+ centerOffset: center - offset2 - alignmentOffset,
1175
+ ...shouldAddOffset && {
1176
+ alignmentOffset
1177
+ }
1178
+ },
1179
+ reset: shouldAddOffset
1180
+ };
1181
+ }
1182
+ });
1183
+ const flip$2 = function(options) {
1184
+ if (options === void 0) {
1185
+ options = {};
1186
+ }
1187
+ return {
1188
+ name: "flip",
1189
+ options,
1190
+ async fn(state) {
1191
+ var _middlewareData$arrow, _middlewareData$flip;
1192
+ const {
1193
+ placement,
1194
+ middlewareData,
1195
+ rects,
1196
+ initialPlacement,
1197
+ platform: platform2,
1198
+ elements
1199
+ } = state;
1200
+ const {
1201
+ mainAxis: checkMainAxis = true,
1202
+ crossAxis: checkCrossAxis = true,
1203
+ fallbackPlacements: specifiedFallbackPlacements,
1204
+ fallbackStrategy = "bestFit",
1205
+ fallbackAxisSideDirection = "none",
1206
+ flipAlignment = true,
1207
+ ...detectOverflowOptions
1208
+ } = evaluate(options, state);
1209
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1210
+ return {};
1211
+ }
1212
+ const side = getSide(placement);
1213
+ const initialSideAxis = getSideAxis(initialPlacement);
1214
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
1215
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
1216
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1217
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
1218
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
1219
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
1220
+ }
1221
+ const placements = [initialPlacement, ...fallbackPlacements];
1222
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1223
+ const overflows = [];
1224
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1225
+ if (checkMainAxis) {
1226
+ overflows.push(overflow[side]);
1227
+ }
1228
+ if (checkCrossAxis) {
1229
+ const sides2 = getAlignmentSides(placement, rects, rtl);
1230
+ overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
1231
+ }
1232
+ overflowsData = [...overflowsData, {
1233
+ placement,
1234
+ overflows
1235
+ }];
1236
+ if (!overflows.every((side2) => side2 <= 0)) {
1237
+ var _middlewareData$flip2, _overflowsData$filter;
1238
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
1239
+ const nextPlacement = placements[nextIndex];
1240
+ if (nextPlacement) {
1241
+ return {
1242
+ data: {
1243
+ index: nextIndex,
1244
+ overflows: overflowsData
1245
+ },
1246
+ reset: {
1247
+ placement: nextPlacement
1248
+ }
1249
+ };
1250
+ }
1251
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
1252
+ if (!resetPlacement) {
1253
+ switch (fallbackStrategy) {
1254
+ case "bestFit": {
1255
+ var _overflowsData$filter2;
1256
+ const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
1257
+ if (hasFallbackAxisSideDirection) {
1258
+ const currentSideAxis = getSideAxis(d.placement);
1259
+ return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
1260
+ // reading directions favoring greater width.
1261
+ currentSideAxis === "y";
1262
+ }
1263
+ return true;
1264
+ }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
1265
+ if (placement2) {
1266
+ resetPlacement = placement2;
1267
+ }
1268
+ break;
1269
+ }
1270
+ case "initialPlacement":
1271
+ resetPlacement = initialPlacement;
1272
+ break;
1273
+ }
1274
+ }
1275
+ if (placement !== resetPlacement) {
1276
+ return {
1277
+ reset: {
1278
+ placement: resetPlacement
1279
+ }
1280
+ };
1281
+ }
1282
+ }
1283
+ return {};
1284
+ }
1285
+ };
1286
+ };
1287
+ function getSideOffsets(overflow, rect) {
1288
+ return {
1289
+ top: overflow.top - rect.height,
1290
+ right: overflow.right - rect.width,
1291
+ bottom: overflow.bottom - rect.height,
1292
+ left: overflow.left - rect.width
1293
+ };
1294
+ }
1295
+ function isAnySideFullyClipped(overflow) {
1296
+ return sides.some((side) => overflow[side] >= 0);
1297
+ }
1298
+ const hide$2 = function(options) {
1299
+ if (options === void 0) {
1300
+ options = {};
1301
+ }
1302
+ return {
1303
+ name: "hide",
1304
+ options,
1305
+ async fn(state) {
1306
+ const {
1307
+ rects
1308
+ } = state;
1309
+ const {
1310
+ strategy = "referenceHidden",
1311
+ ...detectOverflowOptions
1312
+ } = evaluate(options, state);
1313
+ switch (strategy) {
1314
+ case "referenceHidden": {
1315
+ const overflow = await detectOverflow(state, {
1316
+ ...detectOverflowOptions,
1317
+ elementContext: "reference"
1318
+ });
1319
+ const offsets = getSideOffsets(overflow, rects.reference);
1320
+ return {
1321
+ data: {
1322
+ referenceHiddenOffsets: offsets,
1323
+ referenceHidden: isAnySideFullyClipped(offsets)
1324
+ }
1325
+ };
1326
+ }
1327
+ case "escaped": {
1328
+ const overflow = await detectOverflow(state, {
1329
+ ...detectOverflowOptions,
1330
+ altBoundary: true
1331
+ });
1332
+ const offsets = getSideOffsets(overflow, rects.floating);
1333
+ return {
1334
+ data: {
1335
+ escapedOffsets: offsets,
1336
+ escaped: isAnySideFullyClipped(offsets)
1337
+ }
1338
+ };
1339
+ }
1340
+ default: {
1341
+ return {};
1342
+ }
1343
+ }
1344
+ }
1345
+ };
1346
+ };
1347
+ async function convertValueToCoords(state, options) {
1348
+ const {
1349
+ placement,
1350
+ platform: platform2,
1351
+ elements
1352
+ } = state;
1353
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
1354
+ const side = getSide(placement);
1355
+ const alignment = getAlignment(placement);
1356
+ const isVertical = getSideAxis(placement) === "y";
1357
+ const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
1358
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
1359
+ const rawValue = evaluate(options, state);
1360
+ let {
1361
+ mainAxis,
1362
+ crossAxis,
1363
+ alignmentAxis
1364
+ } = typeof rawValue === "number" ? {
1365
+ mainAxis: rawValue,
1366
+ crossAxis: 0,
1367
+ alignmentAxis: null
1368
+ } : {
1369
+ mainAxis: rawValue.mainAxis || 0,
1370
+ crossAxis: rawValue.crossAxis || 0,
1371
+ alignmentAxis: rawValue.alignmentAxis
1372
+ };
1373
+ if (alignment && typeof alignmentAxis === "number") {
1374
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
1375
+ }
1376
+ return isVertical ? {
1377
+ x: crossAxis * crossAxisMulti,
1378
+ y: mainAxis * mainAxisMulti
1379
+ } : {
1380
+ x: mainAxis * mainAxisMulti,
1381
+ y: crossAxis * crossAxisMulti
1382
+ };
1383
+ }
1384
+ const offset$2 = function(options) {
1385
+ if (options === void 0) {
1386
+ options = 0;
1387
+ }
1388
+ return {
1389
+ name: "offset",
1390
+ options,
1391
+ async fn(state) {
1392
+ var _middlewareData$offse, _middlewareData$arrow;
1393
+ const {
1394
+ x,
1395
+ y,
1396
+ placement,
1397
+ middlewareData
1398
+ } = state;
1399
+ const diffCoords = await convertValueToCoords(state, options);
1400
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1401
+ return {};
1402
+ }
1403
+ return {
1404
+ x: x + diffCoords.x,
1405
+ y: y + diffCoords.y,
1406
+ data: {
1407
+ ...diffCoords,
1408
+ placement
1409
+ }
1410
+ };
1411
+ }
1412
+ };
1413
+ };
1414
+ const shift$2 = function(options) {
1415
+ if (options === void 0) {
1416
+ options = {};
1417
+ }
1418
+ return {
1419
+ name: "shift",
1420
+ options,
1421
+ async fn(state) {
1422
+ const {
1423
+ x,
1424
+ y,
1425
+ placement
1426
+ } = state;
1427
+ const {
1428
+ mainAxis: checkMainAxis = true,
1429
+ crossAxis: checkCrossAxis = false,
1430
+ limiter = {
1431
+ fn: (_ref) => {
1432
+ let {
1433
+ x: x2,
1434
+ y: y2
1435
+ } = _ref;
1436
+ return {
1437
+ x: x2,
1438
+ y: y2
1439
+ };
1440
+ }
1441
+ },
1442
+ ...detectOverflowOptions
1443
+ } = evaluate(options, state);
1444
+ const coords = {
1445
+ x,
1446
+ y
1447
+ };
1448
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1449
+ const crossAxis = getSideAxis(getSide(placement));
1450
+ const mainAxis = getOppositeAxis(crossAxis);
1451
+ let mainAxisCoord = coords[mainAxis];
1452
+ let crossAxisCoord = coords[crossAxis];
1453
+ if (checkMainAxis) {
1454
+ const minSide = mainAxis === "y" ? "top" : "left";
1455
+ const maxSide = mainAxis === "y" ? "bottom" : "right";
1456
+ const min2 = mainAxisCoord + overflow[minSide];
1457
+ const max2 = mainAxisCoord - overflow[maxSide];
1458
+ mainAxisCoord = clamp(min2, mainAxisCoord, max2);
1459
+ }
1460
+ if (checkCrossAxis) {
1461
+ const minSide = crossAxis === "y" ? "top" : "left";
1462
+ const maxSide = crossAxis === "y" ? "bottom" : "right";
1463
+ const min2 = crossAxisCoord + overflow[minSide];
1464
+ const max2 = crossAxisCoord - overflow[maxSide];
1465
+ crossAxisCoord = clamp(min2, crossAxisCoord, max2);
1466
+ }
1467
+ const limitedCoords = limiter.fn({
1468
+ ...state,
1469
+ [mainAxis]: mainAxisCoord,
1470
+ [crossAxis]: crossAxisCoord
1471
+ });
1472
+ return {
1473
+ ...limitedCoords,
1474
+ data: {
1475
+ x: limitedCoords.x - x,
1476
+ y: limitedCoords.y - y,
1477
+ enabled: {
1478
+ [mainAxis]: checkMainAxis,
1479
+ [crossAxis]: checkCrossAxis
1480
+ }
1481
+ }
1482
+ };
1483
+ }
1484
+ };
1485
+ };
1486
+ const limitShift$2 = function(options) {
1487
+ if (options === void 0) {
1488
+ options = {};
1489
+ }
1490
+ return {
1491
+ options,
1492
+ fn(state) {
1493
+ const {
1494
+ x,
1495
+ y,
1496
+ placement,
1497
+ rects,
1498
+ middlewareData
1499
+ } = state;
1500
+ const {
1501
+ offset: offset2 = 0,
1502
+ mainAxis: checkMainAxis = true,
1503
+ crossAxis: checkCrossAxis = true
1504
+ } = evaluate(options, state);
1505
+ const coords = {
1506
+ x,
1507
+ y
1508
+ };
1509
+ const crossAxis = getSideAxis(placement);
1510
+ const mainAxis = getOppositeAxis(crossAxis);
1511
+ let mainAxisCoord = coords[mainAxis];
1512
+ let crossAxisCoord = coords[crossAxis];
1513
+ const rawOffset = evaluate(offset2, state);
1514
+ const computedOffset = typeof rawOffset === "number" ? {
1515
+ mainAxis: rawOffset,
1516
+ crossAxis: 0
1517
+ } : {
1518
+ mainAxis: 0,
1519
+ crossAxis: 0,
1520
+ ...rawOffset
1521
+ };
1522
+ if (checkMainAxis) {
1523
+ const len = mainAxis === "y" ? "height" : "width";
1524
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
1525
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
1526
+ if (mainAxisCoord < limitMin) {
1527
+ mainAxisCoord = limitMin;
1528
+ } else if (mainAxisCoord > limitMax) {
1529
+ mainAxisCoord = limitMax;
1530
+ }
1531
+ }
1532
+ if (checkCrossAxis) {
1533
+ var _middlewareData$offse, _middlewareData$offse2;
1534
+ const len = mainAxis === "y" ? "width" : "height";
1535
+ const isOriginSide = ["top", "left"].includes(getSide(placement));
1536
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
1537
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
1538
+ if (crossAxisCoord < limitMin) {
1539
+ crossAxisCoord = limitMin;
1540
+ } else if (crossAxisCoord > limitMax) {
1541
+ crossAxisCoord = limitMax;
1542
+ }
1543
+ }
1544
+ return {
1545
+ [mainAxis]: mainAxisCoord,
1546
+ [crossAxis]: crossAxisCoord
1547
+ };
1548
+ }
1549
+ };
1550
+ };
1551
+ const size$2 = function(options) {
1552
+ if (options === void 0) {
1553
+ options = {};
1554
+ }
1555
+ return {
1556
+ name: "size",
1557
+ options,
1558
+ async fn(state) {
1559
+ var _state$middlewareData, _state$middlewareData2;
1560
+ const {
1561
+ placement,
1562
+ rects,
1563
+ platform: platform2,
1564
+ elements
1565
+ } = state;
1566
+ const {
1567
+ apply = () => {
1568
+ },
1569
+ ...detectOverflowOptions
1570
+ } = evaluate(options, state);
1571
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1572
+ const side = getSide(placement);
1573
+ const alignment = getAlignment(placement);
1574
+ const isYAxis = getSideAxis(placement) === "y";
1575
+ const {
1576
+ width,
1577
+ height
1578
+ } = rects.floating;
1579
+ let heightSide;
1580
+ let widthSide;
1581
+ if (side === "top" || side === "bottom") {
1582
+ heightSide = side;
1583
+ widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
1584
+ } else {
1585
+ widthSide = side;
1586
+ heightSide = alignment === "end" ? "top" : "bottom";
1587
+ }
1588
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
1589
+ const maximumClippingWidth = width - overflow.left - overflow.right;
1590
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
1591
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
1592
+ const noShift = !state.middlewareData.shift;
1593
+ let availableHeight = overflowAvailableHeight;
1594
+ let availableWidth = overflowAvailableWidth;
1595
+ if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
1596
+ availableWidth = maximumClippingWidth;
1597
+ }
1598
+ if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
1599
+ availableHeight = maximumClippingHeight;
1600
+ }
1601
+ if (noShift && !alignment) {
1602
+ const xMin = max(overflow.left, 0);
1603
+ const xMax = max(overflow.right, 0);
1604
+ const yMin = max(overflow.top, 0);
1605
+ const yMax = max(overflow.bottom, 0);
1606
+ if (isYAxis) {
1607
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
1608
+ } else {
1609
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
1610
+ }
1611
+ }
1612
+ await apply({
1613
+ ...state,
1614
+ availableWidth,
1615
+ availableHeight
1616
+ });
1617
+ const nextDimensions = await platform2.getDimensions(elements.floating);
1618
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
1619
+ return {
1620
+ reset: {
1621
+ rects: true
1622
+ }
1623
+ };
1624
+ }
1625
+ return {};
1626
+ }
1627
+ };
1628
+ };
1629
+ function hasWindow() {
1630
+ return typeof window !== "undefined";
1631
+ }
1632
+ function getNodeName(node) {
1633
+ if (isNode(node)) {
1634
+ return (node.nodeName || "").toLowerCase();
1635
+ }
1636
+ return "#document";
1637
+ }
1638
+ function getWindow(node) {
1639
+ var _node$ownerDocument;
1640
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1641
+ }
1642
+ function getDocumentElement(node) {
1643
+ var _ref;
1644
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1645
+ }
1646
+ function isNode(value) {
1647
+ if (!hasWindow()) {
1648
+ return false;
1649
+ }
1650
+ return value instanceof Node || value instanceof getWindow(value).Node;
1651
+ }
1652
+ function isElement(value) {
1653
+ if (!hasWindow()) {
1654
+ return false;
1655
+ }
1656
+ return value instanceof Element || value instanceof getWindow(value).Element;
1657
+ }
1658
+ function isHTMLElement(value) {
1659
+ if (!hasWindow()) {
1660
+ return false;
1661
+ }
1662
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1663
+ }
1664
+ function isShadowRoot(value) {
1665
+ if (!hasWindow() || typeof ShadowRoot === "undefined") {
1666
+ return false;
1667
+ }
1668
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1669
+ }
1670
+ function isOverflowElement(element) {
1671
+ const {
1672
+ overflow,
1673
+ overflowX,
1674
+ overflowY,
1675
+ display
1676
+ } = getComputedStyle$1(element);
1677
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
1678
+ }
1679
+ function isTableElement(element) {
1680
+ return ["table", "td", "th"].includes(getNodeName(element));
1681
+ }
1682
+ function isTopLayer(element) {
1683
+ return [":popover-open", ":modal"].some((selector) => {
1684
+ try {
1685
+ return element.matches(selector);
1686
+ } catch (e) {
1687
+ return false;
1688
+ }
1689
+ });
1690
+ }
1691
+ function isContainingBlock(elementOrCss) {
1692
+ const webkit = isWebKit();
1693
+ const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
1694
+ return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
1695
+ }
1696
+ function getContainingBlock(element) {
1697
+ let currentNode = getParentNode(element);
1698
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1699
+ if (isContainingBlock(currentNode)) {
1700
+ return currentNode;
1701
+ } else if (isTopLayer(currentNode)) {
1702
+ return null;
1703
+ }
1704
+ currentNode = getParentNode(currentNode);
1705
+ }
1706
+ return null;
1707
+ }
1708
+ function isWebKit() {
1709
+ if (typeof CSS === "undefined" || !CSS.supports) return false;
1710
+ return CSS.supports("-webkit-backdrop-filter", "none");
1711
+ }
1712
+ function isLastTraversableNode(node) {
1713
+ return ["html", "body", "#document"].includes(getNodeName(node));
1714
+ }
1715
+ function getComputedStyle$1(element) {
1716
+ return getWindow(element).getComputedStyle(element);
1717
+ }
1718
+ function getNodeScroll(element) {
1719
+ if (isElement(element)) {
1720
+ return {
1721
+ scrollLeft: element.scrollLeft,
1722
+ scrollTop: element.scrollTop
1723
+ };
1724
+ }
1725
+ return {
1726
+ scrollLeft: element.scrollX,
1727
+ scrollTop: element.scrollY
1728
+ };
1729
+ }
1730
+ function getParentNode(node) {
1731
+ if (getNodeName(node) === "html") {
1732
+ return node;
1733
+ }
1734
+ const result = (
1735
+ // Step into the shadow DOM of the parent of a slotted node.
1736
+ node.assignedSlot || // DOM Element detected.
1737
+ node.parentNode || // ShadowRoot detected.
1738
+ isShadowRoot(node) && node.host || // Fallback.
1739
+ getDocumentElement(node)
1740
+ );
1741
+ return isShadowRoot(result) ? result.host : result;
1742
+ }
1743
+ function getNearestOverflowAncestor(node) {
1744
+ const parentNode = getParentNode(node);
1745
+ if (isLastTraversableNode(parentNode)) {
1746
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
1747
+ }
1748
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1749
+ return parentNode;
1750
+ }
1751
+ return getNearestOverflowAncestor(parentNode);
1752
+ }
1753
+ function getOverflowAncestors(node, list, traverseIframes) {
1754
+ var _node$ownerDocument2;
1755
+ if (list === void 0) {
1756
+ list = [];
1757
+ }
1758
+ if (traverseIframes === void 0) {
1759
+ traverseIframes = true;
1760
+ }
1761
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1762
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1763
+ const win = getWindow(scrollableAncestor);
1764
+ if (isBody) {
1765
+ const frameElement = getFrameElement(win);
1766
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1767
+ }
1768
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1769
+ }
1770
+ function getFrameElement(win) {
1771
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1772
+ }
1773
+ function getCssDimensions(element) {
1774
+ const css = getComputedStyle$1(element);
1775
+ let width = parseFloat(css.width) || 0;
1776
+ let height = parseFloat(css.height) || 0;
1777
+ const hasOffset = isHTMLElement(element);
1778
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
1779
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
1780
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1781
+ if (shouldFallback) {
1782
+ width = offsetWidth;
1783
+ height = offsetHeight;
1784
+ }
1785
+ return {
1786
+ width,
1787
+ height,
1788
+ $: shouldFallback
1789
+ };
1790
+ }
1791
+ function unwrapElement(element) {
1792
+ return !isElement(element) ? element.contextElement : element;
1793
+ }
1794
+ function getScale(element) {
1795
+ const domElement = unwrapElement(element);
1796
+ if (!isHTMLElement(domElement)) {
1797
+ return createCoords(1);
1798
+ }
1799
+ const rect = domElement.getBoundingClientRect();
1800
+ const {
1801
+ width,
1802
+ height,
1803
+ $
1804
+ } = getCssDimensions(domElement);
1805
+ let x = ($ ? round(rect.width) : rect.width) / width;
1806
+ let y = ($ ? round(rect.height) : rect.height) / height;
1807
+ if (!x || !Number.isFinite(x)) {
1808
+ x = 1;
1809
+ }
1810
+ if (!y || !Number.isFinite(y)) {
1811
+ y = 1;
1812
+ }
1813
+ return {
1814
+ x,
1815
+ y
1816
+ };
1817
+ }
1818
+ const noOffsets = /* @__PURE__ */ createCoords(0);
1819
+ function getVisualOffsets(element) {
1820
+ const win = getWindow(element);
1821
+ if (!isWebKit() || !win.visualViewport) {
1822
+ return noOffsets;
1823
+ }
1824
+ return {
1825
+ x: win.visualViewport.offsetLeft,
1826
+ y: win.visualViewport.offsetTop
1827
+ };
1828
+ }
1829
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1830
+ if (isFixed === void 0) {
1831
+ isFixed = false;
1832
+ }
1833
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1834
+ return false;
1835
+ }
1836
+ return isFixed;
1837
+ }
1838
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1839
+ if (includeScale === void 0) {
1840
+ includeScale = false;
1841
+ }
1842
+ if (isFixedStrategy === void 0) {
1843
+ isFixedStrategy = false;
1844
+ }
1845
+ const clientRect = element.getBoundingClientRect();
1846
+ const domElement = unwrapElement(element);
1847
+ let scale = createCoords(1);
1848
+ if (includeScale) {
1849
+ if (offsetParent) {
1850
+ if (isElement(offsetParent)) {
1851
+ scale = getScale(offsetParent);
1852
+ }
1853
+ } else {
1854
+ scale = getScale(element);
1855
+ }
1856
+ }
1857
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1858
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
1859
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
1860
+ let width = clientRect.width / scale.x;
1861
+ let height = clientRect.height / scale.y;
1862
+ if (domElement) {
1863
+ const win = getWindow(domElement);
1864
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1865
+ let currentWin = win;
1866
+ let currentIFrame = getFrameElement(currentWin);
1867
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1868
+ const iframeScale = getScale(currentIFrame);
1869
+ const iframeRect = currentIFrame.getBoundingClientRect();
1870
+ const css = getComputedStyle$1(currentIFrame);
1871
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1872
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1873
+ x *= iframeScale.x;
1874
+ y *= iframeScale.y;
1875
+ width *= iframeScale.x;
1876
+ height *= iframeScale.y;
1877
+ x += left;
1878
+ y += top;
1879
+ currentWin = getWindow(currentIFrame);
1880
+ currentIFrame = getFrameElement(currentWin);
1881
+ }
1882
+ }
1883
+ return rectToClientRect({
1884
+ width,
1885
+ height,
1886
+ x,
1887
+ y
1888
+ });
1889
+ }
1890
+ function getWindowScrollBarX(element, rect) {
1891
+ const leftScroll = getNodeScroll(element).scrollLeft;
1892
+ if (!rect) {
1893
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1894
+ }
1895
+ return rect.left + leftScroll;
1896
+ }
1897
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
1898
+ if (ignoreScrollbarX === void 0) {
1899
+ ignoreScrollbarX = false;
1900
+ }
1901
+ const htmlRect = documentElement.getBoundingClientRect();
1902
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : (
1903
+ // RTL <body> scrollbar.
1904
+ getWindowScrollBarX(documentElement, htmlRect)
1905
+ ));
1906
+ const y = htmlRect.top + scroll.scrollTop;
1907
+ return {
1908
+ x,
1909
+ y
1910
+ };
1911
+ }
1912
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1913
+ let {
1914
+ elements,
1915
+ rect,
1916
+ offsetParent,
1917
+ strategy
1918
+ } = _ref;
1919
+ const isFixed = strategy === "fixed";
1920
+ const documentElement = getDocumentElement(offsetParent);
1921
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
1922
+ if (offsetParent === documentElement || topLayer && isFixed) {
1923
+ return rect;
1924
+ }
1925
+ let scroll = {
1926
+ scrollLeft: 0,
1927
+ scrollTop: 0
1928
+ };
1929
+ let scale = createCoords(1);
1930
+ const offsets = createCoords(0);
1931
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1932
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1933
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1934
+ scroll = getNodeScroll(offsetParent);
1935
+ }
1936
+ if (isHTMLElement(offsetParent)) {
1937
+ const offsetRect = getBoundingClientRect(offsetParent);
1938
+ scale = getScale(offsetParent);
1939
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1940
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1941
+ }
1942
+ }
1943
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
1944
+ return {
1945
+ width: rect.width * scale.x,
1946
+ height: rect.height * scale.y,
1947
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1948
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1949
+ };
1950
+ }
1951
+ function getClientRects(element) {
1952
+ return Array.from(element.getClientRects());
1953
+ }
1954
+ function getDocumentRect(element) {
1955
+ const html = getDocumentElement(element);
1956
+ const scroll = getNodeScroll(element);
1957
+ const body = element.ownerDocument.body;
1958
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1959
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1960
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1961
+ const y = -scroll.scrollTop;
1962
+ if (getComputedStyle$1(body).direction === "rtl") {
1963
+ x += max(html.clientWidth, body.clientWidth) - width;
1964
+ }
1965
+ return {
1966
+ width,
1967
+ height,
1968
+ x,
1969
+ y
1970
+ };
1971
+ }
1972
+ function getViewportRect(element, strategy) {
1973
+ const win = getWindow(element);
1974
+ const html = getDocumentElement(element);
1975
+ const visualViewport = win.visualViewport;
1976
+ let width = html.clientWidth;
1977
+ let height = html.clientHeight;
1978
+ let x = 0;
1979
+ let y = 0;
1980
+ if (visualViewport) {
1981
+ width = visualViewport.width;
1982
+ height = visualViewport.height;
1983
+ const visualViewportBased = isWebKit();
1984
+ if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
1985
+ x = visualViewport.offsetLeft;
1986
+ y = visualViewport.offsetTop;
1987
+ }
1988
+ }
1989
+ return {
1990
+ width,
1991
+ height,
1992
+ x,
1993
+ y
1994
+ };
1995
+ }
1996
+ function getInnerBoundingClientRect(element, strategy) {
1997
+ const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
1998
+ const top = clientRect.top + element.clientTop;
1999
+ const left = clientRect.left + element.clientLeft;
2000
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
2001
+ const width = element.clientWidth * scale.x;
2002
+ const height = element.clientHeight * scale.y;
2003
+ const x = left * scale.x;
2004
+ const y = top * scale.y;
2005
+ return {
2006
+ width,
2007
+ height,
2008
+ x,
2009
+ y
2010
+ };
2011
+ }
2012
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
2013
+ let rect;
2014
+ if (clippingAncestor === "viewport") {
2015
+ rect = getViewportRect(element, strategy);
2016
+ } else if (clippingAncestor === "document") {
2017
+ rect = getDocumentRect(getDocumentElement(element));
2018
+ } else if (isElement(clippingAncestor)) {
2019
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
2020
+ } else {
2021
+ const visualOffsets = getVisualOffsets(element);
2022
+ rect = {
2023
+ x: clippingAncestor.x - visualOffsets.x,
2024
+ y: clippingAncestor.y - visualOffsets.y,
2025
+ width: clippingAncestor.width,
2026
+ height: clippingAncestor.height
2027
+ };
2028
+ }
2029
+ return rectToClientRect(rect);
2030
+ }
2031
+ function hasFixedPositionAncestor(element, stopNode) {
2032
+ const parentNode = getParentNode(element);
2033
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
2034
+ return false;
2035
+ }
2036
+ return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
2037
+ }
2038
+ function getClippingElementAncestors(element, cache) {
2039
+ const cachedResult = cache.get(element);
2040
+ if (cachedResult) {
2041
+ return cachedResult;
2042
+ }
2043
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
2044
+ let currentContainingBlockComputedStyle = null;
2045
+ const elementIsFixed = getComputedStyle$1(element).position === "fixed";
2046
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
2047
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
2048
+ const computedStyle = getComputedStyle$1(currentNode);
2049
+ const currentNodeIsContaining = isContainingBlock(currentNode);
2050
+ if (!currentNodeIsContaining && computedStyle.position === "fixed") {
2051
+ currentContainingBlockComputedStyle = null;
2052
+ }
2053
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
2054
+ if (shouldDropCurrentNode) {
2055
+ result = result.filter((ancestor) => ancestor !== currentNode);
2056
+ } else {
2057
+ currentContainingBlockComputedStyle = computedStyle;
2058
+ }
2059
+ currentNode = getParentNode(currentNode);
2060
+ }
2061
+ cache.set(element, result);
2062
+ return result;
2063
+ }
2064
+ function getClippingRect(_ref) {
2065
+ let {
2066
+ element,
2067
+ boundary,
2068
+ rootBoundary,
2069
+ strategy
2070
+ } = _ref;
2071
+ const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
2072
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
2073
+ const firstClippingAncestor = clippingAncestors[0];
2074
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
2075
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
2076
+ accRect.top = max(rect.top, accRect.top);
2077
+ accRect.right = min(rect.right, accRect.right);
2078
+ accRect.bottom = min(rect.bottom, accRect.bottom);
2079
+ accRect.left = max(rect.left, accRect.left);
2080
+ return accRect;
2081
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
2082
+ return {
2083
+ width: clippingRect.right - clippingRect.left,
2084
+ height: clippingRect.bottom - clippingRect.top,
2085
+ x: clippingRect.left,
2086
+ y: clippingRect.top
2087
+ };
2088
+ }
2089
+ function getDimensions(element) {
2090
+ const {
2091
+ width,
2092
+ height
2093
+ } = getCssDimensions(element);
2094
+ return {
2095
+ width,
2096
+ height
2097
+ };
2098
+ }
2099
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
2100
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2101
+ const documentElement = getDocumentElement(offsetParent);
2102
+ const isFixed = strategy === "fixed";
2103
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
2104
+ let scroll = {
2105
+ scrollLeft: 0,
2106
+ scrollTop: 0
2107
+ };
2108
+ const offsets = createCoords(0);
2109
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2110
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
2111
+ scroll = getNodeScroll(offsetParent);
2112
+ }
2113
+ if (isOffsetParentAnElement) {
2114
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
2115
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2116
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2117
+ } else if (documentElement) {
2118
+ offsets.x = getWindowScrollBarX(documentElement);
2119
+ }
2120
+ }
2121
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
2122
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
2123
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
2124
+ return {
2125
+ x,
2126
+ y,
2127
+ width: rect.width,
2128
+ height: rect.height
2129
+ };
2130
+ }
2131
+ function isStaticPositioned(element) {
2132
+ return getComputedStyle$1(element).position === "static";
2133
+ }
2134
+ function getTrueOffsetParent(element, polyfill) {
2135
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
2136
+ return null;
2137
+ }
2138
+ if (polyfill) {
2139
+ return polyfill(element);
2140
+ }
2141
+ let rawOffsetParent = element.offsetParent;
2142
+ if (getDocumentElement(element) === rawOffsetParent) {
2143
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
2144
+ }
2145
+ return rawOffsetParent;
2146
+ }
2147
+ function getOffsetParent(element, polyfill) {
2148
+ const win = getWindow(element);
2149
+ if (isTopLayer(element)) {
2150
+ return win;
2151
+ }
2152
+ if (!isHTMLElement(element)) {
2153
+ let svgOffsetParent = getParentNode(element);
2154
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
2155
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
2156
+ return svgOffsetParent;
2157
+ }
2158
+ svgOffsetParent = getParentNode(svgOffsetParent);
2159
+ }
2160
+ return win;
2161
+ }
2162
+ let offsetParent = getTrueOffsetParent(element, polyfill);
2163
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
2164
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
2165
+ }
2166
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
2167
+ return win;
2168
+ }
2169
+ return offsetParent || getContainingBlock(element) || win;
2170
+ }
2171
+ const getElementRects = async function(data) {
2172
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
2173
+ const getDimensionsFn = this.getDimensions;
2174
+ const floatingDimensions = await getDimensionsFn(data.floating);
2175
+ return {
2176
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
2177
+ floating: {
2178
+ x: 0,
2179
+ y: 0,
2180
+ width: floatingDimensions.width,
2181
+ height: floatingDimensions.height
2182
+ }
2183
+ };
2184
+ };
2185
+ function isRTL(element) {
2186
+ return getComputedStyle$1(element).direction === "rtl";
2187
+ }
2188
+ const platform = {
2189
+ convertOffsetParentRelativeRectToViewportRelativeRect,
2190
+ getDocumentElement,
2191
+ getClippingRect,
2192
+ getOffsetParent,
2193
+ getElementRects,
2194
+ getClientRects,
2195
+ getDimensions,
2196
+ getScale,
2197
+ isElement,
2198
+ isRTL
2199
+ };
2200
+ function observeMove(element, onMove) {
2201
+ let io = null;
2202
+ let timeoutId;
2203
+ const root = getDocumentElement(element);
2204
+ function cleanup() {
2205
+ var _io;
2206
+ clearTimeout(timeoutId);
2207
+ (_io = io) == null || _io.disconnect();
2208
+ io = null;
2209
+ }
2210
+ function refresh(skip, threshold) {
2211
+ if (skip === void 0) {
2212
+ skip = false;
2213
+ }
2214
+ if (threshold === void 0) {
2215
+ threshold = 1;
2216
+ }
2217
+ cleanup();
2218
+ const {
2219
+ left,
2220
+ top,
2221
+ width,
2222
+ height
2223
+ } = element.getBoundingClientRect();
2224
+ if (!skip) {
2225
+ onMove();
2226
+ }
2227
+ if (!width || !height) {
2228
+ return;
2229
+ }
2230
+ const insetTop = floor(top);
2231
+ const insetRight = floor(root.clientWidth - (left + width));
2232
+ const insetBottom = floor(root.clientHeight - (top + height));
2233
+ const insetLeft = floor(left);
2234
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
2235
+ const options = {
2236
+ rootMargin,
2237
+ threshold: max(0, min(1, threshold)) || 1
2238
+ };
2239
+ let isFirstUpdate = true;
2240
+ function handleObserve(entries) {
2241
+ const ratio = entries[0].intersectionRatio;
2242
+ if (ratio !== threshold) {
2243
+ if (!isFirstUpdate) {
2244
+ return refresh();
2245
+ }
2246
+ if (!ratio) {
2247
+ timeoutId = setTimeout(() => {
2248
+ refresh(false, 1e-7);
2249
+ }, 1e3);
2250
+ } else {
2251
+ refresh(false, ratio);
2252
+ }
2253
+ }
2254
+ isFirstUpdate = false;
2255
+ }
2256
+ try {
2257
+ io = new IntersectionObserver(handleObserve, {
2258
+ ...options,
2259
+ // Handle <iframe>s
2260
+ root: root.ownerDocument
2261
+ });
2262
+ } catch (e) {
2263
+ io = new IntersectionObserver(handleObserve, options);
2264
+ }
2265
+ io.observe(element);
2266
+ }
2267
+ refresh(true);
2268
+ return cleanup;
2269
+ }
2270
+ function autoUpdate(reference, floating, update, options) {
2271
+ if (options === void 0) {
2272
+ options = {};
2273
+ }
2274
+ const {
2275
+ ancestorScroll = true,
2276
+ ancestorResize = true,
2277
+ elementResize = typeof ResizeObserver === "function",
2278
+ layoutShift = typeof IntersectionObserver === "function",
2279
+ animationFrame = false
2280
+ } = options;
2281
+ const referenceEl = unwrapElement(reference);
2282
+ const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
2283
+ ancestors.forEach((ancestor) => {
2284
+ ancestorScroll && ancestor.addEventListener("scroll", update, {
2285
+ passive: true
2286
+ });
2287
+ ancestorResize && ancestor.addEventListener("resize", update);
2288
+ });
2289
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
2290
+ let reobserveFrame = -1;
2291
+ let resizeObserver = null;
2292
+ if (elementResize) {
2293
+ resizeObserver = new ResizeObserver((_ref) => {
2294
+ let [firstEntry] = _ref;
2295
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
2296
+ resizeObserver.unobserve(floating);
2297
+ cancelAnimationFrame(reobserveFrame);
2298
+ reobserveFrame = requestAnimationFrame(() => {
2299
+ var _resizeObserver;
2300
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
2301
+ });
2302
+ }
2303
+ update();
2304
+ });
2305
+ if (referenceEl && !animationFrame) {
2306
+ resizeObserver.observe(referenceEl);
2307
+ }
2308
+ resizeObserver.observe(floating);
2309
+ }
2310
+ let frameId;
2311
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
2312
+ if (animationFrame) {
2313
+ frameLoop();
2314
+ }
2315
+ function frameLoop() {
2316
+ const nextRefRect = getBoundingClientRect(reference);
2317
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
2318
+ update();
2319
+ }
2320
+ prevRefRect = nextRefRect;
2321
+ frameId = requestAnimationFrame(frameLoop);
2322
+ }
2323
+ update();
2324
+ return () => {
2325
+ var _resizeObserver2;
2326
+ ancestors.forEach((ancestor) => {
2327
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
2328
+ ancestorResize && ancestor.removeEventListener("resize", update);
2329
+ });
2330
+ cleanupIo == null || cleanupIo();
2331
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
2332
+ resizeObserver = null;
2333
+ if (animationFrame) {
2334
+ cancelAnimationFrame(frameId);
2335
+ }
2336
+ };
2337
+ }
2338
+ const offset$1 = offset$2;
2339
+ const shift$1 = shift$2;
2340
+ const flip$1 = flip$2;
2341
+ const size$1 = size$2;
2342
+ const hide$1 = hide$2;
2343
+ const arrow$2 = arrow$3;
2344
+ const limitShift$1 = limitShift$2;
2345
+ const computePosition = (reference, floating, options) => {
2346
+ const cache = /* @__PURE__ */ new Map();
2347
+ const mergedOptions = {
2348
+ platform,
2349
+ ...options
2350
+ };
2351
+ const platformWithCache = {
2352
+ ...mergedOptions.platform,
2353
+ _c: cache
2354
+ };
2355
+ return computePosition$1(reference, floating, {
2356
+ ...mergedOptions,
2357
+ platform: platformWithCache
2358
+ });
2359
+ };
2360
+ var index$1 = typeof document !== "undefined" ? useLayoutEffect : useEffect;
2361
+ function deepEqual(a, b) {
2362
+ if (a === b) {
2363
+ return true;
2364
+ }
2365
+ if (typeof a !== typeof b) {
2366
+ return false;
2367
+ }
2368
+ if (typeof a === "function" && a.toString() === b.toString()) {
2369
+ return true;
2370
+ }
2371
+ let length;
2372
+ let i;
2373
+ let keys;
2374
+ if (a && b && typeof a === "object") {
2375
+ if (Array.isArray(a)) {
2376
+ length = a.length;
2377
+ if (length !== b.length) return false;
2378
+ for (i = length; i-- !== 0; ) {
2379
+ if (!deepEqual(a[i], b[i])) {
2380
+ return false;
2381
+ }
2382
+ }
2383
+ return true;
2384
+ }
2385
+ keys = Object.keys(a);
2386
+ length = keys.length;
2387
+ if (length !== Object.keys(b).length) {
2388
+ return false;
2389
+ }
2390
+ for (i = length; i-- !== 0; ) {
2391
+ if (!{}.hasOwnProperty.call(b, keys[i])) {
2392
+ return false;
2393
+ }
2394
+ }
2395
+ for (i = length; i-- !== 0; ) {
2396
+ const key = keys[i];
2397
+ if (key === "_owner" && a.$$typeof) {
2398
+ continue;
2399
+ }
2400
+ if (!deepEqual(a[key], b[key])) {
2401
+ return false;
2402
+ }
2403
+ }
2404
+ return true;
2405
+ }
2406
+ return a !== a && b !== b;
2407
+ }
2408
+ function getDPR(element) {
2409
+ if (typeof window === "undefined") {
2410
+ return 1;
2411
+ }
2412
+ const win = element.ownerDocument.defaultView || window;
2413
+ return win.devicePixelRatio || 1;
2414
+ }
2415
+ function roundByDPR(element, value) {
2416
+ const dpr = getDPR(element);
2417
+ return Math.round(value * dpr) / dpr;
2418
+ }
2419
+ function useLatestRef(value) {
2420
+ const ref = React.useRef(value);
2421
+ index$1(() => {
2422
+ ref.current = value;
2423
+ });
2424
+ return ref;
2425
+ }
2426
+ function useFloating(options) {
2427
+ if (options === void 0) {
2428
+ options = {};
2429
+ }
2430
+ const {
2431
+ placement = "bottom",
2432
+ strategy = "absolute",
2433
+ middleware = [],
2434
+ platform: platform2,
2435
+ elements: {
2436
+ reference: externalReference,
2437
+ floating: externalFloating
2438
+ } = {},
2439
+ transform = true,
2440
+ whileElementsMounted,
2441
+ open
2442
+ } = options;
2443
+ const [data, setData] = React.useState({
2444
+ x: 0,
2445
+ y: 0,
2446
+ strategy,
2447
+ placement,
2448
+ middlewareData: {},
2449
+ isPositioned: false
2450
+ });
2451
+ const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
2452
+ if (!deepEqual(latestMiddleware, middleware)) {
2453
+ setLatestMiddleware(middleware);
2454
+ }
2455
+ const [_reference, _setReference] = React.useState(null);
2456
+ const [_floating, _setFloating] = React.useState(null);
2457
+ const setReference = React.useCallback((node) => {
2458
+ if (node !== referenceRef.current) {
2459
+ referenceRef.current = node;
2460
+ _setReference(node);
2461
+ }
2462
+ }, []);
2463
+ const setFloating = React.useCallback((node) => {
2464
+ if (node !== floatingRef.current) {
2465
+ floatingRef.current = node;
2466
+ _setFloating(node);
2467
+ }
2468
+ }, []);
2469
+ const referenceEl = externalReference || _reference;
2470
+ const floatingEl = externalFloating || _floating;
2471
+ const referenceRef = React.useRef(null);
2472
+ const floatingRef = React.useRef(null);
2473
+ const dataRef = React.useRef(data);
2474
+ const hasWhileElementsMounted = whileElementsMounted != null;
2475
+ const whileElementsMountedRef = useLatestRef(whileElementsMounted);
2476
+ const platformRef = useLatestRef(platform2);
2477
+ const openRef = useLatestRef(open);
2478
+ const update = React.useCallback(() => {
2479
+ if (!referenceRef.current || !floatingRef.current) {
2480
+ return;
2481
+ }
2482
+ const config = {
2483
+ placement,
2484
+ strategy,
2485
+ middleware: latestMiddleware
2486
+ };
2487
+ if (platformRef.current) {
2488
+ config.platform = platformRef.current;
2489
+ }
2490
+ computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
2491
+ const fullData = {
2492
+ ...data2,
2493
+ // The floating element's position may be recomputed while it's closed
2494
+ // but still mounted (such as when transitioning out). To ensure
2495
+ // `isPositioned` will be `false` initially on the next open, avoid
2496
+ // setting it to `true` when `open === false` (must be specified).
2497
+ isPositioned: openRef.current !== false
2498
+ };
2499
+ if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
2500
+ dataRef.current = fullData;
2501
+ ReactDOM.flushSync(() => {
2502
+ setData(fullData);
2503
+ });
2504
+ }
2505
+ });
2506
+ }, [latestMiddleware, placement, strategy, platformRef, openRef]);
2507
+ index$1(() => {
2508
+ if (open === false && dataRef.current.isPositioned) {
2509
+ dataRef.current.isPositioned = false;
2510
+ setData((data2) => ({
2511
+ ...data2,
2512
+ isPositioned: false
2513
+ }));
2514
+ }
2515
+ }, [open]);
2516
+ const isMountedRef = React.useRef(false);
2517
+ index$1(() => {
2518
+ isMountedRef.current = true;
2519
+ return () => {
2520
+ isMountedRef.current = false;
2521
+ };
2522
+ }, []);
2523
+ index$1(() => {
2524
+ if (referenceEl) referenceRef.current = referenceEl;
2525
+ if (floatingEl) floatingRef.current = floatingEl;
2526
+ if (referenceEl && floatingEl) {
2527
+ if (whileElementsMountedRef.current) {
2528
+ return whileElementsMountedRef.current(referenceEl, floatingEl, update);
2529
+ }
2530
+ update();
2531
+ }
2532
+ }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
2533
+ const refs = React.useMemo(() => ({
2534
+ reference: referenceRef,
2535
+ floating: floatingRef,
2536
+ setReference,
2537
+ setFloating
2538
+ }), [setReference, setFloating]);
2539
+ const elements = React.useMemo(() => ({
2540
+ reference: referenceEl,
2541
+ floating: floatingEl
2542
+ }), [referenceEl, floatingEl]);
2543
+ const floatingStyles = React.useMemo(() => {
2544
+ const initialStyles = {
2545
+ position: strategy,
2546
+ left: 0,
2547
+ top: 0
2548
+ };
2549
+ if (!elements.floating) {
2550
+ return initialStyles;
2551
+ }
2552
+ const x = roundByDPR(elements.floating, data.x);
2553
+ const y = roundByDPR(elements.floating, data.y);
2554
+ if (transform) {
2555
+ return {
2556
+ ...initialStyles,
2557
+ transform: "translate(" + x + "px, " + y + "px)",
2558
+ ...getDPR(elements.floating) >= 1.5 && {
2559
+ willChange: "transform"
2560
+ }
2561
+ };
2562
+ }
2563
+ return {
2564
+ position: strategy,
2565
+ left: x,
2566
+ top: y
2567
+ };
2568
+ }, [strategy, transform, elements.floating, data.x, data.y]);
2569
+ return React.useMemo(() => ({
2570
+ ...data,
2571
+ update,
2572
+ refs,
2573
+ elements,
2574
+ floatingStyles
2575
+ }), [data, update, refs, elements, floatingStyles]);
2576
+ }
2577
+ const arrow$1 = (options) => {
2578
+ function isRef(value) {
2579
+ return {}.hasOwnProperty.call(value, "current");
2580
+ }
2581
+ return {
2582
+ name: "arrow",
2583
+ options,
2584
+ fn(state) {
2585
+ const {
2586
+ element,
2587
+ padding
2588
+ } = typeof options === "function" ? options(state) : options;
2589
+ if (element && isRef(element)) {
2590
+ if (element.current != null) {
2591
+ return arrow$2({
2592
+ element: element.current,
2593
+ padding
2594
+ }).fn(state);
2595
+ }
2596
+ return {};
2597
+ }
2598
+ if (element) {
2599
+ return arrow$2({
2600
+ element,
2601
+ padding
2602
+ }).fn(state);
2603
+ }
2604
+ return {};
2605
+ }
2606
+ };
2607
+ };
2608
+ const offset = (options, deps) => ({
2609
+ ...offset$1(options),
2610
+ options: [options, deps]
2611
+ });
2612
+ const shift = (options, deps) => ({
2613
+ ...shift$1(options),
2614
+ options: [options, deps]
2615
+ });
2616
+ const limitShift = (options, deps) => ({
2617
+ ...limitShift$1(options),
2618
+ options: [options, deps]
2619
+ });
2620
+ const flip = (options, deps) => ({
2621
+ ...flip$1(options),
2622
+ options: [options, deps]
2623
+ });
2624
+ const size = (options, deps) => ({
2625
+ ...size$1(options),
2626
+ options: [options, deps]
2627
+ });
2628
+ const hide = (options, deps) => ({
2629
+ ...hide$1(options),
2630
+ options: [options, deps]
2631
+ });
2632
+ const arrow = (options, deps) => ({
2633
+ ...arrow$1(options),
2634
+ options: [options, deps]
2635
+ });
2636
+ const $7e8f5cd07187803e$export$21b07c8f274aebd5 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
2637
+ const { children, width = 10, height = 5, ...arrowProps } = props;
2638
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.svg, _extends({}, arrowProps, {
2639
+ ref: forwardedRef,
2640
+ width,
2641
+ height,
2642
+ viewBox: "0 0 30 10",
2643
+ preserveAspectRatio: "none"
2644
+ }), props.asChild ? children : /* @__PURE__ */ createElement("polygon", {
2645
+ points: "0,0 30,0 15,10"
2646
+ }));
2647
+ });
2648
+ const $7e8f5cd07187803e$export$be92b6f5f03c0fe9 = $7e8f5cd07187803e$export$21b07c8f274aebd5;
2649
+ function $db6c3485150b8e66$export$1ab7ae714698c4b8(element) {
2650
+ const [size2, setSize] = useState(void 0);
2651
+ $9f79659886946c16$export$e5c5a5f917a5871c(() => {
2652
+ if (element) {
2653
+ setSize({
2654
+ width: element.offsetWidth,
2655
+ height: element.offsetHeight
2656
+ });
2657
+ const resizeObserver = new ResizeObserver((entries) => {
2658
+ if (!Array.isArray(entries)) return;
2659
+ if (!entries.length) return;
2660
+ const entry = entries[0];
2661
+ let width;
2662
+ let height;
2663
+ if ("borderBoxSize" in entry) {
2664
+ const borderSizeEntry = entry["borderBoxSize"];
2665
+ const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
2666
+ width = borderSize["inlineSize"];
2667
+ height = borderSize["blockSize"];
2668
+ } else {
2669
+ width = element.offsetWidth;
2670
+ height = element.offsetHeight;
2671
+ }
2672
+ setSize({
2673
+ width,
2674
+ height
2675
+ });
2676
+ });
2677
+ resizeObserver.observe(element, {
2678
+ box: "border-box"
2679
+ });
2680
+ return () => resizeObserver.unobserve(element);
2681
+ } else
2682
+ setSize(void 0);
2683
+ }, [
2684
+ element
2685
+ ]);
2686
+ return size2;
2687
+ }
2688
+ const $cf1ac5d9fe0e8206$var$POPPER_NAME = "Popper";
2689
+ const [$cf1ac5d9fe0e8206$var$createPopperContext, $cf1ac5d9fe0e8206$export$722aac194ae923] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($cf1ac5d9fe0e8206$var$POPPER_NAME);
2690
+ const [$cf1ac5d9fe0e8206$var$PopperProvider, $cf1ac5d9fe0e8206$var$usePopperContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$POPPER_NAME);
2691
+ const $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9 = (props) => {
2692
+ const { __scopePopper, children } = props;
2693
+ const [anchor, setAnchor] = useState(null);
2694
+ return /* @__PURE__ */ createElement($cf1ac5d9fe0e8206$var$PopperProvider, {
2695
+ scope: __scopePopper,
2696
+ anchor,
2697
+ onAnchorChange: setAnchor
2698
+ }, children);
2699
+ };
2700
+ const $cf1ac5d9fe0e8206$var$ANCHOR_NAME = "PopperAnchor";
2701
+ const $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
2702
+ const { __scopePopper, virtualRef, ...anchorProps } = props;
2703
+ const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$ANCHOR_NAME, __scopePopper);
2704
+ const ref = useRef(null);
2705
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
2706
+ useEffect(() => {
2707
+ context.onAnchorChange((virtualRef === null || virtualRef === void 0 ? void 0 : virtualRef.current) || ref.current);
2708
+ });
2709
+ return virtualRef ? null : /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, anchorProps, {
2710
+ ref: composedRefs
2711
+ }));
2712
+ });
2713
+ const $cf1ac5d9fe0e8206$var$CONTENT_NAME = "PopperContent";
2714
+ const [$cf1ac5d9fe0e8206$var$PopperContentProvider, $cf1ac5d9fe0e8206$var$useContentContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME);
2715
+ const $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
2716
+ var _arrowSize$width, _arrowSize$height, _middlewareData$arrow, _middlewareData$arrow2, _middlewareData$arrow3, _middlewareData$trans, _middlewareData$trans2, _middlewareData$hide;
2717
+ const { __scopePopper, side = "bottom", sideOffset = 0, align = "center", alignOffset = 0, arrowPadding = 0, avoidCollisions = true, collisionBoundary = [], collisionPadding: collisionPaddingProp = 0, sticky = "partial", hideWhenDetached = false, updatePositionStrategy = "optimized", onPlaced, ...contentProps } = props;
2718
+ const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME, __scopePopper);
2719
+ const [content, setContent] = useState(null);
2720
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(
2721
+ forwardedRef,
2722
+ (node) => setContent(node)
2723
+ );
2724
+ const [arrow$12, setArrow] = useState(null);
2725
+ const arrowSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(arrow$12);
2726
+ const arrowWidth = (_arrowSize$width = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.width) !== null && _arrowSize$width !== void 0 ? _arrowSize$width : 0;
2727
+ const arrowHeight = (_arrowSize$height = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.height) !== null && _arrowSize$height !== void 0 ? _arrowSize$height : 0;
2728
+ const desiredPlacement = side + (align !== "center" ? "-" + align : "");
2729
+ const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : {
2730
+ top: 0,
2731
+ right: 0,
2732
+ bottom: 0,
2733
+ left: 0,
2734
+ ...collisionPaddingProp
2735
+ };
2736
+ const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [
2737
+ collisionBoundary
2738
+ ];
2739
+ const hasExplicitBoundaries = boundary.length > 0;
2740
+ const detectOverflowOptions = {
2741
+ padding: collisionPadding,
2742
+ boundary: boundary.filter($cf1ac5d9fe0e8206$var$isNotNull),
2743
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
2744
+ altBoundary: hasExplicitBoundaries
2745
+ };
2746
+ const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
2747
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
2748
+ strategy: "fixed",
2749
+ placement: desiredPlacement,
2750
+ whileElementsMounted: (...args) => {
2751
+ const cleanup = autoUpdate(...args, {
2752
+ animationFrame: updatePositionStrategy === "always"
2753
+ });
2754
+ return cleanup;
2755
+ },
2756
+ elements: {
2757
+ reference: context.anchor
2758
+ },
2759
+ middleware: [
2760
+ offset({
2761
+ mainAxis: sideOffset + arrowHeight,
2762
+ alignmentAxis: alignOffset
2763
+ }),
2764
+ avoidCollisions && shift({
2765
+ mainAxis: true,
2766
+ crossAxis: false,
2767
+ limiter: sticky === "partial" ? limitShift() : void 0,
2768
+ ...detectOverflowOptions
2769
+ }),
2770
+ avoidCollisions && flip({
2771
+ ...detectOverflowOptions
2772
+ }),
2773
+ size({
2774
+ ...detectOverflowOptions,
2775
+ apply: ({ elements, rects, availableWidth, availableHeight }) => {
2776
+ const { width: anchorWidth, height: anchorHeight } = rects.reference;
2777
+ const contentStyle = elements.floating.style;
2778
+ contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
2779
+ contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
2780
+ contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
2781
+ contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
2782
+ }
2783
+ }),
2784
+ arrow$12 && arrow({
2785
+ element: arrow$12,
2786
+ padding: arrowPadding
2787
+ }),
2788
+ $cf1ac5d9fe0e8206$var$transformOrigin({
2789
+ arrowWidth,
2790
+ arrowHeight
2791
+ }),
2792
+ hideWhenDetached && hide({
2793
+ strategy: "referenceHidden",
2794
+ ...detectOverflowOptions
2795
+ })
2796
+ ]
2797
+ });
2798
+ const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement);
2799
+ const handlePlaced = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPlaced);
2800
+ $9f79659886946c16$export$e5c5a5f917a5871c(() => {
2801
+ if (isPositioned) handlePlaced === null || handlePlaced === void 0 || handlePlaced();
2802
+ }, [
2803
+ isPositioned,
2804
+ handlePlaced
2805
+ ]);
2806
+ const arrowX = (_middlewareData$arrow = middlewareData.arrow) === null || _middlewareData$arrow === void 0 ? void 0 : _middlewareData$arrow.x;
2807
+ const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) === null || _middlewareData$arrow2 === void 0 ? void 0 : _middlewareData$arrow2.y;
2808
+ const cannotCenterArrow = ((_middlewareData$arrow3 = middlewareData.arrow) === null || _middlewareData$arrow3 === void 0 ? void 0 : _middlewareData$arrow3.centerOffset) !== 0;
2809
+ const [contentZIndex, setContentZIndex] = useState();
2810
+ $9f79659886946c16$export$e5c5a5f917a5871c(() => {
2811
+ if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
2812
+ }, [
2813
+ content
2814
+ ]);
2815
+ return /* @__PURE__ */ createElement("div", {
2816
+ ref: refs.setFloating,
2817
+ "data-radix-popper-content-wrapper": "",
2818
+ style: {
2819
+ ...floatingStyles,
2820
+ transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
2821
+ // keep off the page when measuring
2822
+ minWidth: "max-content",
2823
+ zIndex: contentZIndex,
2824
+ ["--radix-popper-transform-origin"]: [
2825
+ (_middlewareData$trans = middlewareData.transformOrigin) === null || _middlewareData$trans === void 0 ? void 0 : _middlewareData$trans.x,
2826
+ (_middlewareData$trans2 = middlewareData.transformOrigin) === null || _middlewareData$trans2 === void 0 ? void 0 : _middlewareData$trans2.y
2827
+ ].join(" ")
2828
+ },
2829
+ dir: props.dir
2830
+ }, /* @__PURE__ */ createElement($cf1ac5d9fe0e8206$var$PopperContentProvider, {
2831
+ scope: __scopePopper,
2832
+ placedSide,
2833
+ onArrowChange: setArrow,
2834
+ arrowX,
2835
+ arrowY,
2836
+ shouldHideArrow: cannotCenterArrow
2837
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
2838
+ "data-side": placedSide,
2839
+ "data-align": placedAlign
2840
+ }, contentProps, {
2841
+ ref: composedRefs,
2842
+ style: {
2843
+ ...contentProps.style,
2844
+ // if the PopperContent hasn't been placed yet (not all measurements done)
2845
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
2846
+ animation: !isPositioned ? "none" : void 0,
2847
+ // hide the content if using the hide middleware and should be hidden
2848
+ opacity: (_middlewareData$hide = middlewareData.hide) !== null && _middlewareData$hide !== void 0 && _middlewareData$hide.referenceHidden ? 0 : void 0
2849
+ }
2850
+ }))));
2851
+ });
2852
+ const $cf1ac5d9fe0e8206$var$ARROW_NAME = "PopperArrow";
2853
+ const $cf1ac5d9fe0e8206$var$OPPOSITE_SIDE = {
2854
+ top: "bottom",
2855
+ right: "left",
2856
+ bottom: "top",
2857
+ left: "right"
2858
+ };
2859
+ const $cf1ac5d9fe0e8206$export$79d62cd4e10a3fd0 = /* @__PURE__ */ forwardRef(function $cf1ac5d9fe0e8206$export$79d62cd4e10a3fd02(props, forwardedRef) {
2860
+ const { __scopePopper, ...arrowProps } = props;
2861
+ const contentContext = $cf1ac5d9fe0e8206$var$useContentContext($cf1ac5d9fe0e8206$var$ARROW_NAME, __scopePopper);
2862
+ const baseSide = $cf1ac5d9fe0e8206$var$OPPOSITE_SIDE[contentContext.placedSide];
2863
+ return (
2864
+ // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
2865
+ // doesn't report size as we'd expect on SVG elements.
2866
+ // it reports their bounding box which is effectively the largest path inside the SVG.
2867
+ /* @__PURE__ */ createElement("span", {
2868
+ ref: contentContext.onArrowChange,
2869
+ style: {
2870
+ position: "absolute",
2871
+ left: contentContext.arrowX,
2872
+ top: contentContext.arrowY,
2873
+ [baseSide]: 0,
2874
+ transformOrigin: {
2875
+ top: "",
2876
+ right: "0 0",
2877
+ bottom: "center 0",
2878
+ left: "100% 0"
2879
+ }[contentContext.placedSide],
2880
+ transform: {
2881
+ top: "translateY(100%)",
2882
+ right: "translateY(50%) rotate(90deg) translateX(-50%)",
2883
+ bottom: `rotate(180deg)`,
2884
+ left: "translateY(50%) rotate(-90deg) translateX(50%)"
2885
+ }[contentContext.placedSide],
2886
+ visibility: contentContext.shouldHideArrow ? "hidden" : void 0
2887
+ }
2888
+ }, /* @__PURE__ */ createElement($7e8f5cd07187803e$export$be92b6f5f03c0fe9, _extends({}, arrowProps, {
2889
+ ref: forwardedRef,
2890
+ style: {
2891
+ ...arrowProps.style,
2892
+ // ensures the element can be measured correctly (mostly for if SVG)
2893
+ display: "block"
2894
+ }
2895
+ })))
2896
+ );
2897
+ });
2898
+ /* @__PURE__ */ Object.assign($cf1ac5d9fe0e8206$export$79d62cd4e10a3fd0, {
2899
+ displayName: $cf1ac5d9fe0e8206$var$ARROW_NAME
2900
+ });
2901
+ function $cf1ac5d9fe0e8206$var$isNotNull(value) {
2902
+ return value !== null;
2903
+ }
2904
+ const $cf1ac5d9fe0e8206$var$transformOrigin = (options) => ({
2905
+ name: "transformOrigin",
2906
+ options,
2907
+ fn(data) {
2908
+ var _middlewareData$arrow4, _middlewareData$arrow5, _middlewareData$arrow6, _middlewareData$arrow7, _middlewareData$arrow8;
2909
+ const { placement, rects, middlewareData } = data;
2910
+ const cannotCenterArrow = ((_middlewareData$arrow4 = middlewareData.arrow) === null || _middlewareData$arrow4 === void 0 ? void 0 : _middlewareData$arrow4.centerOffset) !== 0;
2911
+ const isArrowHidden = cannotCenterArrow;
2912
+ const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
2913
+ const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
2914
+ const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement);
2915
+ const noArrowAlign = {
2916
+ start: "0%",
2917
+ center: "50%",
2918
+ end: "100%"
2919
+ }[placedAlign];
2920
+ const arrowXCenter = ((_middlewareData$arrow5 = (_middlewareData$arrow6 = middlewareData.arrow) === null || _middlewareData$arrow6 === void 0 ? void 0 : _middlewareData$arrow6.x) !== null && _middlewareData$arrow5 !== void 0 ? _middlewareData$arrow5 : 0) + arrowWidth / 2;
2921
+ const arrowYCenter = ((_middlewareData$arrow7 = (_middlewareData$arrow8 = middlewareData.arrow) === null || _middlewareData$arrow8 === void 0 ? void 0 : _middlewareData$arrow8.y) !== null && _middlewareData$arrow7 !== void 0 ? _middlewareData$arrow7 : 0) + arrowHeight / 2;
2922
+ let x = "";
2923
+ let y = "";
2924
+ if (placedSide === "bottom") {
2925
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
2926
+ y = `${-arrowHeight}px`;
2927
+ } else if (placedSide === "top") {
2928
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
2929
+ y = `${rects.floating.height + arrowHeight}px`;
2930
+ } else if (placedSide === "right") {
2931
+ x = `${-arrowHeight}px`;
2932
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
2933
+ } else if (placedSide === "left") {
2934
+ x = `${rects.floating.width + arrowHeight}px`;
2935
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
2936
+ }
2937
+ return {
2938
+ data: {
2939
+ x,
2940
+ y
2941
+ }
2942
+ };
2943
+ }
2944
+ });
2945
+ function $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement) {
2946
+ const [side, align = "center"] = placement.split("-");
2947
+ return [
2948
+ side,
2949
+ align
2950
+ ];
2951
+ }
2952
+ const $cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9 = $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9;
2953
+ const $cf1ac5d9fe0e8206$export$b688253958b8dfe7 = $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d;
2954
+ const $cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2 = $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc;
2955
+ const $f1701beae083dbae$export$602eac185826482c = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
2956
+ var _globalThis$document;
2957
+ const { container = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body, ...portalProps } = props;
2958
+ return container ? /* @__PURE__ */ ReactDOM__default.createPortal(/* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, portalProps, {
2959
+ ref: forwardedRef
2960
+ })), container) : null;
2961
+ });
2962
+ function $fe963b355347cc68$export$3e6543de14f8614f(initialState, machine) {
2963
+ return useReducer((state, event) => {
2964
+ const nextState = machine[state][event];
2965
+ return nextState !== null && nextState !== void 0 ? nextState : state;
2966
+ }, initialState);
2967
+ }
2968
+ const $921a889cee6df7e8$export$99c2b779aa4e8b8b = (props) => {
2969
+ const { present, children } = props;
2970
+ const presence = $921a889cee6df7e8$var$usePresence(present);
2971
+ const child = typeof children === "function" ? children({
2972
+ present: presence.isPresent
2973
+ }) : Children.only(children);
2974
+ const ref = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(presence.ref, child.ref);
2975
+ const forceMount = typeof children === "function";
2976
+ return forceMount || presence.isPresent ? /* @__PURE__ */ cloneElement(child, {
2977
+ ref
2978
+ }) : null;
2979
+ };
2980
+ $921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = "Presence";
2981
+ function $921a889cee6df7e8$var$usePresence(present) {
2982
+ const [node1, setNode] = useState();
2983
+ const stylesRef = useRef({});
2984
+ const prevPresentRef = useRef(present);
2985
+ const prevAnimationNameRef = useRef("none");
2986
+ const initialState = present ? "mounted" : "unmounted";
2987
+ const [state, send] = $fe963b355347cc68$export$3e6543de14f8614f(initialState, {
2988
+ mounted: {
2989
+ UNMOUNT: "unmounted",
2990
+ ANIMATION_OUT: "unmountSuspended"
2991
+ },
2992
+ unmountSuspended: {
2993
+ MOUNT: "mounted",
2994
+ ANIMATION_END: "unmounted"
2995
+ },
2996
+ unmounted: {
2997
+ MOUNT: "mounted"
2998
+ }
2999
+ });
3000
+ useEffect(() => {
3001
+ const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
3002
+ prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
3003
+ }, [
3004
+ state
3005
+ ]);
3006
+ $9f79659886946c16$export$e5c5a5f917a5871c(() => {
3007
+ const styles = stylesRef.current;
3008
+ const wasPresent = prevPresentRef.current;
3009
+ const hasPresentChanged = wasPresent !== present;
3010
+ if (hasPresentChanged) {
3011
+ const prevAnimationName = prevAnimationNameRef.current;
3012
+ const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(styles);
3013
+ if (present) send("MOUNT");
3014
+ else if (currentAnimationName === "none" || (styles === null || styles === void 0 ? void 0 : styles.display) === "none")
3015
+ send("UNMOUNT");
3016
+ else {
3017
+ const isAnimating = prevAnimationName !== currentAnimationName;
3018
+ if (wasPresent && isAnimating) send("ANIMATION_OUT");
3019
+ else send("UNMOUNT");
3020
+ }
3021
+ prevPresentRef.current = present;
3022
+ }
3023
+ }, [
3024
+ present,
3025
+ send
3026
+ ]);
3027
+ $9f79659886946c16$export$e5c5a5f917a5871c(() => {
3028
+ if (node1) {
3029
+ const handleAnimationEnd = (event) => {
3030
+ const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
3031
+ const isCurrentAnimation = currentAnimationName.includes(event.animationName);
3032
+ if (event.target === node1 && isCurrentAnimation)
3033
+ flushSync(
3034
+ () => send("ANIMATION_END")
3035
+ );
3036
+ };
3037
+ const handleAnimationStart = (event) => {
3038
+ if (event.target === node1)
3039
+ prevAnimationNameRef.current = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
3040
+ };
3041
+ node1.addEventListener("animationstart", handleAnimationStart);
3042
+ node1.addEventListener("animationcancel", handleAnimationEnd);
3043
+ node1.addEventListener("animationend", handleAnimationEnd);
3044
+ return () => {
3045
+ node1.removeEventListener("animationstart", handleAnimationStart);
3046
+ node1.removeEventListener("animationcancel", handleAnimationEnd);
3047
+ node1.removeEventListener("animationend", handleAnimationEnd);
3048
+ };
3049
+ } else
3050
+ send("ANIMATION_END");
3051
+ }, [
3052
+ node1,
3053
+ send
3054
+ ]);
3055
+ return {
3056
+ isPresent: [
3057
+ "mounted",
3058
+ "unmountSuspended"
3059
+ ].includes(state),
3060
+ ref: useCallback((node) => {
3061
+ if (node) stylesRef.current = getComputedStyle(node);
3062
+ setNode(node);
3063
+ }, [])
3064
+ };
3065
+ }
3066
+ function $921a889cee6df7e8$var$getAnimationName(styles) {
3067
+ return (styles === null || styles === void 0 ? void 0 : styles.animationName) || "none";
3068
+ }
3069
+ function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop, defaultProp, onChange = () => {
3070
+ } }) {
3071
+ const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({
3072
+ defaultProp,
3073
+ onChange
3074
+ });
3075
+ const isControlled = prop !== void 0;
3076
+ const value1 = isControlled ? prop : uncontrolledProp;
3077
+ const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
3078
+ const setValue = useCallback((nextValue) => {
3079
+ if (isControlled) {
3080
+ const setter = nextValue;
3081
+ const value = typeof nextValue === "function" ? setter(prop) : nextValue;
3082
+ if (value !== prop) handleChange(value);
3083
+ } else setUncontrolledProp(nextValue);
3084
+ }, [
3085
+ isControlled,
3086
+ prop,
3087
+ setUncontrolledProp,
3088
+ handleChange
3089
+ ]);
3090
+ return [
3091
+ value1,
3092
+ setValue
3093
+ ];
3094
+ }
3095
+ function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp, onChange }) {
3096
+ const uncontrolledState = useState(defaultProp);
3097
+ const [value] = uncontrolledState;
3098
+ const prevValueRef = useRef(value);
3099
+ const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
3100
+ useEffect(() => {
3101
+ if (prevValueRef.current !== value) {
3102
+ handleChange(value);
3103
+ prevValueRef.current = value;
3104
+ }
3105
+ }, [
3106
+ value,
3107
+ prevValueRef,
3108
+ handleChange
3109
+ ]);
3110
+ return uncontrolledState;
3111
+ }
3112
+ const $ea1ef594cf570d83$export$439d29a4e110a164 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
3113
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, props, {
3114
+ ref: forwardedRef,
3115
+ style: {
3116
+ // See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
3117
+ position: "absolute",
3118
+ border: 0,
3119
+ width: 1,
3120
+ height: 1,
3121
+ padding: 0,
3122
+ margin: -1,
3123
+ overflow: "hidden",
3124
+ clip: "rect(0, 0, 0, 0)",
3125
+ whiteSpace: "nowrap",
3126
+ wordWrap: "normal",
3127
+ ...props.style
3128
+ }
3129
+ }));
3130
+ });
3131
+ const $ea1ef594cf570d83$export$be92b6f5f03c0fe9 = $ea1ef594cf570d83$export$439d29a4e110a164;
3132
+ const [$a093c7e1ec25a057$var$createTooltipContext, $a093c7e1ec25a057$export$1c540a2224f0d865] = $c512c27ab02ef895$export$50c7b4e9d9f19c1("Tooltip", [
3133
+ $cf1ac5d9fe0e8206$export$722aac194ae923
3134
+ ]);
3135
+ const $a093c7e1ec25a057$var$usePopperScope = $cf1ac5d9fe0e8206$export$722aac194ae923();
3136
+ const $a093c7e1ec25a057$var$PROVIDER_NAME = "TooltipProvider";
3137
+ const $a093c7e1ec25a057$var$DEFAULT_DELAY_DURATION = 700;
3138
+ const $a093c7e1ec25a057$var$TOOLTIP_OPEN = "tooltip.open";
3139
+ const [$a093c7e1ec25a057$var$TooltipProviderContextProvider, $a093c7e1ec25a057$var$useTooltipProviderContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$PROVIDER_NAME);
3140
+ const $a093c7e1ec25a057$export$f78649fb9ca566b8 = (props) => {
3141
+ const { __scopeTooltip, delayDuration = $a093c7e1ec25a057$var$DEFAULT_DELAY_DURATION, skipDelayDuration = 300, disableHoverableContent = false, children } = props;
3142
+ const [isOpenDelayed, setIsOpenDelayed] = useState(true);
3143
+ const isPointerInTransitRef = useRef(false);
3144
+ const skipDelayTimerRef = useRef(0);
3145
+ useEffect(() => {
3146
+ const skipDelayTimer = skipDelayTimerRef.current;
3147
+ return () => window.clearTimeout(skipDelayTimer);
3148
+ }, []);
3149
+ return /* @__PURE__ */ createElement($a093c7e1ec25a057$var$TooltipProviderContextProvider, {
3150
+ scope: __scopeTooltip,
3151
+ isOpenDelayed,
3152
+ delayDuration,
3153
+ onOpen: useCallback(() => {
3154
+ window.clearTimeout(skipDelayTimerRef.current);
3155
+ setIsOpenDelayed(false);
3156
+ }, []),
3157
+ onClose: useCallback(() => {
3158
+ window.clearTimeout(skipDelayTimerRef.current);
3159
+ skipDelayTimerRef.current = window.setTimeout(
3160
+ () => setIsOpenDelayed(true),
3161
+ skipDelayDuration
3162
+ );
3163
+ }, [
3164
+ skipDelayDuration
3165
+ ]),
3166
+ isPointerInTransitRef,
3167
+ onPointerInTransitChange: useCallback((inTransit) => {
3168
+ isPointerInTransitRef.current = inTransit;
3169
+ }, []),
3170
+ disableHoverableContent
3171
+ }, children);
3172
+ };
3173
+ const $a093c7e1ec25a057$var$TOOLTIP_NAME = "Tooltip";
3174
+ const [$a093c7e1ec25a057$var$TooltipContextProvider, $a093c7e1ec25a057$var$useTooltipContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$TOOLTIP_NAME);
3175
+ const $a093c7e1ec25a057$export$28c660c63b792dea = (props) => {
3176
+ const { __scopeTooltip, children, open: openProp, defaultOpen = false, onOpenChange, disableHoverableContent: disableHoverableContentProp, delayDuration: delayDurationProp } = props;
3177
+ const providerContext = $a093c7e1ec25a057$var$useTooltipProviderContext($a093c7e1ec25a057$var$TOOLTIP_NAME, props.__scopeTooltip);
3178
+ const popperScope = $a093c7e1ec25a057$var$usePopperScope(__scopeTooltip);
3179
+ const [trigger, setTrigger] = useState(null);
3180
+ const contentId = $1746a345f3d73bb7$export$f680877a34711e37();
3181
+ const openTimerRef = useRef(0);
3182
+ const disableHoverableContent = disableHoverableContentProp !== null && disableHoverableContentProp !== void 0 ? disableHoverableContentProp : providerContext.disableHoverableContent;
3183
+ const delayDuration = delayDurationProp !== null && delayDurationProp !== void 0 ? delayDurationProp : providerContext.delayDuration;
3184
+ const wasOpenDelayedRef = useRef(false);
3185
+ const [open1 = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3({
3186
+ prop: openProp,
3187
+ defaultProp: defaultOpen,
3188
+ onChange: (open) => {
3189
+ if (open) {
3190
+ providerContext.onOpen();
3191
+ document.dispatchEvent(new CustomEvent($a093c7e1ec25a057$var$TOOLTIP_OPEN));
3192
+ } else providerContext.onClose();
3193
+ onOpenChange === null || onOpenChange === void 0 || onOpenChange(open);
3194
+ }
3195
+ });
3196
+ const stateAttribute = useMemo(() => {
3197
+ return open1 ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
3198
+ }, [
3199
+ open1
3200
+ ]);
3201
+ const handleOpen = useCallback(() => {
3202
+ window.clearTimeout(openTimerRef.current);
3203
+ wasOpenDelayedRef.current = false;
3204
+ setOpen(true);
3205
+ }, [
3206
+ setOpen
3207
+ ]);
3208
+ const handleClose = useCallback(() => {
3209
+ window.clearTimeout(openTimerRef.current);
3210
+ setOpen(false);
3211
+ }, [
3212
+ setOpen
3213
+ ]);
3214
+ const handleDelayedOpen = useCallback(() => {
3215
+ window.clearTimeout(openTimerRef.current);
3216
+ openTimerRef.current = window.setTimeout(() => {
3217
+ wasOpenDelayedRef.current = true;
3218
+ setOpen(true);
3219
+ }, delayDuration);
3220
+ }, [
3221
+ delayDuration,
3222
+ setOpen
3223
+ ]);
3224
+ useEffect(() => {
3225
+ return () => window.clearTimeout(openTimerRef.current);
3226
+ }, []);
3227
+ return /* @__PURE__ */ createElement($cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9, popperScope, /* @__PURE__ */ createElement($a093c7e1ec25a057$var$TooltipContextProvider, {
3228
+ scope: __scopeTooltip,
3229
+ contentId,
3230
+ open: open1,
3231
+ stateAttribute,
3232
+ trigger,
3233
+ onTriggerChange: setTrigger,
3234
+ onTriggerEnter: useCallback(() => {
3235
+ if (providerContext.isOpenDelayed) handleDelayedOpen();
3236
+ else handleOpen();
3237
+ }, [
3238
+ providerContext.isOpenDelayed,
3239
+ handleDelayedOpen,
3240
+ handleOpen
3241
+ ]),
3242
+ onTriggerLeave: useCallback(() => {
3243
+ if (disableHoverableContent) handleClose();
3244
+ else
3245
+ window.clearTimeout(openTimerRef.current);
3246
+ }, [
3247
+ handleClose,
3248
+ disableHoverableContent
3249
+ ]),
3250
+ onOpen: handleOpen,
3251
+ onClose: handleClose,
3252
+ disableHoverableContent
3253
+ }, children));
3254
+ };
3255
+ const $a093c7e1ec25a057$var$TRIGGER_NAME = "TooltipTrigger";
3256
+ const $a093c7e1ec25a057$export$8c610744efcf8a1d = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
3257
+ const { __scopeTooltip, ...triggerProps } = props;
3258
+ const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$TRIGGER_NAME, __scopeTooltip);
3259
+ const providerContext = $a093c7e1ec25a057$var$useTooltipProviderContext($a093c7e1ec25a057$var$TRIGGER_NAME, __scopeTooltip);
3260
+ const popperScope = $a093c7e1ec25a057$var$usePopperScope(__scopeTooltip);
3261
+ const ref = useRef(null);
3262
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref, context.onTriggerChange);
3263
+ const isPointerDownRef = useRef(false);
3264
+ const hasPointerMoveOpenedRef = useRef(false);
3265
+ const handlePointerUp = useCallback(
3266
+ () => isPointerDownRef.current = false,
3267
+ []
3268
+ );
3269
+ useEffect(() => {
3270
+ return () => document.removeEventListener("pointerup", handlePointerUp);
3271
+ }, [
3272
+ handlePointerUp
3273
+ ]);
3274
+ return /* @__PURE__ */ createElement($cf1ac5d9fe0e8206$export$b688253958b8dfe7, _extends({
3275
+ asChild: true
3276
+ }, popperScope), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
3277
+ // We purposefully avoid adding `type=button` here because tooltip triggers are also
3278
+ // commonly anchors and the anchor `type` attribute signifies MIME type.
3279
+ "aria-describedby": context.open ? context.contentId : void 0,
3280
+ "data-state": context.stateAttribute
3281
+ }, triggerProps, {
3282
+ ref: composedRefs,
3283
+ onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerMove, (event) => {
3284
+ if (event.pointerType === "touch") return;
3285
+ if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
3286
+ context.onTriggerEnter();
3287
+ hasPointerMoveOpenedRef.current = true;
3288
+ }
3289
+ }),
3290
+ onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerLeave, () => {
3291
+ context.onTriggerLeave();
3292
+ hasPointerMoveOpenedRef.current = false;
3293
+ }),
3294
+ onPointerDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDown, () => {
3295
+ isPointerDownRef.current = true;
3296
+ document.addEventListener("pointerup", handlePointerUp, {
3297
+ once: true
3298
+ });
3299
+ }),
3300
+ onFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus, () => {
3301
+ if (!isPointerDownRef.current) context.onOpen();
3302
+ }),
3303
+ onBlur: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlur, context.onClose),
3304
+ onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, context.onClose)
3305
+ })));
3306
+ });
3307
+ const $a093c7e1ec25a057$var$PORTAL_NAME = "TooltipPortal";
3308
+ const [$a093c7e1ec25a057$var$PortalProvider, $a093c7e1ec25a057$var$usePortalContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$PORTAL_NAME, {
3309
+ forceMount: void 0
3310
+ });
3311
+ const $a093c7e1ec25a057$export$7b36b8f925ab7497 = (props) => {
3312
+ const { __scopeTooltip, forceMount, children, container } = props;
3313
+ const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$PORTAL_NAME, __scopeTooltip);
3314
+ return /* @__PURE__ */ createElement($a093c7e1ec25a057$var$PortalProvider, {
3315
+ scope: __scopeTooltip,
3316
+ forceMount
3317
+ }, /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
3318
+ present: forceMount || context.open
3319
+ }, /* @__PURE__ */ createElement($f1701beae083dbae$export$602eac185826482c, {
3320
+ asChild: true,
3321
+ container
3322
+ }, children)));
3323
+ };
3324
+ const $a093c7e1ec25a057$var$CONTENT_NAME = "TooltipContent";
3325
+ const $a093c7e1ec25a057$export$e9003e2be37ec060 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
3326
+ const portalContext = $a093c7e1ec25a057$var$usePortalContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
3327
+ const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
3328
+ const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
3329
+ return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
3330
+ present: forceMount || context.open
3331
+ }, context.disableHoverableContent ? /* @__PURE__ */ createElement($a093c7e1ec25a057$var$TooltipContentImpl, _extends({
3332
+ side
3333
+ }, contentProps, {
3334
+ ref: forwardedRef
3335
+ })) : /* @__PURE__ */ createElement($a093c7e1ec25a057$var$TooltipContentHoverable, _extends({
3336
+ side
3337
+ }, contentProps, {
3338
+ ref: forwardedRef
3339
+ })));
3340
+ });
3341
+ const $a093c7e1ec25a057$var$TooltipContentHoverable = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
3342
+ const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
3343
+ const providerContext = $a093c7e1ec25a057$var$useTooltipProviderContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
3344
+ const ref = useRef(null);
3345
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
3346
+ const [pointerGraceArea, setPointerGraceArea] = useState(null);
3347
+ const { trigger, onClose } = context;
3348
+ const content = ref.current;
3349
+ const { onPointerInTransitChange } = providerContext;
3350
+ const handleRemoveGraceArea = useCallback(() => {
3351
+ setPointerGraceArea(null);
3352
+ onPointerInTransitChange(false);
3353
+ }, [
3354
+ onPointerInTransitChange
3355
+ ]);
3356
+ const handleCreateGraceArea = useCallback((event, hoverTarget) => {
3357
+ const currentTarget = event.currentTarget;
3358
+ const exitPoint = {
3359
+ x: event.clientX,
3360
+ y: event.clientY
3361
+ };
3362
+ const exitSide = $a093c7e1ec25a057$var$getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
3363
+ const paddedExitPoints = $a093c7e1ec25a057$var$getPaddedExitPoints(exitPoint, exitSide);
3364
+ const hoverTargetPoints = $a093c7e1ec25a057$var$getPointsFromRect(hoverTarget.getBoundingClientRect());
3365
+ const graceArea = $a093c7e1ec25a057$var$getHull([
3366
+ ...paddedExitPoints,
3367
+ ...hoverTargetPoints
3368
+ ]);
3369
+ setPointerGraceArea(graceArea);
3370
+ onPointerInTransitChange(true);
3371
+ }, [
3372
+ onPointerInTransitChange
3373
+ ]);
3374
+ useEffect(() => {
3375
+ return () => handleRemoveGraceArea();
3376
+ }, [
3377
+ handleRemoveGraceArea
3378
+ ]);
3379
+ useEffect(() => {
3380
+ if (trigger && content) {
3381
+ const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
3382
+ const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
3383
+ trigger.addEventListener("pointerleave", handleTriggerLeave);
3384
+ content.addEventListener("pointerleave", handleContentLeave);
3385
+ return () => {
3386
+ trigger.removeEventListener("pointerleave", handleTriggerLeave);
3387
+ content.removeEventListener("pointerleave", handleContentLeave);
3388
+ };
3389
+ }
3390
+ }, [
3391
+ trigger,
3392
+ content,
3393
+ handleCreateGraceArea,
3394
+ handleRemoveGraceArea
3395
+ ]);
3396
+ useEffect(() => {
3397
+ if (pointerGraceArea) {
3398
+ const handleTrackPointerGrace = (event) => {
3399
+ const target = event.target;
3400
+ const pointerPosition = {
3401
+ x: event.clientX,
3402
+ y: event.clientY
3403
+ };
3404
+ const hasEnteredTarget = (trigger === null || trigger === void 0 ? void 0 : trigger.contains(target)) || (content === null || content === void 0 ? void 0 : content.contains(target));
3405
+ const isPointerOutsideGraceArea = !$a093c7e1ec25a057$var$isPointInPolygon(pointerPosition, pointerGraceArea);
3406
+ if (hasEnteredTarget) handleRemoveGraceArea();
3407
+ else if (isPointerOutsideGraceArea) {
3408
+ handleRemoveGraceArea();
3409
+ onClose();
3410
+ }
3411
+ };
3412
+ document.addEventListener("pointermove", handleTrackPointerGrace);
3413
+ return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
3414
+ }
3415
+ }, [
3416
+ trigger,
3417
+ content,
3418
+ pointerGraceArea,
3419
+ onClose,
3420
+ handleRemoveGraceArea
3421
+ ]);
3422
+ return /* @__PURE__ */ createElement($a093c7e1ec25a057$var$TooltipContentImpl, _extends({}, props, {
3423
+ ref: composedRefs
3424
+ }));
3425
+ });
3426
+ const [$a093c7e1ec25a057$var$VisuallyHiddenContentContextProvider, $a093c7e1ec25a057$var$useVisuallyHiddenContentContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$TOOLTIP_NAME, {
3427
+ isInside: false
3428
+ });
3429
+ const $a093c7e1ec25a057$var$TooltipContentImpl = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
3430
+ const { __scopeTooltip, children, "aria-label": ariaLabel, onEscapeKeyDown, onPointerDownOutside, ...contentProps } = props;
3431
+ const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$CONTENT_NAME, __scopeTooltip);
3432
+ const popperScope = $a093c7e1ec25a057$var$usePopperScope(__scopeTooltip);
3433
+ const { onClose } = context;
3434
+ useEffect(() => {
3435
+ document.addEventListener($a093c7e1ec25a057$var$TOOLTIP_OPEN, onClose);
3436
+ return () => document.removeEventListener($a093c7e1ec25a057$var$TOOLTIP_OPEN, onClose);
3437
+ }, [
3438
+ onClose
3439
+ ]);
3440
+ useEffect(() => {
3441
+ if (context.trigger) {
3442
+ const handleScroll = (event) => {
3443
+ const target = event.target;
3444
+ if (target !== null && target !== void 0 && target.contains(context.trigger)) onClose();
3445
+ };
3446
+ window.addEventListener("scroll", handleScroll, {
3447
+ capture: true
3448
+ });
3449
+ return () => window.removeEventListener("scroll", handleScroll, {
3450
+ capture: true
3451
+ });
3452
+ }
3453
+ }, [
3454
+ context.trigger,
3455
+ onClose
3456
+ ]);
3457
+ return /* @__PURE__ */ createElement($5cb92bef7577960e$export$177fb62ff3ec1f22, {
3458
+ asChild: true,
3459
+ disableOutsidePointerEvents: false,
3460
+ onEscapeKeyDown,
3461
+ onPointerDownOutside,
3462
+ onFocusOutside: (event) => event.preventDefault(),
3463
+ onDismiss: onClose
3464
+ }, /* @__PURE__ */ createElement($cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2, _extends({
3465
+ "data-state": context.stateAttribute
3466
+ }, popperScope, contentProps, {
3467
+ ref: forwardedRef,
3468
+ style: {
3469
+ ...contentProps.style,
3470
+ "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
3471
+ "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
3472
+ "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
3473
+ "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
3474
+ "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
3475
+ }
3476
+ }), /* @__PURE__ */ createElement($5e63c961fc1ce211$export$d9f1ccf0bdb05d45, null, children), /* @__PURE__ */ createElement($a093c7e1ec25a057$var$VisuallyHiddenContentContextProvider, {
3477
+ scope: __scopeTooltip,
3478
+ isInside: true
3479
+ }, /* @__PURE__ */ createElement($ea1ef594cf570d83$export$be92b6f5f03c0fe9, {
3480
+ id: context.contentId,
3481
+ role: "tooltip"
3482
+ }, ariaLabel || children))));
3483
+ });
3484
+ function $a093c7e1ec25a057$var$getExitSideFromRect(point, rect) {
3485
+ const top = Math.abs(rect.top - point.y);
3486
+ const bottom = Math.abs(rect.bottom - point.y);
3487
+ const right = Math.abs(rect.right - point.x);
3488
+ const left = Math.abs(rect.left - point.x);
3489
+ switch (Math.min(top, bottom, right, left)) {
3490
+ case left:
3491
+ return "left";
3492
+ case right:
3493
+ return "right";
3494
+ case top:
3495
+ return "top";
3496
+ case bottom:
3497
+ return "bottom";
3498
+ default:
3499
+ throw new Error("unreachable");
3500
+ }
3501
+ }
3502
+ function $a093c7e1ec25a057$var$getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
3503
+ const paddedExitPoints = [];
3504
+ switch (exitSide) {
3505
+ case "top":
3506
+ paddedExitPoints.push({
3507
+ x: exitPoint.x - padding,
3508
+ y: exitPoint.y + padding
3509
+ }, {
3510
+ x: exitPoint.x + padding,
3511
+ y: exitPoint.y + padding
3512
+ });
3513
+ break;
3514
+ case "bottom":
3515
+ paddedExitPoints.push({
3516
+ x: exitPoint.x - padding,
3517
+ y: exitPoint.y - padding
3518
+ }, {
3519
+ x: exitPoint.x + padding,
3520
+ y: exitPoint.y - padding
3521
+ });
3522
+ break;
3523
+ case "left":
3524
+ paddedExitPoints.push({
3525
+ x: exitPoint.x + padding,
3526
+ y: exitPoint.y - padding
3527
+ }, {
3528
+ x: exitPoint.x + padding,
3529
+ y: exitPoint.y + padding
3530
+ });
3531
+ break;
3532
+ case "right":
3533
+ paddedExitPoints.push({
3534
+ x: exitPoint.x - padding,
3535
+ y: exitPoint.y - padding
3536
+ }, {
3537
+ x: exitPoint.x - padding,
3538
+ y: exitPoint.y + padding
3539
+ });
3540
+ break;
3541
+ }
3542
+ return paddedExitPoints;
3543
+ }
3544
+ function $a093c7e1ec25a057$var$getPointsFromRect(rect) {
3545
+ const { top, right, bottom, left } = rect;
3546
+ return [
3547
+ {
3548
+ x: left,
3549
+ y: top
3550
+ },
3551
+ {
3552
+ x: right,
3553
+ y: top
3554
+ },
3555
+ {
3556
+ x: right,
3557
+ y: bottom
3558
+ },
3559
+ {
3560
+ x: left,
3561
+ y: bottom
3562
+ }
3563
+ ];
3564
+ }
3565
+ function $a093c7e1ec25a057$var$isPointInPolygon(point, polygon) {
3566
+ const { x, y } = point;
3567
+ let inside = false;
3568
+ for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
3569
+ const xi = polygon[i].x;
3570
+ const yi = polygon[i].y;
3571
+ const xj = polygon[j].x;
3572
+ const yj = polygon[j].y;
3573
+ const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
3574
+ if (intersect) inside = !inside;
3575
+ }
3576
+ return inside;
3577
+ }
3578
+ function $a093c7e1ec25a057$var$getHull(points) {
3579
+ const newPoints = points.slice();
3580
+ newPoints.sort((a, b) => {
3581
+ if (a.x < b.x) return -1;
3582
+ else if (a.x > b.x) return 1;
3583
+ else if (a.y < b.y) return -1;
3584
+ else if (a.y > b.y) return 1;
3585
+ else return 0;
3586
+ });
3587
+ return $a093c7e1ec25a057$var$getHullPresorted(newPoints);
3588
+ }
3589
+ function $a093c7e1ec25a057$var$getHullPresorted(points) {
3590
+ if (points.length <= 1) return points.slice();
3591
+ const upperHull = [];
3592
+ for (let i = 0; i < points.length; i++) {
3593
+ const p = points[i];
3594
+ while (upperHull.length >= 2) {
3595
+ const q = upperHull[upperHull.length - 1];
3596
+ const r = upperHull[upperHull.length - 2];
3597
+ if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
3598
+ else break;
3599
+ }
3600
+ upperHull.push(p);
3601
+ }
3602
+ upperHull.pop();
3603
+ const lowerHull = [];
3604
+ for (let i1 = points.length - 1; i1 >= 0; i1--) {
3605
+ const p = points[i1];
3606
+ while (lowerHull.length >= 2) {
3607
+ const q = lowerHull[lowerHull.length - 1];
3608
+ const r = lowerHull[lowerHull.length - 2];
3609
+ if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
3610
+ else break;
3611
+ }
3612
+ lowerHull.push(p);
3613
+ }
3614
+ lowerHull.pop();
3615
+ if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) return upperHull;
3616
+ else return upperHull.concat(lowerHull);
3617
+ }
3618
+ const $a093c7e1ec25a057$export$2881499e37b75b9a = $a093c7e1ec25a057$export$f78649fb9ca566b8;
3619
+ const $a093c7e1ec25a057$export$be92b6f5f03c0fe9 = $a093c7e1ec25a057$export$28c660c63b792dea;
3620
+ const $a093c7e1ec25a057$export$41fb9f06171c75f4 = $a093c7e1ec25a057$export$8c610744efcf8a1d;
3621
+ const $a093c7e1ec25a057$export$602eac185826482c = $a093c7e1ec25a057$export$7b36b8f925ab7497;
3622
+ const $a093c7e1ec25a057$export$7c6e2c02157bb7d2 = $a093c7e1ec25a057$export$e9003e2be37ec060;
3623
+ function Tooltip({ description: description2 }) {
3624
+ return /* @__PURE__ */ jsx($a093c7e1ec25a057$export$2881499e37b75b9a, { children: /* @__PURE__ */ jsxs($a093c7e1ec25a057$export$be92b6f5f03c0fe9, { children: [
3625
+ /* @__PURE__ */ jsx($a093c7e1ec25a057$export$41fb9f06171c75f4, { asChild: true, children: /* @__PURE__ */ jsx(Information, { "aria-hidden": "true" }) }),
3626
+ /* @__PURE__ */ jsx($a093c7e1ec25a057$export$602eac185826482c, { children: /* @__PURE__ */ jsx($a093c7e1ec25a057$export$7c6e2c02157bb7d2, { sideOffset: 5, style: { zIndex: 9999 }, children: /* @__PURE__ */ jsx(
3627
+ Box,
3628
+ {
3629
+ padding: 2,
3630
+ margin: 2,
3631
+ background: "neutral1000",
3632
+ hasRadius: true,
3633
+ shadow: "filterShadow",
3634
+ maxWidth: "300px",
3635
+ children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral0", children: description2 })
3636
+ }
3637
+ ) }) })
3638
+ ] }) });
3639
+ }
3640
+ function debounce(func, wait) {
3641
+ let timeout;
3642
+ return function executedFunction(...args) {
3643
+ const later = () => {
3644
+ clearTimeout(timeout);
3645
+ func(...args);
3646
+ };
3647
+ clearTimeout(timeout);
3648
+ timeout = setTimeout(later, wait);
3649
+ };
3650
+ }
3651
+ async function duplicateCheck(url, routeDocumentId) {
3652
+ if (!url) throw new Error("URL is required");
3653
+ try {
3654
+ const res = await fetch(`/webatlas/checkUniquePath?path=${transformToUrl(url)}${routeDocumentId ? `&targetRouteDocumentId=${routeDocumentId}` : ""}`);
3655
+ if (!res.ok) throw new Error(`Network response was not ok: ${res.status} ${res.statusText}`);
3656
+ return await res.text();
3657
+ } catch (err) {
3658
+ console.error("Error in duplicateCheck:", err);
3659
+ throw new Error("Failed to check URL uniqueness");
3660
+ }
3661
+ }
3662
+ const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
3663
+ function URLInfo({ validationState, replacement, setUrlStatus }) {
3664
+ const [color, setColor] = useState(null);
3665
+ const [text, setText] = useState(null);
3666
+ const { formatMessage } = useIntl();
3667
+ useEffect(() => {
3668
+ if (validationState === "initial") return;
3669
+ if (validationState === "checking") {
3670
+ setColor("neutral800");
3671
+ setText(formatMessage({
3672
+ id: getTranslation("components.URLInfo.checking"),
3673
+ defaultMessage: "Checking if URL is available..."
3674
+ }));
3675
+ } else if (validationState === "done") {
3676
+ setColor(replacement ? "danger500" : "success500");
3677
+ setText(replacement ? `${formatMessage({
3678
+ id: getTranslation("components.URLInfo.notAvailable"),
3679
+ defaultMessage: "URL is not available. Replaced with"
3680
+ })} "${replacement}".` : formatMessage({
3681
+ id: getTranslation("components.URLInfo.available"),
3682
+ defaultMessage: "URL is available."
3683
+ }));
3684
+ if (setUrlStatus) setUrlStatus(replacement ? "invalid" : "valid");
3685
+ }
3686
+ }, [validationState, replacement, formatMessage, setUrlStatus]);
3687
+ return /* @__PURE__ */ jsx(Box, { paddingTop: 2, children: /* @__PURE__ */ jsx(Typography, { textColor: color, children: text }) });
3688
+ }
3689
+ function reducer(state, action) {
3690
+ switch (action.type) {
3691
+ case "DEFAULT":
3692
+ return {
3693
+ ...state,
3694
+ value: transformToUrl(action.payload),
3695
+ prevValue: state.value,
3696
+ needsUrlCheck: true
3697
+ };
3698
+ case "NO_URL_CHECK":
3699
+ return {
3700
+ ...state,
3701
+ value: transformToUrl(action.payload),
3702
+ prevValue: state.value,
3703
+ needsUrlCheck: false
3704
+ };
3705
+ case "NO_TRANSFORM_AND_CHECK":
3706
+ return {
3707
+ ...state,
3708
+ value: action.payload,
3709
+ prevValue: state.value,
3710
+ needsUrlCheck: false
3711
+ };
3712
+ case "RESET_URL_CHECK_FLAG":
3713
+ return { ...state, needsUrlCheck: false };
3714
+ case "SET_UIDPATH":
3715
+ return { ...state, uIdPath: action.payload };
3716
+ case "SET_DOCUMENTIDPATH":
3717
+ return { ...state, documentIdPath: action.payload };
3718
+ default:
3719
+ throw new Error();
3720
+ }
3721
+ }
3722
+ const Alias = ({ config }) => {
3723
+ const { form } = unstable_useContentManagerContext();
3724
+ const { initialValues, values, onChange } = form;
3725
+ const { getRelatedRoute } = useApi();
3726
+ const { formatMessage } = useIntl();
3727
+ const [routeId, setRouteId] = useState();
3728
+ const [isOverride, setIsOverride] = useState(false);
3729
+ const [validationState, setValidationState] = useState("initial");
3730
+ const [replacement, setReplacement] = useState("");
3731
+ const [initialLoadComplete, setInitialLoadComplete] = useState(false);
3732
+ const [urlIsValid, setUrlIsValid] = useState(null);
3733
+ const [path, dispatchPath] = useReducer(reducer, {
3734
+ needsUrlCheck: false,
3735
+ value: "",
3736
+ prevValue: "",
3737
+ uIdPath: ""
3738
+ });
3739
+ const hasUserChangedField = useRef(false);
3740
+ const initialPath = useRef("");
3741
+ const prevValueRef = useRef(null);
3742
+ const debouncedCheckUrl = useCallback(debounce(checkUrl, 250), []);
3743
+ useEffect(() => {
3744
+ onChange("webatlas_path", path.value);
3745
+ onChange("webatlas_override", isOverride);
3746
+ }, [path.value, isOverride]);
3747
+ const debouncedValueEffect = useMemo(() => debounce((currentValues) => {
3748
+ const key = config?.default;
3749
+ if (!key) return;
3750
+ const currentValue = currentValues[key];
3751
+ if (!currentValue) {
3752
+ dispatchPath({ type: "NO_URL_CHECK", payload: "" });
3753
+ return;
3754
+ }
3755
+ if (initialLoadComplete && (hasUserChangedField.current || !routeId) && prevValueRef.current !== currentValue && !isOverride) {
3756
+ const path2 = config.pattern ? `${config.pattern}/${currentValue}` : `${currentValue}`;
3757
+ if (currentValue === initialValues[key]) {
3758
+ dispatchPath({ type: "NO_URL_CHECK", payload: path2 });
3759
+ } else {
3760
+ dispatchPath({ type: "DEFAULT", payload: path2 });
3761
+ }
3762
+ prevValueRef.current = currentValue;
3763
+ }
3764
+ }, 500), [config?.default, config?.pattern, initialValues, isOverride, initialLoadComplete, routeId]);
3765
+ useEffect(() => {
3766
+ const key = config?.default;
3767
+ if (!key) return;
3768
+ const currentValue = values[key];
3769
+ const initialValue = initialValues[key];
3770
+ if (currentValue && !isOverride) {
3771
+ const path2 = config.pattern ? `${config.pattern}/${currentValue}` : `${currentValue}`;
3772
+ onChange("webatlas_path", transformToUrl(path2));
3773
+ }
3774
+ if (!initialLoadComplete) return;
3775
+ if (currentValue !== initialValue) {
3776
+ hasUserChangedField.current = true;
3777
+ }
3778
+ debouncedValueEffect(values);
3779
+ }, [values, debouncedValueEffect, initialLoadComplete]);
3780
+ useEffect(() => {
3781
+ if (path.needsUrlCheck && path.value) {
3782
+ if (path.uIdPath === path.value || initialPath.current === path.value) return;
3783
+ debouncedCheckUrl(path.value);
3784
+ dispatchPath({ type: "RESET_URL_CHECK_FLAG" });
3785
+ }
3786
+ }, [path.needsUrlCheck]);
3787
+ useEffect(() => {
3788
+ async function getTypes() {
3789
+ if (!initialValues.documentId) {
3790
+ setInitialLoadComplete(true);
3791
+ return;
3792
+ }
3793
+ try {
3794
+ const route = await getRelatedRoute(initialValues.documentId);
3795
+ if (!route) return;
3796
+ initialPath.current = initialValues.webatlas_path || route.uIdPath;
3797
+ setRouteId(route.id);
3798
+ setIsOverride(route.isOverride || false);
3799
+ dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: route.fullPath || "" });
3800
+ dispatchPath({ type: "SET_UIDPATH", payload: route.uidPath || "" });
3801
+ dispatchPath({ type: "SET_DOCUMENTIDPATH", payload: route.documentIdPath || "" });
3802
+ const key = config?.default;
3803
+ if (key) {
3804
+ prevValueRef.current = values[key];
3805
+ }
3806
+ } catch (err) {
3807
+ setRouteId(null);
3808
+ console.log(err);
3809
+ }
3810
+ setInitialLoadComplete(true);
3811
+ }
3812
+ getTypes();
3813
+ }, [config]);
3814
+ useEffect(() => {
3815
+ if (initialValues.webatlas_path) dispatchPath({ type: "NO_URL_CHECK", payload: initialValues.webatlas_path });
3816
+ if (initialValues.webatlas_override) setIsOverride(initialValues.webatlas_override);
3817
+ }, []);
3818
+ async function checkUrl(url) {
3819
+ if (!url) return;
3820
+ setValidationState("checking");
3821
+ setReplacement("");
3822
+ try {
3823
+ const data = await duplicateCheck(url);
3824
+ if (!data || data === url) return;
3825
+ dispatchPath({ type: "NO_URL_CHECK", payload: data });
3826
+ setReplacement(data);
3827
+ } catch (err) {
3828
+ console.log(err);
3829
+ } finally {
3830
+ setUrlIsValid(null);
3831
+ setValidationState("done");
3832
+ }
3833
+ }
3834
+ if (!initialLoadComplete) return /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
3835
+ id: getTranslation("loading"),
3836
+ defaultMessage: "Loading..."
3837
+ }) });
3838
+ return /* @__PURE__ */ jsx(
3839
+ Box,
3840
+ {
3841
+ as: "aside",
3842
+ "aria-labelledby": "URL Route",
3843
+ width: "100%",
3844
+ children: /* @__PURE__ */ jsxs(
3845
+ Flex,
3846
+ {
3847
+ direction: "column",
3848
+ alignItems: "stretch",
3849
+ gap: 4,
3850
+ children: [
3851
+ /* @__PURE__ */ jsxs(Box, { children: [
3852
+ !routeId && /* @__PURE__ */ jsxs(Fragment$1, { children: [
3853
+ /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", marginBottom: 2, children: formatMessage({
3854
+ id: getTranslation("components.CMEditViewAside.alias.newRouteInfo"),
3855
+ defaultMessage: "A new URL route will be created upon saving this entry."
3856
+ }) }),
3857
+ /* @__PURE__ */ jsx(Box, { paddingBottom: 2, paddingTop: 2, children: /* @__PURE__ */ jsx(Divider, {}) })
3858
+ ] }),
3859
+ /* @__PURE__ */ jsxs(
3860
+ Field.Root,
3861
+ {
3862
+ hint: formatMessage({
3863
+ id: getTranslation("components.CMEditViewAside.alias.urlInput.start"),
3864
+ defaultMessage: "Edit the"
3865
+ }) + ' "' + config.default + '" ' + formatMessage({
3866
+ id: getTranslation("components.CMEditViewAside.alias.urlInput.end"),
3867
+ defaultMessage: "field to generate a URL"
3868
+ }),
3869
+ children: [
3870
+ /* @__PURE__ */ jsxs(Field.Label, { children: [
3871
+ formatMessage({
3872
+ id: getTranslation("components.CMEditViewAside.alias.urlInput.label"),
3873
+ defaultMessage: "URL"
3874
+ }),
3875
+ /* @__PURE__ */ jsx(Tooltip, { description: formatMessage({
3876
+ id: getTranslation("components.CMEditViewAside.alias.urlInput.tooltip"),
3877
+ defaultMessage: "The following characters are valid: A-Z, a-z, 0-9, /, -, _, $, ., +, !, *, ', (, )"
3878
+ }) })
3879
+ ] }),
3880
+ /* @__PURE__ */ jsx(
3881
+ Field.Input,
3882
+ {
3883
+ id: "url-input",
3884
+ value: path.value,
3885
+ onChange: (e) => dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: e.target.value }),
3886
+ disabled: !isOverride,
3887
+ onBlur: (e) => {
3888
+ if (e.target.value === path.prevValue) return;
3889
+ dispatchPath({ type: "DEFAULT", payload: e.target.value });
3890
+ },
3891
+ style: { outline: urlIsValid !== null ? urlIsValid === "valid" ? "1px solid #5cb176" : "1px solid #ee5e52" : void 0 }
3892
+ }
3893
+ ),
3894
+ /* @__PURE__ */ jsx(Field.Hint, {})
3895
+ ]
3896
+ }
3897
+ ),
3898
+ /* @__PURE__ */ jsx(URLInfo, { validationState, replacement, setUrlStatus: setUrlIsValid }),
3899
+ /* @__PURE__ */ jsx(
3900
+ Flex,
3901
+ {
3902
+ gap: 2,
3903
+ paddingTop: 2,
3904
+ children: /* @__PURE__ */ jsx(
3905
+ Checkbox,
3906
+ {
3907
+ id: "override-url",
3908
+ checked: isOverride,
3909
+ onCheckedChange: () => setIsOverride((prev) => !prev),
3910
+ children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
3911
+ id: getTranslation("components.CMEditViewAside.alias.overrideCheckbox"),
3912
+ defaultMessage: "Override automatic URL generation"
3913
+ }) })
3914
+ }
3915
+ )
3916
+ }
3917
+ )
3918
+ ] }),
3919
+ path.uIdPath && path.documentIdPath && /* @__PURE__ */ jsxs(Fragment$1, { children: [
3920
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Divider, {}) }),
3921
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(
3922
+ Field.Root,
3923
+ {
3924
+ hint: formatMessage({
3925
+ id: getTranslation("components.CMEditViewAside.alias.uidRoute.hint"),
3926
+ defaultMessage: "Permanent UID route, cannot be changed"
3927
+ }),
3928
+ label: formatMessage({
3929
+ id: getTranslation("components.CMEditViewAside.alias.uidRoute.label"),
3930
+ defaultMessage: "UID route"
3931
+ }),
3932
+ children: [
3933
+ /* @__PURE__ */ jsx(Field.Label, {}),
3934
+ /* @__PURE__ */ jsx(
3935
+ Field.Input,
3936
+ {
3937
+ value: path.uIdPath,
3938
+ disabled: true
3939
+ }
3940
+ ),
3941
+ /* @__PURE__ */ jsx(Field.Hint, {})
3942
+ ]
3943
+ }
3944
+ ) }),
3945
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(
3946
+ Field.Root,
3947
+ {
3948
+ hint: formatMessage({
3949
+ id: getTranslation("components.CMEditViewAside.alias.documentIdRoute.hint"),
3950
+ defaultMessage: "Permanent Document ID route, cannot be changed"
3951
+ }),
3952
+ label: formatMessage({
3953
+ id: getTranslation("components.CMEditViewAside.alias.documentIdRoute.label"),
3954
+ defaultMessage: "Document ID route"
3955
+ }),
3956
+ children: [
3957
+ /* @__PURE__ */ jsx(Field.Label, {}),
3958
+ /* @__PURE__ */ jsx(
3959
+ Field.Input,
3960
+ {
3961
+ value: path.documentIdPath,
3962
+ disabled: true
3963
+ }
3964
+ ),
3965
+ /* @__PURE__ */ jsx(Field.Hint, {})
3966
+ ]
3967
+ }
3968
+ ) })
3969
+ ] })
3970
+ ]
3971
+ }
3972
+ )
3973
+ }
3974
+ );
3975
+ };
3976
+ const CMEditViewAside = () => {
3977
+ const { model } = unstable_useContentManagerContext();
3978
+ const { contentTypes } = useAllContentTypes();
3979
+ const { config } = usePluginConfig();
3980
+ const [contentTypeConfig, setContentTypeConfig] = useState(null);
3981
+ const [isAllowedContentType, setIsAllowedContentType] = useState(false);
3982
+ const [isActiveContentType, setIsActiveContentType] = useState(false);
3983
+ const [isLoading, setIsLoading] = useState(true);
3984
+ const { formatMessage } = useIntl();
3985
+ useEffect(() => {
3986
+ if (!config) return;
3987
+ const contentType = contentTypes?.find((ct) => ct.uid === model);
3988
+ if (contentType?.pluginOptions?.webatlas?.active) setIsAllowedContentType(true);
3989
+ config?.selectedContentTypes?.map((type2) => {
3990
+ if (type2.uid === model) {
3991
+ setIsActiveContentType(true);
3992
+ setContentTypeConfig(type2);
3993
+ }
3994
+ });
3995
+ setIsLoading(false);
3996
+ }, [config]);
3997
+ useEffect(() => {
3998
+ const isWebatlasLabel = (label) => label.textContent?.startsWith("webatlas_");
3999
+ document.querySelectorAll("label").forEach((label) => {
4000
+ if (!isWebatlasLabel(label)) return;
4001
+ const container = label.parentElement?.parentElement;
4002
+ const parent = container?.parentElement;
4003
+ const greatGrandParent = parent?.parentElement?.parentElement;
4004
+ if (!container || !parent) return;
4005
+ const parentWebatlasCount = Array.from(parent.querySelectorAll("label")).filter(isWebatlasLabel).length;
4006
+ const childrenCount = parent.children.length;
4007
+ if (greatGrandParent && greatGrandParent?.querySelectorAll("label").length === Array.from(greatGrandParent.querySelectorAll("label")).filter(isWebatlasLabel).length) {
4008
+ greatGrandParent.remove();
4009
+ } else if (childrenCount === 1 || childrenCount === 2 && parentWebatlasCount === 2) {
4010
+ parent.remove();
4011
+ } else {
4012
+ container.remove();
4013
+ }
4014
+ });
4015
+ }, []);
4016
+ if (isLoading || !config) return /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
4017
+ id: getTranslation("loading"),
4018
+ defaultMessage: "Loading..."
4019
+ }) });
4020
+ if (!isAllowedContentType) return /* @__PURE__ */ jsxs(Typography, { textColor: "neutral600", children: [
4021
+ formatMessage({
4022
+ id: getTranslation("components.CMEditViewAside.notAllowed.start"),
4023
+ defaultMessage: "This content type is not allowed for"
4024
+ }),
4025
+ " ",
4026
+ /* @__PURE__ */ jsx("strong", { children: PLUGIN_NAME }),
4027
+ ".",
4028
+ " ",
4029
+ formatMessage({
4030
+ id: getTranslation("components.CMEditViewAside.notAllowed.end"),
4031
+ defaultMessage: "If you wish to use it, please contact your administrator"
4032
+ }),
4033
+ "."
4034
+ ] });
4035
+ if (!isActiveContentType || !contentTypeConfig) return /* @__PURE__ */ jsxs(Typography, { textColor: "neutral600", children: [
4036
+ formatMessage({
4037
+ id: getTranslation("components.CMEditViewAside.notConfigured.start"),
4038
+ defaultMessage: "This content type is not configured for"
4039
+ }),
4040
+ " ",
4041
+ /* @__PURE__ */ jsx("strong", { children: PLUGIN_NAME }),
4042
+ ".",
4043
+ " ",
4044
+ formatMessage({
4045
+ id: getTranslation("components.CMEditViewAside.notConfigured.middle"),
4046
+ defaultMessage: "If you wish to use it, please configure it in the"
4047
+ }),
4048
+ " ",
4049
+ /* @__PURE__ */ jsx(Link$1, { href: "/admin/settings/webatlas/configuration", children: formatMessage({
4050
+ id: getTranslation("components.CMEditViewAside.notConfigured.end"),
4051
+ defaultMessage: "settings"
4052
+ }) }),
4053
+ "."
4054
+ ] });
4055
+ return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Alias, { config: contentTypeConfig }) });
4056
+ };
4057
+ const index = {
4058
+ register(app) {
4059
+ app.addMenuLink({
4060
+ to: `/plugins/${PLUGIN_ID}/routes`,
4061
+ icon: RouteIcon,
4062
+ intlLabel: {
4063
+ id: `${PLUGIN_ID}.link.routes`,
4064
+ defaultMessage: "Routes"
4065
+ },
4066
+ Component: async () => {
4067
+ const component = await import("./index-B2tjc_lG.mjs");
4068
+ return { default: component.default };
4069
+ },
4070
+ permissions: [
4071
+ // Uncomment to set the permissions of the plugin here
4072
+ // {
4073
+ // action: '', // the action name should be plugin::plugin-name.actionType
4074
+ // subject: null,
4075
+ // },
4076
+ ]
4077
+ });
4078
+ app.addMenuLink({
4079
+ to: `/plugins/${PLUGIN_ID}/navigation`,
4080
+ icon: NavigationIcon,
4081
+ intlLabel: {
4082
+ id: `${PLUGIN_ID}.link.navigation`,
4083
+ defaultMessage: "Navigation"
4084
+ },
4085
+ Component: async () => {
4086
+ const component = await import("./index-D2SIGcj3.mjs");
4087
+ return { default: component.default };
4088
+ },
4089
+ permissions: [
4090
+ // Uncomment to set the permissions of the plugin here
4091
+ // {
4092
+ // action: '', // the action name should be plugin::plugin-name.actionType
4093
+ // subject: null,
4094
+ // },
4095
+ ]
4096
+ });
4097
+ app.addSettingsLink(
4098
+ {
4099
+ id: PLUGIN_ID,
4100
+ intlLabel: {
4101
+ id: `${PLUGIN_ID}.settings.section`,
4102
+ defaultMessage: PLUGIN_NAME
4103
+ }
4104
+ },
4105
+ {
4106
+ intlLabel: {
4107
+ id: `${PLUGIN_ID}.settings.section.general`,
4108
+ defaultMessage: "General"
4109
+ },
4110
+ id: `${PLUGIN_ID}-general`,
4111
+ to: `/settings/${PLUGIN_ID}/general`,
4112
+ Component: async () => {
4113
+ return await import(
4114
+ /* webpackChunkName: "webatlas-settings-general-page" */
4115
+ "./index-QFbHwlyj.mjs"
4116
+ );
4117
+ },
4118
+ permissions: [
4119
+ // Uncomment to set the permissions of the plugin here
4120
+ // {
4121
+ // action: '', // the action name should be plugin::plugin-name.actionType
4122
+ // subject: null,
4123
+ // },
4124
+ ]
4125
+ }
4126
+ );
4127
+ app.addSettingsLink(
4128
+ PLUGIN_ID,
4129
+ {
4130
+ intlLabel: {
4131
+ id: `${PLUGIN_ID}.settings.navigation`,
4132
+ defaultMessage: "Navigation"
4133
+ },
4134
+ id: `${PLUGIN_ID}-navigation`,
4135
+ to: `/settings/${PLUGIN_ID}/navigation`,
4136
+ Component: async () => {
4137
+ return await import(
4138
+ /* webpackChunkName: "webatlas-settings-navigation-page" */
4139
+ "./index-DXRtXlZW.mjs"
4140
+ );
4141
+ },
4142
+ permissions: [
4143
+ // Uncomment to set the permissions of the plugin here
4144
+ // {
4145
+ // action: '', // the action name should be plugin::plugin-name.actionType
4146
+ // subject: null,
4147
+ // },
4148
+ ]
4149
+ }
4150
+ );
4151
+ app.registerPlugin({
4152
+ id: PLUGIN_ID,
4153
+ initializer: Initializer,
4154
+ isReady: false,
4155
+ name: PLUGIN_ID
4156
+ });
4157
+ },
4158
+ bootstrap(app) {
4159
+ app.getPlugin("content-manager").apis.addEditViewSidePanel([() => ({
4160
+ title: "URL Alias",
4161
+ content: /* @__PURE__ */ jsx(CMEditViewAside, {})
4162
+ })]);
4163
+ },
4164
+ async registerTrads({ locales }) {
4165
+ return Promise.all(
4166
+ locales.map(async (locale) => {
4167
+ try {
4168
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => import("./de-B9pq-AJZ.mjs"), "./translations/en.json": () => import("./en-Dmbcf7gp.mjs") }), `./translations/${locale}.json`, 3);
4169
+ return { data, locale };
4170
+ } catch {
4171
+ return { data: {}, locale };
4172
+ }
4173
+ })
4174
+ );
4175
+ }
4176
+ };
4177
+ export {
4178
+ PLUGIN_NAME as P,
4179
+ Tooltip as T,
4180
+ URLInfo as U,
4181
+ duplicateCheck as a,
4182
+ usePluginConfig as b,
4183
+ useAllContentTypes as c,
4184
+ debounce as d,
4185
+ PLUGIN_VERSION as e,
4186
+ getTranslation as g,
4187
+ index as i,
4188
+ transformToUrl as t,
4189
+ useApi as u
4190
+ };
4191
+ //# sourceMappingURL=index-Dt-mlR1F.mjs.map