lavish-axi 0.1.87 → 0.1.89
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/README.md +1 -1
- package/dist/chrome-client.js +3 -3
- package/dist/cli.mjs +9 -5
- package/dist/whiteboard/whiteboard.js +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
package/README.md
CHANGED
|
@@ -212,7 +212,7 @@ pnpm link
|
|
|
212
212
|
In the annotation card, Enter queues the annotation, Shift+Enter inserts a newline, and Ctrl+Enter (Cmd+Enter on macOS) queues it and sends all queued prompts immediately. Escape closes the card, same as Cancel, but only while it is empty (no text, no attachment); with unsent text or an attachment present, Escape does nothing rather than risk discarding it.
|
|
213
213
|
While editing a queued note, Enter saves it, Shift+Enter inserts a newline, and Escape discards the edit.
|
|
214
214
|
Cmd+I or Ctrl+I toggles between annotate and explore mode from either the browser chrome or the artifact iframe, including while focus is in a textarea or control.
|
|
215
|
-
In annotate mode a plain click on a link annotates it; Ctrl+click (Cmd+click on macOS) follows the link instead, opening it in a new tab as the browser normally would, without leaving annotate mode.
|
|
215
|
+
In annotate mode a plain click on a link annotates it; Ctrl+click (Cmd+click on macOS) follows the link instead, opening it in a new tab as the browser normally would, without leaving annotate mode. Off macOS, Meta+click (the Windows or Super key) annotates like a plain click.
|
|
216
216
|
- **Agent presence** - The browser shows when no agent is listening, keeps queued feedback for the next successful `lavish-axi poll` send even across reloads, and keeps human feedback actions available while the agent is working because the server queues them for the next poll. An agent reply concludes delivered work and returns presence to waiting (see the CLI Reference for reply and poll commands). A supervisor-owned process listener is shown as an external listener rather than an idle captain turn.
|
|
217
217
|
- **Delivery receipts** - Every note you have sent carries three emoji under it that light up in turn: 👀 **Seen** when a `lavish-axi poll` takes the note, 🛠️ **Working** when the artifact file changes after that, and ✅ **Done** when the agent replies. A step that has not happened yet is the same emoji greyed out. All three come from what the server observes; the agent does nothing extra. Until 👀 lights, the row says why: no agent is listening, or the agent is busy and the note is delivered on its next poll. A note answered without touching the artifact goes Seen to Done with Working still grey. A reply marks every note the agent has seen as Done, not notes still waiting for a poll. Each emoji names its step and time on hover and to screen readers. Notes sent before receipts existed show no receipt row.
|
|
218
218
|
In a Herdr-managed pane, set `LAVISH_AXI_HERDR_CHIME=1` to show a Herdr request notification and play its chime once an indefinite poll enters the waiting state. Immediate queued feedback and timed debug polls do not trigger a notification. The integration is off unless both `LAVISH_AXI_HERDR_CHIME` and Herdr's `HERDR_ENV` session marker equal `1`; leaving either unset or using any other value opts out. Notification delivery runs without blocking feedback: if Herdr is unavailable, rejects the notification, stalls, or fails, the poll continues unchanged.
|
package/dist/chrome-client.js
CHANGED
|
@@ -1596,11 +1596,11 @@ queuedLog.addEventListener("keydown", (event) => {
|
|
|
1596
1596
|
const target = /** @type {Element | null} */ (event.target);
|
|
1597
1597
|
if (!target || typeof target.closest !== "function" || !target.closest(".queued-edit-input")) return;
|
|
1598
1598
|
// The annotation card's keys: Enter keeps the words, Shift+Enter breaks the line.
|
|
1599
|
-
if (event.key === "Enter" && !event.shiftKey && !event.isComposing) {
|
|
1599
|
+
if (event.key === "Enter" && !event.shiftKey && !event.isComposing && event.keyCode !== 229) {
|
|
1600
1600
|
event.preventDefault();
|
|
1601
1601
|
event.stopPropagation();
|
|
1602
1602
|
saveQueuedEdit();
|
|
1603
|
-
} else if (event.key === "Escape" && !event.isComposing) {
|
|
1603
|
+
} else if (event.key === "Escape" && !event.isComposing && event.keyCode !== 229) {
|
|
1604
1604
|
event.preventDefault();
|
|
1605
1605
|
event.stopPropagation();
|
|
1606
1606
|
cancelQueuedEdit();
|
|
@@ -4521,7 +4521,7 @@ chatAttachments.addEventListener("click", (event) => {
|
|
|
4521
4521
|
if (retry) chatAttachmentController.retry(String(retry.dataset.chatAttachmentRetry || ""));
|
|
4522
4522
|
});
|
|
4523
4523
|
chatInput.addEventListener("keydown", (event) => {
|
|
4524
|
-
if (event.key === "Enter" && !event.shiftKey && !event.isComposing) {
|
|
4524
|
+
if (event.key === "Enter" && !event.shiftKey && !event.isComposing && event.keyCode !== 229) {
|
|
4525
4525
|
event.preventDefault();
|
|
4526
4526
|
sendQueued(false);
|
|
4527
4527
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -6890,6 +6890,9 @@ function createArtifactSdk(deriveQueueKey, isNativeInteractive = isNativeInterac
|
|
|
6890
6890
|
selected = null;
|
|
6891
6891
|
if (hadCard) scheduleReviewStateReport();
|
|
6892
6892
|
}
|
|
6893
|
+
function isApplePlatform() {
|
|
6894
|
+
return /Mac|iP(hone|ad|od)/.test(navigator.platform);
|
|
6895
|
+
}
|
|
6893
6896
|
function showAnnotationCard(target, options2 = {}) {
|
|
6894
6897
|
cancelPendingDraftRestore();
|
|
6895
6898
|
const root = ensureShadow();
|
|
@@ -6913,7 +6916,7 @@ function createArtifactSdk(deriveQueueKey, isNativeInteractive = isNativeInterac
|
|
|
6913
6916
|
const tableLabel = isTableCell ? [c.target?.rowLabel, c.target?.columnLabel].filter(Boolean).join(" \u2192 ") : "";
|
|
6914
6917
|
const heading = c.tag === "text" ? "Annotate text" : tableLabel ? isCellItself ? "Annotate cell: " + escapeAnnotationText(tableLabel) : "Annotate <" + c.tag + "> in " + escapeAnnotationText(tableLabel) : c.tag === "mermaid-node" ? "Annotate node" + (nodeLabel ? ": " + escapeAnnotationText(nodeLabel) : "") : "Annotate <" + c.tag + ">";
|
|
6915
6918
|
const placeholder = c.tag === "text" ? "Tell the agent what to change about this text..." : isCellItself ? "Tell the agent what to change about this table cell..." : c.tag === "mermaid-node" ? "Tell the agent what to change about this diagram node..." : "Tell the agent what to change about this element...";
|
|
6916
|
-
const sendNowHint =
|
|
6919
|
+
const sendNowHint = isApplePlatform() ? "\u2318" : "Ctrl";
|
|
6917
6920
|
card.innerHTML = '<div class="lavish-heading">' + heading + '</div><textarea placeholder="' + placeholder + '"></textarea><div class="lavish-attachments" data-attachments hidden></div><div class="lavish-attach-row"><button class="lavish-attach" type="button"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="M21 15l-5-5L5 21"/></svg><span>Attach image</span></button><input class="lavish-attach-input" type="file" accept="' + ATTACHMENT_IMAGE_TYPES.accept + '" multiple hidden></div><div class="lavish-hint">Enter to queue · ' + sendNowHint + '+Enter to send · paste or drop an image</div><div class="lavish-row"><button class="lavish-cancel" type="button">Cancel</button><button class="lavish-send" type="button">Queue</button></div>';
|
|
6918
6921
|
root.appendChild(card);
|
|
6919
6922
|
function positionCard() {
|
|
@@ -7016,12 +7019,12 @@ function createArtifactSdk(deriveQueueKey, isNativeInteractive = isNativeInterac
|
|
|
7016
7019
|
tryQueue();
|
|
7017
7020
|
};
|
|
7018
7021
|
textarea.addEventListener("keydown", (event) => {
|
|
7019
|
-
if (event.key === "Enter" && !event.shiftKey && !event.isComposing) {
|
|
7022
|
+
if (event.key === "Enter" && !event.shiftKey && !event.isComposing && event.keyCode !== 229) {
|
|
7020
7023
|
event.preventDefault();
|
|
7021
7024
|
const sendNow = (event.ctrlKey || event.metaKey) && (!!textarea.value.trim() || attachments.hasReady());
|
|
7022
7025
|
const queued = tryQueue();
|
|
7023
7026
|
if (queued && sendNow) sendQueuedPrompts();
|
|
7024
|
-
} else if (event.key === "Escape" && !event.isComposing) {
|
|
7027
|
+
} else if (event.key === "Escape" && !event.isComposing && event.keyCode !== 229) {
|
|
7025
7028
|
if (textarea.value.trim() || attachments.hasPending() || attachments.hasErrors() || attachments.hasReady())
|
|
7026
7029
|
return;
|
|
7027
7030
|
event.preventDefault();
|
|
@@ -7155,7 +7158,8 @@ function createArtifactSdk(deriveQueueKey, isNativeInteractive = isNativeInterac
|
|
|
7155
7158
|
(event) => {
|
|
7156
7159
|
if (!annotationMode || isLavishUi(event.target) || isLavishAction(event.target) || isInteractiveControl(event.target))
|
|
7157
7160
|
return;
|
|
7158
|
-
|
|
7161
|
+
const followModifier = isApplePlatform() ? event.metaKey : event.ctrlKey;
|
|
7162
|
+
if (followModifier && /** @type {Element} */
|
|
7159
7163
|
event.target?.closest?.("a[href]")) {
|
|
7160
7164
|
ignoreNextClick = false;
|
|
7161
7165
|
return;
|
|
@@ -12774,7 +12778,7 @@ var AGENT_REPLY_INPUT_LIMIT_BYTES = AGENT_REPLY_JSON_LIMIT_BYTES - AGENT_REPLY_J
|
|
|
12774
12778
|
var AGENT_REPLY_LIMIT_LABEL = "2 MB JSON request limit";
|
|
12775
12779
|
var POLL_STATE_HEADER = "lavish-poll-state";
|
|
12776
12780
|
var CODEX_POLL_WAKE_PATH_GUIDANCE = "Codex detected: completed background tasks may not resume Codex automatically, so keep the poll attached to the active turn.";
|
|
12777
|
-
var VERSION = "0.1.
|
|
12781
|
+
var VERSION = "0.1.89";
|
|
12778
12782
|
function detectInvokingAgent(env = process.env) {
|
|
12779
12783
|
return ["CODEX_SANDBOX", "CODEX_THREAD_ID"].some((key) => Object.hasOwn(env, key)) ? "codex" : "generic";
|
|
12780
12784
|
}
|
|
@@ -3348,7 +3348,7 @@ TTD mermaid definition render errror: ${v.message}`,"color: yellow"),ti("ai","me
|
|
|
3348
3348
|
`)}function I0u(A){return String(A||"").replace(/\r\n?/g,`
|
|
3349
3349
|
`).split(`
|
|
3350
3350
|
`)}function s_e(A,e){let t=Number(e)||16,u=I0u(A),r=Math.max(20,...u.map(a=>Math.ceil(Math.max(String(a).length,1)*t*c0u))),i=Math.max(1,u.length)*t*B0u;return{width:r,height:i,lineCount:u.length}}function l3A(A,e,t){let u=Number(A.width)||0,r=Number(A.height)||0,i=Math.max(u,e),a=Math.max(r,t);if(i===u&&a===r)return A;let n={...A,width:i,height:a};return i>u&&(n.x=(Number(A.x)||0)-(i-u)/2),a>r&&(n.y=(Number(A.y)||0)-(a-r)/2),n}function d0u(A,e){let t=String(e.textAlign||"center"),u=String(e.verticalAlign||"middle"),r=Number(A.x)||0,i=Number(A.y)||0,a=Number(A.width)||0,n=Number(A.height)||0,o=Number(e.width)||0,s=Number(e.height)||0,g=t==="left"?r:t==="right"?r+a-o:r+(a-o)/2,l=u==="top"?i:u==="bottom"?i+n-s:i+(n-s)/2;return g===(Number(e.x)||0)&&l===(Number(e.y)||0)?e:{...e,x:g,y:l}}function h0u(A){if(!Array.isArray(A))return[];let e=new Map;for(let t of A)t?.id&&e.set(t.id,t);for(let t of A){if(!t||t.type!=="text"||t.isDeleted||!t.containerId)continue;let u=e.get(t.containerId);if(!u||!$U(u))continue;let r=l3A(u,(Number(t.width)||0)+n_e,(Number(t.height)||0)+o_e);r!==u&&e.set(u.id,r)}for(let t of A){if(!t||t.type!=="text"||t.isDeleted||!t.containerId)continue;let u=e.get(t.id)??t,r=e.get(u.containerId);if(!r||!$U(r))continue;let i=d0u(r,u);i!==u&&e.set(u.id,i)}return A.map(t=>t?.id&&e.has(t.id)?e.get(t.id):t)}function Q0u(A){if(!A||typeof A!="object")return A;let e=A,t=(r,i)=>{e===A&&(e={...A}),e[r]=i};if(typeof A.text=="string"){let r=n3A(A.text);r!==A.text&&t("text",r)}if(typeof A.originalText=="string"){let r=n3A(A.originalText);r!==A.originalText&&(t("originalText",r),typeof e.text=="string"&&t("text",r))}if(A.label&&typeof A.label=="object"&&typeof A.label.text=="string"){let r=n3A(A.label.text);r!==A.label.text&&(e===A&&(e={...A}),e.label={...A.label,text:r})}let u=e.label?.text||e.originalText||e.text;if(typeof u=="string"&&u.includes(`
|
|
3351
|
-
`)&&$U(e)){let r=e.label?.fontSize||e.fontSize,i=s_e(u,r);e=l3A(e,i.width+n_e,i.height+o_e)}return e}function C3A(A,{measure:e}={}){let t=(Array.isArray(A)?A:[]).map(r=>Q0u(r)),u=e?t.map(r=>{let i=r;if(!i||i.type!=="text"||i.isDeleted)return r;let a=e(r);return l3A(r,Number(a?.width)||0,Number(a?.height)||0)}):t;return h0u(u)}var p0u=64,f0u=120,A_e=100,e_e=50,jj=8,m0u=6,zj=4,D0u=5,o3A="lavishIconNode";function g_e(A){let e=Number(A.x)||0,t=Number(A.y)||0,u=Array.isArray(A.points)&&A.points.length>0?A.points.map(C=>[e+(Number(C?.[0])||0),t+(Number(C?.[1])||0)]):[[e,t],[e+(Number(A.width)||0),t+(Number(A.height)||0)]],r=[Math.min(...u.map(C=>C[0])),Math.min(...u.map(C=>C[1])),Math.max(...u.map(C=>C[0])),Math.max(...u.map(C=>C[1]))],i=Number(A.angle)||0;if(i===0)return r;let a=(r[0]+r[2])/2,n=(r[1]+r[3])/2,o=Math.cos(i),s=Math.sin(i),l=(u.length>2?u:[[r[0],r[1]],[r[2],r[1]],[r[2],r[3]],[r[0],r[3]]]).map(([C,B])=>[a+(C-a)*o-(B-n)*s,n+(C-a)*s+(B-n)*o]);return[Math.min(...l.map(C=>C[0])),Math.min(...l.map(C=>C[1])),Math.max(...l.map(C=>C[0])),Math.max(...l.map(C=>C[1]))]}function Vj(A){let e=A.map(g_e),t=Math.min(...e.map(a=>a[0])),u=Math.min(...e.map(a=>a[1])),r=Math.max(...e.map(a=>a[2])),i=Math.max(...e.map(a=>a[3]));return{minX:t,minY:u,width:r-t,height:i-u}}function l_e(A,e){if(!(Array.isArray(A)&&A.some(u=>u.item)))return{};let t=/^(?:flowchart|graph)\s+(LR|RL)\b/i.test(a3A(e));return{flowchart:{curve:"linear",nodeSpacing:t?A_e:e_e,rankSpacing:t?e_e:A_e}}}function c3A(A){let e=Vj(A.elements),t=Math.max(e.width,1),u=Math.max(e.height,1),r=Math.min(p0u/u,f0u/t);return{scale:r,width:t*r,height:u*r}}function w0u(A,e){return A?.id===e&&$U(A)&&A.label&&!(Array.isArray(A.groupIds)&&A.groupIds.includes(`subgraph_group_${e}`))}function t_e(A,e,t){let[u,r]=A,i=e[0]-u,a=e[1]-r,n=0,o=1,s=[[-i,u-t.minX],[i,t.maxX-u],[-a,r-t.minY],[a,t.maxY-r]];for(let[g,l]of s){if(g===0){if(l<0)return null;continue}let C=l/g;if(g<0){if(C>o)return null;n=Math.max(n,C)}else{if(C<n)return null;o=Math.min(o,C)}}return[u+n*i,r+n*a]}function u_e(A,e){return A[0]>e.minX&&A[0]<e.maxX&&A[1]>e.minY&&A[1]<e.maxY}function r_e(A,e){if(A.length<2)return A;if(!u_e(A.at(-1),e)){let r=A.at(-1),i=A.at(-2),a=Math.hypot(r[0]-i[0],r[1]-i[1]);if(a===0)return A;let n=(e.maxX-e.minX+e.maxY-e.minY)*4,o=[r[0]+(r[0]-i[0])/a*n,r[1]+(r[1]-i[1])/a*n],s=t_e(r,o,e);return s?[...A.slice(0,-1),s]:A}let t=A.length-2;for(;t>=0&&u_e(A[t],e);)t-=1;if(t<0)return A;let u=t_e(A[t],A[t+1],e);return u?[...A.slice(0,t+1),u]:A}function y0u(A,e,t){let u=Number(A.x)||0,r=Number(A.y)||0,i=A.points.map(o=>[u+(Number(o?.[0])||0),r+(Number(o?.[1])||0)]);t&&(i=r_e(i,t)),e&&(i=r_e(i.slice().reverse(),e).reverse());let[a,n]=i[0];return{...A,x:a,y:n,points:i.map(([o,s])=>[o-a,s-n])}}function C_e(A,e,{labelFontSize:t=0}={}){let u=Array.isArray(A)?A:[],r=[],i=new Map;for(let n of Array.isArray(e)?e:[]){if(!n.item||!Array.isArray(n.item.elements)||n.item.elements.length===0){r.push({nodeId:n.nodeId,ref:n.ref,reason:"item"});continue}let o=u.findIndex(p=>w0u(p,n.nodeId));if(o<0||i.has(n.nodeId)){r.push({nodeId:n.nodeId,ref:n.ref,reason:"node"});continue}let s=u[o],g=c3A(n.item),l=Math.max(Number(s.label.fontSize)||0,t)||void 0,C=s_e(s.label.text,l),B=Number(s.width)||0,E=Number(s.height)||0,I=Math.max(g.width,C.width)+2*jj,h=jj+g.height+m0u+C.height+jj,d=(Number(s.x)||0)-(I-B)/2,Q=(Number(s.y)||0)-(h-E)/2;i.set(n.nodeId,{index:o,node:{...s,x:d,y:Q,width:I,height:h,strokeColor:"transparent",backgroundColor:"transparent",label:{...s.label,...l?{fontSize:l}:{},verticalAlign:"bottom",strokeColor:s.label.strokeColor||s.strokeColor||"#1e1e1e"},customData:{...s.customData,[o3A]:n.item.ref||n.ref}},box:{minX:d-zj,minY:Q-zj,maxX:d+I+zj,maxY:Q+h+zj}})}return i.size===0?{skeletons:u,missing:r}:{skeletons:u.map((n,o)=>{for(let l of i.values())if(l.index===o)return l.node;if(n?.type!=="arrow"||!Array.isArray(n.points))return n;let s=i.get(n.start?.id)?.box,g=i.get(n.end?.id)?.box;return s||g?y0u(n,s,g):n}),missing:r}}function b0u(A,{idPrefix:e,ref:t,left:u,top:r,outerGroupIds:i}){let{minX:a,minY:n}=Vj(A.elements),{scale:o}=c3A(A),s=new Map(A.elements.map((C,B)=>[C.id,`${e}:${B}`])),g=C=>s.has(C)?s.get(C):null,l=C=>C&&g(C.elementId)?{...C,elementId:g(C.elementId)}:null;return A.elements.map(C=>{let B={...C,id:g(C.id),x:u+((Number(C.x)||0)-a)*o,y:r+((Number(C.y)||0)-n)*o,width:(Number(C.width)||0)*o,height:(Number(C.height)||0)*o,groupIds:[...(Array.isArray(C.groupIds)?C.groupIds:[]).map(E=>`${e}:${E}`),...i],frameId:null,customData:{...C.customData,[qj]:t}};return delete B.index,Array.isArray(C.points)&&(B.points=C.points.map(E=>[(Number(E?.[0])||0)*o,(Number(E?.[1])||0)*o])),typeof C.fontSize=="number"&&(B.fontSize=C.fontSize*o),"containerId"in C&&(B.containerId=C.containerId?g(C.containerId):null),Array.isArray(C.boundElements)&&(B.boundElements=C.boundElements.filter(E=>g(E?.id)).map(E=>({...E,id:g(E.id)}))),"startBinding"in C&&(B.startBinding=l(C.startBinding)),"endBinding"in C&&(B.endBinding=l(C.endBinding)),B})}function c_e(A,e){let t=Array.isArray(A)?A:[],u=t.filter(a=>$U(a)&&typeof a.customData?.[o3A]=="string");if(u.length===0)return t;let r=new Map,i=new Map;for(let a of u){let n=a.customData[o3A],o=e(n);if(!o||!Array.isArray(o.elements)||o.elements.length===0)continue;let s=`${a.id}:icon`,g=[s,...Array.isArray(a.groupIds)?a.groupIds:[]],l=(Number(a.x)||0)+((Number(a.width)||0)-c3A(o).width)/2,C=(Number(a.y)||0)+jj;r.set(a.id,{...a,groupIds:g});let B=t.find(E=>E?.type==="text"&&E.containerId===a.id);if(B){let E=Number(B.height)||0;r.set(B.id,{...B,groupIds:g,y:(Number(a.y)||0)+(Number(a.height)||0)-E-D0u})}i.set(B?B.id:a.id,b0u(o,{idPrefix:s,ref:o.ref||n,left:l,top:C,outerGroupIds:g}))}return t.flatMap(a=>{let n=r.get(a?.id)??a;return i.has(a?.id)?[n,...i.get(a.id)]:[n]})}function B_e(A){let e=String(A||"").trim();return e&&(/^https?:\/\//i.test(e)||/^mailto:[^\s]+$/i.test(e))?e:""}function uV(A){let e=Array.isArray(A)?A.filter(t=>t&&!t.isDeleted):[];return e.length===0?!1:e.every(t=>t.type==="image")}function E_e(A){let e=new Set,t=new Set;for(let u of Array.isArray(A)?A:[]){let r=String(u?.id||"");r&&(e.has(r)&&t.add(r),e.add(r))}return[...t]}async function I_e(A,{convert:e,loadFonts:t}){let u=e(A);return await t(u),e(A)}function B3A(A,{measure:e}){let t=0;return{elements:(Array.isArray(A)?A:[]).map(r=>{let i=r;if(!i||i.type!=="text"||i.isDeleted||i.autoResize===!1)return r;let a=e(r),n=Math.max(Number(i.width)||0,Number(a?.width)||0),o=Math.max(Number(i.height)||0,Number(a?.height)||0);return n<=Number(i.width)&&o<=Number(i.height)?r:(t+=1,{...r,width:n,height:o})}),repaired:t}}var x0u=":libraries-unverified";function d_e(A,e){return e===!0&&Zj(A).length>0}function E3A(A,e){let t=Array.isArray(A?.baselineElements)?A.baselineElements:[],u=String(A?.sceneSourceHash||"");return{sourceHash:A?.drawnWithUnverifiedLibraries?`${u}${x0u}`:u,textMetricsVersion:Math.max(0,Math.floor(Number(A?.textMetricsVersion)||0)),scene:e??null,baseline:{elements:t}}}var v0u=new Set(["backgroundColor","fillStyle","fontFamily","fontSize","index","lineHeight","opacity","roughness","roundness","seed","strokeColor","strokeSharpness","strokeStyle","strokeWidth","textAlign","updated","version","versionNonce","verticalAlign"]),k0u=new Set(["height","width","x","y"]);function Xj(A,e,t,u=!1){if(u&&v0u.has(t))return!1;if(u&&k0u.has(t))return Math.abs((Number(e)||0)-(Number(A)||0))>Ld;if(Object.is(A,e))return!1;if(!A||!e||typeof A!="object"||typeof e!="object")return!0;if(Array.isArray(A)||Array.isArray(e))return!Array.isArray(A)||!Array.isArray(e)||A.length!==e.length?!0:A.some((i,a)=>Xj(i,e[a],String(a)));let r=new Set([...Object.keys(A),...Object.keys(e)]);for(let i of r)if(Xj(A[i],e[i],i))return!0;return!1}function F0u(A,e){let t=new Set([...Object.keys(A),...Object.keys(e)]);for(let u of t)if(u!=="isDeleted"&&Xj(A[u],e[u],u,!0))return!0;return!1}function S0u(A){let e=A?.scene?.elements,t=A?.baseline?.elements;if(!Array.isArray(t))return Array.isArray(e);if(!Array.isArray(e))return!0;let u=AV($j(t)),r=AV($j(e));if(u.size!==r.size)return!0;for(let[i,a]of r){let n=u.get(i);if(!n||F0u(n,a))return!0}return!1}function h_e(A,e){let t=A&&typeof A=="object"&&A.scene?A:null;return t?String(t.source_hash||"")===String(e||"")?"restore":S0u(t)?"prompt":"convert":"convert"}function $j(A){return(Array.isArray(A)?A:[]).filter(e=>e&&typeof e=="object"&&e.id&&!e.isDeleted)}function AV(A){let e=new Map;for(let t of A)e.set(t.id,t);return e}function i_e(A){let e=new Map;for(let t of A)t.type==="text"&&t.containerId&&e.set(t.containerId,t);return e}function s3A(A,e){return String(A.text||e.get(A.id)?.text||"").replace(/\s+/g," ").trim()}function Fx(A,e){let t=s3A(A,e),u=String(A.type||"element");return t?`${u} "${eV(t,60)}" (${A.id})`:`${u} (${A.id})`}function eV(A,e){let t=String(A);return t.length>e?`${t.slice(0,e-1)}\u2026`:t}function RQ(A){return eV(A,s0u)}function L0u(A,e,t){let u=A.startBinding?.elementId?e.get(A.startBinding.elementId):null,r=A.endBinding?.elementId?e.get(A.endBinding.elementId):null;if(!u&&!r)return"";let i=a=>a?Fx(a,t):"(unattached)";return` from ${i(u)} to ${i(r)}`}function Q_e(A,e,{maxLines:t=o0u}={}){let u=$j(A),r=$j(e),i=AV(u),a=AV(r),n=i_e(u),o=i_e(r),s={added:0,removed:0,moved:0,relabeled:0,drawn:0},g=[],l=new Map,C=new Map,B=new Map;for(let d of r){if(i.has(d.id))continue;if(UQ(d)){let[p,m]=g_e(d),f=l.get(XU(d));f?(f.x=Math.min(f.x,p),f.y=Math.min(f.y,m)):l.set(XU(d),{ref:UQ(d),x:p,y:m});continue}if(d.type==="text"&&d.containerId&&!n.has(d.containerId)&&a.has(d.containerId))continue;if(d.type==="freedraw"){s.drawn+=1,g.push(RQ(`Drew a freehand mark near (${Math.round(d.x)}, ${Math.round(d.y)})`));continue}s.added+=1;let Q=d.type==="arrow"||d.type==="line"?L0u(d,a,o):"";g.push(RQ(`Added ${Fx(d,o)}${Q}`))}for(let{ref:d,x:Q,y:p}of l.values())s.added+=1,g.push(RQ(`Added library item ${d} near (${Math.round(Q)}, ${Math.round(p)})`));for(let d of u)if(!a.has(d.id)){if(UQ(d)){let Q=XU(d);C.has(Q)||C.set(Q,{ref:UQ(d),group:g3A(d),parts:0}),C.get(Q).parts+=1;continue}d.type==="text"&&d.containerId&&i.has(d.containerId)||(s.removed+=1,g.push(RQ(`Removed ${Fx(d,n)}`)))}let E=new Set(r.filter(d=>i.has(d.id)&&UQ(d)).map(d=>XU(d)));for(let[d,{ref:Q,group:p}]of C){if(E.has(d))continue;let m=a_e(u,p);m&&!a.has(m.id)||(s.removed+=1,g.push(RQ(`Removed library item ${Q}${m?` from ${Fx(m,n)}`:""}`)))}for(let d of r){let Q=i.get(d.id);if(!Q)continue;if(UQ(d)){let S=XU(d);B.has(S)||B.set(S,{ref:UQ(d),group:g3A(d),before:[],after:[]}),B.get(S).before.push(Q),B.get(S).after.push(d);continue}let p=s3A(Q,n),m=s3A(d,o);if(p!==m&&!(d.type==="text"&&d.containerId)&&(s.relabeled+=1,g.push(RQ(`Relabeled ${d.type} (${d.id}): "${eV(p,50)}" -> "${eV(m,50)}"`))),d.type==="text"&&d.containerId)continue;let f=Math.round((d.x??0)-(Q.x??0)),D=Math.round((d.y??0)-(Q.y??0)),y=Math.round((d.width??0)-(Q.width??0)),w=Math.round((d.height??0)-(Q.height??0)),k=Math.abs(f)>Ld||Math.abs(D)>Ld,v=Math.abs(y)>Ld||Math.abs(w)>Ld;if(k||v){s.moved+=1;let S=[];k&&S.push(`moved by (${f}, ${D})`),v&&S.push(`resized by (${y}, ${w})`),g.push(RQ(`${N0u(S.join(" and "))}: ${Fx(d,o)}`))}}for(let[d,{ref:Q,group:p,before:m,after:f}]of B){let D=a_e(r,p),y=D?i.get(D.id):null,w=D&&y?(D.x??0)-(y.x??0):0,k=D&&y?(D.y??0)-(y.y??0):0,v=Vj(m),S=Vj(f),x=Math.round(S.minX-v.minX-w),R=Math.round(S.minY-v.minY-k),U=Math.round(S.width-v.width),L=Math.round(S.height-v.height),F=D?` in ${Fx(D,o)}`:"",G=Math.abs(x)>Ld||Math.abs(R)>Ld,N=Math.abs(U)>Ld||Math.abs(L)>Ld;if(G||N){s.moved+=1;let T=[];G&&T.push(`Moved library item ${Q} by (${x}, ${R})`),N&&T.push(G?`resized it by (${U}, ${L})`:`Resized library item ${Q} by (${U}, ${L})`),g.push(RQ(`${T.join(" and ")}${F}`))}let Y=C.get(d)?.parts??0;if(Y>0||m.some((T,H)=>U0u(T,f[H])||G0u(T,f[H],v,S))){s.relabeled+=1;let T=Y>0?`: removed ${Y} of ${Y+m.length} parts`:"";g.push(RQ(`Edited library item ${Q}${T}${F}`))}}let I=g0u.reduce((d,Q)=>d+s[Q],0),h=g.slice(0,t);return g.length>h.length&&h.push(`...and ${g.length-h.length} more change${g.length-h.length===1?"":"s"}`),I===0&&h.push("No element changes detected (view-only or style-only edits)."),{lines:h,stats:s,totalChanges:I}}var R0u=new Set(["x","y","width","height","points","lastCommittedPoint"]);function U0u(A,e){let t=new Set([...Object.keys(A),...Object.keys(e)]);for(let u of t)if(!(u==="isDeleted"||R0u.has(u))&&Xj(A[u],e[u],u,!0))return!0;return!1}function G0u(A,e,t,u){let r=t.width>0?u.width/t.width:1,i=t.height>0?u.height/t.height:1,a=(s,g)=>Math.abs((Number(s)||0)-g)>Ld;if(a(e.x,u.minX+((Number(A.x)||0)-t.minX)*r)||a(e.y,u.minY+((Number(A.y)||0)-t.minY)*i)||a(e.width,(Number(A.width)||0)*r)||a(e.height,(Number(A.height)||0)*i))return!0;let n=Array.isArray(A.points)?A.points:[],o=Array.isArray(e.points)?e.points:[];return n.length!==o.length?!0:n.some((s,g)=>a(o[g]?.[0],(Number(s?.[0])||0)*r)||a(o[g]?.[1],(Number(s?.[1])||0)*i))}function UQ(A){let e=A?.customData?.[qj];return typeof e=="string"?e:""}function g3A(A){let e=(Array.isArray(A.groupIds)?A.groupIds:[]).filter(t=>!String(t).startsWith("subgraph_group_"));return e.length>0?String(e.at(-1)):""}function XU(A){return`${UQ(A)}\0${g3A(A)||A.id}`}function a_e(A,e){return e&&A.find(t=>!UQ(t)&&t.type!=="text"&&Array.isArray(t.groupIds)&&t.groupIds.includes(e))||null}function N0u(A){return A&&A[0].toUpperCase()+A.slice(1)}var M0u=800,p_e=16,ut={mode:"overlay",diagramIndex:0,diagramId:"",sceneSourceHash:"",currentSource:"",currentSourceHash:"",baselineElements:[],files:{},libraries:[],drawnWithUnverifiedLibraries:!1,imageFallback:!1,textMetricsVersion:Sx,channelId:"",api:null,saveTimer:0,teardownFlushId:"",flushIds:new Set,queueBusy:!1,setLocked:null};function GQ(A){window.top.postMessage({...A,diagramIndex:ut.diagramIndex,...ut.channelId?{channelId:ut.channelId}:{channelToken:String(window.__lavishWhiteboardChannelToken||""),diagramId:ut.diagramId}},"*")}function R0(A,e={},...t){let u=document.createElement(A);Object.assign(u,e);for(let r of t)u.append(r);return u}function rV(A,e){let t=document.getElementById(A);t&&(t.textContent=e,t.hidden=!e)}function Y0u(A,e){document.body.dataset.lavishWhiteboardTheme=A,document.body.dataset.lavishWhiteboardMode=e;let t=R0("div",{id:"wbShell"}),u=R0("header",{id:"wbHeader"}),r=R0("div",{id:"wbTitle",textContent:"Whiteboard"}),i=R0("input",{id:"wbNote",placeholder:"Optional note for the agent about these edits...",autocomplete:"off"}),a=R0("button",{id:"wbQueue",type:"button",textContent:"Queue feedback"});if(u.append(r,i,a),e==="inline"){let p=R0("button",{id:"wbFullscreen",type:"button",textContent:"Fullscreen",title:"Open this whiteboard full screen"});p.onclick=()=>GQ({type:"lavish-whiteboard:maximize",diagramIndex:ut.diagramIndex}),u.append(p)}let n=R0("div",{id:"wbFallbackBanner",className:"wb-banner",hidden:!0}),o=R0("div",{id:"wbStaleBanner",className:"wb-banner wb-banner-warn",hidden:!0}),s=R0("div",{id:"wbStatus",className:"wb-status",hidden:!0}),g=R0("div",{id:"wbEditor"}),l=R0("div",{id:"wbLinkConfirm",className:"wb-link-confirm",hidden:!0});l.setAttribute("role","dialog"),l.setAttribute("aria-modal","true"),l.setAttribute("aria-label","Open external link");let C=R0("div",{className:"wb-link-confirm-card"}),B=R0("div",{className:"wb-link-confirm-title",textContent:"Open external link?"}),E=R0("p",{className:"wb-link-confirm-copy",textContent:"This link came from the diagram."}),I=R0("p",{id:"wbLinkConfirmUrl",className:"wb-link-confirm-url"}),h=R0("div",{className:"wb-link-confirm-actions"}),d=R0("button",{id:"wbLinkConfirmCancel",type:"button",textContent:"Cancel"}),Q=R0("button",{id:"wbLinkConfirmOpen",type:"button",textContent:"Open link"});h.append(d,Q),C.append(B,E,I,h),l.append(C),t.append(u,n,o,s,g,l),document.body.append(t),a.onclick=()=>V0u().catch(p=>kD(`Queue failed: ${w_e(p)}`)),i.addEventListener("keydown",p=>{p.key==="Enter"&&!p.isComposing&&(p.preventDefault(),a.click())}),d.onclick=I3A,Q.onclick=()=>{let p=String(l.dataset.url||"");p&&window.open(p,"_blank","noopener,noreferrer"),I3A()},l.addEventListener("keydown",p=>{if(p.key==="Escape"){p.preventDefault(),I3A();return}if(p.key!=="Tab")return;let m=[d,Q],f=m.indexOf(document.activeElement),D=p.shiftKey?f-1:f+1;D>=0&&D<m.length||(p.preventDefault(),m[p.shiftKey?m.length-1:0].focus())})}var f_e=0;function kD(A,{transient:e=!0}={}){let t=document.getElementById("wbStatus");t&&(t.textContent=A,t.hidden=!A,e&&A&&(window.clearTimeout(f_e),f_e=window.setTimeout(()=>{t.hidden=!0},4e3)))}function w_e(A){return A instanceof Error?A.message:String(A)}function y_e(){if(!ut.api)return null;let A=ut.api.getAppState();return{elements:ut.api.getSceneElements().map(e=>JSON.parse(JSON.stringify(e))),appState:tV({scrollX:A.scrollX,scrollY:A.scrollY,zoom:A.zoom}),files:ut.api.getFiles()||{}}}function p3A(A=""){let e=y_e();return e?(GQ({type:"lavish-whiteboard:save",diagramIndex:ut.diagramIndex,...E3A(ut,e),...A?{flushId:A}:{}}),!0):!1}function f3A(){ut.teardownFlushId||(window.clearTimeout(ut.saveTimer),ut.saveTimer=window.setTimeout(()=>{p3A()},M0u))}function T0u(A){let e=String(A.flushId||"");e&&(ut.teardownFlushId=e,window.clearTimeout(ut.saveTimer),ut.setLocked?.(!0),p3A(e)||(ut.teardownFlushId="",GQ({type:"lavish-whiteboard:teardownReady",flushId:e})))}function H0u(A){let e=String(A.flushId||"");!e||ut.flushIds.has(e)||(ut.flushIds.add(e),window.clearTimeout(ut.saveTimer),p3A(e)||(ut.flushIds.delete(e),GQ({type:"lavish-whiteboard:flushComplete",flushId:e,ok:!0})))}function K0u(A){let e=String(A.flushId||"");if(e){if(e===ut.teardownFlushId){if(ut.teardownFlushId="",A.ok){GQ({type:"lavish-whiteboard:teardownReady",flushId:e});return}ut.setLocked?.(!1);let t=String(A.error||"failed to save whiteboard scene");kD(`Could not save before closing: ${t}`,{transient:!1}),GQ({type:"lavish-whiteboard:teardownFailed",flushId:e,error:t});return}ut.flushIds.delete(e)&&GQ({type:"lavish-whiteboard:flushComplete",flushId:e,ok:!!A.ok})}}var h3A=null;function I3A(){let A=document.getElementById("wbLinkConfirm");A&&(A.hidden=!0);let e=h3A;h3A=null,e?.focus?.()}function J0u(A){let e=document.getElementById("wbLinkConfirm"),t=document.getElementById("wbLinkConfirmUrl"),u=document.getElementById("wbLinkConfirmCancel");if(!e||!t||!u)return;let r=document.activeElement;h3A=r&&typeof r.focus=="function"?r:null,e.dataset.url=A,t.textContent=A,e.hidden=!1,u.focus()}function O0u(A,e){e.preventDefault();let t=B_e(A?.link);if(!t){kD("Blocked a link with an unsupported or unsafe scheme.");return}J0u(t)}function _0u({elements:A,appState:e,files:t,theme:u,startLocked:r}){let[i,a]=vD.default.useState(r);return ut.setLocked=a,vD.default.createElement("div",{style:{position:"relative",width:"100%",height:"100%"}},vD.default.createElement(u3A,{initialData:{elements:A,appState:e,files:t||void 0,libraryItems:$Oe(ut.libraries),scrollToContent:!0},theme:u,viewModeEnabled:i,onChange:f3A,onLinkOpen:O0u,excalidrawAPI:n=>{ut.api=n,window.setTimeout(()=>{try{n.scrollToContent(n.getSceneElements(),{fitToContent:!0})}catch{}},0)},UIOptions:{canvasActions:{loadScene:!1,saveToActiveFile:!1,toggleTheme:!1}}}),i?vD.default.createElement("div",{className:"wb-activate",role:"button",tabIndex:0,onClick:()=>a(!1),onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&a(!1)}},vD.default.createElement("span",{className:"wb-activate-label"},"Click to edit")):null)}function b_e({elements:A,appState:e,files:t,theme:u}){let r=document.getElementById("wbEditor");(0,D_e.createRoot)(r).render(vD.default.createElement(_0u,{elements:A,appState:e,files:t,theme:u,startLocked:ut.mode==="inline"}))}var P0u=document.createElement("canvas"),d3A=P0u.getContext("2d");function W0u(A){return Object.entries(li).find(([,e])=>e===A)?.[0]||"Segoe UI Emoji"}function x_e(A){let e=W0u(A.fontFamily),t=e==="Excalifont"?[e,"Xiaolai","Segoe UI Emoji"]:[e,"Segoe UI Emoji"];return`${Number(A.fontSize)||20}px ${t.map(u=>JSON.stringify(u)).join(", ")}`}function Q3A(A){if(!d3A)return{width:Number(A.width)||0,height:Number(A.height)||0};d3A.font=x_e(A);let e=String(A.text||"").replace(/\r\n?/g,`
|
|
3351
|
+
`)&&$U(e)){let r=e.label?.fontSize||e.fontSize,i=s_e(u,r);e=l3A(e,i.width+n_e,i.height+o_e)}return e}function C3A(A,{measure:e}={}){let t=(Array.isArray(A)?A:[]).map(r=>Q0u(r)),u=e?t.map(r=>{let i=r;if(!i||i.type!=="text"||i.isDeleted)return r;let a=e(r);return l3A(r,Number(a?.width)||0,Number(a?.height)||0)}):t;return h0u(u)}var p0u=64,f0u=120,A_e=100,e_e=50,jj=8,m0u=6,zj=4,D0u=5,o3A="lavishIconNode";function g_e(A){let e=Number(A.x)||0,t=Number(A.y)||0,u=Array.isArray(A.points)&&A.points.length>0?A.points.map(C=>[e+(Number(C?.[0])||0),t+(Number(C?.[1])||0)]):[[e,t],[e+(Number(A.width)||0),t+(Number(A.height)||0)]],r=[Math.min(...u.map(C=>C[0])),Math.min(...u.map(C=>C[1])),Math.max(...u.map(C=>C[0])),Math.max(...u.map(C=>C[1]))],i=Number(A.angle)||0;if(i===0)return r;let a=(r[0]+r[2])/2,n=(r[1]+r[3])/2,o=Math.cos(i),s=Math.sin(i),l=(u.length>2?u:[[r[0],r[1]],[r[2],r[1]],[r[2],r[3]],[r[0],r[3]]]).map(([C,B])=>[a+(C-a)*o-(B-n)*s,n+(C-a)*s+(B-n)*o]);return[Math.min(...l.map(C=>C[0])),Math.min(...l.map(C=>C[1])),Math.max(...l.map(C=>C[0])),Math.max(...l.map(C=>C[1]))]}function Vj(A){let e=A.map(g_e),t=Math.min(...e.map(a=>a[0])),u=Math.min(...e.map(a=>a[1])),r=Math.max(...e.map(a=>a[2])),i=Math.max(...e.map(a=>a[3]));return{minX:t,minY:u,width:r-t,height:i-u}}function l_e(A,e){if(!(Array.isArray(A)&&A.some(u=>u.item)))return{};let t=/^(?:flowchart|graph)\s+(LR|RL)\b/i.test(a3A(e));return{flowchart:{curve:"linear",nodeSpacing:t?A_e:e_e,rankSpacing:t?e_e:A_e}}}function c3A(A){let e=Vj(A.elements),t=Math.max(e.width,1),u=Math.max(e.height,1),r=Math.min(p0u/u,f0u/t);return{scale:r,width:t*r,height:u*r}}function w0u(A,e){return A?.id===e&&$U(A)&&A.label&&!(Array.isArray(A.groupIds)&&A.groupIds.includes(`subgraph_group_${e}`))}function t_e(A,e,t){let[u,r]=A,i=e[0]-u,a=e[1]-r,n=0,o=1,s=[[-i,u-t.minX],[i,t.maxX-u],[-a,r-t.minY],[a,t.maxY-r]];for(let[g,l]of s){if(g===0){if(l<0)return null;continue}let C=l/g;if(g<0){if(C>o)return null;n=Math.max(n,C)}else{if(C<n)return null;o=Math.min(o,C)}}return[u+n*i,r+n*a]}function u_e(A,e){return A[0]>e.minX&&A[0]<e.maxX&&A[1]>e.minY&&A[1]<e.maxY}function r_e(A,e){if(A.length<2)return A;if(!u_e(A.at(-1),e)){let r=A.at(-1),i=A.at(-2),a=Math.hypot(r[0]-i[0],r[1]-i[1]);if(a===0)return A;let n=(e.maxX-e.minX+e.maxY-e.minY)*4,o=[r[0]+(r[0]-i[0])/a*n,r[1]+(r[1]-i[1])/a*n],s=t_e(r,o,e);return s?[...A.slice(0,-1),s]:A}let t=A.length-2;for(;t>=0&&u_e(A[t],e);)t-=1;if(t<0)return A;let u=t_e(A[t],A[t+1],e);return u?[...A.slice(0,t+1),u]:A}function y0u(A,e,t){let u=Number(A.x)||0,r=Number(A.y)||0,i=A.points.map(o=>[u+(Number(o?.[0])||0),r+(Number(o?.[1])||0)]);t&&(i=r_e(i,t)),e&&(i=r_e(i.slice().reverse(),e).reverse());let[a,n]=i[0];return{...A,x:a,y:n,points:i.map(([o,s])=>[o-a,s-n])}}function C_e(A,e,{labelFontSize:t=0}={}){let u=Array.isArray(A)?A:[],r=[],i=new Map;for(let n of Array.isArray(e)?e:[]){if(!n.item||!Array.isArray(n.item.elements)||n.item.elements.length===0){r.push({nodeId:n.nodeId,ref:n.ref,reason:"item"});continue}let o=u.findIndex(p=>w0u(p,n.nodeId));if(o<0||i.has(n.nodeId)){r.push({nodeId:n.nodeId,ref:n.ref,reason:"node"});continue}let s=u[o],g=c3A(n.item),l=Math.max(Number(s.label.fontSize)||0,t)||void 0,C=s_e(s.label.text,l),B=Number(s.width)||0,E=Number(s.height)||0,I=Math.max(g.width,C.width)+2*jj,h=jj+g.height+m0u+C.height+jj,d=(Number(s.x)||0)-(I-B)/2,Q=(Number(s.y)||0)-(h-E)/2;i.set(n.nodeId,{index:o,node:{...s,x:d,y:Q,width:I,height:h,strokeColor:"transparent",backgroundColor:"transparent",label:{...s.label,...l?{fontSize:l}:{},verticalAlign:"bottom",strokeColor:s.label.strokeColor||s.strokeColor||"#1e1e1e"},customData:{...s.customData,[o3A]:n.item.ref||n.ref}},box:{minX:d-zj,minY:Q-zj,maxX:d+I+zj,maxY:Q+h+zj}})}return i.size===0?{skeletons:u,missing:r}:{skeletons:u.map((n,o)=>{for(let l of i.values())if(l.index===o)return l.node;if(n?.type!=="arrow"||!Array.isArray(n.points))return n;let s=i.get(n.start?.id)?.box,g=i.get(n.end?.id)?.box;return s||g?y0u(n,s,g):n}),missing:r}}function b0u(A,{idPrefix:e,ref:t,left:u,top:r,outerGroupIds:i}){let{minX:a,minY:n}=Vj(A.elements),{scale:o}=c3A(A),s=new Map(A.elements.map((C,B)=>[C.id,`${e}:${B}`])),g=C=>s.has(C)?s.get(C):null,l=C=>C&&g(C.elementId)?{...C,elementId:g(C.elementId)}:null;return A.elements.map(C=>{let B={...C,id:g(C.id),x:u+((Number(C.x)||0)-a)*o,y:r+((Number(C.y)||0)-n)*o,width:(Number(C.width)||0)*o,height:(Number(C.height)||0)*o,groupIds:[...(Array.isArray(C.groupIds)?C.groupIds:[]).map(E=>`${e}:${E}`),...i],frameId:null,customData:{...C.customData,[qj]:t}};return delete B.index,Array.isArray(C.points)&&(B.points=C.points.map(E=>[(Number(E?.[0])||0)*o,(Number(E?.[1])||0)*o])),typeof C.fontSize=="number"&&(B.fontSize=C.fontSize*o),"containerId"in C&&(B.containerId=C.containerId?g(C.containerId):null),Array.isArray(C.boundElements)&&(B.boundElements=C.boundElements.filter(E=>g(E?.id)).map(E=>({...E,id:g(E.id)}))),"startBinding"in C&&(B.startBinding=l(C.startBinding)),"endBinding"in C&&(B.endBinding=l(C.endBinding)),B})}function c_e(A,e){let t=Array.isArray(A)?A:[],u=t.filter(a=>$U(a)&&typeof a.customData?.[o3A]=="string");if(u.length===0)return t;let r=new Map,i=new Map;for(let a of u){let n=a.customData[o3A],o=e(n);if(!o||!Array.isArray(o.elements)||o.elements.length===0)continue;let s=`${a.id}:icon`,g=[s,...Array.isArray(a.groupIds)?a.groupIds:[]],l=(Number(a.x)||0)+((Number(a.width)||0)-c3A(o).width)/2,C=(Number(a.y)||0)+jj;r.set(a.id,{...a,groupIds:g});let B=t.find(E=>E?.type==="text"&&E.containerId===a.id);if(B){let E=Number(B.height)||0;r.set(B.id,{...B,groupIds:g,y:(Number(a.y)||0)+(Number(a.height)||0)-E-D0u})}i.set(B?B.id:a.id,b0u(o,{idPrefix:s,ref:o.ref||n,left:l,top:C,outerGroupIds:g}))}return t.flatMap(a=>{let n=r.get(a?.id)??a;return i.has(a?.id)?[n,...i.get(a.id)]:[n]})}function B_e(A){let e=String(A||"").trim();return e&&(/^https?:\/\//i.test(e)||/^mailto:[^\s]+$/i.test(e))?e:""}function uV(A){let e=Array.isArray(A)?A.filter(t=>t&&!t.isDeleted):[];return e.length===0?!1:e.every(t=>t.type==="image")}function E_e(A){let e=new Set,t=new Set;for(let u of Array.isArray(A)?A:[]){let r=String(u?.id||"");r&&(e.has(r)&&t.add(r),e.add(r))}return[...t]}async function I_e(A,{convert:e,loadFonts:t}){let u=e(A);return await t(u),e(A)}function B3A(A,{measure:e}){let t=0;return{elements:(Array.isArray(A)?A:[]).map(r=>{let i=r;if(!i||i.type!=="text"||i.isDeleted||i.autoResize===!1)return r;let a=e(r),n=Math.max(Number(i.width)||0,Number(a?.width)||0),o=Math.max(Number(i.height)||0,Number(a?.height)||0);return n<=Number(i.width)&&o<=Number(i.height)?r:(t+=1,{...r,width:n,height:o})}),repaired:t}}var x0u=":libraries-unverified";function d_e(A,e){return e===!0&&Zj(A).length>0}function E3A(A,e){let t=Array.isArray(A?.baselineElements)?A.baselineElements:[],u=String(A?.sceneSourceHash||"");return{sourceHash:A?.drawnWithUnverifiedLibraries?`${u}${x0u}`:u,textMetricsVersion:Math.max(0,Math.floor(Number(A?.textMetricsVersion)||0)),scene:e??null,baseline:{elements:t}}}var v0u=new Set(["backgroundColor","fillStyle","fontFamily","fontSize","index","lineHeight","opacity","roughness","roundness","seed","strokeColor","strokeSharpness","strokeStyle","strokeWidth","textAlign","updated","version","versionNonce","verticalAlign"]),k0u=new Set(["height","width","x","y"]);function Xj(A,e,t,u=!1){if(u&&v0u.has(t))return!1;if(u&&k0u.has(t))return Math.abs((Number(e)||0)-(Number(A)||0))>Ld;if(Object.is(A,e))return!1;if(!A||!e||typeof A!="object"||typeof e!="object")return!0;if(Array.isArray(A)||Array.isArray(e))return!Array.isArray(A)||!Array.isArray(e)||A.length!==e.length?!0:A.some((i,a)=>Xj(i,e[a],String(a)));let r=new Set([...Object.keys(A),...Object.keys(e)]);for(let i of r)if(Xj(A[i],e[i],i))return!0;return!1}function F0u(A,e){let t=new Set([...Object.keys(A),...Object.keys(e)]);for(let u of t)if(u!=="isDeleted"&&Xj(A[u],e[u],u,!0))return!0;return!1}function S0u(A){let e=A?.scene?.elements,t=A?.baseline?.elements;if(!Array.isArray(t))return Array.isArray(e);if(!Array.isArray(e))return!0;let u=AV($j(t)),r=AV($j(e));if(u.size!==r.size)return!0;for(let[i,a]of r){let n=u.get(i);if(!n||F0u(n,a))return!0}return!1}function h_e(A,e){let t=A&&typeof A=="object"&&A.scene?A:null;return t?String(t.source_hash||"")===String(e||"")?"restore":S0u(t)?"prompt":"convert":"convert"}function $j(A){return(Array.isArray(A)?A:[]).filter(e=>e&&typeof e=="object"&&e.id&&!e.isDeleted)}function AV(A){let e=new Map;for(let t of A)e.set(t.id,t);return e}function i_e(A){let e=new Map;for(let t of A)t.type==="text"&&t.containerId&&e.set(t.containerId,t);return e}function s3A(A,e){return String(A.text||e.get(A.id)?.text||"").replace(/\s+/g," ").trim()}function Fx(A,e){let t=s3A(A,e),u=String(A.type||"element");return t?`${u} "${eV(t,60)}" (${A.id})`:`${u} (${A.id})`}function eV(A,e){let t=String(A);return t.length>e?`${t.slice(0,e-1)}\u2026`:t}function RQ(A){return eV(A,s0u)}function L0u(A,e,t){let u=A.startBinding?.elementId?e.get(A.startBinding.elementId):null,r=A.endBinding?.elementId?e.get(A.endBinding.elementId):null;if(!u&&!r)return"";let i=a=>a?Fx(a,t):"(unattached)";return` from ${i(u)} to ${i(r)}`}function Q_e(A,e,{maxLines:t=o0u}={}){let u=$j(A),r=$j(e),i=AV(u),a=AV(r),n=i_e(u),o=i_e(r),s={added:0,removed:0,moved:0,relabeled:0,drawn:0},g=[],l=new Map,C=new Map,B=new Map;for(let d of r){if(i.has(d.id))continue;if(UQ(d)){let[p,m]=g_e(d),f=l.get(XU(d));f?(f.x=Math.min(f.x,p),f.y=Math.min(f.y,m)):l.set(XU(d),{ref:UQ(d),x:p,y:m});continue}if(d.type==="text"&&d.containerId&&!n.has(d.containerId)&&a.has(d.containerId))continue;if(d.type==="freedraw"){s.drawn+=1,g.push(RQ(`Drew a freehand mark near (${Math.round(d.x)}, ${Math.round(d.y)})`));continue}s.added+=1;let Q=d.type==="arrow"||d.type==="line"?L0u(d,a,o):"";g.push(RQ(`Added ${Fx(d,o)}${Q}`))}for(let{ref:d,x:Q,y:p}of l.values())s.added+=1,g.push(RQ(`Added library item ${d} near (${Math.round(Q)}, ${Math.round(p)})`));for(let d of u)if(!a.has(d.id)){if(UQ(d)){let Q=XU(d);C.has(Q)||C.set(Q,{ref:UQ(d),group:g3A(d),parts:0}),C.get(Q).parts+=1;continue}d.type==="text"&&d.containerId&&i.has(d.containerId)||(s.removed+=1,g.push(RQ(`Removed ${Fx(d,n)}`)))}let E=new Set(r.filter(d=>i.has(d.id)&&UQ(d)).map(d=>XU(d)));for(let[d,{ref:Q,group:p}]of C){if(E.has(d))continue;let m=a_e(u,p);m&&!a.has(m.id)||(s.removed+=1,g.push(RQ(`Removed library item ${Q}${m?` from ${Fx(m,n)}`:""}`)))}for(let d of r){let Q=i.get(d.id);if(!Q)continue;if(UQ(d)){let S=XU(d);B.has(S)||B.set(S,{ref:UQ(d),group:g3A(d),before:[],after:[]}),B.get(S).before.push(Q),B.get(S).after.push(d);continue}let p=s3A(Q,n),m=s3A(d,o);if(p!==m&&!(d.type==="text"&&d.containerId)&&(s.relabeled+=1,g.push(RQ(`Relabeled ${d.type} (${d.id}): "${eV(p,50)}" -> "${eV(m,50)}"`))),d.type==="text"&&d.containerId)continue;let f=Math.round((d.x??0)-(Q.x??0)),D=Math.round((d.y??0)-(Q.y??0)),y=Math.round((d.width??0)-(Q.width??0)),w=Math.round((d.height??0)-(Q.height??0)),k=Math.abs(f)>Ld||Math.abs(D)>Ld,v=Math.abs(y)>Ld||Math.abs(w)>Ld;if(k||v){s.moved+=1;let S=[];k&&S.push(`moved by (${f}, ${D})`),v&&S.push(`resized by (${y}, ${w})`),g.push(RQ(`${N0u(S.join(" and "))}: ${Fx(d,o)}`))}}for(let[d,{ref:Q,group:p,before:m,after:f}]of B){let D=a_e(r,p),y=D?i.get(D.id):null,w=D&&y?(D.x??0)-(y.x??0):0,k=D&&y?(D.y??0)-(y.y??0):0,v=Vj(m),S=Vj(f),x=Math.round(S.minX-v.minX-w),R=Math.round(S.minY-v.minY-k),U=Math.round(S.width-v.width),L=Math.round(S.height-v.height),F=D?` in ${Fx(D,o)}`:"",G=Math.abs(x)>Ld||Math.abs(R)>Ld,N=Math.abs(U)>Ld||Math.abs(L)>Ld;if(G||N){s.moved+=1;let T=[];G&&T.push(`Moved library item ${Q} by (${x}, ${R})`),N&&T.push(G?`resized it by (${U}, ${L})`:`Resized library item ${Q} by (${U}, ${L})`),g.push(RQ(`${T.join(" and ")}${F}`))}let Y=C.get(d)?.parts??0;if(Y>0||m.some((T,H)=>U0u(T,f[H])||G0u(T,f[H],v,S))){s.relabeled+=1;let T=Y>0?`: removed ${Y} of ${Y+m.length} parts`:"";g.push(RQ(`Edited library item ${Q}${T}${F}`))}}let I=g0u.reduce((d,Q)=>d+s[Q],0),h=g.slice(0,t);return g.length>h.length&&h.push(`...and ${g.length-h.length} more change${g.length-h.length===1?"":"s"}`),I===0&&h.push("No element changes detected (view-only or style-only edits)."),{lines:h,stats:s,totalChanges:I}}var R0u=new Set(["x","y","width","height","points","lastCommittedPoint"]);function U0u(A,e){let t=new Set([...Object.keys(A),...Object.keys(e)]);for(let u of t)if(!(u==="isDeleted"||R0u.has(u))&&Xj(A[u],e[u],u,!0))return!0;return!1}function G0u(A,e,t,u){let r=t.width>0?u.width/t.width:1,i=t.height>0?u.height/t.height:1,a=(s,g)=>Math.abs((Number(s)||0)-g)>Ld;if(a(e.x,u.minX+((Number(A.x)||0)-t.minX)*r)||a(e.y,u.minY+((Number(A.y)||0)-t.minY)*i)||a(e.width,(Number(A.width)||0)*r)||a(e.height,(Number(A.height)||0)*i))return!0;let n=Array.isArray(A.points)?A.points:[],o=Array.isArray(e.points)?e.points:[];return n.length!==o.length?!0:n.some((s,g)=>a(o[g]?.[0],(Number(s?.[0])||0)*r)||a(o[g]?.[1],(Number(s?.[1])||0)*i))}function UQ(A){let e=A?.customData?.[qj];return typeof e=="string"?e:""}function g3A(A){let e=(Array.isArray(A.groupIds)?A.groupIds:[]).filter(t=>!String(t).startsWith("subgraph_group_"));return e.length>0?String(e.at(-1)):""}function XU(A){return`${UQ(A)}\0${g3A(A)||A.id}`}function a_e(A,e){return e&&A.find(t=>!UQ(t)&&t.type!=="text"&&Array.isArray(t.groupIds)&&t.groupIds.includes(e))||null}function N0u(A){return A&&A[0].toUpperCase()+A.slice(1)}var M0u=800,p_e=16,ut={mode:"overlay",diagramIndex:0,diagramId:"",sceneSourceHash:"",currentSource:"",currentSourceHash:"",baselineElements:[],files:{},libraries:[],drawnWithUnverifiedLibraries:!1,imageFallback:!1,textMetricsVersion:Sx,channelId:"",api:null,saveTimer:0,teardownFlushId:"",flushIds:new Set,queueBusy:!1,setLocked:null};function GQ(A){window.top.postMessage({...A,diagramIndex:ut.diagramIndex,...ut.channelId?{channelId:ut.channelId}:{channelToken:String(window.__lavishWhiteboardChannelToken||""),diagramId:ut.diagramId}},"*")}function R0(A,e={},...t){let u=document.createElement(A);Object.assign(u,e);for(let r of t)u.append(r);return u}function rV(A,e){let t=document.getElementById(A);t&&(t.textContent=e,t.hidden=!e)}function Y0u(A,e){document.body.dataset.lavishWhiteboardTheme=A,document.body.dataset.lavishWhiteboardMode=e;let t=R0("div",{id:"wbShell"}),u=R0("header",{id:"wbHeader"}),r=R0("div",{id:"wbTitle",textContent:"Whiteboard"}),i=R0("input",{id:"wbNote",placeholder:"Optional note for the agent about these edits...",autocomplete:"off"}),a=R0("button",{id:"wbQueue",type:"button",textContent:"Queue feedback"});if(u.append(r,i,a),e==="inline"){let p=R0("button",{id:"wbFullscreen",type:"button",textContent:"Fullscreen",title:"Open this whiteboard full screen"});p.onclick=()=>GQ({type:"lavish-whiteboard:maximize",diagramIndex:ut.diagramIndex}),u.append(p)}let n=R0("div",{id:"wbFallbackBanner",className:"wb-banner",hidden:!0}),o=R0("div",{id:"wbStaleBanner",className:"wb-banner wb-banner-warn",hidden:!0}),s=R0("div",{id:"wbStatus",className:"wb-status",hidden:!0}),g=R0("div",{id:"wbEditor"}),l=R0("div",{id:"wbLinkConfirm",className:"wb-link-confirm",hidden:!0});l.setAttribute("role","dialog"),l.setAttribute("aria-modal","true"),l.setAttribute("aria-label","Open external link");let C=R0("div",{className:"wb-link-confirm-card"}),B=R0("div",{className:"wb-link-confirm-title",textContent:"Open external link?"}),E=R0("p",{className:"wb-link-confirm-copy",textContent:"This link came from the diagram."}),I=R0("p",{id:"wbLinkConfirmUrl",className:"wb-link-confirm-url"}),h=R0("div",{className:"wb-link-confirm-actions"}),d=R0("button",{id:"wbLinkConfirmCancel",type:"button",textContent:"Cancel"}),Q=R0("button",{id:"wbLinkConfirmOpen",type:"button",textContent:"Open link"});h.append(d,Q),C.append(B,E,I,h),l.append(C),t.append(u,n,o,s,g,l),document.body.append(t),a.onclick=()=>V0u().catch(p=>kD(`Queue failed: ${w_e(p)}`)),i.addEventListener("keydown",p=>{p.key==="Enter"&&!p.isComposing&&p.keyCode!==229&&(p.preventDefault(),a.click())}),d.onclick=I3A,Q.onclick=()=>{let p=String(l.dataset.url||"");p&&window.open(p,"_blank","noopener,noreferrer"),I3A()},l.addEventListener("keydown",p=>{if(p.key==="Escape"){p.preventDefault(),I3A();return}if(p.key!=="Tab")return;let m=[d,Q],f=m.indexOf(document.activeElement),D=p.shiftKey?f-1:f+1;D>=0&&D<m.length||(p.preventDefault(),m[p.shiftKey?m.length-1:0].focus())})}var f_e=0;function kD(A,{transient:e=!0}={}){let t=document.getElementById("wbStatus");t&&(t.textContent=A,t.hidden=!A,e&&A&&(window.clearTimeout(f_e),f_e=window.setTimeout(()=>{t.hidden=!0},4e3)))}function w_e(A){return A instanceof Error?A.message:String(A)}function y_e(){if(!ut.api)return null;let A=ut.api.getAppState();return{elements:ut.api.getSceneElements().map(e=>JSON.parse(JSON.stringify(e))),appState:tV({scrollX:A.scrollX,scrollY:A.scrollY,zoom:A.zoom}),files:ut.api.getFiles()||{}}}function p3A(A=""){let e=y_e();return e?(GQ({type:"lavish-whiteboard:save",diagramIndex:ut.diagramIndex,...E3A(ut,e),...A?{flushId:A}:{}}),!0):!1}function f3A(){ut.teardownFlushId||(window.clearTimeout(ut.saveTimer),ut.saveTimer=window.setTimeout(()=>{p3A()},M0u))}function T0u(A){let e=String(A.flushId||"");e&&(ut.teardownFlushId=e,window.clearTimeout(ut.saveTimer),ut.setLocked?.(!0),p3A(e)||(ut.teardownFlushId="",GQ({type:"lavish-whiteboard:teardownReady",flushId:e})))}function H0u(A){let e=String(A.flushId||"");!e||ut.flushIds.has(e)||(ut.flushIds.add(e),window.clearTimeout(ut.saveTimer),p3A(e)||(ut.flushIds.delete(e),GQ({type:"lavish-whiteboard:flushComplete",flushId:e,ok:!0})))}function K0u(A){let e=String(A.flushId||"");if(e){if(e===ut.teardownFlushId){if(ut.teardownFlushId="",A.ok){GQ({type:"lavish-whiteboard:teardownReady",flushId:e});return}ut.setLocked?.(!1);let t=String(A.error||"failed to save whiteboard scene");kD(`Could not save before closing: ${t}`,{transient:!1}),GQ({type:"lavish-whiteboard:teardownFailed",flushId:e,error:t});return}ut.flushIds.delete(e)&&GQ({type:"lavish-whiteboard:flushComplete",flushId:e,ok:!!A.ok})}}var h3A=null;function I3A(){let A=document.getElementById("wbLinkConfirm");A&&(A.hidden=!0);let e=h3A;h3A=null,e?.focus?.()}function J0u(A){let e=document.getElementById("wbLinkConfirm"),t=document.getElementById("wbLinkConfirmUrl"),u=document.getElementById("wbLinkConfirmCancel");if(!e||!t||!u)return;let r=document.activeElement;h3A=r&&typeof r.focus=="function"?r:null,e.dataset.url=A,t.textContent=A,e.hidden=!1,u.focus()}function O0u(A,e){e.preventDefault();let t=B_e(A?.link);if(!t){kD("Blocked a link with an unsupported or unsafe scheme.");return}J0u(t)}function _0u({elements:A,appState:e,files:t,theme:u,startLocked:r}){let[i,a]=vD.default.useState(r);return ut.setLocked=a,vD.default.createElement("div",{style:{position:"relative",width:"100%",height:"100%"}},vD.default.createElement(u3A,{initialData:{elements:A,appState:e,files:t||void 0,libraryItems:$Oe(ut.libraries),scrollToContent:!0},theme:u,viewModeEnabled:i,onChange:f3A,onLinkOpen:O0u,excalidrawAPI:n=>{ut.api=n,window.setTimeout(()=>{try{n.scrollToContent(n.getSceneElements(),{fitToContent:!0})}catch{}},0)},UIOptions:{canvasActions:{loadScene:!1,saveToActiveFile:!1,toggleTheme:!1}}}),i?vD.default.createElement("div",{className:"wb-activate",role:"button",tabIndex:0,onClick:()=>a(!1),onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&a(!1)}},vD.default.createElement("span",{className:"wb-activate-label"},"Click to edit")):null)}function b_e({elements:A,appState:e,files:t,theme:u}){let r=document.getElementById("wbEditor");(0,D_e.createRoot)(r).render(vD.default.createElement(_0u,{elements:A,appState:e,files:t,theme:u,startLocked:ut.mode==="inline"}))}var P0u=document.createElement("canvas"),d3A=P0u.getContext("2d");function W0u(A){return Object.entries(li).find(([,e])=>e===A)?.[0]||"Segoe UI Emoji"}function x_e(A){let e=W0u(A.fontFamily),t=e==="Excalifont"?[e,"Xiaolai","Segoe UI Emoji"]:[e,"Segoe UI Emoji"];return`${Number(A.fontSize)||20}px ${t.map(u=>JSON.stringify(u)).join(", ")}`}function Q3A(A){if(!d3A)return{width:Number(A.width)||0,height:Number(A.height)||0};d3A.font=x_e(A);let e=String(A.text||"").replace(/\r\n?/g,`
|
|
3352
3352
|
`).replace(/\t/g," ").split(`
|
|
3353
3353
|
`),t=Math.max(...e.map(r=>d3A.measureText(r||" ").width)),u=e.length*(Number(A.fontSize)||20)*(Number(A.lineHeight)||1.25);return{width:t,height:u}}async function v_e(A,e){let t=A.filter(u=>u.type==="text"&&!u.isDeleted);t.length!==0&&(await Sm({elements:A,appState:{exportBackground:!1},files:e||null,maxWidthOrHeight:1}),await Promise.all(t.map(u=>document.fonts.load(x_e(u),String(u.text||"")))),await document.fonts.ready)}async function q0u(A){let e=Zj(A).map(o=>({...o,item:i3A(ut.libraries,o.ref)})),{elements:t,files:u}=await eCA(A,{themeVariables:{fontSize:`${p_e}px`},...l_e(e,A)}),{skeletons:r,missing:i}=C_e(C3A(t),e,{labelFontSize:p_e}),n=c_e(C3A(await I_e(r,{convert:o=>{let s=fx(o,{regenerateIds:!1});return E_e(s).length>0&&(s=fx(o,{regenerateIds:!0})),s},loadFonts:async o=>{await v_e(o,u)}}),{measure:Q3A}),o=>i3A(ut.libraries,o));return{elements:n,files:u||{},imageFallback:uV(n),missingIcons:i}}function iV(){return{viewBackgroundColor:"#ffffff"}}function aV(A,e,t){return Fm({elements:Array.isArray(A)?A:[],appState:tV(e),files:t||{}},null,null,{repairBindings:!0})}function Z0u(A){let e=aV(A.scene?.elements,A.scene?.appState,A.scene?.files),t=Array.isArray(A.baseline?.elements)?aV(A.baseline.elements,iV(),A.scene?.files):null;return{...A,scene:{...A.scene,elements:e.elements},baseline:t?{...A.baseline,elements:t.elements}:null}}async function z0u(A){let e=await q0u(A.source),t=aV(e.elements,iV(),e.files),u=t.elements,r=t.files||e.files;if(ut.baselineElements=JSON.parse(JSON.stringify(u)),ut.files=r,ut.imageFallback=uV(u),ut.sceneSourceHash=A.sourceHash,ut.drawnWithUnverifiedLibraries=d_e(A.source,A.librariesUnavailable),ut.textMetricsVersion=Sx,ut.imageFallback&&rV("wbFallbackBanner","This diagram type is not natively editable, so it is shown as an image - draw, annotate, and add shapes on top."),b_e({elements:u,appState:iV(),files:r,theme:A.theme}),e.missingIcons.length>0){let i=[...new Set(e.missingIcons.map(n=>n.ref))].join(", "),a=e.missingIcons.length;kD(`${a} library icon${a===1?"":"s"} not shown: ${i}`)}f3A()}async function m_e(A){let e=A.saved,t=tV(e.scene?.appState),u=aV(e.scene?.elements,t,e.scene?.files),r=u.elements,i=Array.isArray(e.baseline?.elements)?JSON.parse(JSON.stringify(e.baseline.elements)):JSON.parse(JSON.stringify(u.elements));ut.files=u.files||e.scene?.files||{};let a=Number(e.text_metrics_version)||0;a<Sx&&(await v_e(r,ut.files),r=B3A(r,{measure:Q3A}).elements,i=B3A(i,{measure:Q3A}).elements),ut.baselineElements=i,ut.textMetricsVersion=Sx,ut.imageFallback=uV(r),ut.sceneSourceHash=e.source_hash||A.sourceHash,ut.drawnWithUnverifiedLibraries=!1,ut.imageFallback&&rV("wbFallbackBanner","This diagram type is not natively editable, so it is shown as an image - draw, annotate, and add shapes on top."),b_e({elements:r,appState:{...iV(),...t},files:ut.files,theme:A.theme}),a<Sx&&f3A()}function j0u(){let A=document.getElementById("wbStaleBanner");A.textContent="This diagram changed since these whiteboard edits were saved. ";let e=R0("button",{type:"button",textContent:"Re-convert (discard saved edits)"}),t=R0("button",{type:"button",textContent:"Keep editing saved scene"});return A.append(e,t),A.hidden=!1,new Promise(u=>{e.onclick=()=>{A.hidden=!0,u("reconvert")},t.onclick=()=>{A.textContent="Editing a scene converted from an older version of this diagram. Re-open the whiteboard to convert the latest diagram.",u("keep")}})}async function V0u(){if(!ut.api||ut.queueBusy)return;ut.queueBusy=!0;let A=document.getElementById("wbQueue");A.disabled=!0,A.textContent="Queueing...";try{let e=y_e(),t=Q_e(ut.baselineElements,e.elements),u=ut.api.getAppState(),r=await zEA({elements:ut.api.getSceneElements(),appState:{exportBackground:!0,viewBackgroundColor:u.viewBackgroundColor||"#ffffff"},files:ut.api.getFiles()||null,mimeType:"image/png"}),i=await X0u(r);GQ({type:"lavish-whiteboard:queueFeedback",diagramIndex:ut.diagramIndex,diagramId:ut.diagramId,...E3A(ut,e),imageFallback:ut.imageFallback,note:String(document.getElementById("wbNote").value||"").trim(),summaryLines:t.lines,stats:t.stats,pngDataUrl:i})}catch(e){throw k_e(),e}}function X0u(A){return new Promise((e,t)=>{let u=new FileReader;u.onload=()=>e(String(u.result)),u.onerror=()=>t(new Error("could not encode PNG preview")),u.readAsDataURL(A)})}function k_e(){ut.queueBusy=!1;let A=document.getElementById("wbQueue");A&&(A.disabled=!1,A.textContent="Queue feedback")}async function $0u(A){ut.mode=A.mode==="inline"?"inline":"overlay",ut.diagramIndex=Number(A.diagramIndex)||0,ut.diagramId=String(A.diagramId||""),ut.currentSource=String(A.source||""),ut.currentSourceHash=String(A.sourceHash||""),ut.libraries=Array.isArray(A.libraries)?A.libraries:[];let e=A.theme==="dark"?"dark":"light";document.getElementById("wbTitle").textContent=`Whiteboard \xB7 diagram ${ut.diagramIndex+1}`;let t=A.saved&&typeof A.saved=="object"&&A.saved.scene?A.saved:null;try{let u=h_e(t?Z0u(t):null,A.sourceHash);if(u==="restore"&&t){await m_e({...A,saved:t,theme:e});return}if(u==="prompt"&&t&&await j0u()==="keep"){await m_e({...A,saved:t,theme:e});return}await z0u({...A,theme:e})}catch(u){kD(`Could not open this diagram as a whiteboard: ${w_e(u)}`,{transient:!1})}}function Anu(A){ut.currentSource=String(A.source||""),ut.currentSourceHash=String(A.sourceHash||""),ut.currentSourceHash!==ut.sceneSourceHash?rV("wbStaleBanner","The underlying diagram changed while you were editing. Your edits are kept; close and re-open the whiteboard to convert the latest diagram."):rV("wbStaleBanner","")}function enu(){window.EXCALIDRAW_ASSET_PATH=`${location.origin}/whiteboard-assets/`;let A=new URL(location.href),e=Number(A.searchParams.get("diagramIndex"));ut.diagramIndex=Number.isInteger(e)&&e>=0&&e<=999?e:0,ut.diagramId=String(A.searchParams.get("diagramId")||"");let t=!1;window.addEventListener("message",u=>{if(u.source!==window.top)return;let r=u.data||{};if(r.type==="lavish-whiteboard:init"&&!t&&typeof r.channelId=="string"&&r.channelId&&(t=!0,ut.channelId=r.channelId,Y0u(r.theme==="dark"?"dark":"light",r.mode==="inline"?"inline":"overlay"),$0u(r)),!(!t||r.channelId!==ut.channelId)&&(r.type==="lavish-whiteboard:sourceChanged"&&Anu(r),r.type==="lavish-whiteboard:prepareTeardown"&&T0u(r),r.type==="lavish-whiteboard:flush"&&H0u(r),r.type==="lavish-whiteboard:saveResult"&&K0u(r),r.type==="lavish-whiteboard:queueResult"))if(k_e(),r.ok){let i=document.getElementById("wbNote");i&&(i.value=""),kD("Queued. Review it in the conversation panel, then Send to Agent.")}else kD(`Queue failed: ${String(r.error||"unknown error")}`,{transient:!1})}),GQ({type:"lavish-whiteboard:ready"})}enu();})();
|
|
3354
3354
|
/*! Bundled license information:
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "lavish-axi",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.89",
|
|
5
5
|
"description": "HTML is the new markdown. Lavish is the new editor for your HTML artifacts.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Kun Chen",
|