pipe-kan 0.18.0 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pipe-kan.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/server.ts
4
- import { readFileSync as readFileSync3, writeSync } from "node:fs";
4
+ import { readFileSync as readFileSync4, writeSync } from "node:fs";
5
5
  import { createServer } from "node:http";
6
6
  import { tmpdir as tmpdir2 } from "node:os";
7
- import { join as join7 } from "node:path";
7
+ import { join as join8 } from "node:path";
8
8
 
9
9
  // src/board.ts
10
10
  function formatDueDate(value) {
@@ -905,20 +905,23 @@ function handleAppApi(req, res, app) {
905
905
  }
906
906
 
907
907
  // src/server/agent/config.ts
908
- import { existsSync as existsSync2, readFileSync } from "node:fs";
908
+ import { existsSync as existsSync2, mkdirSync, readFileSync } from "node:fs";
909
909
  import { homedir } from "node:os";
910
- import { join as join2 } from "node:path";
910
+ import { dirname, join as join2 } from "node:path";
911
911
  var DEFAULT_CONFIG_PATH = join2(homedir(), ".config", "pipe-kan", "agent.json");
912
912
  var DEFAULT_CONFIG = {
913
913
  defaultAgent: "cursor",
914
+ defaultSkill: null,
914
915
  agents: {
915
916
  cursor: {
916
917
  command: "cursor-agent",
917
- args: ["acp"]
918
+ args: ["acp"],
919
+ model: "claude-sonnet-4"
918
920
  },
919
921
  devin: {
920
922
  command: "devin",
921
- args: ["acp"]
923
+ args: ["acp"],
924
+ model: "devin"
922
925
  }
923
926
  }
924
927
  };
@@ -935,6 +938,7 @@ function loadAgentConfig(path = DEFAULT_CONFIG_PATH) {
935
938
  function mergeConfig(raw) {
936
939
  return {
937
940
  defaultAgent: raw.defaultAgent ?? DEFAULT_CONFIG.defaultAgent,
941
+ defaultSkill: raw.defaultSkill ?? DEFAULT_CONFIG.defaultSkill,
938
942
  agents: { ...DEFAULT_CONFIG.agents, ...raw.agents }
939
943
  };
940
944
  }
@@ -10597,6 +10601,8 @@ class AcpSession {
10597
10601
  textBuffer = "";
10598
10602
  detectToolCall = null;
10599
10603
  toolCalls = new Map;
10604
+ shouldAutoApproveTool = null;
10605
+ executeTool = null;
10600
10606
  constructor(config) {
10601
10607
  this.config = config;
10602
10608
  this.id = crypto.randomUUID();
@@ -10611,16 +10617,23 @@ class AcpSession {
10611
10617
  setToolParser(parser) {
10612
10618
  this.detectToolCall = parser;
10613
10619
  }
10620
+ setToolExecutor(shouldAutoApprove, execute) {
10621
+ this.shouldAutoApproveTool = shouldAutoApprove;
10622
+ this.executeTool = execute;
10623
+ }
10614
10624
  pendingToolCalls() {
10615
10625
  return this.toolCalls;
10616
10626
  }
10617
- resolveToolCall(requestId, resultText) {
10627
+ resolveToolCall(requestId, resultText, rawResult) {
10618
10628
  const call = this.toolCalls.get(requestId);
10619
10629
  if (!call)
10620
10630
  return;
10621
10631
  this.toolCalls.delete(requestId);
10632
+ this.push({ type: "tool_result", requestId, name: call.name, result: rawResult ?? resultText });
10622
10633
  this.prompt(`Tool result for ${call.name}(${JSON.stringify(call.args)}):
10623
- ${resultText}`);
10634
+ ${resultText}`).catch(() => {
10635
+ return;
10636
+ });
10624
10637
  }
10625
10638
  approve(requestId, decision) {
10626
10639
  const entry = this.pendingPermissionResolvers.get(requestId);
@@ -10718,7 +10731,11 @@ ${resultText}`);
10718
10731
  const tool = this.detectToolCall?.(this.textBuffer);
10719
10732
  if (tool) {
10720
10733
  this.toolCalls.set(tool.requestId, tool);
10721
- this.push({ type: "tool_call", ...tool });
10734
+ if (this.shouldAutoApproveTool?.(tool.name)) {
10735
+ this.executeTool?.(tool).then(({ text, result }) => this.resolveToolCall(tool.requestId, text, result));
10736
+ } else {
10737
+ this.push({ type: "tool_call", ...tool });
10738
+ }
10722
10739
  return;
10723
10740
  }
10724
10741
  this.push({ type: "agent_message_chunk", text: update.content.text });
@@ -10862,6 +10879,8 @@ function parseFrontMatter(text) {
10862
10879
  }
10863
10880
 
10864
10881
  // src/server/agent/tools.ts
10882
+ import { readFileSync as readFileSync3 } from "node:fs";
10883
+ import { join as join5 } from "node:path";
10865
10884
  var TOOLS = [
10866
10885
  {
10867
10886
  name: "board_state",
@@ -10875,6 +10894,18 @@ var TOOLS = [
10875
10894
  parameters: { key: { type: "string", description: "Issue key, e.g. DEMO-123" } },
10876
10895
  mutates: false
10877
10896
  },
10897
+ {
10898
+ name: "run_skill",
10899
+ description: "Load a skill by id and return its instructions as context.",
10900
+ parameters: { skillId: { type: "string", description: "Skill id, e.g. triage" } },
10901
+ mutates: false
10902
+ },
10903
+ {
10904
+ name: "read_repo_file",
10905
+ description: "Read a file under the repo root as plain text.",
10906
+ parameters: { path: { type: "string", description: "Relative repo path" } },
10907
+ mutates: false
10908
+ },
10878
10909
  {
10879
10910
  name: "move_card",
10880
10911
  description: "Move a card to a new status. Requires user approval because it changes Jira via jira-cli.",
@@ -10903,6 +10934,7 @@ var TOOLS = [
10903
10934
  mutates: true
10904
10935
  }
10905
10936
  ];
10937
+ var skills = createSkillRegistry();
10906
10938
  var EXECUTORS = {
10907
10939
  board_state(_, app) {
10908
10940
  const board = app.board();
@@ -10921,6 +10953,32 @@ var EXECUTORS = {
10921
10953
  return { ok: false, error: result.error };
10922
10954
  return { ok: true, value: { url: result.url, fields: result.fields } };
10923
10955
  },
10956
+ run_skill(args) {
10957
+ const skillId = String(args.skillId ?? "");
10958
+ if (!skillId)
10959
+ return { ok: false, error: "Missing skillId" };
10960
+ const skill = skills.load(skillId);
10961
+ if (!skill)
10962
+ return { ok: false, error: `Skill not found: ${skillId}` };
10963
+ const block = skillContextBlock(skill);
10964
+ if (block.type !== "resource")
10965
+ return { ok: false, error: "Skill produced unexpected block" };
10966
+ return { ok: true, value: block.resource };
10967
+ },
10968
+ read_repo_file(args) {
10969
+ const relPath = String(args.path ?? "");
10970
+ if (!relPath)
10971
+ return { ok: false, error: "Missing path" };
10972
+ if (relPath.includes(".."))
10973
+ return { ok: false, error: "Path traversal not allowed" };
10974
+ const repoRoot = process.cwd();
10975
+ try {
10976
+ const text = readFileSync3(join5(repoRoot, relPath), "utf8");
10977
+ return { ok: true, value: { path: relPath, text } };
10978
+ } catch (err) {
10979
+ return { ok: false, error: String(err) };
10980
+ }
10981
+ },
10924
10982
  async move_card(args, app) {
10925
10983
  const key = String(args.key ?? "");
10926
10984
  const status = String(args.status ?? "");
@@ -10940,13 +10998,13 @@ var EXECUTORS = {
10940
10998
  const name = String(args.name ?? "");
10941
10999
  if (!name)
10942
11000
  return { ok: false, error: "Missing preset name" };
10943
- return { ok: true, value: `Preset '${name}' would be applied by the UI when tool execution is wired there.` };
11001
+ return { ok: true, value: { __ui_action: "apply_preset", preset: name } };
10944
11002
  },
10945
11003
  set_filter(args) {
10946
11004
  const filter = args.filter;
10947
11005
  if (!filter || typeof filter !== "object")
10948
11006
  return { ok: false, error: "Missing filter object" };
10949
- return { ok: true, value: `Filter set to ${JSON.stringify(filter)}. UI should apply this filter.` };
11007
+ return { ok: true, value: { __ui_action: "set_filter", filter } };
10950
11008
  }
10951
11009
  };
10952
11010
  var SYSTEM_TEXT = `You can call tools by emitting a single JSON code block matching this schema:
@@ -10986,6 +11044,9 @@ function createToolRegistry() {
10986
11044
  return;
10987
11045
  }
10988
11046
  },
11047
+ isMutating(name) {
11048
+ return TOOLS.find((t) => t.name === name)?.mutates ?? true;
11049
+ },
10989
11050
  async execute(name, args, app) {
10990
11051
  const executor = EXECUTORS[name];
10991
11052
  if (!executor)
@@ -11001,7 +11062,7 @@ function createToolRegistry() {
11001
11062
 
11002
11063
  // src/server/agent/api.ts
11003
11064
  var sessions = new Map;
11004
- var skills = createSkillRegistry();
11065
+ var skills2 = createSkillRegistry();
11005
11066
  var tools = createToolRegistry();
11006
11067
  function json2(res, status, body) {
11007
11068
  res.statusCode = status;
@@ -11026,15 +11087,18 @@ function handleAgentApi(req, res, app) {
11026
11087
  const cfg = loadAgentConfig();
11027
11088
  json2(res, 200, {
11028
11089
  defaultAgent: cfg.defaultAgent,
11090
+ defaultSkill: cfg.defaultSkill,
11029
11091
  agents: Object.entries(cfg.agents).map(([id, c]) => ({
11030
11092
  id,
11031
- command: [c.command, ...c.args ?? []].join(" ")
11093
+ command: [c.command, ...c.args ?? []].join(" "),
11094
+ model: c.model,
11095
+ options: c.options
11032
11096
  }))
11033
11097
  });
11034
11098
  return true;
11035
11099
  }
11036
11100
  if (url.pathname === "/api/agent/skills" && method === "GET") {
11037
- json2(res, 200, skills.list().map((s) => ({ id: s.id, name: s.name, description: s.description })));
11101
+ json2(res, 200, skills2.list().map((s) => ({ id: s.id, name: s.name, description: s.description })));
11038
11102
  return true;
11039
11103
  }
11040
11104
  if (url.pathname === "/api/agent/session" && method === "POST") {
@@ -11050,6 +11114,13 @@ function handleAgentApi(req, res, app) {
11050
11114
  const call = tools.parse(text);
11051
11115
  return call ? { requestId: call.requestId, name: call.name, args: call.args } : undefined;
11052
11116
  });
11117
+ session.setToolExecutor((name) => !tools.isMutating(name), async (call) => {
11118
+ const result = await tools.execute(call.name, call.args, app);
11119
+ return {
11120
+ text: result.ok ? `Result: ${JSON.stringify(result.value)}` : `Error: ${result.error}`,
11121
+ result: result.ok ? result.value : undefined
11122
+ };
11123
+ });
11053
11124
  sessions.set(session.id, session);
11054
11125
  json2(res, 200, { sessionId: session.id });
11055
11126
  }).catch((err) => json2(res, 500, { error: String(err) }));
@@ -11065,7 +11136,7 @@ function handleAgentApi(req, res, app) {
11065
11136
  }
11066
11137
  const context = [tools.systemBlock(), ...body.context ?? []];
11067
11138
  if (body.skillId) {
11068
- const skill = skills.load(body.skillId);
11139
+ const skill = skills2.load(body.skillId);
11069
11140
  if (skill)
11070
11141
  context.push(skillContextBlock(skill));
11071
11142
  }
@@ -11105,7 +11176,7 @@ function handleAgentApi(req, res, app) {
11105
11176
  } else {
11106
11177
  const result = await tools.execute(toolCall.name, toolCall.args, app);
11107
11178
  const resultText = result.ok ? `Result: ${JSON.stringify(result.value)}` : `Error: ${result.error}`;
11108
- session.resolveToolCall(requestId, resultText);
11179
+ session.resolveToolCall(requestId, resultText, result.ok ? result.value : undefined);
11109
11180
  }
11110
11181
  json2(res, 200, { ok: true });
11111
11182
  return;
@@ -11264,11 +11335,11 @@ function handleRequest(req, res, ctx) {
11264
11335
  }
11265
11336
 
11266
11337
  // src/jira-config.ts
11267
- import { mkdirSync, writeFileSync } from "node:fs";
11268
- import { join as join5 } from "node:path";
11338
+ import { mkdirSync as mkdirSync2, writeFileSync } from "node:fs";
11339
+ import { join as join6 } from "node:path";
11269
11340
  function writeJiraConfig(dir, server) {
11270
- mkdirSync(dir, { recursive: true });
11271
- const path = join5(dir, "jira.config.yml");
11341
+ mkdirSync2(dir, { recursive: true });
11342
+ const path = join6(dir, "jira.config.yml");
11272
11343
  writeFileSync(path, [
11273
11344
  "installation: Cloud",
11274
11345
  `server: ${server}`,
@@ -11324,7 +11395,7 @@ function stdinStat() {
11324
11395
 
11325
11396
  // src/ui.ts
11326
11397
  import { createReadStream, existsSync as existsSync4, statSync } from "node:fs";
11327
- import { dirname, extname, join as join6, resolve as resolve2, sep } from "node:path";
11398
+ import { dirname as dirname2, extname, join as join7, resolve as resolve2, sep } from "node:path";
11328
11399
  import { fileURLToPath } from "node:url";
11329
11400
  var types = {
11330
11401
  ".css": "text/css; charset=utf-8",
@@ -11338,10 +11409,10 @@ var types = {
11338
11409
  ".woff2": "font/woff2"
11339
11410
  };
11340
11411
  function packageRoot(from = import.meta.url) {
11341
- return resolve2(dirname(fileURLToPath(from)), "..");
11412
+ return resolve2(dirname2(fileURLToPath(from)), "..");
11342
11413
  }
11343
11414
  function uiDir(root) {
11344
- return join6(root, "dist", "ui");
11415
+ return join7(root, "dist", "ui");
11345
11416
  }
11346
11417
  function inside(root, file) {
11347
11418
  const base = resolve2(root);
@@ -11350,7 +11421,7 @@ function inside(root, file) {
11350
11421
  }
11351
11422
  function sendUi(root, req, res) {
11352
11423
  const ui = uiDir(root);
11353
- const index = join6(ui, "index.html");
11424
+ const index = join7(ui, "index.html");
11354
11425
  if (!existsSync4(index))
11355
11426
  return false;
11356
11427
  const path = new URL(req.url ?? "/", "http://127.0.0.1").pathname;
@@ -11371,7 +11442,7 @@ function announce(line) {
11371
11442
  }
11372
11443
  async function runServer(opts) {
11373
11444
  const piped = await readPipe();
11374
- const raw = piped ?? JSON.parse(readFileSync3(join7(opts.root, "fixtures/issues.json"), "utf8"));
11445
+ const raw = piped ?? JSON.parse(readFileSync4(join8(opts.root, "fixtures/issues.json"), "utf8"));
11375
11446
  const { app, store, kind } = await createBoardApp({
11376
11447
  raw,
11377
11448
  piped: Boolean(piped)
@@ -11391,7 +11462,7 @@ async function runServer(opts) {
11391
11462
  const { host, port } = resolveListen();
11392
11463
  await bindListen(server, host, port);
11393
11464
  const origin = `http://127.0.0.1:${port}`;
11394
- const fakeConfig = writeJiraConfig(join7(tmpdir2(), "pipe-kan"), origin);
11465
+ const fakeConfig = writeJiraConfig(join8(tmpdir2(), "pipe-kan"), origin);
11395
11466
  announce(`pipe-kan http://${host}:${port}`);
11396
11467
  announce(`cli ${kind === "jira" ? resolveJiraBin() : "store"}`);
11397
11468
  announce(`Fake Jira ${origin}/rest/api/2/search`);
@@ -48,8 +48,8 @@ Error generating stack: `+e.message+`
48
48
  `},Yc=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Xc=function(){C.useEffect(function(){return document.body.setAttribute(qc,(Yc()+1).toString()),function(){var e=Yc()-1;e<=0?document.body.removeAttribute(qc):document.body.setAttribute(qc,e.toString())}},[])},Zc=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Xc();var a=C.useMemo(function(){return Gc(i)},[i]);return C.createElement(Kc,{styles:Jc(a,!t,i,n?``:`!important`)})},Qc=!1;if(typeof window<`u`)try{var $c=Object.defineProperty({},"passive",{get:function(){return Qc=!0,!0}});window.addEventListener(`test`,$c,$c),window.removeEventListener(`test`,$c,$c)}catch{Qc=!1}var el=Qc?{passive:!1}:!1,tl=function(e){return e.tagName===`TEXTAREA`},nl=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!tl(e)&&n[t]===`visible`)},rl=function(e){return nl(e,`overflowY`)},il=function(e){return nl(e,`overflowX`)},al=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),cl(e,r)){var i=ll(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ol=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},sl=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},cl=function(e,t){return e===`v`?rl(t):il(t)},ll=function(e,t){return e===`v`?ol(t):sl(t)},ul=function(e,t){return e===`h`&&t===`rtl`?-1:1},dl=function(e,t,n,r,i){var a=ul(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=ll(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&cl(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},fl=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},pl=function(e){return[e.deltaX,e.deltaY]},ml=function(e){return e&&`current`in e?e.current:e},hl=function(e,t){return e[0]===t[0]&&e[1]===t[1]},gl=function(e){return`
49
49
  .block-interactivity-${e} {pointer-events: none;}
50
50
  .allow-interactivity-${e} {pointer-events: all;}
51
- `},_l=0,vl=[];function yl(e){var t=C.useRef([]),n=C.useRef([0,0]),r=C.useRef(),i=C.useState(_l++)[0],a=C.useState(Vc)[0],o=C.useRef(e);C.useEffect(function(){o.current=e},[e]),C.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=_c([e.lockRef.current],(e.shards||[]).map(ml),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=C.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=fl(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=al(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=al(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return dl(h,t,e,h===`h`?s:c,!0)},[]),c=C.useCallback(function(e){var n=e;if(vl.length&&vl[vl.length-1]===a){var r=`deltaY`in n?pl(n):fl(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&hl(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(ml).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=C.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:bl(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=C.useCallback(function(e){n.current=fl(e),r.current=void 0},[]),d=C.useCallback(function(t){l(t.type,pl(t),t.target,s(t,e.lockRef.current))},[]),f=C.useCallback(function(t){l(t.type,fl(t),t.target,s(t,e.lockRef.current))},[]);C.useEffect(function(){return vl.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,el),document.addEventListener(`touchmove`,c,el),document.addEventListener(`touchstart`,u,el),function(){vl=vl.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,el),document.removeEventListener(`touchmove`,c,el),document.removeEventListener(`touchstart`,u,el)}},[]);var p=e.removeScrollBar,m=e.inert;return C.createElement(C.Fragment,null,m?C.createElement(a,{styles:gl(i)}):null,p?C.createElement(Zc,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function bl(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var xl=jc(Mc,yl),Sl=C.forwardRef(function(e,t){return C.createElement(Pc,hc({},e,{ref:t,sideCar:xl}))});Sl.classNames=Pc.classNames;var Cl=Object.defineProperty,q=(e,t)=>Cl(e,`name`,{value:t,configurable:!0}),wl=[`Enter`,` `],Tl=[`ArrowDown`,`PageUp`,`Home`],El=[`ArrowUp`,`PageDown`,`End`],Dl=[...Tl,...El],Ol={ltr:[...wl,`ArrowRight`],rtl:[...wl,`ArrowLeft`]},kl={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Al=`Menu`,[jl,Ml,Nl]=Mr(Al),[Pl,Fl]=lr(Al,[Nl,ns,Ks]),Il=ns(),Ll=Ks(),[Rl,J]=Pl(Al),[Y,X]=Pl(Al),zl=q(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Il(t),[c,l]=C.useState(null),u=C.useRef(!1),d=Yr(a),f=Kr(i);return C.useEffect(()=>{let e=q(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=q(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),C.useEffect(()=>{if(!n)return;let e=q(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,U.jsx)(hs,{...s,children:(0,U.jsx)(Rl,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,U.jsx)(Y,{scope:t,onClose:C.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Bl=C.forwardRef(q(function(e,t){let{__scopeMenu:n,...r}=e,i=Il(n);return(0,U.jsx)(gs,{...i,...r,ref:t})},`MenuAnchor`)),Vl=`MenuPortal`,[Hl,Ul]=Pl(Vl,{forceMount:void 0}),Wl=q(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=J(Vl,t);return(0,U.jsx)(Hl,{scope:t,forceMount:n,children:(0,U.jsx)(Cs,{present:n||a.open,children:(0,U.jsx)(ys,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Gl=`MenuContent`,[Kl,ql]=Pl(Gl),Jl=C.forwardRef(q(function(e,t){let n=Ul(Gl,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=J(Gl,e.__scopeMenu),o=X(Gl,e.__scopeMenu);return(0,U.jsx)(jl.Provider,{scope:e.__scopeMenu,children:(0,U.jsx)(Cs,{present:r||a.open,children:(0,U.jsx)(jl.Slot,{scope:e.__scopeMenu,children:o.modal?(0,U.jsx)(Yl,{...i,ref:t}):(0,U.jsx)(Xl,{...i,ref:t})})})})},`MenuContent`)),Yl=C.forwardRef(q(function(e,t){let n=J(Gl,e.__scopeMenu),r=C.useRef(null),i=nt(t,r);return C.useEffect(()=>{let e=r.current;if(e)return mc(e)},[]),(0,U.jsx)(Ql,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:W(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Xl=C.forwardRef(q(function(e,t){let n=J(Gl,e.__scopeMenu);return(0,U.jsx)(Ql,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Zl=at(`MenuContent.ScrollLock`),Ql=C.forwardRef(q(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=J(Gl,n),_=X(Gl,n),v=Il(n),y=Ll(n),b=Ml(n),[x,S]=C.useState(null),w=C.useRef(null),T=nt(t,w,g.onContentChange),E=C.useRef(0),D=C.useRef(``),O=C.useRef(0),ee=C.useRef(null),k=C.useRef(`right`),A=C.useRef(0),te=m?Sl:C.Fragment,j=m?{as:Zl,allowPinchZoom:!0}:void 0,M=q(e=>{let t=D.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=ku(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;q((function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);C.useEffect(()=>()=>window.clearTimeout(E.current),[]),hi();let ne=C.useCallback(e=>k.current===ee.current?.side&&ju(e,ee.current?.area),[]);return(0,U.jsx)(Kl,{scope:n,searchRef:D,onItemEnter:C.useCallback(e=>{ne(e)&&e.preventDefault()},[ne]),onItemLeave:C.useCallback(e=>{ne(e)||(w.current?.focus(),S(null))},[ne]),onTriggerLeave:C.useCallback(e=>{ne(e)&&e.preventDefault()},[ne]),pointerGraceTimerRef:O,onPointerGraceIntentChange:C.useCallback(e=>{ee.current=e},[]),children:(0,U.jsx)(te,{...j,children:(0,U.jsx)(Si,{asChild:!0,trapped:i,onMountAutoFocus:W(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,U.jsx)(ri,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,U.jsx)(ic,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:W(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,U.jsx)(_s,{role:`menu`,"aria-orientation":`vertical`,"data-state":wu(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:W(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&M(e.key));let i=w.current;if(e.target!==i||!Dl.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);El.includes(e.key)&&a.reverse(),Du(a)}),onBlur:W(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:W(e.onPointerMove,Mu(e=>{let t=e.target,n=A.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>A.current?`right`:`left`;k.current=t,A.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),$l=C.forwardRef(q(function(e,t){let{__scopeMenu:n,...r}=e;return(0,U.jsx)(Or.div,{role:`group`,...r,ref:t})},`MenuGroup`)),eu=C.forwardRef(q(function(e,t){let{__scopeMenu:n,...r}=e;return(0,U.jsx)(Or.div,{...r,ref:t})},`MenuLabel`)),tu=`MenuItem`,nu=`menu.itemSelect`,ru=C.forwardRef(q(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=C.useRef(null),o=X(tu,e.__scopeMenu),s=ql(tu,e.__scopeMenu),c=nt(t,a),l=C.useRef(!1),u=q(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(nu,{bubbles:!0,cancelable:!0});e.addEventListener(nu,e=>r?.(e),{once:!0}),kr(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,U.jsx)(iu,{...i,ref:c,disabled:n,onClick:W(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:W(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:W(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&wl.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),iu=C.forwardRef(q(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=ql(tu,n),s=Ll(n),c=C.useRef(null),l=nt(t,c),[u,d]=C.useState(!1),[f,p]=C.useState(``);return C.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,U.jsx)(jl.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,U.jsx)(ac,{asChild:!0,...s,focusable:!r,children:(0,U.jsx)(Or.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:W(e.onPointerMove,Mu(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:W(e.onPointerLeave,Mu(e=>o.onItemLeave(e))),onFocus:W(e.onFocus,()=>d(!0)),onBlur:W(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),au=C.forwardRef(q(function(e,t){let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,U.jsx)(fu,{scope:e.__scopeMenu,checked:n,children:(0,U.jsx)(ru,{role:`menuitemcheckbox`,"aria-checked":Tu(n)?`mixed`:n,...i,ref:t,"data-state":Eu(n),onSelect:W(i.onSelect,()=>r?.(Tu(n)?!0:!n),{checkForDefaultPrevented:!1})})})},`MenuCheckboxItem`)),[ou,su]=Pl(`MenuRadioGroup`,{value:void 0,onValueChange:q(()=>{},`onValueChange`)}),cu=C.forwardRef(q(function(e,t){let{value:n,onValueChange:r,...i}=e,a=Yr(r);return(0,U.jsx)(ou,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,U.jsx)($l,{...i,ref:t})})},`MenuRadioGroup`)),lu=`MenuRadioItem`,uu=C.forwardRef(q(function(e,t){let{value:n,...r}=e,i=su(lu,e.__scopeMenu),a=n===i.value;return(0,U.jsx)(fu,{scope:e.__scopeMenu,checked:a,children:(0,U.jsx)(ru,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Eu(a),onSelect:W(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})},`MenuRadioItem`)),du=`MenuItemIndicator`,[fu,pu]=Pl(du,{checked:!1}),mu=C.forwardRef(q(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=pu(du,n);return(0,U.jsx)(Cs,{present:r||Tu(a.checked)||a.checked===!0,children:(0,U.jsx)(Or.span,{...i,ref:t,"data-state":Eu(a.checked)})})},`MenuItemIndicator`)),hu=C.forwardRef(q(function(e,t){let{__scopeMenu:n,...r}=e;return(0,U.jsx)(Or.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),gu=`MenuSub`,[_u,vu]=Pl(gu),yu=q(e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=J(gu,t),o=Il(t),[s,c]=C.useState(null),[l,u]=C.useState(null),d=Yr(i);return C.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,U.jsx)(hs,{...o,children:(0,U.jsx)(Rl,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,U.jsx)(_u,{scope:t,contentId:Li(),triggerId:Li(),trigger:s,onTriggerChange:c,children:n})})})},`MenuSub`),bu=`MenuSubTrigger`,xu=C.forwardRef(q(function(e,t){let n=J(bu,e.__scopeMenu),r=X(bu,e.__scopeMenu),i=vu(bu,e.__scopeMenu),a=ql(bu,e.__scopeMenu),o=C.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=C.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);C.useEffect(()=>u,[u]),C.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]);let d=nt(t,i.onTriggerChange);return(0,U.jsx)(Bl,{asChild:!0,...l,children:(0,U.jsx)(iu,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":wu(n.open),...e,ref:d,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:W(e.onPointerMove,Mu(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:W(e.onPointerLeave,Mu(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:W(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||(a.searchRef.current===``||t.key!==` `)&&Ol[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})},`MenuSubTrigger`)),Su=`MenuSubContent`,Cu=C.forwardRef(q(function(e,t){let n=Ul(Gl,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=J(Gl,e.__scopeMenu),s=X(Gl,e.__scopeMenu),c=vu(Su,e.__scopeMenu),l=C.useRef(null),u=nt(t,l);return(0,U.jsx)(jl.Provider,{scope:e.__scopeMenu,children:(0,U.jsx)(Cs,{present:r||o.open,children:(0,U.jsx)(jl.Slot,{scope:e.__scopeMenu,children:(0,U.jsx)(Ql,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:W(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:W(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:W(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=kl[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})},`MenuSubContent`));function wu(e){return e?`open`:`closed`}q(wu,`getOpenState`);function Tu(e){return e===`indeterminate`}q(Tu,`isIndeterminate`);function Eu(e){return Tu(e)?`indeterminate`:e?`checked`:`unchecked`}q(Eu,`getCheckedState`);function Du(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}q(Du,`focusFirst`);function Ou(e,t){return e.map((n,r)=>e[(t+r)%e.length])}q(Ou,`wrapArray`);function ku(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Ou(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}q(ku,`getNextMatch`);function Au(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}q(Au,`isPointInPolygon`);function ju(e,t){return t?Au({x:e.clientX,y:e.clientY},t):!1}q(ju,`isPointerInGraceArea`);function Mu(e){return t=>t.pointerType===`mouse`?e(t):void 0}q(Mu,`whenMouse`);var Nu=zl,Pu=Bl,Fu=Wl,Iu=Jl,Lu=eu,Ru=ru,zu=au,Bu=cu,Vu=uu,Hu=mu,Uu=hu,Wu=yu,Gu=xu,Ku=Cu,qu=Object.defineProperty,Ju=(e,t)=>qu(e,`name`,{value:t,configurable:!0}),Yu=`DropdownMenu`,[Xu,Zu]=lr(Yu,[Fl]),Qu=Fl(),[$u,ed]=Xu(Yu),td=Ju(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Qu(t),l=C.useRef(null),[u,d]=br({prop:i,defaultProp:a??!1,onChange:o,caller:Yu});return(0,U.jsx)($u,{scope:t,triggerId:Li(),triggerRef:l,contentId:Li(),open:u,onOpenChange:d,onOpenToggle:C.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,U.jsx)(Nu,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),nd=`DropdownMenuTrigger`,rd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=ed(nd,n),o=Qu(n),s=nt(t,a.triggerRef);return(0,U.jsx)(Pu,{asChild:!0,...o,children:(0,U.jsx)(Or.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:W(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:W(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),id=Ju(e=>{let{__scopeDropdownMenu:t,...n}=e,r=Qu(t);return(0,U.jsx)(Fu,{...r,...n})},`DropdownMenuPortal`),ad=`DropdownMenuContent`,od=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ed(ad,n),a=Qu(n),o=C.useRef(!1);return(0,U.jsx)(Iu,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:W(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:W(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),sd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Lu,{...i,...r,ref:t})},`DropdownMenuLabel`)),cd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Ru,{...i,...r,ref:t})},`DropdownMenuItem`)),ld=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(zu,{...i,...r,ref:t})},`DropdownMenuCheckboxItem`)),ud=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Bu,{...i,...r,ref:t})},`DropdownMenuRadioGroup`)),dd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Vu,{...i,...r,ref:t})},`DropdownMenuRadioItem`)),fd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Hu,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),pd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Uu,{...i,...r,ref:t})},`DropdownMenuSeparator`)),md=Ju(e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Qu(t),[s,c]=br({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,U.jsx)(Wu,{...o,open:s,onOpenChange:c,children:n})},`DropdownMenuSub`),hd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Gu,{...i,...r,ref:t})},`DropdownMenuSubTrigger`)),gd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Ku,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuSubContent`)),_d=td,vd=rd,yd=id,bd=od,Z=sd,xd=cd,Sd=ld,Cd=ud,wd=dd,Td=fd,Ed=pd,Dd=md,Od=hd,kd=gd;function Ad(e){return(0,U.jsx)(_d,{"data-slot":`dropdown-menu`,...e})}function jd(e){return(0,U.jsx)(vd,{"data-slot":`dropdown-menu-trigger`,...e})}function Md({className:e,sideOffset:t=4,...n}){return(0,U.jsx)(yd,{children:(0,U.jsx)(bd,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:H(`bg-popover text-popover-foreground z-50 min-w-40 overflow-hidden rounded-md border p-1 shadow-md`,e),...n})})}function Nd({className:e,...t}){return(0,U.jsx)(Z,{"data-slot":`dropdown-menu-label`,className:H(`text-muted-foreground px-2 py-1.5 text-[11px] font-medium`,e),...t})}function Q({className:e,...t}){return(0,U.jsx)(xd,{"data-slot":`dropdown-menu-item`,className:H(`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-[13px] outline-none select-none data-disabled:pointer-events-none data-disabled:opacity-50`,e),...t})}function Pd({className:e,children:t,...n}){return(0,U.jsxs)(Sd,{"data-slot":`dropdown-menu-checkbox-item`,className:H(`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-[13px] outline-none select-none`,e),...n,children:[(0,U.jsx)(`span`,{className:`absolute left-2 flex size-3.5 items-center justify-center`,children:(0,U.jsx)(Td,{children:(0,U.jsx)(k,{className:`size-3.5`})})}),t]})}function Fd(e){return(0,U.jsx)(Cd,{"data-slot":`dropdown-menu-radio-group`,...e})}function Id({className:e,children:t,...n}){return(0,U.jsxs)(wd,{"data-slot":`dropdown-menu-radio-item`,className:H(`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-[13px] outline-none select-none`,e),...n,children:[(0,U.jsx)(`span`,{className:`absolute left-2 flex size-3.5 items-center justify-center`,children:(0,U.jsx)(Td,{children:(0,U.jsx)(k,{className:`size-3.5`})})}),t]})}function Ld({className:e,...t}){return(0,U.jsx)(Ed,{"data-slot":`dropdown-menu-separator`,className:H(`bg-border -mx-1 my-1 h-px`,e),...t})}function Rd(e){return(0,U.jsx)(Dd,{"data-slot":`dropdown-menu-sub`,...e})}function zd({className:e,children:t,...n}){return(0,U.jsxs)(Od,{"data-slot":`dropdown-menu-sub-trigger`,className:H(`focus:bg-accent focus:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-[13px] outline-none select-none`,e),...n,children:[t,(0,U.jsx)(te,{className:`ml-auto size-3.5`})]})}function Bd({className:e,...t}){return(0,U.jsx)(kd,{"data-slot":`dropdown-menu-sub-content`,className:H(`bg-popover text-popover-foreground z-50 min-w-32 overflow-hidden rounded-md border p-1 shadow-md`,e),...t})}function Vd({className:e,type:t,...n}){return(0,U.jsx)(`input`,{type:t,"data-slot":`input`,className:H(`border-input focus-visible:border-ring focus-visible:ring-ring/50 h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30`,`placeholder:text-muted-foreground`,e),...n})}function Hd(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Ud(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function Wd(e){return e/100*window.innerHeight}function Gd(e){return e/100*window.innerWidth}function Kd(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function qd({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Kd(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Ud(t,i);break;case`em`:r=Hd(t,i);break;case`vh`:r=Wd(i);break;case`vw`:r=Gd(i)}return r}function Jd(e){return parseFloat(e.toFixed(3))}function Yd({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Xd(e){let{panels:t}=e,n=Yd({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=Jd(qd({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Jd(qd({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Jd(qd({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Jd(qd({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function Zd(e,t=`Assertion error`){if(!e)throw Error(t)}function Qd(e,t){return Array.from(t).sort(e===`horizontal`?$d:ef)}function $d(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function ef(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function tf(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function nf(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function rf({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=nf(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Zd(i,`No rect found`),i}var af;function of(){return af===void 0&&(af=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),af}function sf(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Qd(n,Array.from(t.children).filter(tf).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,rf({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=of()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:Yd({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var cf=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0){if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},lf={cursorFlags:0,state:`inactive`},uf=new cf;function df(){return lf}function ff(e){return uf.addListener(`change`,e)}function pf(e){let t=lf,n={...lf};n.cursorFlags=e,lf=n,uf.emit(`change`,{prev:t,next:n})}function mf(e){let t=lf;lf=e,uf.emit(`change`,{prev:t,next:e})}var hf=e=>e,gf=()=>{},_f=1,vf=2,yf=4,bf=8,xf=3,Sf=12,Cf;function wf(){return Cf===void 0&&(Cf=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Cf=!0)),Cf}function Tf({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++}})}if(r!==0||i!==0){if(n===`active`&&e&&wf()){let t=(e&_f)!==0,n=(e&vf)!==0,r=(e&yf)!==0,i=(e&bf)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}return wf()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Ef=new WeakMap;function Df(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=Ef.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=df();switch(r.state){case`active`:case`hover`:{let e=Tf({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0)}Ef.set(e,{prevStyle:t,styleSheet:n})}var Of=new Map,kf=new cf;function Af(e){Of=new Map(Of),Of.delete(e)}function jf(e,t){for(let[t]of Of)if(t.id===e)return t}function Mf(e,t){for(let[t,n]of Of)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Nf(){return Of}function Pf(e,t){return kf.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Ff(e,t,n){let r=Of.get(e);Of=new Map(Of),Of.set(e,t),kf.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function If(e){let t=df(),n=Nf(),r=!1;return t.state===`active`&&(mf({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Df(e),r=!0,t.hitRegions.forEach(e=>{if(!n.has(e.group))return;let t=Mf(e.group.id,!0);Ff(e.group,t,{isUserInteraction:!0})}))),r}function Lf(e){e.defaultPrevented||If(e.currentTarget)}function Rf(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=nf(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t)}}return r?{distance:i,hitRegion:r}:void 0}function zf(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Bf(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Kf(e),b:Kf(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Zd(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Gf(Wf(n.a)),b:Gf(Wf(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Vf=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Hf(e){let t=getComputedStyle(qf(e)??e).display;return t===`flex`||t===`inline-flex`}function Uf(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Hf(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Vf.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Wf(e){let t=e.length;for(;t--;){let n=e[t];if(Zd(n,`Missing node`),Uf(n))return n}return null}function Gf(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Kf(e){let t=[];for(;e;)t.push(e),e=qf(e);return t}function qf(e){let{parentNode:t}=e;return zf(t)?t.host:t}function Jf(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Yf({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!tf(n)||n.contains(e)||e.contains(n))return!0;if(Bf(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Jf(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Xf(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=sf(r),a=Rf(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Yf({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Zf(e,t){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 Qf(e,t,n=0){return Math.abs(Jd(e)-Jd(t))<=n}function $f(e,t){return Qf(e,t)?0:e>t?1:-1}function ep({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if($f(r,c)<0){if(a){let e=(i+c)/2;r=$f(r,e)<0?i:c}else r=c}return r=Math.min(s,r),r=Jd(r),r}function tp({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Qf(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Zd(u!=null,`Invalid first pivot index`),Zd(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Zd(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Zd(n!=null,`Previous layout not found for panel index ${t}`),Qf(n,i)){let t=o-n;$f(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Zd(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Zd(n!=null,`Previous layout not found for panel index ${t}`),Qf(n,o)){let t=n-i;$f(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Zd(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&$f(i,c)<0){if(e>0){let t=c-o,n=t/2;$f(i+e,c)<0&&(e=$f(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;$f(i-e,c)<0&&(e=$f(100+e,n)>0?0:-t)}}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];Zd(e!=null,`Previous layout not found for panel index ${r}`);let a=ep({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];Zd(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=ep({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Qf(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(Zf(c,l))return i;{let t=e<0?d:u,r=s[t];Zd(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=ep({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Qf(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Zd(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=ep({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Qf(i,s)||(t-=s-i,l[r]=s),Qf(t,0))break;e>0?r--:r++}}}if(!Qf(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function np(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||$f(e[n],t[n])!==0)return!1;return!0}function rp({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!Qf(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Zd(t!=null,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];Zd(i!=null,`No layout data found for index ${e}`);let o=r[e];Zd(o!=null,`No layout data found for index ${e}`);let s=ep({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Qf(a,0))for(let e=0;e<t.length;e++){let n=r[e];Zd(n!=null,`No layout data found for index ${e}`);let i=n+a,o=ep({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Qf(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function ip({groupId:e,panelId:t}){let n=()=>{let t=Nf();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&Qf(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:Jd(100-e)}}return tp({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=rp({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});np(c,u)||Ff(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Qf(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Yd({group:t}),o=Jd(qd({groupSize:a,panelElement:r,styleProp:e})/a*100);s(o)}}}function ap(e){e.defaultPrevented||Xf(e,Nf()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=ip({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function op(e){let t=Nf();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function sp({groupId:e}){let t=()=>{let t=Nf();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=rp({layout:e,panelConstraints:r});return n?o:(np(o,c)||Ff(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function cp(e,t){let n=op(e),r=Mf(n.id,!0),i=n.separators.find(t=>t.element===e);Zd(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Zd(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=sp({groupId:n.id}).getLayout(),c=rp({layout:tp({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});np(s,c)||Ff(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function lp(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=op(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&cp(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&cp(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&cp(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&cp(t,-5);break;case`End`:e.preventDefault(),cp(t,100);break;case`Enter`:{e.preventDefault();let n=op(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Mf(n.id,!0),o=n.separators.find(e=>e.element===t);Zd(o,`Matching separator not found`);let s=a.get(o);Zd(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Zd(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];cp(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=op(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Zd(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),cp(t,-100)}}function up(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Nf(),n=Xf(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),mf({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function dp({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=tp({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(np(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?_f:vf;break;case`vertical`:s|=d<0?yf:bf}}else Ff(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&xf:c|=s&xf,t.movementY===0?c|=o&Sf:c|=s&Sf,pf(c),Df(e)}function fp(e){let t=Nf(),n=df();n.state===`active`&&dp({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function pp(e){if(e.defaultPrevented)return;let t=df(),n=Nf();switch(t.state){case`active`:if(e.buttons===0){mf({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{if(!n.has(e.group))return;let t=Mf(e.group.id,!0);Ff(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}dp({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Xf(e,n);r.length===0?t.state!==`inactive`&&mf({cursorFlags:0,state:`inactive`}):mf({cursorFlags:0,hitRegions:r,state:`hover`}),Df(e.currentTarget);break}}}function mp(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(df().state){case`hover`:mf({cursorFlags:0,state:`inactive`})}}function hp(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||If(e.currentTarget)&&e.preventDefault()}function gp(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Jd(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Jd((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function _p(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Yd({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Jd(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function vp(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function yp(e,t){return e.length===t.length&&e.every((e,n)=>vp(e,t[n]))}function bp({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=Jd(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=Jd((r[e]??0)/a*l);else{let e=Jd(l/c.length);for(let t of c)u[t]=e}return u}function xp(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var Sp=new Map;function Cp(e){let t=!0;Zd(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=Yd({group:e});if(t===0)return;let n=Mf(e.id);if(!n)return;let r=Xd(e),i=n.defaultLayoutDeferred?gp(r):n.layout,a=rp({layout:bp({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&np(n.layout,a)&&yp(n.derivedPanelConstraints,r)&&n.groupSize===t)continue;Ff(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else _p(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Zd(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=Yd({group:e}),s=Xd(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(xp(e.panels,l)||(l=void 0));let u=rp({layout:e.mutableState.layouts[c]??l??gp(s),panelConstraints:s}),d=e.element.ownerDocument;Sp.set(d,(Sp.get(d)??0)+1);let f=new Map;return sf(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Ff(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Zd(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,lp)}),Sp.get(d)===1&&(d.addEventListener(`contextmenu`,Lf,!0),d.addEventListener(`dblclick`,ap,!0),d.addEventListener(`pointerdown`,up,!0),d.addEventListener(`pointerleave`,fp),d.addEventListener(`pointermove`,pp),d.addEventListener(`pointerout`,mp),d.addEventListener(`pointerup`,hp,!0)),function(){t=!1,Sp.set(d,Math.max(0,(Sp.get(d)??0)-1)),Af(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,lp)}),Sp.get(d)||(d.removeEventListener(`contextmenu`,Lf,!0),d.removeEventListener(`dblclick`,ap,!0),d.removeEventListener(`pointerdown`,up,!0),d.removeEventListener(`pointerleave`,fp),d.removeEventListener(`pointermove`,pp),d.removeEventListener(`pointerout`,mp),d.removeEventListener(`pointerup`,hp,!0)),a.disconnect()}}function wp(){let[e,t]=(0,C.useState)({});return[e,(0,C.useCallback)(()=>t({}),[])]}function Tp(e){let t=(0,C.useId)();return`${e??t}`}var Ep=typeof window<`u`?C.useLayoutEffect:C.useEffect;function Dp(e){let t=(0,C.useRef)(e);return Ep(()=>{t.current=e},[e]),(0,C.useCallback)((...e)=>t.current?.(...e),[t])}function Op(...e){return Dp(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t}})})}function kp(e){let t=(0,C.useRef)({...e});return Ep(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Ap=(0,C.createContext)(null);function jp(e,t){let n=(0,C.useRef)({getLayout:()=>({}),setLayout:hf});(0,C.useImperativeHandle)(t,()=>n.current,[]),Ep(()=>{Object.assign(n.current,sp({groupId:e}))})}function Mp({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,C.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Dp(e=>{np(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Dp((e,t)=>{np(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=Tp(s),v=(0,C.useRef)(null),[y,b]=wp(),x=(0,C.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Op(v,a);jp(_,o);let w=Dp((e,t)=>{let r=df(),i=jf(e),a=Mf(e);if(a){let e=!1;return r.state===`active`&&(e=r.hitRegions.some(e=>e.group===i)),{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),T=kp({defaultLayout:n,disableCursor:r}),E=(0,C.useMemo)(()=>({get disableCursor(){return!!T.disableCursor},getPanelStyles:w,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Qd(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Qd(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=jf(_),i=Mf(_);r&&i&&Ff(r,{...i,derivedPanelConstraints:Xd(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[w,_,b,u,T]),D=(0,C.useRef)(null);return Ep(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(T.defaultLayout!==void 0&&Object.keys(T.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=T.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!T.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};D.current=r;let a=Cp(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Mf(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=Pf(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Qf(t.collapsedSize,i[t.panelId]),a=Qf(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=df().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{D.current=null,a(),l()}},[i,_,g,h,u,y,T]),(0,C.useEffect)(()=>{let e=D.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,U.jsx)(Ap.Provider,{value:E,children:(0,U.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}Mp.displayName=`Group`;function Np(e,t){return`react-resizable-panels:${[e,...t].join(`:`)}`}function Pp({id:e,panelIds:t,storage:n}){let r=Np(e,[]),i=n.getItem(r);if(i)try{let e=JSON.parse(i);if(t){let n=e[t.join(`,`)];if(n&&Array.isArray(n.layout)&&t.length===n.layout.length){let e={};for(let r=0;r<t.length;r++)e[t[r]]=n.layout[r];return e}}else{let t=Object.keys(e);if(t.length===1){let n=e[t[0]];if(n&&Array.isArray(n.layout)){let e=t[0].split(`,`);if(e.length===n.layout.length){let t={};for(let r=0;r<e.length;r++)t[e[r]]=n.layout[r];return t}}}}}catch{}}function Fp({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:r=localStorage,...i}){let a=n!==void 0,o=`id`in i?i.id:i.groupId,s=Np(o,n??[]),c=(0,C.useSyncExternalStore)(Ip,()=>r.getItem(s),()=>r.getItem(s)),l=(0,C.useMemo)(()=>{if(c){let e=JSON.parse(c),t=Object.values(e);if(Array.from(t).every(e=>typeof e==`number`))return e}},[c]),u=(0,C.useMemo)(()=>{if(!l)return Pp({id:o,panelIds:n,storage:r})},[l,o,n,r]),d=l??u,f=(0,C.useRef)(null),p=(0,C.useCallback)(()=>{let e=f.current;e&&(f.current=null,clearTimeout(e))},[]);(0,C.useLayoutEffect)(()=>()=>{p()},[p]);let m=(0,C.useCallback)((e,n)=>{if(t&&!n.isUserInteraction)return;p();let i;i=a?Np(o,Object.keys(e)):Np(o,[]);try{r.setItem(i,JSON.stringify(e))}catch(e){console.error(e)}},[p,a,o,t,r]);return{defaultLayout:d,onLayoutChange:(0,C.useCallback)(t=>{p(),e===0?m(t,{isUserInteraction:!1}):f.current=setTimeout(()=>{m(t,{isUserInteraction:!1})},e)},[p,e,m]),onLayoutChanged:m}}function Ip(){return function(){}}function Lp(){let e=(0,C.useContext)(Ap);return Zd(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Rp(e,t){let{id:n}=Lp(),r=(0,C.useRef)({collapse:gf,expand:gf,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:gf});(0,C.useImperativeHandle)(t,()=>r.current,[]),Ep(()=>{Object.assign(r.current,ip({groupId:n,panelId:e}))})}function zp({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=Tp(c),_=kp({disabled:a}),v=(0,C.useRef)(null),y=Op(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:w,updatePanelProps:T}=Lp(),E=d!==null,D=Dp((e,t,n)=>{d?.(e,c,n)});Ep(()=>{let e=v.current;if(e!==null){let t={element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:E?D:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}};return w(t)}},[s,n,r,i,E,g,h,l,u,D,w,_]),(0,C.useEffect)(()=>{T(g,{disabled:a})},[a,g,T]),Rp(g,f);let O=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},ee=(0,C.useSyncExternalStore)(e=>Pf(x,e),O,O),k;return k=ee?JSON.parse(ee):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,U.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Bp,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,U.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}zp.displayName=`Panel`;var Bp={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Vp({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=rp({layout:tp({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=rp({layout:tp({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Hp({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Tp(a),l=kp({disabled:n,disableDoubleClick:r}),[u,d]=(0,C.useState)({}),[f,p]=(0,C.useState)(`inactive`),[m,h]=(0,C.useState)(!1),g=(0,C.useRef)(null),_=Op(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=Lp(),w=b===`horizontal`?`vertical`:`horizontal`;Ep(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=ff(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Pf(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Vp({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,C.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let T;n&&!v&&(T=`not-allowed`);let E;if(n)E=`disabled`;else switch(f){case`active`:E=`active`;break;default:E=m?`focus`:f}return(0,U.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":w,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":E,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:T,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}Hp.displayName=`Separator`;function Up({className:e,...t}){return(0,U.jsx)(Mp,{"data-slot":`resizable-panel-group`,className:H(`flex h-full w-full aria-[orientation=vertical]:flex-col`,e),...t})}function Wp({...e}){return(0,U.jsx)(zp,{"data-slot":`resizable-panel`,...e})}function Gp({withHandle:e,className:t,...n}){return(0,U.jsx)(Hp,{"data-slot":`resizable-handle`,className:H(`bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,t),...n,children:e?(0,U.jsx)(`div`,{className:`bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border`,children:(0,U.jsx)(N,{className:`size-2.5`})}):null})}function Kp({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card`,className:H(`bg-card text-card-foreground flex flex-col gap-4 rounded-xl border py-4 shadow-sm`,e),...t})}function qp({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-header`,className:H(`flex items-center justify-between gap-2 px-4`,e),...t})}function Jp({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-content`,className:H(`px-4`,e),...t})}function Yp({kind:e,description:t,onAllowOnce:n,onAllowAlways:r,onReject:i}){return(0,U.jsxs)(Kp,{className:`my-2 border-amber-500/50`,children:[(0,U.jsxs)(qp,{className:`py-2 text-sm font-medium`,children:[`Permission requested: `,e]}),(0,U.jsxs)(Jp,{className:`pb-3 pt-0`,children:[(0,U.jsx)(`p`,{className:`text-muted-foreground mb-2 text-sm`,children:t}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(Qn,{size:`sm`,variant:`default`,onClick:n,children:`Allow once`}),(0,U.jsx)(Qn,{size:`sm`,variant:`secondary`,onClick:r,children:`Always allow`}),(0,U.jsx)(Qn,{size:`sm`,variant:`outline`,onClick:i,children:`Reject`})]})]})]})}function Xp({name:e,args:t,status:n=`pending`,onApprove:r,onReject:i}){let a={pending:`bg-muted`,in_progress:`bg-blue-500`,completed:`bg-green-500`,failed:`bg-red-500`}[n];return(0,U.jsxs)(Kp,{className:H(`my-2 border`,n===`pending`&&`border-amber-500/50`),children:[(0,U.jsxs)(qp,{className:`flex flex-row items-center justify-between py-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,U.jsx)(`span`,{className:H(`size-2 rounded-full`,a)}),e]}),(0,U.jsx)(`span`,{className:`text-muted-foreground text-xs uppercase`,children:n})]}),(0,U.jsxs)(Jp,{className:`pb-3 pt-0`,children:[(0,U.jsx)(`pre`,{className:`bg-muted rounded-md p-2 text-xs`,children:JSON.stringify(t,null,2)}),n===`pending`&&(r||i)?(0,U.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[r&&(0,U.jsx)(Qn,{size:`sm`,variant:`default`,onClick:r,children:`Allow once`}),i&&(0,U.jsx)(Qn,{size:`sm`,variant:`outline`,onClick:i,children:`Reject`})]}):null]})]})}function Zp({open:e,onClose:t}){let[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)([]),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)([]),[u,d]=(0,C.useState)(``),[f,p]=(0,C.useState)(!1),[m,h]=(0,C.useState)(null),g=(0,C.useRef)(null);(0,C.useEffect)(()=>{fetch(`/api/agent/config`).then(e=>e.json()).then(r).catch(()=>r({defaultAgent:`cursor`,agents:[]})),fetch(`/api/agent/skills`).then(e=>e.json()).then(a).catch(()=>a([]))},[]),(0,C.useEffect)(()=>{e&&!o&&fetch(`/api/agent/session`,{method:`POST`}).then(e=>e.json()).then(e=>{e.sessionId&&(s(e.sessionId),_(e.sessionId))}).catch(e=>l(t=>[...t,{role:`agent`,text:`Failed to start session: ${String(e)}`}]))},[e,o]);let _=e=>{let t=new EventSource(`/api/agent/events?sessionId=${encodeURIComponent(e)}`);t.addEventListener(`message`,e=>{let n=JSON.parse(e.data);if(n.type===`agent_message_chunk`){let e=n.text??``;l(t=>{let n=t[t.length-1];return n?.role===`agent`?[...t.slice(0,-1),{...n,text:n.text+e}]:[...t,{role:`agent`,text:e}]})}else if(n.type===`tool_call`){let e=n.name??`unknown`;p(!1),l(t=>[...t,{role:`tool`,requestId:n.requestId??``,name:e,args:n.args??{}}])}else if(n.type===`request_permission`){let e=n.kind??`unknown`;l(t=>[...t,{role:`permission`,requestId:n.requestId??``,kind:e,description:n.description??``}])}else n.type===`stop_reason`?p(!1):n.type===`error`?(p(!1),l(e=>[...e,{role:`agent`,text:`Error: ${n.message??`unknown`}`}])):n.type===`disconnected`&&(p(!1),t.close())})},v=()=>{if(!o||!u.trim()||f)return;let e=u.trim();d(``),l(t=>[...t,{role:`user`,text:e}]),p(!0),fetch(`/api/agent/prompt`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:o,prompt:e,skillId:m})}).catch(e=>{p(!1),l(t=>[...t,{role:`agent`,text:`Failed to send: ${String(e)}`}])})},y=(e,t)=>{o&&(fetch(`/api/agent/approve`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:o,requestId:e,decision:t})}).catch(()=>void 0),l(n=>n.map(n=>n.role===`tool`&&n.requestId===e?{...n,approved:t!==`reject`}:n)))},b=(e,t)=>{o&&fetch(`/api/agent/approve`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:o,requestId:e,decision:t})}).catch(()=>void 0)};(0,C.useEffect)(()=>{g.current?.scrollIntoView({behavior:`smooth`})},[c]);let x=(0,C.useMemo)(()=>i.find(e=>e.id===m)?.name??m,[i,m]);return e?(0,U.jsx)(Wp,{id:`agent`,defaultSize:`320px`,minSize:`16rem`,maxSize:`50%`,className:`min-h-0`,children:(0,U.jsxs)(Up,{orientation:`vertical`,className:`h-full`,children:[(0,U.jsxs)(`header`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:`Agent`}),n&&(0,U.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n.defaultAgent})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsx)(Qn,{variant:`ghost`,size:`sm`,children:x??`Skill`})}),(0,U.jsxs)(Md,{align:`end`,children:[(0,U.jsx)(Q,{onClick:()=>h(null),children:`None`}),i.map(e=>(0,U.jsx)(Q,{onClick:()=>h(e.id),children:e.name},e.id))]})]}),(0,U.jsx)(Qn,{variant:`ghost`,size:`icon`,onClick:t,children:`×`})]})]}),(0,U.jsx)(Wp,{className:`min-h-0 flex-1`,children:(0,U.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-3`,children:[c.length===0?(0,U.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Ask the agent about this board or attach a skill.`}):c.map((e,t)=>e.role===`user`?(0,U.jsx)(`div`,{className:`mb-2 flex justify-end`,children:(0,U.jsx)(`div`,{className:`bg-primary text-primary-foreground max-w-[80%] rounded-lg px-3 py-2 text-sm`,children:e.text})},t):e.role===`tool`?(0,U.jsx)(Xp,{name:e.name,args:e.args,status:e.approved===!0?`in_progress`:e.approved===!1?`failed`:`pending`,onApprove:()=>y(e.requestId,`once`),onReject:()=>y(e.requestId,`reject`)},t):e.role===`permission`?(0,U.jsx)(Yp,{kind:e.kind,description:e.description,onAllowOnce:()=>b(e.requestId,`once`),onAllowAlways:()=>b(e.requestId,`always`),onReject:()=>b(e.requestId,`reject`)},t):(0,U.jsx)(`div`,{className:`mb-2 flex justify-start`,children:(0,U.jsx)(`div`,{className:`bg-muted max-w-[90%] rounded-lg px-3 py-2 text-sm whitespace-pre-wrap`,children:e.text})},t)),f&&(0,U.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:`Agent is thinking…`}),(0,U.jsx)(`div`,{ref:g})]}),(0,U.jsxs)(`div`,{className:`border-t p-2`,children:[m&&(0,U.jsxs)(`div`,{className:`text-muted-foreground mb-1 flex items-center gap-1 text-xs`,children:[(0,U.jsx)(`span`,{className:`bg-muted rounded-full px-2 py-0.5`,children:x}),`attached`]}),(0,U.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),v()},children:[(0,U.jsx)(Vd,{value:u,onChange:e=>d(e.target.value),placeholder:`Ask the agent…`,disabled:f,className:`flex-1`}),(0,U.jsx)(Qn,{type:`submit`,disabled:f||!u.trim(),children:`Send`})]})]})]})})]})}):null}function Qp({className:e,...t}){return(0,U.jsx)(`span`,{"data-slot":`avatar`,className:H(`bg-muted text-muted-foreground relative flex size-4 shrink-0 items-center justify-center overflow-hidden rounded-full text-[9px] font-medium`,e),...t})}function $p({className:e,...t}){return(0,U.jsx)(`span`,{"data-slot":`avatar-fallback`,className:H(`flex size-full items-center justify-center`,e),...t})}var em=Object.defineProperty,tm=(e,t)=>em(e,`name`,{value:t,configurable:!0}),nm=`Collapsible`,[rm,im]=lr(nm),[am,om]=rm(nm),sm=C.forwardRef(tm(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=br({prop:r,defaultProp:i??!1,onChange:o,caller:nm});return(0,U.jsx)(am,{scope:n,disabled:a,contentId:Li(),open:c,onOpenToggle:C.useCallback(()=>l(e=>!e),[l]),children:(0,U.jsx)(Or.div,{"data-state":pm(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),cm=`CollapsibleTrigger`,lm=C.forwardRef(tm(function(e,t){let{__scopeCollapsible:n,...r}=e,i=om(cm,n);return(0,U.jsx)(Or.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":pm(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:W(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),um=`CollapsibleContent`,dm=C.forwardRef(tm(function(e,t){let{forceMount:n,...r}=e,i=om(um,e.__scopeCollapsible);return(0,U.jsx)(Cs,{present:n||i.open,children:({present:e})=>(0,U.jsx)(fm,{...r,ref:t,present:e})})},`CollapsibleContent`)),fm=C.forwardRef(tm(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=om(um,n),[s,c]=C.useState(r),l=C.useRef(null),u=nt(t,l),d=C.useRef(0),f=d.current,p=C.useRef(0),m=p.current,h=o.open||s,g=C.useRef(h),_=C.useRef(void 0);return C.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),dr(()=>{let e=l.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,U.jsx)(Or.div,{"data-state":pm(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})},`CollapsibleContentImpl`));function pm(e){return e?`open`:`closed`}tm(pm,`getState`);var mm=sm;function hm({...e}){return(0,U.jsx)(mm,{"data-slot":`collapsible`,...e})}function gm({...e}){return(0,U.jsx)(lm,{"data-slot":`collapsible-trigger`,...e})}function _m({...e}){return(0,U.jsx)(dm,{"data-slot":`collapsible-content`,...e})}function vm(){var e=[...arguments];return(0,C.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var ym=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function bm(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function xm(e){return`nodeType`in e}function Sm(e){return e?bm(e)?e:xm(e)?e.ownerDocument?.defaultView??window:window:window}function Cm(e){let{Document:t}=Sm(e);return e instanceof t}function wm(e){return!bm(e)&&e instanceof Sm(e).HTMLElement}function Tm(e){return e instanceof Sm(e).SVGElement}function Em(e){return e?bm(e)?e.document:xm(e)?Cm(e)?e:wm(e)||Tm(e)?e.ownerDocument:document:document:document}var Dm=ym?C.useLayoutEffect:C.useEffect;function Om(e){let t=(0,C.useRef)(e);return Dm(()=>{t.current=e}),(0,C.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function km(){let e=(0,C.useRef)(null);return[(0,C.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,C.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Am(e,t){t===void 0&&(t=[e]);let n=(0,C.useRef)(e);return Dm(()=>{n.current!==e&&(n.current=e)},t),n}function jm(e,t){let n=(0,C.useRef)();return(0,C.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Mm(e){let t=Om(e),n=(0,C.useRef)(null);return[n,(0,C.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Nm(e){let t=(0,C.useRef)();return(0,C.useEffect)(()=>{t.current=e},[e]),t.current}var Pm={};function Fm(e,t){return(0,C.useMemo)(()=>{if(t)return t;let n=Pm[e]==null?0:Pm[e]+1;return Pm[e]=n,e+`-`+n},[e,t])}function Im(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Lm=Im(1),Rm=Im(-1);function zm(e){return`clientX`in e&&`clientY`in e}function Bm(e){if(!e)return!1;let{KeyboardEvent:t}=Sm(e.target);return t&&e instanceof t}function Vm(e){if(!e)return!1;let{TouchEvent:t}=Sm(e.target);return t&&e instanceof t}function Hm(e){if(Vm(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return zm(e)?{x:e.clientX,y:e.clientY}:null}var Um=Object.freeze({Translate:{toString(e){if(!e)return;let{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;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[Um.Translate.toString(e),Um.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Wm=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Gm(e){return e.matches(Wm)?e:e.querySelector(Wm)}var Km={display:`none`};function qm(e){let{id:t,value:n}=e;return C.createElement(`div`,{id:t,style:Km},n)}function Jm(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return C.createElement(`div`,{id:t,style:{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`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Ym(){let[e,t]=(0,C.useState)(``);return{announce:(0,C.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Xm=(0,C.createContext)(null);function Zm(e){let t=(0,C.useContext)(Xm);(0,C.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Qm(){let[e]=(0,C.useState)(()=>new Set),t=(0,C.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,C.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var $m={draggable:`
51
+ `},_l=0,vl=[];function yl(e){var t=C.useRef([]),n=C.useRef([0,0]),r=C.useRef(),i=C.useState(_l++)[0],a=C.useState(Vc)[0],o=C.useRef(e);C.useEffect(function(){o.current=e},[e]),C.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=_c([e.lockRef.current],(e.shards||[]).map(ml),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=C.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=fl(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=al(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=al(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return dl(h,t,e,h===`h`?s:c,!0)},[]),c=C.useCallback(function(e){var n=e;if(vl.length&&vl[vl.length-1]===a){var r=`deltaY`in n?pl(n):fl(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&hl(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(ml).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=C.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:bl(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=C.useCallback(function(e){n.current=fl(e),r.current=void 0},[]),d=C.useCallback(function(t){l(t.type,pl(t),t.target,s(t,e.lockRef.current))},[]),f=C.useCallback(function(t){l(t.type,fl(t),t.target,s(t,e.lockRef.current))},[]);C.useEffect(function(){return vl.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,el),document.addEventListener(`touchmove`,c,el),document.addEventListener(`touchstart`,u,el),function(){vl=vl.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,el),document.removeEventListener(`touchmove`,c,el),document.removeEventListener(`touchstart`,u,el)}},[]);var p=e.removeScrollBar,m=e.inert;return C.createElement(C.Fragment,null,m?C.createElement(a,{styles:gl(i)}):null,p?C.createElement(Zc,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function bl(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var xl=jc(Mc,yl),Sl=C.forwardRef(function(e,t){return C.createElement(Pc,hc({},e,{ref:t,sideCar:xl}))});Sl.classNames=Pc.classNames;var Cl=Object.defineProperty,q=(e,t)=>Cl(e,`name`,{value:t,configurable:!0}),wl=[`Enter`,` `],Tl=[`ArrowDown`,`PageUp`,`Home`],El=[`ArrowUp`,`PageDown`,`End`],Dl=[...Tl,...El],Ol={ltr:[...wl,`ArrowRight`],rtl:[...wl,`ArrowLeft`]},kl={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Al=`Menu`,[jl,Ml,Nl]=Mr(Al),[Pl,Fl]=lr(Al,[Nl,ns,Ks]),Il=ns(),Ll=Ks(),[Rl,J]=Pl(Al),[Y,X]=Pl(Al),zl=q(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Il(t),[c,l]=C.useState(null),u=C.useRef(!1),d=Yr(a),f=Kr(i);return C.useEffect(()=>{let e=q(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=q(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),C.useEffect(()=>{if(!n)return;let e=q(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,U.jsx)(hs,{...s,children:(0,U.jsx)(Rl,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,U.jsx)(Y,{scope:t,onClose:C.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Bl=C.forwardRef(q(function(e,t){let{__scopeMenu:n,...r}=e,i=Il(n);return(0,U.jsx)(gs,{...i,...r,ref:t})},`MenuAnchor`)),Vl=`MenuPortal`,[Hl,Ul]=Pl(Vl,{forceMount:void 0}),Wl=q(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=J(Vl,t);return(0,U.jsx)(Hl,{scope:t,forceMount:n,children:(0,U.jsx)(Cs,{present:n||a.open,children:(0,U.jsx)(ys,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Gl=`MenuContent`,[Kl,ql]=Pl(Gl),Jl=C.forwardRef(q(function(e,t){let n=Ul(Gl,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=J(Gl,e.__scopeMenu),o=X(Gl,e.__scopeMenu);return(0,U.jsx)(jl.Provider,{scope:e.__scopeMenu,children:(0,U.jsx)(Cs,{present:r||a.open,children:(0,U.jsx)(jl.Slot,{scope:e.__scopeMenu,children:o.modal?(0,U.jsx)(Yl,{...i,ref:t}):(0,U.jsx)(Xl,{...i,ref:t})})})})},`MenuContent`)),Yl=C.forwardRef(q(function(e,t){let n=J(Gl,e.__scopeMenu),r=C.useRef(null),i=nt(t,r);return C.useEffect(()=>{let e=r.current;if(e)return mc(e)},[]),(0,U.jsx)(Ql,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:W(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Xl=C.forwardRef(q(function(e,t){let n=J(Gl,e.__scopeMenu);return(0,U.jsx)(Ql,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Zl=at(`MenuContent.ScrollLock`),Ql=C.forwardRef(q(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=J(Gl,n),_=X(Gl,n),v=Il(n),y=Ll(n),b=Ml(n),[x,S]=C.useState(null),w=C.useRef(null),T=nt(t,w,g.onContentChange),E=C.useRef(0),D=C.useRef(``),O=C.useRef(0),ee=C.useRef(null),k=C.useRef(`right`),A=C.useRef(0),te=m?Sl:C.Fragment,j=m?{as:Zl,allowPinchZoom:!0}:void 0,M=q(e=>{let t=D.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=ku(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;q((function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);C.useEffect(()=>()=>window.clearTimeout(E.current),[]),hi();let ne=C.useCallback(e=>k.current===ee.current?.side&&ju(e,ee.current?.area),[]);return(0,U.jsx)(Kl,{scope:n,searchRef:D,onItemEnter:C.useCallback(e=>{ne(e)&&e.preventDefault()},[ne]),onItemLeave:C.useCallback(e=>{ne(e)||(w.current?.focus(),S(null))},[ne]),onTriggerLeave:C.useCallback(e=>{ne(e)&&e.preventDefault()},[ne]),pointerGraceTimerRef:O,onPointerGraceIntentChange:C.useCallback(e=>{ee.current=e},[]),children:(0,U.jsx)(te,{...j,children:(0,U.jsx)(Si,{asChild:!0,trapped:i,onMountAutoFocus:W(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,U.jsx)(ri,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,U.jsx)(ic,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:W(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,U.jsx)(_s,{role:`menu`,"aria-orientation":`vertical`,"data-state":wu(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:W(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&M(e.key));let i=w.current;if(e.target!==i||!Dl.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);El.includes(e.key)&&a.reverse(),Du(a)}),onBlur:W(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:W(e.onPointerMove,Mu(e=>{let t=e.target,n=A.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>A.current?`right`:`left`;k.current=t,A.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),$l=C.forwardRef(q(function(e,t){let{__scopeMenu:n,...r}=e;return(0,U.jsx)(Or.div,{role:`group`,...r,ref:t})},`MenuGroup`)),eu=C.forwardRef(q(function(e,t){let{__scopeMenu:n,...r}=e;return(0,U.jsx)(Or.div,{...r,ref:t})},`MenuLabel`)),tu=`MenuItem`,nu=`menu.itemSelect`,ru=C.forwardRef(q(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=C.useRef(null),o=X(tu,e.__scopeMenu),s=ql(tu,e.__scopeMenu),c=nt(t,a),l=C.useRef(!1),u=q(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(nu,{bubbles:!0,cancelable:!0});e.addEventListener(nu,e=>r?.(e),{once:!0}),kr(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,U.jsx)(iu,{...i,ref:c,disabled:n,onClick:W(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:W(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:W(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&wl.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),iu=C.forwardRef(q(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=ql(tu,n),s=Ll(n),c=C.useRef(null),l=nt(t,c),[u,d]=C.useState(!1),[f,p]=C.useState(``);return C.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,U.jsx)(jl.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,U.jsx)(ac,{asChild:!0,...s,focusable:!r,children:(0,U.jsx)(Or.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:W(e.onPointerMove,Mu(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:W(e.onPointerLeave,Mu(e=>o.onItemLeave(e))),onFocus:W(e.onFocus,()=>d(!0)),onBlur:W(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),au=C.forwardRef(q(function(e,t){let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,U.jsx)(fu,{scope:e.__scopeMenu,checked:n,children:(0,U.jsx)(ru,{role:`menuitemcheckbox`,"aria-checked":Tu(n)?`mixed`:n,...i,ref:t,"data-state":Eu(n),onSelect:W(i.onSelect,()=>r?.(Tu(n)?!0:!n),{checkForDefaultPrevented:!1})})})},`MenuCheckboxItem`)),[ou,su]=Pl(`MenuRadioGroup`,{value:void 0,onValueChange:q(()=>{},`onValueChange`)}),cu=C.forwardRef(q(function(e,t){let{value:n,onValueChange:r,...i}=e,a=Yr(r);return(0,U.jsx)(ou,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,U.jsx)($l,{...i,ref:t})})},`MenuRadioGroup`)),lu=`MenuRadioItem`,uu=C.forwardRef(q(function(e,t){let{value:n,...r}=e,i=su(lu,e.__scopeMenu),a=n===i.value;return(0,U.jsx)(fu,{scope:e.__scopeMenu,checked:a,children:(0,U.jsx)(ru,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Eu(a),onSelect:W(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})},`MenuRadioItem`)),du=`MenuItemIndicator`,[fu,pu]=Pl(du,{checked:!1}),mu=C.forwardRef(q(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=pu(du,n);return(0,U.jsx)(Cs,{present:r||Tu(a.checked)||a.checked===!0,children:(0,U.jsx)(Or.span,{...i,ref:t,"data-state":Eu(a.checked)})})},`MenuItemIndicator`)),hu=C.forwardRef(q(function(e,t){let{__scopeMenu:n,...r}=e;return(0,U.jsx)(Or.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),gu=`MenuSub`,[_u,vu]=Pl(gu),yu=q(e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=J(gu,t),o=Il(t),[s,c]=C.useState(null),[l,u]=C.useState(null),d=Yr(i);return C.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,U.jsx)(hs,{...o,children:(0,U.jsx)(Rl,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,U.jsx)(_u,{scope:t,contentId:Li(),triggerId:Li(),trigger:s,onTriggerChange:c,children:n})})})},`MenuSub`),bu=`MenuSubTrigger`,xu=C.forwardRef(q(function(e,t){let n=J(bu,e.__scopeMenu),r=X(bu,e.__scopeMenu),i=vu(bu,e.__scopeMenu),a=ql(bu,e.__scopeMenu),o=C.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=C.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);C.useEffect(()=>u,[u]),C.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]);let d=nt(t,i.onTriggerChange);return(0,U.jsx)(Bl,{asChild:!0,...l,children:(0,U.jsx)(iu,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":wu(n.open),...e,ref:d,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:W(e.onPointerMove,Mu(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:W(e.onPointerLeave,Mu(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:W(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||(a.searchRef.current===``||t.key!==` `)&&Ol[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})},`MenuSubTrigger`)),Su=`MenuSubContent`,Cu=C.forwardRef(q(function(e,t){let n=Ul(Gl,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=J(Gl,e.__scopeMenu),s=X(Gl,e.__scopeMenu),c=vu(Su,e.__scopeMenu),l=C.useRef(null),u=nt(t,l);return(0,U.jsx)(jl.Provider,{scope:e.__scopeMenu,children:(0,U.jsx)(Cs,{present:r||o.open,children:(0,U.jsx)(jl.Slot,{scope:e.__scopeMenu,children:(0,U.jsx)(Ql,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:W(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:W(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:W(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=kl[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})},`MenuSubContent`));function wu(e){return e?`open`:`closed`}q(wu,`getOpenState`);function Tu(e){return e===`indeterminate`}q(Tu,`isIndeterminate`);function Eu(e){return Tu(e)?`indeterminate`:e?`checked`:`unchecked`}q(Eu,`getCheckedState`);function Du(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}q(Du,`focusFirst`);function Ou(e,t){return e.map((n,r)=>e[(t+r)%e.length])}q(Ou,`wrapArray`);function ku(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Ou(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}q(ku,`getNextMatch`);function Au(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}q(Au,`isPointInPolygon`);function ju(e,t){return t?Au({x:e.clientX,y:e.clientY},t):!1}q(ju,`isPointerInGraceArea`);function Mu(e){return t=>t.pointerType===`mouse`?e(t):void 0}q(Mu,`whenMouse`);var Nu=zl,Pu=Bl,Fu=Wl,Iu=Jl,Lu=eu,Ru=ru,zu=au,Bu=cu,Vu=uu,Hu=mu,Uu=hu,Wu=yu,Gu=xu,Ku=Cu,qu=Object.defineProperty,Ju=(e,t)=>qu(e,`name`,{value:t,configurable:!0}),Yu=`DropdownMenu`,[Xu,Zu]=lr(Yu,[Fl]),Qu=Fl(),[$u,ed]=Xu(Yu),td=Ju(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Qu(t),l=C.useRef(null),[u,d]=br({prop:i,defaultProp:a??!1,onChange:o,caller:Yu});return(0,U.jsx)($u,{scope:t,triggerId:Li(),triggerRef:l,contentId:Li(),open:u,onOpenChange:d,onOpenToggle:C.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,U.jsx)(Nu,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),nd=`DropdownMenuTrigger`,rd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=ed(nd,n),o=Qu(n),s=nt(t,a.triggerRef);return(0,U.jsx)(Pu,{asChild:!0,...o,children:(0,U.jsx)(Or.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:W(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:W(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),id=Ju(e=>{let{__scopeDropdownMenu:t,...n}=e,r=Qu(t);return(0,U.jsx)(Fu,{...r,...n})},`DropdownMenuPortal`),ad=`DropdownMenuContent`,od=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ed(ad,n),a=Qu(n),o=C.useRef(!1);return(0,U.jsx)(Iu,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:W(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:W(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),sd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Lu,{...i,...r,ref:t})},`DropdownMenuLabel`)),cd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Ru,{...i,...r,ref:t})},`DropdownMenuItem`)),ld=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(zu,{...i,...r,ref:t})},`DropdownMenuCheckboxItem`)),ud=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Bu,{...i,...r,ref:t})},`DropdownMenuRadioGroup`)),dd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Vu,{...i,...r,ref:t})},`DropdownMenuRadioItem`)),fd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Hu,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),pd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Uu,{...i,...r,ref:t})},`DropdownMenuSeparator`)),md=Ju(e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Qu(t),[s,c]=br({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,U.jsx)(Wu,{...o,open:s,onOpenChange:c,children:n})},`DropdownMenuSub`),hd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Gu,{...i,...r,ref:t})},`DropdownMenuSubTrigger`)),gd=C.forwardRef(Ju(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Qu(n);return(0,U.jsx)(Ku,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuSubContent`)),_d=td,vd=rd,yd=id,bd=od,Z=sd,xd=cd,Sd=ld,Cd=ud,wd=dd,Td=fd,Ed=pd,Dd=md,Od=hd,kd=gd;function Ad(e){return(0,U.jsx)(_d,{"data-slot":`dropdown-menu`,...e})}function jd(e){return(0,U.jsx)(vd,{"data-slot":`dropdown-menu-trigger`,...e})}function Md({className:e,sideOffset:t=4,...n}){return(0,U.jsx)(yd,{children:(0,U.jsx)(bd,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:H(`bg-popover text-popover-foreground z-50 min-w-40 overflow-hidden rounded-md border p-1 shadow-md`,e),...n})})}function Nd({className:e,...t}){return(0,U.jsx)(Z,{"data-slot":`dropdown-menu-label`,className:H(`text-muted-foreground px-2 py-1.5 text-[11px] font-medium`,e),...t})}function Q({className:e,...t}){return(0,U.jsx)(xd,{"data-slot":`dropdown-menu-item`,className:H(`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-[13px] outline-none select-none data-disabled:pointer-events-none data-disabled:opacity-50`,e),...t})}function Pd({className:e,children:t,...n}){return(0,U.jsxs)(Sd,{"data-slot":`dropdown-menu-checkbox-item`,className:H(`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-[13px] outline-none select-none`,e),...n,children:[(0,U.jsx)(`span`,{className:`absolute left-2 flex size-3.5 items-center justify-center`,children:(0,U.jsx)(Td,{children:(0,U.jsx)(k,{className:`size-3.5`})})}),t]})}function Fd(e){return(0,U.jsx)(Cd,{"data-slot":`dropdown-menu-radio-group`,...e})}function Id({className:e,children:t,...n}){return(0,U.jsxs)(wd,{"data-slot":`dropdown-menu-radio-item`,className:H(`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-[13px] outline-none select-none`,e),...n,children:[(0,U.jsx)(`span`,{className:`absolute left-2 flex size-3.5 items-center justify-center`,children:(0,U.jsx)(Td,{children:(0,U.jsx)(k,{className:`size-3.5`})})}),t]})}function Ld({className:e,...t}){return(0,U.jsx)(Ed,{"data-slot":`dropdown-menu-separator`,className:H(`bg-border -mx-1 my-1 h-px`,e),...t})}function Rd(e){return(0,U.jsx)(Dd,{"data-slot":`dropdown-menu-sub`,...e})}function zd({className:e,children:t,...n}){return(0,U.jsxs)(Od,{"data-slot":`dropdown-menu-sub-trigger`,className:H(`focus:bg-accent focus:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-[13px] outline-none select-none`,e),...n,children:[t,(0,U.jsx)(te,{className:`ml-auto size-3.5`})]})}function Bd({className:e,...t}){return(0,U.jsx)(kd,{"data-slot":`dropdown-menu-sub-content`,className:H(`bg-popover text-popover-foreground z-50 min-w-32 overflow-hidden rounded-md border p-1 shadow-md`,e),...t})}function Vd({className:e,type:t,...n}){return(0,U.jsx)(`input`,{type:t,"data-slot":`input`,className:H(`border-input focus-visible:border-ring focus-visible:ring-ring/50 h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30`,`placeholder:text-muted-foreground`,e),...n})}function Hd(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Ud(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function Wd(e){return e/100*window.innerHeight}function Gd(e){return e/100*window.innerWidth}function Kd(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function qd({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Kd(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Ud(t,i);break;case`em`:r=Hd(t,i);break;case`vh`:r=Wd(i);break;case`vw`:r=Gd(i)}return r}function Jd(e){return parseFloat(e.toFixed(3))}function Yd({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Xd(e){let{panels:t}=e,n=Yd({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=Jd(qd({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Jd(qd({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Jd(qd({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Jd(qd({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function Zd(e,t=`Assertion error`){if(!e)throw Error(t)}function Qd(e,t){return Array.from(t).sort(e===`horizontal`?$d:ef)}function $d(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function ef(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function tf(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function nf(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function rf({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=nf(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Zd(i,`No rect found`),i}var af;function of(){return af===void 0&&(af=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),af}function sf(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Qd(n,Array.from(t.children).filter(tf).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,rf({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=of()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:Yd({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var cf=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0){if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},lf={cursorFlags:0,state:`inactive`},uf=new cf;function df(){return lf}function ff(e){return uf.addListener(`change`,e)}function pf(e){let t=lf,n={...lf};n.cursorFlags=e,lf=n,uf.emit(`change`,{prev:t,next:n})}function mf(e){let t=lf;lf=e,uf.emit(`change`,{prev:t,next:e})}var hf=e=>e,gf=()=>{},_f=1,vf=2,yf=4,bf=8,xf=3,Sf=12,Cf;function wf(){return Cf===void 0&&(Cf=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Cf=!0)),Cf}function Tf({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++}})}if(r!==0||i!==0){if(n===`active`&&e&&wf()){let t=(e&_f)!==0,n=(e&vf)!==0,r=(e&yf)!==0,i=(e&bf)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}return wf()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Ef=new WeakMap;function Df(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=Ef.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=df();switch(r.state){case`active`:case`hover`:{let e=Tf({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0)}Ef.set(e,{prevStyle:t,styleSheet:n})}var Of=new Map,kf=new cf;function Af(e){Of=new Map(Of),Of.delete(e)}function jf(e,t){for(let[t]of Of)if(t.id===e)return t}function Mf(e,t){for(let[t,n]of Of)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Nf(){return Of}function Pf(e,t){return kf.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Ff(e,t,n){let r=Of.get(e);Of=new Map(Of),Of.set(e,t),kf.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function If(e){let t=df(),n=Nf(),r=!1;return t.state===`active`&&(mf({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Df(e),r=!0,t.hitRegions.forEach(e=>{if(!n.has(e.group))return;let t=Mf(e.group.id,!0);Ff(e.group,t,{isUserInteraction:!0})}))),r}function Lf(e){e.defaultPrevented||If(e.currentTarget)}function Rf(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=nf(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t)}}return r?{distance:i,hitRegion:r}:void 0}function zf(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Bf(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Kf(e),b:Kf(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Zd(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Gf(Wf(n.a)),b:Gf(Wf(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Vf=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Hf(e){let t=getComputedStyle(qf(e)??e).display;return t===`flex`||t===`inline-flex`}function Uf(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Hf(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Vf.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Wf(e){let t=e.length;for(;t--;){let n=e[t];if(Zd(n,`Missing node`),Uf(n))return n}return null}function Gf(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Kf(e){let t=[];for(;e;)t.push(e),e=qf(e);return t}function qf(e){let{parentNode:t}=e;return zf(t)?t.host:t}function Jf(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Yf({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!tf(n)||n.contains(e)||e.contains(n))return!0;if(Bf(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Jf(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Xf(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=sf(r),a=Rf(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Yf({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Zf(e,t){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 Qf(e,t,n=0){return Math.abs(Jd(e)-Jd(t))<=n}function $f(e,t){return Qf(e,t)?0:e>t?1:-1}function ep({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if($f(r,c)<0){if(a){let e=(i+c)/2;r=$f(r,e)<0?i:c}else r=c}return r=Math.min(s,r),r=Jd(r),r}function tp({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Qf(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Zd(u!=null,`Invalid first pivot index`),Zd(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Zd(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Zd(n!=null,`Previous layout not found for panel index ${t}`),Qf(n,i)){let t=o-n;$f(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Zd(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Zd(n!=null,`Previous layout not found for panel index ${t}`),Qf(n,o)){let t=n-i;$f(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Zd(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&$f(i,c)<0){if(e>0){let t=c-o,n=t/2;$f(i+e,c)<0&&(e=$f(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;$f(i-e,c)<0&&(e=$f(100+e,n)>0?0:-t)}}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];Zd(e!=null,`Previous layout not found for panel index ${r}`);let a=ep({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];Zd(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=ep({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Qf(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(Zf(c,l))return i;{let t=e<0?d:u,r=s[t];Zd(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=ep({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Qf(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Zd(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=ep({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Qf(i,s)||(t-=s-i,l[r]=s),Qf(t,0))break;e>0?r--:r++}}}if(!Qf(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function np(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||$f(e[n],t[n])!==0)return!1;return!0}function rp({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!Qf(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Zd(t!=null,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];Zd(i!=null,`No layout data found for index ${e}`);let o=r[e];Zd(o!=null,`No layout data found for index ${e}`);let s=ep({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Qf(a,0))for(let e=0;e<t.length;e++){let n=r[e];Zd(n!=null,`No layout data found for index ${e}`);let i=n+a,o=ep({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Qf(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function ip({groupId:e,panelId:t}){let n=()=>{let t=Nf();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&Qf(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:Jd(100-e)}}return tp({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=rp({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});np(c,u)||Ff(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Qf(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Yd({group:t}),o=Jd(qd({groupSize:a,panelElement:r,styleProp:e})/a*100);s(o)}}}function ap(e){e.defaultPrevented||Xf(e,Nf()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=ip({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function op(e){let t=Nf();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function sp({groupId:e}){let t=()=>{let t=Nf();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=rp({layout:e,panelConstraints:r});return n?o:(np(o,c)||Ff(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function cp(e,t){let n=op(e),r=Mf(n.id,!0),i=n.separators.find(t=>t.element===e);Zd(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Zd(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=sp({groupId:n.id}).getLayout(),c=rp({layout:tp({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});np(s,c)||Ff(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function lp(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=op(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&cp(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&cp(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&cp(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&cp(t,-5);break;case`End`:e.preventDefault(),cp(t,100);break;case`Enter`:{e.preventDefault();let n=op(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Mf(n.id,!0),o=n.separators.find(e=>e.element===t);Zd(o,`Matching separator not found`);let s=a.get(o);Zd(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Zd(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];cp(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=op(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Zd(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),cp(t,-100)}}function up(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Nf(),n=Xf(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),mf({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function dp({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=tp({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(np(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?_f:vf;break;case`vertical`:s|=d<0?yf:bf}}else Ff(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&xf:c|=s&xf,t.movementY===0?c|=o&Sf:c|=s&Sf,pf(c),Df(e)}function fp(e){let t=Nf(),n=df();n.state===`active`&&dp({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function pp(e){if(e.defaultPrevented)return;let t=df(),n=Nf();switch(t.state){case`active`:if(e.buttons===0){mf({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{if(!n.has(e.group))return;let t=Mf(e.group.id,!0);Ff(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}dp({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Xf(e,n);r.length===0?t.state!==`inactive`&&mf({cursorFlags:0,state:`inactive`}):mf({cursorFlags:0,hitRegions:r,state:`hover`}),Df(e.currentTarget);break}}}function mp(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(df().state){case`hover`:mf({cursorFlags:0,state:`inactive`})}}function hp(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||If(e.currentTarget)&&e.preventDefault()}function gp(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Jd(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Jd((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function _p(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Yd({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Jd(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function vp(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function yp(e,t){return e.length===t.length&&e.every((e,n)=>vp(e,t[n]))}function bp({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=Jd(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=Jd((r[e]??0)/a*l);else{let e=Jd(l/c.length);for(let t of c)u[t]=e}return u}function xp(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var Sp=new Map;function Cp(e){let t=!0;Zd(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=Yd({group:e});if(t===0)return;let n=Mf(e.id);if(!n)return;let r=Xd(e),i=n.defaultLayoutDeferred?gp(r):n.layout,a=rp({layout:bp({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&np(n.layout,a)&&yp(n.derivedPanelConstraints,r)&&n.groupSize===t)continue;Ff(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else _p(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Zd(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=Yd({group:e}),s=Xd(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(xp(e.panels,l)||(l=void 0));let u=rp({layout:e.mutableState.layouts[c]??l??gp(s),panelConstraints:s}),d=e.element.ownerDocument;Sp.set(d,(Sp.get(d)??0)+1);let f=new Map;return sf(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Ff(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Zd(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,lp)}),Sp.get(d)===1&&(d.addEventListener(`contextmenu`,Lf,!0),d.addEventListener(`dblclick`,ap,!0),d.addEventListener(`pointerdown`,up,!0),d.addEventListener(`pointerleave`,fp),d.addEventListener(`pointermove`,pp),d.addEventListener(`pointerout`,mp),d.addEventListener(`pointerup`,hp,!0)),function(){t=!1,Sp.set(d,Math.max(0,(Sp.get(d)??0)-1)),Af(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,lp)}),Sp.get(d)||(d.removeEventListener(`contextmenu`,Lf,!0),d.removeEventListener(`dblclick`,ap,!0),d.removeEventListener(`pointerdown`,up,!0),d.removeEventListener(`pointerleave`,fp),d.removeEventListener(`pointermove`,pp),d.removeEventListener(`pointerout`,mp),d.removeEventListener(`pointerup`,hp,!0)),a.disconnect()}}function wp(){let[e,t]=(0,C.useState)({});return[e,(0,C.useCallback)(()=>t({}),[])]}function Tp(e){let t=(0,C.useId)();return`${e??t}`}var Ep=typeof window<`u`?C.useLayoutEffect:C.useEffect;function Dp(e){let t=(0,C.useRef)(e);return Ep(()=>{t.current=e},[e]),(0,C.useCallback)((...e)=>t.current?.(...e),[t])}function Op(...e){return Dp(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t}})})}function kp(e){let t=(0,C.useRef)({...e});return Ep(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Ap=(0,C.createContext)(null);function jp(e,t){let n=(0,C.useRef)({getLayout:()=>({}),setLayout:hf});(0,C.useImperativeHandle)(t,()=>n.current,[]),Ep(()=>{Object.assign(n.current,sp({groupId:e}))})}function Mp({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,C.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Dp(e=>{np(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Dp((e,t)=>{np(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=Tp(s),v=(0,C.useRef)(null),[y,b]=wp(),x=(0,C.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Op(v,a);jp(_,o);let w=Dp((e,t)=>{let r=df(),i=jf(e),a=Mf(e);if(a){let e=!1;return r.state===`active`&&(e=r.hitRegions.some(e=>e.group===i)),{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),T=kp({defaultLayout:n,disableCursor:r}),E=(0,C.useMemo)(()=>({get disableCursor(){return!!T.disableCursor},getPanelStyles:w,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Qd(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Qd(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=jf(_),i=Mf(_);r&&i&&Ff(r,{...i,derivedPanelConstraints:Xd(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[w,_,b,u,T]),D=(0,C.useRef)(null);return Ep(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(T.defaultLayout!==void 0&&Object.keys(T.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=T.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!T.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};D.current=r;let a=Cp(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Mf(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=Pf(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Qf(t.collapsedSize,i[t.panelId]),a=Qf(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=df().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{D.current=null,a(),l()}},[i,_,g,h,u,y,T]),(0,C.useEffect)(()=>{let e=D.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,U.jsx)(Ap.Provider,{value:E,children:(0,U.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}Mp.displayName=`Group`;function Np(e,t){return`react-resizable-panels:${[e,...t].join(`:`)}`}function Pp({id:e,panelIds:t,storage:n}){let r=Np(e,[]),i=n.getItem(r);if(i)try{let e=JSON.parse(i);if(t){let n=e[t.join(`,`)];if(n&&Array.isArray(n.layout)&&t.length===n.layout.length){let e={};for(let r=0;r<t.length;r++)e[t[r]]=n.layout[r];return e}}else{let t=Object.keys(e);if(t.length===1){let n=e[t[0]];if(n&&Array.isArray(n.layout)){let e=t[0].split(`,`);if(e.length===n.layout.length){let t={};for(let r=0;r<e.length;r++)t[e[r]]=n.layout[r];return t}}}}}catch{}}function Fp({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:r=localStorage,...i}){let a=n!==void 0,o=`id`in i?i.id:i.groupId,s=Np(o,n??[]),c=(0,C.useSyncExternalStore)(Ip,()=>r.getItem(s),()=>r.getItem(s)),l=(0,C.useMemo)(()=>{if(c){let e=JSON.parse(c),t=Object.values(e);if(Array.from(t).every(e=>typeof e==`number`))return e}},[c]),u=(0,C.useMemo)(()=>{if(!l)return Pp({id:o,panelIds:n,storage:r})},[l,o,n,r]),d=l??u,f=(0,C.useRef)(null),p=(0,C.useCallback)(()=>{let e=f.current;e&&(f.current=null,clearTimeout(e))},[]);(0,C.useLayoutEffect)(()=>()=>{p()},[p]);let m=(0,C.useCallback)((e,n)=>{if(t&&!n.isUserInteraction)return;p();let i;i=a?Np(o,Object.keys(e)):Np(o,[]);try{r.setItem(i,JSON.stringify(e))}catch(e){console.error(e)}},[p,a,o,t,r]);return{defaultLayout:d,onLayoutChange:(0,C.useCallback)(t=>{p(),e===0?m(t,{isUserInteraction:!1}):f.current=setTimeout(()=>{m(t,{isUserInteraction:!1})},e)},[p,e,m]),onLayoutChanged:m}}function Ip(){return function(){}}function Lp(){let e=(0,C.useContext)(Ap);return Zd(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Rp(e,t){let{id:n}=Lp(),r=(0,C.useRef)({collapse:gf,expand:gf,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:gf});(0,C.useImperativeHandle)(t,()=>r.current,[]),Ep(()=>{Object.assign(r.current,ip({groupId:n,panelId:e}))})}function zp({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=Tp(c),_=kp({disabled:a}),v=(0,C.useRef)(null),y=Op(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:w,updatePanelProps:T}=Lp(),E=d!==null,D=Dp((e,t,n)=>{d?.(e,c,n)});Ep(()=>{let e=v.current;if(e!==null){let t={element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:E?D:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}};return w(t)}},[s,n,r,i,E,g,h,l,u,D,w,_]),(0,C.useEffect)(()=>{T(g,{disabled:a})},[a,g,T]),Rp(g,f);let O=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},ee=(0,C.useSyncExternalStore)(e=>Pf(x,e),O,O),k;return k=ee?JSON.parse(ee):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,U.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Bp,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,U.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}zp.displayName=`Panel`;var Bp={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Vp({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=rp({layout:tp({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=rp({layout:tp({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Hp({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Tp(a),l=kp({disabled:n,disableDoubleClick:r}),[u,d]=(0,C.useState)({}),[f,p]=(0,C.useState)(`inactive`),[m,h]=(0,C.useState)(!1),g=(0,C.useRef)(null),_=Op(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=Lp(),w=b===`horizontal`?`vertical`:`horizontal`;Ep(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=ff(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Pf(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Vp({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,C.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let T;n&&!v&&(T=`not-allowed`);let E;if(n)E=`disabled`;else switch(f){case`active`:E=`active`;break;default:E=m?`focus`:f}return(0,U.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":w,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":E,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:T,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}Hp.displayName=`Separator`;function Up({className:e,...t}){return(0,U.jsx)(Mp,{"data-slot":`resizable-panel-group`,className:H(`flex h-full w-full aria-[orientation=vertical]:flex-col`,e),...t})}function Wp({...e}){return(0,U.jsx)(zp,{"data-slot":`resizable-panel`,...e})}function Gp({withHandle:e,className:t,...n}){return(0,U.jsx)(Hp,{"data-slot":`resizable-handle`,className:H(`bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,t),...n,children:e?(0,U.jsx)(`div`,{className:`bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border`,children:(0,U.jsx)(N,{className:`size-2.5`})}):null})}function Kp({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card`,className:H(`bg-card text-card-foreground flex flex-col gap-4 rounded-xl border py-4 shadow-sm`,e),...t})}function qp({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-header`,className:H(`flex items-center justify-between gap-2 px-4`,e),...t})}function Jp({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-content`,className:H(`px-4`,e),...t})}function Yp({kind:e,description:t,onAllowOnce:n,onAllowAlways:r,onReject:i}){return(0,U.jsxs)(Kp,{className:`my-2 border-amber-500/50`,children:[(0,U.jsxs)(qp,{className:`py-2 text-sm font-medium`,children:[`Permission requested: `,e]}),(0,U.jsxs)(Jp,{className:`pb-3 pt-0`,children:[(0,U.jsx)(`p`,{className:`text-muted-foreground mb-2 text-sm`,children:t}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(Qn,{size:`sm`,variant:`default`,onClick:n,children:`Allow once`}),(0,U.jsx)(Qn,{size:`sm`,variant:`secondary`,onClick:r,children:`Always allow`}),(0,U.jsx)(Qn,{size:`sm`,variant:`outline`,onClick:i,children:`Reject`})]})]})]})}function Xp({name:e,args:t,status:n=`pending`,onApprove:r,onAllowAlways:i,onReject:a}){let o={pending:`bg-muted`,in_progress:`bg-blue-500`,completed:`bg-green-500`,failed:`bg-red-500`}[n];return(0,U.jsxs)(Kp,{className:H(`my-2 border`,n===`pending`&&`border-amber-500/50`),children:[(0,U.jsxs)(qp,{className:`flex flex-row items-center justify-between py-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,U.jsx)(`span`,{className:H(`size-2 rounded-full`,o)}),e]}),(0,U.jsx)(`span`,{className:`text-muted-foreground text-xs uppercase`,children:n})]}),(0,U.jsxs)(Jp,{className:`pb-3 pt-0`,children:[(0,U.jsx)(`pre`,{className:`bg-muted rounded-md p-2 text-xs`,children:JSON.stringify(t,null,2)}),n===`pending`&&(r||i||a)?(0,U.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[r&&(0,U.jsx)(Qn,{size:`sm`,variant:`default`,onClick:r,children:`Allow once`}),i&&(0,U.jsx)(Qn,{size:`sm`,variant:`secondary`,onClick:i,children:`Allow always`}),a&&(0,U.jsx)(Qn,{size:`sm`,variant:`outline`,onClick:a,children:`Reject`})]}):null]})]})}function Zp({open:e,onClose:t,selectedIssueKey:n,boardFilter:r,boardSort:i,boardHide:a,onApplyPreset:o,onSetFilter:s}){let[c,l]=(0,C.useState)(null),[u,d]=(0,C.useState)([]),[f,p]=(0,C.useState)(null),[m,h]=(0,C.useState)([]),[g,_]=(0,C.useState)(``),[v,y]=(0,C.useState)(!1),[b,x]=(0,C.useState)(null),[S,w]=(0,C.useState)(null),[T,E]=(0,C.useState)(null),[D,O]=(0,C.useState)([]),ee=(0,C.useRef)(null);(0,C.useEffect)(()=>{fetch(`/api/agent/config`).then(e=>e.json()).then(e=>{l(e),x(e.defaultAgent);let t=e.agents.find(t=>t.id===e.defaultAgent);w(t?.model??null),e.defaultSkill&&E(e.defaultSkill)}).catch(()=>l({defaultAgent:`cursor`,agents:[]})),fetch(`/api/agent/skills`).then(e=>e.json()).then(d).catch(()=>d([]))},[]),(0,C.useEffect)(()=>{if(!e||f)return;let t=!1;return fetch(`/api/agent/session`,{method:`POST`}).then(e=>e.json()).then(e=>{t||e.sessionId&&p(e.sessionId)}).catch(e=>{t||h(t=>[...t,{role:`agent`,text:`Failed to start session: ${String(e)}`}])}),()=>{t=!0}},[e,f]),(0,C.useEffect)(()=>{if(!f)return;let e=new EventSource(`/api/agent/events?sessionId=${encodeURIComponent(f)}`),t={agent_message_chunk:e=>{let t=e.text??``;h(e=>{let n=e[e.length-1];return n?.role===`agent`?[...e.slice(0,-1),{...n,text:n.text+t}]:[...e,{role:`agent`,text:t}]})},tool_call:e=>{let t=e.name??`unknown`;y(!1),h(n=>[...n,{role:`tool`,requestId:e.requestId??``,name:t,args:e.args??{}}])},tool_result:e=>{let t=e.result;t?.__ui_action===`apply_preset`&&t.preset?o?.(t.preset):t?.__ui_action===`set_filter`&&t.filter&&s?.(t.filter)},request_permission:e=>{let t=e.kind??`unknown`;h(n=>[...n,{role:`permission`,requestId:e.requestId??``,kind:t,description:e.description??``}])},stop_reason:()=>y(!1),error:e=>{y(!1),h(t=>[...t,{role:`agent`,text:`Error: ${e.message??`unknown`}`}])},disconnected:()=>{y(!1),e.close()}};return e.addEventListener(`message`,e=>{let n=JSON.parse(e.data);t[n.type]?.(n)}),()=>e.close()},[f,o,s]);let k=(e,t)=>{f&&fetch(`/api/agent/approve`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:f,requestId:e,decision:t})}).catch(()=>void 0)},A=()=>{if(!f||!g.trim()||v)return;let e=g.trim();_(``),h(t=>[...t,{role:`user`,text:e}]),y(!0);let t=[];for(let e of D)e.kind===`issue`?t.push({type:`text`,text:`Selected issue: ${e.key}`}):e.kind===`board`&&t.push({type:`text`,text:`Current board view: filter=${JSON.stringify(e.filter)}, sort=${e.sort}, hide=${JSON.stringify(e.hide)}`});fetch(`/api/agent/prompt`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:f,prompt:e,skillId:T,context:t.length?t:void 0})}).catch(e=>{y(!1),h(t=>[...t,{role:`agent`,text:`Failed to send: ${String(e)}`}])})},te=()=>{f&&(fetch(`/api/agent/cancel`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:f})}).catch(()=>void 0),y(!1))},j=(e,t)=>{k(e,t),h(n=>n.map(n=>n.role===`tool`&&n.requestId===e?{...n,approved:t!==`reject`}:n))},M=(e,t)=>{k(e,t)},ne=()=>{n&&O(e=>[...e.filter(e=>e.kind!==`issue`),{kind:`issue`,key:n}])},N=()=>{r!=null&&i!=null&&a!=null&&O(e=>[...e.filter(e=>e.kind!==`board`),{kind:`board`,filter:r,sort:i,hide:a}])},P=e=>{O(t=>t.filter(t=>t.kind!==e))};(0,C.useEffect)(()=>{ee.current?.scrollIntoView({behavior:`smooth`})},[m]);let re=(0,C.useMemo)(()=>c?.agents.find(e=>e.id===b)?.id??b,[c,b]),ie=(0,C.useMemo)(()=>S??`Default`,[S]),ae=(0,C.useMemo)(()=>u.find(e=>e.id===T)?.name??T,[u,T]);return e?(0,U.jsx)(Wp,{id:`agent`,defaultSize:`320px`,minSize:`16rem`,maxSize:`50%`,className:`min-h-0`,children:(0,U.jsxs)(Up,{orientation:`vertical`,className:`h-full`,children:[(0,U.jsxs)(`header`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsx)(Qn,{variant:`ghost`,size:`sm`,children:re??`Agent`})}),(0,U.jsx)(Md,{align:`start`,children:c?.agents.map(e=>(0,U.jsx)(Q,{onClick:()=>{x(e.id),w(e.model??null)},children:e.id},e.id))})]}),b&&(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsx)(Qn,{variant:`ghost`,size:`sm`,className:`text-muted-foreground`,children:ie})}),(0,U.jsxs)(Md,{align:`start`,children:[(0,U.jsx)(Q,{onClick:()=>w(null),children:`Default`}),(0,U.jsx)(Q,{onClick:()=>w(`claude-sonnet-4`),children:`Claude Sonnet 4`}),(0,U.jsx)(Q,{onClick:()=>w(`gpt-4.1`),children:`GPT-4.1`})]})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsx)(Qn,{variant:`ghost`,size:`sm`,children:ae??`Skill`})}),(0,U.jsxs)(Md,{align:`end`,children:[(0,U.jsx)(Q,{onClick:()=>E(null),children:`None`}),u.map(e=>(0,U.jsx)(Q,{onClick:()=>E(e.id),children:e.name},e.id))]})]}),(0,U.jsx)(Qn,{variant:`ghost`,size:`icon`,onClick:t,children:`×`})]})]}),(0,U.jsx)(Wp,{className:`min-h-0 flex-1`,children:(0,U.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-3`,children:[m.length===0?(0,U.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Ask the agent about this board or attach a skill.`}):m.map((e,t)=>(0,U.jsx)(C.Fragment,{children:{user:e=>e.role===`user`?(0,U.jsx)(`div`,{className:`mb-2 flex justify-end`,children:(0,U.jsx)(`div`,{className:`bg-primary text-primary-foreground max-w-[80%] rounded-lg px-3 py-2 text-sm`,children:e.text})}):null,agent:e=>e.role===`agent`?(0,U.jsx)(`div`,{className:`mb-2 flex justify-start`,children:(0,U.jsx)(`div`,{className:`bg-muted max-w-[90%] rounded-lg px-3 py-2 text-sm whitespace-pre-wrap`,children:e.text})}):null,tool:e=>e.role===`tool`?(0,U.jsx)(Xp,{name:e.name,args:e.args,status:e.approved===!0?`in_progress`:e.approved===!1?`failed`:`pending`,onApprove:()=>j(e.requestId,`once`),onAllowAlways:()=>j(e.requestId,`always`),onReject:()=>j(e.requestId,`reject`)}):null,permission:e=>e.role===`permission`?(0,U.jsx)(Yp,{kind:e.kind,description:e.description,onAllowOnce:()=>M(e.requestId,`once`),onAllowAlways:()=>M(e.requestId,`always`),onReject:()=>M(e.requestId,`reject`)}):null}[e.role](e,t)},t)),v&&(0,U.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:`Agent is thinking…`}),(0,U.jsx)(`div`,{ref:ee})]}),(0,U.jsxs)(`div`,{className:`border-t p-2`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex flex-wrap gap-1`,children:[T&&(0,U.jsxs)(`span`,{className:`bg-muted inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs`,children:[ae,(0,U.jsx)(`button`,{type:`button`,className:`text-muted-foreground`,onClick:()=>E(null),children:`×`})]}),D.map((e,t)=>(0,U.jsxs)(`span`,{className:`bg-muted inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs`,children:[e.kind===`issue`?`Issue ${e.key}`:e.kind===`board`?`Board view`:e.label,(0,U.jsx)(`button`,{type:`button`,className:`text-muted-foreground`,onClick:()=>P(e.kind),children:`×`})]},`${e.kind}-${t}`))]}),(0,U.jsxs)(`div`,{className:`mb-1 flex flex-wrap gap-1`,children:[n&&!D.some(e=>e.kind===`issue`)&&(0,U.jsx)(Qn,{type:`button`,variant:`ghost`,size:`sm`,onClick:ne,children:`Attach issue`}),r!=null&&i!=null&&a!=null&&!D.some(e=>e.kind===`board`)&&(0,U.jsx)(Qn,{type:`button`,variant:`ghost`,size:`sm`,onClick:N,children:`Attach board view`})]}),(0,U.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),A()},children:[(0,U.jsx)(Vd,{value:g,onChange:e=>_(e.target.value),placeholder:`Ask the agent…`,disabled:v,className:`flex-1`}),v?(0,U.jsx)(Qn,{type:`button`,variant:`secondary`,onClick:te,children:`Stop`}):(0,U.jsx)(Qn,{type:`submit`,disabled:v||!g.trim(),children:`Send`})]})]})]})})]})}):null}function Qp({className:e,...t}){return(0,U.jsx)(`span`,{"data-slot":`avatar`,className:H(`bg-muted text-muted-foreground relative flex size-4 shrink-0 items-center justify-center overflow-hidden rounded-full text-[9px] font-medium`,e),...t})}function $p({className:e,...t}){return(0,U.jsx)(`span`,{"data-slot":`avatar-fallback`,className:H(`flex size-full items-center justify-center`,e),...t})}var em=Object.defineProperty,tm=(e,t)=>em(e,`name`,{value:t,configurable:!0}),nm=`Collapsible`,[rm,im]=lr(nm),[am,om]=rm(nm),sm=C.forwardRef(tm(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=br({prop:r,defaultProp:i??!1,onChange:o,caller:nm});return(0,U.jsx)(am,{scope:n,disabled:a,contentId:Li(),open:c,onOpenToggle:C.useCallback(()=>l(e=>!e),[l]),children:(0,U.jsx)(Or.div,{"data-state":pm(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),cm=`CollapsibleTrigger`,lm=C.forwardRef(tm(function(e,t){let{__scopeCollapsible:n,...r}=e,i=om(cm,n);return(0,U.jsx)(Or.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":pm(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:W(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),um=`CollapsibleContent`,dm=C.forwardRef(tm(function(e,t){let{forceMount:n,...r}=e,i=om(um,e.__scopeCollapsible);return(0,U.jsx)(Cs,{present:n||i.open,children:({present:e})=>(0,U.jsx)(fm,{...r,ref:t,present:e})})},`CollapsibleContent`)),fm=C.forwardRef(tm(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=om(um,n),[s,c]=C.useState(r),l=C.useRef(null),u=nt(t,l),d=C.useRef(0),f=d.current,p=C.useRef(0),m=p.current,h=o.open||s,g=C.useRef(h),_=C.useRef(void 0);return C.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),dr(()=>{let e=l.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,U.jsx)(Or.div,{"data-state":pm(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})},`CollapsibleContentImpl`));function pm(e){return e?`open`:`closed`}tm(pm,`getState`);var mm=sm;function hm({...e}){return(0,U.jsx)(mm,{"data-slot":`collapsible`,...e})}function gm({...e}){return(0,U.jsx)(lm,{"data-slot":`collapsible-trigger`,...e})}function _m({...e}){return(0,U.jsx)(dm,{"data-slot":`collapsible-content`,...e})}function vm(){var e=[...arguments];return(0,C.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var ym=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function bm(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function xm(e){return`nodeType`in e}function Sm(e){return e?bm(e)?e:xm(e)?e.ownerDocument?.defaultView??window:window:window}function Cm(e){let{Document:t}=Sm(e);return e instanceof t}function wm(e){return!bm(e)&&e instanceof Sm(e).HTMLElement}function Tm(e){return e instanceof Sm(e).SVGElement}function Em(e){return e?bm(e)?e.document:xm(e)?Cm(e)?e:wm(e)||Tm(e)?e.ownerDocument:document:document:document}var Dm=ym?C.useLayoutEffect:C.useEffect;function Om(e){let t=(0,C.useRef)(e);return Dm(()=>{t.current=e}),(0,C.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function km(){let e=(0,C.useRef)(null);return[(0,C.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,C.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Am(e,t){t===void 0&&(t=[e]);let n=(0,C.useRef)(e);return Dm(()=>{n.current!==e&&(n.current=e)},t),n}function jm(e,t){let n=(0,C.useRef)();return(0,C.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Mm(e){let t=Om(e),n=(0,C.useRef)(null);return[n,(0,C.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Nm(e){let t=(0,C.useRef)();return(0,C.useEffect)(()=>{t.current=e},[e]),t.current}var Pm={};function Fm(e,t){return(0,C.useMemo)(()=>{if(t)return t;let n=Pm[e]==null?0:Pm[e]+1;return Pm[e]=n,e+`-`+n},[e,t])}function Im(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Lm=Im(1),Rm=Im(-1);function zm(e){return`clientX`in e&&`clientY`in e}function Bm(e){if(!e)return!1;let{KeyboardEvent:t}=Sm(e.target);return t&&e instanceof t}function Vm(e){if(!e)return!1;let{TouchEvent:t}=Sm(e.target);return t&&e instanceof t}function Hm(e){if(Vm(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return zm(e)?{x:e.clientX,y:e.clientY}:null}var Um=Object.freeze({Translate:{toString(e){if(!e)return;let{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;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[Um.Translate.toString(e),Um.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Wm=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Gm(e){return e.matches(Wm)?e:e.querySelector(Wm)}var Km={display:`none`};function qm(e){let{id:t,value:n}=e;return C.createElement(`div`,{id:t,style:Km},n)}function Jm(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return C.createElement(`div`,{id:t,style:{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`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Ym(){let[e,t]=(0,C.useState)(``);return{announce:(0,C.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Xm=(0,C.createContext)(null);function Zm(e){let t=(0,C.useContext)(Xm);(0,C.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Qm(){let[e]=(0,C.useState)(()=>new Set),t=(0,C.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,C.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var $m={draggable:`
52
52
  To pick up a draggable item, press the space bar.
53
53
  While dragging, use the arrow keys to move the item.
54
54
  Press space again to drop the item in its new position, or press escape to cancel.
55
- `},eh={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 th(e){let{announcements:t=eh,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=$m}=e,{announce:a,announcement:o}=Ym(),s=Fm(`DndLiveRegion`),[c,l]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{l(!0)},[]),Zm((0,C.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=C.createElement(C.Fragment,null,C.createElement(qm,{id:r,value:i.draggable}),C.createElement(Jm,{id:s,announcement:o}));return n?(0,Tr.createPortal)(u,n):u}var nh;(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`})(nh||={});function rh(){}function ih(e,t){return(0,C.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function ah(){var e=[...arguments];return(0,C.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var oh=Object.freeze({x:0,y:0});function sh(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function ch(e,t){let n=Hm(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function lh(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function uh(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function dh(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function fh(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}var ph=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=dh(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=dh(r),o=i.reduce((e,t,r)=>e+sh(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(lh)};function mh(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var hh=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=mh(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(uh)};function gh(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function _h(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:oh}function vh(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var yh=vh(1);function bh(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function xh(e,t,n){let r=bh(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var Sh={ignoreTransform:!1};function Ch(e,t){t===void 0&&(t=Sh);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Sm(e).getComputedStyle(e);t&&(n=xh(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function wh(e){return Ch(e,{ignoreTransform:!0})}function Th(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Eh(e,t){return t===void 0&&(t=Sm(e).getComputedStyle(e)),t.position===`fixed`}function Dh(e,t){t===void 0&&(t=Sm(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function Oh(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Cm(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!wm(i)||Tm(i)||n.includes(i))return n;let a=Sm(e).getComputedStyle(i);return i!==e&&Dh(i,a)&&n.push(i),Eh(i,a)?n:r(i.parentNode)}return e?r(e):n}function kh(e){let[t]=Oh(e,1);return t??null}function Ah(e){return!ym||!e?null:bm(e)?e:xm(e)?Cm(e)||e===Em(e).scrollingElement?window:wm(e)?e:null:null}function jh(e){return bm(e)?e.scrollX:e.scrollLeft}function Mh(e){return bm(e)?e.scrollY:e.scrollTop}function Nh(e){return{x:jh(e),y:Mh(e)}}var Ph;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Ph||={});function Fh(e){return!ym||!e?!1:e===document.scrollingElement}function Ih(e){let t={x:0,y:0},n=Fh(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Lh={x:.2,y:.2};function Rh(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Lh);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Ih(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Ph.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Ph.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Ph.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Ph.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function zh(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Bh(e){return e.reduce((e,t)=>Lm(e,Nh(t)),oh)}function Vh(e){return e.reduce((e,t)=>e+jh(t),0)}function Hh(e){return e.reduce((e,t)=>e+Mh(t),0)}function Uh(e,t){if(t===void 0&&(t=Ch),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);kh(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Wh=[[`x`,[`left`,`right`],Vh],[`y`,[`top`,`bottom`],Hh]],Gh=class{constructor(e,t){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;let n=Oh(t),r=Bh(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Wh)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},Kh=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function qh(e){let{EventTarget:t}=Sm(e);return e instanceof t?e:Em(e)}function Jh(e,t){let 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}var Yh;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Yh||={});function Xh(e){e.preventDefault()}function Zh(e){e.stopPropagation()}var $;(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`})($||={});var Qh={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},$h=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},eg=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Kh(Em(t)),this.windowListeners=new Kh(Sm(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Yh.Resize,this.handleCancel),this.windowListeners.add(Yh.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Yh.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Uh(n),t(oh)}handleKeyDown(e){if(Bm(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Qh,coordinateGetter:a=$h,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:oh;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Rm(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Ih(n),p=zh(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===$.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Lm(Rm(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};eg.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Qh,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function tg(e){return!!(e&&`distance`in e)}function ng(e){return!!(e&&`delay`in e)}var rg=class{constructor(e,t,n){n===void 0&&(n=qh(e.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=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Em(i),this.documentListeners=new Kh(this.document),this.listeners=new Kh(n),this.windowListeners=new Kh(Sm(i)),this.initialCoordinates=Hm(r)??oh,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(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Yh.Resize,this.handleCancel),this.windowListeners.add(Yh.DragStart,Xh),this.windowListeners.add(Yh.VisibilityChange,this.handleCancel),this.windowListeners.add(Yh.ContextMenu,Xh),this.documentListeners.add(Yh.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ng(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(tg(t)){this.handlePending(t);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(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Yh.Click,Zh,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Yh.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Hm(e)??oh,s=Rm(n,o);if(!t&&a){if(tg(a)){if(a.tolerance!=null&&Jh(s,a.tolerance))return this.handleCancel();if(Jh(s,a.distance))return this.handleStart()}if(ng(a)&&Jh(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},ig={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},ag=class extends rg{constructor(e){let{event:t}=e,n=Em(t.target);super(e,ig,n)}};ag.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var og={move:{name:`mousemove`},end:{name:`mouseup`}},sg;(function(e){e[e.RightClick=2]=`RightClick`})(sg||={});var cg=class extends rg{constructor(e){super(e,og,Em(e.event.target))}};cg.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==sg.RightClick&&(r?.({event:n}),!0)}}];var lg={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},ug=class extends rg{constructor(e){super(e,lg)}static setup(){return window.addEventListener(lg.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(lg.move.name,e)};function e(){}}};ug.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var dg;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(dg||={});var fg;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(fg||={});function pg(e){let{acceleration:t,activator:n=dg.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=fg.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=hg({delta:d,disabled:!a}),[m,h]=km(),g=(0,C.useRef)({x:0,y:0}),_=(0,C.useRef)({x:0,y:0}),v=(0,C.useMemo)(()=>{switch(n){case dg.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case dg.DraggableRect:return i}},[n,i,c]),y=(0,C.useRef)(null),b=(0,C.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,C.useMemo)(()=>s===fg.TreeOrder?[...l].reverse():l,[s,l]);(0,C.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=Rh(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var mg={x:{[Ph.Backward]:!1,[Ph.Forward]:!1},y:{[Ph.Backward]:!1,[Ph.Forward]:!1}};function hg(e){let{delta:t,disabled:n}=e,r=Nm(t);return jm(e=>{if(n||!r||!e)return mg;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Ph.Backward]:e.x[Ph.Backward]||i.x===-1,[Ph.Forward]:e.x[Ph.Forward]||i.x===1},y:{[Ph.Backward]:e.y[Ph.Backward]||i.y===-1,[Ph.Forward]:e.y[Ph.Forward]||i.y===1}}},[n,t,r])}function gg(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return jm(e=>t==null?null:r??e??null,[r,t])}function _g(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var vg;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(vg||={});var yg;(function(e){e.Optimized=`optimized`})(yg||={});var bg=new Map;function xg(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,C.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,C.useRef)(e),d=g(),f=Am(d),p=(0,C.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,C.useRef)(null),h=jm(t=>{if(d&&!n)return bg;if(!t||t===bg||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Gh(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,C.useEffect)(()=>{u.current=e},[e]),(0,C.useEffect)(()=>{d||p()},[n,d]),(0,C.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,C.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case vg.Always:return!1;case vg.BeforeDragging:return n;default:return!n}}}function Sg(e,t){return jm(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Cg(e,t){return Sg(e,t)}function wg(e){let{callback:t,disabled:n}=e,r=Om(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Tg(e){let{callback:t,disabled:n}=e,r=Om(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Eg(e){return new Gh(Ch(e),e)}function Dg(e,t,n){t===void 0&&(t=Eg);let[r,i]=(0,C.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=wg({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=Tg({callback:a});return Dm(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Og(e){return _h(e,Sg(e))}var kg=[];function Ag(e){let t=(0,C.useRef)(e),n=jm(n=>e?n&&n!==kg&&e&&t.current&&e.parentNode===t.current.parentNode?n:Oh(e):kg,[e]);return(0,C.useEffect)(()=>{t.current=e},[e]),n}function jg(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(e),i=(0,C.useCallback)(e=>{let t=Ah(e.target);t&&n(e=>e?(e.set(t,Nh(t)),new Map(e)):null)},[]);return(0,C.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=Ah(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Nh(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{Ah(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,C.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Lm(e,t),oh):Bh(e):oh,[e,t])}function Mg(e,t){t===void 0&&(t=[]);let n=(0,C.useRef)(null);return(0,C.useEffect)(()=>{n.current=null},t),(0,C.useEffect)(()=>{let t=e!==oh;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Rm(e,n.current):oh}function Ng(e){(0,C.useEffect)(()=>{if(!ym)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Pg(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Fg(e){return(0,C.useMemo)(()=>e?Th(e):null,[e])}var Ig=[];function Lg(e,t){t===void 0&&(t=Ch);let[n]=e,r=Fg(n?Sm(n):null),[i,a]=(0,C.useState)(Ig);function o(){a(()=>e.length?e.map(e=>Fh(e)?r:new Gh(t(e),e)):Ig)}let s=Tg({callback:o});return Dm(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Rg(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return wm(t)?t:e}function zg(e){let{measure:t}=e,[n,r]=(0,C.useState)(null),i=Tg({callback:(0,C.useCallback)(e=>{for(let{target:n}of e)if(wm(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Mm((0,C.useCallback)(e=>{let n=Rg(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,C.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Bg=[{sensor:ag,options:{}},{sensor:eg,options:{}}],Vg={current:{}},Hg={draggable:{measure:wh},droppable:{measure:wh,strategy:vg.WhileDragging,frequency:yg.Optimized},dragOverlay:{measure:Ch}},Ug=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Wg={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ug,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:rh},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Hg,measureDroppableContainers:rh,windowRect:null,measuringScheduled:!1},Gg={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:rh,draggableNodes:new Map,over:null,measureDroppableContainers:rh},Kg=(0,C.createContext)(Gg),qg=(0,C.createContext)(Wg);function Jg(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ug}}}function Yg(e,t){switch(t.type){case nh.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case nh.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 nh.DragEnd:case nh.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case nh.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Ug(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case nh.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Ug(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case nh.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Ug(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Xg(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,C.useContext)(Kg),a=Nm(r),o=Nm(n?.id);return(0,C.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Bm(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Gm(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Zg(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Qg(e){return(0,C.useMemo)(()=>({draggable:{...Hg.draggable,...e?.draggable},droppable:{...Hg.droppable,...e?.droppable},dragOverlay:{...Hg.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function $g(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,C.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Dm(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=_h(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=kh(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var e_=(0,C.createContext)({...oh,scaleX:1,scaleY:1}),t_;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(t_||={});var n_=(0,C.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Bg,collisionDetection:o=hh,measuring:s,modifiers:c,...l}=e,[u,d]=(0,C.useReducer)(Yg,void 0,Jg),[f,p]=Qm(),[m,h]=(0,C.useState)(t_.Uninitialized),g=m===t_.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,C.useRef)({initial:null,translated:null}),w=(0,C.useMemo)(()=>_==null?null:{id:_,data:x?.data??Vg,rect:S},[_,x]),T=(0,C.useRef)(null),[E,D]=(0,C.useState)(null),[O,ee]=(0,C.useState)(null),k=Am(l,Object.values(l)),A=Fm(`DndDescribedBy`,t),te=(0,C.useMemo)(()=>b.getEnabled(),[b]),j=Qg(s),{droppableRects:M,measureDroppableContainers:ne,measuringScheduled:N}=xg(te,{dragging:g,dependencies:[y.x,y.y],config:j.droppable}),P=gg(v,_),re=(0,C.useMemo)(()=>O?Hm(O):null,[O]),ie=je(),ae=Cg(P,j.draggable.measure);$g({activeNode:_==null?null:v.get(_),config:ie.layoutShiftCompensation,initialRect:ae,measure:j.draggable.measure});let F=Dg(P,j.draggable.measure,ae),I=Dg(P?P.parentElement:null),L=(0,C.useRef)({activatorEvent:null,active:null,activeNode:P,collisionRect:null,collisions:null,droppableRects:M,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),oe=b.getNodeFor(L.current.over?.id),R=zg({measure:j.dragOverlay.measure}),se=R.nodeRef.current??P,ce=g?R.rect??F:null,le=!!(R.nodeRef.current&&R.rect),ue=Og(le?null:F),de=Fg(se?Sm(se):null),fe=Ag(g?oe??P:null),pe=Lg(fe),me=Zg(c,{transform:{x:y.x-ue.x,y:y.y-ue.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:F,containerNodeRect:I,draggingNodeRect:ce,over:L.current.over,overlayNodeRect:R.rect,scrollableAncestors:fe,scrollableAncestorRects:pe,windowRect:de}),he=re?Lm(re,y):null,ge=jg(fe),_e=Mg(ge),ve=Mg(ge,[F]),ye=Lm(me,_e),be=ce?yh(ce,me):null,xe=w&&be?o({active:w,collisionRect:be,droppableRects:M,droppableContainers:te,pointerCoordinates:he}):null,Se=fh(xe,`id`),[Ce,we]=(0,C.useState)(null),Te=gh(le?me:Lm(me,ve),Ce?.rect??null,F),Ee=(0,C.useRef)(null),De=(0,C.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent,o=new n({active:T.current,activeNode:i,event:a,options:r,context:L,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,Tr.unstable_batchedUpdates)(()=>{r?.(i),h(t_.Initializing),d({type:nh.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(Ee.current),ee(a)})},onMove(e){d({type:nh.DragMove,coordinates:e})},onEnd:s(nh.DragEnd),onCancel:s(nh.DragCancel)});Ee.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=L.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===nh.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=nh.DragCancel)}T.current=null,(0,Tr.unstable_batchedUpdates)(()=>{d({type:e}),h(t_.Uninitialized),we(null),D(null),ee(null),Ee.current=null;let t=e===nh.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Oe=_g(a,(0,C.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,De(n,t))},[v,De]));Ng(a),Dm(()=>{F&&m===t_.Initializing&&h(t_.Initialized)},[F,m]),(0,C.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=L.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:ye.x,y:ye.y},over:i};(0,Tr.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[ye.x,ye.y]),(0,C.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=L.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(Se),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Tr.unstable_batchedUpdates)(()=>{we(s),a?.(c),f({type:`onDragOver`,event:c})})},[Se]),Dm(()=>{L.current={activatorEvent:O,active:w,activeNode:P,collisionRect:be,collisions:xe,droppableRects:M,draggableNodes:v,draggingNode:se,draggingNodeRect:ce,droppableContainers:b,over:Ce,scrollableAncestors:fe,scrollAdjustedTranslate:ye},S.current={initial:ce,translated:be}},[w,P,xe,be,v,se,ce,M,b,Ce,fe,ye]),pg({...ie,delta:y,draggingRect:be,pointerCoordinates:he,scrollableAncestors:fe,scrollableAncestorRects:pe});let ke=(0,C.useMemo)(()=>({active:w,activeNode:P,activeNodeRect:F,activatorEvent:O,collisions:xe,containerNodeRect:I,dragOverlay:R,draggableNodes:v,droppableContainers:b,droppableRects:M,over:Ce,measureDroppableContainers:ne,scrollableAncestors:fe,scrollableAncestorRects:pe,measuringConfiguration:j,measuringScheduled:N,windowRect:de}),[w,P,F,O,xe,I,R,v,b,M,Ce,ne,fe,pe,j,N,de]),Ae=(0,C.useMemo)(()=>({activatorEvent:O,activators:Oe,active:w,activeNodeRect:F,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:Ce,measureDroppableContainers:ne}),[O,Oe,w,F,d,A,v,Ce,ne]);return C.createElement(Xm.Provider,{value:p},C.createElement(Kg.Provider,{value:Ae},C.createElement(qg.Provider,{value:ke},C.createElement(e_.Provider,{value:Te},i)),C.createElement(Xg,{disabled:n?.restoreFocus===!1})),C.createElement(th,{...n,hiddenTextDescribedById:A}));function je(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),r_=(0,C.createContext)(null),i_=`button`,a_=`Draggable`;function o_(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Fm(a_),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,C.useContext)(Kg),{role:p=i_,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,C.useContext)(g?e_:r_),[v,y]=Mm(),[b,x]=Mm(),S=Pg(o,t),w=Am(n);return Dm(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,C.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===i_?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function s_(){return(0,C.useContext)(qg)}var c_=`Droppable`,l_={timeout:25};function u_(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Fm(c_),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,C.useContext)(Kg),u=(0,C.useRef)({disabled:n}),d=(0,C.useRef)(!1),f=(0,C.useRef)(null),p=(0,C.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...l_,...i},_=Am(h??r),v=Tg({callback:(0,C.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=Mm((0,C.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=Am(t);return(0,C.useEffect)(()=>{v&&y.current&&(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,C.useEffect)(()=>(s({type:nh.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:nh.UnregisterDroppable,key:a,id:r})),[r]),(0,C.useEffect)(()=>{n!==u.current.disabled&&(s({type:nh.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function d_(e){let{animation:t,children:n}=e,[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),s=Nm(n);return!n&&!r&&s&&i(s),Dm(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),C.createElement(C.Fragment,null,n,r?(0,C.cloneElement)(r,{ref:o}):null)}var f_={x:0,y:0,scaleX:1,scaleY:1};function p_(e){let{children:t}=e;return C.createElement(Kg.Provider,{value:Gg},C.createElement(e_.Provider,{value:f_},t))}var m_={position:`fixed`,touchAction:`none`},h_=e=>Bm(e)?`transform 250ms ease`:void 0,g_=(0,C.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=h_}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...m_,width:s.width,height:s.height,top:s.top,left:s.left,transform:Um.Transform.toString(d),transformOrigin:i&&r?ch(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return C.createElement(n,{className:o,style:f,ref:t},a)}),__=e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}},v_={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Um.Transform.toString(t)},{transform:Um.Transform.toString(n)}]},sideEffects:__({styles:{active:{opacity:`0`}}})};function y_(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return Om((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=Rg(a);if(!c)return;let{transform:l}=Sm(a).getComputedStyle(a),u=bh(l);if(!u)return;let d=typeof t==`function`?t:b_(t);return Uh(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function b_(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...v_,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var x_=0;function S_(e){return(0,C.useMemo)(()=>{if(e!=null)return x_++,x_},[e])}var C_=C.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=s_(),S=(0,C.useContext)(e_),w=S_(d?.id),T=Zg(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),E=Sg(f),D=y_({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),O=E?g.setRef:void 0;return C.createElement(p_,null,C.createElement(d_,{animation:D},d&&w?C.createElement(g_,{key:w,id:d.id,ref:O,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:E,style:{zIndex:l,...i},transform:T},n):null))});function w_(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function T_(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function E_(e){return e!==null&&e>=0}function D_(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 O_(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var k_=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=w_(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},A_={scaleX:1,scaleY:1},j_=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...A_}:null}let s=M_(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...A_}:r<t&&r>=a?{x:0,y:o.height+s,...A_}:{x:0,y:0,...A_}};function M_(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var N_=`Sortable`,P_=C.createContext({activeIndex:-1,containerId:N_,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:k_,disabled:{draggable:!1,droppable:!1}});function F_(e){let{children:t,id:n,items:r,strategy:i=k_,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=s_(),d=Fm(N_,n),f=s.rect!==null,p=(0,C.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,C.useRef)(p),v=!D_(p,_.current),y=g!==-1&&h===-1||v,b=O_(a);Dm(()=>{v&&m&&u(p)},[v,p,m,u]),(0,C.useEffect)(()=>{_.current=p},[p]);let x=(0,C.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:T_(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return C.createElement(P_.Provider,{value:x},t)}var I_=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return w_(n,r,i).indexOf(t)},L_=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},R_={duration:200,easing:`ease`},z_=`transform`,B_=Um.Transition.toString({property:z_,duration:0,easing:`linear`}),V_={roleDescription:`sortable`};function H_(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,C.useState)(null),s=(0,C.useRef)(n);return Dm(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=Ch(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,C.useEffect)(()=>{a&&o(null)},[a]),a}function U_(e){let{animateLayoutChanges:t=L_,attributes:n,disabled:r,data:i,getNewIndex:a=I_,id:o,strategy:s,resizeObserverConfig:c,transition:l=R_}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,C.useContext)(P_),y=W_(r,p),b=u.indexOf(o),x=(0,C.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,C.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=u_({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:O,activatorEvent:ee,activeNodeRect:k,attributes:A,setNodeRef:te,listeners:j,isDragging:M,over:ne,setActivatorNodeRef:N,transform:P}=o_({id:o,data:x,attributes:{...V_,...n},disabled:y.draggable}),re=vm(D,te),ie=!!O,ae=ie&&!m&&E_(f)&&E_(g),F=!_&&M,I=ae?(F&&ae?P:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,L=E_(f)&&E_(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,oe=O?.id,R=(0,C.useRef)({activeId:oe,items:u,newIndex:L,containerId:d}),se=u!==R.current.items,ce=t({active:O,containerId:d,isDragging:M,isSorting:ie,id:o,index:b,items:u,newIndex:R.current.newIndex,previousItems:R.current.items,previousContainerId:R.current.containerId,transition:l,wasDragging:R.current.activeId!=null}),le=H_({disabled:!ce,index:b,node:T,rect:w});return(0,C.useEffect)(()=>{ie&&R.current.newIndex!==L&&(R.current.newIndex=L),d!==R.current.containerId&&(R.current.containerId=d),u!==R.current.items&&(R.current.items=u)},[ie,L,d,u]),(0,C.useEffect)(()=>{if(oe===R.current.activeId)return;if(oe!=null&&R.current.activeId==null){R.current.activeId=oe;return}let e=setTimeout(()=>{R.current.activeId=oe},50);return()=>clearTimeout(e)},[oe]),{active:O,activeIndex:f,attributes:A,data:x,rect:w,index:b,newIndex:L,items:u,isOver:E,isSorting:ie,isDragging:M,listeners:j,node:T,overIndex:g,over:ne,setNodeRef:re,setActivatorNodeRef:N,setDroppableNodeRef:D,setDraggableNodeRef:te,transform:le??I,transition:ue()};function ue(){if(le||se&&R.current.newIndex===b)return B_;if(!(F&&!Bm(ee)||!l)&&(ie||ce))return Um.Transition.toString({...l,property:z_})}}function W_(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function G_(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var K_=[$.Down,$.Right,$.Up,$.Left],q_=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(K_.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case $.Down:r.top<a.top&&t.push(n);break;case $.Up:r.top>a.top&&t.push(n);break;case $.Left:r.left>a.left&&t.push(n);break;case $.Right:r.left<a.left&&t.push(n)}});let c=ph({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=fh(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=Oh(c).some((e,t)=>s[t]!==e),i=J_(e,t),a=Y_(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Rm(u,l)}}}};function J_(e,t){return!G_(e)||!G_(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Y_(e,t){return!G_(e)||!G_(t)||!J_(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var X_=(0,C.createContext)({columns:{},setColumns:()=>{},getItemId:()=>``,columnIds:[],activeId:null,setActiveId:()=>{},findContainer:()=>void 0,isColumn:()=>!1,modifiers:void 0}),Z_=(0,C.createContext)({attributes:{},listeners:void 0,isDragging:!1,disabled:!1}),Q_=(0,C.createContext)({listeners:void 0,isDragging:!1,disabled:!1}),$_=(0,C.createContext)(!1),ev=e=>L_({...e,wasDragging:!0}),tv={sideEffects:__({styles:{active:{opacity:`0.4`}}})},nv=()=>()=>{},rv=()=>!0,iv=()=>!1,av={activationConstraint:{distance:10}},ov={activationConstraint:{delay:250,tolerance:5}},sv={coordinateGetter:q_},cv={droppable:{strategy:vg.Always}};function lv({value:e,onValueChange:t,getItemValue:n,children:r,className:i,asChild:a=!1,onMove:o,onValueCommit:s,restoreOnCancel:c=!1,onDragStart:l,onDragEnd:u,onDragCancel:d,accessibility:f,modifiers:p,...m}){let h=e,g=t,[_,v]=(0,C.useState)(null),y=(0,C.useRef)(e),b=(0,C.useRef)(n);(0,C.useLayoutEffect)(()=>{y.current=e,b.current=n});let x=(0,C.useRef)(null),S=ah(ih(cg,av),ih(ug,ov),ih(eg,sv)),w=(0,C.useMemo)(()=>Object.keys(h),[h,n]),T=(0,C.useCallback)(e=>w.includes(e),[w]),E=(0,C.useCallback)(e=>T(e)?e:w.find(t=>h[t].some(t=>n(t)===e)),[h,w,n,T]),D=(0,C.useCallback)((e,t,n)=>{if(!s)return;let r=x.current;if(!r)return;let i=t.active.id;if(n===`column`){let n=Object.keys(e).indexOf(i);if(n===-1||n===r.index)return;s(e,{kind:`column`,event:t,activeContainer:i,activeIndex:r.index,overContainer:String(t.over?.id??i),overIndex:n,previousValue:r.value});return}let a=b.current,o,c=-1;for(let t of Object.keys(e)){let n=e[t].findIndex(e=>a(e)===i);if(n!==-1){o=t,c=n;break}}o!==void 0&&(o!==r.container||c!==r.index)&&s(e,{kind:`item`,event:t,activeContainer:r.container??o,activeIndex:r.index,overContainer:o,overIndex:c,previousValue:r.value})},[s]),O=(0,C.useCallback)(e=>{if(v(e.active.id),l?.(e),s||c){let t=y.current,n=e.active.id,r=Object.keys(t);if(r.includes(n))x.current={value:t,container:n,index:r.indexOf(n)};else{let e=b.current,i,a=-1;for(let o of r){let r=t[o].findIndex(t=>e(t)===n);if(r!==-1){i=o,a=r;break}}x.current={value:t,container:i,index:a}}}},[l,s,c]),ee=(0,C.useCallback)(e=>{if(o)return;let{active:t,over:r}=e;if(!r||T(t.id))return;let i=E(t.id),a=E(r.id);if(i&&a){if(i!==a){let e=h[i],o=h[a],s=e.findIndex(e=>n(e)===t.id),c=o.findIndex(e=>n(e)===r.id);T(r.id)&&(c=o.length);let l=[...e],u=[...o],[d]=l.splice(s,1);u.splice(c,0,d),g({...h,[i]:l,[a]:u})}else{let e=i,a=h[e].findIndex(e=>n(e)===t.id),o=h[e].findIndex(e=>n(e)===r.id);a!==o&&g({...h,[e]:w_(h[e],a,o)})}}},[E,n,T,g,h,o]),k=(0,C.useCallback)(e=>{let t=x.current;c&&t&&!o?g(t.value):s&&t&&!o&&D(y.current,e,`item`),x.current=null,v(null),d?.(e)},[c,o,s,g,d,D]),A=(0,C.useCallback)(e=>{let{active:t,over:r}=e;if(v(null),u?.(e),!r){D(y.current,e,`item`),x.current=null;return}if(o&&!T(t.id)){let i=E(t.id),a=E(r.id);i&&a&&o({event:e,activeContainer:i,activeIndex:h[i].findIndex(e=>n(e)===t.id),overContainer:a,overIndex:T(r.id)?h[a].length:h[a].findIndex(e=>n(e)===r.id)}),x.current=null;return}if(T(t.id)&&T(r.id)){let n=w.indexOf(t.id),i=w.indexOf(r.id);if(n!==i){let t=w_(Object.keys(h),n,i),r={};t.forEach(e=>{r[e]=h[e]}),g(r),D(r,e,`column`)}x.current=null;return}if(T(t.id)){x.current=null;return}let i=E(t.id),a=E(r.id);if(i&&a&&i===a){let a=i,o=h[a].findIndex(e=>n(e)===t.id),s=h[a].findIndex(e=>n(e)===r.id);if(o!==s){let t={...h,[a]:w_(h[a],o,s)};g(t),D(t,e,`item`)}else D(h,e,`item`)}else D(h,e,`item`);x.current=null},[w,h,E,n,T,g,o,u,D]),te=(0,C.useMemo)(()=>({columns:h,setColumns:g,getItemId:n,columnIds:w,activeId:_,setActiveId:v,findContainer:E,isColumn:T,modifiers:p}),[h,g,n,w,_,E,T,p]),j=a?ot:`div`;return(0,U.jsx)(X_.Provider,{value:te,children:(0,U.jsx)(n_,{sensors:S,modifiers:p,accessibility:f,measuring:cv,onDragStart:O,onDragOver:ee,onDragEnd:A,onDragCancel:k,children:(0,U.jsx)(j,{"data-slot":`kanban`,"data-dragging":_!==null,className:H(_!==null&&`cursor-grabbing!`,i),...m,children:r})})})}function uv({className:e,asChild:t=!1,children:n,...r}){let{columnIds:i}=(0,C.useContext)(X_);return(0,U.jsx)(F_,{items:i,strategy:k_,children:(0,U.jsx)(t?ot:`div`,{"data-slot":`kanban-board`,className:H(`grid auto-rows-fr gap-4`,e),...r,children:n})})}function dv({value:e,className:t,asChild:n=!1,disabled:r,children:i,...a}){let o=(0,C.useContext)($_),{setNodeRef:s,transform:c,transition:l,attributes:u,listeners:d,isDragging:f}=U_({id:e,disabled:r||o,animateLayoutChanges:ev}),{activeId:p,isColumn:m}=(0,C.useContext)(X_),h=p?m(p):!1,g={transition:l,transform:Um.Transform.toString(c)},_=n?ot:`div`;return o?(0,U.jsx)(Z_.Provider,{value:{attributes:{},listeners:void 0,isDragging:!0,disabled:!1},children:(0,U.jsx)(_,{"data-slot":`kanban-column`,"data-value":e,"data-dragging":!0,className:H(`group/kanban-column flex flex-col`,t),...a,children:i})}):(0,U.jsx)(Z_.Provider,{value:{attributes:u,listeners:d,isDragging:h,disabled:r},children:(0,U.jsx)(_,{"data-slot":`kanban-column`,"data-value":e,"data-dragging":f,"data-disabled":r,ref:s,style:g,className:H(`group/kanban-column flex flex-col`,f&&`z-50 opacity-50`,r&&`opacity-50`,t),...a,children:i})})}function fv({className:e,asChild:t=!1,cursor:n=!0,children:r,...i}){let{attributes:a,listeners:o,isDragging:s,disabled:c}=(0,C.useContext)(Z_);return(0,U.jsx)(t?ot:`div`,{"data-slot":`kanban-column-handle`,"data-dragging":s,"data-disabled":c,...a,...o,className:H(`opacity-0 transition-opacity group-hover/kanban-column:opacity-100`,n&&(s?`cursor-grabbing!`:`cursor-grab!`),e),...i,children:r})}function pv({value:e,className:t,asChild:n=!1,disabled:r,children:i,...a}){let o=(0,C.useContext)($_),{setNodeRef:s,transform:c,transition:l,attributes:u,listeners:d,isDragging:f}=U_({id:e,disabled:r||o,animateLayoutChanges:ev}),{activeId:p,isColumn:m}=(0,C.useContext)(X_),h=p?!m(p):!1,g={transition:l,transform:Um.Transform.toString(c)},_=n?ot:`div`;return o?(0,U.jsx)(Q_.Provider,{value:{listeners:void 0,isDragging:!0,disabled:!1},children:(0,U.jsx)(_,{"data-slot":`kanban-item`,"data-value":e,"data-dragging":!0,className:H(t),...a,children:i})}):(0,U.jsx)(Q_.Provider,{value:{listeners:d,isDragging:h,disabled:r},children:(0,U.jsx)(_,{"data-slot":`kanban-item`,"data-value":e,"data-dragging":f,"data-disabled":r,ref:s,style:g,...u,className:H(f&&`z-50 opacity-50`,r&&`opacity-50`,t),...a,children:i})})}function mv({className:e,asChild:t=!1,cursor:n=!0,children:r,...i}){let{listeners:a,isDragging:o,disabled:s}=(0,C.useContext)(Q_);return(0,U.jsx)(t?ot:`div`,{"data-slot":`kanban-item-handle`,"data-dragging":o,"data-disabled":s,...a,className:H(n&&(o?`cursor-grabbing!`:`cursor-grab!`),e),...i,children:r})}function hv({value:e,className:t,asChild:n=!1,children:r,...i}){let{columns:a,getItemId:o}=(0,C.useContext)(X_),s=(0,C.useMemo)(()=>{let t=a[e];if(!t)throw Error(`KanbanColumnContent: column "${e}" was not found in the Kanban value. Available columns: ${Object.keys(a).join(`, `)||`(none)`}.`);return t.map(o)},[a,o,e]);return(0,U.jsx)(F_,{items:s,strategy:j_,children:(0,U.jsx)(n?ot:`div`,{"data-slot":`kanban-column-content`,className:H(`flex flex-col gap-2`,t),...i,children:r})})}function gv({children:e,className:t,...n}){let{activeId:r,isColumn:i,modifiers:a}=(0,C.useContext)(X_),o=(0,C.useSyncExternalStore)(nv,rv,iv),s=r&&i(r)?`column`:`item`,c=r&&e?typeof e==`function`?e({value:r,variant:s}):e:null;return o?(0,Tr.createPortal)((0,U.jsx)(C_,{dropAnimation:tv,modifiers:a,className:H(`z-50`,r&&`cursor-grabbing`,t),...n,children:(0,U.jsx)($_.Provider,{value:!0,children:c})}),document.body):null}function _v({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:H(`group/input-group border-input dark:bg-input/30 relative flex h-9 w-full min-w-0 items-center rounded-md border shadow-xs outline-none`,`has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]`,e),...t})}var vv=Ct(`text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm select-none [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-3`,"inline-end":`order-last pr-3`}},defaultVariants:{align:`inline-start`}});function yv({className:e,align:t=`inline-start`,...n}){return(0,U.jsx)(`div`,{"data-slot":`input-group-addon`,className:H(vv({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}function bv({className:e,...t}){return(0,U.jsx)(Vd,{"data-slot":`input-group-control`,className:H(`flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent`,e),...t})}var xv=`collapsed-columns`,Sv=`collapsed-epic-statuses`,Cv=`collapsed-favourite-folders`,wv=`board-chrome`,Tv=`board-opener`,Ev=`favourite-epics`,Dv=`board-presets`,Ov=[`In Progress`,`Completed`,`Cancelled`,`Canceled`],kv={filter:{},sort:`payload`,hide:[]},Av={keys:[],folders:[]};function jv(e=xv,t=[]){try{let n=localStorage.getItem(e);if(n===null)return new Set(t);let r=JSON.parse(n);return new Set(Array.isArray(r)?r.filter(e=>typeof e==`string`):t)}catch{return new Set(t)}}function Mv(e,t=xv){localStorage.setItem(t,JSON.stringify([...e]))}function Nv(e,t){let n=t.toLowerCase();return[...e].some(e=>e.toLowerCase()===n)}function Pv(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e))n!==`priorities`&&n!==`assignees`&&Array.isArray(r)&&(t[n]=r.filter(e=>typeof e==`string`));return Array.isArray(e.priorities)&&!t.priority&&(t.priority=e.priorities.filter(e=>typeof e==`string`)),Array.isArray(e.assignees)&&!t.assignee&&(t.assignee=e.assignees.filter(e=>typeof e==`string`)),t}function Fv(){try{let e=localStorage.getItem(wv);if(e===null)return kv;let t=JSON.parse(e);return{filter:Pv(t.filter),sort:t.sort===`priority`||t.sort===`age`||t.sort===`due`||t.sort===`key`?t.sort:`payload`,hide:Array.isArray(t.hide)?t.hide.filter(e=>typeof e==`string`):[]}}catch{return kv}}function Iv(e){localStorage.setItem(wv,JSON.stringify(e))}function Lv(){try{let e=localStorage.getItem(Ev);if(e===null)return Av;let t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return{keys:t,folders:[]};if(t&&typeof t==`object`){let e=t;return{keys:Array.isArray(e.keys)?e.keys.filter(e=>typeof e==`string`):[],folders:Array.isArray(e.folders)?e.folders.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.name!=`string`||!t.name.trim()?[]:[{name:t.name,keys:Array.isArray(t.keys)?t.keys.filter(e=>typeof e==`string`):[]}]}):[]}}return Av}catch{return Av}}function Rv(e){localStorage.setItem(Ev,JSON.stringify(e))}function zv(){try{let e=localStorage.getItem(Dv);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.name!=`string`||!t.name.trim()?[]:[{name:t.name,filter:Pv(t.filter),sort:t.sort===`priority`||t.sort===`age`||t.sort===`due`||t.sort===`key`?t.sort:`payload`,hide:Array.isArray(t.hide)?t.hide.filter(e=>typeof e==`string`):[]}]}):[]}catch{return[]}}function Bv(e){localStorage.setItem(Dv,JSON.stringify(e))}function Vv(){try{return localStorage.getItem(Tv)===`epics`?`epics`:`stories`}catch{return`stories`}}function Hv(e){localStorage.setItem(Tv,e)}function Uv(e,t){let n=[{label:`Key`,value:e.key},{label:`Summary`,value:e.summary}];return t&&n.push({label:`Jira URL`,value:t}),e.priority&&n.push({label:`Priority`,value:e.priority}),e.assignee&&n.push({label:`Assignee`,value:e.assignee}),e.dueDate&&n.push({label:`Due date`,value:e.dueDate}),e.labels?.length&&n.push({label:`Labels`,value:e.labels.join(`, `),pills:e.labels}),n}async function Wv(e,t){return(await fetch(e,{headers:{"content-type":`application/json`},...t})).json()}function Gv(e){return Object.fromEntries(e.map(e=>[e.title,e.cards]))}function Kv(){return typeof document>`u`?`light`:document.documentElement.classList.contains(`dark`)?`dark`:`light`}function qv(e){document.documentElement.classList.toggle(`dark`,e===`dark`),localStorage.setItem(`theme`,e)}var Jv={done:`green`,complete:`green`,completed:`green`,closed:`green`,resolved:`green`,progress:`yellow`,review:`yellow`,doing:`yellow`,cancelled:`gray`,canceled:`gray`};function Yv(e){if(!e)return`var(--primary)`;let t=e.toLowerCase(),n=Object.keys(Jv).find(e=>t.includes(e));return`var(--kanban-board-circle-${n?Jv[n]:`gray`})`}function Xv(e){let t=(e??``).toLowerCase();return t===`high`||t===`highest`||t===`critical`?`text-red-500`:t===`medium`?`text-orange-400`:`text-yellow-500`}function Zv(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function Qv(e){let t=[];for(let n of e){let e=t.at(-1);n.group&&e?.group===n.group?e.facets.push(n):t.push({group:n.group,facets:[n]})}return t}function $v({facet:e,selected:t,onToggle:n}){return(0,U.jsxs)(U.Fragment,{children:[e.label===e.group?null:(0,U.jsx)(Nd,{children:e.label}),e.values.map(e=>(0,U.jsx)(Pd,{checked:t.includes(e),onCheckedChange:()=>n(e),children:e},e))]})}function ey({facets:e,filter:t,onToggle:n,onClear:r}){let[i,a]=(0,C.useState)({});return(0,U.jsxs)(Md,{align:`end`,className:`w-56`,children:[Qv(e).map((e,r)=>{let o=e.facets.map(e=>(0,U.jsx)($v,{facet:e,selected:t[e.key]??[],onToggle:t=>n(e.key,t)},e.key));return(0,U.jsxs)(C.Fragment,{children:[r>0?(0,U.jsx)(Ld,{}):null,e.group?(0,U.jsxs)(hm,{open:i[e.group]!==!1,onOpenChange:t=>a(n=>({...n,[e.group]:t})),className:`flex flex-col`,children:[(0,U.jsx)(gm,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-[11px] font-medium`,onPointerDown:e=>e.preventDefault(),children:[(0,U.jsx)(A,{className:H(`size-3.5 shrink-0 transition-transform`,i[e.group]===!1&&`-rotate-90`)}),e.group]})}),(0,U.jsx)(_m,{className:`flex flex-col`,children:o})]}):o]},e.group??e.facets[0]?.key)}),e.length?(0,U.jsx)(Ld,{}):null,(0,U.jsx)(Q,{onClick:r,children:`Clear Filter, Sort, and Hide`})]})}function ty({card:e,asHandle:t,isOverlay:n,disabled:r,onOpen:i}){let a=oe(e.created),o=(0,U.jsxs)(`div`,{className:`bg-card hover:bg-foreground/5 rounded-[9px] border px-3 pt-2 pb-3`,children:[(0,U.jsxs)(`div`,{className:`flex h-[22px] items-center justify-between gap-2`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground text-[12px] font-medium tabular-nums`,children:e.key}),(e.type??``).toLowerCase()===`epic`?(0,U.jsx)(`span`,{className:`text-muted-foreground/60 text-[11px] font-normal`,children:`Epic`}):null]}),a?(0,U.jsx)(`span`,{className:`text-muted-foreground text-[11px] tabular-nums`,children:a}):null]}),(0,U.jsx)(`p`,{className:`mt-0.5 truncate text-[13px] leading-[18px]`,children:e.summary}),e.priority||e.labels?.length||e.assignee||e.dueDate?(0,U.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-2 pt-2`,children:[e.priority?(0,U.jsx)(`span`,{className:H(`inline-flex h-6 shrink-0 items-center rounded-full border px-2 text-[12px] font-medium capitalize`,Xv(e.priority)),children:e.priority}):null,e.labels?.map(e=>(0,U.jsx)(`span`,{className:`text-muted-foreground inline-flex h-6 shrink-0 items-center rounded-full border px-2 text-[12px]`,children:e},e)),(0,U.jsx)(`span`,{className:`flex-1`}),e.dueDate?(0,U.jsx)(`time`,{className:`text-muted-foreground shrink-0 text-[11px] tabular-nums`,children:e.dueDate}):null,e.assignee?(0,U.jsx)(Qp,{title:e.assignee,children:(0,U.jsx)($p,{children:e.assignee.charAt(0)})}):null]}):null]});return(0,U.jsx)(pv,{value:e.key,disabled:r,children:t&&!n?(0,U.jsx)(mv,{onClick:i,children:o}):o})}function ny({title:e,cards:t,isOverlay:n,disabled:r,onOpen:i,onHide:a}){let[o,s]=(0,C.useState)(()=>n||!jv().has(e));function c(t){if(s(t),n)return;let r=jv();t?r.delete(e):r.add(e),Mv(r)}return(0,U.jsx)(dv,{value:e,className:`group h-full min-h-0`,children:(0,U.jsx)(hm,{open:o,onOpenChange:c,className:H(`flex h-full min-h-0 flex-col`,!o&&`h-auto`),children:(0,U.jsxs)(`div`,{className:H(`flex flex-col`,o?`h-full min-h-0`:`h-auto`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pt-[13px] pb-5`,children:[(0,U.jsx)(gm,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,children:[(0,U.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-full`,style:{backgroundColor:Yv(e)}}),(0,U.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e}),(0,U.jsx)(`span`,{className:`text-muted-foreground text-[12px] tabular-nums`,children:t.length}),(0,U.jsx)(A,{className:H(`text-muted-foreground size-3.5 shrink-0 transition-transform`,!o&&`-rotate-90`)})]})}),a?(0,U.jsx)(Qn,{size:`icon-xs`,variant:`ghost`,type:`button`,"aria-label":`Hide ${e}`,onClick:a,children:(0,U.jsx)(ne,{})}):null,(0,U.jsx)(fv,{className:`opacity-0 transition-opacity group-hover:opacity-60`,children:(0,U.jsx)(Qn,{size:`icon-xs`,variant:`ghost`,tabIndex:-1,type:`button`,children:(0,U.jsx)(N,{})})})]}),(0,U.jsx)(_m,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,U.jsx)(hv,{value:e,className:`flex h-full flex-col gap-2 overflow-auto px-2 pb-2`,children:t.map(e=>(0,U.jsx)(ty,{card:e,asHandle:!n,isOverlay:n,disabled:r,onOpen:()=>i?.(e.key)},e.key))})})]})})})}function ry(e,t){return[...new Set(e.map(e=>e.status?.trim()).filter(e=>!!e))].filter(e=>e!==t)}function iy({epic:e,selected:t,count:n,favourited:r,folders:i,moveTo:a,onSelect:o,onToggleFavourite:s,onFile:c,onMove:l,onOpen:u}){let d=a??[],f=!!(c&&r),p=!!u||f||d.length>0;return(0,U.jsxs)(`div`,{className:H(`flex h-14 w-full items-center gap-1 rounded-lg pr-1`,t?`bg-sidebar-accent text-sidebar-accent-foreground`:`hover:bg-foreground/5`),children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-3 px-3 text-left`,onClick:()=>void o(e.key),children:[(0,U.jsx)(`span`,{className:`size-2 shrink-0 rounded-full`,style:{backgroundColor:Yv(e.status)}}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] leading-[18px]`,children:e.summary}),(0,U.jsx)(`span`,{className:`text-muted-foreground text-[11px] font-medium tabular-nums`,children:e.key}),(0,U.jsx)(`span`,{className:`text-muted-foreground text-[11px] tabular-nums`,children:n})]}),p?(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsx)(Qn,{size:`icon-xs`,variant:`ghost`,type:`button`,"aria-label":f?`File ${e.key}`:d.length?`Move ${e.key}`:`Open ${e.key}`,children:(0,U.jsx)(M,{})})}),(0,U.jsxs)(Md,{align:`end`,children:[u?(0,U.jsx)(Q,{onClick:()=>u(e.key),children:`Open`}):null,f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Q,{onClick:()=>c?.(e.key,null),children:`Unfiled`}),i?.map(t=>(0,U.jsx)(Q,{onClick:()=>c?.(e.key,t),children:t},t))]}):null,f&&d.length?(0,U.jsxs)(Rd,{children:[(0,U.jsx)(zd,{children:`Move`}),(0,U.jsx)(Bd,{children:d.map(t=>(0,U.jsx)(Q,{onClick:()=>l?.(e.key,t),children:t},t))})]}):null,f?null:d.map(t=>(0,U.jsx)(Q,{onClick:()=>l?.(e.key,t),children:t},t))]})]}):null,(0,U.jsx)(Qn,{size:`icon-xs`,variant:`ghost`,type:`button`,"aria-label":r?`Unfavourite ${e.key}`:`Favourite ${e.key}`,onClick:t=>{t.stopPropagation(),s(e.key)},children:(0,U.jsx)(ae,{className:H(r&&`fill-current`)})})]})}function ay({status:e,epics:t,selectedEpic:n,childCount:r,favourites:i,listedEpics:a,onSelect:o,onToggleFavourite:s,onMove:c,onOpen:l}){let[u,d]=(0,C.useState)(()=>!Nv(jv(Sv,Ov),e));function f(t){d(t);let n=jv(Sv,Ov);if(t)for(let t of[...n])t.toLowerCase()===e.toLowerCase()&&n.delete(t);else n.add(e);Mv(n,Sv)}return(0,U.jsxs)(hm,{open:u,onOpenChange:f,className:`flex flex-col`,children:[(0,U.jsx)(gm,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex h-7 items-center gap-1.5 px-3 text-left`,children:[(0,U.jsx)(A,{className:H(`size-3.5 shrink-0 transition-transform`,!u&&`-rotate-90`)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] font-medium`,children:e}),(0,U.jsx)(`span`,{className:`text-[11px] tabular-nums`,children:t.length})]})}),(0,U.jsx)(_m,{className:`flex flex-col gap-0.5`,children:t.map(e=>(0,U.jsx)(iy,{epic:e,selected:n===e.key,count:r(e.key),favourited:i.keys.includes(e.key),onSelect:o,onToggleFavourite:s,moveTo:ry(a,e.status),onMove:c,onOpen:l},e.key))})]})}function oy({fields:e}){return(0,U.jsx)(`dl`,{className:`flex flex-col gap-3 p-4 text-[13px]`,children:e.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground text-[11px] font-medium`,children:e.label}),(0,U.jsx)(`dd`,{className:`whitespace-pre-wrap`,children:e.label===`Jira URL`?(0,U.jsx)(`a`,{className:`text-foreground font-medium underline-offset-4 hover:underline`,href:e.value,target:`_blank`,rel:`noreferrer`,children:e.value}):e.pills?.length?(0,U.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.pills.map(e=>(0,U.jsx)(`span`,{className:`text-muted-foreground inline-flex h-6 items-center rounded-full border px-2 text-[12px]`,children:e},e))}):e.value})]},e.label))})}function sy(){let[e,t]=(0,C.useState)({}),[n,r]=(0,C.useState)([]),[i,a]=(0,C.useState)(null),[o,s]=(0,C.useState)(!1),[c,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(null),[f,p]=(0,C.useState)(null),[m,h]=(0,C.useState)([]),[g,_]=(0,C.useState)(``),[v,y]=(0,C.useState)(``),[b,x]=(0,C.useState)(``),[S,w]=(0,C.useState)(``),[T,E]=(0,C.useState)(!1),[D,k]=(0,C.useState)(Kv),[A,te]=(0,C.useState)(Fv),[M,ne]=(0,C.useState)(Lv),[N,ae]=(0,C.useState)(zv),[L,oe]=(0,C.useState)(``),[ce,le]=(0,C.useState)(``),[ue,fe]=(0,C.useState)(``),[pe,me]=(0,C.useState)(``),[he,ge]=(0,C.useState)(Vv),_e=(0,C.useRef)(null),ve={...A,epics:n},ye=he===`epics`,be=(0,C.useMemo)(()=>De(e,ye?null:c,b,ve),[e,c,b,A,n,ye]),Se=(0,C.useMemo)(()=>Object.values(e).flat(),[e]),Ce=i??Se,we=(0,C.useMemo)(()=>Ne(n,Ce,b,A.filter),[n,Ce,b,A.filter]),Te=(0,C.useMemo)(()=>Pe(we),[we]),Ee=(0,C.useMemo)(()=>ze(n,M,b,Ce,A.filter),[n,M,b,Ce,A.filter]),Oe=Object.keys(be),ke=u?[`cards`,`open`]:[`cards`],Ae=Fp({id:`shell`,panelIds:[`epics`,`board`],onlySaveAfterUserInteractions:!0}),je=Fp({id:`board-open`,panelIds:ke,onlySaveAfterUserInteractions:!0}),Re=Fp({id:`columns`,panelIds:Oe,onlySaveAfterUserInteractions:!0}),Ge=f?se(f,window.location.origin):null,Ke=xe(Se,n),Qe=Object.keys(e),$e=Ee.unfiled.length>0||Ee.folders.length>0;function et(e){te(e),Iv(e)}function tt(e){ne(e),Rv(e)}function nt(e){ae(e),Bv(e)}function rt(e,n){let i=e.epics??[];t(Gv(n===`epics`?R(i):e.columns)),r(i),a(e.children?Object.values(e.children).flat():null),e.error&&w(e.error)}function it(e){_e.current=e;let n=e.epics??[];t(Gv(he===`epics`?R(n):e.columns)),r(n),a(e.children?Object.values(e.children).flat():null),l(t=>t&&(e.epics??[]).some(e=>e.key===t)?t:null),e.error&&w(e.error)}async function at(){let e=await Wv(`/api/board`);it(e),e.flags&&y(e.flags)}(0,C.useEffect)(()=>{at()},[]);async function ot(){E(!0),w(``);try{it(await Wv(`/api/refresh`,{method:`POST`,body:JSON.stringify({flags:v})}))}catch(e){w(e instanceof Error?e.message:`Refresh failed`)}finally{E(!1)}}async function st(e,t){E(!0),w(``);try{let n=await Wv(`/api/move`,{method:`POST`,body:JSON.stringify({key:e,status:t})});it(n.board),n.ok||w(n.error??`Move failed`)}finally{E(!1)}}async function ct(e){let t=Se.find(t=>t.key===e),r=n.find(t=>t.key===e),i=t??(r?{key:r.key,summary:r.summary,priority:r.priority,assignee:r.assignee,dueDate:r.dueDate,labels:r.labels}:void 0),a=`/browse/${e}`;d(e),p(a),_(``),h(i?Uv(i,a):[{label:`Jira URL`,value:a}]);let o=await Wv(`/api/open`,{method:`POST`,body:JSON.stringify({key:e})});if(p(o.url),o.error){_(o.error),h(i?Uv(i,o.url):[{label:`Jira URL`,value:o.url}]);return}h(o.fields)}function lt(e,n){if(n.kind===`column`||n.activeContainer===n.overContainer||A.hide.includes(n.overContainer)){t(e=>Ie(n.previousValue,e,c,b,ve));return}st(String(n.event.active.id),n.overContainer)}function ut(){let e=D===`dark`?`light`:`dark`;qv(e),k(e)}function dt(e){return Me(Ce,e,b,A.filter,n)}function ft(){Hv(`stories`),ge(`stories`),l(null),_e.current&&rt(_e.current,`stories`)}function pt(){Hv(`epics`),ge(`epics`),l(null),_e.current&&rt(_e.current,`epics`)}async function mt(e){let n=he===`epics`;if(n&&ft(),l(e),e&&!((n&&_e.current?_e.current.columns.flatMap(e=>e.cards):Se).filter(t=>t.epic===e&&de(t,b)).length>0)){E(!0),w(``);try{let n=await Wv(`/api/epic`,{method:`POST`,body:JSON.stringify({key:e})});t(t=>Le(t,Gv(n.columns),e))}catch(e){w(e instanceof Error?e.message:`Epic list failed`)}finally{E(!1)}}}function ht(){let e=Ve(M,L);if(!e.ok){le(`Folder names must be unique`);return}oe(``),le(``),tt(e.state)}function gt(){let e=qe(N,ue,A);if(!e.ok){me(`Preset names must be unique`);return}fe(``),me(``),nt(e.presets)}function _t(e){let t=Je(N,e);t.ok&&(et(t.chrome),he===`epics`&&ft())}function vt(e){let t=Ye(N,e,A);t.ok&&nt(t.presets)}function yt(e,t){let n=Xe(N,e,t);if(!n.ok){me(`Preset names must be unique`);return}me(``),nt(n.presets)}return(0,U.jsx)(`div`,{className:`bg-sidebar flex h-screen`,children:(0,U.jsxs)(Up,{id:`shell`,orientation:`horizontal`,className:`min-h-0 flex-1`,defaultLayout:Ae.defaultLayout,onLayoutChanged:Ae.onLayoutChanged,children:[(0,U.jsx)(Wp,{id:`epics`,defaultSize:`244px`,minSize:`12rem`,maxSize:`40%`,className:`min-h-0`,children:(0,U.jsxs)(`aside`,{className:`text-sidebar-foreground flex h-full min-h-0 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex h-10 items-center justify-between px-4`,children:[(0,U.jsx)(`span`,{className:`text-[13px] font-medium`,children:`pipe-kan`}),(0,U.jsx)(`span`,{className:`text-muted-foreground text-[12px] tabular-nums`,children:we.length})]}),(0,U.jsxs)(`nav`,{className:`flex flex-1 flex-col gap-0.5 overflow-auto px-2 pb-2`,children:[(0,U.jsx)(`button`,{type:`button`,className:H(`h-8 rounded-lg px-3 text-left text-[13px]`,he===`stories`&&c===null?`bg-sidebar-accent text-sidebar-accent-foreground`:`hover:bg-foreground/5`),onClick:ft,children:`All stories`}),(0,U.jsx)(`button`,{type:`button`,className:H(`h-8 rounded-lg px-3 text-left text-[13px]`,he===`epics`?`bg-sidebar-accent text-sidebar-accent-foreground`:`hover:bg-foreground/5`),onClick:pt,children:`All epics`}),$e?(0,U.jsx)(cy,{pane:Ee,selectedEpic:c,childCount:dt,favourites:M,folderName:L,folderError:ce,onFolderName:oe,onCreateFolder:ht,onRenameFolder:(e,t)=>{let n=He(M,e,t);if(!n.ok){le(`Folder names must be unique`);return}le(``),tt(n.state)},onDeleteFolder:e=>tt(Ue(M,e)),listedEpics:n,onSelect:mt,onToggleFavourite:e=>tt(Be(M,e)),onFile:(e,t)=>tt(We(M,e,t)),onMove:st,onOpen:ct}):null,(0,U.jsx)(uy,{presets:N,presetName:ue,presetError:pe,onPresetName:fe,onCreatePreset:gt,onApplyPreset:_t,onOverwritePreset:vt,onRenamePreset:yt,onDeletePreset:e=>nt(Ze(N,e))}),(0,U.jsx)(`div`,{className:`text-muted-foreground px-3 pt-3 pb-1 text-[11px] font-medium`,children:`Epics`}),Te.map(e=>e.status?(0,U.jsx)(ay,{status:e.status,epics:e.epics,selectedEpic:c,childCount:dt,favourites:M,listedEpics:n,onSelect:mt,onToggleFavourite:e=>tt(Be(M,e)),onMove:st,onOpen:ct},e.status):e.epics.map(e=>(0,U.jsx)(iy,{epic:e,selected:c===e.key,count:dt(e.key),favourited:M.keys.includes(e.key),moveTo:ry(n,e.status),onSelect:mt,onToggleFavourite:e=>tt(Be(M,e)),onMove:st,onOpen:ct},e.key)))]})]})}),(0,U.jsx)(Gp,{}),(0,U.jsx)(Wp,{id:`board`,defaultSize:`80%`,minSize:`24rem`,className:`min-h-0`,children:(0,U.jsx)(`div`,{className:`flex h-full min-h-0 flex-col p-2 pl-0`,children:(0,U.jsxs)(`div`,{className:`bg-background flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border`,children:[(0,U.jsxs)(`header`,{className:`flex min-h-11 shrink-0 flex-wrap items-center gap-2 px-3`,children:[(0,U.jsx)(`strong`,{className:`text-[13px] font-medium`,children:`Board`}),(0,U.jsxs)(_v,{className:`h-7 max-w-72 min-w-40 flex-1 border-transparent bg-muted shadow-none`,children:[(0,U.jsx)(yv,{children:(0,U.jsx)(ie,{className:`size-3.5`})}),(0,U.jsx)(bv,{value:b,onChange:e=>x(e.target.value),placeholder:`Search Epics and Cards`,"aria-label":`Search`,className:`h-7 text-[13px]`}),b?(0,U.jsx)(yv,{align:`inline-end`,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,onClick:()=>x(``),children:(0,U.jsx)(I,{className:`size-3.5`})})}):null]}),(0,U.jsx)(`input`,{className:`placeholder:text-muted-foreground h-7 min-w-40 flex-1 rounded-md bg-muted px-2.5 text-[13px] outline-none`,value:v,onChange:e=>y(e.target.value),placeholder:`Scope flags`,spellCheck:!1,"aria-label":`Scope flags`}),(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsxs)(Qn,{variant:`ghost`,size:`sm`,children:[(0,U.jsx)(P,{}),`Filter`]})}),(0,U.jsx)(ey,{facets:Ke,filter:A.filter,onToggle:(e,t)=>et({...A,filter:{...A.filter,[e]:Zv(A.filter[e]??[],t)}}),onClear:()=>et(kv)})]}),(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsxs)(Qn,{variant:`ghost`,size:`sm`,children:[(0,U.jsx)(O,{}),`Sort`]})}),(0,U.jsx)(Md,{align:`end`,children:(0,U.jsxs)(Fd,{value:A.sort,onValueChange:e=>et({...A,sort:e}),children:[(0,U.jsx)(Id,{value:`payload`,children:`Payload order`}),(0,U.jsx)(Id,{value:`priority`,children:`Priority`}),(0,U.jsx)(Id,{value:`age`,children:`Age`}),(0,U.jsx)(Id,{value:`due`,children:`Due date`}),(0,U.jsx)(Id,{value:`key`,children:`Key`})]})})]}),(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsxs)(Qn,{variant:`ghost`,size:`sm`,children:[(0,U.jsx)(j,{}),`Columns`]})}),(0,U.jsx)(Md,{align:`end`,children:Qe.map(e=>(0,U.jsx)(Pd,{checked:!A.hide.includes(e),onCheckedChange:t=>et({...A,hide:t?A.hide.filter(t=>t!==e):[...A.hide,e]}),children:e},e))})]}),(0,U.jsx)(Qn,{variant:`ghost`,size:`sm`,onClick:()=>void ot(),disabled:T,children:`Refresh`}),(0,U.jsxs)(Qn,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),"aria-pressed":o,children:[(0,U.jsx)(ee,{className:`mr-1 size-4`}),`Agent`]}),(0,U.jsx)(Qn,{variant:`ghost`,size:`icon-xs`,onClick:ut,"aria-label":D===`dark`?`Switch to light mode`:`Switch to dark mode`,children:D===`dark`?(0,U.jsx)(F,{}):(0,U.jsx)(re,{})}),S?(0,U.jsx)(`p`,{className:`text-destructive w-full text-[13px] whitespace-pre-wrap`,children:S}):null]}),(0,U.jsxs)(Up,{id:`board-open`,orientation:`horizontal`,className:`min-h-0 flex-1`,defaultLayout:je.defaultLayout,onLayoutChanged:je.onLayoutChanged,children:[(0,U.jsx)(Wp,{id:`cards`,defaultSize:u?`70%`:`100%`,minSize:`16rem`,className:`min-h-0`,children:(0,U.jsx)(`main`,{className:`h-full min-h-0 min-w-0 overflow-auto px-2 pb-2`,children:(0,U.jsxs)(lv,{className:`h-full min-h-0`,value:be,onValueChange:e=>t(t=>Fe(e,t,c,b,ve)),getItemValue:e=>e.key,restoreOnCancel:!0,onValueCommit:lt,children:[(0,U.jsx)(uv,{className:`grid h-full min-h-0 grid-cols-1 auto-rows-fr gap-3`,children:Oe.length?(0,U.jsx)(Up,{id:`columns`,orientation:`horizontal`,className:`min-h-0`,defaultLayout:Re.defaultLayout,onLayoutChanged:Re.onLayoutChanged,children:Object.entries(be).map(([e,t],n,r)=>(0,U.jsxs)(C.Fragment,{children:[n>0?(0,U.jsx)(Gp,{}):null,(0,U.jsx)(Wp,{id:e,defaultSize:`${100/Math.max(r.length,1)}%`,minSize:`16rem`,className:`min-h-0 min-w-0`,children:(0,U.jsx)(ny,{title:e,cards:t,disabled:T,onOpen:e=>void ct(e),onHide:()=>et({...A,hide:[...A.hide,e]})})})]},e))}):null}),(0,U.jsx)(gv,{children:({value:e,variant:t})=>{if(t===`column`)return(0,U.jsx)(ny,{title:String(e),cards:be[String(e)]??[],isOverlay:!0});let n=Object.values(be).flat().find(t=>t.key===e);return n?(0,U.jsx)(ty,{card:n,isOverlay:!0}):null}})]})})}),u?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Gp,{}),(0,U.jsx)(Wp,{id:`open`,defaultSize:`30%`,minSize:`16rem`,className:`min-h-0`,children:(0,U.jsxs)(`aside`,{className:`flex h-full min-h-0 flex-col border-l`,children:[(0,U.jsxs)(`div`,{className:`flex h-10 items-center gap-2 px-3`,children:[(0,U.jsx)(`a`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium underline-offset-4 hover:underline`,href:f??void 0,target:`_blank`,rel:`noreferrer`,children:u}),(0,U.jsx)(Qn,{variant:`ghost`,size:`icon-xs`,"aria-label":`Close issue`,onClick:()=>{d(null),p(null),h([]),_(``)},children:(0,U.jsx)(I,{})})]}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[g?(0,U.jsx)(`p`,{className:`text-destructive px-4 pt-3 text-[13px] whitespace-pre-wrap`,children:g}):null,(0,U.jsx)(oy,{fields:m}),Ge?(0,U.jsx)(`iframe`,{title:u??`Issue`,src:Ge,className:`min-h-64 w-full border-0 bg-background`}):f?(0,U.jsx)(`div`,{className:`text-muted-foreground px-4 pb-6 text-[13px]`,children:`Jira refuses to embed this page.`}):null]})]})})]}):null]})]})})}),o?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Gp,{}),(0,U.jsx)(Zp,{open:o,onClose:()=>s(!1)})]}):null]})})}function cy({pane:e,selectedEpic:t,childCount:n,favourites:r,folderName:i,folderError:a,onFolderName:o,onCreateFolder:s,onRenameFolder:c,onDeleteFolder:l,listedEpics:u,onSelect:d,onToggleFavourite:f,onFile:p,onMove:m,onOpen:h}){let[g,_]=(0,C.useState)(()=>!Nv(jv(Sv,Ov),`Favourites`));function v(e){_(e);let t=jv(Sv,Ov);if(e)for(let e of[...t])e.toLowerCase()===`favourites`&&t.delete(e);else t.add(`Favourites`);Mv(t,Sv)}let y=r.folders.map(e=>e.name);return(0,U.jsxs)(hm,{open:g,onOpenChange:v,className:`flex flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1 px-1`,children:[(0,U.jsx)(gm,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex h-7 min-w-0 flex-1 items-center gap-1.5 px-2 text-left`,children:[(0,U.jsx)(A,{className:H(`size-3.5 shrink-0 transition-transform`,!g&&`-rotate-90`)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] font-medium`,children:`Favourites`})]})}),(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsx)(Qn,{size:`icon-xs`,variant:`ghost`,type:`button`,"aria-label":`Favourite Folders`,children:(0,U.jsx)(M,{})})}),(0,U.jsxs)(Md,{align:`start`,className:`w-56`,children:[(0,U.jsx)(Nd,{children:`Create Folder`}),(0,U.jsxs)(`div`,{className:`px-2 pb-2`,children:[(0,U.jsx)(`input`,{className:`border-input h-7 w-full rounded-md border bg-transparent px-2 text-[13px] outline-none`,value:i,onChange:e=>o(e.target.value),placeholder:`Name`,"aria-label":`Folder name`,onKeyDown:e=>{e.key===`Enter`&&s()}}),a?(0,U.jsx)(`p`,{className:`text-destructive pt-1 text-[11px]`,children:a}):null]}),(0,U.jsx)(Q,{onClick:s,children:`Create`}),y.length?(0,U.jsx)(Ld,{}):null,y.map(e=>(0,U.jsxs)(Q,{onClick:()=>{let t=window.prompt(`Rename Folder`,e);t!=null&&c(e,t)},children:[`Rename `,e]},`rename-${e}`)),y.map(e=>(0,U.jsxs)(Q,{onClick:()=>l(e),children:[`Delete `,e]},`delete-${e}`))]})]})]}),(0,U.jsxs)(_m,{className:`flex flex-col gap-0.5`,children:[e.unfiled.map(e=>(0,U.jsx)(iy,{epic:e,selected:t===e.key,count:n(e.key),favourited:!0,folders:y,onSelect:d,onToggleFavourite:f,onFile:p,moveTo:ry(u,e.status),onMove:m,onOpen:h},e.key)),e.folders.map(e=>(0,U.jsx)(ly,{folder:e,selectedEpic:t,childCount:n,folderNames:y,listedEpics:u,onSelect:d,onToggleFavourite:f,onFile:p,onMove:m,onOpen:h},e.name))]})]})}function ly({folder:e,selectedEpic:t,childCount:n,folderNames:r,listedEpics:i,onSelect:a,onToggleFavourite:o,onFile:s,onMove:c,onOpen:l}){let[u,d]=(0,C.useState)(()=>!Nv(jv(Cv),e.name));function f(t){d(t);let n=jv(Cv);if(t)for(let t of[...n])t.toLowerCase()===e.name.toLowerCase()&&n.delete(t);else n.add(e.name);Mv(n,Cv)}return(0,U.jsxs)(hm,{open:u,onOpenChange:f,className:`flex flex-col`,children:[(0,U.jsx)(gm,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex h-7 items-center gap-1.5 px-3 text-left`,children:[(0,U.jsx)(A,{className:H(`size-3.5 shrink-0 transition-transform`,!u&&`-rotate-90`)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] font-medium`,children:e.name}),(0,U.jsx)(`span`,{className:`text-[11px] tabular-nums`,children:e.epics.length})]})}),(0,U.jsx)(_m,{className:`flex flex-col gap-0.5`,children:e.epics.map(e=>(0,U.jsx)(iy,{epic:e,selected:t===e.key,count:n(e.key),favourited:!0,folders:r,onSelect:a,onToggleFavourite:o,onFile:s,moveTo:ry(i,e.status),onMove:c,onOpen:l},e.key))})]})}function uy({presets:e,presetName:t,presetError:n,onPresetName:r,onCreatePreset:i,onApplyPreset:a,onOverwritePreset:o,onRenamePreset:s,onDeletePreset:c}){let[l,u]=(0,C.useState)(()=>!Nv(jv(Sv,Ov),`Presets`));function d(e){u(e);let t=jv(Sv,Ov);if(e)for(let e of[...t])e.toLowerCase()===`presets`&&t.delete(e);else t.add(`Presets`);Mv(t,Sv)}return(0,U.jsxs)(hm,{open:l,onOpenChange:d,className:`flex flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1 px-1`,children:[(0,U.jsx)(gm,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex h-7 min-w-0 flex-1 items-center gap-1.5 px-2 text-left`,children:[(0,U.jsx)(A,{className:H(`size-3.5 shrink-0 transition-transform`,!l&&`-rotate-90`)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] font-medium`,children:`Presets`})]})}),(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsx)(Qn,{size:`icon-xs`,variant:`ghost`,type:`button`,"aria-label":`Presets`,children:(0,U.jsx)(M,{})})}),(0,U.jsxs)(Md,{align:`start`,className:`w-56`,children:[(0,U.jsx)(Nd,{children:`Save Preset`}),(0,U.jsxs)(`div`,{className:`px-2 pb-2`,children:[(0,U.jsx)(`input`,{className:`border-input h-7 w-full rounded-md border bg-transparent px-2 text-[13px] outline-none`,value:t,onChange:e=>r(e.target.value),placeholder:`Name`,"aria-label":`Preset name`,onKeyDown:e=>{e.key===`Enter`&&i()}}),n?(0,U.jsx)(`p`,{className:`text-destructive pt-1 text-[11px]`,children:n}):null]}),(0,U.jsx)(Q,{onClick:i,children:`Save`})]})]})]}),(0,U.jsx)(_m,{className:`flex flex-col gap-0.5`,children:e.map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(`button`,{type:`button`,className:`hover:bg-foreground/5 flex h-7 min-w-0 flex-1 items-center rounded-lg px-[7px] text-left text-[13px] font-medium`,onClick:()=>a(e.name),children:(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name})}),(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsx)(Qn,{size:`icon-xs`,variant:`ghost`,type:`button`,"aria-label":`Preset ${e.name}`,children:(0,U.jsx)(M,{})})}),(0,U.jsxs)(Md,{align:`end`,children:[(0,U.jsx)(Q,{onClick:()=>o(e.name),children:`Save over`}),(0,U.jsx)(Q,{onClick:()=>{let t=window.prompt(`Rename Preset`,e.name);t!=null&&s(e.name,t)},children:`Rename`}),(0,U.jsx)(Q,{onClick:()=>c(e.name),children:`Delete`})]})]})]},e.name))})]})}(0,L.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(C.StrictMode,{children:(0,U.jsx)(sy,{})}));
55
+ `},eh={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 th(e){let{announcements:t=eh,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=$m}=e,{announce:a,announcement:o}=Ym(),s=Fm(`DndLiveRegion`),[c,l]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{l(!0)},[]),Zm((0,C.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=C.createElement(C.Fragment,null,C.createElement(qm,{id:r,value:i.draggable}),C.createElement(Jm,{id:s,announcement:o}));return n?(0,Tr.createPortal)(u,n):u}var nh;(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`})(nh||={});function rh(){}function ih(e,t){return(0,C.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function ah(){var e=[...arguments];return(0,C.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var oh=Object.freeze({x:0,y:0});function sh(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function ch(e,t){let n=Hm(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function lh(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function uh(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function dh(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function fh(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}var ph=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=dh(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=dh(r),o=i.reduce((e,t,r)=>e+sh(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(lh)};function mh(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var hh=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=mh(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(uh)};function gh(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function _h(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:oh}function vh(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var yh=vh(1);function bh(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function xh(e,t,n){let r=bh(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var Sh={ignoreTransform:!1};function Ch(e,t){t===void 0&&(t=Sh);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Sm(e).getComputedStyle(e);t&&(n=xh(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function wh(e){return Ch(e,{ignoreTransform:!0})}function Th(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Eh(e,t){return t===void 0&&(t=Sm(e).getComputedStyle(e)),t.position===`fixed`}function Dh(e,t){t===void 0&&(t=Sm(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function Oh(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Cm(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!wm(i)||Tm(i)||n.includes(i))return n;let a=Sm(e).getComputedStyle(i);return i!==e&&Dh(i,a)&&n.push(i),Eh(i,a)?n:r(i.parentNode)}return e?r(e):n}function kh(e){let[t]=Oh(e,1);return t??null}function Ah(e){return!ym||!e?null:bm(e)?e:xm(e)?Cm(e)||e===Em(e).scrollingElement?window:wm(e)?e:null:null}function jh(e){return bm(e)?e.scrollX:e.scrollLeft}function Mh(e){return bm(e)?e.scrollY:e.scrollTop}function Nh(e){return{x:jh(e),y:Mh(e)}}var Ph;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Ph||={});function Fh(e){return!ym||!e?!1:e===document.scrollingElement}function Ih(e){let t={x:0,y:0},n=Fh(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Lh={x:.2,y:.2};function Rh(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Lh);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Ih(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Ph.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Ph.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Ph.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Ph.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function zh(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Bh(e){return e.reduce((e,t)=>Lm(e,Nh(t)),oh)}function Vh(e){return e.reduce((e,t)=>e+jh(t),0)}function Hh(e){return e.reduce((e,t)=>e+Mh(t),0)}function Uh(e,t){if(t===void 0&&(t=Ch),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);kh(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Wh=[[`x`,[`left`,`right`],Vh],[`y`,[`top`,`bottom`],Hh]],Gh=class{constructor(e,t){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;let n=Oh(t),r=Bh(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Wh)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},Kh=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function qh(e){let{EventTarget:t}=Sm(e);return e instanceof t?e:Em(e)}function Jh(e,t){let 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}var Yh;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Yh||={});function Xh(e){e.preventDefault()}function Zh(e){e.stopPropagation()}var $;(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`})($||={});var Qh={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},$h=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},eg=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Kh(Em(t)),this.windowListeners=new Kh(Sm(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Yh.Resize,this.handleCancel),this.windowListeners.add(Yh.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Yh.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Uh(n),t(oh)}handleKeyDown(e){if(Bm(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Qh,coordinateGetter:a=$h,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:oh;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Rm(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Ih(n),p=zh(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===$.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Lm(Rm(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};eg.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Qh,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function tg(e){return!!(e&&`distance`in e)}function ng(e){return!!(e&&`delay`in e)}var rg=class{constructor(e,t,n){n===void 0&&(n=qh(e.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=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Em(i),this.documentListeners=new Kh(this.document),this.listeners=new Kh(n),this.windowListeners=new Kh(Sm(i)),this.initialCoordinates=Hm(r)??oh,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(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Yh.Resize,this.handleCancel),this.windowListeners.add(Yh.DragStart,Xh),this.windowListeners.add(Yh.VisibilityChange,this.handleCancel),this.windowListeners.add(Yh.ContextMenu,Xh),this.documentListeners.add(Yh.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ng(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(tg(t)){this.handlePending(t);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(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Yh.Click,Zh,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Yh.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Hm(e)??oh,s=Rm(n,o);if(!t&&a){if(tg(a)){if(a.tolerance!=null&&Jh(s,a.tolerance))return this.handleCancel();if(Jh(s,a.distance))return this.handleStart()}if(ng(a)&&Jh(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},ig={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},ag=class extends rg{constructor(e){let{event:t}=e,n=Em(t.target);super(e,ig,n)}};ag.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var og={move:{name:`mousemove`},end:{name:`mouseup`}},sg;(function(e){e[e.RightClick=2]=`RightClick`})(sg||={});var cg=class extends rg{constructor(e){super(e,og,Em(e.event.target))}};cg.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==sg.RightClick&&(r?.({event:n}),!0)}}];var lg={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},ug=class extends rg{constructor(e){super(e,lg)}static setup(){return window.addEventListener(lg.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(lg.move.name,e)};function e(){}}};ug.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var dg;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(dg||={});var fg;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(fg||={});function pg(e){let{acceleration:t,activator:n=dg.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=fg.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=hg({delta:d,disabled:!a}),[m,h]=km(),g=(0,C.useRef)({x:0,y:0}),_=(0,C.useRef)({x:0,y:0}),v=(0,C.useMemo)(()=>{switch(n){case dg.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case dg.DraggableRect:return i}},[n,i,c]),y=(0,C.useRef)(null),b=(0,C.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,C.useMemo)(()=>s===fg.TreeOrder?[...l].reverse():l,[s,l]);(0,C.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=Rh(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var mg={x:{[Ph.Backward]:!1,[Ph.Forward]:!1},y:{[Ph.Backward]:!1,[Ph.Forward]:!1}};function hg(e){let{delta:t,disabled:n}=e,r=Nm(t);return jm(e=>{if(n||!r||!e)return mg;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Ph.Backward]:e.x[Ph.Backward]||i.x===-1,[Ph.Forward]:e.x[Ph.Forward]||i.x===1},y:{[Ph.Backward]:e.y[Ph.Backward]||i.y===-1,[Ph.Forward]:e.y[Ph.Forward]||i.y===1}}},[n,t,r])}function gg(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return jm(e=>t==null?null:r??e??null,[r,t])}function _g(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var vg;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(vg||={});var yg;(function(e){e.Optimized=`optimized`})(yg||={});var bg=new Map;function xg(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,C.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,C.useRef)(e),d=g(),f=Am(d),p=(0,C.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,C.useRef)(null),h=jm(t=>{if(d&&!n)return bg;if(!t||t===bg||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Gh(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,C.useEffect)(()=>{u.current=e},[e]),(0,C.useEffect)(()=>{d||p()},[n,d]),(0,C.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,C.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case vg.Always:return!1;case vg.BeforeDragging:return n;default:return!n}}}function Sg(e,t){return jm(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Cg(e,t){return Sg(e,t)}function wg(e){let{callback:t,disabled:n}=e,r=Om(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Tg(e){let{callback:t,disabled:n}=e,r=Om(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Eg(e){return new Gh(Ch(e),e)}function Dg(e,t,n){t===void 0&&(t=Eg);let[r,i]=(0,C.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=wg({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=Tg({callback:a});return Dm(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Og(e){return _h(e,Sg(e))}var kg=[];function Ag(e){let t=(0,C.useRef)(e),n=jm(n=>e?n&&n!==kg&&e&&t.current&&e.parentNode===t.current.parentNode?n:Oh(e):kg,[e]);return(0,C.useEffect)(()=>{t.current=e},[e]),n}function jg(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(e),i=(0,C.useCallback)(e=>{let t=Ah(e.target);t&&n(e=>e?(e.set(t,Nh(t)),new Map(e)):null)},[]);return(0,C.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=Ah(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Nh(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{Ah(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,C.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Lm(e,t),oh):Bh(e):oh,[e,t])}function Mg(e,t){t===void 0&&(t=[]);let n=(0,C.useRef)(null);return(0,C.useEffect)(()=>{n.current=null},t),(0,C.useEffect)(()=>{let t=e!==oh;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Rm(e,n.current):oh}function Ng(e){(0,C.useEffect)(()=>{if(!ym)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Pg(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Fg(e){return(0,C.useMemo)(()=>e?Th(e):null,[e])}var Ig=[];function Lg(e,t){t===void 0&&(t=Ch);let[n]=e,r=Fg(n?Sm(n):null),[i,a]=(0,C.useState)(Ig);function o(){a(()=>e.length?e.map(e=>Fh(e)?r:new Gh(t(e),e)):Ig)}let s=Tg({callback:o});return Dm(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Rg(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return wm(t)?t:e}function zg(e){let{measure:t}=e,[n,r]=(0,C.useState)(null),i=Tg({callback:(0,C.useCallback)(e=>{for(let{target:n}of e)if(wm(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Mm((0,C.useCallback)(e=>{let n=Rg(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,C.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Bg=[{sensor:ag,options:{}},{sensor:eg,options:{}}],Vg={current:{}},Hg={draggable:{measure:wh},droppable:{measure:wh,strategy:vg.WhileDragging,frequency:yg.Optimized},dragOverlay:{measure:Ch}},Ug=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Wg={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ug,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:rh},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Hg,measureDroppableContainers:rh,windowRect:null,measuringScheduled:!1},Gg={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:rh,draggableNodes:new Map,over:null,measureDroppableContainers:rh},Kg=(0,C.createContext)(Gg),qg=(0,C.createContext)(Wg);function Jg(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ug}}}function Yg(e,t){switch(t.type){case nh.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case nh.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 nh.DragEnd:case nh.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case nh.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Ug(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case nh.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Ug(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case nh.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Ug(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Xg(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,C.useContext)(Kg),a=Nm(r),o=Nm(n?.id);return(0,C.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Bm(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Gm(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Zg(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Qg(e){return(0,C.useMemo)(()=>({draggable:{...Hg.draggable,...e?.draggable},droppable:{...Hg.droppable,...e?.droppable},dragOverlay:{...Hg.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function $g(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,C.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Dm(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=_h(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=kh(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var e_=(0,C.createContext)({...oh,scaleX:1,scaleY:1}),t_;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(t_||={});var n_=(0,C.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Bg,collisionDetection:o=hh,measuring:s,modifiers:c,...l}=e,[u,d]=(0,C.useReducer)(Yg,void 0,Jg),[f,p]=Qm(),[m,h]=(0,C.useState)(t_.Uninitialized),g=m===t_.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,C.useRef)({initial:null,translated:null}),w=(0,C.useMemo)(()=>_==null?null:{id:_,data:x?.data??Vg,rect:S},[_,x]),T=(0,C.useRef)(null),[E,D]=(0,C.useState)(null),[O,ee]=(0,C.useState)(null),k=Am(l,Object.values(l)),A=Fm(`DndDescribedBy`,t),te=(0,C.useMemo)(()=>b.getEnabled(),[b]),j=Qg(s),{droppableRects:M,measureDroppableContainers:ne,measuringScheduled:N}=xg(te,{dragging:g,dependencies:[y.x,y.y],config:j.droppable}),P=gg(v,_),re=(0,C.useMemo)(()=>O?Hm(O):null,[O]),ie=je(),ae=Cg(P,j.draggable.measure);$g({activeNode:_==null?null:v.get(_),config:ie.layoutShiftCompensation,initialRect:ae,measure:j.draggable.measure});let F=Dg(P,j.draggable.measure,ae),I=Dg(P?P.parentElement:null),L=(0,C.useRef)({activatorEvent:null,active:null,activeNode:P,collisionRect:null,collisions:null,droppableRects:M,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),oe=b.getNodeFor(L.current.over?.id),R=zg({measure:j.dragOverlay.measure}),se=R.nodeRef.current??P,ce=g?R.rect??F:null,le=!!(R.nodeRef.current&&R.rect),ue=Og(le?null:F),de=Fg(se?Sm(se):null),fe=Ag(g?oe??P:null),pe=Lg(fe),me=Zg(c,{transform:{x:y.x-ue.x,y:y.y-ue.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:F,containerNodeRect:I,draggingNodeRect:ce,over:L.current.over,overlayNodeRect:R.rect,scrollableAncestors:fe,scrollableAncestorRects:pe,windowRect:de}),he=re?Lm(re,y):null,ge=jg(fe),_e=Mg(ge),ve=Mg(ge,[F]),ye=Lm(me,_e),be=ce?yh(ce,me):null,xe=w&&be?o({active:w,collisionRect:be,droppableRects:M,droppableContainers:te,pointerCoordinates:he}):null,Se=fh(xe,`id`),[Ce,we]=(0,C.useState)(null),Te=gh(le?me:Lm(me,ve),Ce?.rect??null,F),Ee=(0,C.useRef)(null),De=(0,C.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent,o=new n({active:T.current,activeNode:i,event:a,options:r,context:L,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,Tr.unstable_batchedUpdates)(()=>{r?.(i),h(t_.Initializing),d({type:nh.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(Ee.current),ee(a)})},onMove(e){d({type:nh.DragMove,coordinates:e})},onEnd:s(nh.DragEnd),onCancel:s(nh.DragCancel)});Ee.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=L.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===nh.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=nh.DragCancel)}T.current=null,(0,Tr.unstable_batchedUpdates)(()=>{d({type:e}),h(t_.Uninitialized),we(null),D(null),ee(null),Ee.current=null;let t=e===nh.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Oe=_g(a,(0,C.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,De(n,t))},[v,De]));Ng(a),Dm(()=>{F&&m===t_.Initializing&&h(t_.Initialized)},[F,m]),(0,C.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=L.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:ye.x,y:ye.y},over:i};(0,Tr.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[ye.x,ye.y]),(0,C.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=L.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(Se),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Tr.unstable_batchedUpdates)(()=>{we(s),a?.(c),f({type:`onDragOver`,event:c})})},[Se]),Dm(()=>{L.current={activatorEvent:O,active:w,activeNode:P,collisionRect:be,collisions:xe,droppableRects:M,draggableNodes:v,draggingNode:se,draggingNodeRect:ce,droppableContainers:b,over:Ce,scrollableAncestors:fe,scrollAdjustedTranslate:ye},S.current={initial:ce,translated:be}},[w,P,xe,be,v,se,ce,M,b,Ce,fe,ye]),pg({...ie,delta:y,draggingRect:be,pointerCoordinates:he,scrollableAncestors:fe,scrollableAncestorRects:pe});let ke=(0,C.useMemo)(()=>({active:w,activeNode:P,activeNodeRect:F,activatorEvent:O,collisions:xe,containerNodeRect:I,dragOverlay:R,draggableNodes:v,droppableContainers:b,droppableRects:M,over:Ce,measureDroppableContainers:ne,scrollableAncestors:fe,scrollableAncestorRects:pe,measuringConfiguration:j,measuringScheduled:N,windowRect:de}),[w,P,F,O,xe,I,R,v,b,M,Ce,ne,fe,pe,j,N,de]),Ae=(0,C.useMemo)(()=>({activatorEvent:O,activators:Oe,active:w,activeNodeRect:F,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:Ce,measureDroppableContainers:ne}),[O,Oe,w,F,d,A,v,Ce,ne]);return C.createElement(Xm.Provider,{value:p},C.createElement(Kg.Provider,{value:Ae},C.createElement(qg.Provider,{value:ke},C.createElement(e_.Provider,{value:Te},i)),C.createElement(Xg,{disabled:n?.restoreFocus===!1})),C.createElement(th,{...n,hiddenTextDescribedById:A}));function je(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),r_=(0,C.createContext)(null),i_=`button`,a_=`Draggable`;function o_(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Fm(a_),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,C.useContext)(Kg),{role:p=i_,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,C.useContext)(g?e_:r_),[v,y]=Mm(),[b,x]=Mm(),S=Pg(o,t),w=Am(n);return Dm(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,C.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===i_?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function s_(){return(0,C.useContext)(qg)}var c_=`Droppable`,l_={timeout:25};function u_(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Fm(c_),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,C.useContext)(Kg),u=(0,C.useRef)({disabled:n}),d=(0,C.useRef)(!1),f=(0,C.useRef)(null),p=(0,C.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...l_,...i},_=Am(h??r),v=Tg({callback:(0,C.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=Mm((0,C.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=Am(t);return(0,C.useEffect)(()=>{v&&y.current&&(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,C.useEffect)(()=>(s({type:nh.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:nh.UnregisterDroppable,key:a,id:r})),[r]),(0,C.useEffect)(()=>{n!==u.current.disabled&&(s({type:nh.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function d_(e){let{animation:t,children:n}=e,[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),s=Nm(n);return!n&&!r&&s&&i(s),Dm(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),C.createElement(C.Fragment,null,n,r?(0,C.cloneElement)(r,{ref:o}):null)}var f_={x:0,y:0,scaleX:1,scaleY:1};function p_(e){let{children:t}=e;return C.createElement(Kg.Provider,{value:Gg},C.createElement(e_.Provider,{value:f_},t))}var m_={position:`fixed`,touchAction:`none`},h_=e=>Bm(e)?`transform 250ms ease`:void 0,g_=(0,C.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=h_}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...m_,width:s.width,height:s.height,top:s.top,left:s.left,transform:Um.Transform.toString(d),transformOrigin:i&&r?ch(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return C.createElement(n,{className:o,style:f,ref:t},a)}),__=e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}},v_={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Um.Transform.toString(t)},{transform:Um.Transform.toString(n)}]},sideEffects:__({styles:{active:{opacity:`0`}}})};function y_(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return Om((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=Rg(a);if(!c)return;let{transform:l}=Sm(a).getComputedStyle(a),u=bh(l);if(!u)return;let d=typeof t==`function`?t:b_(t);return Uh(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function b_(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...v_,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var x_=0;function S_(e){return(0,C.useMemo)(()=>{if(e!=null)return x_++,x_},[e])}var C_=C.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=s_(),S=(0,C.useContext)(e_),w=S_(d?.id),T=Zg(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),E=Sg(f),D=y_({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),O=E?g.setRef:void 0;return C.createElement(p_,null,C.createElement(d_,{animation:D},d&&w?C.createElement(g_,{key:w,id:d.id,ref:O,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:E,style:{zIndex:l,...i},transform:T},n):null))});function w_(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function T_(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function E_(e){return e!==null&&e>=0}function D_(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 O_(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var k_=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=w_(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},A_={scaleX:1,scaleY:1},j_=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...A_}:null}let s=M_(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...A_}:r<t&&r>=a?{x:0,y:o.height+s,...A_}:{x:0,y:0,...A_}};function M_(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var N_=`Sortable`,P_=C.createContext({activeIndex:-1,containerId:N_,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:k_,disabled:{draggable:!1,droppable:!1}});function F_(e){let{children:t,id:n,items:r,strategy:i=k_,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=s_(),d=Fm(N_,n),f=s.rect!==null,p=(0,C.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,C.useRef)(p),v=!D_(p,_.current),y=g!==-1&&h===-1||v,b=O_(a);Dm(()=>{v&&m&&u(p)},[v,p,m,u]),(0,C.useEffect)(()=>{_.current=p},[p]);let x=(0,C.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:T_(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return C.createElement(P_.Provider,{value:x},t)}var I_=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return w_(n,r,i).indexOf(t)},L_=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},R_={duration:200,easing:`ease`},z_=`transform`,B_=Um.Transition.toString({property:z_,duration:0,easing:`linear`}),V_={roleDescription:`sortable`};function H_(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,C.useState)(null),s=(0,C.useRef)(n);return Dm(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=Ch(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,C.useEffect)(()=>{a&&o(null)},[a]),a}function U_(e){let{animateLayoutChanges:t=L_,attributes:n,disabled:r,data:i,getNewIndex:a=I_,id:o,strategy:s,resizeObserverConfig:c,transition:l=R_}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,C.useContext)(P_),y=W_(r,p),b=u.indexOf(o),x=(0,C.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,C.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=u_({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:O,activatorEvent:ee,activeNodeRect:k,attributes:A,setNodeRef:te,listeners:j,isDragging:M,over:ne,setActivatorNodeRef:N,transform:P}=o_({id:o,data:x,attributes:{...V_,...n},disabled:y.draggable}),re=vm(D,te),ie=!!O,ae=ie&&!m&&E_(f)&&E_(g),F=!_&&M,I=ae?(F&&ae?P:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,L=E_(f)&&E_(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,oe=O?.id,R=(0,C.useRef)({activeId:oe,items:u,newIndex:L,containerId:d}),se=u!==R.current.items,ce=t({active:O,containerId:d,isDragging:M,isSorting:ie,id:o,index:b,items:u,newIndex:R.current.newIndex,previousItems:R.current.items,previousContainerId:R.current.containerId,transition:l,wasDragging:R.current.activeId!=null}),le=H_({disabled:!ce,index:b,node:T,rect:w});return(0,C.useEffect)(()=>{ie&&R.current.newIndex!==L&&(R.current.newIndex=L),d!==R.current.containerId&&(R.current.containerId=d),u!==R.current.items&&(R.current.items=u)},[ie,L,d,u]),(0,C.useEffect)(()=>{if(oe===R.current.activeId)return;if(oe!=null&&R.current.activeId==null){R.current.activeId=oe;return}let e=setTimeout(()=>{R.current.activeId=oe},50);return()=>clearTimeout(e)},[oe]),{active:O,activeIndex:f,attributes:A,data:x,rect:w,index:b,newIndex:L,items:u,isOver:E,isSorting:ie,isDragging:M,listeners:j,node:T,overIndex:g,over:ne,setNodeRef:re,setActivatorNodeRef:N,setDroppableNodeRef:D,setDraggableNodeRef:te,transform:le??I,transition:ue()};function ue(){if(le||se&&R.current.newIndex===b)return B_;if(!(F&&!Bm(ee)||!l)&&(ie||ce))return Um.Transition.toString({...l,property:z_})}}function W_(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function G_(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var K_=[$.Down,$.Right,$.Up,$.Left],q_=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(K_.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case $.Down:r.top<a.top&&t.push(n);break;case $.Up:r.top>a.top&&t.push(n);break;case $.Left:r.left>a.left&&t.push(n);break;case $.Right:r.left<a.left&&t.push(n)}});let c=ph({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=fh(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=Oh(c).some((e,t)=>s[t]!==e),i=J_(e,t),a=Y_(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Rm(u,l)}}}};function J_(e,t){return!G_(e)||!G_(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Y_(e,t){return!G_(e)||!G_(t)||!J_(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var X_=(0,C.createContext)({columns:{},setColumns:()=>{},getItemId:()=>``,columnIds:[],activeId:null,setActiveId:()=>{},findContainer:()=>void 0,isColumn:()=>!1,modifiers:void 0}),Z_=(0,C.createContext)({attributes:{},listeners:void 0,isDragging:!1,disabled:!1}),Q_=(0,C.createContext)({listeners:void 0,isDragging:!1,disabled:!1}),$_=(0,C.createContext)(!1),ev=e=>L_({...e,wasDragging:!0}),tv={sideEffects:__({styles:{active:{opacity:`0.4`}}})},nv=()=>()=>{},rv=()=>!0,iv=()=>!1,av={activationConstraint:{distance:10}},ov={activationConstraint:{delay:250,tolerance:5}},sv={coordinateGetter:q_},cv={droppable:{strategy:vg.Always}};function lv({value:e,onValueChange:t,getItemValue:n,children:r,className:i,asChild:a=!1,onMove:o,onValueCommit:s,restoreOnCancel:c=!1,onDragStart:l,onDragEnd:u,onDragCancel:d,accessibility:f,modifiers:p,...m}){let h=e,g=t,[_,v]=(0,C.useState)(null),y=(0,C.useRef)(e),b=(0,C.useRef)(n);(0,C.useLayoutEffect)(()=>{y.current=e,b.current=n});let x=(0,C.useRef)(null),S=ah(ih(cg,av),ih(ug,ov),ih(eg,sv)),w=(0,C.useMemo)(()=>Object.keys(h),[h,n]),T=(0,C.useCallback)(e=>w.includes(e),[w]),E=(0,C.useCallback)(e=>T(e)?e:w.find(t=>h[t].some(t=>n(t)===e)),[h,w,n,T]),D=(0,C.useCallback)((e,t,n)=>{if(!s)return;let r=x.current;if(!r)return;let i=t.active.id;if(n===`column`){let n=Object.keys(e).indexOf(i);if(n===-1||n===r.index)return;s(e,{kind:`column`,event:t,activeContainer:i,activeIndex:r.index,overContainer:String(t.over?.id??i),overIndex:n,previousValue:r.value});return}let a=b.current,o,c=-1;for(let t of Object.keys(e)){let n=e[t].findIndex(e=>a(e)===i);if(n!==-1){o=t,c=n;break}}o!==void 0&&(o!==r.container||c!==r.index)&&s(e,{kind:`item`,event:t,activeContainer:r.container??o,activeIndex:r.index,overContainer:o,overIndex:c,previousValue:r.value})},[s]),O=(0,C.useCallback)(e=>{if(v(e.active.id),l?.(e),s||c){let t=y.current,n=e.active.id,r=Object.keys(t);if(r.includes(n))x.current={value:t,container:n,index:r.indexOf(n)};else{let e=b.current,i,a=-1;for(let o of r){let r=t[o].findIndex(t=>e(t)===n);if(r!==-1){i=o,a=r;break}}x.current={value:t,container:i,index:a}}}},[l,s,c]),ee=(0,C.useCallback)(e=>{if(o)return;let{active:t,over:r}=e;if(!r||T(t.id))return;let i=E(t.id),a=E(r.id);if(i&&a){if(i!==a){let e=h[i],o=h[a],s=e.findIndex(e=>n(e)===t.id),c=o.findIndex(e=>n(e)===r.id);T(r.id)&&(c=o.length);let l=[...e],u=[...o],[d]=l.splice(s,1);u.splice(c,0,d),g({...h,[i]:l,[a]:u})}else{let e=i,a=h[e].findIndex(e=>n(e)===t.id),o=h[e].findIndex(e=>n(e)===r.id);a!==o&&g({...h,[e]:w_(h[e],a,o)})}}},[E,n,T,g,h,o]),k=(0,C.useCallback)(e=>{let t=x.current;c&&t&&!o?g(t.value):s&&t&&!o&&D(y.current,e,`item`),x.current=null,v(null),d?.(e)},[c,o,s,g,d,D]),A=(0,C.useCallback)(e=>{let{active:t,over:r}=e;if(v(null),u?.(e),!r){D(y.current,e,`item`),x.current=null;return}if(o&&!T(t.id)){let i=E(t.id),a=E(r.id);i&&a&&o({event:e,activeContainer:i,activeIndex:h[i].findIndex(e=>n(e)===t.id),overContainer:a,overIndex:T(r.id)?h[a].length:h[a].findIndex(e=>n(e)===r.id)}),x.current=null;return}if(T(t.id)&&T(r.id)){let n=w.indexOf(t.id),i=w.indexOf(r.id);if(n!==i){let t=w_(Object.keys(h),n,i),r={};t.forEach(e=>{r[e]=h[e]}),g(r),D(r,e,`column`)}x.current=null;return}if(T(t.id)){x.current=null;return}let i=E(t.id),a=E(r.id);if(i&&a&&i===a){let a=i,o=h[a].findIndex(e=>n(e)===t.id),s=h[a].findIndex(e=>n(e)===r.id);if(o!==s){let t={...h,[a]:w_(h[a],o,s)};g(t),D(t,e,`item`)}else D(h,e,`item`)}else D(h,e,`item`);x.current=null},[w,h,E,n,T,g,o,u,D]),te=(0,C.useMemo)(()=>({columns:h,setColumns:g,getItemId:n,columnIds:w,activeId:_,setActiveId:v,findContainer:E,isColumn:T,modifiers:p}),[h,g,n,w,_,E,T,p]),j=a?ot:`div`;return(0,U.jsx)(X_.Provider,{value:te,children:(0,U.jsx)(n_,{sensors:S,modifiers:p,accessibility:f,measuring:cv,onDragStart:O,onDragOver:ee,onDragEnd:A,onDragCancel:k,children:(0,U.jsx)(j,{"data-slot":`kanban`,"data-dragging":_!==null,className:H(_!==null&&`cursor-grabbing!`,i),...m,children:r})})})}function uv({className:e,asChild:t=!1,children:n,...r}){let{columnIds:i}=(0,C.useContext)(X_);return(0,U.jsx)(F_,{items:i,strategy:k_,children:(0,U.jsx)(t?ot:`div`,{"data-slot":`kanban-board`,className:H(`grid auto-rows-fr gap-4`,e),...r,children:n})})}function dv({value:e,className:t,asChild:n=!1,disabled:r,children:i,...a}){let o=(0,C.useContext)($_),{setNodeRef:s,transform:c,transition:l,attributes:u,listeners:d,isDragging:f}=U_({id:e,disabled:r||o,animateLayoutChanges:ev}),{activeId:p,isColumn:m}=(0,C.useContext)(X_),h=p?m(p):!1,g={transition:l,transform:Um.Transform.toString(c)},_=n?ot:`div`;return o?(0,U.jsx)(Z_.Provider,{value:{attributes:{},listeners:void 0,isDragging:!0,disabled:!1},children:(0,U.jsx)(_,{"data-slot":`kanban-column`,"data-value":e,"data-dragging":!0,className:H(`group/kanban-column flex flex-col`,t),...a,children:i})}):(0,U.jsx)(Z_.Provider,{value:{attributes:u,listeners:d,isDragging:h,disabled:r},children:(0,U.jsx)(_,{"data-slot":`kanban-column`,"data-value":e,"data-dragging":f,"data-disabled":r,ref:s,style:g,className:H(`group/kanban-column flex flex-col`,f&&`z-50 opacity-50`,r&&`opacity-50`,t),...a,children:i})})}function fv({className:e,asChild:t=!1,cursor:n=!0,children:r,...i}){let{attributes:a,listeners:o,isDragging:s,disabled:c}=(0,C.useContext)(Z_);return(0,U.jsx)(t?ot:`div`,{"data-slot":`kanban-column-handle`,"data-dragging":s,"data-disabled":c,...a,...o,className:H(`opacity-0 transition-opacity group-hover/kanban-column:opacity-100`,n&&(s?`cursor-grabbing!`:`cursor-grab!`),e),...i,children:r})}function pv({value:e,className:t,asChild:n=!1,disabled:r,children:i,...a}){let o=(0,C.useContext)($_),{setNodeRef:s,transform:c,transition:l,attributes:u,listeners:d,isDragging:f}=U_({id:e,disabled:r||o,animateLayoutChanges:ev}),{activeId:p,isColumn:m}=(0,C.useContext)(X_),h=p?!m(p):!1,g={transition:l,transform:Um.Transform.toString(c)},_=n?ot:`div`;return o?(0,U.jsx)(Q_.Provider,{value:{listeners:void 0,isDragging:!0,disabled:!1},children:(0,U.jsx)(_,{"data-slot":`kanban-item`,"data-value":e,"data-dragging":!0,className:H(t),...a,children:i})}):(0,U.jsx)(Q_.Provider,{value:{listeners:d,isDragging:h,disabled:r},children:(0,U.jsx)(_,{"data-slot":`kanban-item`,"data-value":e,"data-dragging":f,"data-disabled":r,ref:s,style:g,...u,className:H(f&&`z-50 opacity-50`,r&&`opacity-50`,t),...a,children:i})})}function mv({className:e,asChild:t=!1,cursor:n=!0,children:r,...i}){let{listeners:a,isDragging:o,disabled:s}=(0,C.useContext)(Q_);return(0,U.jsx)(t?ot:`div`,{"data-slot":`kanban-item-handle`,"data-dragging":o,"data-disabled":s,...a,className:H(n&&(o?`cursor-grabbing!`:`cursor-grab!`),e),...i,children:r})}function hv({value:e,className:t,asChild:n=!1,children:r,...i}){let{columns:a,getItemId:o}=(0,C.useContext)(X_),s=(0,C.useMemo)(()=>{let t=a[e];if(!t)throw Error(`KanbanColumnContent: column "${e}" was not found in the Kanban value. Available columns: ${Object.keys(a).join(`, `)||`(none)`}.`);return t.map(o)},[a,o,e]);return(0,U.jsx)(F_,{items:s,strategy:j_,children:(0,U.jsx)(n?ot:`div`,{"data-slot":`kanban-column-content`,className:H(`flex flex-col gap-2`,t),...i,children:r})})}function gv({children:e,className:t,...n}){let{activeId:r,isColumn:i,modifiers:a}=(0,C.useContext)(X_),o=(0,C.useSyncExternalStore)(nv,rv,iv),s=r&&i(r)?`column`:`item`,c=r&&e?typeof e==`function`?e({value:r,variant:s}):e:null;return o?(0,Tr.createPortal)((0,U.jsx)(C_,{dropAnimation:tv,modifiers:a,className:H(`z-50`,r&&`cursor-grabbing`,t),...n,children:(0,U.jsx)($_.Provider,{value:!0,children:c})}),document.body):null}function _v({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:H(`group/input-group border-input dark:bg-input/30 relative flex h-9 w-full min-w-0 items-center rounded-md border shadow-xs outline-none`,`has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]`,e),...t})}var vv=Ct(`text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm select-none [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-3`,"inline-end":`order-last pr-3`}},defaultVariants:{align:`inline-start`}});function yv({className:e,align:t=`inline-start`,...n}){return(0,U.jsx)(`div`,{"data-slot":`input-group-addon`,className:H(vv({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}function bv({className:e,...t}){return(0,U.jsx)(Vd,{"data-slot":`input-group-control`,className:H(`flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent`,e),...t})}var xv=`collapsed-columns`,Sv=`collapsed-epic-statuses`,Cv=`collapsed-favourite-folders`,wv=`board-chrome`,Tv=`board-opener`,Ev=`favourite-epics`,Dv=`board-presets`,Ov=[`In Progress`,`Completed`,`Cancelled`,`Canceled`],kv={filter:{},sort:`payload`,hide:[]},Av={keys:[],folders:[]};function jv(e=xv,t=[]){try{let n=localStorage.getItem(e);if(n===null)return new Set(t);let r=JSON.parse(n);return new Set(Array.isArray(r)?r.filter(e=>typeof e==`string`):t)}catch{return new Set(t)}}function Mv(e,t=xv){localStorage.setItem(t,JSON.stringify([...e]))}function Nv(e,t){let n=t.toLowerCase();return[...e].some(e=>e.toLowerCase()===n)}function Pv(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e))n!==`priorities`&&n!==`assignees`&&Array.isArray(r)&&(t[n]=r.filter(e=>typeof e==`string`));return Array.isArray(e.priorities)&&!t.priority&&(t.priority=e.priorities.filter(e=>typeof e==`string`)),Array.isArray(e.assignees)&&!t.assignee&&(t.assignee=e.assignees.filter(e=>typeof e==`string`)),t}function Fv(){try{let e=localStorage.getItem(wv);if(e===null)return kv;let t=JSON.parse(e);return{filter:Pv(t.filter),sort:t.sort===`priority`||t.sort===`age`||t.sort===`due`||t.sort===`key`?t.sort:`payload`,hide:Array.isArray(t.hide)?t.hide.filter(e=>typeof e==`string`):[]}}catch{return kv}}function Iv(e){localStorage.setItem(wv,JSON.stringify(e))}function Lv(){try{let e=localStorage.getItem(Ev);if(e===null)return Av;let t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return{keys:t,folders:[]};if(t&&typeof t==`object`){let e=t;return{keys:Array.isArray(e.keys)?e.keys.filter(e=>typeof e==`string`):[],folders:Array.isArray(e.folders)?e.folders.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.name!=`string`||!t.name.trim()?[]:[{name:t.name,keys:Array.isArray(t.keys)?t.keys.filter(e=>typeof e==`string`):[]}]}):[]}}return Av}catch{return Av}}function Rv(e){localStorage.setItem(Ev,JSON.stringify(e))}function zv(){try{let e=localStorage.getItem(Dv);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.name!=`string`||!t.name.trim()?[]:[{name:t.name,filter:Pv(t.filter),sort:t.sort===`priority`||t.sort===`age`||t.sort===`due`||t.sort===`key`?t.sort:`payload`,hide:Array.isArray(t.hide)?t.hide.filter(e=>typeof e==`string`):[]}]}):[]}catch{return[]}}function Bv(e){localStorage.setItem(Dv,JSON.stringify(e))}function Vv(){try{return localStorage.getItem(Tv)===`epics`?`epics`:`stories`}catch{return`stories`}}function Hv(e){localStorage.setItem(Tv,e)}function Uv(e,t){let n=[{label:`Key`,value:e.key},{label:`Summary`,value:e.summary}];return t&&n.push({label:`Jira URL`,value:t}),e.priority&&n.push({label:`Priority`,value:e.priority}),e.assignee&&n.push({label:`Assignee`,value:e.assignee}),e.dueDate&&n.push({label:`Due date`,value:e.dueDate}),e.labels?.length&&n.push({label:`Labels`,value:e.labels.join(`, `),pills:e.labels}),n}async function Wv(e,t){return(await fetch(e,{headers:{"content-type":`application/json`},...t})).json()}function Gv(e){return Object.fromEntries(e.map(e=>[e.title,e.cards]))}function Kv(){return typeof document>`u`?`light`:document.documentElement.classList.contains(`dark`)?`dark`:`light`}function qv(e){document.documentElement.classList.toggle(`dark`,e===`dark`),localStorage.setItem(`theme`,e)}var Jv={done:`green`,complete:`green`,completed:`green`,closed:`green`,resolved:`green`,progress:`yellow`,review:`yellow`,doing:`yellow`,cancelled:`gray`,canceled:`gray`};function Yv(e){if(!e)return`var(--primary)`;let t=e.toLowerCase(),n=Object.keys(Jv).find(e=>t.includes(e));return`var(--kanban-board-circle-${n?Jv[n]:`gray`})`}function Xv(e){let t=(e??``).toLowerCase();return t===`high`||t===`highest`||t===`critical`?`text-red-500`:t===`medium`?`text-orange-400`:`text-yellow-500`}function Zv(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function Qv(e){let t=[];for(let n of e){let e=t.at(-1);n.group&&e?.group===n.group?e.facets.push(n):t.push({group:n.group,facets:[n]})}return t}function $v({facet:e,selected:t,onToggle:n}){return(0,U.jsxs)(U.Fragment,{children:[e.label===e.group?null:(0,U.jsx)(Nd,{children:e.label}),e.values.map(e=>(0,U.jsx)(Pd,{checked:t.includes(e),onCheckedChange:()=>n(e),children:e},e))]})}function ey({facets:e,filter:t,onToggle:n,onClear:r}){let[i,a]=(0,C.useState)({});return(0,U.jsxs)(Md,{align:`end`,className:`w-56`,children:[Qv(e).map((e,r)=>{let o=e.facets.map(e=>(0,U.jsx)($v,{facet:e,selected:t[e.key]??[],onToggle:t=>n(e.key,t)},e.key));return(0,U.jsxs)(C.Fragment,{children:[r>0?(0,U.jsx)(Ld,{}):null,e.group?(0,U.jsxs)(hm,{open:i[e.group]!==!1,onOpenChange:t=>a(n=>({...n,[e.group]:t})),className:`flex flex-col`,children:[(0,U.jsx)(gm,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-[11px] font-medium`,onPointerDown:e=>e.preventDefault(),children:[(0,U.jsx)(A,{className:H(`size-3.5 shrink-0 transition-transform`,i[e.group]===!1&&`-rotate-90`)}),e.group]})}),(0,U.jsx)(_m,{className:`flex flex-col`,children:o})]}):o]},e.group??e.facets[0]?.key)}),e.length?(0,U.jsx)(Ld,{}):null,(0,U.jsx)(Q,{onClick:r,children:`Clear Filter, Sort, and Hide`})]})}function ty({card:e,asHandle:t,isOverlay:n,disabled:r,onOpen:i}){let a=oe(e.created),o=(0,U.jsxs)(`div`,{className:`bg-card hover:bg-foreground/5 rounded-[9px] border px-3 pt-2 pb-3`,children:[(0,U.jsxs)(`div`,{className:`flex h-[22px] items-center justify-between gap-2`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground text-[12px] font-medium tabular-nums`,children:e.key}),(e.type??``).toLowerCase()===`epic`?(0,U.jsx)(`span`,{className:`text-muted-foreground/60 text-[11px] font-normal`,children:`Epic`}):null]}),a?(0,U.jsx)(`span`,{className:`text-muted-foreground text-[11px] tabular-nums`,children:a}):null]}),(0,U.jsx)(`p`,{className:`mt-0.5 truncate text-[13px] leading-[18px]`,children:e.summary}),e.priority||e.labels?.length||e.assignee||e.dueDate?(0,U.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-2 pt-2`,children:[e.priority?(0,U.jsx)(`span`,{className:H(`inline-flex h-6 shrink-0 items-center rounded-full border px-2 text-[12px] font-medium capitalize`,Xv(e.priority)),children:e.priority}):null,e.labels?.map(e=>(0,U.jsx)(`span`,{className:`text-muted-foreground inline-flex h-6 shrink-0 items-center rounded-full border px-2 text-[12px]`,children:e},e)),(0,U.jsx)(`span`,{className:`flex-1`}),e.dueDate?(0,U.jsx)(`time`,{className:`text-muted-foreground shrink-0 text-[11px] tabular-nums`,children:e.dueDate}):null,e.assignee?(0,U.jsx)(Qp,{title:e.assignee,children:(0,U.jsx)($p,{children:e.assignee.charAt(0)})}):null]}):null]});return(0,U.jsx)(pv,{value:e.key,disabled:r,children:t&&!n?(0,U.jsx)(mv,{onClick:i,children:o}):o})}function ny({title:e,cards:t,isOverlay:n,disabled:r,onOpen:i,onHide:a}){let[o,s]=(0,C.useState)(()=>n||!jv().has(e));function c(t){if(s(t),n)return;let r=jv();t?r.delete(e):r.add(e),Mv(r)}return(0,U.jsx)(dv,{value:e,className:`group h-full min-h-0`,children:(0,U.jsx)(hm,{open:o,onOpenChange:c,className:H(`flex h-full min-h-0 flex-col`,!o&&`h-auto`),children:(0,U.jsxs)(`div`,{className:H(`flex flex-col`,o?`h-full min-h-0`:`h-auto`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pt-[13px] pb-5`,children:[(0,U.jsx)(gm,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,children:[(0,U.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-full`,style:{backgroundColor:Yv(e)}}),(0,U.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e}),(0,U.jsx)(`span`,{className:`text-muted-foreground text-[12px] tabular-nums`,children:t.length}),(0,U.jsx)(A,{className:H(`text-muted-foreground size-3.5 shrink-0 transition-transform`,!o&&`-rotate-90`)})]})}),a?(0,U.jsx)(Qn,{size:`icon-xs`,variant:`ghost`,type:`button`,"aria-label":`Hide ${e}`,onClick:a,children:(0,U.jsx)(ne,{})}):null,(0,U.jsx)(fv,{className:`opacity-0 transition-opacity group-hover:opacity-60`,children:(0,U.jsx)(Qn,{size:`icon-xs`,variant:`ghost`,tabIndex:-1,type:`button`,children:(0,U.jsx)(N,{})})})]}),(0,U.jsx)(_m,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,U.jsx)(hv,{value:e,className:`flex h-full flex-col gap-2 overflow-auto px-2 pb-2`,children:t.map(e=>(0,U.jsx)(ty,{card:e,asHandle:!n,isOverlay:n,disabled:r,onOpen:()=>i?.(e.key)},e.key))})})]})})})}function ry(e,t){return[...new Set(e.map(e=>e.status?.trim()).filter(e=>!!e))].filter(e=>e!==t)}function iy({epic:e,selected:t,count:n,favourited:r,folders:i,moveTo:a,onSelect:o,onToggleFavourite:s,onFile:c,onMove:l,onOpen:u}){let d=a??[],f=!!(c&&r),p=!!u||f||d.length>0;return(0,U.jsxs)(`div`,{className:H(`flex h-14 w-full items-center gap-1 rounded-lg pr-1`,t?`bg-sidebar-accent text-sidebar-accent-foreground`:`hover:bg-foreground/5`),children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-3 px-3 text-left`,onClick:()=>void o(e.key),children:[(0,U.jsx)(`span`,{className:`size-2 shrink-0 rounded-full`,style:{backgroundColor:Yv(e.status)}}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] leading-[18px]`,children:e.summary}),(0,U.jsx)(`span`,{className:`text-muted-foreground text-[11px] font-medium tabular-nums`,children:e.key}),(0,U.jsx)(`span`,{className:`text-muted-foreground text-[11px] tabular-nums`,children:n})]}),p?(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsx)(Qn,{size:`icon-xs`,variant:`ghost`,type:`button`,"aria-label":f?`File ${e.key}`:d.length?`Move ${e.key}`:`Open ${e.key}`,children:(0,U.jsx)(M,{})})}),(0,U.jsxs)(Md,{align:`end`,children:[u?(0,U.jsx)(Q,{onClick:()=>u(e.key),children:`Open`}):null,f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Q,{onClick:()=>c?.(e.key,null),children:`Unfiled`}),i?.map(t=>(0,U.jsx)(Q,{onClick:()=>c?.(e.key,t),children:t},t))]}):null,f&&d.length?(0,U.jsxs)(Rd,{children:[(0,U.jsx)(zd,{children:`Move`}),(0,U.jsx)(Bd,{children:d.map(t=>(0,U.jsx)(Q,{onClick:()=>l?.(e.key,t),children:t},t))})]}):null,f?null:d.map(t=>(0,U.jsx)(Q,{onClick:()=>l?.(e.key,t),children:t},t))]})]}):null,(0,U.jsx)(Qn,{size:`icon-xs`,variant:`ghost`,type:`button`,"aria-label":r?`Unfavourite ${e.key}`:`Favourite ${e.key}`,onClick:t=>{t.stopPropagation(),s(e.key)},children:(0,U.jsx)(ae,{className:H(r&&`fill-current`)})})]})}function ay({status:e,epics:t,selectedEpic:n,childCount:r,favourites:i,listedEpics:a,onSelect:o,onToggleFavourite:s,onMove:c,onOpen:l}){let[u,d]=(0,C.useState)(()=>!Nv(jv(Sv,Ov),e));function f(t){d(t);let n=jv(Sv,Ov);if(t)for(let t of[...n])t.toLowerCase()===e.toLowerCase()&&n.delete(t);else n.add(e);Mv(n,Sv)}return(0,U.jsxs)(hm,{open:u,onOpenChange:f,className:`flex flex-col`,children:[(0,U.jsx)(gm,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex h-7 items-center gap-1.5 px-3 text-left`,children:[(0,U.jsx)(A,{className:H(`size-3.5 shrink-0 transition-transform`,!u&&`-rotate-90`)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] font-medium`,children:e}),(0,U.jsx)(`span`,{className:`text-[11px] tabular-nums`,children:t.length})]})}),(0,U.jsx)(_m,{className:`flex flex-col gap-0.5`,children:t.map(e=>(0,U.jsx)(iy,{epic:e,selected:n===e.key,count:r(e.key),favourited:i.keys.includes(e.key),onSelect:o,onToggleFavourite:s,moveTo:ry(a,e.status),onMove:c,onOpen:l},e.key))})]})}function oy({fields:e}){return(0,U.jsx)(`dl`,{className:`flex flex-col gap-3 p-4 text-[13px]`,children:e.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground text-[11px] font-medium`,children:e.label}),(0,U.jsx)(`dd`,{className:`whitespace-pre-wrap`,children:e.label===`Jira URL`?(0,U.jsx)(`a`,{className:`text-foreground font-medium underline-offset-4 hover:underline`,href:e.value,target:`_blank`,rel:`noreferrer`,children:e.value}):e.pills?.length?(0,U.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.pills.map(e=>(0,U.jsx)(`span`,{className:`text-muted-foreground inline-flex h-6 items-center rounded-full border px-2 text-[12px]`,children:e},e))}):e.value})]},e.label))})}function sy(){let[e,t]=(0,C.useState)({}),[n,r]=(0,C.useState)([]),[i,a]=(0,C.useState)(null),[o,s]=(0,C.useState)(!1),[c,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(null),[f,p]=(0,C.useState)(null),[m,h]=(0,C.useState)([]),[g,_]=(0,C.useState)(``),[v,y]=(0,C.useState)(``),[b,x]=(0,C.useState)(``),[S,w]=(0,C.useState)(``),[T,E]=(0,C.useState)(!1),[D,k]=(0,C.useState)(Kv),[A,te]=(0,C.useState)(Fv),[M,ne]=(0,C.useState)(Lv),[N,ae]=(0,C.useState)(zv),[L,oe]=(0,C.useState)(``),[ce,le]=(0,C.useState)(``),[ue,fe]=(0,C.useState)(``),[pe,me]=(0,C.useState)(``),[he,ge]=(0,C.useState)(Vv),_e=(0,C.useRef)(null),ve={...A,epics:n},ye=he===`epics`,be=(0,C.useMemo)(()=>De(e,ye?null:c,b,ve),[e,c,b,A,n,ye]),Se=(0,C.useMemo)(()=>Object.values(e).flat(),[e]),Ce=i??Se,we=(0,C.useMemo)(()=>Ne(n,Ce,b,A.filter),[n,Ce,b,A.filter]),Te=(0,C.useMemo)(()=>Pe(we),[we]),Ee=(0,C.useMemo)(()=>ze(n,M,b,Ce,A.filter),[n,M,b,Ce,A.filter]),Oe=Object.keys(be),ke=u?[`cards`,`open`]:[`cards`],Ae=Fp({id:`shell`,panelIds:[`epics`,`board`],onlySaveAfterUserInteractions:!0}),je=Fp({id:`board-open`,panelIds:ke,onlySaveAfterUserInteractions:!0}),Re=Fp({id:`columns`,panelIds:Oe,onlySaveAfterUserInteractions:!0}),Ge=f?se(f,window.location.origin):null,Ke=xe(Se,n),Qe=Object.keys(e),$e=Ee.unfiled.length>0||Ee.folders.length>0;function et(e){te(e),Iv(e)}function tt(e){ne(e),Rv(e)}function nt(e){ae(e),Bv(e)}function rt(e,n){let i=e.epics??[];t(Gv(n===`epics`?R(i):e.columns)),r(i),a(e.children?Object.values(e.children).flat():null),e.error&&w(e.error)}function it(e){_e.current=e;let n=e.epics??[];t(Gv(he===`epics`?R(n):e.columns)),r(n),a(e.children?Object.values(e.children).flat():null),l(t=>t&&(e.epics??[]).some(e=>e.key===t)?t:null),e.error&&w(e.error)}async function at(){let e=await Wv(`/api/board`);it(e),e.flags&&y(e.flags)}(0,C.useEffect)(()=>{at()},[]);async function ot(){E(!0),w(``);try{it(await Wv(`/api/refresh`,{method:`POST`,body:JSON.stringify({flags:v})}))}catch(e){w(e instanceof Error?e.message:`Refresh failed`)}finally{E(!1)}}async function st(e,t){E(!0),w(``);try{let n=await Wv(`/api/move`,{method:`POST`,body:JSON.stringify({key:e,status:t})});it(n.board),n.ok||w(n.error??`Move failed`)}finally{E(!1)}}async function ct(e){let t=Se.find(t=>t.key===e),r=n.find(t=>t.key===e),i=t??(r?{key:r.key,summary:r.summary,priority:r.priority,assignee:r.assignee,dueDate:r.dueDate,labels:r.labels}:void 0),a=`/browse/${e}`;d(e),p(a),_(``),h(i?Uv(i,a):[{label:`Jira URL`,value:a}]);let o=await Wv(`/api/open`,{method:`POST`,body:JSON.stringify({key:e})});if(p(o.url),o.error){_(o.error),h(i?Uv(i,o.url):[{label:`Jira URL`,value:o.url}]);return}h(o.fields)}function lt(e,n){if(n.kind===`column`||n.activeContainer===n.overContainer||A.hide.includes(n.overContainer)){t(e=>Ie(n.previousValue,e,c,b,ve));return}st(String(n.event.active.id),n.overContainer)}function ut(){let e=D===`dark`?`light`:`dark`;qv(e),k(e)}function dt(e){return Me(Ce,e,b,A.filter,n)}function ft(){Hv(`stories`),ge(`stories`),l(null),_e.current&&rt(_e.current,`stories`)}function pt(){Hv(`epics`),ge(`epics`),l(null),_e.current&&rt(_e.current,`epics`)}async function mt(e){let n=he===`epics`;if(n&&ft(),l(e),e&&!((n&&_e.current?_e.current.columns.flatMap(e=>e.cards):Se).filter(t=>t.epic===e&&de(t,b)).length>0)){E(!0),w(``);try{let n=await Wv(`/api/epic`,{method:`POST`,body:JSON.stringify({key:e})});t(t=>Le(t,Gv(n.columns),e))}catch(e){w(e instanceof Error?e.message:`Epic list failed`)}finally{E(!1)}}}function ht(){let e=Ve(M,L);if(!e.ok){le(`Folder names must be unique`);return}oe(``),le(``),tt(e.state)}function gt(){let e=qe(N,ue,A);if(!e.ok){me(`Preset names must be unique`);return}fe(``),me(``),nt(e.presets)}function _t(e){let t=Je(N,e);t.ok&&(et(t.chrome),he===`epics`&&ft())}function vt(e){let t=Ye(N,e,A);t.ok&&nt(t.presets)}function yt(e,t){let n=Xe(N,e,t);if(!n.ok){me(`Preset names must be unique`);return}me(``),nt(n.presets)}return(0,U.jsx)(`div`,{className:`bg-sidebar flex h-screen`,children:(0,U.jsxs)(Up,{id:`shell`,orientation:`horizontal`,className:`min-h-0 flex-1`,defaultLayout:Ae.defaultLayout,onLayoutChanged:Ae.onLayoutChanged,children:[(0,U.jsx)(Wp,{id:`epics`,defaultSize:`244px`,minSize:`12rem`,maxSize:`40%`,className:`min-h-0`,children:(0,U.jsxs)(`aside`,{className:`text-sidebar-foreground flex h-full min-h-0 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex h-10 items-center justify-between px-4`,children:[(0,U.jsx)(`span`,{className:`text-[13px] font-medium`,children:`pipe-kan`}),(0,U.jsx)(`span`,{className:`text-muted-foreground text-[12px] tabular-nums`,children:we.length})]}),(0,U.jsxs)(`nav`,{className:`flex flex-1 flex-col gap-0.5 overflow-auto px-2 pb-2`,children:[(0,U.jsx)(`button`,{type:`button`,className:H(`h-8 rounded-lg px-3 text-left text-[13px]`,he===`stories`&&c===null?`bg-sidebar-accent text-sidebar-accent-foreground`:`hover:bg-foreground/5`),onClick:ft,children:`All stories`}),(0,U.jsx)(`button`,{type:`button`,className:H(`h-8 rounded-lg px-3 text-left text-[13px]`,he===`epics`?`bg-sidebar-accent text-sidebar-accent-foreground`:`hover:bg-foreground/5`),onClick:pt,children:`All epics`}),$e?(0,U.jsx)(cy,{pane:Ee,selectedEpic:c,childCount:dt,favourites:M,folderName:L,folderError:ce,onFolderName:oe,onCreateFolder:ht,onRenameFolder:(e,t)=>{let n=He(M,e,t);if(!n.ok){le(`Folder names must be unique`);return}le(``),tt(n.state)},onDeleteFolder:e=>tt(Ue(M,e)),listedEpics:n,onSelect:mt,onToggleFavourite:e=>tt(Be(M,e)),onFile:(e,t)=>tt(We(M,e,t)),onMove:st,onOpen:ct}):null,(0,U.jsx)(uy,{presets:N,presetName:ue,presetError:pe,onPresetName:fe,onCreatePreset:gt,onApplyPreset:_t,onOverwritePreset:vt,onRenamePreset:yt,onDeletePreset:e=>nt(Ze(N,e))}),(0,U.jsx)(`div`,{className:`text-muted-foreground px-3 pt-3 pb-1 text-[11px] font-medium`,children:`Epics`}),Te.map(e=>e.status?(0,U.jsx)(ay,{status:e.status,epics:e.epics,selectedEpic:c,childCount:dt,favourites:M,listedEpics:n,onSelect:mt,onToggleFavourite:e=>tt(Be(M,e)),onMove:st,onOpen:ct},e.status):e.epics.map(e=>(0,U.jsx)(iy,{epic:e,selected:c===e.key,count:dt(e.key),favourited:M.keys.includes(e.key),moveTo:ry(n,e.status),onSelect:mt,onToggleFavourite:e=>tt(Be(M,e)),onMove:st,onOpen:ct},e.key)))]})]})}),(0,U.jsx)(Gp,{}),(0,U.jsx)(Wp,{id:`board`,defaultSize:`80%`,minSize:`24rem`,className:`min-h-0`,children:(0,U.jsx)(`div`,{className:`flex h-full min-h-0 flex-col p-2 pl-0`,children:(0,U.jsxs)(`div`,{className:`bg-background flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border`,children:[(0,U.jsxs)(`header`,{className:`flex min-h-11 shrink-0 flex-wrap items-center gap-2 px-3`,children:[(0,U.jsx)(`strong`,{className:`text-[13px] font-medium`,children:`Board`}),(0,U.jsxs)(_v,{className:`h-7 max-w-72 min-w-40 flex-1 border-transparent bg-muted shadow-none`,children:[(0,U.jsx)(yv,{children:(0,U.jsx)(ie,{className:`size-3.5`})}),(0,U.jsx)(bv,{value:b,onChange:e=>x(e.target.value),placeholder:`Search Epics and Cards`,"aria-label":`Search`,className:`h-7 text-[13px]`}),b?(0,U.jsx)(yv,{align:`inline-end`,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,onClick:()=>x(``),children:(0,U.jsx)(I,{className:`size-3.5`})})}):null]}),(0,U.jsx)(`input`,{className:`placeholder:text-muted-foreground h-7 min-w-40 flex-1 rounded-md bg-muted px-2.5 text-[13px] outline-none`,value:v,onChange:e=>y(e.target.value),placeholder:`Scope flags`,spellCheck:!1,"aria-label":`Scope flags`}),(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsxs)(Qn,{variant:`ghost`,size:`sm`,children:[(0,U.jsx)(P,{}),`Filter`]})}),(0,U.jsx)(ey,{facets:Ke,filter:A.filter,onToggle:(e,t)=>et({...A,filter:{...A.filter,[e]:Zv(A.filter[e]??[],t)}}),onClear:()=>et(kv)})]}),(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsxs)(Qn,{variant:`ghost`,size:`sm`,children:[(0,U.jsx)(O,{}),`Sort`]})}),(0,U.jsx)(Md,{align:`end`,children:(0,U.jsxs)(Fd,{value:A.sort,onValueChange:e=>et({...A,sort:e}),children:[(0,U.jsx)(Id,{value:`payload`,children:`Payload order`}),(0,U.jsx)(Id,{value:`priority`,children:`Priority`}),(0,U.jsx)(Id,{value:`age`,children:`Age`}),(0,U.jsx)(Id,{value:`due`,children:`Due date`}),(0,U.jsx)(Id,{value:`key`,children:`Key`})]})})]}),(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsxs)(Qn,{variant:`ghost`,size:`sm`,children:[(0,U.jsx)(j,{}),`Columns`]})}),(0,U.jsx)(Md,{align:`end`,children:Qe.map(e=>(0,U.jsx)(Pd,{checked:!A.hide.includes(e),onCheckedChange:t=>et({...A,hide:t?A.hide.filter(t=>t!==e):[...A.hide,e]}),children:e},e))})]}),(0,U.jsx)(Qn,{variant:`ghost`,size:`sm`,onClick:()=>void ot(),disabled:T,children:`Refresh`}),(0,U.jsxs)(Qn,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),"aria-pressed":o,children:[(0,U.jsx)(ee,{className:`mr-1 size-4`}),`Agent`]}),(0,U.jsx)(Qn,{variant:`ghost`,size:`icon-xs`,onClick:ut,"aria-label":D===`dark`?`Switch to light mode`:`Switch to dark mode`,children:D===`dark`?(0,U.jsx)(F,{}):(0,U.jsx)(re,{})}),S?(0,U.jsx)(`p`,{className:`text-destructive w-full text-[13px] whitespace-pre-wrap`,children:S}):null]}),(0,U.jsxs)(Up,{id:`board-open`,orientation:`horizontal`,className:`min-h-0 flex-1`,defaultLayout:je.defaultLayout,onLayoutChanged:je.onLayoutChanged,children:[(0,U.jsx)(Wp,{id:`cards`,defaultSize:u?`70%`:`100%`,minSize:`16rem`,className:`min-h-0`,children:(0,U.jsx)(`main`,{className:`h-full min-h-0 min-w-0 overflow-auto px-2 pb-2`,children:(0,U.jsxs)(lv,{className:`h-full min-h-0`,value:be,onValueChange:e=>t(t=>Fe(e,t,c,b,ve)),getItemValue:e=>e.key,restoreOnCancel:!0,onValueCommit:lt,children:[(0,U.jsx)(uv,{className:`grid h-full min-h-0 grid-cols-1 auto-rows-fr gap-3`,children:Oe.length?(0,U.jsx)(Up,{id:`columns`,orientation:`horizontal`,className:`min-h-0`,defaultLayout:Re.defaultLayout,onLayoutChanged:Re.onLayoutChanged,children:Object.entries(be).map(([e,t],n,r)=>(0,U.jsxs)(C.Fragment,{children:[n>0?(0,U.jsx)(Gp,{}):null,(0,U.jsx)(Wp,{id:e,defaultSize:`${100/Math.max(r.length,1)}%`,minSize:`16rem`,className:`min-h-0 min-w-0`,children:(0,U.jsx)(ny,{title:e,cards:t,disabled:T,onOpen:e=>void ct(e),onHide:()=>et({...A,hide:[...A.hide,e]})})})]},e))}):null}),(0,U.jsx)(gv,{children:({value:e,variant:t})=>{if(t===`column`)return(0,U.jsx)(ny,{title:String(e),cards:be[String(e)]??[],isOverlay:!0});let n=Object.values(be).flat().find(t=>t.key===e);return n?(0,U.jsx)(ty,{card:n,isOverlay:!0}):null}})]})})}),u?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Gp,{}),(0,U.jsx)(Wp,{id:`open`,defaultSize:`30%`,minSize:`16rem`,className:`min-h-0`,children:(0,U.jsxs)(`aside`,{className:`flex h-full min-h-0 flex-col border-l`,children:[(0,U.jsxs)(`div`,{className:`flex h-10 items-center gap-2 px-3`,children:[(0,U.jsx)(`a`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium underline-offset-4 hover:underline`,href:f??void 0,target:`_blank`,rel:`noreferrer`,children:u}),(0,U.jsx)(Qn,{variant:`ghost`,size:`icon-xs`,"aria-label":`Close issue`,onClick:()=>{d(null),p(null),h([]),_(``)},children:(0,U.jsx)(I,{})})]}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[g?(0,U.jsx)(`p`,{className:`text-destructive px-4 pt-3 text-[13px] whitespace-pre-wrap`,children:g}):null,(0,U.jsx)(oy,{fields:m}),Ge?(0,U.jsx)(`iframe`,{title:u??`Issue`,src:Ge,className:`min-h-64 w-full border-0 bg-background`}):f?(0,U.jsx)(`div`,{className:`text-muted-foreground px-4 pb-6 text-[13px]`,children:`Jira refuses to embed this page.`}):null]})]})})]}):null]})]})})}),o?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Gp,{}),(0,U.jsx)(Zp,{open:o,onClose:()=>s(!1),selectedIssueKey:u??c??void 0,boardFilter:A.filter,boardSort:A.sort,boardHide:A.hide,onApplyPreset:_t,onSetFilter:e=>et({...A,filter:e})})]}):null]})})}function cy({pane:e,selectedEpic:t,childCount:n,favourites:r,folderName:i,folderError:a,onFolderName:o,onCreateFolder:s,onRenameFolder:c,onDeleteFolder:l,listedEpics:u,onSelect:d,onToggleFavourite:f,onFile:p,onMove:m,onOpen:h}){let[g,_]=(0,C.useState)(()=>!Nv(jv(Sv,Ov),`Favourites`));function v(e){_(e);let t=jv(Sv,Ov);if(e)for(let e of[...t])e.toLowerCase()===`favourites`&&t.delete(e);else t.add(`Favourites`);Mv(t,Sv)}let y=r.folders.map(e=>e.name);return(0,U.jsxs)(hm,{open:g,onOpenChange:v,className:`flex flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1 px-1`,children:[(0,U.jsx)(gm,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex h-7 min-w-0 flex-1 items-center gap-1.5 px-2 text-left`,children:[(0,U.jsx)(A,{className:H(`size-3.5 shrink-0 transition-transform`,!g&&`-rotate-90`)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] font-medium`,children:`Favourites`})]})}),(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsx)(Qn,{size:`icon-xs`,variant:`ghost`,type:`button`,"aria-label":`Favourite Folders`,children:(0,U.jsx)(M,{})})}),(0,U.jsxs)(Md,{align:`start`,className:`w-56`,children:[(0,U.jsx)(Nd,{children:`Create Folder`}),(0,U.jsxs)(`div`,{className:`px-2 pb-2`,children:[(0,U.jsx)(`input`,{className:`border-input h-7 w-full rounded-md border bg-transparent px-2 text-[13px] outline-none`,value:i,onChange:e=>o(e.target.value),placeholder:`Name`,"aria-label":`Folder name`,onKeyDown:e=>{e.key===`Enter`&&s()}}),a?(0,U.jsx)(`p`,{className:`text-destructive pt-1 text-[11px]`,children:a}):null]}),(0,U.jsx)(Q,{onClick:s,children:`Create`}),y.length?(0,U.jsx)(Ld,{}):null,y.map(e=>(0,U.jsxs)(Q,{onClick:()=>{let t=window.prompt(`Rename Folder`,e);t!=null&&c(e,t)},children:[`Rename `,e]},`rename-${e}`)),y.map(e=>(0,U.jsxs)(Q,{onClick:()=>l(e),children:[`Delete `,e]},`delete-${e}`))]})]})]}),(0,U.jsxs)(_m,{className:`flex flex-col gap-0.5`,children:[e.unfiled.map(e=>(0,U.jsx)(iy,{epic:e,selected:t===e.key,count:n(e.key),favourited:!0,folders:y,onSelect:d,onToggleFavourite:f,onFile:p,moveTo:ry(u,e.status),onMove:m,onOpen:h},e.key)),e.folders.map(e=>(0,U.jsx)(ly,{folder:e,selectedEpic:t,childCount:n,folderNames:y,listedEpics:u,onSelect:d,onToggleFavourite:f,onFile:p,onMove:m,onOpen:h},e.name))]})]})}function ly({folder:e,selectedEpic:t,childCount:n,folderNames:r,listedEpics:i,onSelect:a,onToggleFavourite:o,onFile:s,onMove:c,onOpen:l}){let[u,d]=(0,C.useState)(()=>!Nv(jv(Cv),e.name));function f(t){d(t);let n=jv(Cv);if(t)for(let t of[...n])t.toLowerCase()===e.name.toLowerCase()&&n.delete(t);else n.add(e.name);Mv(n,Cv)}return(0,U.jsxs)(hm,{open:u,onOpenChange:f,className:`flex flex-col`,children:[(0,U.jsx)(gm,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex h-7 items-center gap-1.5 px-3 text-left`,children:[(0,U.jsx)(A,{className:H(`size-3.5 shrink-0 transition-transform`,!u&&`-rotate-90`)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] font-medium`,children:e.name}),(0,U.jsx)(`span`,{className:`text-[11px] tabular-nums`,children:e.epics.length})]})}),(0,U.jsx)(_m,{className:`flex flex-col gap-0.5`,children:e.epics.map(e=>(0,U.jsx)(iy,{epic:e,selected:t===e.key,count:n(e.key),favourited:!0,folders:r,onSelect:a,onToggleFavourite:o,onFile:s,moveTo:ry(i,e.status),onMove:c,onOpen:l},e.key))})]})}function uy({presets:e,presetName:t,presetError:n,onPresetName:r,onCreatePreset:i,onApplyPreset:a,onOverwritePreset:o,onRenamePreset:s,onDeletePreset:c}){let[l,u]=(0,C.useState)(()=>!Nv(jv(Sv,Ov),`Presets`));function d(e){u(e);let t=jv(Sv,Ov);if(e)for(let e of[...t])e.toLowerCase()===`presets`&&t.delete(e);else t.add(`Presets`);Mv(t,Sv)}return(0,U.jsxs)(hm,{open:l,onOpenChange:d,className:`flex flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1 px-1`,children:[(0,U.jsx)(gm,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex h-7 min-w-0 flex-1 items-center gap-1.5 px-2 text-left`,children:[(0,U.jsx)(A,{className:H(`size-3.5 shrink-0 transition-transform`,!l&&`-rotate-90`)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] font-medium`,children:`Presets`})]})}),(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsx)(Qn,{size:`icon-xs`,variant:`ghost`,type:`button`,"aria-label":`Presets`,children:(0,U.jsx)(M,{})})}),(0,U.jsxs)(Md,{align:`start`,className:`w-56`,children:[(0,U.jsx)(Nd,{children:`Save Preset`}),(0,U.jsxs)(`div`,{className:`px-2 pb-2`,children:[(0,U.jsx)(`input`,{className:`border-input h-7 w-full rounded-md border bg-transparent px-2 text-[13px] outline-none`,value:t,onChange:e=>r(e.target.value),placeholder:`Name`,"aria-label":`Preset name`,onKeyDown:e=>{e.key===`Enter`&&i()}}),n?(0,U.jsx)(`p`,{className:`text-destructive pt-1 text-[11px]`,children:n}):null]}),(0,U.jsx)(Q,{onClick:i,children:`Save`})]})]})]}),(0,U.jsx)(_m,{className:`flex flex-col gap-0.5`,children:e.map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(`button`,{type:`button`,className:`hover:bg-foreground/5 flex h-7 min-w-0 flex-1 items-center rounded-lg px-[7px] text-left text-[13px] font-medium`,onClick:()=>a(e.name),children:(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name})}),(0,U.jsxs)(Ad,{children:[(0,U.jsx)(jd,{asChild:!0,children:(0,U.jsx)(Qn,{size:`icon-xs`,variant:`ghost`,type:`button`,"aria-label":`Preset ${e.name}`,children:(0,U.jsx)(M,{})})}),(0,U.jsxs)(Md,{align:`end`,children:[(0,U.jsx)(Q,{onClick:()=>o(e.name),children:`Save over`}),(0,U.jsx)(Q,{onClick:()=>{let t=window.prompt(`Rename Preset`,e.name);t!=null&&s(e.name,t)},children:`Rename`}),(0,U.jsx)(Q,{onClick:()=>c(e.name),children:`Delete`})]})]})]},e.name))})]})}(0,L.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(C.StrictMode,{children:(0,U.jsx)(sy,{})}));
@@ -17,7 +17,7 @@
17
17
  (!theme && matchMedia("(prefers-color-scheme: dark)").matches);
18
18
  document.documentElement.classList.toggle("dark", dark);
19
19
  </script>
20
- <script type="module" crossorigin src="/assets/index-Dcf0qJzq.js"></script>
20
+ <script type="module" crossorigin src="/assets/index-Cq0bLuKF.js"></script>
21
21
  <link rel="stylesheet" crossorigin href="/assets/index-BvG_0OFX.css">
22
22
  </head>
23
23
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pipe-kan",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "description": "Local Kanban for jira-cli",
5
5
  "license": "MIT",
6
6
  "type": "module",