forge-openclaw-plugin 0.2.19 → 0.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +133 -2
  2. package/dist/assets/board-_C6oMy5w.js +6 -0
  3. package/dist/assets/{board-8L3uX7_O.js.map → board-_C6oMy5w.js.map} +1 -1
  4. package/dist/assets/index-B4A6TooJ.js +63 -0
  5. package/dist/assets/index-B4A6TooJ.js.map +1 -0
  6. package/dist/assets/index-D6Xs_2mo.css +1 -0
  7. package/dist/assets/{motion-1GAqqi8M.js → motion-D4sZgCHd.js} +2 -2
  8. package/dist/assets/{motion-1GAqqi8M.js.map → motion-D4sZgCHd.js.map} +1 -1
  9. package/dist/assets/{table-DBGlgRjk.js → table-BWzTaky1.js} +2 -2
  10. package/dist/assets/{table-DBGlgRjk.js.map → table-BWzTaky1.js.map} +1 -1
  11. package/dist/assets/{ui-iTluWjC4.js → ui-BzK4azQb.js} +7 -7
  12. package/dist/assets/{ui-iTluWjC4.js.map → ui-BzK4azQb.js.map} +1 -1
  13. package/dist/assets/vendor-DT3pnAKJ.css +1 -0
  14. package/dist/assets/vendor-De38P6YR.js +729 -0
  15. package/dist/assets/vendor-De38P6YR.js.map +1 -0
  16. package/dist/assets/viz-C6hfyqzu.js +34 -0
  17. package/dist/assets/viz-C6hfyqzu.js.map +1 -0
  18. package/dist/index.html +9 -9
  19. package/dist/openclaw/parity.d.ts +1 -1
  20. package/dist/openclaw/parity.js +29 -2
  21. package/dist/openclaw/routes.js +207 -24
  22. package/dist/openclaw/tools.js +324 -35
  23. package/dist/server/app.js +2080 -92
  24. package/dist/server/db.js +3 -0
  25. package/dist/server/health.js +1284 -0
  26. package/dist/server/managers/platform/background-job-manager.js +138 -2
  27. package/dist/server/managers/platform/llm-manager.js +126 -0
  28. package/dist/server/managers/platform/openai-responses-provider.js +773 -0
  29. package/dist/server/managers/runtime.js +6 -1
  30. package/dist/server/openapi.js +718 -0
  31. package/dist/server/preferences-seeds.js +409 -0
  32. package/dist/server/preferences-types.js +368 -0
  33. package/dist/server/psyche-types.js +42 -18
  34. package/dist/server/repositories/activity-events.js +53 -4
  35. package/dist/server/repositories/calendar.js +89 -15
  36. package/dist/server/repositories/collaboration.js +8 -3
  37. package/dist/server/repositories/diagnostic-logs.js +243 -0
  38. package/dist/server/repositories/entity-ownership.js +92 -0
  39. package/dist/server/repositories/goals.js +7 -2
  40. package/dist/server/repositories/habits.js +122 -16
  41. package/dist/server/repositories/notes.js +119 -41
  42. package/dist/server/repositories/preferences.js +1765 -0
  43. package/dist/server/repositories/projects.js +18 -7
  44. package/dist/server/repositories/psyche.js +84 -27
  45. package/dist/server/repositories/rewards.js +112 -4
  46. package/dist/server/repositories/strategies.js +450 -0
  47. package/dist/server/repositories/tags.js +11 -6
  48. package/dist/server/repositories/task-runs.js +10 -2
  49. package/dist/server/repositories/tasks.js +99 -17
  50. package/dist/server/repositories/users.js +417 -0
  51. package/dist/server/repositories/wiki-memory.js +3366 -0
  52. package/dist/server/services/context.js +20 -18
  53. package/dist/server/services/dashboard.js +29 -6
  54. package/dist/server/services/entity-crud.js +21 -3
  55. package/dist/server/services/insights.js +9 -7
  56. package/dist/server/services/projects.js +2 -1
  57. package/dist/server/services/psyche.js +10 -9
  58. package/dist/server/types.js +594 -30
  59. package/openclaw.plugin.json +1 -1
  60. package/package.json +1 -1
  61. package/server/migrations/015_multi_user_and_strategies.sql +244 -0
  62. package/server/migrations/016_health_companion.sql +158 -0
  63. package/server/migrations/016_strategy_contracts_and_user_graph.sql +22 -0
  64. package/server/migrations/017_preferences.sql +131 -0
  65. package/server/migrations/018_preference_catalogs.sql +31 -0
  66. package/server/migrations/019_wiki_memory.sql +255 -0
  67. package/server/migrations/020_wiki_page_hierarchy.sql +11 -0
  68. package/server/migrations/021_hide_evidence_from_wiki_index.sql +3 -0
  69. package/server/migrations/022_wiki_ingest_background.sql +85 -0
  70. package/server/migrations/023_diagnostic_logs.sql +28 -0
  71. package/skills/forge-openclaw/SKILL.md +126 -34
  72. package/skills/forge-openclaw/entity_conversation_playbooks.md +337 -0
  73. package/skills/forge-openclaw/psyche_entity_playbooks.md +404 -0
  74. package/dist/assets/board-8L3uX7_O.js +0 -6
  75. package/dist/assets/index-Cj1IBH_w.js +0 -36
  76. package/dist/assets/index-Cj1IBH_w.js.map +0 -1
  77. package/dist/assets/index-DQT6EbuS.css +0 -1
  78. package/dist/assets/vendor-BvM2F9Dp.js +0 -503
  79. package/dist/assets/vendor-BvM2F9Dp.js.map +0 -1
  80. package/dist/assets/vendor-CRS-psbw.css +0 -1
  81. package/dist/assets/viz-CNeunkfu.js +0 -34
  82. package/dist/assets/viz-CNeunkfu.js.map +0 -1
@@ -0,0 +1,404 @@
1
+ # Psyche Entity Playbooks
2
+
3
+ Use this file whenever the user is exploring a Psyche entity rather than asking for a
4
+ purely mechanical save. The point is to help the person understand their own
5
+ functioning while gathering enough evidence to store the right Forge record.
6
+
7
+ ## Interview stance
8
+
9
+ - Ask permission before going deeper when the user is hesitant or has not clearly asked
10
+ for exploration yet. If they already invited help understanding the issue, do not add
11
+ extra friction by re-asking permission.
12
+ - Use an active-listening rhythm: open question, brief reflection, focused follow-up,
13
+ concise summary.
14
+ - Use a therapist-like progression of:
15
+ concrete example -> reflection -> meaning -> tentative name -> links -> save.
16
+ - Ask one or two focused questions at a time. Do not dump the whole schema as intake.
17
+ - Start from a recent concrete example before naming an abstract pattern or mode.
18
+ - If the user says "help me understand it first" or signals uncertainty, the first
19
+ response should contain one orienting question before any working formulation, save
20
+ pitch, or suggested title.
21
+ - In that first reply, prefer exactly one question unless a safety issue requires more.
22
+ - In that first reply, ask only one question.
23
+ - In that first reply, prefer a two-sentence shape:
24
+ sentence one is a short empathic reflection;
25
+ sentence two is the single exploratory question.
26
+ - In that first reply, keep the reflection brief: at most one or two short sentences
27
+ before the question.
28
+ - In that first reply, avoid numbered lists, bullet lists, or multi-part frameworks.
29
+ The goal is a natural therapist-like opening, not a worksheet dump.
30
+ - In that first reply, stay in plain prose and end with a single exploratory question.
31
+ - In that first reply, do not define the whole pattern, belief, or mode yet. Only
32
+ reflect what is already obvious from the user's own words.
33
+ - In that first reply, keep the total length short. A good default is under 90 words.
34
+ - In that first reply, do not search Forge, mention whether a matching entity exists,
35
+ or mention saving. Stay with the person's experience first.
36
+ - In that first reply, prefer one concrete-example question such as "What happened the
37
+ last time this showed up?" or "What feels most dangerous in that moment?" instead of
38
+ a broad analysis.
39
+ - Prefer the user's own language over imported clinical labels.
40
+ - After each real answer, decide which lane you need next:
41
+ clarify the situation,
42
+ clarify the sequence,
43
+ clarify the meaning,
44
+ clarify the protection,
45
+ clarify the cost,
46
+ clarify the longing or value,
47
+ or clarify the tentative name.
48
+ - Ask only one lane at a time. Do not jump from the example straight into belief,
49
+ mode, value, and repair all in one turn.
50
+ - Before the next question, reflect back what you just heard in one or two sentences so
51
+ the user can feel understood and correct you if needed.
52
+ - Keep the reflection grounded and ordinary. Sound professionally warm, not clinical,
53
+ mystical, or diagnosis-adjacent.
54
+ - When the person says they want to save "something about" an experience, do not force
55
+ the entity type too early. First understand whether it is mainly a value, belief,
56
+ pattern, mode, or incident.
57
+ - Name possible adjacent entities gently: "This sounds like it may also contain a belief."
58
+ - When nuance matters, preserve it in a linked Markdown `note` instead of forcing every
59
+ detail into normalized fields.
60
+ - Before saving, offer a short working summary and a tentative name when that would help
61
+ the user decide whether the formulation fits.
62
+ - When the user is close to the experience but far from the wording, do some of the
63
+ formulation work for them. Offer one careful candidate name or summary and invite
64
+ correction.
65
+ - After the first real answer, look for the next best move:
66
+ clarify the sequence,
67
+ clarify the meaning,
68
+ clarify the protection,
69
+ or clarify the value at stake.
70
+ - Near the end, ask whether this should stay linked to a belief, value, mode, pattern,
71
+ task, project, or note that also became visible in the conversation.
72
+ - When updating an existing Psyche entity, start with:
73
+ what feels newly clear,
74
+ what still fits,
75
+ and what recent example or episode changed the understanding.
76
+ - Do not diagnose. Do not claim certainty about schemas, modes, or meanings.
77
+ - Do not offer replacement beliefs, softer reframes, or named provisional titles until
78
+ the user has answered at least one real exploration question.
79
+ - Do not front-load a complete explanation of the loop or mode before the first answer.
80
+ Earn the formulation gradually from the user's replies.
81
+ - Do not mention Forge fields, save options, or entity formatting until the user has
82
+ answered at least one exploration question, unless they explicitly interrupt to save
83
+ immediately.
84
+ - Do not use "a useful way to see it", "a clean sequence", "here's what is happening",
85
+ or similar lead-ins on the first reply. Those cues push the conversation into lecture
86
+ mode too early.
87
+ - Do not start the first reply with phrases like "This is", "This sounds like", "What
88
+ you're describing is", or "It reads like". Start with a brief empathic reflection and
89
+ then ask the question.
90
+ - Do not use colons in the first reply. They almost always lead into a list or mini
91
+ framework instead of a live conversation.
92
+
93
+ ## Follow-up rhythm
94
+
95
+ After the first exploratory reply, a strong next turn usually has this shape:
96
+
97
+ 1. one short reflection grounded in the user's own words
98
+ 2. one sentence naming what seems most important so far
99
+ 3. one focused next question
100
+
101
+ Example shape:
102
+
103
+ - "So when Lea goes quiet, something in you reads danger very quickly and starts pulling
104
+ back before the hurt can land. What does disappearing do for you in that moment?"
105
+
106
+ Avoid turning the second turn into a mini case formulation. Stay collaborative and earn
107
+ the abstraction gradually.
108
+
109
+ ## Safety rule
110
+
111
+ If the user shows imminent risk of self-harm, suicide, violence, inability to stay
112
+ safe, or severe disorientation, stop normal Psyche intake. Shift to immediate support,
113
+ encourage urgent human help, and in the U.S. mention calling or texting `988` or using
114
+ local emergency services if they are in immediate danger. This is a safety handoff, not
115
+ another intake step.
116
+
117
+ ## First-turn templates
118
+
119
+ When the user wants understanding before saving, the first reply should usually sound
120
+ like one of these:
121
+
122
+ - "That sounds important. What happened the last time this showed up?"
123
+ - "I can help slow it down. What feels most dangerous in that moment?"
124
+ - "Let’s stay close to your words for a second. When do you notice this most?"
125
+
126
+ Good first turns are short, human, and curious. They are not mini-lectures.
127
+
128
+ ## Bridging To Storage
129
+
130
+ Once the user has answered at least one real exploration question and the formulation
131
+ is becoming coherent:
132
+
133
+ 1. reflect back the pattern, belief, mode, value, or incident in two to four short
134
+ sentences
135
+ 2. offer a tentative name only if it feels earned from the user's own words
136
+ 3. ask whether the wording fits before saving
137
+ 4. ask only for the remaining missing structure needed for the specific entity
138
+
139
+ If the person struggles to name it, do not keep asking "what would you call this?"
140
+ Offer one or two grounded options based on their language and let them refine.
141
+
142
+ Do not jump from one exploratory answer straight into a finished normalized record.
143
+ Help the user recognize their own experience first.
144
+
145
+ ## Value
146
+
147
+ Aim: clarify a direction to live toward, not a goal to complete.
148
+
149
+ Arc:
150
+
151
+ 1. Ask what feels important.
152
+ 2. Ask how living it would look in ordinary life.
153
+ 3. Separate the value from a goal or performance target.
154
+ 4. Ask what gets in the way.
155
+ 5. Name one committed action.
156
+
157
+ Likely linked entities:
158
+
159
+ - `goal` when the value belongs to one strategic direction
160
+ - `project` or `task` when the user wants a concrete expression now
161
+ - `behavior` when the user keeps describing a repeated move that serves or violates the value
162
+
163
+ Ready to save when:
164
+
165
+ - the value has a clear name
166
+ - the valued direction is understandable in plain language
167
+ - there is enough detail to write `whyItMatters` or one `committedAction`
168
+
169
+ Preferred opening question:
170
+
171
+ - "When did the pull or absence of this value feel most noticeable recently?"
172
+
173
+ Helpful follow-up lanes:
174
+
175
+ - what living the value looks like in ordinary behavior
176
+ - what hurts or longing makes the value feel alive right now
177
+ - what gets in the way
178
+ - one next committed action
179
+
180
+ ## Behavior Pattern
181
+
182
+ Aim: build a functional analysis of a recurring loop.
183
+
184
+ Arc:
185
+
186
+ 1. Anchor in one recent example.
187
+ 2. Map cues, vulnerability factors, and context.
188
+ 3. Reflect the sequence of thoughts, feelings, body state, and actions.
189
+ 4. Ask what the loop protects, relieves, or helps avoid short term.
190
+ 5. Ask what it costs long term.
191
+ 6. Ask what a more workable response would be.
192
+ 7. Notice linked beliefs, modes, values, or behaviors.
193
+
194
+ Likely linked entities:
195
+
196
+ - `belief_entry` when a rule, self-judgment, or prediction shows up
197
+ - `mode_profile` when a protector, critic, child, or healthy-adult stance is obvious
198
+ - `psyche_value` when the long-term cost is clearly about drifting from a value
199
+ - `behavior` when one repeated move inside the loop deserves its own record
200
+
201
+ Ready to save when:
202
+
203
+ - the pattern can be named in plain language
204
+ - the cue, short-term payoff, and long-term cost are all at least roughly clear
205
+ - there is a preferred response or at least a direction for one
206
+
207
+ Preferred opening question:
208
+
209
+ - "What happened the last time you noticed yourself disappearing like that?"
210
+
211
+ Helpful follow-up lanes:
212
+
213
+ - the earliest cue or vulnerability factor
214
+ - the moment the loop starts to make sense internally
215
+ - what the loop protects or prevents
216
+ - what it costs later
217
+ - what a more workable move would need to preserve
218
+
219
+ ## Behavior
220
+
221
+ Aim: understand one recurring move and its function.
222
+
223
+ Arc:
224
+
225
+ 1. Ask what the behavior actually looks like.
226
+ 2. Ask what cues or urges pull it online.
227
+ 3. Ask what it does for the user in the moment.
228
+ 4. Ask what cost shows up later.
229
+ 5. Decide whether it is `away`, `committed`, or `recovery`.
230
+ 6. If relevant, ask for a replacement move or repair plan.
231
+
232
+ Likely linked entities:
233
+
234
+ - `behavior_pattern` when the move belongs to a larger loop
235
+ - `psyche_value` when the user contrasts the move with how they want to live
236
+ - `mode_profile` when the move clearly belongs to a protector, critic, or child state
237
+
238
+ Ready to save when:
239
+
240
+ - the move has a stable title
241
+ - its `kind` is clear
242
+ - at least one cue, payoff, or replacement move is grounded enough to be useful later
243
+
244
+ Preferred opening question:
245
+
246
+ - "Right before you send the long message, what feels most urgent or threatened?"
247
+
248
+ Helpful follow-up lanes:
249
+
250
+ - what the urge is trying to fix immediately
251
+ - what cue or body signal appears first
252
+ - whether the move is away, committed, or recovery
253
+ - what alternative move would still meet the underlying need
254
+
255
+ ## Belief
256
+
257
+ Aim: turn implicit self-talk into one explicit sentence that can be examined.
258
+
259
+ Arc:
260
+
261
+ 1. Reflect the likely belief in the user's words and ask for correction.
262
+ 2. Clarify whether it is `absolute` or `conditional`.
263
+ 3. Ask how true it feels from `0` to `100`.
264
+ 4. Gather evidence for and evidence against.
265
+ 5. Ask where the rule may have been learned or reinforced.
266
+ 6. Offer a more flexible alternative only after the user has examined the belief and
267
+ actually wants help loosening it.
268
+
269
+ Likely linked entities:
270
+
271
+ - `behavior_pattern` when the belief drives a recurring loop
272
+ - `mode_profile` when the belief sounds like a specific part-state
273
+ - `trigger_report` when the belief became visible in one episode
274
+
275
+ Ready to save when:
276
+
277
+ - the belief can be written as one sentence
278
+ - `beliefType` is clear
279
+ - there is at least some confidence and one piece of supporting or weakening evidence
280
+
281
+ Preferred opening question:
282
+
283
+ - "When that sentence feels true, what are you afraid would happen if you needed more?"
284
+
285
+ Helpful follow-up lanes:
286
+
287
+ - the feared consequence
288
+ - how old or familiar the rule feels
289
+ - evidence that supports it
290
+ - evidence that strains it
291
+ - whether the user wants help drafting a more flexible alternative
292
+
293
+ ## Mode Profile
294
+
295
+ Aim: describe a recurring part-state, what it does, and what it fears.
296
+
297
+ Arc:
298
+
299
+ 1. Start from a recent moment when the mode showed up.
300
+ 2. Ask how it feels, sounds, looks, or carries itself.
301
+ 3. Choose the mode family after the lived description is clearer.
302
+ 4. Name its protective job, fear, and burden.
303
+ 5. Ask when it first became necessary or familiar.
304
+ 6. Ask what a healthy-adult response would need to do with it.
305
+
306
+ Likely linked entities:
307
+
308
+ - `behavior_pattern` when the mode repeatedly drives a loop
309
+ - `behavior` when the mode expresses through one repeated action
310
+ - `belief_entry` when the mode speaks in a specific rule or script
311
+
312
+ Ready to save when:
313
+
314
+ - the mode has a stable name
315
+ - `family` is clear enough to choose without forcing certainty
316
+ - its job or fear is understandable in plain language
317
+
318
+ Preferred opening question:
319
+
320
+ - "When you become polished and unreachable, what is that part trying to protect?"
321
+
322
+ Helpful follow-up lanes:
323
+
324
+ - the felt sense, posture, or voice of the part
325
+ - what it fears would happen without its control
326
+ - what burden it carries
327
+ - how long it has been needed
328
+ - what a healthy-adult response would need to offer it
329
+
330
+ ## Mode Guide Session
331
+
332
+ Aim: guide a present-moment inquiry when the active mode is not yet clear.
333
+
334
+ Arc:
335
+
336
+ 1. Anchor in the current or recent situation.
337
+ 2. Ask what the part is feeling, saying, stopping, or pushing for.
338
+ 3. Ask what it fears and what it seems to need.
339
+ 4. Reflect the answers before suggesting interpretations.
340
+ 5. Offer one or two candidate mode labels only after enough evidence exists.
341
+
342
+ Likely linked entities:
343
+
344
+ - `mode_profile` if a durable recurring mode becomes clear
345
+ - `trigger_report` if the conversation is really about one incident chain
346
+ - `belief_entry` if the part keeps repeating one explicit rule
347
+
348
+ Ready to save when:
349
+
350
+ - there is a usable `summary`
351
+ - the `answers` capture the user's language faithfully
352
+ - any candidate mode interpretations remain tentative and evidence-based
353
+
354
+ Preferred opening question:
355
+
356
+ - "In the moment you feel exposed, what does that part start telling you to do?"
357
+
358
+ Helpful follow-up lanes:
359
+
360
+ - what just happened before the shift
361
+ - what the part fears
362
+ - what it needs
363
+ - whether one or two tentative mode candidates now fit
364
+
365
+ ## Trigger Report
366
+
367
+ Aim: map one emotionally meaningful episode clearly enough to learn from it.
368
+
369
+ Arc:
370
+
371
+ 1. Name the incident briefly.
372
+ 2. Reconstruct what happened concretely.
373
+ 3. Capture emotions and intensity.
374
+ 4. Capture thoughts, meanings, and belief-linked interpretations.
375
+ 5. Capture behaviors and coping moves.
376
+ 6. Capture short-term and long-term consequences.
377
+ 7. Ask what pattern, belief, mode, or value was most active.
378
+ 8. End with next moves.
379
+
380
+ Likely linked entities:
381
+
382
+ - `behavior_pattern` when the episode reveals a repeated loop
383
+ - `belief_entry` when the episode reveals a clear rule or prediction
384
+ - `mode_profile` when one part-state dominated the sequence
385
+ - `psyche_value` when the repair move points back to a valued direction
386
+
387
+ Ready to save when:
388
+
389
+ - the event has a clear title
390
+ - there is enough structure to fill emotions, thoughts, behaviors, and consequences
391
+ - there is at least one useful next move or linked entity to learn from later
392
+
393
+ Preferred opening question:
394
+
395
+ - "If we slow that incident right down, what was the first moment you noticed the shift in you?"
396
+
397
+ Helpful follow-up lanes:
398
+
399
+ - the first external cue
400
+ - the first internal shift
401
+ - the thoughts or meanings that arrived
402
+ - the behavior that followed
403
+ - the immediate and later consequences
404
+ - the pattern, belief, mode, or value that now seems most relevant
@@ -1,6 +0,0 @@
1
- import{r as l,H as I,a as Ne}from"./vendor-BvM2F9Dp.js";function An(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const nt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function we(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function mt(e){return"nodeType"in e}function z(e){var t,n;return e?we(e)?e:mt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function yt(e){const{Document:t}=z(e);return e instanceof t}function Be(e){return we(e)?!1:e instanceof z(e).HTMLElement}function Wt(e){return e instanceof z(e).SVGElement}function xe(e){return e?we(e)?e.document:mt(e)?yt(e)?e:Be(e)||Wt(e)?e.ownerDocument:document:document:document}const V=nt?l.useLayoutEffect:l.useEffect;function rt(e){const t=l.useRef(e);return V(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Mn(){const e=l.useRef(null),t=l.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=l.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Pe(e,t){t===void 0&&(t=[e]);const n=l.useRef(e);return V(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=l.useRef();return l.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Je(e){const t=rt(e),n=l.useRef(null),r=l.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function _e(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}let ut={};function $e(e,t){return l.useMemo(()=>{if(t)return t;const n=ut[e]==null?0:ut[e]+1;return ut[e]=n,e+"-"+n},[e,t])}function Ut(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[c,u]of a){const d=i[c];d!=null&&(i[c]=d+e*u)}return i},{...t})}}const ye=Ut(1),Qe=Ut(-1);function On(e){return"clientX"in e&&"clientY"in e}function ot(e){if(!e)return!1;const{KeyboardEvent:t}=z(e.target);return t&&e instanceof t}function In(e){if(!e)return!1;const{TouchEvent:t}=z(e.target);return t&&e instanceof t}function Ze(e){if(In(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return On(e)?{x:e.clientX,y:e.clientY}:null}const fe=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[fe.Translate.toString(e),fe.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Tt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Nn(e){return e.matches(Tt)?e:e.querySelector(Tt)}const Tn={display:"none"};function Ln(e){let{id:t,value:n}=e;return I.createElement("div",{id:t,style:Tn},n)}function kn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return I.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Pn(){const[e,t]=l.useState("");return{announce:l.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Ht=l.createContext(null);function zn(e){const t=l.useContext(Ht);l.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Bn(){const[e]=l.useState(()=>new Set),t=l.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[l.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const Fn={draggable:`
2
- To pick up a draggable item, press the space bar.
3
- While dragging, use the arrow keys to move the item.
4
- Press space again to drop the item in its new position, or press escape to cancel.
5
- `},$n={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Xn(e){let{announcements:t=$n,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Fn}=e;const{announce:i,announcement:s}=Pn(),a=$e("DndLiveRegion"),[c,u]=l.useState(!1);if(l.useEffect(()=>{u(!0)},[]),zn(l.useMemo(()=>({onDragStart(f){let{active:h}=f;i(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:g}=f;t.onDragMove&&i(t.onDragMove({active:h,over:g}))},onDragOver(f){let{active:h,over:g}=f;i(t.onDragOver({active:h,over:g}))},onDragEnd(f){let{active:h,over:g}=f;i(t.onDragEnd({active:h,over:g}))},onDragCancel(f){let{active:h,over:g}=f;i(t.onDragCancel({active:h,over:g}))}}),[i,t])),!c)return null;const d=I.createElement(I.Fragment,null,I.createElement(Ln,{id:r,value:o.draggable}),I.createElement(kn,{id:a,announcement:s}));return n?Ne.createPortal(d,n):d}var T;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(T||(T={}));function et(){}function vo(e,t){return l.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function po(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const q=Object.freeze({x:0,y:0});function Vt(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function jn(e,t){const n=Ze(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function qt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Yn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ht(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Kn(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const bo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=ht(t),i=[];for(const s of r){const{id:a}=s,c=n.get(a);if(c){const u=ht(c),d=o.reduce((h,g,D)=>h+Vt(u[D],g),0),f=Number((d/4).toFixed(4));i.push({id:a,data:{droppableContainer:s,value:f}})}}return i.sort(qt)};function Wn(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=o-r,a=i-n;if(r<o&&n<i){const c=t.width*t.height,u=e.width*e.height,d=s*a,f=d/(c+u-d);return Number(f.toFixed(4))}return 0}const Un=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:s}=i,a=n.get(s);if(a){const c=Wn(a,t);c>0&&o.push({id:s,data:{droppableContainer:i,value:c}})}}return o.sort(Yn)};function Hn(e,t){const{top:n,left:r,bottom:o,right:i}=t;return n<=e.y&&e.y<=o&&r<=e.x&&e.x<=i}const mo=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const o=[];for(const i of t){const{id:s}=i,a=n.get(s);if(a&&Hn(r,a)){const u=ht(a).reduce((f,h)=>f+Vt(r,h),0),d=Number((u/4).toFixed(4));o.push({id:s,data:{droppableContainer:i,value:d}})}}return o.sort(qt)};function Vn(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Gt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:q}function qn(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const Gn=qn(1);function Jt(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Jn(e,t,n){const r=Jt(t);if(!r)return e;const{scaleX:o,scaleY:i,x:s,y:a}=r,c=e.left-s-(1-o)*parseFloat(n),u=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,f=i?e.height/i:e.height;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c}}const _n={ignoreTransform:!1};function De(e,t){t===void 0&&(t=_n);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=z(e).getComputedStyle(e);u&&(n=Jn(n,u,d))}const{top:r,left:o,width:i,height:s,bottom:a,right:c}=n;return{top:r,left:o,width:i,height:s,bottom:a,right:c}}function Lt(e){return De(e,{ignoreTransform:!0})}function Qn(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Zn(e,t){return t===void 0&&(t=z(e).getComputedStyle(e)),t.position==="fixed"}function er(e,t){t===void 0&&(t=z(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function wt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(yt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Be(o)||Wt(o)||n.includes(o))return n;const i=z(e).getComputedStyle(o);return o!==e&&er(o,i)&&n.push(o),Zn(o,i)?n:r(o.parentNode)}return e?r(e):n}function _t(e){const[t]=wt(e,1);return t??null}function dt(e){return!nt||!e?null:we(e)?e:mt(e)?yt(e)||e===xe(e).scrollingElement?window:Be(e)?e:null:null}function Qt(e){return we(e)?e.scrollX:e.scrollLeft}function Zt(e){return we(e)?e.scrollY:e.scrollTop}function vt(e){return{x:Qt(e),y:Zt(e)}}var L;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(L||(L={}));function en(e){return!nt||!e?!1:e===document.scrollingElement}function tn(e){const t={x:0,y:0},n=en(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const tr={x:.2,y:.2};function nr(e,t,n,r,o){let{top:i,left:s,right:a,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=tr);const{isTop:u,isBottom:d,isLeft:f,isRight:h}=tn(e),g={x:0,y:0},D={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+v.height?(g.y=L.Backward,D.y=r*Math.abs((t.top+v.height-i)/v.height)):!d&&c>=t.bottom-v.height&&(g.y=L.Forward,D.y=r*Math.abs((t.bottom-v.height-c)/v.height)),!h&&a>=t.right-v.width?(g.x=L.Forward,D.x=r*Math.abs((t.right-v.width-a)/v.width)):!f&&s<=t.left+v.width&&(g.x=L.Backward,D.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:g,speed:D}}function rr(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function nn(e){return e.reduce((t,n)=>ye(t,vt(n)),q)}function or(e){return e.reduce((t,n)=>t+Qt(n),0)}function ir(e){return e.reduce((t,n)=>t+Zt(n),0)}function rn(e,t){if(t===void 0&&(t=De),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);_t(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const sr=[["x",["left","right"],or],["y",["top","bottom"],ir]];class xt{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=wt(n),o=nn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,a]of sr)for(const c of s)Object.defineProperty(this,c,{get:()=>{const u=a(r),d=o[i]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Te{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function ar(e){const{EventTarget:t}=z(e);return e instanceof t?e:xe(e)}function ft(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var W;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(W||(W={}));function kt(e){e.preventDefault()}function lr(e){e.stopPropagation()}var R;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(R||(R={}));const on={start:[R.Space,R.Enter],cancel:[R.Esc],end:[R.Space,R.Enter,R.Tab]},cr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case R.Right:return{...n,x:n.x+25};case R.Left:return{...n,x:n.x-25};case R.Down:return{...n,y:n.y+25};case R.Up:return{...n,y:n.y-25}}};class sn{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Te(xe(n)),this.windowListeners=new Te(z(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(W.Resize,this.handleCancel),this.windowListeners.add(W.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(W.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&rn(r),n(q)}handleKeyDown(t){if(ot(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=on,coordinateGetter:s=cr,scrollBehavior:a="smooth"}=o,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,d=u?{x:u.left,y:u.top}:q;this.referenceCoordinates||(this.referenceCoordinates=d);const f=s(t,{active:n,context:r.current,currentCoordinates:d});if(f){const h=Qe(f,d),g={x:0,y:0},{scrollableAncestors:D}=r.current;for(const v of D){const p=t.code,{isTop:b,isRight:y,isLeft:m,isBottom:C,maxScroll:S,minScroll:E}=tn(v),w=rr(v),x={x:Math.min(p===R.Right?w.right-w.width/2:w.right,Math.max(p===R.Right?w.left:w.left+w.width/2,f.x)),y:Math.min(p===R.Down?w.bottom-w.height/2:w.bottom,Math.max(p===R.Down?w.top:w.top+w.height/2,f.y))},O=p===R.Right&&!y||p===R.Left&&!m,N=p===R.Down&&!C||p===R.Up&&!b;if(O&&x.x!==f.x){const M=v.scrollLeft+h.x,U=p===R.Right&&M<=S.x||p===R.Left&&M>=E.x;if(U&&!h.y){v.scrollTo({left:M,behavior:a});return}U?g.x=v.scrollLeft-M:g.x=p===R.Right?v.scrollLeft-S.x:v.scrollLeft-E.x,g.x&&v.scrollBy({left:-g.x,behavior:a});break}else if(N&&x.y!==f.y){const M=v.scrollTop+h.y,U=p===R.Down&&M<=S.y||p===R.Up&&M>=E.y;if(U&&!h.x){v.scrollTo({top:M,behavior:a});return}U?g.y=v.scrollTop-M:g.y=p===R.Down?v.scrollTop-S.y:v.scrollTop-E.y,g.y&&v.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,ye(Qe(f,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}sn.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=on,onActivation:o}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function Pt(e){return!!(e&&"distance"in e)}function zt(e){return!!(e&&"delay"in e)}class Dt{constructor(t,n,r){var o;r===void 0&&(r=ar(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=xe(s),this.documentListeners=new Te(this.document),this.listeners=new Te(r),this.windowListeners=new Te(z(s)),this.initialCoordinates=(o=Ze(i))!=null?o:q,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(W.Resize,this.handleCancel),this.windowListeners.add(W.DragStart,kt),this.windowListeners.add(W.VisibilityChange,this.handleCancel),this.windowListeners.add(W.ContextMenu,kt),this.documentListeners.add(W.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(zt(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Pt(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(W.Click,lr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(W.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!o)return;const c=(n=Ze(t))!=null?n:q,u=Qe(o,c);if(!r&&a){if(Pt(a)){if(a.tolerance!=null&&ft(u,a.tolerance))return this.handleCancel();if(ft(u,a.distance))return this.handleStart()}if(zt(a)&&ft(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);return}t.cancelable&&t.preventDefault(),s(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===R.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ur={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class an extends Dt{constructor(t){const{event:n}=t,r=xe(n.target);super(t,ur,r)}}an.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const dr={move:{name:"mousemove"},end:{name:"mouseup"}};var pt;(function(e){e[e.RightClick=2]="RightClick"})(pt||(pt={}));class fr extends Dt{constructor(t){super(t,dr,xe(t.event.target))}}fr.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===pt.RightClick?!1:(r==null||r({event:n}),!0)}}];const gt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class gr extends Dt{constructor(t){super(t,gt)}static setup(){return window.addEventListener(gt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(gt.move.name,t)};function t(){}}}gr.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Le;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Le||(Le={}));var tt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(tt||(tt={}));function hr(e){let{acceleration:t,activator:n=Le.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:s=5,order:a=tt.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:h}=e;const g=pr({delta:f,disabled:!i}),[D,v]=Mn(),p=l.useRef({x:0,y:0}),b=l.useRef({x:0,y:0}),y=l.useMemo(()=>{switch(n){case Le.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Le.DraggableRect:return o}},[n,o,c]),m=l.useRef(null),C=l.useCallback(()=>{const E=m.current;if(!E)return;const w=p.current.x*b.current.x,x=p.current.y*b.current.y;E.scrollBy(w,x)},[]),S=l.useMemo(()=>a===tt.TreeOrder?[...u].reverse():u,[a,u]);l.useEffect(()=>{if(!i||!u.length||!y){v();return}for(const E of S){if((r==null?void 0:r(E))===!1)continue;const w=u.indexOf(E),x=d[w];if(!x)continue;const{direction:O,speed:N}=nr(E,x,y,t,h);for(const M of["x","y"])g[M][O[M]]||(N[M]=0,O[M]=0);if(N.x>0||N.y>0){v(),m.current=E,D(C,s),p.current=N,b.current=O;return}}p.current={x:0,y:0},b.current={x:0,y:0},v()},[t,C,r,v,i,s,JSON.stringify(y),JSON.stringify(g),D,u,S,d,JSON.stringify(h)])}const vr={x:{[L.Backward]:!1,[L.Forward]:!1},y:{[L.Backward]:!1,[L.Forward]:!1}};function pr(e){let{delta:t,disabled:n}=e;const r=_e(t);return Fe(o=>{if(n||!r||!o)return vr;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[L.Backward]:o.x[L.Backward]||i.x===-1,[L.Forward]:o.x[L.Forward]||i.x===1},y:{[L.Backward]:o.y[L.Backward]||i.y===-1,[L.Forward]:o.y[L.Forward]||i.y===1}}},[n,t,r])}function br(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Fe(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function mr(e,t){return l.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var ze;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ze||(ze={}));var bt;(function(e){e.Optimized="optimized"})(bt||(bt={}));const Bt=new Map;function yr(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,s]=l.useState(null),{frequency:a,measure:c,strategy:u}=o,d=l.useRef(e),f=p(),h=Pe(f),g=l.useCallback(function(b){b===void 0&&(b=[]),!h.current&&s(y=>y===null?b:y.concat(b.filter(m=>!y.includes(m))))},[h]),D=l.useRef(null),v=Fe(b=>{if(f&&!n)return Bt;if(!b||b===Bt||d.current!==e||i!=null){const y=new Map;for(let m of e){if(!m)continue;if(i&&i.length>0&&!i.includes(m.id)&&m.rect.current){y.set(m.id,m.rect.current);continue}const C=m.node.current,S=C?new xt(c(C),C):null;m.rect.current=S,S&&y.set(m.id,S)}return y}return b},[e,i,n,f,c]);return l.useEffect(()=>{d.current=e},[e]),l.useEffect(()=>{f||g()},[n,f]),l.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),l.useEffect(()=>{f||typeof a!="number"||D.current!==null||(D.current=setTimeout(()=>{g(),D.current=null},a))},[a,f,g,...r]),{droppableRects:v,measureDroppableContainers:g,measuringScheduled:i!=null};function p(){switch(u){case ze.Always:return!1;case ze.BeforeDragging:return n;default:return!n}}}function Ct(e,t){return Fe(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function wr(e,t){return Ct(e,t)}function xr(e){let{callback:t,disabled:n}=e;const r=rt(t),o=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return l.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function it(e){let{callback:t,disabled:n}=e;const r=rt(t),o=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return l.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Dr(e){return new xt(De(e),e)}function Ft(e,t,n){t===void 0&&(t=Dr);const[r,o]=l.useState(null);function i(){o(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d})}const s=xr({callback(c){if(e)for(const u of c){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=it({callback:i});return V(()=>{i(),e?(a==null||a.observe(e),s==null||s.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),s==null||s.disconnect())},[e]),r}function Cr(e){const t=Ct(e);return Gt(e,t)}const $t=[];function Sr(e){const t=l.useRef(e),n=Fe(r=>e?r&&r!==$t&&e&&t.current&&e.parentNode===t.current.parentNode?r:wt(e):$t,[e]);return l.useEffect(()=>{t.current=e},[e]),n}function Rr(e){const[t,n]=l.useState(null),r=l.useRef(e),o=l.useCallback(i=>{const s=dt(i.target);s&&n(a=>a?(a.set(s,vt(s)),new Map(a)):null)},[]);return l.useEffect(()=>{const i=r.current;if(e!==i){s(i);const a=e.map(c=>{const u=dt(c);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,vt(u)]):null}).filter(c=>c!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(i)};function s(a){a.forEach(c=>{const u=dt(c);u==null||u.removeEventListener("scroll",o)})}},[o,e]),l.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>ye(i,s),q):nn(e):q,[e,t])}function Xt(e,t){t===void 0&&(t=[]);const n=l.useRef(null);return l.useEffect(()=>{n.current=null},t),l.useEffect(()=>{const r=e!==q;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Qe(e,n.current):q}function Er(e){l.useEffect(()=>{if(!nt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function Ar(e,t){return l.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=s=>{i(s,t)},n},{}),[e,t])}function ln(e){return l.useMemo(()=>e?Qn(e):null,[e])}const jt=[];function Mr(e,t){t===void 0&&(t=De);const[n]=e,r=ln(n?z(n):null),[o,i]=l.useState(jt);function s(){i(()=>e.length?e.map(c=>en(c)?r:new xt(t(c),c)):jt)}const a=it({callback:s});return V(()=>{a==null||a.disconnect(),s(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),o}function cn(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Be(t)?t:e}function Or(e){let{measure:t}=e;const[n,r]=l.useState(null),o=l.useCallback(u=>{for(const{target:d}of u)if(Be(d)){r(f=>{const h=t(d);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),i=it({callback:o}),s=l.useCallback(u=>{const d=cn(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),r(d?t(d):null)},[t,i]),[a,c]=Je(s);return l.useMemo(()=>({nodeRef:a,rect:n,setRef:c}),[n,a,c])}const Ir=[{sensor:an,options:{}},{sensor:sn,options:{}}],Nr={current:{}},Ge={draggable:{measure:Lt},droppable:{measure:Lt,strategy:ze.WhileDragging,frequency:bt.Optimized},dragOverlay:{measure:De}};class ke extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Tr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ke,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:et},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ge,measureDroppableContainers:et,windowRect:null,measuringScheduled:!1},un={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:et,draggableNodes:new Map,over:null,measureDroppableContainers:et},Xe=l.createContext(un),dn=l.createContext(Tr);function Lr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ke}}}function kr(e,t){switch(t.type){case T.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case T.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case T.DragEnd:case T.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case T.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new ke(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case T.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new ke(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case T.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new ke(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Pr(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=l.useContext(Xe),i=_e(r),s=_e(n==null?void 0:n.id);return l.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!ot(i)||document.activeElement===i.target)return;const a=o.get(s);if(!a)return;const{activatorNode:c,node:u}=a;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=Nn(d);if(f){f.focus();break}}})}},[r,t,o,s,i]),null}function fn(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function zr(e){return l.useMemo(()=>({draggable:{...Ge.draggable,...e==null?void 0:e.draggable},droppable:{...Ge.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Ge.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Br(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=l.useRef(!1),{x:s,y:a}=typeof o=="boolean"?{x:o,y:o}:o;V(()=>{if(!s&&!a||!t){i.current=!1;return}if(i.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=n(u),f=Gt(d,r);if(s||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=_t(u);h&&h.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const st=l.createContext({...q,scaleX:1,scaleY:1});var ue;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ue||(ue={}));const yo=l.memo(function(t){var n,r,o,i;let{id:s,accessibility:a,autoScroll:c=!0,children:u,sensors:d=Ir,collisionDetection:f=Un,measuring:h,modifiers:g,...D}=t;const v=l.useReducer(kr,void 0,Lr),[p,b]=v,[y,m]=Bn(),[C,S]=l.useState(ue.Uninitialized),E=C===ue.Initialized,{draggable:{active:w,nodes:x,translate:O},droppable:{containers:N}}=p,M=w!=null?x.get(w):null,U=l.useRef({initial:null,translated:null}),H=l.useMemo(()=>{var P;return w!=null?{id:w,data:(P=M==null?void 0:M.data)!=null?P:Nr,rect:U}:null},[w,M]),G=l.useRef(null),[Ce,je]=l.useState(null),[F,Ye]=l.useState(null),Z=Pe(D,Object.values(D)),Se=$e("DndDescribedBy",s),Ke=l.useMemo(()=>N.getEnabled(),[N]),B=zr(h),{droppableRects:ee,measureDroppableContainers:de,measuringScheduled:Re}=yr(Ke,{dragging:E,dependencies:[O.x,O.y],config:B.droppable}),Y=br(x,w),We=l.useMemo(()=>F?Ze(F):null,[F]),oe=En(),te=wr(Y,B.draggable.measure);Br({activeNode:w!=null?x.get(w):null,config:oe.layoutShiftCompensation,initialRect:te,measure:B.draggable.measure});const A=Ft(Y,B.draggable.measure,te),Ee=Ft(Y?Y.parentElement:null),J=l.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:x,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ge=N.getNodeFor((n=J.current.over)==null?void 0:n.id),ne=Or({measure:B.dragOverlay.measure}),he=(r=ne.nodeRef.current)!=null?r:Y,ve=E?(o=ne.rect)!=null?o:A:null,St=!!(ne.nodeRef.current&&ne.rect),Rt=Cr(St?null:A),at=ln(he?z(he):null),ie=Sr(E?ge??Y:null),Ue=Mr(ie),He=fn(g,{transform:{x:O.x-Rt.x,y:O.y-Rt.y,scaleX:1,scaleY:1},activatorEvent:F,active:H,activeNodeRect:A,containerNodeRect:Ee,draggingNodeRect:ve,over:J.current.over,overlayNodeRect:ne.rect,scrollableAncestors:ie,scrollableAncestorRects:Ue,windowRect:at}),Et=We?ye(We,O):null,At=Rr(ie),yn=Xt(At),wn=Xt(At,[A]),pe=ye(He,yn),be=ve?Gn(ve,He):null,Ae=H&&be?f({active:H,collisionRect:be,droppableRects:ee,droppableContainers:Ke,pointerCoordinates:Et}):null,Mt=Kn(Ae,"id"),[se,Ot]=l.useState(null),xn=St?He:ye(He,wn),Dn=Vn(xn,(i=se==null?void 0:se.rect)!=null?i:null,A),lt=l.useRef(null),It=l.useCallback((P,$)=>{let{sensor:X,options:ae}=$;if(G.current==null)return;const K=x.get(G.current);if(!K)return;const j=P.nativeEvent,_=new X({active:G.current,activeNode:K,event:j,options:ae,context:J,onAbort(k){if(!x.get(k))return;const{onDragAbort:Q}=Z.current,re={id:k};Q==null||Q(re),y({type:"onDragAbort",event:re})},onPending(k,le,Q,re){if(!x.get(k))return;const{onDragPending:Oe}=Z.current,ce={id:k,constraint:le,initialCoordinates:Q,offset:re};Oe==null||Oe(ce),y({type:"onDragPending",event:ce})},onStart(k){const le=G.current;if(le==null)return;const Q=x.get(le);if(!Q)return;const{onDragStart:re}=Z.current,Me={activatorEvent:j,active:{id:le,data:Q.data,rect:U}};Ne.unstable_batchedUpdates(()=>{re==null||re(Me),S(ue.Initializing),b({type:T.DragStart,initialCoordinates:k,active:le}),y({type:"onDragStart",event:Me}),je(lt.current),Ye(j)})},onMove(k){b({type:T.DragMove,coordinates:k})},onEnd:me(T.DragEnd),onCancel:me(T.DragCancel)});lt.current=_;function me(k){return async function(){const{active:Q,collisions:re,over:Me,scrollAdjustedTranslate:Oe}=J.current;let ce=null;if(Q&&Oe){const{cancelDrop:Ie}=Z.current;ce={activatorEvent:j,active:Q,collisions:re,delta:Oe,over:Me},k===T.DragEnd&&typeof Ie=="function"&&await Promise.resolve(Ie(ce))&&(k=T.DragCancel)}G.current=null,Ne.unstable_batchedUpdates(()=>{b({type:k}),S(ue.Uninitialized),Ot(null),je(null),Ye(null),lt.current=null;const Ie=k===T.DragEnd?"onDragEnd":"onDragCancel";if(ce){const ct=Z.current[Ie];ct==null||ct(ce),y({type:Ie,event:ce})}})}}},[x]),Cn=l.useCallback((P,$)=>(X,ae)=>{const K=X.nativeEvent,j=x.get(ae);if(G.current!==null||!j||K.dndKit||K.defaultPrevented)return;const _={active:j};P(X,$.options,_)===!0&&(K.dndKit={capturedBy:$.sensor},G.current=ae,It(X,$))},[x,It]),Nt=mr(d,Cn);Er(d),V(()=>{A&&C===ue.Initializing&&S(ue.Initialized)},[A,C]),l.useEffect(()=>{const{onDragMove:P}=Z.current,{active:$,activatorEvent:X,collisions:ae,over:K}=J.current;if(!$||!X)return;const j={active:$,activatorEvent:X,collisions:ae,delta:{x:pe.x,y:pe.y},over:K};Ne.unstable_batchedUpdates(()=>{P==null||P(j),y({type:"onDragMove",event:j})})},[pe.x,pe.y]),l.useEffect(()=>{const{active:P,activatorEvent:$,collisions:X,droppableContainers:ae,scrollAdjustedTranslate:K}=J.current;if(!P||G.current==null||!$||!K)return;const{onDragOver:j}=Z.current,_=ae.get(Mt),me=_&&_.rect.current?{id:_.id,rect:_.rect.current,data:_.data,disabled:_.disabled}:null,k={active:P,activatorEvent:$,collisions:X,delta:{x:K.x,y:K.y},over:me};Ne.unstable_batchedUpdates(()=>{Ot(me),j==null||j(k),y({type:"onDragOver",event:k})})},[Mt]),V(()=>{J.current={activatorEvent:F,active:H,activeNode:Y,collisionRect:be,collisions:Ae,droppableRects:ee,draggableNodes:x,draggingNode:he,draggingNodeRect:ve,droppableContainers:N,over:se,scrollableAncestors:ie,scrollAdjustedTranslate:pe},U.current={initial:ve,translated:be}},[H,Y,Ae,be,x,he,ve,ee,N,se,ie,pe]),hr({...oe,delta:O,draggingRect:be,pointerCoordinates:Et,scrollableAncestors:ie,scrollableAncestorRects:Ue});const Sn=l.useMemo(()=>({active:H,activeNode:Y,activeNodeRect:A,activatorEvent:F,collisions:Ae,containerNodeRect:Ee,dragOverlay:ne,draggableNodes:x,droppableContainers:N,droppableRects:ee,over:se,measureDroppableContainers:de,scrollableAncestors:ie,scrollableAncestorRects:Ue,measuringConfiguration:B,measuringScheduled:Re,windowRect:at}),[H,Y,A,F,Ae,Ee,ne,x,N,ee,se,de,ie,Ue,B,Re,at]),Rn=l.useMemo(()=>({activatorEvent:F,activators:Nt,active:H,activeNodeRect:A,ariaDescribedById:{draggable:Se},dispatch:b,draggableNodes:x,over:se,measureDroppableContainers:de}),[F,Nt,H,A,b,Se,x,se,de]);return I.createElement(Ht.Provider,{value:m},I.createElement(Xe.Provider,{value:Rn},I.createElement(dn.Provider,{value:Sn},I.createElement(st.Provider,{value:Dn},u)),I.createElement(Pr,{disabled:(a==null?void 0:a.restoreFocus)===!1})),I.createElement(Xn,{...a,hiddenTextDescribedById:Se}));function En(){const P=(Ce==null?void 0:Ce.autoScrollEnabled)===!1,$=typeof c=="object"?c.enabled===!1:c===!1,X=E&&!P&&!$;return typeof c=="object"?{...c,enabled:X}:{enabled:X}}}),Fr=l.createContext(null),Yt="button",$r="Draggable";function Xr(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=$e($r),{activators:s,activatorEvent:a,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:h}=l.useContext(Xe),{role:g=Yt,roleDescription:D="draggable",tabIndex:v=0}=o??{},p=(c==null?void 0:c.id)===t,b=l.useContext(p?st:Fr),[y,m]=Je(),[C,S]=Je(),E=Ar(s,t),w=Pe(n);V(()=>(f.set(t,{id:t,key:i,node:y,activatorNode:C,data:w}),()=>{const O=f.get(t);O&&O.key===i&&f.delete(t)}),[f,t]);const x=l.useMemo(()=>({role:g,tabIndex:v,"aria-disabled":r,"aria-pressed":p&&g===Yt?!0:void 0,"aria-roledescription":D,"aria-describedby":d.draggable}),[r,g,v,p,D,d.draggable]);return{active:c,activatorEvent:a,activeNodeRect:u,attributes:x,isDragging:p,listeners:r?void 0:E,node:y,over:h,setNodeRef:m,setActivatorNodeRef:S,transform:b}}function gn(){return l.useContext(dn)}const jr="Droppable",Yr={timeout:25};function Kr(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=$e(jr),{active:s,dispatch:a,over:c,measureDroppableContainers:u}=l.useContext(Xe),d=l.useRef({disabled:n}),f=l.useRef(!1),h=l.useRef(null),g=l.useRef(null),{disabled:D,updateMeasurementsFor:v,timeout:p}={...Yr,...o},b=Pe(v??r),y=l.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),g.current=null},p)},[p]),m=it({callback:y,disabled:D||!s}),C=l.useCallback((x,O)=>{m&&(O&&(m.unobserve(O),f.current=!1),x&&m.observe(x))},[m]),[S,E]=Je(C),w=Pe(t);return l.useEffect(()=>{!m||!S.current||(m.disconnect(),f.current=!1,m.observe(S.current))},[S,m]),l.useEffect(()=>(a({type:T.RegisterDroppable,element:{id:r,key:i,disabled:n,node:S,rect:h,data:w}}),()=>a({type:T.UnregisterDroppable,key:i,id:r})),[r]),l.useEffect(()=>{n!==d.current.disabled&&(a({type:T.SetDroppableDisabled,id:r,key:i,disabled:n}),d.current.disabled=n)},[r,i,n,a]),{active:s,rect:h,isOver:(c==null?void 0:c.id)===r,node:S,over:c,setNodeRef:E}}function Wr(e){let{animation:t,children:n}=e;const[r,o]=l.useState(null),[i,s]=l.useState(null),a=_e(n);return!n&&!r&&a&&o(a),V(()=>{if(!i)return;const c=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(c==null||u==null){o(null);return}Promise.resolve(t(u,i)).then(()=>{o(null)})},[t,r,i]),I.createElement(I.Fragment,null,n,r?l.cloneElement(r,{ref:s}):null)}const Ur={x:0,y:0,scaleX:1,scaleY:1};function Hr(e){let{children:t}=e;return I.createElement(Xe.Provider,{value:un},I.createElement(st.Provider,{value:Ur},t))}const Vr={position:"fixed",touchAction:"none"},qr=e=>ot(e)?"transform 250ms ease":void 0,Gr=l.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:o,children:i,className:s,rect:a,style:c,transform:u,transition:d=qr}=e;if(!a)return null;const f=o?u:{...u,scaleX:1,scaleY:1},h={...Vr,width:a.width,height:a.height,top:a.top,left:a.left,transform:fe.Transform.toString(f),transformOrigin:o&&r?jn(r,a):void 0,transition:typeof d=="function"?d(r):d,...c};return I.createElement(n,{className:s,style:h,ref:t},i)}),Jr=e=>t=>{let{active:n,dragOverlay:r}=t;const o={},{styles:i,className:s}=e;if(i!=null&&i.active)for(const[a,c]of Object.entries(i.active))c!==void 0&&(o[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,c));if(i!=null&&i.dragOverlay)for(const[a,c]of Object.entries(i.dragOverlay))c!==void 0&&r.node.style.setProperty(a,c);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[c,u]of Object.entries(o))n.node.style.setProperty(c,u);s!=null&&s.active&&n.node.classList.remove(s.active)}},_r=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:fe.Transform.toString(t)},{transform:fe.Transform.toString(n)}]},Qr={duration:250,easing:"ease",keyframes:_r,sideEffects:Jr({styles:{active:{opacity:"0"}}})};function Zr(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return rt((i,s)=>{if(t===null)return;const a=n.get(i);if(!a)return;const c=a.node.current;if(!c)return;const u=cn(s);if(!u)return;const{transform:d}=z(s).getComputedStyle(s),f=Jt(d);if(!f)return;const h=typeof t=="function"?t:eo(t);return rn(c,o.draggable.measure),h({active:{id:i,data:a.data,node:c,rect:o.draggable.measure(c)},draggableNodes:n,dragOverlay:{node:s,rect:o.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:o,transform:f})})}function eo(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...Qr,...e};return i=>{let{active:s,dragOverlay:a,transform:c,...u}=i;if(!t)return;const d={x:a.rect.left-s.rect.left,y:a.rect.top-s.rect.top},f={scaleX:c.scaleX!==1?s.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?s.rect.height*c.scaleY/a.rect.height:1},h={x:c.x-d.x,y:c.y-d.y,...f},g=o({...u,active:s,dragOverlay:a,transform:{initial:c,final:h}}),[D]=g,v=g[g.length-1];if(JSON.stringify(D)===JSON.stringify(v))return;const p=r==null?void 0:r({active:s,dragOverlay:a,...u}),b=a.node.animate(g,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{b.onfinish=()=>{p==null||p(),y()}})}}let Kt=0;function to(e){return l.useMemo(()=>{if(e!=null)return Kt++,Kt},[e])}const wo=I.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:o,transition:i,modifiers:s,wrapperElement:a="div",className:c,zIndex:u=999}=e;const{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:g,draggableNodes:D,droppableContainers:v,dragOverlay:p,over:b,measuringConfiguration:y,scrollableAncestors:m,scrollableAncestorRects:C,windowRect:S}=gn(),E=l.useContext(st),w=to(f==null?void 0:f.id),x=fn(s,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:g,draggingNodeRect:p.rect,over:b,overlayNodeRect:p.rect,scrollableAncestors:m,scrollableAncestorRects:C,transform:E,windowRect:S}),O=Ct(h),N=Zr({config:r,draggableNodes:D,droppableContainers:v,measuringConfiguration:y}),M=O?p.setRef:void 0;return I.createElement(Hr,null,I.createElement(Wr,{animation:N},f&&w?I.createElement(Gr,{key:w,id:f.id,ref:M,as:a,activatorEvent:d,adjustScale:t,className:c,transition:i,rect:O,style:{zIndex:u,...o},transform:x},n):null))});function hn(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function no(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Ve(e){return e!==null&&e>=0}function ro(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function oo(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const vn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=hn(t,r,n),s=t[o],a=i[o];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},qe={scaleX:1,scaleY:1},xo=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:s}=e;const a=(t=i[n])!=null?t:r;if(!a)return null;if(o===n){const u=i[s];return u?{x:0,y:n<s?u.top+u.height-(a.top+a.height):u.top-a.top,...qe}:null}const c=io(i,o,n);return o>n&&o<=s?{x:0,y:-a.height-c,...qe}:o<n&&o>=s?{x:0,y:a.height+c,...qe}:{x:0,y:0,...qe}};function io(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const pn="Sortable",bn=I.createContext({activeIndex:-1,containerId:pn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:vn,disabled:{draggable:!1,droppable:!1}});function Do(e){let{children:t,id:n,items:r,strategy:o=vn,disabled:i=!1}=e;const{active:s,dragOverlay:a,droppableRects:c,over:u,measureDroppableContainers:d}=gn(),f=$e(pn,n),h=a.rect!==null,g=l.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),D=s!=null,v=s?g.indexOf(s.id):-1,p=u?g.indexOf(u.id):-1,b=l.useRef(g),y=!ro(g,b.current),m=p!==-1&&v===-1||y,C=oo(i);V(()=>{y&&D&&d(g)},[y,g,D,d]),l.useEffect(()=>{b.current=g},[g]);const S=l.useMemo(()=>({activeIndex:v,containerId:f,disabled:C,disableTransforms:m,items:g,overIndex:p,useDragOverlay:h,sortedRects:no(g,c),strategy:o}),[v,f,C.draggable,C.droppable,m,g,p,c,h,o]);return I.createElement(bn.Provider,{value:S},t)}const so=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return hn(n,r,o).indexOf(t)},ao=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:s,previousItems:a,previousContainerId:c,transition:u}=e;return!u||!r||a!==i&&o===s?!1:n?!0:s!==o&&t===c},lo={duration:200,easing:"ease"},mn="transform",co=fe.Transition.toString({property:mn,duration:0,easing:"linear"}),uo={roleDescription:"sortable"};function fo(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,s]=l.useState(null),a=l.useRef(n);return V(()=>{if(!t&&n!==a.current&&r.current){const c=o.current;if(c){const u=De(r.current,{ignoreTransform:!0}),d={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(d.x||d.y)&&s(d)}}n!==a.current&&(a.current=n)},[t,n,r,o]),l.useEffect(()=>{i&&s(null)},[i]),i}function Co(e){let{animateLayoutChanges:t=ao,attributes:n,disabled:r,data:o,getNewIndex:i=so,id:s,strategy:a,resizeObserverConfig:c,transition:u=lo}=e;const{items:d,containerId:f,activeIndex:h,disabled:g,disableTransforms:D,sortedRects:v,overIndex:p,useDragOverlay:b,strategy:y}=l.useContext(bn),m=go(r,g),C=d.indexOf(s),S=l.useMemo(()=>({sortable:{containerId:f,index:C,items:d},...o}),[f,o,C,d]),E=l.useMemo(()=>d.slice(d.indexOf(s)),[d,s]),{rect:w,node:x,isOver:O,setNodeRef:N}=Kr({id:s,data:S,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...c}}),{active:M,activatorEvent:U,activeNodeRect:H,attributes:G,setNodeRef:Ce,listeners:je,isDragging:F,over:Ye,setActivatorNodeRef:Z,transform:Se}=Xr({id:s,data:S,attributes:{...uo,...n},disabled:m.draggable}),Ke=An(N,Ce),B=!!M,ee=B&&!D&&Ve(h)&&Ve(p),de=!b&&F,Re=de&&ee?Se:null,We=ee?Re??(a??y)({rects:v,activeNodeRect:H,activeIndex:h,overIndex:p,index:C}):null,oe=Ve(h)&&Ve(p)?i({id:s,items:d,activeIndex:h,overIndex:p}):C,te=M==null?void 0:M.id,A=l.useRef({activeId:te,items:d,newIndex:oe,containerId:f}),Ee=d!==A.current.items,J=t({active:M,containerId:f,isDragging:F,isSorting:B,id:s,index:C,items:d,newIndex:A.current.newIndex,previousItems:A.current.items,previousContainerId:A.current.containerId,transition:u,wasDragging:A.current.activeId!=null}),ge=fo({disabled:!J,index:C,node:x,rect:w});return l.useEffect(()=>{B&&A.current.newIndex!==oe&&(A.current.newIndex=oe),f!==A.current.containerId&&(A.current.containerId=f),d!==A.current.items&&(A.current.items=d)},[B,oe,f,d]),l.useEffect(()=>{if(te===A.current.activeId)return;if(te!=null&&A.current.activeId==null){A.current.activeId=te;return}const he=setTimeout(()=>{A.current.activeId=te},50);return()=>clearTimeout(he)},[te]),{active:M,activeIndex:h,attributes:G,data:S,rect:w,index:C,newIndex:oe,items:d,isOver:O,isSorting:B,isDragging:F,listeners:je,node:x,overIndex:p,over:Ye,setNodeRef:Ke,setActivatorNodeRef:Z,setDroppableNodeRef:N,setDraggableNodeRef:Ce,transform:ge??We,transition:ne()};function ne(){if(ge||Ee&&A.current.newIndex===C)return co;if(!(de&&!ot(U)||!u)&&(B||J))return fe.Transition.toString({...u,property:mn})}}function go(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}R.Down,R.Right,R.Up,R.Left;export{fe as C,yo as D,an as P,Do as S,vo as a,wo as b,bo as c,Kr as d,Co as e,mo as p,po as u,xo as v};
6
- //# sourceMappingURL=board-8L3uX7_O.js.map