pubuilder 0.6.0 → 0.8.0

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/index.js CHANGED
@@ -1,31 +1,31 @@
1
1
  "use client";
2
- import { jsxs as a, jsx as e, Fragment as ne } from "react/jsx-runtime";
3
- import { createContext as se, memo as de, useRef as H, useState as v, useEffect as A, useMemo as K, useContext as le, useLayoutEffect as ue } from "react";
4
- import { createPortal as pe } from "react-dom";
5
- import { normalizeIA as be } from "./config.js";
6
- import { defineIA as et } from "./config.js";
7
- import { create as fe } from "zustand";
8
- import { Handle as Q, Position as V, ReactFlow as he } from "@xyflow/react";
9
- const ge = "http://localhost:4816";
10
- class J extends Error {
11
- constructor(o, n) {
12
- super(o), this.code = n, this.name = "ApiError";
2
+ import { jsxs as s, jsx as o, Fragment as ee } from "react/jsx-runtime";
3
+ import { createContext as de, memo as pe, useRef as $, useState as N, useEffect as L, useContext as H, useMemo as J, useLayoutEffect as ue } from "react";
4
+ import { createPortal as be } from "react-dom";
5
+ import { normalizeIA as fe } from "./config.js";
6
+ import { defineIA as ro } from "./config.js";
7
+ import { create as he } from "zustand";
8
+ import { Handle as W, Position as B, ReactFlow as ge, Controls as xe } from "@xyflow/react";
9
+ const me = "http://localhost:4816";
10
+ class F extends Error {
11
+ constructor(e, r) {
12
+ super(e), this.code = r, this.name = "ApiError";
13
13
  }
14
14
  }
15
- class ae {
16
- constructor(o = ge) {
17
- this.baseUrl = o;
15
+ class oe {
16
+ constructor(e = me) {
17
+ this.baseUrl = e;
18
18
  }
19
- async request(o, n) {
20
- const r = await fetch(`${this.baseUrl}${o}`, {
21
- ...n,
22
- headers: { "content-type": "application/json", ...n?.headers }
19
+ async request(e, r) {
20
+ const n = await fetch(`${this.baseUrl}${e}`, {
21
+ ...r,
22
+ headers: { "content-type": "application/json", ...r?.headers }
23
23
  });
24
- if (!r.ok) {
25
- const l = await r.json().catch(() => ({}));
26
- throw new J(l.message ?? `요청 실패 (${r.status})`, l.code);
24
+ if (!n.ok) {
25
+ const l = await n.json().catch(() => ({}));
26
+ throw new F(l.message ?? `요청 실패 (${n.status})`, l.code);
27
27
  }
28
- return r.status === 204 ? void 0 : await r.json();
28
+ return n.status === 204 ? void 0 : await n.json();
29
29
  }
30
30
  async isAlive() {
31
31
  try {
@@ -37,47 +37,71 @@ class ae {
37
37
  listSkills() {
38
38
  return this.request("/api/skills");
39
39
  }
40
- toggleSkill(o, n) {
41
- return this.request(`/api/skills/${encodeURIComponent(o)}`, { method: "PATCH", body: JSON.stringify({ enabled: n }) });
40
+ toggleSkill(e, r) {
41
+ return this.request(`/api/skills/${encodeURIComponent(e)}`, { method: "PATCH", body: JSON.stringify({ enabled: r }) });
42
42
  }
43
- uploadSkill(o, n) {
44
- return this.request("/api/skills", { method: "POST", body: JSON.stringify({ filename: o, content: n }) });
43
+ uploadSkill(e, r) {
44
+ return this.request("/api/skills", { method: "POST", body: JSON.stringify({ filename: e, content: r }) });
45
45
  }
46
- removeSkill(o) {
47
- return this.request(`/api/skills/${encodeURIComponent(o)}`, { method: "DELETE" });
46
+ removeSkill(e) {
47
+ return this.request(`/api/skills/${encodeURIComponent(e)}`, { method: "DELETE" });
48
48
  }
49
49
  tokenStatus() {
50
50
  return this.request("/api/settings/figma-token");
51
51
  }
52
- saveToken(o) {
53
- return this.request("/api/settings/figma-token", { method: "PUT", body: JSON.stringify({ token: o }) });
52
+ saveToken(e) {
53
+ return this.request("/api/settings/figma-token", { method: "PUT", body: JSON.stringify({ token: e }) });
54
54
  }
55
55
  deleteToken() {
56
56
  return this.request("/api/settings/figma-token", { method: "DELETE" });
57
57
  }
58
- startPublish(o) {
59
- return this.request("/api/publish", { method: "POST", body: JSON.stringify(o) });
58
+ startPublish(e) {
59
+ return this.request("/api/publish", { method: "POST", body: JSON.stringify(e) });
60
60
  }
61
- cancelPublish(o) {
62
- return this.request(`/api/publish/${o}`, { method: "DELETE" });
61
+ cancelPublish(e) {
62
+ return this.request(`/api/publish/${e}`, { method: "DELETE" });
63
+ }
64
+ /** 진행 중 job 전체 kill + 파일 자동롤백/충돌 분류 */
65
+ suspendPublish() {
66
+ return this.request("/api/publish/suspend", { method: "POST", body: "{}" });
67
+ }
68
+ /** 충돌 파일 결정(revert/keep/edit) 적용 */
69
+ resolveSuspend(e) {
70
+ return this.request("/api/publish/suspend/resolve", { method: "POST", body: JSON.stringify({ resolutions: e }) });
63
71
  }
64
72
  /** SSE 구독 — 반환값 호출로 해제 */
65
- subscribePublish(o, n) {
66
- const r = new EventSource(`${this.baseUrl}/api/publish/${o}/events`);
73
+ subscribePublish(e, r) {
74
+ const n = new EventSource(`${this.baseUrl}/api/publish/${e}/events`);
67
75
  let l = !1;
68
- return r.onmessage = (s) => {
69
- const c = JSON.parse(s.data);
70
- (c.type === "done" || c.type === "error") && (l = !0), n(c);
71
- }, r.onerror = () => {
72
- r.close(), l || (l = !0, n({ type: "error", text: "서버 연결이 끊겼어요. pubuilder serve 상태를 확인해주세요" }));
73
- }, () => r.close();
76
+ return n.onmessage = (p) => {
77
+ const c = JSON.parse(p.data);
78
+ (c.type === "done" || c.type === "error") && (l = !0), r(c);
79
+ }, n.onerror = () => {
80
+ n.close(), l || (l = !0, r({ type: "error", text: "서버 연결이 끊겼어요. pubuilder serve 상태를 확인해주세요" }));
81
+ }, () => n.close();
74
82
  }
75
83
  }
76
- const Z = se(new ae());
77
- function xe() {
84
+ const j = de(new oe());
85
+ function ye() {
78
86
  return typeof process < "u" && process.env.NODE_ENV === "production";
79
87
  }
80
- const k = fe((t) => ({
88
+ const q = {
89
+ jobId: null,
90
+ status: "idle",
91
+ events: [],
92
+ errorMessage: null,
93
+ errorCode: null,
94
+ serverDown: !1,
95
+ checking: !1,
96
+ cancelling: !1,
97
+ figmaUrl: "",
98
+ reply: ""
99
+ };
100
+ function we(t) {
101
+ return `${t.pagePath}
102
+ ${t.selector}`;
103
+ }
104
+ const y = he((t) => ({
81
105
  isMapOpen: !1,
82
106
  viewerPath: null,
83
107
  granularity: "section",
@@ -85,15 +109,40 @@ const k = fe((t) => ({
85
109
  selection: null,
86
110
  selectedOuterHTML: null,
87
111
  skillDrawerOpen: !1,
112
+ publishJobs: {},
88
113
  openMap: () => t({ isMapOpen: !0 }),
114
+ // 오버레이만 닫는다 — publishJobs는 건드리지 않아 실행 중 job이 계속 살아있고,
115
+ // 맵을 다시 열어 같은 블록을 선택하면 진행 상황/결과에 재연결된다.
89
116
  closeMap: () => t({ isMapOpen: !1, viewerPath: null, selection: null, selectedOuterHTML: null }),
90
- openViewer: (o) => t({ viewerPath: o, selection: null, selectedOuterHTML: null }),
117
+ openViewer: (e) => t({ viewerPath: e, selection: null, selectedOuterHTML: null }),
91
118
  closeViewer: () => t({ viewerPath: null, selection: null, selectedOuterHTML: null }),
92
- setGranularity: (o) => t({ granularity: o }),
93
- setInspectEnabled: (o) => t({ inspectEnabled: o }),
94
- setSelectionWithHTML: (o, n) => t({ selection: o, selectedOuterHTML: n }),
95
- toggleSkillDrawer: () => t((o) => ({ skillDrawerOpen: !o.skillDrawerOpen }))
96
- })), me = ".react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #555;--xy-background-pattern-lines-color-default: #333;--xy-background-pattern-cross-color-default: #333;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}", we = "pubuilder-styles", ye = "pubuilder-xyflow-styles", ve = (
119
+ setGranularity: (e) => t({ granularity: e }),
120
+ setInspectEnabled: (e) => t({ inspectEnabled: e }),
121
+ setSelectionWithHTML: (e, r) => t({ selection: e, selectedOuterHTML: r }),
122
+ toggleSkillDrawer: () => t((e) => ({ skillDrawerOpen: !e.skillDrawerOpen })),
123
+ patchPublishJob: (e, r) => t((n) => ({
124
+ publishJobs: {
125
+ ...n.publishJobs,
126
+ [e]: { ...n.publishJobs[e] ?? q, ...r }
127
+ }
128
+ })),
129
+ appendPublishEvent: (e, r) => t((n) => {
130
+ const l = n.publishJobs[e] ?? q;
131
+ return {
132
+ publishJobs: {
133
+ ...n.publishJobs,
134
+ [e]: { ...l, events: [...l.events, r] }
135
+ }
136
+ };
137
+ }),
138
+ suspendConflicts: [],
139
+ suspendResolutions: {},
140
+ setSuspendConflicts: (e) => t({ suspendConflicts: e, suspendResolutions: {} }),
141
+ setConflictResolution: (e, r, n) => t((l) => ({
142
+ suspendResolutions: { ...l.suspendResolutions, [e]: { file: e, action: r, ...n !== void 0 ? { content: n } : {} } }
143
+ })),
144
+ clearSuspend: () => t({ suspendConflicts: [], suspendResolutions: {} })
145
+ })), ve = ".react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #555;--xy-background-pattern-lines-color-default: #333;--xy-background-pattern-cross-color-default: #333;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}", ke = "pubuilder-styles", _e = "pubuilder-xyflow-styles", Ne = (
97
146
  /* css */
98
147
  `
99
148
  .pbu-fab {
@@ -544,150 +593,235 @@ const k = fe((t) => ({
544
593
  font-size: 11px;
545
594
  color: #cccccc;
546
595
  }
596
+
597
+ /* 일시 종료 버튼 — 위험 액션이라 붉은 계열 */
598
+ .pbu-suspend-btn {
599
+ border-color: #7a3b3b;
600
+ background: #3a2626;
601
+ color: #f2b3b3;
602
+ white-space: nowrap;
603
+ }
604
+ .pbu-suspend-btn:hover:not(:disabled) { background: #4a2d2d; }
605
+
606
+ /* 충돌 해결 모달 */
607
+ .pbu-suspend-overlay {
608
+ position: fixed;
609
+ inset: 0;
610
+ z-index: 2147483400;
611
+ background: rgba(0, 0, 0, 0.55);
612
+ display: flex;
613
+ align-items: center;
614
+ justify-content: center;
615
+ padding: 24px;
616
+ }
617
+ .pbu-suspend-panel {
618
+ width: min(560px, 100%);
619
+ max-height: 82vh;
620
+ overflow-y: auto;
621
+ background: #252526;
622
+ border: 1px solid #3c3c3c;
623
+ border-radius: 4px;
624
+ padding: 16px;
625
+ display: flex;
626
+ flex-direction: column;
627
+ gap: 12px;
628
+ color: #cccccc;
629
+ }
630
+ .pbu-suspend-head { display: flex; flex-direction: column; gap: 4px; }
631
+ .pbu-suspend-head strong { color: #f2b3b3; font-size: 13px; }
632
+ .pbu-suspend-head > span { color: #9d9d9d; font-size: 11px; line-height: 1.45; }
633
+ .pbu-conflict-row {
634
+ display: flex;
635
+ flex-direction: column;
636
+ gap: 6px;
637
+ padding: 10px;
638
+ border: 1px solid #3c3c3c;
639
+ border-radius: 2px;
640
+ background: #1e1e1e;
641
+ }
642
+ .pbu-conflict-file { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: #e6e6e6; }
643
+ .pbu-conflict-actions { display: flex; gap: 6px; }
644
+ .pbu-conflict-edit {
645
+ width: 100%;
646
+ box-sizing: border-box;
647
+ resize: vertical;
648
+ background: #1e1e1e;
649
+ border: 1px solid #4b4b4b;
650
+ border-radius: 2px;
651
+ color: #e6e6e6;
652
+ font: 11px/1.5 ui-monospace, Menlo, monospace;
653
+ padding: 7px 8px;
654
+ outline: none;
655
+ }
656
+ .pbu-conflict-edit:focus { border-color: #3794ff; box-shadow: 0 0 0 1px #3794ff; }
657
+ .pbu-suspend-foot {
658
+ display: flex;
659
+ justify-content: flex-end;
660
+ gap: 8px;
661
+ padding-top: 4px;
662
+ border-top: 1px solid #3c3c3c;
663
+ }
547
664
  `
548
665
  );
549
- function ee(t, o) {
666
+ function Y(t, e) {
550
667
  if (document.getElementById(t)) return;
551
- const n = document.createElement("style");
552
- n.id = t, n.textContent = o, document.head.appendChild(n);
668
+ const r = document.createElement("style");
669
+ r.id = t, r.textContent = e, document.head.appendChild(r);
553
670
  }
554
- function ke() {
555
- typeof document > "u" || (ee(ye, me), ee(we, ve));
671
+ function ze() {
672
+ typeof document > "u" || (Y(_e, ve), Y(ke, Ne));
556
673
  }
557
- function _e(t, o, n, r = 140, l = 48) {
558
- const s = /* @__PURE__ */ new Map();
674
+ function Ce(t, e, r, n = 140, l = 48) {
675
+ const p = /* @__PURE__ */ new Map();
559
676
  for (const g of t) {
560
- const p = s.get(g.parentId) ?? [];
561
- p.push(g), s.set(g.parentId, p);
677
+ const b = p.get(g.parentId) ?? [];
678
+ b.push(g), p.set(g.parentId, b);
562
679
  }
563
680
  const c = /* @__PURE__ */ new Map();
564
- let i = 0;
565
- const f = (g) => {
566
- const p = s.get(g.id) ?? [], m = g.depth * (o + r);
567
- let _;
568
- if (p.length === 0)
569
- _ = i, i += n + l;
681
+ let a = 0;
682
+ const u = (g) => {
683
+ const b = p.get(g.id) ?? [], d = g.depth * (e + n);
684
+ let v;
685
+ if (b.length === 0)
686
+ v = a, a += r + l;
570
687
  else {
571
- const d = p.map(f);
572
- _ = (Math.min(...d) + Math.max(...d)) / 2;
688
+ const f = b.map(u);
689
+ v = (Math.min(...f) + Math.max(...f)) / 2;
573
690
  }
574
- return c.set(g.id, { x: m, y: _ }), _;
691
+ return c.set(g.id, { x: d, y: v }), v;
575
692
  };
576
- for (const g of s.get(null) ?? []) f(g);
693
+ for (const g of p.get(null) ?? []) u(g);
577
694
  return t.map((g) => ({ ...g, ...c.get(g.id) }));
578
695
  }
579
- const Ne = de(function(o) {
580
- const { page: n, viewport: r, thumbWidth: l, bodyHeight: s } = o.data, c = k((_) => _.openViewer), i = H(null), [f, g] = v(!1);
581
- A(() => {
582
- const _ = i.current;
583
- if (!_ || n.external) return;
584
- const d = new IntersectionObserver(([C]) => {
585
- C.isIntersecting && (g(!0), d.disconnect());
696
+ const Se = pe(function(e) {
697
+ const { page: r, viewport: n, thumbWidth: l, bodyHeight: p } = e.data, c = y((v) => v.openViewer), a = $(null), [u, g] = N(!1);
698
+ L(() => {
699
+ const v = a.current;
700
+ if (!v || r.external) return;
701
+ const f = new IntersectionObserver(([C]) => {
702
+ C.isIntersecting && (g(!0), f.disconnect());
586
703
  });
587
- return d.observe(_), () => d.disconnect();
588
- }, [n.external]);
589
- const p = l / r.width;
590
- return /* @__PURE__ */ a("div", { ref: i, className: "pbu-node", style: { width: l }, onClick: () => {
591
- n.external ? window.open(n.path, "_blank", "noopener") : c(n.path);
704
+ return f.observe(v), () => f.disconnect();
705
+ }, [r.external]);
706
+ const b = l / n.width;
707
+ return /* @__PURE__ */ s("div", { ref: a, className: "pbu-node", style: { width: l }, onClick: () => {
708
+ r.external ? window.open(r.path, "_blank", "noopener") : c(r.path);
592
709
  }, children: [
593
- /* @__PURE__ */ e(Q, { type: "target", position: V.Left, className: "pbu-handle", isConnectable: !1 }),
594
- /* @__PURE__ */ a("div", { className: "pbu-node-header", children: [
595
- /* @__PURE__ */ e("span", { className: "pbu-node-title", children: n.title }),
596
- /* @__PURE__ */ e("span", { className: "pbu-node-path", children: n.external ? "외부 ↗" : n.path })
710
+ /* @__PURE__ */ o(W, { type: "target", position: B.Left, className: "pbu-handle", isConnectable: !1 }),
711
+ /* @__PURE__ */ s("div", { className: "pbu-node-header", children: [
712
+ /* @__PURE__ */ o("span", { className: "pbu-node-title", children: r.title }),
713
+ /* @__PURE__ */ o("span", { className: "pbu-node-path", children: r.external ? "외부 ↗" : r.path })
597
714
  ] }),
598
- /* @__PURE__ */ a("div", { className: "pbu-node-body", style: { height: s }, children: [
599
- n.external ? /* @__PURE__ */ e("div", { className: "pbu-node-placeholder", children: "↗ 외부 링크" }) : f ? /* @__PURE__ */ e(
715
+ /* @__PURE__ */ s("div", { className: "pbu-node-body", style: { height: p }, children: [
716
+ r.external ? /* @__PURE__ */ o("div", { className: "pbu-node-placeholder", children: "↗ 외부 링크" }) : u ? /* @__PURE__ */ o(
600
717
  "iframe",
601
718
  {
602
719
  className: "pbu-node-iframe",
603
- src: n.path,
604
- title: `${n.title} 미리보기`,
720
+ src: r.path,
721
+ title: `${r.title} 미리보기`,
605
722
  loading: "lazy",
606
723
  tabIndex: -1,
607
724
  style: {
608
- width: r.width,
609
- height: r.height,
610
- transform: `scale(${p})`
725
+ width: n.width,
726
+ height: n.height,
727
+ transform: `scale(${b})`
611
728
  }
612
729
  }
613
- ) : /* @__PURE__ */ e("div", { className: "pbu-node-placeholder", children: "…" }),
614
- /* @__PURE__ */ e("div", { className: "pbu-node-shield" })
730
+ ) : /* @__PURE__ */ o("div", { className: "pbu-node-placeholder", children: "…" }),
731
+ /* @__PURE__ */ o("div", { className: "pbu-node-shield" })
615
732
  ] }),
616
- /* @__PURE__ */ e(Q, { type: "source", position: V.Right, className: "pbu-handle", isConnectable: !1 })
733
+ /* @__PURE__ */ o(W, { type: "source", position: B.Right, className: "pbu-handle", isConnectable: !1 })
617
734
  ] });
618
- }), ze = { page: Ne }, Y = 260, Ce = 30;
619
- function Ee({ ia: t }) {
620
- const o = k((l) => l.closeMap), { nodes: n, edges: r } = K(() => {
621
- const l = Y / t.viewport.width, s = Math.round(t.viewport.height * l), c = s + Ce, i = _e(t.nodes, Y, c), f = i.map((p) => ({
622
- id: p.id,
735
+ });
736
+ function te() {
737
+ const t = H(j), e = y((a) => a.publishJobs), r = y((a) => a.setSuspendConflicts), [n, l] = N(!1);
738
+ return Object.values(e).some((a) => a.status === "running") ? /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn pbu-suspend-btn", onClick: async () => {
739
+ l(!0);
740
+ try {
741
+ const a = await t.suspendPublish();
742
+ a.conflicts.length > 0 && r(a.conflicts);
743
+ } catch {
744
+ } finally {
745
+ l(!1);
746
+ }
747
+ }, disabled: n, children: n ? "종료 중..." : "⏹ 일시 종료" }) : null;
748
+ }
749
+ const Ee = { page: Se }, U = 260, Me = 30;
750
+ function Pe({ ia: t }) {
751
+ const e = y((l) => l.closeMap), { nodes: r, edges: n } = J(() => {
752
+ const l = U / t.viewport.width, p = Math.round(t.viewport.height * l), c = p + Me, a = Ce(t.nodes, U, c), u = a.map((b) => ({
753
+ id: b.id,
623
754
  type: "page",
624
- position: { x: p.x, y: p.y },
755
+ position: { x: b.x, y: b.y },
625
756
  data: {
626
- page: p,
757
+ page: b,
627
758
  viewport: t.viewport,
628
- thumbWidth: Y,
629
- bodyHeight: s
759
+ thumbWidth: U,
760
+ bodyHeight: p
630
761
  },
631
- sourcePosition: V.Right,
632
- targetPosition: V.Left
633
- })), g = i.filter((p) => p.parentId).map((p) => ({
634
- id: `${p.parentId}->${p.id}`,
635
- source: p.parentId,
636
- target: p.id,
762
+ sourcePosition: B.Right,
763
+ targetPosition: B.Left
764
+ })), g = a.filter((b) => b.parentId).map((b) => ({
765
+ id: `${b.parentId}->${b.id}`,
766
+ source: b.parentId,
767
+ target: b.id,
637
768
  type: "smoothstep"
638
769
  }));
639
- return { nodes: f, edges: g };
770
+ return { nodes: u, edges: g };
640
771
  }, [t]);
641
- return A(() => {
642
- const l = (s) => {
643
- if (s.key !== "Escape") return;
644
- const c = k.getState();
645
- c.viewerPath || c.skillDrawerOpen || o();
772
+ return L(() => {
773
+ const l = (p) => {
774
+ if (p.key !== "Escape") return;
775
+ const c = y.getState();
776
+ c.viewerPath || c.skillDrawerOpen || e();
646
777
  };
647
778
  return window.addEventListener("keydown", l), () => window.removeEventListener("keydown", l);
648
- }, [o]), /* @__PURE__ */ a("div", { className: "pbu-overlay", children: [
649
- /* @__PURE__ */ a("div", { className: "pbu-bar", children: [
650
- /* @__PURE__ */ e("span", { className: "pbu-logo", children: "pubuilder" }),
651
- /* @__PURE__ */ e("span", { className: "pbu-hint", children: "노드 클릭 → 페이지 확대 · 스크롤 줌 · 드래그 팬 · Esc 닫기" }),
652
- /* @__PURE__ */ e("span", { className: "pbu-spacer" }),
653
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-icon-btn", onClick: o, "aria-label": "닫기", children: "✕" })
779
+ }, [e]), /* @__PURE__ */ s("div", { className: "pbu-overlay", children: [
780
+ /* @__PURE__ */ s("div", { className: "pbu-bar", children: [
781
+ /* @__PURE__ */ o("span", { className: "pbu-logo", children: "pubuilder" }),
782
+ /* @__PURE__ */ o("span", { className: "pbu-hint", children: "노드 클릭 → 페이지 확대 · 스크롤 줌 · 드래그 팬 · Esc 닫기" }),
783
+ /* @__PURE__ */ o("span", { className: "pbu-spacer" }),
784
+ /* @__PURE__ */ o(te, {}),
785
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-icon-btn", onClick: e, "aria-label": "닫기", children: "✕" })
654
786
  ] }),
655
- /* @__PURE__ */ e("div", { className: "pbu-canvas", children: /* @__PURE__ */ e(
656
- he,
787
+ /* @__PURE__ */ o("div", { className: "pbu-canvas", children: /* @__PURE__ */ o(
788
+ ge,
657
789
  {
658
- nodes: n,
659
- edges: r,
660
- nodeTypes: ze,
790
+ nodes: r,
791
+ edges: n,
792
+ nodeTypes: Ee,
661
793
  fitView: !0,
662
794
  fitViewOptions: { padding: 0.15, maxZoom: 1 },
663
795
  minZoom: 0.05,
664
796
  maxZoom: 2,
665
797
  nodesDraggable: !1,
666
798
  nodesConnectable: !1,
667
- elementsSelectable: !1
799
+ elementsSelectable: !1,
800
+ proOptions: { hideAttribution: !0 },
801
+ children: /* @__PURE__ */ o(xe, { showInteractive: !1 })
668
802
  }
669
803
  ) })
670
804
  ] });
671
805
  }
672
- function Se() {
673
- const t = k((r) => r.isMapOpen), o = k((r) => r.openMap), n = k((r) => r.closeMap);
674
- return /* @__PURE__ */ e(
806
+ function Te() {
807
+ const t = y((n) => n.isMapOpen), e = y((n) => n.openMap), r = y((n) => n.closeMap);
808
+ return /* @__PURE__ */ o(
675
809
  "button",
676
810
  {
677
811
  type: "button",
678
812
  className: "pbu-fab",
679
813
  title: "Page Map (pubuilder)",
680
814
  "aria-label": "페이지 맵 열기",
681
- onClick: () => t ? n() : o(),
682
- children: /* @__PURE__ */ a("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
683
- /* @__PURE__ */ e("polygon", { points: "3 6 9 3 15 6 21 3 21 18 15 21 9 18 3 21" }),
684
- /* @__PURE__ */ e("line", { x1: "9", y1: "3", x2: "9", y2: "18" }),
685
- /* @__PURE__ */ e("line", { x1: "15", y1: "6", x2: "15", y2: "21" })
815
+ onClick: () => t ? r() : e(),
816
+ children: /* @__PURE__ */ s("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
817
+ /* @__PURE__ */ o("polygon", { points: "3 6 9 3 15 6 21 3 21 18 15 21 9 18 3 21" }),
818
+ /* @__PURE__ */ o("line", { x1: "9", y1: "3", x2: "9", y2: "18" }),
819
+ /* @__PURE__ */ o("line", { x1: "15", y1: "6", x2: "15", y2: "21" })
686
820
  ] })
687
821
  }
688
822
  );
689
823
  }
690
- const Te = /* @__PURE__ */ new Set([
824
+ const Le = /* @__PURE__ */ new Set([
691
825
  "section",
692
826
  "header",
693
827
  "footer",
@@ -696,7 +830,7 @@ const Te = /* @__PURE__ */ new Set([
696
830
  "article",
697
831
  "aside",
698
832
  "form"
699
- ]), Me = /* @__PURE__ */ new Set([
833
+ ]), Ie = /* @__PURE__ */ new Set([
700
834
  "a",
701
835
  "button",
702
836
  "input",
@@ -716,83 +850,83 @@ const Te = /* @__PURE__ */ new Set([
716
850
  "p",
717
851
  "label"
718
852
  ]);
719
- function ce(t, o) {
720
- const n = [];
721
- let r = t;
722
- for (; r && r !== o.body && r !== o.documentElement; )
723
- n.push(r), r = r.parentElement;
724
- return n;
725
- }
726
- function Le(t, o) {
727
- const n = ce(t, o);
728
- if (n.length === 0) return null;
729
- const r = n.find((c) => {
730
- const i = c.tagName.toLowerCase();
731
- return Te.has(i) && i !== "main";
853
+ function ne(t, e) {
854
+ const r = [];
855
+ let n = t;
856
+ for (; n && n !== e.body && n !== e.documentElement; )
857
+ r.push(n), n = n.parentElement;
858
+ return r;
859
+ }
860
+ function Oe(t, e) {
861
+ const r = ne(t, e);
862
+ if (r.length === 0) return null;
863
+ const n = r.find((c) => {
864
+ const a = c.tagName.toLowerCase();
865
+ return Le.has(a) && a !== "main";
732
866
  });
733
- if (r) return r;
734
- const l = n.find((c) => c.tagName.toLowerCase() === "main");
867
+ if (n) return n;
868
+ const l = r.find((c) => c.tagName.toLowerCase() === "main");
735
869
  if (l) return l;
736
- const s = o.body.scrollHeight || 1;
737
- for (let c = n.length - 1; c >= 0; c--) {
738
- const i = n[c].getBoundingClientRect();
739
- if (i.height > 0 && i.height < s * 0.8) return n[c];
870
+ const p = e.body.scrollHeight || 1;
871
+ for (let c = r.length - 1; c >= 0; c--) {
872
+ const a = r[c].getBoundingClientRect();
873
+ if (a.height > 0 && a.height < p * 0.8) return r[c];
740
874
  }
741
- return n[n.length - 1];
742
- }
743
- function Pe(t, o) {
744
- const n = ce(t, o);
745
- for (const r of n) {
746
- if (Me.has(r.tagName.toLowerCase())) return r;
747
- const l = r.getBoundingClientRect(), s = r.children.length > 0 || (r.textContent ?? "").trim().length > 0;
748
- if (l.width >= 40 && l.height >= 24 && s) return r;
875
+ return r[r.length - 1];
876
+ }
877
+ function Re(t, e) {
878
+ const r = ne(t, e);
879
+ for (const n of r) {
880
+ if (Ie.has(n.tagName.toLowerCase())) return n;
881
+ const l = n.getBoundingClientRect(), p = n.children.length > 0 || (n.textContent ?? "").trim().length > 0;
882
+ if (l.width >= 40 && l.height >= 24 && p) return n;
749
883
  }
750
- return n[0] ?? null;
884
+ return r[0] ?? null;
751
885
  }
752
- function Oe(t, o, n) {
753
- return n === "all" ? o.body : n === "section" ? Le(t, o) : Pe(t, o);
886
+ function $e(t, e, r) {
887
+ return r === "all" ? e.body : r === "section" ? Oe(t, e) : Re(t, e);
754
888
  }
755
- function Ie(t) {
756
- const n = t.querySelector("h1, h2, h3, h4, h5, h6")?.textContent?.trim();
757
- if (n) return q(n);
758
- const r = t.getAttribute("aria-label");
759
- if (r) return q(r);
889
+ function je(t) {
890
+ const r = t.querySelector("h1, h2, h3, h4, h5, h6")?.textContent?.trim();
891
+ if (r) return A(r);
892
+ const n = t.getAttribute("aria-label");
893
+ if (n) return A(n);
760
894
  const l = t.getAttribute("alt");
761
- if (l) return q(l);
762
- const s = (t.textContent ?? "").trim().replace(/\s+/g, " ");
763
- return s ? q(s) : `<${t.tagName.toLowerCase()}>`;
895
+ if (l) return A(l);
896
+ const p = (t.textContent ?? "").trim().replace(/\s+/g, " ");
897
+ return p ? A(p) : `<${t.tagName.toLowerCase()}>`;
764
898
  }
765
- function q(t, o = 30) {
766
- return t.length > o ? `${t.slice(0, o)}…` : t;
899
+ function A(t, e = 30) {
900
+ return t.length > e ? `${t.slice(0, e)}…` : t;
767
901
  }
768
- function Re(t, o) {
902
+ function De(t, e) {
769
903
  if (t.id) return `#${CSS.escape(t.id)}`;
770
- const n = [];
771
- let r = t;
772
- for (; r && r !== o.body && n.length < 8; ) {
773
- if (r.id)
774
- return n.unshift(`#${CSS.escape(r.id)}`), n.join(" > ");
775
- const l = r.tagName.toLowerCase(), s = r.parentElement;
904
+ const r = [];
905
+ let n = t;
906
+ for (; n && n !== e.body && r.length < 8; ) {
907
+ if (n.id)
908
+ return r.unshift(`#${CSS.escape(n.id)}`), r.join(" > ");
909
+ const l = n.tagName.toLowerCase(), p = n.parentElement;
776
910
  let c = l;
777
- if (s) {
778
- const i = Array.from(s.children).filter(
779
- (f) => f.tagName === r.tagName
911
+ if (p) {
912
+ const a = Array.from(p.children).filter(
913
+ (u) => u.tagName === n.tagName
780
914
  );
781
- i.length > 1 && (c += `:nth-of-type(${i.indexOf(r) + 1})`);
915
+ a.length > 1 && (c += `:nth-of-type(${a.indexOf(n) + 1})`);
782
916
  }
783
- n.unshift(c), r = s;
917
+ r.unshift(c), n = p;
784
918
  }
785
- return n.join(" > ");
919
+ return r.join(" > ");
786
920
  }
787
- function te(t, o, n) {
788
- const r = t.createElement("div");
789
- r.setAttribute("data-pubuilder", "highlight"), Object.assign(r.style, {
921
+ function X(t, e, r) {
922
+ const n = t.createElement("div");
923
+ n.setAttribute("data-pubuilder", "highlight"), Object.assign(n.style, {
790
924
  position: "fixed",
791
925
  top: "0",
792
926
  left: "0",
793
927
  display: "none",
794
- border: `1px solid ${o}`,
795
- background: n,
928
+ border: `1px solid ${e}`,
929
+ background: r,
796
930
  borderRadius: "0",
797
931
  pointerEvents: "none",
798
932
  zIndex: "2147483647",
@@ -804,636 +938,719 @@ function te(t, o, n) {
804
938
  left: "-1px",
805
939
  top: "-22px",
806
940
  padding: "2px 7px",
807
- background: o,
941
+ background: e,
808
942
  color: "#fff",
809
943
  font: "600 10px/16px system-ui, sans-serif",
810
944
  borderRadius: "0",
811
945
  whiteSpace: "nowrap",
812
946
  pointerEvents: "none"
813
- }), r.appendChild(l), { root: r, label: l };
947
+ }), n.appendChild(l), { root: n, label: l };
814
948
  }
815
- function oe(t, o, n, r) {
816
- const l = o.getBoundingClientRect(), s = r ?? -1 / 0, c = Math.max(l.top, s), i = l.bottom - c;
817
- if (i <= 2) {
818
- X(t);
949
+ function Z(t, e, r, n) {
950
+ const l = e.getBoundingClientRect(), p = n ?? -1 / 0, c = Math.max(l.top, p), a = l.bottom - c;
951
+ if (a <= 2) {
952
+ G(t);
819
953
  return;
820
954
  }
821
- t.root.style.display = "block", t.root.style.transform = `translate(${l.x}px, ${c}px)`, t.root.style.width = `${l.width}px`, t.root.style.height = `${i}px`, t.label.textContent = n, t.label.style.top = c < 30 || c - 24 < s ? "2px" : "-24px";
955
+ t.root.style.display = "block", t.root.style.transform = `translate(${l.x}px, ${c}px)`, t.root.style.width = `${l.width}px`, t.root.style.height = `${a}px`, t.label.textContent = r, t.label.style.top = c < 30 || c - 24 < p ? "2px" : "-24px";
822
956
  }
823
- function X(t) {
957
+ function G(t) {
824
958
  t.root.style.display = "none";
825
959
  }
826
- function re(t) {
827
- const o = t.getBoundingClientRect();
828
- return `${t.tagName.toLowerCase()} · ${Math.round(o.width)}×${Math.round(o.height)}`;
960
+ function Q(t) {
961
+ const e = t.getBoundingClientRect();
962
+ return `${t.tagName.toLowerCase()} · ${Math.round(e.width)}×${Math.round(e.height)}`;
829
963
  }
830
- function $e(t, o) {
831
- let n = null;
964
+ function Ae(t, e) {
965
+ let r = null;
832
966
  try {
833
- n = t.contentDocument;
967
+ r = t.contentDocument;
834
968
  } catch {
835
969
  return null;
836
970
  }
837
- const r = t.contentWindow;
838
- if (!n || !n.body || !r) return null;
839
- const l = n;
840
- let s = o.granularity, c = o.enabled, i = null, f = null;
841
- const g = te(l, "rgba(14,99,156,0.95)", "rgba(14,99,156,0.10)"), p = te(l, "rgba(35,134,54,0.95)", "rgba(35,134,54,0.07)");
842
- l.body.appendChild(g.root), l.body.appendChild(p.root);
843
- let m = [], _ = 0;
844
- const d = () => {
845
- m = [];
846
- for (const b of Array.from(l.body.querySelectorAll("*"))) {
847
- if (b === g.root || b === p.root || g.root.contains(b) || p.root.contains(b)) continue;
848
- const y = r.getComputedStyle(b).position;
849
- if (y !== "fixed" && y !== "sticky") continue;
850
- const w = b.getBoundingClientRect();
851
- w.width === 0 || w.height === 0 || w.top <= 1 && w.height < r.innerHeight * 0.5 && m.push({ el: b, rect: w });
971
+ const n = t.contentWindow;
972
+ if (!r || !r.body || !n) return null;
973
+ const l = r;
974
+ let p = e.granularity, c = e.enabled, a = null, u = null;
975
+ const g = X(l, "rgba(14,99,156,0.95)", "rgba(14,99,156,0.10)"), b = X(l, "rgba(35,134,54,0.95)", "rgba(35,134,54,0.07)");
976
+ l.body.appendChild(g.root), l.body.appendChild(b.root);
977
+ let d = [], v = 0;
978
+ const f = () => {
979
+ d = [];
980
+ for (const h of Array.from(l.body.querySelectorAll("*"))) {
981
+ if (h === g.root || h === b.root || g.root.contains(h) || b.root.contains(h)) continue;
982
+ const _ = n.getComputedStyle(h).position;
983
+ if (_ !== "fixed" && _ !== "sticky") continue;
984
+ const k = h.getBoundingClientRect();
985
+ k.width === 0 || k.height === 0 || k.top <= 1 && k.height < n.innerHeight * 0.5 && d.push({ el: h, rect: k });
852
986
  }
853
987
  }, C = () => {
854
- const b = Date.now();
855
- b - _ < 500 || (_ = b, d());
856
- }, E = (b) => {
857
- const y = b.getBoundingClientRect();
858
- let w = null;
859
- for (const S of m)
860
- S.el === b || S.el.contains(b) || b.contains(S.el) || !(y.left < S.rect.right && y.right > S.rect.left) || (w === null || S.rect.bottom > w) && (w = S.rect.bottom);
861
- return w;
862
- }, P = () => {
863
- i && c && i.isConnected ? oe(g, i, re(i), E(i)) : X(g), f && f.isConnected ? oe(p, f, `선택됨 · ${re(f)}`, E(f)) : X(p);
864
- }, T = (b) => {
865
- if (s === "all") return l.body;
866
- if (f && f.isConnected && f.contains(b)) {
867
- if (f === b) return f;
868
- let y = b;
869
- for (; y.parentElement && y.parentElement !== f; )
870
- y = y.parentElement;
871
- return y;
988
+ const h = Date.now();
989
+ h - v < 500 || (v = h, f());
990
+ }, P = (h) => {
991
+ const _ = h.getBoundingClientRect();
992
+ let k = null;
993
+ for (const S of d)
994
+ S.el === h || S.el.contains(h) || h.contains(S.el) || !(_.left < S.rect.right && _.right > S.rect.left) || (k === null || S.rect.bottom > k) && (k = S.rect.bottom);
995
+ return k;
996
+ }, E = () => {
997
+ a && c && a.isConnected ? Z(g, a, Q(a), P(a)) : G(g), u && u.isConnected ? Z(b, u, `선택됨 · ${Q(u)}`, P(u)) : G(b);
998
+ }, T = (h) => {
999
+ if (p === "all") return l.body;
1000
+ if (u && u.isConnected && u.contains(h)) {
1001
+ if (u === h) return u;
1002
+ let _ = h;
1003
+ for (; _.parentElement && _.parentElement !== u; )
1004
+ _ = _.parentElement;
1005
+ return _;
872
1006
  }
873
- return Oe(b, l, s);
874
- }, j = (b) => {
1007
+ return $e(h, l, p);
1008
+ }, I = (h) => {
875
1009
  if (!c) return;
876
1010
  C();
877
- const y = b.target;
878
- if (!y || !l.body.contains(y)) return;
879
- const w = T(y);
880
- w !== i && (i = w, P());
881
- }, O = (b) => {
1011
+ const _ = h.target;
1012
+ if (!_ || !l.body.contains(_)) return;
1013
+ const k = T(_);
1014
+ k !== a && (a = k, E());
1015
+ }, i = (h) => {
882
1016
  if (!c) return;
883
- b.preventDefault(), b.stopPropagation(), d(), _ = Date.now();
884
- const y = b.target;
885
- if (!y) return;
886
- const w = T(y);
887
- if (!w) return;
888
- f = w, P();
889
- const S = w.getBoundingClientRect();
890
- o.onSelect(
1017
+ h.preventDefault(), h.stopPropagation(), f(), v = Date.now();
1018
+ const _ = h.target;
1019
+ if (!_) return;
1020
+ const k = T(_);
1021
+ if (!k) return;
1022
+ u = k, E();
1023
+ const S = k.getBoundingClientRect();
1024
+ e.onSelect(
891
1025
  {
892
- pagePath: o.pagePath,
893
- selector: Re(w, l),
894
- tag: w.tagName.toLowerCase(),
895
- label: Ie(w),
1026
+ pagePath: e.pagePath,
1027
+ selector: De(k, l),
1028
+ tag: k.tagName.toLowerCase(),
1029
+ label: je(k),
896
1030
  rect: {
897
- x: S.x + r.scrollX,
898
- y: S.y + r.scrollY,
1031
+ x: S.x + n.scrollX,
1032
+ y: S.y + n.scrollY,
899
1033
  width: S.width,
900
1034
  height: S.height
901
1035
  },
902
- granularity: s
1036
+ granularity: p
903
1037
  },
904
- w
1038
+ k
905
1039
  );
906
- }, M = () => {
907
- i = null, P();
908
- }, $ = () => P(), I = () => {
909
- d(), P();
1040
+ }, w = () => {
1041
+ a = null, E();
1042
+ }, O = () => E(), z = () => {
1043
+ f(), E();
910
1044
  };
911
- return d(), l.addEventListener("mousemove", j, !0), l.addEventListener("click", O, !0), l.documentElement.addEventListener("mouseleave", M), r.addEventListener("scroll", $, !0), r.addEventListener("resize", I), {
1045
+ return f(), l.addEventListener("mousemove", I, !0), l.addEventListener("click", i, !0), l.documentElement.addEventListener("mouseleave", w), n.addEventListener("scroll", O, !0), n.addEventListener("resize", z), {
912
1046
  destroy() {
913
1047
  try {
914
- l.removeEventListener("mousemove", j, !0), l.removeEventListener("click", O, !0), l.documentElement.removeEventListener("mouseleave", M), r.removeEventListener("scroll", $, !0), r.removeEventListener("resize", I), g.root.remove(), p.root.remove();
1048
+ l.removeEventListener("mousemove", I, !0), l.removeEventListener("click", i, !0), l.documentElement.removeEventListener("mouseleave", w), n.removeEventListener("scroll", O, !0), n.removeEventListener("resize", z), g.root.remove(), b.root.remove();
915
1049
  } catch {
916
1050
  }
917
1051
  },
918
- setGranularity(b) {
919
- s = b, i = null, P();
1052
+ setGranularity(h) {
1053
+ p = h, a = null, E();
920
1054
  },
921
- setEnabled(b) {
922
- c = b, b || (i = null), P();
1055
+ setEnabled(h) {
1056
+ c = h, h || (a = null), E();
923
1057
  }
924
1058
  };
925
1059
  }
926
- const De = {
1060
+ const Be = {
927
1061
  log: "💬",
928
1062
  tool: "🔧",
929
1063
  error: "⛔",
930
1064
  done: "✅"
931
- };
932
- function Ae() {
933
- const t = le(Z), o = k((u) => u.selection), n = k((u) => u.selectedOuterHTML), r = k((u) => u.toggleSkillDrawer), [l, s] = v(""), [c, i] = v("idle"), [f, g] = v(null), [p, m] = v([]), [_, d] = v(!1), [C, E] = v(!1), [P, T] = v(null), [j, O] = v(null), [M, $] = v(!1), [I, b] = v(!1), [y, w] = v(""), S = H(null), R = H(null), D = H(0);
934
- A(() => {
935
- D.current++, R.current?.(), R.current = null, i("idle"), g(null), m([]), d(!1), E(!1), $(!1), T(null), O(null), s(""), w("");
936
- }, [o?.selector]), A(() => {
937
- const u = S.current;
938
- u && (u.scrollTop = u.scrollHeight);
939
- }, [p]), A(() => () => {
940
- D.current++, R.current?.(), R.current = null;
941
- }, []);
942
- const F = (u) => {
943
- R.current = t.subscribePublish(u, (z) => {
944
- m((L) => [...L, z]), z.type === "done" ? (i("done"), g(null), $(!1), R.current?.(), R.current = null) : z.type === "error" && (i("error"), T(z.text), g(null), $(!1), R.current?.(), R.current = null);
1065
+ }, R = /* @__PURE__ */ new Map();
1066
+ function He() {
1067
+ const t = H(j), e = y((i) => i.selection), r = y((i) => i.selectedOuterHTML), n = y((i) => i.toggleSkillDrawer), l = y((i) => i.patchPublishJob), p = y((i) => i.appendPublishEvent), c = e ? we(e) : null, a = y((i) => c ? i.publishJobs[c] : void 0) ?? q, [u, g] = N(!1), b = $(null);
1068
+ L(() => {
1069
+ const i = b.current;
1070
+ i && (i.scrollTop = i.scrollHeight);
1071
+ }, [a.events]);
1072
+ const d = (i, w) => {
1073
+ R.get(i)?.();
1074
+ const O = t.subscribePublish(w, (z) => {
1075
+ p(i, z), z.type === "done" ? (l(i, { status: "done", jobId: null, cancelling: !1 }), R.get(i)?.(), R.delete(i)) : z.type === "error" && (l(i, { status: "error", errorMessage: z.text, jobId: null, cancelling: !1 }), R.get(i)?.(), R.delete(i));
945
1076
  });
946
- }, W = async () => {
947
- if (!o || c === "running" || C) return;
948
- const u = D.current;
949
- d(!1), T(null), O(null), E(!0);
950
- try {
951
- const z = await t.isAlive();
952
- if (u !== D.current) return;
953
- if (!z) {
954
- d(!0);
955
- return;
956
- }
957
- const { jobId: L } = await t.startPublish({
958
- selection: o,
959
- outerHTML: n ?? "",
960
- figmaUrl: l
961
- });
962
- if (u !== D.current) {
963
- t.cancelPublish(L).catch(() => {
1077
+ R.set(i, O);
1078
+ }, v = async () => {
1079
+ if (!(!c || !e || a.status === "running" || a.checking)) {
1080
+ l(c, { serverDown: !1, errorMessage: null, errorCode: null, checking: !0 });
1081
+ try {
1082
+ if (!await t.isAlive()) {
1083
+ l(c, { serverDown: !0 });
1084
+ return;
1085
+ }
1086
+ const { jobId: w } = await t.startPublish({
1087
+ selection: e,
1088
+ outerHTML: r ?? "",
1089
+ figmaUrl: a.figmaUrl
1090
+ });
1091
+ l(c, { jobId: w, status: "running", events: [] }), d(c, w);
1092
+ } catch (i) {
1093
+ l(c, {
1094
+ status: "error",
1095
+ errorMessage: i instanceof Error ? i.message : String(i),
1096
+ errorCode: i instanceof F ? i.code ?? null : null
964
1097
  });
965
- return;
1098
+ } finally {
1099
+ l(c, { checking: !1 });
966
1100
  }
967
- g(L), m([]), i("running"), F(L);
968
- } catch (z) {
969
- if (u !== D.current) return;
970
- i("error"), T(z instanceof Error ? z.message : String(z)), O(z instanceof J ? z.code ?? null : null);
971
- } finally {
972
- E(!1);
973
1101
  }
974
- }, U = async () => {
975
- if (!(!f || M)) {
976
- $(!0);
1102
+ }, f = async () => {
1103
+ if (!(!c || !a.jobId || a.cancelling)) {
1104
+ l(c, { cancelling: !0 });
977
1105
  try {
978
- await t.cancelPublish(f);
979
- } catch (u) {
980
- T(u instanceof Error ? u.message : String(u)), $(!1);
1106
+ await t.cancelPublish(a.jobId);
1107
+ } catch (i) {
1108
+ l(c, {
1109
+ errorMessage: i instanceof Error ? i.message : String(i),
1110
+ cancelling: !1
1111
+ });
981
1112
  }
982
1113
  }
983
- }, G = async () => {
984
- const u = y.trim();
985
- if (!o || !u || C || N) return;
986
- const z = D.current;
987
- E(!0), T(null);
988
- try {
989
- const { jobId: L } = await t.startPublish({
990
- selection: o,
991
- outerHTML: n ?? "",
992
- figmaUrl: l,
993
- instruction: u
994
- });
995
- if (z !== D.current) {
996
- t.cancelPublish(L).catch(() => {
1114
+ }, C = async () => {
1115
+ const i = a.reply.trim();
1116
+ if (!(!c || !e || !i || a.checking || a.status === "running")) {
1117
+ l(c, { checking: !0, errorMessage: null });
1118
+ try {
1119
+ const { jobId: w } = await t.startPublish({
1120
+ selection: e,
1121
+ outerHTML: r ?? "",
1122
+ figmaUrl: a.figmaUrl,
1123
+ instruction: i
997
1124
  });
998
- return;
1125
+ p(c, { type: "log", text: `내 답변: ${i}` }), l(c, { reply: "", jobId: w, status: "running" }), d(c, w);
1126
+ } catch (w) {
1127
+ l(c, {
1128
+ status: "error",
1129
+ errorMessage: w instanceof Error ? w.message : String(w),
1130
+ errorCode: w instanceof F ? w.code ?? null : null
1131
+ });
1132
+ } finally {
1133
+ l(c, { checking: !1 });
999
1134
  }
1000
- m((ie) => [...ie, { type: "log", text: `내 답변: ${u}` }]), w(""), g(L), i("running"), F(L);
1001
- } catch (L) {
1002
- if (z !== D.current) return;
1003
- i("error"), T(L instanceof Error ? L.message : String(L)), O(L instanceof J ? L.code ?? null : null);
1004
- } finally {
1005
- E(!1);
1006
1135
  }
1007
- }, h = async () => {
1008
- await navigator.clipboard.writeText("npx pubuilder serve"), b(!0), setTimeout(() => b(!1), 1200);
1009
- }, x = async () => {
1010
- E(!0);
1011
- try {
1012
- const u = await t.isAlive();
1013
- d(!u);
1014
- } finally {
1015
- E(!1);
1136
+ }, P = async () => {
1137
+ await navigator.clipboard.writeText("npx pubuilder serve"), g(!0), setTimeout(() => g(!1), 1200);
1138
+ }, E = async () => {
1139
+ if (c) {
1140
+ l(c, { checking: !0 });
1141
+ try {
1142
+ const i = await t.isAlive();
1143
+ l(c, { serverDown: !i });
1144
+ } finally {
1145
+ l(c, { checking: !1 });
1146
+ }
1016
1147
  }
1017
- }, N = c === "running";
1018
- return /* @__PURE__ */ a("div", { className: "pbu-publish", children: [
1019
- /* @__PURE__ */ a("div", { className: "pbu-publish-heading", children: [
1020
- /* @__PURE__ */ e("label", { htmlFor: "pbu-figma-url", children: "Figma 노드 링크" }),
1021
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-btn pbu-skill-entry", onClick: r, children: "🧰 스킬함 · 설정" })
1148
+ }, T = a.status === "running", I = a.errorCode === "NO_FIGMA_TOKEN" || a.errorCode === "FIGMA_API_ERROR";
1149
+ return /* @__PURE__ */ s("div", { className: "pbu-publish", children: [
1150
+ /* @__PURE__ */ s("div", { className: "pbu-publish-heading", children: [
1151
+ /* @__PURE__ */ o("label", { htmlFor: "pbu-figma-url", children: "Figma 노드 링크" }),
1152
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn pbu-skill-entry", onClick: n, children: "🧰 스킬함 · 설정" })
1022
1153
  ] }),
1023
- /* @__PURE__ */ e(
1154
+ /* @__PURE__ */ o(
1024
1155
  "input",
1025
1156
  {
1026
1157
  id: "pbu-figma-url",
1027
- value: l,
1028
- onChange: (u) => s(u.target.value),
1029
- disabled: N,
1158
+ value: a.figmaUrl,
1159
+ onChange: (i) => c && l(c, { figmaUrl: i.target.value }),
1160
+ disabled: T,
1030
1161
  placeholder: "https://www.figma.com/design/..."
1031
1162
  }
1032
1163
  ),
1033
- _ && /* @__PURE__ */ a("div", { className: "pbu-panel-empty", children: [
1164
+ a.serverDown && /* @__PURE__ */ s("div", { className: "pbu-panel-empty", children: [
1034
1165
  "컴패니언 서버가 꺼져 있어요",
1035
- /* @__PURE__ */ a("div", { className: "pbu-drawer-code", children: [
1036
- /* @__PURE__ */ e("code", { children: "npx pubuilder serve" }),
1037
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-btn", onClick: h, children: I ? "복사됨 ✓" : "복사" })
1166
+ /* @__PURE__ */ s("div", { className: "pbu-drawer-code", children: [
1167
+ /* @__PURE__ */ o("code", { children: "npx pubuilder serve" }),
1168
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn", onClick: P, children: u ? "복사됨 ✓" : "복사" })
1038
1169
  ] }),
1039
- /* @__PURE__ */ e("div", { className: "pbu-hint", children: 'package.json의 dev 스크립트를 "pubuilder dev -- <기존 명령>"으로 감싸면 자동 실행돼요' }),
1040
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-btn", disabled: C, onClick: x, children: "다시 확인" })
1170
+ /* @__PURE__ */ o("div", { className: "pbu-hint", children: 'package.json의 dev 스크립트를 "pubuilder dev -- <기존 명령>"으로 감싸면 자동 실행돼요' }),
1171
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn", disabled: a.checking, onClick: E, children: "다시 확인" })
1041
1172
  ] }),
1042
- P && !_ && /* @__PURE__ */ a("div", { className: "pbu-drawer-error", children: [
1043
- /* @__PURE__ */ e("span", { children: P }),
1044
- (j === "NO_FIGMA_TOKEN" || j === "FIGMA_API_ERROR") && /* @__PURE__ */ e("button", { type: "button", className: "pbu-btn", onClick: r, children: "스킬함 열기" })
1173
+ a.errorMessage && !a.serverDown && /* @__PURE__ */ s("div", { className: "pbu-drawer-error", children: [
1174
+ /* @__PURE__ */ o("span", { children: a.errorMessage }),
1175
+ I && /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn", onClick: n, children: "스킬함 열기" })
1045
1176
  ] }),
1046
- N ? /* @__PURE__ */ e("button", { type: "button", className: "pbu-btn pbu-btn-primary", disabled: M, onClick: U, children: M ? "중단 중..." : "중단" }) : /* @__PURE__ */ e(
1177
+ T ? /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn pbu-btn-primary", disabled: a.cancelling, onClick: f, children: a.cancelling ? "중단 중..." : "중단" }) : /* @__PURE__ */ o(
1047
1178
  "button",
1048
1179
  {
1049
1180
  type: "button",
1050
1181
  className: "pbu-btn pbu-btn-primary",
1051
- disabled: C || !o,
1052
- onClick: W,
1182
+ disabled: a.checking || !e,
1183
+ onClick: v,
1053
1184
  children: "이 블록 퍼블리싱"
1054
1185
  }
1055
1186
  ),
1056
- (p.length > 0 || N) && /* @__PURE__ */ a("div", { className: "pbu-publish-log", ref: S, children: [
1057
- N && p.length === 0 && /* @__PURE__ */ e("div", { className: "pbu-log-line pbu-log-tool", children: "실행 중..." }),
1058
- p.map((u, z) => /* @__PURE__ */ a(
1187
+ (a.events.length > 0 || T) && /* @__PURE__ */ s("div", { className: "pbu-publish-log", ref: b, children: [
1188
+ T && a.events.length === 0 && /* @__PURE__ */ o("div", { className: "pbu-log-line pbu-log-tool", children: "실행 중..." }),
1189
+ a.events.map((i, w) => /* @__PURE__ */ s(
1059
1190
  "div",
1060
1191
  {
1061
- className: u.type === "error" ? "pbu-log-line pbu-log-error" : u.type === "done" ? "pbu-log-line pbu-log-done" : u.type === "tool" ? "pbu-log-line pbu-log-tool" : "pbu-log-line",
1192
+ className: i.type === "error" ? "pbu-log-line pbu-log-error" : i.type === "done" ? "pbu-log-line pbu-log-done" : i.type === "tool" ? "pbu-log-line pbu-log-tool" : "pbu-log-line",
1062
1193
  children: [
1063
- /* @__PURE__ */ e("span", { children: De[u.type] }),
1194
+ /* @__PURE__ */ o("span", { children: Be[i.type] }),
1064
1195
  " ",
1065
- /* @__PURE__ */ e("span", { children: u.text })
1196
+ /* @__PURE__ */ o("span", { children: i.text })
1066
1197
  ]
1067
1198
  },
1068
- z
1199
+ w
1069
1200
  ))
1070
1201
  ] }),
1071
- c === "done" && /* @__PURE__ */ a("div", { className: "pbu-publish-reply", children: [
1072
- /* @__PURE__ */ e("label", { htmlFor: "pbu-publish-reply", children: "AI에게 이어서 답하기" }),
1073
- /* @__PURE__ */ e(
1202
+ a.status === "done" && /* @__PURE__ */ s("div", { className: "pbu-publish-reply", children: [
1203
+ /* @__PURE__ */ o("label", { htmlFor: "pbu-publish-reply", children: "AI에게 이어서 답하기" }),
1204
+ /* @__PURE__ */ o(
1074
1205
  "textarea",
1075
1206
  {
1076
1207
  id: "pbu-publish-reply",
1077
- value: y,
1078
- onChange: (u) => w(u.target.value),
1079
- onKeyDown: (u) => {
1080
- (u.metaKey || u.ctrlKey) && u.key === "Enter" && G();
1208
+ value: a.reply,
1209
+ onChange: (i) => c && l(c, { reply: i.target.value }),
1210
+ onKeyDown: (i) => {
1211
+ (i.metaKey || i.ctrlKey) && i.key === "Enter" && C();
1081
1212
  },
1082
1213
  placeholder: "예: B 방향으로 진행해줘. 공지와 알림은 유지해.",
1083
1214
  rows: 3
1084
1215
  }
1085
1216
  ),
1086
- /* @__PURE__ */ a("div", { className: "pbu-publish-reply-actions", children: [
1087
- /* @__PURE__ */ e("span", { children: "⌘/Ctrl + Enter" }),
1088
- /* @__PURE__ */ e(
1217
+ /* @__PURE__ */ s("div", { className: "pbu-publish-reply-actions", children: [
1218
+ /* @__PURE__ */ o("span", { children: "⌘/Ctrl + Enter" }),
1219
+ /* @__PURE__ */ o(
1089
1220
  "button",
1090
1221
  {
1091
1222
  type: "button",
1092
1223
  className: "pbu-btn pbu-btn-primary",
1093
- disabled: C || !y.trim(),
1094
- onClick: G,
1095
- children: C ? "전송 중..." : "답변 전송"
1224
+ disabled: a.checking || !a.reply.trim(),
1225
+ onClick: C,
1226
+ children: a.checking ? "전송 중..." : "답변 전송"
1096
1227
  }
1097
1228
  )
1098
1229
  ] })
1099
1230
  ] })
1100
1231
  ] });
1101
1232
  }
1102
- function je() {
1103
- const t = k((l) => l.selection), [o, n] = v(!1), r = async () => {
1104
- t && (await navigator.clipboard.writeText(t.selector), n(!0), setTimeout(() => n(!1), 1200));
1233
+ function Ue() {
1234
+ const t = y((l) => l.selection), [e, r] = N(!1), n = async () => {
1235
+ t && (await navigator.clipboard.writeText(t.selector), r(!0), setTimeout(() => r(!1), 1200));
1105
1236
  };
1106
- return /* @__PURE__ */ a("aside", { className: "pbu-panel", children: [
1107
- /* @__PURE__ */ e("div", { className: "pbu-panel-title", children: "선택된 블록" }),
1108
- t ? /* @__PURE__ */ a(ne, { children: [
1109
- /* @__PURE__ */ a("div", { className: "pbu-field", children: [
1110
- /* @__PURE__ */ e("label", { children: "페이지" }),
1111
- /* @__PURE__ */ e("code", { children: t.pagePath })
1237
+ return /* @__PURE__ */ s("aside", { className: "pbu-panel", children: [
1238
+ /* @__PURE__ */ o("div", { className: "pbu-panel-title", children: "선택된 블록" }),
1239
+ t ? /* @__PURE__ */ s(ee, { children: [
1240
+ /* @__PURE__ */ s("div", { className: "pbu-field", children: [
1241
+ /* @__PURE__ */ o("label", { children: "페이지" }),
1242
+ /* @__PURE__ */ o("code", { children: t.pagePath })
1112
1243
  ] }),
1113
- /* @__PURE__ */ a("div", { className: "pbu-field", children: [
1114
- /* @__PURE__ */ e("label", { children: "블록" }),
1115
- /* @__PURE__ */ a("div", { children: [
1116
- /* @__PURE__ */ e("span", { className: "pbu-chip", children: t.tag }),
1117
- /* @__PURE__ */ e("span", { children: t.label })
1244
+ /* @__PURE__ */ s("div", { className: "pbu-field", children: [
1245
+ /* @__PURE__ */ o("label", { children: "블록" }),
1246
+ /* @__PURE__ */ s("div", { children: [
1247
+ /* @__PURE__ */ o("span", { className: "pbu-chip", children: t.tag }),
1248
+ /* @__PURE__ */ o("span", { children: t.label })
1118
1249
  ] })
1119
1250
  ] }),
1120
- /* @__PURE__ */ a("div", { className: "pbu-field", children: [
1121
- /* @__PURE__ */ e("label", { children: "Selector" }),
1122
- /* @__PURE__ */ e("code", { className: "pbu-selector", children: t.selector }),
1123
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-btn", onClick: r, children: o ? "복사됨 ✓" : "Selector 복사" })
1251
+ /* @__PURE__ */ s("div", { className: "pbu-field", children: [
1252
+ /* @__PURE__ */ o("label", { children: "Selector" }),
1253
+ /* @__PURE__ */ o("code", { className: "pbu-selector", children: t.selector }),
1254
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn", onClick: n, children: e ? "복사됨 ✓" : "Selector 복사" })
1124
1255
  ] }),
1125
- /* @__PURE__ */ a("div", { className: "pbu-field", children: [
1126
- /* @__PURE__ */ e("label", { children: "크기" }),
1127
- /* @__PURE__ */ a("span", { children: [
1256
+ /* @__PURE__ */ s("div", { className: "pbu-field", children: [
1257
+ /* @__PURE__ */ o("label", { children: "크기" }),
1258
+ /* @__PURE__ */ s("span", { children: [
1128
1259
  Math.round(t.rect.width),
1129
1260
  " × ",
1130
1261
  Math.round(t.rect.height),
1131
1262
  "px"
1132
1263
  ] })
1133
1264
  ] }),
1134
- /* @__PURE__ */ a("div", { className: "pbu-field", children: [
1135
- /* @__PURE__ */ e("label", { children: "단위" }),
1136
- /* @__PURE__ */ e("span", { children: t.granularity === "all" ? "전체" : t.granularity === "section" ? "섹션" : "유닛" })
1265
+ /* @__PURE__ */ s("div", { className: "pbu-field", children: [
1266
+ /* @__PURE__ */ o("label", { children: "단위" }),
1267
+ /* @__PURE__ */ o("span", { children: t.granularity === "all" ? "전체" : t.granularity === "section" ? "섹션" : "유닛" })
1137
1268
  ] }),
1138
- /* @__PURE__ */ e(Ae, {})
1139
- ] }) : /* @__PURE__ */ a("div", { className: "pbu-panel-empty", children: [
1269
+ /* @__PURE__ */ o(He, {})
1270
+ ] }) : /* @__PURE__ */ s("div", { className: "pbu-panel-empty", children: [
1140
1271
  "화면에서 블록에 마우스를 올리고 클릭해 선택하세요.",
1141
- /* @__PURE__ */ e("br", {}),
1272
+ /* @__PURE__ */ o("br", {}),
1142
1273
  "상단 토글로 ",
1143
- /* @__PURE__ */ e("b", { children: "전체 / 섹션 / 유닛" }),
1274
+ /* @__PURE__ */ o("b", { children: "전체 / 섹션 / 유닛" }),
1144
1275
  " 단위를 바꿀 수 있어요."
1145
1276
  ] })
1146
1277
  ] });
1147
1278
  }
1148
- function He({ ia: t }) {
1149
- const o = k((d) => d.viewerPath), n = k((d) => d.closeViewer), r = k((d) => d.granularity), l = k((d) => d.setGranularity), s = k((d) => d.inspectEnabled), c = k((d) => d.setInspectEnabled), i = H(null), f = H(null), [g, p] = v(!1), m = t.nodes.find((d) => d.path === o), _ = () => {
1150
- f.current?.destroy(), f.current = null;
1151
- const d = i.current;
1152
- if (!d || !o) return;
1153
- const C = k.getState(), E = $e(d, {
1154
- pagePath: o,
1279
+ function Je({ ia: t }) {
1280
+ const e = y((f) => f.viewerPath), r = y((f) => f.closeViewer), n = y((f) => f.granularity), l = y((f) => f.setGranularity), p = y((f) => f.inspectEnabled), c = y((f) => f.setInspectEnabled), a = $(null), u = $(null), [g, b] = N(!1), d = t.nodes.find((f) => f.path === e), v = () => {
1281
+ u.current?.destroy(), u.current = null;
1282
+ const f = a.current;
1283
+ if (!f || !e) return;
1284
+ const C = y.getState(), P = Ae(f, {
1285
+ pagePath: e,
1155
1286
  granularity: C.granularity,
1156
1287
  enabled: C.inspectEnabled,
1157
- onSelect: (P, T) => (
1288
+ onSelect: (E, T) => (
1158
1289
  // 20K 상한 — 프롬프트 비대화 방지
1159
- k.getState().setSelectionWithHTML(P, T.outerHTML.slice(0, 2e4))
1290
+ y.getState().setSelectionWithHTML(E, T.outerHTML.slice(0, 2e4))
1160
1291
  )
1161
1292
  });
1162
- if (!E) {
1163
- p(!0);
1293
+ if (!P) {
1294
+ b(!0);
1164
1295
  return;
1165
1296
  }
1166
- p(!1), f.current = E;
1297
+ b(!1), u.current = P;
1167
1298
  };
1168
- return A(() => () => f.current?.destroy(), []), A(() => {
1169
- f.current?.setGranularity(r);
1170
- }, [r]), A(() => {
1171
- f.current?.setEnabled(s);
1172
- }, [s]), A(() => {
1173
- const d = (C) => {
1174
- C.key === "Escape" && (k.getState().skillDrawerOpen || n());
1299
+ return L(() => () => u.current?.destroy(), []), L(() => {
1300
+ u.current?.setGranularity(n);
1301
+ }, [n]), L(() => {
1302
+ u.current?.setEnabled(p);
1303
+ }, [p]), L(() => {
1304
+ const f = (C) => {
1305
+ C.key === "Escape" && (y.getState().skillDrawerOpen || r());
1175
1306
  };
1176
- return window.addEventListener("keydown", d), () => window.removeEventListener("keydown", d);
1177
- }, [n]), m ? /* @__PURE__ */ a("div", { className: "pbu-viewer", children: [
1178
- /* @__PURE__ */ a("div", { className: "pbu-bar", children: [
1179
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-btn", onClick: n, children: "← 맵으로" }),
1180
- /* @__PURE__ */ a("span", { className: "pbu-viewer-title", children: [
1181
- m.title,
1182
- /* @__PURE__ */ e("code", { children: m.path })
1307
+ return window.addEventListener("keydown", f), () => window.removeEventListener("keydown", f);
1308
+ }, [r]), d ? /* @__PURE__ */ s("div", { className: "pbu-viewer", children: [
1309
+ /* @__PURE__ */ s("div", { className: "pbu-bar", children: [
1310
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn", onClick: r, children: "← 맵으로" }),
1311
+ /* @__PURE__ */ s("span", { className: "pbu-viewer-title", children: [
1312
+ d.title,
1313
+ /* @__PURE__ */ o("code", { children: d.path })
1183
1314
  ] }),
1184
- /* @__PURE__ */ e("span", { className: "pbu-spacer" }),
1185
- g && /* @__PURE__ */ e("span", { className: "pbu-hint", children: "⚠ 이 페이지는 검사할 수 없어요" }),
1186
- /* @__PURE__ */ a("div", { className: "pbu-seg", role: "group", "aria-label": "블록 단위", children: [
1187
- /* @__PURE__ */ e(
1315
+ /* @__PURE__ */ o("span", { className: "pbu-spacer" }),
1316
+ g && /* @__PURE__ */ o("span", { className: "pbu-hint", children: "⚠ 이 페이지는 검사할 수 없어요" }),
1317
+ /* @__PURE__ */ s("div", { className: "pbu-seg", role: "group", "aria-label": "블록 단위", children: [
1318
+ /* @__PURE__ */ o(
1188
1319
  "button",
1189
1320
  {
1190
1321
  type: "button",
1191
- className: r === "all" ? "pbu-on" : "",
1322
+ className: n === "all" ? "pbu-on" : "",
1192
1323
  onClick: () => l("all"),
1193
1324
  children: "전체"
1194
1325
  }
1195
1326
  ),
1196
- /* @__PURE__ */ e(
1327
+ /* @__PURE__ */ o(
1197
1328
  "button",
1198
1329
  {
1199
1330
  type: "button",
1200
- className: r === "section" ? "pbu-on" : "",
1331
+ className: n === "section" ? "pbu-on" : "",
1201
1332
  onClick: () => l("section"),
1202
1333
  children: "섹션"
1203
1334
  }
1204
1335
  ),
1205
- /* @__PURE__ */ e(
1336
+ /* @__PURE__ */ o(
1206
1337
  "button",
1207
1338
  {
1208
1339
  type: "button",
1209
- className: r === "unit" ? "pbu-on" : "",
1340
+ className: n === "unit" ? "pbu-on" : "",
1210
1341
  onClick: () => l("unit"),
1211
1342
  children: "유닛"
1212
1343
  }
1213
1344
  )
1214
1345
  ] }),
1215
- /* @__PURE__ */ a("label", { className: "pbu-toggle", children: [
1216
- /* @__PURE__ */ e(
1346
+ /* @__PURE__ */ s("label", { className: "pbu-toggle", children: [
1347
+ /* @__PURE__ */ o(
1217
1348
  "input",
1218
1349
  {
1219
1350
  type: "checkbox",
1220
- checked: s,
1221
- onChange: (d) => c(d.target.checked)
1351
+ checked: p,
1352
+ onChange: (f) => c(f.target.checked)
1222
1353
  }
1223
1354
  ),
1224
1355
  "검사 모드"
1225
1356
  ] }),
1226
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-icon-btn", onClick: n, "aria-label": "닫기", children: "✕" })
1357
+ /* @__PURE__ */ o(te, {}),
1358
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-icon-btn", onClick: r, "aria-label": "닫기", children: "✕" })
1227
1359
  ] }),
1228
- /* @__PURE__ */ a("div", { className: "pbu-viewer-body", children: [
1229
- /* @__PURE__ */ e("div", { className: "pbu-viewer-frame-wrap", children: /* @__PURE__ */ e(
1360
+ /* @__PURE__ */ s("div", { className: "pbu-viewer-body", children: [
1361
+ /* @__PURE__ */ o("div", { className: "pbu-viewer-frame-wrap", children: /* @__PURE__ */ o(
1230
1362
  "iframe",
1231
1363
  {
1232
- ref: i,
1364
+ ref: a,
1233
1365
  className: "pbu-viewer-iframe",
1234
- src: m.path,
1235
- title: m.title,
1236
- onLoad: _
1366
+ src: d.path,
1367
+ title: d.title,
1368
+ onLoad: v
1237
1369
  }
1238
1370
  ) }),
1239
- /* @__PURE__ */ e(je, {})
1371
+ /* @__PURE__ */ o(Ue, {})
1240
1372
  ] })
1241
1373
  ] }) : null;
1242
1374
  }
1243
- const Be = {
1375
+ const Fe = {
1376
+ builtin: "기본",
1244
1377
  project: "프로젝트",
1245
1378
  global: "글로벌",
1246
1379
  uploaded: "업로드"
1247
- }, Fe = {
1380
+ }, qe = {
1381
+ builtin: "pubuilder에 기본 포함된 퍼블리싱 스킬 · 기본 사용, 여기서는 삭제할 수 없어요",
1248
1382
  project: "현재 프로젝트에서 발견한 스킬 · 여기서는 삭제할 수 없어요",
1249
1383
  global: "내 전역 환경에 설치된 공용 스킬 · 여기서는 삭제할 수 없어요",
1250
1384
  uploaded: "이 스킬함에 직접 올린 Markdown 스킬 · 삭제할 수 있어요"
1251
- }, Ue = ["project", "global", "uploaded"];
1252
- function Ge() {
1253
- const t = k((h) => h.toggleSkillDrawer), o = le(Z), [n, r] = v(!0), [l, s] = v(!1), [c, i] = v([]), [f, g] = v(null), [p, m] = v(""), [_, d] = v(!1), [C, E] = v(null), [P, T] = v(!1), j = H(null), O = H(0), [M, $] = v(null), I = async () => {
1254
- const h = ++O.current;
1255
- r(!0), E(null);
1385
+ }, Ge = ["builtin", "project", "global", "uploaded"];
1386
+ function Ve() {
1387
+ const t = y((x) => x.toggleSkillDrawer), e = H(j), [r, n] = N(!0), [l, p] = N(!1), [c, a] = N([]), [u, g] = N(null), [b, d] = N(""), [v, f] = N(!1), [C, P] = N(null), [E, T] = N(!1), I = $(null), i = $(0), [w, O] = N(null), z = async () => {
1388
+ const x = ++i.current;
1389
+ n(!0), P(null);
1256
1390
  try {
1257
- const x = await o.isAlive();
1258
- if (h !== O.current || (s(x), !x)) return;
1259
- const [N, B] = await Promise.all([o.listSkills(), o.tokenStatus()]);
1260
- if (h !== O.current) return;
1261
- i(N), g(B), d(!B.configured);
1262
- } catch (x) {
1263
- if (h !== O.current) return;
1264
- E(x instanceof Error ? x.message : String(x));
1391
+ const m = await e.isAlive();
1392
+ if (x !== i.current || (p(m), !m)) return;
1393
+ const [M, D] = await Promise.all([e.listSkills(), e.tokenStatus()]);
1394
+ if (x !== i.current) return;
1395
+ a(M), g(D), f(!D.configured);
1396
+ } catch (m) {
1397
+ if (x !== i.current) return;
1398
+ P(m instanceof Error ? m.message : String(m));
1265
1399
  } finally {
1266
- h === O.current && r(!1);
1400
+ x === i.current && n(!1);
1267
1401
  }
1268
1402
  };
1269
- A(() => {
1270
- I();
1271
- }, []), A(() => {
1272
- const h = (x) => {
1273
- x.key === "Escape" && t();
1403
+ L(() => {
1404
+ z();
1405
+ }, []), L(() => {
1406
+ const x = (m) => {
1407
+ m.key === "Escape" && t();
1274
1408
  };
1275
- return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
1409
+ return window.addEventListener("keydown", x), () => window.removeEventListener("keydown", x);
1276
1410
  }, [t]);
1277
- const b = async (h, x) => {
1278
- if (!M) {
1279
- $(h);
1411
+ const h = async (x, m) => {
1412
+ if (!w) {
1413
+ O(x);
1280
1414
  try {
1281
- await x();
1282
- } catch (N) {
1283
- E(N instanceof Error ? N.message : String(N));
1415
+ await m();
1416
+ } catch (M) {
1417
+ P(M instanceof Error ? M.message : String(M));
1284
1418
  } finally {
1285
- $(null);
1419
+ O(null);
1286
1420
  }
1287
1421
  }
1288
- }, y = (h, x) => b(`toggle:${h}`, async () => {
1289
- await o.toggleSkill(h, x), await I();
1290
- }), w = (h, x) => {
1291
- window.confirm(`"${x}" 스킬을 삭제할까요?`) && b(`remove:${h}`, async () => {
1292
- await o.removeSkill(h), await I();
1422
+ }, _ = (x, m) => h(`toggle:${x}`, async () => {
1423
+ await e.toggleSkill(x, m), await z();
1424
+ }), k = (x, m) => {
1425
+ window.confirm(`"${m}" 스킬을 삭제할까요?`) && h(`remove:${x}`, async () => {
1426
+ await e.removeSkill(x), await z();
1293
1427
  });
1294
- }, S = () => j.current?.click(), R = (h) => {
1295
- const x = h.target.files?.[0];
1296
- h.target.value = "", x && b("upload", async () => {
1297
- const N = new FileReader(), B = await new Promise((u, z) => {
1298
- N.onload = () => u(String(N.result ?? "")), N.onerror = () => z(N.error ?? new Error("파일을 읽을 수 없어요")), N.readAsText(x);
1428
+ }, S = () => I.current?.click(), V = (x) => {
1429
+ const m = x.target.files?.[0];
1430
+ x.target.value = "", m && h("upload", async () => {
1431
+ const M = new FileReader(), D = await new Promise((ie, se) => {
1432
+ M.onload = () => ie(String(M.result ?? "")), M.onerror = () => se(M.error ?? new Error("파일을 읽을 수 없어요")), M.readAsText(m);
1299
1433
  });
1300
- await o.uploadSkill(x.name, B), await I();
1434
+ await e.uploadSkill(m.name, D), await z();
1301
1435
  });
1302
- }, D = () => b("token:save", async () => {
1303
- p.trim() && (await o.saveToken(p.trim()), m(""), await I());
1304
- }), F = () => b("token:delete", async () => {
1305
- await o.deleteToken(), m(""), await I();
1306
- }), W = async () => {
1436
+ }, re = () => h("token:save", async () => {
1437
+ b.trim() && (await e.saveToken(b.trim()), d(""), await z());
1438
+ }), le = () => h("token:delete", async () => {
1439
+ await e.deleteToken(), d(""), await z();
1440
+ }), ae = async () => {
1307
1441
  await navigator.clipboard.writeText("npx pubuilder serve"), T(!0), setTimeout(() => T(!1), 1200);
1308
- }, U = Ue.map((h) => ({
1309
- source: h,
1310
- label: Be[h],
1311
- items: c.filter((x) => x.source === h)
1312
- })).filter((h) => h.items.length > 0), G = c.filter((h) => h.enabled).length;
1313
- return /* @__PURE__ */ a("aside", { className: "pbu-drawer", children: [
1314
- /* @__PURE__ */ a("div", { className: "pbu-drawer-header", children: [
1315
- /* @__PURE__ */ a("div", { children: [
1316
- /* @__PURE__ */ e("span", { className: "pbu-panel-title", children: "스킬함" }),
1317
- /* @__PURE__ */ e("span", { className: "pbu-drawer-kicker", children: "퍼블리싱 실행 설정" })
1442
+ }, K = Ge.map((x) => ({
1443
+ source: x,
1444
+ label: Fe[x],
1445
+ items: c.filter((m) => m.source === x)
1446
+ })).filter((x) => x.items.length > 0), ce = c.filter((x) => x.enabled).length;
1447
+ return /* @__PURE__ */ s("aside", { className: "pbu-drawer", children: [
1448
+ /* @__PURE__ */ s("div", { className: "pbu-drawer-header", children: [
1449
+ /* @__PURE__ */ s("div", { children: [
1450
+ /* @__PURE__ */ o("span", { className: "pbu-panel-title", children: "스킬함" }),
1451
+ /* @__PURE__ */ o("span", { className: "pbu-drawer-kicker", children: "퍼블리싱 실행 설정" })
1318
1452
  ] }),
1319
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-icon-btn", onClick: t, "aria-label": "닫기", children: "✕" })
1453
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-icon-btn", onClick: t, "aria-label": "닫기", children: "✕" })
1320
1454
  ] }),
1321
- /* @__PURE__ */ a("div", { className: "pbu-drawer-guide", children: [
1322
- /* @__PURE__ */ e("strong", { children: "다음 퍼블리싱에 적용할 규칙을 고르세요." }),
1323
- /* @__PURE__ */ e("span", { children: "체크된 스킬의 지침만 AI에게 전달됩니다. 변경 사항은 다음 실행부터 적용돼요." }),
1324
- !n && l && /* @__PURE__ */ a("div", { className: "pbu-guide-status", children: [
1325
- /* @__PURE__ */ e("span", { className: "pbu-status-dot pbu-status-dot-on" }),
1326
- c.length > 0 ? `${G}/${c.length}개 스킬 사용 중` : "사용 가능한 스킬 없음"
1455
+ /* @__PURE__ */ s("div", { className: "pbu-drawer-guide", children: [
1456
+ /* @__PURE__ */ o("strong", { children: "다음 퍼블리싱에 적용할 규칙을 고르세요." }),
1457
+ /* @__PURE__ */ o("span", { children: "체크된 스킬의 지침만 AI에게 전달됩니다. 변경 사항은 다음 실행부터 적용돼요." }),
1458
+ !r && l && /* @__PURE__ */ s("div", { className: "pbu-guide-status", children: [
1459
+ /* @__PURE__ */ o("span", { className: "pbu-status-dot pbu-status-dot-on" }),
1460
+ c.length > 0 ? `${ce}/${c.length}개 스킬 사용 중` : "사용 가능한 스킬 없음"
1327
1461
  ] })
1328
1462
  ] }),
1329
- C && /* @__PURE__ */ a("div", { className: "pbu-drawer-error", children: [
1330
- /* @__PURE__ */ e("span", { children: C }),
1331
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-icon-btn", onClick: () => E(null), "aria-label": "닫기", children: "✕" })
1463
+ C && /* @__PURE__ */ s("div", { className: "pbu-drawer-error", children: [
1464
+ /* @__PURE__ */ o("span", { children: C }),
1465
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-icon-btn", onClick: () => P(null), "aria-label": "닫기", children: "✕" })
1332
1466
  ] }),
1333
- n ? /* @__PURE__ */ e("div", { className: "pbu-panel-empty", children: "불러오는 중..." }) : l ? /* @__PURE__ */ a(ne, { children: [
1334
- /* @__PURE__ */ a("div", { className: "pbu-drawer-section-head", children: [
1335
- /* @__PURE__ */ a("div", { children: [
1336
- /* @__PURE__ */ e("strong", { children: "Figma 연결" }),
1337
- /* @__PURE__ */ e("span", { children: "노드 링크에서 시안 이미지와 구조 정보를 읽을 때 사용해요." })
1467
+ r ? /* @__PURE__ */ o("div", { className: "pbu-panel-empty", children: "불러오는 중..." }) : l ? /* @__PURE__ */ s(ee, { children: [
1468
+ /* @__PURE__ */ s("div", { className: "pbu-drawer-section-head", children: [
1469
+ /* @__PURE__ */ s("div", { children: [
1470
+ /* @__PURE__ */ o("strong", { children: "Figma 연결" }),
1471
+ /* @__PURE__ */ o("span", { children: "노드 링크에서 시안 이미지와 구조 정보를 읽을 때 사용해요." })
1338
1472
  ] }),
1339
- /* @__PURE__ */ e("span", { className: `pbu-status-badge ${f?.configured ? "pbu-status-on" : "pbu-status-off"}`, children: f?.configured ? "연결됨" : "연결 필요" })
1473
+ /* @__PURE__ */ o("span", { className: `pbu-status-badge ${u?.configured ? "pbu-status-on" : "pbu-status-off"}`, children: u?.configured ? "연결됨" : "연결 필요" })
1340
1474
  ] }),
1341
- f?.configured && !_ ? /* @__PURE__ */ a("div", { className: "pbu-field", children: [
1342
- /* @__PURE__ */ e("span", { className: "pbu-token-masked", children: f.masked }),
1343
- /* @__PURE__ */ a("div", { children: [
1344
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-btn", disabled: M !== null, onClick: () => d(!0), children: "재입력" }),
1345
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-btn", disabled: M !== null, onClick: F, children: "삭제" })
1475
+ u?.configured && !v ? /* @__PURE__ */ s("div", { className: "pbu-field", children: [
1476
+ /* @__PURE__ */ o("span", { className: "pbu-token-masked", children: u.masked }),
1477
+ /* @__PURE__ */ s("div", { children: [
1478
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn", disabled: w !== null, onClick: () => f(!0), children: "재입력" }),
1479
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn", disabled: w !== null, onClick: le, children: "삭제" })
1346
1480
  ] })
1347
- ] }) : /* @__PURE__ */ a("div", { className: "pbu-field", children: [
1348
- /* @__PURE__ */ e(
1481
+ ] }) : /* @__PURE__ */ s("div", { className: "pbu-field", children: [
1482
+ /* @__PURE__ */ o(
1349
1483
  "input",
1350
1484
  {
1351
1485
  type: "password",
1352
- value: p,
1353
- onChange: (h) => m(h.target.value),
1486
+ value: b,
1487
+ onChange: (x) => d(x.target.value),
1354
1488
  placeholder: "Figma 토큰"
1355
1489
  }
1356
1490
  ),
1357
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-btn pbu-btn-primary", disabled: M !== null, onClick: D, children: "저장" })
1491
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn pbu-btn-primary", disabled: w !== null, onClick: re, children: "저장" })
1358
1492
  ] }),
1359
- /* @__PURE__ */ a("div", { className: "pbu-drawer-section-head pbu-drawer-section-head-skills", children: [
1360
- /* @__PURE__ */ a("div", { children: [
1361
- /* @__PURE__ */ e("strong", { children: "AI 작업 스킬" }),
1362
- /* @__PURE__ */ e("span", { children: "스킬은 AI에게 전달되는 작업 규칙이 담긴 Markdown 파일이에요." })
1493
+ /* @__PURE__ */ s("div", { className: "pbu-drawer-section-head pbu-drawer-section-head-skills", children: [
1494
+ /* @__PURE__ */ s("div", { children: [
1495
+ /* @__PURE__ */ o("strong", { children: "AI 작업 스킬" }),
1496
+ /* @__PURE__ */ o("span", { children: "스킬은 AI에게 전달되는 작업 규칙이 담긴 Markdown 파일이에요." })
1363
1497
  ] }),
1364
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-btn", disabled: M !== null, onClick: S, children: "업로드" }),
1365
- /* @__PURE__ */ e(
1498
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn", disabled: w !== null, onClick: S, children: "업로드" }),
1499
+ /* @__PURE__ */ o(
1366
1500
  "input",
1367
1501
  {
1368
- ref: j,
1502
+ ref: I,
1369
1503
  type: "file",
1370
1504
  accept: ".md",
1371
1505
  style: { display: "none" },
1372
- onChange: R
1506
+ onChange: V
1373
1507
  }
1374
1508
  )
1375
1509
  ] }),
1376
- U.length === 0 ? /* @__PURE__ */ e("div", { className: "pbu-panel-empty", children: "등록된 스킬이 없어요." }) : U.map((h) => /* @__PURE__ */ a("div", { children: [
1377
- /* @__PURE__ */ a("div", { className: "pbu-skill-source", children: [
1378
- /* @__PURE__ */ e("strong", { children: h.label }),
1379
- /* @__PURE__ */ e("span", { children: Fe[h.source] })
1510
+ K.length === 0 ? /* @__PURE__ */ o("div", { className: "pbu-panel-empty", children: "등록된 스킬이 없어요." }) : K.map((x) => /* @__PURE__ */ s("div", { children: [
1511
+ /* @__PURE__ */ s("div", { className: "pbu-skill-source", children: [
1512
+ /* @__PURE__ */ o("strong", { children: x.label }),
1513
+ /* @__PURE__ */ o("span", { children: qe[x.source] })
1380
1514
  ] }),
1381
- h.items.map((x) => /* @__PURE__ */ a("div", { className: "pbu-skill-row", children: [
1382
- /* @__PURE__ */ a("label", { className: "pbu-toggle", children: [
1383
- /* @__PURE__ */ e(
1515
+ x.items.map((m) => /* @__PURE__ */ s("div", { className: "pbu-skill-row", children: [
1516
+ /* @__PURE__ */ s("label", { className: "pbu-toggle", children: [
1517
+ /* @__PURE__ */ o(
1384
1518
  "input",
1385
1519
  {
1386
1520
  type: "checkbox",
1387
- checked: x.enabled,
1388
- disabled: M !== null,
1389
- onChange: (N) => y(x.id, N.target.checked)
1521
+ checked: m.enabled,
1522
+ disabled: w !== null,
1523
+ onChange: (M) => _(m.id, M.target.checked)
1390
1524
  }
1391
1525
  ),
1392
- x.name
1526
+ m.name
1393
1527
  ] }),
1394
- /* @__PURE__ */ e("span", { className: "pbu-hint", title: x.description, children: x.description }),
1395
- /* @__PURE__ */ e("span", { className: `pbu-skill-state ${x.enabled ? "pbu-skill-state-on" : ""}`, children: M === `toggle:${x.id}` ? "변경 중" : x.enabled ? "사용 중" : "제외됨" }),
1396
- x.source === "uploaded" && /* @__PURE__ */ e(
1528
+ /* @__PURE__ */ o("span", { className: "pbu-hint", title: m.description, children: m.description }),
1529
+ /* @__PURE__ */ o("span", { className: `pbu-skill-state ${m.enabled ? "pbu-skill-state-on" : ""}`, children: w === `toggle:${m.id}` ? "변경 중" : m.enabled ? "사용 중" : "제외됨" }),
1530
+ m.source === "uploaded" && /* @__PURE__ */ o(
1397
1531
  "button",
1398
1532
  {
1399
1533
  type: "button",
1400
1534
  className: "pbu-icon-btn",
1401
- disabled: M !== null,
1402
- onClick: () => w(x.id, x.name),
1535
+ disabled: w !== null,
1536
+ onClick: () => k(m.id, m.name),
1403
1537
  "aria-label": "삭제",
1404
1538
  children: "🗑"
1405
1539
  }
1406
1540
  )
1407
- ] }, x.id))
1408
- ] }, h.source))
1409
- ] }) : /* @__PURE__ */ a("div", { className: "pbu-panel-empty", children: [
1541
+ ] }, m.id))
1542
+ ] }, x.source))
1543
+ ] }) : /* @__PURE__ */ s("div", { className: "pbu-panel-empty", children: [
1410
1544
  "컴패니언 서버가 꺼져 있어요",
1411
- /* @__PURE__ */ a("div", { className: "pbu-drawer-code", children: [
1412
- /* @__PURE__ */ e("code", { children: "npx pubuilder serve" }),
1413
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-btn", onClick: W, children: P ? "복사됨 ✓" : "복사" })
1545
+ /* @__PURE__ */ s("div", { className: "pbu-drawer-code", children: [
1546
+ /* @__PURE__ */ o("code", { children: "npx pubuilder serve" }),
1547
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn", onClick: ae, children: E ? "복사됨 ✓" : "복사" })
1414
1548
  ] }),
1415
- /* @__PURE__ */ e("div", { className: "pbu-hint", children: 'package.json의 dev 스크립트를 "pubuilder dev -- <기존 명령>"으로 감싸면 자동 실행돼요' }),
1416
- /* @__PURE__ */ e("button", { type: "button", className: "pbu-btn", onClick: I, children: "다시 확인" })
1549
+ /* @__PURE__ */ o("div", { className: "pbu-hint", children: 'package.json의 dev 스크립트를 "pubuilder dev -- <기존 명령>"으로 감싸면 자동 실행돼요' }),
1550
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn", onClick: z, children: "다시 확인" })
1417
1551
  ] })
1418
1552
  ] });
1419
1553
  }
1420
- function Xe({ config: t, enabled: o = !0, serverUrl: n }) {
1421
- const r = o && !xe(), [l, s] = v(!1), c = k((m) => m.isMapOpen), i = k((m) => m.viewerPath), f = k((m) => m.skillDrawerOpen), g = K(() => be(t), [t]), p = K(() => new ae(n), [n]);
1554
+ function Ke() {
1555
+ const t = H(j), e = y((d) => d.suspendConflicts), r = y((d) => d.suspendResolutions), n = y((d) => d.setConflictResolution), l = y((d) => d.clearSuspend), [p, c] = N(!1), [a, u] = N(null);
1556
+ if (e.length === 0) return null;
1557
+ const g = e.every((d) => r[d.file]), b = async () => {
1558
+ c(!0), u(null);
1559
+ try {
1560
+ await t.resolveSuspend(e.map((d) => r[d.file])), l();
1561
+ } catch (d) {
1562
+ u(d instanceof Error ? d.message : String(d));
1563
+ } finally {
1564
+ c(!1);
1565
+ }
1566
+ };
1567
+ return /* @__PURE__ */ o("div", { className: "pbu-suspend-overlay", children: /* @__PURE__ */ s("div", { className: "pbu-suspend-panel", children: [
1568
+ /* @__PURE__ */ s("div", { className: "pbu-suspend-head", children: [
1569
+ /* @__PURE__ */ s("strong", { children: [
1570
+ "일시 종료 — 충돌 ",
1571
+ e.length,
1572
+ "건"
1573
+ ] }),
1574
+ /* @__PURE__ */ o("span", { children: "롤백이 다른 변경과 겹쳐요. 파일마다 처리를 골라주세요. 충돌 없는 파일은 이미 되돌렸어요." })
1575
+ ] }),
1576
+ e.map((d) => {
1577
+ const v = r[d.file];
1578
+ return /* @__PURE__ */ s("div", { className: "pbu-conflict-row", children: [
1579
+ /* @__PURE__ */ o("div", { className: "pbu-conflict-file", children: d.file }),
1580
+ /* @__PURE__ */ s("div", { className: "pbu-conflict-actions", children: [
1581
+ /* @__PURE__ */ o(
1582
+ "button",
1583
+ {
1584
+ type: "button",
1585
+ className: `pbu-btn ${v?.action === "revert" ? "pbu-btn-primary" : ""}`,
1586
+ onClick: () => n(d.file, "revert"),
1587
+ children: "이전으로"
1588
+ }
1589
+ ),
1590
+ /* @__PURE__ */ o(
1591
+ "button",
1592
+ {
1593
+ type: "button",
1594
+ className: `pbu-btn ${v?.action === "keep" ? "pbu-btn-primary" : ""}`,
1595
+ onClick: () => n(d.file, "keep"),
1596
+ children: "현재 유지"
1597
+ }
1598
+ ),
1599
+ /* @__PURE__ */ o(
1600
+ "button",
1601
+ {
1602
+ type: "button",
1603
+ className: `pbu-btn ${v?.action === "edit" ? "pbu-btn-primary" : ""}`,
1604
+ onClick: () => n(d.file, "edit", d.current),
1605
+ children: "편집"
1606
+ }
1607
+ )
1608
+ ] }),
1609
+ v?.action === "edit" && /* @__PURE__ */ o(
1610
+ "textarea",
1611
+ {
1612
+ className: "pbu-conflict-edit",
1613
+ value: v.content ?? "",
1614
+ onChange: (f) => n(d.file, "edit", f.target.value),
1615
+ rows: 6
1616
+ }
1617
+ )
1618
+ ] }, d.file);
1619
+ }),
1620
+ a && /* @__PURE__ */ o("div", { className: "pbu-drawer-error", children: /* @__PURE__ */ o("span", { children: a }) }),
1621
+ /* @__PURE__ */ s("div", { className: "pbu-suspend-foot", children: [
1622
+ /* @__PURE__ */ o("button", { type: "button", className: "pbu-btn", onClick: l, disabled: p, children: "닫기" }),
1623
+ /* @__PURE__ */ o(
1624
+ "button",
1625
+ {
1626
+ type: "button",
1627
+ className: "pbu-btn pbu-btn-primary",
1628
+ onClick: b,
1629
+ disabled: !g || p,
1630
+ children: p ? "적용 중..." : "모두 해결 후 적용"
1631
+ }
1632
+ )
1633
+ ] })
1634
+ ] }) });
1635
+ }
1636
+ function oo({ config: t, enabled: e = !0, serverUrl: r }) {
1637
+ const n = e && !ye(), [l, p] = N(!1), c = y((d) => d.isMapOpen), a = y((d) => d.viewerPath), u = y((d) => d.skillDrawerOpen), g = J(() => fe(t), [t]), b = J(() => new oe(r), [r]);
1422
1638
  return ue(() => {
1423
- r && window.self === window.top && (ke(), s(!0));
1424
- }, [r]), !l || !r ? null : pe(
1425
- /* @__PURE__ */ a(Z.Provider, { value: p, children: [
1426
- /* @__PURE__ */ e(Se, {}),
1427
- c && /* @__PURE__ */ e(Ee, { ia: g }),
1428
- i && /* @__PURE__ */ e(He, { ia: g }),
1429
- f && /* @__PURE__ */ e(Ge, {})
1639
+ n && window.self === window.top && (ze(), p(!0));
1640
+ }, [n]), !l || !n ? null : be(
1641
+ /* @__PURE__ */ s(j.Provider, { value: b, children: [
1642
+ /* @__PURE__ */ o(Te, {}),
1643
+ c && /* @__PURE__ */ o(Pe, { ia: g }),
1644
+ a && /* @__PURE__ */ o(Je, { ia: g }),
1645
+ u && /* @__PURE__ */ o(Ve, {}),
1646
+ /* @__PURE__ */ o(Ke, {})
1430
1647
  ] }),
1431
1648
  document.body
1432
1649
  );
1433
1650
  }
1434
1651
  export {
1435
- Xe as PageMap,
1436
- et as defineIA,
1437
- be as normalizeIA
1652
+ oo as PageMap,
1653
+ ro as defineIA,
1654
+ fe as normalizeIA
1438
1655
  };
1439
1656
  //# sourceMappingURL=index.js.map