From 92ea195c463eb42ac857830f74319e80f3d9ec9a Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Mon, 19 May 2025 14:34:44 +0800 Subject: [PATCH 01/14] =?UTF-8?q?feat:=20gallery=E7=9A=84=E4=B8=8B?= =?UTF-8?q?=E6=96=B9=E6=96=87=E5=AD=97=E5=8A=A0=E5=9B=9E=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../copilot_web/{App-mzuNw1xF.js => App-DD0h6y--.js} | 4 ++-- ...YwD2.js => ParameterDebugInterfaceV2-eSr5IIOo.js} | 6 +++--- dist/copilot_web/assets/input-BFxtFr8c.css | 1 + dist/copilot_web/assets/input-CfrhPaqY.css | 1 - dist/copilot_web/input.js | 4 ++-- ...flowChat-QQb_1pUR.js => workflowChat-InPErGJu.js} | 4 ++-- pyproject.toml | 2 +- .../components/debug/screens/ResultGalleryScreen.tsx | 12 ++++++++++++ ui/src/output.css | 3 +++ 9 files changed, 26 insertions(+), 11 deletions(-) rename dist/copilot_web/{App-mzuNw1xF.js => App-DD0h6y--.js} (86%) rename dist/copilot_web/{ParameterDebugInterfaceV2-BjxlYwD2.js => ParameterDebugInterfaceV2-eSr5IIOo.js} (77%) create mode 100644 dist/copilot_web/assets/input-BFxtFr8c.css delete mode 100644 dist/copilot_web/assets/input-CfrhPaqY.css rename dist/copilot_web/{workflowChat-QQb_1pUR.js => workflowChat-InPErGJu.js} (99%) diff --git a/dist/copilot_web/App-mzuNw1xF.js b/dist/copilot_web/App-DD0h6y--.js similarity index 86% rename from dist/copilot_web/App-mzuNw1xF.js rename to dist/copilot_web/App-DD0h6y--.js index c062624..588572a 100644 --- a/dist/copilot_web/App-mzuNw1xF.js +++ b/dist/copilot_web/App-DD0h6y--.js @@ -1,6 +1,6 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-QQb_1pUR.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-B9b4Aopv.js","copilot_web/assets/input-CfrhPaqY.css","copilot_web/fonts.css"].map(path => { +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-InPErGJu.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-B9b4Aopv.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; const prefix = apiBase ? `${apiBase.substring(1)}/` : ''; return `${prefix}${path}`; }))))=>i.map(i=>d[i]); -import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-B9b4Aopv.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import("./workflowChat-QQb_1pUR.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; +import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-B9b4Aopv.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import("./workflowChat-InPErGJu.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/dist/copilot_web/ParameterDebugInterfaceV2-BjxlYwD2.js b/dist/copilot_web/ParameterDebugInterfaceV2-eSr5IIOo.js similarity index 77% rename from dist/copilot_web/ParameterDebugInterfaceV2-BjxlYwD2.js rename to dist/copilot_web/ParameterDebugInterfaceV2-eSr5IIOo.js index 3548218..b4e940c 100644 --- a/dist/copilot_web/ParameterDebugInterfaceV2-BjxlYwD2.js +++ b/dist/copilot_web/ParameterDebugInterfaceV2-eSr5IIOo.js @@ -1,10 +1,10 @@ -import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-B9b4Aopv.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-QQb_1pUR.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:C,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:j})=>{const N=(p,M,D,G=0)=>{if(p=isNaN(p)?0:p,M=isNaN(M)?100:M,D=isNaN(D)||D<=0?1:D,M{!t||t.length===0||t.forEach(p=>{const M=p.id.toString(),D=p.widgets||{};Object.values(D).forEach(y=>{const E=y.name;if(!s[E])return;if(!(r[M]?.[E]?.length>0)&&y.type==="number"){const v=y.options?.min||0,T=y.options?.max||100;let I=(y.options?.step||10)/10;I<.1&&(I=.1);const _=y.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(M,E,B);const z=`${M}_${E}`;b(S=>({...S,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(y.type==="customtext"||y.type.toLowerCase().includes("text")){const v=`${M}_${E}`,T=C[v]||[""];JSON.stringify(T)!==JSON.stringify(r[M]?.[E]||[""])&&l(M,E,T)}})})},[t,s,r,C,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,M)=>{const D=p.widgets||{},G=Object.values(D),y=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",y,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,M),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${y}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=C[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>j(y,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(y,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(y,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(y,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,S=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:$=>{$.preventDefault(),$.stopPropagation()},onChange:$=>{$.preventDefault(),$.stopPropagation();const O=$.target.value;if(b(A=>({...A,[T]:{...A[T],min:O}})),O===""||!isNaN(parseFloat(O))){const A=O===""?0:parseFloat(O),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(y,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:$=>{$.preventDefault(),$.stopPropagation()},required:!0,onChange:$=>{$.preventDefault(),$.stopPropagation();const O=$.target.value;if(b(A=>({...A,[T]:{...A[T],max:O}})),O===""||!isNaN(parseFloat(O))){const A=parseFloat(F.min||I.toString()),H=O===""?A:parseFloat(O),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(y,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:$=>{$.preventDefault(),$.stopPropagation()},onChange:$=>{$.preventDefault(),$.stopPropagation();const O=$.target.value;if(b(A=>({...A,[T]:{...A[T],step:O}})),O===""||!isNaN(parseFloat(O))&&parseFloat(O)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=O===""?1:parseFloat(O);U<.1&&(U=.1);const J=N(A,H,U,z);l(y,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const $=r[y]?.[v]||S;if($.length<=10)return $.map((O,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(y,v,O,H)},children:[e.jsx("span",{children:O}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const O=$.slice(0,5),A=$.slice($.length-5);return e.jsxs(e.Fragment,{children:[O.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(y,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(y,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${y}_${v}`,B=S=>typeof S=="string"?S:S&&typeof S=="object"&&"name"in S?S.name:String(S),z=S=>typeof S=="object"&&S!==null&&"name"in S?S.name:S;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[y]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:S=>{S.preventDefault(),S.stopPropagation(),a(y,v,S)},"data-dropdown":_,children:[e.jsx("span",{children:(r[y]?.[v]||[]).length>0?`${v}: ${(r[y]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:S=>{S.preventDefault(),S.stopPropagation(),d(y,v,S.target.value)},onClick:S=>{S.preventDefault(),S.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:S=>{S.preventDefault(),S.stopPropagation();const $=I.filter(O=>!i[_]||B(O).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(y,v,$)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[y]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[y]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[y]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[y]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(S=>!i[_]||B(S).toLowerCase().includes((i[_]||"").toLowerCase())).map((S,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:$=>{$.preventDefault(),$.stopPropagation(),n(y,v,z(S),$)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[y]?.[v]||[]).includes(z(S))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[y]?.[v]||[]).includes(z(S))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(S)})]},F)),I.filter(S=>!i[_]||B(S).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[y]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[y]?.[v]||[]).map((S,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:S}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:$=>{$.preventDefault(),$.stopPropagation(),n(y,v,S,$)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[y]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(y,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[y]?.[v]||[]).length+1}`;l(y,v,[...r[y]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},M)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const j=[...L,...P];m(j),j.length===1?x(j[0]):j.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const C=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",j=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:j.map((p,M)=>{const D=p.name;if(!s[D])return null;const G=r[N]?.[D]||[],y=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:ME.preventDefault()})})]},M)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>C(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],C=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",C,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const j=r[C]?.[P]||[],N=Array.isArray(j)?`[${j.join(", ")}]`:JSON.stringify(j);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const C=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((j,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:M=>s(p,M),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:M=>f(j.url,j.params,M),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:j.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})})]},p)})}),C>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:j=>i(1,j),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:j=>i(n-1,j),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",C]}),e.jsx("button",{onClick:j=>i(n+1,j),disabled:n===C,className:`px-2 py-1 rounded ${n===C?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:j=>i(C,j),disabled:n===C,className:`px-2 py-1 rounded ${n===C?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:j=>l(j),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white +import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-B9b4Aopv.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-InPErGJu.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:L,handleTextInputChange:k,handleAddTextInput:M,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=L[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,L,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=L[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>M(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:$=>{$.preventDefault(),$.stopPropagation()},onChange:$=>{$.preventDefault(),$.stopPropagation();const D=$.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:$=>{$.preventDefault(),$.stopPropagation()},required:!0,onChange:$=>{$.preventDefault(),$.stopPropagation();const D=$.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:$=>{$.preventDefault(),$.stopPropagation()},onChange:$=>{$.preventDefault(),$.stopPropagation();const D=$.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const $=r[j]?.[v]||C;if($.length<=10)return $.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=$.slice(0,5),A=$.slice($.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const $=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,$)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:$=>{$.preventDefault(),$.stopPropagation(),n(j,v,z(C),$)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:$=>{$.preventDefault(),$.stopPropagation(),n(j,v,C,$)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),M=[],P=[];for(const N of k)N.type==="SaveImage"?M.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...M,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const M=Object.values(V.canvas.selected_nodes);if(M.length===0)return;const P=M[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const L=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,M)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},M)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>L(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],L=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",L,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,M)=>{const P=k.name;if(!s[P])return null;const y=r[L]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Mp.preventDefault()})})]},M)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const L=Math.ceil(t.length/d),k=(n-1)*d,M=Math.min(k+d,t.length),P=t.slice(k,M);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),L>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",L]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===L,className:`px-2 py-1 rounded ${n===L?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i(L,y),disabled:n===L,className:`px-2 py-1 rounded ${n===L?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white bg-gray-50 dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-400 focus:ring-2 focus:ring-blue-500/20 dark:focus:ring-blue-400/20 focus:outline-none`,rows:3,placeholder:"Enter some text here...",value:r,onChange:x=>s(x.target.value)}),e.jsx("button",{className:`mt-2 px-4 py-2 rounded-lg text-sm flex items-center transition-colors ${o?"bg-gray-300 dark:bg-gray-600 text-gray-500 dark:text-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white"}`,onClick:i,disabled:o,children:o?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-gray-500 dark:text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Generating..."]}):e.jsx(e.Fragment,{children:"Generate"})})]}),n&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800/20 rounded-md text-red-700 dark:text-red-400 text-sm",children:n}),l.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Generated variations (select items to add):"}),e.jsx("div",{className:"space-y-2 max-h-[40vh] overflow-y-auto p-2",children:l.map((x,g)=>e.jsxs("div",{className:"flex items-start border border-gray-200 dark:border-gray-600 rounded-md p-2",children:[e.jsx("div",{className:"mr-2 mt-1",children:e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"checkbox",id:`text${g+1}`,checked:!!a[`text${g+1}`],onChange:()=>d(`text${g+1}`),className:"sr-only"}),e.jsx("div",{className:`h-4 w-4 rounded border ${a[`text${g+1}`]?"bg-blue-600 dark:bg-blue-500 border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600"} flex items-center justify-center cursor-pointer`,onClick:()=>d(`text${g+1}`),children:a[`text${g+1}`]&&e.jsx("svg",{className:"h-3 w-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})})]})}),e.jsx("label",{htmlFor:`text${g+1}`,className:"text-sm text-gray-700 dark:text-gray-300 cursor-pointer flex-1",children:x})]},g))})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 flex justify-end flex-shrink-0",children:[e.jsx("button",{className:`px-5 py-2.5 text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 - rounded-lg font-medium transition-colors mr-3`,onClick:u,children:"Cancel"}),e.jsx("button",{className:`px-5 py-2.5 rounded-lg font-medium transition-colors ${Object.values(a).every(x=>!x)?"bg-gray-300 dark:bg-gray-600 text-gray-500 dark:text-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white"}`,onClick:m,disabled:Object.values(a).every(x=>!x),children:"Add Selected"})]})]})}):null,je=t=>{const r=[],s={};if(Object.keys(t).forEach(o=>{const n=parseInt(o),i=t[o]||{},d=Object.keys(i).filter(u=>i[u]&&i[u].length>0);if(d.length===0)return;const m=[[]];d.forEach(u=>{const x=i[u],g=[];m.forEach(f=>{x.forEach(b=>{const C=[...f,{nodeId:n,paramName:u,paramValue:String(b)}];g.push(C)})}),m.length=0,m.push(...g)}),s[o]=m}),Object.keys(s).length===0)return r;if(Object.keys(s).length===1){const o=Object.keys(s)[0];return s[o]}const l=Object.keys(s);let a=s[l[0]];for(let o=1;o{n.forEach(m=>{i.push([...d,...m])})}),a=i}return a},St=(t,r)=>{const s={};s.nodeParams={};const l=je(t);return r{const n=o.nodeId.toString(),i=o.paramName,d=o.paramValue;s.nodeParams[n]||(s.nodeParams[n]={}),s.nodeParams[n][i]=d,s[i]=d}),s},Be="parameter_debug_history",De=30,Ae=async(t,r,s,l,a)=>{try{const o=Re(),n={id:ie(),timestamp:Date.now(),title:Ne(t,r),nodeName:t,params:{...r,nodeNames:{...r.nodeNames||{},[t.split("<")[0]]:t.split("<")[0]}},generatedImages:s,totalCount:l,workflow:a};return o.unshift(n),o.length>De&&o.splice(De),localStorage.setItem(Be,JSON.stringify(o)),n}catch(o){return console.error("Error saving parameter debug history:",o),null}},Re=()=>{try{const t=localStorage.getItem(Be);if(t)return JSON.parse(t)}catch(t){console.error("Error loading parameter debug history:",t)}return[]},ze=t=>{const r=new Date(t);return`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")} ${String(r.getHours()).padStart(2,"0")}:${String(r.getMinutes()).padStart(2,"0")}`},Ne=(t,r)=>{if(r.nodeParams)return Object.entries(r.nodeParams).map(([o,n])=>{let i=t;r.selectedNodeInfoMap&&r.selectedNodeInfoMap[o]&&(i=r.selectedNodeInfoMap[o]);const d=Object.keys(n).slice(0,3);return`${i}<${d.join(",")}>`}).join(";");const s=Object.keys(r).filter(l=>l!=="nodeParams"&&l!=="selectedNodeInfoMap").slice(0,3);return`${t}<${s.join(",")}>`},Ct=({historyItems:t,onViewHistoryItem:r,onClose:s})=>e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 flex flex-col h-full",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Experiments History"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["Last ",t.length," experiments"]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:s,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center text-gray-500 text-sm",children:"No history items found"}):e.jsx("div",{className:"flex-1 overflow-y-auto",children:t.map(l=>e.jsxs("div",{className:"border border-gray-200 rounded-lg mb-3 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 py-2 px-3 flex items-center justify-between border-b",children:[e.jsx("div",{className:"text-[14px] text-gray-600",children:ze(l.timestamp)}),e.jsx("button",{onClick:()=>r(l),className:"px-3 py-1 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"view"})]}),e.jsx("div",{className:"p-3",children:e.jsx("div",{className:"text-[10px] font-medium text-gray-700",children:Ne(l.nodeName,l.params)})})]},l.id))})]}),Lt=({historyItem:t,selectedImageIndex:r,handleSelectImage:s,handleClose:l,currentPage:a,handlePageChange:o,imagesPerPage:n,modalVisible:i,modalImageUrl:d,modalImageParams:m,openImageModal:u,closeImageModal:x})=>{const{timestamp:g,nodeName:f,generatedImages:b,params:C}=t,k=Math.ceil(b.length/n),L=(a-1)*n,P=Math.min(L+n,b.length),j=b.slice(L,P);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-start",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:Ne(f,C)}),e.jsxs("p",{className:"text-xs text-gray-500",children:[ze(g)," • ",b.length," images"]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600 mt-0",onClick:l,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx(te,{visible:i,imageUrl:d,params:{...C,nodeNames:{[t.nodeName.split("<")[0]]:t.nodeName.split("<")[0]}},onClose:x}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:j.map((N,p)=>{const M=L+p;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===M?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:D=>s(M,D),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:D=>u(N.url,N.params,D),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:N.url,alt:`Generated image ${M+1}`,className:"w-full h-full object-cover"})})]},M)})}),k>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:N=>o(1,N),disabled:a===1,className:`px-2 py-1 rounded ${a===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:N=>o(a-1,N),disabled:a===1,className:`px-2 py-1 rounded ${a===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",a," of ",k]}),e.jsx("button",{onClick:N=>o(a+1,N),disabled:a===k,className:`px-2 py-1 rounded ${a===k?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:N=>o(k,N),disabled:a===k,className:`px-2 py-1 rounded ${a===k?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]})]})},Mt=` + rounded-lg font-medium transition-colors mr-3`,onClick:u,children:"Cancel"}),e.jsx("button",{className:`px-5 py-2.5 rounded-lg font-medium transition-colors ${Object.values(a).every(x=>!x)?"bg-gray-300 dark:bg-gray-600 text-gray-500 dark:text-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white"}`,onClick:m,disabled:Object.values(a).every(x=>!x),children:"Add Selected"})]})]})}):null,je=t=>{const r=[],s={};if(Object.keys(t).forEach(o=>{const n=parseInt(o),i=t[o]||{},d=Object.keys(i).filter(u=>i[u]&&i[u].length>0);if(d.length===0)return;const m=[[]];d.forEach(u=>{const x=i[u],g=[];m.forEach(f=>{x.forEach(b=>{const L=[...f,{nodeId:n,paramName:u,paramValue:String(b)}];g.push(L)})}),m.length=0,m.push(...g)}),s[o]=m}),Object.keys(s).length===0)return r;if(Object.keys(s).length===1){const o=Object.keys(s)[0];return s[o]}const l=Object.keys(s);let a=s[l[0]];for(let o=1;o{n.forEach(m=>{i.push([...d,...m])})}),a=i}return a},St=(t,r)=>{const s={};s.nodeParams={};const l=je(t);return r{const n=o.nodeId.toString(),i=o.paramName,d=o.paramValue;s.nodeParams[n]||(s.nodeParams[n]={}),s.nodeParams[n][i]=d,s[i]=d}),s},Be="parameter_debug_history",De=30,Ae=async(t,r,s,l,a)=>{try{const o=Re(),n={id:ie(),timestamp:Date.now(),title:Ne(t,r),nodeName:t,params:{...r,nodeNames:{...r.nodeNames||{},[t.split("<")[0]]:t.split("<")[0]}},generatedImages:s,totalCount:l,workflow:a};return o.unshift(n),o.length>De&&o.splice(De),localStorage.setItem(Be,JSON.stringify(o)),n}catch(o){return console.error("Error saving parameter debug history:",o),null}},Re=()=>{try{const t=localStorage.getItem(Be);if(t)return JSON.parse(t)}catch(t){console.error("Error loading parameter debug history:",t)}return[]},ze=t=>{const r=new Date(t);return`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")} ${String(r.getHours()).padStart(2,"0")}:${String(r.getMinutes()).padStart(2,"0")}`},Ne=(t,r)=>{if(r.nodeParams)return Object.entries(r.nodeParams).map(([o,n])=>{let i=t;r.selectedNodeInfoMap&&r.selectedNodeInfoMap[o]&&(i=r.selectedNodeInfoMap[o]);const d=Object.keys(n).slice(0,3);return`${i}<${d.join(",")}>`}).join(";");const s=Object.keys(r).filter(l=>l!=="nodeParams"&&l!=="selectedNodeInfoMap").slice(0,3);return`${t}<${s.join(",")}>`},Ct=({historyItems:t,onViewHistoryItem:r,onClose:s})=>e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 flex flex-col h-full",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Experiments History"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["Last ",t.length," experiments"]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:s,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center text-gray-500 text-sm",children:"No history items found"}):e.jsx("div",{className:"flex-1 overflow-y-auto",children:t.map(l=>e.jsxs("div",{className:"border border-gray-200 rounded-lg mb-3 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 py-2 px-3 flex items-center justify-between border-b",children:[e.jsx("div",{className:"text-[14px] text-gray-600",children:ze(l.timestamp)}),e.jsx("button",{onClick:()=>r(l),className:"px-3 py-1 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"view"})]}),e.jsx("div",{className:"p-3",children:e.jsx("div",{className:"text-[10px] font-medium text-gray-700",children:Ne(l.nodeName,l.params)})})]},l.id))})]}),Lt=({historyItem:t,selectedImageIndex:r,handleSelectImage:s,handleClose:l,currentPage:a,handlePageChange:o,imagesPerPage:n,modalVisible:i,modalImageUrl:d,modalImageParams:m,openImageModal:u,closeImageModal:x})=>{const{timestamp:g,nodeName:f,generatedImages:b,params:L}=t,k=Math.ceil(b.length/n),M=(a-1)*n,P=Math.min(M+n,b.length),y=b.slice(M,P);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-start",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:Ne(f,L)}),e.jsxs("p",{className:"text-xs text-gray-500",children:[ze(g)," • ",b.length," images"]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600 mt-0",onClick:l,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx(te,{visible:i,imageUrl:d,params:{...L,nodeNames:{[t.nodeName.split("<")[0]]:t.nodeName.split("<")[0]}},onClose:x}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:y.map((N,p)=>{const S=M+p;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===S?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:O=>s(S,O),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:O=>u(N.url,N.params,O),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:N.url,alt:`Generated image ${S+1}`,className:"w-full h-full object-cover"})})]},S)})}),k>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:N=>o(1,N),disabled:a===1,className:`px-2 py-1 rounded ${a===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:N=>o(a-1,N),disabled:a===1,className:`px-2 py-1 rounded ${a===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",a," of ",k]}),e.jsx("button",{onClick:N=>o(a+1,N),disabled:a===k,className:`px-2 py-1 rounded ${a===k?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:N=>o(k,N),disabled:a===k,className:`px-2 py-1 rounded ${a===k?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]})]})},Mt=` @keyframes highlight-pulse { 0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); @@ -32,4 +32,4 @@ import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-re .animate-fade-in-out { animation: fade-in-out 3s forwards; } -`,re="parameter_debug_state",We=t=>{try{localStorage.setItem(re,JSON.stringify(t))}catch(r){console.error("Error saving parameter debug state:",r)}},$t=()=>{try{const t=localStorage.getItem(re);if(t)return JSON.parse(t)}catch(t){console.error("Error loading parameter debug state:",t)}return null},Pt=()=>{try{localStorage.removeItem(re)}catch(t){console.error("Error clearing parameter debug state:",t)}},Et=(t,r,s,l,a,o)=>{const n=`${t}_${r}`;o(d=>{const m=[...d[n]||[]];return m[s]=l,{...d,[n]:m}});const i=[...a[n]||[]];return i[s]=l,i},_t=(t,r,s,l)=>{const a=`${t}_${r}`;return l(o=>{const n=[...o[a]||[]];return n.push(""),{...o,[a]:n}}),[...s[a]||[],""]},It=(t,r,s,l,a)=>{const o=`${t}_${r}`;a(i=>{const d=[...i[o]||[]];return d.splice(s,1),{...i,[o]:d}});const n=[...l[o]||[]];return n.splice(s,1),n},Ot=(t,r,s,l,a)=>{s.preventDefault(),s.stopPropagation();const o=`${t}_${r}`;a(n=>{if(n[o]&&typeof n[o]=="object"?n[o].isOpen:!!n[o])return{...n,[o]:!1};{let d=0,m=0;if(s.currentTarget){const g=s.currentTarget.getBoundingClientRect();d=g.left,m=g.bottom}else d=s.clientX,m=s.clientY+20;const u=window.innerWidth,x=250;return d+x>u&&(d=u-x-10),d<0&&(d=10),{...n,[o]:{isOpen:!0,x:d,y:m}}}})},Dt=(t,r,s,l,a)=>{a(o=>{const n={...o};return n[t]||(n[t]={}),n[t][r]=s,n})},At=(t,r,s,l,a,o)=>{o&&(o.preventDefault(),o.stopPropagation()),a(n=>{const i={...n};i[t]||(i[t]={}),i[t][r]||(i[t][r]=[]);const d=i[t][r];return d.includes(s)?i[t][r]=d.filter(m=>m!==s):i[t][r]=[...d,s],i})},Wt=(t,r,s,l,a)=>{const o=`${t}_${r}`;a(n=>({...n,[o]:s}))},Tt=(t,r,s,l,a)=>{if(!l[t]){a(t,r,s);return}const o=l[t][r]||[];s.length===o.length?a(t,r,[]):a(t,r,[...s])},Bt=(t,r,s,l,a,o)=>{o&&(o.preventDefault(),o.stopPropagation());const n=r[t];if(s(i=>({...i,[t]:!n})),n){const i={...l};Object.keys(i).forEach(d=>{i[d][t]&&delete i[d][t]}),a(i)}},Rt=(t,r,s,l,a,o,n)=>{n.preventDefault(),n.stopPropagation();const i={...r};if(r.nodeParams){const d={};Object.keys(r.nodeParams).forEach(m=>{const u=s.find(x=>x.id.toString()===m);d[m]=u?u.title||`Node ${m}`:`Node ${m}`}),i.nodeNames=d}else if(Object.keys(r).length>0){const d={};Object.entries(r).forEach(([m,u])=>{(typeof u!="object"||u===null)&&(d[m]=u)}),Object.keys(d).length>0&&(i.nodeParams={default:d},i.nodeNames={default:r.node_name||r.nodeName||"参数"})}l(t),a(i),o(!0)},zt=(t,r)=>{r&&(r.preventDefault(),r.stopPropagation()),t(!1)},Ft=(t,r,s,l,a,o,n,i,d,m,u)=>{if(u&&(u.preventDefault(),u.stopPropagation()),t===0){const x={...l};Object.keys(x).forEach(g=>{const f=x[g];Object.keys(f).forEach(b=>{s[b]||delete f[b]})}),a(x)}if(t===1){const x={...l};n.forEach(f=>{const b=f.id.toString(),C=f.widgets||{};Object.values(C).forEach(k=>{const L=k.name;if(s[L]&&(k.type==="customtext"||k.type.toLowerCase().includes("text"))){const P=`${b}_${L}`,j=o[P]||[""];x[b]=x[b]||{},x[b][L]=j}})}),a(x);const g=m(x);i(g.length)}d(null),r(x=>Math.min(x+1,2))},Ht=(t,r,s,l,a,o,n,i,d,m)=>{if(m&&(m.preventDefault(),m.stopPropagation()),d(null),n&&i(!1),t===1){const u=s.map(f=>f.id.toString()),x=Object.keys(l),g={...l};x.forEach(f=>{u.includes(f)||delete g[f]}),a(g)}if(t===2||n){const u={...l};Object.entries(o).forEach(([x,g])=>{if(!g||g.length===0)return;const[f,b]=x.split("_");s.some(C=>C.id.toString()===f)&&(u[f]=u[f]||{},JSON.stringify(u[f][b])!==JSON.stringify(g)&&(u[f][b]=g))}),a(u)}r(u=>Math.max(u-1,0))},Ut=(t,r,s,l,a)=>{a&&(a.preventDefault(),a.stopPropagation()),l(Math.max(1,Math.min(t,Math.ceil(s.length/r))))};function Gt(t,r){try{if(!t)return console.error("Invalid prompt_output: ",t),t;for(const s of r){if(!t[s.nodeId]){console.error(`Node with ID ${s.nodeId} not found`);continue}if(!t[s.nodeId].inputs){console.error(`Inputs not found for node with ID ${s.nodeId}`);continue}t[s.nodeId].inputs[s.paramName]=s.paramValue}return t}catch(s){return console.error("Error updating prompt:",s),t}}async function Jt(t){const r=await V.graphToPrompt(),s=Gt(r.output,t);console.log("queuePrompt updated_prompt:",s);const l={prompt:s,client_id:V.api.clientId,extra_data:{extra_pageinfo:{workflow:r.workflow}}};console.debug("queuePrompt request_body.prompt:",s);const a=await ft(l);return console.debug("queuePrompt response:",a),a}function Te(t){const r=document.createElement("canvas"),s=r.getContext("2d");if(r.width=512,r.height=512,s){s.fillStyle="#f8d7da",s.fillRect(0,0,r.width,r.height),s.strokeStyle="#dc3545",s.lineWidth=4,s.strokeRect(10,10,r.width-20,r.height-20),s.fillStyle="#dc3545",s.beginPath(),s.arc(r.width/2,150,50,0,2*Math.PI),s.fill(),s.fillStyle="white",s.font="bold 80px Arial",s.textAlign="center",s.textBaseline="middle",s.fillText("!",r.width/2,150),s.fillStyle="#721c24",s.font="20px Arial",s.textAlign="center",s.textBaseline="middle";const l=r.width-60,a=30,o=t.split(" ");let n="",i=250;for(let d=0;dl&&d>0?(s.fillText(n,r.width/2,i),n=o[d]+" ",i+=a):n=m}s.fillText(n,r.width/2,i)}return r.toDataURL("image/png")}async function Kt(t){try{if(!t||t==="")return console.log("No prompt ID provided"),{1:[Te("Fail to generate prompt ID")]};const r=await bt(t);if(!r||!r[t])return console.log("Not finished for prompt ID:",t),{};const s=r[t];if(s.status&&s.status.status_str==="error"){console.error("Error for prompt ID:",t);const a=s.status.messages;if(a&&a.length>0){const o=a[a.length-1];if(o&&o.length>0){const n=o[0];return{1:[Te(n)]}}}}const l={};if(s.outputs)for(const a in s.outputs){const o=s.outputs[a];if(o&&o.images){l[a]=[];for(const n of o.images)if(n&&n.filename&&n.type){const i=V.graph._nodes_by_id[a].imgs[0].currentSrc.split("?")[0];l[a].push(i+"?filename="+encodeURIComponent(n.filename)+"&type="+encodeURIComponent(n.type)+(n.subfolder?"&subfolder="+encodeURIComponent(n.subfolder):""))}console.log("outputImages for nodeId:",a,l[a])}}return l}catch(r){throw console.error("Error getting output images from prompt:",r),r}}function qt(){const t=Object.values(V.graph._nodes_by_id),r=[],s=[];for(const l of t)l.type==="SaveImage"?r.push(l.id):l.type==="PreviewImage"&&s.push(l.id);if(console.log("saveNodeIds:",r),console.log("previewNodeIds:",s),r.length===0&&s.length===0)throw new Error("No SaveImage or PreviewImage node found, please add one to the graph");return r.length===1?r[0]:r.length==0&&s.length===1?s[0]:null}async function Vt(t,r){const s=await Kt(t);return Object.keys(s).length===0?null:s[r.toString()]&&s[r.toString()].length>0?s[r.toString()][0]:null}const Yt=async(t,r,s,l,a,o,n,i,d,m,u,x,g,f)=>{g&&(g.preventDefault(),g.stopPropagation()),He(m,d);const b=u(t),C=b.length;if(C>100){a(`Cannot generate more than 100 images at once (currently: ${C} images)`);return}a(null),s(!0),l(0),console.log("Generated parameter combinations:",b);let k=null;try{k=(await x.graphToPrompt()).output}catch(N){console.error("Error capturing workflow data:",N)}if(se.trackEvent({event_type:"start_generation",message_type:"parameter_debug",message_id:r,data:{workflow:k,all_params:t,count:C}}),b.length===0){a("No valid parameter combinations found. Please check your parameter selections."),s(!1);return}let L=f||null;if(L===null){const N=qt();N!==null&&(L=N)}if(L===null){a("Please select a SaveImage or PreviewImage node first."),s(!1);return}const P={};Object.keys(t).forEach(N=>{const p=x.graph._nodes_by_id[N];p&&(P[N]=p.type||p.comfyClass||"Unknown Node")});const j=[];try{const N=Date.now().toString();d.current=N;for(const E of b){const R=await Jt(E);R.prompt_id?j.push(R.prompt_id):(console.error("Failed to get prompt_id from response:",R),j.push(""))}const p=Array(b.length).fill(null).map((E,R)=>({url:`https://source.unsplash.com/random/300x300?sig=${Math.random()}`,params:St(t,R)}));o(p);const M=Date.now(),D=5*60*1e3,G=Object.keys(t)[0],y=P[G]||"Unknown Node";Fe(j,L,p,N,M,D,d,m,o,l,s,n,i,y,t,C,k,P)}catch(N){console.error("Error generating images:",N),s(!1)}},Fe=async(t,r,s,l,a,o,n,i,d,m,u,x,g,f,b,C,k,L)=>{if(n.current!==l){console.log("Another polling session has started, stopping this one");return}if(Date.now()-a>o){if(console.log("Timeout reached while waiting for images"),n.current===l&&(u(!1),x(!0),g(1),s.length>0&&f&&b)){const j=s[0].params;L&&(j.selectedNodeInfoMap=L),Ae(f,j,s,C||s.length,k)}return}let P=0;for(let j=0;j0&&f&&b)){const j=s[0].params;L&&(j.selectedNodeInfoMap=L),Ae(f,j,s,C||s.length,k)}return}n.current===l&&(i.current=setTimeout(()=>{Fe(t,r,s,l,a,o,n,i,d,m,u,x,g,f,b,C,k,L)},2e3))},He=(t,r)=>{t.current&&(clearTimeout(t.current),t.current=null),r.current=null},Xt=async(t,r,s,l,a,o)=>{if(!t.trim()){l("Please enter some text to generate variations");return}s(!0),l(null),a([]),o({});try{const n=await se.generateSDPrompts(t);a(n),se.trackEvent({event_type:"prompt_generate",message_type:"parameter_debug",message_id:r,data:{input_text:t,generated_texts:n}});const i={};n.forEach((d,m)=>{i[`text${m+1}`]=!1}),o(i)}catch(n){console.error("Error generating text:",n),l("Failed to generate text variations. Please try again.")}finally{s(!1)}},Qt=(t,r)=>{r(s=>({...s,[t]:!s[t]}))},Zt=(t,r,s,l,a,o,n,i,d,m)=>{const u=`${t}_${r}`,x=Object.entries(s).filter(([f,b])=>b).map(([f])=>{const b=parseInt(f.replace("text",""))-1;return l[b]});if(x.length===0)return;i(f=>{const b=[...f[u]||[]];return{...f,[u]:[...b,...x]}}),se.trackEvent({event_type:"prompt_apply",message_type:"parameter_debug",message_id:o,data:{input_text:a,generated_texts:l,selected_texts:x}});const g=[...n[u]||[],...x];d(t,r,g),m(!1)},es=(t,r,s,l,a,o,n,i,d,m)=>{s(!0),l(t),a(r),o(""),n([]),i({}),d(!1),m(null)},ts=(t,r,s,l,a,o,n,i,d,m,u,x,g,f,b,C,k,L,P,j,N,p,M,D,G,y,E,R,v,T=!1)=>{t(0),r({Steps:!0,CFG:!0,sampler_name:!0,threshold:!1,prompt:!1}),s(ie()),l(),a(!1),o(!1),n(0),i(12),d(null),m(Array(12).fill(null).map((I,_)=>({url:`https://source.unsplash.com/random/300x300?sig=${Math.random()}`,params:{step:_%3===0?5:_%3===1?10:15,sampler_name:"euler",cfg:1}}))),u({}),x({}),g({}),f({}),b(1),C(null),k(!1),L(!1),P(""),j(null),N({}),p(!1),M(""),D([]),G(!1),y(""),E(""),R(null),v({}),T&&Pt()},ss=(t,r,s)=>{s&&(s.preventDefault(),s.stopPropagation()),r(t)},rs=async(t,r,s,l,a,o,n)=>{if(n&&(n.preventDefault(),n.stopPropagation()),t!==null){console.log(`Applied image ${t+1} with parameters:`,r[t].params);let i=1;if(a){for(const m in a)if(a[m])for(const u in a[m]){const x=a[m][u];if(x){let g=1;Array.isArray(x)?g=x.length>0?x.length:1:typeof x=="object"&&x!==null&&(g=Object.keys(x).length>0?Object.keys(x).length:1),i=i*g}}}se.trackEvent({event_type:"parameter_debug_apply",message_type:"parameter_debug",message_id:l,data:{workflow:(await s.graphToPrompt()).output,selected_params:r[t].params,all_params:a,count:i}});const d=r[t].params;d.nodeParams&&(Object.entries(d.nodeParams).forEach(([m,u])=>{const x=s.graph._nodes_by_id[m];!x||!x.widgets||Object.entries(u).forEach(([g,f])=>{for(const b of x.widgets)if(b.name===g){b.value=f;break}})}),s.graph.setDirtyCanvas(!1,!0),o(!0),setTimeout(()=>{o(!1)},3e3))}},ns=(t,r,s,l,a,o,n)=>{if(n&&(n.preventDefault(),n.stopPropagation()),t===1&&s!==void 0){const i=[...r];i[s],i.splice(s,1),i.length===0?a&&(l({type:"SET_SCREEN_STATE",payload:null}),o(!0),a()):l({type:"SET_SELECTED_NODE",payload:i});return}a&&(l({type:"SET_SCREEN_STATE",payload:null}),o(!0),a())},os=({selectedNodes:t,visible:r,onClose:s})=>{const[l,a]=w.useState(0),[o,n]=w.useState({Steps:!0,CFG:!0,sampler_name:!0,threshold:!1,prompt:!1}),[i,d]=w.useState(ie()),[m,u]=w.useState(!1),[x,g]=w.useState(!1),[f,b]=w.useState(0),[C,k]=w.useState(12),[L,P]=w.useState(null),[j,N]=w.useState(()=>Array(12).fill(null).map((c,h)=>({url:`https://source.unsplash.com/random/300x300?sig=${Math.random()}`,params:{step:h%3===0?5:h%3===1?10:15,sampler_name:"euler",cfg:1}}))),[p,M]=w.useState({}),[D,G]=w.useState({}),[y,E]=w.useState({}),[R,v]=w.useState({}),[T,I]=w.useState(1),_=6,[B,z]=w.useState(null),[S,F]=w.useState(!1),[$,O]=w.useState(!1),[A,H]=w.useState(""),[U,J]=w.useState(null),[q,Y]=w.useState({}),[Ue,ne]=w.useState(!1),[ce,de]=w.useState(""),[we,xe]=w.useState([]),[Ge,me]=w.useState(!1),[Je,ke]=w.useState(""),[Ke,Se]=w.useState(""),[qe,ue]=w.useState(null),[Ce,oe]=w.useState({}),[he,ge]=w.useState(!1),[Ve,Ye]=w.useState([]),[Le,pe]=w.useState(null),{dispatch:fe}=ve(),Me=w.useRef(null),$e=w.useRef(null),[Xe,ae]=w.useState(()=>r);w.useEffect(()=>{if(he){const c=Re();Ye(c)}},[he]);const Qe=async()=>{Xt(ce,i,me,ue,xe,oe)},Ze=(c,h,W,K)=>{const Z=Et(c,h,W,K,q,Y);X(c,h,Z)},et=(c,h)=>{const W=_t(c,h,q,Y);X(c,h,W)},tt=(c,h,W)=>{const K=It(c,h,W,q,Y);X(c,h,K)},st=c=>{Qt(c,oe)},rt=()=>{Zt(Je,Ke,Ce,we,ce,i,q,Y,X,ne)},nt=(c,h)=>{es(c,h,ne,ke,Se,de,xe,oe,me,ue)},Pe=c=>{c&&(c.preventDefault(),c.stopPropagation()),ge(h=>!h)},ot=c=>{pe(c),ge(!1),N(c.generatedImages||[]),P(null),I(1)},at=c=>{c&&(c.preventDefault(),c.stopPropagation()),pe(null)};w.useEffect(()=>{if(!t||t.length===0)return;const c={...p},h=t.map(K=>K.id.toString());Object.keys(c).forEach(K=>{h.includes(K)||delete c[K]}),t.forEach(K=>{const Z=K.id.toString();c[Z]||(c[Z]={})}),JSON.stringify(c)!==JSON.stringify(p)&&M(c)},[t,p]),w.useEffect(()=>{fe({type:"SET_SCREEN_STATE",payload:{currentScreen:l,isProcessing:m,isCompleted:x}})},[l,m,x,fe]),w.useEffect(()=>{const c=document.createElement("style");return c.textContent=Mt,document.head.appendChild(c),()=>{document.head.removeChild(c)}},[]),w.useEffect(()=>{const c=h=>{if(Object.values(D).some(W=>W)){const W=h.target,K=!!W.closest(".dropdown-menu"),Z=!!W.closest("[data-dropdown]");!K&&!Z&&G({})}};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[D]),w.useEffect(()=>{r&&(JSON.parse(localStorage.getItem(re)||"{}").task_id||d(ie()))},[r]),w.useEffect(()=>{if(r){ae(!0);try{const c=localStorage.getItem(re);if(c){const h=JSON.parse(c);if(!t||t.length===0){console.log("Not restoring parameter debug state: no nodes selected"),ae(!1);return}h.currentScreen!==void 0&&a(h.currentScreen),h.selectedParams&&n(h.selectedParams),h.task_id&&d(h.task_id);const W=h.generatedImages&&h.generatedImages.length>0;h.isProcessing!==void 0&&!h.isProcessing&&u(!1),h.isCompleted!==void 0&&W&&g(h.isCompleted),h.completedCount!==void 0&&b(h.completedCount),h.totalCount!==void 0&&k(h.totalCount),h.selectedImageIndex!==void 0&&P(h.selectedImageIndex),h.generatedImages&&N(h.generatedImages),h.paramTestValues&&M(h.paramTestValues),h.searchTerms&&E(h.searchTerms),h.inputValues&&v(h.inputValues),h.currentPage!==void 0&&I(h.currentPage),h.textInputs&&Y(h.textInputs)}}catch(c){console.error("Error loading parameter debug state:",c)}finally{setTimeout(()=>{ae(!1)},50)}}else ae(!0);return()=>{if(!r)return;We({currentScreen:l,selectedParams:o,task_id:i,isProcessing:m,isCompleted:x,completedCount:f,totalCount:C,selectedImageIndex:L,generatedImages:j,paramTestValues:p,searchTerms:y,inputValues:R,currentPage:T,textInputs:q})}},[r]);const lt=(c=!1)=>{ts(a,n,d,ye,u,g,b,k,P,N,M,G,E,v,I,z,F,O,H,J,Y,ne,de,xe,me,ke,Se,ue,oe,c),ge(!1),pe(null)};w.useEffect(()=>{if(!r)return;const c=setTimeout(()=>{We({currentScreen:l,selectedParams:o,task_id:i,isProcessing:m,isCompleted:x,completedCount:f,totalCount:C,selectedImageIndex:L,generatedImages:j,paramTestValues:p,searchTerms:y,inputValues:R,currentPage:T,textInputs:q})},500);return()=>clearTimeout(c)},[r,l,o,i,m,x,f,C,L,j,p,y,R,T,q]);const Ee=c=>{Ft(l,a,o,p,M,q,t,k,z,je,c)},be=c=>{Ht(l,a,t,p,M,q,x,g,z,c)},it=(c,h)=>{Bt(c,o,n,p,M,h)},ct=(c,h,W)=>{Ot(c,h,W,D,G)},X=(c,h,W)=>{Dt(c,h,W,p,M)},dt=(c,h,W,K)=>{At(c,h,W,p,M,K)},xt=(c,h,W)=>{Wt(c,h,W,y,E)},mt=(c,h,W)=>{Tt(c,h,W,p,X)},_e=(c,h)=>{Ut(c,_,j,I,h)},ye=()=>{He(Me,$e)};w.useEffect(()=>()=>{ye()},[]);const ut=async(c,h)=>{Yt(p,i,u,b,z,N,g,I,$e,Me,je,V,c,h)},Ie=(c,h)=>{ss(c,P,h)},Oe=(c,h,W)=>{Rt(c,h,t,H,J,O,W)},ee=c=>{zt(O,c)},ht=async c=>{rs(L,j,V,i,p,F,c)},Q=(c,h)=>{ns(l,t,h,fe,s,lt,c)},le=()=>e.jsx(e.Fragment,{children:e.jsx(te,{visible:$,imageUrl:A,params:U||{},onClose:ee})});return Le?e.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4",onClick:c=>c.stopPropagation(),children:e.jsx(Lt,{historyItem:Le,selectedImageIndex:L,handleSelectImage:Ie,handleClose:at,currentPage:T,handlePageChange:_e,imagesPerPage:_,modalVisible:$,modalImageUrl:A,modalImageParams:U,openImageModal:Oe,closeImageModal:ee})}):he?e.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:e.jsx(Ct,{historyItems:Ve,onViewHistoryItem:ot,onClose:Pe})}):Xe&&r&&t.length>0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 bg-gray-50 overflow-y-auto",onClick:c=>c.stopPropagation(),children:[e.jsxs("div",{className:"p-8 rounded-lg shadow-sm relative flex flex-col items-center",children:[e.jsx("div",{className:"w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin"}),e.jsx("div",{className:"mt-4 text-gray-600 text-sm",children:"Loading interface..."})]}),e.jsx(te,{visible:$,imageUrl:A,params:U||{},onClose:ee})]}):!r||t.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 bg-gray-50 overflow-y-auto",onClick:c=>c.stopPropagation(),children:[e.jsxs("div",{className:"max-w-lg p-8 rounded-lg shadow-sm border border-blue-100 relative",children:[e.jsxs("div",{className:"absolute top-3 right-3 flex",children:[e.jsx("button",{className:"text-blue-500 hover:text-blue-700 mr-2",onClick:Pe,title:"Show History",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})})}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:Q,children:e.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"mb-6 text-center",children:[e.jsx("h3",{className:"text-base font-bold text-blue-600 mb-2",children:"GenLab"}),e.jsx("div",{className:"h-1 w-16 bg-blue-500 mx-auto rounded-full mb-4"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-left mb-4",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-800 mb-3",children:"Batch-test parameters & find the best combo in one click."}),e.jsx("div",{className:"h-px w-full bg-gray-200 my-4"})]}),e.jsxs("div",{className:"text-left",children:[e.jsx("h4",{className:"text-base font-medium text-gray-800 mb-4",children:"How to use"}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("p",{className:"text-sm text-gray-700",children:[e.jsx("span",{className:"font-bold",children:"1 - "}),"Click any node(hold Shift to select multiple nodes)"]}),e.jsxs("p",{className:"text-sm text-gray-700",children:[e.jsx("span",{className:"font-bold",children:"2 - "}),"Set parameter ranges and start batch generation."]})]}),e.jsx("div",{className:"h-px w-full bg-gray-200 my-4"}),e.jsx("p",{className:"text-sm text-blue-600 mt-6",children:"Let's select a node to begin!"})]})]})]}),e.jsx(te,{visible:$,imageUrl:A,params:U||{},onClose:ee})]}):x?e.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4",onClick:c=>c.stopPropagation(),children:e.jsx(wt,{generatedImages:j,selectedImageIndex:L,handleSelectImage:Ie,handleApplySelected:ht,handlePrevious:be,handleClose:Q,currentPage:T,handlePageChange:_e,imagesPerPage:_,notificationVisible:S,modalVisible:$,modalImageUrl:A,modalImageParams:U,openImageModal:Oe,closeImageModal:ee})}):m?e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4",onClick:c=>c.stopPropagation(),children:[e.jsx(Nt,{selectedNodes:t,paramTestValues:p,selectedParams:o,totalCount:C,completedCount:f,errorMessage:B,handleClose:Q,setIsProcessing:u,setCurrentScreen:a,cleanupPolling:ye}),e.jsx(le,{})]}):l===0?e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:[e.jsx(yt,{selectedNodes:t,handleParamSelect:it,selectedParams:o,handleNext:Ee,handleClose:Q}),e.jsx(le,{})]}):l===1?e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:[e.jsx(jt,{selectedNodes:t,paramTestValues:p,selectedParams:o,updateParamTestValues:X,toggleDropdown:ct,openDropdowns:D,handleTestValueSelect:dt,searchTerms:y,handleSearch:xt,handleSelectAll:mt,handleNext:Ee,handlePrevious:be,handleClose:Q,inputValues:R,setInputValues:v,textInputs:q,handleTextInputChange:Ze,handleAddTextInput:et,handleRemoveTextInput:tt,openAiWritingModal:nt}),e.jsx(kt,{visible:Ue,aiWritingModalText:ce,setAiWritingModalText:de,aiGeneratedTexts:we,aiSelectedTexts:Ce,aiWritingLoading:Ge,aiWritingError:qe,handleAiWriting:Qe,toggleTextSelection:st,addSelectedTexts:rt,onClose:()=>ne(!1)}),e.jsx(le,{})]}):e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:[e.jsx(vt,{selectedNodes:t,paramTestValues:p,selectedParams:o,totalCount:C,errorMessage:B,handlePrevious:be,handleStartGeneration:ut,handleClose:Q}),e.jsx(le,{})]})},ms=t=>{const{dispatch:r}=ve(),[s,l]=w.useState(!1);return w.useEffect(()=>{if(t.visible&&!s){const a=$t();a&&a.screenState&&r({type:"SET_SCREEN_STATE",payload:{currentScreen:a.currentScreen,isProcessing:a.isProcessing,isCompleted:a.isCompleted}}),l(!0)}},[t.visible,s,r]),w.useEffect(()=>()=>{t.visible||r({type:"SET_SCREEN_STATE",payload:null})},[t.visible,r]),e.jsx(os,{...t})};export{ms as ParameterDebugInterface}; +`,re="parameter_debug_state",We=t=>{try{localStorage.setItem(re,JSON.stringify(t))}catch(r){console.error("Error saving parameter debug state:",r)}},$t=()=>{try{const t=localStorage.getItem(re);if(t)return JSON.parse(t)}catch(t){console.error("Error loading parameter debug state:",t)}return null},Pt=()=>{try{localStorage.removeItem(re)}catch(t){console.error("Error clearing parameter debug state:",t)}},Et=(t,r,s,l,a,o)=>{const n=`${t}_${r}`;o(d=>{const m=[...d[n]||[]];return m[s]=l,{...d,[n]:m}});const i=[...a[n]||[]];return i[s]=l,i},_t=(t,r,s,l)=>{const a=`${t}_${r}`;return l(o=>{const n=[...o[a]||[]];return n.push(""),{...o,[a]:n}}),[...s[a]||[],""]},It=(t,r,s,l,a)=>{const o=`${t}_${r}`;a(i=>{const d=[...i[o]||[]];return d.splice(s,1),{...i,[o]:d}});const n=[...l[o]||[]];return n.splice(s,1),n},Ot=(t,r,s,l,a)=>{s.preventDefault(),s.stopPropagation();const o=`${t}_${r}`;a(n=>{if(n[o]&&typeof n[o]=="object"?n[o].isOpen:!!n[o])return{...n,[o]:!1};{let d=0,m=0;if(s.currentTarget){const g=s.currentTarget.getBoundingClientRect();d=g.left,m=g.bottom}else d=s.clientX,m=s.clientY+20;const u=window.innerWidth,x=250;return d+x>u&&(d=u-x-10),d<0&&(d=10),{...n,[o]:{isOpen:!0,x:d,y:m}}}})},Dt=(t,r,s,l,a)=>{a(o=>{const n={...o};return n[t]||(n[t]={}),n[t][r]=s,n})},At=(t,r,s,l,a,o)=>{o&&(o.preventDefault(),o.stopPropagation()),a(n=>{const i={...n};i[t]||(i[t]={}),i[t][r]||(i[t][r]=[]);const d=i[t][r];return d.includes(s)?i[t][r]=d.filter(m=>m!==s):i[t][r]=[...d,s],i})},Wt=(t,r,s,l,a)=>{const o=`${t}_${r}`;a(n=>({...n,[o]:s}))},Tt=(t,r,s,l,a)=>{if(!l[t]){a(t,r,s);return}const o=l[t][r]||[];s.length===o.length?a(t,r,[]):a(t,r,[...s])},Bt=(t,r,s,l,a,o)=>{o&&(o.preventDefault(),o.stopPropagation());const n=r[t];if(s(i=>({...i,[t]:!n})),n){const i={...l};Object.keys(i).forEach(d=>{i[d][t]&&delete i[d][t]}),a(i)}},Rt=(t,r,s,l,a,o,n)=>{n.preventDefault(),n.stopPropagation();const i={...r};if(r.nodeParams){const d={};Object.keys(r.nodeParams).forEach(m=>{const u=s.find(x=>x.id.toString()===m);d[m]=u?u.title||`Node ${m}`:`Node ${m}`}),i.nodeNames=d}else if(Object.keys(r).length>0){const d={};Object.entries(r).forEach(([m,u])=>{(typeof u!="object"||u===null)&&(d[m]=u)}),Object.keys(d).length>0&&(i.nodeParams={default:d},i.nodeNames={default:r.node_name||r.nodeName||"参数"})}l(t),a(i),o(!0)},zt=(t,r)=>{r&&(r.preventDefault(),r.stopPropagation()),t(!1)},Ft=(t,r,s,l,a,o,n,i,d,m,u)=>{if(u&&(u.preventDefault(),u.stopPropagation()),t===0){const x={...l};Object.keys(x).forEach(g=>{const f=x[g];Object.keys(f).forEach(b=>{s[b]||delete f[b]})}),a(x)}if(t===1){const x={...l};n.forEach(f=>{const b=f.id.toString(),L=f.widgets||{};Object.values(L).forEach(k=>{const M=k.name;if(s[M]&&(k.type==="customtext"||k.type.toLowerCase().includes("text"))){const P=`${b}_${M}`,y=o[P]||[""];x[b]=x[b]||{},x[b][M]=y}})}),a(x);const g=m(x);i(g.length)}d(null),r(x=>Math.min(x+1,2))},Ht=(t,r,s,l,a,o,n,i,d,m)=>{if(m&&(m.preventDefault(),m.stopPropagation()),d(null),n&&i(!1),t===1){const u=s.map(f=>f.id.toString()),x=Object.keys(l),g={...l};x.forEach(f=>{u.includes(f)||delete g[f]}),a(g)}if(t===2||n){const u={...l};Object.entries(o).forEach(([x,g])=>{if(!g||g.length===0)return;const[f,b]=x.split("_");s.some(L=>L.id.toString()===f)&&(u[f]=u[f]||{},JSON.stringify(u[f][b])!==JSON.stringify(g)&&(u[f][b]=g))}),a(u)}r(u=>Math.max(u-1,0))},Ut=(t,r,s,l,a)=>{a&&(a.preventDefault(),a.stopPropagation()),l(Math.max(1,Math.min(t,Math.ceil(s.length/r))))};function Gt(t,r){try{if(!t)return console.error("Invalid prompt_output: ",t),t;for(const s of r){if(!t[s.nodeId]){console.error(`Node with ID ${s.nodeId} not found`);continue}if(!t[s.nodeId].inputs){console.error(`Inputs not found for node with ID ${s.nodeId}`);continue}t[s.nodeId].inputs[s.paramName]=s.paramValue}return t}catch(s){return console.error("Error updating prompt:",s),t}}async function Jt(t){const r=await V.graphToPrompt(),s=Gt(r.output,t);console.log("queuePrompt updated_prompt:",s);const l={prompt:s,client_id:V.api.clientId,extra_data:{extra_pageinfo:{workflow:r.workflow}}};console.debug("queuePrompt request_body.prompt:",s);const a=await ft(l);return console.debug("queuePrompt response:",a),a}function Te(t){const r=document.createElement("canvas"),s=r.getContext("2d");if(r.width=512,r.height=512,s){s.fillStyle="#f8d7da",s.fillRect(0,0,r.width,r.height),s.strokeStyle="#dc3545",s.lineWidth=4,s.strokeRect(10,10,r.width-20,r.height-20),s.fillStyle="#dc3545",s.beginPath(),s.arc(r.width/2,150,50,0,2*Math.PI),s.fill(),s.fillStyle="white",s.font="bold 80px Arial",s.textAlign="center",s.textBaseline="middle",s.fillText("!",r.width/2,150),s.fillStyle="#721c24",s.font="20px Arial",s.textAlign="center",s.textBaseline="middle";const l=r.width-60,a=30,o=t.split(" ");let n="",i=250;for(let d=0;dl&&d>0?(s.fillText(n,r.width/2,i),n=o[d]+" ",i+=a):n=m}s.fillText(n,r.width/2,i)}return r.toDataURL("image/png")}async function Kt(t){try{if(!t||t==="")return console.log("No prompt ID provided"),{1:[Te("Fail to generate prompt ID")]};const r=await bt(t);if(!r||!r[t])return console.log("Not finished for prompt ID:",t),{};const s=r[t];if(s.status&&s.status.status_str==="error"){console.error("Error for prompt ID:",t);const a=s.status.messages;if(a&&a.length>0){const o=a[a.length-1];if(o&&o.length>0){const n=o[0];return{1:[Te(n)]}}}}const l={};if(s.outputs)for(const a in s.outputs){const o=s.outputs[a];if(o&&o.images){l[a]=[];for(const n of o.images)if(n&&n.filename&&n.type){const i=V.graph._nodes_by_id[a].imgs[0].currentSrc.split("?")[0];l[a].push(i+"?filename="+encodeURIComponent(n.filename)+"&type="+encodeURIComponent(n.type)+(n.subfolder?"&subfolder="+encodeURIComponent(n.subfolder):""))}console.log("outputImages for nodeId:",a,l[a])}}return l}catch(r){throw console.error("Error getting output images from prompt:",r),r}}function qt(){const t=Object.values(V.graph._nodes_by_id),r=[],s=[];for(const l of t)l.type==="SaveImage"?r.push(l.id):l.type==="PreviewImage"&&s.push(l.id);if(console.log("saveNodeIds:",r),console.log("previewNodeIds:",s),r.length===0&&s.length===0)throw new Error("No SaveImage or PreviewImage node found, please add one to the graph");return r.length===1?r[0]:r.length==0&&s.length===1?s[0]:null}async function Vt(t,r){const s=await Kt(t);return Object.keys(s).length===0?null:s[r.toString()]&&s[r.toString()].length>0?s[r.toString()][0]:null}const Yt=async(t,r,s,l,a,o,n,i,d,m,u,x,g,f)=>{g&&(g.preventDefault(),g.stopPropagation()),He(m,d);const b=u(t),L=b.length;if(L>100){a(`Cannot generate more than 100 images at once (currently: ${L} images)`);return}a(null),s(!0),l(0),console.log("Generated parameter combinations:",b);let k=null;try{k=(await x.graphToPrompt()).output}catch(N){console.error("Error capturing workflow data:",N)}if(se.trackEvent({event_type:"start_generation",message_type:"parameter_debug",message_id:r,data:{workflow:k,all_params:t,count:L}}),b.length===0){a("No valid parameter combinations found. Please check your parameter selections."),s(!1);return}let M=f||null;if(M===null){const N=qt();N!==null&&(M=N)}if(M===null){a("Please select a SaveImage or PreviewImage node first."),s(!1);return}const P={};Object.keys(t).forEach(N=>{const p=x.graph._nodes_by_id[N];p&&(P[N]=p.type||p.comfyClass||"Unknown Node")});const y=[];try{const N=Date.now().toString();d.current=N;for(const E of b){const R=await Jt(E);R.prompt_id?y.push(R.prompt_id):(console.error("Failed to get prompt_id from response:",R),y.push(""))}const p=Array(b.length).fill(null).map((E,R)=>({url:`https://source.unsplash.com/random/300x300?sig=${Math.random()}`,params:St(t,R)}));o(p);const S=Date.now(),O=5*60*1e3,G=Object.keys(t)[0],j=P[G]||"Unknown Node";Fe(y,M,p,N,S,O,d,m,o,l,s,n,i,j,t,L,k,P)}catch(N){console.error("Error generating images:",N),s(!1)}},Fe=async(t,r,s,l,a,o,n,i,d,m,u,x,g,f,b,L,k,M)=>{if(n.current!==l){console.log("Another polling session has started, stopping this one");return}if(Date.now()-a>o){if(console.log("Timeout reached while waiting for images"),n.current===l&&(u(!1),x(!0),g(1),s.length>0&&f&&b)){const y=s[0].params;M&&(y.selectedNodeInfoMap=M),Ae(f,y,s,L||s.length,k)}return}let P=0;for(let y=0;y0&&f&&b)){const y=s[0].params;M&&(y.selectedNodeInfoMap=M),Ae(f,y,s,L||s.length,k)}return}n.current===l&&(i.current=setTimeout(()=>{Fe(t,r,s,l,a,o,n,i,d,m,u,x,g,f,b,L,k,M)},2e3))},He=(t,r)=>{t.current&&(clearTimeout(t.current),t.current=null),r.current=null},Xt=async(t,r,s,l,a,o)=>{if(!t.trim()){l("Please enter some text to generate variations");return}s(!0),l(null),a([]),o({});try{const n=await se.generateSDPrompts(t);a(n),se.trackEvent({event_type:"prompt_generate",message_type:"parameter_debug",message_id:r,data:{input_text:t,generated_texts:n}});const i={};n.forEach((d,m)=>{i[`text${m+1}`]=!1}),o(i)}catch(n){console.error("Error generating text:",n),l("Failed to generate text variations. Please try again.")}finally{s(!1)}},Qt=(t,r)=>{r(s=>({...s,[t]:!s[t]}))},Zt=(t,r,s,l,a,o,n,i,d,m)=>{const u=`${t}_${r}`,x=Object.entries(s).filter(([f,b])=>b).map(([f])=>{const b=parseInt(f.replace("text",""))-1;return l[b]});if(x.length===0)return;i(f=>{const b=[...f[u]||[]];return{...f,[u]:[...b,...x]}}),se.trackEvent({event_type:"prompt_apply",message_type:"parameter_debug",message_id:o,data:{input_text:a,generated_texts:l,selected_texts:x}});const g=[...n[u]||[],...x];d(t,r,g),m(!1)},es=(t,r,s,l,a,o,n,i,d,m)=>{s(!0),l(t),a(r),o(""),n([]),i({}),d(!1),m(null)},ts=(t,r,s,l,a,o,n,i,d,m,u,x,g,f,b,L,k,M,P,y,N,p,S,O,G,j,E,R,v,T=!1)=>{t(0),r({Steps:!0,CFG:!0,sampler_name:!0,threshold:!1,prompt:!1}),s(ie()),l(),a(!1),o(!1),n(0),i(12),d(null),m(Array(12).fill(null).map((I,_)=>({url:`https://source.unsplash.com/random/300x300?sig=${Math.random()}`,params:{step:_%3===0?5:_%3===1?10:15,sampler_name:"euler",cfg:1}}))),u({}),x({}),g({}),f({}),b(1),L(null),k(!1),M(!1),P(""),y(null),N({}),p(!1),S(""),O([]),G(!1),j(""),E(""),R(null),v({}),T&&Pt()},ss=(t,r,s)=>{s&&(s.preventDefault(),s.stopPropagation()),r(t)},rs=async(t,r,s,l,a,o,n)=>{if(n&&(n.preventDefault(),n.stopPropagation()),t!==null){console.log(`Applied image ${t+1} with parameters:`,r[t].params);let i=1;if(a){for(const m in a)if(a[m])for(const u in a[m]){const x=a[m][u];if(x){let g=1;Array.isArray(x)?g=x.length>0?x.length:1:typeof x=="object"&&x!==null&&(g=Object.keys(x).length>0?Object.keys(x).length:1),i=i*g}}}se.trackEvent({event_type:"parameter_debug_apply",message_type:"parameter_debug",message_id:l,data:{workflow:(await s.graphToPrompt()).output,selected_params:r[t].params,all_params:a,count:i}});const d=r[t].params;d.nodeParams&&(Object.entries(d.nodeParams).forEach(([m,u])=>{const x=s.graph._nodes_by_id[m];!x||!x.widgets||Object.entries(u).forEach(([g,f])=>{for(const b of x.widgets)if(b.name===g){b.value=f;break}})}),s.graph.setDirtyCanvas(!1,!0),o(!0),setTimeout(()=>{o(!1)},3e3))}},ns=(t,r,s,l,a,o,n)=>{if(n&&(n.preventDefault(),n.stopPropagation()),t===1&&s!==void 0){const i=[...r];i[s],i.splice(s,1),i.length===0?a&&(l({type:"SET_SCREEN_STATE",payload:null}),o(!0),a()):l({type:"SET_SELECTED_NODE",payload:i});return}a&&(l({type:"SET_SCREEN_STATE",payload:null}),o(!0),a())},os=({selectedNodes:t,visible:r,onClose:s})=>{const[l,a]=w.useState(0),[o,n]=w.useState({Steps:!0,CFG:!0,sampler_name:!0,threshold:!1,prompt:!1}),[i,d]=w.useState(ie()),[m,u]=w.useState(!1),[x,g]=w.useState(!1),[f,b]=w.useState(0),[L,k]=w.useState(12),[M,P]=w.useState(null),[y,N]=w.useState(()=>Array(12).fill(null).map((c,h)=>({url:`https://source.unsplash.com/random/300x300?sig=${Math.random()}`,params:{step:h%3===0?5:h%3===1?10:15,sampler_name:"euler",cfg:1}}))),[p,S]=w.useState({}),[O,G]=w.useState({}),[j,E]=w.useState({}),[R,v]=w.useState({}),[T,I]=w.useState(1),_=6,[B,z]=w.useState(null),[C,F]=w.useState(!1),[$,D]=w.useState(!1),[A,H]=w.useState(""),[U,J]=w.useState(null),[q,Y]=w.useState({}),[Ue,ne]=w.useState(!1),[ce,de]=w.useState(""),[we,xe]=w.useState([]),[Ge,me]=w.useState(!1),[Je,ke]=w.useState(""),[Ke,Se]=w.useState(""),[qe,ue]=w.useState(null),[Ce,oe]=w.useState({}),[he,ge]=w.useState(!1),[Ve,Ye]=w.useState([]),[Le,pe]=w.useState(null),{dispatch:fe}=ve(),Me=w.useRef(null),$e=w.useRef(null),[Xe,ae]=w.useState(()=>r);w.useEffect(()=>{if(he){const c=Re();Ye(c)}},[he]);const Qe=async()=>{Xt(ce,i,me,ue,xe,oe)},Ze=(c,h,W,K)=>{const Z=Et(c,h,W,K,q,Y);X(c,h,Z)},et=(c,h)=>{const W=_t(c,h,q,Y);X(c,h,W)},tt=(c,h,W)=>{const K=It(c,h,W,q,Y);X(c,h,K)},st=c=>{Qt(c,oe)},rt=()=>{Zt(Je,Ke,Ce,we,ce,i,q,Y,X,ne)},nt=(c,h)=>{es(c,h,ne,ke,Se,de,xe,oe,me,ue)},Pe=c=>{c&&(c.preventDefault(),c.stopPropagation()),ge(h=>!h)},ot=c=>{pe(c),ge(!1),N(c.generatedImages||[]),P(null),I(1)},at=c=>{c&&(c.preventDefault(),c.stopPropagation()),pe(null)};w.useEffect(()=>{if(!t||t.length===0)return;const c={...p},h=t.map(K=>K.id.toString());Object.keys(c).forEach(K=>{h.includes(K)||delete c[K]}),t.forEach(K=>{const Z=K.id.toString();c[Z]||(c[Z]={})}),JSON.stringify(c)!==JSON.stringify(p)&&S(c)},[t,p]),w.useEffect(()=>{fe({type:"SET_SCREEN_STATE",payload:{currentScreen:l,isProcessing:m,isCompleted:x}})},[l,m,x,fe]),w.useEffect(()=>{const c=document.createElement("style");return c.textContent=Mt,document.head.appendChild(c),()=>{document.head.removeChild(c)}},[]),w.useEffect(()=>{const c=h=>{if(Object.values(O).some(W=>W)){const W=h.target,K=!!W.closest(".dropdown-menu"),Z=!!W.closest("[data-dropdown]");!K&&!Z&&G({})}};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[O]),w.useEffect(()=>{r&&(JSON.parse(localStorage.getItem(re)||"{}").task_id||d(ie()))},[r]),w.useEffect(()=>{if(r){ae(!0);try{const c=localStorage.getItem(re);if(c){const h=JSON.parse(c);if(!t||t.length===0){console.log("Not restoring parameter debug state: no nodes selected"),ae(!1);return}h.currentScreen!==void 0&&a(h.currentScreen),h.selectedParams&&n(h.selectedParams),h.task_id&&d(h.task_id);const W=h.generatedImages&&h.generatedImages.length>0;h.isProcessing!==void 0&&!h.isProcessing&&u(!1),h.isCompleted!==void 0&&W&&g(h.isCompleted),h.completedCount!==void 0&&b(h.completedCount),h.totalCount!==void 0&&k(h.totalCount),h.selectedImageIndex!==void 0&&P(h.selectedImageIndex),h.generatedImages&&N(h.generatedImages),h.paramTestValues&&S(h.paramTestValues),h.searchTerms&&E(h.searchTerms),h.inputValues&&v(h.inputValues),h.currentPage!==void 0&&I(h.currentPage),h.textInputs&&Y(h.textInputs)}}catch(c){console.error("Error loading parameter debug state:",c)}finally{setTimeout(()=>{ae(!1)},50)}}else ae(!0);return()=>{if(!r)return;We({currentScreen:l,selectedParams:o,task_id:i,isProcessing:m,isCompleted:x,completedCount:f,totalCount:L,selectedImageIndex:M,generatedImages:y,paramTestValues:p,searchTerms:j,inputValues:R,currentPage:T,textInputs:q})}},[r]);const lt=(c=!1)=>{ts(a,n,d,ye,u,g,b,k,P,N,S,G,E,v,I,z,F,D,H,J,Y,ne,de,xe,me,ke,Se,ue,oe,c),ge(!1),pe(null)};w.useEffect(()=>{if(!r)return;const c=setTimeout(()=>{We({currentScreen:l,selectedParams:o,task_id:i,isProcessing:m,isCompleted:x,completedCount:f,totalCount:L,selectedImageIndex:M,generatedImages:y,paramTestValues:p,searchTerms:j,inputValues:R,currentPage:T,textInputs:q})},500);return()=>clearTimeout(c)},[r,l,o,i,m,x,f,L,M,y,p,j,R,T,q]);const Ee=c=>{Ft(l,a,o,p,S,q,t,k,z,je,c)},be=c=>{Ht(l,a,t,p,S,q,x,g,z,c)},it=(c,h)=>{Bt(c,o,n,p,S,h)},ct=(c,h,W)=>{Ot(c,h,W,O,G)},X=(c,h,W)=>{Dt(c,h,W,p,S)},dt=(c,h,W,K)=>{At(c,h,W,p,S,K)},xt=(c,h,W)=>{Wt(c,h,W,j,E)},mt=(c,h,W)=>{Tt(c,h,W,p,X)},_e=(c,h)=>{Ut(c,_,y,I,h)},ye=()=>{He(Me,$e)};w.useEffect(()=>()=>{ye()},[]);const ut=async(c,h)=>{Yt(p,i,u,b,z,N,g,I,$e,Me,je,V,c,h)},Ie=(c,h)=>{ss(c,P,h)},Oe=(c,h,W)=>{Rt(c,h,t,H,J,D,W)},ee=c=>{zt(D,c)},ht=async c=>{rs(M,y,V,i,p,F,c)},Q=(c,h)=>{ns(l,t,h,fe,s,lt,c)},le=()=>e.jsx(e.Fragment,{children:e.jsx(te,{visible:$,imageUrl:A,params:U||{},onClose:ee})});return Le?e.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4",onClick:c=>c.stopPropagation(),children:e.jsx(Lt,{historyItem:Le,selectedImageIndex:M,handleSelectImage:Ie,handleClose:at,currentPage:T,handlePageChange:_e,imagesPerPage:_,modalVisible:$,modalImageUrl:A,modalImageParams:U,openImageModal:Oe,closeImageModal:ee})}):he?e.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:e.jsx(Ct,{historyItems:Ve,onViewHistoryItem:ot,onClose:Pe})}):Xe&&r&&t.length>0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 bg-gray-50 overflow-y-auto",onClick:c=>c.stopPropagation(),children:[e.jsxs("div",{className:"p-8 rounded-lg shadow-sm relative flex flex-col items-center",children:[e.jsx("div",{className:"w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin"}),e.jsx("div",{className:"mt-4 text-gray-600 text-sm",children:"Loading interface..."})]}),e.jsx(te,{visible:$,imageUrl:A,params:U||{},onClose:ee})]}):!r||t.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 bg-gray-50 overflow-y-auto",onClick:c=>c.stopPropagation(),children:[e.jsxs("div",{className:"max-w-lg p-8 rounded-lg shadow-sm border border-blue-100 relative",children:[e.jsxs("div",{className:"absolute top-3 right-3 flex",children:[e.jsx("button",{className:"text-blue-500 hover:text-blue-700 mr-2",onClick:Pe,title:"Show History",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})})}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:Q,children:e.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"mb-6 text-center",children:[e.jsx("h3",{className:"text-base font-bold text-blue-600 mb-2",children:"GenLab"}),e.jsx("div",{className:"h-1 w-16 bg-blue-500 mx-auto rounded-full mb-4"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-left mb-4",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-800 mb-3",children:"Batch-test parameters & find the best combo in one click."}),e.jsx("div",{className:"h-px w-full bg-gray-200 my-4"})]}),e.jsxs("div",{className:"text-left",children:[e.jsx("h4",{className:"text-base font-medium text-gray-800 mb-4",children:"How to use"}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("p",{className:"text-sm text-gray-700",children:[e.jsx("span",{className:"font-bold",children:"1 - "}),"Click any node(hold Shift to select multiple nodes)"]}),e.jsxs("p",{className:"text-sm text-gray-700",children:[e.jsx("span",{className:"font-bold",children:"2 - "}),"Set parameter ranges and start batch generation."]})]}),e.jsx("div",{className:"h-px w-full bg-gray-200 my-4"}),e.jsx("p",{className:"text-sm text-blue-600 mt-6",children:"Let's select a node to begin!"})]})]})]}),e.jsx(te,{visible:$,imageUrl:A,params:U||{},onClose:ee})]}):x?e.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4",onClick:c=>c.stopPropagation(),children:e.jsx(wt,{generatedImages:y,selectedImageIndex:M,handleSelectImage:Ie,handleApplySelected:ht,handlePrevious:be,handleClose:Q,currentPage:T,handlePageChange:_e,imagesPerPage:_,notificationVisible:C,modalVisible:$,modalImageUrl:A,modalImageParams:U,openImageModal:Oe,closeImageModal:ee})}):m?e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4",onClick:c=>c.stopPropagation(),children:[e.jsx(Nt,{selectedNodes:t,paramTestValues:p,selectedParams:o,totalCount:L,completedCount:f,errorMessage:B,handleClose:Q,setIsProcessing:u,setCurrentScreen:a,cleanupPolling:ye}),e.jsx(le,{})]}):l===0?e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:[e.jsx(yt,{selectedNodes:t,handleParamSelect:it,selectedParams:o,handleNext:Ee,handleClose:Q}),e.jsx(le,{})]}):l===1?e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:[e.jsx(jt,{selectedNodes:t,paramTestValues:p,selectedParams:o,updateParamTestValues:X,toggleDropdown:ct,openDropdowns:O,handleTestValueSelect:dt,searchTerms:j,handleSearch:xt,handleSelectAll:mt,handleNext:Ee,handlePrevious:be,handleClose:Q,inputValues:R,setInputValues:v,textInputs:q,handleTextInputChange:Ze,handleAddTextInput:et,handleRemoveTextInput:tt,openAiWritingModal:nt}),e.jsx(kt,{visible:Ue,aiWritingModalText:ce,setAiWritingModalText:de,aiGeneratedTexts:we,aiSelectedTexts:Ce,aiWritingLoading:Ge,aiWritingError:qe,handleAiWriting:Qe,toggleTextSelection:st,addSelectedTexts:rt,onClose:()=>ne(!1)}),e.jsx(le,{})]}):e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:[e.jsx(vt,{selectedNodes:t,paramTestValues:p,selectedParams:o,totalCount:L,errorMessage:B,handlePrevious:be,handleStartGeneration:ut,handleClose:Q}),e.jsx(le,{})]})},ms=t=>{const{dispatch:r}=ve(),[s,l]=w.useState(!1);return w.useEffect(()=>{if(t.visible&&!s){const a=$t();a&&a.screenState&&r({type:"SET_SCREEN_STATE",payload:{currentScreen:a.currentScreen,isProcessing:a.isProcessing,isCompleted:a.isCompleted}}),l(!0)}},[t.visible,s,r]),w.useEffect(()=>()=>{t.visible||r({type:"SET_SCREEN_STATE",payload:null})},[t.visible,r]),e.jsx(os,{...t})};export{ms as ParameterDebugInterface}; diff --git a/dist/copilot_web/assets/input-BFxtFr8c.css b/dist/copilot_web/assets/input-BFxtFr8c.css new file mode 100644 index 0000000..0281d7c --- /dev/null +++ b/dist/copilot_web/assets/input-BFxtFr8c.css @@ -0,0 +1 @@ +#comfyui-copilot-plugin *,#comfyui-copilot-plugin :before,#comfyui-copilot-plugin :after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }#comfyui-copilot-plugin ::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }#comfyui-copilot-plugin .container{width:100%}@media (min-width: 640px){#comfyui-copilot-plugin .container{max-width:640px}}@media (min-width: 768px){#comfyui-copilot-plugin .container{max-width:768px}}@media (min-width: 1024px){#comfyui-copilot-plugin .container{max-width:1024px}}@media (min-width: 1280px){#comfyui-copilot-plugin .container{max-width:1280px}}@media (min-width: 1536px){#comfyui-copilot-plugin .container{max-width:1536px}}#comfyui-copilot-plugin .prose,#comfyui-copilot-plugin .prose-neutral{--tw-prose-links: inherit;--tw-prose-headings: inherit}#comfyui-copilot-plugin .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}#comfyui-copilot-plugin .\!visible{visibility:visible!important}#comfyui-copilot-plugin .visible{visibility:visible}#comfyui-copilot-plugin .invisible{visibility:hidden}#comfyui-copilot-plugin .collapse{visibility:collapse}#comfyui-copilot-plugin .static{position:static}#comfyui-copilot-plugin .fixed{position:fixed}#comfyui-copilot-plugin .absolute{position:absolute}#comfyui-copilot-plugin .relative{position:relative}#comfyui-copilot-plugin .sticky{position:sticky}#comfyui-copilot-plugin .inset-0{inset:0}#comfyui-copilot-plugin .inset-y-0{top:0;bottom:0}#comfyui-copilot-plugin .-bottom-1{bottom:-.25rem}#comfyui-copilot-plugin .-right-1{right:-.25rem}#comfyui-copilot-plugin .-top-1{top:-.25rem}#comfyui-copilot-plugin .-top-10{top:-2.5rem}#comfyui-copilot-plugin .-top-6{top:-1.5rem}#comfyui-copilot-plugin .bottom-0{bottom:0}#comfyui-copilot-plugin .bottom-1{bottom:.25rem}#comfyui-copilot-plugin .bottom-2{bottom:.5rem}#comfyui-copilot-plugin .bottom-3{bottom:.75rem}#comfyui-copilot-plugin .bottom-full{bottom:100%}#comfyui-copilot-plugin .left-0{left:0}#comfyui-copilot-plugin .left-1\/2{left:50%}#comfyui-copilot-plugin .left-3{left:.75rem}#comfyui-copilot-plugin .right-0{right:0}#comfyui-copilot-plugin .right-1\.5{right:.375rem}#comfyui-copilot-plugin .right-12{right:3rem}#comfyui-copilot-plugin .right-2{right:.5rem}#comfyui-copilot-plugin .right-3{right:.75rem}#comfyui-copilot-plugin .right-4{right:1rem}#comfyui-copilot-plugin .top-0{top:0}#comfyui-copilot-plugin .top-1\/2{top:50%}#comfyui-copilot-plugin .top-2{top:.5rem}#comfyui-copilot-plugin .top-3{top:.75rem}#comfyui-copilot-plugin .top-4{top:1rem}#comfyui-copilot-plugin .z-10{z-index:10}#comfyui-copilot-plugin .z-50{z-index:50}#comfyui-copilot-plugin .z-\[9999\]{z-index:9999}#comfyui-copilot-plugin .m-4{margin:1rem}#comfyui-copilot-plugin .\!my-0\.5{margin-top:.125rem!important;margin-bottom:.125rem!important}#comfyui-copilot-plugin .\!my-1{margin-top:.25rem!important;margin-bottom:.25rem!important}#comfyui-copilot-plugin .mx-auto{margin-left:auto;margin-right:auto}#comfyui-copilot-plugin .my-4{margin-top:1rem;margin-bottom:1rem}#comfyui-copilot-plugin .-ml-1{margin-left:-.25rem}#comfyui-copilot-plugin .mb-1{margin-bottom:.25rem}#comfyui-copilot-plugin .mb-2{margin-bottom:.5rem}#comfyui-copilot-plugin .mb-3{margin-bottom:.75rem}#comfyui-copilot-plugin .mb-4{margin-bottom:1rem}#comfyui-copilot-plugin .mb-6{margin-bottom:1.5rem}#comfyui-copilot-plugin .ml-1{margin-left:.25rem}#comfyui-copilot-plugin .ml-2{margin-left:.5rem}#comfyui-copilot-plugin .ml-3{margin-left:.75rem}#comfyui-copilot-plugin .mr-1{margin-right:.25rem}#comfyui-copilot-plugin .mr-2{margin-right:.5rem}#comfyui-copilot-plugin .mr-3{margin-right:.75rem}#comfyui-copilot-plugin .mt-0{margin-top:0}#comfyui-copilot-plugin .mt-0\.5{margin-top:.125rem}#comfyui-copilot-plugin .mt-1{margin-top:.25rem}#comfyui-copilot-plugin .mt-12{margin-top:3rem}#comfyui-copilot-plugin .mt-2{margin-top:.5rem}#comfyui-copilot-plugin .mt-4{margin-top:1rem}#comfyui-copilot-plugin .mt-6{margin-top:1.5rem}#comfyui-copilot-plugin .line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}#comfyui-copilot-plugin .block{display:block}#comfyui-copilot-plugin .inline{display:inline}#comfyui-copilot-plugin .flex{display:flex}#comfyui-copilot-plugin .inline-flex{display:inline-flex}#comfyui-copilot-plugin .table{display:table}#comfyui-copilot-plugin .grid{display:grid}#comfyui-copilot-plugin .contents{display:contents}#comfyui-copilot-plugin .hidden{display:none}#comfyui-copilot-plugin .aspect-square{aspect-ratio:1 / 1}#comfyui-copilot-plugin .h-0{height:0px}#comfyui-copilot-plugin .h-1{height:.25rem}#comfyui-copilot-plugin .h-10{height:2.5rem}#comfyui-copilot-plugin .h-14{height:3.5rem}#comfyui-copilot-plugin .h-2{height:.5rem}#comfyui-copilot-plugin .h-20{height:5rem}#comfyui-copilot-plugin .h-3{height:.75rem}#comfyui-copilot-plugin .h-3\.5{height:.875rem}#comfyui-copilot-plugin .h-4{height:1rem}#comfyui-copilot-plugin .h-5{height:1.25rem}#comfyui-copilot-plugin .h-6{height:1.5rem}#comfyui-copilot-plugin .h-7{height:1.75rem}#comfyui-copilot-plugin .h-8{height:2rem}#comfyui-copilot-plugin .h-\[4\.5rem\]{height:4.5rem}#comfyui-copilot-plugin .h-auto{height:auto}#comfyui-copilot-plugin .h-full{height:100%}#comfyui-copilot-plugin .h-px{height:1px}#comfyui-copilot-plugin .max-h-16{max-height:4rem}#comfyui-copilot-plugin .max-h-60{max-height:15rem}#comfyui-copilot-plugin .max-h-\[400px\]{max-height:400px}#comfyui-copilot-plugin .max-h-\[40vh\]{max-height:40vh}#comfyui-copilot-plugin .max-h-\[80vh\]{max-height:80vh}#comfyui-copilot-plugin .max-h-\[90vh\]{max-height:90vh}#comfyui-copilot-plugin .max-h-\[calc\(90vh-2rem\)\]{max-height:calc(90vh - 2rem)}#comfyui-copilot-plugin .max-h-full{max-height:100%}#comfyui-copilot-plugin .min-h-\[80px\]{min-height:80px}#comfyui-copilot-plugin .w-1{width:.25rem}#comfyui-copilot-plugin .w-1\/2{width:50%}#comfyui-copilot-plugin .w-12{width:3rem}#comfyui-copilot-plugin .w-14{width:3.5rem}#comfyui-copilot-plugin .w-16{width:4rem}#comfyui-copilot-plugin .w-2{width:.5rem}#comfyui-copilot-plugin .w-3{width:.75rem}#comfyui-copilot-plugin .w-3\.5{width:.875rem}#comfyui-copilot-plugin .w-4{width:1rem}#comfyui-copilot-plugin .w-48{width:12rem}#comfyui-copilot-plugin .w-5{width:1.25rem}#comfyui-copilot-plugin .w-64{width:16rem}#comfyui-copilot-plugin .w-7{width:1.75rem}#comfyui-copilot-plugin .w-8{width:2rem}#comfyui-copilot-plugin .w-96{width:24rem}#comfyui-copilot-plugin .w-\[100\%\]{width:100%}#comfyui-copilot-plugin .w-\[35\%\]{width:35%}#comfyui-copilot-plugin .w-\[480px\]{width:480px}#comfyui-copilot-plugin .w-\[500px\]{width:500px}#comfyui-copilot-plugin .w-\[65\%\]{width:65%}#comfyui-copilot-plugin .w-\[90\%\]{width:90%}#comfyui-copilot-plugin .w-\[calc\(50\%-0\.25rem\)\]{width:calc(50% - .25rem)}#comfyui-copilot-plugin .w-full{width:100%}#comfyui-copilot-plugin .min-w-\[400px\]{min-width:400px}#comfyui-copilot-plugin .max-w-2xl{max-width:42rem}#comfyui-copilot-plugin .max-w-6xl{max-width:72rem}#comfyui-copilot-plugin .max-w-full{max-width:100%}#comfyui-copilot-plugin .max-w-lg{max-width:32rem}#comfyui-copilot-plugin .flex-1{flex:1 1 0%}#comfyui-copilot-plugin .flex-shrink-0{flex-shrink:0}#comfyui-copilot-plugin .-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#comfyui-copilot-plugin .-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#comfyui-copilot-plugin .-translate-y-full{--tw-translate-y: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#comfyui-copilot-plugin .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#comfyui-copilot-plugin{@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}}#comfyui-copilot-plugin .animate-bounce{animation:bounce 1s infinite}#comfyui-copilot-plugin{@keyframes spin{to{transform:rotate(360deg)}}}#comfyui-copilot-plugin .animate-spin{animation:spin 1s linear infinite}#comfyui-copilot-plugin .cursor-ew-resize{cursor:ew-resize}#comfyui-copilot-plugin .cursor-help{cursor:help}#comfyui-copilot-plugin .cursor-not-allowed{cursor:not-allowed}#comfyui-copilot-plugin .cursor-pointer{cursor:pointer}#comfyui-copilot-plugin .resize-none{resize:none}#comfyui-copilot-plugin .resize-y{resize:vertical}#comfyui-copilot-plugin .resize{resize:both}#comfyui-copilot-plugin .appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}#comfyui-copilot-plugin .grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}#comfyui-copilot-plugin .grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}#comfyui-copilot-plugin .flex-row{flex-direction:row}#comfyui-copilot-plugin .flex-col{flex-direction:column}#comfyui-copilot-plugin .flex-wrap{flex-wrap:wrap}#comfyui-copilot-plugin .items-start{align-items:flex-start}#comfyui-copilot-plugin .items-center{align-items:center}#comfyui-copilot-plugin .justify-end{justify-content:flex-end}#comfyui-copilot-plugin .justify-center{justify-content:center}#comfyui-copilot-plugin .justify-between{justify-content:space-between}#comfyui-copilot-plugin .gap-1{gap:.25rem}#comfyui-copilot-plugin .gap-2{gap:.5rem}#comfyui-copilot-plugin .gap-3{gap:.75rem}#comfyui-copilot-plugin .gap-4{gap:1rem}#comfyui-copilot-plugin .space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}#comfyui-copilot-plugin .space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}#comfyui-copilot-plugin .space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}#comfyui-copilot-plugin .space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}#comfyui-copilot-plugin .space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}#comfyui-copilot-plugin .overflow-hidden{overflow:hidden}#comfyui-copilot-plugin .overflow-visible{overflow:visible}#comfyui-copilot-plugin .overflow-x-auto{overflow-x:auto}#comfyui-copilot-plugin .overflow-y-auto{overflow-y:auto}#comfyui-copilot-plugin .scroll-smooth{scroll-behavior:smooth}#comfyui-copilot-plugin .text-ellipsis{text-overflow:ellipsis}#comfyui-copilot-plugin .whitespace-normal{white-space:normal}#comfyui-copilot-plugin .whitespace-nowrap{white-space:nowrap}#comfyui-copilot-plugin .whitespace-pre-wrap{white-space:pre-wrap}#comfyui-copilot-plugin .break-words{overflow-wrap:break-word}#comfyui-copilot-plugin .break-all{word-break:break-all}#comfyui-copilot-plugin .rounded{border-radius:.25rem}#comfyui-copilot-plugin .rounded-full{border-radius:9999px}#comfyui-copilot-plugin .rounded-lg{border-radius:.5rem}#comfyui-copilot-plugin .rounded-md{border-radius:.375rem}#comfyui-copilot-plugin .rounded-sm{border-radius:.125rem}#comfyui-copilot-plugin .rounded-xl{border-radius:.75rem}#comfyui-copilot-plugin .border{border-width:1px}#comfyui-copilot-plugin .border-0{border-width:0px}#comfyui-copilot-plugin .border-2{border-width:2px}#comfyui-copilot-plugin .border-4{border-width:4px}#comfyui-copilot-plugin .border-b{border-bottom-width:1px}#comfyui-copilot-plugin .border-b-2{border-bottom-width:2px}#comfyui-copilot-plugin .border-l-4{border-left-width:4px}#comfyui-copilot-plugin .border-r{border-right-width:1px}#comfyui-copilot-plugin .border-t{border-top-width:1px}#comfyui-copilot-plugin .border-solid{border-style:solid}#comfyui-copilot-plugin .border-dashed{border-style:dashed}#comfyui-copilot-plugin .border-none{border-style:none}#comfyui-copilot-plugin .border-\[\#979797\]{--tw-border-opacity: 1;border-color:rgb(151 151 151 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-blue-100{--tw-border-opacity: 1;border-color:rgb(219 234 254 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-blue-300{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-blue-600{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-gray-100{border-color:color-mix(in srgb,var(--p-text-color) 10%,transparent)}#comfyui-copilot-plugin .border-gray-200{border-color:color-mix(in srgb,var(--p-text-color) 20%,transparent)}#comfyui-copilot-plugin .border-gray-300{border-color:color-mix(in srgb,var(--p-text-color) 30%,transparent)}#comfyui-copilot-plugin .border-gray-700{border-color:color-mix(in srgb,var(--p-text-color) 70%,transparent)}#comfyui-copilot-plugin .border-gray-900{border-color:color-mix(in srgb,var(--p-text-color) 90%,transparent)}#comfyui-copilot-plugin .border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-pink-500{--tw-border-opacity: 1;border-color:rgb(236 72 153 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-transparent{border-color:transparent}#comfyui-copilot-plugin .border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-t-blue-500{--tw-border-opacity: 1;border-top-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-t-gray-800{border-top-color:color-mix(in srgb,var(--p-text-color) 80%,transparent)}#comfyui-copilot-plugin .border-t-transparent{border-top-color:transparent}#comfyui-copilot-plugin .bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-black\/40{background-color:#0006}#comfyui-copilot-plugin .bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-gray-100{background-color:color-mix(in srgb,var(--p-text-color) 10%,transparent)}#comfyui-copilot-plugin .bg-gray-200{background-color:color-mix(in srgb,var(--p-text-color) 20%,transparent)}#comfyui-copilot-plugin .bg-gray-300{background-color:color-mix(in srgb,var(--p-text-color) 30%,transparent)}#comfyui-copilot-plugin .bg-gray-400{background-color:color-mix(in srgb,var(--p-text-color) 40%,transparent)}#comfyui-copilot-plugin .bg-gray-50{background-color:color-mix(in srgb,var(--p-text-color) 5%,transparent)}#comfyui-copilot-plugin .bg-gray-500{background-color:color-mix(in srgb,var(--p-text-color) 50%,transparent)}#comfyui-copilot-plugin .bg-gray-700{background-color:color-mix(in srgb,var(--p-text-color) 70%,transparent)}#comfyui-copilot-plugin .bg-gray-800{background-color:color-mix(in srgb,var(--p-text-color) 80%,transparent)}#comfyui-copilot-plugin .bg-gray-900{background-color:color-mix(in srgb,var(--p-text-color) 90%,transparent)}#comfyui-copilot-plugin .bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-pink-200{--tw-bg-opacity: 1;background-color:rgb(251 207 232 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-transparent{background-color:transparent}#comfyui-copilot-plugin .bg-white{background-color:var(--p-panel-background)}#comfyui-copilot-plugin .bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-opacity-30{--tw-bg-opacity: .3}#comfyui-copilot-plugin .bg-opacity-50{--tw-bg-opacity: .5}#comfyui-copilot-plugin .bg-opacity-75{--tw-bg-opacity: .75}#comfyui-copilot-plugin .bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}#comfyui-copilot-plugin .from-amber-50{--tw-gradient-from: #fffbeb var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 251 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}#comfyui-copilot-plugin .to-amber-100{--tw-gradient-to: #fef3c7 var(--tw-gradient-to-position)}#comfyui-copilot-plugin .fill-current{fill:currentColor}#comfyui-copilot-plugin .object-contain{-o-object-fit:contain;object-fit:contain}#comfyui-copilot-plugin .object-cover{-o-object-fit:cover;object-fit:cover}#comfyui-copilot-plugin .p-0\.5{padding:.125rem}#comfyui-copilot-plugin .p-1{padding:.25rem}#comfyui-copilot-plugin .p-1\.5{padding:.375rem}#comfyui-copilot-plugin .p-2{padding:.5rem}#comfyui-copilot-plugin .p-3{padding:.75rem}#comfyui-copilot-plugin .p-4{padding:1rem}#comfyui-copilot-plugin .p-6{padding:1.5rem}#comfyui-copilot-plugin .p-8{padding:2rem}#comfyui-copilot-plugin .px-1{padding-left:.25rem;padding-right:.25rem}#comfyui-copilot-plugin .px-1\.5{padding-left:.375rem;padding-right:.375rem}#comfyui-copilot-plugin .px-2{padding-left:.5rem;padding-right:.5rem}#comfyui-copilot-plugin .px-3{padding-left:.75rem;padding-right:.75rem}#comfyui-copilot-plugin .px-4{padding-left:1rem;padding-right:1rem}#comfyui-copilot-plugin .px-5{padding-left:1.25rem;padding-right:1.25rem}#comfyui-copilot-plugin .py-0\.5{padding-top:.125rem;padding-bottom:.125rem}#comfyui-copilot-plugin .py-1{padding-top:.25rem;padding-bottom:.25rem}#comfyui-copilot-plugin .py-1\.5{padding-top:.375rem;padding-bottom:.375rem}#comfyui-copilot-plugin .py-2{padding-top:.5rem;padding-bottom:.5rem}#comfyui-copilot-plugin .py-2\.5{padding-top:.625rem;padding-bottom:.625rem}#comfyui-copilot-plugin .py-3{padding-top:.75rem;padding-bottom:.75rem}#comfyui-copilot-plugin .py-4{padding-top:1rem;padding-bottom:1rem}#comfyui-copilot-plugin .pb-10{padding-bottom:2.5rem}#comfyui-copilot-plugin .pb-2{padding-bottom:.5rem}#comfyui-copilot-plugin .pb-3{padding-bottom:.75rem}#comfyui-copilot-plugin .pl-4{padding-left:1rem}#comfyui-copilot-plugin .pr-12{padding-right:3rem}#comfyui-copilot-plugin .pr-4{padding-right:1rem}#comfyui-copilot-plugin .pr-6{padding-right:1.5rem}#comfyui-copilot-plugin .pt-1{padding-top:.25rem}#comfyui-copilot-plugin .pt-2{padding-top:.5rem}#comfyui-copilot-plugin .pt-6{padding-top:1.5rem}#comfyui-copilot-plugin .text-left{text-align:left}#comfyui-copilot-plugin .text-center{text-align:center}#comfyui-copilot-plugin .\!text-\[11px\]{font-size:11px!important}#comfyui-copilot-plugin .text-\[10px\]{font-size:10px}#comfyui-copilot-plugin .text-\[11px\]{font-size:11px}#comfyui-copilot-plugin .text-\[12px\]{font-size:12px}#comfyui-copilot-plugin .text-\[14px\]{font-size:14px}#comfyui-copilot-plugin .text-base{font-size:1rem;line-height:1.5rem}#comfyui-copilot-plugin .text-lg{font-size:1.125rem;line-height:1.75rem}#comfyui-copilot-plugin .text-sm{font-size:.875rem;line-height:1.25rem}#comfyui-copilot-plugin .text-xl{font-size:1.25rem;line-height:1.75rem}#comfyui-copilot-plugin .text-xs{font-size:.75rem;line-height:1rem}#comfyui-copilot-plugin .font-bold{font-weight:700}#comfyui-copilot-plugin .font-medium{font-weight:500}#comfyui-copilot-plugin .font-semibold{font-weight:600}#comfyui-copilot-plugin .italic{font-style:italic}#comfyui-copilot-plugin .leading-relaxed{line-height:1.625}#comfyui-copilot-plugin .leading-snug{line-height:1.375}#comfyui-copilot-plugin .text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-gray-300{color:color-mix(in srgb,var(--p-text-color) 30%,transparent)}#comfyui-copilot-plugin .text-gray-400{color:color-mix(in srgb,var(--p-text-color) 40%,transparent)}#comfyui-copilot-plugin .text-gray-500{color:color-mix(in srgb,var(--p-text-color) 50%,transparent)}#comfyui-copilot-plugin .text-gray-600{color:color-mix(in srgb,var(--p-text-color) 60%,transparent)}#comfyui-copilot-plugin .text-gray-700{color:color-mix(in srgb,var(--p-text-color) 70%,transparent)}#comfyui-copilot-plugin .text-gray-800{color:color-mix(in srgb,var(--p-text-color) 80%,transparent)}#comfyui-copilot-plugin .text-gray-900{color:color-mix(in srgb,var(--p-text-color) 90%,transparent)}#comfyui-copilot-plugin .text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-green-900{--tw-text-opacity: 1;color:rgb(20 83 45 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-pink-600{--tw-text-opacity: 1;color:rgb(219 39 119 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-pink-700{--tw-text-opacity: 1;color:rgb(190 24 93 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-white{color:var(--p-panel-background)}#comfyui-copilot-plugin .underline{text-decoration-line:underline}#comfyui-copilot-plugin .placeholder-gray-500::-moz-placeholder{color:color-mix(in srgb,var(--p-text-color) 50%,transparent)}#comfyui-copilot-plugin .placeholder-gray-500::placeholder{color:color-mix(in srgb,var(--p-text-color) 50%,transparent)}#comfyui-copilot-plugin .opacity-0{opacity:0}#comfyui-copilot-plugin .opacity-25{opacity:.25}#comfyui-copilot-plugin .opacity-40{opacity:.4}#comfyui-copilot-plugin .opacity-50{opacity:.5}#comfyui-copilot-plugin .opacity-75{opacity:.75}#comfyui-copilot-plugin .shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#comfyui-copilot-plugin .shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#comfyui-copilot-plugin .shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#comfyui-copilot-plugin .shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#comfyui-copilot-plugin .shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#comfyui-copilot-plugin .outline-none{outline:2px solid transparent;outline-offset:2px}#comfyui-copilot-plugin .ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}#comfyui-copilot-plugin .ring-pink-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(249 168 212 / var(--tw-ring-opacity, 1))}#comfyui-copilot-plugin .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}#comfyui-copilot-plugin .backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}#comfyui-copilot-plugin .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#comfyui-copilot-plugin .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#comfyui-copilot-plugin .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#comfyui-copilot-plugin .transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#comfyui-copilot-plugin .duration-200{transition-duration:.2s}#comfyui-copilot-plugin{height:100%;display:flex;flex-direction:column}#comfyui-copilot-plugin h1,#comfyui-copilot-plugin h2,#comfyui-copilot-plugin h3,#comfyui-copilot-plugin h4,#comfyui-copilot-plugin h5,#comfyui-copilot-plugin h6,#comfyui-copilot-plugin p,#comfyui-copilot-plugin ul,#comfyui-copilot-plugin ol,#comfyui-copilot-plugin button,#comfyui-copilot-plugin input,#comfyui-copilot-plugin textarea,#comfyui-copilot-plugin select{margin:0;padding:0;font-size:100%;font-weight:400}#comfyui-copilot-plugin *{box-sizing:border-box;border-width:0;border-style:solid}#comfyui-copilot-plugin img,#comfyui-copilot-plugin svg,#comfyui-copilot-plugin video,#comfyui-copilot-plugin canvas,#comfyui-copilot-plugin audio,#comfyui-copilot-plugin iframe,#comfyui-copilot-plugin embed,#comfyui-copilot-plugin object{display:block;vertical-align:middle}#comfyui-copilot-plugin button{background-color:transparent;background-image:none}.hover\:border-b-2:hover{border-bottom-width:2px}.hover\:border-blue-300:hover{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity, 1))}.hover\:border-blue-500:hover{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.hover\:bg-amber-200\/50:hover{background-color:#fde68a80}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-200:hover{--tw-bg-opacity: 1;background-color:rgb(191 219 254 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-50:hover{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{background-color:color-mix(in srgb,var(--p-text-color) 10%,transparent)}.hover\:bg-gray-200:hover{background-color:color-mix(in srgb,var(--p-text-color) 20%,transparent)}.hover\:bg-gray-300:hover{background-color:color-mix(in srgb,var(--p-text-color) 30%,transparent)}.hover\:bg-gray-50:hover{background-color:color-mix(in srgb,var(--p-text-color) 5%,transparent)}.hover\:bg-green-200:hover{--tw-bg-opacity: 1;background-color:rgb(187 247 208 / var(--tw-bg-opacity, 1))}.hover\:bg-pink-300:hover{--tw-bg-opacity: 1;background-color:rgb(249 168 212 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-200:hover{--tw-bg-opacity: 1;background-color:rgb(233 213 255 / var(--tw-bg-opacity, 1))}.hover\:text-amber-700:hover{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.hover\:text-amber-800:hover{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.hover\:text-blue-500:hover{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\:text-blue-700:hover{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.hover\:text-gray-600:hover{color:color-mix(in srgb,var(--p-text-color) 60%,transparent)}.hover\:text-gray-700:hover{color:color-mix(in srgb,var(--p-text-color) 70%,transparent)}.hover\:text-gray-900:hover{color:color-mix(in srgb,var(--p-text-color) 90%,transparent)}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-sm:hover{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-transparent:focus{border-color:transparent}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-blue-500\/20:focus{--tw-ring-color: rgb(59 130 246 / .2)}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:block{display:block}.group:hover .group-hover\:translate-x-1{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.prose-headings\:font-semibold :is(:where(h1,h2,h3,h4,h5,h6,th):not(:where([class~=not-prose],[class~=not-prose] *))){font-weight:600}.prose-h1\:text-base :is(:where(h1):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:1rem;line-height:1.5rem}.prose-h2\:text-sm :is(:where(h2):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.875rem;line-height:1.25rem}.prose-h3\:text-xs :is(:where(h3):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-h4\:text-xs :is(:where(h4):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-p\:text-xs :is(:where(p):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-a\:font-medium :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))){font-weight:500}.prose-a\:text-amber-700 :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.prose-a\:underline :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))){text-decoration-line:underline}.hover\:prose-a\:text-amber-800 :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))):hover{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.prose-code\:text-xs :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-pre\:text-xs :is(:where(pre):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-ol\:text-xs :is(:where(ol):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-ul\:text-xs :is(:where(ul):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-li\:text-xs :is(:where(li):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}@media (prefers-color-scheme: dark){.dark\:border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.dark\:border-gray-600{border-color:color-mix(in srgb,var(--p-text-color) 60%,transparent)}.dark\:border-gray-700{border-color:color-mix(in srgb,var(--p-text-color) 70%,transparent)}.dark\:border-red-800\/20{border-color:#991b1b33}.dark\:bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-600{background-color:color-mix(in srgb,var(--p-text-color) 60%,transparent)}.dark\:bg-gray-700{background-color:color-mix(in srgb,var(--p-text-color) 70%,transparent)}.dark\:bg-gray-800{background-color:color-mix(in srgb,var(--p-text-color) 80%,transparent)}.dark\:bg-green-900\/20{background-color:#14532d33}.dark\:bg-red-900\/20{background-color:#7f1d1d33}.dark\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-gray-200{color:color-mix(in srgb,var(--p-text-color) 20%,transparent)}.dark\:text-gray-300{color:color-mix(in srgb,var(--p-text-color) 30%,transparent)}.dark\:text-gray-400{color:color-mix(in srgb,var(--p-text-color) 40%,transparent)}.dark\:text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-pink-400{--tw-text-opacity: 1;color:rgb(244 114 182 / var(--tw-text-opacity, 1))}.dark\:text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-white{color:var(--p-panel-background)}.dark\:placeholder-gray-400::-moz-placeholder{color:color-mix(in srgb,var(--p-text-color) 40%,transparent)}.dark\:placeholder-gray-400::placeholder{color:color-mix(in srgb,var(--p-text-color) 40%,transparent)}.dark\:hover\:bg-blue-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-700:hover{background-color:color-mix(in srgb,var(--p-text-color) 70%,transparent)}.dark\:hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:hover\:text-gray-200:hover{color:color-mix(in srgb,var(--p-text-color) 20%,transparent)}.dark\:focus\:border-blue-400:focus{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.dark\:focus\:ring-blue-400\/20:focus{--tw-ring-color: rgb(96 165 250 / .2)}}.\[\&\>\*\]\:\!my-1>*{margin-top:.25rem!important;margin-bottom:.25rem!important} diff --git a/dist/copilot_web/assets/input-CfrhPaqY.css b/dist/copilot_web/assets/input-CfrhPaqY.css deleted file mode 100644 index 2b875e8..0000000 --- a/dist/copilot_web/assets/input-CfrhPaqY.css +++ /dev/null @@ -1 +0,0 @@ -#comfyui-copilot-plugin *,#comfyui-copilot-plugin :before,#comfyui-copilot-plugin :after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }#comfyui-copilot-plugin ::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }#comfyui-copilot-plugin .container{width:100%}@media (min-width: 640px){#comfyui-copilot-plugin .container{max-width:640px}}@media (min-width: 768px){#comfyui-copilot-plugin .container{max-width:768px}}@media (min-width: 1024px){#comfyui-copilot-plugin .container{max-width:1024px}}@media (min-width: 1280px){#comfyui-copilot-plugin .container{max-width:1280px}}@media (min-width: 1536px){#comfyui-copilot-plugin .container{max-width:1536px}}#comfyui-copilot-plugin .prose,#comfyui-copilot-plugin .prose-neutral{--tw-prose-links: inherit;--tw-prose-headings: inherit}#comfyui-copilot-plugin .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}#comfyui-copilot-plugin .\!visible{visibility:visible!important}#comfyui-copilot-plugin .visible{visibility:visible}#comfyui-copilot-plugin .invisible{visibility:hidden}#comfyui-copilot-plugin .collapse{visibility:collapse}#comfyui-copilot-plugin .static{position:static}#comfyui-copilot-plugin .fixed{position:fixed}#comfyui-copilot-plugin .absolute{position:absolute}#comfyui-copilot-plugin .relative{position:relative}#comfyui-copilot-plugin .sticky{position:sticky}#comfyui-copilot-plugin .inset-0{inset:0}#comfyui-copilot-plugin .inset-y-0{top:0;bottom:0}#comfyui-copilot-plugin .-bottom-1{bottom:-.25rem}#comfyui-copilot-plugin .-right-1{right:-.25rem}#comfyui-copilot-plugin .-top-1{top:-.25rem}#comfyui-copilot-plugin .-top-10{top:-2.5rem}#comfyui-copilot-plugin .-top-6{top:-1.5rem}#comfyui-copilot-plugin .bottom-0{bottom:0}#comfyui-copilot-plugin .bottom-1{bottom:.25rem}#comfyui-copilot-plugin .bottom-2{bottom:.5rem}#comfyui-copilot-plugin .bottom-3{bottom:.75rem}#comfyui-copilot-plugin .bottom-full{bottom:100%}#comfyui-copilot-plugin .left-0{left:0}#comfyui-copilot-plugin .left-1\/2{left:50%}#comfyui-copilot-plugin .left-3{left:.75rem}#comfyui-copilot-plugin .right-0{right:0}#comfyui-copilot-plugin .right-1\.5{right:.375rem}#comfyui-copilot-plugin .right-12{right:3rem}#comfyui-copilot-plugin .right-2{right:.5rem}#comfyui-copilot-plugin .right-3{right:.75rem}#comfyui-copilot-plugin .right-4{right:1rem}#comfyui-copilot-plugin .top-0{top:0}#comfyui-copilot-plugin .top-1\/2{top:50%}#comfyui-copilot-plugin .top-2{top:.5rem}#comfyui-copilot-plugin .top-3{top:.75rem}#comfyui-copilot-plugin .top-4{top:1rem}#comfyui-copilot-plugin .z-10{z-index:10}#comfyui-copilot-plugin .z-50{z-index:50}#comfyui-copilot-plugin .z-\[9999\]{z-index:9999}#comfyui-copilot-plugin .m-4{margin:1rem}#comfyui-copilot-plugin .\!my-0\.5{margin-top:.125rem!important;margin-bottom:.125rem!important}#comfyui-copilot-plugin .\!my-1{margin-top:.25rem!important;margin-bottom:.25rem!important}#comfyui-copilot-plugin .mx-auto{margin-left:auto;margin-right:auto}#comfyui-copilot-plugin .my-4{margin-top:1rem;margin-bottom:1rem}#comfyui-copilot-plugin .-ml-1{margin-left:-.25rem}#comfyui-copilot-plugin .mb-1{margin-bottom:.25rem}#comfyui-copilot-plugin .mb-2{margin-bottom:.5rem}#comfyui-copilot-plugin .mb-3{margin-bottom:.75rem}#comfyui-copilot-plugin .mb-4{margin-bottom:1rem}#comfyui-copilot-plugin .mb-6{margin-bottom:1.5rem}#comfyui-copilot-plugin .ml-1{margin-left:.25rem}#comfyui-copilot-plugin .ml-2{margin-left:.5rem}#comfyui-copilot-plugin .ml-3{margin-left:.75rem}#comfyui-copilot-plugin .mr-1{margin-right:.25rem}#comfyui-copilot-plugin .mr-2{margin-right:.5rem}#comfyui-copilot-plugin .mr-3{margin-right:.75rem}#comfyui-copilot-plugin .mt-0{margin-top:0}#comfyui-copilot-plugin .mt-0\.5{margin-top:.125rem}#comfyui-copilot-plugin .mt-1{margin-top:.25rem}#comfyui-copilot-plugin .mt-12{margin-top:3rem}#comfyui-copilot-plugin .mt-2{margin-top:.5rem}#comfyui-copilot-plugin .mt-4{margin-top:1rem}#comfyui-copilot-plugin .mt-6{margin-top:1.5rem}#comfyui-copilot-plugin .line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}#comfyui-copilot-plugin .block{display:block}#comfyui-copilot-plugin .inline{display:inline}#comfyui-copilot-plugin .flex{display:flex}#comfyui-copilot-plugin .inline-flex{display:inline-flex}#comfyui-copilot-plugin .table{display:table}#comfyui-copilot-plugin .grid{display:grid}#comfyui-copilot-plugin .contents{display:contents}#comfyui-copilot-plugin .hidden{display:none}#comfyui-copilot-plugin .aspect-square{aspect-ratio:1 / 1}#comfyui-copilot-plugin .h-0{height:0px}#comfyui-copilot-plugin .h-1{height:.25rem}#comfyui-copilot-plugin .h-10{height:2.5rem}#comfyui-copilot-plugin .h-14{height:3.5rem}#comfyui-copilot-plugin .h-2{height:.5rem}#comfyui-copilot-plugin .h-20{height:5rem}#comfyui-copilot-plugin .h-3{height:.75rem}#comfyui-copilot-plugin .h-3\.5{height:.875rem}#comfyui-copilot-plugin .h-4{height:1rem}#comfyui-copilot-plugin .h-5{height:1.25rem}#comfyui-copilot-plugin .h-6{height:1.5rem}#comfyui-copilot-plugin .h-7{height:1.75rem}#comfyui-copilot-plugin .h-8{height:2rem}#comfyui-copilot-plugin .h-\[4\.5rem\]{height:4.5rem}#comfyui-copilot-plugin .h-auto{height:auto}#comfyui-copilot-plugin .h-full{height:100%}#comfyui-copilot-plugin .h-px{height:1px}#comfyui-copilot-plugin .max-h-60{max-height:15rem}#comfyui-copilot-plugin .max-h-\[400px\]{max-height:400px}#comfyui-copilot-plugin .max-h-\[40vh\]{max-height:40vh}#comfyui-copilot-plugin .max-h-\[80vh\]{max-height:80vh}#comfyui-copilot-plugin .max-h-\[90vh\]{max-height:90vh}#comfyui-copilot-plugin .max-h-\[calc\(90vh-2rem\)\]{max-height:calc(90vh - 2rem)}#comfyui-copilot-plugin .max-h-full{max-height:100%}#comfyui-copilot-plugin .min-h-\[80px\]{min-height:80px}#comfyui-copilot-plugin .w-1{width:.25rem}#comfyui-copilot-plugin .w-1\/2{width:50%}#comfyui-copilot-plugin .w-12{width:3rem}#comfyui-copilot-plugin .w-14{width:3.5rem}#comfyui-copilot-plugin .w-16{width:4rem}#comfyui-copilot-plugin .w-2{width:.5rem}#comfyui-copilot-plugin .w-3{width:.75rem}#comfyui-copilot-plugin .w-3\.5{width:.875rem}#comfyui-copilot-plugin .w-4{width:1rem}#comfyui-copilot-plugin .w-48{width:12rem}#comfyui-copilot-plugin .w-5{width:1.25rem}#comfyui-copilot-plugin .w-64{width:16rem}#comfyui-copilot-plugin .w-7{width:1.75rem}#comfyui-copilot-plugin .w-8{width:2rem}#comfyui-copilot-plugin .w-96{width:24rem}#comfyui-copilot-plugin .w-\[100\%\]{width:100%}#comfyui-copilot-plugin .w-\[35\%\]{width:35%}#comfyui-copilot-plugin .w-\[480px\]{width:480px}#comfyui-copilot-plugin .w-\[500px\]{width:500px}#comfyui-copilot-plugin .w-\[65\%\]{width:65%}#comfyui-copilot-plugin .w-\[90\%\]{width:90%}#comfyui-copilot-plugin .w-\[calc\(50\%-0\.25rem\)\]{width:calc(50% - .25rem)}#comfyui-copilot-plugin .w-full{width:100%}#comfyui-copilot-plugin .min-w-\[400px\]{min-width:400px}#comfyui-copilot-plugin .max-w-2xl{max-width:42rem}#comfyui-copilot-plugin .max-w-6xl{max-width:72rem}#comfyui-copilot-plugin .max-w-full{max-width:100%}#comfyui-copilot-plugin .max-w-lg{max-width:32rem}#comfyui-copilot-plugin .flex-1{flex:1 1 0%}#comfyui-copilot-plugin .flex-shrink-0{flex-shrink:0}#comfyui-copilot-plugin .-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#comfyui-copilot-plugin .-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#comfyui-copilot-plugin .-translate-y-full{--tw-translate-y: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#comfyui-copilot-plugin .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#comfyui-copilot-plugin{@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}}#comfyui-copilot-plugin .animate-bounce{animation:bounce 1s infinite}#comfyui-copilot-plugin{@keyframes spin{to{transform:rotate(360deg)}}}#comfyui-copilot-plugin .animate-spin{animation:spin 1s linear infinite}#comfyui-copilot-plugin .cursor-ew-resize{cursor:ew-resize}#comfyui-copilot-plugin .cursor-help{cursor:help}#comfyui-copilot-plugin .cursor-not-allowed{cursor:not-allowed}#comfyui-copilot-plugin .cursor-pointer{cursor:pointer}#comfyui-copilot-plugin .resize-none{resize:none}#comfyui-copilot-plugin .resize-y{resize:vertical}#comfyui-copilot-plugin .resize{resize:both}#comfyui-copilot-plugin .appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}#comfyui-copilot-plugin .grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}#comfyui-copilot-plugin .grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}#comfyui-copilot-plugin .flex-row{flex-direction:row}#comfyui-copilot-plugin .flex-col{flex-direction:column}#comfyui-copilot-plugin .flex-wrap{flex-wrap:wrap}#comfyui-copilot-plugin .items-start{align-items:flex-start}#comfyui-copilot-plugin .items-center{align-items:center}#comfyui-copilot-plugin .justify-end{justify-content:flex-end}#comfyui-copilot-plugin .justify-center{justify-content:center}#comfyui-copilot-plugin .justify-between{justify-content:space-between}#comfyui-copilot-plugin .gap-1{gap:.25rem}#comfyui-copilot-plugin .gap-2{gap:.5rem}#comfyui-copilot-plugin .gap-3{gap:.75rem}#comfyui-copilot-plugin .gap-4{gap:1rem}#comfyui-copilot-plugin .space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}#comfyui-copilot-plugin .space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}#comfyui-copilot-plugin .space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}#comfyui-copilot-plugin .space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}#comfyui-copilot-plugin .space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}#comfyui-copilot-plugin .overflow-hidden{overflow:hidden}#comfyui-copilot-plugin .overflow-visible{overflow:visible}#comfyui-copilot-plugin .overflow-x-auto{overflow-x:auto}#comfyui-copilot-plugin .overflow-y-auto{overflow-y:auto}#comfyui-copilot-plugin .scroll-smooth{scroll-behavior:smooth}#comfyui-copilot-plugin .text-ellipsis{text-overflow:ellipsis}#comfyui-copilot-plugin .whitespace-normal{white-space:normal}#comfyui-copilot-plugin .whitespace-nowrap{white-space:nowrap}#comfyui-copilot-plugin .whitespace-pre-wrap{white-space:pre-wrap}#comfyui-copilot-plugin .break-words{overflow-wrap:break-word}#comfyui-copilot-plugin .break-all{word-break:break-all}#comfyui-copilot-plugin .rounded{border-radius:.25rem}#comfyui-copilot-plugin .rounded-full{border-radius:9999px}#comfyui-copilot-plugin .rounded-lg{border-radius:.5rem}#comfyui-copilot-plugin .rounded-md{border-radius:.375rem}#comfyui-copilot-plugin .rounded-sm{border-radius:.125rem}#comfyui-copilot-plugin .rounded-xl{border-radius:.75rem}#comfyui-copilot-plugin .border{border-width:1px}#comfyui-copilot-plugin .border-0{border-width:0px}#comfyui-copilot-plugin .border-2{border-width:2px}#comfyui-copilot-plugin .border-4{border-width:4px}#comfyui-copilot-plugin .border-b{border-bottom-width:1px}#comfyui-copilot-plugin .border-b-2{border-bottom-width:2px}#comfyui-copilot-plugin .border-l-4{border-left-width:4px}#comfyui-copilot-plugin .border-r{border-right-width:1px}#comfyui-copilot-plugin .border-t{border-top-width:1px}#comfyui-copilot-plugin .border-solid{border-style:solid}#comfyui-copilot-plugin .border-dashed{border-style:dashed}#comfyui-copilot-plugin .border-none{border-style:none}#comfyui-copilot-plugin .border-\[\#979797\]{--tw-border-opacity: 1;border-color:rgb(151 151 151 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-blue-100{--tw-border-opacity: 1;border-color:rgb(219 234 254 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-blue-300{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-blue-600{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-gray-100{border-color:color-mix(in srgb,var(--p-text-color) 10%,transparent)}#comfyui-copilot-plugin .border-gray-200{border-color:color-mix(in srgb,var(--p-text-color) 20%,transparent)}#comfyui-copilot-plugin .border-gray-300{border-color:color-mix(in srgb,var(--p-text-color) 30%,transparent)}#comfyui-copilot-plugin .border-gray-700{border-color:color-mix(in srgb,var(--p-text-color) 70%,transparent)}#comfyui-copilot-plugin .border-gray-900{border-color:color-mix(in srgb,var(--p-text-color) 90%,transparent)}#comfyui-copilot-plugin .border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-pink-500{--tw-border-opacity: 1;border-color:rgb(236 72 153 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-transparent{border-color:transparent}#comfyui-copilot-plugin .border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-t-blue-500{--tw-border-opacity: 1;border-top-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}#comfyui-copilot-plugin .border-t-gray-800{border-top-color:color-mix(in srgb,var(--p-text-color) 80%,transparent)}#comfyui-copilot-plugin .border-t-transparent{border-top-color:transparent}#comfyui-copilot-plugin .bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-black\/40{background-color:#0006}#comfyui-copilot-plugin .bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-gray-100{background-color:color-mix(in srgb,var(--p-text-color) 10%,transparent)}#comfyui-copilot-plugin .bg-gray-200{background-color:color-mix(in srgb,var(--p-text-color) 20%,transparent)}#comfyui-copilot-plugin .bg-gray-300{background-color:color-mix(in srgb,var(--p-text-color) 30%,transparent)}#comfyui-copilot-plugin .bg-gray-400{background-color:color-mix(in srgb,var(--p-text-color) 40%,transparent)}#comfyui-copilot-plugin .bg-gray-50{background-color:color-mix(in srgb,var(--p-text-color) 5%,transparent)}#comfyui-copilot-plugin .bg-gray-500{background-color:color-mix(in srgb,var(--p-text-color) 50%,transparent)}#comfyui-copilot-plugin .bg-gray-700{background-color:color-mix(in srgb,var(--p-text-color) 70%,transparent)}#comfyui-copilot-plugin .bg-gray-800{background-color:color-mix(in srgb,var(--p-text-color) 80%,transparent)}#comfyui-copilot-plugin .bg-gray-900{background-color:color-mix(in srgb,var(--p-text-color) 90%,transparent)}#comfyui-copilot-plugin .bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-pink-200{--tw-bg-opacity: 1;background-color:rgb(251 207 232 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-transparent{background-color:transparent}#comfyui-copilot-plugin .bg-white{background-color:var(--p-panel-background)}#comfyui-copilot-plugin .bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}#comfyui-copilot-plugin .bg-opacity-30{--tw-bg-opacity: .3}#comfyui-copilot-plugin .bg-opacity-50{--tw-bg-opacity: .5}#comfyui-copilot-plugin .bg-opacity-75{--tw-bg-opacity: .75}#comfyui-copilot-plugin .bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}#comfyui-copilot-plugin .from-amber-50{--tw-gradient-from: #fffbeb var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 251 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}#comfyui-copilot-plugin .to-amber-100{--tw-gradient-to: #fef3c7 var(--tw-gradient-to-position)}#comfyui-copilot-plugin .fill-current{fill:currentColor}#comfyui-copilot-plugin .object-contain{-o-object-fit:contain;object-fit:contain}#comfyui-copilot-plugin .object-cover{-o-object-fit:cover;object-fit:cover}#comfyui-copilot-plugin .p-0\.5{padding:.125rem}#comfyui-copilot-plugin .p-1{padding:.25rem}#comfyui-copilot-plugin .p-1\.5{padding:.375rem}#comfyui-copilot-plugin .p-2{padding:.5rem}#comfyui-copilot-plugin .p-3{padding:.75rem}#comfyui-copilot-plugin .p-4{padding:1rem}#comfyui-copilot-plugin .p-6{padding:1.5rem}#comfyui-copilot-plugin .p-8{padding:2rem}#comfyui-copilot-plugin .px-1{padding-left:.25rem;padding-right:.25rem}#comfyui-copilot-plugin .px-1\.5{padding-left:.375rem;padding-right:.375rem}#comfyui-copilot-plugin .px-2{padding-left:.5rem;padding-right:.5rem}#comfyui-copilot-plugin .px-3{padding-left:.75rem;padding-right:.75rem}#comfyui-copilot-plugin .px-4{padding-left:1rem;padding-right:1rem}#comfyui-copilot-plugin .px-5{padding-left:1.25rem;padding-right:1.25rem}#comfyui-copilot-plugin .py-0\.5{padding-top:.125rem;padding-bottom:.125rem}#comfyui-copilot-plugin .py-1{padding-top:.25rem;padding-bottom:.25rem}#comfyui-copilot-plugin .py-1\.5{padding-top:.375rem;padding-bottom:.375rem}#comfyui-copilot-plugin .py-2{padding-top:.5rem;padding-bottom:.5rem}#comfyui-copilot-plugin .py-2\.5{padding-top:.625rem;padding-bottom:.625rem}#comfyui-copilot-plugin .py-3{padding-top:.75rem;padding-bottom:.75rem}#comfyui-copilot-plugin .py-4{padding-top:1rem;padding-bottom:1rem}#comfyui-copilot-plugin .pb-10{padding-bottom:2.5rem}#comfyui-copilot-plugin .pb-2{padding-bottom:.5rem}#comfyui-copilot-plugin .pb-3{padding-bottom:.75rem}#comfyui-copilot-plugin .pl-4{padding-left:1rem}#comfyui-copilot-plugin .pr-12{padding-right:3rem}#comfyui-copilot-plugin .pr-4{padding-right:1rem}#comfyui-copilot-plugin .pr-6{padding-right:1.5rem}#comfyui-copilot-plugin .pt-1{padding-top:.25rem}#comfyui-copilot-plugin .pt-2{padding-top:.5rem}#comfyui-copilot-plugin .pt-6{padding-top:1.5rem}#comfyui-copilot-plugin .text-left{text-align:left}#comfyui-copilot-plugin .text-center{text-align:center}#comfyui-copilot-plugin .\!text-\[11px\]{font-size:11px!important}#comfyui-copilot-plugin .text-\[10px\]{font-size:10px}#comfyui-copilot-plugin .text-\[11px\]{font-size:11px}#comfyui-copilot-plugin .text-\[12px\]{font-size:12px}#comfyui-copilot-plugin .text-\[14px\]{font-size:14px}#comfyui-copilot-plugin .text-base{font-size:1rem;line-height:1.5rem}#comfyui-copilot-plugin .text-lg{font-size:1.125rem;line-height:1.75rem}#comfyui-copilot-plugin .text-sm{font-size:.875rem;line-height:1.25rem}#comfyui-copilot-plugin .text-xl{font-size:1.25rem;line-height:1.75rem}#comfyui-copilot-plugin .text-xs{font-size:.75rem;line-height:1rem}#comfyui-copilot-plugin .font-bold{font-weight:700}#comfyui-copilot-plugin .font-medium{font-weight:500}#comfyui-copilot-plugin .font-semibold{font-weight:600}#comfyui-copilot-plugin .italic{font-style:italic}#comfyui-copilot-plugin .leading-relaxed{line-height:1.625}#comfyui-copilot-plugin .leading-snug{line-height:1.375}#comfyui-copilot-plugin .text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-gray-300{color:color-mix(in srgb,var(--p-text-color) 30%,transparent)}#comfyui-copilot-plugin .text-gray-400{color:color-mix(in srgb,var(--p-text-color) 40%,transparent)}#comfyui-copilot-plugin .text-gray-500{color:color-mix(in srgb,var(--p-text-color) 50%,transparent)}#comfyui-copilot-plugin .text-gray-600{color:color-mix(in srgb,var(--p-text-color) 60%,transparent)}#comfyui-copilot-plugin .text-gray-700{color:color-mix(in srgb,var(--p-text-color) 70%,transparent)}#comfyui-copilot-plugin .text-gray-800{color:color-mix(in srgb,var(--p-text-color) 80%,transparent)}#comfyui-copilot-plugin .text-gray-900{color:color-mix(in srgb,var(--p-text-color) 90%,transparent)}#comfyui-copilot-plugin .text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-green-900{--tw-text-opacity: 1;color:rgb(20 83 45 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-pink-600{--tw-text-opacity: 1;color:rgb(219 39 119 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-pink-700{--tw-text-opacity: 1;color:rgb(190 24 93 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}#comfyui-copilot-plugin .text-white{color:var(--p-panel-background)}#comfyui-copilot-plugin .underline{text-decoration-line:underline}#comfyui-copilot-plugin .placeholder-gray-500::-moz-placeholder{color:color-mix(in srgb,var(--p-text-color) 50%,transparent)}#comfyui-copilot-plugin .placeholder-gray-500::placeholder{color:color-mix(in srgb,var(--p-text-color) 50%,transparent)}#comfyui-copilot-plugin .opacity-0{opacity:0}#comfyui-copilot-plugin .opacity-25{opacity:.25}#comfyui-copilot-plugin .opacity-40{opacity:.4}#comfyui-copilot-plugin .opacity-50{opacity:.5}#comfyui-copilot-plugin .opacity-75{opacity:.75}#comfyui-copilot-plugin .shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#comfyui-copilot-plugin .shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#comfyui-copilot-plugin .shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#comfyui-copilot-plugin .shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#comfyui-copilot-plugin .shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#comfyui-copilot-plugin .outline-none{outline:2px solid transparent;outline-offset:2px}#comfyui-copilot-plugin .ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}#comfyui-copilot-plugin .ring-pink-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(249 168 212 / var(--tw-ring-opacity, 1))}#comfyui-copilot-plugin .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}#comfyui-copilot-plugin .backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}#comfyui-copilot-plugin .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#comfyui-copilot-plugin .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#comfyui-copilot-plugin .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#comfyui-copilot-plugin .transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#comfyui-copilot-plugin .duration-200{transition-duration:.2s}#comfyui-copilot-plugin{height:100%;display:flex;flex-direction:column}#comfyui-copilot-plugin h1,#comfyui-copilot-plugin h2,#comfyui-copilot-plugin h3,#comfyui-copilot-plugin h4,#comfyui-copilot-plugin h5,#comfyui-copilot-plugin h6,#comfyui-copilot-plugin p,#comfyui-copilot-plugin ul,#comfyui-copilot-plugin ol,#comfyui-copilot-plugin button,#comfyui-copilot-plugin input,#comfyui-copilot-plugin textarea,#comfyui-copilot-plugin select{margin:0;padding:0;font-size:100%;font-weight:400}#comfyui-copilot-plugin *{box-sizing:border-box;border-width:0;border-style:solid}#comfyui-copilot-plugin img,#comfyui-copilot-plugin svg,#comfyui-copilot-plugin video,#comfyui-copilot-plugin canvas,#comfyui-copilot-plugin audio,#comfyui-copilot-plugin iframe,#comfyui-copilot-plugin embed,#comfyui-copilot-plugin object{display:block;vertical-align:middle}#comfyui-copilot-plugin button{background-color:transparent;background-image:none}.hover\:border-b-2:hover{border-bottom-width:2px}.hover\:border-blue-300:hover{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity, 1))}.hover\:border-blue-500:hover{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.hover\:bg-amber-200\/50:hover{background-color:#fde68a80}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-200:hover{--tw-bg-opacity: 1;background-color:rgb(191 219 254 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-50:hover{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{background-color:color-mix(in srgb,var(--p-text-color) 10%,transparent)}.hover\:bg-gray-200:hover{background-color:color-mix(in srgb,var(--p-text-color) 20%,transparent)}.hover\:bg-gray-300:hover{background-color:color-mix(in srgb,var(--p-text-color) 30%,transparent)}.hover\:bg-gray-50:hover{background-color:color-mix(in srgb,var(--p-text-color) 5%,transparent)}.hover\:bg-green-200:hover{--tw-bg-opacity: 1;background-color:rgb(187 247 208 / var(--tw-bg-opacity, 1))}.hover\:bg-pink-300:hover{--tw-bg-opacity: 1;background-color:rgb(249 168 212 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-200:hover{--tw-bg-opacity: 1;background-color:rgb(233 213 255 / var(--tw-bg-opacity, 1))}.hover\:text-amber-700:hover{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.hover\:text-amber-800:hover{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.hover\:text-blue-500:hover{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\:text-blue-700:hover{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.hover\:text-gray-600:hover{color:color-mix(in srgb,var(--p-text-color) 60%,transparent)}.hover\:text-gray-700:hover{color:color-mix(in srgb,var(--p-text-color) 70%,transparent)}.hover\:text-gray-900:hover{color:color-mix(in srgb,var(--p-text-color) 90%,transparent)}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-sm:hover{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-transparent:focus{border-color:transparent}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-blue-500\/20:focus{--tw-ring-color: rgb(59 130 246 / .2)}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:block{display:block}.group:hover .group-hover\:translate-x-1{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.prose-headings\:font-semibold :is(:where(h1,h2,h3,h4,h5,h6,th):not(:where([class~=not-prose],[class~=not-prose] *))){font-weight:600}.prose-h1\:text-base :is(:where(h1):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:1rem;line-height:1.5rem}.prose-h2\:text-sm :is(:where(h2):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.875rem;line-height:1.25rem}.prose-h3\:text-xs :is(:where(h3):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-h4\:text-xs :is(:where(h4):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-p\:text-xs :is(:where(p):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-a\:font-medium :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))){font-weight:500}.prose-a\:text-amber-700 :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.prose-a\:underline :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))){text-decoration-line:underline}.hover\:prose-a\:text-amber-800 :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))):hover{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.prose-code\:text-xs :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-pre\:text-xs :is(:where(pre):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-ol\:text-xs :is(:where(ol):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-ul\:text-xs :is(:where(ul):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-li\:text-xs :is(:where(li):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}@media (prefers-color-scheme: dark){.dark\:border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.dark\:border-gray-600{border-color:color-mix(in srgb,var(--p-text-color) 60%,transparent)}.dark\:border-gray-700{border-color:color-mix(in srgb,var(--p-text-color) 70%,transparent)}.dark\:border-red-800\/20{border-color:#991b1b33}.dark\:bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-600{background-color:color-mix(in srgb,var(--p-text-color) 60%,transparent)}.dark\:bg-gray-700{background-color:color-mix(in srgb,var(--p-text-color) 70%,transparent)}.dark\:bg-gray-800{background-color:color-mix(in srgb,var(--p-text-color) 80%,transparent)}.dark\:bg-green-900\/20{background-color:#14532d33}.dark\:bg-red-900\/20{background-color:#7f1d1d33}.dark\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-gray-200{color:color-mix(in srgb,var(--p-text-color) 20%,transparent)}.dark\:text-gray-300{color:color-mix(in srgb,var(--p-text-color) 30%,transparent)}.dark\:text-gray-400{color:color-mix(in srgb,var(--p-text-color) 40%,transparent)}.dark\:text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-pink-400{--tw-text-opacity: 1;color:rgb(244 114 182 / var(--tw-text-opacity, 1))}.dark\:text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-white{color:var(--p-panel-background)}.dark\:placeholder-gray-400::-moz-placeholder{color:color-mix(in srgb,var(--p-text-color) 40%,transparent)}.dark\:placeholder-gray-400::placeholder{color:color-mix(in srgb,var(--p-text-color) 40%,transparent)}.dark\:hover\:bg-blue-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-700:hover{background-color:color-mix(in srgb,var(--p-text-color) 70%,transparent)}.dark\:hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:hover\:text-gray-200:hover{color:color-mix(in srgb,var(--p-text-color) 20%,transparent)}.dark\:focus\:border-blue-400:focus{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.dark\:focus\:ring-blue-400\/20:focus{--tw-ring-color: rgb(96 165 250 / .2)}}.\[\&\>\*\]\:\!my-1>*{margin-top:.25rem!important;margin-bottom:.25rem!important} diff --git a/dist/copilot_web/input.js b/dist/copilot_web/input.js index 46676fa..b327869 100644 --- a/dist/copilot_web/input.js +++ b/dist/copilot_web/input.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-mzuNw1xF.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-B9b4Aopv.js","copilot_web/fonts.css"])))=>i.map(i=>d[i]); -import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-B9b4Aopv.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import("./App-mzuNw1xF.js");return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-DD0h6y--.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-B9b4Aopv.js","copilot_web/fonts.css"])))=>i.map(i=>d[i]); +import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-B9b4Aopv.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import("./App-DD0h6y--.js");return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; diff --git a/dist/copilot_web/workflowChat-QQb_1pUR.js b/dist/copilot_web/workflowChat-InPErGJu.js similarity index 99% rename from dist/copilot_web/workflowChat-QQb_1pUR.js rename to dist/copilot_web/workflowChat-InPErGJu.js index 597661c..f79e386 100644 --- a/dist/copilot_web/workflowChat-QQb_1pUR.js +++ b/dist/copilot_web/workflowChat-InPErGJu.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-BL9FbSQy.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-B9b4Aopv.js","copilot_web/ParameterDebugInterfaceV2-BjxlYwD2.js","copilot_web/input.js","copilot_web/assets/input-CfrhPaqY.css","copilot_web/fonts.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-BL9FbSQy.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-B9b4Aopv.js","copilot_web/ParameterDebugInterfaceV2-eSr5IIOo.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"])))=>i.map(i=>d[i]); import{_ as Ot}from"./input.js";import{j as h,r as yg,b as wg}from"./vendor-markdown-Dek94WS0.js";import{r as L,R as wn,c as Tt}from"./vendor-react-V04_Axys.js";import{f as bg,v as Sg,a as fn,B as Ag,U as Eg,A as Er,b as Ig,g as en,c as Mt,u as ru,M as Cg,W as Rt}from"./message-components-B9b4Aopv.js";/** * @license lucide-react v0.475.0 - ISC * @@ -126,4 +126,4 @@ __p += '`),z&&(v+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+v+`return __p -}`;var W=Ta(function(){return Y(s,S+"return "+v).apply(a,o)});if(W.source=v,zi(W))throw W;return W}function C0(e){return J(e).toLowerCase()}function N0(e){return J(e).toUpperCase()}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return Uu(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),s=Fu(r,i),o=ju(r,i)+1;return On(r,s,o).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Ku(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=ju(r,tn(n))+1;return On(r,0,i).join("")}function R0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fu(r,tn(n));return On(r,i).join("")}function O0(e,n){var t=bn,r=Cr;if(ae(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var s=e.length;if(Qn(e)){var o=tn(e);s=o.length}if(t>=s)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(au.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function M0(e){return e=J(e),e&&Ga.test(e)?e.replace(iu,al):e}var D0=st(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Rs("toUpperCase");function La(e,n,t){return e=J(e),n=t?a:n,n===a?tl(e)?fl(e):qo(e):e.match(n)||[]}var Ta=U(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),P0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function k0(e){var n=e==null?0:e.length,t=I();return e=n?ue(e,function(r){if(typeof r[1]!="function")throw new Ze(B);return[t(r[0]),r[1]]}):[],U(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ee(e,ze);n=I(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=u[r?"take"+(n=="last"?"Right":""):n],s=r||/^find/.test(n);i&&(u.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(u,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,C=s&&!x,W=c&&!S;if(!s&&_){o=W?o:new K(this);var N=e.apply(o,l);return N.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(N,x)}return C&&W?e.apply(this,l):(N=this.thru(v),C?r?N.value()[0]:N.value():N)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);u.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var s=this.value();return n.apply(O(s)?s:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=u[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,oe).name]=[{name:"wrapper",func:a}],K.prototype.clone=Ol,K.prototype.reverse=Ml,K.prototype.value=Dl,u.prototype.at=fh,u.prototype.chain=ch,u.prototype.commit=hh,u.prototype.next=dh,u.prototype.plant=ph,u.prototype.reverse=_h,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=vh,u.prototype.first=u.prototype.head,_t&&(u.prototype[_t]=gh),u},et=cl();kn?((kn.exports=et)._=et,Jr._=et):we._=et}).call(Tt)})(Ir,Ir.exports);var ka=Ir.exports;function ip(m=!0){L.useEffect(()=>{if(!m)return;const b=ka.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function up(m=!0){const{state:b,dispatch:a}=ru(),{activeTab:F,screenState:M}=b;L.useEffect(()=>{if(!m)return;const E=B=>{const te=F==="parameter-debug",y=F==="chat",q=!M||M.currentScreen===0;if(y||q&&te){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,F,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Cg,{rehypePlugins:[[yg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[wg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...F})=>h.jsx("a",{...F,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,ap=()=>{const{state:m,dispatch:b}=ru(),{selectedNode:a,screenState:F}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import("./ParameterDebugInterfaceV2-BjxlYwD2.js"),__vite__mapDeps([4,1,2,3,5,6,7])).then(te=>({default:te.ParameterDebugInterface}))),B=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:B})})})},Da=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function op({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:F}){const{state:M,dispatch:E}=ru(),{messages:B,installedNodes:te,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,ve=L.useRef(null),[re,ge]=L.useState(""),[T,k]=L.useState(""),[oe,ce]=L.useState(window.innerWidth/3),[se,Pe]=L.useState(!1),[le,H]=L.useState([]),[Z,Se]=L.useState("gpt-4o-mini");L.useState(window.innerHeight),L.useState(0);const[pe,bn]=L.useState(""),[Cr,Dt]=L.useState(!1);ip(b&&P==="chat"),up(b),L.useEffect(()=>{ve.current&&(ve.current.scrollTop=ve.current.scrollHeight)},[B]),L.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await rp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await Rt.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};L.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),L.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),L.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),L.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ct=wn.useCallback(A=>{if(!se)return;const j=window.innerWidth-A.clientX,_e=Math.min(Math.max(300,j),window.innerWidth*.8);ce(_e)},[se]),$n=wn.useMemo(()=>ka.debounce(ct,16),[ct]);L.useEffect(()=>(se&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[se,$n]);const Lr=A=>{ge(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),re.trim()===""&&!$||!q)return;k(re);const A=en(),j={id:en(),role:"user",content:re,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),ge("");try{const _e={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of Rt.streamInvokeServer(q,re,le.map(ie=>ie.file),null,_e,A)){const ie={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ie}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ie});const Ae=M.messages.map(We=>We.id===ie.id&&!We.finished?ie:We);qn(Ae)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(_e){console.error("Error sending message:",_e),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),k(A);const j=en(),_e={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:_e});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ie of Rt.streamInvokeServer(q,A,le.map(Ae=>Ae.file),null,V,j)){const Ae={id:$e,role:"ai",content:JSON.stringify(ie),format:ie.format,finished:ie.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ae}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ae});const We=M.messages.map(nn=>nn.id===Ae.id&&!nn.finished?Ae:nn);qn(We)}ie.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{ge(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const _e=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:_e,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ie=!0;for await(const Ae of Rt.streamInvokeServer(q,_e,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ae),format:Ae.format,finished:Ae.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ie)E({type:"ADD_MESSAGE",payload:We}),ie=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ce=>Ce.id===We.id&&!Ce.finished?We:Ce);qn(nn)}Ae.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{Pe(!1)},Zn=A=>{const j=Array.from(A).map(_e=>({id:Math.random().toString(36).substr(2,9),file:_e,preview:URL.createObjectURL(_e)}));H(_e=>[..._e,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{le.forEach(A=>URL.revokeObjectURL(A.preview))},[le]),L.useEffect(()=>{a&&F&&P==="chat"&&(Pt("node_explain"),F())},[a,P]),L.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await Rt.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(ap,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(zg,{onClose:m,onClear:Hn,hasMessages:B.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Da,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Da,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&pe&&P==="chat"&&h.jsx(sp,{message:pe,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:ve,children:h.jsx(np,{messages:B,latestInput:T,onOptionClick:ze,installedNodes:te,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(Zg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx(Hg,{input:re,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:le,onRemoveImage:Or,selectedModel:Z,onModelChange:Se})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const vp=Object.freeze(Object.defineProperty({__proto__:null,default:op},Symbol.toStringTag,{value:"Module"}));export{_p as g,pp as i,gp as m,dp as r,vp as w}; +}`;var W=Ta(function(){return Y(s,S+"return "+v).apply(a,o)});if(W.source=v,zi(W))throw W;return W}function C0(e){return J(e).toLowerCase()}function N0(e){return J(e).toUpperCase()}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return Uu(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),s=Fu(r,i),o=ju(r,i)+1;return On(r,s,o).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Ku(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=ju(r,tn(n))+1;return On(r,0,i).join("")}function R0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fu(r,tn(n));return On(r,i).join("")}function O0(e,n){var t=bn,r=Cr;if(ae(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var s=e.length;if(Qn(e)){var o=tn(e);s=o.length}if(t>=s)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(au.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function M0(e){return e=J(e),e&&Ga.test(e)?e.replace(iu,al):e}var D0=st(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Rs("toUpperCase");function La(e,n,t){return e=J(e),n=t?a:n,n===a?tl(e)?fl(e):qo(e):e.match(n)||[]}var Ta=U(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),P0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function k0(e){var n=e==null?0:e.length,t=I();return e=n?ue(e,function(r){if(typeof r[1]!="function")throw new Ze(B);return[t(r[0]),r[1]]}):[],U(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ee(e,ze);n=I(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=u[r?"take"+(n=="last"?"Right":""):n],s=r||/^find/.test(n);i&&(u.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(u,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,C=s&&!x,W=c&&!S;if(!s&&_){o=W?o:new K(this);var N=e.apply(o,l);return N.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(N,x)}return C&&W?e.apply(this,l):(N=this.thru(v),C?r?N.value()[0]:N.value():N)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);u.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var s=this.value();return n.apply(O(s)?s:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=u[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,oe).name]=[{name:"wrapper",func:a}],K.prototype.clone=Ol,K.prototype.reverse=Ml,K.prototype.value=Dl,u.prototype.at=fh,u.prototype.chain=ch,u.prototype.commit=hh,u.prototype.next=dh,u.prototype.plant=ph,u.prototype.reverse=_h,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=vh,u.prototype.first=u.prototype.head,_t&&(u.prototype[_t]=gh),u},et=cl();kn?((kn.exports=et)._=et,Jr._=et):we._=et}).call(Tt)})(Ir,Ir.exports);var ka=Ir.exports;function ip(m=!0){L.useEffect(()=>{if(!m)return;const b=ka.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function up(m=!0){const{state:b,dispatch:a}=ru(),{activeTab:F,screenState:M}=b;L.useEffect(()=>{if(!m)return;const E=B=>{const te=F==="parameter-debug",y=F==="chat",q=!M||M.currentScreen===0;if(y||q&&te){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,F,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Cg,{rehypePlugins:[[yg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[wg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...F})=>h.jsx("a",{...F,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,ap=()=>{const{state:m,dispatch:b}=ru(),{selectedNode:a,screenState:F}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import("./ParameterDebugInterfaceV2-eSr5IIOo.js"),__vite__mapDeps([4,1,2,3,5,6,7])).then(te=>({default:te.ParameterDebugInterface}))),B=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:B})})})},Da=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function op({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:F}){const{state:M,dispatch:E}=ru(),{messages:B,installedNodes:te,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,ve=L.useRef(null),[re,ge]=L.useState(""),[T,k]=L.useState(""),[oe,ce]=L.useState(window.innerWidth/3),[se,Pe]=L.useState(!1),[le,H]=L.useState([]),[Z,Se]=L.useState("gpt-4o-mini");L.useState(window.innerHeight),L.useState(0);const[pe,bn]=L.useState(""),[Cr,Dt]=L.useState(!1);ip(b&&P==="chat"),up(b),L.useEffect(()=>{ve.current&&(ve.current.scrollTop=ve.current.scrollHeight)},[B]),L.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await rp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await Rt.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};L.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),L.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),L.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),L.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ct=wn.useCallback(A=>{if(!se)return;const j=window.innerWidth-A.clientX,_e=Math.min(Math.max(300,j),window.innerWidth*.8);ce(_e)},[se]),$n=wn.useMemo(()=>ka.debounce(ct,16),[ct]);L.useEffect(()=>(se&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[se,$n]);const Lr=A=>{ge(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),re.trim()===""&&!$||!q)return;k(re);const A=en(),j={id:en(),role:"user",content:re,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),ge("");try{const _e={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of Rt.streamInvokeServer(q,re,le.map(ie=>ie.file),null,_e,A)){const ie={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ie}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ie});const Ae=M.messages.map(We=>We.id===ie.id&&!We.finished?ie:We);qn(Ae)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(_e){console.error("Error sending message:",_e),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),k(A);const j=en(),_e={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:_e});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ie of Rt.streamInvokeServer(q,A,le.map(Ae=>Ae.file),null,V,j)){const Ae={id:$e,role:"ai",content:JSON.stringify(ie),format:ie.format,finished:ie.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ae}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ae});const We=M.messages.map(nn=>nn.id===Ae.id&&!nn.finished?Ae:nn);qn(We)}ie.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{ge(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const _e=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:_e,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ie=!0;for await(const Ae of Rt.streamInvokeServer(q,_e,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ae),format:Ae.format,finished:Ae.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ie)E({type:"ADD_MESSAGE",payload:We}),ie=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ce=>Ce.id===We.id&&!Ce.finished?We:Ce);qn(nn)}Ae.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{Pe(!1)},Zn=A=>{const j=Array.from(A).map(_e=>({id:Math.random().toString(36).substr(2,9),file:_e,preview:URL.createObjectURL(_e)}));H(_e=>[..._e,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{le.forEach(A=>URL.revokeObjectURL(A.preview))},[le]),L.useEffect(()=>{a&&F&&P==="chat"&&(Pt("node_explain"),F())},[a,P]),L.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await Rt.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(ap,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(zg,{onClose:m,onClear:Hn,hasMessages:B.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Da,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Da,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&pe&&P==="chat"&&h.jsx(sp,{message:pe,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:ve,children:h.jsx(np,{messages:B,latestInput:T,onOptionClick:ze,installedNodes:te,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(Zg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx(Hg,{input:re,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:le,onRemoveImage:Or,selectedModel:Z,onModelChange:Se})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const vp=Object.freeze(Object.defineProperty({__proto__:null,default:op},Symbol.toStringTag,{value:"Module"}));export{_p as g,pp as i,gp as m,dp as r,vp as w}; diff --git a/pyproject.toml b/pyproject.toml index 222d214..d576389 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "ComfyUI-Copilot" description = "Your Intelligent Assistant for Comfy-UI." -version = "1.3.0" +version = "1.3.1" license = {file = "LICENSE"} [project.urls] diff --git a/ui/src/components/debug/screens/ResultGalleryScreen.tsx b/ui/src/components/debug/screens/ResultGalleryScreen.tsx index 6c45373..4ff4a0e 100644 --- a/ui/src/components/debug/screens/ResultGalleryScreen.tsx +++ b/ui/src/components/debug/screens/ResultGalleryScreen.tsx @@ -117,6 +117,18 @@ export const ResultGalleryScreen: React.FC = ({ className="w-full h-full object-cover" /> +
+ {Object.entries(image.params) + // Filter out nodeParams and other complex objects from display + .filter(([paramName, value]) => + paramName !== 'nodeParams' && + typeof value !== 'object' + ) + .map(([paramName, value]) => ( +
{paramName}: {String(value)}
+ )) + } +
); })} diff --git a/ui/src/output.css b/ui/src/output.css index 9844ff6..cd43b46 100644 --- a/ui/src/output.css +++ b/ui/src/output.css @@ -427,6 +427,9 @@ .h-px { height: 1px; } + .max-h-16 { + max-height: 4rem; + } .max-h-60 { max-height: 15rem; } From 4c242812885a71068cf46ab0ad92e40dc58f2270 Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Tue, 20 May 2025 11:46:02 +0800 Subject: [PATCH 02/14] feat: pre --- dist/copilot_web/{App-DD0h6y--.js => App-DpjTOvew.js} | 4 ++-- ...-eSr5IIOo.js => ParameterDebugInterfaceV2-BOLAAraS.js} | 2 +- ...kflowOption-BL9FbSQy.js => WorkflowOption-EBexRuvI.js} | 2 +- dist/copilot_web/input.js | 4 ++-- ...ponents-B9b4Aopv.js => message-components-DetBDgrq.js} | 2 +- ...{workflowChat-InPErGJu.js => workflowChat-C7S5e-Fc.js} | 8 ++++---- 6 files changed, 11 insertions(+), 11 deletions(-) rename dist/copilot_web/{App-DD0h6y--.js => App-DpjTOvew.js} (82%) rename dist/copilot_web/{ParameterDebugInterfaceV2-eSr5IIOo.js => ParameterDebugInterfaceV2-BOLAAraS.js} (99%) rename dist/copilot_web/{WorkflowOption-BL9FbSQy.js => WorkflowOption-EBexRuvI.js} (98%) rename dist/copilot_web/{message-components-B9b4Aopv.js => message-components-DetBDgrq.js} (99%) rename dist/copilot_web/{workflowChat-InPErGJu.js => workflowChat-C7S5e-Fc.js} (99%) diff --git a/dist/copilot_web/App-DD0h6y--.js b/dist/copilot_web/App-DpjTOvew.js similarity index 82% rename from dist/copilot_web/App-DD0h6y--.js rename to dist/copilot_web/App-DpjTOvew.js index 588572a..d5d2c8f 100644 --- a/dist/copilot_web/App-DD0h6y--.js +++ b/dist/copilot_web/App-DpjTOvew.js @@ -1,6 +1,6 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-InPErGJu.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-B9b4Aopv.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-C7S5e-Fc.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DetBDgrq.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; const prefix = apiBase ? `${apiBase.substring(1)}/` : ''; return `${prefix}${path}`; }))))=>i.map(i=>d[i]); -import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-B9b4Aopv.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import("./workflowChat-InPErGJu.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; +import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-DetBDgrq.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import("./workflowChat-C7S5e-Fc.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/dist/copilot_web/ParameterDebugInterfaceV2-eSr5IIOo.js b/dist/copilot_web/ParameterDebugInterfaceV2-BOLAAraS.js similarity index 99% rename from dist/copilot_web/ParameterDebugInterfaceV2-eSr5IIOo.js rename to dist/copilot_web/ParameterDebugInterfaceV2-BOLAAraS.js index b4e940c..fccb7cc 100644 --- a/dist/copilot_web/ParameterDebugInterfaceV2-eSr5IIOo.js +++ b/dist/copilot_web/ParameterDebugInterfaceV2-BOLAAraS.js @@ -1,4 +1,4 @@ -import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-B9b4Aopv.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-InPErGJu.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:L,handleTextInputChange:k,handleAddTextInput:M,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=L[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,L,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=L[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>M(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:$=>{$.preventDefault(),$.stopPropagation()},onChange:$=>{$.preventDefault(),$.stopPropagation();const D=$.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:$=>{$.preventDefault(),$.stopPropagation()},required:!0,onChange:$=>{$.preventDefault(),$.stopPropagation();const D=$.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:$=>{$.preventDefault(),$.stopPropagation()},onChange:$=>{$.preventDefault(),$.stopPropagation();const D=$.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const $=r[j]?.[v]||C;if($.length<=10)return $.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=$.slice(0,5),A=$.slice($.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const $=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,$)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:$=>{$.preventDefault(),$.stopPropagation(),n(j,v,z(C),$)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:$=>{$.preventDefault(),$.stopPropagation(),n(j,v,C,$)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),M=[],P=[];for(const N of k)N.type==="SaveImage"?M.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...M,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const M=Object.values(V.canvas.selected_nodes);if(M.length===0)return;const P=M[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const L=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,M)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},M)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>L(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],L=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",L,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,M)=>{const P=k.name;if(!s[P])return null;const y=r[L]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Mp.preventDefault()})})]},M)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const L=Math.ceil(t.length/d),k=(n-1)*d,M=Math.min(k+d,t.length),P=t.slice(k,M);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),L>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",L]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===L,className:`px-2 py-1 rounded ${n===L?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i(L,y),disabled:n===L,className:`px-2 py-1 rounded ${n===L?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white +import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-DetBDgrq.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-C7S5e-Fc.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:L,handleTextInputChange:k,handleAddTextInput:M,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=L[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,L,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=L[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>M(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:$=>{$.preventDefault(),$.stopPropagation()},onChange:$=>{$.preventDefault(),$.stopPropagation();const D=$.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:$=>{$.preventDefault(),$.stopPropagation()},required:!0,onChange:$=>{$.preventDefault(),$.stopPropagation();const D=$.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:$=>{$.preventDefault(),$.stopPropagation()},onChange:$=>{$.preventDefault(),$.stopPropagation();const D=$.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const $=r[j]?.[v]||C;if($.length<=10)return $.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=$.slice(0,5),A=$.slice($.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const $=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,$)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:$=>{$.preventDefault(),$.stopPropagation(),n(j,v,z(C),$)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:$=>{$.preventDefault(),$.stopPropagation(),n(j,v,C,$)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),M=[],P=[];for(const N of k)N.type==="SaveImage"?M.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...M,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const M=Object.values(V.canvas.selected_nodes);if(M.length===0)return;const P=M[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const L=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,M)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},M)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>L(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],L=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",L,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,M)=>{const P=k.name;if(!s[P])return null;const y=r[L]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Mp.preventDefault()})})]},M)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const L=Math.ceil(t.length/d),k=(n-1)*d,M=Math.min(k+d,t.length),P=t.slice(k,M);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),L>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",L]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===L,className:`px-2 py-1 rounded ${n===L?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i(L,y),disabled:n===L,className:`px-2 py-1 rounded ${n===L?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white bg-gray-50 dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-400 diff --git a/dist/copilot_web/WorkflowOption-BL9FbSQy.js b/dist/copilot_web/WorkflowOption-EBexRuvI.js similarity index 98% rename from dist/copilot_web/WorkflowOption-BL9FbSQy.js rename to dist/copilot_web/WorkflowOption-EBexRuvI.js index f7ff0d7..963e134 100644 --- a/dist/copilot_web/WorkflowOption-BL9FbSQy.js +++ b/dist/copilot_web/WorkflowOption-EBexRuvI.js @@ -1 +1 @@ -import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-B9b4Aopv.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; +import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-DetBDgrq.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; diff --git a/dist/copilot_web/input.js b/dist/copilot_web/input.js index b327869..64d9ea1 100644 --- a/dist/copilot_web/input.js +++ b/dist/copilot_web/input.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-DD0h6y--.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-B9b4Aopv.js","copilot_web/fonts.css"])))=>i.map(i=>d[i]); -import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-B9b4Aopv.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import("./App-DD0h6y--.js");return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-DpjTOvew.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DetBDgrq.js","copilot_web/fonts.css"])))=>i.map(i=>d[i]); +import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-DetBDgrq.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import("./App-DpjTOvew.js");return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; diff --git a/dist/copilot_web/message-components-B9b4Aopv.js b/dist/copilot_web/message-components-DetBDgrq.js similarity index 99% rename from dist/copilot_web/message-components-B9b4Aopv.js rename to dist/copilot_web/message-components-DetBDgrq.js index 26c10e0..bc6123b 100644 --- a/dist/copilot_web/message-components-B9b4Aopv.js +++ b/dist/copilot_web/message-components-DetBDgrq.js @@ -1,4 +1,4 @@ -import{r as Ve,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Mpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=Ve.createContext({state:W$,dispatch:()=>null});function Bpe({children:i}){const[r,e]=Ve.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=Ve.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const Ff={apiBaseUrl:"https://comfyui-copilot-server.onrender.com"};function Sr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var lI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return lI.charAt(i)}function hI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function cI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function dI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,fI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f +import{r as Ve,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Mpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=Ve.createContext({state:W$,dispatch:()=>null});function Bpe({children:i}){const[r,e]=Ve.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=Ve.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const Ff={apiBaseUrl:"https://comfyui-copilot-server-pre.onrender.com"};function Sr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var lI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return lI.charAt(i)}function hI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function cI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function dI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,fI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f \r  \u2028\u2029`;for(pn={},r=0;r<16;++r)pn[e.charAt(r)]=r;for(e=e.toLowerCase(),r=10;r<16;++r)pn[e.charAt(r)]=r;for(r=0;r=2?(n[n.length]=a,a=0,o=0):a<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},Si,wd={decode:function(i){var r;if(Si===void 0){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=`= \f \r  \u2028\u2029`;for(Si=Object.create(null),r=0;r<64;++r)Si[e.charAt(r)]=r;for(Si["-"]=62,Si._=63,r=0;r=4?(n[n.length]=a>>16,n[n.length]=a>>8&255,n[n.length]=a&255,a=0,o=0):a<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=a>>10;break;case 3:n[n.length]=a>>16,n[n.length]=a>>8&255;break}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(i){var r=wd.re.exec(i);if(r)if(r[1])i=r[1];else if(r[2])i=r[2];else throw new Error("RegExp out of sync");return wd.decode(i)}},gn=1e13,Ua=function(){function i(r){this.buf=[+r||0]}return i.prototype.mulAdd=function(r,e){var t=this.buf,n=t.length,a,o;for(a=0;a0&&(t[a]=e)},i.prototype.sub=function(r){var e=this.buf,t=e.length,n,a;for(n=0;n=0;--n)t+=(gn+e[n]).toString().substring(1);return t},i.prototype.valueOf=function(){for(var r=this.buf,e=0,t=r.length-1;t>=0;--t)e=e*gn+r[t];return e},i.prototype.simplify=function(){var r=this.buf;return r.length==1?r[0]:this},i}(),G$="…",vI=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,pI=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Wn(i,r){return i.length>r&&(i=i.substring(0,r)+G$),i}var nh=function(){function i(r,e){this.hexDigits="0123456789ABCDEF",r instanceof i?(this.enc=r.enc,this.pos=r.pos):(this.enc=r,this.pos=e)}return i.prototype.get=function(r){if(r===void 0&&(r=this.pos++),r>=this.enc.length)throw new Error("Requesting byte offset ".concat(r," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(r):this.enc[r]},i.prototype.hexByte=function(r){return this.hexDigits.charAt(r>>4&15)+this.hexDigits.charAt(r&15)},i.prototype.hexDump=function(r,e,t){for(var n="",a=r;a176)return!1}return!0},i.prototype.parseStringISO=function(r,e){for(var t="",n=r;n191&&a<224?t+=String.fromCharCode((a&31)<<6|this.get(n++)&63):t+=String.fromCharCode((a&15)<<12|(this.get(n++)&63)<<6|this.get(n++)&63)}return t},i.prototype.parseStringBMP=function(r,e){for(var t="",n,a,o=r;o127,a=n?255:0,o,s="";t==a&&++r4){for(s=t,o<<=3;!((+s^a)&128);)s=+s<<1,--o;s="("+o+` bit) diff --git a/dist/copilot_web/workflowChat-InPErGJu.js b/dist/copilot_web/workflowChat-C7S5e-Fc.js similarity index 99% rename from dist/copilot_web/workflowChat-InPErGJu.js rename to dist/copilot_web/workflowChat-C7S5e-Fc.js index f79e386..d2b4d95 100644 --- a/dist/copilot_web/workflowChat-InPErGJu.js +++ b/dist/copilot_web/workflowChat-C7S5e-Fc.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-BL9FbSQy.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-B9b4Aopv.js","copilot_web/ParameterDebugInterfaceV2-eSr5IIOo.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"])))=>i.map(i=>d[i]); -import{_ as Ot}from"./input.js";import{j as h,r as yg,b as wg}from"./vendor-markdown-Dek94WS0.js";import{r as L,R as wn,c as Tt}from"./vendor-react-V04_Axys.js";import{f as bg,v as Sg,a as fn,B as Ag,U as Eg,A as Er,b as Ig,g as en,c as Mt,u as ru,M as Cg,W as Rt}from"./message-components-B9b4Aopv.js";/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-EBexRuvI.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DetBDgrq.js","copilot_web/ParameterDebugInterfaceV2-BOLAAraS.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"])))=>i.map(i=>d[i]); +import{_ as Ot}from"./input.js";import{j as h,r as yg,b as wg}from"./vendor-markdown-Dek94WS0.js";import{r as L,R as wn,c as Tt}from"./vendor-react-V04_Axys.js";import{f as bg,v as Sg,a as fn,B as Ag,U as Eg,A as Er,b as Ig,g as en,c as Mt,u as ru,M as Cg,W as Rt}from"./message-components-DetBDgrq.js";/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. @@ -100,7 +100,7 @@ ${k.join(` hover:bg-gray-50`,children:"Close"})})]})})]})}function qg(m){const b=m[0],a=new Set;function F(M,E){if(!(!M||E>=1)&&M.inputs)for(const B of Object.values(M.inputs)){const te=B.link;if(te&&fn.graph.links[te]){const y=fn.graph.links[te].origin_id,q=fn.graph._nodes_by_id[y];q&&(a.add(q.type),F(q,E+1))}}}return b?(F(b,0),[{type:"upstream_node_types",data:Array.from(a)}]):null}function Zg({nodeInfo:m,onSendWithIntent:b,loading:a,onSendWithContent:F}){return console.log("SelectedNodeInfo nodeInfo:",m[0]),h.jsx("div",{className:"mb-3 p-3 rounded-md bg-gray-50 border border-gray-200",children:h.jsxs("div",{className:"text-sm text-gray-700",children:[h.jsxs("p",{children:["Selected node: ",m[0].type]}),h.jsxs("div",{className:"flex gap-2 mt-2",children:[h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-blue-50 text-blue-700 hover:bg-blue-100`,onClick:()=>F(`Reply in ${navigator.language} language: How does the ${m[0].type} node work? I need its official usage guide.`),disabled:a,children:"Usage"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-green-100 text-green-700 hover:bg-green-200`,onClick:()=>F(`Reply in ${navigator.language} language: Show me the technical specifications for the ${m[0].type} node's inputs and outputs.`),disabled:a,children:"Parameters"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-purple-100 - text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",qg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Yg(){return h.jsx(Ag,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Jg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Xg=L.lazy(()=>Ot(()=>import("./WorkflowOption-BL9FbSQy.js"),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Qg=L.lazy(()=>Ot(()=>import("./message-components-B9b4Aopv.js").then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Vg=L.lazy(()=>Ot(()=>import("./message-components-B9b4Aopv.js").then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),ep=L.lazy(()=>Ot(()=>import("./message-components-B9b4Aopv.js").then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function np({messages:m,latestInput:b,onOptionClick:a,installedNodes:F,onAddMessage:M,loading:E}){const B=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Eg,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Jg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(k=>k.type==="workflow"),ve=$.ext?.find(k=>k.type==="node"),re=$.ext?.find(k=>k.type==="downstream_subgraph_search"),ge=$.ext?.find(k=>k.type==="node_install_guide");let T=null;if(P)T=h.jsx(L.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:F,onAddMessage:M})});else if(ve)T=h.jsx(L.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,installedNodes:F})});else if(re){const k=h.jsx(L.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:k,metadata:y.metadata},y.id);T=k}else ge&&(T=h.jsx(L.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(ep,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const k=Object.values(fn.canvas.selected_nodes)[0];if(k){const oe=y.metadata.pendingSubgraph,ce=oe.json.nodes,se=oe.json.links,Pe=ce.find(Z=>Z.id===0),le=Pe?.id,H={};le&&(H[le]=k),fn.canvas.emitBeforeChange();try{for(const Z of ce)if(Z.id!==le){const Se=Pe?.pos||[0,0],pe=k._pos||[0,0],bn=[Z.pos[0]+pe[0]-Se[0],Z.pos[1]+pe[1]-Se[1]];H[Z.id]=Ig(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of se){const Se=H[Z.origin_id],pe=H[Z.target_id];Se&&pe&&Se.connect(Z.origin_slot,pe,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const k=y.metadata.pendingWorkflow,oe=y.metadata.optimizedParams;fn.loadGraphData(k);for(const[se,Pe,le,H,Z]of oe){const Se=fn.graph._nodes_by_id[se].widgets;for(const pe of Se)pe.name===H&&(pe.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const ce={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(ce)}}})}));return $.text||T?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:T,metadata:y.metadata},y.id):T||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[F,a,M,b]),te=wn.useMemo(()=>m?.map(B),[m,B]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[te,E&&h.jsx(Yg,{})]})}async function tp(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function rp(){const m=await tp();return Object.keys(m)}async function dp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function gp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function pp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function _p(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** + text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",qg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Yg(){return h.jsx(Ag,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Jg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Xg=L.lazy(()=>Ot(()=>import("./WorkflowOption-EBexRuvI.js"),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Qg=L.lazy(()=>Ot(()=>import("./message-components-DetBDgrq.js").then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Vg=L.lazy(()=>Ot(()=>import("./message-components-DetBDgrq.js").then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),ep=L.lazy(()=>Ot(()=>import("./message-components-DetBDgrq.js").then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function np({messages:m,latestInput:b,onOptionClick:a,installedNodes:F,onAddMessage:M,loading:E}){const B=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Eg,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Jg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(k=>k.type==="workflow"),ve=$.ext?.find(k=>k.type==="node"),re=$.ext?.find(k=>k.type==="downstream_subgraph_search"),ge=$.ext?.find(k=>k.type==="node_install_guide");let T=null;if(P)T=h.jsx(L.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:F,onAddMessage:M})});else if(ve)T=h.jsx(L.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,installedNodes:F})});else if(re){const k=h.jsx(L.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:k,metadata:y.metadata},y.id);T=k}else ge&&(T=h.jsx(L.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(ep,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const k=Object.values(fn.canvas.selected_nodes)[0];if(k){const oe=y.metadata.pendingSubgraph,ce=oe.json.nodes,se=oe.json.links,Pe=ce.find(Z=>Z.id===0),le=Pe?.id,H={};le&&(H[le]=k),fn.canvas.emitBeforeChange();try{for(const Z of ce)if(Z.id!==le){const Se=Pe?.pos||[0,0],pe=k._pos||[0,0],bn=[Z.pos[0]+pe[0]-Se[0],Z.pos[1]+pe[1]-Se[1]];H[Z.id]=Ig(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of se){const Se=H[Z.origin_id],pe=H[Z.target_id];Se&&pe&&Se.connect(Z.origin_slot,pe,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const k=y.metadata.pendingWorkflow,oe=y.metadata.optimizedParams;fn.loadGraphData(k);for(const[se,Pe,le,H,Z]of oe){const Se=fn.graph._nodes_by_id[se].widgets;for(const pe of Se)pe.name===H&&(pe.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const ce={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(ce)}}})}));return $.text||T?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:T,metadata:y.metadata},y.id):T||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[F,a,M,b]),te=wn.useMemo(()=>m?.map(B),[m,B]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[te,E&&h.jsx(Yg,{})]})}async function tp(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function rp(){const m=await tp();return Object.keys(m)}async function dp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function gp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function pp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function _p(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors @@ -126,4 +126,4 @@ __p += '`),z&&(v+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+v+`return __p -}`;var W=Ta(function(){return Y(s,S+"return "+v).apply(a,o)});if(W.source=v,zi(W))throw W;return W}function C0(e){return J(e).toLowerCase()}function N0(e){return J(e).toUpperCase()}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return Uu(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),s=Fu(r,i),o=ju(r,i)+1;return On(r,s,o).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Ku(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=ju(r,tn(n))+1;return On(r,0,i).join("")}function R0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fu(r,tn(n));return On(r,i).join("")}function O0(e,n){var t=bn,r=Cr;if(ae(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var s=e.length;if(Qn(e)){var o=tn(e);s=o.length}if(t>=s)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(au.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function M0(e){return e=J(e),e&&Ga.test(e)?e.replace(iu,al):e}var D0=st(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Rs("toUpperCase");function La(e,n,t){return e=J(e),n=t?a:n,n===a?tl(e)?fl(e):qo(e):e.match(n)||[]}var Ta=U(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),P0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function k0(e){var n=e==null?0:e.length,t=I();return e=n?ue(e,function(r){if(typeof r[1]!="function")throw new Ze(B);return[t(r[0]),r[1]]}):[],U(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ee(e,ze);n=I(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=u[r?"take"+(n=="last"?"Right":""):n],s=r||/^find/.test(n);i&&(u.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(u,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,C=s&&!x,W=c&&!S;if(!s&&_){o=W?o:new K(this);var N=e.apply(o,l);return N.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(N,x)}return C&&W?e.apply(this,l):(N=this.thru(v),C?r?N.value()[0]:N.value():N)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);u.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var s=this.value();return n.apply(O(s)?s:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=u[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,oe).name]=[{name:"wrapper",func:a}],K.prototype.clone=Ol,K.prototype.reverse=Ml,K.prototype.value=Dl,u.prototype.at=fh,u.prototype.chain=ch,u.prototype.commit=hh,u.prototype.next=dh,u.prototype.plant=ph,u.prototype.reverse=_h,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=vh,u.prototype.first=u.prototype.head,_t&&(u.prototype[_t]=gh),u},et=cl();kn?((kn.exports=et)._=et,Jr._=et):we._=et}).call(Tt)})(Ir,Ir.exports);var ka=Ir.exports;function ip(m=!0){L.useEffect(()=>{if(!m)return;const b=ka.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function up(m=!0){const{state:b,dispatch:a}=ru(),{activeTab:F,screenState:M}=b;L.useEffect(()=>{if(!m)return;const E=B=>{const te=F==="parameter-debug",y=F==="chat",q=!M||M.currentScreen===0;if(y||q&&te){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,F,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Cg,{rehypePlugins:[[yg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[wg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...F})=>h.jsx("a",{...F,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,ap=()=>{const{state:m,dispatch:b}=ru(),{selectedNode:a,screenState:F}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import("./ParameterDebugInterfaceV2-eSr5IIOo.js"),__vite__mapDeps([4,1,2,3,5,6,7])).then(te=>({default:te.ParameterDebugInterface}))),B=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:B})})})},Da=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function op({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:F}){const{state:M,dispatch:E}=ru(),{messages:B,installedNodes:te,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,ve=L.useRef(null),[re,ge]=L.useState(""),[T,k]=L.useState(""),[oe,ce]=L.useState(window.innerWidth/3),[se,Pe]=L.useState(!1),[le,H]=L.useState([]),[Z,Se]=L.useState("gpt-4o-mini");L.useState(window.innerHeight),L.useState(0);const[pe,bn]=L.useState(""),[Cr,Dt]=L.useState(!1);ip(b&&P==="chat"),up(b),L.useEffect(()=>{ve.current&&(ve.current.scrollTop=ve.current.scrollHeight)},[B]),L.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await rp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await Rt.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};L.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),L.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),L.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),L.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ct=wn.useCallback(A=>{if(!se)return;const j=window.innerWidth-A.clientX,_e=Math.min(Math.max(300,j),window.innerWidth*.8);ce(_e)},[se]),$n=wn.useMemo(()=>ka.debounce(ct,16),[ct]);L.useEffect(()=>(se&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[se,$n]);const Lr=A=>{ge(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),re.trim()===""&&!$||!q)return;k(re);const A=en(),j={id:en(),role:"user",content:re,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),ge("");try{const _e={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of Rt.streamInvokeServer(q,re,le.map(ie=>ie.file),null,_e,A)){const ie={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ie}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ie});const Ae=M.messages.map(We=>We.id===ie.id&&!We.finished?ie:We);qn(Ae)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(_e){console.error("Error sending message:",_e),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),k(A);const j=en(),_e={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:_e});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ie of Rt.streamInvokeServer(q,A,le.map(Ae=>Ae.file),null,V,j)){const Ae={id:$e,role:"ai",content:JSON.stringify(ie),format:ie.format,finished:ie.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ae}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ae});const We=M.messages.map(nn=>nn.id===Ae.id&&!nn.finished?Ae:nn);qn(We)}ie.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{ge(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const _e=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:_e,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ie=!0;for await(const Ae of Rt.streamInvokeServer(q,_e,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ae),format:Ae.format,finished:Ae.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ie)E({type:"ADD_MESSAGE",payload:We}),ie=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ce=>Ce.id===We.id&&!Ce.finished?We:Ce);qn(nn)}Ae.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{Pe(!1)},Zn=A=>{const j=Array.from(A).map(_e=>({id:Math.random().toString(36).substr(2,9),file:_e,preview:URL.createObjectURL(_e)}));H(_e=>[..._e,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{le.forEach(A=>URL.revokeObjectURL(A.preview))},[le]),L.useEffect(()=>{a&&F&&P==="chat"&&(Pt("node_explain"),F())},[a,P]),L.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await Rt.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(ap,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(zg,{onClose:m,onClear:Hn,hasMessages:B.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Da,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Da,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&pe&&P==="chat"&&h.jsx(sp,{message:pe,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:ve,children:h.jsx(np,{messages:B,latestInput:T,onOptionClick:ze,installedNodes:te,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(Zg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx(Hg,{input:re,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:le,onRemoveImage:Or,selectedModel:Z,onModelChange:Se})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const vp=Object.freeze(Object.defineProperty({__proto__:null,default:op},Symbol.toStringTag,{value:"Module"}));export{_p as g,pp as i,gp as m,dp as r,vp as w}; +}`;var W=Ta(function(){return Y(s,S+"return "+v).apply(a,o)});if(W.source=v,zi(W))throw W;return W}function C0(e){return J(e).toLowerCase()}function N0(e){return J(e).toUpperCase()}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return Uu(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),s=Fu(r,i),o=ju(r,i)+1;return On(r,s,o).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Ku(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=ju(r,tn(n))+1;return On(r,0,i).join("")}function R0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fu(r,tn(n));return On(r,i).join("")}function O0(e,n){var t=bn,r=Cr;if(ae(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var s=e.length;if(Qn(e)){var o=tn(e);s=o.length}if(t>=s)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(au.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function M0(e){return e=J(e),e&&Ga.test(e)?e.replace(iu,al):e}var D0=st(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Rs("toUpperCase");function La(e,n,t){return e=J(e),n=t?a:n,n===a?tl(e)?fl(e):qo(e):e.match(n)||[]}var Ta=U(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),P0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function k0(e){var n=e==null?0:e.length,t=I();return e=n?ue(e,function(r){if(typeof r[1]!="function")throw new Ze(B);return[t(r[0]),r[1]]}):[],U(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ee(e,ze);n=I(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=u[r?"take"+(n=="last"?"Right":""):n],s=r||/^find/.test(n);i&&(u.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(u,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,C=s&&!x,W=c&&!S;if(!s&&_){o=W?o:new K(this);var N=e.apply(o,l);return N.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(N,x)}return C&&W?e.apply(this,l):(N=this.thru(v),C?r?N.value()[0]:N.value():N)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);u.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var s=this.value();return n.apply(O(s)?s:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=u[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,oe).name]=[{name:"wrapper",func:a}],K.prototype.clone=Ol,K.prototype.reverse=Ml,K.prototype.value=Dl,u.prototype.at=fh,u.prototype.chain=ch,u.prototype.commit=hh,u.prototype.next=dh,u.prototype.plant=ph,u.prototype.reverse=_h,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=vh,u.prototype.first=u.prototype.head,_t&&(u.prototype[_t]=gh),u},et=cl();kn?((kn.exports=et)._=et,Jr._=et):we._=et}).call(Tt)})(Ir,Ir.exports);var ka=Ir.exports;function ip(m=!0){L.useEffect(()=>{if(!m)return;const b=ka.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function up(m=!0){const{state:b,dispatch:a}=ru(),{activeTab:F,screenState:M}=b;L.useEffect(()=>{if(!m)return;const E=B=>{const te=F==="parameter-debug",y=F==="chat",q=!M||M.currentScreen===0;if(y||q&&te){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,F,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Cg,{rehypePlugins:[[yg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[wg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...F})=>h.jsx("a",{...F,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,ap=()=>{const{state:m,dispatch:b}=ru(),{selectedNode:a,screenState:F}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import("./ParameterDebugInterfaceV2-BOLAAraS.js"),__vite__mapDeps([4,1,2,3,5,6,7])).then(te=>({default:te.ParameterDebugInterface}))),B=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:B})})})},Da=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function op({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:F}){const{state:M,dispatch:E}=ru(),{messages:B,installedNodes:te,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,ve=L.useRef(null),[re,ge]=L.useState(""),[T,k]=L.useState(""),[oe,ce]=L.useState(window.innerWidth/3),[se,Pe]=L.useState(!1),[le,H]=L.useState([]),[Z,Se]=L.useState("gpt-4o-mini");L.useState(window.innerHeight),L.useState(0);const[pe,bn]=L.useState(""),[Cr,Dt]=L.useState(!1);ip(b&&P==="chat"),up(b),L.useEffect(()=>{ve.current&&(ve.current.scrollTop=ve.current.scrollHeight)},[B]),L.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await rp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await Rt.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};L.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),L.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),L.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),L.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ct=wn.useCallback(A=>{if(!se)return;const j=window.innerWidth-A.clientX,_e=Math.min(Math.max(300,j),window.innerWidth*.8);ce(_e)},[se]),$n=wn.useMemo(()=>ka.debounce(ct,16),[ct]);L.useEffect(()=>(se&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[se,$n]);const Lr=A=>{ge(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),re.trim()===""&&!$||!q)return;k(re);const A=en(),j={id:en(),role:"user",content:re,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),ge("");try{const _e={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of Rt.streamInvokeServer(q,re,le.map(ie=>ie.file),null,_e,A)){const ie={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ie}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ie});const Ae=M.messages.map(We=>We.id===ie.id&&!We.finished?ie:We);qn(Ae)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(_e){console.error("Error sending message:",_e),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),k(A);const j=en(),_e={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:_e});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ie of Rt.streamInvokeServer(q,A,le.map(Ae=>Ae.file),null,V,j)){const Ae={id:$e,role:"ai",content:JSON.stringify(ie),format:ie.format,finished:ie.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ae}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ae});const We=M.messages.map(nn=>nn.id===Ae.id&&!nn.finished?Ae:nn);qn(We)}ie.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{ge(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const _e=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:_e,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ie=!0;for await(const Ae of Rt.streamInvokeServer(q,_e,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ae),format:Ae.format,finished:Ae.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ie)E({type:"ADD_MESSAGE",payload:We}),ie=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ce=>Ce.id===We.id&&!Ce.finished?We:Ce);qn(nn)}Ae.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{Pe(!1)},Zn=A=>{const j=Array.from(A).map(_e=>({id:Math.random().toString(36).substr(2,9),file:_e,preview:URL.createObjectURL(_e)}));H(_e=>[..._e,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{le.forEach(A=>URL.revokeObjectURL(A.preview))},[le]),L.useEffect(()=>{a&&F&&P==="chat"&&(Pt("node_explain"),F())},[a,P]),L.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await Rt.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(ap,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(zg,{onClose:m,onClear:Hn,hasMessages:B.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Da,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Da,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&pe&&P==="chat"&&h.jsx(sp,{message:pe,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:ve,children:h.jsx(np,{messages:B,latestInput:T,onOptionClick:ze,installedNodes:te,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(Zg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx(Hg,{input:re,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:le,onRemoveImage:Or,selectedModel:Z,onModelChange:Se})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const vp=Object.freeze(Object.defineProperty({__proto__:null,default:op},Symbol.toStringTag,{value:"Module"}));export{_p as g,pp as i,gp as m,dp as r,vp as w}; From 487dfa7fe0d2e4ab191b088b870886abf28cc259 Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Wed, 21 May 2025 17:25:23 +0800 Subject: [PATCH 03/14] feat: fix bug history parameters --- dist/copilot_web/{App-DpjTOvew.js => App-CD8cpUyz.js} | 4 ++-- ...2-BOLAAraS.js => ParameterDebugInterfaceV2-CkhASy27.js} | 6 +++--- dist/copilot_web/input.js | 4 ++-- .../{workflowChat-C7S5e-Fc.js => workflowChat-Bg7hphV8.js} | 4 ++-- ui/src/components/debug/screens/HistoryItemScreen.tsx | 7 ++++--- 5 files changed, 13 insertions(+), 12 deletions(-) rename dist/copilot_web/{App-DpjTOvew.js => App-CD8cpUyz.js} (91%) rename dist/copilot_web/{ParameterDebugInterfaceV2-BOLAAraS.js => ParameterDebugInterfaceV2-CkhASy27.js} (87%) rename dist/copilot_web/{workflowChat-C7S5e-Fc.js => workflowChat-Bg7hphV8.js} (99%) diff --git a/dist/copilot_web/App-DpjTOvew.js b/dist/copilot_web/App-CD8cpUyz.js similarity index 91% rename from dist/copilot_web/App-DpjTOvew.js rename to dist/copilot_web/App-CD8cpUyz.js index d5d2c8f..42da3b5 100644 --- a/dist/copilot_web/App-DpjTOvew.js +++ b/dist/copilot_web/App-CD8cpUyz.js @@ -1,6 +1,6 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-C7S5e-Fc.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DetBDgrq.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-Bg7hphV8.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DetBDgrq.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; const prefix = apiBase ? `${apiBase.substring(1)}/` : ''; return `${prefix}${path}`; }))))=>i.map(i=>d[i]); -import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-DetBDgrq.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import("./workflowChat-C7S5e-Fc.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; +import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-DetBDgrq.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import("./workflowChat-Bg7hphV8.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/dist/copilot_web/ParameterDebugInterfaceV2-BOLAAraS.js b/dist/copilot_web/ParameterDebugInterfaceV2-CkhASy27.js similarity index 87% rename from dist/copilot_web/ParameterDebugInterfaceV2-BOLAAraS.js rename to dist/copilot_web/ParameterDebugInterfaceV2-CkhASy27.js index fccb7cc..447a56e 100644 --- a/dist/copilot_web/ParameterDebugInterfaceV2-BOLAAraS.js +++ b/dist/copilot_web/ParameterDebugInterfaceV2-CkhASy27.js @@ -1,10 +1,10 @@ -import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-DetBDgrq.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-C7S5e-Fc.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:L,handleTextInputChange:k,handleAddTextInput:M,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=L[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,L,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=L[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>M(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:$=>{$.preventDefault(),$.stopPropagation()},onChange:$=>{$.preventDefault(),$.stopPropagation();const D=$.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:$=>{$.preventDefault(),$.stopPropagation()},required:!0,onChange:$=>{$.preventDefault(),$.stopPropagation();const D=$.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:$=>{$.preventDefault(),$.stopPropagation()},onChange:$=>{$.preventDefault(),$.stopPropagation();const D=$.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const $=r[j]?.[v]||C;if($.length<=10)return $.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=$.slice(0,5),A=$.slice($.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const $=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,$)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:$=>{$.preventDefault(),$.stopPropagation(),n(j,v,z(C),$)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:$=>{$.preventDefault(),$.stopPropagation(),n(j,v,C,$)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),M=[],P=[];for(const N of k)N.type==="SaveImage"?M.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...M,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const M=Object.values(V.canvas.selected_nodes);if(M.length===0)return;const P=M[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const L=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,M)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},M)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>L(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],L=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",L,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,M)=>{const P=k.name;if(!s[P])return null;const y=r[L]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Mp.preventDefault()})})]},M)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const L=Math.ceil(t.length/d),k=(n-1)*d,M=Math.min(k+d,t.length),P=t.slice(k,M);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),L>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",L]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===L,className:`px-2 py-1 rounded ${n===L?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i(L,y),disabled:n===L,className:`px-2 py-1 rounded ${n===L?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white +import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-DetBDgrq.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-Bg7hphV8.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white bg-gray-50 dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-400 focus:ring-2 focus:ring-blue-500/20 dark:focus:ring-blue-400/20 focus:outline-none`,rows:3,placeholder:"Enter some text here...",value:r,onChange:x=>s(x.target.value)}),e.jsx("button",{className:`mt-2 px-4 py-2 rounded-lg text-sm flex items-center transition-colors ${o?"bg-gray-300 dark:bg-gray-600 text-gray-500 dark:text-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white"}`,onClick:i,disabled:o,children:o?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-gray-500 dark:text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Generating..."]}):e.jsx(e.Fragment,{children:"Generate"})})]}),n&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800/20 rounded-md text-red-700 dark:text-red-400 text-sm",children:n}),l.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Generated variations (select items to add):"}),e.jsx("div",{className:"space-y-2 max-h-[40vh] overflow-y-auto p-2",children:l.map((x,g)=>e.jsxs("div",{className:"flex items-start border border-gray-200 dark:border-gray-600 rounded-md p-2",children:[e.jsx("div",{className:"mr-2 mt-1",children:e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"checkbox",id:`text${g+1}`,checked:!!a[`text${g+1}`],onChange:()=>d(`text${g+1}`),className:"sr-only"}),e.jsx("div",{className:`h-4 w-4 rounded border ${a[`text${g+1}`]?"bg-blue-600 dark:bg-blue-500 border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600"} flex items-center justify-center cursor-pointer`,onClick:()=>d(`text${g+1}`),children:a[`text${g+1}`]&&e.jsx("svg",{className:"h-3 w-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})})]})}),e.jsx("label",{htmlFor:`text${g+1}`,className:"text-sm text-gray-700 dark:text-gray-300 cursor-pointer flex-1",children:x})]},g))})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 flex justify-end flex-shrink-0",children:[e.jsx("button",{className:`px-5 py-2.5 text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 - rounded-lg font-medium transition-colors mr-3`,onClick:u,children:"Cancel"}),e.jsx("button",{className:`px-5 py-2.5 rounded-lg font-medium transition-colors ${Object.values(a).every(x=>!x)?"bg-gray-300 dark:bg-gray-600 text-gray-500 dark:text-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white"}`,onClick:m,disabled:Object.values(a).every(x=>!x),children:"Add Selected"})]})]})}):null,je=t=>{const r=[],s={};if(Object.keys(t).forEach(o=>{const n=parseInt(o),i=t[o]||{},d=Object.keys(i).filter(u=>i[u]&&i[u].length>0);if(d.length===0)return;const m=[[]];d.forEach(u=>{const x=i[u],g=[];m.forEach(f=>{x.forEach(b=>{const L=[...f,{nodeId:n,paramName:u,paramValue:String(b)}];g.push(L)})}),m.length=0,m.push(...g)}),s[o]=m}),Object.keys(s).length===0)return r;if(Object.keys(s).length===1){const o=Object.keys(s)[0];return s[o]}const l=Object.keys(s);let a=s[l[0]];for(let o=1;o{n.forEach(m=>{i.push([...d,...m])})}),a=i}return a},St=(t,r)=>{const s={};s.nodeParams={};const l=je(t);return r{const n=o.nodeId.toString(),i=o.paramName,d=o.paramValue;s.nodeParams[n]||(s.nodeParams[n]={}),s.nodeParams[n][i]=d,s[i]=d}),s},Be="parameter_debug_history",De=30,Ae=async(t,r,s,l,a)=>{try{const o=Re(),n={id:ie(),timestamp:Date.now(),title:Ne(t,r),nodeName:t,params:{...r,nodeNames:{...r.nodeNames||{},[t.split("<")[0]]:t.split("<")[0]}},generatedImages:s,totalCount:l,workflow:a};return o.unshift(n),o.length>De&&o.splice(De),localStorage.setItem(Be,JSON.stringify(o)),n}catch(o){return console.error("Error saving parameter debug history:",o),null}},Re=()=>{try{const t=localStorage.getItem(Be);if(t)return JSON.parse(t)}catch(t){console.error("Error loading parameter debug history:",t)}return[]},ze=t=>{const r=new Date(t);return`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")} ${String(r.getHours()).padStart(2,"0")}:${String(r.getMinutes()).padStart(2,"0")}`},Ne=(t,r)=>{if(r.nodeParams)return Object.entries(r.nodeParams).map(([o,n])=>{let i=t;r.selectedNodeInfoMap&&r.selectedNodeInfoMap[o]&&(i=r.selectedNodeInfoMap[o]);const d=Object.keys(n).slice(0,3);return`${i}<${d.join(",")}>`}).join(";");const s=Object.keys(r).filter(l=>l!=="nodeParams"&&l!=="selectedNodeInfoMap").slice(0,3);return`${t}<${s.join(",")}>`},Ct=({historyItems:t,onViewHistoryItem:r,onClose:s})=>e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 flex flex-col h-full",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Experiments History"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["Last ",t.length," experiments"]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:s,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center text-gray-500 text-sm",children:"No history items found"}):e.jsx("div",{className:"flex-1 overflow-y-auto",children:t.map(l=>e.jsxs("div",{className:"border border-gray-200 rounded-lg mb-3 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 py-2 px-3 flex items-center justify-between border-b",children:[e.jsx("div",{className:"text-[14px] text-gray-600",children:ze(l.timestamp)}),e.jsx("button",{onClick:()=>r(l),className:"px-3 py-1 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"view"})]}),e.jsx("div",{className:"p-3",children:e.jsx("div",{className:"text-[10px] font-medium text-gray-700",children:Ne(l.nodeName,l.params)})})]},l.id))})]}),Lt=({historyItem:t,selectedImageIndex:r,handleSelectImage:s,handleClose:l,currentPage:a,handlePageChange:o,imagesPerPage:n,modalVisible:i,modalImageUrl:d,modalImageParams:m,openImageModal:u,closeImageModal:x})=>{const{timestamp:g,nodeName:f,generatedImages:b,params:L}=t,k=Math.ceil(b.length/n),M=(a-1)*n,P=Math.min(M+n,b.length),y=b.slice(M,P);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-start",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:Ne(f,L)}),e.jsxs("p",{className:"text-xs text-gray-500",children:[ze(g)," • ",b.length," images"]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600 mt-0",onClick:l,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx(te,{visible:i,imageUrl:d,params:{...L,nodeNames:{[t.nodeName.split("<")[0]]:t.nodeName.split("<")[0]}},onClose:x}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:y.map((N,p)=>{const S=M+p;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===S?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:O=>s(S,O),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:O=>u(N.url,N.params,O),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:N.url,alt:`Generated image ${S+1}`,className:"w-full h-full object-cover"})})]},S)})}),k>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:N=>o(1,N),disabled:a===1,className:`px-2 py-1 rounded ${a===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:N=>o(a-1,N),disabled:a===1,className:`px-2 py-1 rounded ${a===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",a," of ",k]}),e.jsx("button",{onClick:N=>o(a+1,N),disabled:a===k,className:`px-2 py-1 rounded ${a===k?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:N=>o(k,N),disabled:a===k,className:`px-2 py-1 rounded ${a===k?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]})]})},Mt=` + rounded-lg font-medium transition-colors mr-3`,onClick:u,children:"Cancel"}),e.jsx("button",{className:`px-5 py-2.5 rounded-lg font-medium transition-colors ${Object.values(a).every(x=>!x)?"bg-gray-300 dark:bg-gray-600 text-gray-500 dark:text-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white"}`,onClick:m,disabled:Object.values(a).every(x=>!x),children:"Add Selected"})]})]})}):null,je=t=>{const r=[],s={};if(Object.keys(t).forEach(o=>{const n=parseInt(o),i=t[o]||{},d=Object.keys(i).filter(u=>i[u]&&i[u].length>0);if(d.length===0)return;const m=[[]];d.forEach(u=>{const x=i[u],g=[];m.forEach(f=>{x.forEach(b=>{const $=[...f,{nodeId:n,paramName:u,paramValue:String(b)}];g.push($)})}),m.length=0,m.push(...g)}),s[o]=m}),Object.keys(s).length===0)return r;if(Object.keys(s).length===1){const o=Object.keys(s)[0];return s[o]}const l=Object.keys(s);let a=s[l[0]];for(let o=1;o{n.forEach(m=>{i.push([...d,...m])})}),a=i}return a},St=(t,r)=>{const s={};s.nodeParams={};const l=je(t);return r{const n=o.nodeId.toString(),i=o.paramName,d=o.paramValue;s.nodeParams[n]||(s.nodeParams[n]={}),s.nodeParams[n][i]=d,s[i]=d}),s},Be="parameter_debug_history",De=30,Ae=async(t,r,s,l,a)=>{try{const o=Re(),n={id:ie(),timestamp:Date.now(),title:Ne(t,r),nodeName:t,params:{...r,nodeNames:{...r.nodeNames||{},[t.split("<")[0]]:t.split("<")[0]}},generatedImages:s,totalCount:l,workflow:a};return o.unshift(n),o.length>De&&o.splice(De),localStorage.setItem(Be,JSON.stringify(o)),n}catch(o){return console.error("Error saving parameter debug history:",o),null}},Re=()=>{try{const t=localStorage.getItem(Be);if(t)return JSON.parse(t)}catch(t){console.error("Error loading parameter debug history:",t)}return[]},ze=t=>{const r=new Date(t);return`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")} ${String(r.getHours()).padStart(2,"0")}:${String(r.getMinutes()).padStart(2,"0")}`},Ne=(t,r)=>{if(r.nodeParams)return Object.entries(r.nodeParams).map(([o,n])=>{let i=t;r.selectedNodeInfoMap&&r.selectedNodeInfoMap[o]&&(i=r.selectedNodeInfoMap[o]);const d=Object.keys(n).slice(0,3);return`${i}<${d.join(",")}>`}).join(";");const s=Object.keys(r).filter(l=>l!=="nodeParams"&&l!=="selectedNodeInfoMap").slice(0,3);return`${t}<${s.join(",")}>`},Ct=({historyItems:t,onViewHistoryItem:r,onClose:s})=>e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 flex flex-col h-full",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Experiments History"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["Last ",t.length," experiments"]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:s,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center text-gray-500 text-sm",children:"No history items found"}):e.jsx("div",{className:"flex-1 overflow-y-auto",children:t.map(l=>e.jsxs("div",{className:"border border-gray-200 rounded-lg mb-3 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 py-2 px-3 flex items-center justify-between border-b",children:[e.jsx("div",{className:"text-[14px] text-gray-600",children:ze(l.timestamp)}),e.jsx("button",{onClick:()=>r(l),className:"px-3 py-1 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"view"})]}),e.jsx("div",{className:"p-3",children:e.jsx("div",{className:"text-[10px] font-medium text-gray-700",children:Ne(l.nodeName,l.params)})})]},l.id))})]}),Lt=({historyItem:t,selectedImageIndex:r,handleSelectImage:s,handleClose:l,currentPage:a,handlePageChange:o,imagesPerPage:n,modalVisible:i,modalImageUrl:d,modalImageParams:m,openImageModal:u,closeImageModal:x})=>{const{timestamp:g,nodeName:f,generatedImages:b,params:$}=t,k=Math.ceil(b.length/n),L=(a-1)*n,P=Math.min(L+n,b.length),y=b.slice(L,P);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-start",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:Ne(f,$)}),e.jsxs("p",{className:"text-xs text-gray-500",children:[ze(g)," • ",b.length," images"]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600 mt-0",onClick:l,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx(te,{visible:i,imageUrl:d,params:m?{...m,nodeNames:{[t.nodeName.split("<")[0]]:t.nodeName.split("<")[0]}}:void 0,onClose:x}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:y.map((N,p)=>{const S=L+p;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===S?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:O=>s(S,O),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:O=>u(N.url,N.params,O),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:N.url,alt:`Generated image ${S+1}`,className:"w-full h-full object-cover"})})]},S)})}),k>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:N=>o(1,N),disabled:a===1,className:`px-2 py-1 rounded ${a===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:N=>o(a-1,N),disabled:a===1,className:`px-2 py-1 rounded ${a===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",a," of ",k]}),e.jsx("button",{onClick:N=>o(a+1,N),disabled:a===k,className:`px-2 py-1 rounded ${a===k?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:N=>o(k,N),disabled:a===k,className:`px-2 py-1 rounded ${a===k?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]})]})},Mt=` @keyframes highlight-pulse { 0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); @@ -32,4 +32,4 @@ import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-re .animate-fade-in-out { animation: fade-in-out 3s forwards; } -`,re="parameter_debug_state",We=t=>{try{localStorage.setItem(re,JSON.stringify(t))}catch(r){console.error("Error saving parameter debug state:",r)}},$t=()=>{try{const t=localStorage.getItem(re);if(t)return JSON.parse(t)}catch(t){console.error("Error loading parameter debug state:",t)}return null},Pt=()=>{try{localStorage.removeItem(re)}catch(t){console.error("Error clearing parameter debug state:",t)}},Et=(t,r,s,l,a,o)=>{const n=`${t}_${r}`;o(d=>{const m=[...d[n]||[]];return m[s]=l,{...d,[n]:m}});const i=[...a[n]||[]];return i[s]=l,i},_t=(t,r,s,l)=>{const a=`${t}_${r}`;return l(o=>{const n=[...o[a]||[]];return n.push(""),{...o,[a]:n}}),[...s[a]||[],""]},It=(t,r,s,l,a)=>{const o=`${t}_${r}`;a(i=>{const d=[...i[o]||[]];return d.splice(s,1),{...i,[o]:d}});const n=[...l[o]||[]];return n.splice(s,1),n},Ot=(t,r,s,l,a)=>{s.preventDefault(),s.stopPropagation();const o=`${t}_${r}`;a(n=>{if(n[o]&&typeof n[o]=="object"?n[o].isOpen:!!n[o])return{...n,[o]:!1};{let d=0,m=0;if(s.currentTarget){const g=s.currentTarget.getBoundingClientRect();d=g.left,m=g.bottom}else d=s.clientX,m=s.clientY+20;const u=window.innerWidth,x=250;return d+x>u&&(d=u-x-10),d<0&&(d=10),{...n,[o]:{isOpen:!0,x:d,y:m}}}})},Dt=(t,r,s,l,a)=>{a(o=>{const n={...o};return n[t]||(n[t]={}),n[t][r]=s,n})},At=(t,r,s,l,a,o)=>{o&&(o.preventDefault(),o.stopPropagation()),a(n=>{const i={...n};i[t]||(i[t]={}),i[t][r]||(i[t][r]=[]);const d=i[t][r];return d.includes(s)?i[t][r]=d.filter(m=>m!==s):i[t][r]=[...d,s],i})},Wt=(t,r,s,l,a)=>{const o=`${t}_${r}`;a(n=>({...n,[o]:s}))},Tt=(t,r,s,l,a)=>{if(!l[t]){a(t,r,s);return}const o=l[t][r]||[];s.length===o.length?a(t,r,[]):a(t,r,[...s])},Bt=(t,r,s,l,a,o)=>{o&&(o.preventDefault(),o.stopPropagation());const n=r[t];if(s(i=>({...i,[t]:!n})),n){const i={...l};Object.keys(i).forEach(d=>{i[d][t]&&delete i[d][t]}),a(i)}},Rt=(t,r,s,l,a,o,n)=>{n.preventDefault(),n.stopPropagation();const i={...r};if(r.nodeParams){const d={};Object.keys(r.nodeParams).forEach(m=>{const u=s.find(x=>x.id.toString()===m);d[m]=u?u.title||`Node ${m}`:`Node ${m}`}),i.nodeNames=d}else if(Object.keys(r).length>0){const d={};Object.entries(r).forEach(([m,u])=>{(typeof u!="object"||u===null)&&(d[m]=u)}),Object.keys(d).length>0&&(i.nodeParams={default:d},i.nodeNames={default:r.node_name||r.nodeName||"参数"})}l(t),a(i),o(!0)},zt=(t,r)=>{r&&(r.preventDefault(),r.stopPropagation()),t(!1)},Ft=(t,r,s,l,a,o,n,i,d,m,u)=>{if(u&&(u.preventDefault(),u.stopPropagation()),t===0){const x={...l};Object.keys(x).forEach(g=>{const f=x[g];Object.keys(f).forEach(b=>{s[b]||delete f[b]})}),a(x)}if(t===1){const x={...l};n.forEach(f=>{const b=f.id.toString(),L=f.widgets||{};Object.values(L).forEach(k=>{const M=k.name;if(s[M]&&(k.type==="customtext"||k.type.toLowerCase().includes("text"))){const P=`${b}_${M}`,y=o[P]||[""];x[b]=x[b]||{},x[b][M]=y}})}),a(x);const g=m(x);i(g.length)}d(null),r(x=>Math.min(x+1,2))},Ht=(t,r,s,l,a,o,n,i,d,m)=>{if(m&&(m.preventDefault(),m.stopPropagation()),d(null),n&&i(!1),t===1){const u=s.map(f=>f.id.toString()),x=Object.keys(l),g={...l};x.forEach(f=>{u.includes(f)||delete g[f]}),a(g)}if(t===2||n){const u={...l};Object.entries(o).forEach(([x,g])=>{if(!g||g.length===0)return;const[f,b]=x.split("_");s.some(L=>L.id.toString()===f)&&(u[f]=u[f]||{},JSON.stringify(u[f][b])!==JSON.stringify(g)&&(u[f][b]=g))}),a(u)}r(u=>Math.max(u-1,0))},Ut=(t,r,s,l,a)=>{a&&(a.preventDefault(),a.stopPropagation()),l(Math.max(1,Math.min(t,Math.ceil(s.length/r))))};function Gt(t,r){try{if(!t)return console.error("Invalid prompt_output: ",t),t;for(const s of r){if(!t[s.nodeId]){console.error(`Node with ID ${s.nodeId} not found`);continue}if(!t[s.nodeId].inputs){console.error(`Inputs not found for node with ID ${s.nodeId}`);continue}t[s.nodeId].inputs[s.paramName]=s.paramValue}return t}catch(s){return console.error("Error updating prompt:",s),t}}async function Jt(t){const r=await V.graphToPrompt(),s=Gt(r.output,t);console.log("queuePrompt updated_prompt:",s);const l={prompt:s,client_id:V.api.clientId,extra_data:{extra_pageinfo:{workflow:r.workflow}}};console.debug("queuePrompt request_body.prompt:",s);const a=await ft(l);return console.debug("queuePrompt response:",a),a}function Te(t){const r=document.createElement("canvas"),s=r.getContext("2d");if(r.width=512,r.height=512,s){s.fillStyle="#f8d7da",s.fillRect(0,0,r.width,r.height),s.strokeStyle="#dc3545",s.lineWidth=4,s.strokeRect(10,10,r.width-20,r.height-20),s.fillStyle="#dc3545",s.beginPath(),s.arc(r.width/2,150,50,0,2*Math.PI),s.fill(),s.fillStyle="white",s.font="bold 80px Arial",s.textAlign="center",s.textBaseline="middle",s.fillText("!",r.width/2,150),s.fillStyle="#721c24",s.font="20px Arial",s.textAlign="center",s.textBaseline="middle";const l=r.width-60,a=30,o=t.split(" ");let n="",i=250;for(let d=0;dl&&d>0?(s.fillText(n,r.width/2,i),n=o[d]+" ",i+=a):n=m}s.fillText(n,r.width/2,i)}return r.toDataURL("image/png")}async function Kt(t){try{if(!t||t==="")return console.log("No prompt ID provided"),{1:[Te("Fail to generate prompt ID")]};const r=await bt(t);if(!r||!r[t])return console.log("Not finished for prompt ID:",t),{};const s=r[t];if(s.status&&s.status.status_str==="error"){console.error("Error for prompt ID:",t);const a=s.status.messages;if(a&&a.length>0){const o=a[a.length-1];if(o&&o.length>0){const n=o[0];return{1:[Te(n)]}}}}const l={};if(s.outputs)for(const a in s.outputs){const o=s.outputs[a];if(o&&o.images){l[a]=[];for(const n of o.images)if(n&&n.filename&&n.type){const i=V.graph._nodes_by_id[a].imgs[0].currentSrc.split("?")[0];l[a].push(i+"?filename="+encodeURIComponent(n.filename)+"&type="+encodeURIComponent(n.type)+(n.subfolder?"&subfolder="+encodeURIComponent(n.subfolder):""))}console.log("outputImages for nodeId:",a,l[a])}}return l}catch(r){throw console.error("Error getting output images from prompt:",r),r}}function qt(){const t=Object.values(V.graph._nodes_by_id),r=[],s=[];for(const l of t)l.type==="SaveImage"?r.push(l.id):l.type==="PreviewImage"&&s.push(l.id);if(console.log("saveNodeIds:",r),console.log("previewNodeIds:",s),r.length===0&&s.length===0)throw new Error("No SaveImage or PreviewImage node found, please add one to the graph");return r.length===1?r[0]:r.length==0&&s.length===1?s[0]:null}async function Vt(t,r){const s=await Kt(t);return Object.keys(s).length===0?null:s[r.toString()]&&s[r.toString()].length>0?s[r.toString()][0]:null}const Yt=async(t,r,s,l,a,o,n,i,d,m,u,x,g,f)=>{g&&(g.preventDefault(),g.stopPropagation()),He(m,d);const b=u(t),L=b.length;if(L>100){a(`Cannot generate more than 100 images at once (currently: ${L} images)`);return}a(null),s(!0),l(0),console.log("Generated parameter combinations:",b);let k=null;try{k=(await x.graphToPrompt()).output}catch(N){console.error("Error capturing workflow data:",N)}if(se.trackEvent({event_type:"start_generation",message_type:"parameter_debug",message_id:r,data:{workflow:k,all_params:t,count:L}}),b.length===0){a("No valid parameter combinations found. Please check your parameter selections."),s(!1);return}let M=f||null;if(M===null){const N=qt();N!==null&&(M=N)}if(M===null){a("Please select a SaveImage or PreviewImage node first."),s(!1);return}const P={};Object.keys(t).forEach(N=>{const p=x.graph._nodes_by_id[N];p&&(P[N]=p.type||p.comfyClass||"Unknown Node")});const y=[];try{const N=Date.now().toString();d.current=N;for(const E of b){const R=await Jt(E);R.prompt_id?y.push(R.prompt_id):(console.error("Failed to get prompt_id from response:",R),y.push(""))}const p=Array(b.length).fill(null).map((E,R)=>({url:`https://source.unsplash.com/random/300x300?sig=${Math.random()}`,params:St(t,R)}));o(p);const S=Date.now(),O=5*60*1e3,G=Object.keys(t)[0],j=P[G]||"Unknown Node";Fe(y,M,p,N,S,O,d,m,o,l,s,n,i,j,t,L,k,P)}catch(N){console.error("Error generating images:",N),s(!1)}},Fe=async(t,r,s,l,a,o,n,i,d,m,u,x,g,f,b,L,k,M)=>{if(n.current!==l){console.log("Another polling session has started, stopping this one");return}if(Date.now()-a>o){if(console.log("Timeout reached while waiting for images"),n.current===l&&(u(!1),x(!0),g(1),s.length>0&&f&&b)){const y=s[0].params;M&&(y.selectedNodeInfoMap=M),Ae(f,y,s,L||s.length,k)}return}let P=0;for(let y=0;y0&&f&&b)){const y=s[0].params;M&&(y.selectedNodeInfoMap=M),Ae(f,y,s,L||s.length,k)}return}n.current===l&&(i.current=setTimeout(()=>{Fe(t,r,s,l,a,o,n,i,d,m,u,x,g,f,b,L,k,M)},2e3))},He=(t,r)=>{t.current&&(clearTimeout(t.current),t.current=null),r.current=null},Xt=async(t,r,s,l,a,o)=>{if(!t.trim()){l("Please enter some text to generate variations");return}s(!0),l(null),a([]),o({});try{const n=await se.generateSDPrompts(t);a(n),se.trackEvent({event_type:"prompt_generate",message_type:"parameter_debug",message_id:r,data:{input_text:t,generated_texts:n}});const i={};n.forEach((d,m)=>{i[`text${m+1}`]=!1}),o(i)}catch(n){console.error("Error generating text:",n),l("Failed to generate text variations. Please try again.")}finally{s(!1)}},Qt=(t,r)=>{r(s=>({...s,[t]:!s[t]}))},Zt=(t,r,s,l,a,o,n,i,d,m)=>{const u=`${t}_${r}`,x=Object.entries(s).filter(([f,b])=>b).map(([f])=>{const b=parseInt(f.replace("text",""))-1;return l[b]});if(x.length===0)return;i(f=>{const b=[...f[u]||[]];return{...f,[u]:[...b,...x]}}),se.trackEvent({event_type:"prompt_apply",message_type:"parameter_debug",message_id:o,data:{input_text:a,generated_texts:l,selected_texts:x}});const g=[...n[u]||[],...x];d(t,r,g),m(!1)},es=(t,r,s,l,a,o,n,i,d,m)=>{s(!0),l(t),a(r),o(""),n([]),i({}),d(!1),m(null)},ts=(t,r,s,l,a,o,n,i,d,m,u,x,g,f,b,L,k,M,P,y,N,p,S,O,G,j,E,R,v,T=!1)=>{t(0),r({Steps:!0,CFG:!0,sampler_name:!0,threshold:!1,prompt:!1}),s(ie()),l(),a(!1),o(!1),n(0),i(12),d(null),m(Array(12).fill(null).map((I,_)=>({url:`https://source.unsplash.com/random/300x300?sig=${Math.random()}`,params:{step:_%3===0?5:_%3===1?10:15,sampler_name:"euler",cfg:1}}))),u({}),x({}),g({}),f({}),b(1),L(null),k(!1),M(!1),P(""),y(null),N({}),p(!1),S(""),O([]),G(!1),j(""),E(""),R(null),v({}),T&&Pt()},ss=(t,r,s)=>{s&&(s.preventDefault(),s.stopPropagation()),r(t)},rs=async(t,r,s,l,a,o,n)=>{if(n&&(n.preventDefault(),n.stopPropagation()),t!==null){console.log(`Applied image ${t+1} with parameters:`,r[t].params);let i=1;if(a){for(const m in a)if(a[m])for(const u in a[m]){const x=a[m][u];if(x){let g=1;Array.isArray(x)?g=x.length>0?x.length:1:typeof x=="object"&&x!==null&&(g=Object.keys(x).length>0?Object.keys(x).length:1),i=i*g}}}se.trackEvent({event_type:"parameter_debug_apply",message_type:"parameter_debug",message_id:l,data:{workflow:(await s.graphToPrompt()).output,selected_params:r[t].params,all_params:a,count:i}});const d=r[t].params;d.nodeParams&&(Object.entries(d.nodeParams).forEach(([m,u])=>{const x=s.graph._nodes_by_id[m];!x||!x.widgets||Object.entries(u).forEach(([g,f])=>{for(const b of x.widgets)if(b.name===g){b.value=f;break}})}),s.graph.setDirtyCanvas(!1,!0),o(!0),setTimeout(()=>{o(!1)},3e3))}},ns=(t,r,s,l,a,o,n)=>{if(n&&(n.preventDefault(),n.stopPropagation()),t===1&&s!==void 0){const i=[...r];i[s],i.splice(s,1),i.length===0?a&&(l({type:"SET_SCREEN_STATE",payload:null}),o(!0),a()):l({type:"SET_SELECTED_NODE",payload:i});return}a&&(l({type:"SET_SCREEN_STATE",payload:null}),o(!0),a())},os=({selectedNodes:t,visible:r,onClose:s})=>{const[l,a]=w.useState(0),[o,n]=w.useState({Steps:!0,CFG:!0,sampler_name:!0,threshold:!1,prompt:!1}),[i,d]=w.useState(ie()),[m,u]=w.useState(!1),[x,g]=w.useState(!1),[f,b]=w.useState(0),[L,k]=w.useState(12),[M,P]=w.useState(null),[y,N]=w.useState(()=>Array(12).fill(null).map((c,h)=>({url:`https://source.unsplash.com/random/300x300?sig=${Math.random()}`,params:{step:h%3===0?5:h%3===1?10:15,sampler_name:"euler",cfg:1}}))),[p,S]=w.useState({}),[O,G]=w.useState({}),[j,E]=w.useState({}),[R,v]=w.useState({}),[T,I]=w.useState(1),_=6,[B,z]=w.useState(null),[C,F]=w.useState(!1),[$,D]=w.useState(!1),[A,H]=w.useState(""),[U,J]=w.useState(null),[q,Y]=w.useState({}),[Ue,ne]=w.useState(!1),[ce,de]=w.useState(""),[we,xe]=w.useState([]),[Ge,me]=w.useState(!1),[Je,ke]=w.useState(""),[Ke,Se]=w.useState(""),[qe,ue]=w.useState(null),[Ce,oe]=w.useState({}),[he,ge]=w.useState(!1),[Ve,Ye]=w.useState([]),[Le,pe]=w.useState(null),{dispatch:fe}=ve(),Me=w.useRef(null),$e=w.useRef(null),[Xe,ae]=w.useState(()=>r);w.useEffect(()=>{if(he){const c=Re();Ye(c)}},[he]);const Qe=async()=>{Xt(ce,i,me,ue,xe,oe)},Ze=(c,h,W,K)=>{const Z=Et(c,h,W,K,q,Y);X(c,h,Z)},et=(c,h)=>{const W=_t(c,h,q,Y);X(c,h,W)},tt=(c,h,W)=>{const K=It(c,h,W,q,Y);X(c,h,K)},st=c=>{Qt(c,oe)},rt=()=>{Zt(Je,Ke,Ce,we,ce,i,q,Y,X,ne)},nt=(c,h)=>{es(c,h,ne,ke,Se,de,xe,oe,me,ue)},Pe=c=>{c&&(c.preventDefault(),c.stopPropagation()),ge(h=>!h)},ot=c=>{pe(c),ge(!1),N(c.generatedImages||[]),P(null),I(1)},at=c=>{c&&(c.preventDefault(),c.stopPropagation()),pe(null)};w.useEffect(()=>{if(!t||t.length===0)return;const c={...p},h=t.map(K=>K.id.toString());Object.keys(c).forEach(K=>{h.includes(K)||delete c[K]}),t.forEach(K=>{const Z=K.id.toString();c[Z]||(c[Z]={})}),JSON.stringify(c)!==JSON.stringify(p)&&S(c)},[t,p]),w.useEffect(()=>{fe({type:"SET_SCREEN_STATE",payload:{currentScreen:l,isProcessing:m,isCompleted:x}})},[l,m,x,fe]),w.useEffect(()=>{const c=document.createElement("style");return c.textContent=Mt,document.head.appendChild(c),()=>{document.head.removeChild(c)}},[]),w.useEffect(()=>{const c=h=>{if(Object.values(O).some(W=>W)){const W=h.target,K=!!W.closest(".dropdown-menu"),Z=!!W.closest("[data-dropdown]");!K&&!Z&&G({})}};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[O]),w.useEffect(()=>{r&&(JSON.parse(localStorage.getItem(re)||"{}").task_id||d(ie()))},[r]),w.useEffect(()=>{if(r){ae(!0);try{const c=localStorage.getItem(re);if(c){const h=JSON.parse(c);if(!t||t.length===0){console.log("Not restoring parameter debug state: no nodes selected"),ae(!1);return}h.currentScreen!==void 0&&a(h.currentScreen),h.selectedParams&&n(h.selectedParams),h.task_id&&d(h.task_id);const W=h.generatedImages&&h.generatedImages.length>0;h.isProcessing!==void 0&&!h.isProcessing&&u(!1),h.isCompleted!==void 0&&W&&g(h.isCompleted),h.completedCount!==void 0&&b(h.completedCount),h.totalCount!==void 0&&k(h.totalCount),h.selectedImageIndex!==void 0&&P(h.selectedImageIndex),h.generatedImages&&N(h.generatedImages),h.paramTestValues&&S(h.paramTestValues),h.searchTerms&&E(h.searchTerms),h.inputValues&&v(h.inputValues),h.currentPage!==void 0&&I(h.currentPage),h.textInputs&&Y(h.textInputs)}}catch(c){console.error("Error loading parameter debug state:",c)}finally{setTimeout(()=>{ae(!1)},50)}}else ae(!0);return()=>{if(!r)return;We({currentScreen:l,selectedParams:o,task_id:i,isProcessing:m,isCompleted:x,completedCount:f,totalCount:L,selectedImageIndex:M,generatedImages:y,paramTestValues:p,searchTerms:j,inputValues:R,currentPage:T,textInputs:q})}},[r]);const lt=(c=!1)=>{ts(a,n,d,ye,u,g,b,k,P,N,S,G,E,v,I,z,F,D,H,J,Y,ne,de,xe,me,ke,Se,ue,oe,c),ge(!1),pe(null)};w.useEffect(()=>{if(!r)return;const c=setTimeout(()=>{We({currentScreen:l,selectedParams:o,task_id:i,isProcessing:m,isCompleted:x,completedCount:f,totalCount:L,selectedImageIndex:M,generatedImages:y,paramTestValues:p,searchTerms:j,inputValues:R,currentPage:T,textInputs:q})},500);return()=>clearTimeout(c)},[r,l,o,i,m,x,f,L,M,y,p,j,R,T,q]);const Ee=c=>{Ft(l,a,o,p,S,q,t,k,z,je,c)},be=c=>{Ht(l,a,t,p,S,q,x,g,z,c)},it=(c,h)=>{Bt(c,o,n,p,S,h)},ct=(c,h,W)=>{Ot(c,h,W,O,G)},X=(c,h,W)=>{Dt(c,h,W,p,S)},dt=(c,h,W,K)=>{At(c,h,W,p,S,K)},xt=(c,h,W)=>{Wt(c,h,W,j,E)},mt=(c,h,W)=>{Tt(c,h,W,p,X)},_e=(c,h)=>{Ut(c,_,y,I,h)},ye=()=>{He(Me,$e)};w.useEffect(()=>()=>{ye()},[]);const ut=async(c,h)=>{Yt(p,i,u,b,z,N,g,I,$e,Me,je,V,c,h)},Ie=(c,h)=>{ss(c,P,h)},Oe=(c,h,W)=>{Rt(c,h,t,H,J,D,W)},ee=c=>{zt(D,c)},ht=async c=>{rs(M,y,V,i,p,F,c)},Q=(c,h)=>{ns(l,t,h,fe,s,lt,c)},le=()=>e.jsx(e.Fragment,{children:e.jsx(te,{visible:$,imageUrl:A,params:U||{},onClose:ee})});return Le?e.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4",onClick:c=>c.stopPropagation(),children:e.jsx(Lt,{historyItem:Le,selectedImageIndex:M,handleSelectImage:Ie,handleClose:at,currentPage:T,handlePageChange:_e,imagesPerPage:_,modalVisible:$,modalImageUrl:A,modalImageParams:U,openImageModal:Oe,closeImageModal:ee})}):he?e.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:e.jsx(Ct,{historyItems:Ve,onViewHistoryItem:ot,onClose:Pe})}):Xe&&r&&t.length>0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 bg-gray-50 overflow-y-auto",onClick:c=>c.stopPropagation(),children:[e.jsxs("div",{className:"p-8 rounded-lg shadow-sm relative flex flex-col items-center",children:[e.jsx("div",{className:"w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin"}),e.jsx("div",{className:"mt-4 text-gray-600 text-sm",children:"Loading interface..."})]}),e.jsx(te,{visible:$,imageUrl:A,params:U||{},onClose:ee})]}):!r||t.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 bg-gray-50 overflow-y-auto",onClick:c=>c.stopPropagation(),children:[e.jsxs("div",{className:"max-w-lg p-8 rounded-lg shadow-sm border border-blue-100 relative",children:[e.jsxs("div",{className:"absolute top-3 right-3 flex",children:[e.jsx("button",{className:"text-blue-500 hover:text-blue-700 mr-2",onClick:Pe,title:"Show History",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})})}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:Q,children:e.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"mb-6 text-center",children:[e.jsx("h3",{className:"text-base font-bold text-blue-600 mb-2",children:"GenLab"}),e.jsx("div",{className:"h-1 w-16 bg-blue-500 mx-auto rounded-full mb-4"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-left mb-4",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-800 mb-3",children:"Batch-test parameters & find the best combo in one click."}),e.jsx("div",{className:"h-px w-full bg-gray-200 my-4"})]}),e.jsxs("div",{className:"text-left",children:[e.jsx("h4",{className:"text-base font-medium text-gray-800 mb-4",children:"How to use"}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("p",{className:"text-sm text-gray-700",children:[e.jsx("span",{className:"font-bold",children:"1 - "}),"Click any node(hold Shift to select multiple nodes)"]}),e.jsxs("p",{className:"text-sm text-gray-700",children:[e.jsx("span",{className:"font-bold",children:"2 - "}),"Set parameter ranges and start batch generation."]})]}),e.jsx("div",{className:"h-px w-full bg-gray-200 my-4"}),e.jsx("p",{className:"text-sm text-blue-600 mt-6",children:"Let's select a node to begin!"})]})]})]}),e.jsx(te,{visible:$,imageUrl:A,params:U||{},onClose:ee})]}):x?e.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4",onClick:c=>c.stopPropagation(),children:e.jsx(wt,{generatedImages:y,selectedImageIndex:M,handleSelectImage:Ie,handleApplySelected:ht,handlePrevious:be,handleClose:Q,currentPage:T,handlePageChange:_e,imagesPerPage:_,notificationVisible:C,modalVisible:$,modalImageUrl:A,modalImageParams:U,openImageModal:Oe,closeImageModal:ee})}):m?e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4",onClick:c=>c.stopPropagation(),children:[e.jsx(Nt,{selectedNodes:t,paramTestValues:p,selectedParams:o,totalCount:L,completedCount:f,errorMessage:B,handleClose:Q,setIsProcessing:u,setCurrentScreen:a,cleanupPolling:ye}),e.jsx(le,{})]}):l===0?e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:[e.jsx(yt,{selectedNodes:t,handleParamSelect:it,selectedParams:o,handleNext:Ee,handleClose:Q}),e.jsx(le,{})]}):l===1?e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:[e.jsx(jt,{selectedNodes:t,paramTestValues:p,selectedParams:o,updateParamTestValues:X,toggleDropdown:ct,openDropdowns:O,handleTestValueSelect:dt,searchTerms:j,handleSearch:xt,handleSelectAll:mt,handleNext:Ee,handlePrevious:be,handleClose:Q,inputValues:R,setInputValues:v,textInputs:q,handleTextInputChange:Ze,handleAddTextInput:et,handleRemoveTextInput:tt,openAiWritingModal:nt}),e.jsx(kt,{visible:Ue,aiWritingModalText:ce,setAiWritingModalText:de,aiGeneratedTexts:we,aiSelectedTexts:Ce,aiWritingLoading:Ge,aiWritingError:qe,handleAiWriting:Qe,toggleTextSelection:st,addSelectedTexts:rt,onClose:()=>ne(!1)}),e.jsx(le,{})]}):e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:[e.jsx(vt,{selectedNodes:t,paramTestValues:p,selectedParams:o,totalCount:L,errorMessage:B,handlePrevious:be,handleStartGeneration:ut,handleClose:Q}),e.jsx(le,{})]})},ms=t=>{const{dispatch:r}=ve(),[s,l]=w.useState(!1);return w.useEffect(()=>{if(t.visible&&!s){const a=$t();a&&a.screenState&&r({type:"SET_SCREEN_STATE",payload:{currentScreen:a.currentScreen,isProcessing:a.isProcessing,isCompleted:a.isCompleted}}),l(!0)}},[t.visible,s,r]),w.useEffect(()=>()=>{t.visible||r({type:"SET_SCREEN_STATE",payload:null})},[t.visible,r]),e.jsx(os,{...t})};export{ms as ParameterDebugInterface}; +`,re="parameter_debug_state",We=t=>{try{localStorage.setItem(re,JSON.stringify(t))}catch(r){console.error("Error saving parameter debug state:",r)}},$t=()=>{try{const t=localStorage.getItem(re);if(t)return JSON.parse(t)}catch(t){console.error("Error loading parameter debug state:",t)}return null},Pt=()=>{try{localStorage.removeItem(re)}catch(t){console.error("Error clearing parameter debug state:",t)}},Et=(t,r,s,l,a,o)=>{const n=`${t}_${r}`;o(d=>{const m=[...d[n]||[]];return m[s]=l,{...d,[n]:m}});const i=[...a[n]||[]];return i[s]=l,i},_t=(t,r,s,l)=>{const a=`${t}_${r}`;return l(o=>{const n=[...o[a]||[]];return n.push(""),{...o,[a]:n}}),[...s[a]||[],""]},It=(t,r,s,l,a)=>{const o=`${t}_${r}`;a(i=>{const d=[...i[o]||[]];return d.splice(s,1),{...i,[o]:d}});const n=[...l[o]||[]];return n.splice(s,1),n},Ot=(t,r,s,l,a)=>{s.preventDefault(),s.stopPropagation();const o=`${t}_${r}`;a(n=>{if(n[o]&&typeof n[o]=="object"?n[o].isOpen:!!n[o])return{...n,[o]:!1};{let d=0,m=0;if(s.currentTarget){const g=s.currentTarget.getBoundingClientRect();d=g.left,m=g.bottom}else d=s.clientX,m=s.clientY+20;const u=window.innerWidth,x=250;return d+x>u&&(d=u-x-10),d<0&&(d=10),{...n,[o]:{isOpen:!0,x:d,y:m}}}})},Dt=(t,r,s,l,a)=>{a(o=>{const n={...o};return n[t]||(n[t]={}),n[t][r]=s,n})},At=(t,r,s,l,a,o)=>{o&&(o.preventDefault(),o.stopPropagation()),a(n=>{const i={...n};i[t]||(i[t]={}),i[t][r]||(i[t][r]=[]);const d=i[t][r];return d.includes(s)?i[t][r]=d.filter(m=>m!==s):i[t][r]=[...d,s],i})},Wt=(t,r,s,l,a)=>{const o=`${t}_${r}`;a(n=>({...n,[o]:s}))},Tt=(t,r,s,l,a)=>{if(!l[t]){a(t,r,s);return}const o=l[t][r]||[];s.length===o.length?a(t,r,[]):a(t,r,[...s])},Bt=(t,r,s,l,a,o)=>{o&&(o.preventDefault(),o.stopPropagation());const n=r[t];if(s(i=>({...i,[t]:!n})),n){const i={...l};Object.keys(i).forEach(d=>{i[d][t]&&delete i[d][t]}),a(i)}},Rt=(t,r,s,l,a,o,n)=>{n.preventDefault(),n.stopPropagation();const i={...r};if(r.nodeParams){const d={};Object.keys(r.nodeParams).forEach(m=>{const u=s.find(x=>x.id.toString()===m);d[m]=u?u.title||`Node ${m}`:`Node ${m}`}),i.nodeNames=d}else if(Object.keys(r).length>0){const d={};Object.entries(r).forEach(([m,u])=>{(typeof u!="object"||u===null)&&(d[m]=u)}),Object.keys(d).length>0&&(i.nodeParams={default:d},i.nodeNames={default:r.node_name||r.nodeName||"参数"})}l(t),a(i),o(!0)},zt=(t,r)=>{r&&(r.preventDefault(),r.stopPropagation()),t(!1)},Ft=(t,r,s,l,a,o,n,i,d,m,u)=>{if(u&&(u.preventDefault(),u.stopPropagation()),t===0){const x={...l};Object.keys(x).forEach(g=>{const f=x[g];Object.keys(f).forEach(b=>{s[b]||delete f[b]})}),a(x)}if(t===1){const x={...l};n.forEach(f=>{const b=f.id.toString(),$=f.widgets||{};Object.values($).forEach(k=>{const L=k.name;if(s[L]&&(k.type==="customtext"||k.type.toLowerCase().includes("text"))){const P=`${b}_${L}`,y=o[P]||[""];x[b]=x[b]||{},x[b][L]=y}})}),a(x);const g=m(x);i(g.length)}d(null),r(x=>Math.min(x+1,2))},Ht=(t,r,s,l,a,o,n,i,d,m)=>{if(m&&(m.preventDefault(),m.stopPropagation()),d(null),n&&i(!1),t===1){const u=s.map(f=>f.id.toString()),x=Object.keys(l),g={...l};x.forEach(f=>{u.includes(f)||delete g[f]}),a(g)}if(t===2||n){const u={...l};Object.entries(o).forEach(([x,g])=>{if(!g||g.length===0)return;const[f,b]=x.split("_");s.some($=>$.id.toString()===f)&&(u[f]=u[f]||{},JSON.stringify(u[f][b])!==JSON.stringify(g)&&(u[f][b]=g))}),a(u)}r(u=>Math.max(u-1,0))},Ut=(t,r,s,l,a)=>{a&&(a.preventDefault(),a.stopPropagation()),l(Math.max(1,Math.min(t,Math.ceil(s.length/r))))};function Gt(t,r){try{if(!t)return console.error("Invalid prompt_output: ",t),t;for(const s of r){if(!t[s.nodeId]){console.error(`Node with ID ${s.nodeId} not found`);continue}if(!t[s.nodeId].inputs){console.error(`Inputs not found for node with ID ${s.nodeId}`);continue}t[s.nodeId].inputs[s.paramName]=s.paramValue}return t}catch(s){return console.error("Error updating prompt:",s),t}}async function Jt(t){const r=await V.graphToPrompt(),s=Gt(r.output,t);console.log("queuePrompt updated_prompt:",s);const l={prompt:s,client_id:V.api.clientId,extra_data:{extra_pageinfo:{workflow:r.workflow}}};console.debug("queuePrompt request_body.prompt:",s);const a=await ft(l);return console.debug("queuePrompt response:",a),a}function Te(t){const r=document.createElement("canvas"),s=r.getContext("2d");if(r.width=512,r.height=512,s){s.fillStyle="#f8d7da",s.fillRect(0,0,r.width,r.height),s.strokeStyle="#dc3545",s.lineWidth=4,s.strokeRect(10,10,r.width-20,r.height-20),s.fillStyle="#dc3545",s.beginPath(),s.arc(r.width/2,150,50,0,2*Math.PI),s.fill(),s.fillStyle="white",s.font="bold 80px Arial",s.textAlign="center",s.textBaseline="middle",s.fillText("!",r.width/2,150),s.fillStyle="#721c24",s.font="20px Arial",s.textAlign="center",s.textBaseline="middle";const l=r.width-60,a=30,o=t.split(" ");let n="",i=250;for(let d=0;dl&&d>0?(s.fillText(n,r.width/2,i),n=o[d]+" ",i+=a):n=m}s.fillText(n,r.width/2,i)}return r.toDataURL("image/png")}async function Kt(t){try{if(!t||t==="")return console.log("No prompt ID provided"),{1:[Te("Fail to generate prompt ID")]};const r=await bt(t);if(!r||!r[t])return console.log("Not finished for prompt ID:",t),{};const s=r[t];if(s.status&&s.status.status_str==="error"){console.error("Error for prompt ID:",t);const a=s.status.messages;if(a&&a.length>0){const o=a[a.length-1];if(o&&o.length>0){const n=o[0];return{1:[Te(n)]}}}}const l={};if(s.outputs)for(const a in s.outputs){const o=s.outputs[a];if(o&&o.images){l[a]=[];for(const n of o.images)if(n&&n.filename&&n.type){const i=V.graph._nodes_by_id[a].imgs[0].currentSrc.split("?")[0];l[a].push(i+"?filename="+encodeURIComponent(n.filename)+"&type="+encodeURIComponent(n.type)+(n.subfolder?"&subfolder="+encodeURIComponent(n.subfolder):""))}console.log("outputImages for nodeId:",a,l[a])}}return l}catch(r){throw console.error("Error getting output images from prompt:",r),r}}function qt(){const t=Object.values(V.graph._nodes_by_id),r=[],s=[];for(const l of t)l.type==="SaveImage"?r.push(l.id):l.type==="PreviewImage"&&s.push(l.id);if(console.log("saveNodeIds:",r),console.log("previewNodeIds:",s),r.length===0&&s.length===0)throw new Error("No SaveImage or PreviewImage node found, please add one to the graph");return r.length===1?r[0]:r.length==0&&s.length===1?s[0]:null}async function Vt(t,r){const s=await Kt(t);return Object.keys(s).length===0?null:s[r.toString()]&&s[r.toString()].length>0?s[r.toString()][0]:null}const Yt=async(t,r,s,l,a,o,n,i,d,m,u,x,g,f)=>{g&&(g.preventDefault(),g.stopPropagation()),He(m,d);const b=u(t),$=b.length;if($>100){a(`Cannot generate more than 100 images at once (currently: ${$} images)`);return}a(null),s(!0),l(0),console.log("Generated parameter combinations:",b);let k=null;try{k=(await x.graphToPrompt()).output}catch(N){console.error("Error capturing workflow data:",N)}if(se.trackEvent({event_type:"start_generation",message_type:"parameter_debug",message_id:r,data:{workflow:k,all_params:t,count:$}}),b.length===0){a("No valid parameter combinations found. Please check your parameter selections."),s(!1);return}let L=f||null;if(L===null){const N=qt();N!==null&&(L=N)}if(L===null){a("Please select a SaveImage or PreviewImage node first."),s(!1);return}const P={};Object.keys(t).forEach(N=>{const p=x.graph._nodes_by_id[N];p&&(P[N]=p.type||p.comfyClass||"Unknown Node")});const y=[];try{const N=Date.now().toString();d.current=N;for(const E of b){const R=await Jt(E);R.prompt_id?y.push(R.prompt_id):(console.error("Failed to get prompt_id from response:",R),y.push(""))}const p=Array(b.length).fill(null).map((E,R)=>({url:`https://source.unsplash.com/random/300x300?sig=${Math.random()}`,params:St(t,R)}));o(p);const S=Date.now(),O=5*60*1e3,G=Object.keys(t)[0],j=P[G]||"Unknown Node";Fe(y,L,p,N,S,O,d,m,o,l,s,n,i,j,t,$,k,P)}catch(N){console.error("Error generating images:",N),s(!1)}},Fe=async(t,r,s,l,a,o,n,i,d,m,u,x,g,f,b,$,k,L)=>{if(n.current!==l){console.log("Another polling session has started, stopping this one");return}if(Date.now()-a>o){if(console.log("Timeout reached while waiting for images"),n.current===l&&(u(!1),x(!0),g(1),s.length>0&&f&&b)){const y=s[0].params;L&&(y.selectedNodeInfoMap=L),Ae(f,y,s,$||s.length,k)}return}let P=0;for(let y=0;y0&&f&&b)){const y=s[0].params;L&&(y.selectedNodeInfoMap=L),Ae(f,y,s,$||s.length,k)}return}n.current===l&&(i.current=setTimeout(()=>{Fe(t,r,s,l,a,o,n,i,d,m,u,x,g,f,b,$,k,L)},2e3))},He=(t,r)=>{t.current&&(clearTimeout(t.current),t.current=null),r.current=null},Xt=async(t,r,s,l,a,o)=>{if(!t.trim()){l("Please enter some text to generate variations");return}s(!0),l(null),a([]),o({});try{const n=await se.generateSDPrompts(t);a(n),se.trackEvent({event_type:"prompt_generate",message_type:"parameter_debug",message_id:r,data:{input_text:t,generated_texts:n}});const i={};n.forEach((d,m)=>{i[`text${m+1}`]=!1}),o(i)}catch(n){console.error("Error generating text:",n),l("Failed to generate text variations. Please try again.")}finally{s(!1)}},Qt=(t,r)=>{r(s=>({...s,[t]:!s[t]}))},Zt=(t,r,s,l,a,o,n,i,d,m)=>{const u=`${t}_${r}`,x=Object.entries(s).filter(([f,b])=>b).map(([f])=>{const b=parseInt(f.replace("text",""))-1;return l[b]});if(x.length===0)return;i(f=>{const b=[...f[u]||[]];return{...f,[u]:[...b,...x]}}),se.trackEvent({event_type:"prompt_apply",message_type:"parameter_debug",message_id:o,data:{input_text:a,generated_texts:l,selected_texts:x}});const g=[...n[u]||[],...x];d(t,r,g),m(!1)},es=(t,r,s,l,a,o,n,i,d,m)=>{s(!0),l(t),a(r),o(""),n([]),i({}),d(!1),m(null)},ts=(t,r,s,l,a,o,n,i,d,m,u,x,g,f,b,$,k,L,P,y,N,p,S,O,G,j,E,R,v,T=!1)=>{t(0),r({Steps:!0,CFG:!0,sampler_name:!0,threshold:!1,prompt:!1}),s(ie()),l(),a(!1),o(!1),n(0),i(12),d(null),m(Array(12).fill(null).map((I,_)=>({url:`https://source.unsplash.com/random/300x300?sig=${Math.random()}`,params:{step:_%3===0?5:_%3===1?10:15,sampler_name:"euler",cfg:1}}))),u({}),x({}),g({}),f({}),b(1),$(null),k(!1),L(!1),P(""),y(null),N({}),p(!1),S(""),O([]),G(!1),j(""),E(""),R(null),v({}),T&&Pt()},ss=(t,r,s)=>{s&&(s.preventDefault(),s.stopPropagation()),r(t)},rs=async(t,r,s,l,a,o,n)=>{if(n&&(n.preventDefault(),n.stopPropagation()),t!==null){console.log(`Applied image ${t+1} with parameters:`,r[t].params);let i=1;if(a){for(const m in a)if(a[m])for(const u in a[m]){const x=a[m][u];if(x){let g=1;Array.isArray(x)?g=x.length>0?x.length:1:typeof x=="object"&&x!==null&&(g=Object.keys(x).length>0?Object.keys(x).length:1),i=i*g}}}se.trackEvent({event_type:"parameter_debug_apply",message_type:"parameter_debug",message_id:l,data:{workflow:(await s.graphToPrompt()).output,selected_params:r[t].params,all_params:a,count:i}});const d=r[t].params;d.nodeParams&&(Object.entries(d.nodeParams).forEach(([m,u])=>{const x=s.graph._nodes_by_id[m];!x||!x.widgets||Object.entries(u).forEach(([g,f])=>{for(const b of x.widgets)if(b.name===g){b.value=f;break}})}),s.graph.setDirtyCanvas(!1,!0),o(!0),setTimeout(()=>{o(!1)},3e3))}},ns=(t,r,s,l,a,o,n)=>{if(n&&(n.preventDefault(),n.stopPropagation()),t===1&&s!==void 0){const i=[...r];i[s],i.splice(s,1),i.length===0?a&&(l({type:"SET_SCREEN_STATE",payload:null}),o(!0),a()):l({type:"SET_SELECTED_NODE",payload:i});return}a&&(l({type:"SET_SCREEN_STATE",payload:null}),o(!0),a())},os=({selectedNodes:t,visible:r,onClose:s})=>{const[l,a]=w.useState(0),[o,n]=w.useState({Steps:!0,CFG:!0,sampler_name:!0,threshold:!1,prompt:!1}),[i,d]=w.useState(ie()),[m,u]=w.useState(!1),[x,g]=w.useState(!1),[f,b]=w.useState(0),[$,k]=w.useState(12),[L,P]=w.useState(null),[y,N]=w.useState(()=>Array(12).fill(null).map((c,h)=>({url:`https://source.unsplash.com/random/300x300?sig=${Math.random()}`,params:{step:h%3===0?5:h%3===1?10:15,sampler_name:"euler",cfg:1}}))),[p,S]=w.useState({}),[O,G]=w.useState({}),[j,E]=w.useState({}),[R,v]=w.useState({}),[T,I]=w.useState(1),_=6,[B,z]=w.useState(null),[C,F]=w.useState(!1),[M,D]=w.useState(!1),[A,H]=w.useState(""),[U,J]=w.useState(null),[q,Y]=w.useState({}),[Ue,ne]=w.useState(!1),[ce,de]=w.useState(""),[we,xe]=w.useState([]),[Ge,me]=w.useState(!1),[Je,ke]=w.useState(""),[Ke,Se]=w.useState(""),[qe,ue]=w.useState(null),[Ce,oe]=w.useState({}),[he,ge]=w.useState(!1),[Ve,Ye]=w.useState([]),[Le,pe]=w.useState(null),{dispatch:fe}=ve(),Me=w.useRef(null),$e=w.useRef(null),[Xe,ae]=w.useState(()=>r);w.useEffect(()=>{if(he){const c=Re();Ye(c)}},[he]);const Qe=async()=>{Xt(ce,i,me,ue,xe,oe)},Ze=(c,h,W,K)=>{const Z=Et(c,h,W,K,q,Y);X(c,h,Z)},et=(c,h)=>{const W=_t(c,h,q,Y);X(c,h,W)},tt=(c,h,W)=>{const K=It(c,h,W,q,Y);X(c,h,K)},st=c=>{Qt(c,oe)},rt=()=>{Zt(Je,Ke,Ce,we,ce,i,q,Y,X,ne)},nt=(c,h)=>{es(c,h,ne,ke,Se,de,xe,oe,me,ue)},Pe=c=>{c&&(c.preventDefault(),c.stopPropagation()),ge(h=>!h)},ot=c=>{pe(c),ge(!1),N(c.generatedImages||[]),P(null),I(1)},at=c=>{c&&(c.preventDefault(),c.stopPropagation()),pe(null)};w.useEffect(()=>{if(!t||t.length===0)return;const c={...p},h=t.map(K=>K.id.toString());Object.keys(c).forEach(K=>{h.includes(K)||delete c[K]}),t.forEach(K=>{const Z=K.id.toString();c[Z]||(c[Z]={})}),JSON.stringify(c)!==JSON.stringify(p)&&S(c)},[t,p]),w.useEffect(()=>{fe({type:"SET_SCREEN_STATE",payload:{currentScreen:l,isProcessing:m,isCompleted:x}})},[l,m,x,fe]),w.useEffect(()=>{const c=document.createElement("style");return c.textContent=Mt,document.head.appendChild(c),()=>{document.head.removeChild(c)}},[]),w.useEffect(()=>{const c=h=>{if(Object.values(O).some(W=>W)){const W=h.target,K=!!W.closest(".dropdown-menu"),Z=!!W.closest("[data-dropdown]");!K&&!Z&&G({})}};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[O]),w.useEffect(()=>{r&&(JSON.parse(localStorage.getItem(re)||"{}").task_id||d(ie()))},[r]),w.useEffect(()=>{if(r){ae(!0);try{const c=localStorage.getItem(re);if(c){const h=JSON.parse(c);if(!t||t.length===0){console.log("Not restoring parameter debug state: no nodes selected"),ae(!1);return}h.currentScreen!==void 0&&a(h.currentScreen),h.selectedParams&&n(h.selectedParams),h.task_id&&d(h.task_id);const W=h.generatedImages&&h.generatedImages.length>0;h.isProcessing!==void 0&&!h.isProcessing&&u(!1),h.isCompleted!==void 0&&W&&g(h.isCompleted),h.completedCount!==void 0&&b(h.completedCount),h.totalCount!==void 0&&k(h.totalCount),h.selectedImageIndex!==void 0&&P(h.selectedImageIndex),h.generatedImages&&N(h.generatedImages),h.paramTestValues&&S(h.paramTestValues),h.searchTerms&&E(h.searchTerms),h.inputValues&&v(h.inputValues),h.currentPage!==void 0&&I(h.currentPage),h.textInputs&&Y(h.textInputs)}}catch(c){console.error("Error loading parameter debug state:",c)}finally{setTimeout(()=>{ae(!1)},50)}}else ae(!0);return()=>{if(!r)return;We({currentScreen:l,selectedParams:o,task_id:i,isProcessing:m,isCompleted:x,completedCount:f,totalCount:$,selectedImageIndex:L,generatedImages:y,paramTestValues:p,searchTerms:j,inputValues:R,currentPage:T,textInputs:q})}},[r]);const lt=(c=!1)=>{ts(a,n,d,ye,u,g,b,k,P,N,S,G,E,v,I,z,F,D,H,J,Y,ne,de,xe,me,ke,Se,ue,oe,c),ge(!1),pe(null)};w.useEffect(()=>{if(!r)return;const c=setTimeout(()=>{We({currentScreen:l,selectedParams:o,task_id:i,isProcessing:m,isCompleted:x,completedCount:f,totalCount:$,selectedImageIndex:L,generatedImages:y,paramTestValues:p,searchTerms:j,inputValues:R,currentPage:T,textInputs:q})},500);return()=>clearTimeout(c)},[r,l,o,i,m,x,f,$,L,y,p,j,R,T,q]);const Ee=c=>{Ft(l,a,o,p,S,q,t,k,z,je,c)},be=c=>{Ht(l,a,t,p,S,q,x,g,z,c)},it=(c,h)=>{Bt(c,o,n,p,S,h)},ct=(c,h,W)=>{Ot(c,h,W,O,G)},X=(c,h,W)=>{Dt(c,h,W,p,S)},dt=(c,h,W,K)=>{At(c,h,W,p,S,K)},xt=(c,h,W)=>{Wt(c,h,W,j,E)},mt=(c,h,W)=>{Tt(c,h,W,p,X)},_e=(c,h)=>{Ut(c,_,y,I,h)},ye=()=>{He(Me,$e)};w.useEffect(()=>()=>{ye()},[]);const ut=async(c,h)=>{Yt(p,i,u,b,z,N,g,I,$e,Me,je,V,c,h)},Ie=(c,h)=>{ss(c,P,h)},Oe=(c,h,W)=>{Rt(c,h,t,H,J,D,W)},ee=c=>{zt(D,c)},ht=async c=>{rs(L,y,V,i,p,F,c)},Q=(c,h)=>{ns(l,t,h,fe,s,lt,c)},le=()=>e.jsx(e.Fragment,{children:e.jsx(te,{visible:M,imageUrl:A,params:U||{},onClose:ee})});return Le?e.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4",onClick:c=>c.stopPropagation(),children:e.jsx(Lt,{historyItem:Le,selectedImageIndex:L,handleSelectImage:Ie,handleClose:at,currentPage:T,handlePageChange:_e,imagesPerPage:_,modalVisible:M,modalImageUrl:A,modalImageParams:U,openImageModal:Oe,closeImageModal:ee})}):he?e.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:e.jsx(Ct,{historyItems:Ve,onViewHistoryItem:ot,onClose:Pe})}):Xe&&r&&t.length>0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 bg-gray-50 overflow-y-auto",onClick:c=>c.stopPropagation(),children:[e.jsxs("div",{className:"p-8 rounded-lg shadow-sm relative flex flex-col items-center",children:[e.jsx("div",{className:"w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin"}),e.jsx("div",{className:"mt-4 text-gray-600 text-sm",children:"Loading interface..."})]}),e.jsx(te,{visible:M,imageUrl:A,params:U||{},onClose:ee})]}):!r||t.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 bg-gray-50 overflow-y-auto",onClick:c=>c.stopPropagation(),children:[e.jsxs("div",{className:"max-w-lg p-8 rounded-lg shadow-sm border border-blue-100 relative",children:[e.jsxs("div",{className:"absolute top-3 right-3 flex",children:[e.jsx("button",{className:"text-blue-500 hover:text-blue-700 mr-2",onClick:Pe,title:"Show History",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})})}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:Q,children:e.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"mb-6 text-center",children:[e.jsx("h3",{className:"text-base font-bold text-blue-600 mb-2",children:"GenLab"}),e.jsx("div",{className:"h-1 w-16 bg-blue-500 mx-auto rounded-full mb-4"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-left mb-4",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-800 mb-3",children:"Batch-test parameters & find the best combo in one click."}),e.jsx("div",{className:"h-px w-full bg-gray-200 my-4"})]}),e.jsxs("div",{className:"text-left",children:[e.jsx("h4",{className:"text-base font-medium text-gray-800 mb-4",children:"How to use"}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("p",{className:"text-sm text-gray-700",children:[e.jsx("span",{className:"font-bold",children:"1 - "}),"Click any node(hold Shift to select multiple nodes)"]}),e.jsxs("p",{className:"text-sm text-gray-700",children:[e.jsx("span",{className:"font-bold",children:"2 - "}),"Set parameter ranges and start batch generation."]})]}),e.jsx("div",{className:"h-px w-full bg-gray-200 my-4"}),e.jsx("p",{className:"text-sm text-blue-600 mt-6",children:"Let's select a node to begin!"})]})]})]}),e.jsx(te,{visible:M,imageUrl:A,params:U||{},onClose:ee})]}):x?e.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4",onClick:c=>c.stopPropagation(),children:e.jsx(wt,{generatedImages:y,selectedImageIndex:L,handleSelectImage:Ie,handleApplySelected:ht,handlePrevious:be,handleClose:Q,currentPage:T,handlePageChange:_e,imagesPerPage:_,notificationVisible:C,modalVisible:M,modalImageUrl:A,modalImageParams:U,openImageModal:Oe,closeImageModal:ee})}):m?e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4",onClick:c=>c.stopPropagation(),children:[e.jsx(Nt,{selectedNodes:t,paramTestValues:p,selectedParams:o,totalCount:$,completedCount:f,errorMessage:B,handleClose:Q,setIsProcessing:u,setCurrentScreen:a,cleanupPolling:ye}),e.jsx(le,{})]}):l===0?e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:[e.jsx(yt,{selectedNodes:t,handleParamSelect:it,selectedParams:o,handleNext:Ee,handleClose:Q}),e.jsx(le,{})]}):l===1?e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:[e.jsx(jt,{selectedNodes:t,paramTestValues:p,selectedParams:o,updateParamTestValues:X,toggleDropdown:ct,openDropdowns:O,handleTestValueSelect:dt,searchTerms:j,handleSearch:xt,handleSelectAll:mt,handleNext:Ee,handlePrevious:be,handleClose:Q,inputValues:R,setInputValues:v,textInputs:q,handleTextInputChange:Ze,handleAddTextInput:et,handleRemoveTextInput:tt,openAiWritingModal:nt}),e.jsx(kt,{visible:Ue,aiWritingModalText:ce,setAiWritingModalText:de,aiGeneratedTexts:we,aiSelectedTexts:Ce,aiWritingLoading:Ge,aiWritingError:qe,handleAiWriting:Qe,toggleTextSelection:st,addSelectedTexts:rt,onClose:()=>ne(!1)}),e.jsx(le,{})]}):e.jsxs("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-4 flex flex-col h-full max-h-[80vh]",onClick:c=>c.stopPropagation(),children:[e.jsx(vt,{selectedNodes:t,paramTestValues:p,selectedParams:o,totalCount:$,errorMessage:B,handlePrevious:be,handleStartGeneration:ut,handleClose:Q}),e.jsx(le,{})]})},ms=t=>{const{dispatch:r}=ve(),[s,l]=w.useState(!1);return w.useEffect(()=>{if(t.visible&&!s){const a=$t();a&&a.screenState&&r({type:"SET_SCREEN_STATE",payload:{currentScreen:a.currentScreen,isProcessing:a.isProcessing,isCompleted:a.isCompleted}}),l(!0)}},[t.visible,s,r]),w.useEffect(()=>()=>{t.visible||r({type:"SET_SCREEN_STATE",payload:null})},[t.visible,r]),e.jsx(os,{...t})};export{ms as ParameterDebugInterface}; diff --git a/dist/copilot_web/input.js b/dist/copilot_web/input.js index 64d9ea1..27fd6b8 100644 --- a/dist/copilot_web/input.js +++ b/dist/copilot_web/input.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-DpjTOvew.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DetBDgrq.js","copilot_web/fonts.css"])))=>i.map(i=>d[i]); -import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-DetBDgrq.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import("./App-DpjTOvew.js");return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-CD8cpUyz.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DetBDgrq.js","copilot_web/fonts.css"])))=>i.map(i=>d[i]); +import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-DetBDgrq.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import("./App-CD8cpUyz.js");return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; diff --git a/dist/copilot_web/workflowChat-C7S5e-Fc.js b/dist/copilot_web/workflowChat-Bg7hphV8.js similarity index 99% rename from dist/copilot_web/workflowChat-C7S5e-Fc.js rename to dist/copilot_web/workflowChat-Bg7hphV8.js index d2b4d95..bb923bc 100644 --- a/dist/copilot_web/workflowChat-C7S5e-Fc.js +++ b/dist/copilot_web/workflowChat-Bg7hphV8.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-EBexRuvI.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DetBDgrq.js","copilot_web/ParameterDebugInterfaceV2-BOLAAraS.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-EBexRuvI.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DetBDgrq.js","copilot_web/ParameterDebugInterfaceV2-CkhASy27.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"])))=>i.map(i=>d[i]); import{_ as Ot}from"./input.js";import{j as h,r as yg,b as wg}from"./vendor-markdown-Dek94WS0.js";import{r as L,R as wn,c as Tt}from"./vendor-react-V04_Axys.js";import{f as bg,v as Sg,a as fn,B as Ag,U as Eg,A as Er,b as Ig,g as en,c as Mt,u as ru,M as Cg,W as Rt}from"./message-components-DetBDgrq.js";/** * @license lucide-react v0.475.0 - ISC * @@ -126,4 +126,4 @@ __p += '`),z&&(v+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+v+`return __p -}`;var W=Ta(function(){return Y(s,S+"return "+v).apply(a,o)});if(W.source=v,zi(W))throw W;return W}function C0(e){return J(e).toLowerCase()}function N0(e){return J(e).toUpperCase()}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return Uu(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),s=Fu(r,i),o=ju(r,i)+1;return On(r,s,o).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Ku(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=ju(r,tn(n))+1;return On(r,0,i).join("")}function R0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fu(r,tn(n));return On(r,i).join("")}function O0(e,n){var t=bn,r=Cr;if(ae(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var s=e.length;if(Qn(e)){var o=tn(e);s=o.length}if(t>=s)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(au.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function M0(e){return e=J(e),e&&Ga.test(e)?e.replace(iu,al):e}var D0=st(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Rs("toUpperCase");function La(e,n,t){return e=J(e),n=t?a:n,n===a?tl(e)?fl(e):qo(e):e.match(n)||[]}var Ta=U(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),P0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function k0(e){var n=e==null?0:e.length,t=I();return e=n?ue(e,function(r){if(typeof r[1]!="function")throw new Ze(B);return[t(r[0]),r[1]]}):[],U(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ee(e,ze);n=I(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=u[r?"take"+(n=="last"?"Right":""):n],s=r||/^find/.test(n);i&&(u.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(u,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,C=s&&!x,W=c&&!S;if(!s&&_){o=W?o:new K(this);var N=e.apply(o,l);return N.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(N,x)}return C&&W?e.apply(this,l):(N=this.thru(v),C?r?N.value()[0]:N.value():N)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);u.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var s=this.value();return n.apply(O(s)?s:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=u[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,oe).name]=[{name:"wrapper",func:a}],K.prototype.clone=Ol,K.prototype.reverse=Ml,K.prototype.value=Dl,u.prototype.at=fh,u.prototype.chain=ch,u.prototype.commit=hh,u.prototype.next=dh,u.prototype.plant=ph,u.prototype.reverse=_h,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=vh,u.prototype.first=u.prototype.head,_t&&(u.prototype[_t]=gh),u},et=cl();kn?((kn.exports=et)._=et,Jr._=et):we._=et}).call(Tt)})(Ir,Ir.exports);var ka=Ir.exports;function ip(m=!0){L.useEffect(()=>{if(!m)return;const b=ka.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function up(m=!0){const{state:b,dispatch:a}=ru(),{activeTab:F,screenState:M}=b;L.useEffect(()=>{if(!m)return;const E=B=>{const te=F==="parameter-debug",y=F==="chat",q=!M||M.currentScreen===0;if(y||q&&te){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,F,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Cg,{rehypePlugins:[[yg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[wg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...F})=>h.jsx("a",{...F,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,ap=()=>{const{state:m,dispatch:b}=ru(),{selectedNode:a,screenState:F}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import("./ParameterDebugInterfaceV2-BOLAAraS.js"),__vite__mapDeps([4,1,2,3,5,6,7])).then(te=>({default:te.ParameterDebugInterface}))),B=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:B})})})},Da=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function op({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:F}){const{state:M,dispatch:E}=ru(),{messages:B,installedNodes:te,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,ve=L.useRef(null),[re,ge]=L.useState(""),[T,k]=L.useState(""),[oe,ce]=L.useState(window.innerWidth/3),[se,Pe]=L.useState(!1),[le,H]=L.useState([]),[Z,Se]=L.useState("gpt-4o-mini");L.useState(window.innerHeight),L.useState(0);const[pe,bn]=L.useState(""),[Cr,Dt]=L.useState(!1);ip(b&&P==="chat"),up(b),L.useEffect(()=>{ve.current&&(ve.current.scrollTop=ve.current.scrollHeight)},[B]),L.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await rp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await Rt.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};L.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),L.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),L.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),L.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ct=wn.useCallback(A=>{if(!se)return;const j=window.innerWidth-A.clientX,_e=Math.min(Math.max(300,j),window.innerWidth*.8);ce(_e)},[se]),$n=wn.useMemo(()=>ka.debounce(ct,16),[ct]);L.useEffect(()=>(se&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[se,$n]);const Lr=A=>{ge(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),re.trim()===""&&!$||!q)return;k(re);const A=en(),j={id:en(),role:"user",content:re,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),ge("");try{const _e={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of Rt.streamInvokeServer(q,re,le.map(ie=>ie.file),null,_e,A)){const ie={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ie}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ie});const Ae=M.messages.map(We=>We.id===ie.id&&!We.finished?ie:We);qn(Ae)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(_e){console.error("Error sending message:",_e),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),k(A);const j=en(),_e={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:_e});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ie of Rt.streamInvokeServer(q,A,le.map(Ae=>Ae.file),null,V,j)){const Ae={id:$e,role:"ai",content:JSON.stringify(ie),format:ie.format,finished:ie.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ae}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ae});const We=M.messages.map(nn=>nn.id===Ae.id&&!nn.finished?Ae:nn);qn(We)}ie.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{ge(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const _e=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:_e,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ie=!0;for await(const Ae of Rt.streamInvokeServer(q,_e,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ae),format:Ae.format,finished:Ae.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ie)E({type:"ADD_MESSAGE",payload:We}),ie=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ce=>Ce.id===We.id&&!Ce.finished?We:Ce);qn(nn)}Ae.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{Pe(!1)},Zn=A=>{const j=Array.from(A).map(_e=>({id:Math.random().toString(36).substr(2,9),file:_e,preview:URL.createObjectURL(_e)}));H(_e=>[..._e,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{le.forEach(A=>URL.revokeObjectURL(A.preview))},[le]),L.useEffect(()=>{a&&F&&P==="chat"&&(Pt("node_explain"),F())},[a,P]),L.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await Rt.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(ap,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(zg,{onClose:m,onClear:Hn,hasMessages:B.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Da,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Da,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&pe&&P==="chat"&&h.jsx(sp,{message:pe,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:ve,children:h.jsx(np,{messages:B,latestInput:T,onOptionClick:ze,installedNodes:te,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(Zg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx(Hg,{input:re,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:le,onRemoveImage:Or,selectedModel:Z,onModelChange:Se})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const vp=Object.freeze(Object.defineProperty({__proto__:null,default:op},Symbol.toStringTag,{value:"Module"}));export{_p as g,pp as i,gp as m,dp as r,vp as w}; +}`;var W=Ta(function(){return Y(s,S+"return "+v).apply(a,o)});if(W.source=v,zi(W))throw W;return W}function C0(e){return J(e).toLowerCase()}function N0(e){return J(e).toUpperCase()}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return Uu(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),s=Fu(r,i),o=ju(r,i)+1;return On(r,s,o).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Ku(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=ju(r,tn(n))+1;return On(r,0,i).join("")}function R0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fu(r,tn(n));return On(r,i).join("")}function O0(e,n){var t=bn,r=Cr;if(ae(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var s=e.length;if(Qn(e)){var o=tn(e);s=o.length}if(t>=s)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(au.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function M0(e){return e=J(e),e&&Ga.test(e)?e.replace(iu,al):e}var D0=st(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Rs("toUpperCase");function La(e,n,t){return e=J(e),n=t?a:n,n===a?tl(e)?fl(e):qo(e):e.match(n)||[]}var Ta=U(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),P0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function k0(e){var n=e==null?0:e.length,t=I();return e=n?ue(e,function(r){if(typeof r[1]!="function")throw new Ze(B);return[t(r[0]),r[1]]}):[],U(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ee(e,ze);n=I(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=u[r?"take"+(n=="last"?"Right":""):n],s=r||/^find/.test(n);i&&(u.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(u,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,C=s&&!x,W=c&&!S;if(!s&&_){o=W?o:new K(this);var N=e.apply(o,l);return N.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(N,x)}return C&&W?e.apply(this,l):(N=this.thru(v),C?r?N.value()[0]:N.value():N)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);u.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var s=this.value();return n.apply(O(s)?s:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=u[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,oe).name]=[{name:"wrapper",func:a}],K.prototype.clone=Ol,K.prototype.reverse=Ml,K.prototype.value=Dl,u.prototype.at=fh,u.prototype.chain=ch,u.prototype.commit=hh,u.prototype.next=dh,u.prototype.plant=ph,u.prototype.reverse=_h,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=vh,u.prototype.first=u.prototype.head,_t&&(u.prototype[_t]=gh),u},et=cl();kn?((kn.exports=et)._=et,Jr._=et):we._=et}).call(Tt)})(Ir,Ir.exports);var ka=Ir.exports;function ip(m=!0){L.useEffect(()=>{if(!m)return;const b=ka.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function up(m=!0){const{state:b,dispatch:a}=ru(),{activeTab:F,screenState:M}=b;L.useEffect(()=>{if(!m)return;const E=B=>{const te=F==="parameter-debug",y=F==="chat",q=!M||M.currentScreen===0;if(y||q&&te){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,F,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Cg,{rehypePlugins:[[yg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[wg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...F})=>h.jsx("a",{...F,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,ap=()=>{const{state:m,dispatch:b}=ru(),{selectedNode:a,screenState:F}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import("./ParameterDebugInterfaceV2-CkhASy27.js"),__vite__mapDeps([4,1,2,3,5,6,7])).then(te=>({default:te.ParameterDebugInterface}))),B=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:B})})})},Da=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function op({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:F}){const{state:M,dispatch:E}=ru(),{messages:B,installedNodes:te,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,ve=L.useRef(null),[re,ge]=L.useState(""),[T,k]=L.useState(""),[oe,ce]=L.useState(window.innerWidth/3),[se,Pe]=L.useState(!1),[le,H]=L.useState([]),[Z,Se]=L.useState("gpt-4o-mini");L.useState(window.innerHeight),L.useState(0);const[pe,bn]=L.useState(""),[Cr,Dt]=L.useState(!1);ip(b&&P==="chat"),up(b),L.useEffect(()=>{ve.current&&(ve.current.scrollTop=ve.current.scrollHeight)},[B]),L.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await rp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await Rt.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};L.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),L.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),L.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),L.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ct=wn.useCallback(A=>{if(!se)return;const j=window.innerWidth-A.clientX,_e=Math.min(Math.max(300,j),window.innerWidth*.8);ce(_e)},[se]),$n=wn.useMemo(()=>ka.debounce(ct,16),[ct]);L.useEffect(()=>(se&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[se,$n]);const Lr=A=>{ge(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),re.trim()===""&&!$||!q)return;k(re);const A=en(),j={id:en(),role:"user",content:re,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),ge("");try{const _e={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of Rt.streamInvokeServer(q,re,le.map(ie=>ie.file),null,_e,A)){const ie={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ie}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ie});const Ae=M.messages.map(We=>We.id===ie.id&&!We.finished?ie:We);qn(Ae)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(_e){console.error("Error sending message:",_e),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),k(A);const j=en(),_e={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:_e});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ie of Rt.streamInvokeServer(q,A,le.map(Ae=>Ae.file),null,V,j)){const Ae={id:$e,role:"ai",content:JSON.stringify(ie),format:ie.format,finished:ie.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ae}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ae});const We=M.messages.map(nn=>nn.id===Ae.id&&!nn.finished?Ae:nn);qn(We)}ie.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{ge(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const _e=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:_e,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ie=!0;for await(const Ae of Rt.streamInvokeServer(q,_e,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ae),format:Ae.format,finished:Ae.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ie)E({type:"ADD_MESSAGE",payload:We}),ie=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ce=>Ce.id===We.id&&!Ce.finished?We:Ce);qn(nn)}Ae.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{Pe(!1)},Zn=A=>{const j=Array.from(A).map(_e=>({id:Math.random().toString(36).substr(2,9),file:_e,preview:URL.createObjectURL(_e)}));H(_e=>[..._e,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{le.forEach(A=>URL.revokeObjectURL(A.preview))},[le]),L.useEffect(()=>{a&&F&&P==="chat"&&(Pt("node_explain"),F())},[a,P]),L.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await Rt.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(ap,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(zg,{onClose:m,onClear:Hn,hasMessages:B.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Da,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Da,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&pe&&P==="chat"&&h.jsx(sp,{message:pe,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:ve,children:h.jsx(np,{messages:B,latestInput:T,onOptionClick:ze,installedNodes:te,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(Zg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx(Hg,{input:re,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:le,onRemoveImage:Or,selectedModel:Z,onModelChange:Se})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const vp=Object.freeze(Object.defineProperty({__proto__:null,default:op},Symbol.toStringTag,{value:"Module"}));export{_p as g,pp as i,gp as m,dp as r,vp as w}; diff --git a/ui/src/components/debug/screens/HistoryItemScreen.tsx b/ui/src/components/debug/screens/HistoryItemScreen.tsx index 902e985..8ec4558 100644 --- a/ui/src/components/debug/screens/HistoryItemScreen.tsx +++ b/ui/src/components/debug/screens/HistoryItemScreen.tsx @@ -66,10 +66,11 @@ export const HistoryItemScreen: React.FC = ({ From c57262c49051572aa301b3e198413134116d9a1b Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Fri, 30 May 2025 16:50:53 +0800 Subject: [PATCH 04/14] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{App-CD8cpUyz.js => App-Bjq6Zxw-.js} | 4 +- ... => ParameterDebugInterfaceV2-xZYi4DyT.js} | 2 +- ...EBexRuvI.js => WorkflowOption-Ci2jcBGf.js} | 2 +- dist/copilot_web/input.js | 4 +- ...Dgrq.js => message-components-BQDbTDiL.js} | 86 ++++++------ dist/copilot_web/workflowChat-Bg7hphV8.js | 129 ------------------ dist/copilot_web/workflowChat-DztaEqXX.js | 129 ++++++++++++++++++ pyproject.toml | 2 +- ui/src/apis/workflowChatApi.ts | 23 ++++ ui/src/components/chat/ChatInput.tsx | 60 +++++--- 10 files changed, 240 insertions(+), 201 deletions(-) rename dist/copilot_web/{App-CD8cpUyz.js => App-Bjq6Zxw-.js} (82%) rename dist/copilot_web/{ParameterDebugInterfaceV2-CkhASy27.js => ParameterDebugInterfaceV2-xZYi4DyT.js} (99%) rename dist/copilot_web/{WorkflowOption-EBexRuvI.js => WorkflowOption-Ci2jcBGf.js} (98%) rename dist/copilot_web/{message-components-DetBDgrq.js => message-components-BQDbTDiL.js} (78%) delete mode 100644 dist/copilot_web/workflowChat-Bg7hphV8.js create mode 100644 dist/copilot_web/workflowChat-DztaEqXX.js diff --git a/dist/copilot_web/App-CD8cpUyz.js b/dist/copilot_web/App-Bjq6Zxw-.js similarity index 82% rename from dist/copilot_web/App-CD8cpUyz.js rename to dist/copilot_web/App-Bjq6Zxw-.js index 42da3b5..3f9716a 100644 --- a/dist/copilot_web/App-CD8cpUyz.js +++ b/dist/copilot_web/App-Bjq6Zxw-.js @@ -1,6 +1,6 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-Bg7hphV8.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DetBDgrq.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-DztaEqXX.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; const prefix = apiBase ? `${apiBase.substring(1)}/` : ''; return `${prefix}${path}`; }))))=>i.map(i=>d[i]); -import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-DetBDgrq.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import("./workflowChat-Bg7hphV8.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; +import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-BQDbTDiL.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import("./workflowChat-DztaEqXX.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/dist/copilot_web/ParameterDebugInterfaceV2-CkhASy27.js b/dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js similarity index 99% rename from dist/copilot_web/ParameterDebugInterfaceV2-CkhASy27.js rename to dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js index 447a56e..81557e2 100644 --- a/dist/copilot_web/ParameterDebugInterfaceV2-CkhASy27.js +++ b/dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js @@ -1,4 +1,4 @@ -import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-DetBDgrq.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-Bg7hphV8.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white +import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-BQDbTDiL.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-DztaEqXX.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white bg-gray-50 dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-400 diff --git a/dist/copilot_web/WorkflowOption-EBexRuvI.js b/dist/copilot_web/WorkflowOption-Ci2jcBGf.js similarity index 98% rename from dist/copilot_web/WorkflowOption-EBexRuvI.js rename to dist/copilot_web/WorkflowOption-Ci2jcBGf.js index 963e134..9f58209 100644 --- a/dist/copilot_web/WorkflowOption-EBexRuvI.js +++ b/dist/copilot_web/WorkflowOption-Ci2jcBGf.js @@ -1 +1 @@ -import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-DetBDgrq.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; +import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-BQDbTDiL.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; diff --git a/dist/copilot_web/input.js b/dist/copilot_web/input.js index 27fd6b8..d965184 100644 --- a/dist/copilot_web/input.js +++ b/dist/copilot_web/input.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-CD8cpUyz.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DetBDgrq.js","copilot_web/fonts.css"])))=>i.map(i=>d[i]); -import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-DetBDgrq.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import("./App-CD8cpUyz.js");return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-Bjq6Zxw-.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/fonts.css"])))=>i.map(i=>d[i]); +import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-BQDbTDiL.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import("./App-Bjq6Zxw-.js");return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; diff --git a/dist/copilot_web/message-components-DetBDgrq.js b/dist/copilot_web/message-components-BQDbTDiL.js similarity index 78% rename from dist/copilot_web/message-components-DetBDgrq.js rename to dist/copilot_web/message-components-BQDbTDiL.js index bc6123b..27654b7 100644 --- a/dist/copilot_web/message-components-DetBDgrq.js +++ b/dist/copilot_web/message-components-BQDbTDiL.js @@ -1,30 +1,30 @@ -import{r as Ve,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Mpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=Ve.createContext({state:W$,dispatch:()=>null});function Bpe({children:i}){const[r,e]=Ve.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=Ve.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const Ff={apiBaseUrl:"https://comfyui-copilot-server-pre.onrender.com"};function Sr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var lI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return lI.charAt(i)}function hI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function cI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function dI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,fI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f -\r  \u2028\u2029`;for(pn={},r=0;r<16;++r)pn[e.charAt(r)]=r;for(e=e.toLowerCase(),r=10;r<16;++r)pn[e.charAt(r)]=r;for(r=0;r=2?(n[n.length]=a,a=0,o=0):a<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},Si,wd={decode:function(i){var r;if(Si===void 0){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=`= \f -\r  \u2028\u2029`;for(Si=Object.create(null),r=0;r<64;++r)Si[e.charAt(r)]=r;for(Si["-"]=62,Si._=63,r=0;r=4?(n[n.length]=a>>16,n[n.length]=a>>8&255,n[n.length]=a&255,a=0,o=0):a<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=a>>10;break;case 3:n[n.length]=a>>16,n[n.length]=a>>8&255;break}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(i){var r=wd.re.exec(i);if(r)if(r[1])i=r[1];else if(r[2])i=r[2];else throw new Error("RegExp out of sync");return wd.decode(i)}},gn=1e13,Ua=function(){function i(r){this.buf=[+r||0]}return i.prototype.mulAdd=function(r,e){var t=this.buf,n=t.length,a,o;for(a=0;a0&&(t[a]=e)},i.prototype.sub=function(r){var e=this.buf,t=e.length,n,a;for(n=0;n=0;--n)t+=(gn+e[n]).toString().substring(1);return t},i.prototype.valueOf=function(){for(var r=this.buf,e=0,t=r.length-1;t>=0;--t)e=e*gn+r[t];return e},i.prototype.simplify=function(){var r=this.buf;return r.length==1?r[0]:this},i}(),G$="…",vI=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,pI=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Wn(i,r){return i.length>r&&(i=i.substring(0,r)+G$),i}var nh=function(){function i(r,e){this.hexDigits="0123456789ABCDEF",r instanceof i?(this.enc=r.enc,this.pos=r.pos):(this.enc=r,this.pos=e)}return i.prototype.get=function(r){if(r===void 0&&(r=this.pos++),r>=this.enc.length)throw new Error("Requesting byte offset ".concat(r," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(r):this.enc[r]},i.prototype.hexByte=function(r){return this.hexDigits.charAt(r>>4&15)+this.hexDigits.charAt(r&15)},i.prototype.hexDump=function(r,e,t){for(var n="",a=r;a{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=We.createContext({state:W$,dispatch:()=>null});function Bpe({children:i}){const[r,e]=We.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=We.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const Ff={apiBaseUrl:"https://comfyui-copilot-server-pre.onrender.com"};function dr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var lI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return lI.charAt(i)}function hI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function cI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function dI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,fI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f +\r  \u2028\u2029`;for(pn={},r=0;r<16;++r)pn[e.charAt(r)]=r;for(e=e.toLowerCase(),r=10;r<16;++r)pn[e.charAt(r)]=r;for(r=0;r=2?(n[n.length]=a,a=0,o=0):a<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},Ii,wd={decode:function(i){var r;if(Ii===void 0){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=`= \f +\r  \u2028\u2029`;for(Ii=Object.create(null),r=0;r<64;++r)Ii[e.charAt(r)]=r;for(Ii["-"]=62,Ii._=63,r=0;r=4?(n[n.length]=a>>16,n[n.length]=a>>8&255,n[n.length]=a&255,a=0,o=0):a<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=a>>10;break;case 3:n[n.length]=a>>16,n[n.length]=a>>8&255;break}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(i){var r=wd.re.exec(i);if(r)if(r[1])i=r[1];else if(r[2])i=r[2];else throw new Error("RegExp out of sync");return wd.decode(i)}},gn=1e13,Ua=function(){function i(r){this.buf=[+r||0]}return i.prototype.mulAdd=function(r,e){var t=this.buf,n=t.length,a,o;for(a=0;a0&&(t[a]=e)},i.prototype.sub=function(r){var e=this.buf,t=e.length,n,a;for(n=0;n=0;--n)t+=(gn+e[n]).toString().substring(1);return t},i.prototype.valueOf=function(){for(var r=this.buf,e=0,t=r.length-1;t>=0;--t)e=e*gn+r[t];return e},i.prototype.simplify=function(){var r=this.buf;return r.length==1?r[0]:this},i}(),G$="…",vI=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,pI=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Wn(i,r){return i.length>r&&(i=i.substring(0,r)+G$),i}var nh=function(){function i(r,e){this.hexDigits="0123456789ABCDEF",r instanceof i?(this.enc=r.enc,this.pos=r.pos):(this.enc=r,this.pos=e)}return i.prototype.get=function(r){if(r===void 0&&(r=this.pos++),r>=this.enc.length)throw new Error("Requesting byte offset ".concat(r," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(r):this.enc[r]},i.prototype.hexByte=function(r){return this.hexDigits.charAt(r>>4&15)+this.hexDigits.charAt(r&15)},i.prototype.hexDump=function(r,e,t){for(var n="",a=r;a176)return!1}return!0},i.prototype.parseStringISO=function(r,e){for(var t="",n=r;n191&&a<224?t+=String.fromCharCode((a&31)<<6|this.get(n++)&63):t+=String.fromCharCode((a&15)<<12|(this.get(n++)&63)<<6|this.get(n++)&63)}return t},i.prototype.parseStringBMP=function(r,e){for(var t="",n,a,o=r;o127,a=n?255:0,o,s="";t==a&&++r4){for(s=t,o<<=3;!((+s^a)&128);)s=+s<<1,--o;s="("+o+` bit) `}n&&(t=t-256);for(var u=new Ua(t),l=r+1;l=h;--d)s+=l>>d&1?"1":"0";if(s.length>t)return o+Wn(s,t)}return o+s},i.prototype.parseOctetString=function(r,e,t){if(this.isASCII(r,e))return Wn(this.parseStringISO(r,e),t);var n=e-r,a="("+n+` byte) +`,s="",u=r+1;u=h;--c)s+=l>>c&1?"1":"0";if(s.length>t)return o+Wn(s,t)}return o+s},i.prototype.parseOctetString=function(r,e,t){if(this.isASCII(r,e))return Wn(this.parseStringISO(r,e),t);var n=e-r,a="("+n+` byte) `;t/=2,n>t&&(e=r+t);for(var o=r;ot&&(a+=G$),a},i.prototype.parseOID=function(r,e,t){for(var n="",a=new Ua,o=0,s=r;st)return Wn(n,t);a=new Ua,o=0}}return o>0&&(n+=".incomplete"),n},i}(),gI=function(){function i(r,e,t,n,a){if(!(n instanceof _p))throw new Error("Invalid tag value.");this.stream=r,this.header=e,this.length=t,this.tag=n,this.sub=a}return i.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},i.prototype.content=function(r){if(this.tag===void 0)return null;r===void 0&&(r=1/0);var e=this.posContent(),t=Math.abs(this.length);if(!this.tag.isUniversal())return this.sub!==null?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+t,r);switch(this.tag.tagNumber){case 1:return this.stream.get(e)===0?"false":"true";case 2:return this.stream.parseInteger(e,e+t);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+t,r);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+t,r);case 6:return this.stream.parseOID(e,e+t,r);case 16:case 17:return this.sub!==null?"("+this.sub.length+" elem)":"(no elem)";case 12:return Wn(this.stream.parseStringUTF(e,e+t),r);case 18:case 19:case 20:case 21:case 22:case 26:return Wn(this.stream.parseStringISO(e,e+t),r);case 30:return Wn(this.stream.parseStringBMP(e,e+t),r);case 23:case 24:return this.stream.parseTime(e,e+t,this.tag.tagNumber==23)}return null},i.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(this.sub===null?"null":this.sub.length)+"]"},i.prototype.toPrettyString=function(r){r===void 0&&(r="");var e=r+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":this.tag.isUniversal()&&(this.tag.tagNumber==3||this.tag.tagNumber==4)&&this.sub!==null&&(e+=" (encapsulates)"),e+=` -`,this.sub!==null){r+=" ";for(var t=0,n=this.sub.length;t6)throw new Error("Length over 48 bits not supported at position "+(r.pos-1));if(t===0)return null;e=0;for(var n=0;n>6,this.tagConstructed=(e&32)!==0,this.tagNumber=e&31,this.tagNumber==31){var t=new Ua;do e=r.get(),t.mulAdd(128,e&127);while(e&128);this.tagNumber=t.simplify()}}return i.prototype.isUniversal=function(){return this.tagClass===0},i.prototype.isEOC=function(){return this.tagClass===0&&this.tagNumber===0},i}(),ti,yI=0xdeadbeefcafe,Ep=(yI&16777215)==15715070,ct=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],mI=(1<<26)/ct[ct.length-1],Q=function(){function i(r,e,t){r!=null&&(typeof r=="number"?this.fromNumber(r,e,t):e==null&&typeof r!="string"?this.fromString(r,256):this.fromString(r,e))}return i.prototype.toString=function(r){if(this.s<0)return"-"+this.negate().toString(r);var e;if(r==16)e=4;else if(r==8)e=3;else if(r==2)e=1;else if(r==32)e=5;else if(r==4)e=2;else return this.toRadix(r);var t=(1<0)for(u>u)>0&&(a=!0,o=Or(n));s>=0;)u>(u+=this.DB-e)):(n=this[s]>>(u-=e)&t,u<=0&&(u+=this.DB,--s)),n>0&&(a=!0),a&&(o+=Or(n));return a?o:"0"},i.prototype.negate=function(){var r=re();return i.ZERO.subTo(this,r),r},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(r){var e=this.s-r.s;if(e!=0)return e;var t=this.t;if(e=t-r.t,e!=0)return this.s<0?-e:e;for(;--t>=0;)if((e=this[t]-r[t])!=0)return e;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+ms(this[this.t-1]^this.s&this.DM)},i.prototype.mod=function(r){var e=re();return this.abs().divRemTo(r,null,e),this.s<0&&e.compareTo(i.ZERO)>0&&r.subTo(e,e),e},i.prototype.modPowInt=function(r,e){var t;return r<256||e.isEven()?t=new Sp(e):t=new Op(e),this.exp(r,t)},i.prototype.clone=function(){var r=re();return this.copyTo(r),r},i.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24},i.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},i.prototype.toByteArray=function(){var r=this.t,e=[];e[0]=this.s;var t=this.DB-r*this.DB%8,n,a=0;if(r-- >0)for(t>t)!=(this.s&this.DM)>>t&&(e[a++]=n|this.s<=0;)t<8?(n=(this[r]&(1<>(t+=this.DB-8)):(n=this[r]>>(t-=8)&255,t<=0&&(t+=this.DB,--r)),n&128&&(n|=-256),a==0&&(this.s&128)!=(n&128)&&++a,(a>0||n!=this.s)&&(e[a++]=n);return e},i.prototype.equals=function(r){return this.compareTo(r)==0},i.prototype.min=function(r){return this.compareTo(r)<0?this:r},i.prototype.max=function(r){return this.compareTo(r)>0?this:r},i.prototype.and=function(r){var e=re();return this.bitwiseTo(r,hI,e),e},i.prototype.or=function(r){var e=re();return this.bitwiseTo(r,ys,e),e},i.prototype.xor=function(r){var e=re();return this.bitwiseTo(r,bp,e),e},i.prototype.andNot=function(r){var e=re();return this.bitwiseTo(r,$p,e),e},i.prototype.not=function(){for(var r=re(),e=0;e=this.t?this.s!=0:(this[e]&1<1){var d=re();for(o.sqrTo(s[1],d);u<=h;)s[u]=re(),o.mulTo(d,s[u-2],s[u]),u+=2}var c=r.t-1,f,v=!0,p=re(),g;for(t=ms(r[c])-1;c>=0;){for(t>=l?f=r[c]>>t-l&h:(f=(r[c]&(1<0&&(f|=r[c-1]>>this.DB+t-l)),u=n;!(f&1);)f>>=1,--u;if((t-=u)<0&&(t+=this.DB,--c),v)s[f].copyTo(a),v=!1;else{for(;u>1;)o.sqrTo(a,p),o.sqrTo(p,a),u-=2;u>0?o.sqrTo(a,p):(g=a,a=p,p=g),o.mulTo(p,s[f],a)}for(;c>=0&&!(r[c]&1<=0?(t.subTo(n,t),e&&a.subTo(s,a),o.subTo(u,o)):(n.subTo(t,n),e&&s.subTo(a,s),u.subTo(o,u))}if(n.compareTo(i.ONE)!=0)return i.ZERO;if(u.compareTo(r)>=0)return u.subtract(r);if(u.signum()<0)u.addTo(r,u);else return u;return u.signum()<0?u.add(r):u},i.prototype.pow=function(r){return this.exp(r,new bI)},i.prototype.gcd=function(r){var e=this.s<0?this.negate():this.clone(),t=r.s<0?r.negate():r.clone();if(e.compareTo(t)<0){var n=e;e=t,t=n}var a=e.getLowestSetBit(),o=t.getLowestSetBit();if(o<0)return e;for(a0&&(e.rShiftTo(o,e),t.rShiftTo(o,t));e.signum()>0;)(a=e.getLowestSetBit())>0&&e.rShiftTo(a,e),(a=t.getLowestSetBit())>0&&t.rShiftTo(a,t),e.compareTo(t)>=0?(e.subTo(t,e),e.rShiftTo(1,e)):(t.subTo(e,t),t.rShiftTo(1,t));return o>0&&t.lShiftTo(o,t),t},i.prototype.isProbablePrime=function(r){var e,t=this.abs();if(t.t==1&&t[0]<=ct[ct.length-1]){for(e=0;e=0;--e)r[e]=this[e];r.t=this.t,r.s=this.s},i.prototype.fromInt=function(r){this.t=1,this.s=r<0?-1:0,r>0?this[0]=r:r<-1?this[0]=r+this.DV:this.t=0},i.prototype.fromString=function(r,e){var t;if(e==16)t=4;else if(e==8)t=3;else if(e==256)t=8;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else{this.fromRadix(r,e);return}this.t=0,this.s=0;for(var n=r.length,a=!1,o=0;--n>=0;){var s=t==8?+r[n]&255:Ip(r,n);if(s<0){r.charAt(n)=="-"&&(a=!0);continue}a=!1,o==0?this[this.t++]=s:o+t>this.DB?(this[this.t-1]|=(s&(1<>this.DB-o):this[this.t-1]|=s<=this.DB&&(o-=this.DB)}t==8&&+r[0]&128&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==r;)--this.t},i.prototype.dlShiftTo=function(r,e){var t;for(t=this.t-1;t>=0;--t)e[t+r]=this[t];for(t=r-1;t>=0;--t)e[t]=0;e.t=this.t+r,e.s=this.s},i.prototype.drShiftTo=function(r,e){for(var t=r;t=0;--u)e[u+o+1]=this[u]>>n|s,s=(this[u]&a)<=0;--u)e[u]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},i.prototype.rShiftTo=function(r,e){e.s=this.s;var t=Math.floor(r/this.DB);if(t>=this.t){e.t=0;return}var n=r%this.DB,a=this.DB-n,o=(1<>n;for(var s=t+1;s>n;n>0&&(e[this.t-t-1]|=(this.s&o)<>=this.DB;if(r.t>=this.DB;n+=this.s}else{for(n+=this.s;t>=this.DB;n-=r.s}e.s=n<0?-1:0,n<-1?e[t++]=this.DV+n:n>0&&(e[t++]=n),e.t=t,e.clamp()},i.prototype.multiplyTo=function(r,e){var t=this.abs(),n=r.abs(),a=t.t;for(e.t=a+n.t;--a>=0;)e[a]=0;for(a=0;a=0;)r[t]=0;for(t=0;t=e.DV&&(r[t+e.t]-=e.DV,r[t+e.t+1]=1)}r.t>0&&(r[r.t-1]+=e.am(t,e[t],r,2*t,0,1)),r.s=0,r.clamp()},i.prototype.divRemTo=function(r,e,t){var n=r.abs();if(!(n.t<=0)){var a=this.abs();if(a.t0?(n.lShiftTo(l,o),a.lShiftTo(l,t)):(n.copyTo(o),a.copyTo(t));var h=o.t,d=o[h-1];if(d!=0){var c=d*(1<1?o[h-2]>>this.F2:0),f=this.FV/c,v=(1<=0&&(t[t.t++]=1,t.subTo(m,t)),i.ONE.dlShiftTo(h,m),m.subTo(o,o);o.t=0;){var b=t[--g]==d?this.DM:Math.floor(t[g]*f+(t[g-1]+p)*v);if((t[g]+=o.am(0,b,t,y,0,h))0&&t.rShiftTo(l,t),s<0&&i.ZERO.subTo(t,t)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var r=this[0];if(!(r&1))return 0;var e=r&3;return e=e*(2-(r&15)*e)&15,e=e*(2-(r&255)*e)&255,e=e*(2-((r&65535)*e&65535))&65535,e=e*(2-r*e%this.DV)%this.DV,e>0?this.DV-e:-e},i.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0},i.prototype.exp=function(r,e){if(r>4294967295||r<1)return i.ONE;var t=re(),n=re(),a=e.convert(this),o=ms(r)-1;for(a.copyTo(t);--o>=0;)if(e.sqrTo(t,n),(r&1<0)e.mulTo(n,a,t);else{var s=t;t=n,n=s}return e.revert(t)},i.prototype.chunkSize=function(r){return Math.floor(Math.LN2*this.DB/Math.log(r))},i.prototype.toRadix=function(r){if(r==null&&(r=10),this.signum()==0||r<2||r>36)return"0";var e=this.chunkSize(r),t=Math.pow(r,e),n=qr(t),a=re(),o=re(),s="";for(this.divRemTo(n,a,o);a.signum()>0;)s=(t+o.intValue()).toString(r).substr(1)+s,a.divRemTo(n,a,o);return o.intValue().toString(r)+s},i.prototype.fromRadix=function(r,e){this.fromInt(0),e==null&&(e=10);for(var t=this.chunkSize(e),n=Math.pow(e,t),a=!1,o=0,s=0,u=0;u=t&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),a&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(r,e,t){if(typeof e=="number")if(r<2)this.fromInt(1);else for(this.fromNumber(r,t),this.testBit(r-1)||this.bitwiseTo(i.ONE.shiftLeft(r-1),ys,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>r&&this.subTo(i.ONE.shiftLeft(r-1),this);else{var n=[],a=r&7;n.length=(r>>3)+1,e.nextBytes(n),a>0?n[0]&=(1<>=this.DB;if(r.t>=this.DB;n+=this.s}else{for(n+=this.s;t>=this.DB;n+=r.s}e.s=n<0?-1:0,n>0?e[t++]=n:n<-1&&(e[t++]=this.DV+n),e.t=t,e.clamp()},i.prototype.dMultiply=function(r){this[this.t]=this.am(0,r-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(r,e){if(r!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=r;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},i.prototype.multiplyLowerTo=function(r,e,t){var n=Math.min(this.t+r.t,e);for(t.s=0,t.t=n;n>0;)t[--n]=0;for(var a=t.t-this.t;n=0;)t[n]=0;for(n=Math.max(e-this.t,0);n0)if(e==0)t=this[0]%r;else for(var n=this.t-1;n>=0;--n)t=(e*t+this[n])%r;return t},i.prototype.millerRabin=function(r){var e=this.subtract(i.ONE),t=e.getLowestSetBit();if(t<=0)return!1;var n=e.shiftRight(t);r=r+1>>1,r>ct.length&&(r=ct.length);for(var a=re(),o=0;o0&&(t.rShiftTo(s,t),n.rShiftTo(s,n));var u=function(){(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n)),t.signum()>0?setTimeout(u,0):(s>0&&n.lShiftTo(s,n),setTimeout(function(){e(n)},0))};setTimeout(u,10)},i.prototype.fromNumberAsync=function(r,e,t,n){if(typeof e=="number")if(r<2)this.fromInt(1);else{this.fromNumber(r,t),this.testBit(r-1)||this.bitwiseTo(i.ONE.shiftLeft(r-1),ys,this),this.isEven()&&this.dAddOffset(1,0);var a=this,o=function(){a.dAddOffset(2,0),a.bitLength()>r&&a.subTo(i.ONE.shiftLeft(r-1),a),a.isProbablePrime(e)?setTimeout(function(){n()},0):setTimeout(o,0)};setTimeout(o,0)}else{var s=[],u=r&7;s.length=(r>>3)+1,e.nextBytes(s),u>0?s[0]&=(1<=0?r.mod(this.m):r},i.prototype.revert=function(r){return r},i.prototype.reduce=function(r){r.divRemTo(this.m,null,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}(),Op=function(){function i(r){this.m=r,this.mp=r.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e},i.prototype.revert=function(r){var e=re();return r.copyTo(e),this.reduce(e),e},i.prototype.reduce=function(r){for(;r.t<=this.mt2;)r[r.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&r.DM;for(t=e+this.m.t,r[t]+=this.m.am(0,n,r,e,0,this.m.t);r[t]>=r.DV;)r[t]-=r.DV,r[++t]++}r.clamp(),r.drShiftTo(this.m.t,r),r.compareTo(this.m)>=0&&r.subTo(this.m,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}(),$I=function(){function i(r){this.m=r,this.r2=re(),this.q3=re(),Q.ONE.dlShiftTo(2*r.t,this.r2),this.mu=this.r2.divide(r)}return i.prototype.convert=function(r){if(r.s<0||r.t>2*this.m.t)return r.mod(this.m);if(r.compareTo(this.m)<0)return r;var e=re();return r.copyTo(e),this.reduce(e),e},i.prototype.revert=function(r){return r},i.prototype.reduce=function(r){for(r.drShiftTo(this.m.t-1,this.r2),r.t>this.m.t+1&&(r.t=this.m.t+1,r.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);r.compareTo(this.r2)<0;)r.dAddOffset(1,this.m.t+1);for(r.subTo(this.r2,r);r.compareTo(this.m)>=0;)r.subTo(this.m,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}();function re(){return new Q(null)}function Se(i,r){return new Q(i,r)}var Tp=typeof navigator<"u";Tp&&Ep&&navigator.appName=="Microsoft Internet Explorer"?(Q.prototype.am=function(r,e,t,n,a,o){for(var s=e&32767,u=e>>15;--o>=0;){var l=this[r]&32767,h=this[r++]>>15,d=u*l+h*s;l=s*l+((d&32767)<<15)+t[n]+(a&1073741823),a=(l>>>30)+(d>>>15)+u*h+(a>>>30),t[n++]=l&1073741823}return a},ti=30):Tp&&Ep&&navigator.appName!="Netscape"?(Q.prototype.am=function(r,e,t,n,a,o){for(;--o>=0;){var s=e*this[r++]+t[n]+a;a=Math.floor(s/67108864),t[n++]=s&67108863}return a},ti=26):(Q.prototype.am=function(r,e,t,n,a,o){for(var s=e&16383,u=e>>14;--o>=0;){var l=this[r]&16383,h=this[r++]>>14,d=u*l+h*s;l=s*l+((d&16383)<<14)+t[n]+a,a=(l>>28)+(d>>14)+u*h,t[n++]=l&268435455}return a},ti=28);Q.prototype.DB=ti;Q.prototype.DM=(1<>>16)!=0&&(i=e,r+=16),(e=i>>8)!=0&&(i=e,r+=8),(e=i>>4)!=0&&(i=e,r+=4),(e=i>>2)!=0&&(i=e,r+=2),(e=i>>1)!=0&&(i=e,r+=1),r}Q.ZERO=qr(0);Q.ONE=qr(1);var wI=function(){function i(){this.i=0,this.j=0,this.S=[]}return i.prototype.init=function(r){var e,t,n;for(e=0;e<256;++e)this.S[e]=e;for(t=0,e=0;e<256;++e)t=t+this.S[e]+r[e%r.length]&255,n=this.S[e],this.S[e]=this.S[t],this.S[t]=n;this.i=0,this.j=0},i.prototype.next=function(){var r;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,r=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=r,this.S[r+this.S[this.i]&255]},i}();function _I(){return new wI}var q$=256,bs,Jr=null,er;if(Jr==null){Jr=[],er=0;var $s=void 0;if(typeof window<"u"&&window.crypto&&window.crypto.getRandomValues){var ah=new Uint32Array(256);for(window.crypto.getRandomValues(ah),$s=0;$s=256||er>=q$){window.removeEventListener?window.removeEventListener("mousemove",_s,!1):window.detachEvent&&window.detachEvent("onmousemove",_s);return}try{var r=i.x+i.y;Jr[er++]=r&255,ws+=1}catch{}};typeof window<"u"&&(window.addEventListener?window.addEventListener("mousemove",_s,!1):window.attachEvent&&window.attachEvent("onmousemove",_s))}function EI(){if(bs==null){for(bs=_I();er=0&&r>0;){var n=i.charCodeAt(t--);n<128?e[--r]=n:n>127&&n<2048?(e[--r]=n&63|128,e[--r]=n>>6|192):(e[--r]=n&63|128,e[--r]=n>>6&63|128,e[--r]=n>>12|224)}e[--r]=0;for(var a=new _d,o=[];r>2;){for(o[0]=0;o[0]==0;)a.nextBytes(o);e[--r]=o[0]}return e[--r]=2,e[--r]=0,new Q(e)}var TI=function(){function i(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return i.prototype.doPublic=function(r){return r.modPowInt(this.e,this.n)},i.prototype.doPrivate=function(r){if(this.p==null||this.q==null)return r.modPow(this.d,this.n);for(var e=r.mod(this.p).modPow(this.dmp1,this.p),t=r.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(t)<0;)e=e.add(this.p);return e.subtract(t).multiply(this.coeff).mod(this.p).multiply(this.q).add(t)},i.prototype.setPublic=function(r,e){r!=null&&e!=null&&r.length>0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},i.prototype.encrypt=function(r){var e=this.n.bitLength()+7>>3,t=OI(r,e);if(t==null)return null;var n=this.doPublic(t);if(n==null)return null;for(var a=n.toString(16),o=a.length,s=0;s0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16),this.d=Se(t,16)):console.error("Invalid RSA private key")},i.prototype.setPrivateEx=function(r,e,t,n,a,o,s,u){r!=null&&e!=null&&r.length>0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16),this.d=Se(t,16),this.p=Se(n,16),this.q=Se(a,16),this.dmp1=Se(o,16),this.dmq1=Se(s,16),this.coeff=Se(u,16)):console.error("Invalid RSA private key")},i.prototype.generate=function(r,e){var t=new _d,n=r>>1;this.e=parseInt(e,16);for(var a=new Q(e,16);;){for(;this.p=new Q(r-n,1,t),!(this.p.subtract(Q.ONE).gcd(a).compareTo(Q.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new Q(n,1,t),!(this.q.subtract(Q.ONE).gcd(a).compareTo(Q.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(Q.ONE),u=this.q.subtract(Q.ONE),l=s.multiply(u);if(l.gcd(a).compareTo(Q.ONE)==0){this.n=this.p.multiply(this.q),this.d=a.modInverse(l),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(u),this.coeff=this.q.modInverse(this.p);break}}},i.prototype.decrypt=function(r){var e=Se(r,16),t=this.doPrivate(e);return t==null?null:II(t,this.n.bitLength()+7>>3)},i.prototype.generateAsync=function(r,e,t){var n=new _d,a=r>>1;this.e=parseInt(e,16);var o=new Q(e,16),s=this,u=function(){var l=function(){if(s.p.compareTo(s.q)<=0){var c=s.p;s.p=s.q,s.q=c}var f=s.p.subtract(Q.ONE),v=s.q.subtract(Q.ONE),p=f.multiply(v);p.gcd(o).compareTo(Q.ONE)==0?(s.n=s.p.multiply(s.q),s.d=o.modInverse(p),s.dmp1=s.d.mod(f),s.dmq1=s.d.mod(v),s.coeff=s.q.modInverse(s.p),setTimeout(function(){t()},0)):setTimeout(u,0)},h=function(){s.q=re(),s.q.fromNumberAsync(a,1,n,function(){s.q.subtract(Q.ONE).gcda(o,function(c){c.compareTo(Q.ONE)==0&&s.q.isProbablePrime(10)?setTimeout(l,0):setTimeout(h,0)})})},d=function(){s.p=re(),s.p.fromNumberAsync(r-a,1,n,function(){s.p.subtract(Q.ONE).gcda(o,function(c){c.compareTo(Q.ONE)==0&&s.p.isProbablePrime(10)?setTimeout(h,0):setTimeout(d,0)})})};setTimeout(d,0)};setTimeout(u,0)},i.prototype.sign=function(r,e,t){var n=kI(t),a=n+e(r).toString(),o=SI(a,this.n.bitLength()/4);if(o==null)return null;var s=this.doPrivate(o);if(s==null)return null;var u=s.toString(16);return u.length&1?"0"+u:u},i.prototype.verify=function(r,e,t){var n=Se(e,16),a=this.doPublic(n);if(a==null)return null;var o=a.toString(16).replace(/^1f+00/,""),s=PI(o);return s==t(r).toString()},i}();function II(i,r){for(var e=i.toByteArray(),t=0;t=e.length)return null;for(var n="";++t191&&a<224?(n+=String.fromCharCode((a&31)<<6|e[t+1]&63),++t):(n+=String.fromCharCode((a&15)<<12|(e[t+1]&63)<<6|e[t+2]&63),t+=2)}return n}var uu={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function kI(i){return uu[i]||""}function PI(i){for(var r in uu)if(uu.hasOwnProperty(r)){var e=uu[r],t=e.length;if(i.substr(0,t)==e)return i.substr(t)}return i}/*! +`,this.sub!==null){r+=" ";for(var t=0,n=this.sub.length;t6)throw new Error("Length over 48 bits not supported at position "+(r.pos-1));if(t===0)return null;e=0;for(var n=0;n>6,this.tagConstructed=(e&32)!==0,this.tagNumber=e&31,this.tagNumber==31){var t=new Ua;do e=r.get(),t.mulAdd(128,e&127);while(e&128);this.tagNumber=t.simplify()}}return i.prototype.isUniversal=function(){return this.tagClass===0},i.prototype.isEOC=function(){return this.tagClass===0&&this.tagNumber===0},i}(),ni,yI=0xdeadbeefcafe,Ep=(yI&16777215)==15715070,dt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],mI=(1<<26)/dt[dt.length-1],Q=function(){function i(r,e,t){r!=null&&(typeof r=="number"?this.fromNumber(r,e,t):e==null&&typeof r!="string"?this.fromString(r,256):this.fromString(r,e))}return i.prototype.toString=function(r){if(this.s<0)return"-"+this.negate().toString(r);var e;if(r==16)e=4;else if(r==8)e=3;else if(r==2)e=1;else if(r==32)e=5;else if(r==4)e=2;else return this.toRadix(r);var t=(1<0)for(u>u)>0&&(a=!0,o=Or(n));s>=0;)u>(u+=this.DB-e)):(n=this[s]>>(u-=e)&t,u<=0&&(u+=this.DB,--s)),n>0&&(a=!0),a&&(o+=Or(n));return a?o:"0"},i.prototype.negate=function(){var r=re();return i.ZERO.subTo(this,r),r},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(r){var e=this.s-r.s;if(e!=0)return e;var t=this.t;if(e=t-r.t,e!=0)return this.s<0?-e:e;for(;--t>=0;)if((e=this[t]-r[t])!=0)return e;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+ms(this[this.t-1]^this.s&this.DM)},i.prototype.mod=function(r){var e=re();return this.abs().divRemTo(r,null,e),this.s<0&&e.compareTo(i.ZERO)>0&&r.subTo(e,e),e},i.prototype.modPowInt=function(r,e){var t;return r<256||e.isEven()?t=new Sp(e):t=new Op(e),this.exp(r,t)},i.prototype.clone=function(){var r=re();return this.copyTo(r),r},i.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24},i.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},i.prototype.toByteArray=function(){var r=this.t,e=[];e[0]=this.s;var t=this.DB-r*this.DB%8,n,a=0;if(r-- >0)for(t>t)!=(this.s&this.DM)>>t&&(e[a++]=n|this.s<=0;)t<8?(n=(this[r]&(1<>(t+=this.DB-8)):(n=this[r]>>(t-=8)&255,t<=0&&(t+=this.DB,--r)),n&128&&(n|=-256),a==0&&(this.s&128)!=(n&128)&&++a,(a>0||n!=this.s)&&(e[a++]=n);return e},i.prototype.equals=function(r){return this.compareTo(r)==0},i.prototype.min=function(r){return this.compareTo(r)<0?this:r},i.prototype.max=function(r){return this.compareTo(r)>0?this:r},i.prototype.and=function(r){var e=re();return this.bitwiseTo(r,hI,e),e},i.prototype.or=function(r){var e=re();return this.bitwiseTo(r,ys,e),e},i.prototype.xor=function(r){var e=re();return this.bitwiseTo(r,bp,e),e},i.prototype.andNot=function(r){var e=re();return this.bitwiseTo(r,$p,e),e},i.prototype.not=function(){for(var r=re(),e=0;e=this.t?this.s!=0:(this[e]&1<1){var c=re();for(o.sqrTo(s[1],c);u<=h;)s[u]=re(),o.mulTo(c,s[u-2],s[u]),u+=2}var d=r.t-1,f,v=!0,p=re(),g;for(t=ms(r[d])-1;d>=0;){for(t>=l?f=r[d]>>t-l&h:(f=(r[d]&(1<0&&(f|=r[d-1]>>this.DB+t-l)),u=n;!(f&1);)f>>=1,--u;if((t-=u)<0&&(t+=this.DB,--d),v)s[f].copyTo(a),v=!1;else{for(;u>1;)o.sqrTo(a,p),o.sqrTo(p,a),u-=2;u>0?o.sqrTo(a,p):(g=a,a=p,p=g),o.mulTo(p,s[f],a)}for(;d>=0&&!(r[d]&1<=0?(t.subTo(n,t),e&&a.subTo(s,a),o.subTo(u,o)):(n.subTo(t,n),e&&s.subTo(a,s),u.subTo(o,u))}if(n.compareTo(i.ONE)!=0)return i.ZERO;if(u.compareTo(r)>=0)return u.subtract(r);if(u.signum()<0)u.addTo(r,u);else return u;return u.signum()<0?u.add(r):u},i.prototype.pow=function(r){return this.exp(r,new bI)},i.prototype.gcd=function(r){var e=this.s<0?this.negate():this.clone(),t=r.s<0?r.negate():r.clone();if(e.compareTo(t)<0){var n=e;e=t,t=n}var a=e.getLowestSetBit(),o=t.getLowestSetBit();if(o<0)return e;for(a0&&(e.rShiftTo(o,e),t.rShiftTo(o,t));e.signum()>0;)(a=e.getLowestSetBit())>0&&e.rShiftTo(a,e),(a=t.getLowestSetBit())>0&&t.rShiftTo(a,t),e.compareTo(t)>=0?(e.subTo(t,e),e.rShiftTo(1,e)):(t.subTo(e,t),t.rShiftTo(1,t));return o>0&&t.lShiftTo(o,t),t},i.prototype.isProbablePrime=function(r){var e,t=this.abs();if(t.t==1&&t[0]<=dt[dt.length-1]){for(e=0;e=0;--e)r[e]=this[e];r.t=this.t,r.s=this.s},i.prototype.fromInt=function(r){this.t=1,this.s=r<0?-1:0,r>0?this[0]=r:r<-1?this[0]=r+this.DV:this.t=0},i.prototype.fromString=function(r,e){var t;if(e==16)t=4;else if(e==8)t=3;else if(e==256)t=8;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else{this.fromRadix(r,e);return}this.t=0,this.s=0;for(var n=r.length,a=!1,o=0;--n>=0;){var s=t==8?+r[n]&255:Ip(r,n);if(s<0){r.charAt(n)=="-"&&(a=!0);continue}a=!1,o==0?this[this.t++]=s:o+t>this.DB?(this[this.t-1]|=(s&(1<>this.DB-o):this[this.t-1]|=s<=this.DB&&(o-=this.DB)}t==8&&+r[0]&128&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==r;)--this.t},i.prototype.dlShiftTo=function(r,e){var t;for(t=this.t-1;t>=0;--t)e[t+r]=this[t];for(t=r-1;t>=0;--t)e[t]=0;e.t=this.t+r,e.s=this.s},i.prototype.drShiftTo=function(r,e){for(var t=r;t=0;--u)e[u+o+1]=this[u]>>n|s,s=(this[u]&a)<=0;--u)e[u]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},i.prototype.rShiftTo=function(r,e){e.s=this.s;var t=Math.floor(r/this.DB);if(t>=this.t){e.t=0;return}var n=r%this.DB,a=this.DB-n,o=(1<>n;for(var s=t+1;s>n;n>0&&(e[this.t-t-1]|=(this.s&o)<>=this.DB;if(r.t>=this.DB;n+=this.s}else{for(n+=this.s;t>=this.DB;n-=r.s}e.s=n<0?-1:0,n<-1?e[t++]=this.DV+n:n>0&&(e[t++]=n),e.t=t,e.clamp()},i.prototype.multiplyTo=function(r,e){var t=this.abs(),n=r.abs(),a=t.t;for(e.t=a+n.t;--a>=0;)e[a]=0;for(a=0;a=0;)r[t]=0;for(t=0;t=e.DV&&(r[t+e.t]-=e.DV,r[t+e.t+1]=1)}r.t>0&&(r[r.t-1]+=e.am(t,e[t],r,2*t,0,1)),r.s=0,r.clamp()},i.prototype.divRemTo=function(r,e,t){var n=r.abs();if(!(n.t<=0)){var a=this.abs();if(a.t0?(n.lShiftTo(l,o),a.lShiftTo(l,t)):(n.copyTo(o),a.copyTo(t));var h=o.t,c=o[h-1];if(c!=0){var d=c*(1<1?o[h-2]>>this.F2:0),f=this.FV/d,v=(1<=0&&(t[t.t++]=1,t.subTo(m,t)),i.ONE.dlShiftTo(h,m),m.subTo(o,o);o.t=0;){var $=t[--g]==c?this.DM:Math.floor(t[g]*f+(t[g-1]+p)*v);if((t[g]+=o.am(0,$,t,y,0,h))<$)for(o.dlShiftTo(y,m),t.subTo(m,t);t[g]<--$;)t.subTo(m,t)}e!=null&&(t.drShiftTo(h,e),s!=u&&i.ZERO.subTo(e,e)),t.t=h,t.clamp(),l>0&&t.rShiftTo(l,t),s<0&&i.ZERO.subTo(t,t)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var r=this[0];if(!(r&1))return 0;var e=r&3;return e=e*(2-(r&15)*e)&15,e=e*(2-(r&255)*e)&255,e=e*(2-((r&65535)*e&65535))&65535,e=e*(2-r*e%this.DV)%this.DV,e>0?this.DV-e:-e},i.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0},i.prototype.exp=function(r,e){if(r>4294967295||r<1)return i.ONE;var t=re(),n=re(),a=e.convert(this),o=ms(r)-1;for(a.copyTo(t);--o>=0;)if(e.sqrTo(t,n),(r&1<0)e.mulTo(n,a,t);else{var s=t;t=n,n=s}return e.revert(t)},i.prototype.chunkSize=function(r){return Math.floor(Math.LN2*this.DB/Math.log(r))},i.prototype.toRadix=function(r){if(r==null&&(r=10),this.signum()==0||r<2||r>36)return"0";var e=this.chunkSize(r),t=Math.pow(r,e),n=Jr(t),a=re(),o=re(),s="";for(this.divRemTo(n,a,o);a.signum()>0;)s=(t+o.intValue()).toString(r).substr(1)+s,a.divRemTo(n,a,o);return o.intValue().toString(r)+s},i.prototype.fromRadix=function(r,e){this.fromInt(0),e==null&&(e=10);for(var t=this.chunkSize(e),n=Math.pow(e,t),a=!1,o=0,s=0,u=0;u=t&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),a&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(r,e,t){if(typeof e=="number")if(r<2)this.fromInt(1);else for(this.fromNumber(r,t),this.testBit(r-1)||this.bitwiseTo(i.ONE.shiftLeft(r-1),ys,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>r&&this.subTo(i.ONE.shiftLeft(r-1),this);else{var n=[],a=r&7;n.length=(r>>3)+1,e.nextBytes(n),a>0?n[0]&=(1<>=this.DB;if(r.t>=this.DB;n+=this.s}else{for(n+=this.s;t>=this.DB;n+=r.s}e.s=n<0?-1:0,n>0?e[t++]=n:n<-1&&(e[t++]=this.DV+n),e.t=t,e.clamp()},i.prototype.dMultiply=function(r){this[this.t]=this.am(0,r-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(r,e){if(r!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=r;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},i.prototype.multiplyLowerTo=function(r,e,t){var n=Math.min(this.t+r.t,e);for(t.s=0,t.t=n;n>0;)t[--n]=0;for(var a=t.t-this.t;n=0;)t[n]=0;for(n=Math.max(e-this.t,0);n0)if(e==0)t=this[0]%r;else for(var n=this.t-1;n>=0;--n)t=(e*t+this[n])%r;return t},i.prototype.millerRabin=function(r){var e=this.subtract(i.ONE),t=e.getLowestSetBit();if(t<=0)return!1;var n=e.shiftRight(t);r=r+1>>1,r>dt.length&&(r=dt.length);for(var a=re(),o=0;o0&&(t.rShiftTo(s,t),n.rShiftTo(s,n));var u=function(){(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n)),t.signum()>0?setTimeout(u,0):(s>0&&n.lShiftTo(s,n),setTimeout(function(){e(n)},0))};setTimeout(u,10)},i.prototype.fromNumberAsync=function(r,e,t,n){if(typeof e=="number")if(r<2)this.fromInt(1);else{this.fromNumber(r,t),this.testBit(r-1)||this.bitwiseTo(i.ONE.shiftLeft(r-1),ys,this),this.isEven()&&this.dAddOffset(1,0);var a=this,o=function(){a.dAddOffset(2,0),a.bitLength()>r&&a.subTo(i.ONE.shiftLeft(r-1),a),a.isProbablePrime(e)?setTimeout(function(){n()},0):setTimeout(o,0)};setTimeout(o,0)}else{var s=[],u=r&7;s.length=(r>>3)+1,e.nextBytes(s),u>0?s[0]&=(1<=0?r.mod(this.m):r},i.prototype.revert=function(r){return r},i.prototype.reduce=function(r){r.divRemTo(this.m,null,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}(),Op=function(){function i(r){this.m=r,this.mp=r.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e},i.prototype.revert=function(r){var e=re();return r.copyTo(e),this.reduce(e),e},i.prototype.reduce=function(r){for(;r.t<=this.mt2;)r[r.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&r.DM;for(t=e+this.m.t,r[t]+=this.m.am(0,n,r,e,0,this.m.t);r[t]>=r.DV;)r[t]-=r.DV,r[++t]++}r.clamp(),r.drShiftTo(this.m.t,r),r.compareTo(this.m)>=0&&r.subTo(this.m,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}(),$I=function(){function i(r){this.m=r,this.r2=re(),this.q3=re(),Q.ONE.dlShiftTo(2*r.t,this.r2),this.mu=this.r2.divide(r)}return i.prototype.convert=function(r){if(r.s<0||r.t>2*this.m.t)return r.mod(this.m);if(r.compareTo(this.m)<0)return r;var e=re();return r.copyTo(e),this.reduce(e),e},i.prototype.revert=function(r){return r},i.prototype.reduce=function(r){for(r.drShiftTo(this.m.t-1,this.r2),r.t>this.m.t+1&&(r.t=this.m.t+1,r.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);r.compareTo(this.r2)<0;)r.dAddOffset(1,this.m.t+1);for(r.subTo(this.r2,r);r.compareTo(this.m)>=0;)r.subTo(this.m,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}();function re(){return new Q(null)}function Se(i,r){return new Q(i,r)}var Tp=typeof navigator<"u";Tp&&Ep&&navigator.appName=="Microsoft Internet Explorer"?(Q.prototype.am=function(r,e,t,n,a,o){for(var s=e&32767,u=e>>15;--o>=0;){var l=this[r]&32767,h=this[r++]>>15,c=u*l+h*s;l=s*l+((c&32767)<<15)+t[n]+(a&1073741823),a=(l>>>30)+(c>>>15)+u*h+(a>>>30),t[n++]=l&1073741823}return a},ni=30):Tp&&Ep&&navigator.appName!="Netscape"?(Q.prototype.am=function(r,e,t,n,a,o){for(;--o>=0;){var s=e*this[r++]+t[n]+a;a=Math.floor(s/67108864),t[n++]=s&67108863}return a},ni=26):(Q.prototype.am=function(r,e,t,n,a,o){for(var s=e&16383,u=e>>14;--o>=0;){var l=this[r]&16383,h=this[r++]>>14,c=u*l+h*s;l=s*l+((c&16383)<<14)+t[n]+a,a=(l>>28)+(c>>14)+u*h,t[n++]=l&268435455}return a},ni=28);Q.prototype.DB=ni;Q.prototype.DM=(1<>>16)!=0&&(i=e,r+=16),(e=i>>8)!=0&&(i=e,r+=8),(e=i>>4)!=0&&(i=e,r+=4),(e=i>>2)!=0&&(i=e,r+=2),(e=i>>1)!=0&&(i=e,r+=1),r}Q.ZERO=Jr(0);Q.ONE=Jr(1);var wI=function(){function i(){this.i=0,this.j=0,this.S=[]}return i.prototype.init=function(r){var e,t,n;for(e=0;e<256;++e)this.S[e]=e;for(t=0,e=0;e<256;++e)t=t+this.S[e]+r[e%r.length]&255,n=this.S[e],this.S[e]=this.S[t],this.S[t]=n;this.i=0,this.j=0},i.prototype.next=function(){var r;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,r=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=r,this.S[r+this.S[this.i]&255]},i}();function _I(){return new wI}var q$=256,bs,ei=null,er;if(ei==null){ei=[],er=0;var $s=void 0;if(typeof window<"u"&&window.crypto&&window.crypto.getRandomValues){var ah=new Uint32Array(256);for(window.crypto.getRandomValues(ah),$s=0;$s=256||er>=q$){window.removeEventListener?window.removeEventListener("mousemove",_s,!1):window.detachEvent&&window.detachEvent("onmousemove",_s);return}try{var r=i.x+i.y;ei[er++]=r&255,ws+=1}catch{}};typeof window<"u"&&(window.addEventListener?window.addEventListener("mousemove",_s,!1):window.attachEvent&&window.attachEvent("onmousemove",_s))}function EI(){if(bs==null){for(bs=_I();er=0&&r>0;){var n=i.charCodeAt(t--);n<128?e[--r]=n:n>127&&n<2048?(e[--r]=n&63|128,e[--r]=n>>6|192):(e[--r]=n&63|128,e[--r]=n>>6&63|128,e[--r]=n>>12|224)}e[--r]=0;for(var a=new _d,o=[];r>2;){for(o[0]=0;o[0]==0;)a.nextBytes(o);e[--r]=o[0]}return e[--r]=2,e[--r]=0,new Q(e)}var TI=function(){function i(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return i.prototype.doPublic=function(r){return r.modPowInt(this.e,this.n)},i.prototype.doPrivate=function(r){if(this.p==null||this.q==null)return r.modPow(this.d,this.n);for(var e=r.mod(this.p).modPow(this.dmp1,this.p),t=r.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(t)<0;)e=e.add(this.p);return e.subtract(t).multiply(this.coeff).mod(this.p).multiply(this.q).add(t)},i.prototype.setPublic=function(r,e){r!=null&&e!=null&&r.length>0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},i.prototype.encrypt=function(r){var e=this.n.bitLength()+7>>3,t=OI(r,e);if(t==null)return null;var n=this.doPublic(t);if(n==null)return null;for(var a=n.toString(16),o=a.length,s=0;s0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16),this.d=Se(t,16)):console.error("Invalid RSA private key")},i.prototype.setPrivateEx=function(r,e,t,n,a,o,s,u){r!=null&&e!=null&&r.length>0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16),this.d=Se(t,16),this.p=Se(n,16),this.q=Se(a,16),this.dmp1=Se(o,16),this.dmq1=Se(s,16),this.coeff=Se(u,16)):console.error("Invalid RSA private key")},i.prototype.generate=function(r,e){var t=new _d,n=r>>1;this.e=parseInt(e,16);for(var a=new Q(e,16);;){for(;this.p=new Q(r-n,1,t),!(this.p.subtract(Q.ONE).gcd(a).compareTo(Q.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new Q(n,1,t),!(this.q.subtract(Q.ONE).gcd(a).compareTo(Q.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(Q.ONE),u=this.q.subtract(Q.ONE),l=s.multiply(u);if(l.gcd(a).compareTo(Q.ONE)==0){this.n=this.p.multiply(this.q),this.d=a.modInverse(l),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(u),this.coeff=this.q.modInverse(this.p);break}}},i.prototype.decrypt=function(r){var e=Se(r,16),t=this.doPrivate(e);return t==null?null:II(t,this.n.bitLength()+7>>3)},i.prototype.generateAsync=function(r,e,t){var n=new _d,a=r>>1;this.e=parseInt(e,16);var o=new Q(e,16),s=this,u=function(){var l=function(){if(s.p.compareTo(s.q)<=0){var d=s.p;s.p=s.q,s.q=d}var f=s.p.subtract(Q.ONE),v=s.q.subtract(Q.ONE),p=f.multiply(v);p.gcd(o).compareTo(Q.ONE)==0?(s.n=s.p.multiply(s.q),s.d=o.modInverse(p),s.dmp1=s.d.mod(f),s.dmq1=s.d.mod(v),s.coeff=s.q.modInverse(s.p),setTimeout(function(){t()},0)):setTimeout(u,0)},h=function(){s.q=re(),s.q.fromNumberAsync(a,1,n,function(){s.q.subtract(Q.ONE).gcda(o,function(d){d.compareTo(Q.ONE)==0&&s.q.isProbablePrime(10)?setTimeout(l,0):setTimeout(h,0)})})},c=function(){s.p=re(),s.p.fromNumberAsync(r-a,1,n,function(){s.p.subtract(Q.ONE).gcda(o,function(d){d.compareTo(Q.ONE)==0&&s.p.isProbablePrime(10)?setTimeout(h,0):setTimeout(c,0)})})};setTimeout(c,0)};setTimeout(u,0)},i.prototype.sign=function(r,e,t){var n=kI(t),a=n+e(r).toString(),o=SI(a,this.n.bitLength()/4);if(o==null)return null;var s=this.doPrivate(o);if(s==null)return null;var u=s.toString(16);return u.length&1?"0"+u:u},i.prototype.verify=function(r,e,t){var n=Se(e,16),a=this.doPublic(n);if(a==null)return null;var o=a.toString(16).replace(/^1f+00/,""),s=PI(o);return s==t(r).toString()},i}();function II(i,r){for(var e=i.toByteArray(),t=0;t=e.length)return null;for(var n="";++t191&&a<224?(n+=String.fromCharCode((a&31)<<6|e[t+1]&63),++t):(n+=String.fromCharCode((a&15)<<12|(e[t+1]&63)<<6|e[t+2]&63),t+=2)}return n}var uu={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function kI(i){return uu[i]||""}function PI(i){for(var r in uu)if(uu.hasOwnProperty(r)){var e=uu[r],t=e.length;if(i.substr(0,t)==e)return i.substr(t)}return i}/*! Copyright (c) 2011, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html version: 2.9.0 -*/var Ne={};Ne.lang={extend:function(i,r,e){if(!r||!i)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var t=function(){};if(t.prototype=r.prototype,i.prototype=new t,i.prototype.constructor=i,i.superclass=r.prototype,r.prototype.constructor==Object.prototype.constructor&&(r.prototype.constructor=r),e){var n;for(n in e)i.prototype[n]=e[n];var a=function(){},o=["toString","valueOf"];try{/MSIE/.test(navigator.userAgent)&&(a=function(s,u){for(n=0;nMIT License - */var T={};(typeof T.asn1>"u"||!T.asn1)&&(T.asn1={});T.asn1.ASN1Util=new function(){this.integerToByteHex=function(i){var r=i.toString(16);return r.length%2==1&&(r="0"+r),r},this.bigIntToMinTwosComplementsHex=function(i){var r=i.toString(16);if(r.substr(0,1)!="-")r.length%2==1?r="0"+r:r.match(/^[0-7]/)||(r="00"+r);else{var e=r.substr(1),t=e.length;t%2==1?t+=1:r.match(/^[0-7]/)||(t+=2);for(var n="",a=0;a"u"||this.hV==null)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+i.length+",v="+this.hV;var r=this.hV.length/2,e=r.toString(16);if(e.length%2==1&&(e="0"+e),r<128)return e;var t=e.length/2;if(t>15)throw"ASN.1 length too long to represent by 8x: n = "+r.toString(16);var n=128+t;return n.toString(16)+e},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}};T.asn1.DERAbstractString=function(i){T.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(r){this.hTLV=null,this.isModified=!0,this.s=r,this.hV=stohex(this.s)},this.setStringHex=function(r){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i=="string"?this.setString(i):typeof i.str<"u"?this.setString(i.str):typeof i.hex<"u"&&this.setStringHex(i.hex))};Ne.lang.extend(T.asn1.DERAbstractString,T.asn1.ASN1Object);T.asn1.DERAbstractTime=function(i){T.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(r){utc=r.getTime()+r.getTimezoneOffset()*6e4;var e=new Date(utc);return e},this.formatDate=function(r,e,t){var n=this.zeroPadding,a=this.localDateToUTC(r),o=String(a.getFullYear());e=="utc"&&(o=o.substr(2,2));var s=n(String(a.getMonth()+1),2),u=n(String(a.getDate()),2),l=n(String(a.getHours()),2),h=n(String(a.getMinutes()),2),d=n(String(a.getSeconds()),2),c=o+s+u+l+h+d;if(t===!0){var f=a.getMilliseconds();if(f!=0){var v=n(String(f),3);v=v.replace(/[0]+$/,""),c=c+"."+v}}return c+"Z"},this.zeroPadding=function(r,e){return r.length>=e?r:new Array(e-r.length+1).join("0")+r},this.getString=function(){return this.s},this.setString=function(r){this.hTLV=null,this.isModified=!0,this.s=r,this.hV=stohex(r)},this.setByDateValue=function(r,e,t,n,a,o){var s=new Date(Date.UTC(r,e-1,t,n,a,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}};Ne.lang.extend(T.asn1.DERAbstractTime,T.asn1.ASN1Object);T.asn1.DERAbstractStructured=function(i){T.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array=r},this.appendASN1Object=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array.push(r)},this.asn1Array=new Array,typeof i<"u"&&typeof i.array<"u"&&(this.asn1Array=i.array)};Ne.lang.extend(T.asn1.DERAbstractStructured,T.asn1.ASN1Object);T.asn1.DERBoolean=function(){T.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"};Ne.lang.extend(T.asn1.DERBoolean,T.asn1.ASN1Object);T.asn1.DERInteger=function(i){T.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(r){this.hTLV=null,this.isModified=!0,this.hV=T.asn1.ASN1Util.bigIntToMinTwosComplementsHex(r)},this.setByInteger=function(r){var e=new Q(String(r),10);this.setByBigInteger(e)},this.setValueHex=function(r){this.hV=r},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i.bigint<"u"?this.setByBigInteger(i.bigint):typeof i.int<"u"?this.setByInteger(i.int):typeof i=="number"?this.setByInteger(i):typeof i.hex<"u"&&this.setValueHex(i.hex))};Ne.lang.extend(T.asn1.DERInteger,T.asn1.ASN1Object);T.asn1.DERBitString=function(i){if(i!==void 0&&typeof i.obj<"u"){var r=T.asn1.ASN1Util.newObject(i.obj);i.hex="00"+r.getEncodedHex()}T.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7"u"&&typeof this.s>"u"&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{12}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date))};Ne.lang.extend(T.asn1.DERUTCTime,T.asn1.DERAbstractTime);T.asn1.DERGeneralizedTime=function(i){T.asn1.DERGeneralizedTime.superclass.constructor.call(this,i),this.hT="18",this.withMillis=!1,this.setByDate=function(r){this.hTLV=null,this.isModified=!0,this.date=r,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{14}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date),i.millis===!0&&(this.withMillis=!0))};Ne.lang.extend(T.asn1.DERGeneralizedTime,T.asn1.DERAbstractTime);T.asn1.DERSequence=function(i){T.asn1.DERSequence.superclass.constructor.call(this,i),this.hT="30",this.getFreshValueHex=function(){for(var r="",e=0;e"u"||!T.asn1)&&(T.asn1={});T.asn1.ASN1Util=new function(){this.integerToByteHex=function(i){var r=i.toString(16);return r.length%2==1&&(r="0"+r),r},this.bigIntToMinTwosComplementsHex=function(i){var r=i.toString(16);if(r.substr(0,1)!="-")r.length%2==1?r="0"+r:r.match(/^[0-7]/)||(r="00"+r);else{var e=r.substr(1),t=e.length;t%2==1?t+=1:r.match(/^[0-7]/)||(t+=2);for(var n="",a=0;a"u"||this.hV==null)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+i.length+",v="+this.hV;var r=this.hV.length/2,e=r.toString(16);if(e.length%2==1&&(e="0"+e),r<128)return e;var t=e.length/2;if(t>15)throw"ASN.1 length too long to represent by 8x: n = "+r.toString(16);var n=128+t;return n.toString(16)+e},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}};T.asn1.DERAbstractString=function(i){T.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(r){this.hTLV=null,this.isModified=!0,this.s=r,this.hV=stohex(this.s)},this.setStringHex=function(r){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i=="string"?this.setString(i):typeof i.str<"u"?this.setString(i.str):typeof i.hex<"u"&&this.setStringHex(i.hex))};Me.lang.extend(T.asn1.DERAbstractString,T.asn1.ASN1Object);T.asn1.DERAbstractTime=function(i){T.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(r){utc=r.getTime()+r.getTimezoneOffset()*6e4;var e=new Date(utc);return e},this.formatDate=function(r,e,t){var n=this.zeroPadding,a=this.localDateToUTC(r),o=String(a.getFullYear());e=="utc"&&(o=o.substr(2,2));var s=n(String(a.getMonth()+1),2),u=n(String(a.getDate()),2),l=n(String(a.getHours()),2),h=n(String(a.getMinutes()),2),c=n(String(a.getSeconds()),2),d=o+s+u+l+h+c;if(t===!0){var f=a.getMilliseconds();if(f!=0){var v=n(String(f),3);v=v.replace(/[0]+$/,""),d=d+"."+v}}return d+"Z"},this.zeroPadding=function(r,e){return r.length>=e?r:new Array(e-r.length+1).join("0")+r},this.getString=function(){return this.s},this.setString=function(r){this.hTLV=null,this.isModified=!0,this.s=r,this.hV=stohex(r)},this.setByDateValue=function(r,e,t,n,a,o){var s=new Date(Date.UTC(r,e-1,t,n,a,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}};Me.lang.extend(T.asn1.DERAbstractTime,T.asn1.ASN1Object);T.asn1.DERAbstractStructured=function(i){T.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array=r},this.appendASN1Object=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array.push(r)},this.asn1Array=new Array,typeof i<"u"&&typeof i.array<"u"&&(this.asn1Array=i.array)};Me.lang.extend(T.asn1.DERAbstractStructured,T.asn1.ASN1Object);T.asn1.DERBoolean=function(){T.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"};Me.lang.extend(T.asn1.DERBoolean,T.asn1.ASN1Object);T.asn1.DERInteger=function(i){T.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(r){this.hTLV=null,this.isModified=!0,this.hV=T.asn1.ASN1Util.bigIntToMinTwosComplementsHex(r)},this.setByInteger=function(r){var e=new Q(String(r),10);this.setByBigInteger(e)},this.setValueHex=function(r){this.hV=r},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i.bigint<"u"?this.setByBigInteger(i.bigint):typeof i.int<"u"?this.setByInteger(i.int):typeof i=="number"?this.setByInteger(i):typeof i.hex<"u"&&this.setValueHex(i.hex))};Me.lang.extend(T.asn1.DERInteger,T.asn1.ASN1Object);T.asn1.DERBitString=function(i){if(i!==void 0&&typeof i.obj<"u"){var r=T.asn1.ASN1Util.newObject(i.obj);i.hex="00"+r.getEncodedHex()}T.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7"u"&&typeof this.s>"u"&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{12}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date))};Me.lang.extend(T.asn1.DERUTCTime,T.asn1.DERAbstractTime);T.asn1.DERGeneralizedTime=function(i){T.asn1.DERGeneralizedTime.superclass.constructor.call(this,i),this.hT="18",this.withMillis=!1,this.setByDate=function(r){this.hTLV=null,this.isModified=!0,this.date=r,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{14}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date),i.millis===!0&&(this.withMillis=!0))};Me.lang.extend(T.asn1.DERGeneralizedTime,T.asn1.DERAbstractTime);T.asn1.DERSequence=function(i){T.asn1.DERSequence.superclass.constructor.call(this,i),this.hT="30",this.getFreshValueHex=function(){for(var r="",e=0;elocalStorage.getItem("chatApiKey"),Ba=()=>{const i=localStorage.getItem("openaiApiKey"),r=localStorage.getItem("openaiBaseUrl")||"https://api.openai.com/v1",e=localStorage.getItem("rsaPublicKey");return{openaiApiKey:i||"",openaiBaseUrl:r,rsaPublicKey:e}},Ii=()=>navigator.language||"zh-CN",yn=i=>{const r=i.headers.get("User-Api-Key");r&&!localStorage.getItem("chatApiKey")&&localStorage.setItem("chatApiKey",r)};var ri;(i=>{async function r(u){try{const l=Ti(),h=Ii();u.session_id=localStorage.getItem("sessionId")||null,fetch(`${Oi}/api/chat/track_event`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${l}`,"trace-id":Sr(),"Accept-Language":h},body:JSON.stringify(u)}).catch(d=>{console.warn("Track event failed:",d)})}catch(l){console.warn("Error preparing track event:",l)}return Promise.resolve()}i.trackEvent=r;async function*e(u,l,h=[],d=null,c=null,f){try{const v=Ti(),p=Ii(),{openaiApiKey:g,openaiBaseUrl:y,rsaPublicKey:m}=Ba(),b=Sr(),$=(h||[]).map(W=>new Promise((le,Ee)=>{const de=new FileReader;de.onloadend=()=>le(de.result),de.onerror=Ee,de.readAsDataURL(W)})),O=await Promise.all($);let _=c?Array.isArray(c)?c:[c]:[];const C={"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${v}`,"trace-id":f||Sr(),"Accept-Language":p};if(g&&g.trim()!==""&&m)try{const W=await xn(g,m);C["Encrypted-Openai-Api-Key"]=W,C["Openai-Base-Url"]=y}catch(W){console.error("Error encrypting OpenAI API key:",W)}const R=new AbortController,x=setTimeout(()=>R.abort(),12e4),B=await fetch(`${Oi}/api/chat/invoke`,{method:"POST",headers:C,body:JSON.stringify({session_id:u,prompt:l,mock:!1,intent:d,ext:_,images:O.map((W,le)=>({filename:h[le].name,data:W}))}),signal:R.signal});clearTimeout(x),yn(B);const j=B.body.getReader();let X="";for(;;){const{done:W,value:le}=await j.read();if(W)break;X+=new TextDecoder().decode(le);const Ee=X.split(` -`);X=Ee.pop()||"";for(const de of Ee)de.trim()&&(yield{...JSON.parse(de),message_id:b})}X.trim()&&(yield{...JSON.parse(X),message_id:b})}catch(v){throw console.error("Error in streamInvokeServer:",v),v.name==="AbortError"?alert("Request timed out after 2 minutes. Please try again."):alert(v instanceof Error?v.message:"An error occurred while streaming, please refresh the page and try again."),v}}i.streamInvokeServer=e;async function t(u,l){try{const h=Ti(),d=Ii(),{openaiApiKey:c,openaiBaseUrl:f,rsaPublicKey:v}=Ba(),p={"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${h}`,"trace-id":Sr(),"Accept-Language":d};if(c&&c.trim()!==""&&v)try{const m=await xn(c,v);p["Encrypted-Openai-Api-Key"]=m,p["Openai-Base-Url"]=f}catch(m){console.error("Error encrypting OpenAI API key:",m)}const g=await fetch(`${Oi}/api/chat/get_optimized_workflow`,{method:"POST",headers:p,body:JSON.stringify({workflow_id:u,prompt:l})});yn(g);const y=await g.json();if(!y.success){const m=y.message||"Failed to get optimized workflow";throw alert(m),new Error(m)}return y.data}catch(h){throw console.error("Error getting optimized workflow:",h),alert(h instanceof Error?h.message:"Failed to get optimized workflow"),h}}i.getOptimizedWorkflow=t;async function n(u){const l=Ti(),h=Ii(),{openaiApiKey:d,openaiBaseUrl:c,rsaPublicKey:f}=Ba(),v={"Content-Type":"application/json",Authorization:`Bearer ${l}`,"trace-id":Sr(),"Accept-Language":h};if(d&&d.trim()!==""&&f)try{const y=await xn(d,f);v["Encrypted-Openai-Api-Key"]=y,v["Openai-Base-Url"]=c}catch(y){console.error("Error encrypting OpenAI API key:",y)}const p=await fetch(`${Oi}/api/chat/get_node_info_by_types`,{method:"POST",headers:v,body:JSON.stringify({node_types:u})});yn(p);const g=await p.json();if(!g.success){const y=g.message||"Failed to get node info by types";throw alert(y),new Error(y)}return g.data}i.batchGetNodeInfo=n;async function a(u){try{const l=localStorage.getItem(`messages_${u}`);if(l)return console.log("Using cached messages from localStorage"),JSON.parse(l);const h=Ti(),d=Ii(),{openaiApiKey:c,openaiBaseUrl:f,rsaPublicKey:v}=Ba(),p={accept:"application/json",Authorization:`Bearer ${h}`,"trace-id":Sr(),"Accept-Language":d};if(c&&c.trim()!==""&&v)try{const b=await xn(c,v);p["Encrypted-Openai-Api-Key"]=b,p["Openai-Base-Url"]=f}catch(b){console.error("Error encrypting OpenAI API key:",b)}const g=await fetch(`${Oi}/api/chat/get_messages_by_session_id?session_id=${u}`,{method:"GET",headers:p});yn(g);const y=await g.json();if(!y.success){const b=y.message||"Failed to fetch messages";throw alert(b+", please refresh the page and try again."),new Error(b)}const m=y.data.map(b=>(console.log("msg.ext",b.ext),{id:b.id.toString(),content:b.role==="ai"?JSON.stringify({session_id:u,text:b.content,finished:b.finished||!1,format:b.format||"markdown",ext:b.ext}):b.content,role:b.role,name:b.role==="ai"?"Assistant":void 0,format:b.format||"markdown",finished:b.finished}));return localStorage.setItem(`messages_${u}`,JSON.stringify(m)),m}catch(l){throw console.error("Error fetching messages:",l),alert(l instanceof Error?l.message:"Failed to fetch messages, please refresh the page and try again."),l}}i.fetchMessages=a;async function o(){try{const u=Ti(),l=Ii(),{openaiApiKey:h,openaiBaseUrl:d,rsaPublicKey:c}=Ba(),f={accept:"application/json",Authorization:`Bearer ${u}`,"trace-id":Sr(),"Accept-Language":l};if(h&&h.trim()!==""&&c)try{const g=await xn(h,c);f["Encrypted-Openai-Api-Key"]=g,f["Openai-Base-Url"]=d}catch(g){console.error("Error encrypting OpenAI API key:",g)}const v=await fetch(`${Oi}/api/chat/announcement`,{method:"GET",headers:f});yn(v);const p=await v.json();if(!p.success){const g=p.message||"Failed to fetch announcement";return console.error(g),""}return p.data}catch(u){return console.error("Error fetching announcement:",u),""}}i.fetchAnnouncement=o;async function s(u){let h=0,d;for(;h<3;)try{const c=Ti(),f=Ii(),v={"Content-Type":"application/json",accept:"application/json",Authorization:`Bearer ${c}`,"trace-id":Sr(),"Accept-Language":f},p=await fetch(`${Oi}/api/param_debug/generate_sd_prompts`,{method:"POST",headers:v,body:JSON.stringify({text:u})});yn(p);const g=await p.json();if(!g.success){const y=g.message||"Failed to generate SD prompts";throw new Error(y)}return g.data}catch(c){if(d=c,h++,h>=3)throw console.error("Error generating SD prompts after 3 attempts:",c),c;console.warn(`Attempt ${h} failed, retrying... Error: ${c instanceof Error?c.message:"Unknown error"}`),await new Promise(f=>setTimeout(f,500*Math.pow(2,h-1)))}throw d}i.generateSDPrompts=s})(ri||(ri={}));function Y$({name:i,isUser:r=!1,children:e}){return S.jsx("div",{className:"flex flex-col w-full items-start gap-2 py-2 animate-fadeIn",children:S.jsx("div",{className:"w-full",children:e})})}function NI({title:i,titleId:r,...e},t){return Ve.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},e),i?Ve.createElement("title",{id:r},i):null,Ve.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const MI=Ve.forwardRef(NI);function Lpe({content:i,trace_id:r}){const[e,t]=Ve.useState(!1),[n,a]=Ve.useState(!1),o=async()=>{r&&(await navigator.clipboard.writeText(r),a(!0),setTimeout(()=>a(!1),2e3))};return S.jsx(Y$,{name:"User",isUser:!0,children:S.jsxs("div",{className:"w-full rounded-lg border border-gray-700 py-4 px-4 text-gray-700 text-sm break-words relative",children:[S.jsx("p",{className:"whitespace-pre-wrap leading-snug",children:i}),r&&S.jsxs("div",{className:"absolute bottom-1 right-1.5 cursor-pointer opacity-40 hover:opacity-100 transition-opacity",onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),onClick:o,children:[S.jsx(MI,{className:"h-3.5 w-3.5 text-gray-500 hover:text-gray-700"}),e&&S.jsx("div",{className:"absolute right-0 -top-6 bg-gray-700 text-white text-[10px] py-0.5 px-1.5 rounded shadow-sm whitespace-nowrap",children:n?"Copied!":"Copy trace ID"})]})]})})}const BI=Ve.memo(tI,(i,r)=>i.children===r.children&&i.className===r.className),FI=({content:i})=>S.jsxs("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-1 shadow-sm",children:[S.jsxs("div",{className:"flex items-center mb-1",children:[S.jsx("div",{className:"bg-blue-100 rounded-full p-1 mr-1",children:S.jsx("svg",{className:"h-4 w-4 text-blue-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),S.jsx("h3",{className:"text-sm font-medium text-blue-800",children:"Node Usage Guide"})]}),S.jsx("div",{className:"markdown-content text-blue-900",children:i})]}),jI=({content:i})=>S.jsxs("div",{className:"rounded-lg border border-green-200 bg-green-50 p-1 shadow-sm",children:[S.jsxs("div",{className:"flex items-center mb-1",children:[S.jsx("div",{className:"bg-green-100 rounded-full p-1 mr-1",children:S.jsxs("svg",{className:"h-4 w-4 text-green-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),S.jsx("h3",{className:"text-sm font-medium text-green-800",children:"Node Parameter Reference"})]}),S.jsx("div",{className:"markdown-content text-green-900",children:i})]});function zpe({content:i,name:r="Assistant",avatar:e,format:t,onOptionClick:n,extComponent:a,metadata:o}){const s=Ve.useRef(),u=(h,d)=>S.jsx(BI,{rehypePlugins:[[rI,{target:"_blank"}],iI],remarkPlugins:[nI,aI],className:`prose prose-xs prose-neutral prose-a:text-accent-foreground/50 break-words [&>*]:!my-1 leading-relaxed text-xs text-gray-800 +`,e+="-----END PUBLIC KEY-----",e},r.hasPublicKeyProperty=function(e){return e=e||{},e.hasOwnProperty("n")&&e.hasOwnProperty("e")},r.hasPrivateKeyProperty=function(e){return e=e||{},e.hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")},r.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},r}(TI),CI={},oh,AI=typeof process<"u"?(oh=CI)===null||oh===void 0?void 0:oh.npm_package_version:void 0,DI=function(){function i(r){r===void 0&&(r={}),r=r||{},this.default_key_size=r.default_key_size?parseInt(r.default_key_size,10):1024,this.default_public_exponent=r.default_public_exponent||"010001",this.log=r.log||!1,this.key=null}return i.prototype.setKey=function(r){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new kp(r)},i.prototype.setPrivateKey=function(r){this.setKey(r)},i.prototype.setPublicKey=function(r){this.setKey(r)},i.prototype.decrypt=function(r){try{return this.getKey().decrypt(wp(r))}catch{return!1}},i.prototype.encrypt=function(r){try{return Iu(this.getKey().encrypt(r))}catch{return!1}},i.prototype.sign=function(r,e,t){try{return Iu(this.getKey().sign(r,e,t))}catch{return!1}},i.prototype.verify=function(r,e,t){try{return this.getKey().verify(r,wp(e),t)}catch{return!1}},i.prototype.getKey=function(r){if(!this.key){if(this.key=new kp,r&&{}.toString.call(r)==="[object Function]"){this.key.generateAsync(this.default_key_size,this.default_public_exponent,r);return}this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},i.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},i.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},i.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},i.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},i.version=AI,i}();async function Fpe(){try{const r=await(await fetch(`${Ff.apiBaseUrl}/api/chat/rsa_public_key`)).json();if(!r.success)throw new Error(r.message||"Failed to fetch RSA public key");return r.data}catch(i){throw console.error("Error fetching RSA public key:",i),i}}async function xn(i,r){try{if(window.crypto&&window.crypto.subtle){const e="-----BEGIN PUBLIC KEY-----",n=r.substring(r.indexOf(e)+e.length,r.indexOf("-----END PUBLIC KEY-----")).replace(/\s/g,""),a=window.atob(n),o=new ArrayBuffer(a.length),s=new Uint8Array(o);for(let d=0;dlocalStorage.getItem("chatApiKey"),Ba=()=>{const i=localStorage.getItem("openaiApiKey"),r=localStorage.getItem("openaiBaseUrl")||"https://api.openai.com/v1",e=localStorage.getItem("rsaPublicKey");return{openaiApiKey:i||"",openaiBaseUrl:r,rsaPublicKey:e}},Kr=()=>navigator.language||"zh-CN",yn=i=>{const r=i.headers.get("User-Api-Key");r&&!localStorage.getItem("chatApiKey")&&localStorage.setItem("chatApiKey",r)};var ai;(i=>{async function r(l){try{const h=Ur(),c=Kr();l.session_id=localStorage.getItem("sessionId")||null,fetch(`${Wr}/api/chat/track_event`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${h}`,"trace-id":dr(),"Accept-Language":c},body:JSON.stringify(l)}).catch(d=>{console.warn("Track event failed:",d)})}catch(h){console.warn("Error preparing track event:",h)}return Promise.resolve()}i.trackEvent=r;async function*e(l,h,c=[],d=null,f=null,v){try{const p=Ur(),g=Kr(),{openaiApiKey:y,openaiBaseUrl:m,rsaPublicKey:$}=Ba(),b=dr(),O=(c||[]).map(ie=>new Promise((_e,ye)=>{const Ae=new FileReader;Ae.onloadend=()=>_e(Ae.result),Ae.onerror=ye,Ae.readAsDataURL(ie)})),_=await Promise.all(O);let D=f?Array.isArray(f)?f:[f]:[];const R={"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${p}`,"trace-id":v||dr(),"Accept-Language":g};if(y&&y.trim()!==""&&$)try{const ie=await xn(y,$);R["Encrypted-Openai-Api-Key"]=ie,R["Openai-Base-Url"]=m}catch(ie){console.error("Error encrypting OpenAI API key:",ie)}const P=new AbortController,B=setTimeout(()=>P.abort(),12e4),j=await fetch(`${Wr}/api/chat/invoke`,{method:"POST",headers:R,body:JSON.stringify({session_id:l,prompt:h,mock:!1,intent:d,ext:D,images:_.map((ie,_e)=>({filename:c[_e].name,data:ie}))}),signal:P.signal});clearTimeout(B),yn(j);const J=j.body.getReader();let U="";for(;;){const{done:ie,value:_e}=await J.read();if(ie)break;U+=new TextDecoder().decode(_e);const ye=U.split(` +`);U=ye.pop()||"";for(const Ae of ye)Ae.trim()&&(yield{...JSON.parse(Ae),message_id:b})}U.trim()&&(yield{...JSON.parse(U),message_id:b})}catch(p){throw console.error("Error in streamInvokeServer:",p),p.name==="AbortError"?alert("Request timed out after 2 minutes. Please try again."):alert(p instanceof Error?p.message:"An error occurred while streaming, please refresh the page and try again."),p}}i.streamInvokeServer=e;async function t(l,h){try{const c=Ur(),d=Kr(),{openaiApiKey:f,openaiBaseUrl:v,rsaPublicKey:p}=Ba(),g={"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${c}`,"trace-id":dr(),"Accept-Language":d};if(f&&f.trim()!==""&&p)try{const $=await xn(f,p);g["Encrypted-Openai-Api-Key"]=$,g["Openai-Base-Url"]=v}catch($){console.error("Error encrypting OpenAI API key:",$)}const y=await fetch(`${Wr}/api/chat/get_optimized_workflow`,{method:"POST",headers:g,body:JSON.stringify({workflow_id:l,prompt:h})});yn(y);const m=await y.json();if(!m.success){const $=m.message||"Failed to get optimized workflow";throw alert($),new Error($)}return m.data}catch(c){throw console.error("Error getting optimized workflow:",c),alert(c instanceof Error?c.message:"Failed to get optimized workflow"),c}}i.getOptimizedWorkflow=t;async function n(l){const h=Ur(),c=Kr(),{openaiApiKey:d,openaiBaseUrl:f,rsaPublicKey:v}=Ba(),p={"Content-Type":"application/json",Authorization:`Bearer ${h}`,"trace-id":dr(),"Accept-Language":c};if(d&&d.trim()!==""&&v)try{const m=await xn(d,v);p["Encrypted-Openai-Api-Key"]=m,p["Openai-Base-Url"]=f}catch(m){console.error("Error encrypting OpenAI API key:",m)}const g=await fetch(`${Wr}/api/chat/get_node_info_by_types`,{method:"POST",headers:p,body:JSON.stringify({node_types:l})});yn(g);const y=await g.json();if(!y.success){const m=y.message||"Failed to get node info by types";throw alert(m),new Error(m)}return y.data}i.batchGetNodeInfo=n;async function a(l){try{const h=localStorage.getItem(`messages_${l}`);if(h)return console.log("Using cached messages from localStorage"),JSON.parse(h);const c=Ur(),d=Kr(),{openaiApiKey:f,openaiBaseUrl:v,rsaPublicKey:p}=Ba(),g={accept:"application/json",Authorization:`Bearer ${c}`,"trace-id":dr(),"Accept-Language":d};if(f&&f.trim()!==""&&p)try{const b=await xn(f,p);g["Encrypted-Openai-Api-Key"]=b,g["Openai-Base-Url"]=v}catch(b){console.error("Error encrypting OpenAI API key:",b)}const y=await fetch(`${Wr}/api/chat/get_messages_by_session_id?session_id=${l}`,{method:"GET",headers:g});yn(y);const m=await y.json();if(!m.success){const b=m.message||"Failed to fetch messages";throw alert(b+", please refresh the page and try again."),new Error(b)}const $=m.data.map(b=>(console.log("msg.ext",b.ext),{id:b.id.toString(),content:b.role==="ai"?JSON.stringify({session_id:l,text:b.content,finished:b.finished||!1,format:b.format||"markdown",ext:b.ext}):b.content,role:b.role,name:b.role==="ai"?"Assistant":void 0,format:b.format||"markdown",finished:b.finished}));return localStorage.setItem(`messages_${l}`,JSON.stringify($)),$}catch(h){throw console.error("Error fetching messages:",h),alert(h instanceof Error?h.message:"Failed to fetch messages, please refresh the page and try again."),h}}i.fetchMessages=a;async function o(){try{const l=Ur(),h=Kr(),{openaiApiKey:c,openaiBaseUrl:d,rsaPublicKey:f}=Ba(),v={accept:"application/json",Authorization:`Bearer ${l}`,"trace-id":dr(),"Accept-Language":h};if(c&&c.trim()!==""&&f)try{const y=await xn(c,f);v["Encrypted-Openai-Api-Key"]=y,v["Openai-Base-Url"]=d}catch(y){console.error("Error encrypting OpenAI API key:",y)}const p=await fetch(`${Wr}/api/chat/announcement`,{method:"GET",headers:v});yn(p);const g=await p.json();if(!g.success){const y=g.message||"Failed to fetch announcement";return console.error(y),""}return g.data}catch(l){return console.error("Error fetching announcement:",l),""}}i.fetchAnnouncement=o;async function s(l){let c=0,d;for(;c<3;)try{const f=Ur(),v=Kr(),p={"Content-Type":"application/json",accept:"application/json",Authorization:`Bearer ${f}`,"trace-id":dr(),"Accept-Language":v},g=await fetch(`${Wr}/api/param_debug/generate_sd_prompts`,{method:"POST",headers:p,body:JSON.stringify({text:l})});yn(g);const y=await g.json();if(!y.success){const m=y.message||"Failed to generate SD prompts";throw new Error(m)}return y.data}catch(f){if(d=f,c++,c>=3)throw console.error("Error generating SD prompts after 3 attempts:",f),f;console.warn(`Attempt ${c} failed, retrying... Error: ${f instanceof Error?f.message:"Unknown error"}`),await new Promise(v=>setTimeout(v,500*Math.pow(2,c-1)))}throw d}i.generateSDPrompts=s;async function u(){const l=Ur(),h=Kr(),c={"Content-Type":"application/json",accept:"application/json",Authorization:`Bearer ${l}`,"trace-id":dr(),"Accept-Language":h};return await(await fetch(`${Wr}/v1/models`,{method:"GET",headers:c})).json()}i.listModels=u})(ai||(ai={}));function Y$({name:i,isUser:r=!1,children:e}){return S.jsx("div",{className:"flex flex-col w-full items-start gap-2 py-2 animate-fadeIn",children:S.jsx("div",{className:"w-full",children:e})})}function NI({title:i,titleId:r,...e},t){return We.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},e),i?We.createElement("title",{id:r},i):null,We.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const MI=We.forwardRef(NI);function Lpe({content:i,trace_id:r}){const[e,t]=We.useState(!1),[n,a]=We.useState(!1),o=async()=>{r&&(await navigator.clipboard.writeText(r),a(!0),setTimeout(()=>a(!1),2e3))};return S.jsx(Y$,{name:"User",isUser:!0,children:S.jsxs("div",{className:"w-full rounded-lg border border-gray-700 py-4 px-4 text-gray-700 text-sm break-words relative",children:[S.jsx("p",{className:"whitespace-pre-wrap leading-snug",children:i}),r&&S.jsxs("div",{className:"absolute bottom-1 right-1.5 cursor-pointer opacity-40 hover:opacity-100 transition-opacity",onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),onClick:o,children:[S.jsx(MI,{className:"h-3.5 w-3.5 text-gray-500 hover:text-gray-700"}),e&&S.jsx("div",{className:"absolute right-0 -top-6 bg-gray-700 text-white text-[10px] py-0.5 px-1.5 rounded shadow-sm whitespace-nowrap",children:n?"Copied!":"Copy trace ID"})]})]})})}const BI=We.memo(tI,(i,r)=>i.children===r.children&&i.className===r.className),FI=({content:i})=>S.jsxs("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-1 shadow-sm",children:[S.jsxs("div",{className:"flex items-center mb-1",children:[S.jsx("div",{className:"bg-blue-100 rounded-full p-1 mr-1",children:S.jsx("svg",{className:"h-4 w-4 text-blue-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),S.jsx("h3",{className:"text-sm font-medium text-blue-800",children:"Node Usage Guide"})]}),S.jsx("div",{className:"markdown-content text-blue-900",children:i})]}),jI=({content:i})=>S.jsxs("div",{className:"rounded-lg border border-green-200 bg-green-50 p-1 shadow-sm",children:[S.jsxs("div",{className:"flex items-center mb-1",children:[S.jsx("div",{className:"bg-green-100 rounded-full p-1 mr-1",children:S.jsxs("svg",{className:"h-4 w-4 text-green-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),S.jsx("h3",{className:"text-sm font-medium text-green-800",children:"Node Parameter Reference"})]}),S.jsx("div",{className:"markdown-content text-green-900",children:i})]});function zpe({content:i,name:r="Assistant",avatar:e,format:t,onOptionClick:n,extComponent:a,metadata:o}){const s=We.useRef(),u=(h,c)=>S.jsx(BI,{rehypePlugins:[[rI,{target:"_blank"}],iI],remarkPlugins:[nI,aI],className:`prose prose-xs prose-neutral prose-a:text-accent-foreground/50 break-words [&>*]:!my-1 leading-relaxed text-xs text-gray-800 prose-headings:font-semibold prose-h1:text-base prose-h2:text-sm @@ -36,13 +36,13 @@ version: 2.9.0 prose-li:text-xs prose-code:text-xs prose-pre:text-xs - `,components:{p:({children:c})=>S.jsx("p",{className:"!my-0.5 leading-relaxed text-xs",children:c}),strong:({children:c})=>S.jsx("strong",{className:"text-gray-900",children:c}),h1:({children:c})=>S.jsx("h1",{className:"text-base font-semibold !my-1",children:c}),h2:({children:c})=>S.jsx("h2",{className:"text-sm font-semibold !my-1",children:c}),h3:({children:c})=>S.jsx("h3",{className:"text-xs font-semibold !my-1",children:c}),h4:({children:c})=>S.jsx("h4",{className:"text-xs font-semibold !my-1",children:c}),table:({children:c})=>S.jsx("table",{className:"border-solid border w-[100%] text-xs",children:c}),th:({children:c})=>S.jsx("th",{className:"border-solid border text-center pt-2 text-xs",children:c}),td:({children:c})=>{if(Array.isArray(c)&&c?.length>0){const f=[],v=c.length;for(let p=0;p"?f.push(S.jsx("br",{})):f.push(c[p]);c=f}return S.jsx("td",{className:"border-solid border border-[#979797] text-center text-xs",children:c})},code:({children:c})=>{const[f,v]=Ve.useState(!1),p=async()=>{try{await navigator.clipboard.writeText(c),v(!0),setTimeout(()=>v(!1),2e3)}catch(g){console.error("Failed to copy text:",g)}};return S.jsxs("span",{className:"relative group inline-flex items-center",children:[S.jsx("code",{className:"text-xs bg-gray-100 text-gray-900 rounded px-1",children:c}),S.jsx("button",{onClick:p,className:"absolute top-0 right-0 bg-gray-200 rounded p-1 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-gray-300 z-10","aria-label":"Copy code",children:f?S.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:S.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):S.jsxs("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:[S.jsx("path",{d:"M8 2a1 1 0 000 2h2a1 1 0 100-2H8z"}),S.jsx("path",{d:"M3 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v6h-4.586l1.293-1.293a1 1 0 00-1.414-1.414l-3 3a1 1 0 000 1.414l3 3a1 1 0 001.414-1.414L10.414 13H15v3a2 2 0 01-2 2H5a2 2 0 01-2-2V5z"})]})})]})},pre:({children:c})=>S.jsx("pre",{className:"text-xs bg-gray-100 text-gray-800 rounded p-2 overflow-x-auto",children:c}),img:({node:c,...f})=>S.jsx("div",{className:"w-1/2 mx-auto",children:S.jsx("img",{...f,loading:"lazy",className:"w-full h-auto block",onError:v=>{console.warn("Image failed to load:",f.src,"Error:",v),v.currentTarget.style.opacity="0"}})}),a:({href:c,children:f})=>{let v="markdown",p=null;try{const g=JSON.parse(i);v=g.ext?.[0]?.type||"markdown",p=g?.message_id}catch(g){console.error("Error parsing content:",g)}return S.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",onClick:()=>{ri.trackEvent({event_type:"markdown_link_click",message_type:v,message_id:p,data:{link_url:c,link_text:f}})},children:f})}},children:h}),l=()=>{try{const h=JSON.parse(i),d=h.ext?.find(c=>c.type==="guides")?.data||[];if(o?.intent){const c=o.intent;if(c==="node_explain")return S.jsx(FI,{content:u(h.text||"")});if(c==="node_params")return S.jsx(jI,{content:u(h.text||"")})}return S.jsxs("div",{className:"space-y-3",children:[t==="markdown"&&h.text?S.jsx("div",{ref:s,children:u(h.text)}):h.text?S.jsx("p",{className:"whitespace-pre-wrap text-left",children:h.text}):null,d.length>0&&S.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:d.map((c,f)=>S.jsx("button",{className:"px-3 py-1.5 text-gray-700 rounded-md hover:bg-gray-50 transition-colors text-[12px] w-[calc(50%-0.25rem)]",onClick:()=>n?.(c),children:c},f))}),a]})}catch{return S.jsx("p",{className:"whitespace-pre-wrap text-left",children:i})}};return S.jsx(Y$,{name:r,children:S.jsx("div",{className:"w-full rounded-lg bg-gray-50 p-4 text-gray-900 text-sm break-words overflow-hidden",children:l()})})}const LI=LiteGraph;function X$(i,r={}){const e=LI.createNode(i,"",r);if(!r.pos){const t=Mt.canvas.canvas.getBoundingClientRect(),n=t.width/2/Mt.canvas.ds.scale+-Mt.canvas.ds.offset[0]/Mt.canvas.ds.scale,a=t.height/2/Mt.canvas.ds.scale+-Mt.canvas.ds.offset[1]/Mt.canvas.ds.scale;e.pos=[n-e.size[0]/2,a-e.size[1]/2]}return Mt.graph.add(e),e}function zI({content:i,name:r="Assistant",avatar:e,installedNodes:t}){const n=JSON.parse(i),[a,o]=Ve.useState(null),[s,u]=Ve.useState(null),l=n.ext?.find(g=>g.type==="node")?.data||[],h=g=>t.some(y=>y===g),d=l.filter(g=>h(g.name)),c=l.filter(g=>!h(g.name)),f=g=>g>=1e4?`${(g/1e4).toFixed(1)}w`:g>=1e3?`${(g/1e3).toFixed(1)}k`:g.toString(),v=g=>{o(g.name),u(g)},p=()=>{o(null),u(null)};return S.jsxs("div",{className:"rounded-lg bg-gray-50 p-3 text-gray-700 text-xs break-words overflow-visible",children:[d.length>0&&S.jsxs("div",{className:"space-y-3",children:[S.jsx("p",{className:"text-xs font-medium",children:"Installed nodes:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:d.map(g=>S.jsxs("div",{className:`w-full p-3 rounded-lg border border-gray-200 + `,components:{p:({children:d})=>S.jsx("p",{className:"!my-0.5 leading-relaxed text-xs",children:d}),strong:({children:d})=>S.jsx("strong",{className:"text-gray-900",children:d}),h1:({children:d})=>S.jsx("h1",{className:"text-base font-semibold !my-1",children:d}),h2:({children:d})=>S.jsx("h2",{className:"text-sm font-semibold !my-1",children:d}),h3:({children:d})=>S.jsx("h3",{className:"text-xs font-semibold !my-1",children:d}),h4:({children:d})=>S.jsx("h4",{className:"text-xs font-semibold !my-1",children:d}),table:({children:d})=>S.jsx("table",{className:"border-solid border w-[100%] text-xs",children:d}),th:({children:d})=>S.jsx("th",{className:"border-solid border text-center pt-2 text-xs",children:d}),td:({children:d})=>{if(Array.isArray(d)&&d?.length>0){const f=[],v=d.length;for(let p=0;p"?f.push(S.jsx("br",{})):f.push(d[p]);d=f}return S.jsx("td",{className:"border-solid border border-[#979797] text-center text-xs",children:d})},code:({children:d})=>{const[f,v]=We.useState(!1),p=async()=>{try{await navigator.clipboard.writeText(d),v(!0),setTimeout(()=>v(!1),2e3)}catch(g){console.error("Failed to copy text:",g)}};return S.jsxs("span",{className:"relative group inline-flex items-center",children:[S.jsx("code",{className:"text-xs bg-gray-100 text-gray-900 rounded px-1",children:d}),S.jsx("button",{onClick:p,className:"absolute top-0 right-0 bg-gray-200 rounded p-1 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-gray-300 z-10","aria-label":"Copy code",children:f?S.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:S.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):S.jsxs("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:[S.jsx("path",{d:"M8 2a1 1 0 000 2h2a1 1 0 100-2H8z"}),S.jsx("path",{d:"M3 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v6h-4.586l1.293-1.293a1 1 0 00-1.414-1.414l-3 3a1 1 0 000 1.414l3 3a1 1 0 001.414-1.414L10.414 13H15v3a2 2 0 01-2 2H5a2 2 0 01-2-2V5z"})]})})]})},pre:({children:d})=>S.jsx("pre",{className:"text-xs bg-gray-100 text-gray-800 rounded p-2 overflow-x-auto",children:d}),img:({node:d,...f})=>S.jsx("div",{className:"w-1/2 mx-auto",children:S.jsx("img",{...f,loading:"lazy",className:"w-full h-auto block",onError:v=>{console.warn("Image failed to load:",f.src,"Error:",v),v.currentTarget.style.opacity="0"}})}),a:({href:d,children:f})=>{let v="markdown",p=null;try{const g=JSON.parse(i);v=g.ext?.[0]?.type||"markdown",p=g?.message_id}catch(g){console.error("Error parsing content:",g)}return S.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",onClick:()=>{ai.trackEvent({event_type:"markdown_link_click",message_type:v,message_id:p,data:{link_url:d,link_text:f}})},children:f})}},children:h}),l=()=>{try{const h=JSON.parse(i),c=h.ext?.find(d=>d.type==="guides")?.data||[];if(o?.intent){const d=o.intent;if(d==="node_explain")return S.jsx(FI,{content:u(h.text||"")});if(d==="node_params")return S.jsx(jI,{content:u(h.text||"")})}return S.jsxs("div",{className:"space-y-3",children:[t==="markdown"&&h.text?S.jsx("div",{ref:s,children:u(h.text)}):h.text?S.jsx("p",{className:"whitespace-pre-wrap text-left",children:h.text}):null,c.length>0&&S.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:c.map((d,f)=>S.jsx("button",{className:"px-3 py-1.5 text-gray-700 rounded-md hover:bg-gray-50 transition-colors text-[12px] w-[calc(50%-0.25rem)]",onClick:()=>n?.(d),children:d},f))}),a]})}catch{return S.jsx("p",{className:"whitespace-pre-wrap text-left",children:i})}};return S.jsx(Y$,{name:r,children:S.jsx("div",{className:"w-full rounded-lg bg-gray-50 p-4 text-gray-900 text-sm break-words overflow-hidden",children:l()})})}const LI=LiteGraph;function X$(i,r={}){const e=LI.createNode(i,"",r);if(!r.pos){const t=Mt.canvas.canvas.getBoundingClientRect(),n=t.width/2/Mt.canvas.ds.scale+-Mt.canvas.ds.offset[0]/Mt.canvas.ds.scale,a=t.height/2/Mt.canvas.ds.scale+-Mt.canvas.ds.offset[1]/Mt.canvas.ds.scale;e.pos=[n-e.size[0]/2,a-e.size[1]/2]}return Mt.graph.add(e),e}function zI({content:i,name:r="Assistant",avatar:e,installedNodes:t}){const n=JSON.parse(i),[a,o]=We.useState(null),[s,u]=We.useState(null),l=n.ext?.find(g=>g.type==="node")?.data||[],h=g=>t.some(y=>y===g),c=l.filter(g=>h(g.name)),d=l.filter(g=>!h(g.name)),f=g=>g>=1e4?`${(g/1e4).toFixed(1)}w`:g>=1e3?`${(g/1e3).toFixed(1)}k`:g.toString(),v=g=>{o(g.name),u(g)},p=()=>{o(null),u(null)};return S.jsxs("div",{className:"rounded-lg bg-gray-50 p-3 text-gray-700 text-xs break-words overflow-visible",children:[c.length>0&&S.jsxs("div",{className:"space-y-3",children:[S.jsx("p",{className:"text-xs font-medium",children:"Installed nodes:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:c.map(g=>S.jsxs("div",{className:`w-full p-3 rounded-lg border border-gray-200 hover:shadow-sm transition-all duration-200 relative group`,onMouseEnter:()=>v(g),onMouseLeave:p,children:[S.jsx("h3",{className:"text-[12px] font-medium text-gray-800 mb-4",children:g.name}),S.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[S.jsxs("div",{className:"flex items-center gap-1 text-gray-600",children:[S.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{d:"M12 .25a.75.75 0 0 1 .673.418l3.058 6.197 6.839.994a.75.75 0 0 1 .415 1.279l-4.948 4.823 1.168 6.811a.75.75 0 0 1-1.088.791L12 18.347l-6.117 3.216a.75.75 0 0 1-1.088-.79l1.168-6.812-4.948-4.823a.75.75 0 0 1 .416-1.28l6.838-.993L11.327.668A.75.75 0 0 1 12 .25z"})}),S.jsx("span",{children:f(g.github_stars||0)})]}),S.jsxs("button",{className:`px-2 py-1 bg-blue-500 text-white rounded-md - hover:bg-blue-600 transition-colors text-[10px] flex items-center gap-1`,onClick:()=>{const y=X$(g.name);y&&(y.connect(g.from_index,y,g.to_index),ri.trackEvent({event_type:"node_add_to_canvas",message_type:"node",message_id:n.message_id,data:{node_name:g.name}}))},children:[S.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add to Canvas"]})]})]},g.name))})]}),c.length>0&&S.jsxs("div",{className:`space-y-3 ${d.length>0?"mt-4":""}`,children:[S.jsx("p",{className:"text-xs font-medium",children:"Uninstalled nodes:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:c.map(g=>S.jsxs("div",{className:`w-full p-3 rounded-lg border border-gray-200 + hover:bg-blue-600 transition-colors text-[10px] flex items-center gap-1`,onClick:()=>{const y=X$(g.name);y&&(y.connect(g.from_index,y,g.to_index),ai.trackEvent({event_type:"node_add_to_canvas",message_type:"node",message_id:n.message_id,data:{node_name:g.name}}))},children:[S.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add to Canvas"]})]})]},g.name))})]}),d.length>0&&S.jsxs("div",{className:`space-y-3 ${c.length>0?"mt-4":""}`,children:[S.jsx("p",{className:"text-xs font-medium",children:"Uninstalled nodes:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:d.map(g=>S.jsxs("div",{className:`w-full p-3 rounded-lg border border-gray-200 hover:shadow-sm transition-all duration-200 relative group`,onMouseEnter:()=>v(g),onMouseLeave:p,children:[S.jsx("h3",{className:"text-[12px] font-medium text-gray-800 mb-4",children:g.name}),S.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[S.jsxs("div",{className:"flex items-center gap-1 text-gray-600",children:[S.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{d:"M12 .25a.75.75 0 0 1 .673.418l3.058 6.197 6.839.994a.75.75 0 0 1 .415 1.279l-4.948 4.823 1.168 6.811a.75.75 0 0 1-1.088.791L12 18.347l-6.117 3.216a.75.75 0 0 1-1.088-.79l1.168-6.812-4.948-4.823a.75.75 0 0 1 .416-1.28l6.838-.993L11.327.668A.75.75 0 0 1 12 .25z"})}),S.jsx("span",{children:f(g.github_stars||0)})]}),g.github_url?S.jsxs("a",{href:g.github_url,target:"_blank",rel:"noopener noreferrer",className:`px-2 py-1 text-gray-900 rounded-md border border-gray-900 hover:bg-gray-100 - transition-colors text-[10px] flex items-center gap-1`,onClick:()=>{ri.trackEvent({event_type:"node_download",message_type:"node",message_id:n.message_id,data:{node_name:g.name,github_url:g.github_url}})},children:[S.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}):S.jsxs("a",{href:`https://www.google.com/search?q=${encodeURIComponent(g.name+" comfyui custom node")}`,target:"_blank",rel:"noopener noreferrer",className:`px-2 py-1 bg-gray-100 text-gray-500 rounded-md - border border-gray-300 text-[10px] flex items-center gap-1`,onClick:()=>{ri.trackEvent({event_type:"node_search",message_type:"node",message_id:n.message_id,data:{node_name:g.name}})},children:[S.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 21h7a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v11m0 5l4.879-4.879m0 0a3 3 0 104.243-4.242 3 3 0 00-4.243 4.242z"})}),"Search on Google"]})]})]},g.name))})]}),a&&s?.description&&S.jsxs("div",{className:`fixed -translate-y-full z-[9999] w-64 p-2 + transition-colors text-[10px] flex items-center gap-1`,onClick:()=>{ai.trackEvent({event_type:"node_download",message_type:"node",message_id:n.message_id,data:{node_name:g.name,github_url:g.github_url}})},children:[S.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}):S.jsxs("a",{href:`https://www.google.com/search?q=${encodeURIComponent(g.name+" comfyui custom node")}`,target:"_blank",rel:"noopener noreferrer",className:`px-2 py-1 bg-gray-100 text-gray-500 rounded-md + border border-gray-300 text-[10px] flex items-center gap-1`,onClick:()=>{ai.trackEvent({event_type:"node_search",message_type:"node",message_id:n.message_id,data:{node_name:g.name}})},children:[S.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 21h7a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v11m0 5l4.879-4.879m0 0a3 3 0 104.243-4.242 3 3 0 00-4.243 4.242z"})}),"Search on Google"]})]})]},g.name))})]}),a&&s?.description&&S.jsxs("div",{className:`fixed -translate-y-full z-[9999] w-64 p-2 bg-gray-800 text-white text-xs rounded-md shadow-lg mb-2`,style:{left:"calc(var(--mouse-x, 0) + 16px)",top:"calc(var(--mouse-y, 0) - 8px)"},children:[s.description,S.jsx("div",{className:`absolute -bottom-1 left-1/2 -translate-x-1/2 border-4 border-transparent border-t-gray-800`})]})]})}const Hpe=Object.freeze(Object.defineProperty({__proto__:null,NodeSearch:zI},Symbol.toStringTag,{value:"Module"}));/** * vis-data @@ -68,19 +68,19 @@ version: 2.9.0 * http://opensource.org/licenses/MIT * * vis.js may be distributed under either license. - */function tl(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")}var sh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Y(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var J$={exports:{}},Es=function(i){return i&&i.Math===Math&&i},$e=Es(typeof globalThis=="object"&&globalThis)||Es(typeof window=="object"&&window)||Es(typeof self=="object"&&self)||Es(typeof sh=="object"&&sh)||function(){return this}()||sh||Function("return this")(),ue=function(i){try{return!!i()}catch{return!0}},HI=ue,Oo=!HI(function(){var i=function(){}.bind();return typeof i!="function"||i.hasOwnProperty("prototype")}),VI=Oo,Z$=Function.prototype,Pp=Z$.apply,xp=Z$.call,ha=typeof Reflect=="object"&&Reflect.apply||(VI?xp.bind(Pp):function(){return xp.apply(Pp,arguments)}),Q$=Oo,e0=Function.prototype,Ed=e0.call,WI=Q$&&e0.bind.bind(Ed,Ed),be=Q$?WI:function(i){return function(){return Ed.apply(i,arguments)}},t0=be,UI=t0({}.toString),KI=t0("".slice),vi=function(i){return KI(UI(i),8,-1)},GI=vi,qI=be,r0=function(i){if(GI(i)==="Function")return qI(i)},Sd=typeof document=="object"&&document.all,YI=typeof Sd>"u"&&Sd!==void 0,i0={all:Sd,IS_HTMLDDA:YI},n0=i0,XI=n0.all,Ie=n0.IS_HTMLDDA?function(i){return typeof i=="function"||i===XI}:function(i){return typeof i=="function"},Qi={},JI=ue,Ge=!JI(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),ZI=Oo,Ss=Function.prototype.call,qe=ZI?Ss.bind(Ss):function(){return Ss.apply(Ss,arguments)},rl={},a0={}.propertyIsEnumerable,o0=Object.getOwnPropertyDescriptor,QI=o0&&!a0.call({1:2},1);rl.f=QI?function(r){var e=o0(this,r);return!!e&&e.enumerable}:a0;var en=function(i,r){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:r}},ek=be,tk=ue,rk=vi,uh=Object,ik=ek("".split),il=tk(function(){return!uh("z").propertyIsEnumerable(0)})?function(i){return rk(i)==="String"?ik(i,""):uh(i)}:uh,ca=function(i){return i==null},nk=ca,ak=TypeError,Lf=function(i){if(nk(i))throw new ak("Can't call method on "+i);return i},ok=il,sk=Lf,br=function(i){return ok(sk(i))},Cp=Ie,s0=i0,uk=s0.all,it=s0.IS_HTMLDDA?function(i){return typeof i=="object"?i!==null:Cp(i)||i===uk}:function(i){return typeof i=="object"?i!==null:Cp(i)},we={},lh=we,hh=$e,lk=Ie,Ap=function(i){return lk(i)?i:void 0},yt=function(i,r){return arguments.length<2?Ap(lh[i])||Ap(hh[i]):lh[i]&&lh[i][r]||hh[i]&&hh[i][r]},hk=be,ze=hk({}.isPrototypeOf),pi=typeof navigator<"u"&&String(navigator.userAgent)||"",u0=$e,ch=pi,Dp=u0.process,Rp=u0.Deno,Np=Dp&&Dp.versions||Rp&&Rp.version,Mp=Np&&Np.v8,tr,ku;Mp&&(tr=Mp.split("."),ku=tr[0]>0&&tr[0]<4?1:+(tr[0]+tr[1]));!ku&&ch&&(tr=ch.match(/Edge\/(\d+)/),(!tr||tr[1]>=74)&&(tr=ch.match(/Chrome\/(\d+)/),tr&&(ku=+tr[1])));var da=ku,Bp=da,ck=ue,dk=$e,fk=dk.String,fa=!!Object.getOwnPropertySymbols&&!ck(function(){var i=Symbol("symbol detection");return!fk(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&Bp&&Bp<41}),vk=fa,l0=vk&&!Symbol.sham&&typeof Symbol.iterator=="symbol",pk=yt,gk=Ie,yk=ze,mk=l0,bk=Object,To=mk?function(i){return typeof i=="symbol"}:function(i){var r=pk("Symbol");return gk(r)&&yk(r.prototype,bk(i))},$k=String,va=function(i){try{return $k(i)}catch{return"Object"}},wk=Ie,_k=va,Ek=TypeError,kt=function(i){if(wk(i))return i;throw new Ek(_k(i)+" is not a function")},Sk=kt,Ok=ca,zf=function(i,r){var e=i[r];return Ok(e)?void 0:Sk(e)},dh=qe,fh=Ie,vh=it,Tk=TypeError,Ik=function(i,r){var e,t;if(r==="string"&&fh(e=i.toString)&&!vh(t=dh(e,i))||fh(e=i.valueOf)&&!vh(t=dh(e,i))||r!=="string"&&fh(e=i.toString)&&!vh(t=dh(e,i)))return t;throw new Tk("Can't convert object to primitive value")},h0={exports:{}},kk=!0,Fp=$e,Pk=Object.defineProperty,xk=function(i,r){try{Pk(Fp,i,{value:r,configurable:!0,writable:!0})}catch{Fp[i]=r}return r},Ck=$e,Ak=xk,jp="__core-js_shared__",Dk=Ck[jp]||Ak(jp,{}),Hf=Dk,Lp=Hf;(h0.exports=function(i,r){return Lp[i]||(Lp[i]=r!==void 0?r:{})})("versions",[]).push({version:"3.33.2",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.2/LICENSE",source:"https://github.com/zloirock/core-js"});var pa=h0.exports,Rk=Lf,Nk=Object,Pt=function(i){return Nk(Rk(i))},Mk=be,Bk=Pt,Fk=Mk({}.hasOwnProperty),He=Object.hasOwn||function(r,e){return Fk(Bk(r),e)},jk=be,Lk=0,zk=Math.random(),Hk=jk(1 .toString),nl=function(i){return"Symbol("+(i===void 0?"":i)+")_"+Hk(++Lk+zk,36)},Vk=$e,Wk=pa,zp=He,Uk=nl,Kk=fa,Gk=l0,An=Vk.Symbol,ph=Wk("wks"),qk=Gk?An.for||An:An&&An.withoutSetter||Uk,_e=function(i){return zp(ph,i)||(ph[i]=Kk&&zp(An,i)?An[i]:qk("Symbol."+i)),ph[i]},Yk=qe,Hp=it,Vp=To,Xk=zf,Jk=Ik,Zk=_e,Qk=TypeError,eP=Zk("toPrimitive"),tP=function(i,r){if(!Hp(i)||Vp(i))return i;var e=Xk(i,eP),t;if(e){if(r===void 0&&(r="default"),t=Yk(e,i,r),!Hp(t)||Vp(t))return t;throw new Qk("Can't convert object to primitive value")}return r===void 0&&(r="number"),Jk(i,r)},rP=tP,iP=To,al=function(i){var r=rP(i,"string");return iP(r)?r:r+""},nP=$e,Wp=it,Od=nP.document,aP=Wp(Od)&&Wp(Od.createElement),Vf=function(i){return aP?Od.createElement(i):{}},oP=Ge,sP=ue,uP=Vf,c0=!oP&&!sP(function(){return Object.defineProperty(uP("div"),"a",{get:function(){return 7}}).a!==7}),lP=Ge,hP=qe,cP=rl,dP=en,fP=br,vP=al,pP=He,gP=c0,Up=Object.getOwnPropertyDescriptor;Qi.f=lP?Up:function(r,e){if(r=fP(r),e=vP(e),gP)try{return Up(r,e)}catch{}if(pP(r,e))return dP(!hP(cP.f,r,e),r[e])};var yP=ue,mP=Ie,bP=/#|\.prototype\./,Io=function(i,r){var e=wP[$P(i)];return e===EP?!0:e===_P?!1:mP(r)?yP(r):!!r},$P=Io.normalize=function(i){return String(i).replace(bP,".").toLowerCase()},wP=Io.data={},_P=Io.NATIVE="N",EP=Io.POLYFILL="P",d0=Io,Kp=r0,SP=kt,OP=Oo,TP=Kp(Kp.bind),gi=function(i,r){return SP(i),r===void 0?i:OP?TP(i,r):function(){return i.apply(r,arguments)}},xt={},IP=Ge,kP=ue,f0=IP&&kP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),PP=it,xP=String,CP=TypeError,jt=function(i){if(PP(i))return i;throw new CP(xP(i)+" is not an object")},AP=Ge,DP=c0,RP=f0,Os=jt,Gp=al,NP=TypeError,gh=Object.defineProperty,MP=Object.getOwnPropertyDescriptor,yh="enumerable",mh="configurable",bh="writable";xt.f=AP?RP?function(r,e,t){if(Os(r),e=Gp(e),Os(t),typeof r=="function"&&e==="prototype"&&"value"in t&&bh in t&&!t[bh]){var n=MP(r,e);n&&n[bh]&&(r[e]=t.value,t={configurable:mh in t?t[mh]:n[mh],enumerable:yh in t?t[yh]:n[yh],writable:!1})}return gh(r,e,t)}:gh:function(r,e,t){if(Os(r),e=Gp(e),Os(t),DP)try{return gh(r,e,t)}catch{}if("get"in t||"set"in t)throw new NP("Accessors not supported");return"value"in t&&(r[e]=t.value),r};var BP=Ge,FP=xt,jP=en,Lr=BP?function(i,r,e){return FP.f(i,r,jP(1,e))}:function(i,r,e){return i[r]=e,i},Ts=$e,LP=ha,zP=r0,HP=Ie,VP=Qi.f,WP=d0,mn=we,UP=gi,bn=Lr,qp=He,KP=function(i){var r=function(e,t,n){if(this instanceof r){switch(arguments.length){case 0:return new i;case 1:return new i(e);case 2:return new i(e,t)}return new i(e,t,n)}return LP(i,this,arguments)};return r.prototype=i.prototype,r},K=function(i,r){var e=i.target,t=i.global,n=i.stat,a=i.proto,o=t?Ts:n?Ts[e]:(Ts[e]||{}).prototype,s=t?mn:mn[e]||bn(mn,e,{})[e],u=s.prototype,l,h,d,c,f,v,p,g,y;for(c in r)l=WP(t?c:e+(n?".":"#")+c,i.forced),h=!l&&o&&qp(o,c),v=s[c],h&&(i.dontCallGetSet?(y=VP(o,c),p=y&&y.value):p=o[c]),f=h&&p?p:r[c],!(h&&typeof v==typeof f)&&(i.bind&&h?g=UP(f,Ts):i.wrap&&h?g=KP(f):a&&HP(f)?g=zP(f):g=f,(i.sham||f&&f.sham||v&&v.sham)&&bn(g,"sham",!0),bn(s,c,g),a&&(d=e+"Prototype",qp(mn,d)||bn(mn,d,{}),bn(mn[d],c,f),i.real&&u&&(l||!u[c])&&bn(u,c,f)))},GP=K,qP=Ge,Yp=xt.f;GP({target:"Object",stat:!0,forced:Object.defineProperty!==Yp,sham:!qP},{defineProperty:Yp});var YP=we,v0=YP.Object,XP=J$.exports=function(r,e,t){return v0.defineProperty(r,e,t)};v0.defineProperty.sham&&(XP.sham=!0);var JP=J$.exports,ZP=JP,p0=ZP,QP=p0,ex=QP,tx=ex,rx=tx,g0=rx,ol=Y(g0),ix=vi,yi=Array.isArray||function(r){return ix(r)==="Array"},nx=Math.ceil,ax=Math.floor,ox=Math.trunc||function(r){var e=+r;return(e>0?ax:nx)(e)},sx=ox,sl=function(i){var r=+i;return r!==r||r===0?0:sx(r)},ux=sl,lx=Math.min,hx=function(i){return i>0?lx(ux(i),9007199254740991):0},cx=hx,Lt=function(i){return cx(i.length)},dx=TypeError,fx=9007199254740991,ul=function(i){if(i>fx)throw dx("Maximum allowed index exceeded");return i},vx=al,px=xt,gx=en,ga=function(i,r,e){var t=vx(r);t in i?px.f(i,t,gx(0,e)):i[t]=e},yx=_e,mx=yx("toStringTag"),y0={};y0[mx]="z";var Wf=String(y0)==="[object z]",bx=Wf,$x=Ie,lu=vi,wx=_e,_x=wx("toStringTag"),Ex=Object,Sx=lu(function(){return arguments}())==="Arguments",Ox=function(i,r){try{return i[r]}catch{}},zr=bx?lu:function(i){var r,e,t;return i===void 0?"Undefined":i===null?"Null":typeof(e=Ox(r=Ex(i),_x))=="string"?e:Sx?lu(r):(t=lu(r))==="Object"&&$x(r.callee)?"Arguments":t},Tx=be,Ix=Ie,Td=Hf,kx=Tx(Function.toString);Ix(Td.inspectSource)||(Td.inspectSource=function(i){return kx(i)});var m0=Td.inspectSource,Px=be,xx=ue,b0=Ie,Cx=zr,Ax=yt,Dx=m0,$0=function(){},Rx=[],w0=Ax("Reflect","construct"),Uf=/^\s*(?:class|function)\b/,Nx=Px(Uf.exec),Mx=!Uf.test($0),Fa=function(r){if(!b0(r))return!1;try{return w0($0,Rx,r),!0}catch{return!1}},_0=function(r){if(!b0(r))return!1;switch(Cx(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Mx||!!Nx(Uf,Dx(r))}catch{return!0}};_0.sham=!0;var ll=!w0||xx(function(){var i;return Fa(Fa.call)||!Fa(Object)||!Fa(function(){i=!0})||i})?_0:Fa,Xp=yi,Bx=ll,Fx=it,jx=_e,Lx=jx("species"),Jp=Array,zx=function(i){var r;return Xp(i)&&(r=i.constructor,Bx(r)&&(r===Jp||Xp(r.prototype))?r=void 0:Fx(r)&&(r=r[Lx],r===null&&(r=void 0))),r===void 0?Jp:r},Hx=zx,hl=function(i,r){return new(Hx(i))(r===0?0:r)},Vx=ue,Wx=_e,Ux=da,Kx=Wx("species"),ko=function(i){return Ux>=51||!Vx(function(){var r=[],e=r.constructor={};return e[Kx]=function(){return{foo:1}},r[i](Boolean).foo!==1})},Gx=K,qx=ue,Yx=yi,Xx=it,Jx=Pt,Zx=Lt,Zp=ul,Qp=ga,Qx=hl,eC=ko,tC=_e,rC=da,E0=tC("isConcatSpreadable"),iC=rC>=51||!qx(function(){var i=[];return i[E0]=!1,i.concat()[0]!==i}),nC=function(i){if(!Xx(i))return!1;var r=i[E0];return r!==void 0?!!r:Yx(i)},aC=!iC||!eC("concat");Gx({target:"Array",proto:!0,arity:1,forced:aC},{concat:function(r){var e=Jx(this),t=Qx(e,0),n=0,a,o,s,u,l;for(a=-1,s=arguments.length;ao;)if(s=n[o++],s!==s)return!0}else for(;a>o;o++)if((i||o in n)&&n[o]===e)return i||o||0;return!i&&-1}},vC={includes:eg(!0),indexOf:eg(!1)},Po={},pC=be,$h=He,gC=br,yC=vC.indexOf,mC=Po,tg=pC([].push),S0=function(i,r){var e=gC(i),t=0,n=[],a;for(a in e)!$h(mC,a)&&$h(e,a)&&tg(n,a);for(;r.length>t;)$h(e,a=r[t++])&&(~yC(n,a)||tg(n,a));return n},Kf=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],bC=S0,$C=Kf,fl=Object.keys||function(r){return bC(r,$C)},wC=Ge,_C=f0,EC=xt,SC=jt,OC=br,TC=fl;cl.f=wC&&!_C?Object.defineProperties:function(r,e){SC(r);for(var t=OC(e),n=TC(e),a=n.length,o=0,s;a>o;)EC.f(r,s=n[o++],t[s]);return r};var IC=yt,O0=IC("document","documentElement"),kC=pa,PC=nl,rg=kC("keys"),vl=function(i){return rg[i]||(rg[i]=PC(i))},xC=jt,CC=cl,ig=Kf,AC=Po,DC=O0,RC=Vf,NC=vl,ng=">",ag="<",Id="prototype",kd="script",T0=NC("IE_PROTO"),wh=function(){},I0=function(i){return ag+kd+ng+i+ag+"/"+kd+ng},og=function(i){i.write(I0("")),i.close();var r=i.parentWindow.Object;return i=null,r},MC=function(){var i=RC("iframe"),r="java"+kd+":",e;return i.style.display="none",DC.appendChild(i),i.src=String(r),e=i.contentWindow.document,e.open(),e.write(I0("document.F=Object")),e.close(),e.F},Is,hu=function(){try{Is=new ActiveXObject("htmlfile")}catch{}hu=typeof document<"u"?document.domain&&Is?og(Is):MC():og(Is);for(var i=ig.length;i--;)delete hu[Id][ig[i]];return hu()};AC[T0]=!0;var rn=Object.create||function(r,e){var t;return r!==null?(wh[Id]=xC(r),t=new wh,wh[Id]=null,t[T0]=r):t=hu(),e===void 0?t:CC.f(t,e)},xo={},BC=S0,FC=Kf,jC=FC.concat("length","prototype");xo.f=Object.getOwnPropertyNames||function(r){return BC(r,jC)};var Gf={},sg=dl,LC=Lt,zC=ga,HC=Array,VC=Math.max,k0=function(i,r,e){for(var t=LC(i),n=sg(r,t),a=sg(e===void 0?t:e,t),o=HC(VC(a-n,0)),s=0;ng;g++)if((s||g in f)&&(b=f[g],$=v(b,g,c),i))if(r)m[g]=$;else if($)switch(i){case 3:return!0;case 5:return b;case 6:return g;case 2:dg(m,b)}else switch(i){case 4:return!1;case 7:dg(m,b)}return a?-1:t||n?n:m}},ba={forEach:Wr(0),map:Wr(1),filter:Wr(2),some:Wr(3),every:Wr(4),find:Wr(5),findIndex:Wr(6),filterReject:Wr(7)},pl=K,Do=$e,Yf=qe,x2=be,Yn=Ge,Xn=fa,C2=ue,Ue=He,A2=ze,xd=jt,gl=br,Xf=al,D2=tn,Cd=en,uo=rn,D0=fl,R2=xo,R0=Gf,N2=Co,N0=Qi,M0=xt,M2=cl,B0=rl,fg=ya,B2=qf,Jf=pa,F2=vl,F0=Po,vg=nl,j2=_e,L2=Ao,z2=ke,H2=C0,V2=nn,j0=ma,yl=ba.forEach,_t=F2("hidden"),ml="Symbol",lo="prototype",W2=j0.set,pg=j0.getterFor(ml),ar=Object[lo],Ri=Do.Symbol,Ka=Ri&&Ri[lo],U2=Do.RangeError,K2=Do.TypeError,Sh=Do.QObject,L0=N0.f,Ni=M0.f,z0=R0.f,G2=B0.f,H0=x2([].push),Mr=Jf("symbols"),Ro=Jf("op-symbols"),q2=Jf("wks"),Ad=!Sh||!Sh[lo]||!Sh[lo].findChild,V0=function(i,r,e){var t=L0(ar,r);t&&delete ar[r],Ni(i,r,e),t&&i!==ar&&Ni(ar,r,t)},Dd=Yn&&C2(function(){return uo(Ni({},"a",{get:function(){return Ni(this,"a",{value:7}).a}})).a!==7})?V0:Ni,Oh=function(i,r){var e=Mr[i]=uo(Ka);return W2(e,{type:ml,tag:i,description:r}),Yn||(e.description=r),e},bl=function(r,e,t){r===ar&&bl(Ro,e,t),xd(r);var n=Xf(e);return xd(t),Ue(Mr,n)?(t.enumerable?(Ue(r,_t)&&r[_t][n]&&(r[_t][n]=!1),t=uo(t,{enumerable:Cd(0,!1)})):(Ue(r,_t)||Ni(r,_t,Cd(1,{})),r[_t][n]=!0),Dd(r,n,t)):Ni(r,n,t)},Zf=function(r,e){xd(r);var t=gl(e),n=D0(t).concat(G0(t));return yl(n,function(a){(!Yn||Yf(W0,t,a))&&bl(r,a,t[a])}),r},Y2=function(r,e){return e===void 0?uo(r):Zf(uo(r),e)},W0=function(r){var e=Xf(r),t=Yf(G2,this,e);return this===ar&&Ue(Mr,e)&&!Ue(Ro,e)?!1:t||!Ue(this,e)||!Ue(Mr,e)||Ue(this,_t)&&this[_t][e]?t:!0},U0=function(r,e){var t=gl(r),n=Xf(e);if(!(t===ar&&Ue(Mr,n)&&!Ue(Ro,n))){var a=L0(t,n);return a&&Ue(Mr,n)&&!(Ue(t,_t)&&t[_t][n])&&(a.enumerable=!0),a}},K0=function(r){var e=z0(gl(r)),t=[];return yl(e,function(n){!Ue(Mr,n)&&!Ue(F0,n)&&H0(t,n)}),t},G0=function(i){var r=i===ar,e=z0(r?Ro:gl(i)),t=[];return yl(e,function(n){Ue(Mr,n)&&(!r||Ue(ar,n))&&H0(t,Mr[n])}),t};Xn||(Ri=function(){if(A2(Ka,this))throw new K2("Symbol is not a constructor");var r=!arguments.length||arguments[0]===void 0?void 0:D2(arguments[0]),e=vg(r),t=function(n){var a=this===void 0?Do:this;a===ar&&Yf(t,Ro,n),Ue(a,_t)&&Ue(a[_t],e)&&(a[_t][e]=!1);var o=Cd(1,n);try{Dd(a,e,o)}catch(s){if(!(s instanceof U2))throw s;V0(a,e,o)}};return Yn&&Ad&&Dd(ar,e,{configurable:!0,set:t}),Oh(e,r)},Ka=Ri[lo],fg(Ka,"toString",function(){return pg(this).tag}),fg(Ri,"withoutSetter",function(i){return Oh(vg(i),i)}),B0.f=W0,M0.f=bl,M2.f=Zf,N0.f=U0,R2.f=R0.f=K0,N2.f=G0,L2.f=function(i){return Oh(j2(i),i)},Yn&&B2(Ka,"description",{configurable:!0,get:function(){return pg(this).description}}));pl({global:!0,constructor:!0,wrap:!0,forced:!Xn,sham:!Xn},{Symbol:Ri});yl(D0(q2),function(i){z2(i)});pl({target:ml,stat:!0,forced:!Xn},{useSetter:function(){Ad=!0},useSimple:function(){Ad=!1}});pl({target:"Object",stat:!0,forced:!Xn,sham:!Yn},{create:Y2,defineProperty:bl,defineProperties:Zf,getOwnPropertyDescriptor:U0});pl({target:"Object",stat:!0,forced:!Xn},{getOwnPropertyNames:K0});H2();V2(Ri,ml);F0[_t]=!0;var X2=fa,q0=X2&&!!Symbol.for&&!!Symbol.keyFor,J2=K,Z2=yt,Q2=He,eA=tn,Y0=pa,tA=q0,Th=Y0("string-to-symbol-registry"),rA=Y0("symbol-to-string-registry");J2({target:"Symbol",stat:!0,forced:!tA},{for:function(i){var r=eA(i);if(Q2(Th,r))return Th[r];var e=Z2("Symbol")(r);return Th[r]=e,rA[e]=r,e}});var iA=K,nA=He,aA=To,oA=va,sA=pa,uA=q0,gg=sA("symbol-to-string-registry");iA({target:"Symbol",stat:!0,forced:!uA},{keyFor:function(r){if(!aA(r))throw new TypeError(oA(r)+" is not a symbol");if(nA(gg,r))return gg[r]}});var lA=be,No=lA([].slice),hA=be,yg=yi,cA=Ie,mg=vi,dA=tn,bg=hA([].push),fA=function(i){if(cA(i))return i;if(yg(i)){for(var r=i.length,e=[],t=0;t=r.length)return i.target=void 0,Cs(void 0,!0);switch(i.kind){case"keys":return Cs(e,!1);case"values":return Cs(r[e],!1)}return Cs([e,r[e]],!1)},"values");Dg.Arguments=Dg.Array;var KD={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},GD=KD,qD=$e,YD=zr,XD=Lr,Rg=$a,JD=_e,Ng=JD("toStringTag");for(var xh in GD){var Mg=qD[xh],Ch=Mg&&Mg.prototype;Ch&&YD(Ch)!==Ng&&XD(Ch,Ng,xh),Rg[xh]=Rg.Array}var ZD=YA,uw=ZD,QD=_e,eR=xt.f,Bg=QD("metadata"),Fg=Function.prototype;Fg[Bg]===void 0&&eR(Fg,Bg,{value:null});var tR=ke;tR("asyncDispose");var rR=ke;rR("dispose");var iR=ke;iR("metadata");var nR=uw,aR=nR,oR=yt,sR=be,rv=oR("Symbol"),uR=rv.keyFor,lR=sR(rv.prototype.valueOf),lw=rv.isRegisteredSymbol||function(r){try{return uR(lR(r))!==void 0}catch{return!1}},hR=K,cR=lw;hR({target:"Symbol",stat:!0},{isRegisteredSymbol:cR});var dR=pa,hw=yt,fR=be,vR=To,pR=_e,Cu=hw("Symbol"),jg=Cu.isWellKnownSymbol,cw=hw("Object","getOwnPropertyNames"),gR=fR(Cu.prototype.valueOf),Lg=dR("wks");for(var Ah=0,zg=cw(Cu),yR=zg.length;Ah=a?i?"":void 0:(o=Vg(t,n),o<55296||o>56319||n+1===a||(s=Vg(t,n+1))<56320||s>57343?i?RR(t,n):o:i?NR(t,n,n+2):(o-55296<<10)+(s-56320)+65536)}},MR={codeAt:Wg(!1),charAt:Wg(!0)},BR=MR.charAt,FR=tn,fw=ma,jR=ev,Ug=tv,vw="String Iterator",LR=fw.set,zR=fw.getterFor(vw);jR(String,"String",function(i){LR(this,{type:vw,string:FR(i),index:0})},function(){var r=zR(this),e=r.string,t=r.index,n;return t>=e.length?Ug(void 0,!0):(n=BR(e,t),r.index+=n.length,Ug(n,!1))});var HR=Ao,VR=HR.f("iterator"),WR=VR,pw=WR,UR=pw,KR=UR,GR=KR,qR=GR,gw=qR,YR=Y(gw);function Jn(i){"@babel/helpers - typeof";return Jn=typeof Dn=="function"&&typeof YR=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Dn=="function"&&r.constructor===Dn&&r!==Dn.prototype?"symbol":typeof r},Jn(i)}var XR=Ao,JR=XR.f("toPrimitive"),ZR=JR,QR=ZR,eN=QR,tN=eN,rN=tN,iN=rN,nN=iN,aN=Y(nN);function oN(i,r){if(Jn(i)!=="object"||i===null)return i;var e=i[aN];if(e!==void 0){var t=e.call(i,r||"default");if(Jn(t)!=="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(i)}function yw(i){var r=oN(i,"string");return Jn(r)==="symbol"?r:String(r)}function Kg(i,r){for(var e=0;e=0:s>u;u+=l)u in o&&(n=e(n,o[u],u,a));return n}},PN={left:Yg(!1),right:Yg(!0)},xN=ue,_l=function(i,r){var e=[][i];return!!e&&xN(function(){e.call(null,r||function(){return 1},1)})},CN=$e,AN=vi,Bo=AN(CN.process)==="process",DN=K,RN=PN.left,NN=_l,Xg=da,MN=Bo,BN=!MN&&Xg>79&&Xg<83,FN=BN||!NN("reduce");DN({target:"Array",proto:!0,forced:FN},{reduce:function(r){var e=arguments.length;return RN(this,r,e,e>1?arguments[1]:void 0)}});var jN=ut,LN=jN("Array","reduce"),zN=ze,HN=LN,Nh=Array.prototype,VN=function(i){var r=i.reduce;return i===Nh||zN(Nh,i)&&r===Nh.reduce?HN:r},WN=VN,UN=WN,KN=UN,GN=Y(KN),qN=K,YN=ba.filter,XN=ko,JN=XN("filter");qN({target:"Array",proto:!0,forced:!JN},{filter:function(r){return YN(this,r,arguments.length>1?arguments[1]:void 0)}});var ZN=ut,QN=ZN("Array","filter"),eM=ze,tM=QN,Mh=Array.prototype,rM=function(i){var r=i.filter;return i===Mh||eM(Mh,i)&&r===Mh.filter?tM:r},iM=rM,nM=iM,aM=nM,Rn=Y(aM),oM=K,sM=ba.map,uM=ko,lM=uM("map");oM({target:"Array",proto:!0,forced:!lM},{map:function(r){return sM(this,r,arguments.length>1?arguments[1]:void 0)}});var hM=ut,cM=hM("Array","map"),dM=ze,fM=cM,Bh=Array.prototype,vM=function(i){var r=i.map;return i===Bh||dM(Bh,i)&&r===Bh.map?fM:r},pM=vM,gM=pM,yM=gM,rr=Y(yM),mM=yi,bM=Lt,$M=ul,wM=gi,Ew=function(i,r,e,t,n,a,o,s){for(var u=n,l=0,h=o?wM(o,s):!1,d,c;l0&&mM(d)?(c=bM(d),u=Ew(i,r,d,c,u,a-1)-1):($M(u+1),i[u]=d),u++),l++;return u},_M=Ew,EM=K,SM=_M,OM=kt,TM=Pt,IM=Lt,kM=hl;EM({target:"Array",proto:!0},{flatMap:function(r){var e=TM(this),t=IM(e),n;return OM(r),n=kM(e,0),n.length=SM(n,e,e,t,0,1,r,arguments.length>1?arguments[1]:void 0),n}});var PM=ut;PM("Array","flatMap");var xM=qe,Jg=jt,CM=zf,Sw=function(i,r,e){var t,n;Jg(i);try{if(t=CM(i,"return"),!t){if(r==="throw")throw e;return e}t=xM(t,i)}catch(a){n=!0,t=a}if(r==="throw")throw e;if(n)throw t;return Jg(t),e},AM=jt,DM=Sw,RM=function(i,r,e,t){try{return t?r(AM(e)[0],e[1]):r(e)}catch(n){DM(i,"throw",n)}},NM=_e,MM=$a,BM=NM("iterator"),FM=Array.prototype,Ow=function(i){return i!==void 0&&(MM.Array===i||FM[BM]===i)},jM=zr,Zg=zf,LM=ca,zM=$a,HM=_e,VM=HM("iterator"),El=function(i){if(!LM(i))return Zg(i,VM)||Zg(i,"@@iterator")||zM[jM(i)]},WM=qe,UM=kt,KM=jt,GM=va,qM=El,YM=TypeError,av=function(i,r){var e=arguments.length<2?qM(i):r;if(UM(e))return KM(WM(e,i));throw new YM(GM(i)+" is not iterable")},XM=gi,JM=qe,ZM=Pt,QM=RM,eB=Ow,tB=ll,rB=Lt,Qg=ga,iB=av,nB=El,ey=Array,aB=function(r){var e=ZM(r),t=tB(this),n=arguments.length,a=n>1?arguments[1]:void 0,o=a!==void 0;o&&(a=XM(a,n>2?arguments[2]:void 0));var s=nB(e),u=0,l,h,d,c,f,v;if(s&&!(this===ey&&eB(s)))for(c=iB(e,s),f=c.next,h=t?new this:[];!(d=JM(f,c)).done;u++)v=o?QM(c,a,[d.value,u],!0):d.value,Qg(h,u,v);else for(l=rB(e),h=t?new this(l):ey(l);l>u;u++)v=o?a(e[u],u):e[u],Qg(h,u,v);return h.length=u,h},oB=_e,Tw=oB("iterator"),Iw=!1;try{var sB=0,ty={next:function(){return{done:!!sB++}},return:function(){Iw=!0}};ty[Tw]=function(){return this},Array.from(ty,function(){throw 2})}catch{}var kw=function(i,r){try{if(!r&&!Iw)return!1}catch{return!1}var e=!1;try{var t={};t[Tw]=function(){return{next:function(){return{done:e=!0}}}},i(t)}catch{}return e},uB=K,lB=aB,hB=kw,cB=!hB(function(i){Array.from(i)});uB({target:"Array",stat:!0,forced:cB},{from:lB});var dB=we,fB=dB.Array.from,vB=fB,Pw=vB,pB=Pw,ov=Y(pB),gB=El,yB=gB,mB=yB,bB=mB,$B=bB,wB=$B,_B=wB,EB=_B,xw=EB,Cw=Y(xw),SB=xw,sv=Y(SB),OB=K,TB=yi;OB({target:"Array",stat:!0},{isArray:TB});var IB=we,kB=IB.Array.isArray,PB=kB,Aw=PB,xB=Aw,CB=xB,AB=CB,DB=AB,RB=DB,Dw=Y(RB);function NB(i){if(Dw(i))return i}var MB=Ge,BB=yi,FB=TypeError,jB=Object.getOwnPropertyDescriptor,LB=MB&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(i){return i instanceof TypeError}}(),Rw=LB?function(i,r){if(BB(i)&&!jB(i,"length").writable)throw new FB("Cannot set read only .length");return i.length=r}:function(i,r){return i.length=r},zB=K,HB=Pt,VB=Lt,WB=Rw,UB=ul,KB=ue,GB=KB(function(){return[].push.call({length:4294967296},1)!==4294967297}),qB=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(i){return i instanceof TypeError}},YB=GB||!qB();zB({target:"Array",proto:!0,arity:1,forced:YB},{push:function(r){var e=HB(this),t=VB(e),n=arguments.length;UB(t+n);for(var a=0;ai.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?arguments[1]:void 0)},Oj=K,ny=Sj;Oj({target:"Array",proto:!0,forced:[].forEach!==ny},{forEach:ny});var Tj=ut,Ij=Tj("Array","forEach"),kj=Ij,Pj=kj,xj=zr,Cj=He,Aj=ze,Dj=Pj,Hh=Array.prototype,Rj={DOMTokenList:!0,NodeList:!0},zw=function(i){var r=i.forEach;return i===Hh||Aj(Hh,i)&&r===Hh.forEach||Cj(Rj,xj(i))?Dj:r},Nj=zw,Wi=Y(Nj),Mj=K,Bj=be,Fj=yi,jj=Bj([].reverse),ay=[1,2];Mj({target:"Array",proto:!0,forced:String(ay)===String(ay.reverse())},{reverse:function(){return Fj(this)&&(this.length=this.length),jj(this)}});var Lj=ut,zj=Lj("Array","reverse"),Hj=ze,Vj=zj,Vh=Array.prototype,Wj=function(i){var r=i.reverse;return i===Vh||Hj(Vh,i)&&r===Vh.reverse?Vj:r},Uj=Wj,Hw=Uj,Kj=Hw,Gj=Y(Kj),oy=va,qj=TypeError,Vw=function(i,r){if(!delete i[r])throw new qj("Cannot delete property "+oy(r)+" of "+oy(i))},Yj=K,Xj=Pt,Jj=dl,Zj=sl,Qj=Lt,e3=Rw,t3=ul,r3=hl,i3=ga,Wh=Vw,n3=ko,a3=n3("splice"),o3=Math.max,s3=Math.min;Yj({target:"Array",proto:!0,forced:!a3},{splice:function(r,e){var t=Xj(this),n=Qj(t),a=Jj(r,n),o=arguments.length,s,u,l,h,d,c;for(o===0?s=u=0:o===1?(s=0,u=n-a):(s=o-2,u=s3(o3(Zj(e),0),n-a)),t3(n+s-u),l=r3(t,u),h=0;hn-u+s;h--)Wh(t,h-1)}else if(s>u)for(h=n-u;h>a;h--)d=h+u-1,c=h+s-1,d in t?t[c]=t[d]:Wh(t,c);for(h=0;ha;)for(var u=_3(arguments[a++]),l=o?E3(Kh(u),o(u)):Kh(u),h=l.length,d=0,c;h>d;)c=l[d++],(!sy||y3(s,u,c))&&(t[c]=u[c]);return t}:wn,O3=K,ly=S3;O3({target:"Object",stat:!0,arity:2,forced:Object.assign!==ly},{assign:ly});var T3=we,I3=T3.Object.assign,k3=I3,P3=k3,x3=P3,C3=Y(x3),A3=K,D3=ue,R3=Pt,Uw=$l,N3=rw,M3=D3(function(){Uw(1)});A3({target:"Object",stat:!0,forced:M3,sham:!N3},{getPrototypeOf:function(r){return Uw(R3(r))}});var B3=we,F3=B3.Object.getPrototypeOf,j3=F3,L3=j3,z3=K,H3=Ge,V3=rn;z3({target:"Object",stat:!0,sham:!H3},{create:V3});var W3=we,U3=W3.Object,K3=function(r,e){return U3.create(r,e)},G3=K3,Kw=G3,q3=Kw,Y3=Y(q3),Fd=we,X3=ha;Fd.JSON||(Fd.JSON={stringify:JSON.stringify});var J3=function(r,e,t){return X3(Fd.JSON.stringify,null,arguments)},Z3=J3,Q3=Z3,eL=Q3,tL=Y(eL),rL=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",iL=TypeError,Gw=function(i,r){if(ie,o=aL(t)?t:hL(t),s=a?uL(arguments,e):[],u=a?function(){nL(o,this,s)}:o;return r?i(u,n):i(u)}:i},dL=K,Xw=$e,fL=Yw,hy=fL(Xw.setInterval,!0);dL({global:!0,bind:!0,forced:Xw.setInterval!==hy},{setInterval:hy});var vL=K,Jw=$e,pL=Yw,cy=pL(Jw.setTimeout,!0);vL({global:!0,bind:!0,forced:Jw.setTimeout!==cy},{setTimeout:cy});var gL=we,yL=gL.setTimeout,mL=yL,bL=Y(mL),Zw={exports:{}};(function(i){function r(t){if(t)return e(t);this._callbacks=new Map}function e(t){return Object.assign(t,r.prototype),t._callbacks=new Map,t}r.prototype.on=function(t,n){const a=this._callbacks.get(t)??[];return a.push(n),this._callbacks.set(t,a),this},r.prototype.once=function(t,n){const a=(...o)=>{this.off(t,a),n.apply(this,o)};return a.fn=n,this.on(t,a),this},r.prototype.off=function(t,n){if(t===void 0&&n===void 0)return this._callbacks.clear(),this;if(n===void 0)return this._callbacks.delete(t),this;const a=this._callbacks.get(t);if(a){for(const[o,s]of a.entries())if(s===n||s.fn===n){a.splice(o,1);break}a.length===0?this._callbacks.delete(t):this._callbacks.set(t,a)}return this},r.prototype.emit=function(t,...n){const a=this._callbacks.get(t);if(a){const o=[...a];for(const s of o)s.apply(this,n)}return this},r.prototype.listeners=function(t){return this._callbacks.get(t)??[]},r.prototype.listenerCount=function(t){if(t)return this.listeners(t).length;let n=0;for(const a of this._callbacks.values())n+=a.length;return n},r.prototype.hasListeners=function(t){return this.listenerCount(t)>0},r.prototype.addEventListener=r.prototype.on,r.prototype.removeListener=r.prototype.off,r.prototype.removeEventListener=r.prototype.off,r.prototype.removeAllListeners=r.prototype.off,i.exports=r})(Zw);var $L=Zw.exports,wL=Y($L);/*! Hammer.JS - v2.0.17-rc - 2019-12-16 + */function tl(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")}var sh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Y(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var J$={exports:{}},Es=function(i){return i&&i.Math===Math&&i},$e=Es(typeof globalThis=="object"&&globalThis)||Es(typeof window=="object"&&window)||Es(typeof self=="object"&&self)||Es(typeof sh=="object"&&sh)||function(){return this}()||sh||Function("return this")(),le=function(i){try{return!!i()}catch{return!0}},HI=le,Oo=!HI(function(){var i=function(){}.bind();return typeof i!="function"||i.hasOwnProperty("prototype")}),VI=Oo,Z$=Function.prototype,Pp=Z$.apply,xp=Z$.call,ha=typeof Reflect=="object"&&Reflect.apply||(VI?xp.bind(Pp):function(){return xp.apply(Pp,arguments)}),Q$=Oo,e0=Function.prototype,Ed=e0.call,WI=Q$&&e0.bind.bind(Ed,Ed),be=Q$?WI:function(i){return function(){return Ed.apply(i,arguments)}},t0=be,UI=t0({}.toString),KI=t0("".slice),yi=function(i){return KI(UI(i),8,-1)},GI=yi,qI=be,r0=function(i){if(GI(i)==="Function")return qI(i)},Sd=typeof document=="object"&&document.all,YI=typeof Sd>"u"&&Sd!==void 0,i0={all:Sd,IS_HTMLDDA:YI},n0=i0,XI=n0.all,Ie=n0.IS_HTMLDDA?function(i){return typeof i=="function"||i===XI}:function(i){return typeof i=="function"},Qi={},JI=le,qe=!JI(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),ZI=Oo,Ss=Function.prototype.call,Ye=ZI?Ss.bind(Ss):function(){return Ss.apply(Ss,arguments)},rl={},a0={}.propertyIsEnumerable,o0=Object.getOwnPropertyDescriptor,QI=o0&&!a0.call({1:2},1);rl.f=QI?function(r){var e=o0(this,r);return!!e&&e.enumerable}:a0;var en=function(i,r){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:r}},ek=be,tk=le,rk=yi,uh=Object,ik=ek("".split),il=tk(function(){return!uh("z").propertyIsEnumerable(0)})?function(i){return rk(i)==="String"?ik(i,""):uh(i)}:uh,ca=function(i){return i==null},nk=ca,ak=TypeError,Lf=function(i){if(nk(i))throw new ak("Can't call method on "+i);return i},ok=il,sk=Lf,$r=function(i){return ok(sk(i))},Cp=Ie,s0=i0,uk=s0.all,nt=s0.IS_HTMLDDA?function(i){return typeof i=="object"?i!==null:Cp(i)||i===uk}:function(i){return typeof i=="object"?i!==null:Cp(i)},we={},lh=we,hh=$e,lk=Ie,Ap=function(i){return lk(i)?i:void 0},mt=function(i,r){return arguments.length<2?Ap(lh[i])||Ap(hh[i]):lh[i]&&lh[i][r]||hh[i]&&hh[i][r]},hk=be,He=hk({}.isPrototypeOf),mi=typeof navigator<"u"&&String(navigator.userAgent)||"",u0=$e,ch=mi,Dp=u0.process,Rp=u0.Deno,Np=Dp&&Dp.versions||Rp&&Rp.version,Mp=Np&&Np.v8,tr,ku;Mp&&(tr=Mp.split("."),ku=tr[0]>0&&tr[0]<4?1:+(tr[0]+tr[1]));!ku&&ch&&(tr=ch.match(/Edge\/(\d+)/),(!tr||tr[1]>=74)&&(tr=ch.match(/Chrome\/(\d+)/),tr&&(ku=+tr[1])));var da=ku,Bp=da,ck=le,dk=$e,fk=dk.String,fa=!!Object.getOwnPropertySymbols&&!ck(function(){var i=Symbol("symbol detection");return!fk(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&Bp&&Bp<41}),vk=fa,l0=vk&&!Symbol.sham&&typeof Symbol.iterator=="symbol",pk=mt,gk=Ie,yk=He,mk=l0,bk=Object,To=mk?function(i){return typeof i=="symbol"}:function(i){var r=pk("Symbol");return gk(r)&&yk(r.prototype,bk(i))},$k=String,va=function(i){try{return $k(i)}catch{return"Object"}},wk=Ie,_k=va,Ek=TypeError,Pt=function(i){if(wk(i))return i;throw new Ek(_k(i)+" is not a function")},Sk=Pt,Ok=ca,zf=function(i,r){var e=i[r];return Ok(e)?void 0:Sk(e)},dh=Ye,fh=Ie,vh=nt,Tk=TypeError,Ik=function(i,r){var e,t;if(r==="string"&&fh(e=i.toString)&&!vh(t=dh(e,i))||fh(e=i.valueOf)&&!vh(t=dh(e,i))||r!=="string"&&fh(e=i.toString)&&!vh(t=dh(e,i)))return t;throw new Tk("Can't convert object to primitive value")},h0={exports:{}},kk=!0,Fp=$e,Pk=Object.defineProperty,xk=function(i,r){try{Pk(Fp,i,{value:r,configurable:!0,writable:!0})}catch{Fp[i]=r}return r},Ck=$e,Ak=xk,jp="__core-js_shared__",Dk=Ck[jp]||Ak(jp,{}),Hf=Dk,Lp=Hf;(h0.exports=function(i,r){return Lp[i]||(Lp[i]=r!==void 0?r:{})})("versions",[]).push({version:"3.33.2",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.2/LICENSE",source:"https://github.com/zloirock/core-js"});var pa=h0.exports,Rk=Lf,Nk=Object,xt=function(i){return Nk(Rk(i))},Mk=be,Bk=xt,Fk=Mk({}.hasOwnProperty),Ve=Object.hasOwn||function(r,e){return Fk(Bk(r),e)},jk=be,Lk=0,zk=Math.random(),Hk=jk(1 .toString),nl=function(i){return"Symbol("+(i===void 0?"":i)+")_"+Hk(++Lk+zk,36)},Vk=$e,Wk=pa,zp=Ve,Uk=nl,Kk=fa,Gk=l0,An=Vk.Symbol,ph=Wk("wks"),qk=Gk?An.for||An:An&&An.withoutSetter||Uk,Ee=function(i){return zp(ph,i)||(ph[i]=Kk&&zp(An,i)?An[i]:qk("Symbol."+i)),ph[i]},Yk=Ye,Hp=nt,Vp=To,Xk=zf,Jk=Ik,Zk=Ee,Qk=TypeError,eP=Zk("toPrimitive"),tP=function(i,r){if(!Hp(i)||Vp(i))return i;var e=Xk(i,eP),t;if(e){if(r===void 0&&(r="default"),t=Yk(e,i,r),!Hp(t)||Vp(t))return t;throw new Qk("Can't convert object to primitive value")}return r===void 0&&(r="number"),Jk(i,r)},rP=tP,iP=To,al=function(i){var r=rP(i,"string");return iP(r)?r:r+""},nP=$e,Wp=nt,Od=nP.document,aP=Wp(Od)&&Wp(Od.createElement),Vf=function(i){return aP?Od.createElement(i):{}},oP=qe,sP=le,uP=Vf,c0=!oP&&!sP(function(){return Object.defineProperty(uP("div"),"a",{get:function(){return 7}}).a!==7}),lP=qe,hP=Ye,cP=rl,dP=en,fP=$r,vP=al,pP=Ve,gP=c0,Up=Object.getOwnPropertyDescriptor;Qi.f=lP?Up:function(r,e){if(r=fP(r),e=vP(e),gP)try{return Up(r,e)}catch{}if(pP(r,e))return dP(!hP(cP.f,r,e),r[e])};var yP=le,mP=Ie,bP=/#|\.prototype\./,Io=function(i,r){var e=wP[$P(i)];return e===EP?!0:e===_P?!1:mP(r)?yP(r):!!r},$P=Io.normalize=function(i){return String(i).replace(bP,".").toLowerCase()},wP=Io.data={},_P=Io.NATIVE="N",EP=Io.POLYFILL="P",d0=Io,Kp=r0,SP=Pt,OP=Oo,TP=Kp(Kp.bind),bi=function(i,r){return SP(i),r===void 0?i:OP?TP(i,r):function(){return i.apply(r,arguments)}},Ct={},IP=qe,kP=le,f0=IP&&kP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),PP=nt,xP=String,CP=TypeError,jt=function(i){if(PP(i))return i;throw new CP(xP(i)+" is not an object")},AP=qe,DP=c0,RP=f0,Os=jt,Gp=al,NP=TypeError,gh=Object.defineProperty,MP=Object.getOwnPropertyDescriptor,yh="enumerable",mh="configurable",bh="writable";Ct.f=AP?RP?function(r,e,t){if(Os(r),e=Gp(e),Os(t),typeof r=="function"&&e==="prototype"&&"value"in t&&bh in t&&!t[bh]){var n=MP(r,e);n&&n[bh]&&(r[e]=t.value,t={configurable:mh in t?t[mh]:n[mh],enumerable:yh in t?t[yh]:n[yh],writable:!1})}return gh(r,e,t)}:gh:function(r,e,t){if(Os(r),e=Gp(e),Os(t),DP)try{return gh(r,e,t)}catch{}if("get"in t||"set"in t)throw new NP("Accessors not supported");return"value"in t&&(r[e]=t.value),r};var BP=qe,FP=Ct,jP=en,Lr=BP?function(i,r,e){return FP.f(i,r,jP(1,e))}:function(i,r,e){return i[r]=e,i},Ts=$e,LP=ha,zP=r0,HP=Ie,VP=Qi.f,WP=d0,mn=we,UP=bi,bn=Lr,qp=Ve,KP=function(i){var r=function(e,t,n){if(this instanceof r){switch(arguments.length){case 0:return new i;case 1:return new i(e);case 2:return new i(e,t)}return new i(e,t,n)}return LP(i,this,arguments)};return r.prototype=i.prototype,r},K=function(i,r){var e=i.target,t=i.global,n=i.stat,a=i.proto,o=t?Ts:n?Ts[e]:(Ts[e]||{}).prototype,s=t?mn:mn[e]||bn(mn,e,{})[e],u=s.prototype,l,h,c,d,f,v,p,g,y;for(d in r)l=WP(t?d:e+(n?".":"#")+d,i.forced),h=!l&&o&&qp(o,d),v=s[d],h&&(i.dontCallGetSet?(y=VP(o,d),p=y&&y.value):p=o[d]),f=h&&p?p:r[d],!(h&&typeof v==typeof f)&&(i.bind&&h?g=UP(f,Ts):i.wrap&&h?g=KP(f):a&&HP(f)?g=zP(f):g=f,(i.sham||f&&f.sham||v&&v.sham)&&bn(g,"sham",!0),bn(s,d,g),a&&(c=e+"Prototype",qp(mn,c)||bn(mn,c,{}),bn(mn[c],d,f),i.real&&u&&(l||!u[d])&&bn(u,d,f)))},GP=K,qP=qe,Yp=Ct.f;GP({target:"Object",stat:!0,forced:Object.defineProperty!==Yp,sham:!qP},{defineProperty:Yp});var YP=we,v0=YP.Object,XP=J$.exports=function(r,e,t){return v0.defineProperty(r,e,t)};v0.defineProperty.sham&&(XP.sham=!0);var JP=J$.exports,ZP=JP,p0=ZP,QP=p0,ex=QP,tx=ex,rx=tx,g0=rx,ol=Y(g0),ix=yi,$i=Array.isArray||function(r){return ix(r)==="Array"},nx=Math.ceil,ax=Math.floor,ox=Math.trunc||function(r){var e=+r;return(e>0?ax:nx)(e)},sx=ox,sl=function(i){var r=+i;return r!==r||r===0?0:sx(r)},ux=sl,lx=Math.min,hx=function(i){return i>0?lx(ux(i),9007199254740991):0},cx=hx,Lt=function(i){return cx(i.length)},dx=TypeError,fx=9007199254740991,ul=function(i){if(i>fx)throw dx("Maximum allowed index exceeded");return i},vx=al,px=Ct,gx=en,ga=function(i,r,e){var t=vx(r);t in i?px.f(i,t,gx(0,e)):i[t]=e},yx=Ee,mx=yx("toStringTag"),y0={};y0[mx]="z";var Wf=String(y0)==="[object z]",bx=Wf,$x=Ie,lu=yi,wx=Ee,_x=wx("toStringTag"),Ex=Object,Sx=lu(function(){return arguments}())==="Arguments",Ox=function(i,r){try{return i[r]}catch{}},zr=bx?lu:function(i){var r,e,t;return i===void 0?"Undefined":i===null?"Null":typeof(e=Ox(r=Ex(i),_x))=="string"?e:Sx?lu(r):(t=lu(r))==="Object"&&$x(r.callee)?"Arguments":t},Tx=be,Ix=Ie,Td=Hf,kx=Tx(Function.toString);Ix(Td.inspectSource)||(Td.inspectSource=function(i){return kx(i)});var m0=Td.inspectSource,Px=be,xx=le,b0=Ie,Cx=zr,Ax=mt,Dx=m0,$0=function(){},Rx=[],w0=Ax("Reflect","construct"),Uf=/^\s*(?:class|function)\b/,Nx=Px(Uf.exec),Mx=!Uf.test($0),Fa=function(r){if(!b0(r))return!1;try{return w0($0,Rx,r),!0}catch{return!1}},_0=function(r){if(!b0(r))return!1;switch(Cx(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Mx||!!Nx(Uf,Dx(r))}catch{return!0}};_0.sham=!0;var ll=!w0||xx(function(){var i;return Fa(Fa.call)||!Fa(Object)||!Fa(function(){i=!0})||i})?_0:Fa,Xp=$i,Bx=ll,Fx=nt,jx=Ee,Lx=jx("species"),Jp=Array,zx=function(i){var r;return Xp(i)&&(r=i.constructor,Bx(r)&&(r===Jp||Xp(r.prototype))?r=void 0:Fx(r)&&(r=r[Lx],r===null&&(r=void 0))),r===void 0?Jp:r},Hx=zx,hl=function(i,r){return new(Hx(i))(r===0?0:r)},Vx=le,Wx=Ee,Ux=da,Kx=Wx("species"),ko=function(i){return Ux>=51||!Vx(function(){var r=[],e=r.constructor={};return e[Kx]=function(){return{foo:1}},r[i](Boolean).foo!==1})},Gx=K,qx=le,Yx=$i,Xx=nt,Jx=xt,Zx=Lt,Zp=ul,Qp=ga,Qx=hl,eC=ko,tC=Ee,rC=da,E0=tC("isConcatSpreadable"),iC=rC>=51||!qx(function(){var i=[];return i[E0]=!1,i.concat()[0]!==i}),nC=function(i){if(!Xx(i))return!1;var r=i[E0];return r!==void 0?!!r:Yx(i)},aC=!iC||!eC("concat");Gx({target:"Array",proto:!0,arity:1,forced:aC},{concat:function(r){var e=Jx(this),t=Qx(e,0),n=0,a,o,s,u,l;for(a=-1,s=arguments.length;ao;)if(s=n[o++],s!==s)return!0}else for(;a>o;o++)if((i||o in n)&&n[o]===e)return i||o||0;return!i&&-1}},vC={includes:eg(!0),indexOf:eg(!1)},Po={},pC=be,$h=Ve,gC=$r,yC=vC.indexOf,mC=Po,tg=pC([].push),S0=function(i,r){var e=gC(i),t=0,n=[],a;for(a in e)!$h(mC,a)&&$h(e,a)&&tg(n,a);for(;r.length>t;)$h(e,a=r[t++])&&(~yC(n,a)||tg(n,a));return n},Kf=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],bC=S0,$C=Kf,fl=Object.keys||function(r){return bC(r,$C)},wC=qe,_C=f0,EC=Ct,SC=jt,OC=$r,TC=fl;cl.f=wC&&!_C?Object.defineProperties:function(r,e){SC(r);for(var t=OC(e),n=TC(e),a=n.length,o=0,s;a>o;)EC.f(r,s=n[o++],t[s]);return r};var IC=mt,O0=IC("document","documentElement"),kC=pa,PC=nl,rg=kC("keys"),vl=function(i){return rg[i]||(rg[i]=PC(i))},xC=jt,CC=cl,ig=Kf,AC=Po,DC=O0,RC=Vf,NC=vl,ng=">",ag="<",Id="prototype",kd="script",T0=NC("IE_PROTO"),wh=function(){},I0=function(i){return ag+kd+ng+i+ag+"/"+kd+ng},og=function(i){i.write(I0("")),i.close();var r=i.parentWindow.Object;return i=null,r},MC=function(){var i=RC("iframe"),r="java"+kd+":",e;return i.style.display="none",DC.appendChild(i),i.src=String(r),e=i.contentWindow.document,e.open(),e.write(I0("document.F=Object")),e.close(),e.F},Is,hu=function(){try{Is=new ActiveXObject("htmlfile")}catch{}hu=typeof document<"u"?document.domain&&Is?og(Is):MC():og(Is);for(var i=ig.length;i--;)delete hu[Id][ig[i]];return hu()};AC[T0]=!0;var rn=Object.create||function(r,e){var t;return r!==null?(wh[Id]=xC(r),t=new wh,wh[Id]=null,t[T0]=r):t=hu(),e===void 0?t:CC.f(t,e)},xo={},BC=S0,FC=Kf,jC=FC.concat("length","prototype");xo.f=Object.getOwnPropertyNames||function(r){return BC(r,jC)};var Gf={},sg=dl,LC=Lt,zC=ga,HC=Array,VC=Math.max,k0=function(i,r,e){for(var t=LC(i),n=sg(r,t),a=sg(e===void 0?t:e,t),o=HC(VC(a-n,0)),s=0;ng;g++)if((s||g in f)&&($=f[g],b=v($,g,d),i))if(r)m[g]=b;else if(b)switch(i){case 3:return!0;case 5:return $;case 6:return g;case 2:dg(m,$)}else switch(i){case 4:return!1;case 7:dg(m,$)}return a?-1:t||n?n:m}},ba={forEach:Gr(0),map:Gr(1),filter:Gr(2),some:Gr(3),every:Gr(4),find:Gr(5),findIndex:Gr(6),filterReject:Gr(7)},pl=K,Do=$e,Yf=Ye,x2=be,Yn=qe,Xn=fa,C2=le,Ke=Ve,A2=He,xd=jt,gl=$r,Xf=al,D2=tn,Cd=en,uo=rn,D0=fl,R2=xo,R0=Gf,N2=Co,N0=Qi,M0=Ct,M2=cl,B0=rl,fg=ya,B2=qf,Jf=pa,F2=vl,F0=Po,vg=nl,j2=Ee,L2=Ao,z2=ke,H2=C0,V2=nn,j0=ma,yl=ba.forEach,Et=F2("hidden"),ml="Symbol",lo="prototype",W2=j0.set,pg=j0.getterFor(ml),ar=Object[lo],Ri=Do.Symbol,Ka=Ri&&Ri[lo],U2=Do.RangeError,K2=Do.TypeError,Sh=Do.QObject,L0=N0.f,Ni=M0.f,z0=R0.f,G2=B0.f,H0=x2([].push),Mr=Jf("symbols"),Ro=Jf("op-symbols"),q2=Jf("wks"),Ad=!Sh||!Sh[lo]||!Sh[lo].findChild,V0=function(i,r,e){var t=L0(ar,r);t&&delete ar[r],Ni(i,r,e),t&&i!==ar&&Ni(ar,r,t)},Dd=Yn&&C2(function(){return uo(Ni({},"a",{get:function(){return Ni(this,"a",{value:7}).a}})).a!==7})?V0:Ni,Oh=function(i,r){var e=Mr[i]=uo(Ka);return W2(e,{type:ml,tag:i,description:r}),Yn||(e.description=r),e},bl=function(r,e,t){r===ar&&bl(Ro,e,t),xd(r);var n=Xf(e);return xd(t),Ke(Mr,n)?(t.enumerable?(Ke(r,Et)&&r[Et][n]&&(r[Et][n]=!1),t=uo(t,{enumerable:Cd(0,!1)})):(Ke(r,Et)||Ni(r,Et,Cd(1,{})),r[Et][n]=!0),Dd(r,n,t)):Ni(r,n,t)},Zf=function(r,e){xd(r);var t=gl(e),n=D0(t).concat(G0(t));return yl(n,function(a){(!Yn||Yf(W0,t,a))&&bl(r,a,t[a])}),r},Y2=function(r,e){return e===void 0?uo(r):Zf(uo(r),e)},W0=function(r){var e=Xf(r),t=Yf(G2,this,e);return this===ar&&Ke(Mr,e)&&!Ke(Ro,e)?!1:t||!Ke(this,e)||!Ke(Mr,e)||Ke(this,Et)&&this[Et][e]?t:!0},U0=function(r,e){var t=gl(r),n=Xf(e);if(!(t===ar&&Ke(Mr,n)&&!Ke(Ro,n))){var a=L0(t,n);return a&&Ke(Mr,n)&&!(Ke(t,Et)&&t[Et][n])&&(a.enumerable=!0),a}},K0=function(r){var e=z0(gl(r)),t=[];return yl(e,function(n){!Ke(Mr,n)&&!Ke(F0,n)&&H0(t,n)}),t},G0=function(i){var r=i===ar,e=z0(r?Ro:gl(i)),t=[];return yl(e,function(n){Ke(Mr,n)&&(!r||Ke(ar,n))&&H0(t,Mr[n])}),t};Xn||(Ri=function(){if(A2(Ka,this))throw new K2("Symbol is not a constructor");var r=!arguments.length||arguments[0]===void 0?void 0:D2(arguments[0]),e=vg(r),t=function(n){var a=this===void 0?Do:this;a===ar&&Yf(t,Ro,n),Ke(a,Et)&&Ke(a[Et],e)&&(a[Et][e]=!1);var o=Cd(1,n);try{Dd(a,e,o)}catch(s){if(!(s instanceof U2))throw s;V0(a,e,o)}};return Yn&&Ad&&Dd(ar,e,{configurable:!0,set:t}),Oh(e,r)},Ka=Ri[lo],fg(Ka,"toString",function(){return pg(this).tag}),fg(Ri,"withoutSetter",function(i){return Oh(vg(i),i)}),B0.f=W0,M0.f=bl,M2.f=Zf,N0.f=U0,R2.f=R0.f=K0,N2.f=G0,L2.f=function(i){return Oh(j2(i),i)},Yn&&B2(Ka,"description",{configurable:!0,get:function(){return pg(this).description}}));pl({global:!0,constructor:!0,wrap:!0,forced:!Xn,sham:!Xn},{Symbol:Ri});yl(D0(q2),function(i){z2(i)});pl({target:ml,stat:!0,forced:!Xn},{useSetter:function(){Ad=!0},useSimple:function(){Ad=!1}});pl({target:"Object",stat:!0,forced:!Xn,sham:!Yn},{create:Y2,defineProperty:bl,defineProperties:Zf,getOwnPropertyDescriptor:U0});pl({target:"Object",stat:!0,forced:!Xn},{getOwnPropertyNames:K0});H2();V2(Ri,ml);F0[Et]=!0;var X2=fa,q0=X2&&!!Symbol.for&&!!Symbol.keyFor,J2=K,Z2=mt,Q2=Ve,eA=tn,Y0=pa,tA=q0,Th=Y0("string-to-symbol-registry"),rA=Y0("symbol-to-string-registry");J2({target:"Symbol",stat:!0,forced:!tA},{for:function(i){var r=eA(i);if(Q2(Th,r))return Th[r];var e=Z2("Symbol")(r);return Th[r]=e,rA[e]=r,e}});var iA=K,nA=Ve,aA=To,oA=va,sA=pa,uA=q0,gg=sA("symbol-to-string-registry");iA({target:"Symbol",stat:!0,forced:!uA},{keyFor:function(r){if(!aA(r))throw new TypeError(oA(r)+" is not a symbol");if(nA(gg,r))return gg[r]}});var lA=be,No=lA([].slice),hA=be,yg=$i,cA=Ie,mg=yi,dA=tn,bg=hA([].push),fA=function(i){if(cA(i))return i;if(yg(i)){for(var r=i.length,e=[],t=0;t=r.length)return i.target=void 0,Cs(void 0,!0);switch(i.kind){case"keys":return Cs(e,!1);case"values":return Cs(r[e],!1)}return Cs([e,r[e]],!1)},"values");Dg.Arguments=Dg.Array;var KD={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},GD=KD,qD=$e,YD=zr,XD=Lr,Rg=$a,JD=Ee,Ng=JD("toStringTag");for(var xh in GD){var Mg=qD[xh],Ch=Mg&&Mg.prototype;Ch&&YD(Ch)!==Ng&&XD(Ch,Ng,xh),Rg[xh]=Rg.Array}var ZD=YA,uw=ZD,QD=Ee,eR=Ct.f,Bg=QD("metadata"),Fg=Function.prototype;Fg[Bg]===void 0&&eR(Fg,Bg,{value:null});var tR=ke;tR("asyncDispose");var rR=ke;rR("dispose");var iR=ke;iR("metadata");var nR=uw,aR=nR,oR=mt,sR=be,rv=oR("Symbol"),uR=rv.keyFor,lR=sR(rv.prototype.valueOf),lw=rv.isRegisteredSymbol||function(r){try{return uR(lR(r))!==void 0}catch{return!1}},hR=K,cR=lw;hR({target:"Symbol",stat:!0},{isRegisteredSymbol:cR});var dR=pa,hw=mt,fR=be,vR=To,pR=Ee,Cu=hw("Symbol"),jg=Cu.isWellKnownSymbol,cw=hw("Object","getOwnPropertyNames"),gR=fR(Cu.prototype.valueOf),Lg=dR("wks");for(var Ah=0,zg=cw(Cu),yR=zg.length;Ah=a?i?"":void 0:(o=Vg(t,n),o<55296||o>56319||n+1===a||(s=Vg(t,n+1))<56320||s>57343?i?RR(t,n):o:i?NR(t,n,n+2):(o-55296<<10)+(s-56320)+65536)}},MR={codeAt:Wg(!1),charAt:Wg(!0)},BR=MR.charAt,FR=tn,fw=ma,jR=ev,Ug=tv,vw="String Iterator",LR=fw.set,zR=fw.getterFor(vw);jR(String,"String",function(i){LR(this,{type:vw,string:FR(i),index:0})},function(){var r=zR(this),e=r.string,t=r.index,n;return t>=e.length?Ug(void 0,!0):(n=BR(e,t),r.index+=n.length,Ug(n,!1))});var HR=Ao,VR=HR.f("iterator"),WR=VR,pw=WR,UR=pw,KR=UR,GR=KR,qR=GR,gw=qR,YR=Y(gw);function Jn(i){"@babel/helpers - typeof";return Jn=typeof Dn=="function"&&typeof YR=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Dn=="function"&&r.constructor===Dn&&r!==Dn.prototype?"symbol":typeof r},Jn(i)}var XR=Ao,JR=XR.f("toPrimitive"),ZR=JR,QR=ZR,eN=QR,tN=eN,rN=tN,iN=rN,nN=iN,aN=Y(nN);function oN(i,r){if(Jn(i)!=="object"||i===null)return i;var e=i[aN];if(e!==void 0){var t=e.call(i,r||"default");if(Jn(t)!=="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(i)}function yw(i){var r=oN(i,"string");return Jn(r)==="symbol"?r:String(r)}function Kg(i,r){for(var e=0;e=0:s>u;u+=l)u in o&&(n=e(n,o[u],u,a));return n}},PN={left:Yg(!1),right:Yg(!0)},xN=le,_l=function(i,r){var e=[][i];return!!e&&xN(function(){e.call(null,r||function(){return 1},1)})},CN=$e,AN=yi,Bo=AN(CN.process)==="process",DN=K,RN=PN.left,NN=_l,Xg=da,MN=Bo,BN=!MN&&Xg>79&&Xg<83,FN=BN||!NN("reduce");DN({target:"Array",proto:!0,forced:FN},{reduce:function(r){var e=arguments.length;return RN(this,r,e,e>1?arguments[1]:void 0)}});var jN=lt,LN=jN("Array","reduce"),zN=He,HN=LN,Nh=Array.prototype,VN=function(i){var r=i.reduce;return i===Nh||zN(Nh,i)&&r===Nh.reduce?HN:r},WN=VN,UN=WN,KN=UN,GN=Y(KN),qN=K,YN=ba.filter,XN=ko,JN=XN("filter");qN({target:"Array",proto:!0,forced:!JN},{filter:function(r){return YN(this,r,arguments.length>1?arguments[1]:void 0)}});var ZN=lt,QN=ZN("Array","filter"),eM=He,tM=QN,Mh=Array.prototype,rM=function(i){var r=i.filter;return i===Mh||eM(Mh,i)&&r===Mh.filter?tM:r},iM=rM,nM=iM,aM=nM,Rn=Y(aM),oM=K,sM=ba.map,uM=ko,lM=uM("map");oM({target:"Array",proto:!0,forced:!lM},{map:function(r){return sM(this,r,arguments.length>1?arguments[1]:void 0)}});var hM=lt,cM=hM("Array","map"),dM=He,fM=cM,Bh=Array.prototype,vM=function(i){var r=i.map;return i===Bh||dM(Bh,i)&&r===Bh.map?fM:r},pM=vM,gM=pM,yM=gM,rr=Y(yM),mM=$i,bM=Lt,$M=ul,wM=bi,Ew=function(i,r,e,t,n,a,o,s){for(var u=n,l=0,h=o?wM(o,s):!1,c,d;l0&&mM(c)?(d=bM(c),u=Ew(i,r,c,d,u,a-1)-1):($M(u+1),i[u]=c),u++),l++;return u},_M=Ew,EM=K,SM=_M,OM=Pt,TM=xt,IM=Lt,kM=hl;EM({target:"Array",proto:!0},{flatMap:function(r){var e=TM(this),t=IM(e),n;return OM(r),n=kM(e,0),n.length=SM(n,e,e,t,0,1,r,arguments.length>1?arguments[1]:void 0),n}});var PM=lt;PM("Array","flatMap");var xM=Ye,Jg=jt,CM=zf,Sw=function(i,r,e){var t,n;Jg(i);try{if(t=CM(i,"return"),!t){if(r==="throw")throw e;return e}t=xM(t,i)}catch(a){n=!0,t=a}if(r==="throw")throw e;if(n)throw t;return Jg(t),e},AM=jt,DM=Sw,RM=function(i,r,e,t){try{return t?r(AM(e)[0],e[1]):r(e)}catch(n){DM(i,"throw",n)}},NM=Ee,MM=$a,BM=NM("iterator"),FM=Array.prototype,Ow=function(i){return i!==void 0&&(MM.Array===i||FM[BM]===i)},jM=zr,Zg=zf,LM=ca,zM=$a,HM=Ee,VM=HM("iterator"),El=function(i){if(!LM(i))return Zg(i,VM)||Zg(i,"@@iterator")||zM[jM(i)]},WM=Ye,UM=Pt,KM=jt,GM=va,qM=El,YM=TypeError,av=function(i,r){var e=arguments.length<2?qM(i):r;if(UM(e))return KM(WM(e,i));throw new YM(GM(i)+" is not iterable")},XM=bi,JM=Ye,ZM=xt,QM=RM,eB=Ow,tB=ll,rB=Lt,Qg=ga,iB=av,nB=El,ey=Array,aB=function(r){var e=ZM(r),t=tB(this),n=arguments.length,a=n>1?arguments[1]:void 0,o=a!==void 0;o&&(a=XM(a,n>2?arguments[2]:void 0));var s=nB(e),u=0,l,h,c,d,f,v;if(s&&!(this===ey&&eB(s)))for(d=iB(e,s),f=d.next,h=t?new this:[];!(c=JM(f,d)).done;u++)v=o?QM(d,a,[c.value,u],!0):c.value,Qg(h,u,v);else for(l=rB(e),h=t?new this(l):ey(l);l>u;u++)v=o?a(e[u],u):e[u],Qg(h,u,v);return h.length=u,h},oB=Ee,Tw=oB("iterator"),Iw=!1;try{var sB=0,ty={next:function(){return{done:!!sB++}},return:function(){Iw=!0}};ty[Tw]=function(){return this},Array.from(ty,function(){throw 2})}catch{}var kw=function(i,r){try{if(!r&&!Iw)return!1}catch{return!1}var e=!1;try{var t={};t[Tw]=function(){return{next:function(){return{done:e=!0}}}},i(t)}catch{}return e},uB=K,lB=aB,hB=kw,cB=!hB(function(i){Array.from(i)});uB({target:"Array",stat:!0,forced:cB},{from:lB});var dB=we,fB=dB.Array.from,vB=fB,Pw=vB,pB=Pw,ov=Y(pB),gB=El,yB=gB,mB=yB,bB=mB,$B=bB,wB=$B,_B=wB,EB=_B,xw=EB,Cw=Y(xw),SB=xw,sv=Y(SB),OB=K,TB=$i;OB({target:"Array",stat:!0},{isArray:TB});var IB=we,kB=IB.Array.isArray,PB=kB,Aw=PB,xB=Aw,CB=xB,AB=CB,DB=AB,RB=DB,Dw=Y(RB);function NB(i){if(Dw(i))return i}var MB=qe,BB=$i,FB=TypeError,jB=Object.getOwnPropertyDescriptor,LB=MB&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(i){return i instanceof TypeError}}(),Rw=LB?function(i,r){if(BB(i)&&!jB(i,"length").writable)throw new FB("Cannot set read only .length");return i.length=r}:function(i,r){return i.length=r},zB=K,HB=xt,VB=Lt,WB=Rw,UB=ul,KB=le,GB=KB(function(){return[].push.call({length:4294967296},1)!==4294967297}),qB=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(i){return i instanceof TypeError}},YB=GB||!qB();zB({target:"Array",proto:!0,arity:1,forced:YB},{push:function(r){var e=HB(this),t=VB(e),n=arguments.length;UB(t+n);for(var a=0;ai.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?arguments[1]:void 0)},Oj=K,ny=Sj;Oj({target:"Array",proto:!0,forced:[].forEach!==ny},{forEach:ny});var Tj=lt,Ij=Tj("Array","forEach"),kj=Ij,Pj=kj,xj=zr,Cj=Ve,Aj=He,Dj=Pj,Hh=Array.prototype,Rj={DOMTokenList:!0,NodeList:!0},zw=function(i){var r=i.forEach;return i===Hh||Aj(Hh,i)&&r===Hh.forEach||Cj(Rj,xj(i))?Dj:r},Nj=zw,Wi=Y(Nj),Mj=K,Bj=be,Fj=$i,jj=Bj([].reverse),ay=[1,2];Mj({target:"Array",proto:!0,forced:String(ay)===String(ay.reverse())},{reverse:function(){return Fj(this)&&(this.length=this.length),jj(this)}});var Lj=lt,zj=Lj("Array","reverse"),Hj=He,Vj=zj,Vh=Array.prototype,Wj=function(i){var r=i.reverse;return i===Vh||Hj(Vh,i)&&r===Vh.reverse?Vj:r},Uj=Wj,Hw=Uj,Kj=Hw,Gj=Y(Kj),oy=va,qj=TypeError,Vw=function(i,r){if(!delete i[r])throw new qj("Cannot delete property "+oy(r)+" of "+oy(i))},Yj=K,Xj=xt,Jj=dl,Zj=sl,Qj=Lt,e3=Rw,t3=ul,r3=hl,i3=ga,Wh=Vw,n3=ko,a3=n3("splice"),o3=Math.max,s3=Math.min;Yj({target:"Array",proto:!0,forced:!a3},{splice:function(r,e){var t=Xj(this),n=Qj(t),a=Jj(r,n),o=arguments.length,s,u,l,h,c,d;for(o===0?s=u=0:o===1?(s=0,u=n-a):(s=o-2,u=s3(o3(Zj(e),0),n-a)),t3(n+s-u),l=r3(t,u),h=0;hn-u+s;h--)Wh(t,h-1)}else if(s>u)for(h=n-u;h>a;h--)c=h+u-1,d=h+s-1,c in t?t[d]=t[c]:Wh(t,d);for(h=0;ha;)for(var u=_3(arguments[a++]),l=o?E3(Kh(u),o(u)):Kh(u),h=l.length,c=0,d;h>c;)d=l[c++],(!sy||y3(s,u,d))&&(t[d]=u[d]);return t}:wn,O3=K,ly=S3;O3({target:"Object",stat:!0,arity:2,forced:Object.assign!==ly},{assign:ly});var T3=we,I3=T3.Object.assign,k3=I3,P3=k3,x3=P3,C3=Y(x3),A3=K,D3=le,R3=xt,Uw=$l,N3=rw,M3=D3(function(){Uw(1)});A3({target:"Object",stat:!0,forced:M3,sham:!N3},{getPrototypeOf:function(r){return Uw(R3(r))}});var B3=we,F3=B3.Object.getPrototypeOf,j3=F3,L3=j3,z3=K,H3=qe,V3=rn;z3({target:"Object",stat:!0,sham:!H3},{create:V3});var W3=we,U3=W3.Object,K3=function(r,e){return U3.create(r,e)},G3=K3,Kw=G3,q3=Kw,Y3=Y(q3),Fd=we,X3=ha;Fd.JSON||(Fd.JSON={stringify:JSON.stringify});var J3=function(r,e,t){return X3(Fd.JSON.stringify,null,arguments)},Z3=J3,Q3=Z3,eL=Q3,tL=Y(eL),rL=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",iL=TypeError,Gw=function(i,r){if(ie,o=aL(t)?t:hL(t),s=a?uL(arguments,e):[],u=a?function(){nL(o,this,s)}:o;return r?i(u,n):i(u)}:i},dL=K,Xw=$e,fL=Yw,hy=fL(Xw.setInterval,!0);dL({global:!0,bind:!0,forced:Xw.setInterval!==hy},{setInterval:hy});var vL=K,Jw=$e,pL=Yw,cy=pL(Jw.setTimeout,!0);vL({global:!0,bind:!0,forced:Jw.setTimeout!==cy},{setTimeout:cy});var gL=we,yL=gL.setTimeout,mL=yL,bL=Y(mL),Zw={exports:{}};(function(i){function r(t){if(t)return e(t);this._callbacks=new Map}function e(t){return Object.assign(t,r.prototype),t._callbacks=new Map,t}r.prototype.on=function(t,n){const a=this._callbacks.get(t)??[];return a.push(n),this._callbacks.set(t,a),this},r.prototype.once=function(t,n){const a=(...o)=>{this.off(t,a),n.apply(this,o)};return a.fn=n,this.on(t,a),this},r.prototype.off=function(t,n){if(t===void 0&&n===void 0)return this._callbacks.clear(),this;if(n===void 0)return this._callbacks.delete(t),this;const a=this._callbacks.get(t);if(a){for(const[o,s]of a.entries())if(s===n||s.fn===n){a.splice(o,1);break}a.length===0?this._callbacks.delete(t):this._callbacks.set(t,a)}return this},r.prototype.emit=function(t,...n){const a=this._callbacks.get(t);if(a){const o=[...a];for(const s of o)s.apply(this,n)}return this},r.prototype.listeners=function(t){return this._callbacks.get(t)??[]},r.prototype.listenerCount=function(t){if(t)return this.listeners(t).length;let n=0;for(const a of this._callbacks.values())n+=a.length;return n},r.prototype.hasListeners=function(t){return this.listenerCount(t)>0},r.prototype.addEventListener=r.prototype.on,r.prototype.removeListener=r.prototype.off,r.prototype.removeEventListener=r.prototype.off,r.prototype.removeAllListeners=r.prototype.off,i.exports=r})(Zw);var $L=Zw.exports,wL=Y($L);/*! Hammer.JS - v2.0.17-rc - 2019-12-16 * http://naver.github.io/egjs * * Forked By Naver egjs * Copyright (c) hammerjs - * Licensed under the MIT license */function sr(){return sr=Object.assign||function(i){for(var r=1;r"u"?{style:{}}:document.createElement("div"),EL="function",Nn=Math.round,Ki=Math.abs,hv=Date.now;function Il(i,r){for(var e,t,n=r[0].toUpperCase()+r.slice(1),a=0;a"u"?kr={}:kr=window;var Qw=Il(_L.style,"touchAction"),e_=Qw!==void 0;function SL(){if(!e_)return!1;var i={},r=kr.CSS&&kr.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){return i[e]=r?kr.CSS.supports("touch-action",e):!0}),i}var t_="compute",r_="auto",Ld="manipulation",Mi="none",ho="pan-x",co="pan-y",Ds=SL(),OL=/mobile|tablet|ip(ad|hone|od)|android/i,i_="ontouchstart"in kr,TL=Il(kr,"PointerEvent")!==void 0,IL=i_&&OL.test(navigator.userAgent),Fo="touch",kL="pen",cv="mouse",PL="kinect",xL=25,pt=1,an=2,Fe=4,Tt=8,Au=1,jo=2,Lo=4,zo=8,Zn=16,gr=jo|Lo,Bi=zo|Zn,n_=gr|Bi,a_=["x","y"],Du=["clientX","clientY"];function Pr(i,r,e){var t;if(i)if(i.forEach)i.forEach(r,e);else if(i.length!==void 0)for(t=0;t-1}function CL(i){if(Ci(i,Mi))return Mi;var r=Ci(i,ho),e=Ci(i,co);return r&&e?Mi:r||e?r?ho:co:Ci(i,Ld)?Ld:r_}var o_=function(){function i(e,t){this.manager=e,this.set(t)}var r=i.prototype;return r.set=function(t){t===t_&&(t=this.compute()),e_&&this.manager.element.style&&Ds[t]&&(this.manager.element.style[Qw]=t),this.actions=t.toLowerCase().trim()},r.update=function(){this.set(this.manager.options.touchAction)},r.compute=function(){var t=[];return Pr(this.manager.recognizers,function(n){kl(n.options.enable,[n])&&(t=t.concat(n.getTouchAction()))}),CL(t.join(" "))},r.preventDefaults=function(t){var n=t.srcEvent,a=t.offsetDirection;if(this.manager.session.prevented){n.preventDefault();return}var o=this.actions,s=Ci(o,Mi)&&!Ds[Mi],u=Ci(o,co)&&!Ds[co],l=Ci(o,ho)&&!Ds[ho];if(s){var h=t.pointers.length===1,d=t.distance<2,c=t.deltaTime<250;if(h&&d&&c)return}if(!(l&&u)&&(s||u&&a&gr||l&&a&Bi))return this.preventSrc(n)},r.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},i}();function dv(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}function s_(i){var r=i.length;if(r===1)return{x:Nn(i[0].clientX),y:Nn(i[0].clientY)};for(var e=0,t=0,n=0;n=Ki(r)?i<0?jo:Lo:r<0?zo:Zn}function AL(i,r){var e=r.center,t=i.offsetDelta||{},n=i.prevDelta||{},a=i.prevInput||{};(r.eventType===pt||a.eventType===Fe)&&(n=i.prevDelta={x:a.deltaX||0,y:a.deltaY||0},t=i.offsetDelta={x:e.x,y:e.y}),r.deltaX=n.x+(e.x-t.x),r.deltaY=n.y+(e.y-t.y)}function l_(i,r,e){return{x:r/i||0,y:e/i||0}}function DL(i,r){return Ru(r[0],r[1],Du)/Ru(i[0],i[1],Du)}function RL(i,r){return zd(r[1],r[0],Du)+zd(i[1],i[0],Du)}function NL(i,r){var e=i.lastInterval||r,t=r.timeStamp-e.timeStamp,n,a,o,s;if(r.eventType!==Tt&&(t>xL||e.velocity===void 0)){var u=r.deltaX-e.deltaX,l=r.deltaY-e.deltaY,h=l_(t,u,l);a=h.x,o=h.y,n=Ki(h.x)>Ki(h.y)?h.x:h.y,s=u_(u,l),i.lastInterval=r}else n=e.velocity,a=e.velocityX,o=e.velocityY,s=e.direction;r.velocity=n,r.velocityX=a,r.velocityY=o,r.direction=s}function ML(i,r){var e=i.session,t=r.pointers,n=t.length;e.firstInput||(e.firstInput=fy(r)),n>1&&!e.firstMultiple?e.firstMultiple=fy(r):n===1&&(e.firstMultiple=!1);var a=e.firstInput,o=e.firstMultiple,s=o?o.center:a.center,u=r.center=s_(t);r.timeStamp=hv(),r.deltaTime=r.timeStamp-a.timeStamp,r.angle=zd(s,u),r.distance=Ru(s,u),AL(e,r),r.offsetDirection=u_(r.deltaX,r.deltaY);var l=l_(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=l.x,r.overallVelocityY=l.y,r.overallVelocity=Ki(l.x)>Ki(l.y)?l.x:l.y,r.scale=o?DL(o.pointers,t):1,r.rotation=o?RL(o.pointers,t):0,r.maxPointers=e.prevInput?r.pointers.length>e.prevInput.maxPointers?r.pointers.length:e.prevInput.maxPointers:r.pointers.length,NL(e,r);var h=i.element,d=r.srcEvent,c;d.composedPath?c=d.composedPath()[0]:d.path?c=d.path[0]:c=d.target,dv(c,h)&&(h=c),r.target=h}function BL(i,r,e){var t=e.pointers.length,n=e.changedPointers.length,a=r&pt&&t-n===0,o=r&(Fe|Tt)&&t-n===0;e.isFirst=!!a,e.isFinal=!!o,a&&(i.session={}),e.eventType=r,ML(i,e),i.emit("hammer.input",e),i.recognize(e),i.session.prevInput=e}function fo(i){return i.trim().split(/\s+/g)}function Xa(i,r,e){Pr(fo(r),function(t){i.addEventListener(t,e,!1)})}function Ja(i,r,e){Pr(fo(r),function(t){i.removeEventListener(t,e,!1)})}function vy(i){var r=i.ownerDocument||i;return r.defaultView||r.parentWindow||window}var wa=function(){function i(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(a){kl(e.options.enable,[e])&&n.handler(a)},this.init()}var r=i.prototype;return r.handler=function(){},r.init=function(){this.evEl&&Xa(this.element,this.evEl,this.domHandler),this.evTarget&&Xa(this.target,this.evTarget,this.domHandler),this.evWin&&Xa(vy(this.element),this.evWin,this.domHandler)},r.destroy=function(){this.evEl&&Ja(this.element,this.evEl,this.domHandler),this.evTarget&&Ja(this.target,this.evTarget,this.domHandler),this.evWin&&Ja(vy(this.element),this.evWin,this.domHandler)},i}();function Gi(i,r,e){if(i.indexOf&&!e)return i.indexOf(r);for(var t=0;tu[r]}):t=t.sort()),t}var LL={touchstart:pt,touchmove:an,touchend:Fe,touchcancel:Tt},zL="touchstart touchmove touchend touchcancel",vv=function(i){Xt(r,i);function r(){var t;return r.prototype.evTarget=zL,t=i.apply(this,arguments)||this,t.targetIds={},t}var e=r.prototype;return e.handler=function(n){var a=LL[n.type],o=HL.call(this,n,a);o&&this.callback(this.manager,a,{pointers:o[0],changedPointers:o[1],pointerType:Fo,srcEvent:n})},r}(wa);function HL(i,r){var e=vo(i.touches),t=this.targetIds;if(r&(pt|an)&&e.length===1)return t[e[0].identifier]=!0,[e,e];var n,a,o=vo(i.changedTouches),s=[],u=this.target;if(a=e.filter(function(l){return dv(l.target,u)}),r===pt)for(n=0;n-1&&n.splice(s,1)};setTimeout(a,KL)}}function GL(i,r){i&pt?(this.primaryTouch=r.changedPointers[0].identifier,gy.call(this,r)):i&(Fe|Tt)&&gy.call(this,r)}function qL(i){for(var r=i.srcEvent.clientX,e=i.srcEvent.clientY,t=0;t-1&&this.requireFail.splice(n,1),this},r.hasRequireFailures=function(){return this.requireFail.length>0},r.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},r.emit=function(t){var n=this,a=this.state;function o(s){n.manager.emit(s,t)}a=ai&&o(n.options.event+yy(a))},r.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=fr},r.canEmit=function(){for(var t=0;ta.threshold&&u&a.direction},e.attrTest=function(n){return ea.prototype.attrTest.call(this,n)&&(this.state&qt||!(this.state&qt)&&this.directionTest(n))},e.emit=function(n){this.pX=n.deltaX,this.pY=n.deltaY;var a=v_(n.direction);a&&(n.additionalEvent=this.options.event+a),i.prototype.emit.call(this,n)},r}(ea),p_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"swipe",threshold:10,velocity:.3,direction:gr|Bi,pointers:1},t))||this}var e=r.prototype;return e.getTouchAction=function(){return gv.prototype.getTouchAction.call(this)},e.attrTest=function(n){var a=this.options.direction,o;return a&(gr|Bi)?o=n.overallVelocity:a&gr?o=n.overallVelocityX:a&Bi&&(o=n.overallVelocityY),i.prototype.attrTest.call(this,n)&&a&n.offsetDirection&&n.distance>this.options.threshold&&n.maxPointers===this.options.pointers&&Ki(o)>this.options.velocity&&n.eventType&Fe},e.emit=function(n){var a=v_(n.offsetDirection);a&&this.manager.emit(this.options.event+a,n),this.manager.emit(this.options.event,n)},r}(ea),g_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"pinch",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Mi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.scale-1)>this.options.threshold||this.state&qt)},e.emit=function(n){if(n.scale!==1){var a=n.scale<1?"in":"out";n.additionalEvent=this.options.event+a}i.prototype.emit.call(this,n)},r}(ea),y_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"rotate",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Mi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.rotation)>this.options.threshold||this.state&qt)},r}(ea),m_=function(i){Xt(r,i);function r(t){var n;return t===void 0&&(t={}),n=i.call(this,sr({event:"press",pointers:1,time:251,threshold:9},t))||this,n._timer=null,n._input=null,n}var e=r.prototype;return e.getTouchAction=function(){return[r_]},e.process=function(n){var a=this,o=this.options,s=n.pointers.length===o.pointers,u=n.distanceo.time;if(this._input=n,!u||!s||n.eventType&(Fe|Tt)&&!l)this.reset();else if(n.eventType&pt)this.reset(),this._timer=setTimeout(function(){a.state=xr,a.tryEmit()},o.time);else if(n.eventType&Fe)return xr;return fr},e.reset=function(){clearTimeout(this._timer)},e.emit=function(n){this.state===xr&&(n&&n.eventType&Fe?this.manager.emit(this.options.event+"up",n):(this._input.timeStamp=hv(),this.manager.emit(this.options.event,this._input)))},r}(Ho),b_={domEvents:!1,touchAction:t_,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},my=[[y_,{enable:!1}],[g_,{enable:!1},["rotate"]],[p_,{direction:gr}],[gv,{direction:gr},["swipe"]],[Hd],[Hd,{event:"doubletap",taps:2},["tap"]],[m_]],ZL=1,by=2;function $y(i,r){var e=i.element;if(e.style){var t;Pr(i.options.cssProps,function(n,a){t=Il(e.style,a),r?(i.oldCssProps[t]=e.style[t],e.style[t]=n):e.style[t]=i.oldCssProps[t]||""}),r||(i.oldCssProps={})}}function QL(i,r){var e=document.createEvent("Event");e.initEvent(i,!0,!0),e.gesture=r,r.target.dispatchEvent(e)}var wy=function(){function i(e,t){var n=this;this.options=Ui({},b_,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=YL(this),this.touchAction=new o_(this,this.options.touchAction),$y(this,!0),Pr(this.options.recognizers,function(a){var o=n.add(new a[0](a[1]));a[2]&&o.recognizeWith(a[2]),a[3]&&o.requireFailure(a[3])},this)}var r=i.prototype;return r.set=function(t){return Ui(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},r.stop=function(t){this.session.stopped=t?by:ZL},r.recognize=function(t){var n=this.session;if(!n.stopped){this.touchAction.preventDefaults(t);var a,o=this.recognizers,s=n.curRecognizer;(!s||s&&s.state&xr)&&(n.curRecognizer=null,s=null);for(var u=0;u"u"?{style:{}}:document.createElement("div"),EL="function",Nn=Math.round,Ki=Math.abs,hv=Date.now;function Il(i,r){for(var e,t,n=r[0].toUpperCase()+r.slice(1),a=0;a"u"?kr={}:kr=window;var Qw=Il(_L.style,"touchAction"),e_=Qw!==void 0;function SL(){if(!e_)return!1;var i={},r=kr.CSS&&kr.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){return i[e]=r?kr.CSS.supports("touch-action",e):!0}),i}var t_="compute",r_="auto",Ld="manipulation",Mi="none",ho="pan-x",co="pan-y",Ds=SL(),OL=/mobile|tablet|ip(ad|hone|od)|android/i,i_="ontouchstart"in kr,TL=Il(kr,"PointerEvent")!==void 0,IL=i_&&OL.test(navigator.userAgent),Fo="touch",kL="pen",cv="mouse",PL="kinect",xL=25,gt=1,an=2,je=4,It=8,Au=1,jo=2,Lo=4,zo=8,Zn=16,yr=jo|Lo,Bi=zo|Zn,n_=yr|Bi,a_=["x","y"],Du=["clientX","clientY"];function Pr(i,r,e){var t;if(i)if(i.forEach)i.forEach(r,e);else if(i.length!==void 0)for(t=0;t-1}function CL(i){if(Ci(i,Mi))return Mi;var r=Ci(i,ho),e=Ci(i,co);return r&&e?Mi:r||e?r?ho:co:Ci(i,Ld)?Ld:r_}var o_=function(){function i(e,t){this.manager=e,this.set(t)}var r=i.prototype;return r.set=function(t){t===t_&&(t=this.compute()),e_&&this.manager.element.style&&Ds[t]&&(this.manager.element.style[Qw]=t),this.actions=t.toLowerCase().trim()},r.update=function(){this.set(this.manager.options.touchAction)},r.compute=function(){var t=[];return Pr(this.manager.recognizers,function(n){kl(n.options.enable,[n])&&(t=t.concat(n.getTouchAction()))}),CL(t.join(" "))},r.preventDefaults=function(t){var n=t.srcEvent,a=t.offsetDirection;if(this.manager.session.prevented){n.preventDefault();return}var o=this.actions,s=Ci(o,Mi)&&!Ds[Mi],u=Ci(o,co)&&!Ds[co],l=Ci(o,ho)&&!Ds[ho];if(s){var h=t.pointers.length===1,c=t.distance<2,d=t.deltaTime<250;if(h&&c&&d)return}if(!(l&&u)&&(s||u&&a&yr||l&&a&Bi))return this.preventSrc(n)},r.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},i}();function dv(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}function s_(i){var r=i.length;if(r===1)return{x:Nn(i[0].clientX),y:Nn(i[0].clientY)};for(var e=0,t=0,n=0;n=Ki(r)?i<0?jo:Lo:r<0?zo:Zn}function AL(i,r){var e=r.center,t=i.offsetDelta||{},n=i.prevDelta||{},a=i.prevInput||{};(r.eventType===gt||a.eventType===je)&&(n=i.prevDelta={x:a.deltaX||0,y:a.deltaY||0},t=i.offsetDelta={x:e.x,y:e.y}),r.deltaX=n.x+(e.x-t.x),r.deltaY=n.y+(e.y-t.y)}function l_(i,r,e){return{x:r/i||0,y:e/i||0}}function DL(i,r){return Ru(r[0],r[1],Du)/Ru(i[0],i[1],Du)}function RL(i,r){return zd(r[1],r[0],Du)+zd(i[1],i[0],Du)}function NL(i,r){var e=i.lastInterval||r,t=r.timeStamp-e.timeStamp,n,a,o,s;if(r.eventType!==It&&(t>xL||e.velocity===void 0)){var u=r.deltaX-e.deltaX,l=r.deltaY-e.deltaY,h=l_(t,u,l);a=h.x,o=h.y,n=Ki(h.x)>Ki(h.y)?h.x:h.y,s=u_(u,l),i.lastInterval=r}else n=e.velocity,a=e.velocityX,o=e.velocityY,s=e.direction;r.velocity=n,r.velocityX=a,r.velocityY=o,r.direction=s}function ML(i,r){var e=i.session,t=r.pointers,n=t.length;e.firstInput||(e.firstInput=fy(r)),n>1&&!e.firstMultiple?e.firstMultiple=fy(r):n===1&&(e.firstMultiple=!1);var a=e.firstInput,o=e.firstMultiple,s=o?o.center:a.center,u=r.center=s_(t);r.timeStamp=hv(),r.deltaTime=r.timeStamp-a.timeStamp,r.angle=zd(s,u),r.distance=Ru(s,u),AL(e,r),r.offsetDirection=u_(r.deltaX,r.deltaY);var l=l_(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=l.x,r.overallVelocityY=l.y,r.overallVelocity=Ki(l.x)>Ki(l.y)?l.x:l.y,r.scale=o?DL(o.pointers,t):1,r.rotation=o?RL(o.pointers,t):0,r.maxPointers=e.prevInput?r.pointers.length>e.prevInput.maxPointers?r.pointers.length:e.prevInput.maxPointers:r.pointers.length,NL(e,r);var h=i.element,c=r.srcEvent,d;c.composedPath?d=c.composedPath()[0]:c.path?d=c.path[0]:d=c.target,dv(d,h)&&(h=d),r.target=h}function BL(i,r,e){var t=e.pointers.length,n=e.changedPointers.length,a=r>&&t-n===0,o=r&(je|It)&&t-n===0;e.isFirst=!!a,e.isFinal=!!o,a&&(i.session={}),e.eventType=r,ML(i,e),i.emit("hammer.input",e),i.recognize(e),i.session.prevInput=e}function fo(i){return i.trim().split(/\s+/g)}function Xa(i,r,e){Pr(fo(r),function(t){i.addEventListener(t,e,!1)})}function Ja(i,r,e){Pr(fo(r),function(t){i.removeEventListener(t,e,!1)})}function vy(i){var r=i.ownerDocument||i;return r.defaultView||r.parentWindow||window}var wa=function(){function i(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(a){kl(e.options.enable,[e])&&n.handler(a)},this.init()}var r=i.prototype;return r.handler=function(){},r.init=function(){this.evEl&&Xa(this.element,this.evEl,this.domHandler),this.evTarget&&Xa(this.target,this.evTarget,this.domHandler),this.evWin&&Xa(vy(this.element),this.evWin,this.domHandler)},r.destroy=function(){this.evEl&&Ja(this.element,this.evEl,this.domHandler),this.evTarget&&Ja(this.target,this.evTarget,this.domHandler),this.evWin&&Ja(vy(this.element),this.evWin,this.domHandler)},i}();function Gi(i,r,e){if(i.indexOf&&!e)return i.indexOf(r);for(var t=0;tu[r]}):t=t.sort()),t}var LL={touchstart:gt,touchmove:an,touchend:je,touchcancel:It},zL="touchstart touchmove touchend touchcancel",vv=function(i){Xt(r,i);function r(){var t;return r.prototype.evTarget=zL,t=i.apply(this,arguments)||this,t.targetIds={},t}var e=r.prototype;return e.handler=function(n){var a=LL[n.type],o=HL.call(this,n,a);o&&this.callback(this.manager,a,{pointers:o[0],changedPointers:o[1],pointerType:Fo,srcEvent:n})},r}(wa);function HL(i,r){var e=vo(i.touches),t=this.targetIds;if(r&(gt|an)&&e.length===1)return t[e[0].identifier]=!0,[e,e];var n,a,o=vo(i.changedTouches),s=[],u=this.target;if(a=e.filter(function(l){return dv(l.target,u)}),r===gt)for(n=0;n-1&&n.splice(s,1)};setTimeout(a,KL)}}function GL(i,r){i>?(this.primaryTouch=r.changedPointers[0].identifier,gy.call(this,r)):i&(je|It)&&gy.call(this,r)}function qL(i){for(var r=i.srcEvent.clientX,e=i.srcEvent.clientY,t=0;t-1&&this.requireFail.splice(n,1),this},r.hasRequireFailures=function(){return this.requireFail.length>0},r.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},r.emit=function(t){var n=this,a=this.state;function o(s){n.manager.emit(s,t)}a=ui&&o(n.options.event+yy(a))},r.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=vr},r.canEmit=function(){for(var t=0;ta.threshold&&u&a.direction},e.attrTest=function(n){return ea.prototype.attrTest.call(this,n)&&(this.state&qt||!(this.state&qt)&&this.directionTest(n))},e.emit=function(n){this.pX=n.deltaX,this.pY=n.deltaY;var a=v_(n.direction);a&&(n.additionalEvent=this.options.event+a),i.prototype.emit.call(this,n)},r}(ea),p_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"swipe",threshold:10,velocity:.3,direction:yr|Bi,pointers:1},t))||this}var e=r.prototype;return e.getTouchAction=function(){return gv.prototype.getTouchAction.call(this)},e.attrTest=function(n){var a=this.options.direction,o;return a&(yr|Bi)?o=n.overallVelocity:a&yr?o=n.overallVelocityX:a&Bi&&(o=n.overallVelocityY),i.prototype.attrTest.call(this,n)&&a&n.offsetDirection&&n.distance>this.options.threshold&&n.maxPointers===this.options.pointers&&Ki(o)>this.options.velocity&&n.eventType&je},e.emit=function(n){var a=v_(n.offsetDirection);a&&this.manager.emit(this.options.event+a,n),this.manager.emit(this.options.event,n)},r}(ea),g_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"pinch",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Mi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.scale-1)>this.options.threshold||this.state&qt)},e.emit=function(n){if(n.scale!==1){var a=n.scale<1?"in":"out";n.additionalEvent=this.options.event+a}i.prototype.emit.call(this,n)},r}(ea),y_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"rotate",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Mi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.rotation)>this.options.threshold||this.state&qt)},r}(ea),m_=function(i){Xt(r,i);function r(t){var n;return t===void 0&&(t={}),n=i.call(this,sr({event:"press",pointers:1,time:251,threshold:9},t))||this,n._timer=null,n._input=null,n}var e=r.prototype;return e.getTouchAction=function(){return[r_]},e.process=function(n){var a=this,o=this.options,s=n.pointers.length===o.pointers,u=n.distanceo.time;if(this._input=n,!u||!s||n.eventType&(je|It)&&!l)this.reset();else if(n.eventType>)this.reset(),this._timer=setTimeout(function(){a.state=xr,a.tryEmit()},o.time);else if(n.eventType&je)return xr;return vr},e.reset=function(){clearTimeout(this._timer)},e.emit=function(n){this.state===xr&&(n&&n.eventType&je?this.manager.emit(this.options.event+"up",n):(this._input.timeStamp=hv(),this.manager.emit(this.options.event,this._input)))},r}(Ho),b_={domEvents:!1,touchAction:t_,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},my=[[y_,{enable:!1}],[g_,{enable:!1},["rotate"]],[p_,{direction:yr}],[gv,{direction:yr},["swipe"]],[Hd],[Hd,{event:"doubletap",taps:2},["tap"]],[m_]],ZL=1,by=2;function $y(i,r){var e=i.element;if(e.style){var t;Pr(i.options.cssProps,function(n,a){t=Il(e.style,a),r?(i.oldCssProps[t]=e.style[t],e.style[t]=n):e.style[t]=i.oldCssProps[t]||""}),r||(i.oldCssProps={})}}function QL(i,r){var e=document.createEvent("Event");e.initEvent(i,!0,!0),e.gesture=r,r.target.dispatchEvent(e)}var wy=function(){function i(e,t){var n=this;this.options=Ui({},b_,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=YL(this),this.touchAction=new o_(this,this.options.touchAction),$y(this,!0),Pr(this.options.recognizers,function(a){var o=n.add(new a[0](a[1]));a[2]&&o.recognizeWith(a[2]),a[3]&&o.requireFailure(a[3])},this)}var r=i.prototype;return r.set=function(t){return Ui(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},r.stop=function(t){this.session.stopped=t?by:ZL},r.recognize=function(t){var n=this.session;if(!n.stopped){this.touchAction.preventDefaults(t);var a,o=this.recognizers,s=n.curRecognizer;(!s||s&&s.state&xr)&&(n.curRecognizer=null,s=null);for(var u=0;u\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=window.console&&(window.console.warn||window.console.log);return o&&o.call(window.console,t,a),i.apply(this,arguments)}}var w_=$_(function(i,r,e){for(var t=Object.keys(r),n=0;n=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function l5(i,r){var e;if(i){if(typeof i=="string")return Ey(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ey(i,r)}}function Ey(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?e-1:0),n=1;n2){var t;return Nu.apply(void 0,Ol(t=[S_(r[0],r[1])]).call(t,Et(Tl(r).call(r,2))))}var n=r[0],a=r[1];if(n instanceof Date&&a instanceof Date)return n.setTime(a.getTime()),n;var o=__(hj(a)),s;try{for(o.s();!(s=o.n()).done;){var u=s.value;Object.prototype.propertyIsEnumerable.call(a,u)&&(a[u]===E_?delete n[u]:n[u]!==null&&a[u]!==null&&typeof n[u]=="object"&&typeof a[u]=="object"&&!Bt(n[u])&&!Bt(a[u])?n[u]=Nu(n[u],a[u]):n[u]=O_(a[u]))}}catch(l){o.e(l)}finally{o.f()}return n}function O_(i){return Bt(i)?rr(i).call(i,function(r){return O_(r)}):typeof i=="object"&&i!==null?i instanceof Date?new Date(i.getTime()):Nu({},i):i}function T_(i){for(var r=0,e=lv(i);ro;)u=t(e,s=n[o++]),u!==void 0&&Y5(a,s,u);return a}});var X5=we,J5=X5.Object.getOwnPropertyDescriptors,Z5=J5,Q5=Z5,ez=Q5,ky=Y(ez),M_={exports:{}},tz=K,rz=Ge,Py=cl.f;tz({target:"Object",stat:!0,forced:Object.defineProperties!==Py,sham:!rz},{defineProperties:Py});var iz=we,B_=iz.Object,nz=M_.exports=function(r,e){return B_.defineProperties(r,e)};B_.defineProperties.sham&&(nz.sham=!0);var az=M_.exports,oz=az,sz=oz,uz=sz,lz=Y(uz),hz=p0,cz=Y(hz);function F_(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}var dz=Kw,fz=dz,vz=fz,pz=vz,j_=pz,gz=Y(j_),yz=K,mz=aw;yz({target:"Object",stat:!0},{setPrototypeOf:mz});var bz=we,$z=bz.Object.setPrototypeOf,wz=$z,_z=wz,Ez=_z,Sz=Ez,Oz=Sz,Tz=Oz,L_=Tz,Vd=Y(L_),Iz=ww,kz=Iz,Pz=kz,xz=Pz,Cz=xz,z_=Y(Cz);function Wd(i,r){var e;return Wd=Vd?z_(e=Vd).call(e):function(n,a){return n.__proto__=a,n},Wd(i,r)}function Az(i,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=gz(r.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),ol(i,"prototype",{writable:!1}),Wd(i,r)}function Dz(i,r){if(r&&(Jn(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F_(i)}var Rz=L3,Nz=Rz,Mz=Nz,Bz=Mz,H_=Bz,xy=Y(H_);function Mu(i){var r;return Mu=Vd?z_(r=xy).call(r):function(t){return t.__proto__||xy(t)},Mu(i)}var V_={exports:{}},W_={exports:{}};(function(i){var r=iv,e=gw;function t(n){"@babel/helpers - typeof";return i.exports=t=typeof r=="function"&&typeof e=="symbol"?function(a){return typeof a}:function(a){return a&&typeof r=="function"&&a.constructor===r&&a!==r.prototype?"symbol":typeof a},i.exports.__esModule=!0,i.exports.default=i.exports,t(n)}i.exports=t,i.exports.__esModule=!0,i.exports.default=i.exports})(W_);var Fz=W_.exports,jz=zw,Lz=jz,zz=Lz,Hz=zz,Vz=Hz,Cy=He,Wz=uv,Uz=Qi,Kz=xt,Gz=function(i,r,e){for(var t=Wz(r),n=Kz.f,a=Uz.f,o=0;od;d++)if(f=y(i[d]),f&&Dy(Ny,f))return f;return new fu(!1)}l=p4(i,h)}for(v=a?i.next:l.next;!(p=h4(v,l)).done;){try{f=y(p.value)}catch(m){Ry(l,"throw",m)}if(typeof f=="object"&&f&&Dy(Ny,f))return f}return new fu(!1)},m4=tn,b4=function(i,r){return i===void 0?arguments.length<2?"":r:m4(i)},$4=K,w4=ze,_4=$l,Bu=aw,E4=Gz,G_=rn,qh=Lr,Yh=en,S4=Xz,O4=u4,T4=on,I4=b4,k4=_e,P4=k4("toStringTag"),Fu=Error,x4=[].push,ta=function(r,e){var t=w4(Xh,this),n;Bu?n=Bu(new Fu,t?_4(this):Xh):(n=t?this:G_(Xh),qh(n,P4,"Error")),e!==void 0&&qh(n,"message",I4(e)),O4(n,ta,n.stack,1),arguments.length>2&&S4(n,arguments[2]);var a=[];return T4(r,x4,{that:a}),qh(n,"errors",a),n};Bu?Bu(ta,Fu):E4(ta,Fu,{name:!0});var Xh=ta.prototype=G_(Fu.prototype,{constructor:Yh(1,ta),message:Yh(1,""),name:Yh(1,"AggregateError")});$4({global:!0,constructor:!0,arity:2},{AggregateError:ta});var C4=yt,A4=qf,D4=_e,R4=Ge,My=D4("species"),q_=function(i){var r=C4(i);R4&&r&&!r[My]&&A4(r,My,{configurable:!0,get:function(){return this}})},N4=ze,M4=TypeError,mv=function(i,r){if(N4(r,i))return i;throw new M4("Incorrect invocation")},By=jt,B4=I_,F4=ca,j4=_e,L4=j4("species"),Y_=function(i,r){var e=By(i).constructor,t;return e===void 0||F4(t=By(e)[L4])?r:B4(t)},z4=pi,X_=/(?:ipad|iphone|ipod).*applewebkit/i.test(z4),Ft=$e,H4=ha,V4=gi,Fy=Ie,W4=He,J_=ue,jy=O0,U4=No,Ly=Vf,K4=Gw,G4=X_,q4=Bo,Ud=Ft.setImmediate,Kd=Ft.clearImmediate,Y4=Ft.process,Jh=Ft.Dispatch,X4=Ft.Function,zy=Ft.MessageChannel,J4=Ft.String,Zh=0,Za={},Hy="onreadystatechange",go,ki,Qh,ec;J_(function(){go=Ft.location});var bv=function(i){if(W4(Za,i)){var r=Za[i];delete Za[i],r()}},tc=function(i){return function(){bv(i)}},Vy=function(i){bv(i.data)},Wy=function(i){Ft.postMessage(J4(i),go.protocol+"//"+go.host)};(!Ud||!Kd)&&(Ud=function(r){K4(arguments.length,1);var e=Fy(r)?r:X4(r),t=U4(arguments,1);return Za[++Zh]=function(){H4(e,void 0,t)},ki(Zh),Zh},Kd=function(r){delete Za[r]},q4?ki=function(i){Y4.nextTick(tc(i))}:Jh&&Jh.now?ki=function(i){Jh.now(tc(i))}:zy&&!G4?(Qh=new zy,ec=Qh.port2,Qh.port1.onmessage=Vy,ki=V4(ec.postMessage,ec)):Ft.addEventListener&&Fy(Ft.postMessage)&&!Ft.importScripts&&go&&go.protocol!=="file:"&&!J_(Wy)?(ki=Wy,Ft.addEventListener("message",Vy,!1)):Hy in Ly("script")?ki=function(i){jy.appendChild(Ly("script"))[Hy]=function(){jy.removeChild(this),bv(i)}}:ki=function(i){setTimeout(tc(i),0)});var Z_={set:Ud,clear:Kd},Q_=function(){this.head=null,this.tail=null};Q_.prototype={add:function(i){var r={item:i,next:null},e=this.tail;e?e.next=r:this.head=r,this.tail=r},get:function(){var i=this.head;if(i){var r=this.head=i.next;return r===null&&(this.tail=null),i.item}}};var eE=Q_,Z4=pi,Q4=/ipad|iphone|ipod/i.test(Z4)&&typeof Pebble<"u",e6=pi,t6=/web0s(?!.*chrome)/i.test(e6),qi=$e,Uy=gi,r6=Qi.f,rc=Z_.set,i6=eE,n6=X_,a6=Q4,o6=t6,ic=Bo,Ky=qi.MutationObserver||qi.WebKitMutationObserver,Gy=qi.document,qy=qi.process,Ns=qi.Promise,Yy=r6(qi,"queueMicrotask"),Gd=Yy&&Yy.value,_n,nc,ac,Ms,Xy;if(!Gd){var Bs=new i6,Fs=function(){var i,r;for(ic&&(i=qy.domain)&&i.exit();r=Bs.get();)try{r()}catch(e){throw Bs.head&&_n(),e}i&&i.enter()};!n6&&!ic&&!o6&&Ky&&Gy?(nc=!0,ac=Gy.createTextNode(""),new Ky(Fs).observe(ac,{characterData:!0}),_n=function(){ac.data=nc=!nc}):!a6&&Ns&&Ns.resolve?(Ms=Ns.resolve(void 0),Ms.constructor=Ns,Xy=Uy(Ms.then,Ms),_n=function(){Xy(Fs)}):ic?_n=function(){qy.nextTick(Fs)}:(rc=Uy(rc,qi),_n=function(){rc(Fs)}),Gd=function(i){Bs.head||_n(),Bs.add(i)}}var s6=Gd,u6=function(i,r){try{arguments.length===1?console.error(i):console.error(i,r)}catch{}},_a=function(i){try{return{error:!1,value:i()}}catch(r){return{error:!0,value:r}}},l6=$e,Ea=l6.Promise,tE=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",h6=tE,c6=Bo,d6=!h6&&!c6&&typeof window=="object"&&typeof document=="object",f6=$e,Qa=Ea,v6=Ie,p6=d0,g6=m0,y6=_e,m6=d6,b6=tE,oc=da,Jy=Qa&&Qa.prototype,$6=y6("species"),qd=!1,rE=v6(f6.PromiseRejectionEvent),w6=p6("Promise",function(){var i=g6(Qa),r=i!==String(Qa);if(!r&&oc===66||!(Jy.catch&&Jy.finally))return!0;if(!oc||oc<51||!/native code/.test(i)){var e=new Qa(function(a){a(1)}),t=function(a){a(function(){},function(){})},n=e.constructor={};if(n[$6]=t,qd=e.then(function(){})instanceof t,!qd)return!0}return!r&&(m6||b6)&&!rE}),Vo={CONSTRUCTOR:w6,REJECTION_EVENT:rE,SUBCLASSING:qd},$r={},Zy=kt,_6=TypeError,E6=function(i){var r,e;this.promise=new i(function(t,n){if(r!==void 0||e!==void 0)throw new _6("Bad Promise constructor");r=t,e=n}),this.resolve=Zy(r),this.reject=Zy(e)};$r.f=function(i){return new E6(i)};var S6=K,ju=Bo,hi=$e,Wo=qe,O6=ya,T6=nn,I6=q_,k6=kt,Yd=Ie,P6=it,x6=mv,C6=Y_,iE=Z_.set,$v=s6,A6=u6,D6=_a,R6=eE,nE=ma,Xd=Ea,aE=Vo,oE=$r,Pl="Promise",sE=aE.CONSTRUCTOR,N6=aE.REJECTION_EVENT,sc=nE.getterFor(Pl),M6=nE.set,B6=Xd&&Xd.prototype,Bn=Xd,uc=B6,uE=hi.TypeError,Jd=hi.document,wv=hi.process,Zd=oE.f,F6=Zd,j6=!!(Jd&&Jd.createEvent&&hi.dispatchEvent),lE="unhandledrejection",L6="rejectionhandled",Qy=0,hE=1,z6=2,_v=1,cE=2,js,em,H6,dE=function(i){var r;return P6(i)&&Yd(r=i.then)?r:!1},fE=function(i,r){var e=r.value,t=r.state===hE,n=t?i.ok:i.fail,a=i.resolve,o=i.reject,s=i.domain,u,l,h;try{n?(t||(r.rejection===cE&&W6(r),r.rejection=_v),n===!0?u=e:(s&&s.enter(),u=n(e),s&&(s.exit(),h=!0)),u===i.promise?o(new uE("Promise-chain cycle")):(l=dE(u))?Wo(l,u,a,o):a(u)):o(e)}catch(d){s&&!h&&s.exit(),o(d)}},vE=function(i,r){i.notified||(i.notified=!0,$v(function(){for(var e=i.reactions,t;t=e.get();)fE(t,i);i.notified=!1,r&&!i.rejection&&V6(i)}))},pE=function(i,r,e){var t,n;j6?(t=Jd.createEvent("Event"),t.promise=r,t.reason=e,t.initEvent(i,!1,!0),hi.dispatchEvent(t)):t={promise:r,reason:e},!N6&&(n=hi["on"+i])?n(t):i===lE&&A6("Unhandled promise rejection",e)},V6=function(i){Wo(iE,hi,function(){var r=i.facade,e=i.value,t=tm(i),n;if(t&&(n=D6(function(){ju?wv.emit("unhandledRejection",e,r):pE(lE,r,e)}),i.rejection=ju||tm(i)?cE:_v,n.error))throw n.value})},tm=function(i){return i.rejection!==_v&&!i.parent},W6=function(i){Wo(iE,hi,function(){var r=i.facade;ju?wv.emit("rejectionHandled",r):pE(L6,r,i.value)})},Fn=function(i,r,e){return function(t){i(r,t,e)}},Un=function(i,r,e){i.done||(i.done=!0,e&&(i=e),i.value=r,i.state=z6,vE(i,!0))},Qd=function(i,r,e){if(!i.done){i.done=!0,e&&(i=e);try{if(i.facade===r)throw new uE("Promise can't be resolved itself");var t=dE(r);t?$v(function(){var n={done:!1};try{Wo(t,r,Fn(Qd,n,i),Fn(Un,n,i))}catch(a){Un(n,a,i)}}):(i.value=r,i.state=hE,vE(i,!1))}catch(n){Un({done:!1},n,i)}}};sE&&(Bn=function(r){x6(this,uc),k6(r),Wo(js,this);var e=sc(this);try{r(Fn(Qd,e),Fn(Un,e))}catch(t){Un(e,t)}},uc=Bn.prototype,js=function(r){M6(this,{type:Pl,done:!1,notified:!1,parent:!1,reactions:new R6,rejection:!1,state:Qy,value:void 0})},js.prototype=O6(uc,"then",function(r,e){var t=sc(this),n=Zd(C6(this,Bn));return t.parent=!0,n.ok=Yd(r)?r:!0,n.fail=Yd(e)&&e,n.domain=ju?wv.domain:void 0,t.state===Qy?t.reactions.add(n):$v(function(){fE(n,t)}),n.promise}),em=function(){var i=new js,r=sc(i);this.promise=i,this.resolve=Fn(Qd,r),this.reject=Fn(Un,r)},oE.f=Zd=function(i){return i===Bn||i===H6?new em(i):F6(i)});S6({global:!0,constructor:!0,wrap:!0,forced:sE},{Promise:Bn});T6(Bn,Pl,!1,!0);I6(Pl);var U6=Ea,K6=kw,G6=Vo.CONSTRUCTOR,xl=G6||!K6(function(i){U6.all(i).then(void 0,function(){})}),q6=K,Y6=qe,X6=kt,J6=$r,Z6=_a,Q6=on,eH=xl;q6({target:"Promise",stat:!0,forced:eH},{all:function(r){var e=this,t=J6.f(e),n=t.resolve,a=t.reject,o=Z6(function(){var s=X6(e.resolve),u=[],l=0,h=1;Q6(r,function(d){var c=l++,f=!1;h++,Y6(s,e,d).then(function(v){f||(f=!0,u[c]=v,--h||n(u))},a)}),--h||n(u)});return o.error&&a(o.value),t.promise}});var tH=K,rH=Vo.CONSTRUCTOR,rm=Ea;rm&&rm.prototype;tH({target:"Promise",proto:!0,forced:rH,real:!0},{catch:function(i){return this.then(void 0,i)}});var iH=K,nH=qe,aH=kt,oH=$r,sH=_a,uH=on,lH=xl;iH({target:"Promise",stat:!0,forced:lH},{race:function(r){var e=this,t=oH.f(e),n=t.reject,a=sH(function(){var o=aH(e.resolve);uH(r,function(s){nH(o,e,s).then(t.resolve,n)})});return a.error&&n(a.value),t.promise}});var hH=K,cH=qe,dH=$r,fH=Vo.CONSTRUCTOR;hH({target:"Promise",stat:!0,forced:fH},{reject:function(r){var e=dH.f(this);return cH(e.reject,void 0,r),e.promise}});var vH=jt,pH=it,gH=$r,gE=function(i,r){if(vH(i),pH(r)&&r.constructor===i)return r;var e=gH.f(i),t=e.resolve;return t(r),e.promise},yH=K,mH=yt,bH=kk,$H=Ea,wH=Vo.CONSTRUCTOR,_H=gE,EH=mH("Promise"),SH=!wH;yH({target:"Promise",stat:!0,forced:bH},{resolve:function(r){return _H(SH&&this===EH?$H:this,r)}});var OH=K,TH=qe,IH=kt,kH=$r,PH=_a,xH=on,CH=xl;OH({target:"Promise",stat:!0,forced:CH},{allSettled:function(r){var e=this,t=kH.f(e),n=t.resolve,a=t.reject,o=PH(function(){var s=IH(e.resolve),u=[],l=0,h=1;xH(r,function(d){var c=l++,f=!1;h++,TH(s,e,d).then(function(v){f||(f=!0,u[c]={status:"fulfilled",value:v},--h||n(u))},function(v){f||(f=!0,u[c]={status:"rejected",reason:v},--h||n(u))})}),--h||n(u)});return o.error&&a(o.value),t.promise}});var AH=K,DH=qe,RH=kt,NH=yt,MH=$r,BH=_a,FH=on,jH=xl,im="No one promise resolved";AH({target:"Promise",stat:!0,forced:jH},{any:function(r){var e=this,t=NH("AggregateError"),n=MH.f(e),a=n.resolve,o=n.reject,s=BH(function(){var u=RH(e.resolve),l=[],h=0,d=1,c=!1;FH(r,function(f){var v=h++,p=!1;d++,DH(u,e,f).then(function(g){p||c||(c=!0,a(g))},function(g){p||c||(p=!0,l[v]=g,--d||o(new t(l,im)))})}),--d||o(new t(l,im))});return s.error&&o(s.value),n.promise}});var LH=K,ef=Ea,zH=ue,HH=yt,VH=Ie,WH=Y_,nm=gE,UH=ef&&ef.prototype,KH=!!ef&&zH(function(){UH.finally.call({then:function(){}},function(){})});LH({target:"Promise",proto:!0,real:!0,forced:KH},{finally:function(i){var r=WH(this,HH("Promise")),e=VH(i);return this.then(e?function(t){return nm(r,i()).then(function(){return t})}:i,e?function(t){return nm(r,i()).then(function(){throw t})}:i)}});var GH=we,qH=GH.Promise,YH=qH,XH=YH,JH=K,ZH=$r;JH({target:"Promise",stat:!0},{withResolvers:function(){var r=ZH.f(this);return{promise:r.promise,resolve:r.resolve,reject:r.reject}}});var QH=XH,e8=QH,t8=K,r8=$r,i8=_a;t8({target:"Promise",stat:!0,forced:!0},{try:function(i){var r=r8.f(this),e=i8(i);return(e.error?r.reject:r.resolve)(e.value),r.promise}});var n8=e8,a8=n8,o8=a8,s8=Hw,u8=s8,l8=u8,h8=l8,c8=h8;(function(i){var r=Fz.default,e=g0,t=iv,n=j_,a=H_,o=Vz,s=Nw,u=L_,l=o8,h=c8,d=Bw;function c(){i.exports=c=function(){return v},i.exports.__esModule=!0,i.exports.default=i.exports;var f,v={},p=Object.prototype,g=p.hasOwnProperty,y=e||function(F,P,A){F[P]=A.value},m=typeof t=="function"?t:{},b=m.iterator||"@@iterator",$=m.asyncIterator||"@@asyncIterator",O=m.toStringTag||"@@toStringTag";function _(F,P,A){return e(F,P,{value:A,enumerable:!0,configurable:!0,writable:!0}),F[P]}try{_({},"")}catch{_=function(A,U,Z){return A[U]=Z}}function C(F,P,A,U){var Z=P&&P.prototype instanceof le?P:le,J=n(Z.prototype),De=new Rt(U||[]);return y(J,"_invoke",{value:Be(F,A,De)}),J}function R(F,P,A){try{return{type:"normal",arg:F.call(P,A)}}catch(U){return{type:"throw",arg:U}}}v.wrap=C;var x="suspendedStart",B="suspendedYield",j="executing",X="completed",W={};function le(){}function Ee(){}function de(){}var At={};_(At,b,function(){return this});var lt=a,nt=lt&<(lt(st([])));nt&&nt!==p&&g.call(nt,b)&&(At=nt);var Dt=de.prototype=le.prototype=n(At);function at(F){var P;o(P=["next","throw","return"]).call(P,function(A){_(F,A,function(U){return this._invoke(A,U)})})}function me(F,P){function A(Z,J,De,ht){var mt=R(F[Z],F,J);if(mt.type!=="throw"){var _i=mt.arg,Vr=_i.value;return Vr&&r(Vr)=="object"&&g.call(Vr,"__await")?P.resolve(Vr.__await).then(function(Ei){A("next",Ei,De,ht)},function(Ei){A("throw",Ei,De,ht)}):P.resolve(Vr).then(function(Ei){_i.value=Ei,De(_i)},function(Ei){return A("throw",Ei,De,ht)})}ht(mt.arg)}var U;y(this,"_invoke",{value:function(J,De){function ht(){return new P(function(mt,_i){A(J,De,mt,_i)})}return U=U?U.then(ht,ht):ht()}})}function Be(F,P,A){var U=x;return function(Z,J){if(U===j)throw new Error("Generator is already running");if(U===X){if(Z==="throw")throw J;return{value:f,done:!0}}for(A.method=Z,A.arg=J;;){var De=A.delegate;if(De){var ht=Ae(De,A);if(ht){if(ht===W)continue;return ht}}if(A.method==="next")A.sent=A._sent=A.arg;else if(A.method==="throw"){if(U===x)throw U=X,A.arg;A.dispatchException(A.arg)}else A.method==="return"&&A.abrupt("return",A.arg);U=j;var mt=R(F,P,A);if(mt.type==="normal"){if(U=A.done?X:B,mt.arg===W)continue;return{value:mt.arg,done:A.done}}mt.type==="throw"&&(U=X,A.method="throw",A.arg=mt.arg)}}}function Ae(F,P){var A=P.method,U=F.iterator[A];if(U===f)return P.delegate=null,A==="throw"&&F.iterator.return&&(P.method="return",P.arg=f,Ae(F,P),P.method==="throw")||A!=="return"&&(P.method="throw",P.arg=new TypeError("The iterator does not provide a '"+A+"' method")),W;var Z=R(U,F.iterator,P.arg);if(Z.type==="throw")return P.method="throw",P.arg=Z.arg,P.delegate=null,W;var J=Z.arg;return J?J.done?(P[F.resultName]=J.value,P.next=F.nextLoc,P.method!=="return"&&(P.method="next",P.arg=f),P.delegate=null,W):J:(P.method="throw",P.arg=new TypeError("iterator result is not an object"),P.delegate=null,W)}function ot(F){var P,A={tryLoc:F[0]};1 in F&&(A.catchLoc=F[1]),2 in F&&(A.finallyLoc=F[2],A.afterLoc=F[3]),s(P=this.tryEntries).call(P,A)}function Er(F){var P=F.completion||{};P.type="normal",delete P.arg,F.completion=P}function Rt(F){this.tryEntries=[{tryLoc:"root"}],o(F).call(F,ot,this),this.reset(!0)}function st(F){if(F||F===""){var P=F[b];if(P)return P.call(F);if(typeof F.next=="function")return F;if(!isNaN(F.length)){var A=-1,U=function Z(){for(;++A=0;--Z){var J=this.tryEntries[Z],De=J.completion;if(J.tryLoc==="root")return U("end");if(J.tryLoc<=this.prev){var ht=g.call(J,"catchLoc"),mt=g.call(J,"finallyLoc");if(ht&&mt){if(this.prev=0;--U){var Z=this.tryEntries[U];if(Z.tryLoc<=this.prev&&g.call(Z,"finallyLoc")&&this.prev=0;--A){var U=this.tryEntries[A];if(U.finallyLoc===P)return this.complete(U.completion,U.afterLoc),Er(U),W}},catch:function(P){for(var A=this.tryEntries.length-1;A>=0;--A){var U=this.tryEntries[A];if(U.tryLoc===P){var Z=U.completion;if(Z.type==="throw"){var J=Z.arg;Er(U)}return J}}throw new Error("illegal catch attempt")},delegateYield:function(P,A,U){return this.delegate={iterator:st(P),resultName:A,nextLoc:U},this.method==="next"&&(this.arg=f),W}},v}i.exports=c,i.exports.__esModule=!0,i.exports.default=i.exports})(V_);var d8=V_.exports,vu=d8(),f8=vu;try{regeneratorRuntime=vu}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=vu:Function("r","regeneratorRuntime = r")(vu)}var $t=Y(f8),yE={exports:{}},v8=ue,p8=v8(function(){if(typeof ArrayBuffer=="function"){var i=new ArrayBuffer(8);Object.isExtensible(i)&&Object.defineProperty(i,"a",{value:8})}}),g8=ue,y8=it,m8=vi,am=p8,pu=Object.isExtensible,b8=g8(function(){pu(1)}),$8=b8||am?function(r){return!y8(r)||am&&m8(r)==="ArrayBuffer"?!1:pu?pu(r):!0}:pu,w8=ue,_8=!w8(function(){return Object.isExtensible(Object.preventExtensions({}))}),E8=K,S8=be,O8=Po,T8=it,Ev=He,I8=xt.f,om=xo,k8=Gf,Sv=$8,P8=nl,x8=_8,mE=!1,Br=P8("meta"),C8=0,Ov=function(i){I8(i,Br,{value:{objectID:"O"+C8++,weakData:{}}})},A8=function(i,r){if(!T8(i))return typeof i=="symbol"?i:(typeof i=="string"?"S":"P")+i;if(!Ev(i,Br)){if(!Sv(i))return"F";if(!r)return"E";Ov(i)}return i[Br].objectID},D8=function(i,r){if(!Ev(i,Br)){if(!Sv(i))return!0;if(!r)return!1;Ov(i)}return i[Br].weakData},R8=function(i){return x8&&mE&&Sv(i)&&!Ev(i,Br)&&Ov(i),i},N8=function(){M8.enable=function(){},mE=!0;var i=om.f,r=S8([].splice),e={};e[Br]=1,i(e).length&&(om.f=function(t){for(var n=i(t),a=0,o=n.length;a1?arguments[1]:void 0),f;f=f?f.next:d.first;)for(c(f.value,f.key,this);f&&f.removed;)f=f.previous},has:function(h){return!!u(this,h)}}),sm(a,e?{get:function(h){var d=u(this,h);return d&&d.value},set:function(h,d){return s(this,h===0?0:h,d)}}:{add:function(h){return s(this,h=h===0?0:h,h)}}),ja&&r7(a,"size",{configurable:!0,get:function(){return o(this).size}}),n},setStrong:function(i,r,e){var t=r+" Iterator",n=lc(r),a=lc(t);s7(i,r,function(o,s){lm(this,{type:t,target:o,state:n(o),kind:s,last:void 0})},function(){for(var o=a(this),s=o.kind,u=o.last;u&&u.removed;)u=u.previous;return!o.target||!(o.last=u=u?u.next:o.state.first)?(o.target=void 0,Ls(void 0,!0)):Ls(s==="keys"?u.key:s==="values"?u.value:[u.key,u.value],!1)},e?"entries":"values",!e,!0),u7(r)}},l7=wE,h7=EE;l7("Map",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},h7);var c7=we,d7=c7.Map,f7=d7,v7=f7,p7=v7,SE=Y(p7),g7=K,y7=ba.some,m7=_l,b7=m7("some");g7({target:"Array",proto:!0,forced:!b7},{some:function(r){return y7(this,r,arguments.length>1?arguments[1]:void 0)}});var $7=ut,w7=$7("Array","some"),_7=ze,E7=w7,hc=Array.prototype,S7=function(i){var r=i.some;return i===hc||_7(hc,i)&&r===hc.some?E7:r},O7=S7,T7=O7,I7=T7,k7=Y(I7),P7=ut,x7=P7("Array","keys"),C7=x7,A7=C7,D7=zr,R7=He,N7=ze,M7=A7,cc=Array.prototype,B7={DOMTokenList:!0,NodeList:!0},F7=function(i){var r=i.keys;return i===cc||N7(cc,i)&&r===cc.keys||R7(B7,D7(i))?M7:r},j7=F7,En=Y(j7),hm=k0,L7=Math.floor,tf=function(i,r){var e=i.length,t=L7(e/2);return e<8?z7(i,r):H7(i,tf(hm(i,0,t),r),tf(hm(i,t),r),r)},z7=function(i,r){for(var e=i.length,t=1,n,a;t0;)i[a]=i[--a];a!==t++&&(i[a]=n)}return i},H7=function(i,r,e,t){for(var n=r.length,a=e.length,o=0,s=0;o3)){if(rV)return!0;if(ym)return ym<603;var i="",r,e,t,n;for(r=65;r<76;r++){switch(e=String.fromCharCode(r),r){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(n=0;n<47;n++)Zr.push({k:e+n,v:t})}for(Zr.sort(function(a,o){return o.v-a.v}),n=0;nvm(e)?1:-1}};X7({target:"Array",proto:!0,forced:sV},{sort:function(r){r!==void 0&&J7(r);var e=Z7(this);if(TE)return r===void 0?mm(e):mm(e,r);var t=[],n=fm(e),a,o;for(o=0;othis.max&&this.flush(),this._timeout!=null&&(clearTimeout(this._timeout),this._timeout=null),this.queue.length>0&&typeof this.delay=="number"&&(this._timeout=bL(function(){e.flush()},this.delay))}},{key:"flush",value:function(){var e,t;Wi(e=Ww(t=this._queue).call(t,0)).call(e,function(n){n.fn.apply(n.context||n.fn,n.args||[])})}}],[{key:"extend",value:function(e,t){var n=new i(t);if(e.flush!==void 0)throw new Error("Target object already has a property flush");e.flush=function(){n.flush()};var a=[{name:"flush",original:void 0}];if(t&&t.replace)for(var o=0;o=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function cW(i,r){var e;if(i){if(typeof i=="string")return _m(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _m(i,r)}}function _m(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);es&&(s=d,o=h)}return o}},{key:"min",value:function(t){var n=gc(this._pairs),a=n.next();if(a.done)return null;for(var o=a.value[1],s=t(a.value[1],a.value[0]);!(a=n.next()).done;){var u=bt(a.value,2),l=u[0],h=u[1],d=t(h,l);d=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function dW(i,r){var e;if(i){if(typeof i=="string")return Tm(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Tm(i,r)}}function Tm(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e"u"||!du||du.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(du(Boolean,[],function(){})),!0}catch{return!1}}function pW(i,r){return i[r]==null&&(i[r]=UV()),i}var Lu=function(i){Az(e,i);var r=fW(e);function e(t,n){var a;return tl(this,e),a=r.call(this),ni(F_(a),"_queue",null),t&&!Bt(t)&&(n=t,t=[]),a._options=n||{},a._data=new SE,a.length=0,a._idProp=a._options.fieldId||"id",t&&t.length&&a.add(t),a.setOptions(n),a}return wl(e,[{key:"idProp",get:function(){return this._idProp}},{key:"setOptions",value:function(n){n&&n.queue!==void 0&&(n.queue===!1?this._queue&&(this._queue.destroy(),this._queue=null):(this._queue||(this._queue=KV.extend(this,{replace:["add","update","remove"]})),n.queue&&typeof n.queue=="object"&&this._queue.setOptions(n.queue)))}},{key:"add",value:function(n,a){var o=this,s=[],u;if(Bt(n)){var l=rr(n).call(n,function(c){return c[o._idProp]});if(k7(l).call(l,function(c){return o._data.has(c)}))throw new Error("A duplicate id was found in the parameter array.");for(var h=0,d=n.length;hh?1:ls)&&(o=h,s=d)}}catch(c){u.e(c)}finally{u.f()}return o||null}},{key:"min",value:function(n){var a,o=null,s=null,u=yc(bm(a=this._data).call(a)),l;try{for(u.s();!(l=u.n()).done;){var h=l.value,d=h[n];typeof d=="number"&&(s==null||d\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=window.console&&(window.console.warn||window.console.log);return o&&o.call(window.console,t,a),i.apply(this,arguments)}}var w_=$_(function(i,r,e){for(var t=Object.keys(r),n=0;n=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function l5(i,r){var e;if(i){if(typeof i=="string")return Ey(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ey(i,r)}}function Ey(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?e-1:0),n=1;n2){var t;return Nu.apply(void 0,Ol(t=[S_(r[0],r[1])]).call(t,St(Tl(r).call(r,2))))}var n=r[0],a=r[1];if(n instanceof Date&&a instanceof Date)return n.setTime(a.getTime()),n;var o=__(hj(a)),s;try{for(o.s();!(s=o.n()).done;){var u=s.value;Object.prototype.propertyIsEnumerable.call(a,u)&&(a[u]===E_?delete n[u]:n[u]!==null&&a[u]!==null&&typeof n[u]=="object"&&typeof a[u]=="object"&&!Bt(n[u])&&!Bt(a[u])?n[u]=Nu(n[u],a[u]):n[u]=O_(a[u]))}}catch(l){o.e(l)}finally{o.f()}return n}function O_(i){return Bt(i)?rr(i).call(i,function(r){return O_(r)}):typeof i=="object"&&i!==null?i instanceof Date?new Date(i.getTime()):Nu({},i):i}function T_(i){for(var r=0,e=lv(i);ro;)u=t(e,s=n[o++]),u!==void 0&&Y5(a,s,u);return a}});var X5=we,J5=X5.Object.getOwnPropertyDescriptors,Z5=J5,Q5=Z5,ez=Q5,ky=Y(ez),M_={exports:{}},tz=K,rz=qe,Py=cl.f;tz({target:"Object",stat:!0,forced:Object.defineProperties!==Py,sham:!rz},{defineProperties:Py});var iz=we,B_=iz.Object,nz=M_.exports=function(r,e){return B_.defineProperties(r,e)};B_.defineProperties.sham&&(nz.sham=!0);var az=M_.exports,oz=az,sz=oz,uz=sz,lz=Y(uz),hz=p0,cz=Y(hz);function F_(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}var dz=Kw,fz=dz,vz=fz,pz=vz,j_=pz,gz=Y(j_),yz=K,mz=aw;yz({target:"Object",stat:!0},{setPrototypeOf:mz});var bz=we,$z=bz.Object.setPrototypeOf,wz=$z,_z=wz,Ez=_z,Sz=Ez,Oz=Sz,Tz=Oz,L_=Tz,Vd=Y(L_),Iz=ww,kz=Iz,Pz=kz,xz=Pz,Cz=xz,z_=Y(Cz);function Wd(i,r){var e;return Wd=Vd?z_(e=Vd).call(e):function(n,a){return n.__proto__=a,n},Wd(i,r)}function Az(i,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=gz(r.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),ol(i,"prototype",{writable:!1}),Wd(i,r)}function Dz(i,r){if(r&&(Jn(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F_(i)}var Rz=L3,Nz=Rz,Mz=Nz,Bz=Mz,H_=Bz,xy=Y(H_);function Mu(i){var r;return Mu=Vd?z_(r=xy).call(r):function(t){return t.__proto__||xy(t)},Mu(i)}var V_={exports:{}},W_={exports:{}};(function(i){var r=iv,e=gw;function t(n){"@babel/helpers - typeof";return i.exports=t=typeof r=="function"&&typeof e=="symbol"?function(a){return typeof a}:function(a){return a&&typeof r=="function"&&a.constructor===r&&a!==r.prototype?"symbol":typeof a},i.exports.__esModule=!0,i.exports.default=i.exports,t(n)}i.exports=t,i.exports.__esModule=!0,i.exports.default=i.exports})(W_);var Fz=W_.exports,jz=zw,Lz=jz,zz=Lz,Hz=zz,Vz=Hz,Cy=Ve,Wz=uv,Uz=Qi,Kz=Ct,Gz=function(i,r,e){for(var t=Wz(r),n=Kz.f,a=Uz.f,o=0;oc;c++)if(f=y(i[c]),f&&Dy(Ny,f))return f;return new fu(!1)}l=p4(i,h)}for(v=a?i.next:l.next;!(p=h4(v,l)).done;){try{f=y(p.value)}catch(m){Ry(l,"throw",m)}if(typeof f=="object"&&f&&Dy(Ny,f))return f}return new fu(!1)},m4=tn,b4=function(i,r){return i===void 0?arguments.length<2?"":r:m4(i)},$4=K,w4=He,_4=$l,Bu=aw,E4=Gz,G_=rn,qh=Lr,Yh=en,S4=Xz,O4=u4,T4=on,I4=b4,k4=Ee,P4=k4("toStringTag"),Fu=Error,x4=[].push,ta=function(r,e){var t=w4(Xh,this),n;Bu?n=Bu(new Fu,t?_4(this):Xh):(n=t?this:G_(Xh),qh(n,P4,"Error")),e!==void 0&&qh(n,"message",I4(e)),O4(n,ta,n.stack,1),arguments.length>2&&S4(n,arguments[2]);var a=[];return T4(r,x4,{that:a}),qh(n,"errors",a),n};Bu?Bu(ta,Fu):E4(ta,Fu,{name:!0});var Xh=ta.prototype=G_(Fu.prototype,{constructor:Yh(1,ta),message:Yh(1,""),name:Yh(1,"AggregateError")});$4({global:!0,constructor:!0,arity:2},{AggregateError:ta});var C4=mt,A4=qf,D4=Ee,R4=qe,My=D4("species"),q_=function(i){var r=C4(i);R4&&r&&!r[My]&&A4(r,My,{configurable:!0,get:function(){return this}})},N4=He,M4=TypeError,mv=function(i,r){if(N4(r,i))return i;throw new M4("Incorrect invocation")},By=jt,B4=I_,F4=ca,j4=Ee,L4=j4("species"),Y_=function(i,r){var e=By(i).constructor,t;return e===void 0||F4(t=By(e)[L4])?r:B4(t)},z4=mi,X_=/(?:ipad|iphone|ipod).*applewebkit/i.test(z4),Ft=$e,H4=ha,V4=bi,Fy=Ie,W4=Ve,J_=le,jy=O0,U4=No,Ly=Vf,K4=Gw,G4=X_,q4=Bo,Ud=Ft.setImmediate,Kd=Ft.clearImmediate,Y4=Ft.process,Jh=Ft.Dispatch,X4=Ft.Function,zy=Ft.MessageChannel,J4=Ft.String,Zh=0,Za={},Hy="onreadystatechange",go,ki,Qh,ec;J_(function(){go=Ft.location});var bv=function(i){if(W4(Za,i)){var r=Za[i];delete Za[i],r()}},tc=function(i){return function(){bv(i)}},Vy=function(i){bv(i.data)},Wy=function(i){Ft.postMessage(J4(i),go.protocol+"//"+go.host)};(!Ud||!Kd)&&(Ud=function(r){K4(arguments.length,1);var e=Fy(r)?r:X4(r),t=U4(arguments,1);return Za[++Zh]=function(){H4(e,void 0,t)},ki(Zh),Zh},Kd=function(r){delete Za[r]},q4?ki=function(i){Y4.nextTick(tc(i))}:Jh&&Jh.now?ki=function(i){Jh.now(tc(i))}:zy&&!G4?(Qh=new zy,ec=Qh.port2,Qh.port1.onmessage=Vy,ki=V4(ec.postMessage,ec)):Ft.addEventListener&&Fy(Ft.postMessage)&&!Ft.importScripts&&go&&go.protocol!=="file:"&&!J_(Wy)?(ki=Wy,Ft.addEventListener("message",Vy,!1)):Hy in Ly("script")?ki=function(i){jy.appendChild(Ly("script"))[Hy]=function(){jy.removeChild(this),bv(i)}}:ki=function(i){setTimeout(tc(i),0)});var Z_={set:Ud,clear:Kd},Q_=function(){this.head=null,this.tail=null};Q_.prototype={add:function(i){var r={item:i,next:null},e=this.tail;e?e.next=r:this.head=r,this.tail=r},get:function(){var i=this.head;if(i){var r=this.head=i.next;return r===null&&(this.tail=null),i.item}}};var eE=Q_,Z4=mi,Q4=/ipad|iphone|ipod/i.test(Z4)&&typeof Pebble<"u",e6=mi,t6=/web0s(?!.*chrome)/i.test(e6),qi=$e,Uy=bi,r6=Qi.f,rc=Z_.set,i6=eE,n6=X_,a6=Q4,o6=t6,ic=Bo,Ky=qi.MutationObserver||qi.WebKitMutationObserver,Gy=qi.document,qy=qi.process,Ns=qi.Promise,Yy=r6(qi,"queueMicrotask"),Gd=Yy&&Yy.value,_n,nc,ac,Ms,Xy;if(!Gd){var Bs=new i6,Fs=function(){var i,r;for(ic&&(i=qy.domain)&&i.exit();r=Bs.get();)try{r()}catch(e){throw Bs.head&&_n(),e}i&&i.enter()};!n6&&!ic&&!o6&&Ky&&Gy?(nc=!0,ac=Gy.createTextNode(""),new Ky(Fs).observe(ac,{characterData:!0}),_n=function(){ac.data=nc=!nc}):!a6&&Ns&&Ns.resolve?(Ms=Ns.resolve(void 0),Ms.constructor=Ns,Xy=Uy(Ms.then,Ms),_n=function(){Xy(Fs)}):ic?_n=function(){qy.nextTick(Fs)}:(rc=Uy(rc,qi),_n=function(){rc(Fs)}),Gd=function(i){Bs.head||_n(),Bs.add(i)}}var s6=Gd,u6=function(i,r){try{arguments.length===1?console.error(i):console.error(i,r)}catch{}},_a=function(i){try{return{error:!1,value:i()}}catch(r){return{error:!0,value:r}}},l6=$e,Ea=l6.Promise,tE=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",h6=tE,c6=Bo,d6=!h6&&!c6&&typeof window=="object"&&typeof document=="object",f6=$e,Qa=Ea,v6=Ie,p6=d0,g6=m0,y6=Ee,m6=d6,b6=tE,oc=da,Jy=Qa&&Qa.prototype,$6=y6("species"),qd=!1,rE=v6(f6.PromiseRejectionEvent),w6=p6("Promise",function(){var i=g6(Qa),r=i!==String(Qa);if(!r&&oc===66||!(Jy.catch&&Jy.finally))return!0;if(!oc||oc<51||!/native code/.test(i)){var e=new Qa(function(a){a(1)}),t=function(a){a(function(){},function(){})},n=e.constructor={};if(n[$6]=t,qd=e.then(function(){})instanceof t,!qd)return!0}return!r&&(m6||b6)&&!rE}),Vo={CONSTRUCTOR:w6,REJECTION_EVENT:rE,SUBCLASSING:qd},wr={},Zy=Pt,_6=TypeError,E6=function(i){var r,e;this.promise=new i(function(t,n){if(r!==void 0||e!==void 0)throw new _6("Bad Promise constructor");r=t,e=n}),this.resolve=Zy(r),this.reject=Zy(e)};wr.f=function(i){return new E6(i)};var S6=K,ju=Bo,fi=$e,Wo=Ye,O6=ya,T6=nn,I6=q_,k6=Pt,Yd=Ie,P6=nt,x6=mv,C6=Y_,iE=Z_.set,$v=s6,A6=u6,D6=_a,R6=eE,nE=ma,Xd=Ea,aE=Vo,oE=wr,Pl="Promise",sE=aE.CONSTRUCTOR,N6=aE.REJECTION_EVENT,sc=nE.getterFor(Pl),M6=nE.set,B6=Xd&&Xd.prototype,Bn=Xd,uc=B6,uE=fi.TypeError,Jd=fi.document,wv=fi.process,Zd=oE.f,F6=Zd,j6=!!(Jd&&Jd.createEvent&&fi.dispatchEvent),lE="unhandledrejection",L6="rejectionhandled",Qy=0,hE=1,z6=2,_v=1,cE=2,js,em,H6,dE=function(i){var r;return P6(i)&&Yd(r=i.then)?r:!1},fE=function(i,r){var e=r.value,t=r.state===hE,n=t?i.ok:i.fail,a=i.resolve,o=i.reject,s=i.domain,u,l,h;try{n?(t||(r.rejection===cE&&W6(r),r.rejection=_v),n===!0?u=e:(s&&s.enter(),u=n(e),s&&(s.exit(),h=!0)),u===i.promise?o(new uE("Promise-chain cycle")):(l=dE(u))?Wo(l,u,a,o):a(u)):o(e)}catch(c){s&&!h&&s.exit(),o(c)}},vE=function(i,r){i.notified||(i.notified=!0,$v(function(){for(var e=i.reactions,t;t=e.get();)fE(t,i);i.notified=!1,r&&!i.rejection&&V6(i)}))},pE=function(i,r,e){var t,n;j6?(t=Jd.createEvent("Event"),t.promise=r,t.reason=e,t.initEvent(i,!1,!0),fi.dispatchEvent(t)):t={promise:r,reason:e},!N6&&(n=fi["on"+i])?n(t):i===lE&&A6("Unhandled promise rejection",e)},V6=function(i){Wo(iE,fi,function(){var r=i.facade,e=i.value,t=tm(i),n;if(t&&(n=D6(function(){ju?wv.emit("unhandledRejection",e,r):pE(lE,r,e)}),i.rejection=ju||tm(i)?cE:_v,n.error))throw n.value})},tm=function(i){return i.rejection!==_v&&!i.parent},W6=function(i){Wo(iE,fi,function(){var r=i.facade;ju?wv.emit("rejectionHandled",r):pE(L6,r,i.value)})},Fn=function(i,r,e){return function(t){i(r,t,e)}},Un=function(i,r,e){i.done||(i.done=!0,e&&(i=e),i.value=r,i.state=z6,vE(i,!0))},Qd=function(i,r,e){if(!i.done){i.done=!0,e&&(i=e);try{if(i.facade===r)throw new uE("Promise can't be resolved itself");var t=dE(r);t?$v(function(){var n={done:!1};try{Wo(t,r,Fn(Qd,n,i),Fn(Un,n,i))}catch(a){Un(n,a,i)}}):(i.value=r,i.state=hE,vE(i,!1))}catch(n){Un({done:!1},n,i)}}};sE&&(Bn=function(r){x6(this,uc),k6(r),Wo(js,this);var e=sc(this);try{r(Fn(Qd,e),Fn(Un,e))}catch(t){Un(e,t)}},uc=Bn.prototype,js=function(r){M6(this,{type:Pl,done:!1,notified:!1,parent:!1,reactions:new R6,rejection:!1,state:Qy,value:void 0})},js.prototype=O6(uc,"then",function(r,e){var t=sc(this),n=Zd(C6(this,Bn));return t.parent=!0,n.ok=Yd(r)?r:!0,n.fail=Yd(e)&&e,n.domain=ju?wv.domain:void 0,t.state===Qy?t.reactions.add(n):$v(function(){fE(n,t)}),n.promise}),em=function(){var i=new js,r=sc(i);this.promise=i,this.resolve=Fn(Qd,r),this.reject=Fn(Un,r)},oE.f=Zd=function(i){return i===Bn||i===H6?new em(i):F6(i)});S6({global:!0,constructor:!0,wrap:!0,forced:sE},{Promise:Bn});T6(Bn,Pl,!1,!0);I6(Pl);var U6=Ea,K6=kw,G6=Vo.CONSTRUCTOR,xl=G6||!K6(function(i){U6.all(i).then(void 0,function(){})}),q6=K,Y6=Ye,X6=Pt,J6=wr,Z6=_a,Q6=on,eH=xl;q6({target:"Promise",stat:!0,forced:eH},{all:function(r){var e=this,t=J6.f(e),n=t.resolve,a=t.reject,o=Z6(function(){var s=X6(e.resolve),u=[],l=0,h=1;Q6(r,function(c){var d=l++,f=!1;h++,Y6(s,e,c).then(function(v){f||(f=!0,u[d]=v,--h||n(u))},a)}),--h||n(u)});return o.error&&a(o.value),t.promise}});var tH=K,rH=Vo.CONSTRUCTOR,rm=Ea;rm&&rm.prototype;tH({target:"Promise",proto:!0,forced:rH,real:!0},{catch:function(i){return this.then(void 0,i)}});var iH=K,nH=Ye,aH=Pt,oH=wr,sH=_a,uH=on,lH=xl;iH({target:"Promise",stat:!0,forced:lH},{race:function(r){var e=this,t=oH.f(e),n=t.reject,a=sH(function(){var o=aH(e.resolve);uH(r,function(s){nH(o,e,s).then(t.resolve,n)})});return a.error&&n(a.value),t.promise}});var hH=K,cH=Ye,dH=wr,fH=Vo.CONSTRUCTOR;hH({target:"Promise",stat:!0,forced:fH},{reject:function(r){var e=dH.f(this);return cH(e.reject,void 0,r),e.promise}});var vH=jt,pH=nt,gH=wr,gE=function(i,r){if(vH(i),pH(r)&&r.constructor===i)return r;var e=gH.f(i),t=e.resolve;return t(r),e.promise},yH=K,mH=mt,bH=kk,$H=Ea,wH=Vo.CONSTRUCTOR,_H=gE,EH=mH("Promise"),SH=!wH;yH({target:"Promise",stat:!0,forced:bH},{resolve:function(r){return _H(SH&&this===EH?$H:this,r)}});var OH=K,TH=Ye,IH=Pt,kH=wr,PH=_a,xH=on,CH=xl;OH({target:"Promise",stat:!0,forced:CH},{allSettled:function(r){var e=this,t=kH.f(e),n=t.resolve,a=t.reject,o=PH(function(){var s=IH(e.resolve),u=[],l=0,h=1;xH(r,function(c){var d=l++,f=!1;h++,TH(s,e,c).then(function(v){f||(f=!0,u[d]={status:"fulfilled",value:v},--h||n(u))},function(v){f||(f=!0,u[d]={status:"rejected",reason:v},--h||n(u))})}),--h||n(u)});return o.error&&a(o.value),t.promise}});var AH=K,DH=Ye,RH=Pt,NH=mt,MH=wr,BH=_a,FH=on,jH=xl,im="No one promise resolved";AH({target:"Promise",stat:!0,forced:jH},{any:function(r){var e=this,t=NH("AggregateError"),n=MH.f(e),a=n.resolve,o=n.reject,s=BH(function(){var u=RH(e.resolve),l=[],h=0,c=1,d=!1;FH(r,function(f){var v=h++,p=!1;c++,DH(u,e,f).then(function(g){p||d||(d=!0,a(g))},function(g){p||d||(p=!0,l[v]=g,--c||o(new t(l,im)))})}),--c||o(new t(l,im))});return s.error&&o(s.value),n.promise}});var LH=K,ef=Ea,zH=le,HH=mt,VH=Ie,WH=Y_,nm=gE,UH=ef&&ef.prototype,KH=!!ef&&zH(function(){UH.finally.call({then:function(){}},function(){})});LH({target:"Promise",proto:!0,real:!0,forced:KH},{finally:function(i){var r=WH(this,HH("Promise")),e=VH(i);return this.then(e?function(t){return nm(r,i()).then(function(){return t})}:i,e?function(t){return nm(r,i()).then(function(){throw t})}:i)}});var GH=we,qH=GH.Promise,YH=qH,XH=YH,JH=K,ZH=wr;JH({target:"Promise",stat:!0},{withResolvers:function(){var r=ZH.f(this);return{promise:r.promise,resolve:r.resolve,reject:r.reject}}});var QH=XH,e8=QH,t8=K,r8=wr,i8=_a;t8({target:"Promise",stat:!0,forced:!0},{try:function(i){var r=r8.f(this),e=i8(i);return(e.error?r.reject:r.resolve)(e.value),r.promise}});var n8=e8,a8=n8,o8=a8,s8=Hw,u8=s8,l8=u8,h8=l8,c8=h8;(function(i){var r=Fz.default,e=g0,t=iv,n=j_,a=H_,o=Vz,s=Nw,u=L_,l=o8,h=c8,c=Bw;function d(){i.exports=d=function(){return v},i.exports.__esModule=!0,i.exports.default=i.exports;var f,v={},p=Object.prototype,g=p.hasOwnProperty,y=e||function(F,x,C){F[x]=C.value},m=typeof t=="function"?t:{},$=m.iterator||"@@iterator",b=m.asyncIterator||"@@asyncIterator",O=m.toStringTag||"@@toStringTag";function _(F,x,C){return e(F,x,{value:C,enumerable:!0,configurable:!0,writable:!0}),F[x]}try{_({},"")}catch{_=function(C,W,Z){return C[W]=Z}}function D(F,x,C,W){var Z=x&&x.prototype instanceof ie?x:ie,X=n(Z.prototype),Re=new Rt(W||[]);return y(X,"_invoke",{value:Fe(F,C,Re)}),X}function R(F,x,C){try{return{type:"normal",arg:F.call(x,C)}}catch(W){return{type:"throw",arg:W}}}v.wrap=D;var P="suspendedStart",B="suspendedYield",j="executing",J="completed",U={};function ie(){}function _e(){}function ye(){}var Ae={};_(Ae,$,function(){return this});var ht=a,at=ht&&ht(ht(ut([])));at&&at!==p&&g.call(at,$)&&(Ae=at);var Dt=ye.prototype=ie.prototype=n(Ae);function ot(F){var x;o(x=["next","throw","return"]).call(x,function(C){_(F,C,function(W){return this._invoke(C,W)})})}function me(F,x){function C(Z,X,Re,ct){var bt=R(F[Z],F,X);if(bt.type!=="throw"){var Oi=bt.arg,Vr=Oi.value;return Vr&&r(Vr)=="object"&&g.call(Vr,"__await")?x.resolve(Vr.__await).then(function(Ti){C("next",Ti,Re,ct)},function(Ti){C("throw",Ti,Re,ct)}):x.resolve(Vr).then(function(Ti){Oi.value=Ti,Re(Oi)},function(Ti){return C("throw",Ti,Re,ct)})}ct(bt.arg)}var W;y(this,"_invoke",{value:function(X,Re){function ct(){return new x(function(bt,Oi){C(X,Re,bt,Oi)})}return W=W?W.then(ct,ct):ct()}})}function Fe(F,x,C){var W=P;return function(Z,X){if(W===j)throw new Error("Generator is already running");if(W===J){if(Z==="throw")throw X;return{value:f,done:!0}}for(C.method=Z,C.arg=X;;){var Re=C.delegate;if(Re){var ct=De(Re,C);if(ct){if(ct===U)continue;return ct}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(W===P)throw W=J,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);W=j;var bt=R(F,x,C);if(bt.type==="normal"){if(W=C.done?J:B,bt.arg===U)continue;return{value:bt.arg,done:C.done}}bt.type==="throw"&&(W=J,C.method="throw",C.arg=bt.arg)}}}function De(F,x){var C=x.method,W=F.iterator[C];if(W===f)return x.delegate=null,C==="throw"&&F.iterator.return&&(x.method="return",x.arg=f,De(F,x),x.method==="throw")||C!=="return"&&(x.method="throw",x.arg=new TypeError("The iterator does not provide a '"+C+"' method")),U;var Z=R(W,F.iterator,x.arg);if(Z.type==="throw")return x.method="throw",x.arg=Z.arg,x.delegate=null,U;var X=Z.arg;return X?X.done?(x[F.resultName]=X.value,x.next=F.nextLoc,x.method!=="return"&&(x.method="next",x.arg=f),x.delegate=null,U):X:(x.method="throw",x.arg=new TypeError("iterator result is not an object"),x.delegate=null,U)}function st(F){var x,C={tryLoc:F[0]};1 in F&&(C.catchLoc=F[1]),2 in F&&(C.finallyLoc=F[2],C.afterLoc=F[3]),s(x=this.tryEntries).call(x,C)}function Sr(F){var x=F.completion||{};x.type="normal",delete x.arg,F.completion=x}function Rt(F){this.tryEntries=[{tryLoc:"root"}],o(F).call(F,st,this),this.reset(!0)}function ut(F){if(F||F===""){var x=F[$];if(x)return x.call(F);if(typeof F.next=="function")return F;if(!isNaN(F.length)){var C=-1,W=function Z(){for(;++C=0;--Z){var X=this.tryEntries[Z],Re=X.completion;if(X.tryLoc==="root")return W("end");if(X.tryLoc<=this.prev){var ct=g.call(X,"catchLoc"),bt=g.call(X,"finallyLoc");if(ct&&bt){if(this.prev=0;--W){var Z=this.tryEntries[W];if(Z.tryLoc<=this.prev&&g.call(Z,"finallyLoc")&&this.prev=0;--C){var W=this.tryEntries[C];if(W.finallyLoc===x)return this.complete(W.completion,W.afterLoc),Sr(W),U}},catch:function(x){for(var C=this.tryEntries.length-1;C>=0;--C){var W=this.tryEntries[C];if(W.tryLoc===x){var Z=W.completion;if(Z.type==="throw"){var X=Z.arg;Sr(W)}return X}}throw new Error("illegal catch attempt")},delegateYield:function(x,C,W){return this.delegate={iterator:ut(x),resultName:C,nextLoc:W},this.method==="next"&&(this.arg=f),U}},v}i.exports=d,i.exports.__esModule=!0,i.exports.default=i.exports})(V_);var d8=V_.exports,vu=d8(),f8=vu;try{regeneratorRuntime=vu}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=vu:Function("r","regeneratorRuntime = r")(vu)}var wt=Y(f8),yE={exports:{}},v8=le,p8=v8(function(){if(typeof ArrayBuffer=="function"){var i=new ArrayBuffer(8);Object.isExtensible(i)&&Object.defineProperty(i,"a",{value:8})}}),g8=le,y8=nt,m8=yi,am=p8,pu=Object.isExtensible,b8=g8(function(){pu(1)}),$8=b8||am?function(r){return!y8(r)||am&&m8(r)==="ArrayBuffer"?!1:pu?pu(r):!0}:pu,w8=le,_8=!w8(function(){return Object.isExtensible(Object.preventExtensions({}))}),E8=K,S8=be,O8=Po,T8=nt,Ev=Ve,I8=Ct.f,om=xo,k8=Gf,Sv=$8,P8=nl,x8=_8,mE=!1,Br=P8("meta"),C8=0,Ov=function(i){I8(i,Br,{value:{objectID:"O"+C8++,weakData:{}}})},A8=function(i,r){if(!T8(i))return typeof i=="symbol"?i:(typeof i=="string"?"S":"P")+i;if(!Ev(i,Br)){if(!Sv(i))return"F";if(!r)return"E";Ov(i)}return i[Br].objectID},D8=function(i,r){if(!Ev(i,Br)){if(!Sv(i))return!0;if(!r)return!1;Ov(i)}return i[Br].weakData},R8=function(i){return x8&&mE&&Sv(i)&&!Ev(i,Br)&&Ov(i),i},N8=function(){M8.enable=function(){},mE=!0;var i=om.f,r=S8([].splice),e={};e[Br]=1,i(e).length&&(om.f=function(t){for(var n=i(t),a=0,o=n.length;a1?arguments[1]:void 0),f;f=f?f.next:c.first;)for(d(f.value,f.key,this);f&&f.removed;)f=f.previous},has:function(h){return!!u(this,h)}}),sm(a,e?{get:function(h){var c=u(this,h);return c&&c.value},set:function(h,c){return s(this,h===0?0:h,c)}}:{add:function(h){return s(this,h=h===0?0:h,h)}}),ja&&r7(a,"size",{configurable:!0,get:function(){return o(this).size}}),n},setStrong:function(i,r,e){var t=r+" Iterator",n=lc(r),a=lc(t);s7(i,r,function(o,s){lm(this,{type:t,target:o,state:n(o),kind:s,last:void 0})},function(){for(var o=a(this),s=o.kind,u=o.last;u&&u.removed;)u=u.previous;return!o.target||!(o.last=u=u?u.next:o.state.first)?(o.target=void 0,Ls(void 0,!0)):Ls(s==="keys"?u.key:s==="values"?u.value:[u.key,u.value],!1)},e?"entries":"values",!e,!0),u7(r)}},l7=wE,h7=EE;l7("Map",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},h7);var c7=we,d7=c7.Map,f7=d7,v7=f7,p7=v7,SE=Y(p7),g7=K,y7=ba.some,m7=_l,b7=m7("some");g7({target:"Array",proto:!0,forced:!b7},{some:function(r){return y7(this,r,arguments.length>1?arguments[1]:void 0)}});var $7=lt,w7=$7("Array","some"),_7=He,E7=w7,hc=Array.prototype,S7=function(i){var r=i.some;return i===hc||_7(hc,i)&&r===hc.some?E7:r},O7=S7,T7=O7,I7=T7,k7=Y(I7),P7=lt,x7=P7("Array","keys"),C7=x7,A7=C7,D7=zr,R7=Ve,N7=He,M7=A7,cc=Array.prototype,B7={DOMTokenList:!0,NodeList:!0},F7=function(i){var r=i.keys;return i===cc||N7(cc,i)&&r===cc.keys||R7(B7,D7(i))?M7:r},j7=F7,En=Y(j7),hm=k0,L7=Math.floor,tf=function(i,r){var e=i.length,t=L7(e/2);return e<8?z7(i,r):H7(i,tf(hm(i,0,t),r),tf(hm(i,t),r),r)},z7=function(i,r){for(var e=i.length,t=1,n,a;t0;)i[a]=i[--a];a!==t++&&(i[a]=n)}return i},H7=function(i,r,e,t){for(var n=r.length,a=e.length,o=0,s=0;o3)){if(rV)return!0;if(ym)return ym<603;var i="",r,e,t,n;for(r=65;r<76;r++){switch(e=String.fromCharCode(r),r){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(n=0;n<47;n++)ti.push({k:e+n,v:t})}for(ti.sort(function(a,o){return o.v-a.v}),n=0;nvm(e)?1:-1}};X7({target:"Array",proto:!0,forced:sV},{sort:function(r){r!==void 0&&J7(r);var e=Z7(this);if(TE)return r===void 0?mm(e):mm(e,r);var t=[],n=fm(e),a,o;for(o=0;othis.max&&this.flush(),this._timeout!=null&&(clearTimeout(this._timeout),this._timeout=null),this.queue.length>0&&typeof this.delay=="number"&&(this._timeout=bL(function(){e.flush()},this.delay))}},{key:"flush",value:function(){var e,t;Wi(e=Ww(t=this._queue).call(t,0)).call(e,function(n){n.fn.apply(n.context||n.fn,n.args||[])})}}],[{key:"extend",value:function(e,t){var n=new i(t);if(e.flush!==void 0)throw new Error("Target object already has a property flush");e.flush=function(){n.flush()};var a=[{name:"flush",original:void 0}];if(t&&t.replace)for(var o=0;o=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function cW(i,r){var e;if(i){if(typeof i=="string")return _m(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _m(i,r)}}function _m(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);es&&(s=c,o=h)}return o}},{key:"min",value:function(t){var n=gc(this._pairs),a=n.next();if(a.done)return null;for(var o=a.value[1],s=t(a.value[1],a.value[0]);!(a=n.next()).done;){var u=$t(a.value,2),l=u[0],h=u[1],c=t(h,l);c=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function dW(i,r){var e;if(i){if(typeof i=="string")return Tm(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Tm(i,r)}}function Tm(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e"u"||!du||du.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(du(Boolean,[],function(){})),!0}catch{return!1}}function pW(i,r){return i[r]==null&&(i[r]=UV()),i}var Lu=function(i){Az(e,i);var r=fW(e);function e(t,n){var a;return tl(this,e),a=r.call(this),si(F_(a),"_queue",null),t&&!Bt(t)&&(n=t,t=[]),a._options=n||{},a._data=new SE,a.length=0,a._idProp=a._options.fieldId||"id",t&&t.length&&a.add(t),a.setOptions(n),a}return wl(e,[{key:"idProp",get:function(){return this._idProp}},{key:"setOptions",value:function(n){n&&n.queue!==void 0&&(n.queue===!1?this._queue&&(this._queue.destroy(),this._queue=null):(this._queue||(this._queue=KV.extend(this,{replace:["add","update","remove"]})),n.queue&&typeof n.queue=="object"&&this._queue.setOptions(n.queue)))}},{key:"add",value:function(n,a){var o=this,s=[],u;if(Bt(n)){var l=rr(n).call(n,function(d){return d[o._idProp]});if(k7(l).call(l,function(d){return o._data.has(d)}))throw new Error("A duplicate id was found in the parameter array.");for(var h=0,c=n.length;hh?1:ls)&&(o=h,s=c)}}catch(d){u.e(d)}finally{u.f()}return o||null}},{key:"min",value:function(n){var a,o=null,s=null,u=yc(bm(a=this._data).call(a)),l;try{for(u.s();!(l=u.n()).done;){var h=l.value,c=h[n];typeof c=="number"&&(s==null||c"u"&&af!==void 0,AE={all:af,IS_HTMLDDA:SW},DE=AE,OW=DE.all,Ye=DE.IS_HTMLDDA?function(i){return typeof i=="function"||i===OW}:function(i){return typeof i=="function"},Sa={},TW=ne,Xe=!TW(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),IW=Uo,Vs=Function.prototype.call,zt=IW?Vs.bind(Vs):function(){return Vs.apply(Vs,arguments)},Cl={},RE={}.propertyIsEnumerable,NE=Object.getOwnPropertyDescriptor,kW=NE&&!RE.call({1:2},1);Cl.f=kW?function(r){var e=NE(this,r);return!!e&&e.enumerable}:RE;var Go=function(i,r){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:r}},PW=oe,xW=ne,CW=Hr,bc=Object,AW=PW("".split),Al=xW(function(){return!bc("z").propertyIsEnumerable(0)})?function(i){return CW(i)==="String"?AW(i,""):bc(i)}:bc,Oa=function(i){return i==null},DW=Oa,RW=TypeError,qo=function(i){if(DW(i))throw new RW("Can't call method on "+i);return i},NW=Al,MW=qo,wr=function(i){return NW(MW(i))},Pm=Ye,ME=AE,BW=ME.all,Je=ME.IS_HTMLDDA?function(i){return typeof i=="object"?i!==null:Pm(i)||i===BW}:function(i){return typeof i=="object"?i!==null:Pm(i)},ae={},$c=ae,wc=Pe,FW=Ye,xm=function(i){return FW(i)?i:void 0},Jt=function(i,r){return arguments.length<2?xm($c[i])||xm(wc[i]):$c[i]&&$c[i][r]||wc[i]&&wc[i][r]},jW=oe,Me=jW({}.isPrototypeOf),Yo=typeof navigator<"u"&&String(navigator.userAgent)||"",BE=Pe,_c=Yo,Cm=BE.process,Am=BE.Deno,Dm=Cm&&Cm.versions||Am&&Am.version,Rm=Dm&&Dm.v8,ir,zu;Rm&&(ir=Rm.split("."),zu=ir[0]>0&&ir[0]<4?1:+(ir[0]+ir[1]));!zu&&_c&&(ir=_c.match(/Edge\/(\d+)/),(!ir||ir[1]>=74)&&(ir=_c.match(/Chrome\/(\d+)/),ir&&(zu=+ir[1])));var Xo=zu,Nm=Xo,LW=ne,zW=Pe,HW=zW.String,Ta=!!Object.getOwnPropertySymbols&&!LW(function(){var i=Symbol("symbol detection");return!HW(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&Nm&&Nm<41}),VW=Ta,FE=VW&&!Symbol.sham&&typeof Symbol.iterator=="symbol",WW=Jt,UW=Ye,KW=Me,GW=FE,qW=Object,Jo=GW?function(i){return typeof i=="symbol"}:function(i){var r=WW("Symbol");return UW(r)&&KW(r.prototype,qW(i))},YW=String,Ia=function(i){try{return YW(i)}catch{return"Object"}},XW=Ye,JW=Ia,ZW=TypeError,sn=function(i){if(XW(i))return i;throw new ZW(JW(i)+" is not a function")},QW=sn,e9=Oa,kv=function(i,r){var e=i[r];return e9(e)?void 0:QW(e)},Ec=zt,Sc=Ye,Oc=Je,t9=TypeError,r9=function(i,r){var e,t;if(r==="string"&&Sc(e=i.toString)&&!Oc(t=Ec(e,i))||Sc(e=i.valueOf)&&!Oc(t=Ec(e,i))||r!=="string"&&Sc(e=i.toString)&&!Oc(t=Ec(e,i)))return t;throw new t9("Can't convert object to primitive value")},jE={exports:{}},Mm=Pe,i9=Object.defineProperty,n9=function(i,r){try{i9(Mm,i,{value:r,configurable:!0,writable:!0})}catch{Mm[i]=r}return r},a9=Pe,o9=n9,Bm="__core-js_shared__",s9=a9[Bm]||o9(Bm,{}),Pv=s9,Fm=Pv;(jE.exports=function(i,r){return Fm[i]||(Fm[i]=r!==void 0?r:{})})("versions",[]).push({version:"3.33.0",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ka=jE.exports,u9=qo,l9=Object,Ct=function(i){return l9(u9(i))},h9=oe,c9=Ct,d9=h9({}.hasOwnProperty),Ze=Object.hasOwn||function(r,e){return d9(c9(r),e)},f9=oe,v9=0,p9=Math.random(),g9=f9(1 .toString),Dl=function(i){return"Symbol("+(i===void 0?"":i)+")_"+g9(++v9+p9,36)},y9=Pe,m9=ka,jm=Ze,b9=Dl,$9=Ta,w9=FE,Ln=y9.Symbol,Tc=m9("wks"),_9=w9?Ln.for||Ln:Ln&&Ln.withoutSetter||b9,xe=function(i){return jm(Tc,i)||(Tc[i]=$9&&jm(Ln,i)?Ln[i]:_9("Symbol."+i)),Tc[i]},E9=zt,Lm=Je,zm=Jo,S9=kv,O9=r9,T9=xe,I9=TypeError,k9=T9("toPrimitive"),P9=function(i,r){if(!Lm(i)||zm(i))return i;var e=S9(i,k9),t;if(e){if(r===void 0&&(r="default"),t=E9(e,i,r),!Lm(t)||zm(t))return t;throw new I9("Can't convert object to primitive value")}return r===void 0&&(r="number"),O9(i,r)},x9=P9,C9=Jo,Rl=function(i){var r=x9(i,"string");return C9(r)?r:r+""},A9=Pe,Hm=Je,of=A9.document,D9=Hm(of)&&Hm(of.createElement),LE=function(i){return D9?of.createElement(i):{}},R9=Xe,N9=ne,M9=LE,zE=!R9&&!N9(function(){return Object.defineProperty(M9("div"),"a",{get:function(){return 7}}).a!==7}),B9=Xe,F9=zt,j9=Cl,L9=Go,z9=wr,H9=Rl,V9=Ze,W9=zE,Vm=Object.getOwnPropertyDescriptor;Sa.f=B9?Vm:function(r,e){if(r=z9(r),e=H9(e),W9)try{return Vm(r,e)}catch{}if(V9(r,e))return L9(!F9(j9.f,r,e),r[e])};var U9=ne,K9=Ye,G9=/#|\.prototype\./,Zo=function(i,r){var e=Y9[q9(i)];return e===J9?!0:e===X9?!1:K9(r)?U9(r):!!r},q9=Zo.normalize=function(i){return String(i).replace(G9,".").toLowerCase()},Y9=Zo.data={},X9=Zo.NATIVE="N",J9=Zo.POLYFILL="P",Z9=Zo,Wm=Iv,Q9=sn,eU=Uo,tU=Wm(Wm.bind),Qo=function(i,r){return Q9(i),r===void 0?i:eU?tU(i,r):function(){return i.apply(r,arguments)}},Ht={},rU=Xe,iU=ne,HE=rU&&iU(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),nU=Je,aU=String,oU=TypeError,Vt=function(i){if(nU(i))return i;throw new oU(aU(i)+" is not an object")},sU=Xe,uU=zE,lU=HE,Ws=Vt,Um=Rl,hU=TypeError,Ic=Object.defineProperty,cU=Object.getOwnPropertyDescriptor,kc="enumerable",Pc="configurable",xc="writable";Ht.f=sU?lU?function(r,e,t){if(Ws(r),e=Um(e),Ws(t),typeof r=="function"&&e==="prototype"&&"value"in t&&xc in t&&!t[xc]){var n=cU(r,e);n&&n[xc]&&(r[e]=t.value,t={configurable:Pc in t?t[Pc]:n[Pc],enumerable:kc in t?t[kc]:n[kc],writable:!1})}return Ic(r,e,t)}:Ic:function(r,e,t){if(Ws(r),e=Um(e),Ws(t),uU)try{return Ic(r,e,t)}catch{}if("get"in t||"set"in t)throw new hU("Accessors not supported");return"value"in t&&(r[e]=t.value),r};var dU=Xe,fU=Ht,vU=Go,Pa=dU?function(i,r,e){return fU.f(i,r,vU(1,e))}:function(i,r,e){return i[r]=e,i},Us=Pe,pU=Ko,gU=Iv,yU=Ye,mU=Sa.f,bU=Z9,Sn=ae,$U=Qo,On=Pa,Km=Ze,wU=function(i){var r=function(e,t,n){if(this instanceof r){switch(arguments.length){case 0:return new i;case 1:return new i(e);case 2:return new i(e,t)}return new i(e,t,n)}return pU(i,this,arguments)};return r.prototype=i.prototype,r},q=function(i,r){var e=i.target,t=i.global,n=i.stat,a=i.proto,o=t?Us:n?Us[e]:(Us[e]||{}).prototype,s=t?Sn:Sn[e]||On(Sn,e,{})[e],u=s.prototype,l,h,d,c,f,v,p,g,y;for(c in r)l=bU(t?c:e+(n?".":"#")+c,i.forced),h=!l&&o&&Km(o,c),v=s[c],h&&(i.dontCallGetSet?(y=mU(o,c),p=y&&y.value):p=o[c]),f=h&&p?p:r[c],!(h&&typeof v==typeof f)&&(i.bind&&h?g=$U(f,Us):i.wrap&&h?g=wU(f):a&&yU(f)?g=gU(f):g=f,(i.sham||f&&f.sham||v&&v.sham)&&On(g,"sham",!0),On(s,c,g),a&&(d=e+"Prototype",Km(Sn,d)||On(Sn,d,{}),On(Sn[d],c,f),i.real&&u&&(l||!u[c])&&On(u,c,f)))},_U=Math.ceil,EU=Math.floor,SU=Math.trunc||function(r){var e=+r;return(e>0?EU:_U)(e)},OU=SU,Nl=function(i){var r=+i;return r!==r||r===0?0:OU(r)},TU=Nl,IU=Math.max,kU=Math.min,es=function(i,r){var e=TU(i);return e<0?IU(e+r,0):kU(e,r)},PU=Nl,xU=Math.min,CU=function(i){return i>0?xU(PU(i),9007199254740991):0},AU=CU,Zt=function(i){return AU(i.length)},DU=wr,RU=es,NU=Zt,Gm=function(i){return function(r,e,t){var n=DU(r),a=NU(n),o=RU(t,a),s;if(i&&e!==e){for(;a>o;)if(s=n[o++],s!==s)return!0}else for(;a>o;o++)if((i||o in n)&&n[o]===e)return i||o||0;return!i&&-1}},xv={includes:Gm(!0),indexOf:Gm(!1)},ts={},MU=oe,Cc=Ze,BU=wr,FU=xv.indexOf,jU=ts,qm=MU([].push),VE=function(i,r){var e=BU(i),t=0,n=[],a;for(a in e)!Cc(jU,a)&&Cc(e,a)&&qm(n,a);for(;r.length>t;)Cc(e,a=r[t++])&&(~FU(n,a)||qm(n,a));return n},Cv=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],LU=VE,zU=Cv,Ml=Object.keys||function(r){return LU(r,zU)},rs={};rs.f=Object.getOwnPropertySymbols;var Ym=Xe,HU=oe,VU=zt,WU=ne,Ac=Ml,UU=rs,KU=Cl,GU=Ct,qU=Al,Tn=Object.assign,Xm=Object.defineProperty,YU=HU([].concat),XU=!Tn||WU(function(){if(Ym&&Tn({b:1},Tn(Xm({},"a",{enumerable:!0,get:function(){Xm(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var i={},r={},e=Symbol("assign detection"),t="abcdefghijklmnopqrst";return i[e]=7,t.split("").forEach(function(n){r[n]=n}),Tn({},i)[e]!==7||Ac(Tn({},r)).join("")!==t})?function(r,e){for(var t=GU(r),n=arguments.length,a=1,o=UU.f,s=KU.f;n>a;)for(var u=qU(arguments[a++]),l=o?YU(Ac(u),o(u)):Ac(u),h=l.length,d=0,c;h>d;)c=l[d++],(!Ym||VU(s,u,c))&&(t[c]=u[c]);return t}:Tn,JU=q,Jm=XU;JU({target:"Object",stat:!0,arity:2,forced:Object.assign!==Jm},{assign:Jm});var ZU=ae,QU=ZU.Object.assign,eK=QU,tK=eK,rK=tK,je=V(rK),iK=oe,Bl=iK([].slice),WE=oe,nK=sn,aK=Je,oK=Ze,Zm=Bl,sK=Uo,UE=Function,uK=WE([].concat),lK=WE([].join),Dc={},hK=function(i,r,e){if(!oK(Dc,r)){for(var t=[],n=0;n=.1;)v=+a[d++%o],v>h&&(v=h),f=Math.sqrt(v*v/(1+l*l)),f=s<0?-f:f,r+=f,e+=l*f,c===!0?i.lineTo(r,e):i.moveTo(r,e),h-=v,c=!c}function OK(i,r,e,t){i.beginPath();var n=6,a=Math.PI*2/n;i.moveTo(r+t,e);for(var o=1;o1?e-1:0),n=1;n=a?i?"":void 0:(o=tb(t,n),o<55296||o>56319||n+1===a||(s=tb(t,n+1))<56320||s>57343?i?HK(t,n):o:i?VK(t,n,n+2):(o-55296<<10)+(s-56320)+65536)}},WK={codeAt:rb(!1),charAt:rb(!0)},UK=Pe,KK=Ye,ib=UK.WeakMap,eS=KK(ib)&&/native code/.test(String(ib)),GK=ka,qK=Dl,nb=GK("keys"),Fl=function(i){return nb[i]||(nb[i]=qK(i))},YK=eS,tS=Pe,XK=Je,JK=Pa,Nc=Ze,Mc=Pv,ZK=Fl,QK=ts,ab="Object already initialized",uf=tS.TypeError,eG=tS.WeakMap,Hu,yo,Vu,tG=function(i){return Vu(i)?yo(i):Hu(i,{})},rG=function(i){return function(r){var e;if(!XK(r)||(e=yo(r)).type!==i)throw new uf("Incompatible receiver, "+i+" required");return e}};if(YK||Mc.state){var cr=Mc.state||(Mc.state=new eG);cr.get=cr.get,cr.has=cr.has,cr.set=cr.set,Hu=function(i,r){if(cr.has(i))throw new uf(ab);return r.facade=i,cr.set(i,r),r},yo=function(i){return cr.get(i)||{}},Vu=function(i){return cr.has(i)}}else{var In=ZK("state");QK[In]=!0,Hu=function(i,r){if(Nc(i,In))throw new uf(ab);return r.facade=i,JK(i,In,r),r},yo=function(i){return Nc(i,In)?i[In]:{}},Vu=function(i){return Nc(i,In)}}var ln={set:Hu,get:yo,has:Vu,enforce:tG,getterFor:rG},lf=Xe,iG=Ze,rS=Function.prototype,nG=lf&&Object.getOwnPropertyDescriptor,Nv=iG(rS,"name"),aG=Nv&&function(){}.name==="something",oG=Nv&&(!lf||lf&&nG(rS,"name").configurable),sG={EXISTS:Nv,PROPER:aG,CONFIGURABLE:oG},jl={},uG=Xe,lG=HE,hG=Ht,cG=Vt,dG=wr,fG=Ml;jl.f=uG&&!lG?Object.defineProperties:function(r,e){cG(r);for(var t=dG(e),n=fG(e),a=n.length,o=0,s;a>o;)hG.f(r,s=n[o++],t[s]);return r};var vG=Jt,pG=vG("document","documentElement"),gG=Vt,yG=jl,ob=Cv,mG=ts,bG=pG,$G=LE,wG=Fl,sb=">",ub="<",hf="prototype",cf="script",iS=wG("IE_PROTO"),Bc=function(){},nS=function(i){return ub+cf+sb+i+ub+"/"+cf+sb},lb=function(i){i.write(nS("")),i.close();var r=i.parentWindow.Object;return i=null,r},_G=function(){var i=$G("iframe"),r="java"+cf+":",e;return i.style.display="none",bG.appendChild(i),i.src=String(r),e=i.contentWindow.document,e.open(),e.write(nS("document.F=Object")),e.close(),e.F},Ks,yu=function(){try{Ks=new ActiveXObject("htmlfile")}catch{}yu=typeof document<"u"?document.domain&&Ks?lb(Ks):_G():lb(Ks);for(var i=ob.length;i--;)delete yu[hf][ob[i]];return yu()};mG[iS]=!0;var xa=Object.create||function(r,e){var t;return r!==null?(Bc[hf]=gG(r),t=new Bc,Bc[hf]=null,t[iS]=r):t=yu(),e===void 0?t:yG.f(t,e)},EG=ne,aS=!EG(function(){function i(){}return i.prototype.constructor=null,Object.getPrototypeOf(new i)!==i.prototype}),SG=Ze,OG=Ye,TG=Ct,IG=Fl,kG=aS,hb=IG("IE_PROTO"),df=Object,PG=df.prototype,Ll=kG?df.getPrototypeOf:function(i){var r=TG(i);if(SG(r,hb))return r[hb];var e=r.constructor;return OG(e)&&r instanceof e?e.prototype:r instanceof df?PG:null},xG=Pa,is=function(i,r,e,t){return t&&t.enumerable?i[r]=e:xG(i,r,e),i},CG=ne,AG=Ye,DG=Je,RG=xa,cb=Ll,NG=is,MG=xe,ff=MG("iterator"),oS=!1,Cr,Fc,jc;[].keys&&(jc=[].keys(),"next"in jc?(Fc=cb(cb(jc)),Fc!==Object.prototype&&(Cr=Fc)):oS=!0);var BG=!DG(Cr)||CG(function(){var i={};return Cr[ff].call(i)!==i});BG?Cr={}:Cr=RG(Cr);AG(Cr[ff])||NG(Cr,ff,function(){return this});var sS={IteratorPrototype:Cr,BUGGY_SAFARI_ITERATORS:oS},FG=Dv,jG=un,LG=FG?{}.toString:function(){return"[object "+jG(this)+"]"},zG=Dv,HG=Ht.f,VG=Pa,WG=Ze,UG=LG,KG=xe,db=KG("toStringTag"),Ca=function(i,r,e,t){if(i){var n=e?i:i.prototype;WG(n,db)||HG(n,db,{configurable:!0,value:r}),t&&!zG&&VG(n,"toString",UG)}},Aa={},GG=sS.IteratorPrototype,qG=xa,YG=Go,XG=Ca,JG=Aa,ZG=function(){return this},QG=function(i,r,e,t){var n=r+" Iterator";return i.prototype=qG(GG,{next:YG(+!t,e)}),XG(i,n,!1,!0),JG[n]=ZG,i},eq=oe,tq=sn,rq=function(i,r,e){try{return eq(tq(Object.getOwnPropertyDescriptor(i,r)[e]))}catch{}},iq=Ye,nq=String,aq=TypeError,oq=function(i){if(typeof i=="object"||iq(i))return i;throw new aq("Can't set "+nq(i)+" as a prototype")},sq=rq,uq=Vt,lq=oq,hq=Object.setPrototypeOf||("__proto__"in{}?function(){var i=!1,r={},e;try{e=sq(Object.prototype,"__proto__","set"),e(r,[]),i=r instanceof Array}catch{}return function(n,a){return uq(n),lq(a),i?e(n,a):n.__proto__=a,n}}():void 0),cq=q,dq=zt,fq=sG,vq=QG,pq=Ll,gq=Ca,fb=is,yq=xe,vb=Aa,mq=sS,bq=fq.PROPER,Gs=mq.BUGGY_SAFARI_ITERATORS,Lc=yq("iterator"),pb="keys",qs="values",gb="entries",$q=function(){return this},Mv=function(i,r,e,t,n,a,o){vq(e,r,t);var s=function(y){if(y===n&&c)return c;if(!Gs&&y&&y in h)return h[y];switch(y){case pb:return function(){return new e(this,y)};case qs:return function(){return new e(this,y)};case gb:return function(){return new e(this,y)}}return function(){return new e(this)}},u=r+" Iterator",l=!1,h=i.prototype,d=h[Lc]||h["@@iterator"]||n&&h[n],c=!Gs&&d||s(n),f=r==="Array"&&h.entries||d,v,p,g;if(f&&(v=pq(f.call(new i)),v!==Object.prototype&&v.next&&(gq(v,u,!0,!0),vb[u]=$q)),bq&&n===qs&&d&&d.name!==qs&&(l=!0,c=function(){return dq(d,this)}),n)if(p={values:s(qs),keys:a?c:s(pb),entries:s(gb)},o)for(g in p)(Gs||l||!(g in h))&&fb(h,g,p[g]);else cq({target:r,proto:!0,forced:Gs||l},p);return o&&h[Lc]!==c&&fb(h,Lc,c,{name:n}),vb[r]=c,p},Bv=function(i,r){return{value:i,done:r}},wq=WK.charAt,_q=_r,uS=ln,Eq=Mv,yb=Bv,lS="String Iterator",Sq=uS.set,Oq=uS.getterFor(lS);Eq(String,"String",function(i){Sq(this,{type:lS,string:_q(i),index:0})},function(){var r=Oq(this),e=r.string,t=r.index,n;return t>=e.length?yb(void 0,!0):(n=wq(e,t),r.index+=n.length,yb(n,!1))});var Tq=zt,mb=Vt,Iq=kv,hS=function(i,r,e){var t,n;mb(i);try{if(t=Iq(i,"return"),!t){if(r==="throw")throw e;return e}t=Tq(t,i)}catch(a){n=!0,t=a}if(r==="throw")throw e;if(n)throw t;return mb(t),e},kq=Vt,Pq=hS,xq=function(i,r,e,t){try{return t?r(kq(e)[0],e[1]):r(e)}catch(n){Pq(i,"throw",n)}},Cq=xe,Aq=Aa,Dq=Cq("iterator"),Rq=Array.prototype,cS=function(i){return i!==void 0&&(Aq.Array===i||Rq[Dq]===i)},Nq=oe,Mq=Ye,vf=Pv,Bq=Nq(Function.toString);Mq(vf.inspectSource)||(vf.inspectSource=function(i){return Bq(i)});var Fq=vf.inspectSource,jq=oe,Lq=ne,dS=Ye,zq=un,Hq=Jt,Vq=Fq,fS=function(){},Wq=[],vS=Hq("Reflect","construct"),Fv=/^\s*(?:class|function)\b/,Uq=jq(Fv.exec),Kq=!Fv.test(fS),La=function(r){if(!dS(r))return!1;try{return vS(fS,Wq,r),!0}catch{return!1}},pS=function(r){if(!dS(r))return!1;switch(zq(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Kq||!!Uq(Fv,Vq(r))}catch{return!0}};pS.sham=!0;var zl=!vS||Lq(function(){var i;return La(La.call)||!La(Object)||!La(function(){i=!0})||i})?pS:La,Gq=Rl,qq=Ht,Yq=Go,Da=function(i,r,e){var t=Gq(r);t in i?qq.f(i,t,Yq(0,e)):i[t]=e},Xq=un,bb=kv,Jq=Oa,Zq=Aa,Qq=xe,eY=Qq("iterator"),Hl=function(i){if(!Jq(i))return bb(i,eY)||bb(i,"@@iterator")||Zq[Xq(i)]},tY=zt,rY=sn,iY=Vt,nY=Ia,aY=Hl,oY=TypeError,gS=function(i,r){var e=arguments.length<2?aY(i):r;if(rY(e))return iY(tY(e,i));throw new oY(nY(i)+" is not iterable")},sY=Qo,uY=zt,lY=Ct,hY=xq,cY=cS,dY=zl,fY=Zt,$b=Da,vY=gS,pY=Hl,wb=Array,gY=function(r){var e=lY(r),t=dY(this),n=arguments.length,a=n>1?arguments[1]:void 0,o=a!==void 0;o&&(a=sY(a,n>2?arguments[2]:void 0));var s=pY(e),u=0,l,h,d,c,f,v;if(s&&!(this===wb&&cY(s)))for(c=vY(e,s),f=c.next,h=t?new this:[];!(d=uY(f,c)).done;u++)v=o?hY(c,a,[d.value,u],!0):d.value,$b(h,u,v);else for(l=fY(e),h=t?new this(l):wb(l);l>u;u++)v=o?a(e[u],u):e[u],$b(h,u,v);return h.length=u,h},yY=xe,yS=yY("iterator"),mS=!1;try{var mY=0,_b={next:function(){return{done:!!mY++}},return:function(){mS=!0}};_b[yS]=function(){return this},Array.from(_b,function(){throw 2})}catch{}var bY=function(i,r){try{if(!r&&!mS)return!1}catch{return!1}var e=!1;try{var t={};t[yS]=function(){return{next:function(){return{done:e=!0}}}},i(t)}catch{}return e},$Y=q,wY=gY,_Y=bY,EY=!_Y(function(i){Array.from(i)});$Y({target:"Array",stat:!0,forced:EY},{from:wY});var SY=ae,OY=SY.Array.from,TY=OY,bS=TY,IY=bS,hn=V(IY),kY=wr,Eb=Aa,$S=ln;Ht.f;var PY=Mv,Ys=Bv,wS="Array Iterator",xY=$S.set,CY=$S.getterFor(wS);PY(Array,"Array",function(i,r){xY(this,{type:wS,target:kY(i),index:0,kind:r})},function(){var i=CY(this),r=i.target,e=i.kind,t=i.index++;if(!r||t>=r.length)return i.target=void 0,Ys(void 0,!0);switch(e){case"keys":return Ys(t,!1);case"values":return Ys(r[t],!1)}return Ys([t,r[t]],!1)},"values");Eb.Arguments=Eb.Array;var AY=Hl,DY=AY,RY={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},NY=RY,MY=Pe,BY=un,FY=Pa,Sb=Aa,jY=xe,Ob=jY("toStringTag");for(var zc in NY){var Tb=MY[zc],Hc=Tb&&Tb.prototype;Hc&&BY(Hc)!==Ob&&FY(Hc,Ob,zc),Sb[zc]=Sb.Array}var LY=DY,zY=LY,HY=zY,VY=HY,WY=VY,UY=WY,_S=UY,ES=V(_S),KY=_S,cn=V(KY);function N(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")}var SS={exports:{}},GY=q,qY=Xe,Ib=Ht.f;GY({target:"Object",stat:!0,forced:Object.defineProperty!==Ib,sham:!qY},{defineProperty:Ib});var YY=ae,OS=YY.Object,XY=SS.exports=function(r,e,t){return OS.defineProperty(r,e,t)};OS.defineProperty.sham&&(XY.sham=!0);var JY=SS.exports,ZY=JY,TS=ZY,QY=TS,eX=QY,tX=eX,rX=tX,iX=rX,Vl=V(iX),nX=Hr,dn=Array.isArray||function(r){return nX(r)==="Array"},aX=TypeError,oX=9007199254740991,jv=function(i){if(i>oX)throw aX("Maximum allowed index exceeded");return i},kb=dn,sX=zl,uX=Je,lX=xe,hX=lX("species"),Pb=Array,cX=function(i){var r;return kb(i)&&(r=i.constructor,sX(r)&&(r===Pb||kb(r.prototype))?r=void 0:uX(r)&&(r=r[hX],r===null&&(r=void 0))),r===void 0?Pb:r},dX=cX,Lv=function(i,r){return new(dX(i))(r===0?0:r)},fX=ne,vX=xe,pX=Xo,gX=vX("species"),ns=function(i){return pX>=51||!fX(function(){var r=[],e=r.constructor={};return e[gX]=function(){return{foo:1}},r[i](Boolean).foo!==1})},yX=q,mX=ne,bX=dn,$X=Je,wX=Ct,_X=Zt,xb=jv,Cb=Da,EX=Lv,SX=ns,OX=xe,TX=Xo,IS=OX("isConcatSpreadable"),IX=TX>=51||!mX(function(){var i=[];return i[IS]=!1,i.concat()[0]!==i}),kX=function(i){if(!$X(i))return!1;var r=i[IS];return r!==void 0?!!r:bX(i)},PX=!IX||!SX("concat");yX({target:"Array",proto:!0,arity:1,forced:PX},{concat:function(r){var e=wX(this),t=EX(e,0),n=0,a,o,s,u,l;for(a=-1,s=arguments.length;ag;g++)if((s||g in f)&&(b=f[g],$=v(b,g,c),i))if(r)m[g]=$;else if($)switch(i){case 3:return!0;case 5:return b;case 6:return g;case 2:Rb(m,b)}else switch(i){case 4:return!1;case 7:Rb(m,b)}return a?-1:t||n?n:m}},mi={forEach:Ur(0),map:Ur(1),filter:Ur(2),some:Ur(3),every:Ur(4),find:Ur(5),findIndex:Ur(6),filterReject:Ur(7)},Ul=q,Kl=Pe,Hv=zt,rJ=oe,ra=Xe,ia=Ta,iJ=ne,Ke=Ze,nJ=Me,pf=Vt,Gl=wr,Vv=Rl,aJ=_r,gf=Go,mo=xa,AS=Ml,oJ=as,DS=Wl,sJ=rs,RS=Sa,NS=Ht,uJ=jl,MS=Cl,Nb=is,lJ=zv,Wv=ka,hJ=Fl,BS=ts,Mb=Dl,cJ=xe,dJ=os,fJ=Ce,vJ=CS,pJ=Ca,FS=ln,ql=mi.forEach,St=hJ("hidden"),Yl="Symbol",bo="prototype",gJ=FS.set,Bb=FS.getterFor(Yl),or=Object[bo],Fi=Kl.Symbol,Ga=Fi&&Fi[bo],yJ=Kl.RangeError,mJ=Kl.TypeError,Vc=Kl.QObject,jS=RS.f,ji=NS.f,LS=DS.f,bJ=MS.f,zS=rJ([].push),Fr=Wv("symbols"),ss=Wv("op-symbols"),$J=Wv("wks"),yf=!Vc||!Vc[bo]||!Vc[bo].findChild,HS=function(i,r,e){var t=jS(or,r);t&&delete or[r],ji(i,r,e),t&&i!==or&&ji(or,r,t)},mf=ra&&iJ(function(){return mo(ji({},"a",{get:function(){return ji(this,"a",{value:7}).a}})).a!==7})?HS:ji,Wc=function(i,r){var e=Fr[i]=mo(Ga);return gJ(e,{type:Yl,tag:i,description:r}),ra||(e.description=r),e},Xl=function(r,e,t){r===or&&Xl(ss,e,t),pf(r);var n=Vv(e);return pf(t),Ke(Fr,n)?(t.enumerable?(Ke(r,St)&&r[St][n]&&(r[St][n]=!1),t=mo(t,{enumerable:gf(0,!1)})):(Ke(r,St)||ji(r,St,gf(1,{})),r[St][n]=!0),mf(r,n,t)):ji(r,n,t)},Uv=function(r,e){pf(r);var t=Gl(e),n=AS(t).concat(KS(t));return ql(n,function(a){(!ra||Hv(VS,t,a))&&Xl(r,a,t[a])}),r},wJ=function(r,e){return e===void 0?mo(r):Uv(mo(r),e)},VS=function(r){var e=Vv(r),t=Hv(bJ,this,e);return this===or&&Ke(Fr,e)&&!Ke(ss,e)?!1:t||!Ke(this,e)||!Ke(Fr,e)||Ke(this,St)&&this[St][e]?t:!0},WS=function(r,e){var t=Gl(r),n=Vv(e);if(!(t===or&&Ke(Fr,n)&&!Ke(ss,n))){var a=jS(t,n);return a&&Ke(Fr,n)&&!(Ke(t,St)&&t[St][n])&&(a.enumerable=!0),a}},US=function(r){var e=LS(Gl(r)),t=[];return ql(e,function(n){!Ke(Fr,n)&&!Ke(BS,n)&&zS(t,n)}),t},KS=function(i){var r=i===or,e=LS(r?ss:Gl(i)),t=[];return ql(e,function(n){Ke(Fr,n)&&(!r||Ke(or,n))&&zS(t,Fr[n])}),t};ia||(Fi=function(){if(nJ(Ga,this))throw new mJ("Symbol is not a constructor");var r=!arguments.length||arguments[0]===void 0?void 0:aJ(arguments[0]),e=Mb(r),t=function(n){this===or&&Hv(t,ss,n),Ke(this,St)&&Ke(this[St],e)&&(this[St][e]=!1);var a=gf(1,n);try{mf(this,e,a)}catch(o){if(!(o instanceof yJ))throw o;HS(this,e,a)}};return ra&&yf&&mf(or,e,{configurable:!0,set:t}),Wc(e,r)},Ga=Fi[bo],Nb(Ga,"toString",function(){return Bb(this).tag}),Nb(Fi,"withoutSetter",function(i){return Wc(Mb(i),i)}),MS.f=VS,NS.f=Xl,uJ.f=Uv,RS.f=WS,oJ.f=DS.f=US,sJ.f=KS,dJ.f=function(i){return Wc(cJ(i),i)},ra&&lJ(Ga,"description",{configurable:!0,get:function(){return Bb(this).description}}));Ul({global:!0,constructor:!0,wrap:!0,forced:!ia,sham:!ia},{Symbol:Fi});ql(AS($J),function(i){fJ(i)});Ul({target:Yl,stat:!0,forced:!ia},{useSetter:function(){yf=!0},useSimple:function(){yf=!1}});Ul({target:"Object",stat:!0,forced:!ia,sham:!ra},{create:wJ,defineProperty:Xl,defineProperties:Uv,getOwnPropertyDescriptor:WS});Ul({target:"Object",stat:!0,forced:!ia},{getOwnPropertyNames:US});vJ();pJ(Fi,Yl);BS[St]=!0;var _J=Ta,GS=_J&&!!Symbol.for&&!!Symbol.keyFor,EJ=q,SJ=Jt,OJ=Ze,TJ=_r,qS=ka,IJ=GS,Uc=qS("string-to-symbol-registry"),kJ=qS("symbol-to-string-registry");EJ({target:"Symbol",stat:!0,forced:!IJ},{for:function(i){var r=TJ(i);if(OJ(Uc,r))return Uc[r];var e=SJ("Symbol")(r);return Uc[r]=e,kJ[e]=r,e}});var PJ=q,xJ=Ze,CJ=Jo,AJ=Ia,DJ=ka,RJ=GS,Fb=DJ("symbol-to-string-registry");PJ({target:"Symbol",stat:!0,forced:!RJ},{keyFor:function(r){if(!CJ(r))throw new TypeError(AJ(r)+" is not a symbol");if(xJ(Fb,r))return Fb[r]}});var NJ=oe,jb=dn,MJ=Ye,Lb=Hr,BJ=_r,zb=NJ([].push),FJ=function(i){if(MJ(i))return i;if(jb(i)){for(var r=i.length,e=[],t=0;ti.length)&&(r=i.length);for(var e=0,t=new Array(r);e"u"&&af!==void 0,AE={all:af,IS_HTMLDDA:SW},DE=AE,OW=DE.all,Xe=DE.IS_HTMLDDA?function(i){return typeof i=="function"||i===OW}:function(i){return typeof i=="function"},Sa={},TW=ae,Je=!TW(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),IW=Uo,Vs=Function.prototype.call,zt=IW?Vs.bind(Vs):function(){return Vs.apply(Vs,arguments)},Cl={},RE={}.propertyIsEnumerable,NE=Object.getOwnPropertyDescriptor,kW=NE&&!RE.call({1:2},1);Cl.f=kW?function(r){var e=NE(this,r);return!!e&&e.enumerable}:RE;var Go=function(i,r){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:r}},PW=se,xW=ae,CW=Hr,bc=Object,AW=PW("".split),Al=xW(function(){return!bc("z").propertyIsEnumerable(0)})?function(i){return CW(i)==="String"?AW(i,""):bc(i)}:bc,Oa=function(i){return i==null},DW=Oa,RW=TypeError,qo=function(i){if(DW(i))throw new RW("Can't call method on "+i);return i},NW=Al,MW=qo,_r=function(i){return NW(MW(i))},Pm=Xe,ME=AE,BW=ME.all,Ze=ME.IS_HTMLDDA?function(i){return typeof i=="object"?i!==null:Pm(i)||i===BW}:function(i){return typeof i=="object"?i!==null:Pm(i)},oe={},$c=oe,wc=Pe,FW=Xe,xm=function(i){return FW(i)?i:void 0},Jt=function(i,r){return arguments.length<2?xm($c[i])||xm(wc[i]):$c[i]&&$c[i][r]||wc[i]&&wc[i][r]},jW=se,Be=jW({}.isPrototypeOf),Yo=typeof navigator<"u"&&String(navigator.userAgent)||"",BE=Pe,_c=Yo,Cm=BE.process,Am=BE.Deno,Dm=Cm&&Cm.versions||Am&&Am.version,Rm=Dm&&Dm.v8,ir,zu;Rm&&(ir=Rm.split("."),zu=ir[0]>0&&ir[0]<4?1:+(ir[0]+ir[1]));!zu&&_c&&(ir=_c.match(/Edge\/(\d+)/),(!ir||ir[1]>=74)&&(ir=_c.match(/Chrome\/(\d+)/),ir&&(zu=+ir[1])));var Xo=zu,Nm=Xo,LW=ae,zW=Pe,HW=zW.String,Ta=!!Object.getOwnPropertySymbols&&!LW(function(){var i=Symbol("symbol detection");return!HW(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&Nm&&Nm<41}),VW=Ta,FE=VW&&!Symbol.sham&&typeof Symbol.iterator=="symbol",WW=Jt,UW=Xe,KW=Be,GW=FE,qW=Object,Jo=GW?function(i){return typeof i=="symbol"}:function(i){var r=WW("Symbol");return UW(r)&&KW(r.prototype,qW(i))},YW=String,Ia=function(i){try{return YW(i)}catch{return"Object"}},XW=Xe,JW=Ia,ZW=TypeError,sn=function(i){if(XW(i))return i;throw new ZW(JW(i)+" is not a function")},QW=sn,e9=Oa,kv=function(i,r){var e=i[r];return e9(e)?void 0:QW(e)},Ec=zt,Sc=Xe,Oc=Ze,t9=TypeError,r9=function(i,r){var e,t;if(r==="string"&&Sc(e=i.toString)&&!Oc(t=Ec(e,i))||Sc(e=i.valueOf)&&!Oc(t=Ec(e,i))||r!=="string"&&Sc(e=i.toString)&&!Oc(t=Ec(e,i)))return t;throw new t9("Can't convert object to primitive value")},jE={exports:{}},Mm=Pe,i9=Object.defineProperty,n9=function(i,r){try{i9(Mm,i,{value:r,configurable:!0,writable:!0})}catch{Mm[i]=r}return r},a9=Pe,o9=n9,Bm="__core-js_shared__",s9=a9[Bm]||o9(Bm,{}),Pv=s9,Fm=Pv;(jE.exports=function(i,r){return Fm[i]||(Fm[i]=r!==void 0?r:{})})("versions",[]).push({version:"3.33.0",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ka=jE.exports,u9=qo,l9=Object,At=function(i){return l9(u9(i))},h9=se,c9=At,d9=h9({}.hasOwnProperty),Qe=Object.hasOwn||function(r,e){return d9(c9(r),e)},f9=se,v9=0,p9=Math.random(),g9=f9(1 .toString),Dl=function(i){return"Symbol("+(i===void 0?"":i)+")_"+g9(++v9+p9,36)},y9=Pe,m9=ka,jm=Qe,b9=Dl,$9=Ta,w9=FE,Ln=y9.Symbol,Tc=m9("wks"),_9=w9?Ln.for||Ln:Ln&&Ln.withoutSetter||b9,xe=function(i){return jm(Tc,i)||(Tc[i]=$9&&jm(Ln,i)?Ln[i]:_9("Symbol."+i)),Tc[i]},E9=zt,Lm=Ze,zm=Jo,S9=kv,O9=r9,T9=xe,I9=TypeError,k9=T9("toPrimitive"),P9=function(i,r){if(!Lm(i)||zm(i))return i;var e=S9(i,k9),t;if(e){if(r===void 0&&(r="default"),t=E9(e,i,r),!Lm(t)||zm(t))return t;throw new I9("Can't convert object to primitive value")}return r===void 0&&(r="number"),O9(i,r)},x9=P9,C9=Jo,Rl=function(i){var r=x9(i,"string");return C9(r)?r:r+""},A9=Pe,Hm=Ze,of=A9.document,D9=Hm(of)&&Hm(of.createElement),LE=function(i){return D9?of.createElement(i):{}},R9=Je,N9=ae,M9=LE,zE=!R9&&!N9(function(){return Object.defineProperty(M9("div"),"a",{get:function(){return 7}}).a!==7}),B9=Je,F9=zt,j9=Cl,L9=Go,z9=_r,H9=Rl,V9=Qe,W9=zE,Vm=Object.getOwnPropertyDescriptor;Sa.f=B9?Vm:function(r,e){if(r=z9(r),e=H9(e),W9)try{return Vm(r,e)}catch{}if(V9(r,e))return L9(!F9(j9.f,r,e),r[e])};var U9=ae,K9=Xe,G9=/#|\.prototype\./,Zo=function(i,r){var e=Y9[q9(i)];return e===J9?!0:e===X9?!1:K9(r)?U9(r):!!r},q9=Zo.normalize=function(i){return String(i).replace(G9,".").toLowerCase()},Y9=Zo.data={},X9=Zo.NATIVE="N",J9=Zo.POLYFILL="P",Z9=Zo,Wm=Iv,Q9=sn,eU=Uo,tU=Wm(Wm.bind),Qo=function(i,r){return Q9(i),r===void 0?i:eU?tU(i,r):function(){return i.apply(r,arguments)}},Ht={},rU=Je,iU=ae,HE=rU&&iU(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),nU=Ze,aU=String,oU=TypeError,Vt=function(i){if(nU(i))return i;throw new oU(aU(i)+" is not an object")},sU=Je,uU=zE,lU=HE,Ws=Vt,Um=Rl,hU=TypeError,Ic=Object.defineProperty,cU=Object.getOwnPropertyDescriptor,kc="enumerable",Pc="configurable",xc="writable";Ht.f=sU?lU?function(r,e,t){if(Ws(r),e=Um(e),Ws(t),typeof r=="function"&&e==="prototype"&&"value"in t&&xc in t&&!t[xc]){var n=cU(r,e);n&&n[xc]&&(r[e]=t.value,t={configurable:Pc in t?t[Pc]:n[Pc],enumerable:kc in t?t[kc]:n[kc],writable:!1})}return Ic(r,e,t)}:Ic:function(r,e,t){if(Ws(r),e=Um(e),Ws(t),uU)try{return Ic(r,e,t)}catch{}if("get"in t||"set"in t)throw new hU("Accessors not supported");return"value"in t&&(r[e]=t.value),r};var dU=Je,fU=Ht,vU=Go,Pa=dU?function(i,r,e){return fU.f(i,r,vU(1,e))}:function(i,r,e){return i[r]=e,i},Us=Pe,pU=Ko,gU=Iv,yU=Xe,mU=Sa.f,bU=Z9,Sn=oe,$U=Qo,On=Pa,Km=Qe,wU=function(i){var r=function(e,t,n){if(this instanceof r){switch(arguments.length){case 0:return new i;case 1:return new i(e);case 2:return new i(e,t)}return new i(e,t,n)}return pU(i,this,arguments)};return r.prototype=i.prototype,r},q=function(i,r){var e=i.target,t=i.global,n=i.stat,a=i.proto,o=t?Us:n?Us[e]:(Us[e]||{}).prototype,s=t?Sn:Sn[e]||On(Sn,e,{})[e],u=s.prototype,l,h,c,d,f,v,p,g,y;for(d in r)l=bU(t?d:e+(n?".":"#")+d,i.forced),h=!l&&o&&Km(o,d),v=s[d],h&&(i.dontCallGetSet?(y=mU(o,d),p=y&&y.value):p=o[d]),f=h&&p?p:r[d],!(h&&typeof v==typeof f)&&(i.bind&&h?g=$U(f,Us):i.wrap&&h?g=wU(f):a&&yU(f)?g=gU(f):g=f,(i.sham||f&&f.sham||v&&v.sham)&&On(g,"sham",!0),On(s,d,g),a&&(c=e+"Prototype",Km(Sn,c)||On(Sn,c,{}),On(Sn[c],d,f),i.real&&u&&(l||!u[d])&&On(u,d,f)))},_U=Math.ceil,EU=Math.floor,SU=Math.trunc||function(r){var e=+r;return(e>0?EU:_U)(e)},OU=SU,Nl=function(i){var r=+i;return r!==r||r===0?0:OU(r)},TU=Nl,IU=Math.max,kU=Math.min,es=function(i,r){var e=TU(i);return e<0?IU(e+r,0):kU(e,r)},PU=Nl,xU=Math.min,CU=function(i){return i>0?xU(PU(i),9007199254740991):0},AU=CU,Zt=function(i){return AU(i.length)},DU=_r,RU=es,NU=Zt,Gm=function(i){return function(r,e,t){var n=DU(r),a=NU(n),o=RU(t,a),s;if(i&&e!==e){for(;a>o;)if(s=n[o++],s!==s)return!0}else for(;a>o;o++)if((i||o in n)&&n[o]===e)return i||o||0;return!i&&-1}},xv={includes:Gm(!0),indexOf:Gm(!1)},ts={},MU=se,Cc=Qe,BU=_r,FU=xv.indexOf,jU=ts,qm=MU([].push),VE=function(i,r){var e=BU(i),t=0,n=[],a;for(a in e)!Cc(jU,a)&&Cc(e,a)&&qm(n,a);for(;r.length>t;)Cc(e,a=r[t++])&&(~FU(n,a)||qm(n,a));return n},Cv=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],LU=VE,zU=Cv,Ml=Object.keys||function(r){return LU(r,zU)},rs={};rs.f=Object.getOwnPropertySymbols;var Ym=Je,HU=se,VU=zt,WU=ae,Ac=Ml,UU=rs,KU=Cl,GU=At,qU=Al,Tn=Object.assign,Xm=Object.defineProperty,YU=HU([].concat),XU=!Tn||WU(function(){if(Ym&&Tn({b:1},Tn(Xm({},"a",{enumerable:!0,get:function(){Xm(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var i={},r={},e=Symbol("assign detection"),t="abcdefghijklmnopqrst";return i[e]=7,t.split("").forEach(function(n){r[n]=n}),Tn({},i)[e]!==7||Ac(Tn({},r)).join("")!==t})?function(r,e){for(var t=GU(r),n=arguments.length,a=1,o=UU.f,s=KU.f;n>a;)for(var u=qU(arguments[a++]),l=o?YU(Ac(u),o(u)):Ac(u),h=l.length,c=0,d;h>c;)d=l[c++],(!Ym||VU(s,u,d))&&(t[d]=u[d]);return t}:Tn,JU=q,Jm=XU;JU({target:"Object",stat:!0,arity:2,forced:Object.assign!==Jm},{assign:Jm});var ZU=oe,QU=ZU.Object.assign,eK=QU,tK=eK,rK=tK,Le=V(rK),iK=se,Bl=iK([].slice),WE=se,nK=sn,aK=Ze,oK=Qe,Zm=Bl,sK=Uo,UE=Function,uK=WE([].concat),lK=WE([].join),Dc={},hK=function(i,r,e){if(!oK(Dc,r)){for(var t=[],n=0;n=.1;)v=+a[c++%o],v>h&&(v=h),f=Math.sqrt(v*v/(1+l*l)),f=s<0?-f:f,r+=f,e+=l*f,d===!0?i.lineTo(r,e):i.moveTo(r,e),h-=v,d=!d}function OK(i,r,e,t){i.beginPath();var n=6,a=Math.PI*2/n;i.moveTo(r+t,e);for(var o=1;o1?e-1:0),n=1;n=a?i?"":void 0:(o=tb(t,n),o<55296||o>56319||n+1===a||(s=tb(t,n+1))<56320||s>57343?i?HK(t,n):o:i?VK(t,n,n+2):(o-55296<<10)+(s-56320)+65536)}},WK={codeAt:rb(!1),charAt:rb(!0)},UK=Pe,KK=Xe,ib=UK.WeakMap,eS=KK(ib)&&/native code/.test(String(ib)),GK=ka,qK=Dl,nb=GK("keys"),Fl=function(i){return nb[i]||(nb[i]=qK(i))},YK=eS,tS=Pe,XK=Ze,JK=Pa,Nc=Qe,Mc=Pv,ZK=Fl,QK=ts,ab="Object already initialized",uf=tS.TypeError,eG=tS.WeakMap,Hu,yo,Vu,tG=function(i){return Vu(i)?yo(i):Hu(i,{})},rG=function(i){return function(r){var e;if(!XK(r)||(e=yo(r)).type!==i)throw new uf("Incompatible receiver, "+i+" required");return e}};if(YK||Mc.state){var cr=Mc.state||(Mc.state=new eG);cr.get=cr.get,cr.has=cr.has,cr.set=cr.set,Hu=function(i,r){if(cr.has(i))throw new uf(ab);return r.facade=i,cr.set(i,r),r},yo=function(i){return cr.get(i)||{}},Vu=function(i){return cr.has(i)}}else{var In=ZK("state");QK[In]=!0,Hu=function(i,r){if(Nc(i,In))throw new uf(ab);return r.facade=i,JK(i,In,r),r},yo=function(i){return Nc(i,In)?i[In]:{}},Vu=function(i){return Nc(i,In)}}var ln={set:Hu,get:yo,has:Vu,enforce:tG,getterFor:rG},lf=Je,iG=Qe,rS=Function.prototype,nG=lf&&Object.getOwnPropertyDescriptor,Nv=iG(rS,"name"),aG=Nv&&function(){}.name==="something",oG=Nv&&(!lf||lf&&nG(rS,"name").configurable),sG={EXISTS:Nv,PROPER:aG,CONFIGURABLE:oG},jl={},uG=Je,lG=HE,hG=Ht,cG=Vt,dG=_r,fG=Ml;jl.f=uG&&!lG?Object.defineProperties:function(r,e){cG(r);for(var t=dG(e),n=fG(e),a=n.length,o=0,s;a>o;)hG.f(r,s=n[o++],t[s]);return r};var vG=Jt,pG=vG("document","documentElement"),gG=Vt,yG=jl,ob=Cv,mG=ts,bG=pG,$G=LE,wG=Fl,sb=">",ub="<",hf="prototype",cf="script",iS=wG("IE_PROTO"),Bc=function(){},nS=function(i){return ub+cf+sb+i+ub+"/"+cf+sb},lb=function(i){i.write(nS("")),i.close();var r=i.parentWindow.Object;return i=null,r},_G=function(){var i=$G("iframe"),r="java"+cf+":",e;return i.style.display="none",bG.appendChild(i),i.src=String(r),e=i.contentWindow.document,e.open(),e.write(nS("document.F=Object")),e.close(),e.F},Ks,yu=function(){try{Ks=new ActiveXObject("htmlfile")}catch{}yu=typeof document<"u"?document.domain&&Ks?lb(Ks):_G():lb(Ks);for(var i=ob.length;i--;)delete yu[hf][ob[i]];return yu()};mG[iS]=!0;var xa=Object.create||function(r,e){var t;return r!==null?(Bc[hf]=gG(r),t=new Bc,Bc[hf]=null,t[iS]=r):t=yu(),e===void 0?t:yG.f(t,e)},EG=ae,aS=!EG(function(){function i(){}return i.prototype.constructor=null,Object.getPrototypeOf(new i)!==i.prototype}),SG=Qe,OG=Xe,TG=At,IG=Fl,kG=aS,hb=IG("IE_PROTO"),df=Object,PG=df.prototype,Ll=kG?df.getPrototypeOf:function(i){var r=TG(i);if(SG(r,hb))return r[hb];var e=r.constructor;return OG(e)&&r instanceof e?e.prototype:r instanceof df?PG:null},xG=Pa,is=function(i,r,e,t){return t&&t.enumerable?i[r]=e:xG(i,r,e),i},CG=ae,AG=Xe,DG=Ze,RG=xa,cb=Ll,NG=is,MG=xe,ff=MG("iterator"),oS=!1,Cr,Fc,jc;[].keys&&(jc=[].keys(),"next"in jc?(Fc=cb(cb(jc)),Fc!==Object.prototype&&(Cr=Fc)):oS=!0);var BG=!DG(Cr)||CG(function(){var i={};return Cr[ff].call(i)!==i});BG?Cr={}:Cr=RG(Cr);AG(Cr[ff])||NG(Cr,ff,function(){return this});var sS={IteratorPrototype:Cr,BUGGY_SAFARI_ITERATORS:oS},FG=Dv,jG=un,LG=FG?{}.toString:function(){return"[object "+jG(this)+"]"},zG=Dv,HG=Ht.f,VG=Pa,WG=Qe,UG=LG,KG=xe,db=KG("toStringTag"),Ca=function(i,r,e,t){if(i){var n=e?i:i.prototype;WG(n,db)||HG(n,db,{configurable:!0,value:r}),t&&!zG&&VG(n,"toString",UG)}},Aa={},GG=sS.IteratorPrototype,qG=xa,YG=Go,XG=Ca,JG=Aa,ZG=function(){return this},QG=function(i,r,e,t){var n=r+" Iterator";return i.prototype=qG(GG,{next:YG(+!t,e)}),XG(i,n,!1,!0),JG[n]=ZG,i},eq=se,tq=sn,rq=function(i,r,e){try{return eq(tq(Object.getOwnPropertyDescriptor(i,r)[e]))}catch{}},iq=Xe,nq=String,aq=TypeError,oq=function(i){if(typeof i=="object"||iq(i))return i;throw new aq("Can't set "+nq(i)+" as a prototype")},sq=rq,uq=Vt,lq=oq,hq=Object.setPrototypeOf||("__proto__"in{}?function(){var i=!1,r={},e;try{e=sq(Object.prototype,"__proto__","set"),e(r,[]),i=r instanceof Array}catch{}return function(n,a){return uq(n),lq(a),i?e(n,a):n.__proto__=a,n}}():void 0),cq=q,dq=zt,fq=sG,vq=QG,pq=Ll,gq=Ca,fb=is,yq=xe,vb=Aa,mq=sS,bq=fq.PROPER,Gs=mq.BUGGY_SAFARI_ITERATORS,Lc=yq("iterator"),pb="keys",qs="values",gb="entries",$q=function(){return this},Mv=function(i,r,e,t,n,a,o){vq(e,r,t);var s=function(y){if(y===n&&d)return d;if(!Gs&&y&&y in h)return h[y];switch(y){case pb:return function(){return new e(this,y)};case qs:return function(){return new e(this,y)};case gb:return function(){return new e(this,y)}}return function(){return new e(this)}},u=r+" Iterator",l=!1,h=i.prototype,c=h[Lc]||h["@@iterator"]||n&&h[n],d=!Gs&&c||s(n),f=r==="Array"&&h.entries||c,v,p,g;if(f&&(v=pq(f.call(new i)),v!==Object.prototype&&v.next&&(gq(v,u,!0,!0),vb[u]=$q)),bq&&n===qs&&c&&c.name!==qs&&(l=!0,d=function(){return dq(c,this)}),n)if(p={values:s(qs),keys:a?d:s(pb),entries:s(gb)},o)for(g in p)(Gs||l||!(g in h))&&fb(h,g,p[g]);else cq({target:r,proto:!0,forced:Gs||l},p);return o&&h[Lc]!==d&&fb(h,Lc,d,{name:n}),vb[r]=d,p},Bv=function(i,r){return{value:i,done:r}},wq=WK.charAt,_q=Er,uS=ln,Eq=Mv,yb=Bv,lS="String Iterator",Sq=uS.set,Oq=uS.getterFor(lS);Eq(String,"String",function(i){Sq(this,{type:lS,string:_q(i),index:0})},function(){var r=Oq(this),e=r.string,t=r.index,n;return t>=e.length?yb(void 0,!0):(n=wq(e,t),r.index+=n.length,yb(n,!1))});var Tq=zt,mb=Vt,Iq=kv,hS=function(i,r,e){var t,n;mb(i);try{if(t=Iq(i,"return"),!t){if(r==="throw")throw e;return e}t=Tq(t,i)}catch(a){n=!0,t=a}if(r==="throw")throw e;if(n)throw t;return mb(t),e},kq=Vt,Pq=hS,xq=function(i,r,e,t){try{return t?r(kq(e)[0],e[1]):r(e)}catch(n){Pq(i,"throw",n)}},Cq=xe,Aq=Aa,Dq=Cq("iterator"),Rq=Array.prototype,cS=function(i){return i!==void 0&&(Aq.Array===i||Rq[Dq]===i)},Nq=se,Mq=Xe,vf=Pv,Bq=Nq(Function.toString);Mq(vf.inspectSource)||(vf.inspectSource=function(i){return Bq(i)});var Fq=vf.inspectSource,jq=se,Lq=ae,dS=Xe,zq=un,Hq=Jt,Vq=Fq,fS=function(){},Wq=[],vS=Hq("Reflect","construct"),Fv=/^\s*(?:class|function)\b/,Uq=jq(Fv.exec),Kq=!Fv.test(fS),La=function(r){if(!dS(r))return!1;try{return vS(fS,Wq,r),!0}catch{return!1}},pS=function(r){if(!dS(r))return!1;switch(zq(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Kq||!!Uq(Fv,Vq(r))}catch{return!0}};pS.sham=!0;var zl=!vS||Lq(function(){var i;return La(La.call)||!La(Object)||!La(function(){i=!0})||i})?pS:La,Gq=Rl,qq=Ht,Yq=Go,Da=function(i,r,e){var t=Gq(r);t in i?qq.f(i,t,Yq(0,e)):i[t]=e},Xq=un,bb=kv,Jq=Oa,Zq=Aa,Qq=xe,eY=Qq("iterator"),Hl=function(i){if(!Jq(i))return bb(i,eY)||bb(i,"@@iterator")||Zq[Xq(i)]},tY=zt,rY=sn,iY=Vt,nY=Ia,aY=Hl,oY=TypeError,gS=function(i,r){var e=arguments.length<2?aY(i):r;if(rY(e))return iY(tY(e,i));throw new oY(nY(i)+" is not iterable")},sY=Qo,uY=zt,lY=At,hY=xq,cY=cS,dY=zl,fY=Zt,$b=Da,vY=gS,pY=Hl,wb=Array,gY=function(r){var e=lY(r),t=dY(this),n=arguments.length,a=n>1?arguments[1]:void 0,o=a!==void 0;o&&(a=sY(a,n>2?arguments[2]:void 0));var s=pY(e),u=0,l,h,c,d,f,v;if(s&&!(this===wb&&cY(s)))for(d=vY(e,s),f=d.next,h=t?new this:[];!(c=uY(f,d)).done;u++)v=o?hY(d,a,[c.value,u],!0):c.value,$b(h,u,v);else for(l=fY(e),h=t?new this(l):wb(l);l>u;u++)v=o?a(e[u],u):e[u],$b(h,u,v);return h.length=u,h},yY=xe,yS=yY("iterator"),mS=!1;try{var mY=0,_b={next:function(){return{done:!!mY++}},return:function(){mS=!0}};_b[yS]=function(){return this},Array.from(_b,function(){throw 2})}catch{}var bY=function(i,r){try{if(!r&&!mS)return!1}catch{return!1}var e=!1;try{var t={};t[yS]=function(){return{next:function(){return{done:e=!0}}}},i(t)}catch{}return e},$Y=q,wY=gY,_Y=bY,EY=!_Y(function(i){Array.from(i)});$Y({target:"Array",stat:!0,forced:EY},{from:wY});var SY=oe,OY=SY.Array.from,TY=OY,bS=TY,IY=bS,hn=V(IY),kY=_r,Eb=Aa,$S=ln;Ht.f;var PY=Mv,Ys=Bv,wS="Array Iterator",xY=$S.set,CY=$S.getterFor(wS);PY(Array,"Array",function(i,r){xY(this,{type:wS,target:kY(i),index:0,kind:r})},function(){var i=CY(this),r=i.target,e=i.kind,t=i.index++;if(!r||t>=r.length)return i.target=void 0,Ys(void 0,!0);switch(e){case"keys":return Ys(t,!1);case"values":return Ys(r[t],!1)}return Ys([t,r[t]],!1)},"values");Eb.Arguments=Eb.Array;var AY=Hl,DY=AY,RY={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},NY=RY,MY=Pe,BY=un,FY=Pa,Sb=Aa,jY=xe,Ob=jY("toStringTag");for(var zc in NY){var Tb=MY[zc],Hc=Tb&&Tb.prototype;Hc&&BY(Hc)!==Ob&&FY(Hc,Ob,zc),Sb[zc]=Sb.Array}var LY=DY,zY=LY,HY=zY,VY=HY,WY=VY,UY=WY,_S=UY,ES=V(_S),KY=_S,cn=V(KY);function N(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")}var SS={exports:{}},GY=q,qY=Je,Ib=Ht.f;GY({target:"Object",stat:!0,forced:Object.defineProperty!==Ib,sham:!qY},{defineProperty:Ib});var YY=oe,OS=YY.Object,XY=SS.exports=function(r,e,t){return OS.defineProperty(r,e,t)};OS.defineProperty.sham&&(XY.sham=!0);var JY=SS.exports,ZY=JY,TS=ZY,QY=TS,eX=QY,tX=eX,rX=tX,iX=rX,Vl=V(iX),nX=Hr,dn=Array.isArray||function(r){return nX(r)==="Array"},aX=TypeError,oX=9007199254740991,jv=function(i){if(i>oX)throw aX("Maximum allowed index exceeded");return i},kb=dn,sX=zl,uX=Ze,lX=xe,hX=lX("species"),Pb=Array,cX=function(i){var r;return kb(i)&&(r=i.constructor,sX(r)&&(r===Pb||kb(r.prototype))?r=void 0:uX(r)&&(r=r[hX],r===null&&(r=void 0))),r===void 0?Pb:r},dX=cX,Lv=function(i,r){return new(dX(i))(r===0?0:r)},fX=ae,vX=xe,pX=Xo,gX=vX("species"),ns=function(i){return pX>=51||!fX(function(){var r=[],e=r.constructor={};return e[gX]=function(){return{foo:1}},r[i](Boolean).foo!==1})},yX=q,mX=ae,bX=dn,$X=Ze,wX=At,_X=Zt,xb=jv,Cb=Da,EX=Lv,SX=ns,OX=xe,TX=Xo,IS=OX("isConcatSpreadable"),IX=TX>=51||!mX(function(){var i=[];return i[IS]=!1,i.concat()[0]!==i}),kX=function(i){if(!$X(i))return!1;var r=i[IS];return r!==void 0?!!r:bX(i)},PX=!IX||!SX("concat");yX({target:"Array",proto:!0,arity:1,forced:PX},{concat:function(r){var e=wX(this),t=EX(e,0),n=0,a,o,s,u,l;for(a=-1,s=arguments.length;ag;g++)if((s||g in f)&&($=f[g],b=v($,g,d),i))if(r)m[g]=b;else if(b)switch(i){case 3:return!0;case 5:return $;case 6:return g;case 2:Rb(m,$)}else switch(i){case 4:return!1;case 7:Rb(m,$)}return a?-1:t||n?n:m}},wi={forEach:qr(0),map:qr(1),filter:qr(2),some:qr(3),every:qr(4),find:qr(5),findIndex:qr(6),filterReject:qr(7)},Ul=q,Kl=Pe,Hv=zt,rJ=se,ra=Je,ia=Ta,iJ=ae,Ge=Qe,nJ=Be,pf=Vt,Gl=_r,Vv=Rl,aJ=Er,gf=Go,mo=xa,AS=Ml,oJ=as,DS=Wl,sJ=rs,RS=Sa,NS=Ht,uJ=jl,MS=Cl,Nb=is,lJ=zv,Wv=ka,hJ=Fl,BS=ts,Mb=Dl,cJ=xe,dJ=os,fJ=Ce,vJ=CS,pJ=Ca,FS=ln,ql=wi.forEach,Ot=hJ("hidden"),Yl="Symbol",bo="prototype",gJ=FS.set,Bb=FS.getterFor(Yl),or=Object[bo],Fi=Kl.Symbol,Ga=Fi&&Fi[bo],yJ=Kl.RangeError,mJ=Kl.TypeError,Vc=Kl.QObject,jS=RS.f,ji=NS.f,LS=DS.f,bJ=MS.f,zS=rJ([].push),Fr=Wv("symbols"),ss=Wv("op-symbols"),$J=Wv("wks"),yf=!Vc||!Vc[bo]||!Vc[bo].findChild,HS=function(i,r,e){var t=jS(or,r);t&&delete or[r],ji(i,r,e),t&&i!==or&&ji(or,r,t)},mf=ra&&iJ(function(){return mo(ji({},"a",{get:function(){return ji(this,"a",{value:7}).a}})).a!==7})?HS:ji,Wc=function(i,r){var e=Fr[i]=mo(Ga);return gJ(e,{type:Yl,tag:i,description:r}),ra||(e.description=r),e},Xl=function(r,e,t){r===or&&Xl(ss,e,t),pf(r);var n=Vv(e);return pf(t),Ge(Fr,n)?(t.enumerable?(Ge(r,Ot)&&r[Ot][n]&&(r[Ot][n]=!1),t=mo(t,{enumerable:gf(0,!1)})):(Ge(r,Ot)||ji(r,Ot,gf(1,{})),r[Ot][n]=!0),mf(r,n,t)):ji(r,n,t)},Uv=function(r,e){pf(r);var t=Gl(e),n=AS(t).concat(KS(t));return ql(n,function(a){(!ra||Hv(VS,t,a))&&Xl(r,a,t[a])}),r},wJ=function(r,e){return e===void 0?mo(r):Uv(mo(r),e)},VS=function(r){var e=Vv(r),t=Hv(bJ,this,e);return this===or&&Ge(Fr,e)&&!Ge(ss,e)?!1:t||!Ge(this,e)||!Ge(Fr,e)||Ge(this,Ot)&&this[Ot][e]?t:!0},WS=function(r,e){var t=Gl(r),n=Vv(e);if(!(t===or&&Ge(Fr,n)&&!Ge(ss,n))){var a=jS(t,n);return a&&Ge(Fr,n)&&!(Ge(t,Ot)&&t[Ot][n])&&(a.enumerable=!0),a}},US=function(r){var e=LS(Gl(r)),t=[];return ql(e,function(n){!Ge(Fr,n)&&!Ge(BS,n)&&zS(t,n)}),t},KS=function(i){var r=i===or,e=LS(r?ss:Gl(i)),t=[];return ql(e,function(n){Ge(Fr,n)&&(!r||Ge(or,n))&&zS(t,Fr[n])}),t};ia||(Fi=function(){if(nJ(Ga,this))throw new mJ("Symbol is not a constructor");var r=!arguments.length||arguments[0]===void 0?void 0:aJ(arguments[0]),e=Mb(r),t=function(n){this===or&&Hv(t,ss,n),Ge(this,Ot)&&Ge(this[Ot],e)&&(this[Ot][e]=!1);var a=gf(1,n);try{mf(this,e,a)}catch(o){if(!(o instanceof yJ))throw o;HS(this,e,a)}};return ra&&yf&&mf(or,e,{configurable:!0,set:t}),Wc(e,r)},Ga=Fi[bo],Nb(Ga,"toString",function(){return Bb(this).tag}),Nb(Fi,"withoutSetter",function(i){return Wc(Mb(i),i)}),MS.f=VS,NS.f=Xl,uJ.f=Uv,RS.f=WS,oJ.f=DS.f=US,sJ.f=KS,dJ.f=function(i){return Wc(cJ(i),i)},ra&&lJ(Ga,"description",{configurable:!0,get:function(){return Bb(this).description}}));Ul({global:!0,constructor:!0,wrap:!0,forced:!ia,sham:!ia},{Symbol:Fi});ql(AS($J),function(i){fJ(i)});Ul({target:Yl,stat:!0,forced:!ia},{useSetter:function(){yf=!0},useSimple:function(){yf=!1}});Ul({target:"Object",stat:!0,forced:!ia,sham:!ra},{create:wJ,defineProperty:Xl,defineProperties:Uv,getOwnPropertyDescriptor:WS});Ul({target:"Object",stat:!0,forced:!ia},{getOwnPropertyNames:US});vJ();pJ(Fi,Yl);BS[Ot]=!0;var _J=Ta,GS=_J&&!!Symbol.for&&!!Symbol.keyFor,EJ=q,SJ=Jt,OJ=Qe,TJ=Er,qS=ka,IJ=GS,Uc=qS("string-to-symbol-registry"),kJ=qS("symbol-to-string-registry");EJ({target:"Symbol",stat:!0,forced:!IJ},{for:function(i){var r=TJ(i);if(OJ(Uc,r))return Uc[r];var e=SJ("Symbol")(r);return Uc[r]=e,kJ[e]=r,e}});var PJ=q,xJ=Qe,CJ=Jo,AJ=Ia,DJ=ka,RJ=GS,Fb=DJ("symbol-to-string-registry");PJ({target:"Symbol",stat:!0,forced:!RJ},{keyFor:function(r){if(!CJ(r))throw new TypeError(AJ(r)+" is not a symbol");if(xJ(Fb,r))return Fb[r]}});var NJ=se,jb=dn,MJ=Xe,Lb=Hr,BJ=Er,zb=NJ([].push),FJ=function(i){if(MJ(i))return i;if(jb(i)){for(var r=i.length,e=[],t=0;ti.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?arguments[1]:void 0)}});var ute=Qe,lte=ute("Array").map,hte=Me,cte=lte,Jc=Array.prototype,dte=function(i){var r=i.map;return i===Jc||hte(Jc,i)&&r===Jc.map?cte:r},fte=dte,vte=fte,pte=vte,na=V(pte),gte=q,yte=Ct,dO=Ml,mte=ne,bte=mte(function(){dO(1)});gte({target:"Object",stat:!0,forced:bte},{keys:function(r){return dO(yte(r))}});var $te=ae,wte=$te.Object.keys,_te=wte,Ete=_te,Ste=Ete,Oe=V(Ste),Ote=q,Tte=oe,fO=Date,Ite=Tte(fO.prototype.getTime);Ote({target:"Date",stat:!0},{now:function(){return Ite(new fO)}});var kte=ae,Pte=kte.Date.now,xte=Pte,Cte=xte,Ate=Cte,Uu=V(Ate),Dte=ne,Ra=function(i,r){var e=[][i];return!!e&&Dte(function(){e.call(null,r||function(){return 1},1)})},Rte=mi.forEach,Nte=Ra,Mte=Nte("forEach"),Bte=Mte?[].forEach:function(r){return Rte(this,r,arguments.length>1?arguments[1]:void 0)},Fte=q,n1=Bte;Fte({target:"Array",proto:!0,forced:[].forEach!==n1},{forEach:n1});var jte=Qe,Lte=jte("Array").forEach,zte=Lte,Hte=zte,Vte=un,Wte=Ze,Ute=Me,Kte=Hte,Zc=Array.prototype,Gte={DOMTokenList:!0,NodeList:!0},qte=function(i){var r=i.forEach;return i===Zc||Ute(Zc,i)&&r===Zc.forEach||Wte(Gte,Vte(i))?Kte:r},Yte=qte,ve=V(Yte),Xte=q,Jte=oe,Zte=dn,Qte=Jte([].reverse),a1=[1,2];Xte({target:"Array",proto:!0,forced:String(a1)===String(a1.reverse())},{reverse:function(){return Zte(this)&&(this.length=this.length),Qte(this)}});var ere=Qe,tre=ere("Array").reverse,rre=Me,ire=tre,Qc=Array.prototype,nre=function(i){var r=i.reverse;return i===Qc||rre(Qc,i)&&r===Qc.reverse?ire:r},are=nre,ore=are,sre=ore,Li=V(sre),o1=Ia,ure=TypeError,vO=function(i,r){if(!delete i[r])throw new ure("Cannot delete property "+o1(r)+" of "+o1(i))},lre=q,hre=Ct,cre=es,dre=Nl,fre=Zt,vre=uO,pre=jv,gre=Lv,yre=Da,ed=vO,mre=ns,bre=mre("splice"),$re=Math.max,wre=Math.min;lre({target:"Array",proto:!0,forced:!bre},{splice:function(r,e){var t=hre(this),n=fre(t),a=cre(r,n),o=arguments.length,s,u,l,h,d,c;for(o===0?s=u=0:o===1?(s=0,u=n-a):(s=o-2,u=wre($re(dre(e),0),n-a)),pre(n+s-u),l=gre(t,u),h=0;hn-u+s;h--)ed(t,h-1)}else if(s>u)for(h=n-u;h>a;h--)d=h+u-1,c=h+s-1,d in t?t[c]=t[d]:ed(t,c);for(h=0;h1?arguments[1]:void 0)}});var Rre=Qe,Nre=Rre("Array").includes,Mre=Je,Bre=Hr,Fre=xe,jre=Fre("match"),Lre=function(i){var r;return Mre(i)&&((r=i[jre])!==void 0?!!r:Bre(i)==="RegExp")},zre=Lre,Hre=TypeError,Vre=function(i){if(zre(i))throw new Hre("The method doesn't accept regular expressions");return i},Wre=xe,Ure=Wre("match"),Kre=function(i){var r=/./;try{"/./"[i](r)}catch{try{return r[Ure]=!1,"/./"[i](r)}catch{}}return!1},Gre=q,qre=oe,Yre=Vre,Xre=qo,s1=_r,Jre=Kre,Zre=qre("".indexOf);Gre({target:"String",proto:!0,forced:!Jre("includes")},{includes:function(r){return!!~Zre(s1(Xre(this)),s1(Yre(r)),arguments.length>1?arguments[1]:void 0)}});var Qre=Qe,eie=Qre("String").includes,u1=Me,tie=Nre,rie=eie,rd=Array.prototype,id=String.prototype,iie=function(i){var r=i.includes;return i===rd||u1(rd,i)&&r===rd.includes?tie:typeof i=="string"||i===id||u1(id,i)&&r===id.includes?rie:r},nie=iie,aie=nie,oie=aie,si=V(oie),sie=q,uie=ne,lie=Ct,pO=Ll,hie=aS,cie=uie(function(){pO(1)});sie({target:"Object",stat:!0,forced:cie,sham:!hie},{getPrototypeOf:function(r){return pO(lie(r))}});var die=ae,fie=die.Object.getPrototypeOf,vie=fie,gO=vie,pie=gO,l1=V(pie),gie=q,yie=mi.filter,mie=ns,bie=mie("filter");gie({target:"Array",proto:!0,forced:!bie},{filter:function(r){return yie(this,r,arguments.length>1?arguments[1]:void 0)}});var $ie=Qe,wie=$ie("Array").filter,_ie=Me,Eie=wie,nd=Array.prototype,Sie=function(i){var r=i.filter;return i===nd||_ie(nd,i)&&r===nd.filter?Eie:r},Oie=Sie,Tie=Oie,Iie=Tie,Ot=V(Iie),qv=` -\v\f\r                 \u2028\u2029\uFEFF`,kie=oe,Pie=qo,xie=_r,$f=qv,h1=kie("".replace),Cie=RegExp("^["+$f+"]+"),Aie=RegExp("(^|[^"+$f+"])["+$f+"]+$"),ad=function(i){return function(r){var e=xie(Pie(r));return i&1&&(e=h1(e,Cie,"")),i&2&&(e=h1(e,Aie,"$1")),e}},yO={start:ad(1),end:ad(2),trim:ad(3)},mO=Pe,Die=ne,Rie=oe,Nie=_r,Mie=yO.trim,c1=qv,eo=mO.parseInt,d1=mO.Symbol,f1=d1&&d1.iterator,bO=/^[+-]?0x/i,Bie=Rie(bO.exec),Fie=eo(c1+"08")!==8||eo(c1+"0x16")!==22||f1&&!Die(function(){eo(Object(f1))}),jie=Fie?function(r,e){var t=Mie(Nie(r));return eo(t,e>>>0||(Bie(bO,t)?16:10))}:eo,Lie=q,v1=jie;Lie({global:!0,forced:parseInt!==v1},{parseInt:v1});var zie=ae,Hie=zie.parseInt,Vie=Hie,Wie=Vie,Uie=Wie,nr=V(Uie),Kie=q,Gie=Iv,qie=xv.indexOf,Yie=Ra,wf=Gie([].indexOf),$O=!!wf&&1/wf([1],1,-0)<0,Xie=$O||!Yie("indexOf");Kie({target:"Array",proto:!0,forced:Xie},{indexOf:function(r){var e=arguments.length>1?arguments[1]:void 0;return $O?wf(this,r,e)||0:qie(this,r,e)}});var Jie=Qe,Zie=Jie("Array").indexOf,Qie=Me,ene=Zie,od=Array.prototype,tne=function(i){var r=i.indexOf;return i===od||Qie(od,i)&&r===od.indexOf?ene:r},rne=tne,ine=rne,nne=ine,ie=V(nne),ane=q,one=Xe,sne=xa;ane({target:"Object",stat:!0,sham:!one},{create:sne});var une=ae,lne=une.Object,hne=function(r,e){return lne.create(r,e)},cne=hne,wO=cne,dne=wO,zi=V(dne),_f=ae,fne=Ko;_f.JSON||(_f.JSON={stringify:JSON.stringify});var vne=function(r,e,t){return fne(_f.JSON.stringify,null,arguments)},pne=vne,gne=pne,yne=gne,ls=V(yne),mne=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",bne=TypeError,$ne=function(i,r){if(ie,o=_ne(t)?t:Ine(t),s=a?One(arguments,e):[],u=a?function(){wne(o,this,s)}:o;return r?i(u,n):i(u)}:i},Pne=q,SO=Pe,xne=EO,p1=xne(SO.setInterval,!0);Pne({global:!0,bind:!0,forced:SO.setInterval!==p1},{setInterval:p1});var Cne=q,OO=Pe,Ane=EO,g1=Ane(OO.setTimeout,!0);Cne({global:!0,bind:!0,forced:OO.setTimeout!==g1},{setTimeout:g1});var Dne=ae,Rne=Dne.setTimeout,Nne=Rne,yr=V(Nne),Mne=Ct,y1=es,Bne=Zt,Fne=function(r){for(var e=Mne(this),t=Bne(e),n=arguments.length,a=y1(n>1?arguments[1]:void 0,t),o=n>2?arguments[2]:void 0,s=o===void 0?t:y1(o,t);s>a;)e[a++]=r;return e},jne=q,Lne=Fne;jne({target:"Array",proto:!0},{fill:Lne});var zne=Qe,Hne=zne("Array").fill,Vne=Me,Wne=Hne,sd=Array.prototype,Une=function(i){var r=i.fill;return i===sd||Vne(sd,i)&&r===sd.fill?Wne:r},Kne=Une,Gne=Kne,qne=Gne,hs=V(qne);/*! Hammer.JS - v2.0.17-rc - 2019-12-16 +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fr(i){return Bee(i)||Fee(i)||cO(i)||jee()}var Lee=eO,_i=V(Lee),zee=et,Hee=zee("Array").concat,Vee=Be,Wee=Hee,Xc=Array.prototype,Uee=function(i){var r=i.concat;return i===Xc||Vee(Xc,i)&&r===Xc.concat?Wee:r},Kee=Uee,Gee=Kee,qee=Gee,Gv=V(qee),Yee=lO,it=V(Yee),Xee=Jt,Jee=se,Zee=as,Qee=rs,ete=Vt,tte=Jee([].concat),rte=Xee("Reflect","ownKeys")||function(r){var e=Zee.f(ete(r)),t=Qee.f;return t?tte(e,t(r)):e},ite=oO,he=V(ite),nte=q,ate=wi.map,ote=ns,ste=ote("map");nte({target:"Array",proto:!0,forced:!ste},{map:function(r){return ate(this,r,arguments.length>1?arguments[1]:void 0)}});var ute=et,lte=ute("Array").map,hte=Be,cte=lte,Jc=Array.prototype,dte=function(i){var r=i.map;return i===Jc||hte(Jc,i)&&r===Jc.map?cte:r},fte=dte,vte=fte,pte=vte,na=V(pte),gte=q,yte=At,dO=Ml,mte=ae,bte=mte(function(){dO(1)});gte({target:"Object",stat:!0,forced:bte},{keys:function(r){return dO(yte(r))}});var $te=oe,wte=$te.Object.keys,_te=wte,Ete=_te,Ste=Ete,Oe=V(Ste),Ote=q,Tte=se,fO=Date,Ite=Tte(fO.prototype.getTime);Ote({target:"Date",stat:!0},{now:function(){return Ite(new fO)}});var kte=oe,Pte=kte.Date.now,xte=Pte,Cte=xte,Ate=Cte,Uu=V(Ate),Dte=ae,Ra=function(i,r){var e=[][i];return!!e&&Dte(function(){e.call(null,r||function(){return 1},1)})},Rte=wi.forEach,Nte=Ra,Mte=Nte("forEach"),Bte=Mte?[].forEach:function(r){return Rte(this,r,arguments.length>1?arguments[1]:void 0)},Fte=q,n1=Bte;Fte({target:"Array",proto:!0,forced:[].forEach!==n1},{forEach:n1});var jte=et,Lte=jte("Array").forEach,zte=Lte,Hte=zte,Vte=un,Wte=Qe,Ute=Be,Kte=Hte,Zc=Array.prototype,Gte={DOMTokenList:!0,NodeList:!0},qte=function(i){var r=i.forEach;return i===Zc||Ute(Zc,i)&&r===Zc.forEach||Wte(Gte,Vte(i))?Kte:r},Yte=qte,fe=V(Yte),Xte=q,Jte=se,Zte=dn,Qte=Jte([].reverse),a1=[1,2];Xte({target:"Array",proto:!0,forced:String(a1)===String(a1.reverse())},{reverse:function(){return Zte(this)&&(this.length=this.length),Qte(this)}});var ere=et,tre=ere("Array").reverse,rre=Be,ire=tre,Qc=Array.prototype,nre=function(i){var r=i.reverse;return i===Qc||rre(Qc,i)&&r===Qc.reverse?ire:r},are=nre,ore=are,sre=ore,Li=V(sre),o1=Ia,ure=TypeError,vO=function(i,r){if(!delete i[r])throw new ure("Cannot delete property "+o1(r)+" of "+o1(i))},lre=q,hre=At,cre=es,dre=Nl,fre=Zt,vre=uO,pre=jv,gre=Lv,yre=Da,ed=vO,mre=ns,bre=mre("splice"),$re=Math.max,wre=Math.min;lre({target:"Array",proto:!0,forced:!bre},{splice:function(r,e){var t=hre(this),n=fre(t),a=cre(r,n),o=arguments.length,s,u,l,h,c,d;for(o===0?s=u=0:o===1?(s=0,u=n-a):(s=o-2,u=wre($re(dre(e),0),n-a)),pre(n+s-u),l=gre(t,u),h=0;hn-u+s;h--)ed(t,h-1)}else if(s>u)for(h=n-u;h>a;h--)c=h+u-1,d=h+s-1,c in t?t[d]=t[c]:ed(t,d);for(h=0;h1?arguments[1]:void 0)}});var Rre=et,Nre=Rre("Array").includes,Mre=Ze,Bre=Hr,Fre=xe,jre=Fre("match"),Lre=function(i){var r;return Mre(i)&&((r=i[jre])!==void 0?!!r:Bre(i)==="RegExp")},zre=Lre,Hre=TypeError,Vre=function(i){if(zre(i))throw new Hre("The method doesn't accept regular expressions");return i},Wre=xe,Ure=Wre("match"),Kre=function(i){var r=/./;try{"/./"[i](r)}catch{try{return r[Ure]=!1,"/./"[i](r)}catch{}}return!1},Gre=q,qre=se,Yre=Vre,Xre=qo,s1=Er,Jre=Kre,Zre=qre("".indexOf);Gre({target:"String",proto:!0,forced:!Jre("includes")},{includes:function(r){return!!~Zre(s1(Xre(this)),s1(Yre(r)),arguments.length>1?arguments[1]:void 0)}});var Qre=et,eie=Qre("String").includes,u1=Be,tie=Nre,rie=eie,rd=Array.prototype,id=String.prototype,iie=function(i){var r=i.includes;return i===rd||u1(rd,i)&&r===rd.includes?tie:typeof i=="string"||i===id||u1(id,i)&&r===id.includes?rie:r},nie=iie,aie=nie,oie=aie,hi=V(oie),sie=q,uie=ae,lie=At,pO=Ll,hie=aS,cie=uie(function(){pO(1)});sie({target:"Object",stat:!0,forced:cie,sham:!hie},{getPrototypeOf:function(r){return pO(lie(r))}});var die=oe,fie=die.Object.getPrototypeOf,vie=fie,gO=vie,pie=gO,l1=V(pie),gie=q,yie=wi.filter,mie=ns,bie=mie("filter");gie({target:"Array",proto:!0,forced:!bie},{filter:function(r){return yie(this,r,arguments.length>1?arguments[1]:void 0)}});var $ie=et,wie=$ie("Array").filter,_ie=Be,Eie=wie,nd=Array.prototype,Sie=function(i){var r=i.filter;return i===nd||_ie(nd,i)&&r===nd.filter?Eie:r},Oie=Sie,Tie=Oie,Iie=Tie,Tt=V(Iie),qv=` +\v\f\r                 \u2028\u2029\uFEFF`,kie=se,Pie=qo,xie=Er,$f=qv,h1=kie("".replace),Cie=RegExp("^["+$f+"]+"),Aie=RegExp("(^|[^"+$f+"])["+$f+"]+$"),ad=function(i){return function(r){var e=xie(Pie(r));return i&1&&(e=h1(e,Cie,"")),i&2&&(e=h1(e,Aie,"$1")),e}},yO={start:ad(1),end:ad(2),trim:ad(3)},mO=Pe,Die=ae,Rie=se,Nie=Er,Mie=yO.trim,c1=qv,eo=mO.parseInt,d1=mO.Symbol,f1=d1&&d1.iterator,bO=/^[+-]?0x/i,Bie=Rie(bO.exec),Fie=eo(c1+"08")!==8||eo(c1+"0x16")!==22||f1&&!Die(function(){eo(Object(f1))}),jie=Fie?function(r,e){var t=Mie(Nie(r));return eo(t,e>>>0||(Bie(bO,t)?16:10))}:eo,Lie=q,v1=jie;Lie({global:!0,forced:parseInt!==v1},{parseInt:v1});var zie=oe,Hie=zie.parseInt,Vie=Hie,Wie=Vie,Uie=Wie,nr=V(Uie),Kie=q,Gie=Iv,qie=xv.indexOf,Yie=Ra,wf=Gie([].indexOf),$O=!!wf&&1/wf([1],1,-0)<0,Xie=$O||!Yie("indexOf");Kie({target:"Array",proto:!0,forced:Xie},{indexOf:function(r){var e=arguments.length>1?arguments[1]:void 0;return $O?wf(this,r,e)||0:qie(this,r,e)}});var Jie=et,Zie=Jie("Array").indexOf,Qie=Be,ene=Zie,od=Array.prototype,tne=function(i){var r=i.indexOf;return i===od||Qie(od,i)&&r===od.indexOf?ene:r},rne=tne,ine=rne,nne=ine,ne=V(nne),ane=q,one=Je,sne=xa;ane({target:"Object",stat:!0,sham:!one},{create:sne});var une=oe,lne=une.Object,hne=function(r,e){return lne.create(r,e)},cne=hne,wO=cne,dne=wO,zi=V(dne),_f=oe,fne=Ko;_f.JSON||(_f.JSON={stringify:JSON.stringify});var vne=function(r,e,t){return fne(_f.JSON.stringify,null,arguments)},pne=vne,gne=pne,yne=gne,ls=V(yne),mne=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",bne=TypeError,$ne=function(i,r){if(ie,o=_ne(t)?t:Ine(t),s=a?One(arguments,e):[],u=a?function(){wne(o,this,s)}:o;return r?i(u,n):i(u)}:i},Pne=q,SO=Pe,xne=EO,p1=xne(SO.setInterval,!0);Pne({global:!0,bind:!0,forced:SO.setInterval!==p1},{setInterval:p1});var Cne=q,OO=Pe,Ane=EO,g1=Ane(OO.setTimeout,!0);Cne({global:!0,bind:!0,forced:OO.setTimeout!==g1},{setTimeout:g1});var Dne=oe,Rne=Dne.setTimeout,Nne=Rne,mr=V(Nne),Mne=At,y1=es,Bne=Zt,Fne=function(r){for(var e=Mne(this),t=Bne(e),n=arguments.length,a=y1(n>1?arguments[1]:void 0,t),o=n>2?arguments[2]:void 0,s=o===void 0?t:y1(o,t);s>a;)e[a++]=r;return e},jne=q,Lne=Fne;jne({target:"Array",proto:!0},{fill:Lne});var zne=et,Hne=zne("Array").fill,Vne=Be,Wne=Hne,sd=Array.prototype,Une=function(i){var r=i.fill;return i===sd||Vne(sd,i)&&r===sd.fill?Wne:r},Kne=Une,Gne=Kne,qne=Gne,hs=V(qne);/*! Hammer.JS - v2.0.17-rc - 2019-12-16 * http://naver.github.io/egjs * * Forked By Naver egjs * Copyright (c) hammerjs - * Licensed under the MIT license */function ur(){return ur=Object.assign||function(i){for(var r=1;r"u"?{style:{}}:document.createElement("div"),Xne="function",Hn=Math.round,Xi=Math.abs,Yv=Date.now;function Jl(i,r){for(var e,t,n=r[0].toUpperCase()+r.slice(1),a=0;a"u"?Dr={}:Dr=window;var TO=Jl(Yne.style,"touchAction"),IO=TO!==void 0;function Jne(){if(!IO)return!1;var i={},r=Dr.CSS&&Dr.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){return i[e]=r?Dr.CSS.supports("touch-action",e):!0}),i}var kO="compute",PO="auto",Sf="manipulation",Hi="none",$o="pan-x",wo="pan-y",Zs=Jne(),Zne=/mobile|tablet|ip(ad|hone|od)|android/i,xO="ontouchstart"in Dr,Qne=Jl(Dr,"PointerEvent")!==void 0,eae=xO&&Zne.test(navigator.userAgent),cs="touch",tae="pen",Xv="mouse",rae="kinect",iae=25,gt=1,fn=2,Le=4,It=8,Ku=1,ds=2,fs=4,vs=8,aa=16,mr=ds|fs,Vi=vs|aa,CO=mr|Vi,AO=["x","y"],Gu=["clientX","clientY"];function Rr(i,r,e){var t;if(i)if(i.forEach)i.forEach(r,e);else if(i.length!==void 0)for(t=0;t-1}function nae(i){if(Ai(i,Hi))return Hi;var r=Ai(i,$o),e=Ai(i,wo);return r&&e?Hi:r||e?r?$o:wo:Ai(i,Sf)?Sf:PO}var DO=function(){function i(e,t){this.manager=e,this.set(t)}var r=i.prototype;return r.set=function(t){t===kO&&(t=this.compute()),IO&&this.manager.element.style&&Zs[t]&&(this.manager.element.style[TO]=t),this.actions=t.toLowerCase().trim()},r.update=function(){this.set(this.manager.options.touchAction)},r.compute=function(){var t=[];return Rr(this.manager.recognizers,function(n){Zl(n.options.enable,[n])&&(t=t.concat(n.getTouchAction()))}),nae(t.join(" "))},r.preventDefaults=function(t){var n=t.srcEvent,a=t.offsetDirection;if(this.manager.session.prevented){n.preventDefault();return}var o=this.actions,s=Ai(o,Hi)&&!Zs[Hi],u=Ai(o,wo)&&!Zs[wo],l=Ai(o,$o)&&!Zs[$o];if(s){var h=t.pointers.length===1,d=t.distance<2,c=t.deltaTime<250;if(h&&d&&c)return}if(!(l&&u)&&(s||u&&a&mr||l&&a&Vi))return this.preventSrc(n)},r.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},i}();function Jv(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}function RO(i){var r=i.length;if(r===1)return{x:Hn(i[0].clientX),y:Hn(i[0].clientY)};for(var e=0,t=0,n=0;n=Xi(r)?i<0?ds:fs:r<0?vs:aa}function aae(i,r){var e=r.center,t=i.offsetDelta||{},n=i.prevDelta||{},a=i.prevInput||{};(r.eventType===gt||a.eventType===Le)&&(n=i.prevDelta={x:a.deltaX||0,y:a.deltaY||0},t=i.offsetDelta={x:e.x,y:e.y}),r.deltaX=n.x+(e.x-t.x),r.deltaY=n.y+(e.y-t.y)}function MO(i,r,e){return{x:r/i||0,y:e/i||0}}function oae(i,r){return qu(r[0],r[1],Gu)/qu(i[0],i[1],Gu)}function sae(i,r){return Of(r[1],r[0],Gu)+Of(i[1],i[0],Gu)}function uae(i,r){var e=i.lastInterval||r,t=r.timeStamp-e.timeStamp,n,a,o,s;if(r.eventType!==It&&(t>iae||e.velocity===void 0)){var u=r.deltaX-e.deltaX,l=r.deltaY-e.deltaY,h=MO(t,u,l);a=h.x,o=h.y,n=Xi(h.x)>Xi(h.y)?h.x:h.y,s=NO(u,l),i.lastInterval=r}else n=e.velocity,a=e.velocityX,o=e.velocityY,s=e.direction;r.velocity=n,r.velocityX=a,r.velocityY=o,r.direction=s}function lae(i,r){var e=i.session,t=r.pointers,n=t.length;e.firstInput||(e.firstInput=b1(r)),n>1&&!e.firstMultiple?e.firstMultiple=b1(r):n===1&&(e.firstMultiple=!1);var a=e.firstInput,o=e.firstMultiple,s=o?o.center:a.center,u=r.center=RO(t);r.timeStamp=Yv(),r.deltaTime=r.timeStamp-a.timeStamp,r.angle=Of(s,u),r.distance=qu(s,u),aae(e,r),r.offsetDirection=NO(r.deltaX,r.deltaY);var l=MO(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=l.x,r.overallVelocityY=l.y,r.overallVelocity=Xi(l.x)>Xi(l.y)?l.x:l.y,r.scale=o?oae(o.pointers,t):1,r.rotation=o?sae(o.pointers,t):0,r.maxPointers=e.prevInput?r.pointers.length>e.prevInput.maxPointers?r.pointers.length:e.prevInput.maxPointers:r.pointers.length,uae(e,r);var h=i.element,d=r.srcEvent,c;d.composedPath?c=d.composedPath()[0]:d.path?c=d.path[0]:c=d.target,Jv(c,h)&&(h=c),r.target=h}function hae(i,r,e){var t=e.pointers.length,n=e.changedPointers.length,a=r>&&t-n===0,o=r&(Le|It)&&t-n===0;e.isFirst=!!a,e.isFinal=!!o,a&&(i.session={}),e.eventType=r,lae(i,e),i.emit("hammer.input",e),i.recognize(e),i.session.prevInput=e}function _o(i){return i.trim().split(/\s+/g)}function to(i,r,e){Rr(_o(r),function(t){i.addEventListener(t,e,!1)})}function ro(i,r,e){Rr(_o(r),function(t){i.removeEventListener(t,e,!1)})}function $1(i){var r=i.ownerDocument||i;return r.defaultView||r.parentWindow||window}var Na=function(){function i(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(a){Zl(e.options.enable,[e])&&n.handler(a)},this.init()}var r=i.prototype;return r.handler=function(){},r.init=function(){this.evEl&&to(this.element,this.evEl,this.domHandler),this.evTarget&&to(this.target,this.evTarget,this.domHandler),this.evWin&&to($1(this.element),this.evWin,this.domHandler)},r.destroy=function(){this.evEl&&ro(this.element,this.evEl,this.domHandler),this.evTarget&&ro(this.target,this.evTarget,this.domHandler),this.evWin&&ro($1(this.element),this.evWin,this.domHandler)},i}();function Ji(i,r,e){if(i.indexOf&&!e)return i.indexOf(r);for(var t=0;tu[r]}):t=t.sort()),t}var fae={touchstart:gt,touchmove:fn,touchend:Le,touchcancel:It},vae="touchstart touchmove touchend touchcancel",Qv=function(i){Qt(r,i);function r(){var t;return r.prototype.evTarget=vae,t=i.apply(this,arguments)||this,t.targetIds={},t}var e=r.prototype;return e.handler=function(n){var a=fae[n.type],o=pae.call(this,n,a);o&&this.callback(this.manager,a,{pointers:o[0],changedPointers:o[1],pointerType:cs,srcEvent:n})},r}(Na);function pae(i,r){var e=Eo(i.touches),t=this.targetIds;if(r&(gt|fn)&&e.length===1)return t[e[0].identifier]=!0,[e,e];var n,a,o=Eo(i.changedTouches),s=[],u=this.target;if(a=e.filter(function(l){return Jv(l.target,u)}),r===gt)for(n=0;n-1&&n.splice(s,1)};setTimeout(a,bae)}}function $ae(i,r){i>?(this.primaryTouch=r.changedPointers[0].identifier,_1.call(this,r)):i&(Le|It)&&_1.call(this,r)}function wae(i){for(var r=i.srcEvent.clientX,e=i.srcEvent.clientY,t=0;t-1&&this.requireFail.splice(n,1),this},r.hasRequireFailures=function(){return this.requireFail.length>0},r.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},r.emit=function(t){var n=this,a=this.state;function o(s){n.manager.emit(s,t)}a=ui&&o(n.options.event+E1(a))},r.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=vr},r.canEmit=function(){for(var t=0;ta.threshold&&u&a.direction},e.attrTest=function(n){return sa.prototype.attrTest.call(this,n)&&(this.state&Yt||!(this.state&Yt)&&this.directionTest(n))},e.emit=function(n){this.pX=n.deltaX,this.pY=n.deltaY;var a=zO(n.direction);a&&(n.additionalEvent=this.options.event+a),i.prototype.emit.call(this,n)},r}(sa),HO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"swipe",threshold:10,velocity:.3,direction:mr|Vi,pointers:1},t))||this}var e=r.prototype;return e.getTouchAction=function(){return tp.prototype.getTouchAction.call(this)},e.attrTest=function(n){var a=this.options.direction,o;return a&(mr|Vi)?o=n.overallVelocity:a&mr?o=n.overallVelocityX:a&Vi&&(o=n.overallVelocityY),i.prototype.attrTest.call(this,n)&&a&n.offsetDirection&&n.distance>this.options.threshold&&n.maxPointers===this.options.pointers&&Xi(o)>this.options.velocity&&n.eventType&Le},e.emit=function(n){var a=zO(n.offsetDirection);a&&this.manager.emit(this.options.event+a,n),this.manager.emit(this.options.event,n)},r}(sa),VO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"pinch",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Hi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.scale-1)>this.options.threshold||this.state&Yt)},e.emit=function(n){if(n.scale!==1){var a=n.scale<1?"in":"out";n.additionalEvent=this.options.event+a}i.prototype.emit.call(this,n)},r}(sa),WO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"rotate",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Hi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.rotation)>this.options.threshold||this.state&Yt)},r}(sa),UO=function(i){Qt(r,i);function r(t){var n;return t===void 0&&(t={}),n=i.call(this,ur({event:"press",pointers:1,time:251,threshold:9},t))||this,n._timer=null,n._input=null,n}var e=r.prototype;return e.getTouchAction=function(){return[PO]},e.process=function(n){var a=this,o=this.options,s=n.pointers.length===o.pointers,u=n.distanceo.time;if(this._input=n,!u||!s||n.eventType&(Le|It)&&!l)this.reset();else if(n.eventType>)this.reset(),this._timer=setTimeout(function(){a.state=Nr,a.tryEmit()},o.time);else if(n.eventType&Le)return Nr;return vr},e.reset=function(){clearTimeout(this._timer)},e.emit=function(n){this.state===Nr&&(n&&n.eventType&Le?this.manager.emit(this.options.event+"up",n):(this._input.timeStamp=Yv(),this.manager.emit(this.options.event,this._input)))},r}(ps),KO={domEvents:!1,touchAction:kO,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},S1=[[WO,{enable:!1}],[VO,{enable:!1},["rotate"]],[HO,{direction:mr}],[tp,{direction:mr},["swipe"]],[Tf],[Tf,{event:"doubletap",taps:2},["tap"]],[UO]],Oae=1,O1=2;function T1(i,r){var e=i.element;if(e.style){var t;Rr(i.options.cssProps,function(n,a){t=Jl(e.style,a),r?(i.oldCssProps[t]=e.style[t],e.style[t]=n):e.style[t]=i.oldCssProps[t]||""}),r||(i.oldCssProps={})}}function Tae(i,r){var e=document.createEvent("Event");e.initEvent(i,!0,!0),e.gesture=r,r.target.dispatchEvent(e)}var I1=function(){function i(e,t){var n=this;this.options=Yi({},KO,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=_ae(this),this.touchAction=new DO(this,this.options.touchAction),T1(this,!0),Rr(this.options.recognizers,function(a){var o=n.add(new a[0](a[1]));a[2]&&o.recognizeWith(a[2]),a[3]&&o.requireFailure(a[3])},this)}var r=i.prototype;return r.set=function(t){return Yi(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},r.stop=function(t){this.session.stopped=t?O1:Oae},r.recognize=function(t){var n=this.session;if(!n.stopped){this.touchAction.preventDefaults(t);var a,o=this.recognizers,s=n.curRecognizer;(!s||s&&s.state&Nr)&&(n.curRecognizer=null,s=null);for(var u=0;u"u"?{style:{}}:document.createElement("div"),Xne="function",Hn=Math.round,Xi=Math.abs,Yv=Date.now;function Jl(i,r){for(var e,t,n=r[0].toUpperCase()+r.slice(1),a=0;a"u"?Dr={}:Dr=window;var TO=Jl(Yne.style,"touchAction"),IO=TO!==void 0;function Jne(){if(!IO)return!1;var i={},r=Dr.CSS&&Dr.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){return i[e]=r?Dr.CSS.supports("touch-action",e):!0}),i}var kO="compute",PO="auto",Sf="manipulation",Hi="none",$o="pan-x",wo="pan-y",Zs=Jne(),Zne=/mobile|tablet|ip(ad|hone|od)|android/i,xO="ontouchstart"in Dr,Qne=Jl(Dr,"PointerEvent")!==void 0,eae=xO&&Zne.test(navigator.userAgent),cs="touch",tae="pen",Xv="mouse",rae="kinect",iae=25,yt=1,fn=2,ze=4,kt=8,Ku=1,ds=2,fs=4,vs=8,aa=16,br=ds|fs,Vi=vs|aa,CO=br|Vi,AO=["x","y"],Gu=["clientX","clientY"];function Rr(i,r,e){var t;if(i)if(i.forEach)i.forEach(r,e);else if(i.length!==void 0)for(t=0;t-1}function nae(i){if(Ai(i,Hi))return Hi;var r=Ai(i,$o),e=Ai(i,wo);return r&&e?Hi:r||e?r?$o:wo:Ai(i,Sf)?Sf:PO}var DO=function(){function i(e,t){this.manager=e,this.set(t)}var r=i.prototype;return r.set=function(t){t===kO&&(t=this.compute()),IO&&this.manager.element.style&&Zs[t]&&(this.manager.element.style[TO]=t),this.actions=t.toLowerCase().trim()},r.update=function(){this.set(this.manager.options.touchAction)},r.compute=function(){var t=[];return Rr(this.manager.recognizers,function(n){Zl(n.options.enable,[n])&&(t=t.concat(n.getTouchAction()))}),nae(t.join(" "))},r.preventDefaults=function(t){var n=t.srcEvent,a=t.offsetDirection;if(this.manager.session.prevented){n.preventDefault();return}var o=this.actions,s=Ai(o,Hi)&&!Zs[Hi],u=Ai(o,wo)&&!Zs[wo],l=Ai(o,$o)&&!Zs[$o];if(s){var h=t.pointers.length===1,c=t.distance<2,d=t.deltaTime<250;if(h&&c&&d)return}if(!(l&&u)&&(s||u&&a&br||l&&a&Vi))return this.preventSrc(n)},r.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},i}();function Jv(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}function RO(i){var r=i.length;if(r===1)return{x:Hn(i[0].clientX),y:Hn(i[0].clientY)};for(var e=0,t=0,n=0;n=Xi(r)?i<0?ds:fs:r<0?vs:aa}function aae(i,r){var e=r.center,t=i.offsetDelta||{},n=i.prevDelta||{},a=i.prevInput||{};(r.eventType===yt||a.eventType===ze)&&(n=i.prevDelta={x:a.deltaX||0,y:a.deltaY||0},t=i.offsetDelta={x:e.x,y:e.y}),r.deltaX=n.x+(e.x-t.x),r.deltaY=n.y+(e.y-t.y)}function MO(i,r,e){return{x:r/i||0,y:e/i||0}}function oae(i,r){return qu(r[0],r[1],Gu)/qu(i[0],i[1],Gu)}function sae(i,r){return Of(r[1],r[0],Gu)+Of(i[1],i[0],Gu)}function uae(i,r){var e=i.lastInterval||r,t=r.timeStamp-e.timeStamp,n,a,o,s;if(r.eventType!==kt&&(t>iae||e.velocity===void 0)){var u=r.deltaX-e.deltaX,l=r.deltaY-e.deltaY,h=MO(t,u,l);a=h.x,o=h.y,n=Xi(h.x)>Xi(h.y)?h.x:h.y,s=NO(u,l),i.lastInterval=r}else n=e.velocity,a=e.velocityX,o=e.velocityY,s=e.direction;r.velocity=n,r.velocityX=a,r.velocityY=o,r.direction=s}function lae(i,r){var e=i.session,t=r.pointers,n=t.length;e.firstInput||(e.firstInput=b1(r)),n>1&&!e.firstMultiple?e.firstMultiple=b1(r):n===1&&(e.firstMultiple=!1);var a=e.firstInput,o=e.firstMultiple,s=o?o.center:a.center,u=r.center=RO(t);r.timeStamp=Yv(),r.deltaTime=r.timeStamp-a.timeStamp,r.angle=Of(s,u),r.distance=qu(s,u),aae(e,r),r.offsetDirection=NO(r.deltaX,r.deltaY);var l=MO(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=l.x,r.overallVelocityY=l.y,r.overallVelocity=Xi(l.x)>Xi(l.y)?l.x:l.y,r.scale=o?oae(o.pointers,t):1,r.rotation=o?sae(o.pointers,t):0,r.maxPointers=e.prevInput?r.pointers.length>e.prevInput.maxPointers?r.pointers.length:e.prevInput.maxPointers:r.pointers.length,uae(e,r);var h=i.element,c=r.srcEvent,d;c.composedPath?d=c.composedPath()[0]:c.path?d=c.path[0]:d=c.target,Jv(d,h)&&(h=d),r.target=h}function hae(i,r,e){var t=e.pointers.length,n=e.changedPointers.length,a=r&yt&&t-n===0,o=r&(ze|kt)&&t-n===0;e.isFirst=!!a,e.isFinal=!!o,a&&(i.session={}),e.eventType=r,lae(i,e),i.emit("hammer.input",e),i.recognize(e),i.session.prevInput=e}function _o(i){return i.trim().split(/\s+/g)}function to(i,r,e){Rr(_o(r),function(t){i.addEventListener(t,e,!1)})}function ro(i,r,e){Rr(_o(r),function(t){i.removeEventListener(t,e,!1)})}function $1(i){var r=i.ownerDocument||i;return r.defaultView||r.parentWindow||window}var Na=function(){function i(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(a){Zl(e.options.enable,[e])&&n.handler(a)},this.init()}var r=i.prototype;return r.handler=function(){},r.init=function(){this.evEl&&to(this.element,this.evEl,this.domHandler),this.evTarget&&to(this.target,this.evTarget,this.domHandler),this.evWin&&to($1(this.element),this.evWin,this.domHandler)},r.destroy=function(){this.evEl&&ro(this.element,this.evEl,this.domHandler),this.evTarget&&ro(this.target,this.evTarget,this.domHandler),this.evWin&&ro($1(this.element),this.evWin,this.domHandler)},i}();function Ji(i,r,e){if(i.indexOf&&!e)return i.indexOf(r);for(var t=0;tu[r]}):t=t.sort()),t}var fae={touchstart:yt,touchmove:fn,touchend:ze,touchcancel:kt},vae="touchstart touchmove touchend touchcancel",Qv=function(i){Qt(r,i);function r(){var t;return r.prototype.evTarget=vae,t=i.apply(this,arguments)||this,t.targetIds={},t}var e=r.prototype;return e.handler=function(n){var a=fae[n.type],o=pae.call(this,n,a);o&&this.callback(this.manager,a,{pointers:o[0],changedPointers:o[1],pointerType:cs,srcEvent:n})},r}(Na);function pae(i,r){var e=Eo(i.touches),t=this.targetIds;if(r&(yt|fn)&&e.length===1)return t[e[0].identifier]=!0,[e,e];var n,a,o=Eo(i.changedTouches),s=[],u=this.target;if(a=e.filter(function(l){return Jv(l.target,u)}),r===yt)for(n=0;n-1&&n.splice(s,1)};setTimeout(a,bae)}}function $ae(i,r){i&yt?(this.primaryTouch=r.changedPointers[0].identifier,_1.call(this,r)):i&(ze|kt)&&_1.call(this,r)}function wae(i){for(var r=i.srcEvent.clientX,e=i.srcEvent.clientY,t=0;t-1&&this.requireFail.splice(n,1),this},r.hasRequireFailures=function(){return this.requireFail.length>0},r.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},r.emit=function(t){var n=this,a=this.state;function o(s){n.manager.emit(s,t)}a=ci&&o(n.options.event+E1(a))},r.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=pr},r.canEmit=function(){for(var t=0;ta.threshold&&u&a.direction},e.attrTest=function(n){return sa.prototype.attrTest.call(this,n)&&(this.state&Yt||!(this.state&Yt)&&this.directionTest(n))},e.emit=function(n){this.pX=n.deltaX,this.pY=n.deltaY;var a=zO(n.direction);a&&(n.additionalEvent=this.options.event+a),i.prototype.emit.call(this,n)},r}(sa),HO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"swipe",threshold:10,velocity:.3,direction:br|Vi,pointers:1},t))||this}var e=r.prototype;return e.getTouchAction=function(){return tp.prototype.getTouchAction.call(this)},e.attrTest=function(n){var a=this.options.direction,o;return a&(br|Vi)?o=n.overallVelocity:a&br?o=n.overallVelocityX:a&Vi&&(o=n.overallVelocityY),i.prototype.attrTest.call(this,n)&&a&n.offsetDirection&&n.distance>this.options.threshold&&n.maxPointers===this.options.pointers&&Xi(o)>this.options.velocity&&n.eventType&ze},e.emit=function(n){var a=zO(n.offsetDirection);a&&this.manager.emit(this.options.event+a,n),this.manager.emit(this.options.event,n)},r}(sa),VO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"pinch",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Hi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.scale-1)>this.options.threshold||this.state&Yt)},e.emit=function(n){if(n.scale!==1){var a=n.scale<1?"in":"out";n.additionalEvent=this.options.event+a}i.prototype.emit.call(this,n)},r}(sa),WO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"rotate",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Hi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.rotation)>this.options.threshold||this.state&Yt)},r}(sa),UO=function(i){Qt(r,i);function r(t){var n;return t===void 0&&(t={}),n=i.call(this,ur({event:"press",pointers:1,time:251,threshold:9},t))||this,n._timer=null,n._input=null,n}var e=r.prototype;return e.getTouchAction=function(){return[PO]},e.process=function(n){var a=this,o=this.options,s=n.pointers.length===o.pointers,u=n.distanceo.time;if(this._input=n,!u||!s||n.eventType&(ze|kt)&&!l)this.reset();else if(n.eventType&yt)this.reset(),this._timer=setTimeout(function(){a.state=Nr,a.tryEmit()},o.time);else if(n.eventType&ze)return Nr;return pr},e.reset=function(){clearTimeout(this._timer)},e.emit=function(n){this.state===Nr&&(n&&n.eventType&ze?this.manager.emit(this.options.event+"up",n):(this._input.timeStamp=Yv(),this.manager.emit(this.options.event,this._input)))},r}(ps),KO={domEvents:!1,touchAction:kO,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},S1=[[WO,{enable:!1}],[VO,{enable:!1},["rotate"]],[HO,{direction:br}],[tp,{direction:br},["swipe"]],[Tf],[Tf,{event:"doubletap",taps:2},["tap"]],[UO]],Oae=1,O1=2;function T1(i,r){var e=i.element;if(e.style){var t;Rr(i.options.cssProps,function(n,a){t=Jl(e.style,a),r?(i.oldCssProps[t]=e.style[t],e.style[t]=n):e.style[t]=i.oldCssProps[t]||""}),r||(i.oldCssProps={})}}function Tae(i,r){var e=document.createEvent("Event");e.initEvent(i,!0,!0),e.gesture=r,r.target.dispatchEvent(e)}var I1=function(){function i(e,t){var n=this;this.options=Yi({},KO,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=_ae(this),this.touchAction=new DO(this,this.options.touchAction),T1(this,!0),Rr(this.options.recognizers,function(a){var o=n.add(new a[0](a[1]));a[2]&&o.recognizeWith(a[2]),a[3]&&o.requireFailure(a[3])},this)}var r=i.prototype;return r.set=function(t){return Yi(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},r.stop=function(t){this.session.stopped=t?O1:Oae},r.recognize=function(t){var n=this.session;if(!n.stopped){this.touchAction.preventDefaults(t);var a,o=this.recognizers,s=n.curRecognizer;(!s||s&&s.state&Nr)&&(n.curRecognizer=null,s=null);for(var u=0;u\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=window.console&&(window.console.warn||window.console.log);return o&&o.call(window.console,t,a),i.apply(this,arguments)}}var qO=GO(function(i,r,e){for(var t=Object.keys(r),n=0;n=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Nae(i,r){var e;if(i){if(typeof i=="string")return P1(i,r);var t=rt(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return P1(i,r)}}function P1(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e>>0,n-=i,n*=i,i=n>>>0,n-=i,i+=n*4294967296}return(i>>>0)*23283064365386963e-26}}function jae(){var i=function(){};return{on:i,off:i,destroy:i,emit:i,get:function(){return{set:i}}}}var rp=typeof window<"u"?window.Hammer||Rae:function(){return jae()};function pr(i){var r=this,e;this._cleanupQueue=[],this.active=!1,this._dom={container:i,overlay:document.createElement("div")},this._dom.overlay.classList.add("vis-overlay"),this._dom.container.appendChild(this._dom.overlay),this._cleanupQueue.push(function(){r._dom.overlay.parentNode.removeChild(r._dom.overlay)});var t=rp(this._dom.overlay);t.on("tap",k(e=this._onTapOverlay).call(e,this)),this._cleanupQueue.push(function(){t.destroy()});var n=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];ve(n).call(n,function(a){t.on(a,function(o){o.srcEvent.stopPropagation()})}),document&&document.body&&(this._onClick=function(a){Lae(a.target,i)||r.deactivate()},document.body.addEventListener("click",this._onClick),this._cleanupQueue.push(function(){document.body.removeEventListener("click",r._onClick)})),this._escListener=function(a){("key"in a?a.key==="Escape":a.keyCode===27)&&r.deactivate()}}ZE(pr.prototype);pr.current=null;pr.prototype.destroy=function(){var i,r;this.deactivate();var e=XO(Li(i=Ar(r=this._cleanupQueue).call(r,0)).call(i)),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n()}}catch(a){e.e(a)}finally{e.f()}};pr.prototype.activate=function(){pr.current&&pr.current.deactivate(),pr.current=this,this.active=!0,this._dom.overlay.style.display="none",this._dom.container.classList.add("vis-active"),this.emit("change"),this.emit("activate"),document.body.addEventListener("keydown",this._escListener)};pr.prototype.deactivate=function(){this.active=!1,this._dom.overlay.style.display="block",this._dom.container.classList.remove("vis-active"),document.body.removeEventListener("keydown",this._escListener),this.emit("change"),this.emit("deactivate")};pr.prototype._onTapOverlay=function(i){this.activate(),i.srcEvent.stopPropagation()};function Lae(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}var zae=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Hae=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Vae=/^rgb\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *\)$/i,Wae=/^rgba\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *([01]|0?\.\d+) *\)$/i;function Yr(i){if(i)for(;i.hasChildNodes()===!0;){var r=i.firstChild;r&&(Yr(r),i.removeChild(r))}}function Kn(i){return i instanceof String||typeof i=="string"}function x1(i){return fe(i)==="object"&&i!==null}function Zi(i,r,e,t){var n=!1;t===!0&&(n=r[e]===null&&i[e]!==void 0),n?delete i[e]:i[e]=r[e]}function JO(i,r){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;for(var t in i)if(r[t]!==void 0)if(r[t]===null||fe(r[t])!=="object")Zi(i,r,t,e);else{var n=i[t],a=r[t];x1(n)&&x1(a)&&JO(n,a,e)}}function Ma(i,r,e){var t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(he(e))throw new TypeError("Arrays are not supported by deepExtend");for(var n=0;n3&&arguments[3]!==void 0?arguments[3]:!1;if(he(e))throw new TypeError("Arrays are not supported by deepExtend");for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&!si(i).call(i,n))if(e[n]&&e[n].constructor===Object)r[n]===void 0&&(r[n]={}),r[n].constructor===Object?ge(r[n],e[n]):Zi(r,e,n,t);else if(he(e[n])){r[n]=[];for(var a=0;a2&&arguments[2]!==void 0?arguments[2]:!1,t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)||e===!0)if(fe(r[n])==="object"&&r[n]!==null&&l1(r[n])===Object.prototype)i[n]===void 0?i[n]=ge({},r[n],e):fe(i[n])==="object"&&i[n]!==null&&l1(i[n])===Object.prototype?ge(i[n],r[n],e):Zi(i,r,n,t);else if(he(r[n])){var a;i[n]=rt(a=r[n]).call(a)}else Zi(i,r,n,t);return i}function Xu(i,r){var e;return Gv(e=[]).call(e,dr(i),[r])}function Uae(i){return rt(i).call(i)}function Kae(i){return i.getBoundingClientRect().left}function Gae(i){return i.getBoundingClientRect().top}function te(i,r){if(he(i))for(var e=i.length,t=0;t3&&arguments[3]!==void 0?arguments[3]:{},n=function(v){return v!=null},a=function(v){return v!==null&&fe(v)==="object"},o=function(v){for(var p in v)if(Object.prototype.hasOwnProperty.call(v,p))return!1;return!0};if(!a(i))throw new Error("Parameter mergeTarget must be an object");if(!a(r))throw new Error("Parameter options must be an object");if(!n(e))throw new Error("Parameter option must have a value");if(!a(t))throw new Error("Parameter globalOptions must be an object");var s=function(v,p,g){a(v[g])||(v[g]={});var y=p[g],m=v[g];for(var b in y)Object.prototype.hasOwnProperty.call(y,b)&&(m[b]=y[b])},u=r[e],l=a(t)&&!o(t),h=l?t[e]:void 0,d=h?h.enabled:void 0;if(u!==void 0){if(typeof u=="boolean"){a(i[e])||(i[e]={}),i[e].enabled=u;return}if(u===null&&!a(i[e]))if(n(h))i[e]=zi(h);else return;if(a(u)){var c=!0;u.enabled!==void 0?c=u.enabled:d!==void 0&&(c=h.enabled),s(i,r,e),i[e].enabled=c}}}var Xae={linear:function(r){return r},easeInQuad:function(r){return r*r},easeOutQuad:function(r){return r*(2-r)},easeInOutQuad:function(r){return r<.5?2*r*r:-1+(4-2*r)*r},easeInCubic:function(r){return r*r*r},easeOutCubic:function(r){return--r*r*r+1},easeInOutCubic:function(r){return r<.5?4*r*r*r:(r-1)*(2*r-2)*(2*r-2)+1},easeInQuart:function(r){return r*r*r*r},easeOutQuart:function(r){return 1- --r*r*r*r},easeInOutQuart:function(r){return r<.5?8*r*r*r*r:1-8*--r*r*r*r},easeInQuint:function(r){return r*r*r*r*r},easeOutQuint:function(r){return 1+--r*r*r*r*r},easeInOutQuint:function(r){return r<.5?16*r*r*r*r*r:1+16*--r*r*r*r*r}};function Xr(i,r){var e;he(r)||(r=[r]);var t=XO(i),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;if(a){e=a[r[0]];for(var o=1;o0&&arguments[0]!==void 0?arguments[0]:1;N(this,i),this.pixelRatio=r,this.generated=!1,this.centerCoordinates={x:289/2,y:289/2},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return M(i,[{key:"insertTo",value:function(e){this.hammer!==void 0&&(this.hammer.destroy(),this.hammer=void 0),this.container=e,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(e){if(typeof e=="function")this.updateCallback=e;else throw new Error("Function attempted to set as colorPicker update callback is not a function.")}},{key:"setCloseCallback",value:function(e){if(typeof e=="function")this.closeCallback=e;else throw new Error("Function attempted to set as colorPicker closing callback is not a function.")}},{key:"_isColorString",value:function(e){if(typeof e=="string")return Jae[e]}},{key:"setColor",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e!=="none"){var n,a=this._isColorString(e);if(a!==void 0&&(e=a),Kn(e)===!0){if(eT(e)===!0){var o=e.substr(4).substr(0,e.length-5).split(",");n={r:o[0],g:o[1],b:o[2],a:1}}else if(Yae(e)===!0){var s=e.substr(5).substr(0,e.length-6).split(",");n={r:s[0],g:s[1],b:s[2],a:s[3]}}else if(QO(e)===!0){var u=ip(e);n={r:u.r,g:u.g,b:u.b,a:1}}}else if(e instanceof Object&&e.r!==void 0&&e.g!==void 0&&e.b!==void 0){var l=e.a!==void 0?e.a:"1.0";n={r:e.r,g:e.g,b:e.b,a:l}}if(n===void 0)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+ls(e));this._setColor(n,t)}}},{key:"show",value:function(){this.closeCallback!==void 0&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;t===!0&&(this.previousColor=je({},this.color)),this.applied===!0&&this.updateCallback(this.initialColor),this.frame.style.display="none",yr(function(){e.closeCallback!==void 0&&(e.closeCallback(),e.closeCallback=void 0)},0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){this.previousColor!==void 0?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;t===!0&&(this.initialColor=je({},e)),this.color=e;var n=qa(e.r,e.g,e.b),a=2*Math.PI,o=this.r*n.s,s=this.centerCoordinates.x+o*Math.sin(a*n.h),u=this.centerCoordinates.y+o*Math.cos(a*n.h);this.colorPickerSelector.style.left=s-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=u-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(e)}},{key:"_setOpacity",value:function(e){this.color.a=e/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(e){var t=qa(this.color.r,this.color.g,this.color.b);t.v=e/100;var n=bu(t.h,t.s,t.v);n.a=this.color.a,this.color=n,this._updatePicker()}},{key:"_updatePicker",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.color,t=qa(e.r,e.g,e.b),n=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1)),n.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var a=this.colorPickerCanvas.clientWidth,o=this.colorPickerCanvas.clientHeight;n.clearRect(0,0,a,o),n.putImageData(this.hueCircle,0,0),n.fillStyle="rgba(0,0,0,"+(1-t.v)+")",n.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),hs(n).call(n),this.brightnessRange.value=100*t.v,this.opacityRange.value=100*e.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){var e,t,n,a;if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var s=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(s.webkitBackingStorePixelRatio||s.mozBackingStorePixelRatio||s.msBackingStorePixelRatio||s.oBackingStorePixelRatio||s.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var o=document.createElement("DIV");o.style.color="red",o.style.fontWeight="bold",o.style.padding="10px",o.innerText="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(o)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch{}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch{}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var u=this;this.opacityRange.onchange=function(){u._setOpacity(this.value)},this.opacityRange.oninput=function(){u._setOpacity(this.value)},this.brightnessRange.onchange=function(){u._setBrightness(this.value)},this.brightnessRange.oninput=function(){u._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerText="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerText="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerText="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerText="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerText="cancel",this.cancelButton.onclick=k(e=this._hide).call(e,this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerText="apply",this.applyButton.onclick=k(t=this._apply).call(t,this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerText="save",this.saveButton.onclick=k(n=this._save).call(n,this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerText="load last",this.loadButton.onclick=k(a=this._loadLast).call(a,this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var e=this;this.drag={},this.pinch={},this.hammer=new rp(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("hammer.input",function(t){t.isFirst&&e._moveSelector(t)}),this.hammer.on("tap",function(t){e._moveSelector(t)}),this.hammer.on("panstart",function(t){e._moveSelector(t)}),this.hammer.on("panmove",function(t){e._moveSelector(t)}),this.hammer.on("panend",function(t){e._moveSelector(t)})}},{key:"_generateHueCircle",value:function(){if(this.generated===!1){var e=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)),e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var t=this.colorPickerCanvas.clientWidth,n=this.colorPickerCanvas.clientHeight;e.clearRect(0,0,t,n);var a,o,s,u;this.centerCoordinates={x:t*.5,y:n*.5},this.r=.49*t;var l=2*Math.PI/360,h=1/360,d=1/this.r,c;for(s=0;s<360;s++)for(u=0;u3&&arguments[3]!==void 0?arguments[3]:1,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:function(){return!1};N(this,i),this.parent=r,this.changedOptions=[],this.container=e,this.allowCreation=!1,this.hideOption=a,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},je(this.options,this.defaultOptions),this.configureOptions=t,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new Zae(n),this.wrapper=void 0}return M(i,[{key:"setOptions",value:function(e){if(e!==void 0){this.popupHistory={},this._removePopup();var t=!0;if(typeof e=="string")this.options.filter=e;else if(he(e))this.options.filter=e.join();else if(fe(e)==="object"){if(e==null)throw new TypeError("options cannot be null");e.container!==void 0&&(this.options.container=e.container),Ot(e)!==void 0&&(this.options.filter=Ot(e)),e.showButton!==void 0&&(this.options.showButton=e.showButton),e.enabled!==void 0&&(t=e.enabled)}else typeof e=="boolean"?(this.options.filter=!0,t=e):typeof e=="function"&&(this.options.filter=e,t=!0);Ot(this.options)===!1&&(t=!1),this.options.enabled=t}this._clean()}},{key:"setModuleOptions",value:function(e){this.moduleOptions=e,this.options.enabled===!0&&(this._clean(),this.options.container!==void 0&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){this._clean(),this.changedOptions=[];var e=Ot(this.options),t=0,n=!1;for(var a in this.configureOptions)Object.prototype.hasOwnProperty.call(this.configureOptions,a)&&(this.allowCreation=!1,n=!1,typeof e=="function"?(n=e(a,[]),n=n||this._handleObject(this.configureOptions[a],[a],!0)):(e===!0||ie(e).call(e,a)!==-1)&&(n=!0),n!==!1&&(this.allowCreation=!0,t>0&&this._makeItem([]),this._makeHeader(a),this._handleObject(this.configureOptions[a],[a])),t++);this._makeButton(),this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var e=0;e1?n-1:0),o=1;o2&&arguments[2]!==void 0?arguments[2]:!1,a=document.createElement("div");if(a.className="vis-configuration vis-config-label vis-config-s"+t.length,n===!0){for(;a.firstChild;)a.removeChild(a.firstChild);a.appendChild(Pf("i","b",e))}else a.innerText=e+":";return a}},{key:"_makeDropdown",value:function(e,t,n){var a=document.createElement("select");a.className="vis-configuration vis-config-select";var o=0;t!==void 0&&ie(e).call(e,t)!==-1&&(o=ie(e).call(e,t));for(var s=0;ss&&s!==1&&(l.max=Math.ceil(t*c),d=l.max,h="range increased"),l.value=t}else l.value=a;var f=document.createElement("input");f.className="vis-configuration vis-config-rangeinput",f.value=l.value;var v=this;l.onchange=function(){f.value=this.value,v._update(Number(this.value),n)},l.oninput=function(){f.value=this.value};var p=this._makeLabel(n[n.length-1],n),g=this._makeItem(n,p,l,f);h!==""&&this.popupHistory[g]!==d&&(this.popupHistory[g]=d,this._setupPopup(h,g))}},{key:"_makeButton",value:function(){var e=this;if(this.options.showButton===!0){var t=document.createElement("div");t.className="vis-configuration vis-config-button",t.innerText="generate options",t.onclick=function(){e._printOptions()},t.onmouseover=function(){t.className="vis-configuration vis-config-button hover"},t.onmouseout=function(){t.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(t)}}},{key:"_setupPopup",value:function(e,t){var n=this;if(this.initialized===!0&&this.allowCreation===!0&&this.popupCounter1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=!1,o=Ot(this.options),s=!1;for(var u in e)if(Object.prototype.hasOwnProperty.call(e,u)){a=!0;var l=e[u],h=Xu(t,u);if(typeof o=="function"&&(a=o(u,t),a===!1&&!he(l)&&typeof l!="string"&&typeof l!="boolean"&&l instanceof Object&&(this.allowCreation=!1,a=this._handleObject(l,h,!0),this.allowCreation=n===!1)),a!==!1){s=!0;var d=this._getValue(h);if(he(l))this._handleArray(l,d,h);else if(typeof l=="string")this._makeTextInput(l,d,h);else if(typeof l=="boolean")this._makeCheckbox(l,d,h);else if(l instanceof Object){if(!this.hideOption(t,u,this.moduleOptions))if(l.enabled!==void 0){var c=Xu(h,"enabled"),f=this._getValue(c);if(f===!0){var v=this._makeLabel(u,h,!0);this._makeItem(h,v),s=this._handleObject(l,h)||s}else this._makeCheckbox(l,f,h)}else{var p=this._makeLabel(u,h,!0);this._makeItem(h,p),s=this._handleObject(l,h)||s}}else console.error("dont know how to handle",l,u,h)}}return s}},{key:"_handleArray",value:function(e,t,n){typeof e[0]=="string"&&e[0]==="color"?(this._makeColorField(e,t,n),e[1]!==t&&this.changedOptions.push({path:n,value:t})):typeof e[0]=="string"?(this._makeDropdown(e,t,n),e[0]!==t&&this.changedOptions.push({path:n,value:t})):typeof e[0]=="number"&&(this._makeRange(e,t,n),e[0]!==t&&this.changedOptions.push({path:n,value:Number(t)}))}},{key:"_update",value:function(e,t){var n=this._constructOptions(e,t);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",n),this.initialized=!0,this.parent.setOptions(n)}},{key:"_constructOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=n;e=e==="true"?!0:e,e=e==="false"?!1:e;for(var o=0;oo-this.padding&&(l=!0),l?s=this.x-n:s=this.x,h?u=this.y-t:u=this.y}else u=this.y-t,u+t+this.padding>a&&(u=a-t-this.padding),uo&&(s=o-n-this.padding),s\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=window.console&&(window.console.warn||window.console.log);return o&&o.call(window.console,t,a),i.apply(this,arguments)}}var qO=GO(function(i,r,e){for(var t=Object.keys(r),n=0;n=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Nae(i,r){var e;if(i){if(typeof i=="string")return P1(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return P1(i,r)}}function P1(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e>>0,n-=i,n*=i,i=n>>>0,n-=i,i+=n*4294967296}return(i>>>0)*23283064365386963e-26}}function jae(){var i=function(){};return{on:i,off:i,destroy:i,emit:i,get:function(){return{set:i}}}}var rp=typeof window<"u"?window.Hammer||Rae:function(){return jae()};function gr(i){var r=this,e;this._cleanupQueue=[],this.active=!1,this._dom={container:i,overlay:document.createElement("div")},this._dom.overlay.classList.add("vis-overlay"),this._dom.container.appendChild(this._dom.overlay),this._cleanupQueue.push(function(){r._dom.overlay.parentNode.removeChild(r._dom.overlay)});var t=rp(this._dom.overlay);t.on("tap",k(e=this._onTapOverlay).call(e,this)),this._cleanupQueue.push(function(){t.destroy()});var n=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];fe(n).call(n,function(a){t.on(a,function(o){o.srcEvent.stopPropagation()})}),document&&document.body&&(this._onClick=function(a){Lae(a.target,i)||r.deactivate()},document.body.addEventListener("click",this._onClick),this._cleanupQueue.push(function(){document.body.removeEventListener("click",r._onClick)})),this._escListener=function(a){("key"in a?a.key==="Escape":a.keyCode===27)&&r.deactivate()}}ZE(gr.prototype);gr.current=null;gr.prototype.destroy=function(){var i,r;this.deactivate();var e=XO(Li(i=Ar(r=this._cleanupQueue).call(r,0)).call(i)),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n()}}catch(a){e.e(a)}finally{e.f()}};gr.prototype.activate=function(){gr.current&&gr.current.deactivate(),gr.current=this,this.active=!0,this._dom.overlay.style.display="none",this._dom.container.classList.add("vis-active"),this.emit("change"),this.emit("activate"),document.body.addEventListener("keydown",this._escListener)};gr.prototype.deactivate=function(){this.active=!1,this._dom.overlay.style.display="block",this._dom.container.classList.remove("vis-active"),document.body.removeEventListener("keydown",this._escListener),this.emit("change"),this.emit("deactivate")};gr.prototype._onTapOverlay=function(i){this.activate(),i.srcEvent.stopPropagation()};function Lae(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}var zae=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Hae=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Vae=/^rgb\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *\)$/i,Wae=/^rgba\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *([01]|0?\.\d+) *\)$/i;function Zr(i){if(i)for(;i.hasChildNodes()===!0;){var r=i.firstChild;r&&(Zr(r),i.removeChild(r))}}function Kn(i){return i instanceof String||typeof i=="string"}function x1(i){return de(i)==="object"&&i!==null}function Zi(i,r,e,t){var n=!1;t===!0&&(n=r[e]===null&&i[e]!==void 0),n?delete i[e]:i[e]=r[e]}function JO(i,r){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;for(var t in i)if(r[t]!==void 0)if(r[t]===null||de(r[t])!=="object")Zi(i,r,t,e);else{var n=i[t],a=r[t];x1(n)&&x1(a)&&JO(n,a,e)}}function Ma(i,r,e){var t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(he(e))throw new TypeError("Arrays are not supported by deepExtend");for(var n=0;n3&&arguments[3]!==void 0?arguments[3]:!1;if(he(e))throw new TypeError("Arrays are not supported by deepExtend");for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&!hi(i).call(i,n))if(e[n]&&e[n].constructor===Object)r[n]===void 0&&(r[n]={}),r[n].constructor===Object?pe(r[n],e[n]):Zi(r,e,n,t);else if(he(e[n])){r[n]=[];for(var a=0;a2&&arguments[2]!==void 0?arguments[2]:!1,t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)||e===!0)if(de(r[n])==="object"&&r[n]!==null&&l1(r[n])===Object.prototype)i[n]===void 0?i[n]=pe({},r[n],e):de(i[n])==="object"&&i[n]!==null&&l1(i[n])===Object.prototype?pe(i[n],r[n],e):Zi(i,r,n,t);else if(he(r[n])){var a;i[n]=it(a=r[n]).call(a)}else Zi(i,r,n,t);return i}function Xu(i,r){var e;return Gv(e=[]).call(e,fr(i),[r])}function Uae(i){return it(i).call(i)}function Kae(i){return i.getBoundingClientRect().left}function Gae(i){return i.getBoundingClientRect().top}function te(i,r){if(he(i))for(var e=i.length,t=0;t3&&arguments[3]!==void 0?arguments[3]:{},n=function(v){return v!=null},a=function(v){return v!==null&&de(v)==="object"},o=function(v){for(var p in v)if(Object.prototype.hasOwnProperty.call(v,p))return!1;return!0};if(!a(i))throw new Error("Parameter mergeTarget must be an object");if(!a(r))throw new Error("Parameter options must be an object");if(!n(e))throw new Error("Parameter option must have a value");if(!a(t))throw new Error("Parameter globalOptions must be an object");var s=function(v,p,g){a(v[g])||(v[g]={});var y=p[g],m=v[g];for(var $ in y)Object.prototype.hasOwnProperty.call(y,$)&&(m[$]=y[$])},u=r[e],l=a(t)&&!o(t),h=l?t[e]:void 0,c=h?h.enabled:void 0;if(u!==void 0){if(typeof u=="boolean"){a(i[e])||(i[e]={}),i[e].enabled=u;return}if(u===null&&!a(i[e]))if(n(h))i[e]=zi(h);else return;if(a(u)){var d=!0;u.enabled!==void 0?d=u.enabled:c!==void 0&&(d=h.enabled),s(i,r,e),i[e].enabled=d}}}var Xae={linear:function(r){return r},easeInQuad:function(r){return r*r},easeOutQuad:function(r){return r*(2-r)},easeInOutQuad:function(r){return r<.5?2*r*r:-1+(4-2*r)*r},easeInCubic:function(r){return r*r*r},easeOutCubic:function(r){return--r*r*r+1},easeInOutCubic:function(r){return r<.5?4*r*r*r:(r-1)*(2*r-2)*(2*r-2)+1},easeInQuart:function(r){return r*r*r*r},easeOutQuart:function(r){return 1- --r*r*r*r},easeInOutQuart:function(r){return r<.5?8*r*r*r*r:1-8*--r*r*r*r},easeInQuint:function(r){return r*r*r*r*r},easeOutQuint:function(r){return 1+--r*r*r*r*r},easeInOutQuint:function(r){return r<.5?16*r*r*r*r*r:1+16*--r*r*r*r*r}};function Qr(i,r){var e;he(r)||(r=[r]);var t=XO(i),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;if(a){e=a[r[0]];for(var o=1;o0&&arguments[0]!==void 0?arguments[0]:1;N(this,i),this.pixelRatio=r,this.generated=!1,this.centerCoordinates={x:289/2,y:289/2},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return M(i,[{key:"insertTo",value:function(e){this.hammer!==void 0&&(this.hammer.destroy(),this.hammer=void 0),this.container=e,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(e){if(typeof e=="function")this.updateCallback=e;else throw new Error("Function attempted to set as colorPicker update callback is not a function.")}},{key:"setCloseCallback",value:function(e){if(typeof e=="function")this.closeCallback=e;else throw new Error("Function attempted to set as colorPicker closing callback is not a function.")}},{key:"_isColorString",value:function(e){if(typeof e=="string")return Jae[e]}},{key:"setColor",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e!=="none"){var n,a=this._isColorString(e);if(a!==void 0&&(e=a),Kn(e)===!0){if(eT(e)===!0){var o=e.substr(4).substr(0,e.length-5).split(",");n={r:o[0],g:o[1],b:o[2],a:1}}else if(Yae(e)===!0){var s=e.substr(5).substr(0,e.length-6).split(",");n={r:s[0],g:s[1],b:s[2],a:s[3]}}else if(QO(e)===!0){var u=ip(e);n={r:u.r,g:u.g,b:u.b,a:1}}}else if(e instanceof Object&&e.r!==void 0&&e.g!==void 0&&e.b!==void 0){var l=e.a!==void 0?e.a:"1.0";n={r:e.r,g:e.g,b:e.b,a:l}}if(n===void 0)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+ls(e));this._setColor(n,t)}}},{key:"show",value:function(){this.closeCallback!==void 0&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;t===!0&&(this.previousColor=Le({},this.color)),this.applied===!0&&this.updateCallback(this.initialColor),this.frame.style.display="none",mr(function(){e.closeCallback!==void 0&&(e.closeCallback(),e.closeCallback=void 0)},0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){this.previousColor!==void 0?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;t===!0&&(this.initialColor=Le({},e)),this.color=e;var n=qa(e.r,e.g,e.b),a=2*Math.PI,o=this.r*n.s,s=this.centerCoordinates.x+o*Math.sin(a*n.h),u=this.centerCoordinates.y+o*Math.cos(a*n.h);this.colorPickerSelector.style.left=s-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=u-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(e)}},{key:"_setOpacity",value:function(e){this.color.a=e/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(e){var t=qa(this.color.r,this.color.g,this.color.b);t.v=e/100;var n=bu(t.h,t.s,t.v);n.a=this.color.a,this.color=n,this._updatePicker()}},{key:"_updatePicker",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.color,t=qa(e.r,e.g,e.b),n=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1)),n.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var a=this.colorPickerCanvas.clientWidth,o=this.colorPickerCanvas.clientHeight;n.clearRect(0,0,a,o),n.putImageData(this.hueCircle,0,0),n.fillStyle="rgba(0,0,0,"+(1-t.v)+")",n.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),hs(n).call(n),this.brightnessRange.value=100*t.v,this.opacityRange.value=100*e.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){var e,t,n,a;if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var s=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(s.webkitBackingStorePixelRatio||s.mozBackingStorePixelRatio||s.msBackingStorePixelRatio||s.oBackingStorePixelRatio||s.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var o=document.createElement("DIV");o.style.color="red",o.style.fontWeight="bold",o.style.padding="10px",o.innerText="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(o)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch{}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch{}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var u=this;this.opacityRange.onchange=function(){u._setOpacity(this.value)},this.opacityRange.oninput=function(){u._setOpacity(this.value)},this.brightnessRange.onchange=function(){u._setBrightness(this.value)},this.brightnessRange.oninput=function(){u._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerText="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerText="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerText="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerText="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerText="cancel",this.cancelButton.onclick=k(e=this._hide).call(e,this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerText="apply",this.applyButton.onclick=k(t=this._apply).call(t,this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerText="save",this.saveButton.onclick=k(n=this._save).call(n,this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerText="load last",this.loadButton.onclick=k(a=this._loadLast).call(a,this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var e=this;this.drag={},this.pinch={},this.hammer=new rp(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("hammer.input",function(t){t.isFirst&&e._moveSelector(t)}),this.hammer.on("tap",function(t){e._moveSelector(t)}),this.hammer.on("panstart",function(t){e._moveSelector(t)}),this.hammer.on("panmove",function(t){e._moveSelector(t)}),this.hammer.on("panend",function(t){e._moveSelector(t)})}},{key:"_generateHueCircle",value:function(){if(this.generated===!1){var e=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)),e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var t=this.colorPickerCanvas.clientWidth,n=this.colorPickerCanvas.clientHeight;e.clearRect(0,0,t,n);var a,o,s,u;this.centerCoordinates={x:t*.5,y:n*.5},this.r=.49*t;var l=2*Math.PI/360,h=1/360,c=1/this.r,d;for(s=0;s<360;s++)for(u=0;u3&&arguments[3]!==void 0?arguments[3]:1,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:function(){return!1};N(this,i),this.parent=r,this.changedOptions=[],this.container=e,this.allowCreation=!1,this.hideOption=a,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},Le(this.options,this.defaultOptions),this.configureOptions=t,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new Zae(n),this.wrapper=void 0}return M(i,[{key:"setOptions",value:function(e){if(e!==void 0){this.popupHistory={},this._removePopup();var t=!0;if(typeof e=="string")this.options.filter=e;else if(he(e))this.options.filter=e.join();else if(de(e)==="object"){if(e==null)throw new TypeError("options cannot be null");e.container!==void 0&&(this.options.container=e.container),Tt(e)!==void 0&&(this.options.filter=Tt(e)),e.showButton!==void 0&&(this.options.showButton=e.showButton),e.enabled!==void 0&&(t=e.enabled)}else typeof e=="boolean"?(this.options.filter=!0,t=e):typeof e=="function"&&(this.options.filter=e,t=!0);Tt(this.options)===!1&&(t=!1),this.options.enabled=t}this._clean()}},{key:"setModuleOptions",value:function(e){this.moduleOptions=e,this.options.enabled===!0&&(this._clean(),this.options.container!==void 0&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){this._clean(),this.changedOptions=[];var e=Tt(this.options),t=0,n=!1;for(var a in this.configureOptions)Object.prototype.hasOwnProperty.call(this.configureOptions,a)&&(this.allowCreation=!1,n=!1,typeof e=="function"?(n=e(a,[]),n=n||this._handleObject(this.configureOptions[a],[a],!0)):(e===!0||ne(e).call(e,a)!==-1)&&(n=!0),n!==!1&&(this.allowCreation=!0,t>0&&this._makeItem([]),this._makeHeader(a),this._handleObject(this.configureOptions[a],[a])),t++);this._makeButton(),this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var e=0;e1?n-1:0),o=1;o2&&arguments[2]!==void 0?arguments[2]:!1,a=document.createElement("div");if(a.className="vis-configuration vis-config-label vis-config-s"+t.length,n===!0){for(;a.firstChild;)a.removeChild(a.firstChild);a.appendChild(Pf("i","b",e))}else a.innerText=e+":";return a}},{key:"_makeDropdown",value:function(e,t,n){var a=document.createElement("select");a.className="vis-configuration vis-config-select";var o=0;t!==void 0&&ne(e).call(e,t)!==-1&&(o=ne(e).call(e,t));for(var s=0;ss&&s!==1&&(l.max=Math.ceil(t*d),c=l.max,h="range increased"),l.value=t}else l.value=a;var f=document.createElement("input");f.className="vis-configuration vis-config-rangeinput",f.value=l.value;var v=this;l.onchange=function(){f.value=this.value,v._update(Number(this.value),n)},l.oninput=function(){f.value=this.value};var p=this._makeLabel(n[n.length-1],n),g=this._makeItem(n,p,l,f);h!==""&&this.popupHistory[g]!==c&&(this.popupHistory[g]=c,this._setupPopup(h,g))}},{key:"_makeButton",value:function(){var e=this;if(this.options.showButton===!0){var t=document.createElement("div");t.className="vis-configuration vis-config-button",t.innerText="generate options",t.onclick=function(){e._printOptions()},t.onmouseover=function(){t.className="vis-configuration vis-config-button hover"},t.onmouseout=function(){t.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(t)}}},{key:"_setupPopup",value:function(e,t){var n=this;if(this.initialized===!0&&this.allowCreation===!0&&this.popupCounter1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=!1,o=Tt(this.options),s=!1;for(var u in e)if(Object.prototype.hasOwnProperty.call(e,u)){a=!0;var l=e[u],h=Xu(t,u);if(typeof o=="function"&&(a=o(u,t),a===!1&&!he(l)&&typeof l!="string"&&typeof l!="boolean"&&l instanceof Object&&(this.allowCreation=!1,a=this._handleObject(l,h,!0),this.allowCreation=n===!1)),a!==!1){s=!0;var c=this._getValue(h);if(he(l))this._handleArray(l,c,h);else if(typeof l=="string")this._makeTextInput(l,c,h);else if(typeof l=="boolean")this._makeCheckbox(l,c,h);else if(l instanceof Object){if(!this.hideOption(t,u,this.moduleOptions))if(l.enabled!==void 0){var d=Xu(h,"enabled"),f=this._getValue(d);if(f===!0){var v=this._makeLabel(u,h,!0);this._makeItem(h,v),s=this._handleObject(l,h)||s}else this._makeCheckbox(l,f,h)}else{var p=this._makeLabel(u,h,!0);this._makeItem(h,p),s=this._handleObject(l,h)||s}}else console.error("dont know how to handle",l,u,h)}}return s}},{key:"_handleArray",value:function(e,t,n){typeof e[0]=="string"&&e[0]==="color"?(this._makeColorField(e,t,n),e[1]!==t&&this.changedOptions.push({path:n,value:t})):typeof e[0]=="string"?(this._makeDropdown(e,t,n),e[0]!==t&&this.changedOptions.push({path:n,value:t})):typeof e[0]=="number"&&(this._makeRange(e,t,n),e[0]!==t&&this.changedOptions.push({path:n,value:Number(t)}))}},{key:"_update",value:function(e,t){var n=this._constructOptions(e,t);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",n),this.initialized=!0,this.parent.setOptions(n)}},{key:"_constructOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=n;e=e==="true"?!0:e,e=e==="false"?!1:e;for(var o=0;oo-this.padding&&(l=!0),l?s=this.x-n:s=this.x,h?u=this.y-t:u=this.y}else u=this.y-t,u+t+this.padding>a&&(u=a-t-this.padding),uo&&(s=o-n-this.padding),so.distance?l=" in "+i.printLocation(a.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+i.printLocation(o.path,o.closestMatch,""):a.distance<=s?l='. Did you mean "'+a.closestMatch+'"?'+i.printLocation(a.path,e):l=". Did you mean one of these: "+i.print(Oe(t))+i.printLocation(n,e),console.error('%cUnknown option detected: "'+e+'"'+l,xf),za=!0}},{key:"findInOptions",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=1e9,s="",u=[],l=e.toLowerCase(),h=void 0;for(var d in t){var c=void 0;if(t[d].__type__!==void 0&&a===!0){var f=i.findInOptions(e,t[d],Xu(n,d));o>f.distance&&(s=f.closestMatch,u=f.path,o=f.distance,h=f.indexMatch)}else{var v;ie(v=d.toLowerCase()).call(v,l)!==-1&&(h=d),c=i.levenshteinDistance(e,d),o>c&&(s=d,u=Uae(n),o=c)}}return{closestMatch:s,path:u,distance:o,indexMatch:h}}},{key:"printLocation",value:function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`Problem value found at: +`:o.distance<=u&&a.distance>o.distance?l=" in "+i.printLocation(a.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+i.printLocation(o.path,o.closestMatch,""):a.distance<=s?l='. Did you mean "'+a.closestMatch+'"?'+i.printLocation(a.path,e):l=". Did you mean one of these: "+i.print(Oe(t))+i.printLocation(n,e),console.error('%cUnknown option detected: "'+e+'"'+l,xf),za=!0}},{key:"findInOptions",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=1e9,s="",u=[],l=e.toLowerCase(),h=void 0;for(var c in t){var d=void 0;if(t[c].__type__!==void 0&&a===!0){var f=i.findInOptions(e,t[c],Xu(n,c));o>f.distance&&(s=f.closestMatch,u=f.path,o=f.distance,h=f.indexMatch)}else{var v;ne(v=c.toLowerCase()).call(v,l)!==-1&&(h=c),d=i.levenshteinDistance(e,c),o>d&&(s=c,u=Uae(n),o=d)}}return{closestMatch:s,path:u,distance:o,indexMatch:h}}},{key:"printLocation",value:function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`Problem value found at: `,a=` `+n+`options = { @@ -126,22 +126,22 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `;for(var l=0;l":!0,"--":!0},Qr="",ua=0,ee="",G="",wt=dt.NULL;function soe(){ua=0,ee=Qr.charAt(0)}function We(){ua++,ee=Qr.charAt(ua)}function kn(){return Qr.charAt(ua+1)}function D1(i){var r=i.charCodeAt(0);return r<47?r===35||r===46:r<59?r>47:r<91?r>64:r<96?r===95:r<123?r>96:!1}function ci(i,r){if(i||(i={}),r)for(var e in r)r.hasOwnProperty(e)&&(i[e]=r[e]);return i}function uoe(i,r,e){for(var t=r.split("."),n=i;t.length;){var a=t.shift();t.length?(n[a]||(n[a]={}),n=n[a]):n[a]=e}}function iT(i,r){for(var e,t,n=null,a=[i],o=i;o.parent;)a.push(o.parent),o=o.parent;if(o.nodes){for(e=0,t=o.nodes.length;e=0;e--){var s,u=a[e];u.nodes||(u.nodes=[]),ie(s=u.nodes).call(s,n)===-1&&u.nodes.push(n)}r.attr&&(n.attr=ci(n.attr,r.attr))}function loe(i,r){if(i.edges||(i.edges=[]),i.edges.push(r),i.edge){var e=ci({},i.edge);r.attr=ci(e,r.attr)}}function nT(i,r,e,t,n){var a={from:r,to:e,type:t};return i.edge&&(a.attr=ci({},i.edge)),a.attr=ci(a.attr||{},n),n!=null&&n.hasOwnProperty("arrows")&&n.arrows!=null&&(a.arrows={to:{enabled:!0,type:n.arrows.type}},n.arrows=null),a}function ye(){for(wt=dt.NULL,G="";ee===" "||ee===" "||ee===` -`||ee==="\r";)We();do{var i=!1;if(ee==="#"){for(var r=ua-1;Qr.charAt(r)===" "||Qr.charAt(r)===" ";)r--;if(Qr.charAt(r)===` -`||Qr.charAt(r)===""){for(;ee!=""&&ee!=` -`;)We();i=!0}}if(ee==="/"&&kn()==="/"){for(;ee!=""&&ee!=` -`;)We();i=!0}if(ee==="/"&&kn()==="*"){for(;ee!="";)if(ee==="*"&&kn()==="/"){We(),We();break}else We();i=!0}for(;ee===" "||ee===" "||ee===` -`||ee==="\r";)We()}while(i);if(ee===""){wt=dt.DELIMITER;return}var e=ee+kn();if(A1[e]){wt=dt.DELIMITER,G=e,We(),We();return}if(A1[ee]){wt=dt.DELIMITER,G=ee,We();return}if(D1(ee)||ee==="-"){for(G+=ee,We();D1(ee);)G+=ee,We();G==="false"?G=!1:G==="true"?G=!0:isNaN(Number(G))||(G=Number(G)),wt=dt.IDENTIFIER;return}if(ee==='"'){for(We();ee!=""&&(ee!='"'||ee==='"'&&kn()==='"');)ee==='"'?(G+=ee,We()):ee==="\\"&&kn()==="n"?(G+=` -`,We()):G+=ee,We();if(ee!='"')throw ft('End of string " expected');We(),wt=dt.IDENTIFIER;return}for(wt=dt.UNKNOWN;ee!="";)G+=ee,We();throw new SyntaxError('Syntax error in part "'+uT(G,30)+'"')}function hoe(){var i={};if(soe(),ye(),G==="strict"&&(i.strict=!0,ye()),(G==="graph"||G==="digraph")&&(i.type=G,ye()),wt===dt.IDENTIFIER&&(i.id=G,ye()),G!="{")throw ft("Angle bracket { expected");if(ye(),aT(i),G!="}")throw ft("Angle bracket } expected");if(ye(),G!=="")throw ft("End of file expected");return ye(),delete i.node,delete i.edge,delete i.graph,i}function aT(i){for(;G!==""&&G!="}";)coe(i),G===";"&&ye()}function coe(i){var r=oT(i);if(r){sT(i,r);return}var e=doe(i);if(!e){if(wt!=dt.IDENTIFIER)throw ft("Identifier expected");var t=G;if(ye(),G==="="){if(ye(),wt!=dt.IDENTIFIER)throw ft("Identifier expected");i[t]=G,ye()}else foe(i,t)}}function oT(i){var r=null;if(G==="subgraph"&&(r={},r.type="subgraph",ye(),wt===dt.IDENTIFIER&&(r.id=G,ye())),G==="{"){if(ye(),r||(r={}),r.parent=i,r.node=i.node,r.edge=i.edge,r.graph=i.graph,aT(r),G!="}")throw ft("Angle bracket } expected");ye(),delete r.node,delete r.edge,delete r.graph,delete r.parent,i.subgraphs||(i.subgraphs=[]),i.subgraphs.push(r)}return r}function doe(i){return G==="node"?(ye(),i.node=io(),"node"):G==="edge"?(ye(),i.edge=io(),"edge"):G==="graph"?(ye(),i.graph=io(),"graph"):null}function foe(i,r){var e={id:r},t=io();t&&(e.attr=t),iT(i,e),sT(i,r)}function sT(i,r){for(;G==="->"||G==="--";){var e,t=G;ye();var n=oT(i);if(n)e=n;else{if(wt!=dt.IDENTIFIER)throw ft("Identifier or subgraph expected");e=G,iT(i,{id:e}),ye()}var a=io(),o=nT(i,r,e,t,a);loe(i,o),r=e}}function io(){for(var i,r=null,e={dashed:!0,solid:!1,dotted:[1,5]},t={dot:"circle",box:"box",crow:"crow",curve:"curve",icurve:"inv_curve",normal:"triangle",inv:"inv_triangle",diamond:"diamond",tee:"bar",vee:"vee"},n=new Array,a=new Array;G==="[";){for(ye(),r={};G!==""&&G!="]";){if(wt!=dt.IDENTIFIER)throw ft("Attribute name expected");var o=G;if(ye(),G!="=")throw ft("Equal sign = expected");if(ye(),wt!=dt.IDENTIFIER)throw ft("Attribute value expected");var s=G;o==="style"&&(s=e[s]);var u;o==="arrowhead"&&(u=t[s],o="arrows",s={to:{enabled:!0,type:u}}),o==="arrowtail"&&(u=t[s],o="arrows",s={from:{enabled:!0,type:u}}),n.push({attr:r,name:o,value:s}),a.push(o),ye(),G==","&&ye()}if(G!="]")throw ft("Bracket ] expected");ye()}if(si(a).call(a,"dir")){var l={};for(l.arrows={},i=0;i"&&(u.arrows="to"),u};ve(n=r.edges).call(n,function(o){var s,u;if(o.from instanceof Object?s=o.from.nodes:s={id:o.from},o.to instanceof Object?u=o.to.nodes:u={id:o.to},o.from instanceof Object&&o.from.edges){var l;ve(l=o.from.edges).call(l,function(d){var c=a(d);e.edges.push(c)})}if(voe(s,u,function(d,c){var f=nT(e,d.id,c.id,o.type,o.attr),v=a(f);e.edges.push(v)}),o.to instanceof Object&&o.to.edges){var h;ve(h=o.to.edges).call(h,function(d){var c=a(d);e.edges.push(c)})}})}return r.attr&&(e.options=r.attr),e}function goe(i,r){var e,t={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};r!=null&&(r.fixed!=null&&(t.nodes.fixed=r.fixed),r.parseColor!=null&&(t.nodes.parseColor=r.parseColor),r.inheritColor!=null&&(t.edges.inheritColor=r.inheritColor));var n=i.edges,a=na(n).call(n,function(s){var u={from:s.source,id:s.id,to:s.target};return s.attributes!=null&&(u.attributes=s.attributes),s.label!=null&&(u.label=s.label),s.attributes!=null&&s.attributes.title!=null&&(u.title=s.attributes.title),s.type==="Directed"&&(u.arrows="to"),s.color&&t.edges.inheritColor===!1&&(u.color=s.color),u}),o=na(e=i.nodes).call(e,function(s){var u={id:s.id,fixed:t.nodes.fixed&&s.x!=null&&s.y!=null};return s.attributes!=null&&(u.attributes=s.attributes),s.label!=null&&(u.label=s.label),s.size!=null&&(u.size=s.size),s.attributes!=null&&s.attributes.title!=null&&(u.title=s.attributes.title),s.title!=null&&(u.title=s.title),s.x!=null&&(u.x=s.x),s.y!=null&&(u.y=s.y),s.color!=null&&(t.nodes.parseColor===!0?u.color=s.color:u.color={background:s.color,border:s.color,highlight:{background:s.color,border:s.color},hover:{background:s.color,border:s.color}}),u});return{nodes:o,edges:a}}var yoe={addDescription:"Click in an empty space to place a new node.",addEdge:"Add Edge",addNode:"Add Node",back:"Back",close:"Close",createEdgeError:"Cannot link edges to a cluster.",del:"Delete selected",deleteClusterError:"Clusters cannot be deleted.",edgeDescription:"Click on a node and drag the edge to another node to connect them.",edit:"Edit",editClusterError:"Clusters cannot be edited.",editEdge:"Edit Edge",editEdgeDescription:"Click on the control points and drag them to a node to connect to it.",editNode:"Edit Node"},moe={addDescription:"Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.",addEdge:"Kante hinzufügen",addNode:"Knoten hinzufügen",back:"Zurück",close:"Schließen",createEdgeError:"Es ist nicht möglich, Kanten mit Clustern zu verbinden.",del:"Lösche Auswahl",deleteClusterError:"Cluster können nicht gelöscht werden.",edgeDescription:"Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.",edit:"Editieren",editClusterError:"Cluster können nicht editiert werden.",editEdge:"Kante editieren",editEdgeDescription:"Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.",editNode:"Knoten editieren"},boe={addDescription:"Haga clic en un lugar vacío para colocar un nuevo nodo.",addEdge:"Añadir arista",addNode:"Añadir nodo",back:"Atrás",close:"Cerrar",createEdgeError:"No se puede conectar una arista a un grupo.",del:"Eliminar selección",deleteClusterError:"No es posible eliminar grupos.",edgeDescription:"Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.",edit:"Editar",editClusterError:"No es posible editar grupos.",editEdge:"Editar arista",editEdgeDescription:"Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.",editNode:"Editar nodo"},$oe={addDescription:"Clicca per aggiungere un nuovo nodo",addEdge:"Aggiungi un vertice",addNode:"Aggiungi un nodo",back:"Indietro",close:"Chiudere",createEdgeError:"Non si possono collegare vertici ad un cluster",del:"Cancella la selezione",deleteClusterError:"I cluster non possono essere cancellati",edgeDescription:"Clicca su un nodo e trascinalo ad un altro nodo per connetterli.",edit:"Modifica",editClusterError:"I clusters non possono essere modificati.",editEdge:"Modifica il vertice",editEdgeDescription:"Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.",editNode:"Modifica il nodo"},woe={addDescription:"Klik op een leeg gebied om een nieuwe node te maken.",addEdge:"Link toevoegen",addNode:"Node toevoegen",back:"Terug",close:"Sluiten",createEdgeError:"Kan geen link maken naar een cluster.",del:"Selectie verwijderen",deleteClusterError:"Clusters kunnen niet worden verwijderd.",edgeDescription:"Klik op een node en sleep de link naar een andere node om ze te verbinden.",edit:"Wijzigen",editClusterError:"Clusters kunnen niet worden aangepast.",editEdge:"Link wijzigen",editEdgeDescription:"Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.",editNode:"Node wijzigen"},_oe={addDescription:"Clique em um espaço em branco para adicionar um novo nó",addEdge:"Adicionar aresta",addNode:"Adicionar nó",back:"Voltar",close:"Fechar",createEdgeError:"Não foi possível linkar arestas a um cluster.",del:"Remover selecionado",deleteClusterError:"Clusters não puderam ser removidos.",edgeDescription:"Clique em um nó e arraste a aresta até outro nó para conectá-los",edit:"Editar",editClusterError:"Clusters não puderam ser editados.",editEdge:"Editar aresta",editEdgeDescription:"Clique nos pontos de controle e os arraste para um nó para conectá-los",editNode:"Editar nó"},Eoe={addDescription:"Кликните в свободное место, чтобы добавить новый узел.",addEdge:"Добавить ребро",addNode:"Добавить узел",back:"Назад",close:"Закрывать",createEdgeError:"Невозможно соединить ребра в кластер.",del:"Удалить выбранное",deleteClusterError:"Кластеры не могут быть удалены",edgeDescription:"Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.",edit:"Редактировать",editClusterError:"Кластеры недоступны для редактирования.",editEdge:"Редактировать ребро",editEdgeDescription:"Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.",editNode:"Редактировать узел"},Soe={addDescription:"单击空白处放置新节点。",addEdge:"添加连接线",addNode:"添加节点",back:"返回",close:"關閉",createEdgeError:"无法将连接线连接到群集。",del:"删除选定",deleteClusterError:"无法删除群集。",edgeDescription:"单击某个节点并将该连接线拖动到另一个节点以连接它们。",edit:"编辑",editClusterError:"无法编辑群集。",editEdge:"编辑连接线",editEdgeDescription:"单击控制节点并将它们拖到节点上连接。",editNode:"编辑节点"},Ooe={addDescription:"Kлікніть на вільне місце, щоб додати новий вузол.",addEdge:"Додати край",addNode:"Додати вузол",back:"Назад",close:"Закрити",createEdgeError:"Не можливо об'єднати краї в групу.",del:"Видалити обране",deleteClusterError:"Групи не можуть бути видалені.",edgeDescription:"Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з'єднати.",edit:"Редагувати",editClusterError:"Групи недоступні для редагування.",editEdge:"Редагувати край",editEdgeDescription:"Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.",editNode:"Редагувати вузол"},Toe={addDescription:"Cliquez dans un endroit vide pour placer un nœud.",addEdge:"Ajouter un lien",addNode:"Ajouter un nœud",back:"Retour",close:"Fermer",createEdgeError:"Impossible de créer un lien vers un cluster.",del:"Effacer la sélection",deleteClusterError:"Les clusters ne peuvent pas être effacés.",edgeDescription:"Cliquez sur un nœud et glissez le lien vers un autre nœud pour les connecter.",edit:"Éditer",editClusterError:"Les clusters ne peuvent pas être édités.",editEdge:"Éditer le lien",editEdgeDescription:"Cliquez sur les points de contrôle et glissez-les pour connecter un nœud.",editNode:"Éditer le nœud"},Ioe={addDescription:"Kluknutím do prázdného prostoru můžete přidat nový vrchol.",addEdge:"Přidat hranu",addNode:"Přidat vrchol",back:"Zpět",close:"Zavřít",createEdgeError:"Nelze připojit hranu ke shluku.",del:"Smazat výběr",deleteClusterError:"Nelze mazat shluky.",edgeDescription:"Přetažením z jednoho vrcholu do druhého můžete spojit tyto vrcholy novou hranou.",edit:"Upravit",editClusterError:"Nelze upravovat shluky.",editEdge:"Upravit hranu",editEdgeDescription:"Přetažením kontrolního vrcholu hrany ji můžete připojit k jinému vrcholu.",editNode:"Upravit vrchol"},koe=Object.freeze({__proto__:null,cn:Soe,cs:Ioe,de:moe,en:yoe,es:boe,fr:Toe,it:$oe,nl:woe,pt:_oe,ru:Eoe,uk:Ooe});function Poe(i,r){try{var e=r.split(/[-_ /]/,2),t=Te(e,2),n=t[0],a=t[1],o=n!=null?n.toLowerCase():null,s=a!=null?a.toUpperCase():null;if(o&&s){var u=o+"-"+s;if(Object.prototype.hasOwnProperty.call(i,u))return u;var l;console.warn(Gv(l="Unknown variant ".concat(s," of language ")).call(l,o,"."))}if(o){var h=o;if(Object.prototype.hasOwnProperty.call(i,h))return h;console.warn("Unknown language ".concat(o))}return console.warn("Unknown locale ".concat(r,", falling back to English.")),"en"}catch(d){return console.error(d),console.warn("Unexpected error while normalizing locale ".concat(r,", falling back to English.")),"en"}}var xoe=function(){function i(){N(this,i),this.NUM_ITERATIONS=4,this.image=new Image,this.canvas=document.createElement("canvas")}return M(i,[{key:"init",value:function(){if(!this.initialized()){this.src=this.image.src;var e=this.image.width,t=this.image.height;this.width=e,this.height=t;var n=Math.floor(t/2),a=Math.floor(t/4),o=Math.floor(t/8),s=Math.floor(t/16),u=Math.floor(e/2),l=Math.floor(e/4),h=Math.floor(e/8),d=Math.floor(e/16);this.canvas.width=3*l,this.canvas.height=n,this.coordinates=[[0,0,u,n],[u,0,l,a],[u,a,h,o],[5*h,a,d,s]],this._fillMipMap()}}},{key:"initialized",value:function(){return this.coordinates!==void 0}},{key:"_fillMipMap",value:function(){var e=this.canvas.getContext("2d"),t=this.coordinates[0];e.drawImage(this.image,t[0],t[1],t[2],t[3]);for(var n=1;n2){t*=.5;for(var u=0;t>2&&u=this.NUM_ITERATIONS&&(u=this.NUM_ITERATIONS-1);var l=this.coordinates[u];e.drawImage(this.canvas,l[0],l[1],l[2],l[3],n,a,o,s)}else e.drawImage(this.image,n,a,o,s)}}]),i}(),Coe=function(){function i(r){N(this,i),this.images={},this.imageBroken={},this.callback=r}return M(i,[{key:"_tryloadBrokenUrl",value:function(e,t,n){if(!(e===void 0||n===void 0)){if(t===void 0){console.warn("No broken url image defined");return}n.image.onerror=function(){console.error("Could not load brokenImage:",t)},n.image.src=t}}},{key:"_redrawWithImage",value:function(e){this.callback&&this.callback(e)}},{key:"load",value:function(e,t){var n=this,a=this.images[e];if(a)return a;var o=new xoe;return this.images[e]=o,o.image.onload=function(){n._fixImageCoordinates(o.image),o.init(),n._redrawWithImage(o)},o.image.onerror=function(){console.error("Could not load image:",e),n._tryloadBrokenUrl(e,t,o)},o.image.src=e,o}},{key:"_fixImageCoordinates",value:function(e){e.width===0&&(document.body.appendChild(e),e.width=e.offsetWidth,e.height=e.offsetHeight,document.body.removeChild(e))}}]),i}(),lT={exports:{}},Aoe=ne,Doe=Aoe(function(){if(typeof ArrayBuffer=="function"){var i=new ArrayBuffer(8);Object.isExtensible(i)&&Object.defineProperty(i,"a",{value:8})}}),Roe=ne,Noe=Je,Moe=Hr,N1=Doe,$u=Object.isExtensible,Boe=Roe(function(){$u(1)}),Foe=Boe||N1?function(r){return!Noe(r)||N1&&Moe(r)==="ArrayBuffer"?!1:$u?$u(r):!0}:$u,joe=ne,hT=!joe(function(){return Object.isExtensible(Object.preventExtensions({}))}),Loe=q,zoe=oe,Hoe=ts,Voe=Je,ap=Ze,Woe=Ht.f,M1=as,Uoe=Wl,op=Foe,Koe=Dl,Goe=hT,cT=!1,jr=Koe("meta"),qoe=0,sp=function(i){Woe(i,jr,{value:{objectID:"O"+qoe++,weakData:{}}})},Yoe=function(i,r){if(!Voe(i))return typeof i=="symbol"?i:(typeof i=="string"?"S":"P")+i;if(!ap(i,jr)){if(!op(i))return"F";if(!r)return"E";sp(i)}return i[jr].objectID},Xoe=function(i,r){if(!ap(i,jr)){if(!op(i))return!0;if(!r)return!1;sp(i)}return i[jr].weakData},Joe=function(i){return Goe&&cT&&op(i)&&!ap(i,jr)&&sp(i),i},Zoe=function(){Qoe.enable=function(){},cT=!0;var i=M1.f,r=zoe([].splice),e={};e[jr]=1,i(e).length&&(M1.f=function(t){for(var n=i(t),a=0,o=n.length;ad;d++)if(f=y(i[d]),f&&B1(j1,f))return f;return new wu(!1)}l=ose(i,h)}for(v=a?i.next:l.next;!(p=tse(v,l)).done;){try{f=y(p.value)}catch(m){F1(l,"throw",m)}if(typeof f=="object"&&f&&B1(j1,f))return f}return new wu(!1)},lse=Me,hse=TypeError,lp=function(i,r){if(lse(r,i))return i;throw new hse("Incorrect invocation")},cse=q,dse=Pe,fse=eh,vse=ne,pse=Pa,gse=up,yse=lp,mse=Ye,bse=Je,$se=Oa,wse=Ca,_se=Ht.f,Ese=mi.forEach,Sse=Xe,dT=ln,Ose=dT.set,Tse=dT.getterFor,hp=function(i,r,e){var t=i.indexOf("Map")!==-1,n=i.indexOf("Weak")!==-1,a=t?"set":"add",o=dse[i],s=o&&o.prototype,u={},l;if(!Sse||!mse(o)||!(n||s.forEach&&!vse(function(){new o().entries().next()})))l=e.getConstructor(r,i,t,a),fse.enable();else{l=r(function(c,f){Ose(yse(c,h),{type:i,collection:new o}),$se(f)||gse(f,c[a],{that:c,AS_ENTRIES:t})});var h=l.prototype,d=Tse(i);Ese(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(c){var f=c==="add"||c==="set";c in s&&!(n&&c==="clear")&&pse(h,c,function(v,p){var g=d(this).collection;if(!f&&n&&!bse(v))return c==="get"?void 0:!1;var y=g[c](v===0?0:v,p);return f?this:y})}),n||_se(h,"size",{configurable:!0,get:function(){return d(this).collection.size}})}return wse(l,i,!1,!0),u[i]=l,cse({global:!0,forced:!0},u),n||e.setStrong(l,i,t),l},Ise=is,cp=function(i,r,e){for(var t in r)e&&e.unsafe&&i[t]?i[t]=r[t]:Ise(i,t,r[t],e);return i},kse=Jt,Pse=zv,xse=xe,Cse=Xe,L1=xse("species"),Ase=function(i){var r=kse(i);Cse&&r&&!r[L1]&&Pse(r,L1,{configurable:!0,get:function(){return this}})},Dse=xa,Rse=zv,z1=cp,Nse=Qo,Mse=lp,Bse=Oa,Fse=up,jse=Mv,eu=Bv,Lse=Ase,Ha=Xe,H1=eh.fastKey,fT=ln,V1=fT.set,ld=fT.getterFor,vT={getConstructor:function(i,r,e,t){var n=i(function(l,h){Mse(l,a),V1(l,{type:r,index:Dse(null),first:void 0,last:void 0,size:0}),Ha||(l.size=0),Bse(h)||Fse(h,l[t],{that:l,AS_ENTRIES:e})}),a=n.prototype,o=ld(r),s=function(l,h,d){var c=o(l),f=u(l,h),v,p;return f?f.value=d:(c.last=f={index:p=H1(h,!0),key:h,value:d,previous:v=c.last,next:void 0,removed:!1},c.first||(c.first=f),v&&(v.next=f),Ha?c.size++:l.size++,p!=="F"&&(c.index[p]=f)),l},u=function(l,h){var d=o(l),c=H1(h),f;if(c!=="F")return d.index[c];for(f=d.first;f;f=f.next)if(f.key===h)return f};return z1(a,{clear:function(){for(var h=this,d=o(h),c=d.index,f=d.first;f;)f.removed=!0,f.previous&&(f.previous=f.previous.next=void 0),delete c[f.index],f=f.next;d.first=d.last=void 0,Ha?d.size=0:h.size=0},delete:function(l){var h=this,d=o(h),c=u(h,l);if(c){var f=c.next,v=c.previous;delete d.index[c.index],c.removed=!0,v&&(v.next=f),f&&(f.previous=v),d.first===c&&(d.first=f),d.last===c&&(d.last=v),Ha?d.size--:h.size--}return!!c},forEach:function(h){for(var d=o(this),c=Nse(h,arguments.length>1?arguments[1]:void 0),f;f=f?f.next:d.first;)for(c(f.value,f.key,this);f&&f.removed;)f=f.previous},has:function(h){return!!u(this,h)}}),z1(a,e?{get:function(h){var d=u(this,h);return d&&d.value},set:function(h,d){return s(this,h===0?0:h,d)}}:{add:function(h){return s(this,h=h===0?0:h,h)}}),Ha&&Rse(a,"size",{configurable:!0,get:function(){return o(this).size}}),n},setStrong:function(i,r,e){var t=r+" Iterator",n=ld(r),a=ld(t);jse(i,r,function(o,s){V1(this,{type:t,target:o,state:n(o),kind:s,last:void 0})},function(){for(var o=a(this),s=o.kind,u=o.last;u&&u.removed;)u=u.previous;return!o.target||!(o.last=u=u?u.next:o.state.first)?(o.target=void 0,eu(void 0,!0)):eu(s==="keys"?u.key:s==="values"?u.value:[u.key,u.value],!1)},e?"entries":"values",!e,!0),Lse(r)}},zse=hp,Hse=vT;zse("Map",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},Hse);var Vse=ae,Wse=Vse.Map,Use=Wse,Kse=Use,Gse=Kse,pT=V(Gse),qse=function(){function i(){N(this,i),this.clear(),this._defaultIndex=0,this._groupIndex=0,this._defaultGroups=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}},{border:"#990000",background:"#EE0000",highlight:{border:"#BB0000",background:"#FF3333"},hover:{border:"#BB0000",background:"#FF3333"}},{border:"#FF6000",background:"#FF6000",highlight:{border:"#FF6000",background:"#FF6000"},hover:{border:"#FF6000",background:"#FF6000"}},{border:"#97C2FC",background:"#2B7CE9",highlight:{border:"#D2E5FF",background:"#2B7CE9"},hover:{border:"#D2E5FF",background:"#2B7CE9"}},{border:"#399605",background:"#255C03",highlight:{border:"#399605",background:"#255C03"},hover:{border:"#399605",background:"#255C03"}},{border:"#B70054",background:"#FF007E",highlight:{border:"#B70054",background:"#FF007E"},hover:{border:"#B70054",background:"#FF007E"}},{border:"#AD85E4",background:"#7C29F0",highlight:{border:"#D3BDF0",background:"#7C29F0"},hover:{border:"#D3BDF0",background:"#7C29F0"}},{border:"#4557FA",background:"#000EA1",highlight:{border:"#6E6EFD",background:"#000EA1"},hover:{border:"#6E6EFD",background:"#000EA1"}},{border:"#FFC0CB",background:"#FD5A77",highlight:{border:"#FFD1D9",background:"#FD5A77"},hover:{border:"#FFD1D9",background:"#FD5A77"}},{border:"#C2FABC",background:"#74D66A",highlight:{border:"#E6FFE3",background:"#74D66A"},hover:{border:"#E6FFE3",background:"#74D66A"}},{border:"#EE0000",background:"#990000",highlight:{border:"#FF3333",background:"#BB0000"},hover:{border:"#FF3333",background:"#BB0000"}}],this.options={},this.defaultOptions={useDefaultGroups:!0},je(this.options,this.defaultOptions)}return M(i,[{key:"setOptions",value:function(e){var t=["useDefaultGroups"];if(e!==void 0){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&ie(t).call(t,n)===-1){var a=e[n];this.add(n,a)}}}},{key:"clear",value:function(){this._groups=new pT,this._groupNames=[]}},{key:"get",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this._groups.get(e);if(n===void 0&&t)if(this.options.useDefaultGroups===!1&&this._groupNames.length>0){var a=this._groupIndex%this._groupNames.length;++this._groupIndex,n={},n.color=this._groups.get(this._groupNames[a]),this._groups.set(e,n)}else{var o=this._defaultIndex%this._defaultGroups.length;this._defaultIndex++,n={},n.color=this._defaultGroups[o],this._groups.set(e,n)}return n}},{key:"add",value:function(e,t){return this._groups.has(e)||this._groupNames.push(e),this._groups.set(e,t),t}}]),i}(),Yse=q;Yse({target:"Number",stat:!0},{isNaN:function(r){return r!==r}});var Xse=ae,Jse=Xse.Number.isNaN,Zse=Jse,Qse=Zse,eue=Qse,Cf=V(eue),tue=Pe,rue=tue.isFinite,iue=Number.isFinite||function(r){return typeof r=="number"&&rue(r)},nue=q,aue=iue;nue({target:"Number",stat:!0},{isFinite:aue});var oue=ae,sue=oue.Number.isFinite,uue=sue,lue=uue,hue=lue,Di=V(hue),cue=q,due=mi.some,fue=Ra,vue=fue("some");cue({target:"Array",proto:!0,forced:!vue},{some:function(r){return due(this,r,arguments.length>1?arguments[1]:void 0)}});var pue=Qe,gue=pue("Array").some,yue=Me,mue=gue,hd=Array.prototype,bue=function(i){var r=i.some;return i===hd||yue(hd,i)&&r===hd.some?mue:r},$ue=bue,wue=$ue,_ue=wue,Eue=V(_ue),Sue=ae,Oue=Sue.Object.getOwnPropertySymbols,Tue=Oue,Iue=Tue,kue=Iue,di=V(kue),gT={exports:{}},Pue=q,xue=ne,Cue=wr,yT=Sa.f,mT=Xe,Aue=!mT||xue(function(){yT(1)});Pue({target:"Object",stat:!0,forced:Aue,sham:!mT},{getOwnPropertyDescriptor:function(r,e){return yT(Cue(r),e)}});var Due=ae,bT=Due.Object,Rue=gT.exports=function(r,e){return bT.getOwnPropertyDescriptor(r,e)};bT.getOwnPropertyDescriptor.sham&&(Rue.sham=!0);var Nue=gT.exports,Mue=Nue,$T=Mue,Bue=$T,$i=V(Bue),Fue=q,jue=Xe,Lue=rte,zue=wr,Hue=Sa,Vue=Da;Fue({target:"Object",stat:!0,sham:!jue},{getOwnPropertyDescriptors:function(r){for(var e=zue(r),t=Hue.f,n=Lue(e),a={},o=0,s,u;n.length>o;)u=t(e,s=n[o++]),u!==void 0&&Vue(a,s,u);return a}});var Wue=ae,Uue=Wue.Object.getOwnPropertyDescriptors,Kue=Uue,Gue=Kue,que=Gue,fi=V(que),wT={exports:{}},Yue=q,Xue=Xe,W1=jl.f;Yue({target:"Object",stat:!0,forced:Object.defineProperties!==W1,sham:!Xue},{defineProperties:W1});var Jue=ae,_T=Jue.Object,Zue=wT.exports=function(r,e){return _T.defineProperties(r,e)};_T.defineProperties.sham&&(Zue.sham=!0);var Que=wT.exports,ele=Que,tle=ele,rle=tle,th=V(rle),ile=TS,rh=V(ile);function ih(i,r,e){return r=aO(r),r in i?Vl(i,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[r]=e,i}var ET=Pe,nle=ne,ale=oe,ole=_r,sle=yO.trim,ule=qv,lle=ale("".charAt),Ju=ET.parseFloat,U1=ET.Symbol,K1=U1&&U1.iterator,hle=1/Ju(ule+"-0")!==-1/0||K1&&!nle(function(){Ju(Object(K1))}),cle=hle?function(r){var e=sle(ole(r)),t=Ju(e);return t===0&&lle(e,0)==="-"?-0:t}:Ju,dle=q,G1=cle;dle({global:!0,forced:parseFloat!==G1},{parseFloat:G1});var fle=ae,vle=fle.parseFloat,ple=vle,gle=ple,yle=gle,ST=V(yle),mle=q,ble=ne,$le=Wl.f,wle=ble(function(){return!Object.getOwnPropertyNames(1)});mle({target:"Object",stat:!0,forced:wle},{getOwnPropertyNames:$le});var _le=ae,Ele=_le.Object,Sle=function(r){return Ele.getOwnPropertyNames(r)},Ole=Sle,Tle=Ole,Ile=Tle,kle=V(Ile);function dp(i,r){var e=["node","edge","label"],t=!0,n=Xr(r,"chosen");if(typeof n=="boolean")t=n;else if(fe(n)==="object"){if(ie(e).call(e,i)===-1)throw new Error("choosify: subOption '"+i+"' should be one of '"+e.join("', '")+"'");var a=Xr(r,["chosen",i]);(typeof a=="boolean"||typeof a=="function")&&(t=a)}return t}function Af(i,r,e){if(i.width<=0||i.height<=0)return!1;if(e!==void 0){var t={x:r.x-e.x,y:r.y-e.y};if(e.angle!==0){var n=-e.angle,a={x:Math.cos(n)*t.x-Math.sin(n)*t.y,y:Math.sin(n)*t.x+Math.cos(n)*t.y};r=a}else r=t}var o=i.x+i.width,s=i.y+i.width;return i.leftr.x&&i.topr.y}function Zu(i){return typeof i=="string"&&i!==""}function OT(i,r,e,t){var n=t.x,a=t.y;if(typeof t.distanceToBorder=="function"){var o=t.distanceToBorder(i,r),s=Math.sin(r)*o,u=Math.cos(r)*o;u===o?(n+=o,a=t.y):s===o?(n=t.x,a-=o):(n+=u,a-=s)}else t.shape.width>t.shape.height?(n=t.x+t.shape.width*.5,a=t.y-e):(n=t.x+e,a=t.y-t.shape.height*.5);return{x:n,y:a}}var Ple=Qe,xle=Ple("Array").values,Cle=xle,Ale=Cle,Dle=un,Rle=Ze,Nle=Me,Mle=Ale,cd=Array.prototype,Ble={DOMTokenList:!0,NodeList:!0},Fle=function(i){var r=i.values;return i===cd||Nle(cd,i)&&r===cd.values||Rle(Ble,Dle(i))?Mle:r},jle=Fle,TT=V(jle),Lle=function(){function i(r){N(this,i),this.measureText=r,this.current=0,this.width=0,this.height=0,this.lines=[]}return M(i,[{key:"_add",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"normal";this.lines[e]===void 0&&(this.lines[e]={width:0,height:0,blocks:[]});var a=t;(t===void 0||t==="")&&(a=" ");var o=this.measureText(a,n),s=je({},TT(o));s.text=t,s.width=o.width,s.mod=n,(t===void 0||t==="")&&(s.width=0),this.lines[e].blocks.push(s),this.lines[e].width+=s.width}},{key:"curWidth",value:function(){var e=this.lines[this.current];return e===void 0?0:e.width}},{key:"append",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t)}},{key:"newLine",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t),this.current++}},{key:"determineLineHeights",value:function(){for(var e=0;ee&&(e=a.width),t+=a.height}this.width=e,this.height=t}},{key:"removeEmptyBlocks",value:function(){for(var e=[],t=0;t"://,""://,""://,"":/<\/b>/,"":/<\/i>/,"":/<\/code>/,"*":/\*/,_:/_/,"`":/`/,afterBold:/[^*]/,afterItal:/[^_]/,afterMono:/[^`]/},q1=function(){function i(r){N(this,i),this.text=r,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer="",this.modStack=[],this.blocks=[]}return M(i,[{key:"mod",value:function(){return this.modStack.length===0?"normal":this.modStack[0]}},{key:"modName",value:function(){if(this.modStack.length===0)return"normal";if(this.modStack[0]==="mono")return"mono";if(this.bold&&this.ital)return"boldital";if(this.bold)return"bold";if(this.ital)return"ital"}},{key:"emitBlock",value:function(){this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(this.blocks.push({text:this.buffer,mod:this.modName()}),this.buffer="")}},{key:"add",value:function(e){e===" "&&(this.spacing=!0),this.spacing&&(this.buffer+=" ",this.spacing=!1),e!=" "&&(this.buffer+=e)}},{key:"parseWS",value:function(e){return/[ \t]/.test(e)?(this.mono?this.add(e):this.spacing=!0,!0):!1}},{key:"setTag",value:function(e){this.emitBlock(),this[e]=!0,this.modStack.unshift(e)}},{key:"unsetTag",value:function(e){this.emitBlock(),this[e]=!1,this.modStack.shift()}},{key:"parseStartTag",value:function(e,t){return!this.mono&&!this[e]&&this.match(t)?(this.setTag(e),!0):!1}},{key:"match",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this.prepareRegExp(e),a=Te(n,2),o=a[0],s=a[1],u=o.test(this.text.substr(this.position,s));return u&&t&&(this.position+=s-1),u}},{key:"parseEndTag",value:function(e,t,n){var a=this.mod()===e;return e==="mono"?a=a&&this.mono:a=a&&!this.mono,a&&this.match(t)?(n!==void 0?(this.position===this.text.length-1||this.match(n,!1))&&this.unsetTag(e):this.unsetTag(e),!0):!1}},{key:"replace",value:function(e,t){return this.match(e)?(this.add(t),this.position+=length-1,!0):!1}},{key:"prepareRegExp",value:function(e){var t,n;if(e instanceof RegExp)n=e,t=1;else{var a=zle[e];a!==void 0?n=a:n=new RegExp(e),t=e.length}return[n,t]}}]),i}(),Hle=function(){function i(r,e,t,n){var a=this;N(this,i),this.ctx=r,this.parent=e,this.selected=t,this.hover=n;var o=function(u,l){if(u===void 0)return 0;var h=a.parent.getFormattingValues(r,t,n,l),d=0;if(u!==""){var c=a.ctx.measureText(u);d=c.width}return{width:d,values:h}};this.lines=new Lle(o)}return M(i,[{key:"process",value:function(e){if(!Zu(e))return this.lines.finalize();var t=this.parent.fontOptions;e=e.replace(/\r\n/g,` +`}},{key:"print",value:function(e){return ls(e).replace(/(")|(\[)|(\])|(,"__type__")/g,"").replace(/(,)/g,", ")}},{key:"levenshteinDistance",value:function(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;var n=[],a;for(a=0;a<=t.length;a++)n[a]=[a];var o;for(o=0;o<=e.length;o++)n[0][o]=o;for(a=1;a<=t.length;a++)for(o=1;o<=e.length;o++)t.charAt(a-1)==e.charAt(o-1)?n[a][o]=n[a-1][o-1]:n[a][o]=Math.min(n[a-1][o-1]+1,Math.min(n[a][o-1]+1,n[a-1][o]+1));return n[t.length][e.length]}}]),i}(),roe=gr,ioe=Qae,Gn=rp,noe=eoe,tT=xf,aoe=toe;function ooe(i){return ri=i,hoe()}var rT={fontsize:"font.size",fontcolor:"font.color",labelfontcolor:"font.color",fontname:"font.face",color:["color.border","color.background"],fillcolor:"color.background",tooltip:"title",labeltooltip:"title"},np=zi(rT);np.color="color.color";np.style="dashes";var ft={NULL:0,DELIMITER:1,IDENTIFIER:2,UNKNOWN:3},A1={"{":!0,"}":!0,"[":!0,"]":!0,";":!0,"=":!0,",":!0,"->":!0,"--":!0},ri="",ua=0,ee="",G="",_t=ft.NULL;function soe(){ua=0,ee=ri.charAt(0)}function Ue(){ua++,ee=ri.charAt(ua)}function kn(){return ri.charAt(ua+1)}function D1(i){var r=i.charCodeAt(0);return r<47?r===35||r===46:r<59?r>47:r<91?r>64:r<96?r===95:r<123?r>96:!1}function vi(i,r){if(i||(i={}),r)for(var e in r)r.hasOwnProperty(e)&&(i[e]=r[e]);return i}function uoe(i,r,e){for(var t=r.split("."),n=i;t.length;){var a=t.shift();t.length?(n[a]||(n[a]={}),n=n[a]):n[a]=e}}function iT(i,r){for(var e,t,n=null,a=[i],o=i;o.parent;)a.push(o.parent),o=o.parent;if(o.nodes){for(e=0,t=o.nodes.length;e=0;e--){var s,u=a[e];u.nodes||(u.nodes=[]),ne(s=u.nodes).call(s,n)===-1&&u.nodes.push(n)}r.attr&&(n.attr=vi(n.attr,r.attr))}function loe(i,r){if(i.edges||(i.edges=[]),i.edges.push(r),i.edge){var e=vi({},i.edge);r.attr=vi(e,r.attr)}}function nT(i,r,e,t,n){var a={from:r,to:e,type:t};return i.edge&&(a.attr=vi({},i.edge)),a.attr=vi(a.attr||{},n),n!=null&&n.hasOwnProperty("arrows")&&n.arrows!=null&&(a.arrows={to:{enabled:!0,type:n.arrows.type}},n.arrows=null),a}function ge(){for(_t=ft.NULL,G="";ee===" "||ee===" "||ee===` +`||ee==="\r";)Ue();do{var i=!1;if(ee==="#"){for(var r=ua-1;ri.charAt(r)===" "||ri.charAt(r)===" ";)r--;if(ri.charAt(r)===` +`||ri.charAt(r)===""){for(;ee!=""&&ee!=` +`;)Ue();i=!0}}if(ee==="/"&&kn()==="/"){for(;ee!=""&&ee!=` +`;)Ue();i=!0}if(ee==="/"&&kn()==="*"){for(;ee!="";)if(ee==="*"&&kn()==="/"){Ue(),Ue();break}else Ue();i=!0}for(;ee===" "||ee===" "||ee===` +`||ee==="\r";)Ue()}while(i);if(ee===""){_t=ft.DELIMITER;return}var e=ee+kn();if(A1[e]){_t=ft.DELIMITER,G=e,Ue(),Ue();return}if(A1[ee]){_t=ft.DELIMITER,G=ee,Ue();return}if(D1(ee)||ee==="-"){for(G+=ee,Ue();D1(ee);)G+=ee,Ue();G==="false"?G=!1:G==="true"?G=!0:isNaN(Number(G))||(G=Number(G)),_t=ft.IDENTIFIER;return}if(ee==='"'){for(Ue();ee!=""&&(ee!='"'||ee==='"'&&kn()==='"');)ee==='"'?(G+=ee,Ue()):ee==="\\"&&kn()==="n"?(G+=` +`,Ue()):G+=ee,Ue();if(ee!='"')throw vt('End of string " expected');Ue(),_t=ft.IDENTIFIER;return}for(_t=ft.UNKNOWN;ee!="";)G+=ee,Ue();throw new SyntaxError('Syntax error in part "'+uT(G,30)+'"')}function hoe(){var i={};if(soe(),ge(),G==="strict"&&(i.strict=!0,ge()),(G==="graph"||G==="digraph")&&(i.type=G,ge()),_t===ft.IDENTIFIER&&(i.id=G,ge()),G!="{")throw vt("Angle bracket { expected");if(ge(),aT(i),G!="}")throw vt("Angle bracket } expected");if(ge(),G!=="")throw vt("End of file expected");return ge(),delete i.node,delete i.edge,delete i.graph,i}function aT(i){for(;G!==""&&G!="}";)coe(i),G===";"&&ge()}function coe(i){var r=oT(i);if(r){sT(i,r);return}var e=doe(i);if(!e){if(_t!=ft.IDENTIFIER)throw vt("Identifier expected");var t=G;if(ge(),G==="="){if(ge(),_t!=ft.IDENTIFIER)throw vt("Identifier expected");i[t]=G,ge()}else foe(i,t)}}function oT(i){var r=null;if(G==="subgraph"&&(r={},r.type="subgraph",ge(),_t===ft.IDENTIFIER&&(r.id=G,ge())),G==="{"){if(ge(),r||(r={}),r.parent=i,r.node=i.node,r.edge=i.edge,r.graph=i.graph,aT(r),G!="}")throw vt("Angle bracket } expected");ge(),delete r.node,delete r.edge,delete r.graph,delete r.parent,i.subgraphs||(i.subgraphs=[]),i.subgraphs.push(r)}return r}function doe(i){return G==="node"?(ge(),i.node=io(),"node"):G==="edge"?(ge(),i.edge=io(),"edge"):G==="graph"?(ge(),i.graph=io(),"graph"):null}function foe(i,r){var e={id:r},t=io();t&&(e.attr=t),iT(i,e),sT(i,r)}function sT(i,r){for(;G==="->"||G==="--";){var e,t=G;ge();var n=oT(i);if(n)e=n;else{if(_t!=ft.IDENTIFIER)throw vt("Identifier or subgraph expected");e=G,iT(i,{id:e}),ge()}var a=io(),o=nT(i,r,e,t,a);loe(i,o),r=e}}function io(){for(var i,r=null,e={dashed:!0,solid:!1,dotted:[1,5]},t={dot:"circle",box:"box",crow:"crow",curve:"curve",icurve:"inv_curve",normal:"triangle",inv:"inv_triangle",diamond:"diamond",tee:"bar",vee:"vee"},n=new Array,a=new Array;G==="[";){for(ge(),r={};G!==""&&G!="]";){if(_t!=ft.IDENTIFIER)throw vt("Attribute name expected");var o=G;if(ge(),G!="=")throw vt("Equal sign = expected");if(ge(),_t!=ft.IDENTIFIER)throw vt("Attribute value expected");var s=G;o==="style"&&(s=e[s]);var u;o==="arrowhead"&&(u=t[s],o="arrows",s={to:{enabled:!0,type:u}}),o==="arrowtail"&&(u=t[s],o="arrows",s={from:{enabled:!0,type:u}}),n.push({attr:r,name:o,value:s}),a.push(o),ge(),G==","&&ge()}if(G!="]")throw vt("Bracket ] expected");ge()}if(hi(a).call(a,"dir")){var l={};for(l.arrows={},i=0;i"&&(u.arrows="to"),u};fe(n=r.edges).call(n,function(o){var s,u;if(o.from instanceof Object?s=o.from.nodes:s={id:o.from},o.to instanceof Object?u=o.to.nodes:u={id:o.to},o.from instanceof Object&&o.from.edges){var l;fe(l=o.from.edges).call(l,function(c){var d=a(c);e.edges.push(d)})}if(voe(s,u,function(c,d){var f=nT(e,c.id,d.id,o.type,o.attr),v=a(f);e.edges.push(v)}),o.to instanceof Object&&o.to.edges){var h;fe(h=o.to.edges).call(h,function(c){var d=a(c);e.edges.push(d)})}})}return r.attr&&(e.options=r.attr),e}function goe(i,r){var e,t={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};r!=null&&(r.fixed!=null&&(t.nodes.fixed=r.fixed),r.parseColor!=null&&(t.nodes.parseColor=r.parseColor),r.inheritColor!=null&&(t.edges.inheritColor=r.inheritColor));var n=i.edges,a=na(n).call(n,function(s){var u={from:s.source,id:s.id,to:s.target};return s.attributes!=null&&(u.attributes=s.attributes),s.label!=null&&(u.label=s.label),s.attributes!=null&&s.attributes.title!=null&&(u.title=s.attributes.title),s.type==="Directed"&&(u.arrows="to"),s.color&&t.edges.inheritColor===!1&&(u.color=s.color),u}),o=na(e=i.nodes).call(e,function(s){var u={id:s.id,fixed:t.nodes.fixed&&s.x!=null&&s.y!=null};return s.attributes!=null&&(u.attributes=s.attributes),s.label!=null&&(u.label=s.label),s.size!=null&&(u.size=s.size),s.attributes!=null&&s.attributes.title!=null&&(u.title=s.attributes.title),s.title!=null&&(u.title=s.title),s.x!=null&&(u.x=s.x),s.y!=null&&(u.y=s.y),s.color!=null&&(t.nodes.parseColor===!0?u.color=s.color:u.color={background:s.color,border:s.color,highlight:{background:s.color,border:s.color},hover:{background:s.color,border:s.color}}),u});return{nodes:o,edges:a}}var yoe={addDescription:"Click in an empty space to place a new node.",addEdge:"Add Edge",addNode:"Add Node",back:"Back",close:"Close",createEdgeError:"Cannot link edges to a cluster.",del:"Delete selected",deleteClusterError:"Clusters cannot be deleted.",edgeDescription:"Click on a node and drag the edge to another node to connect them.",edit:"Edit",editClusterError:"Clusters cannot be edited.",editEdge:"Edit Edge",editEdgeDescription:"Click on the control points and drag them to a node to connect to it.",editNode:"Edit Node"},moe={addDescription:"Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.",addEdge:"Kante hinzufügen",addNode:"Knoten hinzufügen",back:"Zurück",close:"Schließen",createEdgeError:"Es ist nicht möglich, Kanten mit Clustern zu verbinden.",del:"Lösche Auswahl",deleteClusterError:"Cluster können nicht gelöscht werden.",edgeDescription:"Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.",edit:"Editieren",editClusterError:"Cluster können nicht editiert werden.",editEdge:"Kante editieren",editEdgeDescription:"Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.",editNode:"Knoten editieren"},boe={addDescription:"Haga clic en un lugar vacío para colocar un nuevo nodo.",addEdge:"Añadir arista",addNode:"Añadir nodo",back:"Atrás",close:"Cerrar",createEdgeError:"No se puede conectar una arista a un grupo.",del:"Eliminar selección",deleteClusterError:"No es posible eliminar grupos.",edgeDescription:"Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.",edit:"Editar",editClusterError:"No es posible editar grupos.",editEdge:"Editar arista",editEdgeDescription:"Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.",editNode:"Editar nodo"},$oe={addDescription:"Clicca per aggiungere un nuovo nodo",addEdge:"Aggiungi un vertice",addNode:"Aggiungi un nodo",back:"Indietro",close:"Chiudere",createEdgeError:"Non si possono collegare vertici ad un cluster",del:"Cancella la selezione",deleteClusterError:"I cluster non possono essere cancellati",edgeDescription:"Clicca su un nodo e trascinalo ad un altro nodo per connetterli.",edit:"Modifica",editClusterError:"I clusters non possono essere modificati.",editEdge:"Modifica il vertice",editEdgeDescription:"Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.",editNode:"Modifica il nodo"},woe={addDescription:"Klik op een leeg gebied om een nieuwe node te maken.",addEdge:"Link toevoegen",addNode:"Node toevoegen",back:"Terug",close:"Sluiten",createEdgeError:"Kan geen link maken naar een cluster.",del:"Selectie verwijderen",deleteClusterError:"Clusters kunnen niet worden verwijderd.",edgeDescription:"Klik op een node en sleep de link naar een andere node om ze te verbinden.",edit:"Wijzigen",editClusterError:"Clusters kunnen niet worden aangepast.",editEdge:"Link wijzigen",editEdgeDescription:"Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.",editNode:"Node wijzigen"},_oe={addDescription:"Clique em um espaço em branco para adicionar um novo nó",addEdge:"Adicionar aresta",addNode:"Adicionar nó",back:"Voltar",close:"Fechar",createEdgeError:"Não foi possível linkar arestas a um cluster.",del:"Remover selecionado",deleteClusterError:"Clusters não puderam ser removidos.",edgeDescription:"Clique em um nó e arraste a aresta até outro nó para conectá-los",edit:"Editar",editClusterError:"Clusters não puderam ser editados.",editEdge:"Editar aresta",editEdgeDescription:"Clique nos pontos de controle e os arraste para um nó para conectá-los",editNode:"Editar nó"},Eoe={addDescription:"Кликните в свободное место, чтобы добавить новый узел.",addEdge:"Добавить ребро",addNode:"Добавить узел",back:"Назад",close:"Закрывать",createEdgeError:"Невозможно соединить ребра в кластер.",del:"Удалить выбранное",deleteClusterError:"Кластеры не могут быть удалены",edgeDescription:"Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.",edit:"Редактировать",editClusterError:"Кластеры недоступны для редактирования.",editEdge:"Редактировать ребро",editEdgeDescription:"Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.",editNode:"Редактировать узел"},Soe={addDescription:"单击空白处放置新节点。",addEdge:"添加连接线",addNode:"添加节点",back:"返回",close:"關閉",createEdgeError:"无法将连接线连接到群集。",del:"删除选定",deleteClusterError:"无法删除群集。",edgeDescription:"单击某个节点并将该连接线拖动到另一个节点以连接它们。",edit:"编辑",editClusterError:"无法编辑群集。",editEdge:"编辑连接线",editEdgeDescription:"单击控制节点并将它们拖到节点上连接。",editNode:"编辑节点"},Ooe={addDescription:"Kлікніть на вільне місце, щоб додати новий вузол.",addEdge:"Додати край",addNode:"Додати вузол",back:"Назад",close:"Закрити",createEdgeError:"Не можливо об'єднати краї в групу.",del:"Видалити обране",deleteClusterError:"Групи не можуть бути видалені.",edgeDescription:"Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з'єднати.",edit:"Редагувати",editClusterError:"Групи недоступні для редагування.",editEdge:"Редагувати край",editEdgeDescription:"Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.",editNode:"Редагувати вузол"},Toe={addDescription:"Cliquez dans un endroit vide pour placer un nœud.",addEdge:"Ajouter un lien",addNode:"Ajouter un nœud",back:"Retour",close:"Fermer",createEdgeError:"Impossible de créer un lien vers un cluster.",del:"Effacer la sélection",deleteClusterError:"Les clusters ne peuvent pas être effacés.",edgeDescription:"Cliquez sur un nœud et glissez le lien vers un autre nœud pour les connecter.",edit:"Éditer",editClusterError:"Les clusters ne peuvent pas être édités.",editEdge:"Éditer le lien",editEdgeDescription:"Cliquez sur les points de contrôle et glissez-les pour connecter un nœud.",editNode:"Éditer le nœud"},Ioe={addDescription:"Kluknutím do prázdného prostoru můžete přidat nový vrchol.",addEdge:"Přidat hranu",addNode:"Přidat vrchol",back:"Zpět",close:"Zavřít",createEdgeError:"Nelze připojit hranu ke shluku.",del:"Smazat výběr",deleteClusterError:"Nelze mazat shluky.",edgeDescription:"Přetažením z jednoho vrcholu do druhého můžete spojit tyto vrcholy novou hranou.",edit:"Upravit",editClusterError:"Nelze upravovat shluky.",editEdge:"Upravit hranu",editEdgeDescription:"Přetažením kontrolního vrcholu hrany ji můžete připojit k jinému vrcholu.",editNode:"Upravit vrchol"},koe=Object.freeze({__proto__:null,cn:Soe,cs:Ioe,de:moe,en:yoe,es:boe,fr:Toe,it:$oe,nl:woe,pt:_oe,ru:Eoe,uk:Ooe});function Poe(i,r){try{var e=r.split(/[-_ /]/,2),t=Te(e,2),n=t[0],a=t[1],o=n!=null?n.toLowerCase():null,s=a!=null?a.toUpperCase():null;if(o&&s){var u=o+"-"+s;if(Object.prototype.hasOwnProperty.call(i,u))return u;var l;console.warn(Gv(l="Unknown variant ".concat(s," of language ")).call(l,o,"."))}if(o){var h=o;if(Object.prototype.hasOwnProperty.call(i,h))return h;console.warn("Unknown language ".concat(o))}return console.warn("Unknown locale ".concat(r,", falling back to English.")),"en"}catch(c){return console.error(c),console.warn("Unexpected error while normalizing locale ".concat(r,", falling back to English.")),"en"}}var xoe=function(){function i(){N(this,i),this.NUM_ITERATIONS=4,this.image=new Image,this.canvas=document.createElement("canvas")}return M(i,[{key:"init",value:function(){if(!this.initialized()){this.src=this.image.src;var e=this.image.width,t=this.image.height;this.width=e,this.height=t;var n=Math.floor(t/2),a=Math.floor(t/4),o=Math.floor(t/8),s=Math.floor(t/16),u=Math.floor(e/2),l=Math.floor(e/4),h=Math.floor(e/8),c=Math.floor(e/16);this.canvas.width=3*l,this.canvas.height=n,this.coordinates=[[0,0,u,n],[u,0,l,a],[u,a,h,o],[5*h,a,c,s]],this._fillMipMap()}}},{key:"initialized",value:function(){return this.coordinates!==void 0}},{key:"_fillMipMap",value:function(){var e=this.canvas.getContext("2d"),t=this.coordinates[0];e.drawImage(this.image,t[0],t[1],t[2],t[3]);for(var n=1;n2){t*=.5;for(var u=0;t>2&&u=this.NUM_ITERATIONS&&(u=this.NUM_ITERATIONS-1);var l=this.coordinates[u];e.drawImage(this.canvas,l[0],l[1],l[2],l[3],n,a,o,s)}else e.drawImage(this.image,n,a,o,s)}}]),i}(),Coe=function(){function i(r){N(this,i),this.images={},this.imageBroken={},this.callback=r}return M(i,[{key:"_tryloadBrokenUrl",value:function(e,t,n){if(!(e===void 0||n===void 0)){if(t===void 0){console.warn("No broken url image defined");return}n.image.onerror=function(){console.error("Could not load brokenImage:",t)},n.image.src=t}}},{key:"_redrawWithImage",value:function(e){this.callback&&this.callback(e)}},{key:"load",value:function(e,t){var n=this,a=this.images[e];if(a)return a;var o=new xoe;return this.images[e]=o,o.image.onload=function(){n._fixImageCoordinates(o.image),o.init(),n._redrawWithImage(o)},o.image.onerror=function(){console.error("Could not load image:",e),n._tryloadBrokenUrl(e,t,o)},o.image.src=e,o}},{key:"_fixImageCoordinates",value:function(e){e.width===0&&(document.body.appendChild(e),e.width=e.offsetWidth,e.height=e.offsetHeight,document.body.removeChild(e))}}]),i}(),lT={exports:{}},Aoe=ae,Doe=Aoe(function(){if(typeof ArrayBuffer=="function"){var i=new ArrayBuffer(8);Object.isExtensible(i)&&Object.defineProperty(i,"a",{value:8})}}),Roe=ae,Noe=Ze,Moe=Hr,N1=Doe,$u=Object.isExtensible,Boe=Roe(function(){$u(1)}),Foe=Boe||N1?function(r){return!Noe(r)||N1&&Moe(r)==="ArrayBuffer"?!1:$u?$u(r):!0}:$u,joe=ae,hT=!joe(function(){return Object.isExtensible(Object.preventExtensions({}))}),Loe=q,zoe=se,Hoe=ts,Voe=Ze,ap=Qe,Woe=Ht.f,M1=as,Uoe=Wl,op=Foe,Koe=Dl,Goe=hT,cT=!1,jr=Koe("meta"),qoe=0,sp=function(i){Woe(i,jr,{value:{objectID:"O"+qoe++,weakData:{}}})},Yoe=function(i,r){if(!Voe(i))return typeof i=="symbol"?i:(typeof i=="string"?"S":"P")+i;if(!ap(i,jr)){if(!op(i))return"F";if(!r)return"E";sp(i)}return i[jr].objectID},Xoe=function(i,r){if(!ap(i,jr)){if(!op(i))return!0;if(!r)return!1;sp(i)}return i[jr].weakData},Joe=function(i){return Goe&&cT&&op(i)&&!ap(i,jr)&&sp(i),i},Zoe=function(){Qoe.enable=function(){},cT=!0;var i=M1.f,r=zoe([].splice),e={};e[jr]=1,i(e).length&&(M1.f=function(t){for(var n=i(t),a=0,o=n.length;ac;c++)if(f=y(i[c]),f&&B1(j1,f))return f;return new wu(!1)}l=ose(i,h)}for(v=a?i.next:l.next;!(p=tse(v,l)).done;){try{f=y(p.value)}catch(m){F1(l,"throw",m)}if(typeof f=="object"&&f&&B1(j1,f))return f}return new wu(!1)},lse=Be,hse=TypeError,lp=function(i,r){if(lse(r,i))return i;throw new hse("Incorrect invocation")},cse=q,dse=Pe,fse=eh,vse=ae,pse=Pa,gse=up,yse=lp,mse=Xe,bse=Ze,$se=Oa,wse=Ca,_se=Ht.f,Ese=wi.forEach,Sse=Je,dT=ln,Ose=dT.set,Tse=dT.getterFor,hp=function(i,r,e){var t=i.indexOf("Map")!==-1,n=i.indexOf("Weak")!==-1,a=t?"set":"add",o=dse[i],s=o&&o.prototype,u={},l;if(!Sse||!mse(o)||!(n||s.forEach&&!vse(function(){new o().entries().next()})))l=e.getConstructor(r,i,t,a),fse.enable();else{l=r(function(d,f){Ose(yse(d,h),{type:i,collection:new o}),$se(f)||gse(f,d[a],{that:d,AS_ENTRIES:t})});var h=l.prototype,c=Tse(i);Ese(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(d){var f=d==="add"||d==="set";d in s&&!(n&&d==="clear")&&pse(h,d,function(v,p){var g=c(this).collection;if(!f&&n&&!bse(v))return d==="get"?void 0:!1;var y=g[d](v===0?0:v,p);return f?this:y})}),n||_se(h,"size",{configurable:!0,get:function(){return c(this).collection.size}})}return wse(l,i,!1,!0),u[i]=l,cse({global:!0,forced:!0},u),n||e.setStrong(l,i,t),l},Ise=is,cp=function(i,r,e){for(var t in r)e&&e.unsafe&&i[t]?i[t]=r[t]:Ise(i,t,r[t],e);return i},kse=Jt,Pse=zv,xse=xe,Cse=Je,L1=xse("species"),Ase=function(i){var r=kse(i);Cse&&r&&!r[L1]&&Pse(r,L1,{configurable:!0,get:function(){return this}})},Dse=xa,Rse=zv,z1=cp,Nse=Qo,Mse=lp,Bse=Oa,Fse=up,jse=Mv,eu=Bv,Lse=Ase,Ha=Je,H1=eh.fastKey,fT=ln,V1=fT.set,ld=fT.getterFor,vT={getConstructor:function(i,r,e,t){var n=i(function(l,h){Mse(l,a),V1(l,{type:r,index:Dse(null),first:void 0,last:void 0,size:0}),Ha||(l.size=0),Bse(h)||Fse(h,l[t],{that:l,AS_ENTRIES:e})}),a=n.prototype,o=ld(r),s=function(l,h,c){var d=o(l),f=u(l,h),v,p;return f?f.value=c:(d.last=f={index:p=H1(h,!0),key:h,value:c,previous:v=d.last,next:void 0,removed:!1},d.first||(d.first=f),v&&(v.next=f),Ha?d.size++:l.size++,p!=="F"&&(d.index[p]=f)),l},u=function(l,h){var c=o(l),d=H1(h),f;if(d!=="F")return c.index[d];for(f=c.first;f;f=f.next)if(f.key===h)return f};return z1(a,{clear:function(){for(var h=this,c=o(h),d=c.index,f=c.first;f;)f.removed=!0,f.previous&&(f.previous=f.previous.next=void 0),delete d[f.index],f=f.next;c.first=c.last=void 0,Ha?c.size=0:h.size=0},delete:function(l){var h=this,c=o(h),d=u(h,l);if(d){var f=d.next,v=d.previous;delete c.index[d.index],d.removed=!0,v&&(v.next=f),f&&(f.previous=v),c.first===d&&(c.first=f),c.last===d&&(c.last=v),Ha?c.size--:h.size--}return!!d},forEach:function(h){for(var c=o(this),d=Nse(h,arguments.length>1?arguments[1]:void 0),f;f=f?f.next:c.first;)for(d(f.value,f.key,this);f&&f.removed;)f=f.previous},has:function(h){return!!u(this,h)}}),z1(a,e?{get:function(h){var c=u(this,h);return c&&c.value},set:function(h,c){return s(this,h===0?0:h,c)}}:{add:function(h){return s(this,h=h===0?0:h,h)}}),Ha&&Rse(a,"size",{configurable:!0,get:function(){return o(this).size}}),n},setStrong:function(i,r,e){var t=r+" Iterator",n=ld(r),a=ld(t);jse(i,r,function(o,s){V1(this,{type:t,target:o,state:n(o),kind:s,last:void 0})},function(){for(var o=a(this),s=o.kind,u=o.last;u&&u.removed;)u=u.previous;return!o.target||!(o.last=u=u?u.next:o.state.first)?(o.target=void 0,eu(void 0,!0)):eu(s==="keys"?u.key:s==="values"?u.value:[u.key,u.value],!1)},e?"entries":"values",!e,!0),Lse(r)}},zse=hp,Hse=vT;zse("Map",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},Hse);var Vse=oe,Wse=Vse.Map,Use=Wse,Kse=Use,Gse=Kse,pT=V(Gse),qse=function(){function i(){N(this,i),this.clear(),this._defaultIndex=0,this._groupIndex=0,this._defaultGroups=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}},{border:"#990000",background:"#EE0000",highlight:{border:"#BB0000",background:"#FF3333"},hover:{border:"#BB0000",background:"#FF3333"}},{border:"#FF6000",background:"#FF6000",highlight:{border:"#FF6000",background:"#FF6000"},hover:{border:"#FF6000",background:"#FF6000"}},{border:"#97C2FC",background:"#2B7CE9",highlight:{border:"#D2E5FF",background:"#2B7CE9"},hover:{border:"#D2E5FF",background:"#2B7CE9"}},{border:"#399605",background:"#255C03",highlight:{border:"#399605",background:"#255C03"},hover:{border:"#399605",background:"#255C03"}},{border:"#B70054",background:"#FF007E",highlight:{border:"#B70054",background:"#FF007E"},hover:{border:"#B70054",background:"#FF007E"}},{border:"#AD85E4",background:"#7C29F0",highlight:{border:"#D3BDF0",background:"#7C29F0"},hover:{border:"#D3BDF0",background:"#7C29F0"}},{border:"#4557FA",background:"#000EA1",highlight:{border:"#6E6EFD",background:"#000EA1"},hover:{border:"#6E6EFD",background:"#000EA1"}},{border:"#FFC0CB",background:"#FD5A77",highlight:{border:"#FFD1D9",background:"#FD5A77"},hover:{border:"#FFD1D9",background:"#FD5A77"}},{border:"#C2FABC",background:"#74D66A",highlight:{border:"#E6FFE3",background:"#74D66A"},hover:{border:"#E6FFE3",background:"#74D66A"}},{border:"#EE0000",background:"#990000",highlight:{border:"#FF3333",background:"#BB0000"},hover:{border:"#FF3333",background:"#BB0000"}}],this.options={},this.defaultOptions={useDefaultGroups:!0},Le(this.options,this.defaultOptions)}return M(i,[{key:"setOptions",value:function(e){var t=["useDefaultGroups"];if(e!==void 0){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&ne(t).call(t,n)===-1){var a=e[n];this.add(n,a)}}}},{key:"clear",value:function(){this._groups=new pT,this._groupNames=[]}},{key:"get",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this._groups.get(e);if(n===void 0&&t)if(this.options.useDefaultGroups===!1&&this._groupNames.length>0){var a=this._groupIndex%this._groupNames.length;++this._groupIndex,n={},n.color=this._groups.get(this._groupNames[a]),this._groups.set(e,n)}else{var o=this._defaultIndex%this._defaultGroups.length;this._defaultIndex++,n={},n.color=this._defaultGroups[o],this._groups.set(e,n)}return n}},{key:"add",value:function(e,t){return this._groups.has(e)||this._groupNames.push(e),this._groups.set(e,t),t}}]),i}(),Yse=q;Yse({target:"Number",stat:!0},{isNaN:function(r){return r!==r}});var Xse=oe,Jse=Xse.Number.isNaN,Zse=Jse,Qse=Zse,eue=Qse,Cf=V(eue),tue=Pe,rue=tue.isFinite,iue=Number.isFinite||function(r){return typeof r=="number"&&rue(r)},nue=q,aue=iue;nue({target:"Number",stat:!0},{isFinite:aue});var oue=oe,sue=oue.Number.isFinite,uue=sue,lue=uue,hue=lue,Di=V(hue),cue=q,due=wi.some,fue=Ra,vue=fue("some");cue({target:"Array",proto:!0,forced:!vue},{some:function(r){return due(this,r,arguments.length>1?arguments[1]:void 0)}});var pue=et,gue=pue("Array").some,yue=Be,mue=gue,hd=Array.prototype,bue=function(i){var r=i.some;return i===hd||yue(hd,i)&&r===hd.some?mue:r},$ue=bue,wue=$ue,_ue=wue,Eue=V(_ue),Sue=oe,Oue=Sue.Object.getOwnPropertySymbols,Tue=Oue,Iue=Tue,kue=Iue,pi=V(kue),gT={exports:{}},Pue=q,xue=ae,Cue=_r,yT=Sa.f,mT=Je,Aue=!mT||xue(function(){yT(1)});Pue({target:"Object",stat:!0,forced:Aue,sham:!mT},{getOwnPropertyDescriptor:function(r,e){return yT(Cue(r),e)}});var Due=oe,bT=Due.Object,Rue=gT.exports=function(r,e){return bT.getOwnPropertyDescriptor(r,e)};bT.getOwnPropertyDescriptor.sham&&(Rue.sham=!0);var Nue=gT.exports,Mue=Nue,$T=Mue,Bue=$T,Ei=V(Bue),Fue=q,jue=Je,Lue=rte,zue=_r,Hue=Sa,Vue=Da;Fue({target:"Object",stat:!0,sham:!jue},{getOwnPropertyDescriptors:function(r){for(var e=zue(r),t=Hue.f,n=Lue(e),a={},o=0,s,u;n.length>o;)u=t(e,s=n[o++]),u!==void 0&&Vue(a,s,u);return a}});var Wue=oe,Uue=Wue.Object.getOwnPropertyDescriptors,Kue=Uue,Gue=Kue,que=Gue,gi=V(que),wT={exports:{}},Yue=q,Xue=Je,W1=jl.f;Yue({target:"Object",stat:!0,forced:Object.defineProperties!==W1,sham:!Xue},{defineProperties:W1});var Jue=oe,_T=Jue.Object,Zue=wT.exports=function(r,e){return _T.defineProperties(r,e)};_T.defineProperties.sham&&(Zue.sham=!0);var Que=wT.exports,ele=Que,tle=ele,rle=tle,th=V(rle),ile=TS,rh=V(ile);function ih(i,r,e){return r=aO(r),r in i?Vl(i,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[r]=e,i}var ET=Pe,nle=ae,ale=se,ole=Er,sle=yO.trim,ule=qv,lle=ale("".charAt),Ju=ET.parseFloat,U1=ET.Symbol,K1=U1&&U1.iterator,hle=1/Ju(ule+"-0")!==-1/0||K1&&!nle(function(){Ju(Object(K1))}),cle=hle?function(r){var e=sle(ole(r)),t=Ju(e);return t===0&&lle(e,0)==="-"?-0:t}:Ju,dle=q,G1=cle;dle({global:!0,forced:parseFloat!==G1},{parseFloat:G1});var fle=oe,vle=fle.parseFloat,ple=vle,gle=ple,yle=gle,ST=V(yle),mle=q,ble=ae,$le=Wl.f,wle=ble(function(){return!Object.getOwnPropertyNames(1)});mle({target:"Object",stat:!0,forced:wle},{getOwnPropertyNames:$le});var _le=oe,Ele=_le.Object,Sle=function(r){return Ele.getOwnPropertyNames(r)},Ole=Sle,Tle=Ole,Ile=Tle,kle=V(Ile);function dp(i,r){var e=["node","edge","label"],t=!0,n=Qr(r,"chosen");if(typeof n=="boolean")t=n;else if(de(n)==="object"){if(ne(e).call(e,i)===-1)throw new Error("choosify: subOption '"+i+"' should be one of '"+e.join("', '")+"'");var a=Qr(r,["chosen",i]);(typeof a=="boolean"||typeof a=="function")&&(t=a)}return t}function Af(i,r,e){if(i.width<=0||i.height<=0)return!1;if(e!==void 0){var t={x:r.x-e.x,y:r.y-e.y};if(e.angle!==0){var n=-e.angle,a={x:Math.cos(n)*t.x-Math.sin(n)*t.y,y:Math.sin(n)*t.x+Math.cos(n)*t.y};r=a}else r=t}var o=i.x+i.width,s=i.y+i.width;return i.leftr.x&&i.topr.y}function Zu(i){return typeof i=="string"&&i!==""}function OT(i,r,e,t){var n=t.x,a=t.y;if(typeof t.distanceToBorder=="function"){var o=t.distanceToBorder(i,r),s=Math.sin(r)*o,u=Math.cos(r)*o;u===o?(n+=o,a=t.y):s===o?(n=t.x,a-=o):(n+=u,a-=s)}else t.shape.width>t.shape.height?(n=t.x+t.shape.width*.5,a=t.y-e):(n=t.x+e,a=t.y-t.shape.height*.5);return{x:n,y:a}}var Ple=et,xle=Ple("Array").values,Cle=xle,Ale=Cle,Dle=un,Rle=Qe,Nle=Be,Mle=Ale,cd=Array.prototype,Ble={DOMTokenList:!0,NodeList:!0},Fle=function(i){var r=i.values;return i===cd||Nle(cd,i)&&r===cd.values||Rle(Ble,Dle(i))?Mle:r},jle=Fle,TT=V(jle),Lle=function(){function i(r){N(this,i),this.measureText=r,this.current=0,this.width=0,this.height=0,this.lines=[]}return M(i,[{key:"_add",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"normal";this.lines[e]===void 0&&(this.lines[e]={width:0,height:0,blocks:[]});var a=t;(t===void 0||t==="")&&(a=" ");var o=this.measureText(a,n),s=Le({},TT(o));s.text=t,s.width=o.width,s.mod=n,(t===void 0||t==="")&&(s.width=0),this.lines[e].blocks.push(s),this.lines[e].width+=s.width}},{key:"curWidth",value:function(){var e=this.lines[this.current];return e===void 0?0:e.width}},{key:"append",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t)}},{key:"newLine",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t),this.current++}},{key:"determineLineHeights",value:function(){for(var e=0;ee&&(e=a.width),t+=a.height}this.width=e,this.height=t}},{key:"removeEmptyBlocks",value:function(){for(var e=[],t=0;t"://,""://,""://,"":/<\/b>/,"":/<\/i>/,"":/<\/code>/,"*":/\*/,_:/_/,"`":/`/,afterBold:/[^*]/,afterItal:/[^_]/,afterMono:/[^`]/},q1=function(){function i(r){N(this,i),this.text=r,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer="",this.modStack=[],this.blocks=[]}return M(i,[{key:"mod",value:function(){return this.modStack.length===0?"normal":this.modStack[0]}},{key:"modName",value:function(){if(this.modStack.length===0)return"normal";if(this.modStack[0]==="mono")return"mono";if(this.bold&&this.ital)return"boldital";if(this.bold)return"bold";if(this.ital)return"ital"}},{key:"emitBlock",value:function(){this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(this.blocks.push({text:this.buffer,mod:this.modName()}),this.buffer="")}},{key:"add",value:function(e){e===" "&&(this.spacing=!0),this.spacing&&(this.buffer+=" ",this.spacing=!1),e!=" "&&(this.buffer+=e)}},{key:"parseWS",value:function(e){return/[ \t]/.test(e)?(this.mono?this.add(e):this.spacing=!0,!0):!1}},{key:"setTag",value:function(e){this.emitBlock(),this[e]=!0,this.modStack.unshift(e)}},{key:"unsetTag",value:function(e){this.emitBlock(),this[e]=!1,this.modStack.shift()}},{key:"parseStartTag",value:function(e,t){return!this.mono&&!this[e]&&this.match(t)?(this.setTag(e),!0):!1}},{key:"match",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this.prepareRegExp(e),a=Te(n,2),o=a[0],s=a[1],u=o.test(this.text.substr(this.position,s));return u&&t&&(this.position+=s-1),u}},{key:"parseEndTag",value:function(e,t,n){var a=this.mod()===e;return e==="mono"?a=a&&this.mono:a=a&&!this.mono,a&&this.match(t)?(n!==void 0?(this.position===this.text.length-1||this.match(n,!1))&&this.unsetTag(e):this.unsetTag(e),!0):!1}},{key:"replace",value:function(e,t){return this.match(e)?(this.add(t),this.position+=length-1,!0):!1}},{key:"prepareRegExp",value:function(e){var t,n;if(e instanceof RegExp)n=e,t=1;else{var a=zle[e];a!==void 0?n=a:n=new RegExp(e),t=e.length}return[n,t]}}]),i}(),Hle=function(){function i(r,e,t,n){var a=this;N(this,i),this.ctx=r,this.parent=e,this.selected=t,this.hover=n;var o=function(u,l){if(u===void 0)return 0;var h=a.parent.getFormattingValues(r,t,n,l),c=0;if(u!==""){var d=a.ctx.measureText(u);c=d.width}return{width:c,values:h}};this.lines=new Lle(o)}return M(i,[{key:"process",value:function(e){if(!Zu(e))return this.lines.finalize();var t=this.parent.fontOptions;e=e.replace(/\r\n/g,` `),e=e.replace(/\r/g,` `);var n=String(e).split(` -`),a=n.length;if(t.multi)for(var o=0;o0)for(var u=0;u0)for(var v=0;v")||t.parseStartTag("ital","")||t.parseStartTag("mono","")||t.parseEndTag("bold","")||t.parseEndTag("ital","")||t.parseEndTag("mono",""))||n(a);o||t.add(a),t.position++}return t.emitBlock(),t.blocks}},{key:"splitMarkdownBlocks",value:function(e){for(var t=this,n=new q1(e),a=!0,o=function(h){return/\\/.test(h)?(n.positionthis.parent.fontOptions.maxWdt}},{key:"getLongestFit",value:function(e){for(var t="",n=0;n1&&arguments[1]!==void 0?arguments[1]:"normal",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t),e=e.replace(/^( +)/g,"$1\r"),e=e.replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r");for(var a=e.split("\r");a.length>0;){var o=this.getLongestFit(a);if(o===0){var s=a[0],u=this.getLongestFitWord(s);this.lines.newLine(rt(s).call(s,0,u),t),a[0]=rt(s).call(s,u)}else{var l=o;a[o-1]===" "?o--:a[l]===" "&&l++;var h=rt(a).call(a,0,o).join("");o==a.length&&n?this.lines.append(h,t):this.lines.newLine(h,t),a=rt(a).call(a,l)}}}}]),i}(),Va=["bold","ital","boldital","mono"],IT=function(){function i(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;N(this,i),this.body=r,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(e),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=t}return M(i,[{key:"setOptions",value:function(e){if(this.elementOptions=e,this.initFontOptions(e.font),Zu(e.label)?this.labelDirty=!0:e.label=void 0,e.font!==void 0&&e.font!==null){if(typeof e.font=="string")this.baseSize=this.fontOptions.size;else if(fe(e.font)==="object"){var t=e.font.size;t!==void 0&&(this.baseSize=t)}}}},{key:"initFontOptions",value:function(e){var t=this;if(te(Va,function(n){t.fontOptions[n]={}}),i.parseFontString(this.fontOptions,e)){this.fontOptions.vadjust=0;return}te(e,function(n,a){n!=null&&fe(n)!=="object"&&(t.fontOptions[a]=n)})}},{key:"constrain",value:function(e){var t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},n=Xr(e,"widthConstraint");if(typeof n=="number")t.maxWdt=Number(n),t.minWdt=Number(n);else if(fe(n)==="object"){var a=Xr(e,["widthConstraint","maximum"]);typeof a=="number"&&(t.maxWdt=Number(a));var o=Xr(e,["widthConstraint","minimum"]);typeof o=="number"&&(t.minWdt=Number(o))}var s=Xr(e,"heightConstraint");if(typeof s=="number")t.minHgt=Number(s);else if(fe(s)==="object"){var u=Xr(e,["heightConstraint","minimum"]);typeof u=="number"&&(t.minHgt=Number(u));var l=Xr(e,["heightConstraint","valign"]);typeof l=="string"&&(l==="top"||l==="bottom")&&(t.valign=l)}return t}},{key:"update",value:function(e,t){this.setOptions(e,!0),this.propagateFonts(t),ge(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=dp("label",t)}},{key:"adjustSizes",value:function(e){var t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);var n=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=n)}},{key:"addFontOptionsToPile",value:function(e,t){for(var n=0;n5&&arguments[5]!==void 0?arguments[5]:"middle";if(this.elementOptions.label!==void 0){var u=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&u=this.elementOptions.scaling.label.maxVisible&&(u=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,a,o,t,n,s),this._drawBackground(e),this._drawText(e,t,this.size.yLine,s,u))}}},{key:"_drawBackground",value:function(e){if(this.fontOptions.background!==void 0&&this.fontOptions.background!=="none"){e.fillStyle=this.fontOptions.background;var t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}},{key:"_drawText",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"middle",o=arguments.length>4?arguments[4]:void 0,s=this._setAlignment(e,t,n,a),u=Te(s,2);t=u[0],n=u[1],e.textAlign="left",t=t-this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&(this.fontOptions.valign==="top"&&(n-=(this.size.height-this.size.labelHeight)/2),this.fontOptions.valign==="bottom"&&(n+=(this.size.height-this.size.labelHeight)/2));for(var l=0;l0&&(e.lineWidth=f.strokeWidth,e.strokeStyle=y,e.lineJoin="round"),e.fillStyle=g,f.strokeWidth>0&&e.strokeText(f.text,t+d,n+f.vadjust),e.fillText(f.text,t+d,n+f.vadjust),d+=f.width}n+=h.height}}}},{key:"_setAlignment",value:function(e,t,n,a){if(this.isEdgeLabel&&this.fontOptions.align!=="horizontal"&&this.pointToSelf===!1){t=0,n=0;var o=2;this.fontOptions.align==="top"?(e.textBaseline="alphabetic",n-=2*o):this.fontOptions.align==="bottom"?(e.textBaseline="hanging",n+=2*o):e.textBaseline="middle"}else e.textBaseline=a;return[t,n]}},{key:"_getColor",value:function(e,t,n){var a=e||"#000000",o=n||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){var s=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));a=Kt(a,s),o=Kt(o,s)}return[a,o]}},{key:"getTextSize",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this._processLabel(e,t,n),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}},{key:"getSize",value:function(){var e=2,t=this.size.left,n=this.size.top-.5*e;if(this.isEdgeLabel){var a=-this.size.width*.5;switch(this.fontOptions.align){case"middle":t=a,n=-this.size.height*.5;break;case"top":t=a,n=-(this.size.height+e);break;case"bottom":t=a,n=e;break}}var o={left:t,top:n,width:this.size.width,height:this.size.height};return o}},{key:"calculateLabelSize",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";this._processLabel(e,t,n),this.size.left=a-this.size.width*.5,this.size.top=o-this.size.height*.5,this.size.yLine=o+(1-this.lineCount)*.5*this.fontOptions.size,s==="hanging"&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}},{key:"getFormattingValues",value:function(e,t,n,a){var o=function(h,d,c){return d==="normal"?c==="mod"?"":h[c]:h[d][c]!==void 0?h[d][c]:h[c]},s={color:o(this.fontOptions,a,"color"),size:o(this.fontOptions,a,"size"),face:o(this.fontOptions,a,"face"),mod:o(this.fontOptions,a,"mod"),vadjust:o(this.fontOptions,a,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||n)&&(a==="normal"&&this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?s.mod="bold":typeof this.fontOptions.chooser=="function"&&this.fontOptions.chooser(s,this.elementOptions.id,t,n));var u="";return s.mod!==void 0&&s.mod!==""&&(u+=s.mod+" "),u+=s.size+"px "+s.face,e.font=u.replace(/"/g,""),s.font=e.font,s.height=s.size,s}},{key:"differentState",value:function(e,t){return e!==this.selectedState||t!==this.hoverState}},{key:"_processLabelText",value:function(e,t,n,a){var o=new Hle(e,this,t,n);return o.process(a)}},{key:"_processLabel",value:function(e,t,n){if(!(this.labelDirty===!1&&!this.differentState(t,n))){var a=this._processLabelText(e,t,n,this.elementOptions.label);this.fontOptions.minWdt>0&&a.width0&&a.height0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}},{key:"performFill",value:function(e,t){e.save(),e.fillStyle=t.color,this.enableShadow(e,t),hs(e).call(e),this.disableShadow(e,t),e.restore(),this.performStroke(e,t)}},{key:"_addBoundingBoxMargin",value:function(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}},{key:"_updateBoundingBox",value:function(e,t,n,a,o){n!==void 0&&this.resize(n,a,o),this.left=e-this.width/2,this.top=t-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}},{key:"updateBoundingBox",value:function(e,t,n,a,o){this._updateBoundingBox(e,t,n,a,o)}},{key:"getDimensionsFromLabel",value:function(e,t,n){this.textSize=this.labelModule.getTextSize(e,t,n);var a=this.textSize.width,o=this.textSize.height,s=14;return a===0&&(a=s,o=s),{width:a,height:o}}}]),i}();function Dhe(i){var r=Rhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Rhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Nhe=function(i){se(e,i);var r=Dhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o);this.width=s.width+this.margin.right+this.margin.left,this.height=s.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.initContextForDraw(n,l),qE(n,this.left,this.top,this.width,this.height,l.borderRadius),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u)}},{key:"updateBoundingBox",value:function(n,a,o,s,u){this._updateBoundingBox(n,a,o,s,u);var l=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(l)}},{key:"distanceToBorder",value:function(n,a){n&&this.resize(n);var o=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(a)),Math.abs(this.height/2/Math.sin(a)))+o}}]),e}(vn);function Mhe(i){var r=Bhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Bhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var pp=function(i){se(e,i);var r=Mhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o.labelOffset=0,o.selected=!1,o}return M(e,[{key:"setOptions",value:function(n,a,o){this.options=n,a===void 0&&o===void 0||this.setImages(a,o)}},{key:"setImages",value:function(n,a){a&&this.selected?(this.imageObj=a,this.imageObjAlt=n):(this.imageObj=n,this.imageObjAlt=a)}},{key:"switchImages",value:function(n){var a=n&&!this.selected||!n&&this.selected;if(this.selected=n,this.imageObjAlt!==void 0&&a){var o=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=o}}},{key:"_getImagePadding",value:function(){var n={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){var a=this.options.imagePadding;fe(a)=="object"?(n.top=a.top,n.right=a.right,n.bottom=a.bottom,n.left=a.left):(n.top=a,n.right=a,n.bottom=a,n.left=a)}return n}},{key:"_resizeImage",value:function(){var n,a;if(this.options.shapeProperties.useImageSize===!1){var o=1,s=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?o=this.imageObj.width/this.imageObj.height:s=this.imageObj.height/this.imageObj.width),n=this.options.size*2*o,a=this.options.size*2*s}else{var u=this._getImagePadding();n=this.imageObj.width+u.left+u.right,a=this.imageObj.height+u.top+u.bottom}this.width=n,this.height=a,this.radius=.5*this.width}},{key:"_drawRawCircle",value:function(n,a,o,s){this.initContextForDraw(n,s),Av(n,a,o,s.size),this.performFill(n,s)}},{key:"_drawImageAtPosition",value:function(n,a){if(this.imageObj.width!=0){n.globalAlpha=a.opacity!==void 0?a.opacity:1,this.enableShadow(n,a);var o=1;this.options.shapeProperties.interpolation===!0&&(o=this.imageObj.width/this.width/this.body.view.scale);var s=this._getImagePadding(),u=this.left+s.left,l=this.top+s.top,h=this.width-s.left-s.right,d=this.height-s.top-s.bottom;this.imageObj.drawImageAtPosition(n,o,u,l,h,d),this.disableShadow(n,a)}}},{key:"_drawImageLabel",value:function(n,a,o,s,u){var l=0;if(this.height!==void 0){l=this.height*.5;var h=this.labelModule.getTextSize(n,s,u);h.lineCount>=1&&(l+=h.height/2)}var d=o+l;this.options.label&&(this.labelOffset=l),this.labelModule.draw(n,a,d,s,u,"hanging")}}]),e}(vn);function Fhe(i){var r=jhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function jhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Lhe=function(i){se(e,i);var r=Fhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o),u=Math.max(s.width+this.margin.right+this.margin.left,s.height+this.margin.top+this.margin.bottom);this.options.size=u/2,this.width=u,this.height=u,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this._drawRawCircle(n,a,o,l),this.updateBoundingBox(a,o),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,o,s,u)}},{key:"updateBoundingBox",value:function(n,a){this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.width*.5}}]),e}(pp);function zhe(i){var r=Hhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Hhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Vhe=function(i){se(e,i);var r=zhe(e);function e(t,n,a,o,s){var u;return N(this,e),u=r.call(this,t,n,a),u.setImages(o,s),u}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0;if(s){var u=this.options.size*2;this.width=u,this.height=u,this.radius=.5*this.width;return}this.needsRefresh(a,o)&&this._resizeImage()}},{key:"draw",value:function(n,a,o,s,u,l){this.switchImages(s),this.resize();var h=a,d=o;this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=a,this.top=o,h+=this.width/2,d+=this.height/2):(this.left=a-this.width/2,this.top=o-this.height/2),this._drawRawCircle(n,h,d,l),n.save(),n.clip(),this._drawImageAtPosition(n,l),n.restore(),this._drawImageLabel(n,h,d,s,u),this.updateBoundingBox(a,o)}},{key:"updateBoundingBox",value:function(n,a){this.options.shapeProperties.coordinateOrigin==="top-left"?(this.boundingBox.top=a,this.boundingBox.left=n,this.boundingBox.right=n+this.options.size*2,this.boundingBox.bottom=a+this.options.size*2):(this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size),this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.width*.5}}]),e}(pp);function Whe(i){var r=Uhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Uhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var wi=function(i){se(e,i);var r=Whe(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{size:this.options.size};if(this.needsRefresh(a,o)){var u,l;this.labelModule.getTextSize(n,a,o);var h=2*s.size;this.width=(u=this.customSizeWidth)!==null&&u!==void 0?u:h,this.height=(l=this.customSizeHeight)!==null&&l!==void 0?l:h,this.radius=.5*this.width}}},{key:"_drawShape",value:function(n,a,o,s,u,l,h,d){var c=this;return this.resize(n,l,h,d),this.left=s-this.width/2,this.top=u-this.height/2,this.initContextForDraw(n,d),TK(a)(n,s,u,d.size),this.performFill(n,d),this.options.icon!==void 0&&this.options.icon.code!==void 0&&(n.font=(l?"bold ":"")+this.height/2+"px "+(this.options.icon.face||"FontAwesome"),n.fillStyle=this.options.icon.color||"black",n.textAlign="center",n.textBaseline="middle",n.fillText(this.options.icon.code,s,u)),{drawExternalLabel:function(){if(c.options.label!==void 0){c.labelModule.calculateLabelSize(n,l,h,s,u,"hanging");var v=u+.5*c.height+.5*c.labelModule.size.height;c.labelModule.draw(n,s,v,l,h,"hanging")}c.updateBoundingBox(s,u)}}}},{key:"updateBoundingBox",value:function(n,a){this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}]),e}(vn);function Q1(i,r){var e=Oe(i);if(di){var t=di(i);r&&(t=Ot(t).call(t,function(n){return $i(i,n).enumerable})),e.push.apply(e,t)}return e}function Khe(i){for(var r=1;r"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Yhe=function(i){se(e,i);var r=Ghe(e);function e(t,n,a,o){var s;return N(this,e),s=r.call(this,t,n,a,o),s.ctxRenderer=o,s}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u,l),this.left=a-this.width/2,this.top=o-this.height/2,n.save();var h=this.ctxRenderer({ctx:n,id:this.options.id,x:a,y:o,state:{selected:s,hover:u},style:Khe({},l),label:this.options.label});if(h.drawNode!=null&&h.drawNode(),n.restore(),h.drawExternalLabel){var d=h.drawExternalLabel;h.drawExternalLabel=function(){n.save(),d(),n.restore()}}return h.nodeDimensions&&(this.customSizeWidth=h.nodeDimensions.width,this.customSizeHeight=h.nodeDimensions.height),h}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(wi);function Xhe(i){var r=Jhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Jhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Zhe=function(i){se(e,i);var r=Xhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o),u=s.width+this.margin.right+this.margin.left;this.width=u,this.height=u,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.initContextForDraw(n,l),YE(n,a-this.width/2,o-this.height/2,this.width,this.height),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function Qhe(i){var r=ece();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function ece(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var tce=function(i){se(e,i);var r=Qhe(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"diamond",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(wi);function rce(i){var r=ice();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function ice(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var nce=function(i){se(e,i);var r=rce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"circle",2,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.options.size}}]),e}(wi);function ace(i){var r=oce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function oce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var e$=function(i){se(e,i);var r=ace(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o);this.height=s.height*2,this.width=s.width+s.height,this.radius=.5*this.width}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width*.5,this.top=o-this.height*.5,this.initContextForDraw(n,l),sf(n,this.left,this.top,this.width,this.height),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,a,o,s,u)}},{key:"distanceToBorder",value:function(n,a){n&&this.resize(n);var o=this.width*.5,s=this.height*.5,u=Math.sin(a)*o,l=Math.cos(a)*s;return o*s/Math.sqrt(u*u+l*l)}}]),e}(vn);function sce(i){var r=uce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function uce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var lce=function(i){se(e,i);var r=sce(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){this.needsRefresh(a,o)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(n,a,o,s,u,l){var h=this;return this.resize(n,s,u),this.options.icon.size=this.options.icon.size||50,this.left=a-this.width/2,this.top=o-this.height/2,this._icon(n,a,o,s,u,l),{drawExternalLabel:function(){if(h.options.label!==void 0){var c=5;h.labelModule.draw(n,h.left+h.iconSize.width/2+h.margin.left,o+h.height/2+c,s)}h.updateBoundingBox(a,o)}}}},{key:"updateBoundingBox",value:function(n,a){if(this.boundingBox.top=a-this.options.icon.size*.5,this.boundingBox.left=n-this.options.icon.size*.5,this.boundingBox.right=n+this.options.icon.size*.5,this.boundingBox.bottom=a+this.options.icon.size*.5,this.options.label!==void 0&&this.labelModule.size.width>0){var o=5;this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+o)}}},{key:"_icon",value:function(n,a,o,s,u,l){var h=Number(this.options.icon.size);this.options.icon.code!==void 0?(n.font=[this.options.icon.weight!=null?this.options.icon.weight:s?"bold":"",(this.options.icon.weight!=null&&s?5:0)+h+"px",this.options.icon.face].join(" "),n.fillStyle=this.options.icon.color||"black",n.textAlign="center",n.textBaseline="middle",this.enableShadow(n,l),n.fillText(this.options.icon.code,a,o),this.disableShadow(n,l)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function hce(i){var r=cce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function cce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var dce=function(i){se(e,i);var r=hce(e);function e(t,n,a,o,s){var u;return N(this,e),u=r.call(this,t,n,a),u.setImages(o,s),u}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0;if(s){var u=this.options.size*2;this.width=u,this.height=u;return}this.needsRefresh(a,o)&&this._resizeImage()}},{key:"draw",value:function(n,a,o,s,u,l){n.save(),this.switchImages(s),this.resize();var h=a,d=o;if(this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=a,this.top=o,h+=this.width/2,d+=this.height/2):(this.left=a-this.width/2,this.top=o-this.height/2),this.options.shapeProperties.useBorderWithImage===!0){var c=this.options.borderWidth,f=this.options.borderWidthSelected||2*this.options.borderWidth,v=(s?f:c)/this.body.view.scale;n.lineWidth=Math.min(this.width,v),n.beginPath();var p=s?this.options.color.highlight.border:u?this.options.color.hover.border:this.options.color.border,g=s?this.options.color.highlight.background:u?this.options.color.hover.background:this.options.color.background;l.opacity!==void 0&&(p=Kt(p,l.opacity),g=Kt(g,l.opacity)),n.strokeStyle=p,n.fillStyle=g,n.rect(this.left-.5*n.lineWidth,this.top-.5*n.lineWidth,this.width+n.lineWidth,this.height+n.lineWidth),hs(n).call(n),this.performStroke(n,l),n.closePath()}this._drawImageAtPosition(n,l),this._drawImageLabel(n,h,d,s,u),this.updateBoundingBox(a,o),n.restore()}},{key:"updateBoundingBox",value:function(n,a){this.resize(),this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=n,this.top=a):(this.left=n-this.width/2,this.top=a-this.height/2),this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(pp);function fce(i){var r=vce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function vce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var pce=function(i){se(e,i);var r=fce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"square",2,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(wi);function gce(i){var r=yce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function yce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var mce=function(i){se(e,i);var r=gce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"hexagon",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(wi);function bce(i){var r=$ce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function $ce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var wce=function(i){se(e,i);var r=bce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"star",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(wi);function _ce(i){var r=Ece();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Ece(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Sce=function(i){se(e,i);var r=_ce(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){this.needsRefresh(a,o)&&(this.textSize=this.labelModule.getTextSize(n,a,o),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.enableShadow(n,l),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u),this.disableShadow(n,l),this.updateBoundingBox(a,o,n,s,u)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function Oce(i){var r=Tce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Tce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Ice=function(i){se(e,i);var r=Oce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"triangle",3,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(wi);function kce(i){var r=Pce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Pce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var xce=function(i){se(e,i);var r=kce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"triangleDown",3,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(wi);function t$(i,r){var e=Oe(i);if(di){var t=di(i);r&&(t=Ot(t).call(t,function(n){return $i(i,n).enumerable})),e.push.apply(e,t)}return e}function r$(i){for(var r=1;re.left&&this.shape.tope.top}},{key:"isBoundingBoxOverlappingWith",value:function(e){return this.shape.boundingBox.lefte.left&&this.shape.boundingBox.tope.top}}],[{key:"checkOpacity",value:function(e){return 0<=e&&e<=1}},{key:"checkCoordinateOrigin",value:function(e){return e===void 0||e==="center"||e==="top-left"}},{key:"updateGroupOptions",value:function(e,t,n){var a;if(n!==void 0){var o=e.group;if(t!==void 0&&t.group!==void 0&&o!==t.group)throw new Error("updateGroupOptions: group values in options don't match.");var s=typeof o=="number"||typeof o=="string"&&o!="";if(s){var u=n.get(o);u.opacity!==void 0&&t.opacity===void 0&&(i.checkOpacity(u.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+u.opacity),u.opacity=void 0));var l=Ot(a=kle(t)).call(a,function(h){return t[h]!=null});l.push("font"),Yu(l,e,u),e.color=If(e.color)}}}},{key:"parseOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=arguments.length>4?arguments[4]:void 0,s=["color","fixed","shadow"];if(Yu(s,e,t,n),i.checkMass(t),e.opacity!==void 0&&(i.checkOpacity(e.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity),e.opacity=void 0)),t.opacity!==void 0&&(i.checkOpacity(t.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+t.opacity),t.opacity=void 0)),t.shapeProperties&&!i.checkCoordinateOrigin(t.shapeProperties.coordinateOrigin)&&console.error("Invalid option for node coordinateOrigin, found: "+t.shapeProperties.coordinateOrigin),Ut(e,t,"shadow",a),t.color!==void 0&&t.color!==null){var u=If(t.color);JO(e.color,u)}else n===!0&&t.color===null&&(e.color=li(a.color));t.fixed!==void 0&&t.fixed!==null&&(typeof t.fixed=="boolean"?(e.fixed.x=t.fixed,e.fixed.y=t.fixed):(t.fixed.x!==void 0&&typeof t.fixed.x=="boolean"&&(e.fixed.x=t.fixed.x),t.fixed.y!==void 0&&typeof t.fixed.y=="boolean"&&(e.fixed.y=t.fixed.y))),n===!0&&t.font===null&&(e.font=li(a.font)),i.updateGroupOptions(e,t,o),t.scaling!==void 0&&Ut(e.scaling,t.scaling,"label",a.scaling)}},{key:"checkMass",value:function(e,t){if(e.mass!==void 0&&e.mass<=0){var n="";t!==void 0&&(n=" in node id: "+t),console.error("%cNegative or zero mass disallowed"+n+", setting mass to 1.",tT),e.mass=1}}}]),i}();function Cce(i,r){var e=typeof bi<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=Ace(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Ace(i,r){var e;if(i){if(typeof i=="string")return i$(i,r);var t=rt(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i$(i,r)}}function i$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity):this.options.opacity=e.opacity),e.shape!==void 0)for(var t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].updateShape();if(typeof e.font<"u"||typeof e.widthConstraint<"u"||typeof e.heightConstraint<"u")for(var n=0,a=Oe(this.body.nodes);n1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.data.nodes;if(IE("id",e))this.body.data.nodes=e;else if(he(e))this.body.data.nodes=new Lu,this.body.data.nodes.add(e);else if(!e)this.body.data.nodes=new Lu;else throw new TypeError("Array or DataSet expected");if(n&&te(this.nodesListeners,function(s,u){n.off(u,s)}),this.body.nodes={},this.body.data.nodes){var a=this;te(this.nodesListeners,function(s,u){a.body.data.nodes.on(u,s)});var o=this.body.data.nodes.getIds();this.add(o,!0)}t===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n,a=[],o=0;o1&&arguments[1]!==void 0?arguments[1]:Nt;return new t(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}},{key:"refresh",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;te(this.body.nodes,function(n,a){var o=e.body.data.nodes.get(a);o!==void 0&&(t===!0&&n.setOptions({x:null,y:null}),n.setOptions({fixed:!1}),n.setOptions(o))})}},{key:"getPositions",value:function(e){var t={};if(e!==void 0){if(he(e)===!0){for(var n=0;n0?(u=s/o,t+=u*u):t+=s;return o===1/0?1/0:o*ode(t)}});var ude=ae,lde=ude.Math.hypot,hde=lde,cde=hde,dde=cde,fde=V(dde);function AT(i){var r=vde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function vde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Re=function(){function i(){N(this,i)}return M(i,null,[{key:"transform",value:function(e,t){he(e)||(e=[e]);for(var n=t.point.x,a=t.point.y,o=t.angle,s=t.length,u=0;u4&&arguments[4]!==void 0?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,t),e.lineWidth=t.width,t.dashes!==!1?this._drawDashedLine(e,t,o):this._drawLine(e,t,o)}},{key:"_drawLine",value:function(e,t,n,a,o){if(this.from!=this.to)this._line(e,t,n,a,o);else{var s=this._getCircleData(e),u=Te(s,3),l=u[0],h=u[1],d=u[2];this._circle(e,t,l,h,d)}}},{key:"_drawDashedLine",value:function(e,t,n,a,o){e.lineCap="round";var s=he(t.dashes)?t.dashes:[5,5];if(e.setLineDash!==void 0){if(e.save(),e.setLineDash(s),e.lineDashOffset=0,this.from!=this.to)this._line(e,t,n);else{var u=this._getCircleData(e),l=Te(u,3),h=l[0],d=l[1],c=l[2];this._circle(e,t,h,d,c)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)XE(e,this.from.x,this.from.y,this.to.x,this.to.y,s);else{var f=this._getCircleData(e),v=Te(f,3),p=v[0],g=v[1],y=v[2];this._circle(e,t,p,g,y)}this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}}},{key:"findBorderPosition",value:function(e,t,n){return this.from!=this.to?this._findBorderPosition(e,t,n):this._findBorderPositionCircle(e,t,n)}},{key:"findBorderPositions",value:function(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};var t,n=rt(t=this._getCircleData(e)).call(t,0,2),a=Te(n,2),o=a[0],s=a[1];return{from:this._findBorderPositionCircle(this.from,e,{x:o,y:s,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:o,y:s,low:.6,high:.8,direction:1})}}},{key:"_getCircleData",value:function(e){var t=this.options.selfReference.size;e!==void 0&&this.from.shape.width===void 0&&this.from.shape.resize(e);var n=OT(e,this.options.selfReference.angle,t,this.from);return[n.x,n.y,t]}},{key:"_pointOnCircle",value:function(e,t,n,a){var o=a*2*Math.PI;return{x:e+n*Math.cos(o),y:t-n*Math.sin(o)}}},{key:"_findBorderPositionCircle",value:function(e,t,n){var a=n.x,o=n.y,s=n.low,u=n.high,l=n.direction,h=10,d=this.options.selfReference.size,c=.05,f,v=(s+u)*.5,p=0;this.options.arrowStrikethrough===!0&&(l===-1?p=this.options.endPointOffset.from:l===1&&(p=this.options.endPointOffset.to));var g=0;do{v=(s+u)*.5,f=this._pointOnCircle(a,o,d,v);var y=Math.atan2(e.y-f.y,e.x-f.x),m=e.distanceToBorder(t,y)+p,b=Math.sqrt(Math.pow(f.x-e.x,2)+Math.pow(f.y-e.y,2)),$=m-b;if(Math.abs($)0?l>0?s=v:u=v:l>0?u=v:s=v,++g}while(s<=u&&g1?d=1:d<0&&(d=0);var c=e+d*u,f=t+d*l,v=c-o,p=f-s;return Math.sqrt(v*v+p*p)}},{key:"getArrowData",value:function(e,t,n,a,o,s){var u,l,h,d,c,f,v,p=s.width;t==="from"?(h=this.from,d=this.to,c=s.fromArrowScale<0,f=Math.abs(s.fromArrowScale),v=s.fromArrowType):t==="to"?(h=this.to,d=this.from,c=s.toArrowScale<0,f=Math.abs(s.toArrowScale),v=s.toArrowType):(h=this.to,d=this.from,c=s.middleArrowScale<0,f=Math.abs(s.middleArrowScale),v=s.middleArrowType);var g=15*f+3*p;if(h!=d){var y=fde(h.x-d.x,h.y-d.y),m=g/y;if(t!=="middle")if(this.options.smooth.enabled===!0){var b=this._findBorderPosition(h,e,{via:n}),$=this.getPoint(b.t+m*(t==="from"?1:-1),n);u=Math.atan2(b.y-$.y,b.x-$.x),l=b}else u=Math.atan2(h.y-d.y,h.x-d.x),l=this._findBorderPosition(h,e);else{var O=(c?-m:m)/2,_=this.getPoint(.5+O,n),C=this.getPoint(.5-O,n);u=Math.atan2(_.y-C.y,_.x-C.x),l=this.getPoint(.5,n)}}else{var R=this._getCircleData(e),x=Te(R,3),B=x[0],j=x[1],X=x[2];if(t==="from"){var W=this.options.selfReference.angle,le=this.options.selfReference.angle+Math.PI,Ee=this._findBorderPositionCircle(this.from,e,{x:B,y:j,low:W,high:le,direction:-1});u=Ee.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI,l=Ee}else if(t==="to"){var de=this.options.selfReference.angle,At=this.options.selfReference.angle+Math.PI,lt=this._findBorderPositionCircle(this.from,e,{x:B,y:j,low:de,high:At,direction:1});u=lt.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI,l=lt}else{var nt=this.options.selfReference.angle/(2*Math.PI);l=this._pointOnCircle(B,j,X,nt),u=nt*-2*Math.PI+1.5*Math.PI+.1*Math.PI}}var Dt=l.x-g*.9*Math.cos(u),at=l.y-g*.9*Math.sin(u),me={x:Dt,y:at};return{point:l,core:me,angle:u,length:g,type:v}}},{key:"drawArrowHead",value:function(e,t,n,a,o){e.strokeStyle=this.getColor(e,t),e.fillStyle=e.strokeStyle,e.lineWidth=t.width;var s=DT.draw(e,o);s&&(this.enableShadow(e,t),hs(e).call(e),this.disableShadow(e,t))}},{key:"enableShadow",value:function(e,t){t.shadow===!0&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}},{key:"disableShadow",value:function(e,t){t.shadow===!0&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}},{key:"drawBackground",value:function(e,t){if(t.background!==!1){var n={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),e.strokeStyle=n.strokeStyle,e.lineWidth=n.lineWidth,e.dashes=n.dashes,this.setStrokeDashed(e,t.dashes)}}},{key:"setStrokeDashed",value:function(e,t){if(t!==!1)if(e.setLineDash!==void 0){var n=he(t)?t:[5,5];e.setLineDash(n)}else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");else e.setLineDash!==void 0?e.setLineDash([]):console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.")}}]),i}();function l$(i,r){var e=Oe(i);if(di){var t=di(i);r&&(t=Ot(t).call(t,function(n){return $i(i,n).enumerable})),e.push.apply(e,t)}return e}function h$(i){for(var r=1;r"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var gp=function(i){se(e,i);var r=Ide(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_findBorderPositionBezier",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this._getViaCoordinates(),s=10,u=.2,l=!1,h=1,d=0,c=this.to,f,v,p=this.options.endPointOffset?this.options.endPointOffset.to:0;n.id===this.from.id&&(c=this.from,l=!0,p=this.options.endPointOffset?this.options.endPointOffset.from:0),this.options.arrowStrikethrough===!1&&(p=0);var g=0;do{v=(d+h)*.5,f=this.getPoint(v,o);var y=Math.atan2(c.y-f.y,c.x-f.x),m=c.distanceToBorder(a,y)+p,b=Math.sqrt(Math.pow(f.x-c.x,2)+Math.pow(f.y-c.y,2)),$=m-b;if(Math.abs($)0&&(c=this._getDistanceToLine(y,m,p,g,u,l),d=c"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var c$=function(i){se(e,i);var r=Pde(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o.via=o.via,o._boundFunction=function(){o.positionBezierNode()},o._body.emitter.on("_repositionBezierNodes",o._boundFunction),o}return M(e,[{key:"setOptions",value:function(n){_u(L(e.prototype),"setOptions",this).call(this,n);var a=!1;this.options.physics!==n.physics&&(a=!0),this.options=n,this.id=this.options.id,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.setupSupportNode(),this.connect(),a===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}},{key:"connect",value:function(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.from===void 0||this.to===void 0||this.options.physics===!1?this.via.setOptions({physics:!1}):this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}},{key:"cleanup",value:function(){return this._body.emitter.off("_repositionBezierNodes",this._boundFunction),this.via!==void 0?(delete this._body.nodes[this.via.id],this.via=void 0,!0):!1}},{key:"setupSupportNode",value:function(){if(this.via===void 0){var n="edgeId:"+this.id,a=this._body.functions.createNode({id:n,shape:"circle",physics:!0,hidden:!0});this._body.nodes[n]=a,this.via=a,this.via.parentEdgeId=this.id,this.positionBezierNode()}}},{key:"positionBezierNode",value:function(){this.via!==void 0&&this.from!==void 0&&this.to!==void 0?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):this.via!==void 0&&(this.via.x=0,this.via.y=0)}},{key:"_line",value:function(n,a,o){this._bezierCurve(n,a,o)}},{key:"_getViaCoordinates",value:function(){return this.via}},{key:"getViaNode",value:function(){return this.via}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.via;if(this.from===this.to){var o=this._getCircleData(),s=Te(o,3),u=s[0],l=s[1],h=s[2],d=2*Math.PI*(1-n);return{x:u+h*Math.sin(d),y:l+h-h*(1-Math.cos(d))}}else return{x:Math.pow(1-n,2)*this.fromPoint.x+2*n*(1-n)*a.x+Math.pow(n,2)*this.toPoint.x,y:Math.pow(1-n,2)*this.fromPoint.y+2*n*(1-n)*a.y+Math.pow(n,2)*this.toPoint.y}}},{key:"_findBorderPosition",value:function(n,a){return this._findBorderPositionBezier(n,a,this.via)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){return this._getDistanceToBezierEdge(n,a,o,s,u,l,this.via)}}]),e}(gp);function Cde(i){var r=Ade();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Ade(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var d$=function(i){se(e,i);var r=Cde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a,o){this._bezierCurve(n,a,o)}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_getViaCoordinates",value:function(){var n=this.options.smooth.roundness,a=this.options.smooth.type,o=Math.abs(this.from.x-this.to.x),s=Math.abs(this.from.y-this.to.y);if(a==="discrete"||a==="diagonalCross"){var u,l;o<=s?u=l=n*s:u=l=n*o,this.from.x>this.to.x&&(u=-u),this.from.y>=this.to.y&&(l=-l);var h=this.from.x+u,d=this.from.y+l;return a==="discrete"&&(o<=s?h=othis.to.x&&(R=-R),this.from.y>=this.to.y&&(x=-x);var B=this.from.x+R,j=this.from.y+x;return o<=s?this.from.x<=this.to.x?B=this.to.xB?this.to.x:B:this.from.y>=this.to.y?j=this.to.y>j?this.to.y:j:j=this.to.y2&&arguments[2]!==void 0?arguments[2]:{};return this._findBorderPositionBezier(n,a,o.via)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){var h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(n,a,o,s,u,l,h)}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),o=n,s=Math.pow(1-o,2)*this.fromPoint.x+2*o*(1-o)*a.x+Math.pow(o,2)*this.toPoint.x,u=Math.pow(1-o,2)*this.fromPoint.y+2*o*(1-o)*a.y+Math.pow(o,2)*this.toPoint.y;return{x:s,y:u}}}]),e}(gp);function Dde(i){var r=Rde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Rde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Nde=function(i){se(e,i);var r=Dde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_getDistanceToBezierEdge2",value:function(n,a,o,s,u,l,h,d){for(var c=1e9,f=n,v=a,p=[0,0,0,0],g=1;g<10;g++){var y=.1*g;p[0]=Math.pow(1-y,3),p[1]=3*y*Math.pow(1-y,2),p[2]=3*Math.pow(y,2)*(1-y),p[3]=Math.pow(y,3);var m=p[0]*n+p[1]*h.x+p[2]*d.x+p[3]*o,b=p[0]*a+p[1]*h.y+p[2]*d.y+p[3]*s;if(g>0){var $=this._getDistanceToLine(f,v,m,b,u,l);c=$"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var f$=function(i){se(e,i);var r=Mde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a,o){var s=o[0],u=o[1];this._bezierCurve(n,a,s,u)}},{key:"_getViaCoordinates",value:function(){var n=this.from.x-this.to.x,a=this.from.y-this.to.y,o,s,u,l,h=this.options.smooth.roundness;return(Math.abs(n)>Math.abs(a)||this.options.smooth.forceDirection===!0||this.options.smooth.forceDirection==="horizontal")&&this.options.smooth.forceDirection!=="vertical"?(s=this.from.y,l=this.to.y,o=this.from.x-h*n,u=this.to.x+h*n):(s=this.from.y-h*a,l=this.to.y+h*a,o=this.from.x,u=this.to.x),[{x:o,y:s},{x:u,y:l}]}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_findBorderPosition",value:function(n,a){return this._findBorderPositionBezier(n,a)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){var h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates(),d=Te(h,2),c=d[0],f=d[1];return this._getDistanceToBezierEdge2(n,a,o,s,u,l,c,f)}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),o=Te(a,2),s=o[0],u=o[1],l=n,h=[Math.pow(1-l,3),3*l*Math.pow(1-l,2),3*Math.pow(l,2)*(1-l),Math.pow(l,3)],d=h[0]*this.fromPoint.x+h[1]*s.x+h[2]*u.x+h[3]*this.toPoint.x,c=h[0]*this.fromPoint.y+h[1]*s.y+h[2]*u.y+h[3]*this.toPoint.y;return{x:d,y:c}}}]),e}(Nde);function Fde(i){var r=jde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function jde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var v$=function(i){se(e,i);var r=Fde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a){n.beginPath(),n.moveTo(this.fromPoint.x,this.fromPoint.y),n.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(n,a),n.stroke(),this.disableShadow(n,a)}},{key:"getViaNode",value:function(){}},{key:"getPoint",value:function(n){return{x:(1-n)*this.fromPoint.x+n*this.toPoint.x,y:(1-n)*this.fromPoint.y+n*this.toPoint.y}}},{key:"_findBorderPosition",value:function(n,a){var o=this.to,s=this.from;n.id===this.from.id&&(o=this.from,s=this.to);var u=Math.atan2(o.y-s.y,o.x-s.x),l=o.x-s.x,h=o.y-s.y,d=Math.sqrt(l*l+h*h),c=n.distanceToBorder(a,u),f=(d-c)/d;return{x:(1-f)*s.x+f*o.x,y:(1-f)*s.y+f*o.y,t:0}}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){return this._getDistanceToLine(n,a,o,s,u,l)}}]),e}(RT),qn=function(){function i(r,e,t,n,a){if(N(this,i),e===void 0)throw new Error("No body provided");this.options=li(n),this.globalOptions=n,this.defaultOptions=a,this.body=e,this.imagelist=t,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new IT(this.body,this.options,!0),this.setOptions(r)}return M(i,[{key:"setOptions",value:function(e){if(e){var t=typeof e.physics<"u"&&this.options.physics!==e.physics||typeof e.hidden<"u"&&(this.options.hidden||!1)!==(e.hidden||!1)||typeof e.from<"u"&&this.options.from!==e.from||typeof e.to<"u"&&this.options.to!==e.to;i.parseOptions(this.options,e,!0,this.globalOptions),e.id!==void 0&&(this.id=e.id),e.from!==void 0&&(this.fromId=e.from),e.to!==void 0&&(this.toId=e.to),e.title!==void 0&&(this.title=e.title),e.value!==void 0&&(e.value=ST(e.value));var n=[e,this.options,this.defaultOptions];return this.chooser=dp("edge",n),this.updateLabelModule(e),t=this.updateEdgeType()||t,this._setInteractionWidths(),this.connect(),t}}},{key:"getFormattingValues",value:function(){var e=this.options.arrows.to===!0||this.options.arrows.to.enabled===!0,t=this.options.arrows.from===!0||this.options.arrows.from.enabled===!0,n=this.options.arrows.middle===!0||this.options.arrows.middle.enabled===!0,a=this.options.color.inherit,o={toArrow:e,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,toArrowSrc:this.options.arrows.to.src,toArrowImageWidth:this.options.arrows.to.imageWidth,toArrowImageHeight:this.options.arrows.to.imageHeight,middleArrow:n,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,middleArrowSrc:this.options.arrows.middle.src,middleArrowImageWidth:this.options.arrows.middle.imageWidth,middleArrowImageHeight:this.options.arrows.middle.imageHeight,fromArrow:t,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,fromArrowSrc:this.options.arrows.from.src,fromArrowImageWidth:this.options.arrows.from.imageWidth,fromArrowImageHeight:this.options.arrows.from.imageHeight,arrowStrikethrough:this.options.arrowStrikethrough,color:a?void 0:this.options.color.color,inheritsColor:a,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width,background:this.options.background.enabled,backgroundColor:this.options.background.color,backgroundSize:this.options.background.size,backgroundDashes:this.options.background.dashes};if(this.selected||this.hover)if(this.chooser===!0){if(this.selected){var s=this.options.selectionWidth;typeof s=="function"?o.width=s(o.width):typeof s=="number"&&(o.width+=s),o.width=Math.max(o.width,.3/this.body.view.scale),o.color=this.options.color.highlight,o.shadow=this.options.shadow.enabled}else if(this.hover){var u=this.options.hoverWidth;typeof u=="function"?o.width=u(o.width):typeof u=="number"&&(o.width+=u),o.width=Math.max(o.width,.3/this.body.view.scale),o.color=this.options.color.hover,o.shadow=this.options.shadow.enabled}}else typeof this.chooser=="function"&&(this.chooser(o,this.options.id,this.selected,this.hover),o.color!==void 0&&(o.inheritsColor=!1),o.shadow===!1&&(o.shadowColor!==this.options.shadow.color||o.shadowSize!==this.options.shadow.size||o.shadowX!==this.options.shadow.x||o.shadowY!==this.options.shadow.y)&&(o.shadow=!0));else o.shadow=this.options.shadow.enabled,o.width=Math.max(o.width,.3/this.body.view.scale);return o}},{key:"updateLabelModule",value:function(e){var t=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,t),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}},{key:"updateEdgeType",value:function(){var e=this.options.smooth,t=!1,n=!0;return this.edgeType!==void 0&&((this.edgeType instanceof c$&&e.enabled===!0&&e.type==="dynamic"||this.edgeType instanceof f$&&e.enabled===!0&&e.type==="cubicBezier"||this.edgeType instanceof d$&&e.enabled===!0&&e.type!=="dynamic"&&e.type!=="cubicBezier"||this.edgeType instanceof v$&&e.type.enabled===!1)&&(n=!1),n===!0&&(t=this.cleanup())),n===!0?e.enabled===!0?e.type==="dynamic"?(t=!0,this.edgeType=new c$(this.options,this.body,this.labelModule)):e.type==="cubicBezier"?this.edgeType=new f$(this.options,this.body,this.labelModule):this.edgeType=new d$(this.options,this.body,this.labelModule):this.edgeType=new v$(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),t}},{key:"connect",value:function(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=this.from!==void 0&&this.to!==void 0,this.connected===!0?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}},{key:"disconnect",value:function(){this.from&&(this.from.detachEdge(this),this.from=void 0),this.to&&(this.to.detachEdge(this),this.to=void 0),this.connected=!1}},{key:"getTitle",value:function(){return this.title}},{key:"isSelected",value:function(){return this.selected}},{key:"getValue",value:function(){return this.options.value}},{key:"setValueRange",value:function(e,t,n){if(this.options.value!==void 0){var a=this.options.scaling.customScalingFunction(e,t,n,this.options.value),o=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){var s=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+a*s}this.options.width=this.options.scaling.min+a*o}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}},{key:"_setInteractionWidths",value:function(){typeof this.options.hoverWidth=="function"?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,typeof this.options.selectionWidth=="function"?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}},{key:"draw",value:function(e){var t=this.getFormattingValues();if(!t.hidden){var n=this.edgeType.getViaNode();this.edgeType.drawLine(e,t,this.selected,this.hover,n),this.drawLabel(e,n)}}},{key:"drawArrows",value:function(e){var t=this.getFormattingValues();if(!t.hidden){var n=this.edgeType.getViaNode(),a={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,t.fromArrow&&(a.from=this.edgeType.getArrowData(e,"from",n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.fromPoint=a.from.core),t.fromArrowSrc&&(a.from.image=this.imagelist.load(t.fromArrowSrc)),t.fromArrowImageWidth&&(a.from.imageWidth=t.fromArrowImageWidth),t.fromArrowImageHeight&&(a.from.imageHeight=t.fromArrowImageHeight)),t.toArrow&&(a.to=this.edgeType.getArrowData(e,"to",n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.toPoint=a.to.core),t.toArrowSrc&&(a.to.image=this.imagelist.load(t.toArrowSrc)),t.toArrowImageWidth&&(a.to.imageWidth=t.toArrowImageWidth),t.toArrowImageHeight&&(a.to.imageHeight=t.toArrowImageHeight)),t.middleArrow&&(a.middle=this.edgeType.getArrowData(e,"middle",n,this.selected,this.hover,t),t.middleArrowSrc&&(a.middle.image=this.imagelist.load(t.middleArrowSrc)),t.middleArrowImageWidth&&(a.middle.imageWidth=t.middleArrowImageWidth),t.middleArrowImageHeight&&(a.middle.imageHeight=t.middleArrowImageHeight)),t.fromArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.from),t.middleArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.middle),t.toArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.to)}}},{key:"drawLabel",value:function(e,t){if(this.options.label!==void 0){var n=this.from,a=this.to;this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover);var o;if(n.id!=a.id){this.labelModule.pointToSelf=!1,o=this.edgeType.getPoint(.5,t),e.save();var s=this._getRotation(e);s.angle!=0&&(e.translate(s.x,s.y),e.rotate(s.angle)),this.labelModule.draw(e,o.x,o.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;var u=OT(e,this.options.selfReference.angle,this.options.selfReference.size,n);o=this._pointOnCircle(u.x,u.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(e,o.x,o.y,this.selected,this.hover)}}}},{key:"getItemsOnPoint",value:function(e){var t=[];if(this.labelModule.visible()){var n=this._getRotation();Af(this.labelModule.getSize(),e,n)&&t.push({edgeId:this.id,labelId:0})}var a={left:e.x,top:e.y};return this.isOverlappingWith(a)&&t.push({edgeId:this.id}),t}},{key:"isOverlappingWith",value:function(e){if(this.connected){var t=10,n=this.from.x,a=this.from.y,o=this.to.x,s=this.to.y,u=e.left,l=e.top,h=this.edgeType.getDistanceToEdge(n,a,o,s,u,l);return h0&&s<0)&&(u+=Math.PI),a.angle=u,a}},{key:"_pointOnCircle",value:function(e,t,n,a){return{x:e+n*Math.cos(a),y:t-n*Math.sin(a)}}},{key:"select",value:function(){this.selected=!0}},{key:"unselect",value:function(){this.selected=!1}},{key:"cleanup",value:function(){return this.edgeType.cleanup()}},{key:"remove",value:function(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}},{key:"endPointsValid",value:function(){return this.body.nodes[this.fromId]!==void 0&&this.body.nodes[this.toId]!==void 0}}],[{key:"parseOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,s=["endPointOffset","arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","selfReference","to","title","value","width","font","chosen","widthConstraint"];if(Ma(s,e,t,n),t.endPointOffset!==void 0&&t.endPointOffset.from!==void 0&&(Di(t.endPointOffset.from)?e.endPointOffset.from=t.endPointOffset.from:(e.endPointOffset.from=a.endPointOffset.from!==void 0?a.endPointOffset.from:0,console.error("endPointOffset.from is not a valid number"))),t.endPointOffset!==void 0&&t.endPointOffset.to!==void 0&&(Di(t.endPointOffset.to)?e.endPointOffset.to=t.endPointOffset.to:(e.endPointOffset.to=a.endPointOffset.to!==void 0?a.endPointOffset.to:0,console.error("endPointOffset.to is not a valid number"))),Zu(t.label)?e.label=t.label:Zu(e.label)||(e.label=void 0),Ut(e,t,"smooth",a),Ut(e,t,"shadow",a),Ut(e,t,"background",a),t.dashes!==void 0&&t.dashes!==null?e.dashes=t.dashes:n===!0&&t.dashes===null&&(e.dashes=zi(a.dashes)),t.scaling!==void 0&&t.scaling!==null?(t.scaling.min!==void 0&&(e.scaling.min=t.scaling.min),t.scaling.max!==void 0&&(e.scaling.max=t.scaling.max),Ut(e.scaling,t.scaling,"label",a.scaling)):n===!0&&t.scaling===null&&(e.scaling=zi(a.scaling)),t.arrows!==void 0&&t.arrows!==null)if(typeof t.arrows=="string"){var u=t.arrows.toLowerCase();e.arrows.to.enabled=ie(u).call(u,"to")!=-1,e.arrows.middle.enabled=ie(u).call(u,"middle")!=-1,e.arrows.from.enabled=ie(u).call(u,"from")!=-1}else if(fe(t.arrows)==="object")Ut(e.arrows,t.arrows,"to",a.arrows),Ut(e.arrows,t.arrows,"middle",a.arrows),Ut(e.arrows,t.arrows,"from",a.arrows);else throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+ls(t.arrows));else n===!0&&t.arrows===null&&(e.arrows=zi(a.arrows));if(t.color!==void 0&&t.color!==null){var l=Kn(t.color)?{color:t.color,highlight:t.color,hover:t.color,inherit:!1,opacity:1}:t.color,h=e.color;if(o)ge(h,a.color,!1,n);else for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&delete h[d];if(Kn(h))h.color=h,h.highlight=h,h.hover=h,h.inherit=!1,l.opacity===void 0&&(h.opacity=1);else{var c=!1;l.color!==void 0&&(h.color=l.color,c=!0),l.highlight!==void 0&&(h.highlight=l.highlight,c=!0),l.hover!==void 0&&(h.hover=l.hover,c=!0),l.inherit!==void 0&&(h.inherit=l.inherit),l.opacity!==void 0&&(h.opacity=Math.min(1,Math.max(0,l.opacity))),c===!0?h.inherit=!1:h.inherit===void 0&&(h.inherit="from")}}else n===!0&&t.color===null&&(e.color=li(a.color));n===!0&&t.font===null&&(e.font=li(a.font)),Object.prototype.hasOwnProperty.call(t,"selfReferenceSize")&&(console.warn("The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}"),e.selfReference.size=t.selfReferenceSize)}}]),i}(),Lde=function(){function i(r,e,t){var n,a=this;N(this,i),this.body=r,this.images=e,this.groups=t,this.body.functions.createEdge=k(n=this.create).call(n,this),this.edgesListeners={add:function(s,u){a.add(u.items)},update:function(s,u){a.update(u.items)},remove:function(s,u){a.remove(u.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},endPointOffset:{from:0,to:0},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(s,u,l,h){if(u===s)return .5;var d=1/(u-s);return Math.max(0,(h-s)*d)}},selectionWidth:1.5,selfReference:{size:20,angle:Math.PI/4,renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},background:{enabled:!1,color:"rgba(111,111,111,1)",size:10,dashes:!1},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},ge(this.options,this.defaultOptions),this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this,t,n;this.body.emitter.on("_forceDisableDynamicCurves",function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a==="dynamic"&&(a="continuous");var s=!1;for(var u in e.body.edges)if(Object.prototype.hasOwnProperty.call(e.body.edges,u)){var l=e.body.edges[u],h=e.body.data.edges.get(u);if(h!=null){var d=h.smooth;d!==void 0&&d.enabled===!0&&d.type==="dynamic"&&(a===void 0?l.setOptions({smooth:!1}):l.setOptions({smooth:{type:a}}),s=!0)}}o===!0&&s===!0&&e.body.emitter.emit("_dataChanged")}),this.body.emitter.on("_dataUpdated",function(){e.reconnectEdges()}),this.body.emitter.on("refreshEdges",k(t=this.refresh).call(t,this)),this.body.emitter.on("refresh",k(n=this.refresh).call(n,this)),this.body.emitter.on("destroy",function(){te(e.edgesListeners,function(a,o){e.body.data.edges&&e.body.data.edges.off(o,a)}),delete e.body.functions.createEdge,delete e.edgesListeners.add,delete e.edgesListeners.update,delete e.edgesListeners.remove,delete e.edgesListeners})}},{key:"setOptions",value:function(e){if(e!==void 0){qn.parseOptions(this.options,e,!0,this.defaultOptions,!0);var t=!1;if(e.smooth!==void 0)for(var n in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,n)&&(t=this.body.edges[n].updateEdgeType()||t);if(e.font!==void 0)for(var a in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,a)&&this.body.edges[a].updateLabelModule();(e.hidden!==void 0||e.physics!==void 0||t===!0)&&this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.body.data.edges;if(IE("id",e))this.body.data.edges=e;else if(he(e))this.body.data.edges=new Lu,this.body.data.edges.add(e);else if(!e)this.body.data.edges=new Lu;else throw new TypeError("Array or DataSet expected");if(a&&te(this.edgesListeners,function(s,u){a.off(u,s)}),this.body.edges={},this.body.data.edges){te(this.edgesListeners,function(s,u){t.body.data.edges.on(u,s)});var o=this.body.data.edges.getIds();this.add(o,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),n===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.edges,a=this.body.data.edges,o=0;o1&&arguments[1]!==void 0?arguments[1]:!0;if(e.length!==0){var n=this.body.edges;te(e,function(a){var o=n[a];o!==void 0&&o.remove()}),t&&this.body.emitter.emit("_dataChanged")}}},{key:"refresh",value:function(){var e=this;te(this.body.edges,function(t,n){var a=e.body.data.edges.get(n);a!==void 0&&t.setOptions(a)})}},{key:"create",value:function(e){return new qn(e,this.body,this.images,this.options,this.defaultOptions)}},{key:"reconnectEdges",value:function(){var e,t=this.body.nodes,n=this.body.edges;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e].edges=[]);for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)){var a=n[e];a.from=null,a.to=null,a.connect()}}},{key:"getConnectedNodes",value:function(e){var t=[];if(this.body.edges[e]!==void 0){var n=this.body.edges[e];n.fromId!==void 0&&t.push(n.fromId),n.toId!==void 0&&t.push(n.toId)}return t}},{key:"_updateState",value:function(){this._addMissingEdges(),this._removeInvalidEdges()}},{key:"_removeInvalidEdges",value:function(){var e=this,t=[];te(this.body.edges,function(n,a){var o=e.body.nodes[n.toId],s=e.body.nodes[n.fromId];o!==void 0&&o.isCluster===!0||s!==void 0&&s.isCluster===!0||(o===void 0||s===void 0)&&t.push(a)}),this.remove(t,!1)}},{key:"_addMissingEdges",value:function(){var e=this.body.data.edges;if(e!=null){var t=this.body.edges,n=[];ve(e).call(e,function(a,o){var s=t[o];s===void 0&&n.push(o)}),this.add(n,!0)}}}]),i}(),NT=function(){function i(r,e,t){N(this,i),this.body=r,this.physicsBody=e,this.barnesHutTree,this.setOptions(t),this._rng=Ql("BARNES HUT SOLVER")}return M(i,[{key:"setOptions",value:function(e){this.options=e,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}},{key:"solve",value:function(){if(this.options.gravitationalConstant!==0&&this.physicsBody.physicsNodeIndices.length>0){var e,t=this.body.nodes,n=this.physicsBody.physicsNodeIndices,a=n.length,o=this._formBarnesHutTree(t,n);this.barnesHutTree=o;for(var s=0;s0&&this._getForceContributions(o.root,e)}}},{key:"_getForceContributions",value:function(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}},{key:"_getForceContribution",value:function(e,t){if(e.childrenCount>0){var n=e.centerOfMass.x-t.x,a=e.centerOfMass.y-t.y,o=Math.sqrt(n*n+a*a);o*e.calcSize>this.thetaInversed?this._calculateForces(o,n,a,t,e):e.childrenCount===4?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(o,n,a,t,e)}}},{key:"_calculateForces",value:function(e,t,n,a,o){e===0&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&a.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*a.shape.radius,e-a.shape.radius));var s=this.options.gravitationalConstant*o.mass*a.options.mass/Math.pow(e,3),u=t*s,l=n*s;this.physicsBody.forces[a.id].x+=u,this.physicsBody.forces[a.id].y+=l}},{key:"_formBarnesHutTree",value:function(e,t){for(var n,a=t.length,o=e[t[0]].x,s=e[t[0]].y,u=e[t[0]].x,l=e[t[0]].y,h=1;h0&&(cu&&(u=c),fl&&(l=f))}var v=Math.abs(u-o)-Math.abs(l-s);v>0?(s-=.5*v,l+=.5*v):(o+=.5*v,u-=.5*v);var p=1e-5,g=Math.max(p,Math.abs(u-o)),y=.5*g,m=.5*(o+u),b=.5*(s+l),$={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:m-y,maxX:m+y,minY:b-y,maxY:b+y},size:g,calcSize:1/g,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch($.root);for(var O=0;O0&&this._placeInTree($.root,n);return $}},{key:"_updateBranchMass",value:function(e,t){var n=e.centerOfMass,a=e.mass+t.options.mass,o=1/a;n.x=n.x*e.mass+t.x*t.options.mass,n.x*=o,n.y=n.y*e.mass+t.y*t.options.mass,n.y*=o,e.mass=a;var s=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidtht.x?a.maxY>t.y?o="NW":o="SW":a.maxY>t.y?o="NE":o="SE",this._placeInRegion(e,t,o)}},{key:"_placeInRegion",value:function(e,t,n){var a=e.children[n];switch(a.childrenCount){case 0:a.children.data=t,a.childrenCount=1,this._updateBranchMass(a,t);break;case 1:a.children.data.x===t.x&&a.children.data.y===t.y?(t.x+=this._rng(),t.y+=this._rng()):(this._splitBranch(a),this._placeInTree(a,t));break;case 4:this._placeInTree(a,t);break}}},{key:"_splitBranch",value:function(e){var t=null;e.childrenCount===1&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),t!=null&&this._placeInTree(e,t)}},{key:"_insertRegion",value:function(e,t){var n,a,o,s,u=.5*e.size;switch(t){case"NW":n=e.range.minX,a=e.range.minX+u,o=e.range.minY,s=e.range.minY+u;break;case"NE":n=e.range.minX+u,a=e.range.maxX,o=e.range.minY,s=e.range.minY+u;break;case"SW":n=e.range.minX,a=e.range.minX+u,o=e.range.minY+u,s=e.range.maxY;break;case"SE":n=e.range.minX+u,a=e.range.maxX,o=e.range.minY+u,s=e.range.maxY;break}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:n,maxX:a,minY:o,maxY:s},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}},{key:"_debug",value:function(e,t){this.barnesHutTree!==void 0&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}},{key:"_drawBranch",value:function(e,t,n){n===void 0&&(n="#FF0000"),e.childrenCount===4&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=n,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}]),i}(),zde=function(){function i(r,e,t){N(this,i),this._rng=Ql("REPULSION SOLVER"),this.body=r,this.physicsBody=e,this.setOptions(t)}return M(i,[{key:"setOptions",value:function(e){this.options=e}},{key:"solve",value:function(){for(var e,t,n,a,o,s,u,l,h=this.body.nodes,d=this.physicsBody.physicsNodeIndices,c=this.physicsBody.forces,f=this.options.nodeDistance,v=-2/3/f,p=4/3,g=0;g"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Kde=function(i){se(e,i);var r=Wde(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._rng=Ql("FORCE ATLAS 2 BASED REPULSION SOLVER"),o}return M(e,[{key:"_calculateForces",value:function(n,a,o,s,u){n===0&&(n=.1*this._rng(),a=n),this.overlapAvoidanceFactor<1&&s.shape.radius&&(n=Math.max(.1+this.overlapAvoidanceFactor*s.shape.radius,n-s.shape.radius));var l=s.edges.length+1,h=this.options.gravitationalConstant*u.mass*s.options.mass*l/Math.pow(n,2),d=a*h,c=o*h;this.physicsBody.forces[s.id].x+=d,this.physicsBody.forces[s.id].y+=c}}]),e}(NT);function Gde(i){var r=qde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function qde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Yde=function(i){se(e,i);var r=Gde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_calculateForces",value:function(n,a,o,s,u){if(n>0){var l=u.edges.length+1,h=this.options.centralGravity*l*u.options.mass;s[u.id].x=a*h,s[u.id].y=o*h}}}]),e}(Eu),Xde=function(){function i(r){N(this,i),this.body=r,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},je(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("initPhysics",function(){e.initPhysics()}),this.body.emitter.on("_layoutFailed",function(){e.layoutFailed=!0}),this.body.emitter.on("resetPhysics",function(){e.stopSimulation(),e.ready=!1}),this.body.emitter.on("disablePhysics",function(){e.physicsEnabled=!1,e.stopSimulation()}),this.body.emitter.on("restorePhysics",function(){e.setOptions(e.options),e.ready===!0&&e.startSimulation()}),this.body.emitter.on("startSimulation",function(){e.ready===!0&&e.startSimulation()}),this.body.emitter.on("stopSimulation",function(){e.stopSimulation()}),this.body.emitter.on("destroy",function(){e.stopSimulation(!1),e.body.emitter.off()}),this.body.emitter.on("_dataChanged",function(){e.updatePhysicsData()})}},{key:"setOptions",value:function(e){if(e!==void 0)if(e===!1)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(e===!0)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,Yu(["stabilization"],this.options,e),Ut(this.options,e,"stabilization"),e.enabled===void 0&&(this.options.enabled=!0),this.options.enabled===!1&&(this.physicsEnabled=!1,this.stopSimulation());var t=this.options.wind;t&&((typeof t.x!="number"||Cf(t.x))&&(t.x=0),(typeof t.y!="number"||Cf(t.y))&&(t.y=0)),this.timestep=this.options.timestep}this.init()}},{key:"init",value:function(){var e;this.options.solver==="forceAtlas2Based"?(e=this.options.forceAtlas2Based,this.nodesSolver=new Kde(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Yde(this.body,this.physicsBody,e)):this.options.solver==="repulsion"?(e=this.options.repulsion,this.nodesSolver=new zde(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)):this.options.solver==="hierarchicalRepulsion"?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new Hde(this.body,this.physicsBody,e),this.edgesSolver=new Vde(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new NT(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)),this.modelOptions=e}},{key:"initPhysics",value:function(){this.physicsEnabled===!0&&this.options.enabled===!0?this.options.stabilization.enabled===!0?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}},{key:"startSimulation",value:function(){if(this.physicsEnabled===!0&&this.options.enabled===!0){if(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),this.viewFunction===void 0){var e;this.viewFunction=k(e=this.simulationStep).call(e,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}else this.body.emitter.emit("_redraw")}},{key:"stopSimulation",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.stabilized=!0,e===!0&&this._emitStabilized(),this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,e===!0&&this.body.emitter.emit("_stopRendering"))}},{key:"simulationStep",value:function(){var e=Uu();this.physicsTick();var t=Uu()-e;(t<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}},{key:"_emitStabilized",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&yr(function(){e.body.emitter.emit("stabilized",{iterations:t}),e.startedStabilization=!1,e.stabilizationIterations=0},0)}},{key:"physicsStep",value:function(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}},{key:"adjustTimeStep",value:function(){var e=1.2;this._evaluateStepQuality()===!0?this.timestep=e*this.timestep:this.timestep/es))return!1;return!0}},{key:"moveNodes",value:function(){for(var e=this.physicsBody.physicsNodeIndices,t=0,n=0,a=5,o=0;os&&(e=e>0?s:-s),e}},{key:"_performStep",value:function(e){var t=this.body.nodes[e],n=this.physicsBody.forces[e];this.options.wind&&(n.x+=this.options.wind.x,n.y+=this.options.wind.y);var a=this.physicsBody.velocities[e];this.previousStates[e]={x:t.x,y:t.y,vx:a.x,vy:a.y},t.options.fixed.x===!1?(a.x=this.calculateComponentVelocity(a.x,n.x,t.options.mass),t.x+=a.x*this.timestep):(n.x=0,a.x=0),t.options.fixed.y===!1?(a.y=this.calculateComponentVelocity(a.y,n.y,t.options.mass),t.y+=a.y*this.timestep):(n.y=0,a.y=0);var o=Math.sqrt(Math.pow(a.x,2)+Math.pow(a.y,2));return o}},{key:"_freezeNodes",value:function(){var e=this.body.nodes;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].x&&e[t].y){var n=e[t].options.fixed;this.freezeCache[t]={x:n.x,y:n.y},n.x=!0,n.y=!0}}},{key:"_restoreFrozenNodes",value:function(){var e=this.body.nodes;for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.freezeCache[t]!==void 0&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}},{key:"stabilize",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.stabilization.iterations;if(typeof t!="number"&&(t=this.options.stabilization.iterations,console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ",t)),this.physicsBody.physicsNodeIndices.length===0){this.ready=!0;return}this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=t,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,yr(function(){return e._stabilizationBatch()},0)}},{key:"_startStabilizing",value:function(){return this.startedStabilization===!0?!1:(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}},{key:"_stabilizationBatch",value:function(){var e=this,t=function(){return e.stabilized===!1&&e.stabilizationIterations1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,a=-1e9,o=1e9,s=-1e9,u;if(t.length>0)for(var l=0;lu.shape.boundingBox.left&&(o=u.shape.boundingBox.left),su.shape.boundingBox.top&&(n=u.shape.boundingBox.top),a1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,a=-1e9,o=1e9,s=-1e9,u;if(t.length>0)for(var l=0;lu.x&&(o=u.x),su.y&&(n=u.y),a"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var ife=function(i){se(e,i);var r=tfe(e);function e(t,n,a,o,s,u){var l;return N(this,e),l=r.call(this,t,n,a,o,s,u),l.isCluster=!0,l.containedNodes={},l.containedEdges={},l}return M(e,[{key:"_openChildCluster",value:function(n){var a=this,o=this.body.nodes[n];if(this.containedNodes[n]===void 0)throw new Error("node with id: "+n+" not in current cluster");if(!o.isCluster)throw new Error("node with id: "+n+" is not a cluster");delete this.containedNodes[n],te(o.edges,function(s){delete a.containedEdges[s.id]}),te(o.containedNodes,function(s,u){a.containedNodes[u]=s}),o.containedNodes={},te(o.containedEdges,function(s,u){a.containedEdges[u]=s}),o.containedEdges={},te(o.edges,function(s){te(a.edges,function(u){var l,h,d=ie(l=u.clusteringEdgeReplacingIds).call(l,s.id);d!==-1&&(te(s.clusteringEdgeReplacingIds,function(c){u.clusteringEdgeReplacingIds.push(c),a.body.edges[c].edgeReplacedById=u.id}),Ar(h=u.clusteringEdgeReplacingIds).call(h,d,1))})}),o.edges=[]}}]),e}(Nt),nfe=function(){function i(r){var e=this;N(this,i),this.body=r,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},je(this.options,this.defaultOptions),this.body.emitter.on("_resetData",function(){e.clusteredNodes={},e.clusteredEdges={}})}return M(i,[{key:"clusterByHubsize",value:function(e,t){e===void 0?e=this._getHubSize():fe(e)==="object"&&(t=this._checkOptions(e),e=this._getHubSize());for(var n=[],a=0;a=e&&n.push(o.id)}for(var s=0;s0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.joinCondition===void 0)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");t=this._checkOptions(t);var a={},o={};te(this.body.nodes,function(s,u){s.options&&t.joinCondition(s.options)===!0&&(a[u]=s,te(s.edges,function(l){e.clusteredEdges[l.id]===void 0&&(o[l.id]=l)}))}),this._cluster(a,o,t,n)}},{key:"clusterByEdgeCount",value:function(e,t){var n=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;t=this._checkOptions(t);for(var o=[],s={},u,l,h,d=function(){var p={},g={},y=n.body.nodeIndices[c],m=n.body.nodes[y];if(s[y]===void 0){h=0,l=[];for(var b=0;b0&&Oe(g).length>0&&O===!0){var R=function(){for(var W=0;W1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(1,e,t)}},{key:"clusterBridges",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(2,e,t)}},{key:"clusterByConnection",value:function(e,t){var n,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No nodeId supplied to clusterByConnection!");if(this.body.nodes[e]===void 0)throw new Error("The nodeId given to clusterByConnection does not exist!");var o=this.body.nodes[e];t=this._checkOptions(t,o),t.clusterNodeProperties.x===void 0&&(t.clusterNodeProperties.x=o.x),t.clusterNodeProperties.y===void 0&&(t.clusterNodeProperties.y=o.y),t.clusterNodeProperties.fixed===void 0&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=o.options.fixed.x,t.clusterNodeProperties.fixed.y=o.options.fixed.y);var s={},u={},l=o.id,h=vt.cloneOptions(o);s[l]=o;for(var d=0;d-1&&(u[b.id]=b)}this._cluster(s,u,t,a)}},{key:"_createClusterEdges",value:function(e,t,n,a){for(var o,s,u,l,h,d,c=Oe(e),f=[],v=0;v0&&arguments[0]!==void 0?arguments[0]:{};return e.clusterEdgeProperties===void 0&&(e.clusterEdgeProperties={}),e.clusterNodeProperties===void 0&&(e.clusterNodeProperties={}),e}},{key:"_cluster",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&this.clusteredNodes[s]!==void 0&&o.push(s);for(var u=0;ua?u.x:a,o=u.ys?u.y:s;return{x:.5*(n+a),y:.5*(o+s)}}},{key:"openCluster",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No clusterNodeId supplied to openCluster.");var a=this.body.nodes[e];if(a===void 0)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(a.isCluster!==!0||a.containedNodes===void 0||a.containedEdges===void 0)throw new Error("The node:"+e+" is not a valid cluster.");var o=this.findNode(e),s=ie(o).call(o,e)-1;if(s>=0){var u=o[s],l=this.body.nodes[u];l._openChildCluster(e),delete this.body.nodes[e],n===!0&&this.body.emitter.emit("_dataChanged");return}var h=a.containedNodes,d=a.containedEdges;if(t!==void 0&&t.releaseFunction!==void 0&&typeof t.releaseFunction=="function"){var c={},f={x:a.x,y:a.y};for(var v in h)if(Object.prototype.hasOwnProperty.call(h,v)){var p=this.body.nodes[v];c[v]={x:p.x,y:p.y}}var g=t.releaseFunction(f,c);for(var y in h)if(Object.prototype.hasOwnProperty.call(h,y)){var m=this.body.nodes[y];g[y]!==void 0&&(m.x=g[y].x===void 0?a.x:g[y].x,m.y=g[y].y===void 0?a.y:g[y].y)}}else te(h,function(lt){lt.options.fixed.x===!1&&(lt.x=a.x),lt.options.fixed.y===!1&&(lt.y=a.y)});for(var b in h)if(Object.prototype.hasOwnProperty.call(h,b)){var $=this.body.nodes[b];$.vx=a.vx,$.vy=a.vy,$.setOptions({physics:!0}),delete this.clusteredNodes[b]}for(var O=[],_=0;_0&&sa&&(a=s.edges.length),e+=s.edges.length,t+=Math.pow(s.edges.length,2),n+=1}e=e/n,t=t/n;var u=t-Math.pow(e,2),l=Math.sqrt(u),h=Math.floor(e+2*l);return h>a&&(h=a),h}},{key:"_createClusteredEdge",value:function(e,t,n,a,o){var s=vt.cloneOptions(n,"edge");ge(s,a),s.from=e,s.to=t,s.id="clusterEdge:"+no(),o!==void 0&&ge(s,o);var u=this.body.functions.createEdge(s);return u.clusteringEdgeReplacingIds=[n.id],u.connect(),this.body.edges[u.id]=u,u}},{key:"_clusterEdges",value:function(e,t,n,a){if(t instanceof qn){var o=t,s={};s[o.id]=o,t=s}if(e instanceof Nt){var u=e,l={};l[u.id]=u,e=l}if(n==null)throw new Error("_clusterEdges: parameter clusterNode required");a===void 0&&(a=n.clusterEdgeProperties),this._createClusterEdges(e,t,n,a);for(var h in t)if(Object.prototype.hasOwnProperty.call(t,h)&&this.body.edges[h]!==void 0){var d=this.body.edges[h];this._backupEdgeOptions(d),d.setOptions({physics:!1})}for(var c in e)Object.prototype.hasOwnProperty.call(e,c)&&(this.clusteredNodes[c]={clusterId:n.id,node:this.body.nodes[c]},this.body.nodes[c].setOptions({physics:!1}))}},{key:"_getClusterNodeForNode",value:function(e){if(e!==void 0){var t=this.clusteredNodes[e];if(t!==void 0){var n=t.clusterId;if(n!==void 0)return this.body.nodes[n]}}}},{key:"_filter",value:function(e,t){var n=[];return te(e,function(a){t(a)&&n.push(a)}),n}},{key:"_updateState",value:function(){var e=this,t,n=[],a={},o=function(v){te(e.body.nodes,function(p){p.isCluster===!0&&v(p)})};for(t in this.clusteredNodes)if(Object.prototype.hasOwnProperty.call(this.clusteredNodes,t)){var s=this.body.nodes[t];s===void 0&&n.push(t)}o(function(f){for(var v=0;v0}(!f.endPointsValid()||!p)&&(a[v]=v)}),o(function(f){te(a,function(v){delete f.containedEdges[v],te(f.edges,function(p,g){if(p.id===v){f.edges[g]=null;return}p.clusteringEdgeReplacingIds=e._filter(p.clusteringEdgeReplacingIds,function(y){return!a[y]})}),f.edges=e._filter(f.edges,function(p){return p!==null})})}),te(a,function(f){delete e.clusteredEdges[f]}),te(a,function(f){delete e.body.edges[f]});var l=Oe(this.body.edges);te(l,function(f){var v=e.body.edges[f],p=e._isClusteredNode(v.fromId)||e._isClusteredNode(v.toId);if(p!==e._isClusteredEdge(v.id))if(p){var g=e._getClusterNodeForNode(v.fromId);g!==void 0&&e._clusterEdges(e.body.nodes[v.fromId],v,g);var y=e._getClusterNodeForNode(v.toId);y!==void 0&&e._clusterEdges(e.body.nodes[v.toId],v,y)}else delete e._clusterEdges[f],e._restoreEdge(v)});for(var h=!1,d=!0,c=function(){var v=[];o(function(g){var y=Oe(g.containedNodes).length,m=g.options.allowSingleNodeCluster===!0;(m&&y<1||!m&&y<2)&&v.push(g.id)});for(var p=0;p0,h=h||d};d;)c();h&&this._updateState()}},{key:"_isClusteredNode",value:function(e){return this.clusteredNodes[e]!==void 0}},{key:"_isClusteredEdge",value:function(e){return this.clusteredEdges[e]!==void 0}}]),i}();function afe(){var i;window!==void 0&&(i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame),i===void 0?window.requestAnimationFrame=function(r){r()}:window.requestAnimationFrame=i}var ofe=function(){function i(r,e){N(this,i),afe(),this.body=r,this.canvas=e,this.redrawRequested=!1,this.renderTimer=void 0,this.requiresTimeout=!0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},je(this.options,this.defaultOptions),this._determineBrowserMethod(),this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this,t;this.body.emitter.on("dragStart",function(){e.dragging=!0}),this.body.emitter.on("dragEnd",function(){e.dragging=!1}),this.body.emitter.on("zoom",function(){e.zooming=!0,window.clearTimeout(e.zoomTimeoutId),e.zoomTimeoutId=yr(function(){var n;e.zooming=!1,k(n=e._requestRedraw).call(n,e)()},250)}),this.body.emitter.on("_resizeNodes",function(){e._resizeNodes()}),this.body.emitter.on("_redraw",function(){e.renderingActive===!1&&e._redraw()}),this.body.emitter.on("_blockRedraw",function(){e.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",function(){e.allowRedraw=!0,e.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",k(t=this._requestRedraw).call(t,this)),this.body.emitter.on("_startRendering",function(){e.renderRequests+=1,e.renderingActive=!0,e._startRendering()}),this.body.emitter.on("_stopRendering",function(){e.renderRequests-=1,e.renderingActive=e.renderRequests>0,e.renderTimer=void 0}),this.body.emitter.on("destroy",function(){e.renderRequests=0,e.allowRedraw=!1,e.renderingActive=!1,e.requiresTimeout===!0?clearTimeout(e.renderTimer):window.cancelAnimationFrame(e.renderTimer),e.body.emitter.off()})}},{key:"setOptions",value:function(e){if(e!==void 0){var t=["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"];Ma(t,this.options,e)}}},{key:"_requestNextFrame",value:function(e,t){if(!(typeof window>"u")){var n,a=window;return this.requiresTimeout===!0?n=yr(e,t):a.requestAnimationFrame&&(n=a.requestAnimationFrame(e)),n}}},{key:"_startRendering",value:function(){if(this.renderingActive===!0&&this.renderTimer===void 0){var e;this.renderTimer=this._requestNextFrame(k(e=this._renderStep).call(e,this),this.simulationInterval)}}},{key:"_renderStep",value:function(){this.renderingActive===!0&&(this.renderTimer=void 0,this.requiresTimeout===!0&&this._startRendering(),this._redraw(),this.requiresTimeout===!1&&this._startRendering())}},{key:"redraw",value:function(){this.body.emitter.emit("setSize"),this._redraw()}},{key:"_requestRedraw",value:function(){var e=this;this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,this._requestNextFrame(function(){e._redraw(!1)},0))}},{key:"_redraw",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(this.allowRedraw===!0){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;var t={drawExternalLabels:null};(this.canvas.frame.canvas.width===0||this.canvas.frame.canvas.height===0)&&this.canvas.setSize(),this.canvas.setTransform();var n=this.canvas.getContext(),a=this.canvas.frame.canvas.clientWidth,o=this.canvas.frame.canvas.clientHeight;if(n.clearRect(0,0,a,o),this.canvas.frame.clientWidth===0)return;if(n.save(),n.translate(this.body.view.translation.x,this.body.view.translation.y),n.scale(this.body.view.scale,this.body.view.scale),n.beginPath(),this.body.emitter.emit("beforeDrawing",n),n.closePath(),e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawEdges(n),this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1){var s=this._drawNodes(n,e),u=s.drawExternalLabels;t.drawExternalLabels=u}e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawArrows(n),t.drawExternalLabels!=null&&t.drawExternalLabels(),e===!1&&this._drawSelectionBox(n),n.beginPath(),this.body.emitter.emit("afterDrawing",n),n.closePath(),n.restore(),e===!0&&n.clearRect(0,0,a,o)}}},{key:"_resizeNodes",value:function(){this.canvas.setTransform();var e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);var t=this.body.nodes,n;for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n=t[a],n.resize(e),n.updateBoundingBox(e,n.selected));e.restore()}},{key:"_drawNodes",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.nodes,a=this.body.nodeIndices,o,s=[],u=[],l=20,h=this.canvas.DOMtoCanvas({x:-20,y:-20}),d=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+l,y:this.canvas.frame.canvas.clientHeight+l}),c={top:h.y,left:h.x,bottom:d.y,right:d.x},f=[],v=0;v0&&arguments[0]!==void 0?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}},{key:"_setCameraState",value:function(){if(this.cameraState.scale!==void 0&&this.frame.canvas.clientWidth!==0&&this.frame.canvas.clientHeight!==0&&this.pixelRatio!==0&&this.cameraState.previousWidth>0&&this.cameraState.previousHeight>0){var e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight,n=this.cameraState.scale;e!=1&&t!=1?n=this.cameraState.scale*.5*(e+t):e!=1?n=this.cameraState.scale*e:t!=1&&(n=this.cameraState.scale*t),this.body.view.scale=n;var a=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),o={x:a.x-this.cameraState.position.x,y:a.y-this.cameraState.position.y};this.body.view.translation.x+=o.x*this.body.view.scale,this.body.view.translation.y+=o.y*this.body.view.scale}}},{key:"_prepareValue",value:function(e){if(typeof e=="number")return e+"px";if(typeof e=="string"){if(ie(e).call(e,"%")!==-1||ie(e).call(e,"px")!==-1)return e;if(ie(e).call(e,"%")===-1)return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}},{key:"_create",value:function(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=0,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{var e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerText="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}},{key:"_bindHammer",value:function(){var e=this;this.hammer!==void 0&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new Gn(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:Gn.DIRECTION_ALL}),Qu(this.hammer,function(t){e.body.eventListeners.onTouch(t)}),this.hammer.on("tap",function(t){e.body.eventListeners.onTap(t)}),this.hammer.on("doubletap",function(t){e.body.eventListeners.onDoubleTap(t)}),this.hammer.on("press",function(t){e.body.eventListeners.onHold(t)}),this.hammer.on("panstart",function(t){e.body.eventListeners.onDragStart(t)}),this.hammer.on("panmove",function(t){e.body.eventListeners.onDrag(t)}),this.hammer.on("panend",function(t){e.body.eventListeners.onDragEnd(t)}),this.hammer.on("pinch",function(t){e.body.eventListeners.onPinch(t)}),this.frame.canvas.addEventListener("wheel",function(t){e.body.eventListeners.onMouseWheel(t)}),this.frame.canvas.addEventListener("mousemove",function(t){e.body.eventListeners.onMouseMove(t)}),this.frame.canvas.addEventListener("contextmenu",function(t){e.body.eventListeners.onContext(t)}),this.hammerFrame=new Gn(this.frame),MT(this.hammerFrame,function(t){e.body.eventListeners.onRelease(t)})}},{key:"setSize",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.width,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);var n=!1,a=this.frame.canvas.width,o=this.frame.canvas.height,s=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(s),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},n=!0;else{var u=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),l=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);(this.frame.canvas.width!==u||this.frame.canvas.height!==l)&&this._getCameraState(s),this.frame.canvas.width!==u&&(this.frame.canvas.width=u,n=!0),this.frame.canvas.height!==l&&(this.frame.canvas.height=l,n=!0)}return n===!0&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(a/this.pixelRatio),oldHeight:Math.round(o/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,n}},{key:"getContext",value:function(){return this.frame.canvas.getContext("2d")}},{key:"_determinePixelRatio",value:function(){var e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");var t=1;typeof window<"u"&&(t=window.devicePixelRatio||1);var n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return t/n}},{key:"_setPixelRatio",value:function(){this.pixelRatio=this._determinePixelRatio()}},{key:"setTransform",value:function(){var e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}},{key:"_XconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.x)/this.body.view.scale}},{key:"_XconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.x}},{key:"_YconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.y)/this.body.view.scale}},{key:"_YconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.y}},{key:"canvasToDOM",value:function(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}},{key:"DOMtoCanvas",value:function(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}]),i}();function dfe(i,r){var e=je({nodes:r,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},i??{});if(!he(e.nodes))throw new TypeError("Nodes has to be an array of ids.");if(e.nodes.length===0&&(e.nodes=r),!(typeof e.minZoomLevel=="number"&&e.minZoomLevel>0))throw new TypeError("Min zoom level has to be a number higher than zero.");if(!(typeof e.maxZoomLevel=="number"&&e.minZoomLevel<=e.maxZoomLevel))throw new TypeError("Max zoom level has to be a number higher than min zoom level.");return e}var ffe=function(){function i(r,e){var t,n=this,a;N(this,i),this.body=r,this.canvas=e,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",k(t=this.fit).call(t,this)),this.body.emitter.on("animationFinished",function(){n.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",k(a=this.releaseNode).call(a,this))}return M(i,[{key:"setOptions",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=e}},{key:"fit",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e=dfe(e,this.body.nodeIndices);var n=this.canvas.frame.canvas.clientWidth,a=this.canvas.frame.canvas.clientHeight,o,s;if(n===0||a===0)s=1,o=vt.getRange(this.body.nodes,e.nodes);else if(t===!0){var u=0;for(var l in this.body.nodes)if(Object.prototype.hasOwnProperty.call(this.body.nodes,l)){var h=this.body.nodes[l];h.predefinedPosition===!0&&(u+=1)}if(u>.5*this.body.nodeIndices.length){this.fit(e,!1);return}o=vt.getRange(this.body.nodes,e.nodes);var d=this.body.nodeIndices.length;s=12.662/(d+7.4147)+.0964822;var c=Math.min(n/600,a/600);s*=c}else{this.body.emitter.emit("_resizeNodes"),o=vt.getRange(this.body.nodes,e.nodes);var f=Math.abs(o.maxX-o.minX)*1.1,v=Math.abs(o.maxY-o.minY)*1.1,p=n/f,g=a/v;s=p<=g?p:g}s>e.maxZoomLevel?s=e.maxZoomLevel:s1&&arguments[1]!==void 0?arguments[1]:{};if(this.body.nodes[e]!==void 0){var n={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=n,t.lockedOnNode=e,this.moveTo(t)}else console.error("Node: "+e+" cannot be found.")}},{key:"moveTo",value:function(e){if(e===void 0){e={};return}if(e.offset!=null){if(e.offset.x!=null){if(e.offset.x=+e.offset.x,!Di(e.offset.x))throw new TypeError('The option "offset.x" has to be a finite number.')}else e.offset.x=0;if(e.offset.y!=null){if(e.offset.y=+e.offset.y,!Di(e.offset.y))throw new TypeError('The option "offset.y" has to be a finite number.')}else e.offset.x=0}else e.offset={x:0,y:0};if(e.position!=null){if(e.position.x!=null){if(e.position.x=+e.position.x,!Di(e.position.x))throw new TypeError('The option "position.x" has to be a finite number.')}else e.position.x=0;if(e.position.y!=null){if(e.position.y=+e.position.y,!Di(e.position.y))throw new TypeError('The option "position.y" has to be a finite number.')}else e.position.x=0}else e.position=this.getViewPosition();if(e.scale!=null){if(e.scale=+e.scale,!(e.scale>0))throw new TypeError('The option "scale" has to be a number greater than zero.')}else e.scale=this.body.view.scale;e.animation===void 0&&(e.animation={duration:0}),e.animation===!1&&(e.animation={duration:0}),e.animation===!0&&(e.animation={}),e.animation.duration===void 0&&(e.animation.duration=1e3),e.animation.easingFunction===void 0&&(e.animation.easingFunction="easeInOutQuad"),this.animateView(e)}},{key:"animateView",value:function(e){if(e!==void 0){this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),e.locked===!0&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),this.easingTime!=0&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;var t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.position.x,y:t.y-e.position.y};if(this.targetTranslation={x:this.sourceTranslation.x+n.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+n.y*this.targetScale+e.offset.y},e.animation.duration===0)if(this.lockedOnNodeId!=null){var a;this.viewFunction=k(a=this._lockedRedraw).call(a,this),this.body.emitter.on("initRedraw",this.viewFunction)}else this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw");else{var o;this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=k(o=this._transitionRedraw).call(o,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}}},{key:"_lockedRedraw",value:function(){var e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.x,y:t.y-e.y},a=this.body.view.translation,o={x:a.x+n.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:a.y+n.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=o}},{key:"releaseNode",value:function(){this.lockedOnNodeId!==void 0&&this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}},{key:"_transitionRedraw",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.easingTime+=this.animationSpeed,this.easingTime=e===!0?1:this.easingTime;var t=Xae[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1){if(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,this.lockedOnNodeId!=null){var n;this.viewFunction=k(n=this._lockedRedraw).call(n,this),this.body.emitter.on("initRedraw",this.viewFunction)}this.body.emitter.emit("animationFinished")}}},{key:"getScale",value:function(){return this.body.view.scale}},{key:"getViewPosition",value:function(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}]),i}();function g$(i){var r=i&&i.preventDefault||!1,e=i&&i.container||window,t={},n={keydown:{},keyup:{}},a={},o;for(o=97;o<=122;o++)a[String.fromCharCode(o)]={code:65+(o-97),shift:!1};for(o=65;o<=90;o++)a[String.fromCharCode(o)]={code:o,shift:!0};for(o=0;o<=9;o++)a[""+o]={code:48+o,shift:!1};for(o=1;o<=12;o++)a["F"+o]={code:111+o,shift:!1};for(o=0;o<=9;o++)a["num"+o]={code:96+o,shift:!1};a["num*"]={code:106,shift:!1},a["num+"]={code:107,shift:!1},a["num-"]={code:109,shift:!1},a["num/"]={code:111,shift:!1},a["num."]={code:110,shift:!1},a.left={code:37,shift:!1},a.up={code:38,shift:!1},a.right={code:39,shift:!1},a.down={code:40,shift:!1},a.space={code:32,shift:!1},a.enter={code:13,shift:!1},a.shift={code:16,shift:void 0},a.esc={code:27,shift:!1},a.backspace={code:8,shift:!1},a.tab={code:9,shift:!1},a.ctrl={code:17,shift:!1},a.alt={code:18,shift:!1},a.delete={code:46,shift:!1},a.pageup={code:33,shift:!1},a.pagedown={code:34,shift:!1},a["="]={code:187,shift:!1},a["-"]={code:189,shift:!1},a["]"]={code:221,shift:!1},a["["]={code:219,shift:!1};var s=function(h){l(h,"keydown")},u=function(h){l(h,"keyup")},l=function(h,d){if(n[d][h.keyCode]!==void 0){for(var c=n[d][h.keyCode],f=0;f700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=new Date().valueOf())}},{key:"_stopMovement",value:function(){for(var e in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}},{key:"_moveUp",value:function(){this.body.view.translation.y+=this.options.keyboard.speed.y}},{key:"_moveDown",value:function(){this.body.view.translation.y-=this.options.keyboard.speed.y}},{key:"_moveLeft",value:function(){this.body.view.translation.x+=this.options.keyboard.speed.x}},{key:"_moveRight",value:function(){this.body.view.translation.x-=this.options.keyboard.speed.x}},{key:"_zoomIn",value:function(){var e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,a=t/e,o=(1-a)*this.canvas.canvasViewCenter.x+n.x*a,s=(1-a)*this.canvas.canvasViewCenter.y+n.y*a;this.body.view.scale=t,this.body.view.translation={x:o,y:s},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}},{key:"_zoomOut",value:function(){var e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,a=t/e,o=(1-a)*this.canvas.canvasViewCenter.x+n.x*a,s=(1-a)*this.canvas.canvasViewCenter.y+n.y*a;this.body.view.scale=t,this.body.view.translation={x:o,y:s},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}},{key:"configureKeyboardBindings",value:function(){var e=this;if(this.keycharm!==void 0&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=g$({container:window,preventDefault:!0}):this.keycharm=g$({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0)){var t,n,a,o,s,u,l,h,d,c,f,v,p,g,y,m,b,$,O,_,C,R,x,B;k(t=this.keycharm).call(t,"up",function(){e.bindToRedraw("_moveUp")},"keydown"),k(n=this.keycharm).call(n,"down",function(){e.bindToRedraw("_moveDown")},"keydown"),k(a=this.keycharm).call(a,"left",function(){e.bindToRedraw("_moveLeft")},"keydown"),k(o=this.keycharm).call(o,"right",function(){e.bindToRedraw("_moveRight")},"keydown"),k(s=this.keycharm).call(s,"=",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(u=this.keycharm).call(u,"num+",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(l=this.keycharm).call(l,"num-",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(h=this.keycharm).call(h,"-",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(d=this.keycharm).call(d,"[",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(c=this.keycharm).call(c,"]",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(f=this.keycharm).call(f,"pageup",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(v=this.keycharm).call(v,"pagedown",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(p=this.keycharm).call(p,"up",function(){e.unbindFromRedraw("_moveUp")},"keyup"),k(g=this.keycharm).call(g,"down",function(){e.unbindFromRedraw("_moveDown")},"keyup"),k(y=this.keycharm).call(y,"left",function(){e.unbindFromRedraw("_moveLeft")},"keyup"),k(m=this.keycharm).call(m,"right",function(){e.unbindFromRedraw("_moveRight")},"keyup"),k(b=this.keycharm).call(b,"=",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k($=this.keycharm).call($,"num+",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(O=this.keycharm).call(O,"num-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(_=this.keycharm).call(_,"-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(C=this.keycharm).call(C,"[",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(R=this.keycharm).call(R,"]",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(x=this.keycharm).call(x,"pageup",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(B=this.keycharm).call(B,"pagedown",function(){e.unbindFromRedraw("_zoomOut")},"keyup")}}}]),i}();function pfe(i,r){var e=typeof bi<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=gfe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function gfe(i,r){var e;if(i){if(typeof i=="string")return y$(i,r);var t=rt(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return y$(i,r)}}function y$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=new Date().valueOf())}},{key:"onTap",value:function(e){var t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t)}},{key:"onDoubleTap",value:function(e){var t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("doubleClick",e,t)}},{key:"onHold",value:function(e){var t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t),this.selectionHandler.generateClickEvent("hold",e,t)}},{key:"onRelease",value:function(e){if(new Date().valueOf()-this.touchTime>10){var t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("release",e,t),this.touchTime=new Date().valueOf()}}},{key:"onContext",value:function(e){var t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent("oncontext",e,t)}},{key:"checkSelectionChanges",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;t===!0?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}},{key:"_determineDifference",value:function(e,t){var n=function(o,s){for(var u=[],l=0;l=o.minX&&d.x<=o.maxX&&d.y>=o.minY&&d.y<=o.maxY});ve(s).call(s,function(h){return t.selectionHandler.selectObject(t.body.nodes[h])});var u=this.getPointer(e.center);this.selectionHandler.commitAndEmit(u,e),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw")}else{var l=this.drag.selection;l&&l.length?(ve(l).call(l,function(h){h.node.options.fixed.x=h.xFixed,h.node.options.fixed.y=h.yFixed}),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center)),this.body.emitter.emit("startSimulation")):(this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw"))}}},{key:"onPinch",value:function(e){var t=this.getPointer(e.center);this.drag.pinched=!0,this.pinch.scale===void 0&&(this.pinch.scale=1);var n=this.pinch.scale*e.scale;this.zoom(n,t)}},{key:"zoom",value:function(e,t){if(this.options.zoomView===!0){var n=this.body.view.scale;e<1e-5&&(e=1e-5),e>10&&(e=10);var a=void 0;this.drag!==void 0&&this.drag.dragging===!0&&(a=this.canvas.DOMtoCanvas(this.drag.pointer));var o=this.body.view.translation,s=e/n,u=(1-s)*t.x+o.x*s,l=(1-s)*t.y+o.y*s;if(this.body.view.scale=e,this.body.view.translation={x:u,y:l},a!=null){var h=this.canvas.canvasToDOM(a);this.drag.pointer.x=h.x,this.drag.pointer.y=h.y}this.body.emitter.emit("_requestRedraw"),n0&&(this.popupObj=h[c[c.length-1]],s=!0)}if(this.popupObj===void 0&&s===!1){for(var v=this.body.edgeIndices,p=this.body.edges,g,y=[],m=0;m0&&(this.popupObj=p[y[y.length-1]],u="edge")}this.popupObj!==void 0?this.popupObj.id!==o&&(this.popup===void 0&&(this.popup=new noe(this.canvas.frame)),this.popup.popupTargetType=u,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):this.popup!==void 0&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}},{key:"_checkHidePopup",value:function(e){var t=this.selectionHandler._pointerToPositionObject(e),n=!1;if(this.popup.popupTargetType==="node"){if(this.body.nodes[this.popup.popupTargetId]!==void 0&&(n=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),n===!0)){var a=this.selectionHandler.getNodeAt(e);n=a===void 0?!1:a.id===this.popup.popupTargetId}}else this.selectionHandler.getNodeAt(e)===void 0&&this.body.edges[this.popup.popupTargetId]!==void 0&&(n=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));n===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}]),i}(),mfe=hp,bfe=vT;mfe("Set",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},bfe);var $fe=ae,wfe=$fe.Set,_fe=wfe,Efe=_fe,Sfe=Efe,xi=V(Sfe),Ofe=oe,m$=cp,ru=eh.getWeakData,Tfe=lp,Ife=Vt,kfe=Oa,vd=Je,Pfe=up,BT=mi,b$=Ze,FT=ln,xfe=FT.set,Cfe=FT.getterFor,Afe=BT.find,Dfe=BT.findIndex,Rfe=Ofe([].splice),Nfe=0,iu=function(i){return i.frozen||(i.frozen=new jT)},jT=function(){this.entries=[]},pd=function(i,r){return Afe(i.entries,function(e){return e[0]===r})};jT.prototype={get:function(i){var r=pd(this,i);if(r)return r[1]},has:function(i){return!!pd(this,i)},set:function(i,r){var e=pd(this,i);e?e[1]=r:this.entries.push([i,r])},delete:function(i){var r=Dfe(this.entries,function(e){return e[0]===i});return~r&&Rfe(this.entries,r,1),!!~r}};var Mfe={getConstructor:function(i,r,e,t){var n=i(function(u,l){Tfe(u,a),xfe(u,{type:r,id:Nfe++,frozen:void 0}),kfe(l)||Pfe(l,u[t],{that:u,AS_ENTRIES:e})}),a=n.prototype,o=Cfe(r),s=function(u,l,h){var d=o(u),c=ru(Ife(l),!0);return c===!0?iu(d).set(l,h):c[d.id]=h,u};return m$(a,{delete:function(u){var l=o(this);if(!vd(u))return!1;var h=ru(u);return h===!0?iu(l).delete(u):h&&b$(h,l.id)&&delete h[l.id]},has:function(l){var h=o(this);if(!vd(l))return!1;var d=ru(l);return d===!0?iu(h).has(l):d&&b$(d,h.id)}}),m$(a,e?{get:function(l){var h=o(this);if(vd(l)){var d=ru(l);return d===!0?iu(h).get(l):d?d[h.id]:void 0}},set:function(l,h){return s(this,l,h)}}:{add:function(l){return s(this,l,!0)}}),n}},Bfe=hT,$$=Pe,Su=oe,w$=cp,Ffe=eh,jfe=hp,LT=Mfe,nu=Je,au=ln.enforce,Lfe=ne,zfe=eS,gs=Object,Hfe=Array.isArray,ou=gs.isExtensible,zT=gs.isFrozen,Vfe=gs.isSealed,HT=gs.freeze,Wfe=gs.seal,_$={},E$={},Ufe=!$$.ActiveXObject&&"ActiveXObject"in $$,Wa,VT=function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},WT=jfe("WeakMap",VT,LT),Cn=WT.prototype,Ou=Su(Cn.set),Kfe=function(){return Bfe&&Lfe(function(){var i=HT([]);return Ou(new WT,i,1),!zT(i)})};if(zfe)if(Ufe){Wa=LT.getConstructor(VT,"WeakMap",!0),Ffe.enable();var S$=Su(Cn.delete),su=Su(Cn.has),O$=Su(Cn.get);w$(Cn,{delete:function(i){if(nu(i)&&!ou(i)){var r=au(this);return r.frozen||(r.frozen=new Wa),S$(this,i)||r.frozen.delete(i)}return S$(this,i)},has:function(r){if(nu(r)&&!ou(r)){var e=au(this);return e.frozen||(e.frozen=new Wa),su(this,r)||e.frozen.has(r)}return su(this,r)},get:function(r){if(nu(r)&&!ou(r)){var e=au(this);return e.frozen||(e.frozen=new Wa),su(this,r)?O$(this,r):e.frozen.get(r)}return O$(this,r)},set:function(r,e){if(nu(r)&&!ou(r)){var t=au(this);t.frozen||(t.frozen=new Wa),su(this,r)?Ou(this,r,e):t.frozen.set(r,e)}else Ou(this,r,e);return this}})}else Kfe()&&w$(Cn,{set:function(r,e){var t;return Hfe(r)&&(zT(r)?t=_$:Vfe(r)&&(t=E$)),Ou(this,r,e),t===_$&&HT(r),t===E$&&Wfe(r),this}});var Gfe=ae,qfe=Gfe.WeakMap,Yfe=qfe,Xfe=Yfe,Jfe=Xfe,ao=V(Jfe);function pe(i,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?i!==r||!t:!r.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(i):t?t.value:r.get(i)}function Nf(i,r,e,t,n){if(typeof r=="function"?i!==r||!0:!r.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r.set(i,e),e}function Mf(i,r){var e=typeof bi<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=Zfe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Zfe(i,r){var e;if(i){if(typeof i=="string")return T$(i,r);var t=rt(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return T$(i,r)}}function T$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e0&&arguments[0]!==void 0?arguments[0]:function(){};N(this,i),Kr.set(this,new k$),Gr.set(this,new k$),Tu.set(this,void 0),Nf(this,Tu,r)}return M(i,[{key:"sizeNodes",get:function(){return pe(this,Kr,"f").size}},{key:"sizeEdges",get:function(){return pe(this,Gr,"f").size}},{key:"getNodes",value:function(){return pe(this,Kr,"f").getSelection()}},{key:"getEdges",value:function(){return pe(this,Gr,"f").getSelection()}},{key:"addNodes",value:function(){var e;(e=pe(this,Kr,"f")).add.apply(e,arguments)}},{key:"addEdges",value:function(){var e;(e=pe(this,Gr,"f")).add.apply(e,arguments)}},{key:"deleteNodes",value:function(e){pe(this,Kr,"f").delete(e)}},{key:"deleteEdges",value:function(e){pe(this,Gr,"f").delete(e)}},{key:"clear",value:function(){pe(this,Kr,"f").clear(),pe(this,Gr,"f").clear()}},{key:"commit",value:function(){for(var e,t,n={nodes:pe(this,Kr,"f").commit(),edges:pe(this,Gr,"f").commit()},a=arguments.length,o=new Array(a),s=0;s=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function eve(i,r){var e;if(i){if(typeof i=="string")return x$(i,r);var t=rt(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return x$(i,r)}}function x$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e4&&arguments[4]!==void 0?arguments[4]:!1,s=this._initBaseEvent(t,n);if(o===!0)s.nodes=[],s.edges=[];else{var u=this.getSelection();s.nodes=u.nodes,s.edges=u.edges}a!==void 0&&(s.previousSelection=a),e=="click"&&(s.items=this.getClickedItems(n)),t.controlEdge!==void 0&&(s.controlEdge=t.controlEdge),this.body.emitter.emit(e,s)}},{key:"selectObject",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.selectConnectedEdges;if(e!==void 0){if(e instanceof Nt){if(t===!0){var n;(n=this._selectionAccumulator).addEdges.apply(n,dr(e.edges))}this._selectionAccumulator.addNodes(e)}else this._selectionAccumulator.addEdges(e);return!0}return!1}},{key:"deselectObject",value:function(e){e.isSelected()===!0&&(e.selected=!1,this._removeFromSelection(e))}},{key:"_getAllNodesOverlappingWith",value:function(e){for(var t=[],n=this.body.nodes,a=0;a1&&arguments[1]!==void 0?arguments[1]:!0,n=this._pointerToPositionObject(e),a=this._getAllNodesOverlappingWith(n);if(a.length>0)return t===!0?this.body.nodes[a[a.length-1]]:a[a.length-1]}},{key:"_getEdgesOverlappingWith",value:function(e,t){for(var n=this.body.edges,a=0;a1&&arguments[1]!==void 0?arguments[1]:!0,n=this.canvas.DOMtoCanvas(e),a=10,o=null,s=this.body.edges,u=0;u0&&(this.generateClickEvent("deselectEdge",t,e,o),n=!0),a.nodes.deleted.length>0&&(this.generateClickEvent("deselectNode",t,e,o),n=!0),a.nodes.added.length>0&&(this.generateClickEvent("selectNode",t,e),n=!0),a.edges.added.length>0&&(this.generateClickEvent("selectEdge",t,e),n=!0),n===!0&&this.generateClickEvent("select",t,e)}},{key:"getSelection",value:function(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}},{key:"getSelectedNodes",value:function(){return this._selectionAccumulator.getNodes()}},{key:"getSelectedEdges",value:function(){return this._selectionAccumulator.getEdges()}},{key:"getSelectedNodeIds",value:function(){var e;return na(e=this._selectionAccumulator.getNodes()).call(e,function(t){return t.id})}},{key:"getSelectedEdgeIds",value:function(){var e;return na(e=this._selectionAccumulator.getEdges()).call(e,function(t){return t.id})}},{key:"setSelection",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||!e.nodes&&!e.edges)throw new TypeError("Selection must be an object with nodes and/or edges properties");if((t.unselectAll||t.unselectAll===void 0)&&this.unselectAll(),e.nodes){var n=P$(e.nodes),a;try{for(n.s();!(a=n.n()).done;){var o=a.value,s=this.body.nodes[o];if(!s)throw new RangeError('Node with id "'+o+'" not found');this.selectObject(s,t.highlightEdges)}}catch(c){n.e(c)}finally{n.f()}}if(e.edges){var u=P$(e.edges),l;try{for(u.s();!(l=u.n()).done;){var h=l.value,d=this.body.edges[h];if(!d)throw new RangeError('Edge with id "'+h+'" not found');this.selectObject(d)}}catch(c){u.e(c)}finally{u.f()}}this.body.emitter.emit("_requestRedraw"),this._selectionAccumulator.commit()}},{key:"selectNodes",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:t})}},{key:"selectEdges",value:function(e){if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({edges:e})}},{key:"updateSelection",value:function(){for(var e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(var t in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,t.id)||this._selectionAccumulator.deleteEdges(t)}},{key:"getClickedItems",value:function(e){for(var t=this.canvas.DOMtoCanvas(e),n=[],a=this.body.nodeIndices,o=this.body.nodes,s=a.length-1;s>=0;s--){var u=o[a[s]],l=u.getItemsOnPoint(t);n.push.apply(n,l)}for(var h=this.body.edgeIndices,d=this.body.edges,c=h.length-1;c>=0;c--){var f=d[h[c]],v=f.getItemsOnPoint(t);n.push.apply(n,v)}return n}}]),i}(),C$=kS,rve=Math.floor,Bf=function(i,r){var e=i.length,t=rve(e/2);return e<8?ive(i,r):nve(i,Bf(C$(i,0,t),r),Bf(C$(i,t),r),r)},ive=function(i,r){for(var e=i.length,t=1,n,a;t0;)i[a]=i[--a];a!==t++&&(i[a]=n)}return i},nve=function(i,r,e,t){for(var n=r.length,a=e.length,o=0,s=0;o3)){if(mve)return!0;if(F$)return F$<603;var i="",r,e,t,n;for(r=65;r<76;r++){switch(e=String.fromCharCode(r),r){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(n=0;n<47;n++)ei.push({k:e+n,v:t})}for(ei.sort(function(a,o){return o.v-a.v}),n=0;nN$(e)?1:-1}};dve({target:"Array",proto:!0,forced:Eve},{sort:function(r){r!==void 0&&fve(r);var e=vve(this);if(KT)return r===void 0?j$(e):j$(e,r);var t=[],n=R$(e),a,o;for(o=0;o=0:s>u;u+=l)u in o&&(n=e(n,o[u],u,a));return n}},Fve={left:L$(!1),right:L$(!0)},jve=Pe,Lve=Hr,zve=Lve(jve.process)==="process",Hve=q,Vve=Fve.left,Wve=Ra,z$=Xo,Uve=zve,Kve=!Uve&&z$>79&&z$<83,Gve=Kve||!Wve("reduce");Hve({target:"Array",proto:!0,forced:Gve},{reduce:function(r){var e=arguments.length;return Vve(this,r,e,e>1?arguments[1]:void 0)}});var qve=Qe,Yve=qve("Array").reduce,Xve=Me,Jve=Yve,yd=Array.prototype,Zve=function(i){var r=i.reduce;return i===yd||Xve(yd,i)&&r===yd.reduce?Jve:r},Qve=Zve,epe=Qve,tpe=epe,GT=V(tpe);function qT(i){var r=rpe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function rpe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var YT=function(){function i(){N(this,i)}return M(i,[{key:"abstract",value:function(){throw new Error("Can't instantiate abstract class!")}},{key:"fake_use",value:function(){}},{key:"curveType",value:function(){return this.abstract()}},{key:"getPosition",value:function(e){return this.fake_use(e),this.abstract()}},{key:"setPosition",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;this.fake_use(e,t,n),this.abstract()}},{key:"getTreeSize",value:function(e){return this.fake_use(e),this.abstract()}},{key:"sort",value:function(e){this.fake_use(e),this.abstract()}},{key:"fix",value:function(e,t){this.fake_use(e,t),this.abstract()}},{key:"shift",value:function(e,t){this.fake_use(e,t),this.abstract()}}]),i}(),ipe=function(i){se(e,i);var r=qT(e);function e(t){var n;return N(this,e),n=r.call(this),n.layout=t,n}return M(e,[{key:"curveType",value:function(){return"horizontal"}},{key:"getPosition",value:function(n){return n.x}},{key:"setPosition",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;o!==void 0&&this.layout.hierarchical.addToOrdering(n,o),n.x=a}},{key:"getTreeSize",value:function(n){var a=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,n);return{min:a.min_x,max:a.max_x}}},{key:"sort",value:function(n){oo(n).call(n,function(a,o){return a.x-o.x})}},{key:"fix",value:function(n,a){n.y=this.layout.options.hierarchical.levelSeparation*a,n.options.fixed.y=!0}},{key:"shift",value:function(n,a){this.layout.body.nodes[n].x+=a}}]),e}(YT),npe=function(i){se(e,i);var r=qT(e);function e(t){var n;return N(this,e),n=r.call(this),n.layout=t,n}return M(e,[{key:"curveType",value:function(){return"vertical"}},{key:"getPosition",value:function(n){return n.y}},{key:"setPosition",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;o!==void 0&&this.layout.hierarchical.addToOrdering(n,o),n.y=a}},{key:"getTreeSize",value:function(n){var a=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,n);return{min:a.min_y,max:a.max_y}}},{key:"sort",value:function(n){oo(n).call(n,function(a,o){return a.y-o.y})}},{key:"fix",value:function(n,a){n.x=this.layout.options.hierarchical.levelSeparation*a,n.options.fixed.x=!0}},{key:"shift",value:function(n,a){this.layout.body.nodes[n].y+=a}}]),e}(YT),ape=q,ope=mi.every,spe=Ra,upe=spe("every");ape({target:"Array",proto:!0,forced:!upe},{every:function(r){return ope(this,r,arguments.length>1?arguments[1]:void 0)}});var lpe=Qe,hpe=lpe("Array").every,cpe=Me,dpe=hpe,md=Array.prototype,fpe=function(i){var r=i.every;return i===md||cpe(md,i)&&r===md.every?dpe:r},vpe=fpe,ppe=vpe,gpe=ppe,XT=V(gpe);function ype(i,r){var e=typeof bi<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=mpe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function mpe(i,r){var e;if(i){if(typeof i=="string")return H$(i,r);var t=rt(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return H$(i,r)}}function H$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e=r[a])&&(r[a]=r[n]+1)}),r}function $pe(i){return JT(function(r){var e,t;return XT(e=Ot(t=r.edges).call(t,function(n){return i.has(n.toId)})).call(e,function(n){return n.to===r})},function(r,e){return e>r},"from",i)}function wpe(i){return JT(function(r){var e,t;return XT(e=Ot(t=r.edges).call(t,function(n){return i.has(n.toId)})).call(e,function(n){return n.from===r})},function(r,e){return eo)return{v:{v:bpe(t,a)}};++m},O;b=y.pop();)if(O=$(),O!==0&&O)return O.v},c;for(l.s();!(h=l.n()).done;)if(c=d(),c!==0&&c)return c.v}catch(f){l.e(f)}finally{l.f()}return a}var _pe=function(){function i(){N(this,i),this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}return M(i,[{key:"addRelation",value:function(e,t){this.childrenReference[e]===void 0&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),this.parentReference[t]===void 0&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}},{key:"checkIfTree",value:function(){for(var e in this.parentReference)if(this.parentReference[e].length>1){this.isTree=!1;return}this.isTree=!0}},{key:"numTrees",value:function(){return this.treeIndex+1}},{key:"setTreeIndex",value:function(e,t){t!==void 0&&this.trees[e.id]===void 0&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}},{key:"ensureLevel",value:function(e){this.levels[e]===void 0&&(this.levels[e]=0)}},{key:"getMaxLevel",value:function(e){var t=this,n={},a=function o(s){if(n[s]!==void 0)return n[s];var u=t.levels[s];if(t.childrenReference[s]){var l=t.childrenReference[s];if(l.length>0)for(var h=0;h0&&(n.levelSeparation*=-1):n.levelSeparation<0&&(n.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(a===!0)return this.body.emitter.emit("refresh"),ge(t,this.optionsBackup)}return t}},{key:"_resetRNG",value:function(e){this.initialRandomSeed=e,this._rng=Ql(this.initialRandomSeed)}},{key:"adaptAllOptionsForHierarchicalLayout",value:function(e){if(this.options.hierarchical.enabled===!0){var t=this.optionsBackup.physics;e.physics===void 0||e.physics===!0?(e.physics={enabled:t.enabled===void 0?!0:t.enabled,solver:"hierarchicalRepulsion"},t.enabled=t.enabled===void 0?!0:t.enabled,t.solver=t.solver||"barnesHut"):fe(e.physics)==="object"?(t.enabled=e.physics.enabled===void 0?!0:e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):e.physics!==!1&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});var n=this.direction.curveType();if(e.edges===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(e.edges.smooth===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if(typeof e.edges.smooth=="boolean")this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:n};else{var a=e.edges.smooth;a.type!==void 0&&a.type!=="dynamic"&&(n=a.type),this.optionsBackup.edges={smooth:{enabled:a.enabled===void 0?!0:a.enabled,type:a.type===void 0?"dynamic":a.type,roundness:a.roundness===void 0?.5:a.roundness,forceDirection:a.forceDirection===void 0?!1:a.forceDirection}},e.edges.smooth={enabled:a.enabled===void 0?!0:a.enabled,type:n,roundness:a.roundness===void 0?.5:a.roundness,forceDirection:a.forceDirection===void 0?!1:a.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",n)}return e}},{key:"positionInitially",value:function(e){if(this.options.hierarchical.enabled!==!0){this._resetRNG(this.initialRandomSeed);for(var t=e.length+50,n=0;nu){for(var h=e.length;e.length>u&&s<=o;){s+=1;var d=e.length;s%3===0?this.body.modules.clustering.clusterBridges(l):this.body.modules.clustering.clusterOutliers(l);var c=e.length;if(d==c&&s%3!==0){this._declusterAll(),this.body.emitter.emit("_layoutFailed"),console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.");return}}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*h)})}s>o&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();for(var f=70,v=0;v0){var e,t,n=!1,a=!1;this.lastNodeOnLevel={},this.hierarchical=new _pe;for(t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&(e=this.body.nodes[t],e.options.level!==void 0?(n=!0,this.hierarchical.levels[t]=e.options.level):a=!0);if(a===!0&&n===!0)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");if(a===!0){var o=this.options.hierarchical.sortMethod;o==="hubsize"?this._determineLevelsByHubsize():o==="directed"?this._determineLevelsDirected():o==="custom"&&this._determineLevelsCustomCallback()}for(var s in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,s)&&this.hierarchical.ensureLevel(s);var u=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(u),this._condenseHierarchy(),this._shiftToCenter()}}},{key:"_condenseHierarchy",value:function(){var e=this,t=!1,n={},a=function(){for(var b=s(),$=0,O=0;O0)for(var _=0;_1&&arguments[1]!==void 0?arguments[1]:1e9,O=1e9,_=1e9,C=1e9,R=-1e9;for(var x in b)if(Object.prototype.hasOwnProperty.call(b,x)){var B=e.body.nodes[x],j=e.hierarchical.levels[B.id],X=e.direction.getPosition(B),W=e._getSpaceAroundNode(B,b),le=Te(W,2),Ee=le[0],de=le[1];O=Math.min(Ee,O),_=Math.min(de,_),j<=$&&(C=Math.min(X,C),R=Math.max(X,R))}return[C,R,O,_]},h=function(b,$){var O=e.hierarchical.getMaxLevel(b.id),_=e.hierarchical.getMaxLevel($.id);return Math.min(O,_)},d=function(b,$,O){for(var _=e.hierarchical,C=0;C<$.length;C++){var R=$[C],x=_.distributionOrdering[R];if(x.length>1)for(var B=0;B2&&arguments[2]!==void 0?arguments[2]:!1,_=e.direction.getPosition(b),C=e.direction.getPosition($),R=Math.abs(C-_),x=e.options.hierarchical.nodeSpacing;if(R>x){var B={},j={};u(b,B),u($,j);var X=h(b,$),W=l(B,X),le=l(j,X),Ee=W[1],de=le[0],At=le[2],lt=Math.abs(Ee-de);if(lt>x){var nt=Ee-de+x;nt<-At+x&&(nt=-At+x),nt<0&&(e._shiftBlock($.id,nt),t=!0,O===!0&&e._centerParent($))}}},f=function(b,$){for(var O=$.id,_=$.edges,C=e.hierarchical.levels[$.id],R=e.options.hierarchical.levelSeparation*e.options.hierarchical.levelSeparation,x={},B=[],j=0;j<_.length;j++){var X=_[j];if(X.toId!=X.fromId){var W=X.toId==O?X.from:X.to;x[_[j].id]=W,e.hierarchical.levels[W.id]0?st=Math.min(Rt,Er-e.options.hierarchical.nodeSpacing):Rt<0&&(st=-Math.min(-Rt,ot-e.options.hierarchical.nodeSpacing)),st!=0&&(e._shiftBlock($.id,st),t=!0)},lt=function(at){var me=e.direction.getPosition($),Be=e._getSpaceAroundNode($),Ae=Te(Be,2),ot=Ae[0],Er=Ae[1],Rt=at-me,st=me;Rt>0?st=Math.min(me+(Er-e.options.hierarchical.nodeSpacing),at):Rt<0&&(st=Math.max(me-(ot-e.options.hierarchical.nodeSpacing),at)),st!==me&&(e.direction.setPosition($,st),t=!0)},nt=de(b,B);At(nt),nt=de(b,_),lt(nt)},v=function(b){var $=e.hierarchical.getLevels();$=Li($).call($);for(var O=0;O0&&Math.abs(v)0&&(h=this.direction.getPosition(a[s-1])+l),this.direction.setPosition(u,h,t),this._validatePositionAndContinue(u,t,h),o++}}}}},{key:"_placeBranchNodes",value:function(e,t){var n,a=this.hierarchical.childrenReference[e];if(a!==void 0){for(var o=[],s=0;st&&this.positionedNodes[l.id]===void 0){var d=this.options.hierarchical.nodeSpacing,c=void 0;u===0?c=this.direction.getPosition(this.body.nodes[e]):c=this.direction.getPosition(o[u-1])+d,this.direction.setPosition(l,c,h),this._validatePositionAndContinue(l,h,c)}else return}var f=this._getCenterPosition(o);this.direction.setPosition(this.body.nodes[e],f,t)}}},{key:"_validatePositionAndContinue",value:function(e,t,n){if(this.hierarchical.isTree){if(this.lastNodeOnLevel[t]!==void 0){var a=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(n-ae.hierarchical.levels[a.id]&&e.hierarchical.addRelation(a.id,o.id)};this._crawlNetwork(t),this.hierarchical.checkIfTree()}},{key:"_crawlNetwork",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){},n=arguments.length>1?arguments[1]:void 0,a={},o=function c(f,v){if(a[f.id]===void 0){e.hierarchical.setTreeIndex(f,v),a[f.id]=!0;for(var p,g=e._getActiveEdges(f),y=0;y=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Ope(i,r){var e;if(i){if(typeof i=="string")return V$(i,r);var t=rt(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return V$(i,r)}}function V$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e0&&this.options.deleteNode!==!1?(u===!0&&this._createSeperator(4),this._createDeleteButton(s)):n===0&&this.options.deleteEdge!==!1&&(u===!0&&this._createSeperator(4),this._createDeleteButton(s))),this._bindElementEvents(this.closeDiv,k(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent("select",k(t=this.showManipulatorToolbar).call(t,this))}this.body.emitter.emit("_redraw")}},{key:"addNodeMode",value:function(){var e;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addNode",this.guiEnabled===!0){var t,n=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(n),this._createSeperator(),this._createDescription(n.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,k(t=this.toggleEditMode).call(t,this))}this._temporaryBindEvent("click",k(e=this._performAddNode).call(e,this))}},{key:"editNode",value:function(){var e=this;this.editMode!==!0&&this.enableEditMode(),this._clean();var t=this.selectionHandler.getSelectedNodes()[0];if(t!==void 0)if(this.inMode="editNode",typeof this.options.editNode=="function")if(t.isCluster!==!0){var n=ge({},t.options,!1);if(n.x=t.x,n.y=t.y,this.options.editNode.length===2)this.options.editNode(n,function(a){a!=null&&e.inMode==="editNode"&&e.body.data.nodes.getDataSet().update(a),e.showManipulatorToolbar()});else throw new Error("The function for edit does not support two arguments (data, callback)")}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError);else throw new Error("No function has been configured to handle the editing of nodes.");else this.showManipulatorToolbar()}},{key:"addEdgeMode",value:function(){var e,t,n,a,o;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addEdge",this.guiEnabled===!0){var s,u=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(u),this._createSeperator(),this._createDescription(u.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,k(s=this.toggleEditMode).call(s,this))}this._temporaryBindUI("onTouch",k(e=this._handleConnect).call(e,this)),this._temporaryBindUI("onDragEnd",k(t=this._finishConnect).call(t,this)),this._temporaryBindUI("onDrag",k(n=this._dragControlNode).call(n,this)),this._temporaryBindUI("onRelease",k(a=this._finishConnect).call(a,this)),this._temporaryBindUI("onDragStart",k(o=this._dragStartEdge).call(o,this)),this._temporaryBindUI("onHold",function(){})}},{key:"editEdgeMode",value:function(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="editEdge",fe(this.options.editEdge)==="object"&&typeof this.options.editEdge.editWithoutDrag=="function"&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0)){var e=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(e.from.id,e.to.id);return}if(this.guiEnabled===!0){var t,n=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(n),this._createSeperator(),this._createDescription(n.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,k(t=this.toggleEditMode).call(t,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0){var a,o,s,u,l=this.body.edges[this.edgeBeingEditedId],h=this._getNewTargetNode(l.from.x,l.from.y),d=this._getNewTargetNode(l.to.x,l.to.y);this.temporaryIds.nodes.push(h.id),this.temporaryIds.nodes.push(d.id),this.body.nodes[h.id]=h,this.body.nodeIndices.push(h.id),this.body.nodes[d.id]=d,this.body.nodeIndices.push(d.id),this._temporaryBindUI("onTouch",k(a=this._controlNodeTouch).call(a,this)),this._temporaryBindUI("onTap",function(){}),this._temporaryBindUI("onHold",function(){}),this._temporaryBindUI("onDragStart",k(o=this._controlNodeDragStart).call(o,this)),this._temporaryBindUI("onDrag",k(s=this._controlNodeDrag).call(s,this)),this._temporaryBindUI("onDragEnd",k(u=this._controlNodeDragEnd).call(u,this)),this._temporaryBindUI("onMouseMove",function(){}),this._temporaryBindEvent("beforeDrawing",function(c){var f=l.edgeType.findBorderPositions(c);h.selected===!1&&(h.x=f.from.x,h.y=f.from.y),d.selected===!1&&(d.x=f.to.x,d.y=f.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}},{key:"deleteSelected",value:function(){var e=this;this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="delete";var t=this.selectionHandler.getSelectedNodeIds(),n=this.selectionHandler.getSelectedEdgeIds(),a=void 0;if(t.length>0){for(var o=0;o0&&typeof this.options.deleteEdge=="function"&&(a=this.options.deleteEdge);if(typeof a=="function"){var s={nodes:t,edges:n};if(a.length===2)a(s,function(u){u!=null&&e.inMode==="delete"?(e.body.data.edges.getDataSet().remove(u.edges),e.body.data.nodes.getDataSet().remove(u.nodes),e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar()):(e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar())});else throw new Error("The function for delete does not support two arguments (data, callback)")}else this.body.data.edges.getDataSet().remove(n),this.body.data.nodes.getDataSet().remove(t),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}},{key:"_setup",value:function(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}},{key:"_createWrappers",value:function(){if(this.manipulationDiv===void 0&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",this.editMode===!0?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),this.editModeDiv===void 0&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",this.editMode===!0?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),this.closeDiv===void 0){var e,t;this.closeDiv=document.createElement("button"),this.closeDiv.className="vis-close",this.closeDiv.setAttribute("aria-label",(e=(t=this.options.locales[this.options.locale])===null||t===void 0?void 0:t.close)!==null&&e!==void 0?e:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv)}}},{key:"_getNewTargetNode",value:function(e,t){var n=ge({},this.options.controlNodeStyle);n.id="targetNode"+no(),n.hidden=!1,n.physics=!1,n.x=e,n.y=t;var a=this.body.functions.createNode(n);return a.shape.boundingBox={left:e,right:e,top:t,bottom:t},a}},{key:"_createEditButton",value:function(){var e;this._clean(),this.manipulationDOM={},Yr(this.editModeDiv);var t=this.options.locales[this.options.locale],n=this._createButton("editMode","vis-edit vis-edit-mode",t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(n),this._bindElementEvents(n,k(e=this.toggleEditMode).call(e,this))}},{key:"_clean",value:function(){this.inMode=!1,this.guiEnabled===!0&&(Yr(this.editModeDiv),Yr(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}},{key:"_cleanupDOMEventListeners",value:function(){var e,t=Spe(Ar(e=this._domEventListenerCleanupQueue).call(e,0)),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;a()}}catch(o){t.e(o)}finally{t.f()}}},{key:"_removeManipulationDOM",value:function(){this._clean(),Yr(this.manipulationDiv),Yr(this.editModeDiv),Yr(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}},{key:"_createSeperator",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}},{key:"_createAddNodeButton",value:function(e){var t,n=this._createButton("addNode","vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.addNodeMode).call(t,this))}},{key:"_createAddEdgeButton",value:function(e){var t,n=this._createButton("addEdge","vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.addEdgeMode).call(t,this))}},{key:"_createEditNodeButton",value:function(e){var t,n=this._createButton("editNode","vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.editNode).call(t,this))}},{key:"_createEditEdgeButton",value:function(e){var t,n=this._createButton("editEdge","vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.editEdgeMode).call(t,this))}},{key:"_createDeleteButton",value:function(e){var t,n;this.options.rtl?n="vis-delete-rtl":n="vis-delete";var a=this._createButton("delete",n,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(a),this._bindElementEvents(a,k(t=this.deleteSelected).call(t,this))}},{key:"_createBackButton",value:function(e){var t,n=this._createButton("back","vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.showManipulatorToolbar).call(t,this))}},{key:"_createButton",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("button"),this.manipulationDOM[e+"Div"].className="vis-button "+t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=a,this.manipulationDOM[e+"Label"].innerText=n,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}},{key:"_createDescription",value:function(e){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}},{key:"_temporaryBindEvent",value:function(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}},{key:"_temporaryBindUI",value:function(e,t){if(this.body.eventListeners[e]!==void 0)this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t;else throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+ls(Oe(this.body.eventListeners)))}},{key:"_unbindTemporaryUIs",value:function(){for(var e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}},{key:"_unbindTemporaryEvents",value:function(){for(var e=0;e=0;u--)if(o[u]!==this.selectedControlNode.id){s=this.body.nodes[o[u]];break}if(s!==void 0&&this.selectedControlNode!==void 0)if(s.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var l=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===l.id?this._performEditEdge(s.id,a.to.id):this._performEditEdge(a.from.id,s.id)}else a.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}}},{key:"_handleConnect",value:function(e){if(new Date().valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=je({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;var t=this.lastTouch,n=this.selectionHandler.getNodeAt(t);if(n!==void 0)if(n.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var a=this._getNewTargetNode(n.x,n.y);this.body.nodes[a.id]=a,this.body.nodeIndices.push(a.id);var o=this.body.functions.createEdge({id:"connectionEdge"+no(),from:n.id,to:a.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[o.id]=o,this.body.edgeIndices.push(o.id),this.temporaryIds.nodes.push(a.id),this.temporaryIds.edges.push(o.id)}this.touchTime=new Date().valueOf()}}},{key:"_dragControlNode",value:function(e){var t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),a=void 0;this.temporaryIds.edges[0]!==void 0&&(a=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var o=this.selectionHandler._getAllNodesOverlappingWith(n),s=void 0,u=o.length-1;u>=0;u--){var l;if(ie(l=this.temporaryIds.nodes).call(l,o[u])===-1){s=this.body.nodes[o[u]];break}}if(e.controlEdge={from:a,to:s?s.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",e,t),this.temporaryIds.nodes[0]!==void 0){var h=this.body.nodes[this.temporaryIds.nodes[0]];h.x=this.canvas._XconvertDOMtoCanvas(t.x),h.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(e)}},{key:"_finishConnect",value:function(e){var t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),a=void 0;this.temporaryIds.edges[0]!==void 0&&(a=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var o=this.selectionHandler._getAllNodesOverlappingWith(n),s=void 0,u=o.length-1;u>=0;u--){var l;if(ie(l=this.temporaryIds.nodes).call(l,o[u])===-1){s=this.body.nodes[o[u]];break}}this._cleanupTemporaryNodesAndEdges(),s!==void 0&&(s.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):this.body.nodes[a]!==void 0&&this.body.nodes[s.id]!==void 0&&this._performAddEdge(a,s.id)),e.controlEdge={from:a,to:s?s.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",e,t),this.body.emitter.emit("_redraw")}},{key:"_dragStartEdge",value:function(e){var t=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",e,t,void 0,!0)}},{key:"_performAddNode",value:function(e){var t=this,n={id:no(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if(typeof this.options.addNode=="function")if(this.options.addNode.length===2)this.options.addNode(n,function(a){a!=null&&t.inMode==="addNode"&&t.body.data.nodes.getDataSet().add(a),t.showManipulatorToolbar()});else throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");else this.body.data.nodes.getDataSet().add(n),this.showManipulatorToolbar()}},{key:"_performAddEdge",value:function(e,t){var n=this,a={from:e,to:t};if(typeof this.options.addEdge=="function")if(this.options.addEdge.length===2)this.options.addEdge(a,function(o){o!=null&&n.inMode==="addEdge"&&(n.body.data.edges.getDataSet().add(o),n.selectionHandler.unselectAll(),n.showManipulatorToolbar())});else throw new Error("The function for connect does not support two arguments (data,callback)");else this.body.data.edges.getDataSet().add(a),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}},{key:"_performEditEdge",value:function(e,t){var n=this,a={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges.get(this.edgeBeingEditedId).label},o=this.options.editEdge;if(fe(o)==="object"&&(o=o.editWithoutDrag),typeof o=="function")if(o.length===2)o(a,function(s){s==null||n.inMode!=="editEdge"?(n.body.edges[a.id].updateEdgeType(),n.body.emitter.emit("_redraw"),n.showManipulatorToolbar()):(n.body.data.edges.getDataSet().update(s),n.selectionHandler.unselectAll(),n.showManipulatorToolbar())});else throw new Error("The function for edit does not support two arguments (data, callback)");else this.body.data.edges.getDataSet().update(a),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}]),i}(),D="string",I="boolean",w="number",Ya="array",H="object",ZT="dom",Ipe="any",bd=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],$d={borderWidth:{number:w},borderWidthSelected:{number:w,undefined:"undefined"},brokenImage:{string:D,undefined:"undefined"},chosen:{label:{boolean:I,function:"function"},node:{boolean:I,function:"function"},__type__:{object:H,boolean:I}},color:{border:{string:D},background:{string:D},highlight:{border:{string:D},background:{string:D},__type__:{object:H,string:D}},hover:{border:{string:D},background:{string:D},__type__:{object:H,string:D}},__type__:{object:H,string:D}},opacity:{number:w,undefined:"undefined"},fixed:{x:{boolean:I},y:{boolean:I},__type__:{object:H,boolean:I}},font:{align:{string:D},color:{string:D},size:{number:w},face:{string:D},background:{string:D},strokeWidth:{number:w},strokeColor:{string:D},vadjust:{number:w},multi:{boolean:I,string:D},bold:{color:{string:D},size:{number:w},face:{string:D},mod:{string:D},vadjust:{number:w},__type__:{object:H,string:D}},boldital:{color:{string:D},size:{number:w},face:{string:D},mod:{string:D},vadjust:{number:w},__type__:{object:H,string:D}},ital:{color:{string:D},size:{number:w},face:{string:D},mod:{string:D},vadjust:{number:w},__type__:{object:H,string:D}},mono:{color:{string:D},size:{number:w},face:{string:D},mod:{string:D},vadjust:{number:w},__type__:{object:H,string:D}},__type__:{object:H,string:D}},group:{string:D,number:w,undefined:"undefined"},heightConstraint:{minimum:{number:w},valign:{string:D},__type__:{object:H,boolean:I,number:w}},hidden:{boolean:I},icon:{face:{string:D},code:{string:D},size:{number:w},color:{string:D},weight:{string:D,number:w},__type__:{object:H}},id:{string:D,number:w},image:{selected:{string:D,undefined:"undefined"},unselected:{string:D,undefined:"undefined"},__type__:{object:H,string:D}},imagePadding:{top:{number:w},right:{number:w},bottom:{number:w},left:{number:w},__type__:{object:H,number:w}},label:{string:D,undefined:"undefined"},labelHighlightBold:{boolean:I},level:{number:w,undefined:"undefined"},margin:{top:{number:w},right:{number:w},bottom:{number:w},left:{number:w},__type__:{object:H,number:w}},mass:{number:w},physics:{boolean:I},scaling:{min:{number:w},max:{number:w},label:{enabled:{boolean:I},min:{number:w},max:{number:w},maxVisible:{number:w},drawThreshold:{number:w},__type__:{object:H,boolean:I}},customScalingFunction:{function:"function"},__type__:{object:H}},shadow:{enabled:{boolean:I},color:{string:D},size:{number:w},x:{number:w},y:{number:w},__type__:{object:H,boolean:I}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:I,array:Ya},borderRadius:{number:w},interpolation:{boolean:I},useImageSize:{boolean:I},useBorderWithImage:{boolean:I},coordinateOrigin:{string:["center","top-left"]},__type__:{object:H}},size:{number:w},title:{string:D,dom:ZT,undefined:"undefined"},value:{number:w,undefined:"undefined"},widthConstraint:{minimum:{number:w},maximum:{number:w},__type__:{object:H,boolean:I,number:w}},x:{number:w},y:{number:w},__type__:{object:H}},kpe={configure:{enabled:{boolean:I},filter:{boolean:I,string:D,array:Ya,function:"function"},container:{dom:ZT},showButton:{boolean:I},__type__:{object:H,boolean:I,string:D,array:Ya,function:"function"}},edges:{arrows:{to:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageHeight:{number:w},imageWidth:{number:w},src:{string:D},__type__:{object:H,boolean:I}},middle:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageWidth:{number:w},imageHeight:{number:w},src:{string:D},__type__:{object:H,boolean:I}},from:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageWidth:{number:w},imageHeight:{number:w},src:{string:D},__type__:{object:H,boolean:I}},__type__:{string:["from","to","middle"],object:H}},endPointOffset:{from:{number:w},to:{number:w},__type__:{object:H,number:w}},arrowStrikethrough:{boolean:I},background:{enabled:{boolean:I},color:{string:D},size:{number:w},dashes:{boolean:I,array:Ya},__type__:{object:H,boolean:I}},chosen:{label:{boolean:I,function:"function"},edge:{boolean:I,function:"function"},__type__:{object:H,boolean:I}},color:{color:{string:D},highlight:{string:D},hover:{string:D},inherit:{string:["from","to","both"],boolean:I},opacity:{number:w},__type__:{object:H,string:D}},dashes:{boolean:I,array:Ya},font:{color:{string:D},size:{number:w},face:{string:D},background:{string:D},strokeWidth:{number:w},strokeColor:{string:D},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:w},multi:{boolean:I,string:D},bold:{color:{string:D},size:{number:w},face:{string:D},mod:{string:D},vadjust:{number:w},__type__:{object:H,string:D}},boldital:{color:{string:D},size:{number:w},face:{string:D},mod:{string:D},vadjust:{number:w},__type__:{object:H,string:D}},ital:{color:{string:D},size:{number:w},face:{string:D},mod:{string:D},vadjust:{number:w},__type__:{object:H,string:D}},mono:{color:{string:D},size:{number:w},face:{string:D},mod:{string:D},vadjust:{number:w},__type__:{object:H,string:D}},__type__:{object:H,string:D}},hidden:{boolean:I},hoverWidth:{function:"function",number:w},label:{string:D,undefined:"undefined"},labelHighlightBold:{boolean:I},length:{number:w,undefined:"undefined"},physics:{boolean:I},scaling:{min:{number:w},max:{number:w},label:{enabled:{boolean:I},min:{number:w},max:{number:w},maxVisible:{number:w},drawThreshold:{number:w},__type__:{object:H,boolean:I}},customScalingFunction:{function:"function"},__type__:{object:H}},selectionWidth:{function:"function",number:w},selfReferenceSize:{number:w},selfReference:{size:{number:w},angle:{number:w},renderBehindTheNode:{boolean:I},__type__:{object:H}},shadow:{enabled:{boolean:I},color:{string:D},size:{number:w},x:{number:w},y:{number:w},__type__:{object:H,boolean:I}},smooth:{enabled:{boolean:I},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:w},forceDirection:{string:["horizontal","vertical","none"],boolean:I},__type__:{object:H,boolean:I}},title:{string:D,undefined:"undefined"},width:{number:w},widthConstraint:{maximum:{number:w},__type__:{object:H,boolean:I,number:w}},value:{number:w,undefined:"undefined"},__type__:{object:H}},groups:{useDefaultGroups:{boolean:I},__any__:$d,__type__:{object:H}},interaction:{dragNodes:{boolean:I},dragView:{boolean:I},hideEdgesOnDrag:{boolean:I},hideEdgesOnZoom:{boolean:I},hideNodesOnDrag:{boolean:I},hover:{boolean:I},keyboard:{enabled:{boolean:I},speed:{x:{number:w},y:{number:w},zoom:{number:w},__type__:{object:H}},bindToWindow:{boolean:I},autoFocus:{boolean:I},__type__:{object:H,boolean:I}},multiselect:{boolean:I},navigationButtons:{boolean:I},selectable:{boolean:I},selectConnectedEdges:{boolean:I},hoverConnectedEdges:{boolean:I},tooltipDelay:{number:w},zoomView:{boolean:I},zoomSpeed:{number:w},__type__:{object:H}},layout:{randomSeed:{undefined:"undefined",number:w,string:D},improvedLayout:{boolean:I},clusterThreshold:{number:w},hierarchical:{enabled:{boolean:I},levelSeparation:{number:w},nodeSpacing:{number:w},treeSpacing:{number:w},blockShifting:{boolean:I},edgeMinimization:{boolean:I},parentCentralization:{boolean:I},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:H,boolean:I}},__type__:{object:H}},manipulation:{enabled:{boolean:I},initiallyActive:{boolean:I},addNode:{boolean:I,function:"function"},addEdge:{boolean:I,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:H,boolean:I,function:"function"}},deleteNode:{boolean:I,function:"function"},deleteEdge:{boolean:I,function:"function"},controlNodeStyle:$d,__type__:{object:H,boolean:I}},nodes:$d,physics:{enabled:{boolean:I},barnesHut:{theta:{number:w},gravitationalConstant:{number:w},centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},forceAtlas2Based:{theta:{number:w},gravitationalConstant:{number:w},centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},repulsion:{centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},nodeDistance:{number:w},damping:{number:w},__type__:{object:H}},hierarchicalRepulsion:{centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},nodeDistance:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},maxVelocity:{number:w},minVelocity:{number:w},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:I},iterations:{number:w},updateInterval:{number:w},onlyDynamicEdges:{boolean:I},fit:{boolean:I},__type__:{object:H,boolean:I}},timestep:{number:w},adaptiveTimestep:{boolean:I},wind:{x:{number:w},y:{number:w},__type__:{object:H}},__type__:{object:H,boolean:I}},autoResize:{boolean:I},clickToUse:{boolean:I},locale:{string:D},locales:{__any__:{any:Ipe},__type__:{object:H}},height:{string:D},width:{string:D},__type__:{object:H}},QT={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:["color","#2B7CE9"],background:["color","#97C2FC"],highlight:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]},hover:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[0,0,50,1],strokeColor:["color","#ffffff"]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:["ellipse","box","circle","database","diamond","dot","square","star","text","triangle","triangleDown","hexagon"],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:["color","#848484"],highlight:["color","#848484"],hover:["color","#848484"],inherit:["from","to","both",!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[2,0,50,1],strokeColor:["color","#ffffff"],align:["horizontal","top","middle","bottom"]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"],forceDirection:["horizontal","vertical","none"],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:["UD","DU","LR","RL"],sortMethod:["hubsize","directed"],shakeTowards:["leaves","roots"]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0,autoFocus:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:["barnesHut","forceAtlas2Based","repulsion","hierarchicalRepulsion"],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},Ppe=function(r,e,t){var n;return!!(si(r).call(r,"physics")&&si(n=QT.physics.solver).call(n,e)&&t.physics.solver!==e&&e!=="wind")},xpe=function(){function i(){N(this,i)}return M(i,[{key:"getDistances",value:function(e,t,n){for(var a={},o=e.edges,s=0;s2&&arguments[2]!==void 0?arguments[2]:!1,a=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(a),this._createK_matrix(a),this._createE_matrix();for(var o=.01,s=1,u=0,l=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),h=5,d=1e9,c=0,f=0,v=0,p=0,g=0;d>o&&us&&gy.type==="downstream_subgraph_search")?.data||[],f=y=>{const m=y.json.nodes.map($=>({id:$.id,label:$.type,color:{background:"#2B7CE9",border:"#1B5BB1"},font:{size:16,color:"#FFFFFF",face:"arial",bold:!0},margin:12,padding:10,shape:"box",widthConstraint:{minimum:100,maximum:200}})),b=y.json.links.map($=>({from:$.origin_id,to:$.target_id,arrows:{to:{enabled:!0,scaleFactor:1.2}},color:"#000000",width:2}));return{nodes:m,edges:b}};Ve.useEffect(()=>()=>{d.current&&(d.current.destroy(),d.current=null)},[]);const v=Ve.useCallback((y,m)=>{d.current&&d.current.destroy();const b=f(m),$=new z(y,b,{nodes:{shape:"box",margin:12,padding:10,font:{size:16,color:"#FFFFFF",face:"arial",bold:!0},borderWidth:2,shadow:{enabled:!0,color:"rgba(0,0,0,0.2)",size:5}},edges:{arrows:"to",color:"#000000",width:2,smooth:{enabled:!0,type:"straightCross"}},physics:{enabled:!0,solver:"hierarchicalRepulsion",hierarchicalRepulsion:{nodeDistance:200,springLength:200}},layout:{hierarchical:{enabled:!0,direction:"UD",sortMethod:"directed",nodeSpacing:200,levelSeparation:150}},interaction:{dragNodes:!1,zoomView:!1,dragView:!1}});d.current=$},[]),p=async y=>{console.log("[DownstreamSubgraphs] Starting checkAndLoadSubgraph with node:",y),ri.trackEvent({event_type:"subgraph_accept",message_type:"subgraph",message_id:u.message_id,data:{subgraph_name:y.name,subgraph_tags:y.tags}});const m=y.json.nodes,b=Object.values(Mt.canvas.selected_nodes)[0];if(!b){console.warn("[DownstreamSubgraphs] No node selected"),alert("Please select a upstream node first before adding a subgraph.");return}const $=m.map(C=>C.type),O=s;console.log("[DownstreamSubgraphs] Required node types:",$),console.log("[DownstreamSubgraphs] Installed node types:",O);const _=$.filter(C=>!O.includes(C));if(console.log("[DownstreamSubgraphs] Missing node types:",_),_.length>0)try{console.log("[DownstreamSubgraphs] Fetching info for missing nodes");const C=await ri.batchGetNodeInfo(_);console.log("[DownstreamSubgraphs] Received node infos:",C);const R={text:"",ext:[{type:"node_install_guide",data:C.map(B=>({name:B.name,repository_url:B.github_url}))}]};console.log("[DownstreamSubgraphs] Created message content:",R);const x={id:Sr(),role:"ai",content:JSON.stringify(R),format:"markdown",name:"Assistant",metadata:{pendingSubgraph:y}};console.log("[DownstreamSubgraphs] Created AI message:",x),t?.(x);return}catch(C){console.error("[DownstreamSubgraphs] Error fetching node info:",C),alert("Error checking required nodes. Please try again.");return}console.log("[DownstreamSubgraphs] All required nodes are installed, proceeding to load subgraph"),g(y,b)},g=(y,m)=>{const b=y.json.nodes,$=y.json.links,O=b.find(R=>R.id===0),_=O?.id;console.log("[DownstreamSubgraphs] Entry node ID:",_);const C={};_!==null&&(C[_]=m),Mt.canvas.emitBeforeChange();try{for(const R of b)if(R.id!==_){const x=O?.pos,B=[m._pos[0],m._pos[1]],j=[R.pos[0]+B[0]-x[0],R.pos[1]+B[1]-x[1]];C[R.id]=X$(R.type,{pos:j})}for(const R of $){const x=C[R.origin_id],B=C[R.target_id];x&&B&&x.connect(R.origin_slot,B,R.target_slot)}}finally{Mt.canvas.emitAfterChange()}};return Ve.useEffect(()=>{const y=()=>{const m=Mt.canvas.selected_nodes;Object.keys(m??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values(m)}):a({type:"SET_SELECTED_NODE",payload:null})};return document.addEventListener("click",y),()=>{document.removeEventListener("click",y)}},[]),S.jsx("div",{className:"rounded-lg bg-gray-500 p-3 text-gray-700 text-xs break-words overflow-visible",children:c.length>0&&S.jsx("div",{className:"space-y-3",children:S.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(y=>S.jsxs("div",{className:"relative group",children:[S.jsx("button",{className:`px-3 py-1.5 bg-blue-500 text-white rounded-md +`),a=n.length;if(t.multi)for(var o=0;o0)for(var u=0;u0)for(var v=0;v")||t.parseStartTag("ital","")||t.parseStartTag("mono","")||t.parseEndTag("bold","")||t.parseEndTag("ital","")||t.parseEndTag("mono",""))||n(a);o||t.add(a),t.position++}return t.emitBlock(),t.blocks}},{key:"splitMarkdownBlocks",value:function(e){for(var t=this,n=new q1(e),a=!0,o=function(h){return/\\/.test(h)?(n.positionthis.parent.fontOptions.maxWdt}},{key:"getLongestFit",value:function(e){for(var t="",n=0;n1&&arguments[1]!==void 0?arguments[1]:"normal",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t),e=e.replace(/^( +)/g,"$1\r"),e=e.replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r");for(var a=e.split("\r");a.length>0;){var o=this.getLongestFit(a);if(o===0){var s=a[0],u=this.getLongestFitWord(s);this.lines.newLine(it(s).call(s,0,u),t),a[0]=it(s).call(s,u)}else{var l=o;a[o-1]===" "?o--:a[l]===" "&&l++;var h=it(a).call(a,0,o).join("");o==a.length&&n?this.lines.append(h,t):this.lines.newLine(h,t),a=it(a).call(a,l)}}}}]),i}(),Va=["bold","ital","boldital","mono"],IT=function(){function i(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;N(this,i),this.body=r,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(e),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=t}return M(i,[{key:"setOptions",value:function(e){if(this.elementOptions=e,this.initFontOptions(e.font),Zu(e.label)?this.labelDirty=!0:e.label=void 0,e.font!==void 0&&e.font!==null){if(typeof e.font=="string")this.baseSize=this.fontOptions.size;else if(de(e.font)==="object"){var t=e.font.size;t!==void 0&&(this.baseSize=t)}}}},{key:"initFontOptions",value:function(e){var t=this;if(te(Va,function(n){t.fontOptions[n]={}}),i.parseFontString(this.fontOptions,e)){this.fontOptions.vadjust=0;return}te(e,function(n,a){n!=null&&de(n)!=="object"&&(t.fontOptions[a]=n)})}},{key:"constrain",value:function(e){var t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},n=Qr(e,"widthConstraint");if(typeof n=="number")t.maxWdt=Number(n),t.minWdt=Number(n);else if(de(n)==="object"){var a=Qr(e,["widthConstraint","maximum"]);typeof a=="number"&&(t.maxWdt=Number(a));var o=Qr(e,["widthConstraint","minimum"]);typeof o=="number"&&(t.minWdt=Number(o))}var s=Qr(e,"heightConstraint");if(typeof s=="number")t.minHgt=Number(s);else if(de(s)==="object"){var u=Qr(e,["heightConstraint","minimum"]);typeof u=="number"&&(t.minHgt=Number(u));var l=Qr(e,["heightConstraint","valign"]);typeof l=="string"&&(l==="top"||l==="bottom")&&(t.valign=l)}return t}},{key:"update",value:function(e,t){this.setOptions(e,!0),this.propagateFonts(t),pe(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=dp("label",t)}},{key:"adjustSizes",value:function(e){var t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);var n=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=n)}},{key:"addFontOptionsToPile",value:function(e,t){for(var n=0;n5&&arguments[5]!==void 0?arguments[5]:"middle";if(this.elementOptions.label!==void 0){var u=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&u=this.elementOptions.scaling.label.maxVisible&&(u=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,a,o,t,n,s),this._drawBackground(e),this._drawText(e,t,this.size.yLine,s,u))}}},{key:"_drawBackground",value:function(e){if(this.fontOptions.background!==void 0&&this.fontOptions.background!=="none"){e.fillStyle=this.fontOptions.background;var t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}},{key:"_drawText",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"middle",o=arguments.length>4?arguments[4]:void 0,s=this._setAlignment(e,t,n,a),u=Te(s,2);t=u[0],n=u[1],e.textAlign="left",t=t-this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&(this.fontOptions.valign==="top"&&(n-=(this.size.height-this.size.labelHeight)/2),this.fontOptions.valign==="bottom"&&(n+=(this.size.height-this.size.labelHeight)/2));for(var l=0;l0&&(e.lineWidth=f.strokeWidth,e.strokeStyle=y,e.lineJoin="round"),e.fillStyle=g,f.strokeWidth>0&&e.strokeText(f.text,t+c,n+f.vadjust),e.fillText(f.text,t+c,n+f.vadjust),c+=f.width}n+=h.height}}}},{key:"_setAlignment",value:function(e,t,n,a){if(this.isEdgeLabel&&this.fontOptions.align!=="horizontal"&&this.pointToSelf===!1){t=0,n=0;var o=2;this.fontOptions.align==="top"?(e.textBaseline="alphabetic",n-=2*o):this.fontOptions.align==="bottom"?(e.textBaseline="hanging",n+=2*o):e.textBaseline="middle"}else e.textBaseline=a;return[t,n]}},{key:"_getColor",value:function(e,t,n){var a=e||"#000000",o=n||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){var s=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));a=Kt(a,s),o=Kt(o,s)}return[a,o]}},{key:"getTextSize",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this._processLabel(e,t,n),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}},{key:"getSize",value:function(){var e=2,t=this.size.left,n=this.size.top-.5*e;if(this.isEdgeLabel){var a=-this.size.width*.5;switch(this.fontOptions.align){case"middle":t=a,n=-this.size.height*.5;break;case"top":t=a,n=-(this.size.height+e);break;case"bottom":t=a,n=e;break}}var o={left:t,top:n,width:this.size.width,height:this.size.height};return o}},{key:"calculateLabelSize",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";this._processLabel(e,t,n),this.size.left=a-this.size.width*.5,this.size.top=o-this.size.height*.5,this.size.yLine=o+(1-this.lineCount)*.5*this.fontOptions.size,s==="hanging"&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}},{key:"getFormattingValues",value:function(e,t,n,a){var o=function(h,c,d){return c==="normal"?d==="mod"?"":h[d]:h[c][d]!==void 0?h[c][d]:h[d]},s={color:o(this.fontOptions,a,"color"),size:o(this.fontOptions,a,"size"),face:o(this.fontOptions,a,"face"),mod:o(this.fontOptions,a,"mod"),vadjust:o(this.fontOptions,a,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||n)&&(a==="normal"&&this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?s.mod="bold":typeof this.fontOptions.chooser=="function"&&this.fontOptions.chooser(s,this.elementOptions.id,t,n));var u="";return s.mod!==void 0&&s.mod!==""&&(u+=s.mod+" "),u+=s.size+"px "+s.face,e.font=u.replace(/"/g,""),s.font=e.font,s.height=s.size,s}},{key:"differentState",value:function(e,t){return e!==this.selectedState||t!==this.hoverState}},{key:"_processLabelText",value:function(e,t,n,a){var o=new Hle(e,this,t,n);return o.process(a)}},{key:"_processLabel",value:function(e,t,n){if(!(this.labelDirty===!1&&!this.differentState(t,n))){var a=this._processLabelText(e,t,n,this.elementOptions.label);this.fontOptions.minWdt>0&&a.width0&&a.height0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}},{key:"performFill",value:function(e,t){e.save(),e.fillStyle=t.color,this.enableShadow(e,t),hs(e).call(e),this.disableShadow(e,t),e.restore(),this.performStroke(e,t)}},{key:"_addBoundingBoxMargin",value:function(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}},{key:"_updateBoundingBox",value:function(e,t,n,a,o){n!==void 0&&this.resize(n,a,o),this.left=e-this.width/2,this.top=t-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}},{key:"updateBoundingBox",value:function(e,t,n,a,o){this._updateBoundingBox(e,t,n,a,o)}},{key:"getDimensionsFromLabel",value:function(e,t,n){this.textSize=this.labelModule.getTextSize(e,t,n);var a=this.textSize.width,o=this.textSize.height,s=14;return a===0&&(a=s,o=s),{width:a,height:o}}}]),i}();function Dhe(i){var r=Rhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Rhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Nhe=function(i){ue(e,i);var r=Dhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o);this.width=s.width+this.margin.right+this.margin.left,this.height=s.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.initContextForDraw(n,l),qE(n,this.left,this.top,this.width,this.height,l.borderRadius),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u)}},{key:"updateBoundingBox",value:function(n,a,o,s,u){this._updateBoundingBox(n,a,o,s,u);var l=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(l)}},{key:"distanceToBorder",value:function(n,a){n&&this.resize(n);var o=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(a)),Math.abs(this.height/2/Math.sin(a)))+o}}]),e}(vn);function Mhe(i){var r=Bhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Bhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var pp=function(i){ue(e,i);var r=Mhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o.labelOffset=0,o.selected=!1,o}return M(e,[{key:"setOptions",value:function(n,a,o){this.options=n,a===void 0&&o===void 0||this.setImages(a,o)}},{key:"setImages",value:function(n,a){a&&this.selected?(this.imageObj=a,this.imageObjAlt=n):(this.imageObj=n,this.imageObjAlt=a)}},{key:"switchImages",value:function(n){var a=n&&!this.selected||!n&&this.selected;if(this.selected=n,this.imageObjAlt!==void 0&&a){var o=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=o}}},{key:"_getImagePadding",value:function(){var n={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){var a=this.options.imagePadding;de(a)=="object"?(n.top=a.top,n.right=a.right,n.bottom=a.bottom,n.left=a.left):(n.top=a,n.right=a,n.bottom=a,n.left=a)}return n}},{key:"_resizeImage",value:function(){var n,a;if(this.options.shapeProperties.useImageSize===!1){var o=1,s=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?o=this.imageObj.width/this.imageObj.height:s=this.imageObj.height/this.imageObj.width),n=this.options.size*2*o,a=this.options.size*2*s}else{var u=this._getImagePadding();n=this.imageObj.width+u.left+u.right,a=this.imageObj.height+u.top+u.bottom}this.width=n,this.height=a,this.radius=.5*this.width}},{key:"_drawRawCircle",value:function(n,a,o,s){this.initContextForDraw(n,s),Av(n,a,o,s.size),this.performFill(n,s)}},{key:"_drawImageAtPosition",value:function(n,a){if(this.imageObj.width!=0){n.globalAlpha=a.opacity!==void 0?a.opacity:1,this.enableShadow(n,a);var o=1;this.options.shapeProperties.interpolation===!0&&(o=this.imageObj.width/this.width/this.body.view.scale);var s=this._getImagePadding(),u=this.left+s.left,l=this.top+s.top,h=this.width-s.left-s.right,c=this.height-s.top-s.bottom;this.imageObj.drawImageAtPosition(n,o,u,l,h,c),this.disableShadow(n,a)}}},{key:"_drawImageLabel",value:function(n,a,o,s,u){var l=0;if(this.height!==void 0){l=this.height*.5;var h=this.labelModule.getTextSize(n,s,u);h.lineCount>=1&&(l+=h.height/2)}var c=o+l;this.options.label&&(this.labelOffset=l),this.labelModule.draw(n,a,c,s,u,"hanging")}}]),e}(vn);function Fhe(i){var r=jhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function jhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Lhe=function(i){ue(e,i);var r=Fhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o),u=Math.max(s.width+this.margin.right+this.margin.left,s.height+this.margin.top+this.margin.bottom);this.options.size=u/2,this.width=u,this.height=u,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this._drawRawCircle(n,a,o,l),this.updateBoundingBox(a,o),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,o,s,u)}},{key:"updateBoundingBox",value:function(n,a){this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.width*.5}}]),e}(pp);function zhe(i){var r=Hhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Hhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Vhe=function(i){ue(e,i);var r=zhe(e);function e(t,n,a,o,s){var u;return N(this,e),u=r.call(this,t,n,a),u.setImages(o,s),u}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0;if(s){var u=this.options.size*2;this.width=u,this.height=u,this.radius=.5*this.width;return}this.needsRefresh(a,o)&&this._resizeImage()}},{key:"draw",value:function(n,a,o,s,u,l){this.switchImages(s),this.resize();var h=a,c=o;this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=a,this.top=o,h+=this.width/2,c+=this.height/2):(this.left=a-this.width/2,this.top=o-this.height/2),this._drawRawCircle(n,h,c,l),n.save(),n.clip(),this._drawImageAtPosition(n,l),n.restore(),this._drawImageLabel(n,h,c,s,u),this.updateBoundingBox(a,o)}},{key:"updateBoundingBox",value:function(n,a){this.options.shapeProperties.coordinateOrigin==="top-left"?(this.boundingBox.top=a,this.boundingBox.left=n,this.boundingBox.right=n+this.options.size*2,this.boundingBox.bottom=a+this.options.size*2):(this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size),this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.width*.5}}]),e}(pp);function Whe(i){var r=Uhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Uhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Si=function(i){ue(e,i);var r=Whe(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{size:this.options.size};if(this.needsRefresh(a,o)){var u,l;this.labelModule.getTextSize(n,a,o);var h=2*s.size;this.width=(u=this.customSizeWidth)!==null&&u!==void 0?u:h,this.height=(l=this.customSizeHeight)!==null&&l!==void 0?l:h,this.radius=.5*this.width}}},{key:"_drawShape",value:function(n,a,o,s,u,l,h,c){var d=this;return this.resize(n,l,h,c),this.left=s-this.width/2,this.top=u-this.height/2,this.initContextForDraw(n,c),TK(a)(n,s,u,c.size),this.performFill(n,c),this.options.icon!==void 0&&this.options.icon.code!==void 0&&(n.font=(l?"bold ":"")+this.height/2+"px "+(this.options.icon.face||"FontAwesome"),n.fillStyle=this.options.icon.color||"black",n.textAlign="center",n.textBaseline="middle",n.fillText(this.options.icon.code,s,u)),{drawExternalLabel:function(){if(d.options.label!==void 0){d.labelModule.calculateLabelSize(n,l,h,s,u,"hanging");var v=u+.5*d.height+.5*d.labelModule.size.height;d.labelModule.draw(n,s,v,l,h,"hanging")}d.updateBoundingBox(s,u)}}}},{key:"updateBoundingBox",value:function(n,a){this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}]),e}(vn);function Q1(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function Khe(i){for(var r=1;r"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Yhe=function(i){ue(e,i);var r=Ghe(e);function e(t,n,a,o){var s;return N(this,e),s=r.call(this,t,n,a,o),s.ctxRenderer=o,s}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u,l),this.left=a-this.width/2,this.top=o-this.height/2,n.save();var h=this.ctxRenderer({ctx:n,id:this.options.id,x:a,y:o,state:{selected:s,hover:u},style:Khe({},l),label:this.options.label});if(h.drawNode!=null&&h.drawNode(),n.restore(),h.drawExternalLabel){var c=h.drawExternalLabel;h.drawExternalLabel=function(){n.save(),c(),n.restore()}}return h.nodeDimensions&&(this.customSizeWidth=h.nodeDimensions.width,this.customSizeHeight=h.nodeDimensions.height),h}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function Xhe(i){var r=Jhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Jhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Zhe=function(i){ue(e,i);var r=Xhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o),u=s.width+this.margin.right+this.margin.left;this.width=u,this.height=u,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.initContextForDraw(n,l),YE(n,a-this.width/2,o-this.height/2,this.width,this.height),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function Qhe(i){var r=ece();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function ece(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var tce=function(i){ue(e,i);var r=Qhe(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"diamond",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function rce(i){var r=ice();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function ice(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var nce=function(i){ue(e,i);var r=rce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"circle",2,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.options.size}}]),e}(Si);function ace(i){var r=oce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function oce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var e$=function(i){ue(e,i);var r=ace(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o);this.height=s.height*2,this.width=s.width+s.height,this.radius=.5*this.width}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width*.5,this.top=o-this.height*.5,this.initContextForDraw(n,l),sf(n,this.left,this.top,this.width,this.height),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,a,o,s,u)}},{key:"distanceToBorder",value:function(n,a){n&&this.resize(n);var o=this.width*.5,s=this.height*.5,u=Math.sin(a)*o,l=Math.cos(a)*s;return o*s/Math.sqrt(u*u+l*l)}}]),e}(vn);function sce(i){var r=uce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function uce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var lce=function(i){ue(e,i);var r=sce(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){this.needsRefresh(a,o)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(n,a,o,s,u,l){var h=this;return this.resize(n,s,u),this.options.icon.size=this.options.icon.size||50,this.left=a-this.width/2,this.top=o-this.height/2,this._icon(n,a,o,s,u,l),{drawExternalLabel:function(){if(h.options.label!==void 0){var d=5;h.labelModule.draw(n,h.left+h.iconSize.width/2+h.margin.left,o+h.height/2+d,s)}h.updateBoundingBox(a,o)}}}},{key:"updateBoundingBox",value:function(n,a){if(this.boundingBox.top=a-this.options.icon.size*.5,this.boundingBox.left=n-this.options.icon.size*.5,this.boundingBox.right=n+this.options.icon.size*.5,this.boundingBox.bottom=a+this.options.icon.size*.5,this.options.label!==void 0&&this.labelModule.size.width>0){var o=5;this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+o)}}},{key:"_icon",value:function(n,a,o,s,u,l){var h=Number(this.options.icon.size);this.options.icon.code!==void 0?(n.font=[this.options.icon.weight!=null?this.options.icon.weight:s?"bold":"",(this.options.icon.weight!=null&&s?5:0)+h+"px",this.options.icon.face].join(" "),n.fillStyle=this.options.icon.color||"black",n.textAlign="center",n.textBaseline="middle",this.enableShadow(n,l),n.fillText(this.options.icon.code,a,o),this.disableShadow(n,l)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function hce(i){var r=cce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function cce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var dce=function(i){ue(e,i);var r=hce(e);function e(t,n,a,o,s){var u;return N(this,e),u=r.call(this,t,n,a),u.setImages(o,s),u}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0;if(s){var u=this.options.size*2;this.width=u,this.height=u;return}this.needsRefresh(a,o)&&this._resizeImage()}},{key:"draw",value:function(n,a,o,s,u,l){n.save(),this.switchImages(s),this.resize();var h=a,c=o;if(this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=a,this.top=o,h+=this.width/2,c+=this.height/2):(this.left=a-this.width/2,this.top=o-this.height/2),this.options.shapeProperties.useBorderWithImage===!0){var d=this.options.borderWidth,f=this.options.borderWidthSelected||2*this.options.borderWidth,v=(s?f:d)/this.body.view.scale;n.lineWidth=Math.min(this.width,v),n.beginPath();var p=s?this.options.color.highlight.border:u?this.options.color.hover.border:this.options.color.border,g=s?this.options.color.highlight.background:u?this.options.color.hover.background:this.options.color.background;l.opacity!==void 0&&(p=Kt(p,l.opacity),g=Kt(g,l.opacity)),n.strokeStyle=p,n.fillStyle=g,n.rect(this.left-.5*n.lineWidth,this.top-.5*n.lineWidth,this.width+n.lineWidth,this.height+n.lineWidth),hs(n).call(n),this.performStroke(n,l),n.closePath()}this._drawImageAtPosition(n,l),this._drawImageLabel(n,h,c,s,u),this.updateBoundingBox(a,o),n.restore()}},{key:"updateBoundingBox",value:function(n,a){this.resize(),this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=n,this.top=a):(this.left=n-this.width/2,this.top=a-this.height/2),this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(pp);function fce(i){var r=vce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function vce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var pce=function(i){ue(e,i);var r=fce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"square",2,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function gce(i){var r=yce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function yce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var mce=function(i){ue(e,i);var r=gce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"hexagon",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function bce(i){var r=$ce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function $ce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var wce=function(i){ue(e,i);var r=bce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"star",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function _ce(i){var r=Ece();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Ece(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Sce=function(i){ue(e,i);var r=_ce(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){this.needsRefresh(a,o)&&(this.textSize=this.labelModule.getTextSize(n,a,o),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.enableShadow(n,l),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u),this.disableShadow(n,l),this.updateBoundingBox(a,o,n,s,u)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function Oce(i){var r=Tce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Tce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Ice=function(i){ue(e,i);var r=Oce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"triangle",3,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function kce(i){var r=Pce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Pce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var xce=function(i){ue(e,i);var r=kce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"triangleDown",3,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function t$(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function r$(i){for(var r=1;re.left&&this.shape.tope.top}},{key:"isBoundingBoxOverlappingWith",value:function(e){return this.shape.boundingBox.lefte.left&&this.shape.boundingBox.tope.top}}],[{key:"checkOpacity",value:function(e){return 0<=e&&e<=1}},{key:"checkCoordinateOrigin",value:function(e){return e===void 0||e==="center"||e==="top-left"}},{key:"updateGroupOptions",value:function(e,t,n){var a;if(n!==void 0){var o=e.group;if(t!==void 0&&t.group!==void 0&&o!==t.group)throw new Error("updateGroupOptions: group values in options don't match.");var s=typeof o=="number"||typeof o=="string"&&o!="";if(s){var u=n.get(o);u.opacity!==void 0&&t.opacity===void 0&&(i.checkOpacity(u.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+u.opacity),u.opacity=void 0));var l=Tt(a=kle(t)).call(a,function(h){return t[h]!=null});l.push("font"),Yu(l,e,u),e.color=If(e.color)}}}},{key:"parseOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=arguments.length>4?arguments[4]:void 0,s=["color","fixed","shadow"];if(Yu(s,e,t,n),i.checkMass(t),e.opacity!==void 0&&(i.checkOpacity(e.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity),e.opacity=void 0)),t.opacity!==void 0&&(i.checkOpacity(t.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+t.opacity),t.opacity=void 0)),t.shapeProperties&&!i.checkCoordinateOrigin(t.shapeProperties.coordinateOrigin)&&console.error("Invalid option for node coordinateOrigin, found: "+t.shapeProperties.coordinateOrigin),Ut(e,t,"shadow",a),t.color!==void 0&&t.color!==null){var u=If(t.color);JO(e.color,u)}else n===!0&&t.color===null&&(e.color=di(a.color));t.fixed!==void 0&&t.fixed!==null&&(typeof t.fixed=="boolean"?(e.fixed.x=t.fixed,e.fixed.y=t.fixed):(t.fixed.x!==void 0&&typeof t.fixed.x=="boolean"&&(e.fixed.x=t.fixed.x),t.fixed.y!==void 0&&typeof t.fixed.y=="boolean"&&(e.fixed.y=t.fixed.y))),n===!0&&t.font===null&&(e.font=di(a.font)),i.updateGroupOptions(e,t,o),t.scaling!==void 0&&Ut(e.scaling,t.scaling,"label",a.scaling)}},{key:"checkMass",value:function(e,t){if(e.mass!==void 0&&e.mass<=0){var n="";t!==void 0&&(n=" in node id: "+t),console.error("%cNegative or zero mass disallowed"+n+", setting mass to 1.",tT),e.mass=1}}}]),i}();function Cce(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=Ace(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Ace(i,r){var e;if(i){if(typeof i=="string")return i$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i$(i,r)}}function i$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity):this.options.opacity=e.opacity),e.shape!==void 0)for(var t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].updateShape();if(typeof e.font<"u"||typeof e.widthConstraint<"u"||typeof e.heightConstraint<"u")for(var n=0,a=Oe(this.body.nodes);n1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.data.nodes;if(IE("id",e))this.body.data.nodes=e;else if(he(e))this.body.data.nodes=new Lu,this.body.data.nodes.add(e);else if(!e)this.body.data.nodes=new Lu;else throw new TypeError("Array or DataSet expected");if(n&&te(this.nodesListeners,function(s,u){n.off(u,s)}),this.body.nodes={},this.body.data.nodes){var a=this;te(this.nodesListeners,function(s,u){a.body.data.nodes.on(u,s)});var o=this.body.data.nodes.getIds();this.add(o,!0)}t===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n,a=[],o=0;o1&&arguments[1]!==void 0?arguments[1]:Nt;return new t(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}},{key:"refresh",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;te(this.body.nodes,function(n,a){var o=e.body.data.nodes.get(a);o!==void 0&&(t===!0&&n.setOptions({x:null,y:null}),n.setOptions({fixed:!1}),n.setOptions(o))})}},{key:"getPositions",value:function(e){var t={};if(e!==void 0){if(he(e)===!0){for(var n=0;n0?(u=s/o,t+=u*u):t+=s;return o===1/0?1/0:o*ode(t)}});var ude=oe,lde=ude.Math.hypot,hde=lde,cde=hde,dde=cde,fde=V(dde);function AT(i){var r=vde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function vde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Ne=function(){function i(){N(this,i)}return M(i,null,[{key:"transform",value:function(e,t){he(e)||(e=[e]);for(var n=t.point.x,a=t.point.y,o=t.angle,s=t.length,u=0;u4&&arguments[4]!==void 0?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,t),e.lineWidth=t.width,t.dashes!==!1?this._drawDashedLine(e,t,o):this._drawLine(e,t,o)}},{key:"_drawLine",value:function(e,t,n,a,o){if(this.from!=this.to)this._line(e,t,n,a,o);else{var s=this._getCircleData(e),u=Te(s,3),l=u[0],h=u[1],c=u[2];this._circle(e,t,l,h,c)}}},{key:"_drawDashedLine",value:function(e,t,n,a,o){e.lineCap="round";var s=he(t.dashes)?t.dashes:[5,5];if(e.setLineDash!==void 0){if(e.save(),e.setLineDash(s),e.lineDashOffset=0,this.from!=this.to)this._line(e,t,n);else{var u=this._getCircleData(e),l=Te(u,3),h=l[0],c=l[1],d=l[2];this._circle(e,t,h,c,d)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)XE(e,this.from.x,this.from.y,this.to.x,this.to.y,s);else{var f=this._getCircleData(e),v=Te(f,3),p=v[0],g=v[1],y=v[2];this._circle(e,t,p,g,y)}this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}}},{key:"findBorderPosition",value:function(e,t,n){return this.from!=this.to?this._findBorderPosition(e,t,n):this._findBorderPositionCircle(e,t,n)}},{key:"findBorderPositions",value:function(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};var t,n=it(t=this._getCircleData(e)).call(t,0,2),a=Te(n,2),o=a[0],s=a[1];return{from:this._findBorderPositionCircle(this.from,e,{x:o,y:s,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:o,y:s,low:.6,high:.8,direction:1})}}},{key:"_getCircleData",value:function(e){var t=this.options.selfReference.size;e!==void 0&&this.from.shape.width===void 0&&this.from.shape.resize(e);var n=OT(e,this.options.selfReference.angle,t,this.from);return[n.x,n.y,t]}},{key:"_pointOnCircle",value:function(e,t,n,a){var o=a*2*Math.PI;return{x:e+n*Math.cos(o),y:t-n*Math.sin(o)}}},{key:"_findBorderPositionCircle",value:function(e,t,n){var a=n.x,o=n.y,s=n.low,u=n.high,l=n.direction,h=10,c=this.options.selfReference.size,d=.05,f,v=(s+u)*.5,p=0;this.options.arrowStrikethrough===!0&&(l===-1?p=this.options.endPointOffset.from:l===1&&(p=this.options.endPointOffset.to));var g=0;do{v=(s+u)*.5,f=this._pointOnCircle(a,o,c,v);var y=Math.atan2(e.y-f.y,e.x-f.x),m=e.distanceToBorder(t,y)+p,$=Math.sqrt(Math.pow(f.x-e.x,2)+Math.pow(f.y-e.y,2)),b=m-$;if(Math.abs(b)0?l>0?s=v:u=v:l>0?u=v:s=v,++g}while(s<=u&&g1?c=1:c<0&&(c=0);var d=e+c*u,f=t+c*l,v=d-o,p=f-s;return Math.sqrt(v*v+p*p)}},{key:"getArrowData",value:function(e,t,n,a,o,s){var u,l,h,c,d,f,v,p=s.width;t==="from"?(h=this.from,c=this.to,d=s.fromArrowScale<0,f=Math.abs(s.fromArrowScale),v=s.fromArrowType):t==="to"?(h=this.to,c=this.from,d=s.toArrowScale<0,f=Math.abs(s.toArrowScale),v=s.toArrowType):(h=this.to,c=this.from,d=s.middleArrowScale<0,f=Math.abs(s.middleArrowScale),v=s.middleArrowType);var g=15*f+3*p;if(h!=c){var y=fde(h.x-c.x,h.y-c.y),m=g/y;if(t!=="middle")if(this.options.smooth.enabled===!0){var $=this._findBorderPosition(h,e,{via:n}),b=this.getPoint($.t+m*(t==="from"?1:-1),n);u=Math.atan2($.y-b.y,$.x-b.x),l=$}else u=Math.atan2(h.y-c.y,h.x-c.x),l=this._findBorderPosition(h,e);else{var O=(d?-m:m)/2,_=this.getPoint(.5+O,n),D=this.getPoint(.5-O,n);u=Math.atan2(_.y-D.y,_.x-D.x),l=this.getPoint(.5,n)}}else{var R=this._getCircleData(e),P=Te(R,3),B=P[0],j=P[1],J=P[2];if(t==="from"){var U=this.options.selfReference.angle,ie=this.options.selfReference.angle+Math.PI,_e=this._findBorderPositionCircle(this.from,e,{x:B,y:j,low:U,high:ie,direction:-1});u=_e.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI,l=_e}else if(t==="to"){var ye=this.options.selfReference.angle,Ae=this.options.selfReference.angle+Math.PI,ht=this._findBorderPositionCircle(this.from,e,{x:B,y:j,low:ye,high:Ae,direction:1});u=ht.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI,l=ht}else{var at=this.options.selfReference.angle/(2*Math.PI);l=this._pointOnCircle(B,j,J,at),u=at*-2*Math.PI+1.5*Math.PI+.1*Math.PI}}var Dt=l.x-g*.9*Math.cos(u),ot=l.y-g*.9*Math.sin(u),me={x:Dt,y:ot};return{point:l,core:me,angle:u,length:g,type:v}}},{key:"drawArrowHead",value:function(e,t,n,a,o){e.strokeStyle=this.getColor(e,t),e.fillStyle=e.strokeStyle,e.lineWidth=t.width;var s=DT.draw(e,o);s&&(this.enableShadow(e,t),hs(e).call(e),this.disableShadow(e,t))}},{key:"enableShadow",value:function(e,t){t.shadow===!0&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}},{key:"disableShadow",value:function(e,t){t.shadow===!0&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}},{key:"drawBackground",value:function(e,t){if(t.background!==!1){var n={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),e.strokeStyle=n.strokeStyle,e.lineWidth=n.lineWidth,e.dashes=n.dashes,this.setStrokeDashed(e,t.dashes)}}},{key:"setStrokeDashed",value:function(e,t){if(t!==!1)if(e.setLineDash!==void 0){var n=he(t)?t:[5,5];e.setLineDash(n)}else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");else e.setLineDash!==void 0?e.setLineDash([]):console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.")}}]),i}();function l$(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function h$(i){for(var r=1;r"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var gp=function(i){ue(e,i);var r=Ide(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_findBorderPositionBezier",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this._getViaCoordinates(),s=10,u=.2,l=!1,h=1,c=0,d=this.to,f,v,p=this.options.endPointOffset?this.options.endPointOffset.to:0;n.id===this.from.id&&(d=this.from,l=!0,p=this.options.endPointOffset?this.options.endPointOffset.from:0),this.options.arrowStrikethrough===!1&&(p=0);var g=0;do{v=(c+h)*.5,f=this.getPoint(v,o);var y=Math.atan2(d.y-f.y,d.x-f.x),m=d.distanceToBorder(a,y)+p,$=Math.sqrt(Math.pow(f.x-d.x,2)+Math.pow(f.y-d.y,2)),b=m-$;if(Math.abs(b)0&&(d=this._getDistanceToLine(y,m,p,g,u,l),c=d"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var c$=function(i){ue(e,i);var r=Pde(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o.via=o.via,o._boundFunction=function(){o.positionBezierNode()},o._body.emitter.on("_repositionBezierNodes",o._boundFunction),o}return M(e,[{key:"setOptions",value:function(n){_u(L(e.prototype),"setOptions",this).call(this,n);var a=!1;this.options.physics!==n.physics&&(a=!0),this.options=n,this.id=this.options.id,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.setupSupportNode(),this.connect(),a===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}},{key:"connect",value:function(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.from===void 0||this.to===void 0||this.options.physics===!1?this.via.setOptions({physics:!1}):this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}},{key:"cleanup",value:function(){return this._body.emitter.off("_repositionBezierNodes",this._boundFunction),this.via!==void 0?(delete this._body.nodes[this.via.id],this.via=void 0,!0):!1}},{key:"setupSupportNode",value:function(){if(this.via===void 0){var n="edgeId:"+this.id,a=this._body.functions.createNode({id:n,shape:"circle",physics:!0,hidden:!0});this._body.nodes[n]=a,this.via=a,this.via.parentEdgeId=this.id,this.positionBezierNode()}}},{key:"positionBezierNode",value:function(){this.via!==void 0&&this.from!==void 0&&this.to!==void 0?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):this.via!==void 0&&(this.via.x=0,this.via.y=0)}},{key:"_line",value:function(n,a,o){this._bezierCurve(n,a,o)}},{key:"_getViaCoordinates",value:function(){return this.via}},{key:"getViaNode",value:function(){return this.via}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.via;if(this.from===this.to){var o=this._getCircleData(),s=Te(o,3),u=s[0],l=s[1],h=s[2],c=2*Math.PI*(1-n);return{x:u+h*Math.sin(c),y:l+h-h*(1-Math.cos(c))}}else return{x:Math.pow(1-n,2)*this.fromPoint.x+2*n*(1-n)*a.x+Math.pow(n,2)*this.toPoint.x,y:Math.pow(1-n,2)*this.fromPoint.y+2*n*(1-n)*a.y+Math.pow(n,2)*this.toPoint.y}}},{key:"_findBorderPosition",value:function(n,a){return this._findBorderPositionBezier(n,a,this.via)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){return this._getDistanceToBezierEdge(n,a,o,s,u,l,this.via)}}]),e}(gp);function Cde(i){var r=Ade();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Ade(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var d$=function(i){ue(e,i);var r=Cde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a,o){this._bezierCurve(n,a,o)}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_getViaCoordinates",value:function(){var n=this.options.smooth.roundness,a=this.options.smooth.type,o=Math.abs(this.from.x-this.to.x),s=Math.abs(this.from.y-this.to.y);if(a==="discrete"||a==="diagonalCross"){var u,l;o<=s?u=l=n*s:u=l=n*o,this.from.x>this.to.x&&(u=-u),this.from.y>=this.to.y&&(l=-l);var h=this.from.x+u,c=this.from.y+l;return a==="discrete"&&(o<=s?h=othis.to.x&&(R=-R),this.from.y>=this.to.y&&(P=-P);var B=this.from.x+R,j=this.from.y+P;return o<=s?this.from.x<=this.to.x?B=this.to.xB?this.to.x:B:this.from.y>=this.to.y?j=this.to.y>j?this.to.y:j:j=this.to.y2&&arguments[2]!==void 0?arguments[2]:{};return this._findBorderPositionBezier(n,a,o.via)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){var h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(n,a,o,s,u,l,h)}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),o=n,s=Math.pow(1-o,2)*this.fromPoint.x+2*o*(1-o)*a.x+Math.pow(o,2)*this.toPoint.x,u=Math.pow(1-o,2)*this.fromPoint.y+2*o*(1-o)*a.y+Math.pow(o,2)*this.toPoint.y;return{x:s,y:u}}}]),e}(gp);function Dde(i){var r=Rde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Rde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Nde=function(i){ue(e,i);var r=Dde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_getDistanceToBezierEdge2",value:function(n,a,o,s,u,l,h,c){for(var d=1e9,f=n,v=a,p=[0,0,0,0],g=1;g<10;g++){var y=.1*g;p[0]=Math.pow(1-y,3),p[1]=3*y*Math.pow(1-y,2),p[2]=3*Math.pow(y,2)*(1-y),p[3]=Math.pow(y,3);var m=p[0]*n+p[1]*h.x+p[2]*c.x+p[3]*o,$=p[0]*a+p[1]*h.y+p[2]*c.y+p[3]*s;if(g>0){var b=this._getDistanceToLine(f,v,m,$,u,l);d=b"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var f$=function(i){ue(e,i);var r=Mde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a,o){var s=o[0],u=o[1];this._bezierCurve(n,a,s,u)}},{key:"_getViaCoordinates",value:function(){var n=this.from.x-this.to.x,a=this.from.y-this.to.y,o,s,u,l,h=this.options.smooth.roundness;return(Math.abs(n)>Math.abs(a)||this.options.smooth.forceDirection===!0||this.options.smooth.forceDirection==="horizontal")&&this.options.smooth.forceDirection!=="vertical"?(s=this.from.y,l=this.to.y,o=this.from.x-h*n,u=this.to.x+h*n):(s=this.from.y-h*a,l=this.to.y+h*a,o=this.from.x,u=this.to.x),[{x:o,y:s},{x:u,y:l}]}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_findBorderPosition",value:function(n,a){return this._findBorderPositionBezier(n,a)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){var h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates(),c=Te(h,2),d=c[0],f=c[1];return this._getDistanceToBezierEdge2(n,a,o,s,u,l,d,f)}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),o=Te(a,2),s=o[0],u=o[1],l=n,h=[Math.pow(1-l,3),3*l*Math.pow(1-l,2),3*Math.pow(l,2)*(1-l),Math.pow(l,3)],c=h[0]*this.fromPoint.x+h[1]*s.x+h[2]*u.x+h[3]*this.toPoint.x,d=h[0]*this.fromPoint.y+h[1]*s.y+h[2]*u.y+h[3]*this.toPoint.y;return{x:c,y:d}}}]),e}(Nde);function Fde(i){var r=jde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function jde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var v$=function(i){ue(e,i);var r=Fde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a){n.beginPath(),n.moveTo(this.fromPoint.x,this.fromPoint.y),n.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(n,a),n.stroke(),this.disableShadow(n,a)}},{key:"getViaNode",value:function(){}},{key:"getPoint",value:function(n){return{x:(1-n)*this.fromPoint.x+n*this.toPoint.x,y:(1-n)*this.fromPoint.y+n*this.toPoint.y}}},{key:"_findBorderPosition",value:function(n,a){var o=this.to,s=this.from;n.id===this.from.id&&(o=this.from,s=this.to);var u=Math.atan2(o.y-s.y,o.x-s.x),l=o.x-s.x,h=o.y-s.y,c=Math.sqrt(l*l+h*h),d=n.distanceToBorder(a,u),f=(c-d)/c;return{x:(1-f)*s.x+f*o.x,y:(1-f)*s.y+f*o.y,t:0}}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){return this._getDistanceToLine(n,a,o,s,u,l)}}]),e}(RT),qn=function(){function i(r,e,t,n,a){if(N(this,i),e===void 0)throw new Error("No body provided");this.options=di(n),this.globalOptions=n,this.defaultOptions=a,this.body=e,this.imagelist=t,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new IT(this.body,this.options,!0),this.setOptions(r)}return M(i,[{key:"setOptions",value:function(e){if(e){var t=typeof e.physics<"u"&&this.options.physics!==e.physics||typeof e.hidden<"u"&&(this.options.hidden||!1)!==(e.hidden||!1)||typeof e.from<"u"&&this.options.from!==e.from||typeof e.to<"u"&&this.options.to!==e.to;i.parseOptions(this.options,e,!0,this.globalOptions),e.id!==void 0&&(this.id=e.id),e.from!==void 0&&(this.fromId=e.from),e.to!==void 0&&(this.toId=e.to),e.title!==void 0&&(this.title=e.title),e.value!==void 0&&(e.value=ST(e.value));var n=[e,this.options,this.defaultOptions];return this.chooser=dp("edge",n),this.updateLabelModule(e),t=this.updateEdgeType()||t,this._setInteractionWidths(),this.connect(),t}}},{key:"getFormattingValues",value:function(){var e=this.options.arrows.to===!0||this.options.arrows.to.enabled===!0,t=this.options.arrows.from===!0||this.options.arrows.from.enabled===!0,n=this.options.arrows.middle===!0||this.options.arrows.middle.enabled===!0,a=this.options.color.inherit,o={toArrow:e,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,toArrowSrc:this.options.arrows.to.src,toArrowImageWidth:this.options.arrows.to.imageWidth,toArrowImageHeight:this.options.arrows.to.imageHeight,middleArrow:n,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,middleArrowSrc:this.options.arrows.middle.src,middleArrowImageWidth:this.options.arrows.middle.imageWidth,middleArrowImageHeight:this.options.arrows.middle.imageHeight,fromArrow:t,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,fromArrowSrc:this.options.arrows.from.src,fromArrowImageWidth:this.options.arrows.from.imageWidth,fromArrowImageHeight:this.options.arrows.from.imageHeight,arrowStrikethrough:this.options.arrowStrikethrough,color:a?void 0:this.options.color.color,inheritsColor:a,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width,background:this.options.background.enabled,backgroundColor:this.options.background.color,backgroundSize:this.options.background.size,backgroundDashes:this.options.background.dashes};if(this.selected||this.hover)if(this.chooser===!0){if(this.selected){var s=this.options.selectionWidth;typeof s=="function"?o.width=s(o.width):typeof s=="number"&&(o.width+=s),o.width=Math.max(o.width,.3/this.body.view.scale),o.color=this.options.color.highlight,o.shadow=this.options.shadow.enabled}else if(this.hover){var u=this.options.hoverWidth;typeof u=="function"?o.width=u(o.width):typeof u=="number"&&(o.width+=u),o.width=Math.max(o.width,.3/this.body.view.scale),o.color=this.options.color.hover,o.shadow=this.options.shadow.enabled}}else typeof this.chooser=="function"&&(this.chooser(o,this.options.id,this.selected,this.hover),o.color!==void 0&&(o.inheritsColor=!1),o.shadow===!1&&(o.shadowColor!==this.options.shadow.color||o.shadowSize!==this.options.shadow.size||o.shadowX!==this.options.shadow.x||o.shadowY!==this.options.shadow.y)&&(o.shadow=!0));else o.shadow=this.options.shadow.enabled,o.width=Math.max(o.width,.3/this.body.view.scale);return o}},{key:"updateLabelModule",value:function(e){var t=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,t),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}},{key:"updateEdgeType",value:function(){var e=this.options.smooth,t=!1,n=!0;return this.edgeType!==void 0&&((this.edgeType instanceof c$&&e.enabled===!0&&e.type==="dynamic"||this.edgeType instanceof f$&&e.enabled===!0&&e.type==="cubicBezier"||this.edgeType instanceof d$&&e.enabled===!0&&e.type!=="dynamic"&&e.type!=="cubicBezier"||this.edgeType instanceof v$&&e.type.enabled===!1)&&(n=!1),n===!0&&(t=this.cleanup())),n===!0?e.enabled===!0?e.type==="dynamic"?(t=!0,this.edgeType=new c$(this.options,this.body,this.labelModule)):e.type==="cubicBezier"?this.edgeType=new f$(this.options,this.body,this.labelModule):this.edgeType=new d$(this.options,this.body,this.labelModule):this.edgeType=new v$(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),t}},{key:"connect",value:function(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=this.from!==void 0&&this.to!==void 0,this.connected===!0?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}},{key:"disconnect",value:function(){this.from&&(this.from.detachEdge(this),this.from=void 0),this.to&&(this.to.detachEdge(this),this.to=void 0),this.connected=!1}},{key:"getTitle",value:function(){return this.title}},{key:"isSelected",value:function(){return this.selected}},{key:"getValue",value:function(){return this.options.value}},{key:"setValueRange",value:function(e,t,n){if(this.options.value!==void 0){var a=this.options.scaling.customScalingFunction(e,t,n,this.options.value),o=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){var s=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+a*s}this.options.width=this.options.scaling.min+a*o}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}},{key:"_setInteractionWidths",value:function(){typeof this.options.hoverWidth=="function"?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,typeof this.options.selectionWidth=="function"?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}},{key:"draw",value:function(e){var t=this.getFormattingValues();if(!t.hidden){var n=this.edgeType.getViaNode();this.edgeType.drawLine(e,t,this.selected,this.hover,n),this.drawLabel(e,n)}}},{key:"drawArrows",value:function(e){var t=this.getFormattingValues();if(!t.hidden){var n=this.edgeType.getViaNode(),a={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,t.fromArrow&&(a.from=this.edgeType.getArrowData(e,"from",n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.fromPoint=a.from.core),t.fromArrowSrc&&(a.from.image=this.imagelist.load(t.fromArrowSrc)),t.fromArrowImageWidth&&(a.from.imageWidth=t.fromArrowImageWidth),t.fromArrowImageHeight&&(a.from.imageHeight=t.fromArrowImageHeight)),t.toArrow&&(a.to=this.edgeType.getArrowData(e,"to",n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.toPoint=a.to.core),t.toArrowSrc&&(a.to.image=this.imagelist.load(t.toArrowSrc)),t.toArrowImageWidth&&(a.to.imageWidth=t.toArrowImageWidth),t.toArrowImageHeight&&(a.to.imageHeight=t.toArrowImageHeight)),t.middleArrow&&(a.middle=this.edgeType.getArrowData(e,"middle",n,this.selected,this.hover,t),t.middleArrowSrc&&(a.middle.image=this.imagelist.load(t.middleArrowSrc)),t.middleArrowImageWidth&&(a.middle.imageWidth=t.middleArrowImageWidth),t.middleArrowImageHeight&&(a.middle.imageHeight=t.middleArrowImageHeight)),t.fromArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.from),t.middleArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.middle),t.toArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.to)}}},{key:"drawLabel",value:function(e,t){if(this.options.label!==void 0){var n=this.from,a=this.to;this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover);var o;if(n.id!=a.id){this.labelModule.pointToSelf=!1,o=this.edgeType.getPoint(.5,t),e.save();var s=this._getRotation(e);s.angle!=0&&(e.translate(s.x,s.y),e.rotate(s.angle)),this.labelModule.draw(e,o.x,o.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;var u=OT(e,this.options.selfReference.angle,this.options.selfReference.size,n);o=this._pointOnCircle(u.x,u.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(e,o.x,o.y,this.selected,this.hover)}}}},{key:"getItemsOnPoint",value:function(e){var t=[];if(this.labelModule.visible()){var n=this._getRotation();Af(this.labelModule.getSize(),e,n)&&t.push({edgeId:this.id,labelId:0})}var a={left:e.x,top:e.y};return this.isOverlappingWith(a)&&t.push({edgeId:this.id}),t}},{key:"isOverlappingWith",value:function(e){if(this.connected){var t=10,n=this.from.x,a=this.from.y,o=this.to.x,s=this.to.y,u=e.left,l=e.top,h=this.edgeType.getDistanceToEdge(n,a,o,s,u,l);return h0&&s<0)&&(u+=Math.PI),a.angle=u,a}},{key:"_pointOnCircle",value:function(e,t,n,a){return{x:e+n*Math.cos(a),y:t-n*Math.sin(a)}}},{key:"select",value:function(){this.selected=!0}},{key:"unselect",value:function(){this.selected=!1}},{key:"cleanup",value:function(){return this.edgeType.cleanup()}},{key:"remove",value:function(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}},{key:"endPointsValid",value:function(){return this.body.nodes[this.fromId]!==void 0&&this.body.nodes[this.toId]!==void 0}}],[{key:"parseOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,s=["endPointOffset","arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","selfReference","to","title","value","width","font","chosen","widthConstraint"];if(Ma(s,e,t,n),t.endPointOffset!==void 0&&t.endPointOffset.from!==void 0&&(Di(t.endPointOffset.from)?e.endPointOffset.from=t.endPointOffset.from:(e.endPointOffset.from=a.endPointOffset.from!==void 0?a.endPointOffset.from:0,console.error("endPointOffset.from is not a valid number"))),t.endPointOffset!==void 0&&t.endPointOffset.to!==void 0&&(Di(t.endPointOffset.to)?e.endPointOffset.to=t.endPointOffset.to:(e.endPointOffset.to=a.endPointOffset.to!==void 0?a.endPointOffset.to:0,console.error("endPointOffset.to is not a valid number"))),Zu(t.label)?e.label=t.label:Zu(e.label)||(e.label=void 0),Ut(e,t,"smooth",a),Ut(e,t,"shadow",a),Ut(e,t,"background",a),t.dashes!==void 0&&t.dashes!==null?e.dashes=t.dashes:n===!0&&t.dashes===null&&(e.dashes=zi(a.dashes)),t.scaling!==void 0&&t.scaling!==null?(t.scaling.min!==void 0&&(e.scaling.min=t.scaling.min),t.scaling.max!==void 0&&(e.scaling.max=t.scaling.max),Ut(e.scaling,t.scaling,"label",a.scaling)):n===!0&&t.scaling===null&&(e.scaling=zi(a.scaling)),t.arrows!==void 0&&t.arrows!==null)if(typeof t.arrows=="string"){var u=t.arrows.toLowerCase();e.arrows.to.enabled=ne(u).call(u,"to")!=-1,e.arrows.middle.enabled=ne(u).call(u,"middle")!=-1,e.arrows.from.enabled=ne(u).call(u,"from")!=-1}else if(de(t.arrows)==="object")Ut(e.arrows,t.arrows,"to",a.arrows),Ut(e.arrows,t.arrows,"middle",a.arrows),Ut(e.arrows,t.arrows,"from",a.arrows);else throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+ls(t.arrows));else n===!0&&t.arrows===null&&(e.arrows=zi(a.arrows));if(t.color!==void 0&&t.color!==null){var l=Kn(t.color)?{color:t.color,highlight:t.color,hover:t.color,inherit:!1,opacity:1}:t.color,h=e.color;if(o)pe(h,a.color,!1,n);else for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&delete h[c];if(Kn(h))h.color=h,h.highlight=h,h.hover=h,h.inherit=!1,l.opacity===void 0&&(h.opacity=1);else{var d=!1;l.color!==void 0&&(h.color=l.color,d=!0),l.highlight!==void 0&&(h.highlight=l.highlight,d=!0),l.hover!==void 0&&(h.hover=l.hover,d=!0),l.inherit!==void 0&&(h.inherit=l.inherit),l.opacity!==void 0&&(h.opacity=Math.min(1,Math.max(0,l.opacity))),d===!0?h.inherit=!1:h.inherit===void 0&&(h.inherit="from")}}else n===!0&&t.color===null&&(e.color=di(a.color));n===!0&&t.font===null&&(e.font=di(a.font)),Object.prototype.hasOwnProperty.call(t,"selfReferenceSize")&&(console.warn("The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}"),e.selfReference.size=t.selfReferenceSize)}}]),i}(),Lde=function(){function i(r,e,t){var n,a=this;N(this,i),this.body=r,this.images=e,this.groups=t,this.body.functions.createEdge=k(n=this.create).call(n,this),this.edgesListeners={add:function(s,u){a.add(u.items)},update:function(s,u){a.update(u.items)},remove:function(s,u){a.remove(u.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},endPointOffset:{from:0,to:0},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(s,u,l,h){if(u===s)return .5;var c=1/(u-s);return Math.max(0,(h-s)*c)}},selectionWidth:1.5,selfReference:{size:20,angle:Math.PI/4,renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},background:{enabled:!1,color:"rgba(111,111,111,1)",size:10,dashes:!1},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},pe(this.options,this.defaultOptions),this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this,t,n;this.body.emitter.on("_forceDisableDynamicCurves",function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a==="dynamic"&&(a="continuous");var s=!1;for(var u in e.body.edges)if(Object.prototype.hasOwnProperty.call(e.body.edges,u)){var l=e.body.edges[u],h=e.body.data.edges.get(u);if(h!=null){var c=h.smooth;c!==void 0&&c.enabled===!0&&c.type==="dynamic"&&(a===void 0?l.setOptions({smooth:!1}):l.setOptions({smooth:{type:a}}),s=!0)}}o===!0&&s===!0&&e.body.emitter.emit("_dataChanged")}),this.body.emitter.on("_dataUpdated",function(){e.reconnectEdges()}),this.body.emitter.on("refreshEdges",k(t=this.refresh).call(t,this)),this.body.emitter.on("refresh",k(n=this.refresh).call(n,this)),this.body.emitter.on("destroy",function(){te(e.edgesListeners,function(a,o){e.body.data.edges&&e.body.data.edges.off(o,a)}),delete e.body.functions.createEdge,delete e.edgesListeners.add,delete e.edgesListeners.update,delete e.edgesListeners.remove,delete e.edgesListeners})}},{key:"setOptions",value:function(e){if(e!==void 0){qn.parseOptions(this.options,e,!0,this.defaultOptions,!0);var t=!1;if(e.smooth!==void 0)for(var n in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,n)&&(t=this.body.edges[n].updateEdgeType()||t);if(e.font!==void 0)for(var a in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,a)&&this.body.edges[a].updateLabelModule();(e.hidden!==void 0||e.physics!==void 0||t===!0)&&this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.body.data.edges;if(IE("id",e))this.body.data.edges=e;else if(he(e))this.body.data.edges=new Lu,this.body.data.edges.add(e);else if(!e)this.body.data.edges=new Lu;else throw new TypeError("Array or DataSet expected");if(a&&te(this.edgesListeners,function(s,u){a.off(u,s)}),this.body.edges={},this.body.data.edges){te(this.edgesListeners,function(s,u){t.body.data.edges.on(u,s)});var o=this.body.data.edges.getIds();this.add(o,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),n===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.edges,a=this.body.data.edges,o=0;o1&&arguments[1]!==void 0?arguments[1]:!0;if(e.length!==0){var n=this.body.edges;te(e,function(a){var o=n[a];o!==void 0&&o.remove()}),t&&this.body.emitter.emit("_dataChanged")}}},{key:"refresh",value:function(){var e=this;te(this.body.edges,function(t,n){var a=e.body.data.edges.get(n);a!==void 0&&t.setOptions(a)})}},{key:"create",value:function(e){return new qn(e,this.body,this.images,this.options,this.defaultOptions)}},{key:"reconnectEdges",value:function(){var e,t=this.body.nodes,n=this.body.edges;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e].edges=[]);for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)){var a=n[e];a.from=null,a.to=null,a.connect()}}},{key:"getConnectedNodes",value:function(e){var t=[];if(this.body.edges[e]!==void 0){var n=this.body.edges[e];n.fromId!==void 0&&t.push(n.fromId),n.toId!==void 0&&t.push(n.toId)}return t}},{key:"_updateState",value:function(){this._addMissingEdges(),this._removeInvalidEdges()}},{key:"_removeInvalidEdges",value:function(){var e=this,t=[];te(this.body.edges,function(n,a){var o=e.body.nodes[n.toId],s=e.body.nodes[n.fromId];o!==void 0&&o.isCluster===!0||s!==void 0&&s.isCluster===!0||(o===void 0||s===void 0)&&t.push(a)}),this.remove(t,!1)}},{key:"_addMissingEdges",value:function(){var e=this.body.data.edges;if(e!=null){var t=this.body.edges,n=[];fe(e).call(e,function(a,o){var s=t[o];s===void 0&&n.push(o)}),this.add(n,!0)}}}]),i}(),NT=function(){function i(r,e,t){N(this,i),this.body=r,this.physicsBody=e,this.barnesHutTree,this.setOptions(t),this._rng=Ql("BARNES HUT SOLVER")}return M(i,[{key:"setOptions",value:function(e){this.options=e,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}},{key:"solve",value:function(){if(this.options.gravitationalConstant!==0&&this.physicsBody.physicsNodeIndices.length>0){var e,t=this.body.nodes,n=this.physicsBody.physicsNodeIndices,a=n.length,o=this._formBarnesHutTree(t,n);this.barnesHutTree=o;for(var s=0;s0&&this._getForceContributions(o.root,e)}}},{key:"_getForceContributions",value:function(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}},{key:"_getForceContribution",value:function(e,t){if(e.childrenCount>0){var n=e.centerOfMass.x-t.x,a=e.centerOfMass.y-t.y,o=Math.sqrt(n*n+a*a);o*e.calcSize>this.thetaInversed?this._calculateForces(o,n,a,t,e):e.childrenCount===4?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(o,n,a,t,e)}}},{key:"_calculateForces",value:function(e,t,n,a,o){e===0&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&a.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*a.shape.radius,e-a.shape.radius));var s=this.options.gravitationalConstant*o.mass*a.options.mass/Math.pow(e,3),u=t*s,l=n*s;this.physicsBody.forces[a.id].x+=u,this.physicsBody.forces[a.id].y+=l}},{key:"_formBarnesHutTree",value:function(e,t){for(var n,a=t.length,o=e[t[0]].x,s=e[t[0]].y,u=e[t[0]].x,l=e[t[0]].y,h=1;h0&&(du&&(u=d),fl&&(l=f))}var v=Math.abs(u-o)-Math.abs(l-s);v>0?(s-=.5*v,l+=.5*v):(o+=.5*v,u-=.5*v);var p=1e-5,g=Math.max(p,Math.abs(u-o)),y=.5*g,m=.5*(o+u),$=.5*(s+l),b={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:m-y,maxX:m+y,minY:$-y,maxY:$+y},size:g,calcSize:1/g,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(b.root);for(var O=0;O0&&this._placeInTree(b.root,n);return b}},{key:"_updateBranchMass",value:function(e,t){var n=e.centerOfMass,a=e.mass+t.options.mass,o=1/a;n.x=n.x*e.mass+t.x*t.options.mass,n.x*=o,n.y=n.y*e.mass+t.y*t.options.mass,n.y*=o,e.mass=a;var s=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidtht.x?a.maxY>t.y?o="NW":o="SW":a.maxY>t.y?o="NE":o="SE",this._placeInRegion(e,t,o)}},{key:"_placeInRegion",value:function(e,t,n){var a=e.children[n];switch(a.childrenCount){case 0:a.children.data=t,a.childrenCount=1,this._updateBranchMass(a,t);break;case 1:a.children.data.x===t.x&&a.children.data.y===t.y?(t.x+=this._rng(),t.y+=this._rng()):(this._splitBranch(a),this._placeInTree(a,t));break;case 4:this._placeInTree(a,t);break}}},{key:"_splitBranch",value:function(e){var t=null;e.childrenCount===1&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),t!=null&&this._placeInTree(e,t)}},{key:"_insertRegion",value:function(e,t){var n,a,o,s,u=.5*e.size;switch(t){case"NW":n=e.range.minX,a=e.range.minX+u,o=e.range.minY,s=e.range.minY+u;break;case"NE":n=e.range.minX+u,a=e.range.maxX,o=e.range.minY,s=e.range.minY+u;break;case"SW":n=e.range.minX,a=e.range.minX+u,o=e.range.minY+u,s=e.range.maxY;break;case"SE":n=e.range.minX+u,a=e.range.maxX,o=e.range.minY+u,s=e.range.maxY;break}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:n,maxX:a,minY:o,maxY:s},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}},{key:"_debug",value:function(e,t){this.barnesHutTree!==void 0&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}},{key:"_drawBranch",value:function(e,t,n){n===void 0&&(n="#FF0000"),e.childrenCount===4&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=n,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}]),i}(),zde=function(){function i(r,e,t){N(this,i),this._rng=Ql("REPULSION SOLVER"),this.body=r,this.physicsBody=e,this.setOptions(t)}return M(i,[{key:"setOptions",value:function(e){this.options=e}},{key:"solve",value:function(){for(var e,t,n,a,o,s,u,l,h=this.body.nodes,c=this.physicsBody.physicsNodeIndices,d=this.physicsBody.forces,f=this.options.nodeDistance,v=-2/3/f,p=4/3,g=0;g"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Kde=function(i){ue(e,i);var r=Wde(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._rng=Ql("FORCE ATLAS 2 BASED REPULSION SOLVER"),o}return M(e,[{key:"_calculateForces",value:function(n,a,o,s,u){n===0&&(n=.1*this._rng(),a=n),this.overlapAvoidanceFactor<1&&s.shape.radius&&(n=Math.max(.1+this.overlapAvoidanceFactor*s.shape.radius,n-s.shape.radius));var l=s.edges.length+1,h=this.options.gravitationalConstant*u.mass*s.options.mass*l/Math.pow(n,2),c=a*h,d=o*h;this.physicsBody.forces[s.id].x+=c,this.physicsBody.forces[s.id].y+=d}}]),e}(NT);function Gde(i){var r=qde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function qde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Yde=function(i){ue(e,i);var r=Gde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_calculateForces",value:function(n,a,o,s,u){if(n>0){var l=u.edges.length+1,h=this.options.centralGravity*l*u.options.mass;s[u.id].x=a*h,s[u.id].y=o*h}}}]),e}(Eu),Xde=function(){function i(r){N(this,i),this.body=r,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},Le(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("initPhysics",function(){e.initPhysics()}),this.body.emitter.on("_layoutFailed",function(){e.layoutFailed=!0}),this.body.emitter.on("resetPhysics",function(){e.stopSimulation(),e.ready=!1}),this.body.emitter.on("disablePhysics",function(){e.physicsEnabled=!1,e.stopSimulation()}),this.body.emitter.on("restorePhysics",function(){e.setOptions(e.options),e.ready===!0&&e.startSimulation()}),this.body.emitter.on("startSimulation",function(){e.ready===!0&&e.startSimulation()}),this.body.emitter.on("stopSimulation",function(){e.stopSimulation()}),this.body.emitter.on("destroy",function(){e.stopSimulation(!1),e.body.emitter.off()}),this.body.emitter.on("_dataChanged",function(){e.updatePhysicsData()})}},{key:"setOptions",value:function(e){if(e!==void 0)if(e===!1)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(e===!0)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,Yu(["stabilization"],this.options,e),Ut(this.options,e,"stabilization"),e.enabled===void 0&&(this.options.enabled=!0),this.options.enabled===!1&&(this.physicsEnabled=!1,this.stopSimulation());var t=this.options.wind;t&&((typeof t.x!="number"||Cf(t.x))&&(t.x=0),(typeof t.y!="number"||Cf(t.y))&&(t.y=0)),this.timestep=this.options.timestep}this.init()}},{key:"init",value:function(){var e;this.options.solver==="forceAtlas2Based"?(e=this.options.forceAtlas2Based,this.nodesSolver=new Kde(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Yde(this.body,this.physicsBody,e)):this.options.solver==="repulsion"?(e=this.options.repulsion,this.nodesSolver=new zde(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)):this.options.solver==="hierarchicalRepulsion"?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new Hde(this.body,this.physicsBody,e),this.edgesSolver=new Vde(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new NT(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)),this.modelOptions=e}},{key:"initPhysics",value:function(){this.physicsEnabled===!0&&this.options.enabled===!0?this.options.stabilization.enabled===!0?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}},{key:"startSimulation",value:function(){if(this.physicsEnabled===!0&&this.options.enabled===!0){if(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),this.viewFunction===void 0){var e;this.viewFunction=k(e=this.simulationStep).call(e,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}else this.body.emitter.emit("_redraw")}},{key:"stopSimulation",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.stabilized=!0,e===!0&&this._emitStabilized(),this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,e===!0&&this.body.emitter.emit("_stopRendering"))}},{key:"simulationStep",value:function(){var e=Uu();this.physicsTick();var t=Uu()-e;(t<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}},{key:"_emitStabilized",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&mr(function(){e.body.emitter.emit("stabilized",{iterations:t}),e.startedStabilization=!1,e.stabilizationIterations=0},0)}},{key:"physicsStep",value:function(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}},{key:"adjustTimeStep",value:function(){var e=1.2;this._evaluateStepQuality()===!0?this.timestep=e*this.timestep:this.timestep/es))return!1;return!0}},{key:"moveNodes",value:function(){for(var e=this.physicsBody.physicsNodeIndices,t=0,n=0,a=5,o=0;os&&(e=e>0?s:-s),e}},{key:"_performStep",value:function(e){var t=this.body.nodes[e],n=this.physicsBody.forces[e];this.options.wind&&(n.x+=this.options.wind.x,n.y+=this.options.wind.y);var a=this.physicsBody.velocities[e];this.previousStates[e]={x:t.x,y:t.y,vx:a.x,vy:a.y},t.options.fixed.x===!1?(a.x=this.calculateComponentVelocity(a.x,n.x,t.options.mass),t.x+=a.x*this.timestep):(n.x=0,a.x=0),t.options.fixed.y===!1?(a.y=this.calculateComponentVelocity(a.y,n.y,t.options.mass),t.y+=a.y*this.timestep):(n.y=0,a.y=0);var o=Math.sqrt(Math.pow(a.x,2)+Math.pow(a.y,2));return o}},{key:"_freezeNodes",value:function(){var e=this.body.nodes;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].x&&e[t].y){var n=e[t].options.fixed;this.freezeCache[t]={x:n.x,y:n.y},n.x=!0,n.y=!0}}},{key:"_restoreFrozenNodes",value:function(){var e=this.body.nodes;for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.freezeCache[t]!==void 0&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}},{key:"stabilize",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.stabilization.iterations;if(typeof t!="number"&&(t=this.options.stabilization.iterations,console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ",t)),this.physicsBody.physicsNodeIndices.length===0){this.ready=!0;return}this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=t,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,mr(function(){return e._stabilizationBatch()},0)}},{key:"_startStabilizing",value:function(){return this.startedStabilization===!0?!1:(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}},{key:"_stabilizationBatch",value:function(){var e=this,t=function(){return e.stabilized===!1&&e.stabilizationIterations1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,a=-1e9,o=1e9,s=-1e9,u;if(t.length>0)for(var l=0;lu.shape.boundingBox.left&&(o=u.shape.boundingBox.left),su.shape.boundingBox.top&&(n=u.shape.boundingBox.top),a1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,a=-1e9,o=1e9,s=-1e9,u;if(t.length>0)for(var l=0;lu.x&&(o=u.x),su.y&&(n=u.y),a"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var ife=function(i){ue(e,i);var r=tfe(e);function e(t,n,a,o,s,u){var l;return N(this,e),l=r.call(this,t,n,a,o,s,u),l.isCluster=!0,l.containedNodes={},l.containedEdges={},l}return M(e,[{key:"_openChildCluster",value:function(n){var a=this,o=this.body.nodes[n];if(this.containedNodes[n]===void 0)throw new Error("node with id: "+n+" not in current cluster");if(!o.isCluster)throw new Error("node with id: "+n+" is not a cluster");delete this.containedNodes[n],te(o.edges,function(s){delete a.containedEdges[s.id]}),te(o.containedNodes,function(s,u){a.containedNodes[u]=s}),o.containedNodes={},te(o.containedEdges,function(s,u){a.containedEdges[u]=s}),o.containedEdges={},te(o.edges,function(s){te(a.edges,function(u){var l,h,c=ne(l=u.clusteringEdgeReplacingIds).call(l,s.id);c!==-1&&(te(s.clusteringEdgeReplacingIds,function(d){u.clusteringEdgeReplacingIds.push(d),a.body.edges[d].edgeReplacedById=u.id}),Ar(h=u.clusteringEdgeReplacingIds).call(h,c,1))})}),o.edges=[]}}]),e}(Nt),nfe=function(){function i(r){var e=this;N(this,i),this.body=r,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},Le(this.options,this.defaultOptions),this.body.emitter.on("_resetData",function(){e.clusteredNodes={},e.clusteredEdges={}})}return M(i,[{key:"clusterByHubsize",value:function(e,t){e===void 0?e=this._getHubSize():de(e)==="object"&&(t=this._checkOptions(e),e=this._getHubSize());for(var n=[],a=0;a=e&&n.push(o.id)}for(var s=0;s0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.joinCondition===void 0)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");t=this._checkOptions(t);var a={},o={};te(this.body.nodes,function(s,u){s.options&&t.joinCondition(s.options)===!0&&(a[u]=s,te(s.edges,function(l){e.clusteredEdges[l.id]===void 0&&(o[l.id]=l)}))}),this._cluster(a,o,t,n)}},{key:"clusterByEdgeCount",value:function(e,t){var n=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;t=this._checkOptions(t);for(var o=[],s={},u,l,h,c=function(){var p={},g={},y=n.body.nodeIndices[d],m=n.body.nodes[y];if(s[y]===void 0){h=0,l=[];for(var $=0;$0&&Oe(g).length>0&&O===!0){var R=function(){for(var U=0;U1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(1,e,t)}},{key:"clusterBridges",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(2,e,t)}},{key:"clusterByConnection",value:function(e,t){var n,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No nodeId supplied to clusterByConnection!");if(this.body.nodes[e]===void 0)throw new Error("The nodeId given to clusterByConnection does not exist!");var o=this.body.nodes[e];t=this._checkOptions(t,o),t.clusterNodeProperties.x===void 0&&(t.clusterNodeProperties.x=o.x),t.clusterNodeProperties.y===void 0&&(t.clusterNodeProperties.y=o.y),t.clusterNodeProperties.fixed===void 0&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=o.options.fixed.x,t.clusterNodeProperties.fixed.y=o.options.fixed.y);var s={},u={},l=o.id,h=pt.cloneOptions(o);s[l]=o;for(var c=0;c-1&&(u[$.id]=$)}this._cluster(s,u,t,a)}},{key:"_createClusterEdges",value:function(e,t,n,a){for(var o,s,u,l,h,c,d=Oe(e),f=[],v=0;v0&&arguments[0]!==void 0?arguments[0]:{};return e.clusterEdgeProperties===void 0&&(e.clusterEdgeProperties={}),e.clusterNodeProperties===void 0&&(e.clusterNodeProperties={}),e}},{key:"_cluster",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&this.clusteredNodes[s]!==void 0&&o.push(s);for(var u=0;ua?u.x:a,o=u.ys?u.y:s;return{x:.5*(n+a),y:.5*(o+s)}}},{key:"openCluster",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No clusterNodeId supplied to openCluster.");var a=this.body.nodes[e];if(a===void 0)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(a.isCluster!==!0||a.containedNodes===void 0||a.containedEdges===void 0)throw new Error("The node:"+e+" is not a valid cluster.");var o=this.findNode(e),s=ne(o).call(o,e)-1;if(s>=0){var u=o[s],l=this.body.nodes[u];l._openChildCluster(e),delete this.body.nodes[e],n===!0&&this.body.emitter.emit("_dataChanged");return}var h=a.containedNodes,c=a.containedEdges;if(t!==void 0&&t.releaseFunction!==void 0&&typeof t.releaseFunction=="function"){var d={},f={x:a.x,y:a.y};for(var v in h)if(Object.prototype.hasOwnProperty.call(h,v)){var p=this.body.nodes[v];d[v]={x:p.x,y:p.y}}var g=t.releaseFunction(f,d);for(var y in h)if(Object.prototype.hasOwnProperty.call(h,y)){var m=this.body.nodes[y];g[y]!==void 0&&(m.x=g[y].x===void 0?a.x:g[y].x,m.y=g[y].y===void 0?a.y:g[y].y)}}else te(h,function(ht){ht.options.fixed.x===!1&&(ht.x=a.x),ht.options.fixed.y===!1&&(ht.y=a.y)});for(var $ in h)if(Object.prototype.hasOwnProperty.call(h,$)){var b=this.body.nodes[$];b.vx=a.vx,b.vy=a.vy,b.setOptions({physics:!0}),delete this.clusteredNodes[$]}for(var O=[],_=0;_0&&sa&&(a=s.edges.length),e+=s.edges.length,t+=Math.pow(s.edges.length,2),n+=1}e=e/n,t=t/n;var u=t-Math.pow(e,2),l=Math.sqrt(u),h=Math.floor(e+2*l);return h>a&&(h=a),h}},{key:"_createClusteredEdge",value:function(e,t,n,a,o){var s=pt.cloneOptions(n,"edge");pe(s,a),s.from=e,s.to=t,s.id="clusterEdge:"+no(),o!==void 0&&pe(s,o);var u=this.body.functions.createEdge(s);return u.clusteringEdgeReplacingIds=[n.id],u.connect(),this.body.edges[u.id]=u,u}},{key:"_clusterEdges",value:function(e,t,n,a){if(t instanceof qn){var o=t,s={};s[o.id]=o,t=s}if(e instanceof Nt){var u=e,l={};l[u.id]=u,e=l}if(n==null)throw new Error("_clusterEdges: parameter clusterNode required");a===void 0&&(a=n.clusterEdgeProperties),this._createClusterEdges(e,t,n,a);for(var h in t)if(Object.prototype.hasOwnProperty.call(t,h)&&this.body.edges[h]!==void 0){var c=this.body.edges[h];this._backupEdgeOptions(c),c.setOptions({physics:!1})}for(var d in e)Object.prototype.hasOwnProperty.call(e,d)&&(this.clusteredNodes[d]={clusterId:n.id,node:this.body.nodes[d]},this.body.nodes[d].setOptions({physics:!1}))}},{key:"_getClusterNodeForNode",value:function(e){if(e!==void 0){var t=this.clusteredNodes[e];if(t!==void 0){var n=t.clusterId;if(n!==void 0)return this.body.nodes[n]}}}},{key:"_filter",value:function(e,t){var n=[];return te(e,function(a){t(a)&&n.push(a)}),n}},{key:"_updateState",value:function(){var e=this,t,n=[],a={},o=function(v){te(e.body.nodes,function(p){p.isCluster===!0&&v(p)})};for(t in this.clusteredNodes)if(Object.prototype.hasOwnProperty.call(this.clusteredNodes,t)){var s=this.body.nodes[t];s===void 0&&n.push(t)}o(function(f){for(var v=0;v0}(!f.endPointsValid()||!p)&&(a[v]=v)}),o(function(f){te(a,function(v){delete f.containedEdges[v],te(f.edges,function(p,g){if(p.id===v){f.edges[g]=null;return}p.clusteringEdgeReplacingIds=e._filter(p.clusteringEdgeReplacingIds,function(y){return!a[y]})}),f.edges=e._filter(f.edges,function(p){return p!==null})})}),te(a,function(f){delete e.clusteredEdges[f]}),te(a,function(f){delete e.body.edges[f]});var l=Oe(this.body.edges);te(l,function(f){var v=e.body.edges[f],p=e._isClusteredNode(v.fromId)||e._isClusteredNode(v.toId);if(p!==e._isClusteredEdge(v.id))if(p){var g=e._getClusterNodeForNode(v.fromId);g!==void 0&&e._clusterEdges(e.body.nodes[v.fromId],v,g);var y=e._getClusterNodeForNode(v.toId);y!==void 0&&e._clusterEdges(e.body.nodes[v.toId],v,y)}else delete e._clusterEdges[f],e._restoreEdge(v)});for(var h=!1,c=!0,d=function(){var v=[];o(function(g){var y=Oe(g.containedNodes).length,m=g.options.allowSingleNodeCluster===!0;(m&&y<1||!m&&y<2)&&v.push(g.id)});for(var p=0;p0,h=h||c};c;)d();h&&this._updateState()}},{key:"_isClusteredNode",value:function(e){return this.clusteredNodes[e]!==void 0}},{key:"_isClusteredEdge",value:function(e){return this.clusteredEdges[e]!==void 0}}]),i}();function afe(){var i;window!==void 0&&(i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame),i===void 0?window.requestAnimationFrame=function(r){r()}:window.requestAnimationFrame=i}var ofe=function(){function i(r,e){N(this,i),afe(),this.body=r,this.canvas=e,this.redrawRequested=!1,this.renderTimer=void 0,this.requiresTimeout=!0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},Le(this.options,this.defaultOptions),this._determineBrowserMethod(),this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this,t;this.body.emitter.on("dragStart",function(){e.dragging=!0}),this.body.emitter.on("dragEnd",function(){e.dragging=!1}),this.body.emitter.on("zoom",function(){e.zooming=!0,window.clearTimeout(e.zoomTimeoutId),e.zoomTimeoutId=mr(function(){var n;e.zooming=!1,k(n=e._requestRedraw).call(n,e)()},250)}),this.body.emitter.on("_resizeNodes",function(){e._resizeNodes()}),this.body.emitter.on("_redraw",function(){e.renderingActive===!1&&e._redraw()}),this.body.emitter.on("_blockRedraw",function(){e.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",function(){e.allowRedraw=!0,e.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",k(t=this._requestRedraw).call(t,this)),this.body.emitter.on("_startRendering",function(){e.renderRequests+=1,e.renderingActive=!0,e._startRendering()}),this.body.emitter.on("_stopRendering",function(){e.renderRequests-=1,e.renderingActive=e.renderRequests>0,e.renderTimer=void 0}),this.body.emitter.on("destroy",function(){e.renderRequests=0,e.allowRedraw=!1,e.renderingActive=!1,e.requiresTimeout===!0?clearTimeout(e.renderTimer):window.cancelAnimationFrame(e.renderTimer),e.body.emitter.off()})}},{key:"setOptions",value:function(e){if(e!==void 0){var t=["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"];Ma(t,this.options,e)}}},{key:"_requestNextFrame",value:function(e,t){if(!(typeof window>"u")){var n,a=window;return this.requiresTimeout===!0?n=mr(e,t):a.requestAnimationFrame&&(n=a.requestAnimationFrame(e)),n}}},{key:"_startRendering",value:function(){if(this.renderingActive===!0&&this.renderTimer===void 0){var e;this.renderTimer=this._requestNextFrame(k(e=this._renderStep).call(e,this),this.simulationInterval)}}},{key:"_renderStep",value:function(){this.renderingActive===!0&&(this.renderTimer=void 0,this.requiresTimeout===!0&&this._startRendering(),this._redraw(),this.requiresTimeout===!1&&this._startRendering())}},{key:"redraw",value:function(){this.body.emitter.emit("setSize"),this._redraw()}},{key:"_requestRedraw",value:function(){var e=this;this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,this._requestNextFrame(function(){e._redraw(!1)},0))}},{key:"_redraw",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(this.allowRedraw===!0){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;var t={drawExternalLabels:null};(this.canvas.frame.canvas.width===0||this.canvas.frame.canvas.height===0)&&this.canvas.setSize(),this.canvas.setTransform();var n=this.canvas.getContext(),a=this.canvas.frame.canvas.clientWidth,o=this.canvas.frame.canvas.clientHeight;if(n.clearRect(0,0,a,o),this.canvas.frame.clientWidth===0)return;if(n.save(),n.translate(this.body.view.translation.x,this.body.view.translation.y),n.scale(this.body.view.scale,this.body.view.scale),n.beginPath(),this.body.emitter.emit("beforeDrawing",n),n.closePath(),e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawEdges(n),this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1){var s=this._drawNodes(n,e),u=s.drawExternalLabels;t.drawExternalLabels=u}e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawArrows(n),t.drawExternalLabels!=null&&t.drawExternalLabels(),e===!1&&this._drawSelectionBox(n),n.beginPath(),this.body.emitter.emit("afterDrawing",n),n.closePath(),n.restore(),e===!0&&n.clearRect(0,0,a,o)}}},{key:"_resizeNodes",value:function(){this.canvas.setTransform();var e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);var t=this.body.nodes,n;for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n=t[a],n.resize(e),n.updateBoundingBox(e,n.selected));e.restore()}},{key:"_drawNodes",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.nodes,a=this.body.nodeIndices,o,s=[],u=[],l=20,h=this.canvas.DOMtoCanvas({x:-20,y:-20}),c=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+l,y:this.canvas.frame.canvas.clientHeight+l}),d={top:h.y,left:h.x,bottom:c.y,right:c.x},f=[],v=0;v0&&arguments[0]!==void 0?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}},{key:"_setCameraState",value:function(){if(this.cameraState.scale!==void 0&&this.frame.canvas.clientWidth!==0&&this.frame.canvas.clientHeight!==0&&this.pixelRatio!==0&&this.cameraState.previousWidth>0&&this.cameraState.previousHeight>0){var e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight,n=this.cameraState.scale;e!=1&&t!=1?n=this.cameraState.scale*.5*(e+t):e!=1?n=this.cameraState.scale*e:t!=1&&(n=this.cameraState.scale*t),this.body.view.scale=n;var a=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),o={x:a.x-this.cameraState.position.x,y:a.y-this.cameraState.position.y};this.body.view.translation.x+=o.x*this.body.view.scale,this.body.view.translation.y+=o.y*this.body.view.scale}}},{key:"_prepareValue",value:function(e){if(typeof e=="number")return e+"px";if(typeof e=="string"){if(ne(e).call(e,"%")!==-1||ne(e).call(e,"px")!==-1)return e;if(ne(e).call(e,"%")===-1)return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}},{key:"_create",value:function(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=0,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{var e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerText="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}},{key:"_bindHammer",value:function(){var e=this;this.hammer!==void 0&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new Gn(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:Gn.DIRECTION_ALL}),Qu(this.hammer,function(t){e.body.eventListeners.onTouch(t)}),this.hammer.on("tap",function(t){e.body.eventListeners.onTap(t)}),this.hammer.on("doubletap",function(t){e.body.eventListeners.onDoubleTap(t)}),this.hammer.on("press",function(t){e.body.eventListeners.onHold(t)}),this.hammer.on("panstart",function(t){e.body.eventListeners.onDragStart(t)}),this.hammer.on("panmove",function(t){e.body.eventListeners.onDrag(t)}),this.hammer.on("panend",function(t){e.body.eventListeners.onDragEnd(t)}),this.hammer.on("pinch",function(t){e.body.eventListeners.onPinch(t)}),this.frame.canvas.addEventListener("wheel",function(t){e.body.eventListeners.onMouseWheel(t)}),this.frame.canvas.addEventListener("mousemove",function(t){e.body.eventListeners.onMouseMove(t)}),this.frame.canvas.addEventListener("contextmenu",function(t){e.body.eventListeners.onContext(t)}),this.hammerFrame=new Gn(this.frame),MT(this.hammerFrame,function(t){e.body.eventListeners.onRelease(t)})}},{key:"setSize",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.width,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);var n=!1,a=this.frame.canvas.width,o=this.frame.canvas.height,s=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(s),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},n=!0;else{var u=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),l=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);(this.frame.canvas.width!==u||this.frame.canvas.height!==l)&&this._getCameraState(s),this.frame.canvas.width!==u&&(this.frame.canvas.width=u,n=!0),this.frame.canvas.height!==l&&(this.frame.canvas.height=l,n=!0)}return n===!0&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(a/this.pixelRatio),oldHeight:Math.round(o/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,n}},{key:"getContext",value:function(){return this.frame.canvas.getContext("2d")}},{key:"_determinePixelRatio",value:function(){var e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");var t=1;typeof window<"u"&&(t=window.devicePixelRatio||1);var n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return t/n}},{key:"_setPixelRatio",value:function(){this.pixelRatio=this._determinePixelRatio()}},{key:"setTransform",value:function(){var e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}},{key:"_XconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.x)/this.body.view.scale}},{key:"_XconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.x}},{key:"_YconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.y)/this.body.view.scale}},{key:"_YconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.y}},{key:"canvasToDOM",value:function(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}},{key:"DOMtoCanvas",value:function(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}]),i}();function dfe(i,r){var e=Le({nodes:r,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},i??{});if(!he(e.nodes))throw new TypeError("Nodes has to be an array of ids.");if(e.nodes.length===0&&(e.nodes=r),!(typeof e.minZoomLevel=="number"&&e.minZoomLevel>0))throw new TypeError("Min zoom level has to be a number higher than zero.");if(!(typeof e.maxZoomLevel=="number"&&e.minZoomLevel<=e.maxZoomLevel))throw new TypeError("Max zoom level has to be a number higher than min zoom level.");return e}var ffe=function(){function i(r,e){var t,n=this,a;N(this,i),this.body=r,this.canvas=e,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",k(t=this.fit).call(t,this)),this.body.emitter.on("animationFinished",function(){n.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",k(a=this.releaseNode).call(a,this))}return M(i,[{key:"setOptions",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=e}},{key:"fit",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e=dfe(e,this.body.nodeIndices);var n=this.canvas.frame.canvas.clientWidth,a=this.canvas.frame.canvas.clientHeight,o,s;if(n===0||a===0)s=1,o=pt.getRange(this.body.nodes,e.nodes);else if(t===!0){var u=0;for(var l in this.body.nodes)if(Object.prototype.hasOwnProperty.call(this.body.nodes,l)){var h=this.body.nodes[l];h.predefinedPosition===!0&&(u+=1)}if(u>.5*this.body.nodeIndices.length){this.fit(e,!1);return}o=pt.getRange(this.body.nodes,e.nodes);var c=this.body.nodeIndices.length;s=12.662/(c+7.4147)+.0964822;var d=Math.min(n/600,a/600);s*=d}else{this.body.emitter.emit("_resizeNodes"),o=pt.getRange(this.body.nodes,e.nodes);var f=Math.abs(o.maxX-o.minX)*1.1,v=Math.abs(o.maxY-o.minY)*1.1,p=n/f,g=a/v;s=p<=g?p:g}s>e.maxZoomLevel?s=e.maxZoomLevel:s1&&arguments[1]!==void 0?arguments[1]:{};if(this.body.nodes[e]!==void 0){var n={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=n,t.lockedOnNode=e,this.moveTo(t)}else console.error("Node: "+e+" cannot be found.")}},{key:"moveTo",value:function(e){if(e===void 0){e={};return}if(e.offset!=null){if(e.offset.x!=null){if(e.offset.x=+e.offset.x,!Di(e.offset.x))throw new TypeError('The option "offset.x" has to be a finite number.')}else e.offset.x=0;if(e.offset.y!=null){if(e.offset.y=+e.offset.y,!Di(e.offset.y))throw new TypeError('The option "offset.y" has to be a finite number.')}else e.offset.x=0}else e.offset={x:0,y:0};if(e.position!=null){if(e.position.x!=null){if(e.position.x=+e.position.x,!Di(e.position.x))throw new TypeError('The option "position.x" has to be a finite number.')}else e.position.x=0;if(e.position.y!=null){if(e.position.y=+e.position.y,!Di(e.position.y))throw new TypeError('The option "position.y" has to be a finite number.')}else e.position.x=0}else e.position=this.getViewPosition();if(e.scale!=null){if(e.scale=+e.scale,!(e.scale>0))throw new TypeError('The option "scale" has to be a number greater than zero.')}else e.scale=this.body.view.scale;e.animation===void 0&&(e.animation={duration:0}),e.animation===!1&&(e.animation={duration:0}),e.animation===!0&&(e.animation={}),e.animation.duration===void 0&&(e.animation.duration=1e3),e.animation.easingFunction===void 0&&(e.animation.easingFunction="easeInOutQuad"),this.animateView(e)}},{key:"animateView",value:function(e){if(e!==void 0){this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),e.locked===!0&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),this.easingTime!=0&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;var t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.position.x,y:t.y-e.position.y};if(this.targetTranslation={x:this.sourceTranslation.x+n.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+n.y*this.targetScale+e.offset.y},e.animation.duration===0)if(this.lockedOnNodeId!=null){var a;this.viewFunction=k(a=this._lockedRedraw).call(a,this),this.body.emitter.on("initRedraw",this.viewFunction)}else this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw");else{var o;this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=k(o=this._transitionRedraw).call(o,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}}},{key:"_lockedRedraw",value:function(){var e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.x,y:t.y-e.y},a=this.body.view.translation,o={x:a.x+n.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:a.y+n.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=o}},{key:"releaseNode",value:function(){this.lockedOnNodeId!==void 0&&this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}},{key:"_transitionRedraw",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.easingTime+=this.animationSpeed,this.easingTime=e===!0?1:this.easingTime;var t=Xae[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1){if(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,this.lockedOnNodeId!=null){var n;this.viewFunction=k(n=this._lockedRedraw).call(n,this),this.body.emitter.on("initRedraw",this.viewFunction)}this.body.emitter.emit("animationFinished")}}},{key:"getScale",value:function(){return this.body.view.scale}},{key:"getViewPosition",value:function(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}]),i}();function g$(i){var r=i&&i.preventDefault||!1,e=i&&i.container||window,t={},n={keydown:{},keyup:{}},a={},o;for(o=97;o<=122;o++)a[String.fromCharCode(o)]={code:65+(o-97),shift:!1};for(o=65;o<=90;o++)a[String.fromCharCode(o)]={code:o,shift:!0};for(o=0;o<=9;o++)a[""+o]={code:48+o,shift:!1};for(o=1;o<=12;o++)a["F"+o]={code:111+o,shift:!1};for(o=0;o<=9;o++)a["num"+o]={code:96+o,shift:!1};a["num*"]={code:106,shift:!1},a["num+"]={code:107,shift:!1},a["num-"]={code:109,shift:!1},a["num/"]={code:111,shift:!1},a["num."]={code:110,shift:!1},a.left={code:37,shift:!1},a.up={code:38,shift:!1},a.right={code:39,shift:!1},a.down={code:40,shift:!1},a.space={code:32,shift:!1},a.enter={code:13,shift:!1},a.shift={code:16,shift:void 0},a.esc={code:27,shift:!1},a.backspace={code:8,shift:!1},a.tab={code:9,shift:!1},a.ctrl={code:17,shift:!1},a.alt={code:18,shift:!1},a.delete={code:46,shift:!1},a.pageup={code:33,shift:!1},a.pagedown={code:34,shift:!1},a["="]={code:187,shift:!1},a["-"]={code:189,shift:!1},a["]"]={code:221,shift:!1},a["["]={code:219,shift:!1};var s=function(h){l(h,"keydown")},u=function(h){l(h,"keyup")},l=function(h,c){if(n[c][h.keyCode]!==void 0){for(var d=n[c][h.keyCode],f=0;f700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=new Date().valueOf())}},{key:"_stopMovement",value:function(){for(var e in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}},{key:"_moveUp",value:function(){this.body.view.translation.y+=this.options.keyboard.speed.y}},{key:"_moveDown",value:function(){this.body.view.translation.y-=this.options.keyboard.speed.y}},{key:"_moveLeft",value:function(){this.body.view.translation.x+=this.options.keyboard.speed.x}},{key:"_moveRight",value:function(){this.body.view.translation.x-=this.options.keyboard.speed.x}},{key:"_zoomIn",value:function(){var e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,a=t/e,o=(1-a)*this.canvas.canvasViewCenter.x+n.x*a,s=(1-a)*this.canvas.canvasViewCenter.y+n.y*a;this.body.view.scale=t,this.body.view.translation={x:o,y:s},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}},{key:"_zoomOut",value:function(){var e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,a=t/e,o=(1-a)*this.canvas.canvasViewCenter.x+n.x*a,s=(1-a)*this.canvas.canvasViewCenter.y+n.y*a;this.body.view.scale=t,this.body.view.translation={x:o,y:s},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}},{key:"configureKeyboardBindings",value:function(){var e=this;if(this.keycharm!==void 0&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=g$({container:window,preventDefault:!0}):this.keycharm=g$({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0)){var t,n,a,o,s,u,l,h,c,d,f,v,p,g,y,m,$,b,O,_,D,R,P,B;k(t=this.keycharm).call(t,"up",function(){e.bindToRedraw("_moveUp")},"keydown"),k(n=this.keycharm).call(n,"down",function(){e.bindToRedraw("_moveDown")},"keydown"),k(a=this.keycharm).call(a,"left",function(){e.bindToRedraw("_moveLeft")},"keydown"),k(o=this.keycharm).call(o,"right",function(){e.bindToRedraw("_moveRight")},"keydown"),k(s=this.keycharm).call(s,"=",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(u=this.keycharm).call(u,"num+",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(l=this.keycharm).call(l,"num-",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(h=this.keycharm).call(h,"-",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(c=this.keycharm).call(c,"[",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(d=this.keycharm).call(d,"]",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(f=this.keycharm).call(f,"pageup",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(v=this.keycharm).call(v,"pagedown",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(p=this.keycharm).call(p,"up",function(){e.unbindFromRedraw("_moveUp")},"keyup"),k(g=this.keycharm).call(g,"down",function(){e.unbindFromRedraw("_moveDown")},"keyup"),k(y=this.keycharm).call(y,"left",function(){e.unbindFromRedraw("_moveLeft")},"keyup"),k(m=this.keycharm).call(m,"right",function(){e.unbindFromRedraw("_moveRight")},"keyup"),k($=this.keycharm).call($,"=",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(b=this.keycharm).call(b,"num+",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(O=this.keycharm).call(O,"num-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(_=this.keycharm).call(_,"-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(D=this.keycharm).call(D,"[",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(R=this.keycharm).call(R,"]",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(P=this.keycharm).call(P,"pageup",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(B=this.keycharm).call(B,"pagedown",function(){e.unbindFromRedraw("_zoomOut")},"keyup")}}}]),i}();function pfe(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=gfe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function gfe(i,r){var e;if(i){if(typeof i=="string")return y$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return y$(i,r)}}function y$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=new Date().valueOf())}},{key:"onTap",value:function(e){var t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t)}},{key:"onDoubleTap",value:function(e){var t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("doubleClick",e,t)}},{key:"onHold",value:function(e){var t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t),this.selectionHandler.generateClickEvent("hold",e,t)}},{key:"onRelease",value:function(e){if(new Date().valueOf()-this.touchTime>10){var t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("release",e,t),this.touchTime=new Date().valueOf()}}},{key:"onContext",value:function(e){var t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent("oncontext",e,t)}},{key:"checkSelectionChanges",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;t===!0?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}},{key:"_determineDifference",value:function(e,t){var n=function(o,s){for(var u=[],l=0;l=o.minX&&c.x<=o.maxX&&c.y>=o.minY&&c.y<=o.maxY});fe(s).call(s,function(h){return t.selectionHandler.selectObject(t.body.nodes[h])});var u=this.getPointer(e.center);this.selectionHandler.commitAndEmit(u,e),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw")}else{var l=this.drag.selection;l&&l.length?(fe(l).call(l,function(h){h.node.options.fixed.x=h.xFixed,h.node.options.fixed.y=h.yFixed}),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center)),this.body.emitter.emit("startSimulation")):(this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw"))}}},{key:"onPinch",value:function(e){var t=this.getPointer(e.center);this.drag.pinched=!0,this.pinch.scale===void 0&&(this.pinch.scale=1);var n=this.pinch.scale*e.scale;this.zoom(n,t)}},{key:"zoom",value:function(e,t){if(this.options.zoomView===!0){var n=this.body.view.scale;e<1e-5&&(e=1e-5),e>10&&(e=10);var a=void 0;this.drag!==void 0&&this.drag.dragging===!0&&(a=this.canvas.DOMtoCanvas(this.drag.pointer));var o=this.body.view.translation,s=e/n,u=(1-s)*t.x+o.x*s,l=(1-s)*t.y+o.y*s;if(this.body.view.scale=e,this.body.view.translation={x:u,y:l},a!=null){var h=this.canvas.canvasToDOM(a);this.drag.pointer.x=h.x,this.drag.pointer.y=h.y}this.body.emitter.emit("_requestRedraw"),n0&&(this.popupObj=h[d[d.length-1]],s=!0)}if(this.popupObj===void 0&&s===!1){for(var v=this.body.edgeIndices,p=this.body.edges,g,y=[],m=0;m0&&(this.popupObj=p[y[y.length-1]],u="edge")}this.popupObj!==void 0?this.popupObj.id!==o&&(this.popup===void 0&&(this.popup=new noe(this.canvas.frame)),this.popup.popupTargetType=u,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):this.popup!==void 0&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}},{key:"_checkHidePopup",value:function(e){var t=this.selectionHandler._pointerToPositionObject(e),n=!1;if(this.popup.popupTargetType==="node"){if(this.body.nodes[this.popup.popupTargetId]!==void 0&&(n=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),n===!0)){var a=this.selectionHandler.getNodeAt(e);n=a===void 0?!1:a.id===this.popup.popupTargetId}}else this.selectionHandler.getNodeAt(e)===void 0&&this.body.edges[this.popup.popupTargetId]!==void 0&&(n=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));n===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}]),i}(),mfe=hp,bfe=vT;mfe("Set",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},bfe);var $fe=oe,wfe=$fe.Set,_fe=wfe,Efe=_fe,Sfe=Efe,xi=V(Sfe),Ofe=se,m$=cp,ru=eh.getWeakData,Tfe=lp,Ife=Vt,kfe=Oa,vd=Ze,Pfe=up,BT=wi,b$=Qe,FT=ln,xfe=FT.set,Cfe=FT.getterFor,Afe=BT.find,Dfe=BT.findIndex,Rfe=Ofe([].splice),Nfe=0,iu=function(i){return i.frozen||(i.frozen=new jT)},jT=function(){this.entries=[]},pd=function(i,r){return Afe(i.entries,function(e){return e[0]===r})};jT.prototype={get:function(i){var r=pd(this,i);if(r)return r[1]},has:function(i){return!!pd(this,i)},set:function(i,r){var e=pd(this,i);e?e[1]=r:this.entries.push([i,r])},delete:function(i){var r=Dfe(this.entries,function(e){return e[0]===i});return~r&&Rfe(this.entries,r,1),!!~r}};var Mfe={getConstructor:function(i,r,e,t){var n=i(function(u,l){Tfe(u,a),xfe(u,{type:r,id:Nfe++,frozen:void 0}),kfe(l)||Pfe(l,u[t],{that:u,AS_ENTRIES:e})}),a=n.prototype,o=Cfe(r),s=function(u,l,h){var c=o(u),d=ru(Ife(l),!0);return d===!0?iu(c).set(l,h):d[c.id]=h,u};return m$(a,{delete:function(u){var l=o(this);if(!vd(u))return!1;var h=ru(u);return h===!0?iu(l).delete(u):h&&b$(h,l.id)&&delete h[l.id]},has:function(l){var h=o(this);if(!vd(l))return!1;var c=ru(l);return c===!0?iu(h).has(l):c&&b$(c,h.id)}}),m$(a,e?{get:function(l){var h=o(this);if(vd(l)){var c=ru(l);return c===!0?iu(h).get(l):c?c[h.id]:void 0}},set:function(l,h){return s(this,l,h)}}:{add:function(l){return s(this,l,!0)}}),n}},Bfe=hT,$$=Pe,Su=se,w$=cp,Ffe=eh,jfe=hp,LT=Mfe,nu=Ze,au=ln.enforce,Lfe=ae,zfe=eS,gs=Object,Hfe=Array.isArray,ou=gs.isExtensible,zT=gs.isFrozen,Vfe=gs.isSealed,HT=gs.freeze,Wfe=gs.seal,_$={},E$={},Ufe=!$$.ActiveXObject&&"ActiveXObject"in $$,Wa,VT=function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},WT=jfe("WeakMap",VT,LT),Cn=WT.prototype,Ou=Su(Cn.set),Kfe=function(){return Bfe&&Lfe(function(){var i=HT([]);return Ou(new WT,i,1),!zT(i)})};if(zfe)if(Ufe){Wa=LT.getConstructor(VT,"WeakMap",!0),Ffe.enable();var S$=Su(Cn.delete),su=Su(Cn.has),O$=Su(Cn.get);w$(Cn,{delete:function(i){if(nu(i)&&!ou(i)){var r=au(this);return r.frozen||(r.frozen=new Wa),S$(this,i)||r.frozen.delete(i)}return S$(this,i)},has:function(r){if(nu(r)&&!ou(r)){var e=au(this);return e.frozen||(e.frozen=new Wa),su(this,r)||e.frozen.has(r)}return su(this,r)},get:function(r){if(nu(r)&&!ou(r)){var e=au(this);return e.frozen||(e.frozen=new Wa),su(this,r)?O$(this,r):e.frozen.get(r)}return O$(this,r)},set:function(r,e){if(nu(r)&&!ou(r)){var t=au(this);t.frozen||(t.frozen=new Wa),su(this,r)?Ou(this,r,e):t.frozen.set(r,e)}else Ou(this,r,e);return this}})}else Kfe()&&w$(Cn,{set:function(r,e){var t;return Hfe(r)&&(zT(r)?t=_$:Vfe(r)&&(t=E$)),Ou(this,r,e),t===_$&&HT(r),t===E$&&Wfe(r),this}});var Gfe=oe,qfe=Gfe.WeakMap,Yfe=qfe,Xfe=Yfe,Jfe=Xfe,ao=V(Jfe);function ve(i,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?i!==r||!t:!r.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(i):t?t.value:r.get(i)}function Nf(i,r,e,t,n){if(typeof r=="function"?i!==r||!0:!r.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r.set(i,e),e}function Mf(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=Zfe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Zfe(i,r){var e;if(i){if(typeof i=="string")return T$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return T$(i,r)}}function T$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e0&&arguments[0]!==void 0?arguments[0]:function(){};N(this,i),Yr.set(this,new k$),Xr.set(this,new k$),Tu.set(this,void 0),Nf(this,Tu,r)}return M(i,[{key:"sizeNodes",get:function(){return ve(this,Yr,"f").size}},{key:"sizeEdges",get:function(){return ve(this,Xr,"f").size}},{key:"getNodes",value:function(){return ve(this,Yr,"f").getSelection()}},{key:"getEdges",value:function(){return ve(this,Xr,"f").getSelection()}},{key:"addNodes",value:function(){var e;(e=ve(this,Yr,"f")).add.apply(e,arguments)}},{key:"addEdges",value:function(){var e;(e=ve(this,Xr,"f")).add.apply(e,arguments)}},{key:"deleteNodes",value:function(e){ve(this,Yr,"f").delete(e)}},{key:"deleteEdges",value:function(e){ve(this,Xr,"f").delete(e)}},{key:"clear",value:function(){ve(this,Yr,"f").clear(),ve(this,Xr,"f").clear()}},{key:"commit",value:function(){for(var e,t,n={nodes:ve(this,Yr,"f").commit(),edges:ve(this,Xr,"f").commit()},a=arguments.length,o=new Array(a),s=0;s=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function eve(i,r){var e;if(i){if(typeof i=="string")return x$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return x$(i,r)}}function x$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e4&&arguments[4]!==void 0?arguments[4]:!1,s=this._initBaseEvent(t,n);if(o===!0)s.nodes=[],s.edges=[];else{var u=this.getSelection();s.nodes=u.nodes,s.edges=u.edges}a!==void 0&&(s.previousSelection=a),e=="click"&&(s.items=this.getClickedItems(n)),t.controlEdge!==void 0&&(s.controlEdge=t.controlEdge),this.body.emitter.emit(e,s)}},{key:"selectObject",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.selectConnectedEdges;if(e!==void 0){if(e instanceof Nt){if(t===!0){var n;(n=this._selectionAccumulator).addEdges.apply(n,fr(e.edges))}this._selectionAccumulator.addNodes(e)}else this._selectionAccumulator.addEdges(e);return!0}return!1}},{key:"deselectObject",value:function(e){e.isSelected()===!0&&(e.selected=!1,this._removeFromSelection(e))}},{key:"_getAllNodesOverlappingWith",value:function(e){for(var t=[],n=this.body.nodes,a=0;a1&&arguments[1]!==void 0?arguments[1]:!0,n=this._pointerToPositionObject(e),a=this._getAllNodesOverlappingWith(n);if(a.length>0)return t===!0?this.body.nodes[a[a.length-1]]:a[a.length-1]}},{key:"_getEdgesOverlappingWith",value:function(e,t){for(var n=this.body.edges,a=0;a1&&arguments[1]!==void 0?arguments[1]:!0,n=this.canvas.DOMtoCanvas(e),a=10,o=null,s=this.body.edges,u=0;u0&&(this.generateClickEvent("deselectEdge",t,e,o),n=!0),a.nodes.deleted.length>0&&(this.generateClickEvent("deselectNode",t,e,o),n=!0),a.nodes.added.length>0&&(this.generateClickEvent("selectNode",t,e),n=!0),a.edges.added.length>0&&(this.generateClickEvent("selectEdge",t,e),n=!0),n===!0&&this.generateClickEvent("select",t,e)}},{key:"getSelection",value:function(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}},{key:"getSelectedNodes",value:function(){return this._selectionAccumulator.getNodes()}},{key:"getSelectedEdges",value:function(){return this._selectionAccumulator.getEdges()}},{key:"getSelectedNodeIds",value:function(){var e;return na(e=this._selectionAccumulator.getNodes()).call(e,function(t){return t.id})}},{key:"getSelectedEdgeIds",value:function(){var e;return na(e=this._selectionAccumulator.getEdges()).call(e,function(t){return t.id})}},{key:"setSelection",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||!e.nodes&&!e.edges)throw new TypeError("Selection must be an object with nodes and/or edges properties");if((t.unselectAll||t.unselectAll===void 0)&&this.unselectAll(),e.nodes){var n=P$(e.nodes),a;try{for(n.s();!(a=n.n()).done;){var o=a.value,s=this.body.nodes[o];if(!s)throw new RangeError('Node with id "'+o+'" not found');this.selectObject(s,t.highlightEdges)}}catch(d){n.e(d)}finally{n.f()}}if(e.edges){var u=P$(e.edges),l;try{for(u.s();!(l=u.n()).done;){var h=l.value,c=this.body.edges[h];if(!c)throw new RangeError('Edge with id "'+h+'" not found');this.selectObject(c)}}catch(d){u.e(d)}finally{u.f()}}this.body.emitter.emit("_requestRedraw"),this._selectionAccumulator.commit()}},{key:"selectNodes",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:t})}},{key:"selectEdges",value:function(e){if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({edges:e})}},{key:"updateSelection",value:function(){for(var e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(var t in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,t.id)||this._selectionAccumulator.deleteEdges(t)}},{key:"getClickedItems",value:function(e){for(var t=this.canvas.DOMtoCanvas(e),n=[],a=this.body.nodeIndices,o=this.body.nodes,s=a.length-1;s>=0;s--){var u=o[a[s]],l=u.getItemsOnPoint(t);n.push.apply(n,l)}for(var h=this.body.edgeIndices,c=this.body.edges,d=h.length-1;d>=0;d--){var f=c[h[d]],v=f.getItemsOnPoint(t);n.push.apply(n,v)}return n}}]),i}(),C$=kS,rve=Math.floor,Bf=function(i,r){var e=i.length,t=rve(e/2);return e<8?ive(i,r):nve(i,Bf(C$(i,0,t),r),Bf(C$(i,t),r),r)},ive=function(i,r){for(var e=i.length,t=1,n,a;t0;)i[a]=i[--a];a!==t++&&(i[a]=n)}return i},nve=function(i,r,e,t){for(var n=r.length,a=e.length,o=0,s=0;o3)){if(mve)return!0;if(F$)return F$<603;var i="",r,e,t,n;for(r=65;r<76;r++){switch(e=String.fromCharCode(r),r){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(n=0;n<47;n++)ii.push({k:e+n,v:t})}for(ii.sort(function(a,o){return o.v-a.v}),n=0;nN$(e)?1:-1}};dve({target:"Array",proto:!0,forced:Eve},{sort:function(r){r!==void 0&&fve(r);var e=vve(this);if(KT)return r===void 0?j$(e):j$(e,r);var t=[],n=R$(e),a,o;for(o=0;o=0:s>u;u+=l)u in o&&(n=e(n,o[u],u,a));return n}},Fve={left:L$(!1),right:L$(!0)},jve=Pe,Lve=Hr,zve=Lve(jve.process)==="process",Hve=q,Vve=Fve.left,Wve=Ra,z$=Xo,Uve=zve,Kve=!Uve&&z$>79&&z$<83,Gve=Kve||!Wve("reduce");Hve({target:"Array",proto:!0,forced:Gve},{reduce:function(r){var e=arguments.length;return Vve(this,r,e,e>1?arguments[1]:void 0)}});var qve=et,Yve=qve("Array").reduce,Xve=Be,Jve=Yve,yd=Array.prototype,Zve=function(i){var r=i.reduce;return i===yd||Xve(yd,i)&&r===yd.reduce?Jve:r},Qve=Zve,epe=Qve,tpe=epe,GT=V(tpe);function qT(i){var r=rpe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function rpe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var YT=function(){function i(){N(this,i)}return M(i,[{key:"abstract",value:function(){throw new Error("Can't instantiate abstract class!")}},{key:"fake_use",value:function(){}},{key:"curveType",value:function(){return this.abstract()}},{key:"getPosition",value:function(e){return this.fake_use(e),this.abstract()}},{key:"setPosition",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;this.fake_use(e,t,n),this.abstract()}},{key:"getTreeSize",value:function(e){return this.fake_use(e),this.abstract()}},{key:"sort",value:function(e){this.fake_use(e),this.abstract()}},{key:"fix",value:function(e,t){this.fake_use(e,t),this.abstract()}},{key:"shift",value:function(e,t){this.fake_use(e,t),this.abstract()}}]),i}(),ipe=function(i){ue(e,i);var r=qT(e);function e(t){var n;return N(this,e),n=r.call(this),n.layout=t,n}return M(e,[{key:"curveType",value:function(){return"horizontal"}},{key:"getPosition",value:function(n){return n.x}},{key:"setPosition",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;o!==void 0&&this.layout.hierarchical.addToOrdering(n,o),n.x=a}},{key:"getTreeSize",value:function(n){var a=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,n);return{min:a.min_x,max:a.max_x}}},{key:"sort",value:function(n){oo(n).call(n,function(a,o){return a.x-o.x})}},{key:"fix",value:function(n,a){n.y=this.layout.options.hierarchical.levelSeparation*a,n.options.fixed.y=!0}},{key:"shift",value:function(n,a){this.layout.body.nodes[n].x+=a}}]),e}(YT),npe=function(i){ue(e,i);var r=qT(e);function e(t){var n;return N(this,e),n=r.call(this),n.layout=t,n}return M(e,[{key:"curveType",value:function(){return"vertical"}},{key:"getPosition",value:function(n){return n.y}},{key:"setPosition",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;o!==void 0&&this.layout.hierarchical.addToOrdering(n,o),n.y=a}},{key:"getTreeSize",value:function(n){var a=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,n);return{min:a.min_y,max:a.max_y}}},{key:"sort",value:function(n){oo(n).call(n,function(a,o){return a.y-o.y})}},{key:"fix",value:function(n,a){n.x=this.layout.options.hierarchical.levelSeparation*a,n.options.fixed.x=!0}},{key:"shift",value:function(n,a){this.layout.body.nodes[n].y+=a}}]),e}(YT),ape=q,ope=wi.every,spe=Ra,upe=spe("every");ape({target:"Array",proto:!0,forced:!upe},{every:function(r){return ope(this,r,arguments.length>1?arguments[1]:void 0)}});var lpe=et,hpe=lpe("Array").every,cpe=Be,dpe=hpe,md=Array.prototype,fpe=function(i){var r=i.every;return i===md||cpe(md,i)&&r===md.every?dpe:r},vpe=fpe,ppe=vpe,gpe=ppe,XT=V(gpe);function ype(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=mpe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function mpe(i,r){var e;if(i){if(typeof i=="string")return H$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return H$(i,r)}}function H$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e=r[a])&&(r[a]=r[n]+1)}),r}function $pe(i){return JT(function(r){var e,t;return XT(e=Tt(t=r.edges).call(t,function(n){return i.has(n.toId)})).call(e,function(n){return n.to===r})},function(r,e){return e>r},"from",i)}function wpe(i){return JT(function(r){var e,t;return XT(e=Tt(t=r.edges).call(t,function(n){return i.has(n.toId)})).call(e,function(n){return n.from===r})},function(r,e){return eo)return{v:{v:bpe(t,a)}};++m},O;$=y.pop();)if(O=b(),O!==0&&O)return O.v},d;for(l.s();!(h=l.n()).done;)if(d=c(),d!==0&&d)return d.v}catch(f){l.e(f)}finally{l.f()}return a}var _pe=function(){function i(){N(this,i),this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}return M(i,[{key:"addRelation",value:function(e,t){this.childrenReference[e]===void 0&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),this.parentReference[t]===void 0&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}},{key:"checkIfTree",value:function(){for(var e in this.parentReference)if(this.parentReference[e].length>1){this.isTree=!1;return}this.isTree=!0}},{key:"numTrees",value:function(){return this.treeIndex+1}},{key:"setTreeIndex",value:function(e,t){t!==void 0&&this.trees[e.id]===void 0&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}},{key:"ensureLevel",value:function(e){this.levels[e]===void 0&&(this.levels[e]=0)}},{key:"getMaxLevel",value:function(e){var t=this,n={},a=function o(s){if(n[s]!==void 0)return n[s];var u=t.levels[s];if(t.childrenReference[s]){var l=t.childrenReference[s];if(l.length>0)for(var h=0;h0&&(n.levelSeparation*=-1):n.levelSeparation<0&&(n.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(a===!0)return this.body.emitter.emit("refresh"),pe(t,this.optionsBackup)}return t}},{key:"_resetRNG",value:function(e){this.initialRandomSeed=e,this._rng=Ql(this.initialRandomSeed)}},{key:"adaptAllOptionsForHierarchicalLayout",value:function(e){if(this.options.hierarchical.enabled===!0){var t=this.optionsBackup.physics;e.physics===void 0||e.physics===!0?(e.physics={enabled:t.enabled===void 0?!0:t.enabled,solver:"hierarchicalRepulsion"},t.enabled=t.enabled===void 0?!0:t.enabled,t.solver=t.solver||"barnesHut"):de(e.physics)==="object"?(t.enabled=e.physics.enabled===void 0?!0:e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):e.physics!==!1&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});var n=this.direction.curveType();if(e.edges===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(e.edges.smooth===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if(typeof e.edges.smooth=="boolean")this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:n};else{var a=e.edges.smooth;a.type!==void 0&&a.type!=="dynamic"&&(n=a.type),this.optionsBackup.edges={smooth:{enabled:a.enabled===void 0?!0:a.enabled,type:a.type===void 0?"dynamic":a.type,roundness:a.roundness===void 0?.5:a.roundness,forceDirection:a.forceDirection===void 0?!1:a.forceDirection}},e.edges.smooth={enabled:a.enabled===void 0?!0:a.enabled,type:n,roundness:a.roundness===void 0?.5:a.roundness,forceDirection:a.forceDirection===void 0?!1:a.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",n)}return e}},{key:"positionInitially",value:function(e){if(this.options.hierarchical.enabled!==!0){this._resetRNG(this.initialRandomSeed);for(var t=e.length+50,n=0;nu){for(var h=e.length;e.length>u&&s<=o;){s+=1;var c=e.length;s%3===0?this.body.modules.clustering.clusterBridges(l):this.body.modules.clustering.clusterOutliers(l);var d=e.length;if(c==d&&s%3!==0){this._declusterAll(),this.body.emitter.emit("_layoutFailed"),console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.");return}}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*h)})}s>o&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();for(var f=70,v=0;v0){var e,t,n=!1,a=!1;this.lastNodeOnLevel={},this.hierarchical=new _pe;for(t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&(e=this.body.nodes[t],e.options.level!==void 0?(n=!0,this.hierarchical.levels[t]=e.options.level):a=!0);if(a===!0&&n===!0)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");if(a===!0){var o=this.options.hierarchical.sortMethod;o==="hubsize"?this._determineLevelsByHubsize():o==="directed"?this._determineLevelsDirected():o==="custom"&&this._determineLevelsCustomCallback()}for(var s in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,s)&&this.hierarchical.ensureLevel(s);var u=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(u),this._condenseHierarchy(),this._shiftToCenter()}}},{key:"_condenseHierarchy",value:function(){var e=this,t=!1,n={},a=function(){for(var $=s(),b=0,O=0;O<$.length-1;O++){var _=$[O].max-$[O+1].min;b+=_+e.options.hierarchical.treeSpacing,o(O+1,b)}},o=function($,b){var O=e.hierarchical.trees;for(var _ in O)Object.prototype.hasOwnProperty.call(O,_)&&O[_]===$&&e.direction.shift(_,b)},s=function(){for(var $=[],b=0;b0)for(var _=0;_1&&arguments[1]!==void 0?arguments[1]:1e9,O=1e9,_=1e9,D=1e9,R=-1e9;for(var P in $)if(Object.prototype.hasOwnProperty.call($,P)){var B=e.body.nodes[P],j=e.hierarchical.levels[B.id],J=e.direction.getPosition(B),U=e._getSpaceAroundNode(B,$),ie=Te(U,2),_e=ie[0],ye=ie[1];O=Math.min(_e,O),_=Math.min(ye,_),j<=b&&(D=Math.min(J,D),R=Math.max(J,R))}return[D,R,O,_]},h=function($,b){var O=e.hierarchical.getMaxLevel($.id),_=e.hierarchical.getMaxLevel(b.id);return Math.min(O,_)},c=function($,b,O){for(var _=e.hierarchical,D=0;D1)for(var B=0;B2&&arguments[2]!==void 0?arguments[2]:!1,_=e.direction.getPosition($),D=e.direction.getPosition(b),R=Math.abs(D-_),P=e.options.hierarchical.nodeSpacing;if(R>P){var B={},j={};u($,B),u(b,j);var J=h($,b),U=l(B,J),ie=l(j,J),_e=U[1],ye=ie[0],Ae=ie[2],ht=Math.abs(_e-ye);if(ht>P){var at=_e-ye+P;at<-Ae+P&&(at=-Ae+P),at<0&&(e._shiftBlock(b.id,at),t=!0,O===!0&&e._centerParent(b))}}},f=function($,b){for(var O=b.id,_=b.edges,D=e.hierarchical.levels[b.id],R=e.options.hierarchical.levelSeparation*e.options.hierarchical.levelSeparation,P={},B=[],j=0;j<_.length;j++){var J=_[j];if(J.toId!=J.fromId){var U=J.toId==O?J.from:J.to;P[_[j].id]=U,e.hierarchical.levels[U.id]0?ut=Math.min(Rt,Sr-e.options.hierarchical.nodeSpacing):Rt<0&&(ut=-Math.min(-Rt,st-e.options.hierarchical.nodeSpacing)),ut!=0&&(e._shiftBlock(b.id,ut),t=!0)},ht=function(ot){var me=e.direction.getPosition(b),Fe=e._getSpaceAroundNode(b),De=Te(Fe,2),st=De[0],Sr=De[1],Rt=ot-me,ut=me;Rt>0?ut=Math.min(me+(Sr-e.options.hierarchical.nodeSpacing),ot):Rt<0&&(ut=Math.max(me-(st-e.options.hierarchical.nodeSpacing),ot)),ut!==me&&(e.direction.setPosition(b,ut),t=!0)},at=ye($,B);Ae(at),at=ye($,_),ht(at)},v=function($){var b=e.hierarchical.getLevels();b=Li(b).call(b);for(var O=0;O<$;O++){t=!1;for(var _=0;_0&&Math.abs(v)0&&(h=this.direction.getPosition(a[s-1])+l),this.direction.setPosition(u,h,t),this._validatePositionAndContinue(u,t,h),o++}}}}},{key:"_placeBranchNodes",value:function(e,t){var n,a=this.hierarchical.childrenReference[e];if(a!==void 0){for(var o=[],s=0;st&&this.positionedNodes[l.id]===void 0){var c=this.options.hierarchical.nodeSpacing,d=void 0;u===0?d=this.direction.getPosition(this.body.nodes[e]):d=this.direction.getPosition(o[u-1])+c,this.direction.setPosition(l,d,h),this._validatePositionAndContinue(l,h,d)}else return}var f=this._getCenterPosition(o);this.direction.setPosition(this.body.nodes[e],f,t)}}},{key:"_validatePositionAndContinue",value:function(e,t,n){if(this.hierarchical.isTree){if(this.lastNodeOnLevel[t]!==void 0){var a=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(n-ae.hierarchical.levels[a.id]&&e.hierarchical.addRelation(a.id,o.id)};this._crawlNetwork(t),this.hierarchical.checkIfTree()}},{key:"_crawlNetwork",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){},n=arguments.length>1?arguments[1]:void 0,a={},o=function d(f,v){if(a[f.id]===void 0){e.hierarchical.setTreeIndex(f,v),a[f.id]=!0;for(var p,g=e._getActiveEdges(f),y=0;y=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Ope(i,r){var e;if(i){if(typeof i=="string")return V$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return V$(i,r)}}function V$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e0&&this.options.deleteNode!==!1?(u===!0&&this._createSeperator(4),this._createDeleteButton(s)):n===0&&this.options.deleteEdge!==!1&&(u===!0&&this._createSeperator(4),this._createDeleteButton(s))),this._bindElementEvents(this.closeDiv,k(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent("select",k(t=this.showManipulatorToolbar).call(t,this))}this.body.emitter.emit("_redraw")}},{key:"addNodeMode",value:function(){var e;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addNode",this.guiEnabled===!0){var t,n=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(n),this._createSeperator(),this._createDescription(n.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,k(t=this.toggleEditMode).call(t,this))}this._temporaryBindEvent("click",k(e=this._performAddNode).call(e,this))}},{key:"editNode",value:function(){var e=this;this.editMode!==!0&&this.enableEditMode(),this._clean();var t=this.selectionHandler.getSelectedNodes()[0];if(t!==void 0)if(this.inMode="editNode",typeof this.options.editNode=="function")if(t.isCluster!==!0){var n=pe({},t.options,!1);if(n.x=t.x,n.y=t.y,this.options.editNode.length===2)this.options.editNode(n,function(a){a!=null&&e.inMode==="editNode"&&e.body.data.nodes.getDataSet().update(a),e.showManipulatorToolbar()});else throw new Error("The function for edit does not support two arguments (data, callback)")}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError);else throw new Error("No function has been configured to handle the editing of nodes.");else this.showManipulatorToolbar()}},{key:"addEdgeMode",value:function(){var e,t,n,a,o;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addEdge",this.guiEnabled===!0){var s,u=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(u),this._createSeperator(),this._createDescription(u.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,k(s=this.toggleEditMode).call(s,this))}this._temporaryBindUI("onTouch",k(e=this._handleConnect).call(e,this)),this._temporaryBindUI("onDragEnd",k(t=this._finishConnect).call(t,this)),this._temporaryBindUI("onDrag",k(n=this._dragControlNode).call(n,this)),this._temporaryBindUI("onRelease",k(a=this._finishConnect).call(a,this)),this._temporaryBindUI("onDragStart",k(o=this._dragStartEdge).call(o,this)),this._temporaryBindUI("onHold",function(){})}},{key:"editEdgeMode",value:function(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="editEdge",de(this.options.editEdge)==="object"&&typeof this.options.editEdge.editWithoutDrag=="function"&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0)){var e=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(e.from.id,e.to.id);return}if(this.guiEnabled===!0){var t,n=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(n),this._createSeperator(),this._createDescription(n.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,k(t=this.toggleEditMode).call(t,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0){var a,o,s,u,l=this.body.edges[this.edgeBeingEditedId],h=this._getNewTargetNode(l.from.x,l.from.y),c=this._getNewTargetNode(l.to.x,l.to.y);this.temporaryIds.nodes.push(h.id),this.temporaryIds.nodes.push(c.id),this.body.nodes[h.id]=h,this.body.nodeIndices.push(h.id),this.body.nodes[c.id]=c,this.body.nodeIndices.push(c.id),this._temporaryBindUI("onTouch",k(a=this._controlNodeTouch).call(a,this)),this._temporaryBindUI("onTap",function(){}),this._temporaryBindUI("onHold",function(){}),this._temporaryBindUI("onDragStart",k(o=this._controlNodeDragStart).call(o,this)),this._temporaryBindUI("onDrag",k(s=this._controlNodeDrag).call(s,this)),this._temporaryBindUI("onDragEnd",k(u=this._controlNodeDragEnd).call(u,this)),this._temporaryBindUI("onMouseMove",function(){}),this._temporaryBindEvent("beforeDrawing",function(d){var f=l.edgeType.findBorderPositions(d);h.selected===!1&&(h.x=f.from.x,h.y=f.from.y),c.selected===!1&&(c.x=f.to.x,c.y=f.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}},{key:"deleteSelected",value:function(){var e=this;this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="delete";var t=this.selectionHandler.getSelectedNodeIds(),n=this.selectionHandler.getSelectedEdgeIds(),a=void 0;if(t.length>0){for(var o=0;o0&&typeof this.options.deleteEdge=="function"&&(a=this.options.deleteEdge);if(typeof a=="function"){var s={nodes:t,edges:n};if(a.length===2)a(s,function(u){u!=null&&e.inMode==="delete"?(e.body.data.edges.getDataSet().remove(u.edges),e.body.data.nodes.getDataSet().remove(u.nodes),e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar()):(e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar())});else throw new Error("The function for delete does not support two arguments (data, callback)")}else this.body.data.edges.getDataSet().remove(n),this.body.data.nodes.getDataSet().remove(t),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}},{key:"_setup",value:function(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}},{key:"_createWrappers",value:function(){if(this.manipulationDiv===void 0&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",this.editMode===!0?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),this.editModeDiv===void 0&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",this.editMode===!0?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),this.closeDiv===void 0){var e,t;this.closeDiv=document.createElement("button"),this.closeDiv.className="vis-close",this.closeDiv.setAttribute("aria-label",(e=(t=this.options.locales[this.options.locale])===null||t===void 0?void 0:t.close)!==null&&e!==void 0?e:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv)}}},{key:"_getNewTargetNode",value:function(e,t){var n=pe({},this.options.controlNodeStyle);n.id="targetNode"+no(),n.hidden=!1,n.physics=!1,n.x=e,n.y=t;var a=this.body.functions.createNode(n);return a.shape.boundingBox={left:e,right:e,top:t,bottom:t},a}},{key:"_createEditButton",value:function(){var e;this._clean(),this.manipulationDOM={},Zr(this.editModeDiv);var t=this.options.locales[this.options.locale],n=this._createButton("editMode","vis-edit vis-edit-mode",t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(n),this._bindElementEvents(n,k(e=this.toggleEditMode).call(e,this))}},{key:"_clean",value:function(){this.inMode=!1,this.guiEnabled===!0&&(Zr(this.editModeDiv),Zr(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}},{key:"_cleanupDOMEventListeners",value:function(){var e,t=Spe(Ar(e=this._domEventListenerCleanupQueue).call(e,0)),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;a()}}catch(o){t.e(o)}finally{t.f()}}},{key:"_removeManipulationDOM",value:function(){this._clean(),Zr(this.manipulationDiv),Zr(this.editModeDiv),Zr(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}},{key:"_createSeperator",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}},{key:"_createAddNodeButton",value:function(e){var t,n=this._createButton("addNode","vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.addNodeMode).call(t,this))}},{key:"_createAddEdgeButton",value:function(e){var t,n=this._createButton("addEdge","vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.addEdgeMode).call(t,this))}},{key:"_createEditNodeButton",value:function(e){var t,n=this._createButton("editNode","vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.editNode).call(t,this))}},{key:"_createEditEdgeButton",value:function(e){var t,n=this._createButton("editEdge","vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.editEdgeMode).call(t,this))}},{key:"_createDeleteButton",value:function(e){var t,n;this.options.rtl?n="vis-delete-rtl":n="vis-delete";var a=this._createButton("delete",n,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(a),this._bindElementEvents(a,k(t=this.deleteSelected).call(t,this))}},{key:"_createBackButton",value:function(e){var t,n=this._createButton("back","vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.showManipulatorToolbar).call(t,this))}},{key:"_createButton",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("button"),this.manipulationDOM[e+"Div"].className="vis-button "+t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=a,this.manipulationDOM[e+"Label"].innerText=n,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}},{key:"_createDescription",value:function(e){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}},{key:"_temporaryBindEvent",value:function(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}},{key:"_temporaryBindUI",value:function(e,t){if(this.body.eventListeners[e]!==void 0)this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t;else throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+ls(Oe(this.body.eventListeners)))}},{key:"_unbindTemporaryUIs",value:function(){for(var e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}},{key:"_unbindTemporaryEvents",value:function(){for(var e=0;e=0;u--)if(o[u]!==this.selectedControlNode.id){s=this.body.nodes[o[u]];break}if(s!==void 0&&this.selectedControlNode!==void 0)if(s.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var l=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===l.id?this._performEditEdge(s.id,a.to.id):this._performEditEdge(a.from.id,s.id)}else a.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}}},{key:"_handleConnect",value:function(e){if(new Date().valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=Le({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;var t=this.lastTouch,n=this.selectionHandler.getNodeAt(t);if(n!==void 0)if(n.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var a=this._getNewTargetNode(n.x,n.y);this.body.nodes[a.id]=a,this.body.nodeIndices.push(a.id);var o=this.body.functions.createEdge({id:"connectionEdge"+no(),from:n.id,to:a.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[o.id]=o,this.body.edgeIndices.push(o.id),this.temporaryIds.nodes.push(a.id),this.temporaryIds.edges.push(o.id)}this.touchTime=new Date().valueOf()}}},{key:"_dragControlNode",value:function(e){var t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),a=void 0;this.temporaryIds.edges[0]!==void 0&&(a=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var o=this.selectionHandler._getAllNodesOverlappingWith(n),s=void 0,u=o.length-1;u>=0;u--){var l;if(ne(l=this.temporaryIds.nodes).call(l,o[u])===-1){s=this.body.nodes[o[u]];break}}if(e.controlEdge={from:a,to:s?s.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",e,t),this.temporaryIds.nodes[0]!==void 0){var h=this.body.nodes[this.temporaryIds.nodes[0]];h.x=this.canvas._XconvertDOMtoCanvas(t.x),h.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(e)}},{key:"_finishConnect",value:function(e){var t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),a=void 0;this.temporaryIds.edges[0]!==void 0&&(a=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var o=this.selectionHandler._getAllNodesOverlappingWith(n),s=void 0,u=o.length-1;u>=0;u--){var l;if(ne(l=this.temporaryIds.nodes).call(l,o[u])===-1){s=this.body.nodes[o[u]];break}}this._cleanupTemporaryNodesAndEdges(),s!==void 0&&(s.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):this.body.nodes[a]!==void 0&&this.body.nodes[s.id]!==void 0&&this._performAddEdge(a,s.id)),e.controlEdge={from:a,to:s?s.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",e,t),this.body.emitter.emit("_redraw")}},{key:"_dragStartEdge",value:function(e){var t=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",e,t,void 0,!0)}},{key:"_performAddNode",value:function(e){var t=this,n={id:no(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if(typeof this.options.addNode=="function")if(this.options.addNode.length===2)this.options.addNode(n,function(a){a!=null&&t.inMode==="addNode"&&t.body.data.nodes.getDataSet().add(a),t.showManipulatorToolbar()});else throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");else this.body.data.nodes.getDataSet().add(n),this.showManipulatorToolbar()}},{key:"_performAddEdge",value:function(e,t){var n=this,a={from:e,to:t};if(typeof this.options.addEdge=="function")if(this.options.addEdge.length===2)this.options.addEdge(a,function(o){o!=null&&n.inMode==="addEdge"&&(n.body.data.edges.getDataSet().add(o),n.selectionHandler.unselectAll(),n.showManipulatorToolbar())});else throw new Error("The function for connect does not support two arguments (data,callback)");else this.body.data.edges.getDataSet().add(a),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}},{key:"_performEditEdge",value:function(e,t){var n=this,a={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges.get(this.edgeBeingEditedId).label},o=this.options.editEdge;if(de(o)==="object"&&(o=o.editWithoutDrag),typeof o=="function")if(o.length===2)o(a,function(s){s==null||n.inMode!=="editEdge"?(n.body.edges[a.id].updateEdgeType(),n.body.emitter.emit("_redraw"),n.showManipulatorToolbar()):(n.body.data.edges.getDataSet().update(s),n.selectionHandler.unselectAll(),n.showManipulatorToolbar())});else throw new Error("The function for edit does not support two arguments (data, callback)");else this.body.data.edges.getDataSet().update(a),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}]),i}(),A="string",I="boolean",w="number",Ya="array",H="object",ZT="dom",Ipe="any",bd=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],$d={borderWidth:{number:w},borderWidthSelected:{number:w,undefined:"undefined"},brokenImage:{string:A,undefined:"undefined"},chosen:{label:{boolean:I,function:"function"},node:{boolean:I,function:"function"},__type__:{object:H,boolean:I}},color:{border:{string:A},background:{string:A},highlight:{border:{string:A},background:{string:A},__type__:{object:H,string:A}},hover:{border:{string:A},background:{string:A},__type__:{object:H,string:A}},__type__:{object:H,string:A}},opacity:{number:w,undefined:"undefined"},fixed:{x:{boolean:I},y:{boolean:I},__type__:{object:H,boolean:I}},font:{align:{string:A},color:{string:A},size:{number:w},face:{string:A},background:{string:A},strokeWidth:{number:w},strokeColor:{string:A},vadjust:{number:w},multi:{boolean:I,string:A},bold:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},boldital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},ital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},mono:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},__type__:{object:H,string:A}},group:{string:A,number:w,undefined:"undefined"},heightConstraint:{minimum:{number:w},valign:{string:A},__type__:{object:H,boolean:I,number:w}},hidden:{boolean:I},icon:{face:{string:A},code:{string:A},size:{number:w},color:{string:A},weight:{string:A,number:w},__type__:{object:H}},id:{string:A,number:w},image:{selected:{string:A,undefined:"undefined"},unselected:{string:A,undefined:"undefined"},__type__:{object:H,string:A}},imagePadding:{top:{number:w},right:{number:w},bottom:{number:w},left:{number:w},__type__:{object:H,number:w}},label:{string:A,undefined:"undefined"},labelHighlightBold:{boolean:I},level:{number:w,undefined:"undefined"},margin:{top:{number:w},right:{number:w},bottom:{number:w},left:{number:w},__type__:{object:H,number:w}},mass:{number:w},physics:{boolean:I},scaling:{min:{number:w},max:{number:w},label:{enabled:{boolean:I},min:{number:w},max:{number:w},maxVisible:{number:w},drawThreshold:{number:w},__type__:{object:H,boolean:I}},customScalingFunction:{function:"function"},__type__:{object:H}},shadow:{enabled:{boolean:I},color:{string:A},size:{number:w},x:{number:w},y:{number:w},__type__:{object:H,boolean:I}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:I,array:Ya},borderRadius:{number:w},interpolation:{boolean:I},useImageSize:{boolean:I},useBorderWithImage:{boolean:I},coordinateOrigin:{string:["center","top-left"]},__type__:{object:H}},size:{number:w},title:{string:A,dom:ZT,undefined:"undefined"},value:{number:w,undefined:"undefined"},widthConstraint:{minimum:{number:w},maximum:{number:w},__type__:{object:H,boolean:I,number:w}},x:{number:w},y:{number:w},__type__:{object:H}},kpe={configure:{enabled:{boolean:I},filter:{boolean:I,string:A,array:Ya,function:"function"},container:{dom:ZT},showButton:{boolean:I},__type__:{object:H,boolean:I,string:A,array:Ya,function:"function"}},edges:{arrows:{to:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageHeight:{number:w},imageWidth:{number:w},src:{string:A},__type__:{object:H,boolean:I}},middle:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageWidth:{number:w},imageHeight:{number:w},src:{string:A},__type__:{object:H,boolean:I}},from:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageWidth:{number:w},imageHeight:{number:w},src:{string:A},__type__:{object:H,boolean:I}},__type__:{string:["from","to","middle"],object:H}},endPointOffset:{from:{number:w},to:{number:w},__type__:{object:H,number:w}},arrowStrikethrough:{boolean:I},background:{enabled:{boolean:I},color:{string:A},size:{number:w},dashes:{boolean:I,array:Ya},__type__:{object:H,boolean:I}},chosen:{label:{boolean:I,function:"function"},edge:{boolean:I,function:"function"},__type__:{object:H,boolean:I}},color:{color:{string:A},highlight:{string:A},hover:{string:A},inherit:{string:["from","to","both"],boolean:I},opacity:{number:w},__type__:{object:H,string:A}},dashes:{boolean:I,array:Ya},font:{color:{string:A},size:{number:w},face:{string:A},background:{string:A},strokeWidth:{number:w},strokeColor:{string:A},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:w},multi:{boolean:I,string:A},bold:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},boldital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},ital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},mono:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},__type__:{object:H,string:A}},hidden:{boolean:I},hoverWidth:{function:"function",number:w},label:{string:A,undefined:"undefined"},labelHighlightBold:{boolean:I},length:{number:w,undefined:"undefined"},physics:{boolean:I},scaling:{min:{number:w},max:{number:w},label:{enabled:{boolean:I},min:{number:w},max:{number:w},maxVisible:{number:w},drawThreshold:{number:w},__type__:{object:H,boolean:I}},customScalingFunction:{function:"function"},__type__:{object:H}},selectionWidth:{function:"function",number:w},selfReferenceSize:{number:w},selfReference:{size:{number:w},angle:{number:w},renderBehindTheNode:{boolean:I},__type__:{object:H}},shadow:{enabled:{boolean:I},color:{string:A},size:{number:w},x:{number:w},y:{number:w},__type__:{object:H,boolean:I}},smooth:{enabled:{boolean:I},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:w},forceDirection:{string:["horizontal","vertical","none"],boolean:I},__type__:{object:H,boolean:I}},title:{string:A,undefined:"undefined"},width:{number:w},widthConstraint:{maximum:{number:w},__type__:{object:H,boolean:I,number:w}},value:{number:w,undefined:"undefined"},__type__:{object:H}},groups:{useDefaultGroups:{boolean:I},__any__:$d,__type__:{object:H}},interaction:{dragNodes:{boolean:I},dragView:{boolean:I},hideEdgesOnDrag:{boolean:I},hideEdgesOnZoom:{boolean:I},hideNodesOnDrag:{boolean:I},hover:{boolean:I},keyboard:{enabled:{boolean:I},speed:{x:{number:w},y:{number:w},zoom:{number:w},__type__:{object:H}},bindToWindow:{boolean:I},autoFocus:{boolean:I},__type__:{object:H,boolean:I}},multiselect:{boolean:I},navigationButtons:{boolean:I},selectable:{boolean:I},selectConnectedEdges:{boolean:I},hoverConnectedEdges:{boolean:I},tooltipDelay:{number:w},zoomView:{boolean:I},zoomSpeed:{number:w},__type__:{object:H}},layout:{randomSeed:{undefined:"undefined",number:w,string:A},improvedLayout:{boolean:I},clusterThreshold:{number:w},hierarchical:{enabled:{boolean:I},levelSeparation:{number:w},nodeSpacing:{number:w},treeSpacing:{number:w},blockShifting:{boolean:I},edgeMinimization:{boolean:I},parentCentralization:{boolean:I},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:H,boolean:I}},__type__:{object:H}},manipulation:{enabled:{boolean:I},initiallyActive:{boolean:I},addNode:{boolean:I,function:"function"},addEdge:{boolean:I,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:H,boolean:I,function:"function"}},deleteNode:{boolean:I,function:"function"},deleteEdge:{boolean:I,function:"function"},controlNodeStyle:$d,__type__:{object:H,boolean:I}},nodes:$d,physics:{enabled:{boolean:I},barnesHut:{theta:{number:w},gravitationalConstant:{number:w},centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},forceAtlas2Based:{theta:{number:w},gravitationalConstant:{number:w},centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},repulsion:{centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},nodeDistance:{number:w},damping:{number:w},__type__:{object:H}},hierarchicalRepulsion:{centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},nodeDistance:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},maxVelocity:{number:w},minVelocity:{number:w},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:I},iterations:{number:w},updateInterval:{number:w},onlyDynamicEdges:{boolean:I},fit:{boolean:I},__type__:{object:H,boolean:I}},timestep:{number:w},adaptiveTimestep:{boolean:I},wind:{x:{number:w},y:{number:w},__type__:{object:H}},__type__:{object:H,boolean:I}},autoResize:{boolean:I},clickToUse:{boolean:I},locale:{string:A},locales:{__any__:{any:Ipe},__type__:{object:H}},height:{string:A},width:{string:A},__type__:{object:H}},QT={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:["color","#2B7CE9"],background:["color","#97C2FC"],highlight:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]},hover:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[0,0,50,1],strokeColor:["color","#ffffff"]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:["ellipse","box","circle","database","diamond","dot","square","star","text","triangle","triangleDown","hexagon"],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:["color","#848484"],highlight:["color","#848484"],hover:["color","#848484"],inherit:["from","to","both",!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[2,0,50,1],strokeColor:["color","#ffffff"],align:["horizontal","top","middle","bottom"]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"],forceDirection:["horizontal","vertical","none"],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:["UD","DU","LR","RL"],sortMethod:["hubsize","directed"],shakeTowards:["leaves","roots"]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0,autoFocus:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:["barnesHut","forceAtlas2Based","repulsion","hierarchicalRepulsion"],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},Ppe=function(r,e,t){var n;return!!(hi(r).call(r,"physics")&&hi(n=QT.physics.solver).call(n,e)&&t.physics.solver!==e&&e!=="wind")},xpe=function(){function i(){N(this,i)}return M(i,[{key:"getDistances",value:function(e,t,n){for(var a={},o=e.edges,s=0;s2&&arguments[2]!==void 0?arguments[2]:!1,a=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(a),this._createK_matrix(a),this._createE_matrix();for(var o=.01,s=1,u=0,l=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),h=5,c=1e9,d=0,f=0,v=0,p=0,g=0;c>o&&us&&gy.type==="downstream_subgraph_search")?.data||[],f=y=>{const m=y.json.nodes.map(b=>({id:b.id,label:b.type,color:{background:"#2B7CE9",border:"#1B5BB1"},font:{size:16,color:"#FFFFFF",face:"arial",bold:!0},margin:12,padding:10,shape:"box",widthConstraint:{minimum:100,maximum:200}})),$=y.json.links.map(b=>({from:b.origin_id,to:b.target_id,arrows:{to:{enabled:!0,scaleFactor:1.2}},color:"#000000",width:2}));return{nodes:m,edges:$}};We.useEffect(()=>()=>{c.current&&(c.current.destroy(),c.current=null)},[]);const v=We.useCallback((y,m)=>{c.current&&c.current.destroy();const $=f(m),b=new z(y,$,{nodes:{shape:"box",margin:12,padding:10,font:{size:16,color:"#FFFFFF",face:"arial",bold:!0},borderWidth:2,shadow:{enabled:!0,color:"rgba(0,0,0,0.2)",size:5}},edges:{arrows:"to",color:"#000000",width:2,smooth:{enabled:!0,type:"straightCross"}},physics:{enabled:!0,solver:"hierarchicalRepulsion",hierarchicalRepulsion:{nodeDistance:200,springLength:200}},layout:{hierarchical:{enabled:!0,direction:"UD",sortMethod:"directed",nodeSpacing:200,levelSeparation:150}},interaction:{dragNodes:!1,zoomView:!1,dragView:!1}});c.current=b},[]),p=async y=>{console.log("[DownstreamSubgraphs] Starting checkAndLoadSubgraph with node:",y),ai.trackEvent({event_type:"subgraph_accept",message_type:"subgraph",message_id:u.message_id,data:{subgraph_name:y.name,subgraph_tags:y.tags}});const m=y.json.nodes,$=Object.values(Mt.canvas.selected_nodes)[0];if(!$){console.warn("[DownstreamSubgraphs] No node selected"),alert("Please select a upstream node first before adding a subgraph.");return}const b=m.map(D=>D.type),O=s;console.log("[DownstreamSubgraphs] Required node types:",b),console.log("[DownstreamSubgraphs] Installed node types:",O);const _=b.filter(D=>!O.includes(D));if(console.log("[DownstreamSubgraphs] Missing node types:",_),_.length>0)try{console.log("[DownstreamSubgraphs] Fetching info for missing nodes");const D=await ai.batchGetNodeInfo(_);console.log("[DownstreamSubgraphs] Received node infos:",D);const R={text:"",ext:[{type:"node_install_guide",data:D.map(B=>({name:B.name,repository_url:B.github_url}))}]};console.log("[DownstreamSubgraphs] Created message content:",R);const P={id:dr(),role:"ai",content:JSON.stringify(R),format:"markdown",name:"Assistant",metadata:{pendingSubgraph:y}};console.log("[DownstreamSubgraphs] Created AI message:",P),t?.(P);return}catch(D){console.error("[DownstreamSubgraphs] Error fetching node info:",D),alert("Error checking required nodes. Please try again.");return}console.log("[DownstreamSubgraphs] All required nodes are installed, proceeding to load subgraph"),g(y,$)},g=(y,m)=>{const $=y.json.nodes,b=y.json.links,O=$.find(R=>R.id===0),_=O?.id;console.log("[DownstreamSubgraphs] Entry node ID:",_);const D={};_!==null&&(D[_]=m),Mt.canvas.emitBeforeChange();try{for(const R of $)if(R.id!==_){const P=O?.pos,B=[m._pos[0],m._pos[1]],j=[R.pos[0]+B[0]-P[0],R.pos[1]+B[1]-P[1]];D[R.id]=X$(R.type,{pos:j})}for(const R of b){const P=D[R.origin_id],B=D[R.target_id];P&&B&&P.connect(R.origin_slot,B,R.target_slot)}}finally{Mt.canvas.emitAfterChange()}};return We.useEffect(()=>{const y=()=>{const m=Mt.canvas.selected_nodes;Object.keys(m??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values(m)}):a({type:"SET_SELECTED_NODE",payload:null})};return document.addEventListener("click",y),()=>{document.removeEventListener("click",y)}},[]),S.jsx("div",{className:"rounded-lg bg-gray-500 p-3 text-gray-700 text-xs break-words overflow-visible",children:d.length>0&&S.jsx("div",{className:"space-y-3",children:S.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(y=>S.jsxs("div",{className:"relative group",children:[S.jsx("button",{className:`px-3 py-1.5 bg-blue-500 text-white rounded-md hover:bg-blue-600 transition-colors text-xs`,onClick:()=>p(y),onMouseEnter:()=>h(y.name),onMouseLeave:()=>h(null),children:y.name}),S.jsxs("p",{className:"text-xs ml-3 text-white",children:["[",y.tags.join(", "),"]"]}),l===y.name&&S.jsx("div",{className:`fixed -translate-y-full z-[9999] w-[500px] p-4 bg-gray-800 text-white text-xs rounded-md shadow-lg mb-2 border border-gray-700`,style:{left:"calc(var(--mouse-x, 0) + 16px)",top:"calc(var(--mouse-y, 0) - 8px)"},children:S.jsx("div",{style:{width:"100%",height:"300px"},ref:m=>{m&&v(m,y)}})})]},y.name))})})})}const Vpe=Object.freeze(Object.defineProperty({__proto__:null,DownstreamSubgraphs:Ape},Symbol.toStringTag,{value:"Module"}));function Dpe({content:i,onLoadSubgraph:r}){const n=(JSON.parse(i).ext?.find(a=>a.type==="node_install_guide")?.data||[]).reduce((a,o)=>(a.some(s=>s.name===o.name)||a.push(o),a),[]);return S.jsxs("div",{children:[S.jsx("p",{children:"Before loading the graph to canvas, the following nodes need to be installed. Please visit the corresponding GitHub repositories to install them:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:n.map((a,o)=>S.jsx("div",{className:`w-full p-3 rounded-lg border border-gray-200 @@ -149,4 +149,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho border border-gray-900 hover:bg-gray-100 transition-colors text-[10px] flex items-center gap-1`,children:[S.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}):S.jsxs("a",{href:`https://www.google.com/search?q=${encodeURIComponent(a.name+" comfyui custom node")}`,target:"_blank",rel:"noopener noreferrer",className:`px-2 py-1 bg-gray-100 text-gray-500 rounded-md border border-gray-300 text-[10px] flex items-center gap-1`,children:[S.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 21h7a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v11m0 5l4.879-4.879m0 0a3 3 0 104.243-4.242 3 3 0 00-4.243 4.242z"})}),"Search on Google"]})})]})},o))}),S.jsx("p",{className:"mt-4"}),S.jsx("p",{children:"After installation, please click the continue loading graph button to load the graph to the canvas:"}),S.jsx("div",{className:"mt-4",children:S.jsx("button",{className:`px-3 py-2 bg-blue-500 text-white rounded-md - hover:bg-blue-600 transition-colors text-xs block mx-auto`,onClick:r,children:"Loading graph directly"})})]})}const Wpe=Object.freeze(Object.defineProperty({__proto__:null,NodeInstallGuide:Dpe},Symbol.toStringTag,{value:"Module"}));export{zpe as A,Y$ as B,Bpe as C,Vpe as D,BI as M,Hpe as N,Lpe as U,ri as W,Mt as a,X$ as b,oI as c,Wpe as d,Fpe as f,Sr as g,uI as u,jpe as v,Mpe as w}; + hover:bg-blue-600 transition-colors text-xs block mx-auto`,onClick:r,children:"Loading graph directly"})})]})}const Wpe=Object.freeze(Object.defineProperty({__proto__:null,NodeInstallGuide:Dpe},Symbol.toStringTag,{value:"Module"}));export{zpe as A,Y$ as B,Bpe as C,Vpe as D,BI as M,Hpe as N,Lpe as U,ai as W,Mt as a,X$ as b,oI as c,Wpe as d,Fpe as f,dr as g,uI as u,jpe as v,Mpe as w}; diff --git a/dist/copilot_web/workflowChat-Bg7hphV8.js b/dist/copilot_web/workflowChat-Bg7hphV8.js deleted file mode 100644 index bb923bc..0000000 --- a/dist/copilot_web/workflowChat-Bg7hphV8.js +++ /dev/null @@ -1,129 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-EBexRuvI.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DetBDgrq.js","copilot_web/ParameterDebugInterfaceV2-CkhASy27.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"])))=>i.map(i=>d[i]); -import{_ as Ot}from"./input.js";import{j as h,r as yg,b as wg}from"./vendor-markdown-Dek94WS0.js";import{r as L,R as wn,c as Tt}from"./vendor-react-V04_Axys.js";import{f as bg,v as Sg,a as fn,B as Ag,U as Eg,A as Er,b as Ig,g as en,c as Mt,u as ru,M as Cg,W as Rt}from"./message-components-DetBDgrq.js";/** - * @license lucide-react v0.475.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ng=m=>m.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Pa=(...m)=>m.filter((b,a,F)=>!!b&&b.trim()!==""&&F.indexOf(b)===a).join(" ").trim();/** - * @license lucide-react v0.475.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var Lg={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.475.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Tg=L.forwardRef(({color:m="currentColor",size:b=24,strokeWidth:a=2,absoluteStrokeWidth:F,className:M="",children:E,iconNode:B,...te},y)=>L.createElement("svg",{ref:y,...Lg,width:b,height:b,stroke:m,strokeWidth:F?Number(a)*24/Number(b):a,className:Pa("lucide",M),...te},[...B.map(([q,$])=>L.createElement(q,$)),...Array.isArray(E)?E:[E]]));/** - * @license lucide-react v0.475.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ft=(m,b)=>{const a=L.forwardRef(({className:F,...M},E)=>L.createElement(Tg,{ref:E,iconNode:b,className:Pa(`lucide-${Ng(m)}`,F),...M}));return a.displayName=`${m}`,a};/** - * @license lucide-react v0.475.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Rg=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Og=ft("Image",Rg);/** - * @license lucide-react v0.475.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Mg=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Dg=ft("Plus",Mg);/** - * @license lucide-react v0.475.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pg=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],kg=ft("Send",Pg);/** - * @license lucide-react v0.475.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Wg=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Bg=ft("Settings",Wg);/** - * @license lucide-react v0.475.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ug=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]],Fg=ft("Trash",Ug);/** - * @license lucide-react v0.475.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jg=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],nu=ft("X",jg);function Gg({isOpen:m,onClose:b,onSave:a,initialApiKey:F=""}){const[M,E]=L.useState(F),[B,te]=L.useState(!1),[y,q]=L.useState(""),[$,P]=L.useState("https://api.openai.com/v1"),[ve,re]=L.useState(!1),[ge,T]=L.useState(!1),[k,oe]=L.useState(null),[ce,se]=L.useState(null);L.useEffect(()=>{E(F);const H=localStorage.getItem("openaiApiKey"),Z=localStorage.getItem("openaiBaseUrl");H&&q(H),Z&&P(Z),(async()=>{try{const pe=localStorage.getItem("rsaPublicKey");if(pe)se(pe);else{const bn=await bg();se(bn),localStorage.setItem("rsaPublicKey",bn)}}catch(pe){console.error("Failed to fetch RSA public key:",pe)}})()},[F]);const Pe=async()=>{if(!y.trim()){oe({success:!1,message:"Please enter an OpenAI API key"});return}if(!ce){oe({success:!1,message:"RSA public key not available. Please try again later."});return}T(!0),oe(null);try{const H=await Sg(y,$,ce);oe({success:H,message:H?"API key is valid!":"Invalid API key. Please check and try again."})}catch(H){oe({success:!1,message:H instanceof Error?H.message:"Failed to verify API key"})}finally{T(!1)}},le=()=>{a(M),y.trim()?(localStorage.setItem("openaiApiKey",y),localStorage.setItem("openaiBaseUrl",$)):(localStorage.removeItem("openaiApiKey"),localStorage.removeItem("openaiBaseUrl")),b()};return m?h.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",children:h.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl p-8 w-[480px] shadow-2xl",children:[h.jsx("h2",{className:"text-xl text-gray-900 dark:text-white font-semibold mb-6",children:"Set API Key"}),h.jsxs("div",{className:"mb-6",children:[h.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"ComfyUI Copilot API Key"}),h.jsxs("div",{className:"relative",children:[h.jsx("input",{type:B?"text":"password",value:M,onChange:H=>E(H.target.value),placeholder:"Enter your API key",className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg mb-4 pr-12 - bg-gray-50 dark:bg-gray-700 - text-gray-900 dark:text-white - placeholder-gray-500 dark:placeholder-gray-400 - focus:border-blue-500 dark:focus:border-blue-400 - focus:ring-2 focus:ring-blue-500/20 dark:focus:ring-blue-400/20 - focus:outline-none`}),h.jsx("button",{type:"button",className:`absolute inset-y-0 right-0 pr-4 flex items-center text-gray-500 dark:text-gray-400 - hover:text-gray-700 dark:hover:text-gray-200 transition-colors bg-transparent border-none`,onClick:()=>te(!B),children:B?h.jsxs("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}):h.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})})})]}),h.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:[h.jsx("span",{children:"Don't have an API key? "}),h.jsx("a",{href:"https://form.typeform.com/to/tkg91K8D",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:"Click here to request one"})]})]}),h.jsxs("div",{className:"mb-6 border-t border-gray-200 dark:border-gray-700 pt-6",children:[h.jsx("h3",{className:"text-sm text-gray-900 dark:text-white font-medium mb-4",children:"OpenAI API Configuration (Optional)"}),h.jsxs("div",{className:"mb-4",children:[h.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-2",children:"OpenAI API Key"}),h.jsxs("div",{className:"relative",children:[h.jsx("input",{type:ve?"text":"password",value:y,onChange:H=>q(H.target.value),placeholder:"Enter your OpenAI API key",className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg pr-12 text-xs - bg-gray-50 dark:bg-gray-700 - text-gray-900 dark:text-white - placeholder-gray-500 dark:placeholder-gray-400 - focus:border-blue-500 dark:focus:border-blue-400 - focus:ring-2 focus:ring-blue-500/20 dark:focus:ring-blue-400/20 - focus:outline-none`}),h.jsx("button",{type:"button",className:`absolute inset-y-0 right-0 pr-4 flex items-center text-gray-500 dark:text-gray-400 - hover:text-gray-700 dark:hover:text-gray-200 transition-colors bg-transparent border-none`,onClick:()=>re(!ve),children:ve?h.jsxs("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}):h.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})})})]})]}),h.jsxs("div",{className:"mb-4",children:[h.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-2",children:"OpenAI Base URL"}),h.jsx("input",{type:"text",value:$,onChange:H=>P(H.target.value),placeholder:"https://api.openai.com/v1",className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-xs - bg-gray-50 dark:bg-gray-700 - text-gray-900 dark:text-white - placeholder-gray-500 dark:placeholder-gray-400 - focus:border-blue-500 dark:focus:border-blue-400 - focus:ring-2 focus:ring-blue-500/20 dark:focus:ring-blue-400/20 - focus:outline-none`})]}),h.jsx("div",{className:"flex items-center mb-2",children:h.jsx("button",{onClick:Pe,disabled:ge||!y.trim(),className:`px-4 py-2 rounded-lg font-medium text-xs transition-colors ${ge||!y.trim()?"bg-gray-300 dark:bg-gray-600 text-gray-500 dark:text-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white"}`,children:ge?h.jsxs("span",{className:"flex items-center",children:[h.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Verifying..."]}):"Verify"})}),k&&h.jsx("div",{className:`text-xs p-2 rounded-md ${k.success?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400"}`,children:k.message})]}),h.jsxs("div",{className:"flex justify-end gap-3",children:[h.jsx("button",{onClick:b,className:`px-5 py-2.5 text-gray-700 bg-white dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 - rounded-lg font-medium transition-colors`,children:"Cancel"}),h.jsx("button",{onClick:le,className:`px-5 py-2.5 bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 - text-white rounded-lg font-medium transition-colors`,children:"Save"})]})]})}):null}const Kg="/copilot_web/assets/logo-BTZhX0BN.png";function zg({onClose:m,onClear:b,hasMessages:a,onHeightResize:F,title:M="ComfyUI-Copilot"}){const[E,B]=L.useState(!1),[te,y]=L.useState(!1),q=()=>{B(!0)},$=P=>{localStorage.setItem("chatApiKey",P)};return L.useEffect(()=>{const P=re=>{if(!te)return;const ge=re.movementY;F?.(ge)},ve=()=>{y(!1)};return te&&(document.addEventListener("mousemove",P),document.addEventListener("mouseup",ve)),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",ve)}},[te,F]),h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:`flex items-center justify-between border-b px-3 py-2 - bg-white border-gray-200 sticky top-2 z-10`,children:[h.jsxs("div",{className:"flex items-center space-x-1",children:[h.jsx("img",{src:Kg,alt:"ComfyUI-Copilot Logo",className:"h-7 w-7 -ml-1"}),h.jsx("h3",{className:"text-[14px] font-medium text-gray-800",children:M}),h.jsx("button",{onClick:q,className:"p-1 bg-white border-none hover:bg-gray-100 rounded text-gray-500",children:h.jsx(Bg,{className:"h-4 w-4"})})]}),h.jsx("div",{className:"flex items-center gap-1",children:h.jsx("button",{className:`inline-flex bg-white border-none items-center justify-center rounded-md p-1.5 - ${a?"text-gray-500 hover:bg-gray-100":"text-gray-300 cursor-not-allowed"}`,disabled:!a,onClick:b,children:h.jsx(Fg,{className:"h-4 w-4"})})})]}),h.jsx(Gg,{isOpen:E,onClose:()=>B(!1),onSave:$,initialApiKey:localStorage.getItem("chatApiKey")||""})]})}const $g=5*1024*1024,Ma=["image/jpeg","image/png","image/gif","image/webp"],tu=[{name:"gpt-4o",image_enable:!0},{name:"gpt-4o-mini",image_enable:!0},{name:"qwen-plus",image_enable:!1},{name:"DeepSeek-V3",image_enable:!1}];function Hg({input:m,loading:b,onChange:a,onSend:F,onKeyPress:M,onUploadImages:E,uploadedImages:B,onRemoveImage:te,selectedModel:y,onModelChange:q}){const[$,P]=L.useState(!1),ve=wn.useRef(null),re=L.useRef(null);L.useEffect(()=>{re.current&&(re.current.style.height="auto",re.current.style.height=`${Math.min(re.current.scrollHeight,400)}px`)},[m]);const ge=T=>{if(T.target.files){const k=[],oe=[];if(Array.from(T.target.files).forEach(ce=>{Ma.includes(ce.type)?ce.size>$g?k.push(`${ce.name} (exceeds 5MB)`):oe.push(ce):k.push(`${ce.name} (unsupported format)`)}),k.length>0&&alert(`The following files couldn't be uploaded: -${k.join(` -`)}`),oe.length>0){const ce=new DataTransfer;oe.forEach(se=>ce.items.add(se)),E(ce.files)}}};return h.jsxs("div",{className:`relative ${B.length>0?"mt-12":""}`,children:[B.length>0&&h.jsx("div",{className:"absolute -top-10 left-0 flex gap-2",children:B.map(T=>h.jsxs("div",{className:"relative group",children:[h.jsx("img",{src:T.preview,alt:"uploaded",className:"w-8 h-8 rounded object-cover"}),h.jsx("button",{onClick:()=>te(T.id),className:`absolute -top-1 -right-1 bg-white border-none text-gray-500 rounded-full p-0.5 - opacity-0 group-hover:opacity-100 transition-opacity`,children:h.jsx(nu,{className:"w-3 h-3"})})]},T.id))}),h.jsx("textarea",{ref:re,onChange:a,onKeyDown:T=>{if(T.key==="Enter"&&!T.shiftKey){if(T.nativeEvent.isComposing)return;T.preventDefault(),m.trim()!==""&&F()}M(T)},value:m,placeholder:"Type your message...",className:`w-full min-h-[80px] max-h-[400px] resize-none rounded-md border - border-gray-200 px-3 py-2 pr-12 pb-10 text-[14px] shadow-sm - focus:outline-none focus:ring-2 focus:ring-blue-500 - focus:border-transparent bg-white transition-all - duration-200 text-gray-700 overflow-y-auto`,style:{height:"80px"}}),h.jsxs("div",{className:`absolute bottom-2 left-3 right-12 flex items-center gap-2 - bg-white border-t border-gray-100 pt-1`,children:[h.jsx("select",{value:y,onChange:T=>q(T.target.value),className:`px-1.5 py-0.5 text-xs rounded-md - border border-gray-200 bg-white text-gray-700 - focus:outline-none focus:ring-2 focus:ring-blue-500 - focus:border-transparent hover:bg-gray-50 - transition-colors border-0`,children:tu.map(T=>h.jsx("option",{value:T.name,children:T.name},T.name))}),h.jsx("button",{type:"button",onClick:()=>P(!0),disabled:!tu.find(T=>T.name===y)?.image_enable,className:`p-1.5 text-gray-500 bg-white border-none - hover:bg-gray-100 hover:text-gray-600 - transition-all duration-200 outline-none - ${tu.find(T=>T.name===y)?.image_enable?"":"opacity-50 cursor-not-allowed"}`,children:h.jsx(Og,{className:"h-4 w-4"})})]}),h.jsx("button",{type:"submit",onClick:F,disabled:b||m.trim()==="",className:`absolute bottom-3 right-3 p-2 rounded-md text-gray-500 bg-white border-none - hover:bg-gray-100 hover:text-gray-600 disabled:opacity-50 - transition-all duration-200 active:scale-95`,children:b?h.jsx("div",{className:`h-5 w-5 animate-spin rounded-full - border-2 border-gray-300 border-t-blue-500`}):h.jsx(kg,{className:"h-5 w-5 group-hover:translate-x-1"})}),$&&h.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:h.jsxs("div",{className:"bg-white rounded-lg p-6 w-96 relative",children:[h.jsx("button",{onClick:()=>P(!1),className:"absolute top-2 right-2 bg-white border-none text-gray-500 hover:text-gray-700",children:h.jsx(nu,{className:"w-5 h-5"})}),h.jsx("h3",{className:"text-lg text-gray-800 font-medium mb-4",children:"Upload Images"}),h.jsxs("div",{className:`border-2 border-dashed border-gray-300 rounded-lg p-8 - flex flex-col items-center justify-center gap-4 - hover:border-blue-500 transition-colors cursor-pointer`,onClick:()=>ve.current?.click(),children:[h.jsx(Dg,{className:"w-8 h-8 text-gray-400"}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-sm text-gray-500 mb-2",children:"Click to upload images or drag and drop"}),h.jsx("p",{className:"text-xs text-gray-400",children:"Supported formats: JPG, PNG, GIF, WebP"}),h.jsx("p",{className:"text-xs text-gray-400",children:"Max file size: 5MB"})]})]}),h.jsx("input",{ref:ve,type:"file",multiple:!0,accept:Ma.join(","),onChange:ge,className:"hidden"}),B.length>0&&h.jsx("div",{className:"mt-4 grid grid-cols-3 gap-2",children:B.map(T=>h.jsxs("div",{className:"relative group",children:[h.jsx("img",{src:T.preview,alt:"preview",className:"w-full h-20 object-cover rounded"}),h.jsx("button",{onClick:()=>te(T.id),className:`absolute -top-1 -right-1 bg-white border-none text-gray-500 - rounded-full p-0.5 opacity-0 group-hover:opacity-100 - transition-opacity`,children:h.jsx(nu,{className:"w-3 h-3"})})]},T.id))}),h.jsx("div",{className:"mt-4 flex justify-end gap-2",children:h.jsx("button",{onClick:()=>P(!1),className:`px-4 py-2 text-sm font-medium text-gray-700 - bg-white border border-gray-300 rounded-md - hover:bg-gray-50`,children:"Close"})})]})})]})}function qg(m){const b=m[0],a=new Set;function F(M,E){if(!(!M||E>=1)&&M.inputs)for(const B of Object.values(M.inputs)){const te=B.link;if(te&&fn.graph.links[te]){const y=fn.graph.links[te].origin_id,q=fn.graph._nodes_by_id[y];q&&(a.add(q.type),F(q,E+1))}}}return b?(F(b,0),[{type:"upstream_node_types",data:Array.from(a)}]):null}function Zg({nodeInfo:m,onSendWithIntent:b,loading:a,onSendWithContent:F}){return console.log("SelectedNodeInfo nodeInfo:",m[0]),h.jsx("div",{className:"mb-3 p-3 rounded-md bg-gray-50 border border-gray-200",children:h.jsxs("div",{className:"text-sm text-gray-700",children:[h.jsxs("p",{children:["Selected node: ",m[0].type]}),h.jsxs("div",{className:"flex gap-2 mt-2",children:[h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-blue-50 - text-blue-700 hover:bg-blue-100`,onClick:()=>F(`Reply in ${navigator.language} language: How does the ${m[0].type} node work? I need its official usage guide.`),disabled:a,children:"Usage"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-green-100 - text-green-700 hover:bg-green-200`,onClick:()=>F(`Reply in ${navigator.language} language: Show me the technical specifications for the ${m[0].type} node's inputs and outputs.`),disabled:a,children:"Parameters"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-purple-100 - text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",qg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Yg(){return h.jsx(Ag,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Jg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Xg=L.lazy(()=>Ot(()=>import("./WorkflowOption-EBexRuvI.js"),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Qg=L.lazy(()=>Ot(()=>import("./message-components-DetBDgrq.js").then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Vg=L.lazy(()=>Ot(()=>import("./message-components-DetBDgrq.js").then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),ep=L.lazy(()=>Ot(()=>import("./message-components-DetBDgrq.js").then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function np({messages:m,latestInput:b,onOptionClick:a,installedNodes:F,onAddMessage:M,loading:E}){const B=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Eg,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Jg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(k=>k.type==="workflow"),ve=$.ext?.find(k=>k.type==="node"),re=$.ext?.find(k=>k.type==="downstream_subgraph_search"),ge=$.ext?.find(k=>k.type==="node_install_guide");let T=null;if(P)T=h.jsx(L.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:F,onAddMessage:M})});else if(ve)T=h.jsx(L.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,installedNodes:F})});else if(re){const k=h.jsx(L.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:k,metadata:y.metadata},y.id);T=k}else ge&&(T=h.jsx(L.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(ep,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const k=Object.values(fn.canvas.selected_nodes)[0];if(k){const oe=y.metadata.pendingSubgraph,ce=oe.json.nodes,se=oe.json.links,Pe=ce.find(Z=>Z.id===0),le=Pe?.id,H={};le&&(H[le]=k),fn.canvas.emitBeforeChange();try{for(const Z of ce)if(Z.id!==le){const Se=Pe?.pos||[0,0],pe=k._pos||[0,0],bn=[Z.pos[0]+pe[0]-Se[0],Z.pos[1]+pe[1]-Se[1]];H[Z.id]=Ig(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of se){const Se=H[Z.origin_id],pe=H[Z.target_id];Se&&pe&&Se.connect(Z.origin_slot,pe,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const k=y.metadata.pendingWorkflow,oe=y.metadata.optimizedParams;fn.loadGraphData(k);for(const[se,Pe,le,H,Z]of oe){const Se=fn.graph._nodes_by_id[se].widgets;for(const pe of Se)pe.name===H&&(pe.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const ce={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(ce)}}})}));return $.text||T?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:T,metadata:y.metadata},y.id):T||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[F,a,M,b]),te=wn.useMemo(()=>m?.map(B),[m,B]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[te,E&&h.jsx(Yg,{})]})}async function tp(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function rp(){const m=await tp();return Object.keys(m)}async function dp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function gp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function pp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function _p(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** - * @license - * Lodash - * Copyright OpenJS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */Ir.exports;(function(m,b){(function(){var a,F="4.17.21",M=200,E="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",B="Expected a function",te="Invalid `variable` option passed into `_.template`",y="__lodash_hash_undefined__",q=500,$="__lodash_placeholder__",P=1,ve=2,re=4,ge=1,T=2,k=1,oe=2,ce=4,se=8,Pe=16,le=32,H=64,Z=128,Se=256,pe=512,bn=30,Cr="...",Dt=800,Nr=16,ct=1,$n=2,Lr=3,Dn=1/0,Sn=9007199254740991,Tr=17976931348623157e292,Hn=NaN,ze=4294967295,Pt=ze-1,qn=ze>>>1,Rr=[["ary",Z],["bind",k],["bindKey",oe],["curry",se],["curryRight",Pe],["flip",pe],["partial",le],["partialRight",H],["rearg",Se]],cn="[object Arguments]",Zn="[object Array]",Or="[object AsyncFunction]",Pn="[object Boolean]",An="[object Date]",Mr="[object DOMException]",A="[object Error]",j="[object Function]",_e="[object GeneratorFunction]",V="[object Map]",$e="[object Number]",ke="[object Null]",ie="[object Object]",Ae="[object Promise]",We="[object Proxy]",nn="[object RegExp]",Ce="[object Set]",ht="[object String]",kt="[object Symbol]",Wa="[object Undefined]",dt="[object WeakMap]",Ba="[object WeakSet]",gt="[object ArrayBuffer]",Yn="[object DataView]",Dr="[object Float32Array]",Pr="[object Float64Array]",kr="[object Int8Array]",Wr="[object Int16Array]",Br="[object Int32Array]",Ur="[object Uint8Array]",Fr="[object Uint8ClampedArray]",jr="[object Uint16Array]",Gr="[object Uint32Array]",Ua=/\b__p \+= '';/g,Fa=/\b(__p \+=) '' \+/g,ja=/(__e\(.*?\)|\b__t\)) \+\n'';/g,iu=/&(?:amp|lt|gt|quot|#39);/g,uu=/[&<>"']/g,Ga=RegExp(iu.source),Ka=RegExp(uu.source),za=/<%-([\s\S]+?)%>/g,$a=/<%([\s\S]+?)%>/g,su=/<%=([\s\S]+?)%>/g,Ha=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qa=/^\w*$/,Za=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Kr=/[\\^$.*+?()[\]{}|]/g,Ya=RegExp(Kr.source),zr=/^\s+/,Ja=/\s/,Xa=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Qa=/\{\n\/\* \[wrapped with (.+)\] \*/,Va=/,? & /,eo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,no=/[()=,{}\[\]\/\s]/,to=/\\(\\)?/g,ro=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,au=/\w*$/,io=/^[-+]0x[0-9a-f]+$/i,uo=/^0b[01]+$/i,so=/^\[object .+?Constructor\]$/,ao=/^0o[0-7]+$/i,oo=/^(?:0|[1-9]\d*)$/,lo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Wt=/($^)/,fo=/['\n\r\u2028\u2029\\]/g,Bt="\\ud800-\\udfff",co="\\u0300-\\u036f",ho="\\ufe20-\\ufe2f",go="\\u20d0-\\u20ff",ou=co+ho+go,lu="\\u2700-\\u27bf",fu="a-z\\xdf-\\xf6\\xf8-\\xff",po="\\xac\\xb1\\xd7\\xf7",_o="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",vo="\\u2000-\\u206f",mo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",cu="A-Z\\xc0-\\xd6\\xd8-\\xde",hu="\\ufe0e\\ufe0f",du=po+_o+vo+mo,$r="['’]",xo="["+Bt+"]",gu="["+du+"]",Ut="["+ou+"]",pu="\\d+",yo="["+lu+"]",_u="["+fu+"]",vu="[^"+Bt+du+pu+lu+fu+cu+"]",Hr="\\ud83c[\\udffb-\\udfff]",wo="(?:"+Ut+"|"+Hr+")",mu="[^"+Bt+"]",qr="(?:\\ud83c[\\udde6-\\uddff]){2}",Zr="[\\ud800-\\udbff][\\udc00-\\udfff]",Jn="["+cu+"]",xu="\\u200d",yu="(?:"+_u+"|"+vu+")",bo="(?:"+Jn+"|"+vu+")",wu="(?:"+$r+"(?:d|ll|m|re|s|t|ve))?",bu="(?:"+$r+"(?:D|LL|M|RE|S|T|VE))?",Su=wo+"?",Au="["+hu+"]?",So="(?:"+xu+"(?:"+[mu,qr,Zr].join("|")+")"+Au+Su+")*",Ao="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Eo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Eu=Au+Su+So,Io="(?:"+[yo,qr,Zr].join("|")+")"+Eu,Co="(?:"+[mu+Ut+"?",Ut,qr,Zr,xo].join("|")+")",No=RegExp($r,"g"),Lo=RegExp(Ut,"g"),Yr=RegExp(Hr+"(?="+Hr+")|"+Co+Eu,"g"),To=RegExp([Jn+"?"+_u+"+"+wu+"(?="+[gu,Jn,"$"].join("|")+")",bo+"+"+bu+"(?="+[gu,Jn+yu,"$"].join("|")+")",Jn+"?"+yu+"+"+wu,Jn+"+"+bu,Eo,Ao,pu,Io].join("|"),"g"),Ro=RegExp("["+xu+Bt+ou+hu+"]"),Oo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Mo=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Do=-1,ne={};ne[Dr]=ne[Pr]=ne[kr]=ne[Wr]=ne[Br]=ne[Ur]=ne[Fr]=ne[jr]=ne[Gr]=!0,ne[cn]=ne[Zn]=ne[gt]=ne[Pn]=ne[Yn]=ne[An]=ne[A]=ne[j]=ne[V]=ne[$e]=ne[ie]=ne[nn]=ne[Ce]=ne[ht]=ne[dt]=!1;var ee={};ee[cn]=ee[Zn]=ee[gt]=ee[Yn]=ee[Pn]=ee[An]=ee[Dr]=ee[Pr]=ee[kr]=ee[Wr]=ee[Br]=ee[V]=ee[$e]=ee[ie]=ee[nn]=ee[Ce]=ee[ht]=ee[kt]=ee[Ur]=ee[Fr]=ee[jr]=ee[Gr]=!0,ee[A]=ee[j]=ee[dt]=!1;var Po={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ko={"&":"&","<":"<",">":">",'"':""","'":"'"},Wo={"&":"&","<":"<",">":">",""":'"',"'":"'"},Bo={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Uo=parseFloat,Fo=parseInt,Iu=typeof Tt=="object"&&Tt&&Tt.Object===Object&&Tt,jo=typeof self=="object"&&self&&self.Object===Object&&self,we=Iu||jo||Function("return this")(),Jr=b&&!b.nodeType&&b,kn=Jr&&!0&&m&&!m.nodeType&&m,Cu=kn&&kn.exports===Jr,Xr=Cu&&Iu.process,He=function(){try{var f=kn&&kn.require&&kn.require("util").types;return f||Xr&&Xr.binding&&Xr.binding("util")}catch{}}(),Nu=He&&He.isArrayBuffer,Lu=He&&He.isDate,Tu=He&&He.isMap,Ru=He&&He.isRegExp,Ou=He&&He.isSet,Mu=He&&He.isTypedArray;function Be(f,g,d){switch(d.length){case 0:return f.call(g);case 1:return f.call(g,d[0]);case 2:return f.call(g,d[0],d[1]);case 3:return f.call(g,d[0],d[1],d[2])}return f.apply(g,d)}function Go(f,g,d,w){for(var R=-1,Y=f==null?0:f.length;++R-1}function Qr(f,g,d){for(var w=-1,R=f==null?0:f.length;++w-1;);return d}function ju(f,g){for(var d=f.length;d--&&Xn(g,f[d],0)>-1;);return d}function Xo(f,g){for(var d=f.length,w=0;d--;)f[d]===g&&++w;return w}var Qo=ti(Po),Vo=ti(ko);function el(f){return"\\"+Bo[f]}function nl(f,g){return f==null?a:f[g]}function Qn(f){return Ro.test(f)}function tl(f){return Oo.test(f)}function rl(f){for(var g,d=[];!(g=f.next()).done;)d.push(g.value);return d}function si(f){var g=-1,d=Array(f.size);return f.forEach(function(w,R){d[++g]=[R,w]}),d}function Gu(f,g){return function(d){return f(g(d))}}function Cn(f,g){for(var d=-1,w=f.length,R=0,Y=[];++d-1}function zl(e,n){var t=this.__data__,r=rr(t,e);return r<0?(++this.size,t.push([e,n])):t[r][1]=n,this}hn.prototype.clear=Fl,hn.prototype.delete=jl,hn.prototype.get=Gl,hn.prototype.has=Kl,hn.prototype.set=zl;function dn(e){var n=-1,t=e==null?0:e.length;for(this.clear();++n=n?e:n)),e}function Je(e,n,t,r,i,s){var o,l=n&P,c=n&ve,p=n&re;if(t&&(o=i?t(e,r,i,s):t(e)),o!==a)return o;if(!ae(e))return e;var _=O(e);if(_){if(o=Yf(e),!l)return Re(e,o)}else{var v=Ie(e),x=v==j||v==_e;if(Mn(e))return As(e,l);if(v==ie||v==cn||x&&!i){if(o=c||x?{}:Ks(e),!l)return c?Bf(e,af(o,e)):Wf(e,es(o,e))}else{if(!ee[v])return i?e:{};o=Jf(e,v,l)}}s||(s=new rn);var S=s.get(e);if(S)return S;s.set(e,o),ma(e)?e.forEach(function(N){o.add(Je(N,n,t,N,e,s))}):_a(e)&&e.forEach(function(N,G){o.set(G,Je(N,n,t,G,e,s))});var C=p?c?Oi:Ri:c?Me:ye,W=_?a:C(e);return qe(W||e,function(N,G){W&&(G=N,N=e[G]),wt(o,G,Je(N,n,t,G,e,s))}),o}function of(e){var n=ye(e);return function(t){return ns(t,e,n)}}function ns(e,n,t){var r=t.length;if(e==null)return!r;for(e=Q(e);r--;){var i=t[r],s=n[i],o=e[i];if(o===a&&!(i in e)||!s(o))return!1}return!0}function ts(e,n,t){if(typeof e!="function")throw new Ze(B);return Nt(function(){e.apply(a,t)},n)}function bt(e,n,t,r){var i=-1,s=Ft,o=!0,l=e.length,c=[],p=n.length;if(!l)return c;t&&(n=ue(n,Ue(t))),r?(s=Qr,o=!1):n.length>=M&&(s=pt,o=!1,n=new Un(n));e:for(;++ii?0:i+t),r=r===a||r>i?i:D(r),r<0&&(r+=i),r=t>r?0:ya(r);t0&&t(l)?n>1?be(l,n-1,t,r,i):In(i,l):r||(i[i.length]=l)}return i}var di=Ts(),us=Ts(!0);function an(e,n){return e&&di(e,n,ye)}function gi(e,n){return e&&us(e,n,ye)}function ur(e,n){return En(n,function(t){return mn(e[t])})}function jn(e,n){n=Rn(n,e);for(var t=0,r=n.length;e!=null&&tn}function cf(e,n){return e!=null&&X.call(e,n)}function hf(e,n){return e!=null&&n in Q(e)}function df(e,n,t){return e>=Ee(n,t)&&e=120&&_.length>=120)?new Un(o&&_):a}_=e[0];var v=-1,x=l[0];e:for(;++v-1;)l!==e&&Jt.call(l,c,1),Jt.call(e,c,1);return e}function _s(e,n){for(var t=e?n.length:0,r=t-1;t--;){var i=n[t];if(t==r||i!==s){var s=i;vn(i)?Jt.call(e,i,1):Ai(e,i)}}return e}function wi(e,n){return e+Vt(Ju()*(n-e+1))}function If(e,n,t,r){for(var i=-1,s=xe(Qt((n-e)/(t||1)),0),o=d(s);s--;)o[r?s:++i]=e,e+=t;return o}function bi(e,n){var t="";if(!e||n<1||n>Sn)return t;do n%2&&(t+=e),n=Vt(n/2),n&&(e+=e);while(n);return t}function U(e,n){return Ui(Hs(e,n,De),e+"")}function Cf(e){return Vu(lt(e))}function Nf(e,n){var t=lt(e);return _r(t,Fn(n,0,t.length))}function Et(e,n,t,r){if(!ae(e))return e;n=Rn(n,e);for(var i=-1,s=n.length,o=s-1,l=e;l!=null&&++ii?0:i+n),t=t>i?i:t,t<0&&(t+=i),i=n>t?0:t-n>>>0,n>>>=0;for(var s=d(i);++r>>1,o=e[s];o!==null&&!je(o)&&(t?o<=n:o=M){var p=n?null:Gf(e);if(p)return Gt(p);o=!1,i=pt,c=new Un}else c=n?[]:l;e:for(;++r=r?e:Xe(e,n,t)}var Ss=ml||function(e){return we.clearTimeout(e)};function As(e,n){if(n)return e.slice();var t=e.length,r=$u?$u(t):new e.constructor(t);return e.copy(r),r}function Ni(e){var n=new e.constructor(e.byteLength);return new Zt(n).set(new Zt(e)),n}function Mf(e,n){var t=n?Ni(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.byteLength)}function Df(e){var n=new e.constructor(e.source,au.exec(e));return n.lastIndex=e.lastIndex,n}function Pf(e){return yt?Q(yt.call(e)):{}}function Es(e,n){var t=n?Ni(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}function Is(e,n){if(e!==n){var t=e!==a,r=e===null,i=e===e,s=je(e),o=n!==a,l=n===null,c=n===n,p=je(n);if(!l&&!p&&!s&&e>n||s&&o&&c&&!l&&!p||r&&o&&c||!t&&c||!i)return 1;if(!r&&!s&&!p&&e=l)return c;var p=t[r];return c*(p=="desc"?-1:1)}}return e.index-n.index}function Cs(e,n,t,r){for(var i=-1,s=e.length,o=t.length,l=-1,c=n.length,p=xe(s-o,0),_=d(c+p),v=!r;++l1?t[i-1]:a,o=i>2?t[2]:a;for(s=e.length>3&&typeof s=="function"?(i--,s):a,o&&Le(t[0],t[1],o)&&(s=i<3?a:s,i=1),n=Q(n);++r-1?i[s?n[o]:o]:a}}function Ms(e){return _n(function(n){var t=n.length,r=t,i=Ye.prototype.thru;for(e&&n.reverse();r--;){var s=n[r];if(typeof s!="function")throw new Ze(B);if(i&&!o&&gr(s)=="wrapper")var o=new Ye([],!0)}for(r=o?r:t;++r1&&z.reverse(),_&&cl))return!1;var p=s.get(e),_=s.get(n);if(p&&_)return p==n&&_==e;var v=-1,x=!0,S=t&T?new Un:a;for(s.set(e,n),s.set(n,e);++v1?"& ":"")+n[r],n=n.join(t>2?", ":" "),e.replace(Xa,`{ -/* [wrapped with `+n+`] */ -`)}function Qf(e){return O(e)||zn(e)||!!(Zu&&e&&e[Zu])}function vn(e,n){var t=typeof e;return n=n??Sn,!!n&&(t=="number"||t!="symbol"&&oo.test(e))&&e>-1&&e%1==0&&e0){if(++n>=Dt)return arguments[0]}else n=0;return e.apply(a,arguments)}}function _r(e,n){var t=-1,r=e.length,i=r-1;for(n=n===a?r:n;++t1?e[n-1]:a;return t=typeof t=="function"?(e.pop(),t):a,ia(e,t)});function ua(e){var n=u(e);return n.__chain__=!0,n}function lh(e,n){return n(e),e}function vr(e,n){return n(e)}var fh=_n(function(e){var n=e.length,t=n?e[0]:0,r=this.__wrapped__,i=function(s){return hi(s,e)};return n>1||this.__actions__.length||!(r instanceof K)||!vn(t)?this.thru(i):(r=r.slice(t,+t+(n?1:0)),r.__actions__.push({func:vr,args:[i],thisArg:a}),new Ye(r,this.__chain__).thru(function(s){return n&&!s.length&&s.push(a),s}))});function ch(){return ua(this)}function hh(){return new Ye(this.value(),this.__chain__)}function dh(){this.__values__===a&&(this.__values__=xa(this.value()));var e=this.__index__>=this.__values__.length,n=e?a:this.__values__[this.__index__++];return{done:e,value:n}}function gh(){return this}function ph(e){for(var n,t=this;t instanceof tr;){var r=Qs(t);r.__index__=0,r.__values__=a,n?i.__wrapped__=r:n=r;var i=r;t=t.__wrapped__}return i.__wrapped__=e,n}function _h(){var e=this.__wrapped__;if(e instanceof K){var n=e;return this.__actions__.length&&(n=new K(this)),n=n.reverse(),n.__actions__.push({func:vr,args:[Fi],thisArg:a}),new Ye(n,this.__chain__)}return this.thru(Fi)}function vh(){return ws(this.__wrapped__,this.__actions__)}var mh=lr(function(e,n,t){X.call(e,t)?++e[t]:gn(e,t,1)});function xh(e,n,t){var r=O(e)?Du:lf;return t&&Le(e,n,t)&&(n=a),r(e,I(n,3))}function yh(e,n){var t=O(e)?En:is;return t(e,I(n,3))}var wh=Os(Vs),bh=Os(ea);function Sh(e,n){return be(mr(e,n),1)}function Ah(e,n){return be(mr(e,n),Dn)}function Eh(e,n,t){return t=t===a?1:D(t),be(mr(e,n),t)}function sa(e,n){var t=O(e)?qe:Ln;return t(e,I(n,3))}function aa(e,n){var t=O(e)?Ko:rs;return t(e,I(n,3))}var Ih=lr(function(e,n,t){X.call(e,t)?e[t].push(n):gn(e,t,[n])});function Ch(e,n,t,r){e=Oe(e)?e:lt(e),t=t&&!r?D(t):0;var i=e.length;return t<0&&(t=xe(i+t,0)),Sr(e)?t<=i&&e.indexOf(n,t)>-1:!!i&&Xn(e,n,t)>-1}var Nh=U(function(e,n,t){var r=-1,i=typeof n=="function",s=Oe(e)?d(e.length):[];return Ln(e,function(o){s[++r]=i?Be(n,o,t):St(o,n,t)}),s}),Lh=lr(function(e,n,t){gn(e,t,n)});function mr(e,n){var t=O(e)?ue:fs;return t(e,I(n,3))}function Th(e,n,t,r){return e==null?[]:(O(n)||(n=n==null?[]:[n]),t=r?a:t,O(t)||(t=t==null?[]:[t]),gs(e,n,t))}var Rh=lr(function(e,n,t){e[t?0:1].push(n)},function(){return[[],[]]});function Oh(e,n,t){var r=O(e)?Vr:Bu,i=arguments.length<3;return r(e,I(n,4),t,i,Ln)}function Mh(e,n,t){var r=O(e)?zo:Bu,i=arguments.length<3;return r(e,I(n,4),t,i,rs)}function Dh(e,n){var t=O(e)?En:is;return t(e,wr(I(n,3)))}function Ph(e){var n=O(e)?Vu:Cf;return n(e)}function kh(e,n,t){(t?Le(e,n,t):n===a)?n=1:n=D(n);var r=O(e)?rf:Nf;return r(e,n)}function Wh(e){var n=O(e)?uf:Tf;return n(e)}function Bh(e){if(e==null)return 0;if(Oe(e))return Sr(e)?Vn(e):e.length;var n=Ie(e);return n==V||n==Ce?e.size:mi(e).length}function Uh(e,n,t){var r=O(e)?ei:Rf;return t&&Le(e,n,t)&&(n=a),r(e,I(n,3))}var Fh=U(function(e,n){if(e==null)return[];var t=n.length;return t>1&&Le(e,n[0],n[1])?n=[]:t>2&&Le(n[0],n[1],n[2])&&(n=[n[0]]),gs(e,be(n,1),[])}),xr=xl||function(){return we.Date.now()};function jh(e,n){if(typeof n!="function")throw new Ze(B);return e=D(e),function(){if(--e<1)return n.apply(this,arguments)}}function oa(e,n,t){return n=t?a:n,n=e&&n==null?e.length:n,pn(e,Z,a,a,a,a,n)}function la(e,n){var t;if(typeof n!="function")throw new Ze(B);return e=D(e),function(){return--e>0&&(t=n.apply(this,arguments)),e<=1&&(n=a),t}}var Gi=U(function(e,n,t){var r=k;if(t.length){var i=Cn(t,at(Gi));r|=le}return pn(e,r,n,t,i)}),fa=U(function(e,n,t){var r=k|oe;if(t.length){var i=Cn(t,at(fa));r|=le}return pn(n,r,e,t,i)});function ca(e,n,t){n=t?a:n;var r=pn(e,se,a,a,a,a,a,n);return r.placeholder=ca.placeholder,r}function ha(e,n,t){n=t?a:n;var r=pn(e,Pe,a,a,a,a,a,n);return r.placeholder=ha.placeholder,r}function da(e,n,t){var r,i,s,o,l,c,p=0,_=!1,v=!1,x=!0;if(typeof e!="function")throw new Ze(B);n=Ve(n)||0,ae(t)&&(_=!!t.leading,v="maxWait"in t,s=v?xe(Ve(t.maxWait)||0,n):s,x="trailing"in t?!!t.trailing:x);function S(de){var sn=r,yn=i;return r=i=a,p=de,o=e.apply(yn,sn),o}function C(de){return p=de,l=Nt(G,n),_?S(de):o}function W(de){var sn=de-c,yn=de-p,Oa=n-sn;return v?Ee(Oa,s-yn):Oa}function N(de){var sn=de-c,yn=de-p;return c===a||sn>=n||sn<0||v&&yn>=s}function G(){var de=xr();if(N(de))return z(de);l=Nt(G,W(de))}function z(de){return l=a,x&&r?S(de):(r=i=a,o)}function Ge(){l!==a&&Ss(l),p=0,r=c=i=l=a}function Te(){return l===a?o:z(xr())}function Ke(){var de=xr(),sn=N(de);if(r=arguments,i=this,c=de,sn){if(l===a)return C(c);if(v)return Ss(l),l=Nt(G,n),S(c)}return l===a&&(l=Nt(G,n)),o}return Ke.cancel=Ge,Ke.flush=Te,Ke}var Gh=U(function(e,n){return ts(e,1,n)}),Kh=U(function(e,n,t){return ts(e,Ve(n)||0,t)});function zh(e){return pn(e,pe)}function yr(e,n){if(typeof e!="function"||n!=null&&typeof n!="function")throw new Ze(B);var t=function(){var r=arguments,i=n?n.apply(this,r):r[0],s=t.cache;if(s.has(i))return s.get(i);var o=e.apply(this,r);return t.cache=s.set(i,o)||s,o};return t.cache=new(yr.Cache||dn),t}yr.Cache=dn;function wr(e){if(typeof e!="function")throw new Ze(B);return function(){var n=arguments;switch(n.length){case 0:return!e.call(this);case 1:return!e.call(this,n[0]);case 2:return!e.call(this,n[0],n[1]);case 3:return!e.call(this,n[0],n[1],n[2])}return!e.apply(this,n)}}function $h(e){return la(2,e)}var Hh=Of(function(e,n){n=n.length==1&&O(n[0])?ue(n[0],Ue(I())):ue(be(n,1),Ue(I()));var t=n.length;return U(function(r){for(var i=-1,s=Ee(r.length,t);++i=n}),zn=as(function(){return arguments}())?as:function(e){return fe(e)&&X.call(e,"callee")&&!qu.call(e,"callee")},O=d.isArray,ad=Nu?Ue(Nu):pf;function Oe(e){return e!=null&&br(e.length)&&!mn(e)}function he(e){return fe(e)&&Oe(e)}function od(e){return e===!0||e===!1||fe(e)&&Ne(e)==Pn}var Mn=wl||eu,ld=Lu?Ue(Lu):_f;function fd(e){return fe(e)&&e.nodeType===1&&!Lt(e)}function cd(e){if(e==null)return!0;if(Oe(e)&&(O(e)||typeof e=="string"||typeof e.splice=="function"||Mn(e)||ot(e)||zn(e)))return!e.length;var n=Ie(e);if(n==V||n==Ce)return!e.size;if(Ct(e))return!mi(e).length;for(var t in e)if(X.call(e,t))return!1;return!0}function hd(e,n){return At(e,n)}function dd(e,n,t){t=typeof t=="function"?t:a;var r=t?t(e,n):a;return r===a?At(e,n,a,t):!!r}function zi(e){if(!fe(e))return!1;var n=Ne(e);return n==A||n==Mr||typeof e.message=="string"&&typeof e.name=="string"&&!Lt(e)}function gd(e){return typeof e=="number"&&Yu(e)}function mn(e){if(!ae(e))return!1;var n=Ne(e);return n==j||n==_e||n==Or||n==We}function pa(e){return typeof e=="number"&&e==D(e)}function br(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Sn}function ae(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}function fe(e){return e!=null&&typeof e=="object"}var _a=Tu?Ue(Tu):mf;function pd(e,n){return e===n||vi(e,n,Di(n))}function _d(e,n,t){return t=typeof t=="function"?t:a,vi(e,n,Di(n),t)}function vd(e){return va(e)&&e!=+e}function md(e){if(nc(e))throw new R(E);return os(e)}function xd(e){return e===null}function yd(e){return e==null}function va(e){return typeof e=="number"||fe(e)&&Ne(e)==$e}function Lt(e){if(!fe(e)||Ne(e)!=ie)return!1;var n=Yt(e);if(n===null)return!0;var t=X.call(n,"constructor")&&n.constructor;return typeof t=="function"&&t instanceof t&&$t.call(t)==pl}var $i=Ru?Ue(Ru):xf;function wd(e){return pa(e)&&e>=-9007199254740991&&e<=Sn}var ma=Ou?Ue(Ou):yf;function Sr(e){return typeof e=="string"||!O(e)&&fe(e)&&Ne(e)==ht}function je(e){return typeof e=="symbol"||fe(e)&&Ne(e)==kt}var ot=Mu?Ue(Mu):wf;function bd(e){return e===a}function Sd(e){return fe(e)&&Ie(e)==dt}function Ad(e){return fe(e)&&Ne(e)==Ba}var Ed=dr(xi),Id=dr(function(e,n){return e<=n});function xa(e){if(!e)return[];if(Oe(e))return Sr(e)?tn(e):Re(e);if(_t&&e[_t])return rl(e[_t]());var n=Ie(e),t=n==V?si:n==Ce?Gt:lt;return t(e)}function xn(e){if(!e)return e===0?e:0;if(e=Ve(e),e===Dn||e===-1/0){var n=e<0?-1:1;return n*Tr}return e===e?e:0}function D(e){var n=xn(e),t=n%1;return n===n?t?n-t:n:0}function ya(e){return e?Fn(D(e),0,ze):0}function Ve(e){if(typeof e=="number")return e;if(je(e))return Hn;if(ae(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=ae(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Uu(e);var t=uo.test(e);return t||ao.test(e)?Fo(e.slice(2),t?2:8):io.test(e)?Hn:+e}function wa(e){return on(e,Me(e))}function Cd(e){return e?Fn(D(e),-9007199254740991,Sn):e===0?e:0}function J(e){return e==null?"":Fe(e)}var Nd=ut(function(e,n){if(Ct(n)||Oe(n)){on(n,ye(n),e);return}for(var t in n)X.call(n,t)&&wt(e,t,n[t])}),ba=ut(function(e,n){on(n,Me(n),e)}),Ar=ut(function(e,n,t,r){on(n,Me(n),e,r)}),Ld=ut(function(e,n,t,r){on(n,ye(n),e,r)}),Td=_n(hi);function Rd(e,n){var t=it(e);return n==null?t:es(t,n)}var Od=U(function(e,n){e=Q(e);var t=-1,r=n.length,i=r>2?n[2]:a;for(i&&Le(n[0],n[1],i)&&(r=1);++t1),s}),on(e,Oi(e),t),r&&(t=Je(t,P|ve|re,Kf));for(var i=n.length;i--;)Ai(t,n[i]);return t});function Jd(e,n){return Aa(e,wr(I(n)))}var Xd=_n(function(e,n){return e==null?{}:Af(e,n)});function Aa(e,n){if(e==null)return{};var t=ue(Oi(e),function(r){return[r]});return n=I(n),ps(e,t,function(r,i){return n(r,i[0])})}function Qd(e,n,t){n=Rn(n,e);var r=-1,i=n.length;for(i||(i=1,e=a);++rn){var r=e;e=n,n=r}if(t||e%1||n%1){var i=Ju();return Ee(e+i*(n-e+Uo("1e-"+((i+"").length-1))),n)}return wi(e,n)}var l0=st(function(e,n,t){return n=n.toLowerCase(),e+(t?Ca(n):n)});function Ca(e){return Zi(J(e).toLowerCase())}function Na(e){return e=J(e),e&&e.replace(lo,Qo).replace(Lo,"")}function f0(e,n,t){e=J(e),n=Fe(n);var r=e.length;t=t===a?r:Fn(D(t),0,r);var i=t;return t-=n.length,t>=0&&e.slice(t,i)==n}function c0(e){return e=J(e),e&&Ka.test(e)?e.replace(uu,Vo):e}function h0(e){return e=J(e),e&&Ya.test(e)?e.replace(Kr,"\\$&"):e}var d0=st(function(e,n,t){return e+(t?"-":"")+n.toLowerCase()}),g0=st(function(e,n,t){return e+(t?" ":"")+n.toLowerCase()}),p0=Rs("toLowerCase");function _0(e,n,t){e=J(e),n=D(n);var r=n?Vn(e):0;if(!n||r>=n)return e;var i=(n-r)/2;return hr(Vt(i),t)+e+hr(Qt(i),t)}function v0(e,n,t){e=J(e),n=D(n);var r=n?Vn(e):0;return n&&r>>0,t?(e=J(e),e&&(typeof n=="string"||n!=null&&!$i(n))&&(n=Fe(n),!n&&Qn(e))?On(tn(e),0,t):e.split(n,t)):[]}var A0=st(function(e,n,t){return e+(t?" ":"")+Zi(n)});function E0(e,n,t){return e=J(e),t=t==null?0:Fn(D(t),0,e.length),n=Fe(n),e.slice(t,t+n.length)==n}function I0(e,n,t){var r=u.templateSettings;t&&Le(e,n,t)&&(n=a),e=J(e),n=Ar({},n,r,Bs);var i=Ar({},n.imports,r.imports,Bs),s=ye(i),o=ui(i,s),l,c,p=0,_=n.interpolate||Wt,v="__p += '",x=ai((n.escape||Wt).source+"|"+_.source+"|"+(_===su?ro:Wt).source+"|"+(n.evaluate||Wt).source+"|$","g"),S="//# sourceURL="+(X.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Do+"]")+` -`;e.replace(x,function(N,G,z,Ge,Te,Ke){return z||(z=Ge),v+=e.slice(p,Ke).replace(fo,el),G&&(l=!0,v+=`' + -__e(`+G+`) + -'`),Te&&(c=!0,v+=`'; -`+Te+`; -__p += '`),z&&(v+=`' + -((__t = (`+z+`)) == null ? '' : __t) + -'`),p=Ke+N.length,N}),v+=`'; -`;var C=X.call(n,"variable")&&n.variable;if(!C)v=`with (obj) { -`+v+` -} -`;else if(no.test(C))throw new R(te);v=(c?v.replace(Ua,""):v).replace(Fa,"$1").replace(ja,"$1;"),v="function("+(C||"obj")+`) { -`+(C?"":`obj || (obj = {}); -`)+"var __t, __p = ''"+(l?", __e = _.escape":"")+(c?`, __j = Array.prototype.join; -function print() { __p += __j.call(arguments, '') } -`:`; -`)+v+`return __p -}`;var W=Ta(function(){return Y(s,S+"return "+v).apply(a,o)});if(W.source=v,zi(W))throw W;return W}function C0(e){return J(e).toLowerCase()}function N0(e){return J(e).toUpperCase()}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return Uu(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),s=Fu(r,i),o=ju(r,i)+1;return On(r,s,o).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Ku(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=ju(r,tn(n))+1;return On(r,0,i).join("")}function R0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fu(r,tn(n));return On(r,i).join("")}function O0(e,n){var t=bn,r=Cr;if(ae(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var s=e.length;if(Qn(e)){var o=tn(e);s=o.length}if(t>=s)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(au.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function M0(e){return e=J(e),e&&Ga.test(e)?e.replace(iu,al):e}var D0=st(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Rs("toUpperCase");function La(e,n,t){return e=J(e),n=t?a:n,n===a?tl(e)?fl(e):qo(e):e.match(n)||[]}var Ta=U(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),P0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function k0(e){var n=e==null?0:e.length,t=I();return e=n?ue(e,function(r){if(typeof r[1]!="function")throw new Ze(B);return[t(r[0]),r[1]]}):[],U(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ee(e,ze);n=I(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=u[r?"take"+(n=="last"?"Right":""):n],s=r||/^find/.test(n);i&&(u.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(u,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,C=s&&!x,W=c&&!S;if(!s&&_){o=W?o:new K(this);var N=e.apply(o,l);return N.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(N,x)}return C&&W?e.apply(this,l):(N=this.thru(v),C?r?N.value()[0]:N.value():N)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);u.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var s=this.value();return n.apply(O(s)?s:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=u[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,oe).name]=[{name:"wrapper",func:a}],K.prototype.clone=Ol,K.prototype.reverse=Ml,K.prototype.value=Dl,u.prototype.at=fh,u.prototype.chain=ch,u.prototype.commit=hh,u.prototype.next=dh,u.prototype.plant=ph,u.prototype.reverse=_h,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=vh,u.prototype.first=u.prototype.head,_t&&(u.prototype[_t]=gh),u},et=cl();kn?((kn.exports=et)._=et,Jr._=et):we._=et}).call(Tt)})(Ir,Ir.exports);var ka=Ir.exports;function ip(m=!0){L.useEffect(()=>{if(!m)return;const b=ka.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function up(m=!0){const{state:b,dispatch:a}=ru(),{activeTab:F,screenState:M}=b;L.useEffect(()=>{if(!m)return;const E=B=>{const te=F==="parameter-debug",y=F==="chat",q=!M||M.currentScreen===0;if(y||q&&te){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,F,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Cg,{rehypePlugins:[[yg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[wg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...F})=>h.jsx("a",{...F,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,ap=()=>{const{state:m,dispatch:b}=ru(),{selectedNode:a,screenState:F}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import("./ParameterDebugInterfaceV2-CkhASy27.js"),__vite__mapDeps([4,1,2,3,5,6,7])).then(te=>({default:te.ParameterDebugInterface}))),B=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:B})})})},Da=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function op({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:F}){const{state:M,dispatch:E}=ru(),{messages:B,installedNodes:te,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,ve=L.useRef(null),[re,ge]=L.useState(""),[T,k]=L.useState(""),[oe,ce]=L.useState(window.innerWidth/3),[se,Pe]=L.useState(!1),[le,H]=L.useState([]),[Z,Se]=L.useState("gpt-4o-mini");L.useState(window.innerHeight),L.useState(0);const[pe,bn]=L.useState(""),[Cr,Dt]=L.useState(!1);ip(b&&P==="chat"),up(b),L.useEffect(()=>{ve.current&&(ve.current.scrollTop=ve.current.scrollHeight)},[B]),L.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await rp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await Rt.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};L.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),L.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),L.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),L.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ct=wn.useCallback(A=>{if(!se)return;const j=window.innerWidth-A.clientX,_e=Math.min(Math.max(300,j),window.innerWidth*.8);ce(_e)},[se]),$n=wn.useMemo(()=>ka.debounce(ct,16),[ct]);L.useEffect(()=>(se&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[se,$n]);const Lr=A=>{ge(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),re.trim()===""&&!$||!q)return;k(re);const A=en(),j={id:en(),role:"user",content:re,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),ge("");try{const _e={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of Rt.streamInvokeServer(q,re,le.map(ie=>ie.file),null,_e,A)){const ie={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ie}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ie});const Ae=M.messages.map(We=>We.id===ie.id&&!We.finished?ie:We);qn(Ae)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(_e){console.error("Error sending message:",_e),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),k(A);const j=en(),_e={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:_e});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ie of Rt.streamInvokeServer(q,A,le.map(Ae=>Ae.file),null,V,j)){const Ae={id:$e,role:"ai",content:JSON.stringify(ie),format:ie.format,finished:ie.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ae}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ae});const We=M.messages.map(nn=>nn.id===Ae.id&&!nn.finished?Ae:nn);qn(We)}ie.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{ge(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const _e=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:_e,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ie=!0;for await(const Ae of Rt.streamInvokeServer(q,_e,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ae),format:Ae.format,finished:Ae.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ie)E({type:"ADD_MESSAGE",payload:We}),ie=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ce=>Ce.id===We.id&&!Ce.finished?We:Ce);qn(nn)}Ae.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{Pe(!1)},Zn=A=>{const j=Array.from(A).map(_e=>({id:Math.random().toString(36).substr(2,9),file:_e,preview:URL.createObjectURL(_e)}));H(_e=>[..._e,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{le.forEach(A=>URL.revokeObjectURL(A.preview))},[le]),L.useEffect(()=>{a&&F&&P==="chat"&&(Pt("node_explain"),F())},[a,P]),L.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await Rt.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(ap,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(zg,{onClose:m,onClear:Hn,hasMessages:B.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Da,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Da,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&pe&&P==="chat"&&h.jsx(sp,{message:pe,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:ve,children:h.jsx(np,{messages:B,latestInput:T,onOptionClick:ze,installedNodes:te,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(Zg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx(Hg,{input:re,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:le,onRemoveImage:Or,selectedModel:Z,onModelChange:Se})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const vp=Object.freeze(Object.defineProperty({__proto__:null,default:op},Symbol.toStringTag,{value:"Module"}));export{_p as g,pp as i,gp as m,dp as r,vp as w}; diff --git a/dist/copilot_web/workflowChat-DztaEqXX.js b/dist/copilot_web/workflowChat-DztaEqXX.js new file mode 100644 index 0000000..8397028 --- /dev/null +++ b/dist/copilot_web/workflowChat-DztaEqXX.js @@ -0,0 +1,129 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-Ci2jcBGf.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"])))=>i.map(i=>d[i]); +import{_ as Ot}from"./input.js";import{j as h,r as xg,b as yg}from"./vendor-markdown-Dek94WS0.js";import{r as I,R as wn,c as Rt}from"./vendor-react-V04_Axys.js";import{f as wg,v as bg,W as ft,a as fn,B as Sg,U as Ag,A as Er,b as Eg,g as en,c as Mt,u as ts,M as Ig}from"./message-components-BQDbTDiL.js";/** + * @license lucide-react v0.475.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Cg=m=>m.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Da=(...m)=>m.filter((b,a,U)=>!!b&&b.trim()!==""&&U.indexOf(b)===a).join(" ").trim();/** + * @license lucide-react v0.475.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var Ng={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.475.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Lg=I.forwardRef(({color:m="currentColor",size:b=24,strokeWidth:a=2,absoluteStrokeWidth:U,className:M="",children:E,iconNode:W,...re},y)=>I.createElement("svg",{ref:y,...Ng,width:b,height:b,stroke:m,strokeWidth:U?Number(a)*24/Number(b):a,className:Da("lucide",M),...re},[...W.map(([q,$])=>I.createElement(q,$)),...Array.isArray(E)?E:[E]]));/** + * @license lucide-react v0.475.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ct=(m,b)=>{const a=I.forwardRef(({className:U,...M},E)=>I.createElement(Lg,{ref:E,iconNode:b,className:Da(`lucide-${Cg(m)}`,U),...M}));return a.displayName=`${m}`,a};/** + * @license lucide-react v0.475.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Tg=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Rg=ct("Image",Tg);/** + * @license lucide-react v0.475.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Og=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Mg=ct("Plus",Og);/** + * @license lucide-react v0.475.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Dg=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Pg=ct("Send",Dg);/** + * @license lucide-react v0.475.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kg=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Wg=ct("Settings",kg);/** + * @license lucide-react v0.475.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Bg=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]],Ug=ct("Trash",Bg);/** + * @license lucide-react v0.475.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Fg=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ns=ct("X",Fg);function jg({isOpen:m,onClose:b,onSave:a,initialApiKey:U=""}){const[M,E]=I.useState(U),[W,re]=I.useState(!1),[y,q]=I.useState(""),[$,P]=I.useState("https://api.openai.com/v1"),[_e,ce]=I.useState(!1),[he,ie]=I.useState(!1),[F,T]=I.useState(null),[de,ne]=I.useState(null);I.useEffect(()=>{E(U);const H=localStorage.getItem("openaiApiKey"),Z=localStorage.getItem("openaiBaseUrl");H&&q(H),Z&&P(Z),(async()=>{try{const ve=localStorage.getItem("rsaPublicKey");if(ve)ne(ve);else{const bn=await wg();ne(bn),localStorage.setItem("rsaPublicKey",bn)}}catch(ve){console.error("Failed to fetch RSA public key:",ve)}})()},[U]);const le=async()=>{if(!y.trim()){T({success:!1,message:"Please enter an OpenAI API key"});return}if(!de){T({success:!1,message:"RSA public key not available. Please try again later."});return}ie(!0),T(null);try{const H=await bg(y,$,de);T({success:H,message:H?"API key is valid!":"Invalid API key. Please check and try again."})}catch(H){T({success:!1,message:H instanceof Error?H.message:"Failed to verify API key"})}finally{ie(!1)}},se=()=>{a(M),y.trim()?(localStorage.setItem("openaiApiKey",y),localStorage.setItem("openaiBaseUrl",$)):(localStorage.removeItem("openaiApiKey"),localStorage.removeItem("openaiBaseUrl")),b()};return m?h.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",children:h.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl p-8 w-[480px] shadow-2xl",children:[h.jsx("h2",{className:"text-xl text-gray-900 dark:text-white font-semibold mb-6",children:"Set API Key"}),h.jsxs("div",{className:"mb-6",children:[h.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"ComfyUI Copilot API Key"}),h.jsxs("div",{className:"relative",children:[h.jsx("input",{type:W?"text":"password",value:M,onChange:H=>E(H.target.value),placeholder:"Enter your API key",className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg mb-4 pr-12 + bg-gray-50 dark:bg-gray-700 + text-gray-900 dark:text-white + placeholder-gray-500 dark:placeholder-gray-400 + focus:border-blue-500 dark:focus:border-blue-400 + focus:ring-2 focus:ring-blue-500/20 dark:focus:ring-blue-400/20 + focus:outline-none`}),h.jsx("button",{type:"button",className:`absolute inset-y-0 right-0 pr-4 flex items-center text-gray-500 dark:text-gray-400 + hover:text-gray-700 dark:hover:text-gray-200 transition-colors bg-transparent border-none`,onClick:()=>re(!W),children:W?h.jsxs("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}):h.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})})})]}),h.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:[h.jsx("span",{children:"Don't have an API key? "}),h.jsx("a",{href:"https://form.typeform.com/to/tkg91K8D",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:"Click here to request one"})]})]}),h.jsxs("div",{className:"mb-6 border-t border-gray-200 dark:border-gray-700 pt-6",children:[h.jsx("h3",{className:"text-sm text-gray-900 dark:text-white font-medium mb-4",children:"OpenAI API Configuration (Optional)"}),h.jsxs("div",{className:"mb-4",children:[h.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-2",children:"OpenAI API Key"}),h.jsxs("div",{className:"relative",children:[h.jsx("input",{type:_e?"text":"password",value:y,onChange:H=>q(H.target.value),placeholder:"Enter your OpenAI API key",className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg pr-12 text-xs + bg-gray-50 dark:bg-gray-700 + text-gray-900 dark:text-white + placeholder-gray-500 dark:placeholder-gray-400 + focus:border-blue-500 dark:focus:border-blue-400 + focus:ring-2 focus:ring-blue-500/20 dark:focus:ring-blue-400/20 + focus:outline-none`}),h.jsx("button",{type:"button",className:`absolute inset-y-0 right-0 pr-4 flex items-center text-gray-500 dark:text-gray-400 + hover:text-gray-700 dark:hover:text-gray-200 transition-colors bg-transparent border-none`,onClick:()=>ce(!_e),children:_e?h.jsxs("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}):h.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})})})]})]}),h.jsxs("div",{className:"mb-4",children:[h.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-2",children:"OpenAI Base URL"}),h.jsx("input",{type:"text",value:$,onChange:H=>P(H.target.value),placeholder:"https://api.openai.com/v1",className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-xs + bg-gray-50 dark:bg-gray-700 + text-gray-900 dark:text-white + placeholder-gray-500 dark:placeholder-gray-400 + focus:border-blue-500 dark:focus:border-blue-400 + focus:ring-2 focus:ring-blue-500/20 dark:focus:ring-blue-400/20 + focus:outline-none`})]}),h.jsx("div",{className:"flex items-center mb-2",children:h.jsx("button",{onClick:le,disabled:he||!y.trim(),className:`px-4 py-2 rounded-lg font-medium text-xs transition-colors ${he||!y.trim()?"bg-gray-300 dark:bg-gray-600 text-gray-500 dark:text-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white"}`,children:he?h.jsxs("span",{className:"flex items-center",children:[h.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Verifying..."]}):"Verify"})}),F&&h.jsx("div",{className:`text-xs p-2 rounded-md ${F.success?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400"}`,children:F.message})]}),h.jsxs("div",{className:"flex justify-end gap-3",children:[h.jsx("button",{onClick:b,className:`px-5 py-2.5 text-gray-700 bg-white dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 + rounded-lg font-medium transition-colors`,children:"Cancel"}),h.jsx("button",{onClick:se,className:`px-5 py-2.5 bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 + text-white rounded-lg font-medium transition-colors`,children:"Save"})]})]})}):null}const Gg="/copilot_web/assets/logo-BTZhX0BN.png";function Kg({onClose:m,onClear:b,hasMessages:a,onHeightResize:U,title:M="ComfyUI-Copilot"}){const[E,W]=I.useState(!1),[re,y]=I.useState(!1),q=()=>{W(!0)},$=P=>{localStorage.setItem("chatApiKey",P)};return I.useEffect(()=>{const P=ce=>{if(!re)return;const he=ce.movementY;U?.(he)},_e=()=>{y(!1)};return re&&(document.addEventListener("mousemove",P),document.addEventListener("mouseup",_e)),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",_e)}},[re,U]),h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:`flex items-center justify-between border-b px-3 py-2 + bg-white border-gray-200 sticky top-2 z-10`,children:[h.jsxs("div",{className:"flex items-center space-x-1",children:[h.jsx("img",{src:Gg,alt:"ComfyUI-Copilot Logo",className:"h-7 w-7 -ml-1"}),h.jsx("h3",{className:"text-[14px] font-medium text-gray-800",children:M}),h.jsx("button",{onClick:q,className:"p-1 bg-white border-none hover:bg-gray-100 rounded text-gray-500",children:h.jsx(Wg,{className:"h-4 w-4"})})]}),h.jsx("div",{className:"flex items-center gap-1",children:h.jsx("button",{className:`inline-flex bg-white border-none items-center justify-center rounded-md p-1.5 + ${a?"text-gray-500 hover:bg-gray-100":"text-gray-300 cursor-not-allowed"}`,disabled:!a,onClick:b,children:h.jsx(Ug,{className:"h-4 w-4"})})})]}),h.jsx(jg,{isOpen:E,onClose:()=>W(!1),onSave:$,initialApiKey:localStorage.getItem("chatApiKey")||""})]})}const zg=5*1024*1024,Oa=["image/jpeg","image/png","image/gif","image/webp"];function $g({input:m,loading:b,onChange:a,onSend:U,onKeyPress:M,onUploadImages:E,uploadedImages:W,onRemoveImage:re,selectedModel:y,onModelChange:q}){const[$,P]=I.useState(!1),[_e,ce]=I.useState([]),he=wn.useRef(null),ie=I.useRef(null);I.useEffect(()=>{ie.current&&(ie.current.style.height="auto",ie.current.style.height=`${Math.min(ie.current.scrollHeight,400)}px`)},[m]),I.useEffect(()=>{(async()=>{try{const de=await ft.listModels();ce(de.models)}catch(de){console.error("Failed to load models:",de),ce([{name:"gpt-4o",image_enable:!0},{name:"gpt-4o-mini",image_enable:!0},{name:"qwen-plus",image_enable:!1},{name:"DeepSeek-V3",image_enable:!1}])}})()},[]);const F=T=>{if(T.target.files){const de=[],ne=[];if(Array.from(T.target.files).forEach(le=>{Oa.includes(le.type)?le.size>zg?de.push(`${le.name} (exceeds 5MB)`):ne.push(le):de.push(`${le.name} (unsupported format)`)}),de.length>0&&alert(`The following files couldn't be uploaded: +${de.join(` +`)}`),ne.length>0){const le=new DataTransfer;ne.forEach(se=>le.items.add(se)),E(le.files)}}};return h.jsxs("div",{className:`relative ${W.length>0?"mt-12":""}`,children:[W.length>0&&h.jsx("div",{className:"absolute -top-10 left-0 flex gap-2",children:W.map(T=>h.jsxs("div",{className:"relative group",children:[h.jsx("img",{src:T.preview,alt:"uploaded",className:"w-8 h-8 rounded object-cover"}),h.jsx("button",{onClick:()=>re(T.id),className:`absolute -top-1 -right-1 bg-white border-none text-gray-500 rounded-full p-0.5 + opacity-0 group-hover:opacity-100 transition-opacity`,children:h.jsx(ns,{className:"w-3 h-3"})})]},T.id))}),h.jsx("textarea",{ref:ie,onChange:a,onKeyDown:T=>{if(T.key==="Enter"&&!T.shiftKey){if(T.nativeEvent.isComposing)return;T.preventDefault(),m.trim()!==""&&U()}M(T)},value:m,placeholder:"Type your message...",className:`w-full min-h-[80px] max-h-[400px] resize-none rounded-md border + border-gray-200 px-3 py-2 pr-12 pb-10 text-[14px] shadow-sm + focus:outline-none focus:ring-2 focus:ring-blue-500 + focus:border-transparent bg-white transition-all + duration-200 text-gray-700 overflow-y-auto`,style:{height:"80px"}}),h.jsxs("div",{className:`absolute bottom-2 left-3 right-12 flex items-center gap-2 + bg-white border-t border-gray-100 pt-1`,children:[h.jsx("select",{value:y,onChange:T=>q(T.target.value),className:`px-1.5 py-0.5 text-xs rounded-md + border border-gray-200 bg-white text-gray-700 + focus:outline-none focus:ring-2 focus:ring-blue-500 + focus:border-transparent hover:bg-gray-50 + transition-colors border-0`,children:_e.map(T=>h.jsx("option",{value:T.name,children:T.name},T.name))}),h.jsx("button",{type:"button",onClick:()=>P(!0),disabled:!_e.find(T=>T.name===y)?.image_enable,className:`p-1.5 text-gray-500 bg-white border-none + hover:bg-gray-100 hover:text-gray-600 + transition-all duration-200 outline-none + ${_e.find(T=>T.name===y)?.image_enable?"":"opacity-50 cursor-not-allowed"}`,children:h.jsx(Rg,{className:"h-4 w-4"})})]}),h.jsx("button",{type:"submit",onClick:U,disabled:b||m.trim()==="",className:`absolute bottom-3 right-3 p-2 rounded-md text-gray-500 bg-white border-none + hover:bg-gray-100 hover:text-gray-600 disabled:opacity-50 + transition-all duration-200 active:scale-95`,children:b?h.jsx("div",{className:`h-5 w-5 animate-spin rounded-full + border-2 border-gray-300 border-t-blue-500`}):h.jsx(Pg,{className:"h-5 w-5 group-hover:translate-x-1"})}),$&&h.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:h.jsxs("div",{className:"bg-white rounded-lg p-6 w-96 relative",children:[h.jsx("button",{onClick:()=>P(!1),className:"absolute top-2 right-2 bg-white border-none text-gray-500 hover:text-gray-700",children:h.jsx(ns,{className:"w-5 h-5"})}),h.jsx("h3",{className:"text-lg text-gray-800 font-medium mb-4",children:"Upload Images"}),h.jsxs("div",{className:`border-2 border-dashed border-gray-300 rounded-lg p-8 + flex flex-col items-center justify-center gap-4 + hover:border-blue-500 transition-colors cursor-pointer`,onClick:()=>he.current?.click(),children:[h.jsx(Mg,{className:"w-8 h-8 text-gray-400"}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-sm text-gray-500 mb-2",children:"Click to upload images or drag and drop"}),h.jsx("p",{className:"text-xs text-gray-400",children:"Supported formats: JPG, PNG, GIF, WebP"}),h.jsx("p",{className:"text-xs text-gray-400",children:"Max file size: 5MB"})]})]}),h.jsx("input",{ref:he,type:"file",multiple:!0,accept:Oa.join(","),onChange:F,className:"hidden"}),W.length>0&&h.jsx("div",{className:"mt-4 grid grid-cols-3 gap-2",children:W.map(T=>h.jsxs("div",{className:"relative group",children:[h.jsx("img",{src:T.preview,alt:"preview",className:"w-full h-20 object-cover rounded"}),h.jsx("button",{onClick:()=>re(T.id),className:`absolute -top-1 -right-1 bg-white border-none text-gray-500 + rounded-full p-0.5 opacity-0 group-hover:opacity-100 + transition-opacity`,children:h.jsx(ns,{className:"w-3 h-3"})})]},T.id))}),h.jsx("div",{className:"mt-4 flex justify-end gap-2",children:h.jsx("button",{onClick:()=>P(!1),className:`px-4 py-2 text-sm font-medium text-gray-700 + bg-white border border-gray-300 rounded-md + hover:bg-gray-50`,children:"Close"})})]})})]})}function Hg(m){const b=m[0],a=new Set;function U(M,E){if(!(!M||E>=1)&&M.inputs)for(const W of Object.values(M.inputs)){const re=W.link;if(re&&fn.graph.links[re]){const y=fn.graph.links[re].origin_id,q=fn.graph._nodes_by_id[y];q&&(a.add(q.type),U(q,E+1))}}}return b?(U(b,0),[{type:"upstream_node_types",data:Array.from(a)}]):null}function qg({nodeInfo:m,onSendWithIntent:b,loading:a,onSendWithContent:U}){return console.log("SelectedNodeInfo nodeInfo:",m[0]),h.jsx("div",{className:"mb-3 p-3 rounded-md bg-gray-50 border border-gray-200",children:h.jsxs("div",{className:"text-sm text-gray-700",children:[h.jsxs("p",{children:["Selected node: ",m[0].type]}),h.jsxs("div",{className:"flex gap-2 mt-2",children:[h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-blue-50 + text-blue-700 hover:bg-blue-100`,onClick:()=>U(`Reply in ${navigator.language} language: How does the ${m[0].type} node work? I need its official usage guide.`),disabled:a,children:"Usage"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-green-100 + text-green-700 hover:bg-green-200`,onClick:()=>U(`Reply in ${navigator.language} language: Show me the technical specifications for the ${m[0].type} node's inputs and outputs.`),disabled:a,children:"Parameters"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-purple-100 + text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import("./WorkflowOption-Ci2jcBGf.js"),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import("./message-components-BQDbTDiL.js").then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import("./message-components-BQDbTDiL.js").then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import("./message-components-BQDbTDiL.js").then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */Ir.exports;(function(m,b){(function(){var a,U="4.17.21",M=200,E="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",W="Expected a function",re="Invalid `variable` option passed into `_.template`",y="__lodash_hash_undefined__",q=500,$="__lodash_placeholder__",P=1,_e=2,ce=4,he=1,ie=2,F=1,T=2,de=4,ne=8,le=16,se=32,H=64,Z=128,Ae=256,ve=512,bn=30,Cr="...",Dt=800,Nr=16,ht=1,$n=2,Lr=3,Dn=1/0,Sn=9007199254740991,Tr=17976931348623157e292,Hn=NaN,ze=4294967295,Pt=ze-1,qn=ze>>>1,Rr=[["ary",Z],["bind",F],["bindKey",T],["curry",ne],["curryRight",le],["flip",ve],["partial",se],["partialRight",H],["rearg",Ae]],cn="[object Arguments]",Zn="[object Array]",Or="[object AsyncFunction]",Pn="[object Boolean]",An="[object Date]",Mr="[object DOMException]",A="[object Error]",j="[object Function]",me="[object GeneratorFunction]",V="[object Map]",$e="[object Number]",ke="[object Null]",ue="[object Object]",Ee="[object Promise]",We="[object Proxy]",nn="[object RegExp]",Ne="[object Set]",dt="[object String]",kt="[object Symbol]",ka="[object Undefined]",gt="[object WeakMap]",Wa="[object WeakSet]",pt="[object ArrayBuffer]",Yn="[object DataView]",Dr="[object Float32Array]",Pr="[object Float64Array]",kr="[object Int8Array]",Wr="[object Int16Array]",Br="[object Int32Array]",Ur="[object Uint8Array]",Fr="[object Uint8ClampedArray]",jr="[object Uint16Array]",Gr="[object Uint32Array]",Ba=/\b__p \+= '';/g,Ua=/\b(__p \+=) '' \+/g,Fa=/(__e\(.*?\)|\b__t\)) \+\n'';/g,rs=/&(?:amp|lt|gt|quot|#39);/g,is=/[&<>"']/g,ja=RegExp(rs.source),Ga=RegExp(is.source),Ka=/<%-([\s\S]+?)%>/g,za=/<%([\s\S]+?)%>/g,ss=/<%=([\s\S]+?)%>/g,$a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ha=/^\w*$/,qa=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Kr=/[\\^$.*+?()[\]{}|]/g,Za=RegExp(Kr.source),zr=/^\s+/,Ya=/\s/,Ja=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Xa=/\{\n\/\* \[wrapped with (.+)\] \*/,Qa=/,? & /,Va=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,eo=/[()=,{}\[\]\/\s]/,no=/\\(\\)?/g,to=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,us=/\w*$/,ro=/^[-+]0x[0-9a-f]+$/i,io=/^0b[01]+$/i,so=/^\[object .+?Constructor\]$/,uo=/^0o[0-7]+$/i,ao=/^(?:0|[1-9]\d*)$/,oo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Wt=/($^)/,lo=/['\n\r\u2028\u2029\\]/g,Bt="\\ud800-\\udfff",fo="\\u0300-\\u036f",co="\\ufe20-\\ufe2f",ho="\\u20d0-\\u20ff",as=fo+co+ho,os="\\u2700-\\u27bf",ls="a-z\\xdf-\\xf6\\xf8-\\xff",go="\\xac\\xb1\\xd7\\xf7",po="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",_o="\\u2000-\\u206f",vo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",fs="A-Z\\xc0-\\xd6\\xd8-\\xde",cs="\\ufe0e\\ufe0f",hs=go+po+_o+vo,$r="['’]",mo="["+Bt+"]",ds="["+hs+"]",Ut="["+as+"]",gs="\\d+",xo="["+os+"]",ps="["+ls+"]",_s="[^"+Bt+hs+gs+os+ls+fs+"]",Hr="\\ud83c[\\udffb-\\udfff]",yo="(?:"+Ut+"|"+Hr+")",vs="[^"+Bt+"]",qr="(?:\\ud83c[\\udde6-\\uddff]){2}",Zr="[\\ud800-\\udbff][\\udc00-\\udfff]",Jn="["+fs+"]",ms="\\u200d",xs="(?:"+ps+"|"+_s+")",wo="(?:"+Jn+"|"+_s+")",ys="(?:"+$r+"(?:d|ll|m|re|s|t|ve))?",ws="(?:"+$r+"(?:D|LL|M|RE|S|T|VE))?",bs=yo+"?",Ss="["+cs+"]?",bo="(?:"+ms+"(?:"+[vs,qr,Zr].join("|")+")"+Ss+bs+")*",So="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ao="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",As=Ss+bs+bo,Eo="(?:"+[xo,qr,Zr].join("|")+")"+As,Io="(?:"+[vs+Ut+"?",Ut,qr,Zr,mo].join("|")+")",Co=RegExp($r,"g"),No=RegExp(Ut,"g"),Yr=RegExp(Hr+"(?="+Hr+")|"+Io+As,"g"),Lo=RegExp([Jn+"?"+ps+"+"+ys+"(?="+[ds,Jn,"$"].join("|")+")",wo+"+"+ws+"(?="+[ds,Jn+xs,"$"].join("|")+")",Jn+"?"+xs+"+"+ys,Jn+"+"+ws,Ao,So,gs,Eo].join("|"),"g"),To=RegExp("["+ms+Bt+as+cs+"]"),Ro=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Oo=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Mo=-1,te={};te[Dr]=te[Pr]=te[kr]=te[Wr]=te[Br]=te[Ur]=te[Fr]=te[jr]=te[Gr]=!0,te[cn]=te[Zn]=te[pt]=te[Pn]=te[Yn]=te[An]=te[A]=te[j]=te[V]=te[$e]=te[ue]=te[nn]=te[Ne]=te[dt]=te[gt]=!1;var ee={};ee[cn]=ee[Zn]=ee[pt]=ee[Yn]=ee[Pn]=ee[An]=ee[Dr]=ee[Pr]=ee[kr]=ee[Wr]=ee[Br]=ee[V]=ee[$e]=ee[ue]=ee[nn]=ee[Ne]=ee[dt]=ee[kt]=ee[Ur]=ee[Fr]=ee[jr]=ee[Gr]=!0,ee[A]=ee[j]=ee[gt]=!1;var Do={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Po={"&":"&","<":"<",">":">",'"':""","'":"'"},ko={"&":"&","<":"<",">":">",""":'"',"'":"'"},Wo={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Bo=parseFloat,Uo=parseInt,Es=typeof Rt=="object"&&Rt&&Rt.Object===Object&&Rt,Fo=typeof self=="object"&&self&&self.Object===Object&&self,be=Es||Fo||Function("return this")(),Jr=b&&!b.nodeType&&b,kn=Jr&&!0&&m&&!m.nodeType&&m,Is=kn&&kn.exports===Jr,Xr=Is&&Es.process,He=function(){try{var f=kn&&kn.require&&kn.require("util").types;return f||Xr&&Xr.binding&&Xr.binding("util")}catch{}}(),Cs=He&&He.isArrayBuffer,Ns=He&&He.isDate,Ls=He&&He.isMap,Ts=He&&He.isRegExp,Rs=He&&He.isSet,Os=He&&He.isTypedArray;function Be(f,g,d){switch(d.length){case 0:return f.call(g);case 1:return f.call(g,d[0]);case 2:return f.call(g,d[0],d[1]);case 3:return f.call(g,d[0],d[1],d[2])}return f.apply(g,d)}function jo(f,g,d,w){for(var R=-1,Y=f==null?0:f.length;++R-1}function Qr(f,g,d){for(var w=-1,R=f==null?0:f.length;++w-1;);return d}function Fs(f,g){for(var d=f.length;d--&&Xn(g,f[d],0)>-1;);return d}function Jo(f,g){for(var d=f.length,w=0;d--;)f[d]===g&&++w;return w}var Xo=ti(Do),Qo=ti(Po);function Vo(f){return"\\"+Wo[f]}function el(f,g){return f==null?a:f[g]}function Qn(f){return To.test(f)}function nl(f){return Ro.test(f)}function tl(f){for(var g,d=[];!(g=f.next()).done;)d.push(g.value);return d}function ui(f){var g=-1,d=Array(f.size);return f.forEach(function(w,R){d[++g]=[R,w]}),d}function js(f,g){return function(d){return f(g(d))}}function Cn(f,g){for(var d=-1,w=f.length,R=0,Y=[];++d-1}function Kl(e,n){var t=this.__data__,r=rr(t,e);return r<0?(++this.size,t.push([e,n])):t[r][1]=n,this}hn.prototype.clear=Ul,hn.prototype.delete=Fl,hn.prototype.get=jl,hn.prototype.has=Gl,hn.prototype.set=Kl;function dn(e){var n=-1,t=e==null?0:e.length;for(this.clear();++n=n?e:n)),e}function Je(e,n,t,r,i,u){var o,l=n&P,c=n&_e,p=n&ce;if(t&&(o=i?t(e,r,i,u):t(e)),o!==a)return o;if(!oe(e))return e;var _=O(e);if(_){if(o=Zf(e),!l)return Oe(e,o)}else{var v=Ce(e),x=v==j||v==me;if(Mn(e))return Su(e,l);if(v==ue||v==cn||x&&!i){if(o=c||x?{}:Gu(e),!l)return c?Wf(e,uf(o,e)):kf(e,Vs(o,e))}else{if(!ee[v])return i?e:{};o=Yf(e,v,l)}}u||(u=new rn);var S=u.get(e);if(S)return S;u.set(e,o),va(e)?e.forEach(function(L){o.add(Je(L,n,t,L,e,u))}):pa(e)&&e.forEach(function(L,G){o.set(G,Je(L,n,t,G,e,u))});var N=p?c?Oi:Ri:c?De:we,k=_?a:N(e);return qe(k||e,function(L,G){k&&(G=L,L=e[G]),bt(o,G,Je(L,n,t,G,e,u))}),o}function af(e){var n=we(e);return function(t){return eu(t,e,n)}}function eu(e,n,t){var r=t.length;if(e==null)return!r;for(e=Q(e);r--;){var i=t[r],u=n[i],o=e[i];if(o===a&&!(i in e)||!u(o))return!1}return!0}function nu(e,n,t){if(typeof e!="function")throw new Ze(W);return Lt(function(){e.apply(a,t)},n)}function St(e,n,t,r){var i=-1,u=Ft,o=!0,l=e.length,c=[],p=n.length;if(!l)return c;t&&(n=ae(n,Ue(t))),r?(u=Qr,o=!1):n.length>=M&&(u=_t,o=!1,n=new Un(n));e:for(;++ii?0:i+t),r=r===a||r>i?i:D(r),r<0&&(r+=i),r=t>r?0:xa(r);t0&&t(l)?n>1?Se(l,n-1,t,r,i):In(i,l):r||(i[i.length]=l)}return i}var di=Lu(),iu=Lu(!0);function an(e,n){return e&&di(e,n,we)}function gi(e,n){return e&&iu(e,n,we)}function sr(e,n){return En(n,function(t){return mn(e[t])})}function jn(e,n){n=Rn(n,e);for(var t=0,r=n.length;e!=null&&tn}function ff(e,n){return e!=null&&X.call(e,n)}function cf(e,n){return e!=null&&n in Q(e)}function hf(e,n,t){return e>=Ie(n,t)&&e=120&&_.length>=120)?new Un(o&&_):a}_=e[0];var v=-1,x=l[0];e:for(;++v-1;)l!==e&&Jt.call(l,c,1),Jt.call(e,c,1);return e}function pu(e,n){for(var t=e?n.length:0,r=t-1;t--;){var i=n[t];if(t==r||i!==u){var u=i;vn(i)?Jt.call(e,i,1):Ai(e,i)}}return e}function wi(e,n){return e+Vt(Ys()*(n-e+1))}function Ef(e,n,t,r){for(var i=-1,u=ye(Qt((n-e)/(t||1)),0),o=d(u);u--;)o[r?u:++i]=e,e+=t;return o}function bi(e,n){var t="";if(!e||n<1||n>Sn)return t;do n%2&&(t+=e),n=Vt(n/2),n&&(e+=e);while(n);return t}function B(e,n){return Ui($u(e,n,Pe),e+"")}function If(e){return Qs(lt(e))}function Cf(e,n){var t=lt(e);return _r(t,Fn(n,0,t.length))}function It(e,n,t,r){if(!oe(e))return e;n=Rn(n,e);for(var i=-1,u=n.length,o=u-1,l=e;l!=null&&++ii?0:i+n),t=t>i?i:t,t<0&&(t+=i),i=n>t?0:t-n>>>0,n>>>=0;for(var u=d(i);++r>>1,o=e[u];o!==null&&!je(o)&&(t?o<=n:o=M){var p=n?null:jf(e);if(p)return Gt(p);o=!1,i=_t,c=new Un}else c=n?[]:l;e:for(;++r=r?e:Xe(e,n,t)}var bu=vl||function(e){return be.clearTimeout(e)};function Su(e,n){if(n)return e.slice();var t=e.length,r=zs?zs(t):new e.constructor(t);return e.copy(r),r}function Ni(e){var n=new e.constructor(e.byteLength);return new Zt(n).set(new Zt(e)),n}function Of(e,n){var t=n?Ni(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.byteLength)}function Mf(e){var n=new e.constructor(e.source,us.exec(e));return n.lastIndex=e.lastIndex,n}function Df(e){return wt?Q(wt.call(e)):{}}function Au(e,n){var t=n?Ni(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}function Eu(e,n){if(e!==n){var t=e!==a,r=e===null,i=e===e,u=je(e),o=n!==a,l=n===null,c=n===n,p=je(n);if(!l&&!p&&!u&&e>n||u&&o&&c&&!l&&!p||r&&o&&c||!t&&c||!i)return 1;if(!r&&!u&&!p&&e=l)return c;var p=t[r];return c*(p=="desc"?-1:1)}}return e.index-n.index}function Iu(e,n,t,r){for(var i=-1,u=e.length,o=t.length,l=-1,c=n.length,p=ye(u-o,0),_=d(c+p),v=!r;++l1?t[i-1]:a,o=i>2?t[2]:a;for(u=e.length>3&&typeof u=="function"?(i--,u):a,o&&Te(t[0],t[1],o)&&(u=i<3?a:u,i=1),n=Q(n);++r-1?i[u?n[o]:o]:a}}function Ou(e){return _n(function(n){var t=n.length,r=t,i=Ye.prototype.thru;for(e&&n.reverse();r--;){var u=n[r];if(typeof u!="function")throw new Ze(W);if(i&&!o&&gr(u)=="wrapper")var o=new Ye([],!0)}for(r=o?r:t;++r1&&z.reverse(),_&&cl))return!1;var p=u.get(e),_=u.get(n);if(p&&_)return p==n&&_==e;var v=-1,x=!0,S=t&ie?new Un:a;for(u.set(e,n),u.set(n,e);++v1?"& ":"")+n[r],n=n.join(t>2?", ":" "),e.replace(Ja,`{ +/* [wrapped with `+n+`] */ +`)}function Xf(e){return O(e)||zn(e)||!!(qs&&e&&e[qs])}function vn(e,n){var t=typeof e;return n=n??Sn,!!n&&(t=="number"||t!="symbol"&&ao.test(e))&&e>-1&&e%1==0&&e0){if(++n>=Dt)return arguments[0]}else n=0;return e.apply(a,arguments)}}function _r(e,n){var t=-1,r=e.length,i=r-1;for(n=n===a?r:n;++t1?e[n-1]:a;return t=typeof t=="function"?(e.pop(),t):a,ra(e,t)});function ia(e){var n=s(e);return n.__chain__=!0,n}function oh(e,n){return n(e),e}function vr(e,n){return n(e)}var lh=_n(function(e){var n=e.length,t=n?e[0]:0,r=this.__wrapped__,i=function(u){return hi(u,e)};return n>1||this.__actions__.length||!(r instanceof K)||!vn(t)?this.thru(i):(r=r.slice(t,+t+(n?1:0)),r.__actions__.push({func:vr,args:[i],thisArg:a}),new Ye(r,this.__chain__).thru(function(u){return n&&!u.length&&u.push(a),u}))});function fh(){return ia(this)}function ch(){return new Ye(this.value(),this.__chain__)}function hh(){this.__values__===a&&(this.__values__=ma(this.value()));var e=this.__index__>=this.__values__.length,n=e?a:this.__values__[this.__index__++];return{done:e,value:n}}function dh(){return this}function gh(e){for(var n,t=this;t instanceof tr;){var r=Xu(t);r.__index__=0,r.__values__=a,n?i.__wrapped__=r:n=r;var i=r;t=t.__wrapped__}return i.__wrapped__=e,n}function ph(){var e=this.__wrapped__;if(e instanceof K){var n=e;return this.__actions__.length&&(n=new K(this)),n=n.reverse(),n.__actions__.push({func:vr,args:[Fi],thisArg:a}),new Ye(n,this.__chain__)}return this.thru(Fi)}function _h(){return yu(this.__wrapped__,this.__actions__)}var vh=lr(function(e,n,t){X.call(e,t)?++e[t]:gn(e,t,1)});function mh(e,n,t){var r=O(e)?Ms:of;return t&&Te(e,n,t)&&(n=a),r(e,C(n,3))}function xh(e,n){var t=O(e)?En:ru;return t(e,C(n,3))}var yh=Ru(Qu),wh=Ru(Vu);function bh(e,n){return Se(mr(e,n),1)}function Sh(e,n){return Se(mr(e,n),Dn)}function Ah(e,n,t){return t=t===a?1:D(t),Se(mr(e,n),t)}function sa(e,n){var t=O(e)?qe:Ln;return t(e,C(n,3))}function ua(e,n){var t=O(e)?Go:tu;return t(e,C(n,3))}var Eh=lr(function(e,n,t){X.call(e,t)?e[t].push(n):gn(e,t,[n])});function Ih(e,n,t,r){e=Me(e)?e:lt(e),t=t&&!r?D(t):0;var i=e.length;return t<0&&(t=ye(i+t,0)),Sr(e)?t<=i&&e.indexOf(n,t)>-1:!!i&&Xn(e,n,t)>-1}var Ch=B(function(e,n,t){var r=-1,i=typeof n=="function",u=Me(e)?d(e.length):[];return Ln(e,function(o){u[++r]=i?Be(n,o,t):At(o,n,t)}),u}),Nh=lr(function(e,n,t){gn(e,t,n)});function mr(e,n){var t=O(e)?ae:lu;return t(e,C(n,3))}function Lh(e,n,t,r){return e==null?[]:(O(n)||(n=n==null?[]:[n]),t=r?a:t,O(t)||(t=t==null?[]:[t]),du(e,n,t))}var Th=lr(function(e,n,t){e[t?0:1].push(n)},function(){return[[],[]]});function Rh(e,n,t){var r=O(e)?Vr:Ws,i=arguments.length<3;return r(e,C(n,4),t,i,Ln)}function Oh(e,n,t){var r=O(e)?Ko:Ws,i=arguments.length<3;return r(e,C(n,4),t,i,tu)}function Mh(e,n){var t=O(e)?En:ru;return t(e,wr(C(n,3)))}function Dh(e){var n=O(e)?Qs:If;return n(e)}function Ph(e,n,t){(t?Te(e,n,t):n===a)?n=1:n=D(n);var r=O(e)?tf:Cf;return r(e,n)}function kh(e){var n=O(e)?rf:Lf;return n(e)}function Wh(e){if(e==null)return 0;if(Me(e))return Sr(e)?Vn(e):e.length;var n=Ce(e);return n==V||n==Ne?e.size:mi(e).length}function Bh(e,n,t){var r=O(e)?ei:Tf;return t&&Te(e,n,t)&&(n=a),r(e,C(n,3))}var Uh=B(function(e,n){if(e==null)return[];var t=n.length;return t>1&&Te(e,n[0],n[1])?n=[]:t>2&&Te(n[0],n[1],n[2])&&(n=[n[0]]),du(e,Se(n,1),[])}),xr=ml||function(){return be.Date.now()};function Fh(e,n){if(typeof n!="function")throw new Ze(W);return e=D(e),function(){if(--e<1)return n.apply(this,arguments)}}function aa(e,n,t){return n=t?a:n,n=e&&n==null?e.length:n,pn(e,Z,a,a,a,a,n)}function oa(e,n){var t;if(typeof n!="function")throw new Ze(W);return e=D(e),function(){return--e>0&&(t=n.apply(this,arguments)),e<=1&&(n=a),t}}var Gi=B(function(e,n,t){var r=F;if(t.length){var i=Cn(t,at(Gi));r|=se}return pn(e,r,n,t,i)}),la=B(function(e,n,t){var r=F|T;if(t.length){var i=Cn(t,at(la));r|=se}return pn(n,r,e,t,i)});function fa(e,n,t){n=t?a:n;var r=pn(e,ne,a,a,a,a,a,n);return r.placeholder=fa.placeholder,r}function ca(e,n,t){n=t?a:n;var r=pn(e,le,a,a,a,a,a,n);return r.placeholder=ca.placeholder,r}function ha(e,n,t){var r,i,u,o,l,c,p=0,_=!1,v=!1,x=!0;if(typeof e!="function")throw new Ze(W);n=Ve(n)||0,oe(t)&&(_=!!t.leading,v="maxWait"in t,u=v?ye(Ve(t.maxWait)||0,n):u,x="trailing"in t?!!t.trailing:x);function S(pe){var un=r,yn=i;return r=i=a,p=pe,o=e.apply(yn,un),o}function N(pe){return p=pe,l=Lt(G,n),_?S(pe):o}function k(pe){var un=pe-c,yn=pe-p,Ra=n-un;return v?Ie(Ra,u-yn):Ra}function L(pe){var un=pe-c,yn=pe-p;return c===a||un>=n||un<0||v&&yn>=u}function G(){var pe=xr();if(L(pe))return z(pe);l=Lt(G,k(pe))}function z(pe){return l=a,x&&r?S(pe):(r=i=a,o)}function Ge(){l!==a&&bu(l),p=0,r=c=i=l=a}function Re(){return l===a?o:z(xr())}function Ke(){var pe=xr(),un=L(pe);if(r=arguments,i=this,c=pe,un){if(l===a)return N(c);if(v)return bu(l),l=Lt(G,n),S(c)}return l===a&&(l=Lt(G,n)),o}return Ke.cancel=Ge,Ke.flush=Re,Ke}var jh=B(function(e,n){return nu(e,1,n)}),Gh=B(function(e,n,t){return nu(e,Ve(n)||0,t)});function Kh(e){return pn(e,ve)}function yr(e,n){if(typeof e!="function"||n!=null&&typeof n!="function")throw new Ze(W);var t=function(){var r=arguments,i=n?n.apply(this,r):r[0],u=t.cache;if(u.has(i))return u.get(i);var o=e.apply(this,r);return t.cache=u.set(i,o)||u,o};return t.cache=new(yr.Cache||dn),t}yr.Cache=dn;function wr(e){if(typeof e!="function")throw new Ze(W);return function(){var n=arguments;switch(n.length){case 0:return!e.call(this);case 1:return!e.call(this,n[0]);case 2:return!e.call(this,n[0],n[1]);case 3:return!e.call(this,n[0],n[1],n[2])}return!e.apply(this,n)}}function zh(e){return oa(2,e)}var $h=Rf(function(e,n){n=n.length==1&&O(n[0])?ae(n[0],Ue(C())):ae(Se(n,1),Ue(C()));var t=n.length;return B(function(r){for(var i=-1,u=Ie(r.length,t);++i=n}),zn=uu(function(){return arguments}())?uu:function(e){return fe(e)&&X.call(e,"callee")&&!Hs.call(e,"callee")},O=d.isArray,ud=Cs?Ue(Cs):gf;function Me(e){return e!=null&&br(e.length)&&!mn(e)}function ge(e){return fe(e)&&Me(e)}function ad(e){return e===!0||e===!1||fe(e)&&Le(e)==Pn}var Mn=yl||es,od=Ns?Ue(Ns):pf;function ld(e){return fe(e)&&e.nodeType===1&&!Tt(e)}function fd(e){if(e==null)return!0;if(Me(e)&&(O(e)||typeof e=="string"||typeof e.splice=="function"||Mn(e)||ot(e)||zn(e)))return!e.length;var n=Ce(e);if(n==V||n==Ne)return!e.size;if(Nt(e))return!mi(e).length;for(var t in e)if(X.call(e,t))return!1;return!0}function cd(e,n){return Et(e,n)}function hd(e,n,t){t=typeof t=="function"?t:a;var r=t?t(e,n):a;return r===a?Et(e,n,a,t):!!r}function zi(e){if(!fe(e))return!1;var n=Le(e);return n==A||n==Mr||typeof e.message=="string"&&typeof e.name=="string"&&!Tt(e)}function dd(e){return typeof e=="number"&&Zs(e)}function mn(e){if(!oe(e))return!1;var n=Le(e);return n==j||n==me||n==Or||n==We}function ga(e){return typeof e=="number"&&e==D(e)}function br(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Sn}function oe(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}function fe(e){return e!=null&&typeof e=="object"}var pa=Ls?Ue(Ls):vf;function gd(e,n){return e===n||vi(e,n,Di(n))}function pd(e,n,t){return t=typeof t=="function"?t:a,vi(e,n,Di(n),t)}function _d(e){return _a(e)&&e!=+e}function vd(e){if(ec(e))throw new R(E);return au(e)}function md(e){return e===null}function xd(e){return e==null}function _a(e){return typeof e=="number"||fe(e)&&Le(e)==$e}function Tt(e){if(!fe(e)||Le(e)!=ue)return!1;var n=Yt(e);if(n===null)return!0;var t=X.call(n,"constructor")&&n.constructor;return typeof t=="function"&&t instanceof t&&$t.call(t)==gl}var $i=Ts?Ue(Ts):mf;function yd(e){return ga(e)&&e>=-9007199254740991&&e<=Sn}var va=Rs?Ue(Rs):xf;function Sr(e){return typeof e=="string"||!O(e)&&fe(e)&&Le(e)==dt}function je(e){return typeof e=="symbol"||fe(e)&&Le(e)==kt}var ot=Os?Ue(Os):yf;function wd(e){return e===a}function bd(e){return fe(e)&&Ce(e)==gt}function Sd(e){return fe(e)&&Le(e)==Wa}var Ad=dr(xi),Ed=dr(function(e,n){return e<=n});function ma(e){if(!e)return[];if(Me(e))return Sr(e)?tn(e):Oe(e);if(vt&&e[vt])return tl(e[vt]());var n=Ce(e),t=n==V?ui:n==Ne?Gt:lt;return t(e)}function xn(e){if(!e)return e===0?e:0;if(e=Ve(e),e===Dn||e===-1/0){var n=e<0?-1:1;return n*Tr}return e===e?e:0}function D(e){var n=xn(e),t=n%1;return n===n?t?n-t:n:0}function xa(e){return e?Fn(D(e),0,ze):0}function Ve(e){if(typeof e=="number")return e;if(je(e))return Hn;if(oe(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=oe(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Bs(e);var t=io.test(e);return t||uo.test(e)?Uo(e.slice(2),t?2:8):ro.test(e)?Hn:+e}function ya(e){return on(e,De(e))}function Id(e){return e?Fn(D(e),-9007199254740991,Sn):e===0?e:0}function J(e){return e==null?"":Fe(e)}var Cd=st(function(e,n){if(Nt(n)||Me(n)){on(n,we(n),e);return}for(var t in n)X.call(n,t)&&bt(e,t,n[t])}),wa=st(function(e,n){on(n,De(n),e)}),Ar=st(function(e,n,t,r){on(n,De(n),e,r)}),Nd=st(function(e,n,t,r){on(n,we(n),e,r)}),Ld=_n(hi);function Td(e,n){var t=it(e);return n==null?t:Vs(t,n)}var Rd=B(function(e,n){e=Q(e);var t=-1,r=n.length,i=r>2?n[2]:a;for(i&&Te(n[0],n[1],i)&&(r=1);++t1),u}),on(e,Oi(e),t),r&&(t=Je(t,P|_e|ce,Gf));for(var i=n.length;i--;)Ai(t,n[i]);return t});function Yd(e,n){return Sa(e,wr(C(n)))}var Jd=_n(function(e,n){return e==null?{}:Sf(e,n)});function Sa(e,n){if(e==null)return{};var t=ae(Oi(e),function(r){return[r]});return n=C(n),gu(e,t,function(r,i){return n(r,i[0])})}function Xd(e,n,t){n=Rn(n,e);var r=-1,i=n.length;for(i||(i=1,e=a);++rn){var r=e;e=n,n=r}if(t||e%1||n%1){var i=Ys();return Ie(e+i*(n-e+Bo("1e-"+((i+"").length-1))),n)}return wi(e,n)}var o0=ut(function(e,n,t){return n=n.toLowerCase(),e+(t?Ia(n):n)});function Ia(e){return Zi(J(e).toLowerCase())}function Ca(e){return e=J(e),e&&e.replace(oo,Xo).replace(No,"")}function l0(e,n,t){e=J(e),n=Fe(n);var r=e.length;t=t===a?r:Fn(D(t),0,r);var i=t;return t-=n.length,t>=0&&e.slice(t,i)==n}function f0(e){return e=J(e),e&&Ga.test(e)?e.replace(is,Qo):e}function c0(e){return e=J(e),e&&Za.test(e)?e.replace(Kr,"\\$&"):e}var h0=ut(function(e,n,t){return e+(t?"-":"")+n.toLowerCase()}),d0=ut(function(e,n,t){return e+(t?" ":"")+n.toLowerCase()}),g0=Tu("toLowerCase");function p0(e,n,t){e=J(e),n=D(n);var r=n?Vn(e):0;if(!n||r>=n)return e;var i=(n-r)/2;return hr(Vt(i),t)+e+hr(Qt(i),t)}function _0(e,n,t){e=J(e),n=D(n);var r=n?Vn(e):0;return n&&r>>0,t?(e=J(e),e&&(typeof n=="string"||n!=null&&!$i(n))&&(n=Fe(n),!n&&Qn(e))?On(tn(e),0,t):e.split(n,t)):[]}var S0=ut(function(e,n,t){return e+(t?" ":"")+Zi(n)});function A0(e,n,t){return e=J(e),t=t==null?0:Fn(D(t),0,e.length),n=Fe(n),e.slice(t,t+n.length)==n}function E0(e,n,t){var r=s.templateSettings;t&&Te(e,n,t)&&(n=a),e=J(e),n=Ar({},n,r,Wu);var i=Ar({},n.imports,r.imports,Wu),u=we(i),o=si(i,u),l,c,p=0,_=n.interpolate||Wt,v="__p += '",x=ai((n.escape||Wt).source+"|"+_.source+"|"+(_===ss?to:Wt).source+"|"+(n.evaluate||Wt).source+"|$","g"),S="//# sourceURL="+(X.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Mo+"]")+` +`;e.replace(x,function(L,G,z,Ge,Re,Ke){return z||(z=Ge),v+=e.slice(p,Ke).replace(lo,Vo),G&&(l=!0,v+=`' + +__e(`+G+`) + +'`),Re&&(c=!0,v+=`'; +`+Re+`; +__p += '`),z&&(v+=`' + +((__t = (`+z+`)) == null ? '' : __t) + +'`),p=Ke+L.length,L}),v+=`'; +`;var N=X.call(n,"variable")&&n.variable;if(!N)v=`with (obj) { +`+v+` +} +`;else if(eo.test(N))throw new R(re);v=(c?v.replace(Ba,""):v).replace(Ua,"$1").replace(Fa,"$1;"),v="function("+(N||"obj")+`) { +`+(N?"":`obj || (obj = {}); +`)+"var __t, __p = ''"+(l?", __e = _.escape":"")+(c?`, __j = Array.prototype.join; +function print() { __p += __j.call(arguments, '') } +`:`; +`)+v+`return __p +}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import("./ParameterDebugInterfaceV2-xZYi4DyT.js"),__vite__mapDeps([4,1,2,3,5,6,7])).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w}; diff --git a/pyproject.toml b/pyproject.toml index d576389..daaea80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "ComfyUI-Copilot" description = "Your Intelligent Assistant for Comfy-UI." -version = "1.3.1" +version = "1.3.2" license = {file = "LICENSE"} [project.urls] diff --git a/ui/src/apis/workflowChatApi.ts b/ui/src/apis/workflowChatApi.ts index fa3029d..84e046c 100644 --- a/ui/src/apis/workflowChatApi.ts +++ b/ui/src/apis/workflowChatApi.ts @@ -480,6 +480,29 @@ export namespace WorkflowChatAPI { // This should never be reached due to the throw in the loop, but TypeScript needs it throw lastError; } + + export async function listModels(): Promise<{ models: { name: string; image_enable: boolean }[] }> { + const apiKey = getApiKey(); + const browserLanguage = getBrowserLanguage(); + + // Prepare headers + const headers: Record = { + 'Content-Type': 'application/json', + 'accept': 'application/json', + 'Authorization': `Bearer ${apiKey}`, + 'trace-id': generateUUID(), + 'Accept-Language': browserLanguage, + }; + + const response = await fetch(`${BASE_URL}/v1/models`, { + method: 'GET', + headers, + }); + + const result = await response.json(); + + return result as { models: { name: string; image_enable: boolean }[] }; + } } diff --git a/ui/src/components/chat/ChatInput.tsx b/ui/src/components/chat/ChatInput.tsx index 98c341c..385a99f 100644 --- a/ui/src/components/chat/ChatInput.tsx +++ b/ui/src/components/chat/ChatInput.tsx @@ -4,6 +4,7 @@ import { ChangeEvent, KeyboardEvent, useState, useRef, useEffect } from 'react'; import { SendIcon, ImageIcon, PlusIcon, XIcon } from './Icons'; import React from 'react'; +import { WorkflowChatAPI } from '../../apis/workflowChatApi'; interface ChatInputProps { input: string; @@ -27,25 +28,6 @@ export interface UploadedImage { const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB const SUPPORTED_FORMATS = ['image/jpeg', 'image/png', 'image/gif', 'image/webp']; -const models_conf = [ - { - "name": "gpt-4o", - "image_enable": true - }, - { - "name": "gpt-4o-mini", - "image_enable": true - }, - { - "name": "qwen-plus", - "image_enable": false - }, - { - "name": "DeepSeek-V3", - "image_enable": false - } -] - export function ChatInput({ input, loading, @@ -59,6 +41,7 @@ export function ChatInput({ onModelChange, }: ChatInputProps) { const [showUploadModal, setShowUploadModal] = useState(false); + const [models, setModels] = useState<{ name: string; image_enable: boolean }[]>([]); const fileInputRef = React.useRef(null); const textareaRef = useRef(null); @@ -72,6 +55,39 @@ export function ChatInput({ } }, [input]); + // Load models on component mount + useEffect(() => { + const loadModels = async () => { + try { + const result = await WorkflowChatAPI.listModels(); + setModels(result.models); + } catch (error) { + console.error('Failed to load models:', error); + // Fallback to default models if API fails + setModels([ + { + "name": "gpt-4o", + "image_enable": true + }, + { + "name": "gpt-4o-mini", + "image_enable": true + }, + { + "name": "qwen-plus", + "image_enable": false + }, + { + "name": "DeepSeek-V3", + "image_enable": false + } + ]); + } + }; + + loadModels(); + }, []); + const handleFileChange = (event: ChangeEvent) => { if (event.target.files) { const invalidFiles: string[] = []; @@ -161,7 +177,7 @@ export function ChatInput({ focus:border-transparent hover:bg-gray-50 transition-colors border-0" > - {models_conf.map((model) => ( + {models.map((model) => ( ))} @@ -170,11 +186,11 @@ export function ChatInput({ From c79725a2fa3965ac1e5e859696550013d9d47365 Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Wed, 4 Jun 2025 16:25:26 +0800 Subject: [PATCH 05/14] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/copilot_web/App-Bjq6Zxw-.js | 72 +++++++++++++++++++++++++-- ui/package.json | 2 +- ui/scripts/post-build.js | 84 +++++++++++++++++++++++++++++--- 3 files changed, 147 insertions(+), 11 deletions(-) diff --git a/dist/copilot_web/App-Bjq6Zxw-.js b/dist/copilot_web/App-Bjq6Zxw-.js index 3f9716a..d4cb848 100644 --- a/dist/copilot_web/App-Bjq6Zxw-.js +++ b/dist/copilot_web/App-Bjq6Zxw-.js @@ -1,6 +1,72 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-DztaEqXX.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { - const apiBase = window.comfyAPI?.api?.api?.api_base; - const prefix = apiBase ? `${apiBase.substring(1)}/` : ''; - return `${prefix}${path}`; + // 智能路径处理逻辑 v2 + const getBasePath = () => { + try { + // 优先使用 comfyAPI 提供的 api_base + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase && typeof apiBase === 'string') { + console.log('[ComfyUI Copilot] Using comfyAPI api_base:', apiBase); + // 确保 apiBase 格式正确:去除开头的斜杠,确保结尾有斜杠 + const cleanApiBase = apiBase.replace(/^\/+/, '').replace(/\/+$/, ''); + return cleanApiBase ? `${cleanApiBase}/` : ''; + } + + // 如果没有 apiBase,根据当前页面 URL 智能判断 + const currentPath = window.location.pathname; + const currentOrigin = window.location.origin; + const currentHost = window.location.host; + + console.log('[ComfyUI Copilot] Current URL info:', { + origin: currentOrigin, + pathname: currentPath, + host: currentHost + }); + + // 检查是否是本地开发环境 + const isLocalDev = /^https?:\/\/(localhost|127\.0\.0\.1|0\.0\.0\.0)(:|$)/.test(currentOrigin); + + // 检查是否是直接的 ComfyUI 环境 (通常有8188端口) + const isDirectComfyUI = currentOrigin.includes(':8188') || + (isLocalDev && !currentPath.includes('/notebook/')); + + if (isDirectComfyUI) { + console.log('[ComfyUI Copilot] Detected direct ComfyUI environment'); + return ''; + } + + // 检查是否在 notebook 环境中 (如 nebula-notebook) + const notebookMatch = currentPath.match(/^\/([^/]+)\//); + if (notebookMatch && notebookMatch[1] && + (notebookMatch[1].includes('notebook') || + currentOrigin.includes('notebook') || + currentOrigin.includes('nebula'))) { + const prefix = notebookMatch[1]; + console.log('[ComfyUI Copilot] Detected notebook environment with prefix:', prefix); + return `${prefix}/`; + } + + // 通用路径前缀检测 + const pathSegments = currentPath.split('/').filter(Boolean); + if (pathSegments.length > 0 && pathSegments[0]) { + // 如果第一个路径段不是 copilot_web,可能是需要的前缀 + if (pathSegments[0] !== 'copilot_web') { + console.log('[ComfyUI Copilot] Using path-based prefix:', pathSegments[0]); + return `${pathSegments[0]}/`; + } + } + + console.log('[ComfyUI Copilot] Using default empty prefix'); + return ''; + + } catch (error) { + console.error('[ComfyUI Copilot] Error in path detection:', error); + return ''; + } + }; + + const prefix = getBasePath(); + const finalPath = `${prefix}${path}`; + console.log('[ComfyUI Copilot] Resource path mapping:', { original: path, prefix, final: finalPath }); + return finalPath; }))))=>i.map(i=>d[i]); import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-BQDbTDiL.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import("./workflowChat-DztaEqXX.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/ui/package.json b/ui/package.json index b739dfe..7a4c20e 100644 --- a/ui/package.json +++ b/ui/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "vite build", + "build": "vite build && node scripts/post-build.js", "build:css": "tailwindcss -i ./src/scoped-tailwind.css -o ./src/output.css --watch", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", diff --git a/ui/scripts/post-build.js b/ui/scripts/post-build.js index cb7e40a..24bc76a 100644 --- a/ui/scripts/post-build.js +++ b/ui/scripts/post-build.js @@ -22,26 +22,96 @@ files.forEach(file => { if (depsMatch && depsMatch[1]) { const originalDeps = depsMatch[1]; + // 新的智能路径处理逻辑 + const smartPathLogic = ` + // 智能路径处理逻辑 v2 + const getBasePath = () => { + try { + // 优先使用 comfyAPI 提供的 api_base + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase && typeof apiBase === 'string') { + console.log('[ComfyUI Copilot] Using comfyAPI api_base:', apiBase); + // 确保 apiBase 格式正确:去除开头的斜杠,确保结尾有斜杠 + const cleanApiBase = apiBase.replace(/^\\/+/, '').replace(/\\/+$/, ''); + return cleanApiBase ? \`\${cleanApiBase}/\` : ''; + } + + // 如果没有 apiBase,根据当前页面 URL 智能判断 + const currentPath = window.location.pathname; + const currentOrigin = window.location.origin; + const currentHost = window.location.host; + + console.log('[ComfyUI Copilot] Current URL info:', { + origin: currentOrigin, + pathname: currentPath, + host: currentHost + }); + + // 检查是否是本地开发环境 + const isLocalDev = /^https?:\\/\\/(localhost|127\\.0\\.0\\.1|0\\.0\\.0\\.0)(:|$)/.test(currentOrigin); + + // 检查是否是直接的 ComfyUI 环境 (通常有8188端口) + const isDirectComfyUI = currentOrigin.includes(':8188') || + (isLocalDev && !currentPath.includes('/notebook/')); + + if (isDirectComfyUI) { + console.log('[ComfyUI Copilot] Detected direct ComfyUI environment'); + return ''; + } + + // 检查是否在 notebook 环境中 (如 nebula-notebook) + const notebookMatch = currentPath.match(/^\\/([^/]+)\\//); + if (notebookMatch && notebookMatch[1] && + (notebookMatch[1].includes('notebook') || + currentOrigin.includes('notebook') || + currentOrigin.includes('nebula'))) { + const prefix = notebookMatch[1]; + console.log('[ComfyUI Copilot] Detected notebook environment with prefix:', prefix); + return \`\${prefix}/\`; + } + + // 通用路径前缀检测 + const pathSegments = currentPath.split('/').filter(Boolean); + if (pathSegments.length > 0 && pathSegments[0]) { + // 如果第一个路径段不是 copilot_web,可能是需要的前缀 + if (pathSegments[0] !== 'copilot_web') { + console.log('[ComfyUI Copilot] Using path-based prefix:', pathSegments[0]); + return \`\${pathSegments[0]}/\`; + } + } + + console.log('[ComfyUI Copilot] Using default empty prefix'); + return ''; + + } catch (error) { + console.error('[ComfyUI Copilot] Error in path detection:', error); + return ''; + } + }; + + const prefix = getBasePath(); + const finalPath = \`\${prefix}\${path}\`; + console.log('[ComfyUI Copilot] Resource path mapping:', { original: path, prefix, final: finalPath }); + return finalPath;`; + // 如果文件中还没有路径转换逻辑,则添加 if (!content.includes('window.comfyAPI?.api?.api?.api_base')) { content = content.replace( /const __vite__mapDeps=.*?\)=>i\.map\(i=>d\[i\]\);/, - `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[${originalDeps}].map(path => { - const apiBase = window.comfyAPI?.api?.api?.api_base; - const prefix = apiBase ? \`\${apiBase.substring(1)}/\` : ''; - return \`\${prefix}\${path}\`; + `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[${originalDeps}].map(path => {${smartPathLogic} }))))=>i.map(i=>d[i]);` ); } else { - // 如果已经有路径转换逻辑,只替换依赖数组部分 + // 如果已经有路径转换逻辑,替换为新的逻辑 content = content.replace( /const __vite__mapDeps=\(.*?\)=>i\.map\(i=>d\[i\]\);/, - `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[${originalDeps}])))=>i.map(i=>d[i]);` + `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[${originalDeps}].map(path => {${smartPathLogic} + }))))=>i.map(i=>d[i]);` ); } fs.writeFileSync(file, content, 'utf-8'); - console.log(`Modified ${path.basename(file)}`); + console.log(`Modified ${path.basename(file)} with enhanced path logic`); } else { console.log(`No deps pattern found in ${path.basename(file)}`); } From 4e3a8e04edb80b01bcd941d8dab193419420adf0 Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Wed, 4 Jun 2025 17:33:22 +0800 Subject: [PATCH 06/14] =?UTF-8?q?feat:=20=E8=B7=AF=E5=BE=84=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/copilot_web/App-Bjq6Zxw-.js | 89 ++++++----------------- ui/package.json | 2 +- ui/scripts/post-build.js | 117 +++++++++++-------------------- 3 files changed, 63 insertions(+), 145 deletions(-) diff --git a/dist/copilot_web/App-Bjq6Zxw-.js b/dist/copilot_web/App-Bjq6Zxw-.js index d4cb848..3dd8449 100644 --- a/dist/copilot_web/App-Bjq6Zxw-.js +++ b/dist/copilot_web/App-Bjq6Zxw-.js @@ -1,72 +1,29 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-DztaEqXX.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { - // 智能路径处理逻辑 v2 - const getBasePath = () => { - try { - // 优先使用 comfyAPI 提供的 api_base + // 判断是否在代理环境下(如 nebula-notebook) + let baseUrl = ''; + try { + if (window.location && window.location.pathname.includes('/proxy/')) { + // 在代理环境下使用完整路径 + const protocol = window.location.protocol; + const host = window.location.host; + const pathname = window.location.pathname; + baseUrl = `${protocol}//${host}${pathname}`; + // 确保路径以 / 结尾 + if (!baseUrl.endsWith('/')) { + baseUrl += '/'; + } + } else { + // 在本地环境下使用相对路径或API base const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase && typeof apiBase === 'string') { - console.log('[ComfyUI Copilot] Using comfyAPI api_base:', apiBase); - // 确保 apiBase 格式正确:去除开头的斜杠,确保结尾有斜杠 - const cleanApiBase = apiBase.replace(/^\/+/, '').replace(/\/+$/, ''); - return cleanApiBase ? `${cleanApiBase}/` : ''; - } - - // 如果没有 apiBase,根据当前页面 URL 智能判断 - const currentPath = window.location.pathname; - const currentOrigin = window.location.origin; - const currentHost = window.location.host; - - console.log('[ComfyUI Copilot] Current URL info:', { - origin: currentOrigin, - pathname: currentPath, - host: currentHost - }); - - // 检查是否是本地开发环境 - const isLocalDev = /^https?:\/\/(localhost|127\.0\.0\.1|0\.0\.0\.0)(:|$)/.test(currentOrigin); - - // 检查是否是直接的 ComfyUI 环境 (通常有8188端口) - const isDirectComfyUI = currentOrigin.includes(':8188') || - (isLocalDev && !currentPath.includes('/notebook/')); - - if (isDirectComfyUI) { - console.log('[ComfyUI Copilot] Detected direct ComfyUI environment'); - return ''; - } - - // 检查是否在 notebook 环境中 (如 nebula-notebook) - const notebookMatch = currentPath.match(/^\/([^/]+)\//); - if (notebookMatch && notebookMatch[1] && - (notebookMatch[1].includes('notebook') || - currentOrigin.includes('notebook') || - currentOrigin.includes('nebula'))) { - const prefix = notebookMatch[1]; - console.log('[ComfyUI Copilot] Detected notebook environment with prefix:', prefix); - return `${prefix}/`; - } - - // 通用路径前缀检测 - const pathSegments = currentPath.split('/').filter(Boolean); - if (pathSegments.length > 0 && pathSegments[0]) { - // 如果第一个路径段不是 copilot_web,可能是需要的前缀 - if (pathSegments[0] !== 'copilot_web') { - console.log('[ComfyUI Copilot] Using path-based prefix:', pathSegments[0]); - return `${pathSegments[0]}/`; - } - } - - console.log('[ComfyUI Copilot] Using default empty prefix'); - return ''; - - } catch (error) { - console.error('[ComfyUI Copilot] Error in path detection:', error); - return ''; + baseUrl = apiBase ? `${apiBase.substring(1)}/` : ''; } - }; + } catch (e) { + console.warn('Failed to get base URL:', e); + // 回退到原来的方式 + const apiBase = window.comfyAPI?.api?.api?.api_base; + baseUrl = apiBase ? `${apiBase.substring(1)}/` : ''; + } - const prefix = getBasePath(); - const finalPath = `${prefix}${path}`; - console.log('[ComfyUI Copilot] Resource path mapping:', { original: path, prefix, final: finalPath }); - return finalPath; + return `${baseUrl}${path}`; }))))=>i.map(i=>d[i]); import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-BQDbTDiL.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import("./workflowChat-DztaEqXX.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/ui/package.json b/ui/package.json index 7a4c20e..b739dfe 100644 --- a/ui/package.json +++ b/ui/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "vite build && node scripts/post-build.js", + "build": "vite build", "build:css": "tailwindcss -i ./src/scoped-tailwind.css -o ./src/output.css --watch", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", diff --git a/ui/scripts/post-build.js b/ui/scripts/post-build.js index 24bc76a..6273312 100644 --- a/ui/scripts/post-build.js +++ b/ui/scripts/post-build.js @@ -1,3 +1,11 @@ +/* + * @Author: ai-business-hql qingli.hql@alibaba-inc.com + * @Date: 2025-02-17 20:53:45 + * @LastEditors: ai-business-hql qingli.hql@alibaba-inc.com + * @LastEditTime: 2025-06-04 17:16:22 + * @FilePath: /comfyui_copilot/ui/scripts/post-build.js + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ import fs from 'fs'; import path from 'path'; import glob from 'glob'; @@ -22,96 +30,49 @@ files.forEach(file => { if (depsMatch && depsMatch[1]) { const originalDeps = depsMatch[1]; - // 新的智能路径处理逻辑 - const smartPathLogic = ` - // 智能路径处理逻辑 v2 - const getBasePath = () => { - try { - // 优先使用 comfyAPI 提供的 api_base - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase && typeof apiBase === 'string') { - console.log('[ComfyUI Copilot] Using comfyAPI api_base:', apiBase); - // 确保 apiBase 格式正确:去除开头的斜杠,确保结尾有斜杠 - const cleanApiBase = apiBase.replace(/^\\/+/, '').replace(/\\/+$/, ''); - return cleanApiBase ? \`\${cleanApiBase}/\` : ''; - } - - // 如果没有 apiBase,根据当前页面 URL 智能判断 - const currentPath = window.location.pathname; - const currentOrigin = window.location.origin; - const currentHost = window.location.host; - - console.log('[ComfyUI Copilot] Current URL info:', { - origin: currentOrigin, - pathname: currentPath, - host: currentHost - }); - - // 检查是否是本地开发环境 - const isLocalDev = /^https?:\\/\\/(localhost|127\\.0\\.0\\.1|0\\.0\\.0\\.0)(:|$)/.test(currentOrigin); - - // 检查是否是直接的 ComfyUI 环境 (通常有8188端口) - const isDirectComfyUI = currentOrigin.includes(':8188') || - (isLocalDev && !currentPath.includes('/notebook/')); - - if (isDirectComfyUI) { - console.log('[ComfyUI Copilot] Detected direct ComfyUI environment'); - return ''; - } - - // 检查是否在 notebook 环境中 (如 nebula-notebook) - const notebookMatch = currentPath.match(/^\\/([^/]+)\\//); - if (notebookMatch && notebookMatch[1] && - (notebookMatch[1].includes('notebook') || - currentOrigin.includes('notebook') || - currentOrigin.includes('nebula'))) { - const prefix = notebookMatch[1]; - console.log('[ComfyUI Copilot] Detected notebook environment with prefix:', prefix); - return \`\${prefix}/\`; - } - - // 通用路径前缀检测 - const pathSegments = currentPath.split('/').filter(Boolean); - if (pathSegments.length > 0 && pathSegments[0]) { - // 如果第一个路径段不是 copilot_web,可能是需要的前缀 - if (pathSegments[0] !== 'copilot_web') { - console.log('[ComfyUI Copilot] Using path-based prefix:', pathSegments[0]); - return \`\${pathSegments[0]}/\`; - } - } - - console.log('[ComfyUI Copilot] Using default empty prefix'); - return ''; - - } catch (error) { - console.error('[ComfyUI Copilot] Error in path detection:', error); - return ''; - } - }; - - const prefix = getBasePath(); - const finalPath = \`\${prefix}\${path}\`; - console.log('[ComfyUI Copilot] Resource path mapping:', { original: path, prefix, final: finalPath }); - return finalPath;`; - // 如果文件中还没有路径转换逻辑,则添加 - if (!content.includes('window.comfyAPI?.api?.api?.api_base')) { + if (!content.includes('window.location.protocol')) { content = content.replace( /const __vite__mapDeps=.*?\)=>i\.map\(i=>d\[i\]\);/, - `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[${originalDeps}].map(path => {${smartPathLogic} + `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[${originalDeps}].map(path => { + // 判断是否在代理环境下(如 nebula-notebook) + let baseUrl = ''; + try { + if (window.location && window.location.pathname.includes('/proxy/')) { + // 在代理环境下使用完整路径 + const protocol = window.location.protocol; + const host = window.location.host; + const pathname = window.location.pathname; + baseUrl = \`\${protocol}//\${host}\${pathname}\`; + // 确保路径以 / 结尾 + if (!baseUrl.endsWith('/')) { + baseUrl += '/'; + } + } else { + // 在本地环境下使用相对路径或API base + const apiBase = window.comfyAPI?.api?.api?.api_base; + baseUrl = apiBase ? \`\${apiBase.substring(1)}/\` : ''; + } + } catch (e) { + console.warn('Failed to get base URL:', e); + // 回退到原来的方式 + const apiBase = window.comfyAPI?.api?.api?.api_base; + baseUrl = apiBase ? \`\${apiBase.substring(1)}/\` : ''; + } + + return \`\${baseUrl}\${path}\`; }))))=>i.map(i=>d[i]);` ); } else { - // 如果已经有路径转换逻辑,替换为新的逻辑 + // 如果已经有路径转换逻辑,只替换依赖数组部分 content = content.replace( /const __vite__mapDeps=\(.*?\)=>i\.map\(i=>d\[i\]\);/, - `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[${originalDeps}].map(path => {${smartPathLogic} - }))))=>i.map(i=>d[i]);` + `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[${originalDeps}])))=>i.map(i=>d[i]);` ); } fs.writeFileSync(file, content, 'utf-8'); - console.log(`Modified ${path.basename(file)} with enhanced path logic`); + console.log(`Modified ${path.basename(file)}`); } else { console.log(`No deps pattern found in ${path.basename(file)}`); } From 4cc0309d94d7f4c2371dfb476afb4291f74d25cd Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Wed, 4 Jun 2025 19:24:26 +0800 Subject: [PATCH 07/14] =?UTF-8?q?feat:=20dynamic=20import=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/copilot_web/App-Bjq6Zxw-.js | 29 -------- dist/copilot_web/App-ByZR41yl.js | 17 +++++ ... => ParameterDebugInterfaceV2-DfZJN3da.js} | 2 +- ...Ci2jcBGf.js => WorkflowOption-WINGBPvy.js} | 2 +- dist/copilot_web/input.js | 4 +- ...TDiL.js => message-components-DHp7C_am.js} | 74 +++++++++---------- ...t-DztaEqXX.js => workflowChat-CIPsWdia.js} | 8 +- ui/package.json | 2 +- ui/scripts/post-build.js | 63 ++++++++-------- 9 files changed, 97 insertions(+), 104 deletions(-) delete mode 100644 dist/copilot_web/App-Bjq6Zxw-.js create mode 100644 dist/copilot_web/App-ByZR41yl.js rename dist/copilot_web/{ParameterDebugInterfaceV2-xZYi4DyT.js => ParameterDebugInterfaceV2-DfZJN3da.js} (99%) rename dist/copilot_web/{WorkflowOption-Ci2jcBGf.js => WorkflowOption-WINGBPvy.js} (98%) rename dist/copilot_web/{message-components-BQDbTDiL.js => message-components-DHp7C_am.js} (80%) rename dist/copilot_web/{workflowChat-DztaEqXX.js => workflowChat-CIPsWdia.js} (99%) diff --git a/dist/copilot_web/App-Bjq6Zxw-.js b/dist/copilot_web/App-Bjq6Zxw-.js deleted file mode 100644 index 3dd8449..0000000 --- a/dist/copilot_web/App-Bjq6Zxw-.js +++ /dev/null @@ -1,29 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-DztaEqXX.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { - // 判断是否在代理环境下(如 nebula-notebook) - let baseUrl = ''; - try { - if (window.location && window.location.pathname.includes('/proxy/')) { - // 在代理环境下使用完整路径 - const protocol = window.location.protocol; - const host = window.location.host; - const pathname = window.location.pathname; - baseUrl = `${protocol}//${host}${pathname}`; - // 确保路径以 / 结尾 - if (!baseUrl.endsWith('/')) { - baseUrl += '/'; - } - } else { - // 在本地环境下使用相对路径或API base - const apiBase = window.comfyAPI?.api?.api?.api_base; - baseUrl = apiBase ? `${apiBase.substring(1)}/` : ''; - } - } catch (e) { - console.warn('Failed to get base URL:', e); - // 回退到原来的方式 - const apiBase = window.comfyAPI?.api?.api?.api_base; - baseUrl = apiBase ? `${apiBase.substring(1)}/` : ''; - } - - return `${baseUrl}${path}`; - }))))=>i.map(i=>d[i]); -import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-BQDbTDiL.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import("./workflowChat-DztaEqXX.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/dist/copilot_web/App-ByZR41yl.js b/dist/copilot_web/App-ByZR41yl.js new file mode 100644 index 0000000..ec241c6 --- /dev/null +++ b/dist/copilot_web/App-ByZR41yl.js @@ -0,0 +1,17 @@ + +const getImportPath = (relativePath) => { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用绝对路径 + const prefix = apiBase.substring(1); // 移除开头的 / + return `/${prefix}/copilot_web/${relativePath}`; + } else { + // 没有 API base 时,使用相对路径 + return `./${relativePath}`; + } +};const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-CIPsWdia.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DHp7C_am.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { + const apiBase = window.comfyAPI?.api?.api?.api_base; + const prefix = apiBase ? `${apiBase.substring(1)}/` : ''; + return `${prefix}${path}`; + }))))=>i.map(i=>d[i]); +import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-DHp7C_am.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-CIPsWdia.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js b/dist/copilot_web/ParameterDebugInterfaceV2-DfZJN3da.js similarity index 99% rename from dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js rename to dist/copilot_web/ParameterDebugInterfaceV2-DfZJN3da.js index 81557e2..2def542 100644 --- a/dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js +++ b/dist/copilot_web/ParameterDebugInterfaceV2-DfZJN3da.js @@ -1,4 +1,4 @@ -import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-BQDbTDiL.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-DztaEqXX.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white +import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-DHp7C_am.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-CIPsWdia.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white bg-gray-50 dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-400 diff --git a/dist/copilot_web/WorkflowOption-Ci2jcBGf.js b/dist/copilot_web/WorkflowOption-WINGBPvy.js similarity index 98% rename from dist/copilot_web/WorkflowOption-Ci2jcBGf.js rename to dist/copilot_web/WorkflowOption-WINGBPvy.js index 9f58209..9fa4e33 100644 --- a/dist/copilot_web/WorkflowOption-Ci2jcBGf.js +++ b/dist/copilot_web/WorkflowOption-WINGBPvy.js @@ -1 +1 @@ -import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-BQDbTDiL.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; +import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-DHp7C_am.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; diff --git a/dist/copilot_web/input.js b/dist/copilot_web/input.js index d965184..fc60c55 100644 --- a/dist/copilot_web/input.js +++ b/dist/copilot_web/input.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-Bjq6Zxw-.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/fonts.css"])))=>i.map(i=>d[i]); -import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-BQDbTDiL.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import("./App-Bjq6Zxw-.js");return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-ByZR41yl.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DHp7C_am.js","copilot_web/fonts.css"])))=>i.map(i=>d[i]); +import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-DHp7C_am.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import("./App-ByZR41yl.js");return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; diff --git a/dist/copilot_web/message-components-BQDbTDiL.js b/dist/copilot_web/message-components-DHp7C_am.js similarity index 80% rename from dist/copilot_web/message-components-BQDbTDiL.js rename to dist/copilot_web/message-components-DHp7C_am.js index 27654b7..01f3091 100644 --- a/dist/copilot_web/message-components-BQDbTDiL.js +++ b/dist/copilot_web/message-components-DHp7C_am.js @@ -1,11 +1,11 @@ -import{r as We,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Mpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=We.createContext({state:W$,dispatch:()=>null});function Bpe({children:i}){const[r,e]=We.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=We.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const Ff={apiBaseUrl:"https://comfyui-copilot-server-pre.onrender.com"};function dr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var lI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return lI.charAt(i)}function hI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function cI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function dI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,fI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f +import{r as We,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Bpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=We.createContext({state:W$,dispatch:()=>null});function Fpe({children:i}){const[r,e]=We.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=We.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const lI="http://localhost:8000",Ff={apiBaseUrl:lI};function dr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var hI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return hI.charAt(i)}function cI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function dI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function fI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,vI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f \r  \u2028\u2029`;for(pn={},r=0;r<16;++r)pn[e.charAt(r)]=r;for(e=e.toLowerCase(),r=10;r<16;++r)pn[e.charAt(r)]=r;for(r=0;r=2?(n[n.length]=a,a=0,o=0):a<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},Ii,wd={decode:function(i){var r;if(Ii===void 0){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=`= \f -\r  \u2028\u2029`;for(Ii=Object.create(null),r=0;r<64;++r)Ii[e.charAt(r)]=r;for(Ii["-"]=62,Ii._=63,r=0;r=4?(n[n.length]=a>>16,n[n.length]=a>>8&255,n[n.length]=a&255,a=0,o=0):a<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=a>>10;break;case 3:n[n.length]=a>>16,n[n.length]=a>>8&255;break}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(i){var r=wd.re.exec(i);if(r)if(r[1])i=r[1];else if(r[2])i=r[2];else throw new Error("RegExp out of sync");return wd.decode(i)}},gn=1e13,Ua=function(){function i(r){this.buf=[+r||0]}return i.prototype.mulAdd=function(r,e){var t=this.buf,n=t.length,a,o;for(a=0;a0&&(t[a]=e)},i.prototype.sub=function(r){var e=this.buf,t=e.length,n,a;for(n=0;n=0;--n)t+=(gn+e[n]).toString().substring(1);return t},i.prototype.valueOf=function(){for(var r=this.buf,e=0,t=r.length-1;t>=0;--t)e=e*gn+r[t];return e},i.prototype.simplify=function(){var r=this.buf;return r.length==1?r[0]:this},i}(),G$="…",vI=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,pI=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Wn(i,r){return i.length>r&&(i=i.substring(0,r)+G$),i}var nh=function(){function i(r,e){this.hexDigits="0123456789ABCDEF",r instanceof i?(this.enc=r.enc,this.pos=r.pos):(this.enc=r,this.pos=e)}return i.prototype.get=function(r){if(r===void 0&&(r=this.pos++),r>=this.enc.length)throw new Error("Requesting byte offset ".concat(r," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(r):this.enc[r]},i.prototype.hexByte=function(r){return this.hexDigits.charAt(r>>4&15)+this.hexDigits.charAt(r&15)},i.prototype.hexDump=function(r,e,t){for(var n="",a=r;a176)return!1}return!0},i.prototype.parseStringISO=function(r,e){for(var t="",n=r;n191&&a<224?t+=String.fromCharCode((a&31)<<6|this.get(n++)&63):t+=String.fromCharCode((a&15)<<12|(this.get(n++)&63)<<6|this.get(n++)&63)}return t},i.prototype.parseStringBMP=function(r,e){for(var t="",n,a,o=r;o127,a=n?255:0,o,s="";t==a&&++r4){for(s=t,o<<=3;!((+s^a)&128);)s=+s<<1,--o;s="("+o+` bit) +\r  \u2028\u2029`;for(Ii=Object.create(null),r=0;r<64;++r)Ii[e.charAt(r)]=r;for(Ii["-"]=62,Ii._=63,r=0;r=4?(n[n.length]=a>>16,n[n.length]=a>>8&255,n[n.length]=a&255,a=0,o=0):a<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=a>>10;break;case 3:n[n.length]=a>>16,n[n.length]=a>>8&255;break}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(i){var r=wd.re.exec(i);if(r)if(r[1])i=r[1];else if(r[2])i=r[2];else throw new Error("RegExp out of sync");return wd.decode(i)}},gn=1e13,Ua=function(){function i(r){this.buf=[+r||0]}return i.prototype.mulAdd=function(r,e){var t=this.buf,n=t.length,a,o;for(a=0;a0&&(t[a]=e)},i.prototype.sub=function(r){var e=this.buf,t=e.length,n,a;for(n=0;n=0;--n)t+=(gn+e[n]).toString().substring(1);return t},i.prototype.valueOf=function(){for(var r=this.buf,e=0,t=r.length-1;t>=0;--t)e=e*gn+r[t];return e},i.prototype.simplify=function(){var r=this.buf;return r.length==1?r[0]:this},i}(),G$="…",pI=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,gI=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Wn(i,r){return i.length>r&&(i=i.substring(0,r)+G$),i}var nh=function(){function i(r,e){this.hexDigits="0123456789ABCDEF",r instanceof i?(this.enc=r.enc,this.pos=r.pos):(this.enc=r,this.pos=e)}return i.prototype.get=function(r){if(r===void 0&&(r=this.pos++),r>=this.enc.length)throw new Error("Requesting byte offset ".concat(r," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(r):this.enc[r]},i.prototype.hexByte=function(r){return this.hexDigits.charAt(r>>4&15)+this.hexDigits.charAt(r&15)},i.prototype.hexDump=function(r,e,t){for(var n="",a=r;a176)return!1}return!0},i.prototype.parseStringISO=function(r,e){for(var t="",n=r;n191&&a<224?t+=String.fromCharCode((a&31)<<6|this.get(n++)&63):t+=String.fromCharCode((a&15)<<12|(this.get(n++)&63)<<6|this.get(n++)&63)}return t},i.prototype.parseStringBMP=function(r,e){for(var t="",n,a,o=r;o127,a=n?255:0,o,s="";t==a&&++r4){for(s=t,o<<=3;!((+s^a)&128);)s=+s<<1,--o;s="("+o+` bit) `}n&&(t=t-256);for(var u=new Ua(t),l=r+1;l=h;--c)s+=l>>c&1?"1":"0";if(s.length>t)return o+Wn(s,t)}return o+s},i.prototype.parseOctetString=function(r,e,t){if(this.isASCII(r,e))return Wn(this.parseStringISO(r,e),t);var n=e-r,a="("+n+` byte) -`;t/=2,n>t&&(e=r+t);for(var o=r;ot&&(a+=G$),a},i.prototype.parseOID=function(r,e,t){for(var n="",a=new Ua,o=0,s=r;st)return Wn(n,t);a=new Ua,o=0}}return o>0&&(n+=".incomplete"),n},i}(),gI=function(){function i(r,e,t,n,a){if(!(n instanceof _p))throw new Error("Invalid tag value.");this.stream=r,this.header=e,this.length=t,this.tag=n,this.sub=a}return i.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},i.prototype.content=function(r){if(this.tag===void 0)return null;r===void 0&&(r=1/0);var e=this.posContent(),t=Math.abs(this.length);if(!this.tag.isUniversal())return this.sub!==null?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+t,r);switch(this.tag.tagNumber){case 1:return this.stream.get(e)===0?"false":"true";case 2:return this.stream.parseInteger(e,e+t);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+t,r);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+t,r);case 6:return this.stream.parseOID(e,e+t,r);case 16:case 17:return this.sub!==null?"("+this.sub.length+" elem)":"(no elem)";case 12:return Wn(this.stream.parseStringUTF(e,e+t),r);case 18:case 19:case 20:case 21:case 22:case 26:return Wn(this.stream.parseStringISO(e,e+t),r);case 30:return Wn(this.stream.parseStringBMP(e,e+t),r);case 23:case 24:return this.stream.parseTime(e,e+t,this.tag.tagNumber==23)}return null},i.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(this.sub===null?"null":this.sub.length)+"]"},i.prototype.toPrettyString=function(r){r===void 0&&(r="");var e=r+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":this.tag.isUniversal()&&(this.tag.tagNumber==3||this.tag.tagNumber==4)&&this.sub!==null&&(e+=" (encapsulates)"),e+=` -`,this.sub!==null){r+=" ";for(var t=0,n=this.sub.length;t6)throw new Error("Length over 48 bits not supported at position "+(r.pos-1));if(t===0)return null;e=0;for(var n=0;n>6,this.tagConstructed=(e&32)!==0,this.tagNumber=e&31,this.tagNumber==31){var t=new Ua;do e=r.get(),t.mulAdd(128,e&127);while(e&128);this.tagNumber=t.simplify()}}return i.prototype.isUniversal=function(){return this.tagClass===0},i.prototype.isEOC=function(){return this.tagClass===0&&this.tagNumber===0},i}(),ni,yI=0xdeadbeefcafe,Ep=(yI&16777215)==15715070,dt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],mI=(1<<26)/dt[dt.length-1],Q=function(){function i(r,e,t){r!=null&&(typeof r=="number"?this.fromNumber(r,e,t):e==null&&typeof r!="string"?this.fromString(r,256):this.fromString(r,e))}return i.prototype.toString=function(r){if(this.s<0)return"-"+this.negate().toString(r);var e;if(r==16)e=4;else if(r==8)e=3;else if(r==2)e=1;else if(r==32)e=5;else if(r==4)e=2;else return this.toRadix(r);var t=(1<0)for(u>u)>0&&(a=!0,o=Or(n));s>=0;)u>(u+=this.DB-e)):(n=this[s]>>(u-=e)&t,u<=0&&(u+=this.DB,--s)),n>0&&(a=!0),a&&(o+=Or(n));return a?o:"0"},i.prototype.negate=function(){var r=re();return i.ZERO.subTo(this,r),r},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(r){var e=this.s-r.s;if(e!=0)return e;var t=this.t;if(e=t-r.t,e!=0)return this.s<0?-e:e;for(;--t>=0;)if((e=this[t]-r[t])!=0)return e;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+ms(this[this.t-1]^this.s&this.DM)},i.prototype.mod=function(r){var e=re();return this.abs().divRemTo(r,null,e),this.s<0&&e.compareTo(i.ZERO)>0&&r.subTo(e,e),e},i.prototype.modPowInt=function(r,e){var t;return r<256||e.isEven()?t=new Sp(e):t=new Op(e),this.exp(r,t)},i.prototype.clone=function(){var r=re();return this.copyTo(r),r},i.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24},i.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},i.prototype.toByteArray=function(){var r=this.t,e=[];e[0]=this.s;var t=this.DB-r*this.DB%8,n,a=0;if(r-- >0)for(t>t)!=(this.s&this.DM)>>t&&(e[a++]=n|this.s<=0;)t<8?(n=(this[r]&(1<>(t+=this.DB-8)):(n=this[r]>>(t-=8)&255,t<=0&&(t+=this.DB,--r)),n&128&&(n|=-256),a==0&&(this.s&128)!=(n&128)&&++a,(a>0||n!=this.s)&&(e[a++]=n);return e},i.prototype.equals=function(r){return this.compareTo(r)==0},i.prototype.min=function(r){return this.compareTo(r)<0?this:r},i.prototype.max=function(r){return this.compareTo(r)>0?this:r},i.prototype.and=function(r){var e=re();return this.bitwiseTo(r,hI,e),e},i.prototype.or=function(r){var e=re();return this.bitwiseTo(r,ys,e),e},i.prototype.xor=function(r){var e=re();return this.bitwiseTo(r,bp,e),e},i.prototype.andNot=function(r){var e=re();return this.bitwiseTo(r,$p,e),e},i.prototype.not=function(){for(var r=re(),e=0;e=this.t?this.s!=0:(this[e]&1<1){var c=re();for(o.sqrTo(s[1],c);u<=h;)s[u]=re(),o.mulTo(c,s[u-2],s[u]),u+=2}var d=r.t-1,f,v=!0,p=re(),g;for(t=ms(r[d])-1;d>=0;){for(t>=l?f=r[d]>>t-l&h:(f=(r[d]&(1<0&&(f|=r[d-1]>>this.DB+t-l)),u=n;!(f&1);)f>>=1,--u;if((t-=u)<0&&(t+=this.DB,--d),v)s[f].copyTo(a),v=!1;else{for(;u>1;)o.sqrTo(a,p),o.sqrTo(p,a),u-=2;u>0?o.sqrTo(a,p):(g=a,a=p,p=g),o.mulTo(p,s[f],a)}for(;d>=0&&!(r[d]&1<=0?(t.subTo(n,t),e&&a.subTo(s,a),o.subTo(u,o)):(n.subTo(t,n),e&&s.subTo(a,s),u.subTo(o,u))}if(n.compareTo(i.ONE)!=0)return i.ZERO;if(u.compareTo(r)>=0)return u.subtract(r);if(u.signum()<0)u.addTo(r,u);else return u;return u.signum()<0?u.add(r):u},i.prototype.pow=function(r){return this.exp(r,new bI)},i.prototype.gcd=function(r){var e=this.s<0?this.negate():this.clone(),t=r.s<0?r.negate():r.clone();if(e.compareTo(t)<0){var n=e;e=t,t=n}var a=e.getLowestSetBit(),o=t.getLowestSetBit();if(o<0)return e;for(a0&&(e.rShiftTo(o,e),t.rShiftTo(o,t));e.signum()>0;)(a=e.getLowestSetBit())>0&&e.rShiftTo(a,e),(a=t.getLowestSetBit())>0&&t.rShiftTo(a,t),e.compareTo(t)>=0?(e.subTo(t,e),e.rShiftTo(1,e)):(t.subTo(e,t),t.rShiftTo(1,t));return o>0&&t.lShiftTo(o,t),t},i.prototype.isProbablePrime=function(r){var e,t=this.abs();if(t.t==1&&t[0]<=dt[dt.length-1]){for(e=0;e=0;--e)r[e]=this[e];r.t=this.t,r.s=this.s},i.prototype.fromInt=function(r){this.t=1,this.s=r<0?-1:0,r>0?this[0]=r:r<-1?this[0]=r+this.DV:this.t=0},i.prototype.fromString=function(r,e){var t;if(e==16)t=4;else if(e==8)t=3;else if(e==256)t=8;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else{this.fromRadix(r,e);return}this.t=0,this.s=0;for(var n=r.length,a=!1,o=0;--n>=0;){var s=t==8?+r[n]&255:Ip(r,n);if(s<0){r.charAt(n)=="-"&&(a=!0);continue}a=!1,o==0?this[this.t++]=s:o+t>this.DB?(this[this.t-1]|=(s&(1<>this.DB-o):this[this.t-1]|=s<=this.DB&&(o-=this.DB)}t==8&&+r[0]&128&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==r;)--this.t},i.prototype.dlShiftTo=function(r,e){var t;for(t=this.t-1;t>=0;--t)e[t+r]=this[t];for(t=r-1;t>=0;--t)e[t]=0;e.t=this.t+r,e.s=this.s},i.prototype.drShiftTo=function(r,e){for(var t=r;t=0;--u)e[u+o+1]=this[u]>>n|s,s=(this[u]&a)<=0;--u)e[u]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},i.prototype.rShiftTo=function(r,e){e.s=this.s;var t=Math.floor(r/this.DB);if(t>=this.t){e.t=0;return}var n=r%this.DB,a=this.DB-n,o=(1<>n;for(var s=t+1;s>n;n>0&&(e[this.t-t-1]|=(this.s&o)<>=this.DB;if(r.t>=this.DB;n+=this.s}else{for(n+=this.s;t>=this.DB;n-=r.s}e.s=n<0?-1:0,n<-1?e[t++]=this.DV+n:n>0&&(e[t++]=n),e.t=t,e.clamp()},i.prototype.multiplyTo=function(r,e){var t=this.abs(),n=r.abs(),a=t.t;for(e.t=a+n.t;--a>=0;)e[a]=0;for(a=0;a=0;)r[t]=0;for(t=0;t=e.DV&&(r[t+e.t]-=e.DV,r[t+e.t+1]=1)}r.t>0&&(r[r.t-1]+=e.am(t,e[t],r,2*t,0,1)),r.s=0,r.clamp()},i.prototype.divRemTo=function(r,e,t){var n=r.abs();if(!(n.t<=0)){var a=this.abs();if(a.t0?(n.lShiftTo(l,o),a.lShiftTo(l,t)):(n.copyTo(o),a.copyTo(t));var h=o.t,c=o[h-1];if(c!=0){var d=c*(1<1?o[h-2]>>this.F2:0),f=this.FV/d,v=(1<=0&&(t[t.t++]=1,t.subTo(m,t)),i.ONE.dlShiftTo(h,m),m.subTo(o,o);o.t=0;){var $=t[--g]==c?this.DM:Math.floor(t[g]*f+(t[g-1]+p)*v);if((t[g]+=o.am(0,$,t,y,0,h))<$)for(o.dlShiftTo(y,m),t.subTo(m,t);t[g]<--$;)t.subTo(m,t)}e!=null&&(t.drShiftTo(h,e),s!=u&&i.ZERO.subTo(e,e)),t.t=h,t.clamp(),l>0&&t.rShiftTo(l,t),s<0&&i.ZERO.subTo(t,t)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var r=this[0];if(!(r&1))return 0;var e=r&3;return e=e*(2-(r&15)*e)&15,e=e*(2-(r&255)*e)&255,e=e*(2-((r&65535)*e&65535))&65535,e=e*(2-r*e%this.DV)%this.DV,e>0?this.DV-e:-e},i.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0},i.prototype.exp=function(r,e){if(r>4294967295||r<1)return i.ONE;var t=re(),n=re(),a=e.convert(this),o=ms(r)-1;for(a.copyTo(t);--o>=0;)if(e.sqrTo(t,n),(r&1<0)e.mulTo(n,a,t);else{var s=t;t=n,n=s}return e.revert(t)},i.prototype.chunkSize=function(r){return Math.floor(Math.LN2*this.DB/Math.log(r))},i.prototype.toRadix=function(r){if(r==null&&(r=10),this.signum()==0||r<2||r>36)return"0";var e=this.chunkSize(r),t=Math.pow(r,e),n=Jr(t),a=re(),o=re(),s="";for(this.divRemTo(n,a,o);a.signum()>0;)s=(t+o.intValue()).toString(r).substr(1)+s,a.divRemTo(n,a,o);return o.intValue().toString(r)+s},i.prototype.fromRadix=function(r,e){this.fromInt(0),e==null&&(e=10);for(var t=this.chunkSize(e),n=Math.pow(e,t),a=!1,o=0,s=0,u=0;u=t&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),a&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(r,e,t){if(typeof e=="number")if(r<2)this.fromInt(1);else for(this.fromNumber(r,t),this.testBit(r-1)||this.bitwiseTo(i.ONE.shiftLeft(r-1),ys,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>r&&this.subTo(i.ONE.shiftLeft(r-1),this);else{var n=[],a=r&7;n.length=(r>>3)+1,e.nextBytes(n),a>0?n[0]&=(1<>=this.DB;if(r.t>=this.DB;n+=this.s}else{for(n+=this.s;t>=this.DB;n+=r.s}e.s=n<0?-1:0,n>0?e[t++]=n:n<-1&&(e[t++]=this.DV+n),e.t=t,e.clamp()},i.prototype.dMultiply=function(r){this[this.t]=this.am(0,r-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(r,e){if(r!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=r;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},i.prototype.multiplyLowerTo=function(r,e,t){var n=Math.min(this.t+r.t,e);for(t.s=0,t.t=n;n>0;)t[--n]=0;for(var a=t.t-this.t;n=0;)t[n]=0;for(n=Math.max(e-this.t,0);n0)if(e==0)t=this[0]%r;else for(var n=this.t-1;n>=0;--n)t=(e*t+this[n])%r;return t},i.prototype.millerRabin=function(r){var e=this.subtract(i.ONE),t=e.getLowestSetBit();if(t<=0)return!1;var n=e.shiftRight(t);r=r+1>>1,r>dt.length&&(r=dt.length);for(var a=re(),o=0;o0&&(t.rShiftTo(s,t),n.rShiftTo(s,n));var u=function(){(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n)),t.signum()>0?setTimeout(u,0):(s>0&&n.lShiftTo(s,n),setTimeout(function(){e(n)},0))};setTimeout(u,10)},i.prototype.fromNumberAsync=function(r,e,t,n){if(typeof e=="number")if(r<2)this.fromInt(1);else{this.fromNumber(r,t),this.testBit(r-1)||this.bitwiseTo(i.ONE.shiftLeft(r-1),ys,this),this.isEven()&&this.dAddOffset(1,0);var a=this,o=function(){a.dAddOffset(2,0),a.bitLength()>r&&a.subTo(i.ONE.shiftLeft(r-1),a),a.isProbablePrime(e)?setTimeout(function(){n()},0):setTimeout(o,0)};setTimeout(o,0)}else{var s=[],u=r&7;s.length=(r>>3)+1,e.nextBytes(s),u>0?s[0]&=(1<=0?r.mod(this.m):r},i.prototype.revert=function(r){return r},i.prototype.reduce=function(r){r.divRemTo(this.m,null,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}(),Op=function(){function i(r){this.m=r,this.mp=r.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e},i.prototype.revert=function(r){var e=re();return r.copyTo(e),this.reduce(e),e},i.prototype.reduce=function(r){for(;r.t<=this.mt2;)r[r.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&r.DM;for(t=e+this.m.t,r[t]+=this.m.am(0,n,r,e,0,this.m.t);r[t]>=r.DV;)r[t]-=r.DV,r[++t]++}r.clamp(),r.drShiftTo(this.m.t,r),r.compareTo(this.m)>=0&&r.subTo(this.m,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}(),$I=function(){function i(r){this.m=r,this.r2=re(),this.q3=re(),Q.ONE.dlShiftTo(2*r.t,this.r2),this.mu=this.r2.divide(r)}return i.prototype.convert=function(r){if(r.s<0||r.t>2*this.m.t)return r.mod(this.m);if(r.compareTo(this.m)<0)return r;var e=re();return r.copyTo(e),this.reduce(e),e},i.prototype.revert=function(r){return r},i.prototype.reduce=function(r){for(r.drShiftTo(this.m.t-1,this.r2),r.t>this.m.t+1&&(r.t=this.m.t+1,r.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);r.compareTo(this.r2)<0;)r.dAddOffset(1,this.m.t+1);for(r.subTo(this.r2,r);r.compareTo(this.m)>=0;)r.subTo(this.m,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}();function re(){return new Q(null)}function Se(i,r){return new Q(i,r)}var Tp=typeof navigator<"u";Tp&&Ep&&navigator.appName=="Microsoft Internet Explorer"?(Q.prototype.am=function(r,e,t,n,a,o){for(var s=e&32767,u=e>>15;--o>=0;){var l=this[r]&32767,h=this[r++]>>15,c=u*l+h*s;l=s*l+((c&32767)<<15)+t[n]+(a&1073741823),a=(l>>>30)+(c>>>15)+u*h+(a>>>30),t[n++]=l&1073741823}return a},ni=30):Tp&&Ep&&navigator.appName!="Netscape"?(Q.prototype.am=function(r,e,t,n,a,o){for(;--o>=0;){var s=e*this[r++]+t[n]+a;a=Math.floor(s/67108864),t[n++]=s&67108863}return a},ni=26):(Q.prototype.am=function(r,e,t,n,a,o){for(var s=e&16383,u=e>>14;--o>=0;){var l=this[r]&16383,h=this[r++]>>14,c=u*l+h*s;l=s*l+((c&16383)<<14)+t[n]+a,a=(l>>28)+(c>>14)+u*h,t[n++]=l&268435455}return a},ni=28);Q.prototype.DB=ni;Q.prototype.DM=(1<>>16)!=0&&(i=e,r+=16),(e=i>>8)!=0&&(i=e,r+=8),(e=i>>4)!=0&&(i=e,r+=4),(e=i>>2)!=0&&(i=e,r+=2),(e=i>>1)!=0&&(i=e,r+=1),r}Q.ZERO=Jr(0);Q.ONE=Jr(1);var wI=function(){function i(){this.i=0,this.j=0,this.S=[]}return i.prototype.init=function(r){var e,t,n;for(e=0;e<256;++e)this.S[e]=e;for(t=0,e=0;e<256;++e)t=t+this.S[e]+r[e%r.length]&255,n=this.S[e],this.S[e]=this.S[t],this.S[t]=n;this.i=0,this.j=0},i.prototype.next=function(){var r;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,r=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=r,this.S[r+this.S[this.i]&255]},i}();function _I(){return new wI}var q$=256,bs,ei=null,er;if(ei==null){ei=[],er=0;var $s=void 0;if(typeof window<"u"&&window.crypto&&window.crypto.getRandomValues){var ah=new Uint32Array(256);for(window.crypto.getRandomValues(ah),$s=0;$s=256||er>=q$){window.removeEventListener?window.removeEventListener("mousemove",_s,!1):window.detachEvent&&window.detachEvent("onmousemove",_s);return}try{var r=i.x+i.y;ei[er++]=r&255,ws+=1}catch{}};typeof window<"u"&&(window.addEventListener?window.addEventListener("mousemove",_s,!1):window.attachEvent&&window.attachEvent("onmousemove",_s))}function EI(){if(bs==null){for(bs=_I();er=0&&r>0;){var n=i.charCodeAt(t--);n<128?e[--r]=n:n>127&&n<2048?(e[--r]=n&63|128,e[--r]=n>>6|192):(e[--r]=n&63|128,e[--r]=n>>6&63|128,e[--r]=n>>12|224)}e[--r]=0;for(var a=new _d,o=[];r>2;){for(o[0]=0;o[0]==0;)a.nextBytes(o);e[--r]=o[0]}return e[--r]=2,e[--r]=0,new Q(e)}var TI=function(){function i(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return i.prototype.doPublic=function(r){return r.modPowInt(this.e,this.n)},i.prototype.doPrivate=function(r){if(this.p==null||this.q==null)return r.modPow(this.d,this.n);for(var e=r.mod(this.p).modPow(this.dmp1,this.p),t=r.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(t)<0;)e=e.add(this.p);return e.subtract(t).multiply(this.coeff).mod(this.p).multiply(this.q).add(t)},i.prototype.setPublic=function(r,e){r!=null&&e!=null&&r.length>0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},i.prototype.encrypt=function(r){var e=this.n.bitLength()+7>>3,t=OI(r,e);if(t==null)return null;var n=this.doPublic(t);if(n==null)return null;for(var a=n.toString(16),o=a.length,s=0;s0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16),this.d=Se(t,16)):console.error("Invalid RSA private key")},i.prototype.setPrivateEx=function(r,e,t,n,a,o,s,u){r!=null&&e!=null&&r.length>0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16),this.d=Se(t,16),this.p=Se(n,16),this.q=Se(a,16),this.dmp1=Se(o,16),this.dmq1=Se(s,16),this.coeff=Se(u,16)):console.error("Invalid RSA private key")},i.prototype.generate=function(r,e){var t=new _d,n=r>>1;this.e=parseInt(e,16);for(var a=new Q(e,16);;){for(;this.p=new Q(r-n,1,t),!(this.p.subtract(Q.ONE).gcd(a).compareTo(Q.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new Q(n,1,t),!(this.q.subtract(Q.ONE).gcd(a).compareTo(Q.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(Q.ONE),u=this.q.subtract(Q.ONE),l=s.multiply(u);if(l.gcd(a).compareTo(Q.ONE)==0){this.n=this.p.multiply(this.q),this.d=a.modInverse(l),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(u),this.coeff=this.q.modInverse(this.p);break}}},i.prototype.decrypt=function(r){var e=Se(r,16),t=this.doPrivate(e);return t==null?null:II(t,this.n.bitLength()+7>>3)},i.prototype.generateAsync=function(r,e,t){var n=new _d,a=r>>1;this.e=parseInt(e,16);var o=new Q(e,16),s=this,u=function(){var l=function(){if(s.p.compareTo(s.q)<=0){var d=s.p;s.p=s.q,s.q=d}var f=s.p.subtract(Q.ONE),v=s.q.subtract(Q.ONE),p=f.multiply(v);p.gcd(o).compareTo(Q.ONE)==0?(s.n=s.p.multiply(s.q),s.d=o.modInverse(p),s.dmp1=s.d.mod(f),s.dmq1=s.d.mod(v),s.coeff=s.q.modInverse(s.p),setTimeout(function(){t()},0)):setTimeout(u,0)},h=function(){s.q=re(),s.q.fromNumberAsync(a,1,n,function(){s.q.subtract(Q.ONE).gcda(o,function(d){d.compareTo(Q.ONE)==0&&s.q.isProbablePrime(10)?setTimeout(l,0):setTimeout(h,0)})})},c=function(){s.p=re(),s.p.fromNumberAsync(r-a,1,n,function(){s.p.subtract(Q.ONE).gcda(o,function(d){d.compareTo(Q.ONE)==0&&s.p.isProbablePrime(10)?setTimeout(h,0):setTimeout(c,0)})})};setTimeout(c,0)};setTimeout(u,0)},i.prototype.sign=function(r,e,t){var n=kI(t),a=n+e(r).toString(),o=SI(a,this.n.bitLength()/4);if(o==null)return null;var s=this.doPrivate(o);if(s==null)return null;var u=s.toString(16);return u.length&1?"0"+u:u},i.prototype.verify=function(r,e,t){var n=Se(e,16),a=this.doPublic(n);if(a==null)return null;var o=a.toString(16).replace(/^1f+00/,""),s=PI(o);return s==t(r).toString()},i}();function II(i,r){for(var e=i.toByteArray(),t=0;t=e.length)return null;for(var n="";++t191&&a<224?(n+=String.fromCharCode((a&31)<<6|e[t+1]&63),++t):(n+=String.fromCharCode((a&15)<<12|(e[t+1]&63)<<6|e[t+2]&63),t+=2)}return n}var uu={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function kI(i){return uu[i]||""}function PI(i){for(var r in uu)if(uu.hasOwnProperty(r)){var e=uu[r],t=e.length;if(i.substr(0,t)==e)return i.substr(t)}return i}/*! +`;t/=2,n>t&&(e=r+t);for(var o=r;ot&&(a+=G$),a},i.prototype.parseOID=function(r,e,t){for(var n="",a=new Ua,o=0,s=r;st)return Wn(n,t);a=new Ua,o=0}}return o>0&&(n+=".incomplete"),n},i}(),yI=function(){function i(r,e,t,n,a){if(!(n instanceof _p))throw new Error("Invalid tag value.");this.stream=r,this.header=e,this.length=t,this.tag=n,this.sub=a}return i.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},i.prototype.content=function(r){if(this.tag===void 0)return null;r===void 0&&(r=1/0);var e=this.posContent(),t=Math.abs(this.length);if(!this.tag.isUniversal())return this.sub!==null?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+t,r);switch(this.tag.tagNumber){case 1:return this.stream.get(e)===0?"false":"true";case 2:return this.stream.parseInteger(e,e+t);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+t,r);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+t,r);case 6:return this.stream.parseOID(e,e+t,r);case 16:case 17:return this.sub!==null?"("+this.sub.length+" elem)":"(no elem)";case 12:return Wn(this.stream.parseStringUTF(e,e+t),r);case 18:case 19:case 20:case 21:case 22:case 26:return Wn(this.stream.parseStringISO(e,e+t),r);case 30:return Wn(this.stream.parseStringBMP(e,e+t),r);case 23:case 24:return this.stream.parseTime(e,e+t,this.tag.tagNumber==23)}return null},i.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(this.sub===null?"null":this.sub.length)+"]"},i.prototype.toPrettyString=function(r){r===void 0&&(r="");var e=r+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":this.tag.isUniversal()&&(this.tag.tagNumber==3||this.tag.tagNumber==4)&&this.sub!==null&&(e+=" (encapsulates)"),e+=` +`,this.sub!==null){r+=" ";for(var t=0,n=this.sub.length;t6)throw new Error("Length over 48 bits not supported at position "+(r.pos-1));if(t===0)return null;e=0;for(var n=0;n>6,this.tagConstructed=(e&32)!==0,this.tagNumber=e&31,this.tagNumber==31){var t=new Ua;do e=r.get(),t.mulAdd(128,e&127);while(e&128);this.tagNumber=t.simplify()}}return i.prototype.isUniversal=function(){return this.tagClass===0},i.prototype.isEOC=function(){return this.tagClass===0&&this.tagNumber===0},i}(),ni,mI=0xdeadbeefcafe,Ep=(mI&16777215)==15715070,dt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],bI=(1<<26)/dt[dt.length-1],Q=function(){function i(r,e,t){r!=null&&(typeof r=="number"?this.fromNumber(r,e,t):e==null&&typeof r!="string"?this.fromString(r,256):this.fromString(r,e))}return i.prototype.toString=function(r){if(this.s<0)return"-"+this.negate().toString(r);var e;if(r==16)e=4;else if(r==8)e=3;else if(r==2)e=1;else if(r==32)e=5;else if(r==4)e=2;else return this.toRadix(r);var t=(1<0)for(u>u)>0&&(a=!0,o=Or(n));s>=0;)u>(u+=this.DB-e)):(n=this[s]>>(u-=e)&t,u<=0&&(u+=this.DB,--s)),n>0&&(a=!0),a&&(o+=Or(n));return a?o:"0"},i.prototype.negate=function(){var r=re();return i.ZERO.subTo(this,r),r},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(r){var e=this.s-r.s;if(e!=0)return e;var t=this.t;if(e=t-r.t,e!=0)return this.s<0?-e:e;for(;--t>=0;)if((e=this[t]-r[t])!=0)return e;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+ms(this[this.t-1]^this.s&this.DM)},i.prototype.mod=function(r){var e=re();return this.abs().divRemTo(r,null,e),this.s<0&&e.compareTo(i.ZERO)>0&&r.subTo(e,e),e},i.prototype.modPowInt=function(r,e){var t;return r<256||e.isEven()?t=new Sp(e):t=new Op(e),this.exp(r,t)},i.prototype.clone=function(){var r=re();return this.copyTo(r),r},i.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24},i.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},i.prototype.toByteArray=function(){var r=this.t,e=[];e[0]=this.s;var t=this.DB-r*this.DB%8,n,a=0;if(r-- >0)for(t>t)!=(this.s&this.DM)>>t&&(e[a++]=n|this.s<=0;)t<8?(n=(this[r]&(1<>(t+=this.DB-8)):(n=this[r]>>(t-=8)&255,t<=0&&(t+=this.DB,--r)),n&128&&(n|=-256),a==0&&(this.s&128)!=(n&128)&&++a,(a>0||n!=this.s)&&(e[a++]=n);return e},i.prototype.equals=function(r){return this.compareTo(r)==0},i.prototype.min=function(r){return this.compareTo(r)<0?this:r},i.prototype.max=function(r){return this.compareTo(r)>0?this:r},i.prototype.and=function(r){var e=re();return this.bitwiseTo(r,cI,e),e},i.prototype.or=function(r){var e=re();return this.bitwiseTo(r,ys,e),e},i.prototype.xor=function(r){var e=re();return this.bitwiseTo(r,bp,e),e},i.prototype.andNot=function(r){var e=re();return this.bitwiseTo(r,$p,e),e},i.prototype.not=function(){for(var r=re(),e=0;e=this.t?this.s!=0:(this[e]&1<1){var c=re();for(o.sqrTo(s[1],c);u<=h;)s[u]=re(),o.mulTo(c,s[u-2],s[u]),u+=2}var d=r.t-1,f,v=!0,p=re(),g;for(t=ms(r[d])-1;d>=0;){for(t>=l?f=r[d]>>t-l&h:(f=(r[d]&(1<0&&(f|=r[d-1]>>this.DB+t-l)),u=n;!(f&1);)f>>=1,--u;if((t-=u)<0&&(t+=this.DB,--d),v)s[f].copyTo(a),v=!1;else{for(;u>1;)o.sqrTo(a,p),o.sqrTo(p,a),u-=2;u>0?o.sqrTo(a,p):(g=a,a=p,p=g),o.mulTo(p,s[f],a)}for(;d>=0&&!(r[d]&1<=0?(t.subTo(n,t),e&&a.subTo(s,a),o.subTo(u,o)):(n.subTo(t,n),e&&s.subTo(a,s),u.subTo(o,u))}if(n.compareTo(i.ONE)!=0)return i.ZERO;if(u.compareTo(r)>=0)return u.subtract(r);if(u.signum()<0)u.addTo(r,u);else return u;return u.signum()<0?u.add(r):u},i.prototype.pow=function(r){return this.exp(r,new $I)},i.prototype.gcd=function(r){var e=this.s<0?this.negate():this.clone(),t=r.s<0?r.negate():r.clone();if(e.compareTo(t)<0){var n=e;e=t,t=n}var a=e.getLowestSetBit(),o=t.getLowestSetBit();if(o<0)return e;for(a0&&(e.rShiftTo(o,e),t.rShiftTo(o,t));e.signum()>0;)(a=e.getLowestSetBit())>0&&e.rShiftTo(a,e),(a=t.getLowestSetBit())>0&&t.rShiftTo(a,t),e.compareTo(t)>=0?(e.subTo(t,e),e.rShiftTo(1,e)):(t.subTo(e,t),t.rShiftTo(1,t));return o>0&&t.lShiftTo(o,t),t},i.prototype.isProbablePrime=function(r){var e,t=this.abs();if(t.t==1&&t[0]<=dt[dt.length-1]){for(e=0;e=0;--e)r[e]=this[e];r.t=this.t,r.s=this.s},i.prototype.fromInt=function(r){this.t=1,this.s=r<0?-1:0,r>0?this[0]=r:r<-1?this[0]=r+this.DV:this.t=0},i.prototype.fromString=function(r,e){var t;if(e==16)t=4;else if(e==8)t=3;else if(e==256)t=8;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else{this.fromRadix(r,e);return}this.t=0,this.s=0;for(var n=r.length,a=!1,o=0;--n>=0;){var s=t==8?+r[n]&255:Ip(r,n);if(s<0){r.charAt(n)=="-"&&(a=!0);continue}a=!1,o==0?this[this.t++]=s:o+t>this.DB?(this[this.t-1]|=(s&(1<>this.DB-o):this[this.t-1]|=s<=this.DB&&(o-=this.DB)}t==8&&+r[0]&128&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==r;)--this.t},i.prototype.dlShiftTo=function(r,e){var t;for(t=this.t-1;t>=0;--t)e[t+r]=this[t];for(t=r-1;t>=0;--t)e[t]=0;e.t=this.t+r,e.s=this.s},i.prototype.drShiftTo=function(r,e){for(var t=r;t=0;--u)e[u+o+1]=this[u]>>n|s,s=(this[u]&a)<=0;--u)e[u]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},i.prototype.rShiftTo=function(r,e){e.s=this.s;var t=Math.floor(r/this.DB);if(t>=this.t){e.t=0;return}var n=r%this.DB,a=this.DB-n,o=(1<>n;for(var s=t+1;s>n;n>0&&(e[this.t-t-1]|=(this.s&o)<>=this.DB;if(r.t>=this.DB;n+=this.s}else{for(n+=this.s;t>=this.DB;n-=r.s}e.s=n<0?-1:0,n<-1?e[t++]=this.DV+n:n>0&&(e[t++]=n),e.t=t,e.clamp()},i.prototype.multiplyTo=function(r,e){var t=this.abs(),n=r.abs(),a=t.t;for(e.t=a+n.t;--a>=0;)e[a]=0;for(a=0;a=0;)r[t]=0;for(t=0;t=e.DV&&(r[t+e.t]-=e.DV,r[t+e.t+1]=1)}r.t>0&&(r[r.t-1]+=e.am(t,e[t],r,2*t,0,1)),r.s=0,r.clamp()},i.prototype.divRemTo=function(r,e,t){var n=r.abs();if(!(n.t<=0)){var a=this.abs();if(a.t0?(n.lShiftTo(l,o),a.lShiftTo(l,t)):(n.copyTo(o),a.copyTo(t));var h=o.t,c=o[h-1];if(c!=0){var d=c*(1<1?o[h-2]>>this.F2:0),f=this.FV/d,v=(1<=0&&(t[t.t++]=1,t.subTo(m,t)),i.ONE.dlShiftTo(h,m),m.subTo(o,o);o.t=0;){var $=t[--g]==c?this.DM:Math.floor(t[g]*f+(t[g-1]+p)*v);if((t[g]+=o.am(0,$,t,y,0,h))<$)for(o.dlShiftTo(y,m),t.subTo(m,t);t[g]<--$;)t.subTo(m,t)}e!=null&&(t.drShiftTo(h,e),s!=u&&i.ZERO.subTo(e,e)),t.t=h,t.clamp(),l>0&&t.rShiftTo(l,t),s<0&&i.ZERO.subTo(t,t)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var r=this[0];if(!(r&1))return 0;var e=r&3;return e=e*(2-(r&15)*e)&15,e=e*(2-(r&255)*e)&255,e=e*(2-((r&65535)*e&65535))&65535,e=e*(2-r*e%this.DV)%this.DV,e>0?this.DV-e:-e},i.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0},i.prototype.exp=function(r,e){if(r>4294967295||r<1)return i.ONE;var t=re(),n=re(),a=e.convert(this),o=ms(r)-1;for(a.copyTo(t);--o>=0;)if(e.sqrTo(t,n),(r&1<0)e.mulTo(n,a,t);else{var s=t;t=n,n=s}return e.revert(t)},i.prototype.chunkSize=function(r){return Math.floor(Math.LN2*this.DB/Math.log(r))},i.prototype.toRadix=function(r){if(r==null&&(r=10),this.signum()==0||r<2||r>36)return"0";var e=this.chunkSize(r),t=Math.pow(r,e),n=Jr(t),a=re(),o=re(),s="";for(this.divRemTo(n,a,o);a.signum()>0;)s=(t+o.intValue()).toString(r).substr(1)+s,a.divRemTo(n,a,o);return o.intValue().toString(r)+s},i.prototype.fromRadix=function(r,e){this.fromInt(0),e==null&&(e=10);for(var t=this.chunkSize(e),n=Math.pow(e,t),a=!1,o=0,s=0,u=0;u=t&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),a&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(r,e,t){if(typeof e=="number")if(r<2)this.fromInt(1);else for(this.fromNumber(r,t),this.testBit(r-1)||this.bitwiseTo(i.ONE.shiftLeft(r-1),ys,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>r&&this.subTo(i.ONE.shiftLeft(r-1),this);else{var n=[],a=r&7;n.length=(r>>3)+1,e.nextBytes(n),a>0?n[0]&=(1<>=this.DB;if(r.t>=this.DB;n+=this.s}else{for(n+=this.s;t>=this.DB;n+=r.s}e.s=n<0?-1:0,n>0?e[t++]=n:n<-1&&(e[t++]=this.DV+n),e.t=t,e.clamp()},i.prototype.dMultiply=function(r){this[this.t]=this.am(0,r-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(r,e){if(r!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=r;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},i.prototype.multiplyLowerTo=function(r,e,t){var n=Math.min(this.t+r.t,e);for(t.s=0,t.t=n;n>0;)t[--n]=0;for(var a=t.t-this.t;n=0;)t[n]=0;for(n=Math.max(e-this.t,0);n0)if(e==0)t=this[0]%r;else for(var n=this.t-1;n>=0;--n)t=(e*t+this[n])%r;return t},i.prototype.millerRabin=function(r){var e=this.subtract(i.ONE),t=e.getLowestSetBit();if(t<=0)return!1;var n=e.shiftRight(t);r=r+1>>1,r>dt.length&&(r=dt.length);for(var a=re(),o=0;o0&&(t.rShiftTo(s,t),n.rShiftTo(s,n));var u=function(){(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n)),t.signum()>0?setTimeout(u,0):(s>0&&n.lShiftTo(s,n),setTimeout(function(){e(n)},0))};setTimeout(u,10)},i.prototype.fromNumberAsync=function(r,e,t,n){if(typeof e=="number")if(r<2)this.fromInt(1);else{this.fromNumber(r,t),this.testBit(r-1)||this.bitwiseTo(i.ONE.shiftLeft(r-1),ys,this),this.isEven()&&this.dAddOffset(1,0);var a=this,o=function(){a.dAddOffset(2,0),a.bitLength()>r&&a.subTo(i.ONE.shiftLeft(r-1),a),a.isProbablePrime(e)?setTimeout(function(){n()},0):setTimeout(o,0)};setTimeout(o,0)}else{var s=[],u=r&7;s.length=(r>>3)+1,e.nextBytes(s),u>0?s[0]&=(1<=0?r.mod(this.m):r},i.prototype.revert=function(r){return r},i.prototype.reduce=function(r){r.divRemTo(this.m,null,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}(),Op=function(){function i(r){this.m=r,this.mp=r.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e},i.prototype.revert=function(r){var e=re();return r.copyTo(e),this.reduce(e),e},i.prototype.reduce=function(r){for(;r.t<=this.mt2;)r[r.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&r.DM;for(t=e+this.m.t,r[t]+=this.m.am(0,n,r,e,0,this.m.t);r[t]>=r.DV;)r[t]-=r.DV,r[++t]++}r.clamp(),r.drShiftTo(this.m.t,r),r.compareTo(this.m)>=0&&r.subTo(this.m,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}(),wI=function(){function i(r){this.m=r,this.r2=re(),this.q3=re(),Q.ONE.dlShiftTo(2*r.t,this.r2),this.mu=this.r2.divide(r)}return i.prototype.convert=function(r){if(r.s<0||r.t>2*this.m.t)return r.mod(this.m);if(r.compareTo(this.m)<0)return r;var e=re();return r.copyTo(e),this.reduce(e),e},i.prototype.revert=function(r){return r},i.prototype.reduce=function(r){for(r.drShiftTo(this.m.t-1,this.r2),r.t>this.m.t+1&&(r.t=this.m.t+1,r.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);r.compareTo(this.r2)<0;)r.dAddOffset(1,this.m.t+1);for(r.subTo(this.r2,r);r.compareTo(this.m)>=0;)r.subTo(this.m,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}();function re(){return new Q(null)}function Se(i,r){return new Q(i,r)}var Tp=typeof navigator<"u";Tp&&Ep&&navigator.appName=="Microsoft Internet Explorer"?(Q.prototype.am=function(r,e,t,n,a,o){for(var s=e&32767,u=e>>15;--o>=0;){var l=this[r]&32767,h=this[r++]>>15,c=u*l+h*s;l=s*l+((c&32767)<<15)+t[n]+(a&1073741823),a=(l>>>30)+(c>>>15)+u*h+(a>>>30),t[n++]=l&1073741823}return a},ni=30):Tp&&Ep&&navigator.appName!="Netscape"?(Q.prototype.am=function(r,e,t,n,a,o){for(;--o>=0;){var s=e*this[r++]+t[n]+a;a=Math.floor(s/67108864),t[n++]=s&67108863}return a},ni=26):(Q.prototype.am=function(r,e,t,n,a,o){for(var s=e&16383,u=e>>14;--o>=0;){var l=this[r]&16383,h=this[r++]>>14,c=u*l+h*s;l=s*l+((c&16383)<<14)+t[n]+a,a=(l>>28)+(c>>14)+u*h,t[n++]=l&268435455}return a},ni=28);Q.prototype.DB=ni;Q.prototype.DM=(1<>>16)!=0&&(i=e,r+=16),(e=i>>8)!=0&&(i=e,r+=8),(e=i>>4)!=0&&(i=e,r+=4),(e=i>>2)!=0&&(i=e,r+=2),(e=i>>1)!=0&&(i=e,r+=1),r}Q.ZERO=Jr(0);Q.ONE=Jr(1);var _I=function(){function i(){this.i=0,this.j=0,this.S=[]}return i.prototype.init=function(r){var e,t,n;for(e=0;e<256;++e)this.S[e]=e;for(t=0,e=0;e<256;++e)t=t+this.S[e]+r[e%r.length]&255,n=this.S[e],this.S[e]=this.S[t],this.S[t]=n;this.i=0,this.j=0},i.prototype.next=function(){var r;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,r=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=r,this.S[r+this.S[this.i]&255]},i}();function EI(){return new _I}var q$=256,bs,ei=null,er;if(ei==null){ei=[],er=0;var $s=void 0;if(typeof window<"u"&&window.crypto&&window.crypto.getRandomValues){var ah=new Uint32Array(256);for(window.crypto.getRandomValues(ah),$s=0;$s=256||er>=q$){window.removeEventListener?window.removeEventListener("mousemove",_s,!1):window.detachEvent&&window.detachEvent("onmousemove",_s);return}try{var r=i.x+i.y;ei[er++]=r&255,ws+=1}catch{}};typeof window<"u"&&(window.addEventListener?window.addEventListener("mousemove",_s,!1):window.attachEvent&&window.attachEvent("onmousemove",_s))}function SI(){if(bs==null){for(bs=EI();er=0&&r>0;){var n=i.charCodeAt(t--);n<128?e[--r]=n:n>127&&n<2048?(e[--r]=n&63|128,e[--r]=n>>6|192):(e[--r]=n&63|128,e[--r]=n>>6&63|128,e[--r]=n>>12|224)}e[--r]=0;for(var a=new _d,o=[];r>2;){for(o[0]=0;o[0]==0;)a.nextBytes(o);e[--r]=o[0]}return e[--r]=2,e[--r]=0,new Q(e)}var II=function(){function i(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return i.prototype.doPublic=function(r){return r.modPowInt(this.e,this.n)},i.prototype.doPrivate=function(r){if(this.p==null||this.q==null)return r.modPow(this.d,this.n);for(var e=r.mod(this.p).modPow(this.dmp1,this.p),t=r.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(t)<0;)e=e.add(this.p);return e.subtract(t).multiply(this.coeff).mod(this.p).multiply(this.q).add(t)},i.prototype.setPublic=function(r,e){r!=null&&e!=null&&r.length>0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},i.prototype.encrypt=function(r){var e=this.n.bitLength()+7>>3,t=TI(r,e);if(t==null)return null;var n=this.doPublic(t);if(n==null)return null;for(var a=n.toString(16),o=a.length,s=0;s0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16),this.d=Se(t,16)):console.error("Invalid RSA private key")},i.prototype.setPrivateEx=function(r,e,t,n,a,o,s,u){r!=null&&e!=null&&r.length>0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16),this.d=Se(t,16),this.p=Se(n,16),this.q=Se(a,16),this.dmp1=Se(o,16),this.dmq1=Se(s,16),this.coeff=Se(u,16)):console.error("Invalid RSA private key")},i.prototype.generate=function(r,e){var t=new _d,n=r>>1;this.e=parseInt(e,16);for(var a=new Q(e,16);;){for(;this.p=new Q(r-n,1,t),!(this.p.subtract(Q.ONE).gcd(a).compareTo(Q.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new Q(n,1,t),!(this.q.subtract(Q.ONE).gcd(a).compareTo(Q.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(Q.ONE),u=this.q.subtract(Q.ONE),l=s.multiply(u);if(l.gcd(a).compareTo(Q.ONE)==0){this.n=this.p.multiply(this.q),this.d=a.modInverse(l),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(u),this.coeff=this.q.modInverse(this.p);break}}},i.prototype.decrypt=function(r){var e=Se(r,16),t=this.doPrivate(e);return t==null?null:kI(t,this.n.bitLength()+7>>3)},i.prototype.generateAsync=function(r,e,t){var n=new _d,a=r>>1;this.e=parseInt(e,16);var o=new Q(e,16),s=this,u=function(){var l=function(){if(s.p.compareTo(s.q)<=0){var d=s.p;s.p=s.q,s.q=d}var f=s.p.subtract(Q.ONE),v=s.q.subtract(Q.ONE),p=f.multiply(v);p.gcd(o).compareTo(Q.ONE)==0?(s.n=s.p.multiply(s.q),s.d=o.modInverse(p),s.dmp1=s.d.mod(f),s.dmq1=s.d.mod(v),s.coeff=s.q.modInverse(s.p),setTimeout(function(){t()},0)):setTimeout(u,0)},h=function(){s.q=re(),s.q.fromNumberAsync(a,1,n,function(){s.q.subtract(Q.ONE).gcda(o,function(d){d.compareTo(Q.ONE)==0&&s.q.isProbablePrime(10)?setTimeout(l,0):setTimeout(h,0)})})},c=function(){s.p=re(),s.p.fromNumberAsync(r-a,1,n,function(){s.p.subtract(Q.ONE).gcda(o,function(d){d.compareTo(Q.ONE)==0&&s.p.isProbablePrime(10)?setTimeout(h,0):setTimeout(c,0)})})};setTimeout(c,0)};setTimeout(u,0)},i.prototype.sign=function(r,e,t){var n=PI(t),a=n+e(r).toString(),o=OI(a,this.n.bitLength()/4);if(o==null)return null;var s=this.doPrivate(o);if(s==null)return null;var u=s.toString(16);return u.length&1?"0"+u:u},i.prototype.verify=function(r,e,t){var n=Se(e,16),a=this.doPublic(n);if(a==null)return null;var o=a.toString(16).replace(/^1f+00/,""),s=xI(o);return s==t(r).toString()},i}();function kI(i,r){for(var e=i.toByteArray(),t=0;t=e.length)return null;for(var n="";++t191&&a<224?(n+=String.fromCharCode((a&31)<<6|e[t+1]&63),++t):(n+=String.fromCharCode((a&15)<<12|(e[t+1]&63)<<6|e[t+2]&63),t+=2)}return n}var uu={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function PI(i){return uu[i]||""}function xI(i){for(var r in uu)if(uu.hasOwnProperty(r)){var e=uu[r],t=e.length;if(i.substr(0,t)==e)return i.substr(t)}return i}/*! Copyright (c) 2011, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html @@ -17,14 +17,14 @@ version: 2.9.0 * @version asn1 1.0.13 (2017-Jun-02) * @since jsrsasign 2.1 * @license MIT License - */var T={};(typeof T.asn1>"u"||!T.asn1)&&(T.asn1={});T.asn1.ASN1Util=new function(){this.integerToByteHex=function(i){var r=i.toString(16);return r.length%2==1&&(r="0"+r),r},this.bigIntToMinTwosComplementsHex=function(i){var r=i.toString(16);if(r.substr(0,1)!="-")r.length%2==1?r="0"+r:r.match(/^[0-7]/)||(r="00"+r);else{var e=r.substr(1),t=e.length;t%2==1?t+=1:r.match(/^[0-7]/)||(t+=2);for(var n="",a=0;a"u"||this.hV==null)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+i.length+",v="+this.hV;var r=this.hV.length/2,e=r.toString(16);if(e.length%2==1&&(e="0"+e),r<128)return e;var t=e.length/2;if(t>15)throw"ASN.1 length too long to represent by 8x: n = "+r.toString(16);var n=128+t;return n.toString(16)+e},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}};T.asn1.DERAbstractString=function(i){T.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(r){this.hTLV=null,this.isModified=!0,this.s=r,this.hV=stohex(this.s)},this.setStringHex=function(r){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i=="string"?this.setString(i):typeof i.str<"u"?this.setString(i.str):typeof i.hex<"u"&&this.setStringHex(i.hex))};Me.lang.extend(T.asn1.DERAbstractString,T.asn1.ASN1Object);T.asn1.DERAbstractTime=function(i){T.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(r){utc=r.getTime()+r.getTimezoneOffset()*6e4;var e=new Date(utc);return e},this.formatDate=function(r,e,t){var n=this.zeroPadding,a=this.localDateToUTC(r),o=String(a.getFullYear());e=="utc"&&(o=o.substr(2,2));var s=n(String(a.getMonth()+1),2),u=n(String(a.getDate()),2),l=n(String(a.getHours()),2),h=n(String(a.getMinutes()),2),c=n(String(a.getSeconds()),2),d=o+s+u+l+h+c;if(t===!0){var f=a.getMilliseconds();if(f!=0){var v=n(String(f),3);v=v.replace(/[0]+$/,""),d=d+"."+v}}return d+"Z"},this.zeroPadding=function(r,e){return r.length>=e?r:new Array(e-r.length+1).join("0")+r},this.getString=function(){return this.s},this.setString=function(r){this.hTLV=null,this.isModified=!0,this.s=r,this.hV=stohex(r)},this.setByDateValue=function(r,e,t,n,a,o){var s=new Date(Date.UTC(r,e-1,t,n,a,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}};Me.lang.extend(T.asn1.DERAbstractTime,T.asn1.ASN1Object);T.asn1.DERAbstractStructured=function(i){T.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array=r},this.appendASN1Object=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array.push(r)},this.asn1Array=new Array,typeof i<"u"&&typeof i.array<"u"&&(this.asn1Array=i.array)};Me.lang.extend(T.asn1.DERAbstractStructured,T.asn1.ASN1Object);T.asn1.DERBoolean=function(){T.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"};Me.lang.extend(T.asn1.DERBoolean,T.asn1.ASN1Object);T.asn1.DERInteger=function(i){T.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(r){this.hTLV=null,this.isModified=!0,this.hV=T.asn1.ASN1Util.bigIntToMinTwosComplementsHex(r)},this.setByInteger=function(r){var e=new Q(String(r),10);this.setByBigInteger(e)},this.setValueHex=function(r){this.hV=r},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i.bigint<"u"?this.setByBigInteger(i.bigint):typeof i.int<"u"?this.setByInteger(i.int):typeof i=="number"?this.setByInteger(i):typeof i.hex<"u"&&this.setValueHex(i.hex))};Me.lang.extend(T.asn1.DERInteger,T.asn1.ASN1Object);T.asn1.DERBitString=function(i){if(i!==void 0&&typeof i.obj<"u"){var r=T.asn1.ASN1Util.newObject(i.obj);i.hex="00"+r.getEncodedHex()}T.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7"u"&&typeof this.s>"u"&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{12}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date))};Me.lang.extend(T.asn1.DERUTCTime,T.asn1.DERAbstractTime);T.asn1.DERGeneralizedTime=function(i){T.asn1.DERGeneralizedTime.superclass.constructor.call(this,i),this.hT="18",this.withMillis=!1,this.setByDate=function(r){this.hTLV=null,this.isModified=!0,this.date=r,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{14}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date),i.millis===!0&&(this.withMillis=!0))};Me.lang.extend(T.asn1.DERGeneralizedTime,T.asn1.DERAbstractTime);T.asn1.DERSequence=function(i){T.asn1.DERSequence.superclass.constructor.call(this,i),this.hT="30",this.getFreshValueHex=function(){for(var r="",e=0;e"u"||!T.asn1)&&(T.asn1={});T.asn1.ASN1Util=new function(){this.integerToByteHex=function(i){var r=i.toString(16);return r.length%2==1&&(r="0"+r),r},this.bigIntToMinTwosComplementsHex=function(i){var r=i.toString(16);if(r.substr(0,1)!="-")r.length%2==1?r="0"+r:r.match(/^[0-7]/)||(r="00"+r);else{var e=r.substr(1),t=e.length;t%2==1?t+=1:r.match(/^[0-7]/)||(t+=2);for(var n="",a=0;a"u"||this.hV==null)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+i.length+",v="+this.hV;var r=this.hV.length/2,e=r.toString(16);if(e.length%2==1&&(e="0"+e),r<128)return e;var t=e.length/2;if(t>15)throw"ASN.1 length too long to represent by 8x: n = "+r.toString(16);var n=128+t;return n.toString(16)+e},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}};T.asn1.DERAbstractString=function(i){T.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(r){this.hTLV=null,this.isModified=!0,this.s=r,this.hV=stohex(this.s)},this.setStringHex=function(r){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i=="string"?this.setString(i):typeof i.str<"u"?this.setString(i.str):typeof i.hex<"u"&&this.setStringHex(i.hex))};Me.lang.extend(T.asn1.DERAbstractString,T.asn1.ASN1Object);T.asn1.DERAbstractTime=function(i){T.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(r){utc=r.getTime()+r.getTimezoneOffset()*6e4;var e=new Date(utc);return e},this.formatDate=function(r,e,t){var n=this.zeroPadding,a=this.localDateToUTC(r),o=String(a.getFullYear());e=="utc"&&(o=o.substr(2,2));var s=n(String(a.getMonth()+1),2),u=n(String(a.getDate()),2),l=n(String(a.getHours()),2),h=n(String(a.getMinutes()),2),c=n(String(a.getSeconds()),2),d=o+s+u+l+h+c;if(t===!0){var f=a.getMilliseconds();if(f!=0){var v=n(String(f),3);v=v.replace(/[0]+$/,""),d=d+"."+v}}return d+"Z"},this.zeroPadding=function(r,e){return r.length>=e?r:new Array(e-r.length+1).join("0")+r},this.getString=function(){return this.s},this.setString=function(r){this.hTLV=null,this.isModified=!0,this.s=r,this.hV=stohex(r)},this.setByDateValue=function(r,e,t,n,a,o){var s=new Date(Date.UTC(r,e-1,t,n,a,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}};Me.lang.extend(T.asn1.DERAbstractTime,T.asn1.ASN1Object);T.asn1.DERAbstractStructured=function(i){T.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array=r},this.appendASN1Object=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array.push(r)},this.asn1Array=new Array,typeof i<"u"&&typeof i.array<"u"&&(this.asn1Array=i.array)};Me.lang.extend(T.asn1.DERAbstractStructured,T.asn1.ASN1Object);T.asn1.DERBoolean=function(){T.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"};Me.lang.extend(T.asn1.DERBoolean,T.asn1.ASN1Object);T.asn1.DERInteger=function(i){T.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(r){this.hTLV=null,this.isModified=!0,this.hV=T.asn1.ASN1Util.bigIntToMinTwosComplementsHex(r)},this.setByInteger=function(r){var e=new Q(String(r),10);this.setByBigInteger(e)},this.setValueHex=function(r){this.hV=r},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i.bigint<"u"?this.setByBigInteger(i.bigint):typeof i.int<"u"?this.setByInteger(i.int):typeof i=="number"?this.setByInteger(i):typeof i.hex<"u"&&this.setValueHex(i.hex))};Me.lang.extend(T.asn1.DERInteger,T.asn1.ASN1Object);T.asn1.DERBitString=function(i){if(i!==void 0&&typeof i.obj<"u"){var r=T.asn1.ASN1Util.newObject(i.obj);i.hex="00"+r.getEncodedHex()}T.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7"u"&&typeof this.s>"u"&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{12}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date))};Me.lang.extend(T.asn1.DERUTCTime,T.asn1.DERAbstractTime);T.asn1.DERGeneralizedTime=function(i){T.asn1.DERGeneralizedTime.superclass.constructor.call(this,i),this.hT="18",this.withMillis=!1,this.setByDate=function(r){this.hTLV=null,this.isModified=!0,this.date=r,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{14}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date),i.millis===!0&&(this.withMillis=!0))};Me.lang.extend(T.asn1.DERGeneralizedTime,T.asn1.DERAbstractTime);T.asn1.DERSequence=function(i){T.asn1.DERSequence.superclass.constructor.call(this,i),this.hT="30",this.getFreshValueHex=function(){for(var r="",e=0;elocalStorage.getItem("chatApiKey"),Ba=()=>{const i=localStorage.getItem("openaiApiKey"),r=localStorage.getItem("openaiBaseUrl")||"https://api.openai.com/v1",e=localStorage.getItem("rsaPublicKey");return{openaiApiKey:i||"",openaiBaseUrl:r,rsaPublicKey:e}},Kr=()=>navigator.language||"zh-CN",yn=i=>{const r=i.headers.get("User-Api-Key");r&&!localStorage.getItem("chatApiKey")&&localStorage.setItem("chatApiKey",r)};var ai;(i=>{async function r(l){try{const h=Ur(),c=Kr();l.session_id=localStorage.getItem("sessionId")||null,fetch(`${Wr}/api/chat/track_event`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${h}`,"trace-id":dr(),"Accept-Language":c},body:JSON.stringify(l)}).catch(d=>{console.warn("Track event failed:",d)})}catch(h){console.warn("Error preparing track event:",h)}return Promise.resolve()}i.trackEvent=r;async function*e(l,h,c=[],d=null,f=null,v){try{const p=Ur(),g=Kr(),{openaiApiKey:y,openaiBaseUrl:m,rsaPublicKey:$}=Ba(),b=dr(),O=(c||[]).map(ie=>new Promise((_e,ye)=>{const Ae=new FileReader;Ae.onloadend=()=>_e(Ae.result),Ae.onerror=ye,Ae.readAsDataURL(ie)})),_=await Promise.all(O);let D=f?Array.isArray(f)?f:[f]:[];const R={"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${p}`,"trace-id":v||dr(),"Accept-Language":g};if(y&&y.trim()!==""&&$)try{const ie=await xn(y,$);R["Encrypted-Openai-Api-Key"]=ie,R["Openai-Base-Url"]=m}catch(ie){console.error("Error encrypting OpenAI API key:",ie)}const P=new AbortController,B=setTimeout(()=>P.abort(),12e4),j=await fetch(`${Wr}/api/chat/invoke`,{method:"POST",headers:R,body:JSON.stringify({session_id:l,prompt:h,mock:!1,intent:d,ext:D,images:_.map((ie,_e)=>({filename:c[_e].name,data:ie}))}),signal:P.signal});clearTimeout(B),yn(j);const J=j.body.getReader();let U="";for(;;){const{done:ie,value:_e}=await J.read();if(ie)break;U+=new TextDecoder().decode(_e);const ye=U.split(` -`);U=ye.pop()||"";for(const Ae of ye)Ae.trim()&&(yield{...JSON.parse(Ae),message_id:b})}U.trim()&&(yield{...JSON.parse(U),message_id:b})}catch(p){throw console.error("Error in streamInvokeServer:",p),p.name==="AbortError"?alert("Request timed out after 2 minutes. Please try again."):alert(p instanceof Error?p.message:"An error occurred while streaming, please refresh the page and try again."),p}}i.streamInvokeServer=e;async function t(l,h){try{const c=Ur(),d=Kr(),{openaiApiKey:f,openaiBaseUrl:v,rsaPublicKey:p}=Ba(),g={"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${c}`,"trace-id":dr(),"Accept-Language":d};if(f&&f.trim()!==""&&p)try{const $=await xn(f,p);g["Encrypted-Openai-Api-Key"]=$,g["Openai-Base-Url"]=v}catch($){console.error("Error encrypting OpenAI API key:",$)}const y=await fetch(`${Wr}/api/chat/get_optimized_workflow`,{method:"POST",headers:g,body:JSON.stringify({workflow_id:l,prompt:h})});yn(y);const m=await y.json();if(!m.success){const $=m.message||"Failed to get optimized workflow";throw alert($),new Error($)}return m.data}catch(c){throw console.error("Error getting optimized workflow:",c),alert(c instanceof Error?c.message:"Failed to get optimized workflow"),c}}i.getOptimizedWorkflow=t;async function n(l){const h=Ur(),c=Kr(),{openaiApiKey:d,openaiBaseUrl:f,rsaPublicKey:v}=Ba(),p={"Content-Type":"application/json",Authorization:`Bearer ${h}`,"trace-id":dr(),"Accept-Language":c};if(d&&d.trim()!==""&&v)try{const m=await xn(d,v);p["Encrypted-Openai-Api-Key"]=m,p["Openai-Base-Url"]=f}catch(m){console.error("Error encrypting OpenAI API key:",m)}const g=await fetch(`${Wr}/api/chat/get_node_info_by_types`,{method:"POST",headers:p,body:JSON.stringify({node_types:l})});yn(g);const y=await g.json();if(!y.success){const m=y.message||"Failed to get node info by types";throw alert(m),new Error(m)}return y.data}i.batchGetNodeInfo=n;async function a(l){try{const h=localStorage.getItem(`messages_${l}`);if(h)return console.log("Using cached messages from localStorage"),JSON.parse(h);const c=Ur(),d=Kr(),{openaiApiKey:f,openaiBaseUrl:v,rsaPublicKey:p}=Ba(),g={accept:"application/json",Authorization:`Bearer ${c}`,"trace-id":dr(),"Accept-Language":d};if(f&&f.trim()!==""&&p)try{const b=await xn(f,p);g["Encrypted-Openai-Api-Key"]=b,g["Openai-Base-Url"]=v}catch(b){console.error("Error encrypting OpenAI API key:",b)}const y=await fetch(`${Wr}/api/chat/get_messages_by_session_id?session_id=${l}`,{method:"GET",headers:g});yn(y);const m=await y.json();if(!m.success){const b=m.message||"Failed to fetch messages";throw alert(b+", please refresh the page and try again."),new Error(b)}const $=m.data.map(b=>(console.log("msg.ext",b.ext),{id:b.id.toString(),content:b.role==="ai"?JSON.stringify({session_id:l,text:b.content,finished:b.finished||!1,format:b.format||"markdown",ext:b.ext}):b.content,role:b.role,name:b.role==="ai"?"Assistant":void 0,format:b.format||"markdown",finished:b.finished}));return localStorage.setItem(`messages_${l}`,JSON.stringify($)),$}catch(h){throw console.error("Error fetching messages:",h),alert(h instanceof Error?h.message:"Failed to fetch messages, please refresh the page and try again."),h}}i.fetchMessages=a;async function o(){try{const l=Ur(),h=Kr(),{openaiApiKey:c,openaiBaseUrl:d,rsaPublicKey:f}=Ba(),v={accept:"application/json",Authorization:`Bearer ${l}`,"trace-id":dr(),"Accept-Language":h};if(c&&c.trim()!==""&&f)try{const y=await xn(c,f);v["Encrypted-Openai-Api-Key"]=y,v["Openai-Base-Url"]=d}catch(y){console.error("Error encrypting OpenAI API key:",y)}const p=await fetch(`${Wr}/api/chat/announcement`,{method:"GET",headers:v});yn(p);const g=await p.json();if(!g.success){const y=g.message||"Failed to fetch announcement";return console.error(y),""}return g.data}catch(l){return console.error("Error fetching announcement:",l),""}}i.fetchAnnouncement=o;async function s(l){let c=0,d;for(;c<3;)try{const f=Ur(),v=Kr(),p={"Content-Type":"application/json",accept:"application/json",Authorization:`Bearer ${f}`,"trace-id":dr(),"Accept-Language":v},g=await fetch(`${Wr}/api/param_debug/generate_sd_prompts`,{method:"POST",headers:p,body:JSON.stringify({text:l})});yn(g);const y=await g.json();if(!y.success){const m=y.message||"Failed to generate SD prompts";throw new Error(m)}return y.data}catch(f){if(d=f,c++,c>=3)throw console.error("Error generating SD prompts after 3 attempts:",f),f;console.warn(`Attempt ${c} failed, retrying... Error: ${f instanceof Error?f.message:"Unknown error"}`),await new Promise(v=>setTimeout(v,500*Math.pow(2,c-1)))}throw d}i.generateSDPrompts=s;async function u(){const l=Ur(),h=Kr(),c={"Content-Type":"application/json",accept:"application/json",Authorization:`Bearer ${l}`,"trace-id":dr(),"Accept-Language":h};return await(await fetch(`${Wr}/v1/models`,{method:"GET",headers:c})).json()}i.listModels=u})(ai||(ai={}));function Y$({name:i,isUser:r=!1,children:e}){return S.jsx("div",{className:"flex flex-col w-full items-start gap-2 py-2 animate-fadeIn",children:S.jsx("div",{className:"w-full",children:e})})}function NI({title:i,titleId:r,...e},t){return We.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},e),i?We.createElement("title",{id:r},i):null,We.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const MI=We.forwardRef(NI);function Lpe({content:i,trace_id:r}){const[e,t]=We.useState(!1),[n,a]=We.useState(!1),o=async()=>{r&&(await navigator.clipboard.writeText(r),a(!0),setTimeout(()=>a(!1),2e3))};return S.jsx(Y$,{name:"User",isUser:!0,children:S.jsxs("div",{className:"w-full rounded-lg border border-gray-700 py-4 px-4 text-gray-700 text-sm break-words relative",children:[S.jsx("p",{className:"whitespace-pre-wrap leading-snug",children:i}),r&&S.jsxs("div",{className:"absolute bottom-1 right-1.5 cursor-pointer opacity-40 hover:opacity-100 transition-opacity",onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),onClick:o,children:[S.jsx(MI,{className:"h-3.5 w-3.5 text-gray-500 hover:text-gray-700"}),e&&S.jsx("div",{className:"absolute right-0 -top-6 bg-gray-700 text-white text-[10px] py-0.5 px-1.5 rounded shadow-sm whitespace-nowrap",children:n?"Copied!":"Copy trace ID"})]})]})})}const BI=We.memo(tI,(i,r)=>i.children===r.children&&i.className===r.className),FI=({content:i})=>S.jsxs("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-1 shadow-sm",children:[S.jsxs("div",{className:"flex items-center mb-1",children:[S.jsx("div",{className:"bg-blue-100 rounded-full p-1 mr-1",children:S.jsx("svg",{className:"h-4 w-4 text-blue-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),S.jsx("h3",{className:"text-sm font-medium text-blue-800",children:"Node Usage Guide"})]}),S.jsx("div",{className:"markdown-content text-blue-900",children:i})]}),jI=({content:i})=>S.jsxs("div",{className:"rounded-lg border border-green-200 bg-green-50 p-1 shadow-sm",children:[S.jsxs("div",{className:"flex items-center mb-1",children:[S.jsx("div",{className:"bg-green-100 rounded-full p-1 mr-1",children:S.jsxs("svg",{className:"h-4 w-4 text-green-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),S.jsx("h3",{className:"text-sm font-medium text-green-800",children:"Node Parameter Reference"})]}),S.jsx("div",{className:"markdown-content text-green-900",children:i})]});function zpe({content:i,name:r="Assistant",avatar:e,format:t,onOptionClick:n,extComponent:a,metadata:o}){const s=We.useRef(),u=(h,c)=>S.jsx(BI,{rehypePlugins:[[rI,{target:"_blank"}],iI],remarkPlugins:[nI,aI],className:`prose prose-xs prose-neutral prose-a:text-accent-foreground/50 break-words [&>*]:!my-1 leading-relaxed text-xs text-gray-800 +`,e+="-----END PUBLIC KEY-----",e},r.hasPublicKeyProperty=function(e){return e=e||{},e.hasOwnProperty("n")&&e.hasOwnProperty("e")},r.hasPrivateKeyProperty=function(e){return e=e||{},e.hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")},r.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},r}(II),AI={},oh,DI=typeof process<"u"?(oh=AI)===null||oh===void 0?void 0:oh.npm_package_version:void 0,RI=function(){function i(r){r===void 0&&(r={}),r=r||{},this.default_key_size=r.default_key_size?parseInt(r.default_key_size,10):1024,this.default_public_exponent=r.default_public_exponent||"010001",this.log=r.log||!1,this.key=null}return i.prototype.setKey=function(r){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new kp(r)},i.prototype.setPrivateKey=function(r){this.setKey(r)},i.prototype.setPublicKey=function(r){this.setKey(r)},i.prototype.decrypt=function(r){try{return this.getKey().decrypt(wp(r))}catch{return!1}},i.prototype.encrypt=function(r){try{return Iu(this.getKey().encrypt(r))}catch{return!1}},i.prototype.sign=function(r,e,t){try{return Iu(this.getKey().sign(r,e,t))}catch{return!1}},i.prototype.verify=function(r,e,t){try{return this.getKey().verify(r,wp(e),t)}catch{return!1}},i.prototype.getKey=function(r){if(!this.key){if(this.key=new kp,r&&{}.toString.call(r)==="[object Function]"){this.key.generateAsync(this.default_key_size,this.default_public_exponent,r);return}this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},i.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},i.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},i.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},i.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},i.version=DI,i}();async function jpe(){try{const r=await(await fetch(`${Ff.apiBaseUrl}/api/chat/rsa_public_key`)).json();if(!r.success)throw new Error(r.message||"Failed to fetch RSA public key");return r.data}catch(i){throw console.error("Error fetching RSA public key:",i),i}}async function xn(i,r){try{if(window.crypto&&window.crypto.subtle){const e="-----BEGIN PUBLIC KEY-----",n=r.substring(r.indexOf(e)+e.length,r.indexOf("-----END PUBLIC KEY-----")).replace(/\s/g,""),a=window.atob(n),o=new ArrayBuffer(a.length),s=new Uint8Array(o);for(let d=0;dlocalStorage.getItem("chatApiKey"),Ba=()=>{const i=localStorage.getItem("openaiApiKey"),r=localStorage.getItem("openaiBaseUrl")||"https://api.openai.com/v1",e=localStorage.getItem("rsaPublicKey");return{openaiApiKey:i||"",openaiBaseUrl:r,rsaPublicKey:e}},Kr=()=>navigator.language||"zh-CN",yn=i=>{const r=i.headers.get("User-Api-Key");r&&!localStorage.getItem("chatApiKey")&&localStorage.setItem("chatApiKey",r)};var ai;(i=>{async function r(l){try{const h=Ur(),c=Kr();l.session_id=localStorage.getItem("sessionId")||null,fetch(`${Wr}/api/chat/track_event`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${h}`,"trace-id":dr(),"Accept-Language":c},body:JSON.stringify(l)}).catch(d=>{console.warn("Track event failed:",d)})}catch(h){console.warn("Error preparing track event:",h)}return Promise.resolve()}i.trackEvent=r;async function*e(l,h,c=[],d=null,f=null,v){try{const p=Ur(),g=Kr(),{openaiApiKey:y,openaiBaseUrl:m,rsaPublicKey:$}=Ba(),b=dr(),O=(c||[]).map(ie=>new Promise((_e,ye)=>{const Ae=new FileReader;Ae.onloadend=()=>_e(Ae.result),Ae.onerror=ye,Ae.readAsDataURL(ie)})),_=await Promise.all(O);let D=f?Array.isArray(f)?f:[f]:[];const R={"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${p}`,"trace-id":v||dr(),"Accept-Language":g};if(y&&y.trim()!==""&&$)try{const ie=await xn(y,$);R["Encrypted-Openai-Api-Key"]=ie,R["Openai-Base-Url"]=m}catch(ie){console.error("Error encrypting OpenAI API key:",ie)}const P=new AbortController,B=setTimeout(()=>P.abort(),12e4),j=await fetch(`${Wr}/api/chat/invoke`,{method:"POST",headers:R,body:JSON.stringify({session_id:l,prompt:h,mock:!1,intent:d,ext:D,images:_.map((ie,_e)=>({filename:c[_e].name,data:ie}))}),signal:P.signal});clearTimeout(B),yn(j);const J=j.body.getReader();let U="";for(;;){const{done:ie,value:_e}=await J.read();if(ie)break;U+=new TextDecoder().decode(_e);const ye=U.split(` +`);U=ye.pop()||"";for(const Ae of ye)Ae.trim()&&(yield{...JSON.parse(Ae),message_id:b})}U.trim()&&(yield{...JSON.parse(U),message_id:b})}catch(p){throw console.error("Error in streamInvokeServer:",p),p.name==="AbortError"?alert("Request timed out after 2 minutes. Please try again."):alert(p instanceof Error?p.message:"An error occurred while streaming, please refresh the page and try again."),p}}i.streamInvokeServer=e;async function t(l,h){try{const c=Ur(),d=Kr(),{openaiApiKey:f,openaiBaseUrl:v,rsaPublicKey:p}=Ba(),g={"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${c}`,"trace-id":dr(),"Accept-Language":d};if(f&&f.trim()!==""&&p)try{const $=await xn(f,p);g["Encrypted-Openai-Api-Key"]=$,g["Openai-Base-Url"]=v}catch($){console.error("Error encrypting OpenAI API key:",$)}const y=await fetch(`${Wr}/api/chat/get_optimized_workflow`,{method:"POST",headers:g,body:JSON.stringify({workflow_id:l,prompt:h})});yn(y);const m=await y.json();if(!m.success){const $=m.message||"Failed to get optimized workflow";throw alert($),new Error($)}return m.data}catch(c){throw console.error("Error getting optimized workflow:",c),alert(c instanceof Error?c.message:"Failed to get optimized workflow"),c}}i.getOptimizedWorkflow=t;async function n(l){const h=Ur(),c=Kr(),{openaiApiKey:d,openaiBaseUrl:f,rsaPublicKey:v}=Ba(),p={"Content-Type":"application/json",Authorization:`Bearer ${h}`,"trace-id":dr(),"Accept-Language":c};if(d&&d.trim()!==""&&v)try{const m=await xn(d,v);p["Encrypted-Openai-Api-Key"]=m,p["Openai-Base-Url"]=f}catch(m){console.error("Error encrypting OpenAI API key:",m)}const g=await fetch(`${Wr}/api/chat/get_node_info_by_types`,{method:"POST",headers:p,body:JSON.stringify({node_types:l})});yn(g);const y=await g.json();if(!y.success){const m=y.message||"Failed to get node info by types";throw alert(m),new Error(m)}return y.data}i.batchGetNodeInfo=n;async function a(l){try{const h=localStorage.getItem(`messages_${l}`);if(h)return console.log("Using cached messages from localStorage"),JSON.parse(h);const c=Ur(),d=Kr(),{openaiApiKey:f,openaiBaseUrl:v,rsaPublicKey:p}=Ba(),g={accept:"application/json",Authorization:`Bearer ${c}`,"trace-id":dr(),"Accept-Language":d};if(f&&f.trim()!==""&&p)try{const b=await xn(f,p);g["Encrypted-Openai-Api-Key"]=b,g["Openai-Base-Url"]=v}catch(b){console.error("Error encrypting OpenAI API key:",b)}const y=await fetch(`${Wr}/api/chat/get_messages_by_session_id?session_id=${l}`,{method:"GET",headers:g});yn(y);const m=await y.json();if(!m.success){const b=m.message||"Failed to fetch messages";throw alert(b+", please refresh the page and try again."),new Error(b)}const $=m.data.map(b=>(console.log("msg.ext",b.ext),{id:b.id.toString(),content:b.role==="ai"?JSON.stringify({session_id:l,text:b.content,finished:b.finished||!1,format:b.format||"markdown",ext:b.ext}):b.content,role:b.role,name:b.role==="ai"?"Assistant":void 0,format:b.format||"markdown",finished:b.finished}));return localStorage.setItem(`messages_${l}`,JSON.stringify($)),$}catch(h){throw console.error("Error fetching messages:",h),alert(h instanceof Error?h.message:"Failed to fetch messages, please refresh the page and try again."),h}}i.fetchMessages=a;async function o(){try{const l=Ur(),h=Kr(),{openaiApiKey:c,openaiBaseUrl:d,rsaPublicKey:f}=Ba(),v={accept:"application/json",Authorization:`Bearer ${l}`,"trace-id":dr(),"Accept-Language":h};if(c&&c.trim()!==""&&f)try{const y=await xn(c,f);v["Encrypted-Openai-Api-Key"]=y,v["Openai-Base-Url"]=d}catch(y){console.error("Error encrypting OpenAI API key:",y)}const p=await fetch(`${Wr}/api/chat/announcement`,{method:"GET",headers:v});yn(p);const g=await p.json();if(!g.success){const y=g.message||"Failed to fetch announcement";return console.error(y),""}return g.data}catch(l){return console.error("Error fetching announcement:",l),""}}i.fetchAnnouncement=o;async function s(l){let c=0,d;for(;c<3;)try{const f=Ur(),v=Kr(),p={"Content-Type":"application/json",accept:"application/json",Authorization:`Bearer ${f}`,"trace-id":dr(),"Accept-Language":v},g=await fetch(`${Wr}/api/param_debug/generate_sd_prompts`,{method:"POST",headers:p,body:JSON.stringify({text:l})});yn(g);const y=await g.json();if(!y.success){const m=y.message||"Failed to generate SD prompts";throw new Error(m)}return y.data}catch(f){if(d=f,c++,c>=3)throw console.error("Error generating SD prompts after 3 attempts:",f),f;console.warn(`Attempt ${c} failed, retrying... Error: ${f instanceof Error?f.message:"Unknown error"}`),await new Promise(v=>setTimeout(v,500*Math.pow(2,c-1)))}throw d}i.generateSDPrompts=s;async function u(){const l=Ur(),h=Kr(),c={"Content-Type":"application/json",accept:"application/json",Authorization:`Bearer ${l}`,"trace-id":dr(),"Accept-Language":h};return await(await fetch(`${Wr}/v1/models`,{method:"GET",headers:c})).json()}i.listModels=u})(ai||(ai={}));function Y$({name:i,isUser:r=!1,children:e}){return S.jsx("div",{className:"flex flex-col w-full items-start gap-2 py-2 animate-fadeIn",children:S.jsx("div",{className:"w-full",children:e})})}function MI({title:i,titleId:r,...e},t){return We.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},e),i?We.createElement("title",{id:r},i):null,We.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const BI=We.forwardRef(MI);function zpe({content:i,trace_id:r}){const[e,t]=We.useState(!1),[n,a]=We.useState(!1),o=async()=>{r&&(await navigator.clipboard.writeText(r),a(!0),setTimeout(()=>a(!1),2e3))};return S.jsx(Y$,{name:"User",isUser:!0,children:S.jsxs("div",{className:"w-full rounded-lg border border-gray-700 py-4 px-4 text-gray-700 text-sm break-words relative",children:[S.jsx("p",{className:"whitespace-pre-wrap leading-snug",children:i}),r&&S.jsxs("div",{className:"absolute bottom-1 right-1.5 cursor-pointer opacity-40 hover:opacity-100 transition-opacity",onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),onClick:o,children:[S.jsx(BI,{className:"h-3.5 w-3.5 text-gray-500 hover:text-gray-700"}),e&&S.jsx("div",{className:"absolute right-0 -top-6 bg-gray-700 text-white text-[10px] py-0.5 px-1.5 rounded shadow-sm whitespace-nowrap",children:n?"Copied!":"Copy trace ID"})]})]})})}const FI=We.memo(tI,(i,r)=>i.children===r.children&&i.className===r.className),jI=({content:i})=>S.jsxs("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-1 shadow-sm",children:[S.jsxs("div",{className:"flex items-center mb-1",children:[S.jsx("div",{className:"bg-blue-100 rounded-full p-1 mr-1",children:S.jsx("svg",{className:"h-4 w-4 text-blue-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),S.jsx("h3",{className:"text-sm font-medium text-blue-800",children:"Node Usage Guide"})]}),S.jsx("div",{className:"markdown-content text-blue-900",children:i})]}),LI=({content:i})=>S.jsxs("div",{className:"rounded-lg border border-green-200 bg-green-50 p-1 shadow-sm",children:[S.jsxs("div",{className:"flex items-center mb-1",children:[S.jsx("div",{className:"bg-green-100 rounded-full p-1 mr-1",children:S.jsxs("svg",{className:"h-4 w-4 text-green-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),S.jsx("h3",{className:"text-sm font-medium text-green-800",children:"Node Parameter Reference"})]}),S.jsx("div",{className:"markdown-content text-green-900",children:i})]});function Hpe({content:i,name:r="Assistant",avatar:e,format:t,onOptionClick:n,extComponent:a,metadata:o}){const s=We.useRef(),u=(h,c)=>S.jsx(FI,{rehypePlugins:[[rI,{target:"_blank"}],iI],remarkPlugins:[nI,aI],className:`prose prose-xs prose-neutral prose-a:text-accent-foreground/50 break-words [&>*]:!my-1 leading-relaxed text-xs text-gray-800 prose-headings:font-semibold prose-h1:text-base prose-h2:text-sm @@ -36,7 +36,7 @@ version: 2.9.0 prose-li:text-xs prose-code:text-xs prose-pre:text-xs - `,components:{p:({children:d})=>S.jsx("p",{className:"!my-0.5 leading-relaxed text-xs",children:d}),strong:({children:d})=>S.jsx("strong",{className:"text-gray-900",children:d}),h1:({children:d})=>S.jsx("h1",{className:"text-base font-semibold !my-1",children:d}),h2:({children:d})=>S.jsx("h2",{className:"text-sm font-semibold !my-1",children:d}),h3:({children:d})=>S.jsx("h3",{className:"text-xs font-semibold !my-1",children:d}),h4:({children:d})=>S.jsx("h4",{className:"text-xs font-semibold !my-1",children:d}),table:({children:d})=>S.jsx("table",{className:"border-solid border w-[100%] text-xs",children:d}),th:({children:d})=>S.jsx("th",{className:"border-solid border text-center pt-2 text-xs",children:d}),td:({children:d})=>{if(Array.isArray(d)&&d?.length>0){const f=[],v=d.length;for(let p=0;p"?f.push(S.jsx("br",{})):f.push(d[p]);d=f}return S.jsx("td",{className:"border-solid border border-[#979797] text-center text-xs",children:d})},code:({children:d})=>{const[f,v]=We.useState(!1),p=async()=>{try{await navigator.clipboard.writeText(d),v(!0),setTimeout(()=>v(!1),2e3)}catch(g){console.error("Failed to copy text:",g)}};return S.jsxs("span",{className:"relative group inline-flex items-center",children:[S.jsx("code",{className:"text-xs bg-gray-100 text-gray-900 rounded px-1",children:d}),S.jsx("button",{onClick:p,className:"absolute top-0 right-0 bg-gray-200 rounded p-1 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-gray-300 z-10","aria-label":"Copy code",children:f?S.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:S.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):S.jsxs("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:[S.jsx("path",{d:"M8 2a1 1 0 000 2h2a1 1 0 100-2H8z"}),S.jsx("path",{d:"M3 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v6h-4.586l1.293-1.293a1 1 0 00-1.414-1.414l-3 3a1 1 0 000 1.414l3 3a1 1 0 001.414-1.414L10.414 13H15v3a2 2 0 01-2 2H5a2 2 0 01-2-2V5z"})]})})]})},pre:({children:d})=>S.jsx("pre",{className:"text-xs bg-gray-100 text-gray-800 rounded p-2 overflow-x-auto",children:d}),img:({node:d,...f})=>S.jsx("div",{className:"w-1/2 mx-auto",children:S.jsx("img",{...f,loading:"lazy",className:"w-full h-auto block",onError:v=>{console.warn("Image failed to load:",f.src,"Error:",v),v.currentTarget.style.opacity="0"}})}),a:({href:d,children:f})=>{let v="markdown",p=null;try{const g=JSON.parse(i);v=g.ext?.[0]?.type||"markdown",p=g?.message_id}catch(g){console.error("Error parsing content:",g)}return S.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",onClick:()=>{ai.trackEvent({event_type:"markdown_link_click",message_type:v,message_id:p,data:{link_url:d,link_text:f}})},children:f})}},children:h}),l=()=>{try{const h=JSON.parse(i),c=h.ext?.find(d=>d.type==="guides")?.data||[];if(o?.intent){const d=o.intent;if(d==="node_explain")return S.jsx(FI,{content:u(h.text||"")});if(d==="node_params")return S.jsx(jI,{content:u(h.text||"")})}return S.jsxs("div",{className:"space-y-3",children:[t==="markdown"&&h.text?S.jsx("div",{ref:s,children:u(h.text)}):h.text?S.jsx("p",{className:"whitespace-pre-wrap text-left",children:h.text}):null,c.length>0&&S.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:c.map((d,f)=>S.jsx("button",{className:"px-3 py-1.5 text-gray-700 rounded-md hover:bg-gray-50 transition-colors text-[12px] w-[calc(50%-0.25rem)]",onClick:()=>n?.(d),children:d},f))}),a]})}catch{return S.jsx("p",{className:"whitespace-pre-wrap text-left",children:i})}};return S.jsx(Y$,{name:r,children:S.jsx("div",{className:"w-full rounded-lg bg-gray-50 p-4 text-gray-900 text-sm break-words overflow-hidden",children:l()})})}const LI=LiteGraph;function X$(i,r={}){const e=LI.createNode(i,"",r);if(!r.pos){const t=Mt.canvas.canvas.getBoundingClientRect(),n=t.width/2/Mt.canvas.ds.scale+-Mt.canvas.ds.offset[0]/Mt.canvas.ds.scale,a=t.height/2/Mt.canvas.ds.scale+-Mt.canvas.ds.offset[1]/Mt.canvas.ds.scale;e.pos=[n-e.size[0]/2,a-e.size[1]/2]}return Mt.graph.add(e),e}function zI({content:i,name:r="Assistant",avatar:e,installedNodes:t}){const n=JSON.parse(i),[a,o]=We.useState(null),[s,u]=We.useState(null),l=n.ext?.find(g=>g.type==="node")?.data||[],h=g=>t.some(y=>y===g),c=l.filter(g=>h(g.name)),d=l.filter(g=>!h(g.name)),f=g=>g>=1e4?`${(g/1e4).toFixed(1)}w`:g>=1e3?`${(g/1e3).toFixed(1)}k`:g.toString(),v=g=>{o(g.name),u(g)},p=()=>{o(null),u(null)};return S.jsxs("div",{className:"rounded-lg bg-gray-50 p-3 text-gray-700 text-xs break-words overflow-visible",children:[c.length>0&&S.jsxs("div",{className:"space-y-3",children:[S.jsx("p",{className:"text-xs font-medium",children:"Installed nodes:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:c.map(g=>S.jsxs("div",{className:`w-full p-3 rounded-lg border border-gray-200 + `,components:{p:({children:d})=>S.jsx("p",{className:"!my-0.5 leading-relaxed text-xs",children:d}),strong:({children:d})=>S.jsx("strong",{className:"text-gray-900",children:d}),h1:({children:d})=>S.jsx("h1",{className:"text-base font-semibold !my-1",children:d}),h2:({children:d})=>S.jsx("h2",{className:"text-sm font-semibold !my-1",children:d}),h3:({children:d})=>S.jsx("h3",{className:"text-xs font-semibold !my-1",children:d}),h4:({children:d})=>S.jsx("h4",{className:"text-xs font-semibold !my-1",children:d}),table:({children:d})=>S.jsx("table",{className:"border-solid border w-[100%] text-xs",children:d}),th:({children:d})=>S.jsx("th",{className:"border-solid border text-center pt-2 text-xs",children:d}),td:({children:d})=>{if(Array.isArray(d)&&d?.length>0){const f=[],v=d.length;for(let p=0;p"?f.push(S.jsx("br",{})):f.push(d[p]);d=f}return S.jsx("td",{className:"border-solid border border-[#979797] text-center text-xs",children:d})},code:({children:d})=>{const[f,v]=We.useState(!1),p=async()=>{try{await navigator.clipboard.writeText(d),v(!0),setTimeout(()=>v(!1),2e3)}catch(g){console.error("Failed to copy text:",g)}};return S.jsxs("span",{className:"relative group inline-flex items-center",children:[S.jsx("code",{className:"text-xs bg-gray-100 text-gray-900 rounded px-1",children:d}),S.jsx("button",{onClick:p,className:"absolute top-0 right-0 bg-gray-200 rounded p-1 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-gray-300 z-10","aria-label":"Copy code",children:f?S.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:S.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):S.jsxs("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:[S.jsx("path",{d:"M8 2a1 1 0 000 2h2a1 1 0 100-2H8z"}),S.jsx("path",{d:"M3 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v6h-4.586l1.293-1.293a1 1 0 00-1.414-1.414l-3 3a1 1 0 000 1.414l3 3a1 1 0 001.414-1.414L10.414 13H15v3a2 2 0 01-2 2H5a2 2 0 01-2-2V5z"})]})})]})},pre:({children:d})=>S.jsx("pre",{className:"text-xs bg-gray-100 text-gray-800 rounded p-2 overflow-x-auto",children:d}),img:({node:d,...f})=>S.jsx("div",{className:"w-1/2 mx-auto",children:S.jsx("img",{...f,loading:"lazy",className:"w-full h-auto block",onError:v=>{console.warn("Image failed to load:",f.src,"Error:",v),v.currentTarget.style.opacity="0"}})}),a:({href:d,children:f})=>{let v="markdown",p=null;try{const g=JSON.parse(i);v=g.ext?.[0]?.type||"markdown",p=g?.message_id}catch(g){console.error("Error parsing content:",g)}return S.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",onClick:()=>{ai.trackEvent({event_type:"markdown_link_click",message_type:v,message_id:p,data:{link_url:d,link_text:f}})},children:f})}},children:h}),l=()=>{try{const h=JSON.parse(i),c=h.ext?.find(d=>d.type==="guides")?.data||[];if(o?.intent){const d=o.intent;if(d==="node_explain")return S.jsx(jI,{content:u(h.text||"")});if(d==="node_params")return S.jsx(LI,{content:u(h.text||"")})}return S.jsxs("div",{className:"space-y-3",children:[t==="markdown"&&h.text?S.jsx("div",{ref:s,children:u(h.text)}):h.text?S.jsx("p",{className:"whitespace-pre-wrap text-left",children:h.text}):null,c.length>0&&S.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:c.map((d,f)=>S.jsx("button",{className:"px-3 py-1.5 text-gray-700 rounded-md hover:bg-gray-50 transition-colors text-[12px] w-[calc(50%-0.25rem)]",onClick:()=>n?.(d),children:d},f))}),a]})}catch{return S.jsx("p",{className:"whitespace-pre-wrap text-left",children:i})}};return S.jsx(Y$,{name:r,children:S.jsx("div",{className:"w-full rounded-lg bg-gray-50 p-4 text-gray-900 text-sm break-words overflow-hidden",children:l()})})}const zI=LiteGraph;function X$(i,r={}){const e=zI.createNode(i,"",r);if(!r.pos){const t=Mt.canvas.canvas.getBoundingClientRect(),n=t.width/2/Mt.canvas.ds.scale+-Mt.canvas.ds.offset[0]/Mt.canvas.ds.scale,a=t.height/2/Mt.canvas.ds.scale+-Mt.canvas.ds.offset[1]/Mt.canvas.ds.scale;e.pos=[n-e.size[0]/2,a-e.size[1]/2]}return Mt.graph.add(e),e}function HI({content:i,name:r="Assistant",avatar:e,installedNodes:t}){const n=JSON.parse(i),[a,o]=We.useState(null),[s,u]=We.useState(null),l=n.ext?.find(g=>g.type==="node")?.data||[],h=g=>t.some(y=>y===g),c=l.filter(g=>h(g.name)),d=l.filter(g=>!h(g.name)),f=g=>g>=1e4?`${(g/1e4).toFixed(1)}w`:g>=1e3?`${(g/1e3).toFixed(1)}k`:g.toString(),v=g=>{o(g.name),u(g)},p=()=>{o(null),u(null)};return S.jsxs("div",{className:"rounded-lg bg-gray-50 p-3 text-gray-700 text-xs break-words overflow-visible",children:[c.length>0&&S.jsxs("div",{className:"space-y-3",children:[S.jsx("p",{className:"text-xs font-medium",children:"Installed nodes:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:c.map(g=>S.jsxs("div",{className:`w-full p-3 rounded-lg border border-gray-200 hover:shadow-sm transition-all duration-200 relative group`,onMouseEnter:()=>v(g),onMouseLeave:p,children:[S.jsx("h3",{className:"text-[12px] font-medium text-gray-800 mb-4",children:g.name}),S.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[S.jsxs("div",{className:"flex items-center gap-1 text-gray-600",children:[S.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{d:"M12 .25a.75.75 0 0 1 .673.418l3.058 6.197 6.839.994a.75.75 0 0 1 .415 1.279l-4.948 4.823 1.168 6.811a.75.75 0 0 1-1.088.791L12 18.347l-6.117 3.216a.75.75 0 0 1-1.088-.79l1.168-6.812-4.948-4.823a.75.75 0 0 1 .416-1.28l6.838-.993L11.327.668A.75.75 0 0 1 12 .25z"})}),S.jsx("span",{children:f(g.github_stars||0)})]}),S.jsxs("button",{className:`px-2 py-1 bg-blue-500 text-white rounded-md hover:bg-blue-600 transition-colors text-[10px] flex items-center gap-1`,onClick:()=>{const y=X$(g.name);y&&(y.connect(g.from_index,y,g.to_index),ai.trackEvent({event_type:"node_add_to_canvas",message_type:"node",message_id:n.message_id,data:{node_name:g.name}}))},children:[S.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add to Canvas"]})]})]},g.name))})]}),d.length>0&&S.jsxs("div",{className:`space-y-3 ${c.length>0?"mt-4":""}`,children:[S.jsx("p",{className:"text-xs font-medium",children:"Uninstalled nodes:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:d.map(g=>S.jsxs("div",{className:`w-full p-3 rounded-lg border border-gray-200 hover:shadow-sm transition-all duration-200 relative group`,onMouseEnter:()=>v(g),onMouseLeave:p,children:[S.jsx("h3",{className:"text-[12px] font-medium text-gray-800 mb-4",children:g.name}),S.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[S.jsxs("div",{className:"flex items-center gap-1 text-gray-600",children:[S.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{d:"M12 .25a.75.75 0 0 1 .673.418l3.058 6.197 6.839.994a.75.75 0 0 1 .415 1.279l-4.948 4.823 1.168 6.811a.75.75 0 0 1-1.088.791L12 18.347l-6.117 3.216a.75.75 0 0 1-1.088-.79l1.168-6.812-4.948-4.823a.75.75 0 0 1 .416-1.28l6.838-.993L11.327.668A.75.75 0 0 1 12 .25z"})}),S.jsx("span",{children:f(g.github_stars||0)})]}),g.github_url?S.jsxs("a",{href:g.github_url,target:"_blank",rel:"noopener noreferrer",className:`px-2 py-1 text-gray-900 rounded-md @@ -44,7 +44,7 @@ version: 2.9.0 transition-colors text-[10px] flex items-center gap-1`,onClick:()=>{ai.trackEvent({event_type:"node_download",message_type:"node",message_id:n.message_id,data:{node_name:g.name,github_url:g.github_url}})},children:[S.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}):S.jsxs("a",{href:`https://www.google.com/search?q=${encodeURIComponent(g.name+" comfyui custom node")}`,target:"_blank",rel:"noopener noreferrer",className:`px-2 py-1 bg-gray-100 text-gray-500 rounded-md border border-gray-300 text-[10px] flex items-center gap-1`,onClick:()=>{ai.trackEvent({event_type:"node_search",message_type:"node",message_id:n.message_id,data:{node_name:g.name}})},children:[S.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 21h7a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v11m0 5l4.879-4.879m0 0a3 3 0 104.243-4.242 3 3 0 00-4.243 4.242z"})}),"Search on Google"]})]})]},g.name))})]}),a&&s?.description&&S.jsxs("div",{className:`fixed -translate-y-full z-[9999] w-64 p-2 bg-gray-800 text-white text-xs rounded-md shadow-lg mb-2`,style:{left:"calc(var(--mouse-x, 0) + 16px)",top:"calc(var(--mouse-y, 0) - 8px)"},children:[s.description,S.jsx("div",{className:`absolute -bottom-1 left-1/2 -translate-x-1/2 - border-4 border-transparent border-t-gray-800`})]})]})}const Hpe=Object.freeze(Object.defineProperty({__proto__:null,NodeSearch:zI},Symbol.toStringTag,{value:"Module"}));/** + border-4 border-transparent border-t-gray-800`})]})]})}const Vpe=Object.freeze(Object.defineProperty({__proto__:null,NodeSearch:HI},Symbol.toStringTag,{value:"Module"}));/** * vis-data * http://visjs.org/ * @@ -68,19 +68,19 @@ version: 2.9.0 * http://opensource.org/licenses/MIT * * vis.js may be distributed under either license. - */function tl(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")}var sh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Y(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var J$={exports:{}},Es=function(i){return i&&i.Math===Math&&i},$e=Es(typeof globalThis=="object"&&globalThis)||Es(typeof window=="object"&&window)||Es(typeof self=="object"&&self)||Es(typeof sh=="object"&&sh)||function(){return this}()||sh||Function("return this")(),le=function(i){try{return!!i()}catch{return!0}},HI=le,Oo=!HI(function(){var i=function(){}.bind();return typeof i!="function"||i.hasOwnProperty("prototype")}),VI=Oo,Z$=Function.prototype,Pp=Z$.apply,xp=Z$.call,ha=typeof Reflect=="object"&&Reflect.apply||(VI?xp.bind(Pp):function(){return xp.apply(Pp,arguments)}),Q$=Oo,e0=Function.prototype,Ed=e0.call,WI=Q$&&e0.bind.bind(Ed,Ed),be=Q$?WI:function(i){return function(){return Ed.apply(i,arguments)}},t0=be,UI=t0({}.toString),KI=t0("".slice),yi=function(i){return KI(UI(i),8,-1)},GI=yi,qI=be,r0=function(i){if(GI(i)==="Function")return qI(i)},Sd=typeof document=="object"&&document.all,YI=typeof Sd>"u"&&Sd!==void 0,i0={all:Sd,IS_HTMLDDA:YI},n0=i0,XI=n0.all,Ie=n0.IS_HTMLDDA?function(i){return typeof i=="function"||i===XI}:function(i){return typeof i=="function"},Qi={},JI=le,qe=!JI(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),ZI=Oo,Ss=Function.prototype.call,Ye=ZI?Ss.bind(Ss):function(){return Ss.apply(Ss,arguments)},rl={},a0={}.propertyIsEnumerable,o0=Object.getOwnPropertyDescriptor,QI=o0&&!a0.call({1:2},1);rl.f=QI?function(r){var e=o0(this,r);return!!e&&e.enumerable}:a0;var en=function(i,r){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:r}},ek=be,tk=le,rk=yi,uh=Object,ik=ek("".split),il=tk(function(){return!uh("z").propertyIsEnumerable(0)})?function(i){return rk(i)==="String"?ik(i,""):uh(i)}:uh,ca=function(i){return i==null},nk=ca,ak=TypeError,Lf=function(i){if(nk(i))throw new ak("Can't call method on "+i);return i},ok=il,sk=Lf,$r=function(i){return ok(sk(i))},Cp=Ie,s0=i0,uk=s0.all,nt=s0.IS_HTMLDDA?function(i){return typeof i=="object"?i!==null:Cp(i)||i===uk}:function(i){return typeof i=="object"?i!==null:Cp(i)},we={},lh=we,hh=$e,lk=Ie,Ap=function(i){return lk(i)?i:void 0},mt=function(i,r){return arguments.length<2?Ap(lh[i])||Ap(hh[i]):lh[i]&&lh[i][r]||hh[i]&&hh[i][r]},hk=be,He=hk({}.isPrototypeOf),mi=typeof navigator<"u"&&String(navigator.userAgent)||"",u0=$e,ch=mi,Dp=u0.process,Rp=u0.Deno,Np=Dp&&Dp.versions||Rp&&Rp.version,Mp=Np&&Np.v8,tr,ku;Mp&&(tr=Mp.split("."),ku=tr[0]>0&&tr[0]<4?1:+(tr[0]+tr[1]));!ku&&ch&&(tr=ch.match(/Edge\/(\d+)/),(!tr||tr[1]>=74)&&(tr=ch.match(/Chrome\/(\d+)/),tr&&(ku=+tr[1])));var da=ku,Bp=da,ck=le,dk=$e,fk=dk.String,fa=!!Object.getOwnPropertySymbols&&!ck(function(){var i=Symbol("symbol detection");return!fk(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&Bp&&Bp<41}),vk=fa,l0=vk&&!Symbol.sham&&typeof Symbol.iterator=="symbol",pk=mt,gk=Ie,yk=He,mk=l0,bk=Object,To=mk?function(i){return typeof i=="symbol"}:function(i){var r=pk("Symbol");return gk(r)&&yk(r.prototype,bk(i))},$k=String,va=function(i){try{return $k(i)}catch{return"Object"}},wk=Ie,_k=va,Ek=TypeError,Pt=function(i){if(wk(i))return i;throw new Ek(_k(i)+" is not a function")},Sk=Pt,Ok=ca,zf=function(i,r){var e=i[r];return Ok(e)?void 0:Sk(e)},dh=Ye,fh=Ie,vh=nt,Tk=TypeError,Ik=function(i,r){var e,t;if(r==="string"&&fh(e=i.toString)&&!vh(t=dh(e,i))||fh(e=i.valueOf)&&!vh(t=dh(e,i))||r!=="string"&&fh(e=i.toString)&&!vh(t=dh(e,i)))return t;throw new Tk("Can't convert object to primitive value")},h0={exports:{}},kk=!0,Fp=$e,Pk=Object.defineProperty,xk=function(i,r){try{Pk(Fp,i,{value:r,configurable:!0,writable:!0})}catch{Fp[i]=r}return r},Ck=$e,Ak=xk,jp="__core-js_shared__",Dk=Ck[jp]||Ak(jp,{}),Hf=Dk,Lp=Hf;(h0.exports=function(i,r){return Lp[i]||(Lp[i]=r!==void 0?r:{})})("versions",[]).push({version:"3.33.2",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.2/LICENSE",source:"https://github.com/zloirock/core-js"});var pa=h0.exports,Rk=Lf,Nk=Object,xt=function(i){return Nk(Rk(i))},Mk=be,Bk=xt,Fk=Mk({}.hasOwnProperty),Ve=Object.hasOwn||function(r,e){return Fk(Bk(r),e)},jk=be,Lk=0,zk=Math.random(),Hk=jk(1 .toString),nl=function(i){return"Symbol("+(i===void 0?"":i)+")_"+Hk(++Lk+zk,36)},Vk=$e,Wk=pa,zp=Ve,Uk=nl,Kk=fa,Gk=l0,An=Vk.Symbol,ph=Wk("wks"),qk=Gk?An.for||An:An&&An.withoutSetter||Uk,Ee=function(i){return zp(ph,i)||(ph[i]=Kk&&zp(An,i)?An[i]:qk("Symbol."+i)),ph[i]},Yk=Ye,Hp=nt,Vp=To,Xk=zf,Jk=Ik,Zk=Ee,Qk=TypeError,eP=Zk("toPrimitive"),tP=function(i,r){if(!Hp(i)||Vp(i))return i;var e=Xk(i,eP),t;if(e){if(r===void 0&&(r="default"),t=Yk(e,i,r),!Hp(t)||Vp(t))return t;throw new Qk("Can't convert object to primitive value")}return r===void 0&&(r="number"),Jk(i,r)},rP=tP,iP=To,al=function(i){var r=rP(i,"string");return iP(r)?r:r+""},nP=$e,Wp=nt,Od=nP.document,aP=Wp(Od)&&Wp(Od.createElement),Vf=function(i){return aP?Od.createElement(i):{}},oP=qe,sP=le,uP=Vf,c0=!oP&&!sP(function(){return Object.defineProperty(uP("div"),"a",{get:function(){return 7}}).a!==7}),lP=qe,hP=Ye,cP=rl,dP=en,fP=$r,vP=al,pP=Ve,gP=c0,Up=Object.getOwnPropertyDescriptor;Qi.f=lP?Up:function(r,e){if(r=fP(r),e=vP(e),gP)try{return Up(r,e)}catch{}if(pP(r,e))return dP(!hP(cP.f,r,e),r[e])};var yP=le,mP=Ie,bP=/#|\.prototype\./,Io=function(i,r){var e=wP[$P(i)];return e===EP?!0:e===_P?!1:mP(r)?yP(r):!!r},$P=Io.normalize=function(i){return String(i).replace(bP,".").toLowerCase()},wP=Io.data={},_P=Io.NATIVE="N",EP=Io.POLYFILL="P",d0=Io,Kp=r0,SP=Pt,OP=Oo,TP=Kp(Kp.bind),bi=function(i,r){return SP(i),r===void 0?i:OP?TP(i,r):function(){return i.apply(r,arguments)}},Ct={},IP=qe,kP=le,f0=IP&&kP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),PP=nt,xP=String,CP=TypeError,jt=function(i){if(PP(i))return i;throw new CP(xP(i)+" is not an object")},AP=qe,DP=c0,RP=f0,Os=jt,Gp=al,NP=TypeError,gh=Object.defineProperty,MP=Object.getOwnPropertyDescriptor,yh="enumerable",mh="configurable",bh="writable";Ct.f=AP?RP?function(r,e,t){if(Os(r),e=Gp(e),Os(t),typeof r=="function"&&e==="prototype"&&"value"in t&&bh in t&&!t[bh]){var n=MP(r,e);n&&n[bh]&&(r[e]=t.value,t={configurable:mh in t?t[mh]:n[mh],enumerable:yh in t?t[yh]:n[yh],writable:!1})}return gh(r,e,t)}:gh:function(r,e,t){if(Os(r),e=Gp(e),Os(t),DP)try{return gh(r,e,t)}catch{}if("get"in t||"set"in t)throw new NP("Accessors not supported");return"value"in t&&(r[e]=t.value),r};var BP=qe,FP=Ct,jP=en,Lr=BP?function(i,r,e){return FP.f(i,r,jP(1,e))}:function(i,r,e){return i[r]=e,i},Ts=$e,LP=ha,zP=r0,HP=Ie,VP=Qi.f,WP=d0,mn=we,UP=bi,bn=Lr,qp=Ve,KP=function(i){var r=function(e,t,n){if(this instanceof r){switch(arguments.length){case 0:return new i;case 1:return new i(e);case 2:return new i(e,t)}return new i(e,t,n)}return LP(i,this,arguments)};return r.prototype=i.prototype,r},K=function(i,r){var e=i.target,t=i.global,n=i.stat,a=i.proto,o=t?Ts:n?Ts[e]:(Ts[e]||{}).prototype,s=t?mn:mn[e]||bn(mn,e,{})[e],u=s.prototype,l,h,c,d,f,v,p,g,y;for(d in r)l=WP(t?d:e+(n?".":"#")+d,i.forced),h=!l&&o&&qp(o,d),v=s[d],h&&(i.dontCallGetSet?(y=VP(o,d),p=y&&y.value):p=o[d]),f=h&&p?p:r[d],!(h&&typeof v==typeof f)&&(i.bind&&h?g=UP(f,Ts):i.wrap&&h?g=KP(f):a&&HP(f)?g=zP(f):g=f,(i.sham||f&&f.sham||v&&v.sham)&&bn(g,"sham",!0),bn(s,d,g),a&&(c=e+"Prototype",qp(mn,c)||bn(mn,c,{}),bn(mn[c],d,f),i.real&&u&&(l||!u[d])&&bn(u,d,f)))},GP=K,qP=qe,Yp=Ct.f;GP({target:"Object",stat:!0,forced:Object.defineProperty!==Yp,sham:!qP},{defineProperty:Yp});var YP=we,v0=YP.Object,XP=J$.exports=function(r,e,t){return v0.defineProperty(r,e,t)};v0.defineProperty.sham&&(XP.sham=!0);var JP=J$.exports,ZP=JP,p0=ZP,QP=p0,ex=QP,tx=ex,rx=tx,g0=rx,ol=Y(g0),ix=yi,$i=Array.isArray||function(r){return ix(r)==="Array"},nx=Math.ceil,ax=Math.floor,ox=Math.trunc||function(r){var e=+r;return(e>0?ax:nx)(e)},sx=ox,sl=function(i){var r=+i;return r!==r||r===0?0:sx(r)},ux=sl,lx=Math.min,hx=function(i){return i>0?lx(ux(i),9007199254740991):0},cx=hx,Lt=function(i){return cx(i.length)},dx=TypeError,fx=9007199254740991,ul=function(i){if(i>fx)throw dx("Maximum allowed index exceeded");return i},vx=al,px=Ct,gx=en,ga=function(i,r,e){var t=vx(r);t in i?px.f(i,t,gx(0,e)):i[t]=e},yx=Ee,mx=yx("toStringTag"),y0={};y0[mx]="z";var Wf=String(y0)==="[object z]",bx=Wf,$x=Ie,lu=yi,wx=Ee,_x=wx("toStringTag"),Ex=Object,Sx=lu(function(){return arguments}())==="Arguments",Ox=function(i,r){try{return i[r]}catch{}},zr=bx?lu:function(i){var r,e,t;return i===void 0?"Undefined":i===null?"Null":typeof(e=Ox(r=Ex(i),_x))=="string"?e:Sx?lu(r):(t=lu(r))==="Object"&&$x(r.callee)?"Arguments":t},Tx=be,Ix=Ie,Td=Hf,kx=Tx(Function.toString);Ix(Td.inspectSource)||(Td.inspectSource=function(i){return kx(i)});var m0=Td.inspectSource,Px=be,xx=le,b0=Ie,Cx=zr,Ax=mt,Dx=m0,$0=function(){},Rx=[],w0=Ax("Reflect","construct"),Uf=/^\s*(?:class|function)\b/,Nx=Px(Uf.exec),Mx=!Uf.test($0),Fa=function(r){if(!b0(r))return!1;try{return w0($0,Rx,r),!0}catch{return!1}},_0=function(r){if(!b0(r))return!1;switch(Cx(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Mx||!!Nx(Uf,Dx(r))}catch{return!0}};_0.sham=!0;var ll=!w0||xx(function(){var i;return Fa(Fa.call)||!Fa(Object)||!Fa(function(){i=!0})||i})?_0:Fa,Xp=$i,Bx=ll,Fx=nt,jx=Ee,Lx=jx("species"),Jp=Array,zx=function(i){var r;return Xp(i)&&(r=i.constructor,Bx(r)&&(r===Jp||Xp(r.prototype))?r=void 0:Fx(r)&&(r=r[Lx],r===null&&(r=void 0))),r===void 0?Jp:r},Hx=zx,hl=function(i,r){return new(Hx(i))(r===0?0:r)},Vx=le,Wx=Ee,Ux=da,Kx=Wx("species"),ko=function(i){return Ux>=51||!Vx(function(){var r=[],e=r.constructor={};return e[Kx]=function(){return{foo:1}},r[i](Boolean).foo!==1})},Gx=K,qx=le,Yx=$i,Xx=nt,Jx=xt,Zx=Lt,Zp=ul,Qp=ga,Qx=hl,eC=ko,tC=Ee,rC=da,E0=tC("isConcatSpreadable"),iC=rC>=51||!qx(function(){var i=[];return i[E0]=!1,i.concat()[0]!==i}),nC=function(i){if(!Xx(i))return!1;var r=i[E0];return r!==void 0?!!r:Yx(i)},aC=!iC||!eC("concat");Gx({target:"Array",proto:!0,arity:1,forced:aC},{concat:function(r){var e=Jx(this),t=Qx(e,0),n=0,a,o,s,u,l;for(a=-1,s=arguments.length;ao;)if(s=n[o++],s!==s)return!0}else for(;a>o;o++)if((i||o in n)&&n[o]===e)return i||o||0;return!i&&-1}},vC={includes:eg(!0),indexOf:eg(!1)},Po={},pC=be,$h=Ve,gC=$r,yC=vC.indexOf,mC=Po,tg=pC([].push),S0=function(i,r){var e=gC(i),t=0,n=[],a;for(a in e)!$h(mC,a)&&$h(e,a)&&tg(n,a);for(;r.length>t;)$h(e,a=r[t++])&&(~yC(n,a)||tg(n,a));return n},Kf=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],bC=S0,$C=Kf,fl=Object.keys||function(r){return bC(r,$C)},wC=qe,_C=f0,EC=Ct,SC=jt,OC=$r,TC=fl;cl.f=wC&&!_C?Object.defineProperties:function(r,e){SC(r);for(var t=OC(e),n=TC(e),a=n.length,o=0,s;a>o;)EC.f(r,s=n[o++],t[s]);return r};var IC=mt,O0=IC("document","documentElement"),kC=pa,PC=nl,rg=kC("keys"),vl=function(i){return rg[i]||(rg[i]=PC(i))},xC=jt,CC=cl,ig=Kf,AC=Po,DC=O0,RC=Vf,NC=vl,ng=">",ag="<",Id="prototype",kd="script",T0=NC("IE_PROTO"),wh=function(){},I0=function(i){return ag+kd+ng+i+ag+"/"+kd+ng},og=function(i){i.write(I0("")),i.close();var r=i.parentWindow.Object;return i=null,r},MC=function(){var i=RC("iframe"),r="java"+kd+":",e;return i.style.display="none",DC.appendChild(i),i.src=String(r),e=i.contentWindow.document,e.open(),e.write(I0("document.F=Object")),e.close(),e.F},Is,hu=function(){try{Is=new ActiveXObject("htmlfile")}catch{}hu=typeof document<"u"?document.domain&&Is?og(Is):MC():og(Is);for(var i=ig.length;i--;)delete hu[Id][ig[i]];return hu()};AC[T0]=!0;var rn=Object.create||function(r,e){var t;return r!==null?(wh[Id]=xC(r),t=new wh,wh[Id]=null,t[T0]=r):t=hu(),e===void 0?t:CC.f(t,e)},xo={},BC=S0,FC=Kf,jC=FC.concat("length","prototype");xo.f=Object.getOwnPropertyNames||function(r){return BC(r,jC)};var Gf={},sg=dl,LC=Lt,zC=ga,HC=Array,VC=Math.max,k0=function(i,r,e){for(var t=LC(i),n=sg(r,t),a=sg(e===void 0?t:e,t),o=HC(VC(a-n,0)),s=0;ng;g++)if((s||g in f)&&($=f[g],b=v($,g,d),i))if(r)m[g]=b;else if(b)switch(i){case 3:return!0;case 5:return $;case 6:return g;case 2:dg(m,$)}else switch(i){case 4:return!1;case 7:dg(m,$)}return a?-1:t||n?n:m}},ba={forEach:Gr(0),map:Gr(1),filter:Gr(2),some:Gr(3),every:Gr(4),find:Gr(5),findIndex:Gr(6),filterReject:Gr(7)},pl=K,Do=$e,Yf=Ye,x2=be,Yn=qe,Xn=fa,C2=le,Ke=Ve,A2=He,xd=jt,gl=$r,Xf=al,D2=tn,Cd=en,uo=rn,D0=fl,R2=xo,R0=Gf,N2=Co,N0=Qi,M0=Ct,M2=cl,B0=rl,fg=ya,B2=qf,Jf=pa,F2=vl,F0=Po,vg=nl,j2=Ee,L2=Ao,z2=ke,H2=C0,V2=nn,j0=ma,yl=ba.forEach,Et=F2("hidden"),ml="Symbol",lo="prototype",W2=j0.set,pg=j0.getterFor(ml),ar=Object[lo],Ri=Do.Symbol,Ka=Ri&&Ri[lo],U2=Do.RangeError,K2=Do.TypeError,Sh=Do.QObject,L0=N0.f,Ni=M0.f,z0=R0.f,G2=B0.f,H0=x2([].push),Mr=Jf("symbols"),Ro=Jf("op-symbols"),q2=Jf("wks"),Ad=!Sh||!Sh[lo]||!Sh[lo].findChild,V0=function(i,r,e){var t=L0(ar,r);t&&delete ar[r],Ni(i,r,e),t&&i!==ar&&Ni(ar,r,t)},Dd=Yn&&C2(function(){return uo(Ni({},"a",{get:function(){return Ni(this,"a",{value:7}).a}})).a!==7})?V0:Ni,Oh=function(i,r){var e=Mr[i]=uo(Ka);return W2(e,{type:ml,tag:i,description:r}),Yn||(e.description=r),e},bl=function(r,e,t){r===ar&&bl(Ro,e,t),xd(r);var n=Xf(e);return xd(t),Ke(Mr,n)?(t.enumerable?(Ke(r,Et)&&r[Et][n]&&(r[Et][n]=!1),t=uo(t,{enumerable:Cd(0,!1)})):(Ke(r,Et)||Ni(r,Et,Cd(1,{})),r[Et][n]=!0),Dd(r,n,t)):Ni(r,n,t)},Zf=function(r,e){xd(r);var t=gl(e),n=D0(t).concat(G0(t));return yl(n,function(a){(!Yn||Yf(W0,t,a))&&bl(r,a,t[a])}),r},Y2=function(r,e){return e===void 0?uo(r):Zf(uo(r),e)},W0=function(r){var e=Xf(r),t=Yf(G2,this,e);return this===ar&&Ke(Mr,e)&&!Ke(Ro,e)?!1:t||!Ke(this,e)||!Ke(Mr,e)||Ke(this,Et)&&this[Et][e]?t:!0},U0=function(r,e){var t=gl(r),n=Xf(e);if(!(t===ar&&Ke(Mr,n)&&!Ke(Ro,n))){var a=L0(t,n);return a&&Ke(Mr,n)&&!(Ke(t,Et)&&t[Et][n])&&(a.enumerable=!0),a}},K0=function(r){var e=z0(gl(r)),t=[];return yl(e,function(n){!Ke(Mr,n)&&!Ke(F0,n)&&H0(t,n)}),t},G0=function(i){var r=i===ar,e=z0(r?Ro:gl(i)),t=[];return yl(e,function(n){Ke(Mr,n)&&(!r||Ke(ar,n))&&H0(t,Mr[n])}),t};Xn||(Ri=function(){if(A2(Ka,this))throw new K2("Symbol is not a constructor");var r=!arguments.length||arguments[0]===void 0?void 0:D2(arguments[0]),e=vg(r),t=function(n){var a=this===void 0?Do:this;a===ar&&Yf(t,Ro,n),Ke(a,Et)&&Ke(a[Et],e)&&(a[Et][e]=!1);var o=Cd(1,n);try{Dd(a,e,o)}catch(s){if(!(s instanceof U2))throw s;V0(a,e,o)}};return Yn&&Ad&&Dd(ar,e,{configurable:!0,set:t}),Oh(e,r)},Ka=Ri[lo],fg(Ka,"toString",function(){return pg(this).tag}),fg(Ri,"withoutSetter",function(i){return Oh(vg(i),i)}),B0.f=W0,M0.f=bl,M2.f=Zf,N0.f=U0,R2.f=R0.f=K0,N2.f=G0,L2.f=function(i){return Oh(j2(i),i)},Yn&&B2(Ka,"description",{configurable:!0,get:function(){return pg(this).description}}));pl({global:!0,constructor:!0,wrap:!0,forced:!Xn,sham:!Xn},{Symbol:Ri});yl(D0(q2),function(i){z2(i)});pl({target:ml,stat:!0,forced:!Xn},{useSetter:function(){Ad=!0},useSimple:function(){Ad=!1}});pl({target:"Object",stat:!0,forced:!Xn,sham:!Yn},{create:Y2,defineProperty:bl,defineProperties:Zf,getOwnPropertyDescriptor:U0});pl({target:"Object",stat:!0,forced:!Xn},{getOwnPropertyNames:K0});H2();V2(Ri,ml);F0[Et]=!0;var X2=fa,q0=X2&&!!Symbol.for&&!!Symbol.keyFor,J2=K,Z2=mt,Q2=Ve,eA=tn,Y0=pa,tA=q0,Th=Y0("string-to-symbol-registry"),rA=Y0("symbol-to-string-registry");J2({target:"Symbol",stat:!0,forced:!tA},{for:function(i){var r=eA(i);if(Q2(Th,r))return Th[r];var e=Z2("Symbol")(r);return Th[r]=e,rA[e]=r,e}});var iA=K,nA=Ve,aA=To,oA=va,sA=pa,uA=q0,gg=sA("symbol-to-string-registry");iA({target:"Symbol",stat:!0,forced:!uA},{keyFor:function(r){if(!aA(r))throw new TypeError(oA(r)+" is not a symbol");if(nA(gg,r))return gg[r]}});var lA=be,No=lA([].slice),hA=be,yg=$i,cA=Ie,mg=yi,dA=tn,bg=hA([].push),fA=function(i){if(cA(i))return i;if(yg(i)){for(var r=i.length,e=[],t=0;t=r.length)return i.target=void 0,Cs(void 0,!0);switch(i.kind){case"keys":return Cs(e,!1);case"values":return Cs(r[e],!1)}return Cs([e,r[e]],!1)},"values");Dg.Arguments=Dg.Array;var KD={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},GD=KD,qD=$e,YD=zr,XD=Lr,Rg=$a,JD=Ee,Ng=JD("toStringTag");for(var xh in GD){var Mg=qD[xh],Ch=Mg&&Mg.prototype;Ch&&YD(Ch)!==Ng&&XD(Ch,Ng,xh),Rg[xh]=Rg.Array}var ZD=YA,uw=ZD,QD=Ee,eR=Ct.f,Bg=QD("metadata"),Fg=Function.prototype;Fg[Bg]===void 0&&eR(Fg,Bg,{value:null});var tR=ke;tR("asyncDispose");var rR=ke;rR("dispose");var iR=ke;iR("metadata");var nR=uw,aR=nR,oR=mt,sR=be,rv=oR("Symbol"),uR=rv.keyFor,lR=sR(rv.prototype.valueOf),lw=rv.isRegisteredSymbol||function(r){try{return uR(lR(r))!==void 0}catch{return!1}},hR=K,cR=lw;hR({target:"Symbol",stat:!0},{isRegisteredSymbol:cR});var dR=pa,hw=mt,fR=be,vR=To,pR=Ee,Cu=hw("Symbol"),jg=Cu.isWellKnownSymbol,cw=hw("Object","getOwnPropertyNames"),gR=fR(Cu.prototype.valueOf),Lg=dR("wks");for(var Ah=0,zg=cw(Cu),yR=zg.length;Ah=a?i?"":void 0:(o=Vg(t,n),o<55296||o>56319||n+1===a||(s=Vg(t,n+1))<56320||s>57343?i?RR(t,n):o:i?NR(t,n,n+2):(o-55296<<10)+(s-56320)+65536)}},MR={codeAt:Wg(!1),charAt:Wg(!0)},BR=MR.charAt,FR=tn,fw=ma,jR=ev,Ug=tv,vw="String Iterator",LR=fw.set,zR=fw.getterFor(vw);jR(String,"String",function(i){LR(this,{type:vw,string:FR(i),index:0})},function(){var r=zR(this),e=r.string,t=r.index,n;return t>=e.length?Ug(void 0,!0):(n=BR(e,t),r.index+=n.length,Ug(n,!1))});var HR=Ao,VR=HR.f("iterator"),WR=VR,pw=WR,UR=pw,KR=UR,GR=KR,qR=GR,gw=qR,YR=Y(gw);function Jn(i){"@babel/helpers - typeof";return Jn=typeof Dn=="function"&&typeof YR=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Dn=="function"&&r.constructor===Dn&&r!==Dn.prototype?"symbol":typeof r},Jn(i)}var XR=Ao,JR=XR.f("toPrimitive"),ZR=JR,QR=ZR,eN=QR,tN=eN,rN=tN,iN=rN,nN=iN,aN=Y(nN);function oN(i,r){if(Jn(i)!=="object"||i===null)return i;var e=i[aN];if(e!==void 0){var t=e.call(i,r||"default");if(Jn(t)!=="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(i)}function yw(i){var r=oN(i,"string");return Jn(r)==="symbol"?r:String(r)}function Kg(i,r){for(var e=0;e=0:s>u;u+=l)u in o&&(n=e(n,o[u],u,a));return n}},PN={left:Yg(!1),right:Yg(!0)},xN=le,_l=function(i,r){var e=[][i];return!!e&&xN(function(){e.call(null,r||function(){return 1},1)})},CN=$e,AN=yi,Bo=AN(CN.process)==="process",DN=K,RN=PN.left,NN=_l,Xg=da,MN=Bo,BN=!MN&&Xg>79&&Xg<83,FN=BN||!NN("reduce");DN({target:"Array",proto:!0,forced:FN},{reduce:function(r){var e=arguments.length;return RN(this,r,e,e>1?arguments[1]:void 0)}});var jN=lt,LN=jN("Array","reduce"),zN=He,HN=LN,Nh=Array.prototype,VN=function(i){var r=i.reduce;return i===Nh||zN(Nh,i)&&r===Nh.reduce?HN:r},WN=VN,UN=WN,KN=UN,GN=Y(KN),qN=K,YN=ba.filter,XN=ko,JN=XN("filter");qN({target:"Array",proto:!0,forced:!JN},{filter:function(r){return YN(this,r,arguments.length>1?arguments[1]:void 0)}});var ZN=lt,QN=ZN("Array","filter"),eM=He,tM=QN,Mh=Array.prototype,rM=function(i){var r=i.filter;return i===Mh||eM(Mh,i)&&r===Mh.filter?tM:r},iM=rM,nM=iM,aM=nM,Rn=Y(aM),oM=K,sM=ba.map,uM=ko,lM=uM("map");oM({target:"Array",proto:!0,forced:!lM},{map:function(r){return sM(this,r,arguments.length>1?arguments[1]:void 0)}});var hM=lt,cM=hM("Array","map"),dM=He,fM=cM,Bh=Array.prototype,vM=function(i){var r=i.map;return i===Bh||dM(Bh,i)&&r===Bh.map?fM:r},pM=vM,gM=pM,yM=gM,rr=Y(yM),mM=$i,bM=Lt,$M=ul,wM=bi,Ew=function(i,r,e,t,n,a,o,s){for(var u=n,l=0,h=o?wM(o,s):!1,c,d;l0&&mM(c)?(d=bM(c),u=Ew(i,r,c,d,u,a-1)-1):($M(u+1),i[u]=c),u++),l++;return u},_M=Ew,EM=K,SM=_M,OM=Pt,TM=xt,IM=Lt,kM=hl;EM({target:"Array",proto:!0},{flatMap:function(r){var e=TM(this),t=IM(e),n;return OM(r),n=kM(e,0),n.length=SM(n,e,e,t,0,1,r,arguments.length>1?arguments[1]:void 0),n}});var PM=lt;PM("Array","flatMap");var xM=Ye,Jg=jt,CM=zf,Sw=function(i,r,e){var t,n;Jg(i);try{if(t=CM(i,"return"),!t){if(r==="throw")throw e;return e}t=xM(t,i)}catch(a){n=!0,t=a}if(r==="throw")throw e;if(n)throw t;return Jg(t),e},AM=jt,DM=Sw,RM=function(i,r,e,t){try{return t?r(AM(e)[0],e[1]):r(e)}catch(n){DM(i,"throw",n)}},NM=Ee,MM=$a,BM=NM("iterator"),FM=Array.prototype,Ow=function(i){return i!==void 0&&(MM.Array===i||FM[BM]===i)},jM=zr,Zg=zf,LM=ca,zM=$a,HM=Ee,VM=HM("iterator"),El=function(i){if(!LM(i))return Zg(i,VM)||Zg(i,"@@iterator")||zM[jM(i)]},WM=Ye,UM=Pt,KM=jt,GM=va,qM=El,YM=TypeError,av=function(i,r){var e=arguments.length<2?qM(i):r;if(UM(e))return KM(WM(e,i));throw new YM(GM(i)+" is not iterable")},XM=bi,JM=Ye,ZM=xt,QM=RM,eB=Ow,tB=ll,rB=Lt,Qg=ga,iB=av,nB=El,ey=Array,aB=function(r){var e=ZM(r),t=tB(this),n=arguments.length,a=n>1?arguments[1]:void 0,o=a!==void 0;o&&(a=XM(a,n>2?arguments[2]:void 0));var s=nB(e),u=0,l,h,c,d,f,v;if(s&&!(this===ey&&eB(s)))for(d=iB(e,s),f=d.next,h=t?new this:[];!(c=JM(f,d)).done;u++)v=o?QM(d,a,[c.value,u],!0):c.value,Qg(h,u,v);else for(l=rB(e),h=t?new this(l):ey(l);l>u;u++)v=o?a(e[u],u):e[u],Qg(h,u,v);return h.length=u,h},oB=Ee,Tw=oB("iterator"),Iw=!1;try{var sB=0,ty={next:function(){return{done:!!sB++}},return:function(){Iw=!0}};ty[Tw]=function(){return this},Array.from(ty,function(){throw 2})}catch{}var kw=function(i,r){try{if(!r&&!Iw)return!1}catch{return!1}var e=!1;try{var t={};t[Tw]=function(){return{next:function(){return{done:e=!0}}}},i(t)}catch{}return e},uB=K,lB=aB,hB=kw,cB=!hB(function(i){Array.from(i)});uB({target:"Array",stat:!0,forced:cB},{from:lB});var dB=we,fB=dB.Array.from,vB=fB,Pw=vB,pB=Pw,ov=Y(pB),gB=El,yB=gB,mB=yB,bB=mB,$B=bB,wB=$B,_B=wB,EB=_B,xw=EB,Cw=Y(xw),SB=xw,sv=Y(SB),OB=K,TB=$i;OB({target:"Array",stat:!0},{isArray:TB});var IB=we,kB=IB.Array.isArray,PB=kB,Aw=PB,xB=Aw,CB=xB,AB=CB,DB=AB,RB=DB,Dw=Y(RB);function NB(i){if(Dw(i))return i}var MB=qe,BB=$i,FB=TypeError,jB=Object.getOwnPropertyDescriptor,LB=MB&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(i){return i instanceof TypeError}}(),Rw=LB?function(i,r){if(BB(i)&&!jB(i,"length").writable)throw new FB("Cannot set read only .length");return i.length=r}:function(i,r){return i.length=r},zB=K,HB=xt,VB=Lt,WB=Rw,UB=ul,KB=le,GB=KB(function(){return[].push.call({length:4294967296},1)!==4294967297}),qB=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(i){return i instanceof TypeError}},YB=GB||!qB();zB({target:"Array",proto:!0,arity:1,forced:YB},{push:function(r){var e=HB(this),t=VB(e),n=arguments.length;UB(t+n);for(var a=0;ai.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?arguments[1]:void 0)},Oj=K,ny=Sj;Oj({target:"Array",proto:!0,forced:[].forEach!==ny},{forEach:ny});var Tj=lt,Ij=Tj("Array","forEach"),kj=Ij,Pj=kj,xj=zr,Cj=Ve,Aj=He,Dj=Pj,Hh=Array.prototype,Rj={DOMTokenList:!0,NodeList:!0},zw=function(i){var r=i.forEach;return i===Hh||Aj(Hh,i)&&r===Hh.forEach||Cj(Rj,xj(i))?Dj:r},Nj=zw,Wi=Y(Nj),Mj=K,Bj=be,Fj=$i,jj=Bj([].reverse),ay=[1,2];Mj({target:"Array",proto:!0,forced:String(ay)===String(ay.reverse())},{reverse:function(){return Fj(this)&&(this.length=this.length),jj(this)}});var Lj=lt,zj=Lj("Array","reverse"),Hj=He,Vj=zj,Vh=Array.prototype,Wj=function(i){var r=i.reverse;return i===Vh||Hj(Vh,i)&&r===Vh.reverse?Vj:r},Uj=Wj,Hw=Uj,Kj=Hw,Gj=Y(Kj),oy=va,qj=TypeError,Vw=function(i,r){if(!delete i[r])throw new qj("Cannot delete property "+oy(r)+" of "+oy(i))},Yj=K,Xj=xt,Jj=dl,Zj=sl,Qj=Lt,e3=Rw,t3=ul,r3=hl,i3=ga,Wh=Vw,n3=ko,a3=n3("splice"),o3=Math.max,s3=Math.min;Yj({target:"Array",proto:!0,forced:!a3},{splice:function(r,e){var t=Xj(this),n=Qj(t),a=Jj(r,n),o=arguments.length,s,u,l,h,c,d;for(o===0?s=u=0:o===1?(s=0,u=n-a):(s=o-2,u=s3(o3(Zj(e),0),n-a)),t3(n+s-u),l=r3(t,u),h=0;hn-u+s;h--)Wh(t,h-1)}else if(s>u)for(h=n-u;h>a;h--)c=h+u-1,d=h+s-1,c in t?t[d]=t[c]:Wh(t,d);for(h=0;ha;)for(var u=_3(arguments[a++]),l=o?E3(Kh(u),o(u)):Kh(u),h=l.length,c=0,d;h>c;)d=l[c++],(!sy||y3(s,u,d))&&(t[d]=u[d]);return t}:wn,O3=K,ly=S3;O3({target:"Object",stat:!0,arity:2,forced:Object.assign!==ly},{assign:ly});var T3=we,I3=T3.Object.assign,k3=I3,P3=k3,x3=P3,C3=Y(x3),A3=K,D3=le,R3=xt,Uw=$l,N3=rw,M3=D3(function(){Uw(1)});A3({target:"Object",stat:!0,forced:M3,sham:!N3},{getPrototypeOf:function(r){return Uw(R3(r))}});var B3=we,F3=B3.Object.getPrototypeOf,j3=F3,L3=j3,z3=K,H3=qe,V3=rn;z3({target:"Object",stat:!0,sham:!H3},{create:V3});var W3=we,U3=W3.Object,K3=function(r,e){return U3.create(r,e)},G3=K3,Kw=G3,q3=Kw,Y3=Y(q3),Fd=we,X3=ha;Fd.JSON||(Fd.JSON={stringify:JSON.stringify});var J3=function(r,e,t){return X3(Fd.JSON.stringify,null,arguments)},Z3=J3,Q3=Z3,eL=Q3,tL=Y(eL),rL=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",iL=TypeError,Gw=function(i,r){if(ie,o=aL(t)?t:hL(t),s=a?uL(arguments,e):[],u=a?function(){nL(o,this,s)}:o;return r?i(u,n):i(u)}:i},dL=K,Xw=$e,fL=Yw,hy=fL(Xw.setInterval,!0);dL({global:!0,bind:!0,forced:Xw.setInterval!==hy},{setInterval:hy});var vL=K,Jw=$e,pL=Yw,cy=pL(Jw.setTimeout,!0);vL({global:!0,bind:!0,forced:Jw.setTimeout!==cy},{setTimeout:cy});var gL=we,yL=gL.setTimeout,mL=yL,bL=Y(mL),Zw={exports:{}};(function(i){function r(t){if(t)return e(t);this._callbacks=new Map}function e(t){return Object.assign(t,r.prototype),t._callbacks=new Map,t}r.prototype.on=function(t,n){const a=this._callbacks.get(t)??[];return a.push(n),this._callbacks.set(t,a),this},r.prototype.once=function(t,n){const a=(...o)=>{this.off(t,a),n.apply(this,o)};return a.fn=n,this.on(t,a),this},r.prototype.off=function(t,n){if(t===void 0&&n===void 0)return this._callbacks.clear(),this;if(n===void 0)return this._callbacks.delete(t),this;const a=this._callbacks.get(t);if(a){for(const[o,s]of a.entries())if(s===n||s.fn===n){a.splice(o,1);break}a.length===0?this._callbacks.delete(t):this._callbacks.set(t,a)}return this},r.prototype.emit=function(t,...n){const a=this._callbacks.get(t);if(a){const o=[...a];for(const s of o)s.apply(this,n)}return this},r.prototype.listeners=function(t){return this._callbacks.get(t)??[]},r.prototype.listenerCount=function(t){if(t)return this.listeners(t).length;let n=0;for(const a of this._callbacks.values())n+=a.length;return n},r.prototype.hasListeners=function(t){return this.listenerCount(t)>0},r.prototype.addEventListener=r.prototype.on,r.prototype.removeListener=r.prototype.off,r.prototype.removeEventListener=r.prototype.off,r.prototype.removeAllListeners=r.prototype.off,i.exports=r})(Zw);var $L=Zw.exports,wL=Y($L);/*! Hammer.JS - v2.0.17-rc - 2019-12-16 + */function tl(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")}var sh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Y(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var J$={exports:{}},Es=function(i){return i&&i.Math===Math&&i},$e=Es(typeof globalThis=="object"&&globalThis)||Es(typeof window=="object"&&window)||Es(typeof self=="object"&&self)||Es(typeof sh=="object"&&sh)||function(){return this}()||sh||Function("return this")(),le=function(i){try{return!!i()}catch{return!0}},VI=le,Oo=!VI(function(){var i=function(){}.bind();return typeof i!="function"||i.hasOwnProperty("prototype")}),WI=Oo,Z$=Function.prototype,Pp=Z$.apply,xp=Z$.call,ha=typeof Reflect=="object"&&Reflect.apply||(WI?xp.bind(Pp):function(){return xp.apply(Pp,arguments)}),Q$=Oo,e0=Function.prototype,Ed=e0.call,UI=Q$&&e0.bind.bind(Ed,Ed),be=Q$?UI:function(i){return function(){return Ed.apply(i,arguments)}},t0=be,KI=t0({}.toString),GI=t0("".slice),yi=function(i){return GI(KI(i),8,-1)},qI=yi,YI=be,r0=function(i){if(qI(i)==="Function")return YI(i)},Sd=typeof document=="object"&&document.all,XI=typeof Sd>"u"&&Sd!==void 0,i0={all:Sd,IS_HTMLDDA:XI},n0=i0,JI=n0.all,Ie=n0.IS_HTMLDDA?function(i){return typeof i=="function"||i===JI}:function(i){return typeof i=="function"},Qi={},ZI=le,qe=!ZI(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),QI=Oo,Ss=Function.prototype.call,Ye=QI?Ss.bind(Ss):function(){return Ss.apply(Ss,arguments)},rl={},a0={}.propertyIsEnumerable,o0=Object.getOwnPropertyDescriptor,ek=o0&&!a0.call({1:2},1);rl.f=ek?function(r){var e=o0(this,r);return!!e&&e.enumerable}:a0;var en=function(i,r){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:r}},tk=be,rk=le,ik=yi,uh=Object,nk=tk("".split),il=rk(function(){return!uh("z").propertyIsEnumerable(0)})?function(i){return ik(i)==="String"?nk(i,""):uh(i)}:uh,ca=function(i){return i==null},ak=ca,ok=TypeError,Lf=function(i){if(ak(i))throw new ok("Can't call method on "+i);return i},sk=il,uk=Lf,$r=function(i){return sk(uk(i))},Cp=Ie,s0=i0,lk=s0.all,nt=s0.IS_HTMLDDA?function(i){return typeof i=="object"?i!==null:Cp(i)||i===lk}:function(i){return typeof i=="object"?i!==null:Cp(i)},we={},lh=we,hh=$e,hk=Ie,Ap=function(i){return hk(i)?i:void 0},mt=function(i,r){return arguments.length<2?Ap(lh[i])||Ap(hh[i]):lh[i]&&lh[i][r]||hh[i]&&hh[i][r]},ck=be,He=ck({}.isPrototypeOf),mi=typeof navigator<"u"&&String(navigator.userAgent)||"",u0=$e,ch=mi,Dp=u0.process,Rp=u0.Deno,Np=Dp&&Dp.versions||Rp&&Rp.version,Mp=Np&&Np.v8,tr,ku;Mp&&(tr=Mp.split("."),ku=tr[0]>0&&tr[0]<4?1:+(tr[0]+tr[1]));!ku&&ch&&(tr=ch.match(/Edge\/(\d+)/),(!tr||tr[1]>=74)&&(tr=ch.match(/Chrome\/(\d+)/),tr&&(ku=+tr[1])));var da=ku,Bp=da,dk=le,fk=$e,vk=fk.String,fa=!!Object.getOwnPropertySymbols&&!dk(function(){var i=Symbol("symbol detection");return!vk(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&Bp&&Bp<41}),pk=fa,l0=pk&&!Symbol.sham&&typeof Symbol.iterator=="symbol",gk=mt,yk=Ie,mk=He,bk=l0,$k=Object,To=bk?function(i){return typeof i=="symbol"}:function(i){var r=gk("Symbol");return yk(r)&&mk(r.prototype,$k(i))},wk=String,va=function(i){try{return wk(i)}catch{return"Object"}},_k=Ie,Ek=va,Sk=TypeError,Pt=function(i){if(_k(i))return i;throw new Sk(Ek(i)+" is not a function")},Ok=Pt,Tk=ca,zf=function(i,r){var e=i[r];return Tk(e)?void 0:Ok(e)},dh=Ye,fh=Ie,vh=nt,Ik=TypeError,kk=function(i,r){var e,t;if(r==="string"&&fh(e=i.toString)&&!vh(t=dh(e,i))||fh(e=i.valueOf)&&!vh(t=dh(e,i))||r!=="string"&&fh(e=i.toString)&&!vh(t=dh(e,i)))return t;throw new Ik("Can't convert object to primitive value")},h0={exports:{}},Pk=!0,Fp=$e,xk=Object.defineProperty,Ck=function(i,r){try{xk(Fp,i,{value:r,configurable:!0,writable:!0})}catch{Fp[i]=r}return r},Ak=$e,Dk=Ck,jp="__core-js_shared__",Rk=Ak[jp]||Dk(jp,{}),Hf=Rk,Lp=Hf;(h0.exports=function(i,r){return Lp[i]||(Lp[i]=r!==void 0?r:{})})("versions",[]).push({version:"3.33.2",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.2/LICENSE",source:"https://github.com/zloirock/core-js"});var pa=h0.exports,Nk=Lf,Mk=Object,xt=function(i){return Mk(Nk(i))},Bk=be,Fk=xt,jk=Bk({}.hasOwnProperty),Ve=Object.hasOwn||function(r,e){return jk(Fk(r),e)},Lk=be,zk=0,Hk=Math.random(),Vk=Lk(1 .toString),nl=function(i){return"Symbol("+(i===void 0?"":i)+")_"+Vk(++zk+Hk,36)},Wk=$e,Uk=pa,zp=Ve,Kk=nl,Gk=fa,qk=l0,An=Wk.Symbol,ph=Uk("wks"),Yk=qk?An.for||An:An&&An.withoutSetter||Kk,Ee=function(i){return zp(ph,i)||(ph[i]=Gk&&zp(An,i)?An[i]:Yk("Symbol."+i)),ph[i]},Xk=Ye,Hp=nt,Vp=To,Jk=zf,Zk=kk,Qk=Ee,eP=TypeError,tP=Qk("toPrimitive"),rP=function(i,r){if(!Hp(i)||Vp(i))return i;var e=Jk(i,tP),t;if(e){if(r===void 0&&(r="default"),t=Xk(e,i,r),!Hp(t)||Vp(t))return t;throw new eP("Can't convert object to primitive value")}return r===void 0&&(r="number"),Zk(i,r)},iP=rP,nP=To,al=function(i){var r=iP(i,"string");return nP(r)?r:r+""},aP=$e,Wp=nt,Od=aP.document,oP=Wp(Od)&&Wp(Od.createElement),Vf=function(i){return oP?Od.createElement(i):{}},sP=qe,uP=le,lP=Vf,c0=!sP&&!uP(function(){return Object.defineProperty(lP("div"),"a",{get:function(){return 7}}).a!==7}),hP=qe,cP=Ye,dP=rl,fP=en,vP=$r,pP=al,gP=Ve,yP=c0,Up=Object.getOwnPropertyDescriptor;Qi.f=hP?Up:function(r,e){if(r=vP(r),e=pP(e),yP)try{return Up(r,e)}catch{}if(gP(r,e))return fP(!cP(dP.f,r,e),r[e])};var mP=le,bP=Ie,$P=/#|\.prototype\./,Io=function(i,r){var e=_P[wP(i)];return e===SP?!0:e===EP?!1:bP(r)?mP(r):!!r},wP=Io.normalize=function(i){return String(i).replace($P,".").toLowerCase()},_P=Io.data={},EP=Io.NATIVE="N",SP=Io.POLYFILL="P",d0=Io,Kp=r0,OP=Pt,TP=Oo,IP=Kp(Kp.bind),bi=function(i,r){return OP(i),r===void 0?i:TP?IP(i,r):function(){return i.apply(r,arguments)}},Ct={},kP=qe,PP=le,f0=kP&&PP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),xP=nt,CP=String,AP=TypeError,jt=function(i){if(xP(i))return i;throw new AP(CP(i)+" is not an object")},DP=qe,RP=c0,NP=f0,Os=jt,Gp=al,MP=TypeError,gh=Object.defineProperty,BP=Object.getOwnPropertyDescriptor,yh="enumerable",mh="configurable",bh="writable";Ct.f=DP?NP?function(r,e,t){if(Os(r),e=Gp(e),Os(t),typeof r=="function"&&e==="prototype"&&"value"in t&&bh in t&&!t[bh]){var n=BP(r,e);n&&n[bh]&&(r[e]=t.value,t={configurable:mh in t?t[mh]:n[mh],enumerable:yh in t?t[yh]:n[yh],writable:!1})}return gh(r,e,t)}:gh:function(r,e,t){if(Os(r),e=Gp(e),Os(t),RP)try{return gh(r,e,t)}catch{}if("get"in t||"set"in t)throw new MP("Accessors not supported");return"value"in t&&(r[e]=t.value),r};var FP=qe,jP=Ct,LP=en,Lr=FP?function(i,r,e){return jP.f(i,r,LP(1,e))}:function(i,r,e){return i[r]=e,i},Ts=$e,zP=ha,HP=r0,VP=Ie,WP=Qi.f,UP=d0,mn=we,KP=bi,bn=Lr,qp=Ve,GP=function(i){var r=function(e,t,n){if(this instanceof r){switch(arguments.length){case 0:return new i;case 1:return new i(e);case 2:return new i(e,t)}return new i(e,t,n)}return zP(i,this,arguments)};return r.prototype=i.prototype,r},K=function(i,r){var e=i.target,t=i.global,n=i.stat,a=i.proto,o=t?Ts:n?Ts[e]:(Ts[e]||{}).prototype,s=t?mn:mn[e]||bn(mn,e,{})[e],u=s.prototype,l,h,c,d,f,v,p,g,y;for(d in r)l=UP(t?d:e+(n?".":"#")+d,i.forced),h=!l&&o&&qp(o,d),v=s[d],h&&(i.dontCallGetSet?(y=WP(o,d),p=y&&y.value):p=o[d]),f=h&&p?p:r[d],!(h&&typeof v==typeof f)&&(i.bind&&h?g=KP(f,Ts):i.wrap&&h?g=GP(f):a&&VP(f)?g=HP(f):g=f,(i.sham||f&&f.sham||v&&v.sham)&&bn(g,"sham",!0),bn(s,d,g),a&&(c=e+"Prototype",qp(mn,c)||bn(mn,c,{}),bn(mn[c],d,f),i.real&&u&&(l||!u[d])&&bn(u,d,f)))},qP=K,YP=qe,Yp=Ct.f;qP({target:"Object",stat:!0,forced:Object.defineProperty!==Yp,sham:!YP},{defineProperty:Yp});var XP=we,v0=XP.Object,JP=J$.exports=function(r,e,t){return v0.defineProperty(r,e,t)};v0.defineProperty.sham&&(JP.sham=!0);var ZP=J$.exports,QP=ZP,p0=QP,ex=p0,tx=ex,rx=tx,ix=rx,g0=ix,ol=Y(g0),nx=yi,$i=Array.isArray||function(r){return nx(r)==="Array"},ax=Math.ceil,ox=Math.floor,sx=Math.trunc||function(r){var e=+r;return(e>0?ox:ax)(e)},ux=sx,sl=function(i){var r=+i;return r!==r||r===0?0:ux(r)},lx=sl,hx=Math.min,cx=function(i){return i>0?hx(lx(i),9007199254740991):0},dx=cx,Lt=function(i){return dx(i.length)},fx=TypeError,vx=9007199254740991,ul=function(i){if(i>vx)throw fx("Maximum allowed index exceeded");return i},px=al,gx=Ct,yx=en,ga=function(i,r,e){var t=px(r);t in i?gx.f(i,t,yx(0,e)):i[t]=e},mx=Ee,bx=mx("toStringTag"),y0={};y0[bx]="z";var Wf=String(y0)==="[object z]",$x=Wf,wx=Ie,lu=yi,_x=Ee,Ex=_x("toStringTag"),Sx=Object,Ox=lu(function(){return arguments}())==="Arguments",Tx=function(i,r){try{return i[r]}catch{}},zr=$x?lu:function(i){var r,e,t;return i===void 0?"Undefined":i===null?"Null":typeof(e=Tx(r=Sx(i),Ex))=="string"?e:Ox?lu(r):(t=lu(r))==="Object"&&wx(r.callee)?"Arguments":t},Ix=be,kx=Ie,Td=Hf,Px=Ix(Function.toString);kx(Td.inspectSource)||(Td.inspectSource=function(i){return Px(i)});var m0=Td.inspectSource,xx=be,Cx=le,b0=Ie,Ax=zr,Dx=mt,Rx=m0,$0=function(){},Nx=[],w0=Dx("Reflect","construct"),Uf=/^\s*(?:class|function)\b/,Mx=xx(Uf.exec),Bx=!Uf.test($0),Fa=function(r){if(!b0(r))return!1;try{return w0($0,Nx,r),!0}catch{return!1}},_0=function(r){if(!b0(r))return!1;switch(Ax(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Bx||!!Mx(Uf,Rx(r))}catch{return!0}};_0.sham=!0;var ll=!w0||Cx(function(){var i;return Fa(Fa.call)||!Fa(Object)||!Fa(function(){i=!0})||i})?_0:Fa,Xp=$i,Fx=ll,jx=nt,Lx=Ee,zx=Lx("species"),Jp=Array,Hx=function(i){var r;return Xp(i)&&(r=i.constructor,Fx(r)&&(r===Jp||Xp(r.prototype))?r=void 0:jx(r)&&(r=r[zx],r===null&&(r=void 0))),r===void 0?Jp:r},Vx=Hx,hl=function(i,r){return new(Vx(i))(r===0?0:r)},Wx=le,Ux=Ee,Kx=da,Gx=Ux("species"),ko=function(i){return Kx>=51||!Wx(function(){var r=[],e=r.constructor={};return e[Gx]=function(){return{foo:1}},r[i](Boolean).foo!==1})},qx=K,Yx=le,Xx=$i,Jx=nt,Zx=xt,Qx=Lt,Zp=ul,Qp=ga,eC=hl,tC=ko,rC=Ee,iC=da,E0=rC("isConcatSpreadable"),nC=iC>=51||!Yx(function(){var i=[];return i[E0]=!1,i.concat()[0]!==i}),aC=function(i){if(!Jx(i))return!1;var r=i[E0];return r!==void 0?!!r:Xx(i)},oC=!nC||!tC("concat");qx({target:"Array",proto:!0,arity:1,forced:oC},{concat:function(r){var e=Zx(this),t=eC(e,0),n=0,a,o,s,u,l;for(a=-1,s=arguments.length;ao;)if(s=n[o++],s!==s)return!0}else for(;a>o;o++)if((i||o in n)&&n[o]===e)return i||o||0;return!i&&-1}},pC={includes:eg(!0),indexOf:eg(!1)},Po={},gC=be,$h=Ve,yC=$r,mC=pC.indexOf,bC=Po,tg=gC([].push),S0=function(i,r){var e=yC(i),t=0,n=[],a;for(a in e)!$h(bC,a)&&$h(e,a)&&tg(n,a);for(;r.length>t;)$h(e,a=r[t++])&&(~mC(n,a)||tg(n,a));return n},Kf=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],$C=S0,wC=Kf,fl=Object.keys||function(r){return $C(r,wC)},_C=qe,EC=f0,SC=Ct,OC=jt,TC=$r,IC=fl;cl.f=_C&&!EC?Object.defineProperties:function(r,e){OC(r);for(var t=TC(e),n=IC(e),a=n.length,o=0,s;a>o;)SC.f(r,s=n[o++],t[s]);return r};var kC=mt,O0=kC("document","documentElement"),PC=pa,xC=nl,rg=PC("keys"),vl=function(i){return rg[i]||(rg[i]=xC(i))},CC=jt,AC=cl,ig=Kf,DC=Po,RC=O0,NC=Vf,MC=vl,ng=">",ag="<",Id="prototype",kd="script",T0=MC("IE_PROTO"),wh=function(){},I0=function(i){return ag+kd+ng+i+ag+"/"+kd+ng},og=function(i){i.write(I0("")),i.close();var r=i.parentWindow.Object;return i=null,r},BC=function(){var i=NC("iframe"),r="java"+kd+":",e;return i.style.display="none",RC.appendChild(i),i.src=String(r),e=i.contentWindow.document,e.open(),e.write(I0("document.F=Object")),e.close(),e.F},Is,hu=function(){try{Is=new ActiveXObject("htmlfile")}catch{}hu=typeof document<"u"?document.domain&&Is?og(Is):BC():og(Is);for(var i=ig.length;i--;)delete hu[Id][ig[i]];return hu()};DC[T0]=!0;var rn=Object.create||function(r,e){var t;return r!==null?(wh[Id]=CC(r),t=new wh,wh[Id]=null,t[T0]=r):t=hu(),e===void 0?t:AC.f(t,e)},xo={},FC=S0,jC=Kf,LC=jC.concat("length","prototype");xo.f=Object.getOwnPropertyNames||function(r){return FC(r,LC)};var Gf={},sg=dl,zC=Lt,HC=ga,VC=Array,WC=Math.max,k0=function(i,r,e){for(var t=zC(i),n=sg(r,t),a=sg(e===void 0?t:e,t),o=VC(WC(a-n,0)),s=0;ng;g++)if((s||g in f)&&($=f[g],b=v($,g,d),i))if(r)m[g]=b;else if(b)switch(i){case 3:return!0;case 5:return $;case 6:return g;case 2:dg(m,$)}else switch(i){case 4:return!1;case 7:dg(m,$)}return a?-1:t||n?n:m}},ba={forEach:Gr(0),map:Gr(1),filter:Gr(2),some:Gr(3),every:Gr(4),find:Gr(5),findIndex:Gr(6),filterReject:Gr(7)},pl=K,Do=$e,Yf=Ye,C2=be,Yn=qe,Xn=fa,A2=le,Ke=Ve,D2=He,xd=jt,gl=$r,Xf=al,R2=tn,Cd=en,uo=rn,D0=fl,N2=xo,R0=Gf,M2=Co,N0=Qi,M0=Ct,B2=cl,B0=rl,fg=ya,F2=qf,Jf=pa,j2=vl,F0=Po,vg=nl,L2=Ee,z2=Ao,H2=ke,V2=C0,W2=nn,j0=ma,yl=ba.forEach,Et=j2("hidden"),ml="Symbol",lo="prototype",U2=j0.set,pg=j0.getterFor(ml),ar=Object[lo],Ri=Do.Symbol,Ka=Ri&&Ri[lo],K2=Do.RangeError,G2=Do.TypeError,Sh=Do.QObject,L0=N0.f,Ni=M0.f,z0=R0.f,q2=B0.f,H0=C2([].push),Mr=Jf("symbols"),Ro=Jf("op-symbols"),Y2=Jf("wks"),Ad=!Sh||!Sh[lo]||!Sh[lo].findChild,V0=function(i,r,e){var t=L0(ar,r);t&&delete ar[r],Ni(i,r,e),t&&i!==ar&&Ni(ar,r,t)},Dd=Yn&&A2(function(){return uo(Ni({},"a",{get:function(){return Ni(this,"a",{value:7}).a}})).a!==7})?V0:Ni,Oh=function(i,r){var e=Mr[i]=uo(Ka);return U2(e,{type:ml,tag:i,description:r}),Yn||(e.description=r),e},bl=function(r,e,t){r===ar&&bl(Ro,e,t),xd(r);var n=Xf(e);return xd(t),Ke(Mr,n)?(t.enumerable?(Ke(r,Et)&&r[Et][n]&&(r[Et][n]=!1),t=uo(t,{enumerable:Cd(0,!1)})):(Ke(r,Et)||Ni(r,Et,Cd(1,{})),r[Et][n]=!0),Dd(r,n,t)):Ni(r,n,t)},Zf=function(r,e){xd(r);var t=gl(e),n=D0(t).concat(G0(t));return yl(n,function(a){(!Yn||Yf(W0,t,a))&&bl(r,a,t[a])}),r},X2=function(r,e){return e===void 0?uo(r):Zf(uo(r),e)},W0=function(r){var e=Xf(r),t=Yf(q2,this,e);return this===ar&&Ke(Mr,e)&&!Ke(Ro,e)?!1:t||!Ke(this,e)||!Ke(Mr,e)||Ke(this,Et)&&this[Et][e]?t:!0},U0=function(r,e){var t=gl(r),n=Xf(e);if(!(t===ar&&Ke(Mr,n)&&!Ke(Ro,n))){var a=L0(t,n);return a&&Ke(Mr,n)&&!(Ke(t,Et)&&t[Et][n])&&(a.enumerable=!0),a}},K0=function(r){var e=z0(gl(r)),t=[];return yl(e,function(n){!Ke(Mr,n)&&!Ke(F0,n)&&H0(t,n)}),t},G0=function(i){var r=i===ar,e=z0(r?Ro:gl(i)),t=[];return yl(e,function(n){Ke(Mr,n)&&(!r||Ke(ar,n))&&H0(t,Mr[n])}),t};Xn||(Ri=function(){if(D2(Ka,this))throw new G2("Symbol is not a constructor");var r=!arguments.length||arguments[0]===void 0?void 0:R2(arguments[0]),e=vg(r),t=function(n){var a=this===void 0?Do:this;a===ar&&Yf(t,Ro,n),Ke(a,Et)&&Ke(a[Et],e)&&(a[Et][e]=!1);var o=Cd(1,n);try{Dd(a,e,o)}catch(s){if(!(s instanceof K2))throw s;V0(a,e,o)}};return Yn&&Ad&&Dd(ar,e,{configurable:!0,set:t}),Oh(e,r)},Ka=Ri[lo],fg(Ka,"toString",function(){return pg(this).tag}),fg(Ri,"withoutSetter",function(i){return Oh(vg(i),i)}),B0.f=W0,M0.f=bl,B2.f=Zf,N0.f=U0,N2.f=R0.f=K0,M2.f=G0,z2.f=function(i){return Oh(L2(i),i)},Yn&&F2(Ka,"description",{configurable:!0,get:function(){return pg(this).description}}));pl({global:!0,constructor:!0,wrap:!0,forced:!Xn,sham:!Xn},{Symbol:Ri});yl(D0(Y2),function(i){H2(i)});pl({target:ml,stat:!0,forced:!Xn},{useSetter:function(){Ad=!0},useSimple:function(){Ad=!1}});pl({target:"Object",stat:!0,forced:!Xn,sham:!Yn},{create:X2,defineProperty:bl,defineProperties:Zf,getOwnPropertyDescriptor:U0});pl({target:"Object",stat:!0,forced:!Xn},{getOwnPropertyNames:K0});V2();W2(Ri,ml);F0[Et]=!0;var J2=fa,q0=J2&&!!Symbol.for&&!!Symbol.keyFor,Z2=K,Q2=mt,eA=Ve,tA=tn,Y0=pa,rA=q0,Th=Y0("string-to-symbol-registry"),iA=Y0("symbol-to-string-registry");Z2({target:"Symbol",stat:!0,forced:!rA},{for:function(i){var r=tA(i);if(eA(Th,r))return Th[r];var e=Q2("Symbol")(r);return Th[r]=e,iA[e]=r,e}});var nA=K,aA=Ve,oA=To,sA=va,uA=pa,lA=q0,gg=uA("symbol-to-string-registry");nA({target:"Symbol",stat:!0,forced:!lA},{keyFor:function(r){if(!oA(r))throw new TypeError(sA(r)+" is not a symbol");if(aA(gg,r))return gg[r]}});var hA=be,No=hA([].slice),cA=be,yg=$i,dA=Ie,mg=yi,fA=tn,bg=cA([].push),vA=function(i){if(dA(i))return i;if(yg(i)){for(var r=i.length,e=[],t=0;t=r.length)return i.target=void 0,Cs(void 0,!0);switch(i.kind){case"keys":return Cs(e,!1);case"values":return Cs(r[e],!1)}return Cs([e,r[e]],!1)},"values");Dg.Arguments=Dg.Array;var GD={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},qD=GD,YD=$e,XD=zr,JD=Lr,Rg=$a,ZD=Ee,Ng=ZD("toStringTag");for(var xh in qD){var Mg=YD[xh],Ch=Mg&&Mg.prototype;Ch&&XD(Ch)!==Ng&&JD(Ch,Ng,xh),Rg[xh]=Rg.Array}var QD=XA,uw=QD,eR=Ee,tR=Ct.f,Bg=eR("metadata"),Fg=Function.prototype;Fg[Bg]===void 0&&tR(Fg,Bg,{value:null});var rR=ke;rR("asyncDispose");var iR=ke;iR("dispose");var nR=ke;nR("metadata");var aR=uw,oR=aR,sR=mt,uR=be,rv=sR("Symbol"),lR=rv.keyFor,hR=uR(rv.prototype.valueOf),lw=rv.isRegisteredSymbol||function(r){try{return lR(hR(r))!==void 0}catch{return!1}},cR=K,dR=lw;cR({target:"Symbol",stat:!0},{isRegisteredSymbol:dR});var fR=pa,hw=mt,vR=be,pR=To,gR=Ee,Cu=hw("Symbol"),jg=Cu.isWellKnownSymbol,cw=hw("Object","getOwnPropertyNames"),yR=vR(Cu.prototype.valueOf),Lg=fR("wks");for(var Ah=0,zg=cw(Cu),mR=zg.length;Ah=a?i?"":void 0:(o=Vg(t,n),o<55296||o>56319||n+1===a||(s=Vg(t,n+1))<56320||s>57343?i?NR(t,n):o:i?MR(t,n,n+2):(o-55296<<10)+(s-56320)+65536)}},BR={codeAt:Wg(!1),charAt:Wg(!0)},FR=BR.charAt,jR=tn,fw=ma,LR=ev,Ug=tv,vw="String Iterator",zR=fw.set,HR=fw.getterFor(vw);LR(String,"String",function(i){zR(this,{type:vw,string:jR(i),index:0})},function(){var r=HR(this),e=r.string,t=r.index,n;return t>=e.length?Ug(void 0,!0):(n=FR(e,t),r.index+=n.length,Ug(n,!1))});var VR=Ao,WR=VR.f("iterator"),UR=WR,pw=UR,KR=pw,GR=KR,qR=GR,YR=qR,gw=YR,XR=Y(gw);function Jn(i){"@babel/helpers - typeof";return Jn=typeof Dn=="function"&&typeof XR=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Dn=="function"&&r.constructor===Dn&&r!==Dn.prototype?"symbol":typeof r},Jn(i)}var JR=Ao,ZR=JR.f("toPrimitive"),QR=ZR,eN=QR,tN=eN,rN=tN,iN=rN,nN=iN,aN=nN,oN=Y(aN);function sN(i,r){if(Jn(i)!=="object"||i===null)return i;var e=i[oN];if(e!==void 0){var t=e.call(i,r||"default");if(Jn(t)!=="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(i)}function yw(i){var r=sN(i,"string");return Jn(r)==="symbol"?r:String(r)}function Kg(i,r){for(var e=0;e=0:s>u;u+=l)u in o&&(n=e(n,o[u],u,a));return n}},xN={left:Yg(!1),right:Yg(!0)},CN=le,_l=function(i,r){var e=[][i];return!!e&&CN(function(){e.call(null,r||function(){return 1},1)})},AN=$e,DN=yi,Bo=DN(AN.process)==="process",RN=K,NN=xN.left,MN=_l,Xg=da,BN=Bo,FN=!BN&&Xg>79&&Xg<83,jN=FN||!MN("reduce");RN({target:"Array",proto:!0,forced:jN},{reduce:function(r){var e=arguments.length;return NN(this,r,e,e>1?arguments[1]:void 0)}});var LN=lt,zN=LN("Array","reduce"),HN=He,VN=zN,Nh=Array.prototype,WN=function(i){var r=i.reduce;return i===Nh||HN(Nh,i)&&r===Nh.reduce?VN:r},UN=WN,KN=UN,GN=KN,qN=Y(GN),YN=K,XN=ba.filter,JN=ko,ZN=JN("filter");YN({target:"Array",proto:!0,forced:!ZN},{filter:function(r){return XN(this,r,arguments.length>1?arguments[1]:void 0)}});var QN=lt,eM=QN("Array","filter"),tM=He,rM=eM,Mh=Array.prototype,iM=function(i){var r=i.filter;return i===Mh||tM(Mh,i)&&r===Mh.filter?rM:r},nM=iM,aM=nM,oM=aM,Rn=Y(oM),sM=K,uM=ba.map,lM=ko,hM=lM("map");sM({target:"Array",proto:!0,forced:!hM},{map:function(r){return uM(this,r,arguments.length>1?arguments[1]:void 0)}});var cM=lt,dM=cM("Array","map"),fM=He,vM=dM,Bh=Array.prototype,pM=function(i){var r=i.map;return i===Bh||fM(Bh,i)&&r===Bh.map?vM:r},gM=pM,yM=gM,mM=yM,rr=Y(mM),bM=$i,$M=Lt,wM=ul,_M=bi,Ew=function(i,r,e,t,n,a,o,s){for(var u=n,l=0,h=o?_M(o,s):!1,c,d;l0&&bM(c)?(d=$M(c),u=Ew(i,r,c,d,u,a-1)-1):(wM(u+1),i[u]=c),u++),l++;return u},EM=Ew,SM=K,OM=EM,TM=Pt,IM=xt,kM=Lt,PM=hl;SM({target:"Array",proto:!0},{flatMap:function(r){var e=IM(this),t=kM(e),n;return TM(r),n=PM(e,0),n.length=OM(n,e,e,t,0,1,r,arguments.length>1?arguments[1]:void 0),n}});var xM=lt;xM("Array","flatMap");var CM=Ye,Jg=jt,AM=zf,Sw=function(i,r,e){var t,n;Jg(i);try{if(t=AM(i,"return"),!t){if(r==="throw")throw e;return e}t=CM(t,i)}catch(a){n=!0,t=a}if(r==="throw")throw e;if(n)throw t;return Jg(t),e},DM=jt,RM=Sw,NM=function(i,r,e,t){try{return t?r(DM(e)[0],e[1]):r(e)}catch(n){RM(i,"throw",n)}},MM=Ee,BM=$a,FM=MM("iterator"),jM=Array.prototype,Ow=function(i){return i!==void 0&&(BM.Array===i||jM[FM]===i)},LM=zr,Zg=zf,zM=ca,HM=$a,VM=Ee,WM=VM("iterator"),El=function(i){if(!zM(i))return Zg(i,WM)||Zg(i,"@@iterator")||HM[LM(i)]},UM=Ye,KM=Pt,GM=jt,qM=va,YM=El,XM=TypeError,av=function(i,r){var e=arguments.length<2?YM(i):r;if(KM(e))return GM(UM(e,i));throw new XM(qM(i)+" is not iterable")},JM=bi,ZM=Ye,QM=xt,eB=NM,tB=Ow,rB=ll,iB=Lt,Qg=ga,nB=av,aB=El,ey=Array,oB=function(r){var e=QM(r),t=rB(this),n=arguments.length,a=n>1?arguments[1]:void 0,o=a!==void 0;o&&(a=JM(a,n>2?arguments[2]:void 0));var s=aB(e),u=0,l,h,c,d,f,v;if(s&&!(this===ey&&tB(s)))for(d=nB(e,s),f=d.next,h=t?new this:[];!(c=ZM(f,d)).done;u++)v=o?eB(d,a,[c.value,u],!0):c.value,Qg(h,u,v);else for(l=iB(e),h=t?new this(l):ey(l);l>u;u++)v=o?a(e[u],u):e[u],Qg(h,u,v);return h.length=u,h},sB=Ee,Tw=sB("iterator"),Iw=!1;try{var uB=0,ty={next:function(){return{done:!!uB++}},return:function(){Iw=!0}};ty[Tw]=function(){return this},Array.from(ty,function(){throw 2})}catch{}var kw=function(i,r){try{if(!r&&!Iw)return!1}catch{return!1}var e=!1;try{var t={};t[Tw]=function(){return{next:function(){return{done:e=!0}}}},i(t)}catch{}return e},lB=K,hB=oB,cB=kw,dB=!cB(function(i){Array.from(i)});lB({target:"Array",stat:!0,forced:dB},{from:hB});var fB=we,vB=fB.Array.from,pB=vB,Pw=pB,gB=Pw,ov=Y(gB),yB=El,mB=yB,bB=mB,$B=bB,wB=$B,_B=wB,EB=_B,SB=EB,xw=SB,Cw=Y(xw),OB=xw,sv=Y(OB),TB=K,IB=$i;TB({target:"Array",stat:!0},{isArray:IB});var kB=we,PB=kB.Array.isArray,xB=PB,Aw=xB,CB=Aw,AB=CB,DB=AB,RB=DB,NB=RB,Dw=Y(NB);function MB(i){if(Dw(i))return i}var BB=qe,FB=$i,jB=TypeError,LB=Object.getOwnPropertyDescriptor,zB=BB&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(i){return i instanceof TypeError}}(),Rw=zB?function(i,r){if(FB(i)&&!LB(i,"length").writable)throw new jB("Cannot set read only .length");return i.length=r}:function(i,r){return i.length=r},HB=K,VB=xt,WB=Lt,UB=Rw,KB=ul,GB=le,qB=GB(function(){return[].push.call({length:4294967296},1)!==4294967297}),YB=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(i){return i instanceof TypeError}},XB=qB||!YB();HB({target:"Array",proto:!0,arity:1,forced:XB},{push:function(r){var e=VB(this),t=WB(e),n=arguments.length;KB(t+n);for(var a=0;ai.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?arguments[1]:void 0)},Tj=K,ny=Oj;Tj({target:"Array",proto:!0,forced:[].forEach!==ny},{forEach:ny});var Ij=lt,kj=Ij("Array","forEach"),Pj=kj,xj=Pj,Cj=zr,Aj=Ve,Dj=He,Rj=xj,Hh=Array.prototype,Nj={DOMTokenList:!0,NodeList:!0},zw=function(i){var r=i.forEach;return i===Hh||Dj(Hh,i)&&r===Hh.forEach||Aj(Nj,Cj(i))?Rj:r},Mj=zw,Wi=Y(Mj),Bj=K,Fj=be,jj=$i,Lj=Fj([].reverse),ay=[1,2];Bj({target:"Array",proto:!0,forced:String(ay)===String(ay.reverse())},{reverse:function(){return jj(this)&&(this.length=this.length),Lj(this)}});var zj=lt,Hj=zj("Array","reverse"),Vj=He,Wj=Hj,Vh=Array.prototype,Uj=function(i){var r=i.reverse;return i===Vh||Vj(Vh,i)&&r===Vh.reverse?Wj:r},Kj=Uj,Hw=Kj,Gj=Hw,qj=Y(Gj),oy=va,Yj=TypeError,Vw=function(i,r){if(!delete i[r])throw new Yj("Cannot delete property "+oy(r)+" of "+oy(i))},Xj=K,Jj=xt,Zj=dl,Qj=sl,e3=Lt,t3=Rw,r3=ul,i3=hl,n3=ga,Wh=Vw,a3=ko,o3=a3("splice"),s3=Math.max,u3=Math.min;Xj({target:"Array",proto:!0,forced:!o3},{splice:function(r,e){var t=Jj(this),n=e3(t),a=Zj(r,n),o=arguments.length,s,u,l,h,c,d;for(o===0?s=u=0:o===1?(s=0,u=n-a):(s=o-2,u=u3(s3(Qj(e),0),n-a)),r3(n+s-u),l=i3(t,u),h=0;hn-u+s;h--)Wh(t,h-1)}else if(s>u)for(h=n-u;h>a;h--)c=h+u-1,d=h+s-1,c in t?t[d]=t[c]:Wh(t,d);for(h=0;ha;)for(var u=E3(arguments[a++]),l=o?S3(Kh(u),o(u)):Kh(u),h=l.length,c=0,d;h>c;)d=l[c++],(!sy||m3(s,u,d))&&(t[d]=u[d]);return t}:wn,T3=K,ly=O3;T3({target:"Object",stat:!0,arity:2,forced:Object.assign!==ly},{assign:ly});var I3=we,k3=I3.Object.assign,P3=k3,x3=P3,C3=x3,A3=Y(C3),D3=K,R3=le,N3=xt,Uw=$l,M3=rw,B3=R3(function(){Uw(1)});D3({target:"Object",stat:!0,forced:B3,sham:!M3},{getPrototypeOf:function(r){return Uw(N3(r))}});var F3=we,j3=F3.Object.getPrototypeOf,L3=j3,z3=L3,H3=K,V3=qe,W3=rn;H3({target:"Object",stat:!0,sham:!V3},{create:W3});var U3=we,K3=U3.Object,G3=function(r,e){return K3.create(r,e)},q3=G3,Kw=q3,Y3=Kw,X3=Y(Y3),Fd=we,J3=ha;Fd.JSON||(Fd.JSON={stringify:JSON.stringify});var Z3=function(r,e,t){return J3(Fd.JSON.stringify,null,arguments)},Q3=Z3,eL=Q3,tL=eL,rL=Y(tL),iL=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",nL=TypeError,Gw=function(i,r){if(ie,o=oL(t)?t:cL(t),s=a?lL(arguments,e):[],u=a?function(){aL(o,this,s)}:o;return r?i(u,n):i(u)}:i},fL=K,Xw=$e,vL=Yw,hy=vL(Xw.setInterval,!0);fL({global:!0,bind:!0,forced:Xw.setInterval!==hy},{setInterval:hy});var pL=K,Jw=$e,gL=Yw,cy=gL(Jw.setTimeout,!0);pL({global:!0,bind:!0,forced:Jw.setTimeout!==cy},{setTimeout:cy});var yL=we,mL=yL.setTimeout,bL=mL,$L=Y(bL),Zw={exports:{}};(function(i){function r(t){if(t)return e(t);this._callbacks=new Map}function e(t){return Object.assign(t,r.prototype),t._callbacks=new Map,t}r.prototype.on=function(t,n){const a=this._callbacks.get(t)??[];return a.push(n),this._callbacks.set(t,a),this},r.prototype.once=function(t,n){const a=(...o)=>{this.off(t,a),n.apply(this,o)};return a.fn=n,this.on(t,a),this},r.prototype.off=function(t,n){if(t===void 0&&n===void 0)return this._callbacks.clear(),this;if(n===void 0)return this._callbacks.delete(t),this;const a=this._callbacks.get(t);if(a){for(const[o,s]of a.entries())if(s===n||s.fn===n){a.splice(o,1);break}a.length===0?this._callbacks.delete(t):this._callbacks.set(t,a)}return this},r.prototype.emit=function(t,...n){const a=this._callbacks.get(t);if(a){const o=[...a];for(const s of o)s.apply(this,n)}return this},r.prototype.listeners=function(t){return this._callbacks.get(t)??[]},r.prototype.listenerCount=function(t){if(t)return this.listeners(t).length;let n=0;for(const a of this._callbacks.values())n+=a.length;return n},r.prototype.hasListeners=function(t){return this.listenerCount(t)>0},r.prototype.addEventListener=r.prototype.on,r.prototype.removeListener=r.prototype.off,r.prototype.removeEventListener=r.prototype.off,r.prototype.removeAllListeners=r.prototype.off,i.exports=r})(Zw);var wL=Zw.exports,_L=Y(wL);/*! Hammer.JS - v2.0.17-rc - 2019-12-16 * http://naver.github.io/egjs * * Forked By Naver egjs * Copyright (c) hammerjs - * Licensed under the MIT license */function sr(){return sr=Object.assign||function(i){for(var r=1;r"u"?{style:{}}:document.createElement("div"),EL="function",Nn=Math.round,Ki=Math.abs,hv=Date.now;function Il(i,r){for(var e,t,n=r[0].toUpperCase()+r.slice(1),a=0;a"u"?kr={}:kr=window;var Qw=Il(_L.style,"touchAction"),e_=Qw!==void 0;function SL(){if(!e_)return!1;var i={},r=kr.CSS&&kr.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){return i[e]=r?kr.CSS.supports("touch-action",e):!0}),i}var t_="compute",r_="auto",Ld="manipulation",Mi="none",ho="pan-x",co="pan-y",Ds=SL(),OL=/mobile|tablet|ip(ad|hone|od)|android/i,i_="ontouchstart"in kr,TL=Il(kr,"PointerEvent")!==void 0,IL=i_&&OL.test(navigator.userAgent),Fo="touch",kL="pen",cv="mouse",PL="kinect",xL=25,gt=1,an=2,je=4,It=8,Au=1,jo=2,Lo=4,zo=8,Zn=16,yr=jo|Lo,Bi=zo|Zn,n_=yr|Bi,a_=["x","y"],Du=["clientX","clientY"];function Pr(i,r,e){var t;if(i)if(i.forEach)i.forEach(r,e);else if(i.length!==void 0)for(t=0;t-1}function CL(i){if(Ci(i,Mi))return Mi;var r=Ci(i,ho),e=Ci(i,co);return r&&e?Mi:r||e?r?ho:co:Ci(i,Ld)?Ld:r_}var o_=function(){function i(e,t){this.manager=e,this.set(t)}var r=i.prototype;return r.set=function(t){t===t_&&(t=this.compute()),e_&&this.manager.element.style&&Ds[t]&&(this.manager.element.style[Qw]=t),this.actions=t.toLowerCase().trim()},r.update=function(){this.set(this.manager.options.touchAction)},r.compute=function(){var t=[];return Pr(this.manager.recognizers,function(n){kl(n.options.enable,[n])&&(t=t.concat(n.getTouchAction()))}),CL(t.join(" "))},r.preventDefaults=function(t){var n=t.srcEvent,a=t.offsetDirection;if(this.manager.session.prevented){n.preventDefault();return}var o=this.actions,s=Ci(o,Mi)&&!Ds[Mi],u=Ci(o,co)&&!Ds[co],l=Ci(o,ho)&&!Ds[ho];if(s){var h=t.pointers.length===1,c=t.distance<2,d=t.deltaTime<250;if(h&&c&&d)return}if(!(l&&u)&&(s||u&&a&yr||l&&a&Bi))return this.preventSrc(n)},r.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},i}();function dv(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}function s_(i){var r=i.length;if(r===1)return{x:Nn(i[0].clientX),y:Nn(i[0].clientY)};for(var e=0,t=0,n=0;n=Ki(r)?i<0?jo:Lo:r<0?zo:Zn}function AL(i,r){var e=r.center,t=i.offsetDelta||{},n=i.prevDelta||{},a=i.prevInput||{};(r.eventType===gt||a.eventType===je)&&(n=i.prevDelta={x:a.deltaX||0,y:a.deltaY||0},t=i.offsetDelta={x:e.x,y:e.y}),r.deltaX=n.x+(e.x-t.x),r.deltaY=n.y+(e.y-t.y)}function l_(i,r,e){return{x:r/i||0,y:e/i||0}}function DL(i,r){return Ru(r[0],r[1],Du)/Ru(i[0],i[1],Du)}function RL(i,r){return zd(r[1],r[0],Du)+zd(i[1],i[0],Du)}function NL(i,r){var e=i.lastInterval||r,t=r.timeStamp-e.timeStamp,n,a,o,s;if(r.eventType!==It&&(t>xL||e.velocity===void 0)){var u=r.deltaX-e.deltaX,l=r.deltaY-e.deltaY,h=l_(t,u,l);a=h.x,o=h.y,n=Ki(h.x)>Ki(h.y)?h.x:h.y,s=u_(u,l),i.lastInterval=r}else n=e.velocity,a=e.velocityX,o=e.velocityY,s=e.direction;r.velocity=n,r.velocityX=a,r.velocityY=o,r.direction=s}function ML(i,r){var e=i.session,t=r.pointers,n=t.length;e.firstInput||(e.firstInput=fy(r)),n>1&&!e.firstMultiple?e.firstMultiple=fy(r):n===1&&(e.firstMultiple=!1);var a=e.firstInput,o=e.firstMultiple,s=o?o.center:a.center,u=r.center=s_(t);r.timeStamp=hv(),r.deltaTime=r.timeStamp-a.timeStamp,r.angle=zd(s,u),r.distance=Ru(s,u),AL(e,r),r.offsetDirection=u_(r.deltaX,r.deltaY);var l=l_(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=l.x,r.overallVelocityY=l.y,r.overallVelocity=Ki(l.x)>Ki(l.y)?l.x:l.y,r.scale=o?DL(o.pointers,t):1,r.rotation=o?RL(o.pointers,t):0,r.maxPointers=e.prevInput?r.pointers.length>e.prevInput.maxPointers?r.pointers.length:e.prevInput.maxPointers:r.pointers.length,NL(e,r);var h=i.element,c=r.srcEvent,d;c.composedPath?d=c.composedPath()[0]:c.path?d=c.path[0]:d=c.target,dv(d,h)&&(h=d),r.target=h}function BL(i,r,e){var t=e.pointers.length,n=e.changedPointers.length,a=r>&&t-n===0,o=r&(je|It)&&t-n===0;e.isFirst=!!a,e.isFinal=!!o,a&&(i.session={}),e.eventType=r,ML(i,e),i.emit("hammer.input",e),i.recognize(e),i.session.prevInput=e}function fo(i){return i.trim().split(/\s+/g)}function Xa(i,r,e){Pr(fo(r),function(t){i.addEventListener(t,e,!1)})}function Ja(i,r,e){Pr(fo(r),function(t){i.removeEventListener(t,e,!1)})}function vy(i){var r=i.ownerDocument||i;return r.defaultView||r.parentWindow||window}var wa=function(){function i(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(a){kl(e.options.enable,[e])&&n.handler(a)},this.init()}var r=i.prototype;return r.handler=function(){},r.init=function(){this.evEl&&Xa(this.element,this.evEl,this.domHandler),this.evTarget&&Xa(this.target,this.evTarget,this.domHandler),this.evWin&&Xa(vy(this.element),this.evWin,this.domHandler)},r.destroy=function(){this.evEl&&Ja(this.element,this.evEl,this.domHandler),this.evTarget&&Ja(this.target,this.evTarget,this.domHandler),this.evWin&&Ja(vy(this.element),this.evWin,this.domHandler)},i}();function Gi(i,r,e){if(i.indexOf&&!e)return i.indexOf(r);for(var t=0;tu[r]}):t=t.sort()),t}var LL={touchstart:gt,touchmove:an,touchend:je,touchcancel:It},zL="touchstart touchmove touchend touchcancel",vv=function(i){Xt(r,i);function r(){var t;return r.prototype.evTarget=zL,t=i.apply(this,arguments)||this,t.targetIds={},t}var e=r.prototype;return e.handler=function(n){var a=LL[n.type],o=HL.call(this,n,a);o&&this.callback(this.manager,a,{pointers:o[0],changedPointers:o[1],pointerType:Fo,srcEvent:n})},r}(wa);function HL(i,r){var e=vo(i.touches),t=this.targetIds;if(r&(gt|an)&&e.length===1)return t[e[0].identifier]=!0,[e,e];var n,a,o=vo(i.changedTouches),s=[],u=this.target;if(a=e.filter(function(l){return dv(l.target,u)}),r===gt)for(n=0;n-1&&n.splice(s,1)};setTimeout(a,KL)}}function GL(i,r){i>?(this.primaryTouch=r.changedPointers[0].identifier,gy.call(this,r)):i&(je|It)&&gy.call(this,r)}function qL(i){for(var r=i.srcEvent.clientX,e=i.srcEvent.clientY,t=0;t-1&&this.requireFail.splice(n,1),this},r.hasRequireFailures=function(){return this.requireFail.length>0},r.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},r.emit=function(t){var n=this,a=this.state;function o(s){n.manager.emit(s,t)}a=ui&&o(n.options.event+yy(a))},r.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=vr},r.canEmit=function(){for(var t=0;ta.threshold&&u&a.direction},e.attrTest=function(n){return ea.prototype.attrTest.call(this,n)&&(this.state&qt||!(this.state&qt)&&this.directionTest(n))},e.emit=function(n){this.pX=n.deltaX,this.pY=n.deltaY;var a=v_(n.direction);a&&(n.additionalEvent=this.options.event+a),i.prototype.emit.call(this,n)},r}(ea),p_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"swipe",threshold:10,velocity:.3,direction:yr|Bi,pointers:1},t))||this}var e=r.prototype;return e.getTouchAction=function(){return gv.prototype.getTouchAction.call(this)},e.attrTest=function(n){var a=this.options.direction,o;return a&(yr|Bi)?o=n.overallVelocity:a&yr?o=n.overallVelocityX:a&Bi&&(o=n.overallVelocityY),i.prototype.attrTest.call(this,n)&&a&n.offsetDirection&&n.distance>this.options.threshold&&n.maxPointers===this.options.pointers&&Ki(o)>this.options.velocity&&n.eventType&je},e.emit=function(n){var a=v_(n.offsetDirection);a&&this.manager.emit(this.options.event+a,n),this.manager.emit(this.options.event,n)},r}(ea),g_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"pinch",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Mi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.scale-1)>this.options.threshold||this.state&qt)},e.emit=function(n){if(n.scale!==1){var a=n.scale<1?"in":"out";n.additionalEvent=this.options.event+a}i.prototype.emit.call(this,n)},r}(ea),y_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"rotate",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Mi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.rotation)>this.options.threshold||this.state&qt)},r}(ea),m_=function(i){Xt(r,i);function r(t){var n;return t===void 0&&(t={}),n=i.call(this,sr({event:"press",pointers:1,time:251,threshold:9},t))||this,n._timer=null,n._input=null,n}var e=r.prototype;return e.getTouchAction=function(){return[r_]},e.process=function(n){var a=this,o=this.options,s=n.pointers.length===o.pointers,u=n.distanceo.time;if(this._input=n,!u||!s||n.eventType&(je|It)&&!l)this.reset();else if(n.eventType>)this.reset(),this._timer=setTimeout(function(){a.state=xr,a.tryEmit()},o.time);else if(n.eventType&je)return xr;return vr},e.reset=function(){clearTimeout(this._timer)},e.emit=function(n){this.state===xr&&(n&&n.eventType&je?this.manager.emit(this.options.event+"up",n):(this._input.timeStamp=hv(),this.manager.emit(this.options.event,this._input)))},r}(Ho),b_={domEvents:!1,touchAction:t_,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},my=[[y_,{enable:!1}],[g_,{enable:!1},["rotate"]],[p_,{direction:yr}],[gv,{direction:yr},["swipe"]],[Hd],[Hd,{event:"doubletap",taps:2},["tap"]],[m_]],ZL=1,by=2;function $y(i,r){var e=i.element;if(e.style){var t;Pr(i.options.cssProps,function(n,a){t=Il(e.style,a),r?(i.oldCssProps[t]=e.style[t],e.style[t]=n):e.style[t]=i.oldCssProps[t]||""}),r||(i.oldCssProps={})}}function QL(i,r){var e=document.createEvent("Event");e.initEvent(i,!0,!0),e.gesture=r,r.target.dispatchEvent(e)}var wy=function(){function i(e,t){var n=this;this.options=Ui({},b_,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=YL(this),this.touchAction=new o_(this,this.options.touchAction),$y(this,!0),Pr(this.options.recognizers,function(a){var o=n.add(new a[0](a[1]));a[2]&&o.recognizeWith(a[2]),a[3]&&o.requireFailure(a[3])},this)}var r=i.prototype;return r.set=function(t){return Ui(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},r.stop=function(t){this.session.stopped=t?by:ZL},r.recognize=function(t){var n=this.session;if(!n.stopped){this.touchAction.preventDefaults(t);var a,o=this.recognizers,s=n.curRecognizer;(!s||s&&s.state&xr)&&(n.curRecognizer=null,s=null);for(var u=0;u"u"?{style:{}}:document.createElement("div"),SL="function",Nn=Math.round,Ki=Math.abs,hv=Date.now;function Il(i,r){for(var e,t,n=r[0].toUpperCase()+r.slice(1),a=0;a"u"?kr={}:kr=window;var Qw=Il(EL.style,"touchAction"),e_=Qw!==void 0;function OL(){if(!e_)return!1;var i={},r=kr.CSS&&kr.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){return i[e]=r?kr.CSS.supports("touch-action",e):!0}),i}var t_="compute",r_="auto",Ld="manipulation",Mi="none",ho="pan-x",co="pan-y",Ds=OL(),TL=/mobile|tablet|ip(ad|hone|od)|android/i,i_="ontouchstart"in kr,IL=Il(kr,"PointerEvent")!==void 0,kL=i_&&TL.test(navigator.userAgent),Fo="touch",PL="pen",cv="mouse",xL="kinect",CL=25,gt=1,an=2,je=4,It=8,Au=1,jo=2,Lo=4,zo=8,Zn=16,yr=jo|Lo,Bi=zo|Zn,n_=yr|Bi,a_=["x","y"],Du=["clientX","clientY"];function Pr(i,r,e){var t;if(i)if(i.forEach)i.forEach(r,e);else if(i.length!==void 0)for(t=0;t-1}function AL(i){if(Ci(i,Mi))return Mi;var r=Ci(i,ho),e=Ci(i,co);return r&&e?Mi:r||e?r?ho:co:Ci(i,Ld)?Ld:r_}var o_=function(){function i(e,t){this.manager=e,this.set(t)}var r=i.prototype;return r.set=function(t){t===t_&&(t=this.compute()),e_&&this.manager.element.style&&Ds[t]&&(this.manager.element.style[Qw]=t),this.actions=t.toLowerCase().trim()},r.update=function(){this.set(this.manager.options.touchAction)},r.compute=function(){var t=[];return Pr(this.manager.recognizers,function(n){kl(n.options.enable,[n])&&(t=t.concat(n.getTouchAction()))}),AL(t.join(" "))},r.preventDefaults=function(t){var n=t.srcEvent,a=t.offsetDirection;if(this.manager.session.prevented){n.preventDefault();return}var o=this.actions,s=Ci(o,Mi)&&!Ds[Mi],u=Ci(o,co)&&!Ds[co],l=Ci(o,ho)&&!Ds[ho];if(s){var h=t.pointers.length===1,c=t.distance<2,d=t.deltaTime<250;if(h&&c&&d)return}if(!(l&&u)&&(s||u&&a&yr||l&&a&Bi))return this.preventSrc(n)},r.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},i}();function dv(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}function s_(i){var r=i.length;if(r===1)return{x:Nn(i[0].clientX),y:Nn(i[0].clientY)};for(var e=0,t=0,n=0;n=Ki(r)?i<0?jo:Lo:r<0?zo:Zn}function DL(i,r){var e=r.center,t=i.offsetDelta||{},n=i.prevDelta||{},a=i.prevInput||{};(r.eventType===gt||a.eventType===je)&&(n=i.prevDelta={x:a.deltaX||0,y:a.deltaY||0},t=i.offsetDelta={x:e.x,y:e.y}),r.deltaX=n.x+(e.x-t.x),r.deltaY=n.y+(e.y-t.y)}function l_(i,r,e){return{x:r/i||0,y:e/i||0}}function RL(i,r){return Ru(r[0],r[1],Du)/Ru(i[0],i[1],Du)}function NL(i,r){return zd(r[1],r[0],Du)+zd(i[1],i[0],Du)}function ML(i,r){var e=i.lastInterval||r,t=r.timeStamp-e.timeStamp,n,a,o,s;if(r.eventType!==It&&(t>CL||e.velocity===void 0)){var u=r.deltaX-e.deltaX,l=r.deltaY-e.deltaY,h=l_(t,u,l);a=h.x,o=h.y,n=Ki(h.x)>Ki(h.y)?h.x:h.y,s=u_(u,l),i.lastInterval=r}else n=e.velocity,a=e.velocityX,o=e.velocityY,s=e.direction;r.velocity=n,r.velocityX=a,r.velocityY=o,r.direction=s}function BL(i,r){var e=i.session,t=r.pointers,n=t.length;e.firstInput||(e.firstInput=fy(r)),n>1&&!e.firstMultiple?e.firstMultiple=fy(r):n===1&&(e.firstMultiple=!1);var a=e.firstInput,o=e.firstMultiple,s=o?o.center:a.center,u=r.center=s_(t);r.timeStamp=hv(),r.deltaTime=r.timeStamp-a.timeStamp,r.angle=zd(s,u),r.distance=Ru(s,u),DL(e,r),r.offsetDirection=u_(r.deltaX,r.deltaY);var l=l_(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=l.x,r.overallVelocityY=l.y,r.overallVelocity=Ki(l.x)>Ki(l.y)?l.x:l.y,r.scale=o?RL(o.pointers,t):1,r.rotation=o?NL(o.pointers,t):0,r.maxPointers=e.prevInput?r.pointers.length>e.prevInput.maxPointers?r.pointers.length:e.prevInput.maxPointers:r.pointers.length,ML(e,r);var h=i.element,c=r.srcEvent,d;c.composedPath?d=c.composedPath()[0]:c.path?d=c.path[0]:d=c.target,dv(d,h)&&(h=d),r.target=h}function FL(i,r,e){var t=e.pointers.length,n=e.changedPointers.length,a=r>&&t-n===0,o=r&(je|It)&&t-n===0;e.isFirst=!!a,e.isFinal=!!o,a&&(i.session={}),e.eventType=r,BL(i,e),i.emit("hammer.input",e),i.recognize(e),i.session.prevInput=e}function fo(i){return i.trim().split(/\s+/g)}function Xa(i,r,e){Pr(fo(r),function(t){i.addEventListener(t,e,!1)})}function Ja(i,r,e){Pr(fo(r),function(t){i.removeEventListener(t,e,!1)})}function vy(i){var r=i.ownerDocument||i;return r.defaultView||r.parentWindow||window}var wa=function(){function i(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(a){kl(e.options.enable,[e])&&n.handler(a)},this.init()}var r=i.prototype;return r.handler=function(){},r.init=function(){this.evEl&&Xa(this.element,this.evEl,this.domHandler),this.evTarget&&Xa(this.target,this.evTarget,this.domHandler),this.evWin&&Xa(vy(this.element),this.evWin,this.domHandler)},r.destroy=function(){this.evEl&&Ja(this.element,this.evEl,this.domHandler),this.evTarget&&Ja(this.target,this.evTarget,this.domHandler),this.evWin&&Ja(vy(this.element),this.evWin,this.domHandler)},i}();function Gi(i,r,e){if(i.indexOf&&!e)return i.indexOf(r);for(var t=0;tu[r]}):t=t.sort()),t}var zL={touchstart:gt,touchmove:an,touchend:je,touchcancel:It},HL="touchstart touchmove touchend touchcancel",vv=function(i){Xt(r,i);function r(){var t;return r.prototype.evTarget=HL,t=i.apply(this,arguments)||this,t.targetIds={},t}var e=r.prototype;return e.handler=function(n){var a=zL[n.type],o=VL.call(this,n,a);o&&this.callback(this.manager,a,{pointers:o[0],changedPointers:o[1],pointerType:Fo,srcEvent:n})},r}(wa);function VL(i,r){var e=vo(i.touches),t=this.targetIds;if(r&(gt|an)&&e.length===1)return t[e[0].identifier]=!0,[e,e];var n,a,o=vo(i.changedTouches),s=[],u=this.target;if(a=e.filter(function(l){return dv(l.target,u)}),r===gt)for(n=0;n-1&&n.splice(s,1)};setTimeout(a,GL)}}function qL(i,r){i>?(this.primaryTouch=r.changedPointers[0].identifier,gy.call(this,r)):i&(je|It)&&gy.call(this,r)}function YL(i){for(var r=i.srcEvent.clientX,e=i.srcEvent.clientY,t=0;t-1&&this.requireFail.splice(n,1),this},r.hasRequireFailures=function(){return this.requireFail.length>0},r.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},r.emit=function(t){var n=this,a=this.state;function o(s){n.manager.emit(s,t)}a=ui&&o(n.options.event+yy(a))},r.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=vr},r.canEmit=function(){for(var t=0;ta.threshold&&u&a.direction},e.attrTest=function(n){return ea.prototype.attrTest.call(this,n)&&(this.state&qt||!(this.state&qt)&&this.directionTest(n))},e.emit=function(n){this.pX=n.deltaX,this.pY=n.deltaY;var a=v_(n.direction);a&&(n.additionalEvent=this.options.event+a),i.prototype.emit.call(this,n)},r}(ea),p_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"swipe",threshold:10,velocity:.3,direction:yr|Bi,pointers:1},t))||this}var e=r.prototype;return e.getTouchAction=function(){return gv.prototype.getTouchAction.call(this)},e.attrTest=function(n){var a=this.options.direction,o;return a&(yr|Bi)?o=n.overallVelocity:a&yr?o=n.overallVelocityX:a&Bi&&(o=n.overallVelocityY),i.prototype.attrTest.call(this,n)&&a&n.offsetDirection&&n.distance>this.options.threshold&&n.maxPointers===this.options.pointers&&Ki(o)>this.options.velocity&&n.eventType&je},e.emit=function(n){var a=v_(n.offsetDirection);a&&this.manager.emit(this.options.event+a,n),this.manager.emit(this.options.event,n)},r}(ea),g_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"pinch",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Mi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.scale-1)>this.options.threshold||this.state&qt)},e.emit=function(n){if(n.scale!==1){var a=n.scale<1?"in":"out";n.additionalEvent=this.options.event+a}i.prototype.emit.call(this,n)},r}(ea),y_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"rotate",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Mi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.rotation)>this.options.threshold||this.state&qt)},r}(ea),m_=function(i){Xt(r,i);function r(t){var n;return t===void 0&&(t={}),n=i.call(this,sr({event:"press",pointers:1,time:251,threshold:9},t))||this,n._timer=null,n._input=null,n}var e=r.prototype;return e.getTouchAction=function(){return[r_]},e.process=function(n){var a=this,o=this.options,s=n.pointers.length===o.pointers,u=n.distanceo.time;if(this._input=n,!u||!s||n.eventType&(je|It)&&!l)this.reset();else if(n.eventType>)this.reset(),this._timer=setTimeout(function(){a.state=xr,a.tryEmit()},o.time);else if(n.eventType&je)return xr;return vr},e.reset=function(){clearTimeout(this._timer)},e.emit=function(n){this.state===xr&&(n&&n.eventType&je?this.manager.emit(this.options.event+"up",n):(this._input.timeStamp=hv(),this.manager.emit(this.options.event,this._input)))},r}(Ho),b_={domEvents:!1,touchAction:t_,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},my=[[y_,{enable:!1}],[g_,{enable:!1},["rotate"]],[p_,{direction:yr}],[gv,{direction:yr},["swipe"]],[Hd],[Hd,{event:"doubletap",taps:2},["tap"]],[m_]],QL=1,by=2;function $y(i,r){var e=i.element;if(e.style){var t;Pr(i.options.cssProps,function(n,a){t=Il(e.style,a),r?(i.oldCssProps[t]=e.style[t],e.style[t]=n):e.style[t]=i.oldCssProps[t]||""}),r||(i.oldCssProps={})}}function e5(i,r){var e=document.createEvent("Event");e.initEvent(i,!0,!0),e.gesture=r,r.target.dispatchEvent(e)}var wy=function(){function i(e,t){var n=this;this.options=Ui({},b_,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=XL(this),this.touchAction=new o_(this,this.options.touchAction),$y(this,!0),Pr(this.options.recognizers,function(a){var o=n.add(new a[0](a[1]));a[2]&&o.recognizeWith(a[2]),a[3]&&o.requireFailure(a[3])},this)}var r=i.prototype;return r.set=function(t){return Ui(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},r.stop=function(t){this.session.stopped=t?by:QL},r.recognize=function(t){var n=this.session;if(!n.stopped){this.touchAction.preventDefaults(t);var a,o=this.recognizers,s=n.curRecognizer;(!s||s&&s.state&xr)&&(n.curRecognizer=null,s=null);for(var u=0;u\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=window.console&&(window.console.warn||window.console.log);return o&&o.call(window.console,t,a),i.apply(this,arguments)}}var w_=$_(function(i,r,e){for(var t=Object.keys(r),n=0;n=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function l5(i,r){var e;if(i){if(typeof i=="string")return Ey(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ey(i,r)}}function Ey(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?e-1:0),n=1;n2){var t;return Nu.apply(void 0,Ol(t=[S_(r[0],r[1])]).call(t,St(Tl(r).call(r,2))))}var n=r[0],a=r[1];if(n instanceof Date&&a instanceof Date)return n.setTime(a.getTime()),n;var o=__(hj(a)),s;try{for(o.s();!(s=o.n()).done;){var u=s.value;Object.prototype.propertyIsEnumerable.call(a,u)&&(a[u]===E_?delete n[u]:n[u]!==null&&a[u]!==null&&typeof n[u]=="object"&&typeof a[u]=="object"&&!Bt(n[u])&&!Bt(a[u])?n[u]=Nu(n[u],a[u]):n[u]=O_(a[u]))}}catch(l){o.e(l)}finally{o.f()}return n}function O_(i){return Bt(i)?rr(i).call(i,function(r){return O_(r)}):typeof i=="object"&&i!==null?i instanceof Date?new Date(i.getTime()):Nu({},i):i}function T_(i){for(var r=0,e=lv(i);ro;)u=t(e,s=n[o++]),u!==void 0&&Y5(a,s,u);return a}});var X5=we,J5=X5.Object.getOwnPropertyDescriptors,Z5=J5,Q5=Z5,ez=Q5,ky=Y(ez),M_={exports:{}},tz=K,rz=qe,Py=cl.f;tz({target:"Object",stat:!0,forced:Object.defineProperties!==Py,sham:!rz},{defineProperties:Py});var iz=we,B_=iz.Object,nz=M_.exports=function(r,e){return B_.defineProperties(r,e)};B_.defineProperties.sham&&(nz.sham=!0);var az=M_.exports,oz=az,sz=oz,uz=sz,lz=Y(uz),hz=p0,cz=Y(hz);function F_(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}var dz=Kw,fz=dz,vz=fz,pz=vz,j_=pz,gz=Y(j_),yz=K,mz=aw;yz({target:"Object",stat:!0},{setPrototypeOf:mz});var bz=we,$z=bz.Object.setPrototypeOf,wz=$z,_z=wz,Ez=_z,Sz=Ez,Oz=Sz,Tz=Oz,L_=Tz,Vd=Y(L_),Iz=ww,kz=Iz,Pz=kz,xz=Pz,Cz=xz,z_=Y(Cz);function Wd(i,r){var e;return Wd=Vd?z_(e=Vd).call(e):function(n,a){return n.__proto__=a,n},Wd(i,r)}function Az(i,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=gz(r.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),ol(i,"prototype",{writable:!1}),Wd(i,r)}function Dz(i,r){if(r&&(Jn(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F_(i)}var Rz=L3,Nz=Rz,Mz=Nz,Bz=Mz,H_=Bz,xy=Y(H_);function Mu(i){var r;return Mu=Vd?z_(r=xy).call(r):function(t){return t.__proto__||xy(t)},Mu(i)}var V_={exports:{}},W_={exports:{}};(function(i){var r=iv,e=gw;function t(n){"@babel/helpers - typeof";return i.exports=t=typeof r=="function"&&typeof e=="symbol"?function(a){return typeof a}:function(a){return a&&typeof r=="function"&&a.constructor===r&&a!==r.prototype?"symbol":typeof a},i.exports.__esModule=!0,i.exports.default=i.exports,t(n)}i.exports=t,i.exports.__esModule=!0,i.exports.default=i.exports})(W_);var Fz=W_.exports,jz=zw,Lz=jz,zz=Lz,Hz=zz,Vz=Hz,Cy=Ve,Wz=uv,Uz=Qi,Kz=Ct,Gz=function(i,r,e){for(var t=Wz(r),n=Kz.f,a=Uz.f,o=0;oc;c++)if(f=y(i[c]),f&&Dy(Ny,f))return f;return new fu(!1)}l=p4(i,h)}for(v=a?i.next:l.next;!(p=h4(v,l)).done;){try{f=y(p.value)}catch(m){Ry(l,"throw",m)}if(typeof f=="object"&&f&&Dy(Ny,f))return f}return new fu(!1)},m4=tn,b4=function(i,r){return i===void 0?arguments.length<2?"":r:m4(i)},$4=K,w4=He,_4=$l,Bu=aw,E4=Gz,G_=rn,qh=Lr,Yh=en,S4=Xz,O4=u4,T4=on,I4=b4,k4=Ee,P4=k4("toStringTag"),Fu=Error,x4=[].push,ta=function(r,e){var t=w4(Xh,this),n;Bu?n=Bu(new Fu,t?_4(this):Xh):(n=t?this:G_(Xh),qh(n,P4,"Error")),e!==void 0&&qh(n,"message",I4(e)),O4(n,ta,n.stack,1),arguments.length>2&&S4(n,arguments[2]);var a=[];return T4(r,x4,{that:a}),qh(n,"errors",a),n};Bu?Bu(ta,Fu):E4(ta,Fu,{name:!0});var Xh=ta.prototype=G_(Fu.prototype,{constructor:Yh(1,ta),message:Yh(1,""),name:Yh(1,"AggregateError")});$4({global:!0,constructor:!0,arity:2},{AggregateError:ta});var C4=mt,A4=qf,D4=Ee,R4=qe,My=D4("species"),q_=function(i){var r=C4(i);R4&&r&&!r[My]&&A4(r,My,{configurable:!0,get:function(){return this}})},N4=He,M4=TypeError,mv=function(i,r){if(N4(r,i))return i;throw new M4("Incorrect invocation")},By=jt,B4=I_,F4=ca,j4=Ee,L4=j4("species"),Y_=function(i,r){var e=By(i).constructor,t;return e===void 0||F4(t=By(e)[L4])?r:B4(t)},z4=mi,X_=/(?:ipad|iphone|ipod).*applewebkit/i.test(z4),Ft=$e,H4=ha,V4=bi,Fy=Ie,W4=Ve,J_=le,jy=O0,U4=No,Ly=Vf,K4=Gw,G4=X_,q4=Bo,Ud=Ft.setImmediate,Kd=Ft.clearImmediate,Y4=Ft.process,Jh=Ft.Dispatch,X4=Ft.Function,zy=Ft.MessageChannel,J4=Ft.String,Zh=0,Za={},Hy="onreadystatechange",go,ki,Qh,ec;J_(function(){go=Ft.location});var bv=function(i){if(W4(Za,i)){var r=Za[i];delete Za[i],r()}},tc=function(i){return function(){bv(i)}},Vy=function(i){bv(i.data)},Wy=function(i){Ft.postMessage(J4(i),go.protocol+"//"+go.host)};(!Ud||!Kd)&&(Ud=function(r){K4(arguments.length,1);var e=Fy(r)?r:X4(r),t=U4(arguments,1);return Za[++Zh]=function(){H4(e,void 0,t)},ki(Zh),Zh},Kd=function(r){delete Za[r]},q4?ki=function(i){Y4.nextTick(tc(i))}:Jh&&Jh.now?ki=function(i){Jh.now(tc(i))}:zy&&!G4?(Qh=new zy,ec=Qh.port2,Qh.port1.onmessage=Vy,ki=V4(ec.postMessage,ec)):Ft.addEventListener&&Fy(Ft.postMessage)&&!Ft.importScripts&&go&&go.protocol!=="file:"&&!J_(Wy)?(ki=Wy,Ft.addEventListener("message",Vy,!1)):Hy in Ly("script")?ki=function(i){jy.appendChild(Ly("script"))[Hy]=function(){jy.removeChild(this),bv(i)}}:ki=function(i){setTimeout(tc(i),0)});var Z_={set:Ud,clear:Kd},Q_=function(){this.head=null,this.tail=null};Q_.prototype={add:function(i){var r={item:i,next:null},e=this.tail;e?e.next=r:this.head=r,this.tail=r},get:function(){var i=this.head;if(i){var r=this.head=i.next;return r===null&&(this.tail=null),i.item}}};var eE=Q_,Z4=mi,Q4=/ipad|iphone|ipod/i.test(Z4)&&typeof Pebble<"u",e6=mi,t6=/web0s(?!.*chrome)/i.test(e6),qi=$e,Uy=bi,r6=Qi.f,rc=Z_.set,i6=eE,n6=X_,a6=Q4,o6=t6,ic=Bo,Ky=qi.MutationObserver||qi.WebKitMutationObserver,Gy=qi.document,qy=qi.process,Ns=qi.Promise,Yy=r6(qi,"queueMicrotask"),Gd=Yy&&Yy.value,_n,nc,ac,Ms,Xy;if(!Gd){var Bs=new i6,Fs=function(){var i,r;for(ic&&(i=qy.domain)&&i.exit();r=Bs.get();)try{r()}catch(e){throw Bs.head&&_n(),e}i&&i.enter()};!n6&&!ic&&!o6&&Ky&&Gy?(nc=!0,ac=Gy.createTextNode(""),new Ky(Fs).observe(ac,{characterData:!0}),_n=function(){ac.data=nc=!nc}):!a6&&Ns&&Ns.resolve?(Ms=Ns.resolve(void 0),Ms.constructor=Ns,Xy=Uy(Ms.then,Ms),_n=function(){Xy(Fs)}):ic?_n=function(){qy.nextTick(Fs)}:(rc=Uy(rc,qi),_n=function(){rc(Fs)}),Gd=function(i){Bs.head||_n(),Bs.add(i)}}var s6=Gd,u6=function(i,r){try{arguments.length===1?console.error(i):console.error(i,r)}catch{}},_a=function(i){try{return{error:!1,value:i()}}catch(r){return{error:!0,value:r}}},l6=$e,Ea=l6.Promise,tE=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",h6=tE,c6=Bo,d6=!h6&&!c6&&typeof window=="object"&&typeof document=="object",f6=$e,Qa=Ea,v6=Ie,p6=d0,g6=m0,y6=Ee,m6=d6,b6=tE,oc=da,Jy=Qa&&Qa.prototype,$6=y6("species"),qd=!1,rE=v6(f6.PromiseRejectionEvent),w6=p6("Promise",function(){var i=g6(Qa),r=i!==String(Qa);if(!r&&oc===66||!(Jy.catch&&Jy.finally))return!0;if(!oc||oc<51||!/native code/.test(i)){var e=new Qa(function(a){a(1)}),t=function(a){a(function(){},function(){})},n=e.constructor={};if(n[$6]=t,qd=e.then(function(){})instanceof t,!qd)return!0}return!r&&(m6||b6)&&!rE}),Vo={CONSTRUCTOR:w6,REJECTION_EVENT:rE,SUBCLASSING:qd},wr={},Zy=Pt,_6=TypeError,E6=function(i){var r,e;this.promise=new i(function(t,n){if(r!==void 0||e!==void 0)throw new _6("Bad Promise constructor");r=t,e=n}),this.resolve=Zy(r),this.reject=Zy(e)};wr.f=function(i){return new E6(i)};var S6=K,ju=Bo,fi=$e,Wo=Ye,O6=ya,T6=nn,I6=q_,k6=Pt,Yd=Ie,P6=nt,x6=mv,C6=Y_,iE=Z_.set,$v=s6,A6=u6,D6=_a,R6=eE,nE=ma,Xd=Ea,aE=Vo,oE=wr,Pl="Promise",sE=aE.CONSTRUCTOR,N6=aE.REJECTION_EVENT,sc=nE.getterFor(Pl),M6=nE.set,B6=Xd&&Xd.prototype,Bn=Xd,uc=B6,uE=fi.TypeError,Jd=fi.document,wv=fi.process,Zd=oE.f,F6=Zd,j6=!!(Jd&&Jd.createEvent&&fi.dispatchEvent),lE="unhandledrejection",L6="rejectionhandled",Qy=0,hE=1,z6=2,_v=1,cE=2,js,em,H6,dE=function(i){var r;return P6(i)&&Yd(r=i.then)?r:!1},fE=function(i,r){var e=r.value,t=r.state===hE,n=t?i.ok:i.fail,a=i.resolve,o=i.reject,s=i.domain,u,l,h;try{n?(t||(r.rejection===cE&&W6(r),r.rejection=_v),n===!0?u=e:(s&&s.enter(),u=n(e),s&&(s.exit(),h=!0)),u===i.promise?o(new uE("Promise-chain cycle")):(l=dE(u))?Wo(l,u,a,o):a(u)):o(e)}catch(c){s&&!h&&s.exit(),o(c)}},vE=function(i,r){i.notified||(i.notified=!0,$v(function(){for(var e=i.reactions,t;t=e.get();)fE(t,i);i.notified=!1,r&&!i.rejection&&V6(i)}))},pE=function(i,r,e){var t,n;j6?(t=Jd.createEvent("Event"),t.promise=r,t.reason=e,t.initEvent(i,!1,!0),fi.dispatchEvent(t)):t={promise:r,reason:e},!N6&&(n=fi["on"+i])?n(t):i===lE&&A6("Unhandled promise rejection",e)},V6=function(i){Wo(iE,fi,function(){var r=i.facade,e=i.value,t=tm(i),n;if(t&&(n=D6(function(){ju?wv.emit("unhandledRejection",e,r):pE(lE,r,e)}),i.rejection=ju||tm(i)?cE:_v,n.error))throw n.value})},tm=function(i){return i.rejection!==_v&&!i.parent},W6=function(i){Wo(iE,fi,function(){var r=i.facade;ju?wv.emit("rejectionHandled",r):pE(L6,r,i.value)})},Fn=function(i,r,e){return function(t){i(r,t,e)}},Un=function(i,r,e){i.done||(i.done=!0,e&&(i=e),i.value=r,i.state=z6,vE(i,!0))},Qd=function(i,r,e){if(!i.done){i.done=!0,e&&(i=e);try{if(i.facade===r)throw new uE("Promise can't be resolved itself");var t=dE(r);t?$v(function(){var n={done:!1};try{Wo(t,r,Fn(Qd,n,i),Fn(Un,n,i))}catch(a){Un(n,a,i)}}):(i.value=r,i.state=hE,vE(i,!1))}catch(n){Un({done:!1},n,i)}}};sE&&(Bn=function(r){x6(this,uc),k6(r),Wo(js,this);var e=sc(this);try{r(Fn(Qd,e),Fn(Un,e))}catch(t){Un(e,t)}},uc=Bn.prototype,js=function(r){M6(this,{type:Pl,done:!1,notified:!1,parent:!1,reactions:new R6,rejection:!1,state:Qy,value:void 0})},js.prototype=O6(uc,"then",function(r,e){var t=sc(this),n=Zd(C6(this,Bn));return t.parent=!0,n.ok=Yd(r)?r:!0,n.fail=Yd(e)&&e,n.domain=ju?wv.domain:void 0,t.state===Qy?t.reactions.add(n):$v(function(){fE(n,t)}),n.promise}),em=function(){var i=new js,r=sc(i);this.promise=i,this.resolve=Fn(Qd,r),this.reject=Fn(Un,r)},oE.f=Zd=function(i){return i===Bn||i===H6?new em(i):F6(i)});S6({global:!0,constructor:!0,wrap:!0,forced:sE},{Promise:Bn});T6(Bn,Pl,!1,!0);I6(Pl);var U6=Ea,K6=kw,G6=Vo.CONSTRUCTOR,xl=G6||!K6(function(i){U6.all(i).then(void 0,function(){})}),q6=K,Y6=Ye,X6=Pt,J6=wr,Z6=_a,Q6=on,eH=xl;q6({target:"Promise",stat:!0,forced:eH},{all:function(r){var e=this,t=J6.f(e),n=t.resolve,a=t.reject,o=Z6(function(){var s=X6(e.resolve),u=[],l=0,h=1;Q6(r,function(c){var d=l++,f=!1;h++,Y6(s,e,c).then(function(v){f||(f=!0,u[d]=v,--h||n(u))},a)}),--h||n(u)});return o.error&&a(o.value),t.promise}});var tH=K,rH=Vo.CONSTRUCTOR,rm=Ea;rm&&rm.prototype;tH({target:"Promise",proto:!0,forced:rH,real:!0},{catch:function(i){return this.then(void 0,i)}});var iH=K,nH=Ye,aH=Pt,oH=wr,sH=_a,uH=on,lH=xl;iH({target:"Promise",stat:!0,forced:lH},{race:function(r){var e=this,t=oH.f(e),n=t.reject,a=sH(function(){var o=aH(e.resolve);uH(r,function(s){nH(o,e,s).then(t.resolve,n)})});return a.error&&n(a.value),t.promise}});var hH=K,cH=Ye,dH=wr,fH=Vo.CONSTRUCTOR;hH({target:"Promise",stat:!0,forced:fH},{reject:function(r){var e=dH.f(this);return cH(e.reject,void 0,r),e.promise}});var vH=jt,pH=nt,gH=wr,gE=function(i,r){if(vH(i),pH(r)&&r.constructor===i)return r;var e=gH.f(i),t=e.resolve;return t(r),e.promise},yH=K,mH=mt,bH=kk,$H=Ea,wH=Vo.CONSTRUCTOR,_H=gE,EH=mH("Promise"),SH=!wH;yH({target:"Promise",stat:!0,forced:bH},{resolve:function(r){return _H(SH&&this===EH?$H:this,r)}});var OH=K,TH=Ye,IH=Pt,kH=wr,PH=_a,xH=on,CH=xl;OH({target:"Promise",stat:!0,forced:CH},{allSettled:function(r){var e=this,t=kH.f(e),n=t.resolve,a=t.reject,o=PH(function(){var s=IH(e.resolve),u=[],l=0,h=1;xH(r,function(c){var d=l++,f=!1;h++,TH(s,e,c).then(function(v){f||(f=!0,u[d]={status:"fulfilled",value:v},--h||n(u))},function(v){f||(f=!0,u[d]={status:"rejected",reason:v},--h||n(u))})}),--h||n(u)});return o.error&&a(o.value),t.promise}});var AH=K,DH=Ye,RH=Pt,NH=mt,MH=wr,BH=_a,FH=on,jH=xl,im="No one promise resolved";AH({target:"Promise",stat:!0,forced:jH},{any:function(r){var e=this,t=NH("AggregateError"),n=MH.f(e),a=n.resolve,o=n.reject,s=BH(function(){var u=RH(e.resolve),l=[],h=0,c=1,d=!1;FH(r,function(f){var v=h++,p=!1;c++,DH(u,e,f).then(function(g){p||d||(d=!0,a(g))},function(g){p||d||(p=!0,l[v]=g,--c||o(new t(l,im)))})}),--c||o(new t(l,im))});return s.error&&o(s.value),n.promise}});var LH=K,ef=Ea,zH=le,HH=mt,VH=Ie,WH=Y_,nm=gE,UH=ef&&ef.prototype,KH=!!ef&&zH(function(){UH.finally.call({then:function(){}},function(){})});LH({target:"Promise",proto:!0,real:!0,forced:KH},{finally:function(i){var r=WH(this,HH("Promise")),e=VH(i);return this.then(e?function(t){return nm(r,i()).then(function(){return t})}:i,e?function(t){return nm(r,i()).then(function(){throw t})}:i)}});var GH=we,qH=GH.Promise,YH=qH,XH=YH,JH=K,ZH=wr;JH({target:"Promise",stat:!0},{withResolvers:function(){var r=ZH.f(this);return{promise:r.promise,resolve:r.resolve,reject:r.reject}}});var QH=XH,e8=QH,t8=K,r8=wr,i8=_a;t8({target:"Promise",stat:!0,forced:!0},{try:function(i){var r=r8.f(this),e=i8(i);return(e.error?r.reject:r.resolve)(e.value),r.promise}});var n8=e8,a8=n8,o8=a8,s8=Hw,u8=s8,l8=u8,h8=l8,c8=h8;(function(i){var r=Fz.default,e=g0,t=iv,n=j_,a=H_,o=Vz,s=Nw,u=L_,l=o8,h=c8,c=Bw;function d(){i.exports=d=function(){return v},i.exports.__esModule=!0,i.exports.default=i.exports;var f,v={},p=Object.prototype,g=p.hasOwnProperty,y=e||function(F,x,C){F[x]=C.value},m=typeof t=="function"?t:{},$=m.iterator||"@@iterator",b=m.asyncIterator||"@@asyncIterator",O=m.toStringTag||"@@toStringTag";function _(F,x,C){return e(F,x,{value:C,enumerable:!0,configurable:!0,writable:!0}),F[x]}try{_({},"")}catch{_=function(C,W,Z){return C[W]=Z}}function D(F,x,C,W){var Z=x&&x.prototype instanceof ie?x:ie,X=n(Z.prototype),Re=new Rt(W||[]);return y(X,"_invoke",{value:Fe(F,C,Re)}),X}function R(F,x,C){try{return{type:"normal",arg:F.call(x,C)}}catch(W){return{type:"throw",arg:W}}}v.wrap=D;var P="suspendedStart",B="suspendedYield",j="executing",J="completed",U={};function ie(){}function _e(){}function ye(){}var Ae={};_(Ae,$,function(){return this});var ht=a,at=ht&&ht(ht(ut([])));at&&at!==p&&g.call(at,$)&&(Ae=at);var Dt=ye.prototype=ie.prototype=n(Ae);function ot(F){var x;o(x=["next","throw","return"]).call(x,function(C){_(F,C,function(W){return this._invoke(C,W)})})}function me(F,x){function C(Z,X,Re,ct){var bt=R(F[Z],F,X);if(bt.type!=="throw"){var Oi=bt.arg,Vr=Oi.value;return Vr&&r(Vr)=="object"&&g.call(Vr,"__await")?x.resolve(Vr.__await).then(function(Ti){C("next",Ti,Re,ct)},function(Ti){C("throw",Ti,Re,ct)}):x.resolve(Vr).then(function(Ti){Oi.value=Ti,Re(Oi)},function(Ti){return C("throw",Ti,Re,ct)})}ct(bt.arg)}var W;y(this,"_invoke",{value:function(X,Re){function ct(){return new x(function(bt,Oi){C(X,Re,bt,Oi)})}return W=W?W.then(ct,ct):ct()}})}function Fe(F,x,C){var W=P;return function(Z,X){if(W===j)throw new Error("Generator is already running");if(W===J){if(Z==="throw")throw X;return{value:f,done:!0}}for(C.method=Z,C.arg=X;;){var Re=C.delegate;if(Re){var ct=De(Re,C);if(ct){if(ct===U)continue;return ct}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(W===P)throw W=J,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);W=j;var bt=R(F,x,C);if(bt.type==="normal"){if(W=C.done?J:B,bt.arg===U)continue;return{value:bt.arg,done:C.done}}bt.type==="throw"&&(W=J,C.method="throw",C.arg=bt.arg)}}}function De(F,x){var C=x.method,W=F.iterator[C];if(W===f)return x.delegate=null,C==="throw"&&F.iterator.return&&(x.method="return",x.arg=f,De(F,x),x.method==="throw")||C!=="return"&&(x.method="throw",x.arg=new TypeError("The iterator does not provide a '"+C+"' method")),U;var Z=R(W,F.iterator,x.arg);if(Z.type==="throw")return x.method="throw",x.arg=Z.arg,x.delegate=null,U;var X=Z.arg;return X?X.done?(x[F.resultName]=X.value,x.next=F.nextLoc,x.method!=="return"&&(x.method="next",x.arg=f),x.delegate=null,U):X:(x.method="throw",x.arg=new TypeError("iterator result is not an object"),x.delegate=null,U)}function st(F){var x,C={tryLoc:F[0]};1 in F&&(C.catchLoc=F[1]),2 in F&&(C.finallyLoc=F[2],C.afterLoc=F[3]),s(x=this.tryEntries).call(x,C)}function Sr(F){var x=F.completion||{};x.type="normal",delete x.arg,F.completion=x}function Rt(F){this.tryEntries=[{tryLoc:"root"}],o(F).call(F,st,this),this.reset(!0)}function ut(F){if(F||F===""){var x=F[$];if(x)return x.call(F);if(typeof F.next=="function")return F;if(!isNaN(F.length)){var C=-1,W=function Z(){for(;++C=0;--Z){var X=this.tryEntries[Z],Re=X.completion;if(X.tryLoc==="root")return W("end");if(X.tryLoc<=this.prev){var ct=g.call(X,"catchLoc"),bt=g.call(X,"finallyLoc");if(ct&&bt){if(this.prev=0;--W){var Z=this.tryEntries[W];if(Z.tryLoc<=this.prev&&g.call(Z,"finallyLoc")&&this.prev=0;--C){var W=this.tryEntries[C];if(W.finallyLoc===x)return this.complete(W.completion,W.afterLoc),Sr(W),U}},catch:function(x){for(var C=this.tryEntries.length-1;C>=0;--C){var W=this.tryEntries[C];if(W.tryLoc===x){var Z=W.completion;if(Z.type==="throw"){var X=Z.arg;Sr(W)}return X}}throw new Error("illegal catch attempt")},delegateYield:function(x,C,W){return this.delegate={iterator:ut(x),resultName:C,nextLoc:W},this.method==="next"&&(this.arg=f),U}},v}i.exports=d,i.exports.__esModule=!0,i.exports.default=i.exports})(V_);var d8=V_.exports,vu=d8(),f8=vu;try{regeneratorRuntime=vu}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=vu:Function("r","regeneratorRuntime = r")(vu)}var wt=Y(f8),yE={exports:{}},v8=le,p8=v8(function(){if(typeof ArrayBuffer=="function"){var i=new ArrayBuffer(8);Object.isExtensible(i)&&Object.defineProperty(i,"a",{value:8})}}),g8=le,y8=nt,m8=yi,am=p8,pu=Object.isExtensible,b8=g8(function(){pu(1)}),$8=b8||am?function(r){return!y8(r)||am&&m8(r)==="ArrayBuffer"?!1:pu?pu(r):!0}:pu,w8=le,_8=!w8(function(){return Object.isExtensible(Object.preventExtensions({}))}),E8=K,S8=be,O8=Po,T8=nt,Ev=Ve,I8=Ct.f,om=xo,k8=Gf,Sv=$8,P8=nl,x8=_8,mE=!1,Br=P8("meta"),C8=0,Ov=function(i){I8(i,Br,{value:{objectID:"O"+C8++,weakData:{}}})},A8=function(i,r){if(!T8(i))return typeof i=="symbol"?i:(typeof i=="string"?"S":"P")+i;if(!Ev(i,Br)){if(!Sv(i))return"F";if(!r)return"E";Ov(i)}return i[Br].objectID},D8=function(i,r){if(!Ev(i,Br)){if(!Sv(i))return!0;if(!r)return!1;Ov(i)}return i[Br].weakData},R8=function(i){return x8&&mE&&Sv(i)&&!Ev(i,Br)&&Ov(i),i},N8=function(){M8.enable=function(){},mE=!0;var i=om.f,r=S8([].splice),e={};e[Br]=1,i(e).length&&(om.f=function(t){for(var n=i(t),a=0,o=n.length;a1?arguments[1]:void 0),f;f=f?f.next:c.first;)for(d(f.value,f.key,this);f&&f.removed;)f=f.previous},has:function(h){return!!u(this,h)}}),sm(a,e?{get:function(h){var c=u(this,h);return c&&c.value},set:function(h,c){return s(this,h===0?0:h,c)}}:{add:function(h){return s(this,h=h===0?0:h,h)}}),ja&&r7(a,"size",{configurable:!0,get:function(){return o(this).size}}),n},setStrong:function(i,r,e){var t=r+" Iterator",n=lc(r),a=lc(t);s7(i,r,function(o,s){lm(this,{type:t,target:o,state:n(o),kind:s,last:void 0})},function(){for(var o=a(this),s=o.kind,u=o.last;u&&u.removed;)u=u.previous;return!o.target||!(o.last=u=u?u.next:o.state.first)?(o.target=void 0,Ls(void 0,!0)):Ls(s==="keys"?u.key:s==="values"?u.value:[u.key,u.value],!1)},e?"entries":"values",!e,!0),u7(r)}},l7=wE,h7=EE;l7("Map",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},h7);var c7=we,d7=c7.Map,f7=d7,v7=f7,p7=v7,SE=Y(p7),g7=K,y7=ba.some,m7=_l,b7=m7("some");g7({target:"Array",proto:!0,forced:!b7},{some:function(r){return y7(this,r,arguments.length>1?arguments[1]:void 0)}});var $7=lt,w7=$7("Array","some"),_7=He,E7=w7,hc=Array.prototype,S7=function(i){var r=i.some;return i===hc||_7(hc,i)&&r===hc.some?E7:r},O7=S7,T7=O7,I7=T7,k7=Y(I7),P7=lt,x7=P7("Array","keys"),C7=x7,A7=C7,D7=zr,R7=Ve,N7=He,M7=A7,cc=Array.prototype,B7={DOMTokenList:!0,NodeList:!0},F7=function(i){var r=i.keys;return i===cc||N7(cc,i)&&r===cc.keys||R7(B7,D7(i))?M7:r},j7=F7,En=Y(j7),hm=k0,L7=Math.floor,tf=function(i,r){var e=i.length,t=L7(e/2);return e<8?z7(i,r):H7(i,tf(hm(i,0,t),r),tf(hm(i,t),r),r)},z7=function(i,r){for(var e=i.length,t=1,n,a;t0;)i[a]=i[--a];a!==t++&&(i[a]=n)}return i},H7=function(i,r,e,t){for(var n=r.length,a=e.length,o=0,s=0;o3)){if(rV)return!0;if(ym)return ym<603;var i="",r,e,t,n;for(r=65;r<76;r++){switch(e=String.fromCharCode(r),r){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(n=0;n<47;n++)ti.push({k:e+n,v:t})}for(ti.sort(function(a,o){return o.v-a.v}),n=0;nvm(e)?1:-1}};X7({target:"Array",proto:!0,forced:sV},{sort:function(r){r!==void 0&&J7(r);var e=Z7(this);if(TE)return r===void 0?mm(e):mm(e,r);var t=[],n=fm(e),a,o;for(o=0;othis.max&&this.flush(),this._timeout!=null&&(clearTimeout(this._timeout),this._timeout=null),this.queue.length>0&&typeof this.delay=="number"&&(this._timeout=bL(function(){e.flush()},this.delay))}},{key:"flush",value:function(){var e,t;Wi(e=Ww(t=this._queue).call(t,0)).call(e,function(n){n.fn.apply(n.context||n.fn,n.args||[])})}}],[{key:"extend",value:function(e,t){var n=new i(t);if(e.flush!==void 0)throw new Error("Target object already has a property flush");e.flush=function(){n.flush()};var a=[{name:"flush",original:void 0}];if(t&&t.replace)for(var o=0;o=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function cW(i,r){var e;if(i){if(typeof i=="string")return _m(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _m(i,r)}}function _m(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);es&&(s=c,o=h)}return o}},{key:"min",value:function(t){var n=gc(this._pairs),a=n.next();if(a.done)return null;for(var o=a.value[1],s=t(a.value[1],a.value[0]);!(a=n.next()).done;){var u=$t(a.value,2),l=u[0],h=u[1],c=t(h,l);c=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function dW(i,r){var e;if(i){if(typeof i=="string")return Tm(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Tm(i,r)}}function Tm(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e"u"||!du||du.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(du(Boolean,[],function(){})),!0}catch{return!1}}function pW(i,r){return i[r]==null&&(i[r]=UV()),i}var Lu=function(i){Az(e,i);var r=fW(e);function e(t,n){var a;return tl(this,e),a=r.call(this),si(F_(a),"_queue",null),t&&!Bt(t)&&(n=t,t=[]),a._options=n||{},a._data=new SE,a.length=0,a._idProp=a._options.fieldId||"id",t&&t.length&&a.add(t),a.setOptions(n),a}return wl(e,[{key:"idProp",get:function(){return this._idProp}},{key:"setOptions",value:function(n){n&&n.queue!==void 0&&(n.queue===!1?this._queue&&(this._queue.destroy(),this._queue=null):(this._queue||(this._queue=KV.extend(this,{replace:["add","update","remove"]})),n.queue&&typeof n.queue=="object"&&this._queue.setOptions(n.queue)))}},{key:"add",value:function(n,a){var o=this,s=[],u;if(Bt(n)){var l=rr(n).call(n,function(d){return d[o._idProp]});if(k7(l).call(l,function(d){return o._data.has(d)}))throw new Error("A duplicate id was found in the parameter array.");for(var h=0,c=n.length;hh?1:ls)&&(o=h,s=c)}}catch(d){u.e(d)}finally{u.f()}return o||null}},{key:"min",value:function(n){var a,o=null,s=null,u=yc(bm(a=this._data).call(a)),l;try{for(u.s();!(l=u.n()).done;){var h=l.value,c=h[n];typeof c=="number"&&(s==null||c\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=window.console&&(window.console.warn||window.console.log);return o&&o.call(window.console,t,a),i.apply(this,arguments)}}var w_=$_(function(i,r,e){for(var t=Object.keys(r),n=0;n=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function h5(i,r){var e;if(i){if(typeof i=="string")return Ey(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ey(i,r)}}function Ey(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?e-1:0),n=1;n2){var t;return Nu.apply(void 0,Ol(t=[S_(r[0],r[1])]).call(t,St(Tl(r).call(r,2))))}var n=r[0],a=r[1];if(n instanceof Date&&a instanceof Date)return n.setTime(a.getTime()),n;var o=__(cj(a)),s;try{for(o.s();!(s=o.n()).done;){var u=s.value;Object.prototype.propertyIsEnumerable.call(a,u)&&(a[u]===E_?delete n[u]:n[u]!==null&&a[u]!==null&&typeof n[u]=="object"&&typeof a[u]=="object"&&!Bt(n[u])&&!Bt(a[u])?n[u]=Nu(n[u],a[u]):n[u]=O_(a[u]))}}catch(l){o.e(l)}finally{o.f()}return n}function O_(i){return Bt(i)?rr(i).call(i,function(r){return O_(r)}):typeof i=="object"&&i!==null?i instanceof Date?new Date(i.getTime()):Nu({},i):i}function T_(i){for(var r=0,e=lv(i);ro;)u=t(e,s=n[o++]),u!==void 0&&X5(a,s,u);return a}});var J5=we,Z5=J5.Object.getOwnPropertyDescriptors,Q5=Z5,ez=Q5,tz=ez,ky=Y(tz),M_={exports:{}},rz=K,iz=qe,Py=cl.f;rz({target:"Object",stat:!0,forced:Object.defineProperties!==Py,sham:!iz},{defineProperties:Py});var nz=we,B_=nz.Object,az=M_.exports=function(r,e){return B_.defineProperties(r,e)};B_.defineProperties.sham&&(az.sham=!0);var oz=M_.exports,sz=oz,uz=sz,lz=uz,hz=Y(lz),cz=p0,dz=Y(cz);function F_(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}var fz=Kw,vz=fz,pz=vz,gz=pz,j_=gz,yz=Y(j_),mz=K,bz=aw;mz({target:"Object",stat:!0},{setPrototypeOf:bz});var $z=we,wz=$z.Object.setPrototypeOf,_z=wz,Ez=_z,Sz=Ez,Oz=Sz,Tz=Oz,Iz=Tz,L_=Iz,Vd=Y(L_),kz=ww,Pz=kz,xz=Pz,Cz=xz,Az=Cz,z_=Y(Az);function Wd(i,r){var e;return Wd=Vd?z_(e=Vd).call(e):function(n,a){return n.__proto__=a,n},Wd(i,r)}function Dz(i,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=yz(r.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),ol(i,"prototype",{writable:!1}),Wd(i,r)}function Rz(i,r){if(r&&(Jn(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F_(i)}var Nz=z3,Mz=Nz,Bz=Mz,Fz=Bz,H_=Fz,xy=Y(H_);function Mu(i){var r;return Mu=Vd?z_(r=xy).call(r):function(t){return t.__proto__||xy(t)},Mu(i)}var V_={exports:{}},W_={exports:{}};(function(i){var r=iv,e=gw;function t(n){"@babel/helpers - typeof";return i.exports=t=typeof r=="function"&&typeof e=="symbol"?function(a){return typeof a}:function(a){return a&&typeof r=="function"&&a.constructor===r&&a!==r.prototype?"symbol":typeof a},i.exports.__esModule=!0,i.exports.default=i.exports,t(n)}i.exports=t,i.exports.__esModule=!0,i.exports.default=i.exports})(W_);var jz=W_.exports,Lz=zw,zz=Lz,Hz=zz,Vz=Hz,Wz=Vz,Cy=Ve,Uz=uv,Kz=Qi,Gz=Ct,qz=function(i,r,e){for(var t=Uz(r),n=Gz.f,a=Kz.f,o=0;oc;c++)if(f=y(i[c]),f&&Dy(Ny,f))return f;return new fu(!1)}l=g4(i,h)}for(v=a?i.next:l.next;!(p=c4(v,l)).done;){try{f=y(p.value)}catch(m){Ry(l,"throw",m)}if(typeof f=="object"&&f&&Dy(Ny,f))return f}return new fu(!1)},b4=tn,$4=function(i,r){return i===void 0?arguments.length<2?"":r:b4(i)},w4=K,_4=He,E4=$l,Bu=aw,S4=qz,G_=rn,qh=Lr,Yh=en,O4=Jz,T4=l4,I4=on,k4=$4,P4=Ee,x4=P4("toStringTag"),Fu=Error,C4=[].push,ta=function(r,e){var t=_4(Xh,this),n;Bu?n=Bu(new Fu,t?E4(this):Xh):(n=t?this:G_(Xh),qh(n,x4,"Error")),e!==void 0&&qh(n,"message",k4(e)),T4(n,ta,n.stack,1),arguments.length>2&&O4(n,arguments[2]);var a=[];return I4(r,C4,{that:a}),qh(n,"errors",a),n};Bu?Bu(ta,Fu):S4(ta,Fu,{name:!0});var Xh=ta.prototype=G_(Fu.prototype,{constructor:Yh(1,ta),message:Yh(1,""),name:Yh(1,"AggregateError")});w4({global:!0,constructor:!0,arity:2},{AggregateError:ta});var A4=mt,D4=qf,R4=Ee,N4=qe,My=R4("species"),q_=function(i){var r=A4(i);N4&&r&&!r[My]&&D4(r,My,{configurable:!0,get:function(){return this}})},M4=He,B4=TypeError,mv=function(i,r){if(M4(r,i))return i;throw new B4("Incorrect invocation")},By=jt,F4=I_,j4=ca,L4=Ee,z4=L4("species"),Y_=function(i,r){var e=By(i).constructor,t;return e===void 0||j4(t=By(e)[z4])?r:F4(t)},H4=mi,X_=/(?:ipad|iphone|ipod).*applewebkit/i.test(H4),Ft=$e,V4=ha,W4=bi,Fy=Ie,U4=Ve,J_=le,jy=O0,K4=No,Ly=Vf,G4=Gw,q4=X_,Y4=Bo,Ud=Ft.setImmediate,Kd=Ft.clearImmediate,X4=Ft.process,Jh=Ft.Dispatch,J4=Ft.Function,zy=Ft.MessageChannel,Z4=Ft.String,Zh=0,Za={},Hy="onreadystatechange",go,ki,Qh,ec;J_(function(){go=Ft.location});var bv=function(i){if(U4(Za,i)){var r=Za[i];delete Za[i],r()}},tc=function(i){return function(){bv(i)}},Vy=function(i){bv(i.data)},Wy=function(i){Ft.postMessage(Z4(i),go.protocol+"//"+go.host)};(!Ud||!Kd)&&(Ud=function(r){G4(arguments.length,1);var e=Fy(r)?r:J4(r),t=K4(arguments,1);return Za[++Zh]=function(){V4(e,void 0,t)},ki(Zh),Zh},Kd=function(r){delete Za[r]},Y4?ki=function(i){X4.nextTick(tc(i))}:Jh&&Jh.now?ki=function(i){Jh.now(tc(i))}:zy&&!q4?(Qh=new zy,ec=Qh.port2,Qh.port1.onmessage=Vy,ki=W4(ec.postMessage,ec)):Ft.addEventListener&&Fy(Ft.postMessage)&&!Ft.importScripts&&go&&go.protocol!=="file:"&&!J_(Wy)?(ki=Wy,Ft.addEventListener("message",Vy,!1)):Hy in Ly("script")?ki=function(i){jy.appendChild(Ly("script"))[Hy]=function(){jy.removeChild(this),bv(i)}}:ki=function(i){setTimeout(tc(i),0)});var Z_={set:Ud,clear:Kd},Q_=function(){this.head=null,this.tail=null};Q_.prototype={add:function(i){var r={item:i,next:null},e=this.tail;e?e.next=r:this.head=r,this.tail=r},get:function(){var i=this.head;if(i){var r=this.head=i.next;return r===null&&(this.tail=null),i.item}}};var eE=Q_,Q4=mi,e6=/ipad|iphone|ipod/i.test(Q4)&&typeof Pebble<"u",t6=mi,r6=/web0s(?!.*chrome)/i.test(t6),qi=$e,Uy=bi,i6=Qi.f,rc=Z_.set,n6=eE,a6=X_,o6=e6,s6=r6,ic=Bo,Ky=qi.MutationObserver||qi.WebKitMutationObserver,Gy=qi.document,qy=qi.process,Ns=qi.Promise,Yy=i6(qi,"queueMicrotask"),Gd=Yy&&Yy.value,_n,nc,ac,Ms,Xy;if(!Gd){var Bs=new n6,Fs=function(){var i,r;for(ic&&(i=qy.domain)&&i.exit();r=Bs.get();)try{r()}catch(e){throw Bs.head&&_n(),e}i&&i.enter()};!a6&&!ic&&!s6&&Ky&&Gy?(nc=!0,ac=Gy.createTextNode(""),new Ky(Fs).observe(ac,{characterData:!0}),_n=function(){ac.data=nc=!nc}):!o6&&Ns&&Ns.resolve?(Ms=Ns.resolve(void 0),Ms.constructor=Ns,Xy=Uy(Ms.then,Ms),_n=function(){Xy(Fs)}):ic?_n=function(){qy.nextTick(Fs)}:(rc=Uy(rc,qi),_n=function(){rc(Fs)}),Gd=function(i){Bs.head||_n(),Bs.add(i)}}var u6=Gd,l6=function(i,r){try{arguments.length===1?console.error(i):console.error(i,r)}catch{}},_a=function(i){try{return{error:!1,value:i()}}catch(r){return{error:!0,value:r}}},h6=$e,Ea=h6.Promise,tE=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",c6=tE,d6=Bo,f6=!c6&&!d6&&typeof window=="object"&&typeof document=="object",v6=$e,Qa=Ea,p6=Ie,g6=d0,y6=m0,m6=Ee,b6=f6,$6=tE,oc=da,Jy=Qa&&Qa.prototype,w6=m6("species"),qd=!1,rE=p6(v6.PromiseRejectionEvent),_6=g6("Promise",function(){var i=y6(Qa),r=i!==String(Qa);if(!r&&oc===66||!(Jy.catch&&Jy.finally))return!0;if(!oc||oc<51||!/native code/.test(i)){var e=new Qa(function(a){a(1)}),t=function(a){a(function(){},function(){})},n=e.constructor={};if(n[w6]=t,qd=e.then(function(){})instanceof t,!qd)return!0}return!r&&(b6||$6)&&!rE}),Vo={CONSTRUCTOR:_6,REJECTION_EVENT:rE,SUBCLASSING:qd},wr={},Zy=Pt,E6=TypeError,S6=function(i){var r,e;this.promise=new i(function(t,n){if(r!==void 0||e!==void 0)throw new E6("Bad Promise constructor");r=t,e=n}),this.resolve=Zy(r),this.reject=Zy(e)};wr.f=function(i){return new S6(i)};var O6=K,ju=Bo,fi=$e,Wo=Ye,T6=ya,I6=nn,k6=q_,P6=Pt,Yd=Ie,x6=nt,C6=mv,A6=Y_,iE=Z_.set,$v=u6,D6=l6,R6=_a,N6=eE,nE=ma,Xd=Ea,aE=Vo,oE=wr,Pl="Promise",sE=aE.CONSTRUCTOR,M6=aE.REJECTION_EVENT,sc=nE.getterFor(Pl),B6=nE.set,F6=Xd&&Xd.prototype,Bn=Xd,uc=F6,uE=fi.TypeError,Jd=fi.document,wv=fi.process,Zd=oE.f,j6=Zd,L6=!!(Jd&&Jd.createEvent&&fi.dispatchEvent),lE="unhandledrejection",z6="rejectionhandled",Qy=0,hE=1,H6=2,_v=1,cE=2,js,em,V6,dE=function(i){var r;return x6(i)&&Yd(r=i.then)?r:!1},fE=function(i,r){var e=r.value,t=r.state===hE,n=t?i.ok:i.fail,a=i.resolve,o=i.reject,s=i.domain,u,l,h;try{n?(t||(r.rejection===cE&&U6(r),r.rejection=_v),n===!0?u=e:(s&&s.enter(),u=n(e),s&&(s.exit(),h=!0)),u===i.promise?o(new uE("Promise-chain cycle")):(l=dE(u))?Wo(l,u,a,o):a(u)):o(e)}catch(c){s&&!h&&s.exit(),o(c)}},vE=function(i,r){i.notified||(i.notified=!0,$v(function(){for(var e=i.reactions,t;t=e.get();)fE(t,i);i.notified=!1,r&&!i.rejection&&W6(i)}))},pE=function(i,r,e){var t,n;L6?(t=Jd.createEvent("Event"),t.promise=r,t.reason=e,t.initEvent(i,!1,!0),fi.dispatchEvent(t)):t={promise:r,reason:e},!M6&&(n=fi["on"+i])?n(t):i===lE&&D6("Unhandled promise rejection",e)},W6=function(i){Wo(iE,fi,function(){var r=i.facade,e=i.value,t=tm(i),n;if(t&&(n=R6(function(){ju?wv.emit("unhandledRejection",e,r):pE(lE,r,e)}),i.rejection=ju||tm(i)?cE:_v,n.error))throw n.value})},tm=function(i){return i.rejection!==_v&&!i.parent},U6=function(i){Wo(iE,fi,function(){var r=i.facade;ju?wv.emit("rejectionHandled",r):pE(z6,r,i.value)})},Fn=function(i,r,e){return function(t){i(r,t,e)}},Un=function(i,r,e){i.done||(i.done=!0,e&&(i=e),i.value=r,i.state=H6,vE(i,!0))},Qd=function(i,r,e){if(!i.done){i.done=!0,e&&(i=e);try{if(i.facade===r)throw new uE("Promise can't be resolved itself");var t=dE(r);t?$v(function(){var n={done:!1};try{Wo(t,r,Fn(Qd,n,i),Fn(Un,n,i))}catch(a){Un(n,a,i)}}):(i.value=r,i.state=hE,vE(i,!1))}catch(n){Un({done:!1},n,i)}}};sE&&(Bn=function(r){C6(this,uc),P6(r),Wo(js,this);var e=sc(this);try{r(Fn(Qd,e),Fn(Un,e))}catch(t){Un(e,t)}},uc=Bn.prototype,js=function(r){B6(this,{type:Pl,done:!1,notified:!1,parent:!1,reactions:new N6,rejection:!1,state:Qy,value:void 0})},js.prototype=T6(uc,"then",function(r,e){var t=sc(this),n=Zd(A6(this,Bn));return t.parent=!0,n.ok=Yd(r)?r:!0,n.fail=Yd(e)&&e,n.domain=ju?wv.domain:void 0,t.state===Qy?t.reactions.add(n):$v(function(){fE(n,t)}),n.promise}),em=function(){var i=new js,r=sc(i);this.promise=i,this.resolve=Fn(Qd,r),this.reject=Fn(Un,r)},oE.f=Zd=function(i){return i===Bn||i===V6?new em(i):j6(i)});O6({global:!0,constructor:!0,wrap:!0,forced:sE},{Promise:Bn});I6(Bn,Pl,!1,!0);k6(Pl);var K6=Ea,G6=kw,q6=Vo.CONSTRUCTOR,xl=q6||!G6(function(i){K6.all(i).then(void 0,function(){})}),Y6=K,X6=Ye,J6=Pt,Z6=wr,Q6=_a,eH=on,tH=xl;Y6({target:"Promise",stat:!0,forced:tH},{all:function(r){var e=this,t=Z6.f(e),n=t.resolve,a=t.reject,o=Q6(function(){var s=J6(e.resolve),u=[],l=0,h=1;eH(r,function(c){var d=l++,f=!1;h++,X6(s,e,c).then(function(v){f||(f=!0,u[d]=v,--h||n(u))},a)}),--h||n(u)});return o.error&&a(o.value),t.promise}});var rH=K,iH=Vo.CONSTRUCTOR,rm=Ea;rm&&rm.prototype;rH({target:"Promise",proto:!0,forced:iH,real:!0},{catch:function(i){return this.then(void 0,i)}});var nH=K,aH=Ye,oH=Pt,sH=wr,uH=_a,lH=on,hH=xl;nH({target:"Promise",stat:!0,forced:hH},{race:function(r){var e=this,t=sH.f(e),n=t.reject,a=uH(function(){var o=oH(e.resolve);lH(r,function(s){aH(o,e,s).then(t.resolve,n)})});return a.error&&n(a.value),t.promise}});var cH=K,dH=Ye,fH=wr,vH=Vo.CONSTRUCTOR;cH({target:"Promise",stat:!0,forced:vH},{reject:function(r){var e=fH.f(this);return dH(e.reject,void 0,r),e.promise}});var pH=jt,gH=nt,yH=wr,gE=function(i,r){if(pH(i),gH(r)&&r.constructor===i)return r;var e=yH.f(i),t=e.resolve;return t(r),e.promise},mH=K,bH=mt,$H=Pk,wH=Ea,_H=Vo.CONSTRUCTOR,EH=gE,SH=bH("Promise"),OH=!_H;mH({target:"Promise",stat:!0,forced:$H},{resolve:function(r){return EH(OH&&this===SH?wH:this,r)}});var TH=K,IH=Ye,kH=Pt,PH=wr,xH=_a,CH=on,AH=xl;TH({target:"Promise",stat:!0,forced:AH},{allSettled:function(r){var e=this,t=PH.f(e),n=t.resolve,a=t.reject,o=xH(function(){var s=kH(e.resolve),u=[],l=0,h=1;CH(r,function(c){var d=l++,f=!1;h++,IH(s,e,c).then(function(v){f||(f=!0,u[d]={status:"fulfilled",value:v},--h||n(u))},function(v){f||(f=!0,u[d]={status:"rejected",reason:v},--h||n(u))})}),--h||n(u)});return o.error&&a(o.value),t.promise}});var DH=K,RH=Ye,NH=Pt,MH=mt,BH=wr,FH=_a,jH=on,LH=xl,im="No one promise resolved";DH({target:"Promise",stat:!0,forced:LH},{any:function(r){var e=this,t=MH("AggregateError"),n=BH.f(e),a=n.resolve,o=n.reject,s=FH(function(){var u=NH(e.resolve),l=[],h=0,c=1,d=!1;jH(r,function(f){var v=h++,p=!1;c++,RH(u,e,f).then(function(g){p||d||(d=!0,a(g))},function(g){p||d||(p=!0,l[v]=g,--c||o(new t(l,im)))})}),--c||o(new t(l,im))});return s.error&&o(s.value),n.promise}});var zH=K,ef=Ea,HH=le,VH=mt,WH=Ie,UH=Y_,nm=gE,KH=ef&&ef.prototype,GH=!!ef&&HH(function(){KH.finally.call({then:function(){}},function(){})});zH({target:"Promise",proto:!0,real:!0,forced:GH},{finally:function(i){var r=UH(this,VH("Promise")),e=WH(i);return this.then(e?function(t){return nm(r,i()).then(function(){return t})}:i,e?function(t){return nm(r,i()).then(function(){throw t})}:i)}});var qH=we,YH=qH.Promise,XH=YH,JH=XH,ZH=K,QH=wr;ZH({target:"Promise",stat:!0},{withResolvers:function(){var r=QH.f(this);return{promise:r.promise,resolve:r.resolve,reject:r.reject}}});var e8=JH,t8=e8,r8=K,i8=wr,n8=_a;r8({target:"Promise",stat:!0,forced:!0},{try:function(i){var r=i8.f(this),e=n8(i);return(e.error?r.reject:r.resolve)(e.value),r.promise}});var a8=t8,o8=a8,s8=o8,u8=Hw,l8=u8,h8=l8,c8=h8,d8=c8;(function(i){var r=jz.default,e=g0,t=iv,n=j_,a=H_,o=Wz,s=Nw,u=L_,l=s8,h=d8,c=Bw;function d(){i.exports=d=function(){return v},i.exports.__esModule=!0,i.exports.default=i.exports;var f,v={},p=Object.prototype,g=p.hasOwnProperty,y=e||function(F,x,C){F[x]=C.value},m=typeof t=="function"?t:{},$=m.iterator||"@@iterator",b=m.asyncIterator||"@@asyncIterator",O=m.toStringTag||"@@toStringTag";function _(F,x,C){return e(F,x,{value:C,enumerable:!0,configurable:!0,writable:!0}),F[x]}try{_({},"")}catch{_=function(C,W,Z){return C[W]=Z}}function D(F,x,C,W){var Z=x&&x.prototype instanceof ie?x:ie,X=n(Z.prototype),Re=new Rt(W||[]);return y(X,"_invoke",{value:Fe(F,C,Re)}),X}function R(F,x,C){try{return{type:"normal",arg:F.call(x,C)}}catch(W){return{type:"throw",arg:W}}}v.wrap=D;var P="suspendedStart",B="suspendedYield",j="executing",J="completed",U={};function ie(){}function _e(){}function ye(){}var Ae={};_(Ae,$,function(){return this});var ht=a,at=ht&&ht(ht(ut([])));at&&at!==p&&g.call(at,$)&&(Ae=at);var Dt=ye.prototype=ie.prototype=n(Ae);function ot(F){var x;o(x=["next","throw","return"]).call(x,function(C){_(F,C,function(W){return this._invoke(C,W)})})}function me(F,x){function C(Z,X,Re,ct){var bt=R(F[Z],F,X);if(bt.type!=="throw"){var Oi=bt.arg,Vr=Oi.value;return Vr&&r(Vr)=="object"&&g.call(Vr,"__await")?x.resolve(Vr.__await).then(function(Ti){C("next",Ti,Re,ct)},function(Ti){C("throw",Ti,Re,ct)}):x.resolve(Vr).then(function(Ti){Oi.value=Ti,Re(Oi)},function(Ti){return C("throw",Ti,Re,ct)})}ct(bt.arg)}var W;y(this,"_invoke",{value:function(X,Re){function ct(){return new x(function(bt,Oi){C(X,Re,bt,Oi)})}return W=W?W.then(ct,ct):ct()}})}function Fe(F,x,C){var W=P;return function(Z,X){if(W===j)throw new Error("Generator is already running");if(W===J){if(Z==="throw")throw X;return{value:f,done:!0}}for(C.method=Z,C.arg=X;;){var Re=C.delegate;if(Re){var ct=De(Re,C);if(ct){if(ct===U)continue;return ct}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(W===P)throw W=J,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);W=j;var bt=R(F,x,C);if(bt.type==="normal"){if(W=C.done?J:B,bt.arg===U)continue;return{value:bt.arg,done:C.done}}bt.type==="throw"&&(W=J,C.method="throw",C.arg=bt.arg)}}}function De(F,x){var C=x.method,W=F.iterator[C];if(W===f)return x.delegate=null,C==="throw"&&F.iterator.return&&(x.method="return",x.arg=f,De(F,x),x.method==="throw")||C!=="return"&&(x.method="throw",x.arg=new TypeError("The iterator does not provide a '"+C+"' method")),U;var Z=R(W,F.iterator,x.arg);if(Z.type==="throw")return x.method="throw",x.arg=Z.arg,x.delegate=null,U;var X=Z.arg;return X?X.done?(x[F.resultName]=X.value,x.next=F.nextLoc,x.method!=="return"&&(x.method="next",x.arg=f),x.delegate=null,U):X:(x.method="throw",x.arg=new TypeError("iterator result is not an object"),x.delegate=null,U)}function st(F){var x,C={tryLoc:F[0]};1 in F&&(C.catchLoc=F[1]),2 in F&&(C.finallyLoc=F[2],C.afterLoc=F[3]),s(x=this.tryEntries).call(x,C)}function Sr(F){var x=F.completion||{};x.type="normal",delete x.arg,F.completion=x}function Rt(F){this.tryEntries=[{tryLoc:"root"}],o(F).call(F,st,this),this.reset(!0)}function ut(F){if(F||F===""){var x=F[$];if(x)return x.call(F);if(typeof F.next=="function")return F;if(!isNaN(F.length)){var C=-1,W=function Z(){for(;++C=0;--Z){var X=this.tryEntries[Z],Re=X.completion;if(X.tryLoc==="root")return W("end");if(X.tryLoc<=this.prev){var ct=g.call(X,"catchLoc"),bt=g.call(X,"finallyLoc");if(ct&&bt){if(this.prev=0;--W){var Z=this.tryEntries[W];if(Z.tryLoc<=this.prev&&g.call(Z,"finallyLoc")&&this.prev=0;--C){var W=this.tryEntries[C];if(W.finallyLoc===x)return this.complete(W.completion,W.afterLoc),Sr(W),U}},catch:function(x){for(var C=this.tryEntries.length-1;C>=0;--C){var W=this.tryEntries[C];if(W.tryLoc===x){var Z=W.completion;if(Z.type==="throw"){var X=Z.arg;Sr(W)}return X}}throw new Error("illegal catch attempt")},delegateYield:function(x,C,W){return this.delegate={iterator:ut(x),resultName:C,nextLoc:W},this.method==="next"&&(this.arg=f),U}},v}i.exports=d,i.exports.__esModule=!0,i.exports.default=i.exports})(V_);var f8=V_.exports,vu=f8(),v8=vu;try{regeneratorRuntime=vu}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=vu:Function("r","regeneratorRuntime = r")(vu)}var wt=Y(v8),yE={exports:{}},p8=le,g8=p8(function(){if(typeof ArrayBuffer=="function"){var i=new ArrayBuffer(8);Object.isExtensible(i)&&Object.defineProperty(i,"a",{value:8})}}),y8=le,m8=nt,b8=yi,am=g8,pu=Object.isExtensible,$8=y8(function(){pu(1)}),w8=$8||am?function(r){return!m8(r)||am&&b8(r)==="ArrayBuffer"?!1:pu?pu(r):!0}:pu,_8=le,E8=!_8(function(){return Object.isExtensible(Object.preventExtensions({}))}),S8=K,O8=be,T8=Po,I8=nt,Ev=Ve,k8=Ct.f,om=xo,P8=Gf,Sv=w8,x8=nl,C8=E8,mE=!1,Br=x8("meta"),A8=0,Ov=function(i){k8(i,Br,{value:{objectID:"O"+A8++,weakData:{}}})},D8=function(i,r){if(!I8(i))return typeof i=="symbol"?i:(typeof i=="string"?"S":"P")+i;if(!Ev(i,Br)){if(!Sv(i))return"F";if(!r)return"E";Ov(i)}return i[Br].objectID},R8=function(i,r){if(!Ev(i,Br)){if(!Sv(i))return!0;if(!r)return!1;Ov(i)}return i[Br].weakData},N8=function(i){return C8&&mE&&Sv(i)&&!Ev(i,Br)&&Ov(i),i},M8=function(){B8.enable=function(){},mE=!0;var i=om.f,r=O8([].splice),e={};e[Br]=1,i(e).length&&(om.f=function(t){for(var n=i(t),a=0,o=n.length;a1?arguments[1]:void 0),f;f=f?f.next:c.first;)for(d(f.value,f.key,this);f&&f.removed;)f=f.previous},has:function(h){return!!u(this,h)}}),sm(a,e?{get:function(h){var c=u(this,h);return c&&c.value},set:function(h,c){return s(this,h===0?0:h,c)}}:{add:function(h){return s(this,h=h===0?0:h,h)}}),ja&&i7(a,"size",{configurable:!0,get:function(){return o(this).size}}),n},setStrong:function(i,r,e){var t=r+" Iterator",n=lc(r),a=lc(t);u7(i,r,function(o,s){lm(this,{type:t,target:o,state:n(o),kind:s,last:void 0})},function(){for(var o=a(this),s=o.kind,u=o.last;u&&u.removed;)u=u.previous;return!o.target||!(o.last=u=u?u.next:o.state.first)?(o.target=void 0,Ls(void 0,!0)):Ls(s==="keys"?u.key:s==="values"?u.value:[u.key,u.value],!1)},e?"entries":"values",!e,!0),l7(r)}},h7=wE,c7=EE;h7("Map",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},c7);var d7=we,f7=d7.Map,v7=f7,p7=v7,g7=p7,SE=Y(g7),y7=K,m7=ba.some,b7=_l,$7=b7("some");y7({target:"Array",proto:!0,forced:!$7},{some:function(r){return m7(this,r,arguments.length>1?arguments[1]:void 0)}});var w7=lt,_7=w7("Array","some"),E7=He,S7=_7,hc=Array.prototype,O7=function(i){var r=i.some;return i===hc||E7(hc,i)&&r===hc.some?S7:r},T7=O7,I7=T7,k7=I7,P7=Y(k7),x7=lt,C7=x7("Array","keys"),A7=C7,D7=A7,R7=zr,N7=Ve,M7=He,B7=D7,cc=Array.prototype,F7={DOMTokenList:!0,NodeList:!0},j7=function(i){var r=i.keys;return i===cc||M7(cc,i)&&r===cc.keys||N7(F7,R7(i))?B7:r},L7=j7,En=Y(L7),hm=k0,z7=Math.floor,tf=function(i,r){var e=i.length,t=z7(e/2);return e<8?H7(i,r):V7(i,tf(hm(i,0,t),r),tf(hm(i,t),r),r)},H7=function(i,r){for(var e=i.length,t=1,n,a;t0;)i[a]=i[--a];a!==t++&&(i[a]=n)}return i},V7=function(i,r,e,t){for(var n=r.length,a=e.length,o=0,s=0;o3)){if(iV)return!0;if(ym)return ym<603;var i="",r,e,t,n;for(r=65;r<76;r++){switch(e=String.fromCharCode(r),r){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(n=0;n<47;n++)ti.push({k:e+n,v:t})}for(ti.sort(function(a,o){return o.v-a.v}),n=0;nvm(e)?1:-1}};J7({target:"Array",proto:!0,forced:uV},{sort:function(r){r!==void 0&&Z7(r);var e=Q7(this);if(TE)return r===void 0?mm(e):mm(e,r);var t=[],n=fm(e),a,o;for(o=0;othis.max&&this.flush(),this._timeout!=null&&(clearTimeout(this._timeout),this._timeout=null),this.queue.length>0&&typeof this.delay=="number"&&(this._timeout=$L(function(){e.flush()},this.delay))}},{key:"flush",value:function(){var e,t;Wi(e=Ww(t=this._queue).call(t,0)).call(e,function(n){n.fn.apply(n.context||n.fn,n.args||[])})}}],[{key:"extend",value:function(e,t){var n=new i(t);if(e.flush!==void 0)throw new Error("Target object already has a property flush");e.flush=function(){n.flush()};var a=[{name:"flush",original:void 0}];if(t&&t.replace)for(var o=0;o=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function dW(i,r){var e;if(i){if(typeof i=="string")return _m(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _m(i,r)}}function _m(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);es&&(s=c,o=h)}return o}},{key:"min",value:function(t){var n=gc(this._pairs),a=n.next();if(a.done)return null;for(var o=a.value[1],s=t(a.value[1],a.value[0]);!(a=n.next()).done;){var u=$t(a.value,2),l=u[0],h=u[1],c=t(h,l);c=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function fW(i,r){var e;if(i){if(typeof i=="string")return Tm(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Tm(i,r)}}function Tm(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e"u"||!du||du.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(du(Boolean,[],function(){})),!0}catch{return!1}}function gW(i,r){return i[r]==null&&(i[r]=KV()),i}var Lu=function(i){Dz(e,i);var r=vW(e);function e(t,n){var a;return tl(this,e),a=r.call(this),si(F_(a),"_queue",null),t&&!Bt(t)&&(n=t,t=[]),a._options=n||{},a._data=new SE,a.length=0,a._idProp=a._options.fieldId||"id",t&&t.length&&a.add(t),a.setOptions(n),a}return wl(e,[{key:"idProp",get:function(){return this._idProp}},{key:"setOptions",value:function(n){n&&n.queue!==void 0&&(n.queue===!1?this._queue&&(this._queue.destroy(),this._queue=null):(this._queue||(this._queue=GV.extend(this,{replace:["add","update","remove"]})),n.queue&&typeof n.queue=="object"&&this._queue.setOptions(n.queue)))}},{key:"add",value:function(n,a){var o=this,s=[],u;if(Bt(n)){var l=rr(n).call(n,function(d){return d[o._idProp]});if(P7(l).call(l,function(d){return o._data.has(d)}))throw new Error("A duplicate id was found in the parameter array.");for(var h=0,c=n.length;hh?1:ls)&&(o=h,s=c)}}catch(d){u.e(d)}finally{u.f()}return o||null}},{key:"min",value:function(n){var a,o=null,s=null,u=yc(bm(a=this._data).call(a)),l;try{for(u.s();!(l=u.n()).done;){var h=l.value,c=h[n];typeof c=="number"&&(s==null||c"u"&&af!==void 0,AE={all:af,IS_HTMLDDA:SW},DE=AE,OW=DE.all,Xe=DE.IS_HTMLDDA?function(i){return typeof i=="function"||i===OW}:function(i){return typeof i=="function"},Sa={},TW=ae,Je=!TW(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),IW=Uo,Vs=Function.prototype.call,zt=IW?Vs.bind(Vs):function(){return Vs.apply(Vs,arguments)},Cl={},RE={}.propertyIsEnumerable,NE=Object.getOwnPropertyDescriptor,kW=NE&&!RE.call({1:2},1);Cl.f=kW?function(r){var e=NE(this,r);return!!e&&e.enumerable}:RE;var Go=function(i,r){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:r}},PW=se,xW=ae,CW=Hr,bc=Object,AW=PW("".split),Al=xW(function(){return!bc("z").propertyIsEnumerable(0)})?function(i){return CW(i)==="String"?AW(i,""):bc(i)}:bc,Oa=function(i){return i==null},DW=Oa,RW=TypeError,qo=function(i){if(DW(i))throw new RW("Can't call method on "+i);return i},NW=Al,MW=qo,_r=function(i){return NW(MW(i))},Pm=Xe,ME=AE,BW=ME.all,Ze=ME.IS_HTMLDDA?function(i){return typeof i=="object"?i!==null:Pm(i)||i===BW}:function(i){return typeof i=="object"?i!==null:Pm(i)},oe={},$c=oe,wc=Pe,FW=Xe,xm=function(i){return FW(i)?i:void 0},Jt=function(i,r){return arguments.length<2?xm($c[i])||xm(wc[i]):$c[i]&&$c[i][r]||wc[i]&&wc[i][r]},jW=se,Be=jW({}.isPrototypeOf),Yo=typeof navigator<"u"&&String(navigator.userAgent)||"",BE=Pe,_c=Yo,Cm=BE.process,Am=BE.Deno,Dm=Cm&&Cm.versions||Am&&Am.version,Rm=Dm&&Dm.v8,ir,zu;Rm&&(ir=Rm.split("."),zu=ir[0]>0&&ir[0]<4?1:+(ir[0]+ir[1]));!zu&&_c&&(ir=_c.match(/Edge\/(\d+)/),(!ir||ir[1]>=74)&&(ir=_c.match(/Chrome\/(\d+)/),ir&&(zu=+ir[1])));var Xo=zu,Nm=Xo,LW=ae,zW=Pe,HW=zW.String,Ta=!!Object.getOwnPropertySymbols&&!LW(function(){var i=Symbol("symbol detection");return!HW(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&Nm&&Nm<41}),VW=Ta,FE=VW&&!Symbol.sham&&typeof Symbol.iterator=="symbol",WW=Jt,UW=Xe,KW=Be,GW=FE,qW=Object,Jo=GW?function(i){return typeof i=="symbol"}:function(i){var r=WW("Symbol");return UW(r)&&KW(r.prototype,qW(i))},YW=String,Ia=function(i){try{return YW(i)}catch{return"Object"}},XW=Xe,JW=Ia,ZW=TypeError,sn=function(i){if(XW(i))return i;throw new ZW(JW(i)+" is not a function")},QW=sn,e9=Oa,kv=function(i,r){var e=i[r];return e9(e)?void 0:QW(e)},Ec=zt,Sc=Xe,Oc=Ze,t9=TypeError,r9=function(i,r){var e,t;if(r==="string"&&Sc(e=i.toString)&&!Oc(t=Ec(e,i))||Sc(e=i.valueOf)&&!Oc(t=Ec(e,i))||r!=="string"&&Sc(e=i.toString)&&!Oc(t=Ec(e,i)))return t;throw new t9("Can't convert object to primitive value")},jE={exports:{}},Mm=Pe,i9=Object.defineProperty,n9=function(i,r){try{i9(Mm,i,{value:r,configurable:!0,writable:!0})}catch{Mm[i]=r}return r},a9=Pe,o9=n9,Bm="__core-js_shared__",s9=a9[Bm]||o9(Bm,{}),Pv=s9,Fm=Pv;(jE.exports=function(i,r){return Fm[i]||(Fm[i]=r!==void 0?r:{})})("versions",[]).push({version:"3.33.0",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ka=jE.exports,u9=qo,l9=Object,At=function(i){return l9(u9(i))},h9=se,c9=At,d9=h9({}.hasOwnProperty),Qe=Object.hasOwn||function(r,e){return d9(c9(r),e)},f9=se,v9=0,p9=Math.random(),g9=f9(1 .toString),Dl=function(i){return"Symbol("+(i===void 0?"":i)+")_"+g9(++v9+p9,36)},y9=Pe,m9=ka,jm=Qe,b9=Dl,$9=Ta,w9=FE,Ln=y9.Symbol,Tc=m9("wks"),_9=w9?Ln.for||Ln:Ln&&Ln.withoutSetter||b9,xe=function(i){return jm(Tc,i)||(Tc[i]=$9&&jm(Ln,i)?Ln[i]:_9("Symbol."+i)),Tc[i]},E9=zt,Lm=Ze,zm=Jo,S9=kv,O9=r9,T9=xe,I9=TypeError,k9=T9("toPrimitive"),P9=function(i,r){if(!Lm(i)||zm(i))return i;var e=S9(i,k9),t;if(e){if(r===void 0&&(r="default"),t=E9(e,i,r),!Lm(t)||zm(t))return t;throw new I9("Can't convert object to primitive value")}return r===void 0&&(r="number"),O9(i,r)},x9=P9,C9=Jo,Rl=function(i){var r=x9(i,"string");return C9(r)?r:r+""},A9=Pe,Hm=Ze,of=A9.document,D9=Hm(of)&&Hm(of.createElement),LE=function(i){return D9?of.createElement(i):{}},R9=Je,N9=ae,M9=LE,zE=!R9&&!N9(function(){return Object.defineProperty(M9("div"),"a",{get:function(){return 7}}).a!==7}),B9=Je,F9=zt,j9=Cl,L9=Go,z9=_r,H9=Rl,V9=Qe,W9=zE,Vm=Object.getOwnPropertyDescriptor;Sa.f=B9?Vm:function(r,e){if(r=z9(r),e=H9(e),W9)try{return Vm(r,e)}catch{}if(V9(r,e))return L9(!F9(j9.f,r,e),r[e])};var U9=ae,K9=Xe,G9=/#|\.prototype\./,Zo=function(i,r){var e=Y9[q9(i)];return e===J9?!0:e===X9?!1:K9(r)?U9(r):!!r},q9=Zo.normalize=function(i){return String(i).replace(G9,".").toLowerCase()},Y9=Zo.data={},X9=Zo.NATIVE="N",J9=Zo.POLYFILL="P",Z9=Zo,Wm=Iv,Q9=sn,eU=Uo,tU=Wm(Wm.bind),Qo=function(i,r){return Q9(i),r===void 0?i:eU?tU(i,r):function(){return i.apply(r,arguments)}},Ht={},rU=Je,iU=ae,HE=rU&&iU(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),nU=Ze,aU=String,oU=TypeError,Vt=function(i){if(nU(i))return i;throw new oU(aU(i)+" is not an object")},sU=Je,uU=zE,lU=HE,Ws=Vt,Um=Rl,hU=TypeError,Ic=Object.defineProperty,cU=Object.getOwnPropertyDescriptor,kc="enumerable",Pc="configurable",xc="writable";Ht.f=sU?lU?function(r,e,t){if(Ws(r),e=Um(e),Ws(t),typeof r=="function"&&e==="prototype"&&"value"in t&&xc in t&&!t[xc]){var n=cU(r,e);n&&n[xc]&&(r[e]=t.value,t={configurable:Pc in t?t[Pc]:n[Pc],enumerable:kc in t?t[kc]:n[kc],writable:!1})}return Ic(r,e,t)}:Ic:function(r,e,t){if(Ws(r),e=Um(e),Ws(t),uU)try{return Ic(r,e,t)}catch{}if("get"in t||"set"in t)throw new hU("Accessors not supported");return"value"in t&&(r[e]=t.value),r};var dU=Je,fU=Ht,vU=Go,Pa=dU?function(i,r,e){return fU.f(i,r,vU(1,e))}:function(i,r,e){return i[r]=e,i},Us=Pe,pU=Ko,gU=Iv,yU=Xe,mU=Sa.f,bU=Z9,Sn=oe,$U=Qo,On=Pa,Km=Qe,wU=function(i){var r=function(e,t,n){if(this instanceof r){switch(arguments.length){case 0:return new i;case 1:return new i(e);case 2:return new i(e,t)}return new i(e,t,n)}return pU(i,this,arguments)};return r.prototype=i.prototype,r},q=function(i,r){var e=i.target,t=i.global,n=i.stat,a=i.proto,o=t?Us:n?Us[e]:(Us[e]||{}).prototype,s=t?Sn:Sn[e]||On(Sn,e,{})[e],u=s.prototype,l,h,c,d,f,v,p,g,y;for(d in r)l=bU(t?d:e+(n?".":"#")+d,i.forced),h=!l&&o&&Km(o,d),v=s[d],h&&(i.dontCallGetSet?(y=mU(o,d),p=y&&y.value):p=o[d]),f=h&&p?p:r[d],!(h&&typeof v==typeof f)&&(i.bind&&h?g=$U(f,Us):i.wrap&&h?g=wU(f):a&&yU(f)?g=gU(f):g=f,(i.sham||f&&f.sham||v&&v.sham)&&On(g,"sham",!0),On(s,d,g),a&&(c=e+"Prototype",Km(Sn,c)||On(Sn,c,{}),On(Sn[c],d,f),i.real&&u&&(l||!u[d])&&On(u,d,f)))},_U=Math.ceil,EU=Math.floor,SU=Math.trunc||function(r){var e=+r;return(e>0?EU:_U)(e)},OU=SU,Nl=function(i){var r=+i;return r!==r||r===0?0:OU(r)},TU=Nl,IU=Math.max,kU=Math.min,es=function(i,r){var e=TU(i);return e<0?IU(e+r,0):kU(e,r)},PU=Nl,xU=Math.min,CU=function(i){return i>0?xU(PU(i),9007199254740991):0},AU=CU,Zt=function(i){return AU(i.length)},DU=_r,RU=es,NU=Zt,Gm=function(i){return function(r,e,t){var n=DU(r),a=NU(n),o=RU(t,a),s;if(i&&e!==e){for(;a>o;)if(s=n[o++],s!==s)return!0}else for(;a>o;o++)if((i||o in n)&&n[o]===e)return i||o||0;return!i&&-1}},xv={includes:Gm(!0),indexOf:Gm(!1)},ts={},MU=se,Cc=Qe,BU=_r,FU=xv.indexOf,jU=ts,qm=MU([].push),VE=function(i,r){var e=BU(i),t=0,n=[],a;for(a in e)!Cc(jU,a)&&Cc(e,a)&&qm(n,a);for(;r.length>t;)Cc(e,a=r[t++])&&(~FU(n,a)||qm(n,a));return n},Cv=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],LU=VE,zU=Cv,Ml=Object.keys||function(r){return LU(r,zU)},rs={};rs.f=Object.getOwnPropertySymbols;var Ym=Je,HU=se,VU=zt,WU=ae,Ac=Ml,UU=rs,KU=Cl,GU=At,qU=Al,Tn=Object.assign,Xm=Object.defineProperty,YU=HU([].concat),XU=!Tn||WU(function(){if(Ym&&Tn({b:1},Tn(Xm({},"a",{enumerable:!0,get:function(){Xm(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var i={},r={},e=Symbol("assign detection"),t="abcdefghijklmnopqrst";return i[e]=7,t.split("").forEach(function(n){r[n]=n}),Tn({},i)[e]!==7||Ac(Tn({},r)).join("")!==t})?function(r,e){for(var t=GU(r),n=arguments.length,a=1,o=UU.f,s=KU.f;n>a;)for(var u=qU(arguments[a++]),l=o?YU(Ac(u),o(u)):Ac(u),h=l.length,c=0,d;h>c;)d=l[c++],(!Ym||VU(s,u,d))&&(t[d]=u[d]);return t}:Tn,JU=q,Jm=XU;JU({target:"Object",stat:!0,arity:2,forced:Object.assign!==Jm},{assign:Jm});var ZU=oe,QU=ZU.Object.assign,eK=QU,tK=eK,rK=tK,Le=V(rK),iK=se,Bl=iK([].slice),WE=se,nK=sn,aK=Ze,oK=Qe,Zm=Bl,sK=Uo,UE=Function,uK=WE([].concat),lK=WE([].join),Dc={},hK=function(i,r,e){if(!oK(Dc,r)){for(var t=[],n=0;n=.1;)v=+a[c++%o],v>h&&(v=h),f=Math.sqrt(v*v/(1+l*l)),f=s<0?-f:f,r+=f,e+=l*f,d===!0?i.lineTo(r,e):i.moveTo(r,e),h-=v,d=!d}function OK(i,r,e,t){i.beginPath();var n=6,a=Math.PI*2/n;i.moveTo(r+t,e);for(var o=1;o1?e-1:0),n=1;n=a?i?"":void 0:(o=tb(t,n),o<55296||o>56319||n+1===a||(s=tb(t,n+1))<56320||s>57343?i?HK(t,n):o:i?VK(t,n,n+2):(o-55296<<10)+(s-56320)+65536)}},WK={codeAt:rb(!1),charAt:rb(!0)},UK=Pe,KK=Xe,ib=UK.WeakMap,eS=KK(ib)&&/native code/.test(String(ib)),GK=ka,qK=Dl,nb=GK("keys"),Fl=function(i){return nb[i]||(nb[i]=qK(i))},YK=eS,tS=Pe,XK=Ze,JK=Pa,Nc=Qe,Mc=Pv,ZK=Fl,QK=ts,ab="Object already initialized",uf=tS.TypeError,eG=tS.WeakMap,Hu,yo,Vu,tG=function(i){return Vu(i)?yo(i):Hu(i,{})},rG=function(i){return function(r){var e;if(!XK(r)||(e=yo(r)).type!==i)throw new uf("Incompatible receiver, "+i+" required");return e}};if(YK||Mc.state){var cr=Mc.state||(Mc.state=new eG);cr.get=cr.get,cr.has=cr.has,cr.set=cr.set,Hu=function(i,r){if(cr.has(i))throw new uf(ab);return r.facade=i,cr.set(i,r),r},yo=function(i){return cr.get(i)||{}},Vu=function(i){return cr.has(i)}}else{var In=ZK("state");QK[In]=!0,Hu=function(i,r){if(Nc(i,In))throw new uf(ab);return r.facade=i,JK(i,In,r),r},yo=function(i){return Nc(i,In)?i[In]:{}},Vu=function(i){return Nc(i,In)}}var ln={set:Hu,get:yo,has:Vu,enforce:tG,getterFor:rG},lf=Je,iG=Qe,rS=Function.prototype,nG=lf&&Object.getOwnPropertyDescriptor,Nv=iG(rS,"name"),aG=Nv&&function(){}.name==="something",oG=Nv&&(!lf||lf&&nG(rS,"name").configurable),sG={EXISTS:Nv,PROPER:aG,CONFIGURABLE:oG},jl={},uG=Je,lG=HE,hG=Ht,cG=Vt,dG=_r,fG=Ml;jl.f=uG&&!lG?Object.defineProperties:function(r,e){cG(r);for(var t=dG(e),n=fG(e),a=n.length,o=0,s;a>o;)hG.f(r,s=n[o++],t[s]);return r};var vG=Jt,pG=vG("document","documentElement"),gG=Vt,yG=jl,ob=Cv,mG=ts,bG=pG,$G=LE,wG=Fl,sb=">",ub="<",hf="prototype",cf="script",iS=wG("IE_PROTO"),Bc=function(){},nS=function(i){return ub+cf+sb+i+ub+"/"+cf+sb},lb=function(i){i.write(nS("")),i.close();var r=i.parentWindow.Object;return i=null,r},_G=function(){var i=$G("iframe"),r="java"+cf+":",e;return i.style.display="none",bG.appendChild(i),i.src=String(r),e=i.contentWindow.document,e.open(),e.write(nS("document.F=Object")),e.close(),e.F},Ks,yu=function(){try{Ks=new ActiveXObject("htmlfile")}catch{}yu=typeof document<"u"?document.domain&&Ks?lb(Ks):_G():lb(Ks);for(var i=ob.length;i--;)delete yu[hf][ob[i]];return yu()};mG[iS]=!0;var xa=Object.create||function(r,e){var t;return r!==null?(Bc[hf]=gG(r),t=new Bc,Bc[hf]=null,t[iS]=r):t=yu(),e===void 0?t:yG.f(t,e)},EG=ae,aS=!EG(function(){function i(){}return i.prototype.constructor=null,Object.getPrototypeOf(new i)!==i.prototype}),SG=Qe,OG=Xe,TG=At,IG=Fl,kG=aS,hb=IG("IE_PROTO"),df=Object,PG=df.prototype,Ll=kG?df.getPrototypeOf:function(i){var r=TG(i);if(SG(r,hb))return r[hb];var e=r.constructor;return OG(e)&&r instanceof e?e.prototype:r instanceof df?PG:null},xG=Pa,is=function(i,r,e,t){return t&&t.enumerable?i[r]=e:xG(i,r,e),i},CG=ae,AG=Xe,DG=Ze,RG=xa,cb=Ll,NG=is,MG=xe,ff=MG("iterator"),oS=!1,Cr,Fc,jc;[].keys&&(jc=[].keys(),"next"in jc?(Fc=cb(cb(jc)),Fc!==Object.prototype&&(Cr=Fc)):oS=!0);var BG=!DG(Cr)||CG(function(){var i={};return Cr[ff].call(i)!==i});BG?Cr={}:Cr=RG(Cr);AG(Cr[ff])||NG(Cr,ff,function(){return this});var sS={IteratorPrototype:Cr,BUGGY_SAFARI_ITERATORS:oS},FG=Dv,jG=un,LG=FG?{}.toString:function(){return"[object "+jG(this)+"]"},zG=Dv,HG=Ht.f,VG=Pa,WG=Qe,UG=LG,KG=xe,db=KG("toStringTag"),Ca=function(i,r,e,t){if(i){var n=e?i:i.prototype;WG(n,db)||HG(n,db,{configurable:!0,value:r}),t&&!zG&&VG(n,"toString",UG)}},Aa={},GG=sS.IteratorPrototype,qG=xa,YG=Go,XG=Ca,JG=Aa,ZG=function(){return this},QG=function(i,r,e,t){var n=r+" Iterator";return i.prototype=qG(GG,{next:YG(+!t,e)}),XG(i,n,!1,!0),JG[n]=ZG,i},eq=se,tq=sn,rq=function(i,r,e){try{return eq(tq(Object.getOwnPropertyDescriptor(i,r)[e]))}catch{}},iq=Xe,nq=String,aq=TypeError,oq=function(i){if(typeof i=="object"||iq(i))return i;throw new aq("Can't set "+nq(i)+" as a prototype")},sq=rq,uq=Vt,lq=oq,hq=Object.setPrototypeOf||("__proto__"in{}?function(){var i=!1,r={},e;try{e=sq(Object.prototype,"__proto__","set"),e(r,[]),i=r instanceof Array}catch{}return function(n,a){return uq(n),lq(a),i?e(n,a):n.__proto__=a,n}}():void 0),cq=q,dq=zt,fq=sG,vq=QG,pq=Ll,gq=Ca,fb=is,yq=xe,vb=Aa,mq=sS,bq=fq.PROPER,Gs=mq.BUGGY_SAFARI_ITERATORS,Lc=yq("iterator"),pb="keys",qs="values",gb="entries",$q=function(){return this},Mv=function(i,r,e,t,n,a,o){vq(e,r,t);var s=function(y){if(y===n&&d)return d;if(!Gs&&y&&y in h)return h[y];switch(y){case pb:return function(){return new e(this,y)};case qs:return function(){return new e(this,y)};case gb:return function(){return new e(this,y)}}return function(){return new e(this)}},u=r+" Iterator",l=!1,h=i.prototype,c=h[Lc]||h["@@iterator"]||n&&h[n],d=!Gs&&c||s(n),f=r==="Array"&&h.entries||c,v,p,g;if(f&&(v=pq(f.call(new i)),v!==Object.prototype&&v.next&&(gq(v,u,!0,!0),vb[u]=$q)),bq&&n===qs&&c&&c.name!==qs&&(l=!0,d=function(){return dq(c,this)}),n)if(p={values:s(qs),keys:a?d:s(pb),entries:s(gb)},o)for(g in p)(Gs||l||!(g in h))&&fb(h,g,p[g]);else cq({target:r,proto:!0,forced:Gs||l},p);return o&&h[Lc]!==d&&fb(h,Lc,d,{name:n}),vb[r]=d,p},Bv=function(i,r){return{value:i,done:r}},wq=WK.charAt,_q=Er,uS=ln,Eq=Mv,yb=Bv,lS="String Iterator",Sq=uS.set,Oq=uS.getterFor(lS);Eq(String,"String",function(i){Sq(this,{type:lS,string:_q(i),index:0})},function(){var r=Oq(this),e=r.string,t=r.index,n;return t>=e.length?yb(void 0,!0):(n=wq(e,t),r.index+=n.length,yb(n,!1))});var Tq=zt,mb=Vt,Iq=kv,hS=function(i,r,e){var t,n;mb(i);try{if(t=Iq(i,"return"),!t){if(r==="throw")throw e;return e}t=Tq(t,i)}catch(a){n=!0,t=a}if(r==="throw")throw e;if(n)throw t;return mb(t),e},kq=Vt,Pq=hS,xq=function(i,r,e,t){try{return t?r(kq(e)[0],e[1]):r(e)}catch(n){Pq(i,"throw",n)}},Cq=xe,Aq=Aa,Dq=Cq("iterator"),Rq=Array.prototype,cS=function(i){return i!==void 0&&(Aq.Array===i||Rq[Dq]===i)},Nq=se,Mq=Xe,vf=Pv,Bq=Nq(Function.toString);Mq(vf.inspectSource)||(vf.inspectSource=function(i){return Bq(i)});var Fq=vf.inspectSource,jq=se,Lq=ae,dS=Xe,zq=un,Hq=Jt,Vq=Fq,fS=function(){},Wq=[],vS=Hq("Reflect","construct"),Fv=/^\s*(?:class|function)\b/,Uq=jq(Fv.exec),Kq=!Fv.test(fS),La=function(r){if(!dS(r))return!1;try{return vS(fS,Wq,r),!0}catch{return!1}},pS=function(r){if(!dS(r))return!1;switch(zq(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Kq||!!Uq(Fv,Vq(r))}catch{return!0}};pS.sham=!0;var zl=!vS||Lq(function(){var i;return La(La.call)||!La(Object)||!La(function(){i=!0})||i})?pS:La,Gq=Rl,qq=Ht,Yq=Go,Da=function(i,r,e){var t=Gq(r);t in i?qq.f(i,t,Yq(0,e)):i[t]=e},Xq=un,bb=kv,Jq=Oa,Zq=Aa,Qq=xe,eY=Qq("iterator"),Hl=function(i){if(!Jq(i))return bb(i,eY)||bb(i,"@@iterator")||Zq[Xq(i)]},tY=zt,rY=sn,iY=Vt,nY=Ia,aY=Hl,oY=TypeError,gS=function(i,r){var e=arguments.length<2?aY(i):r;if(rY(e))return iY(tY(e,i));throw new oY(nY(i)+" is not iterable")},sY=Qo,uY=zt,lY=At,hY=xq,cY=cS,dY=zl,fY=Zt,$b=Da,vY=gS,pY=Hl,wb=Array,gY=function(r){var e=lY(r),t=dY(this),n=arguments.length,a=n>1?arguments[1]:void 0,o=a!==void 0;o&&(a=sY(a,n>2?arguments[2]:void 0));var s=pY(e),u=0,l,h,c,d,f,v;if(s&&!(this===wb&&cY(s)))for(d=vY(e,s),f=d.next,h=t?new this:[];!(c=uY(f,d)).done;u++)v=o?hY(d,a,[c.value,u],!0):c.value,$b(h,u,v);else for(l=fY(e),h=t?new this(l):wb(l);l>u;u++)v=o?a(e[u],u):e[u],$b(h,u,v);return h.length=u,h},yY=xe,yS=yY("iterator"),mS=!1;try{var mY=0,_b={next:function(){return{done:!!mY++}},return:function(){mS=!0}};_b[yS]=function(){return this},Array.from(_b,function(){throw 2})}catch{}var bY=function(i,r){try{if(!r&&!mS)return!1}catch{return!1}var e=!1;try{var t={};t[yS]=function(){return{next:function(){return{done:e=!0}}}},i(t)}catch{}return e},$Y=q,wY=gY,_Y=bY,EY=!_Y(function(i){Array.from(i)});$Y({target:"Array",stat:!0,forced:EY},{from:wY});var SY=oe,OY=SY.Array.from,TY=OY,bS=TY,IY=bS,hn=V(IY),kY=_r,Eb=Aa,$S=ln;Ht.f;var PY=Mv,Ys=Bv,wS="Array Iterator",xY=$S.set,CY=$S.getterFor(wS);PY(Array,"Array",function(i,r){xY(this,{type:wS,target:kY(i),index:0,kind:r})},function(){var i=CY(this),r=i.target,e=i.kind,t=i.index++;if(!r||t>=r.length)return i.target=void 0,Ys(void 0,!0);switch(e){case"keys":return Ys(t,!1);case"values":return Ys(r[t],!1)}return Ys([t,r[t]],!1)},"values");Eb.Arguments=Eb.Array;var AY=Hl,DY=AY,RY={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},NY=RY,MY=Pe,BY=un,FY=Pa,Sb=Aa,jY=xe,Ob=jY("toStringTag");for(var zc in NY){var Tb=MY[zc],Hc=Tb&&Tb.prototype;Hc&&BY(Hc)!==Ob&&FY(Hc,Ob,zc),Sb[zc]=Sb.Array}var LY=DY,zY=LY,HY=zY,VY=HY,WY=VY,UY=WY,_S=UY,ES=V(_S),KY=_S,cn=V(KY);function N(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")}var SS={exports:{}},GY=q,qY=Je,Ib=Ht.f;GY({target:"Object",stat:!0,forced:Object.defineProperty!==Ib,sham:!qY},{defineProperty:Ib});var YY=oe,OS=YY.Object,XY=SS.exports=function(r,e,t){return OS.defineProperty(r,e,t)};OS.defineProperty.sham&&(XY.sham=!0);var JY=SS.exports,ZY=JY,TS=ZY,QY=TS,eX=QY,tX=eX,rX=tX,iX=rX,Vl=V(iX),nX=Hr,dn=Array.isArray||function(r){return nX(r)==="Array"},aX=TypeError,oX=9007199254740991,jv=function(i){if(i>oX)throw aX("Maximum allowed index exceeded");return i},kb=dn,sX=zl,uX=Ze,lX=xe,hX=lX("species"),Pb=Array,cX=function(i){var r;return kb(i)&&(r=i.constructor,sX(r)&&(r===Pb||kb(r.prototype))?r=void 0:uX(r)&&(r=r[hX],r===null&&(r=void 0))),r===void 0?Pb:r},dX=cX,Lv=function(i,r){return new(dX(i))(r===0?0:r)},fX=ae,vX=xe,pX=Xo,gX=vX("species"),ns=function(i){return pX>=51||!fX(function(){var r=[],e=r.constructor={};return e[gX]=function(){return{foo:1}},r[i](Boolean).foo!==1})},yX=q,mX=ae,bX=dn,$X=Ze,wX=At,_X=Zt,xb=jv,Cb=Da,EX=Lv,SX=ns,OX=xe,TX=Xo,IS=OX("isConcatSpreadable"),IX=TX>=51||!mX(function(){var i=[];return i[IS]=!1,i.concat()[0]!==i}),kX=function(i){if(!$X(i))return!1;var r=i[IS];return r!==void 0?!!r:bX(i)},PX=!IX||!SX("concat");yX({target:"Array",proto:!0,arity:1,forced:PX},{concat:function(r){var e=wX(this),t=EX(e,0),n=0,a,o,s,u,l;for(a=-1,s=arguments.length;ag;g++)if((s||g in f)&&($=f[g],b=v($,g,d),i))if(r)m[g]=b;else if(b)switch(i){case 3:return!0;case 5:return $;case 6:return g;case 2:Rb(m,$)}else switch(i){case 4:return!1;case 7:Rb(m,$)}return a?-1:t||n?n:m}},wi={forEach:qr(0),map:qr(1),filter:qr(2),some:qr(3),every:qr(4),find:qr(5),findIndex:qr(6),filterReject:qr(7)},Ul=q,Kl=Pe,Hv=zt,rJ=se,ra=Je,ia=Ta,iJ=ae,Ge=Qe,nJ=Be,pf=Vt,Gl=_r,Vv=Rl,aJ=Er,gf=Go,mo=xa,AS=Ml,oJ=as,DS=Wl,sJ=rs,RS=Sa,NS=Ht,uJ=jl,MS=Cl,Nb=is,lJ=zv,Wv=ka,hJ=Fl,BS=ts,Mb=Dl,cJ=xe,dJ=os,fJ=Ce,vJ=CS,pJ=Ca,FS=ln,ql=wi.forEach,Ot=hJ("hidden"),Yl="Symbol",bo="prototype",gJ=FS.set,Bb=FS.getterFor(Yl),or=Object[bo],Fi=Kl.Symbol,Ga=Fi&&Fi[bo],yJ=Kl.RangeError,mJ=Kl.TypeError,Vc=Kl.QObject,jS=RS.f,ji=NS.f,LS=DS.f,bJ=MS.f,zS=rJ([].push),Fr=Wv("symbols"),ss=Wv("op-symbols"),$J=Wv("wks"),yf=!Vc||!Vc[bo]||!Vc[bo].findChild,HS=function(i,r,e){var t=jS(or,r);t&&delete or[r],ji(i,r,e),t&&i!==or&&ji(or,r,t)},mf=ra&&iJ(function(){return mo(ji({},"a",{get:function(){return ji(this,"a",{value:7}).a}})).a!==7})?HS:ji,Wc=function(i,r){var e=Fr[i]=mo(Ga);return gJ(e,{type:Yl,tag:i,description:r}),ra||(e.description=r),e},Xl=function(r,e,t){r===or&&Xl(ss,e,t),pf(r);var n=Vv(e);return pf(t),Ge(Fr,n)?(t.enumerable?(Ge(r,Ot)&&r[Ot][n]&&(r[Ot][n]=!1),t=mo(t,{enumerable:gf(0,!1)})):(Ge(r,Ot)||ji(r,Ot,gf(1,{})),r[Ot][n]=!0),mf(r,n,t)):ji(r,n,t)},Uv=function(r,e){pf(r);var t=Gl(e),n=AS(t).concat(KS(t));return ql(n,function(a){(!ra||Hv(VS,t,a))&&Xl(r,a,t[a])}),r},wJ=function(r,e){return e===void 0?mo(r):Uv(mo(r),e)},VS=function(r){var e=Vv(r),t=Hv(bJ,this,e);return this===or&&Ge(Fr,e)&&!Ge(ss,e)?!1:t||!Ge(this,e)||!Ge(Fr,e)||Ge(this,Ot)&&this[Ot][e]?t:!0},WS=function(r,e){var t=Gl(r),n=Vv(e);if(!(t===or&&Ge(Fr,n)&&!Ge(ss,n))){var a=jS(t,n);return a&&Ge(Fr,n)&&!(Ge(t,Ot)&&t[Ot][n])&&(a.enumerable=!0),a}},US=function(r){var e=LS(Gl(r)),t=[];return ql(e,function(n){!Ge(Fr,n)&&!Ge(BS,n)&&zS(t,n)}),t},KS=function(i){var r=i===or,e=LS(r?ss:Gl(i)),t=[];return ql(e,function(n){Ge(Fr,n)&&(!r||Ge(or,n))&&zS(t,Fr[n])}),t};ia||(Fi=function(){if(nJ(Ga,this))throw new mJ("Symbol is not a constructor");var r=!arguments.length||arguments[0]===void 0?void 0:aJ(arguments[0]),e=Mb(r),t=function(n){this===or&&Hv(t,ss,n),Ge(this,Ot)&&Ge(this[Ot],e)&&(this[Ot][e]=!1);var a=gf(1,n);try{mf(this,e,a)}catch(o){if(!(o instanceof yJ))throw o;HS(this,e,a)}};return ra&&yf&&mf(or,e,{configurable:!0,set:t}),Wc(e,r)},Ga=Fi[bo],Nb(Ga,"toString",function(){return Bb(this).tag}),Nb(Fi,"withoutSetter",function(i){return Wc(Mb(i),i)}),MS.f=VS,NS.f=Xl,uJ.f=Uv,RS.f=WS,oJ.f=DS.f=US,sJ.f=KS,dJ.f=function(i){return Wc(cJ(i),i)},ra&&lJ(Ga,"description",{configurable:!0,get:function(){return Bb(this).description}}));Ul({global:!0,constructor:!0,wrap:!0,forced:!ia,sham:!ia},{Symbol:Fi});ql(AS($J),function(i){fJ(i)});Ul({target:Yl,stat:!0,forced:!ia},{useSetter:function(){yf=!0},useSimple:function(){yf=!1}});Ul({target:"Object",stat:!0,forced:!ia,sham:!ra},{create:wJ,defineProperty:Xl,defineProperties:Uv,getOwnPropertyDescriptor:WS});Ul({target:"Object",stat:!0,forced:!ia},{getOwnPropertyNames:US});vJ();pJ(Fi,Yl);BS[Ot]=!0;var _J=Ta,GS=_J&&!!Symbol.for&&!!Symbol.keyFor,EJ=q,SJ=Jt,OJ=Qe,TJ=Er,qS=ka,IJ=GS,Uc=qS("string-to-symbol-registry"),kJ=qS("symbol-to-string-registry");EJ({target:"Symbol",stat:!0,forced:!IJ},{for:function(i){var r=TJ(i);if(OJ(Uc,r))return Uc[r];var e=SJ("Symbol")(r);return Uc[r]=e,kJ[e]=r,e}});var PJ=q,xJ=Qe,CJ=Jo,AJ=Ia,DJ=ka,RJ=GS,Fb=DJ("symbol-to-string-registry");PJ({target:"Symbol",stat:!0,forced:!RJ},{keyFor:function(r){if(!CJ(r))throw new TypeError(AJ(r)+" is not a symbol");if(xJ(Fb,r))return Fb[r]}});var NJ=se,jb=dn,MJ=Xe,Lb=Hr,BJ=Er,zb=NJ([].push),FJ=function(i){if(MJ(i))return i;if(jb(i)){for(var r=i.length,e=[],t=0;ti.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?arguments[1]:void 0)}});var ute=et,lte=ute("Array").map,hte=Be,cte=lte,Jc=Array.prototype,dte=function(i){var r=i.map;return i===Jc||hte(Jc,i)&&r===Jc.map?cte:r},fte=dte,vte=fte,pte=vte,na=V(pte),gte=q,yte=At,dO=Ml,mte=ae,bte=mte(function(){dO(1)});gte({target:"Object",stat:!0,forced:bte},{keys:function(r){return dO(yte(r))}});var $te=oe,wte=$te.Object.keys,_te=wte,Ete=_te,Ste=Ete,Oe=V(Ste),Ote=q,Tte=se,fO=Date,Ite=Tte(fO.prototype.getTime);Ote({target:"Date",stat:!0},{now:function(){return Ite(new fO)}});var kte=oe,Pte=kte.Date.now,xte=Pte,Cte=xte,Ate=Cte,Uu=V(Ate),Dte=ae,Ra=function(i,r){var e=[][i];return!!e&&Dte(function(){e.call(null,r||function(){return 1},1)})},Rte=wi.forEach,Nte=Ra,Mte=Nte("forEach"),Bte=Mte?[].forEach:function(r){return Rte(this,r,arguments.length>1?arguments[1]:void 0)},Fte=q,n1=Bte;Fte({target:"Array",proto:!0,forced:[].forEach!==n1},{forEach:n1});var jte=et,Lte=jte("Array").forEach,zte=Lte,Hte=zte,Vte=un,Wte=Qe,Ute=Be,Kte=Hte,Zc=Array.prototype,Gte={DOMTokenList:!0,NodeList:!0},qte=function(i){var r=i.forEach;return i===Zc||Ute(Zc,i)&&r===Zc.forEach||Wte(Gte,Vte(i))?Kte:r},Yte=qte,fe=V(Yte),Xte=q,Jte=se,Zte=dn,Qte=Jte([].reverse),a1=[1,2];Xte({target:"Array",proto:!0,forced:String(a1)===String(a1.reverse())},{reverse:function(){return Zte(this)&&(this.length=this.length),Qte(this)}});var ere=et,tre=ere("Array").reverse,rre=Be,ire=tre,Qc=Array.prototype,nre=function(i){var r=i.reverse;return i===Qc||rre(Qc,i)&&r===Qc.reverse?ire:r},are=nre,ore=are,sre=ore,Li=V(sre),o1=Ia,ure=TypeError,vO=function(i,r){if(!delete i[r])throw new ure("Cannot delete property "+o1(r)+" of "+o1(i))},lre=q,hre=At,cre=es,dre=Nl,fre=Zt,vre=uO,pre=jv,gre=Lv,yre=Da,ed=vO,mre=ns,bre=mre("splice"),$re=Math.max,wre=Math.min;lre({target:"Array",proto:!0,forced:!bre},{splice:function(r,e){var t=hre(this),n=fre(t),a=cre(r,n),o=arguments.length,s,u,l,h,c,d;for(o===0?s=u=0:o===1?(s=0,u=n-a):(s=o-2,u=wre($re(dre(e),0),n-a)),pre(n+s-u),l=gre(t,u),h=0;hn-u+s;h--)ed(t,h-1)}else if(s>u)for(h=n-u;h>a;h--)c=h+u-1,d=h+s-1,c in t?t[d]=t[c]:ed(t,d);for(h=0;h1?arguments[1]:void 0)}});var Rre=et,Nre=Rre("Array").includes,Mre=Ze,Bre=Hr,Fre=xe,jre=Fre("match"),Lre=function(i){var r;return Mre(i)&&((r=i[jre])!==void 0?!!r:Bre(i)==="RegExp")},zre=Lre,Hre=TypeError,Vre=function(i){if(zre(i))throw new Hre("The method doesn't accept regular expressions");return i},Wre=xe,Ure=Wre("match"),Kre=function(i){var r=/./;try{"/./"[i](r)}catch{try{return r[Ure]=!1,"/./"[i](r)}catch{}}return!1},Gre=q,qre=se,Yre=Vre,Xre=qo,s1=Er,Jre=Kre,Zre=qre("".indexOf);Gre({target:"String",proto:!0,forced:!Jre("includes")},{includes:function(r){return!!~Zre(s1(Xre(this)),s1(Yre(r)),arguments.length>1?arguments[1]:void 0)}});var Qre=et,eie=Qre("String").includes,u1=Be,tie=Nre,rie=eie,rd=Array.prototype,id=String.prototype,iie=function(i){var r=i.includes;return i===rd||u1(rd,i)&&r===rd.includes?tie:typeof i=="string"||i===id||u1(id,i)&&r===id.includes?rie:r},nie=iie,aie=nie,oie=aie,hi=V(oie),sie=q,uie=ae,lie=At,pO=Ll,hie=aS,cie=uie(function(){pO(1)});sie({target:"Object",stat:!0,forced:cie,sham:!hie},{getPrototypeOf:function(r){return pO(lie(r))}});var die=oe,fie=die.Object.getPrototypeOf,vie=fie,gO=vie,pie=gO,l1=V(pie),gie=q,yie=wi.filter,mie=ns,bie=mie("filter");gie({target:"Array",proto:!0,forced:!bie},{filter:function(r){return yie(this,r,arguments.length>1?arguments[1]:void 0)}});var $ie=et,wie=$ie("Array").filter,_ie=Be,Eie=wie,nd=Array.prototype,Sie=function(i){var r=i.filter;return i===nd||_ie(nd,i)&&r===nd.filter?Eie:r},Oie=Sie,Tie=Oie,Iie=Tie,Tt=V(Iie),qv=` -\v\f\r                 \u2028\u2029\uFEFF`,kie=se,Pie=qo,xie=Er,$f=qv,h1=kie("".replace),Cie=RegExp("^["+$f+"]+"),Aie=RegExp("(^|[^"+$f+"])["+$f+"]+$"),ad=function(i){return function(r){var e=xie(Pie(r));return i&1&&(e=h1(e,Cie,"")),i&2&&(e=h1(e,Aie,"$1")),e}},yO={start:ad(1),end:ad(2),trim:ad(3)},mO=Pe,Die=ae,Rie=se,Nie=Er,Mie=yO.trim,c1=qv,eo=mO.parseInt,d1=mO.Symbol,f1=d1&&d1.iterator,bO=/^[+-]?0x/i,Bie=Rie(bO.exec),Fie=eo(c1+"08")!==8||eo(c1+"0x16")!==22||f1&&!Die(function(){eo(Object(f1))}),jie=Fie?function(r,e){var t=Mie(Nie(r));return eo(t,e>>>0||(Bie(bO,t)?16:10))}:eo,Lie=q,v1=jie;Lie({global:!0,forced:parseInt!==v1},{parseInt:v1});var zie=oe,Hie=zie.parseInt,Vie=Hie,Wie=Vie,Uie=Wie,nr=V(Uie),Kie=q,Gie=Iv,qie=xv.indexOf,Yie=Ra,wf=Gie([].indexOf),$O=!!wf&&1/wf([1],1,-0)<0,Xie=$O||!Yie("indexOf");Kie({target:"Array",proto:!0,forced:Xie},{indexOf:function(r){var e=arguments.length>1?arguments[1]:void 0;return $O?wf(this,r,e)||0:qie(this,r,e)}});var Jie=et,Zie=Jie("Array").indexOf,Qie=Be,ene=Zie,od=Array.prototype,tne=function(i){var r=i.indexOf;return i===od||Qie(od,i)&&r===od.indexOf?ene:r},rne=tne,ine=rne,nne=ine,ne=V(nne),ane=q,one=Je,sne=xa;ane({target:"Object",stat:!0,sham:!one},{create:sne});var une=oe,lne=une.Object,hne=function(r,e){return lne.create(r,e)},cne=hne,wO=cne,dne=wO,zi=V(dne),_f=oe,fne=Ko;_f.JSON||(_f.JSON={stringify:JSON.stringify});var vne=function(r,e,t){return fne(_f.JSON.stringify,null,arguments)},pne=vne,gne=pne,yne=gne,ls=V(yne),mne=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",bne=TypeError,$ne=function(i,r){if(ie,o=_ne(t)?t:Ine(t),s=a?One(arguments,e):[],u=a?function(){wne(o,this,s)}:o;return r?i(u,n):i(u)}:i},Pne=q,SO=Pe,xne=EO,p1=xne(SO.setInterval,!0);Pne({global:!0,bind:!0,forced:SO.setInterval!==p1},{setInterval:p1});var Cne=q,OO=Pe,Ane=EO,g1=Ane(OO.setTimeout,!0);Cne({global:!0,bind:!0,forced:OO.setTimeout!==g1},{setTimeout:g1});var Dne=oe,Rne=Dne.setTimeout,Nne=Rne,mr=V(Nne),Mne=At,y1=es,Bne=Zt,Fne=function(r){for(var e=Mne(this),t=Bne(e),n=arguments.length,a=y1(n>1?arguments[1]:void 0,t),o=n>2?arguments[2]:void 0,s=o===void 0?t:y1(o,t);s>a;)e[a++]=r;return e},jne=q,Lne=Fne;jne({target:"Array",proto:!0},{fill:Lne});var zne=et,Hne=zne("Array").fill,Vne=Be,Wne=Hne,sd=Array.prototype,Une=function(i){var r=i.fill;return i===sd||Vne(sd,i)&&r===sd.fill?Wne:r},Kne=Une,Gne=Kne,qne=Gne,hs=V(qne);/*! Hammer.JS - v2.0.17-rc - 2019-12-16 + */var mc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function V(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Hs=function(i){return i&&i.Math===Math&&i},Pe=Hs(typeof globalThis=="object"&&globalThis)||Hs(typeof window=="object"&&window)||Hs(typeof self=="object"&&self)||Hs(typeof mc=="object"&&mc)||function(){return this}()||mc||Function("return this")(),ae=function(i){try{return!!i()}catch{return!0}},mW=ae,Uo=!mW(function(){var i=function(){}.bind();return typeof i!="function"||i.hasOwnProperty("prototype")}),bW=Uo,kE=Function.prototype,Im=kE.apply,km=kE.call,Ko=typeof Reflect=="object"&&Reflect.apply||(bW?km.bind(Im):function(){return km.apply(Im,arguments)}),PE=Uo,xE=Function.prototype,nf=xE.call,$W=PE&&xE.bind.bind(nf,nf),se=PE?$W:function(i){return function(){return nf.apply(i,arguments)}},CE=se,wW=CE({}.toString),_W=CE("".slice),Hr=function(i){return _W(wW(i),8,-1)},EW=Hr,SW=se,Iv=function(i){if(EW(i)==="Function")return SW(i)},af=typeof document=="object"&&document.all,OW=typeof af>"u"&&af!==void 0,AE={all:af,IS_HTMLDDA:OW},DE=AE,TW=DE.all,Xe=DE.IS_HTMLDDA?function(i){return typeof i=="function"||i===TW}:function(i){return typeof i=="function"},Sa={},IW=ae,Je=!IW(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),kW=Uo,Vs=Function.prototype.call,zt=kW?Vs.bind(Vs):function(){return Vs.apply(Vs,arguments)},Cl={},RE={}.propertyIsEnumerable,NE=Object.getOwnPropertyDescriptor,PW=NE&&!RE.call({1:2},1);Cl.f=PW?function(r){var e=NE(this,r);return!!e&&e.enumerable}:RE;var Go=function(i,r){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:r}},xW=se,CW=ae,AW=Hr,bc=Object,DW=xW("".split),Al=CW(function(){return!bc("z").propertyIsEnumerable(0)})?function(i){return AW(i)==="String"?DW(i,""):bc(i)}:bc,Oa=function(i){return i==null},RW=Oa,NW=TypeError,qo=function(i){if(RW(i))throw new NW("Can't call method on "+i);return i},MW=Al,BW=qo,_r=function(i){return MW(BW(i))},Pm=Xe,ME=AE,FW=ME.all,Ze=ME.IS_HTMLDDA?function(i){return typeof i=="object"?i!==null:Pm(i)||i===FW}:function(i){return typeof i=="object"?i!==null:Pm(i)},oe={},$c=oe,wc=Pe,jW=Xe,xm=function(i){return jW(i)?i:void 0},Jt=function(i,r){return arguments.length<2?xm($c[i])||xm(wc[i]):$c[i]&&$c[i][r]||wc[i]&&wc[i][r]},LW=se,Be=LW({}.isPrototypeOf),Yo=typeof navigator<"u"&&String(navigator.userAgent)||"",BE=Pe,_c=Yo,Cm=BE.process,Am=BE.Deno,Dm=Cm&&Cm.versions||Am&&Am.version,Rm=Dm&&Dm.v8,ir,zu;Rm&&(ir=Rm.split("."),zu=ir[0]>0&&ir[0]<4?1:+(ir[0]+ir[1]));!zu&&_c&&(ir=_c.match(/Edge\/(\d+)/),(!ir||ir[1]>=74)&&(ir=_c.match(/Chrome\/(\d+)/),ir&&(zu=+ir[1])));var Xo=zu,Nm=Xo,zW=ae,HW=Pe,VW=HW.String,Ta=!!Object.getOwnPropertySymbols&&!zW(function(){var i=Symbol("symbol detection");return!VW(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&Nm&&Nm<41}),WW=Ta,FE=WW&&!Symbol.sham&&typeof Symbol.iterator=="symbol",UW=Jt,KW=Xe,GW=Be,qW=FE,YW=Object,Jo=qW?function(i){return typeof i=="symbol"}:function(i){var r=UW("Symbol");return KW(r)&&GW(r.prototype,YW(i))},XW=String,Ia=function(i){try{return XW(i)}catch{return"Object"}},JW=Xe,ZW=Ia,QW=TypeError,sn=function(i){if(JW(i))return i;throw new QW(ZW(i)+" is not a function")},e9=sn,t9=Oa,kv=function(i,r){var e=i[r];return t9(e)?void 0:e9(e)},Ec=zt,Sc=Xe,Oc=Ze,r9=TypeError,i9=function(i,r){var e,t;if(r==="string"&&Sc(e=i.toString)&&!Oc(t=Ec(e,i))||Sc(e=i.valueOf)&&!Oc(t=Ec(e,i))||r!=="string"&&Sc(e=i.toString)&&!Oc(t=Ec(e,i)))return t;throw new r9("Can't convert object to primitive value")},jE={exports:{}},Mm=Pe,n9=Object.defineProperty,a9=function(i,r){try{n9(Mm,i,{value:r,configurable:!0,writable:!0})}catch{Mm[i]=r}return r},o9=Pe,s9=a9,Bm="__core-js_shared__",u9=o9[Bm]||s9(Bm,{}),Pv=u9,Fm=Pv;(jE.exports=function(i,r){return Fm[i]||(Fm[i]=r!==void 0?r:{})})("versions",[]).push({version:"3.33.0",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ka=jE.exports,l9=qo,h9=Object,At=function(i){return h9(l9(i))},c9=se,d9=At,f9=c9({}.hasOwnProperty),Qe=Object.hasOwn||function(r,e){return f9(d9(r),e)},v9=se,p9=0,g9=Math.random(),y9=v9(1 .toString),Dl=function(i){return"Symbol("+(i===void 0?"":i)+")_"+y9(++p9+g9,36)},m9=Pe,b9=ka,jm=Qe,$9=Dl,w9=Ta,_9=FE,Ln=m9.Symbol,Tc=b9("wks"),E9=_9?Ln.for||Ln:Ln&&Ln.withoutSetter||$9,xe=function(i){return jm(Tc,i)||(Tc[i]=w9&&jm(Ln,i)?Ln[i]:E9("Symbol."+i)),Tc[i]},S9=zt,Lm=Ze,zm=Jo,O9=kv,T9=i9,I9=xe,k9=TypeError,P9=I9("toPrimitive"),x9=function(i,r){if(!Lm(i)||zm(i))return i;var e=O9(i,P9),t;if(e){if(r===void 0&&(r="default"),t=S9(e,i,r),!Lm(t)||zm(t))return t;throw new k9("Can't convert object to primitive value")}return r===void 0&&(r="number"),T9(i,r)},C9=x9,A9=Jo,Rl=function(i){var r=C9(i,"string");return A9(r)?r:r+""},D9=Pe,Hm=Ze,of=D9.document,R9=Hm(of)&&Hm(of.createElement),LE=function(i){return R9?of.createElement(i):{}},N9=Je,M9=ae,B9=LE,zE=!N9&&!M9(function(){return Object.defineProperty(B9("div"),"a",{get:function(){return 7}}).a!==7}),F9=Je,j9=zt,L9=Cl,z9=Go,H9=_r,V9=Rl,W9=Qe,U9=zE,Vm=Object.getOwnPropertyDescriptor;Sa.f=F9?Vm:function(r,e){if(r=H9(r),e=V9(e),U9)try{return Vm(r,e)}catch{}if(W9(r,e))return z9(!j9(L9.f,r,e),r[e])};var K9=ae,G9=Xe,q9=/#|\.prototype\./,Zo=function(i,r){var e=X9[Y9(i)];return e===Z9?!0:e===J9?!1:G9(r)?K9(r):!!r},Y9=Zo.normalize=function(i){return String(i).replace(q9,".").toLowerCase()},X9=Zo.data={},J9=Zo.NATIVE="N",Z9=Zo.POLYFILL="P",Q9=Zo,Wm=Iv,eU=sn,tU=Uo,rU=Wm(Wm.bind),Qo=function(i,r){return eU(i),r===void 0?i:tU?rU(i,r):function(){return i.apply(r,arguments)}},Ht={},iU=Je,nU=ae,HE=iU&&nU(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),aU=Ze,oU=String,sU=TypeError,Vt=function(i){if(aU(i))return i;throw new sU(oU(i)+" is not an object")},uU=Je,lU=zE,hU=HE,Ws=Vt,Um=Rl,cU=TypeError,Ic=Object.defineProperty,dU=Object.getOwnPropertyDescriptor,kc="enumerable",Pc="configurable",xc="writable";Ht.f=uU?hU?function(r,e,t){if(Ws(r),e=Um(e),Ws(t),typeof r=="function"&&e==="prototype"&&"value"in t&&xc in t&&!t[xc]){var n=dU(r,e);n&&n[xc]&&(r[e]=t.value,t={configurable:Pc in t?t[Pc]:n[Pc],enumerable:kc in t?t[kc]:n[kc],writable:!1})}return Ic(r,e,t)}:Ic:function(r,e,t){if(Ws(r),e=Um(e),Ws(t),lU)try{return Ic(r,e,t)}catch{}if("get"in t||"set"in t)throw new cU("Accessors not supported");return"value"in t&&(r[e]=t.value),r};var fU=Je,vU=Ht,pU=Go,Pa=fU?function(i,r,e){return vU.f(i,r,pU(1,e))}:function(i,r,e){return i[r]=e,i},Us=Pe,gU=Ko,yU=Iv,mU=Xe,bU=Sa.f,$U=Q9,Sn=oe,wU=Qo,On=Pa,Km=Qe,_U=function(i){var r=function(e,t,n){if(this instanceof r){switch(arguments.length){case 0:return new i;case 1:return new i(e);case 2:return new i(e,t)}return new i(e,t,n)}return gU(i,this,arguments)};return r.prototype=i.prototype,r},q=function(i,r){var e=i.target,t=i.global,n=i.stat,a=i.proto,o=t?Us:n?Us[e]:(Us[e]||{}).prototype,s=t?Sn:Sn[e]||On(Sn,e,{})[e],u=s.prototype,l,h,c,d,f,v,p,g,y;for(d in r)l=$U(t?d:e+(n?".":"#")+d,i.forced),h=!l&&o&&Km(o,d),v=s[d],h&&(i.dontCallGetSet?(y=bU(o,d),p=y&&y.value):p=o[d]),f=h&&p?p:r[d],!(h&&typeof v==typeof f)&&(i.bind&&h?g=wU(f,Us):i.wrap&&h?g=_U(f):a&&mU(f)?g=yU(f):g=f,(i.sham||f&&f.sham||v&&v.sham)&&On(g,"sham",!0),On(s,d,g),a&&(c=e+"Prototype",Km(Sn,c)||On(Sn,c,{}),On(Sn[c],d,f),i.real&&u&&(l||!u[d])&&On(u,d,f)))},EU=Math.ceil,SU=Math.floor,OU=Math.trunc||function(r){var e=+r;return(e>0?SU:EU)(e)},TU=OU,Nl=function(i){var r=+i;return r!==r||r===0?0:TU(r)},IU=Nl,kU=Math.max,PU=Math.min,es=function(i,r){var e=IU(i);return e<0?kU(e+r,0):PU(e,r)},xU=Nl,CU=Math.min,AU=function(i){return i>0?CU(xU(i),9007199254740991):0},DU=AU,Zt=function(i){return DU(i.length)},RU=_r,NU=es,MU=Zt,Gm=function(i){return function(r,e,t){var n=RU(r),a=MU(n),o=NU(t,a),s;if(i&&e!==e){for(;a>o;)if(s=n[o++],s!==s)return!0}else for(;a>o;o++)if((i||o in n)&&n[o]===e)return i||o||0;return!i&&-1}},xv={includes:Gm(!0),indexOf:Gm(!1)},ts={},BU=se,Cc=Qe,FU=_r,jU=xv.indexOf,LU=ts,qm=BU([].push),VE=function(i,r){var e=FU(i),t=0,n=[],a;for(a in e)!Cc(LU,a)&&Cc(e,a)&&qm(n,a);for(;r.length>t;)Cc(e,a=r[t++])&&(~jU(n,a)||qm(n,a));return n},Cv=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],zU=VE,HU=Cv,Ml=Object.keys||function(r){return zU(r,HU)},rs={};rs.f=Object.getOwnPropertySymbols;var Ym=Je,VU=se,WU=zt,UU=ae,Ac=Ml,KU=rs,GU=Cl,qU=At,YU=Al,Tn=Object.assign,Xm=Object.defineProperty,XU=VU([].concat),JU=!Tn||UU(function(){if(Ym&&Tn({b:1},Tn(Xm({},"a",{enumerable:!0,get:function(){Xm(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var i={},r={},e=Symbol("assign detection"),t="abcdefghijklmnopqrst";return i[e]=7,t.split("").forEach(function(n){r[n]=n}),Tn({},i)[e]!==7||Ac(Tn({},r)).join("")!==t})?function(r,e){for(var t=qU(r),n=arguments.length,a=1,o=KU.f,s=GU.f;n>a;)for(var u=YU(arguments[a++]),l=o?XU(Ac(u),o(u)):Ac(u),h=l.length,c=0,d;h>c;)d=l[c++],(!Ym||WU(s,u,d))&&(t[d]=u[d]);return t}:Tn,ZU=q,Jm=JU;ZU({target:"Object",stat:!0,arity:2,forced:Object.assign!==Jm},{assign:Jm});var QU=oe,eK=QU.Object.assign,tK=eK,rK=tK,iK=rK,Le=V(iK),nK=se,Bl=nK([].slice),WE=se,aK=sn,oK=Ze,sK=Qe,Zm=Bl,uK=Uo,UE=Function,lK=WE([].concat),hK=WE([].join),Dc={},cK=function(i,r,e){if(!sK(Dc,r)){for(var t=[],n=0;n=.1;)v=+a[c++%o],v>h&&(v=h),f=Math.sqrt(v*v/(1+l*l)),f=s<0?-f:f,r+=f,e+=l*f,d===!0?i.lineTo(r,e):i.moveTo(r,e),h-=v,d=!d}function TK(i,r,e,t){i.beginPath();var n=6,a=Math.PI*2/n;i.moveTo(r+t,e);for(var o=1;o1?e-1:0),n=1;n=a?i?"":void 0:(o=tb(t,n),o<55296||o>56319||n+1===a||(s=tb(t,n+1))<56320||s>57343?i?VK(t,n):o:i?WK(t,n,n+2):(o-55296<<10)+(s-56320)+65536)}},UK={codeAt:rb(!1),charAt:rb(!0)},KK=Pe,GK=Xe,ib=KK.WeakMap,eS=GK(ib)&&/native code/.test(String(ib)),qK=ka,YK=Dl,nb=qK("keys"),Fl=function(i){return nb[i]||(nb[i]=YK(i))},XK=eS,tS=Pe,JK=Ze,ZK=Pa,Nc=Qe,Mc=Pv,QK=Fl,eG=ts,ab="Object already initialized",uf=tS.TypeError,tG=tS.WeakMap,Hu,yo,Vu,rG=function(i){return Vu(i)?yo(i):Hu(i,{})},iG=function(i){return function(r){var e;if(!JK(r)||(e=yo(r)).type!==i)throw new uf("Incompatible receiver, "+i+" required");return e}};if(XK||Mc.state){var cr=Mc.state||(Mc.state=new tG);cr.get=cr.get,cr.has=cr.has,cr.set=cr.set,Hu=function(i,r){if(cr.has(i))throw new uf(ab);return r.facade=i,cr.set(i,r),r},yo=function(i){return cr.get(i)||{}},Vu=function(i){return cr.has(i)}}else{var In=QK("state");eG[In]=!0,Hu=function(i,r){if(Nc(i,In))throw new uf(ab);return r.facade=i,ZK(i,In,r),r},yo=function(i){return Nc(i,In)?i[In]:{}},Vu=function(i){return Nc(i,In)}}var ln={set:Hu,get:yo,has:Vu,enforce:rG,getterFor:iG},lf=Je,nG=Qe,rS=Function.prototype,aG=lf&&Object.getOwnPropertyDescriptor,Nv=nG(rS,"name"),oG=Nv&&function(){}.name==="something",sG=Nv&&(!lf||lf&&aG(rS,"name").configurable),uG={EXISTS:Nv,PROPER:oG,CONFIGURABLE:sG},jl={},lG=Je,hG=HE,cG=Ht,dG=Vt,fG=_r,vG=Ml;jl.f=lG&&!hG?Object.defineProperties:function(r,e){dG(r);for(var t=fG(e),n=vG(e),a=n.length,o=0,s;a>o;)cG.f(r,s=n[o++],t[s]);return r};var pG=Jt,gG=pG("document","documentElement"),yG=Vt,mG=jl,ob=Cv,bG=ts,$G=gG,wG=LE,_G=Fl,sb=">",ub="<",hf="prototype",cf="script",iS=_G("IE_PROTO"),Bc=function(){},nS=function(i){return ub+cf+sb+i+ub+"/"+cf+sb},lb=function(i){i.write(nS("")),i.close();var r=i.parentWindow.Object;return i=null,r},EG=function(){var i=wG("iframe"),r="java"+cf+":",e;return i.style.display="none",$G.appendChild(i),i.src=String(r),e=i.contentWindow.document,e.open(),e.write(nS("document.F=Object")),e.close(),e.F},Ks,yu=function(){try{Ks=new ActiveXObject("htmlfile")}catch{}yu=typeof document<"u"?document.domain&&Ks?lb(Ks):EG():lb(Ks);for(var i=ob.length;i--;)delete yu[hf][ob[i]];return yu()};bG[iS]=!0;var xa=Object.create||function(r,e){var t;return r!==null?(Bc[hf]=yG(r),t=new Bc,Bc[hf]=null,t[iS]=r):t=yu(),e===void 0?t:mG.f(t,e)},SG=ae,aS=!SG(function(){function i(){}return i.prototype.constructor=null,Object.getPrototypeOf(new i)!==i.prototype}),OG=Qe,TG=Xe,IG=At,kG=Fl,PG=aS,hb=kG("IE_PROTO"),df=Object,xG=df.prototype,Ll=PG?df.getPrototypeOf:function(i){var r=IG(i);if(OG(r,hb))return r[hb];var e=r.constructor;return TG(e)&&r instanceof e?e.prototype:r instanceof df?xG:null},CG=Pa,is=function(i,r,e,t){return t&&t.enumerable?i[r]=e:CG(i,r,e),i},AG=ae,DG=Xe,RG=Ze,NG=xa,cb=Ll,MG=is,BG=xe,ff=BG("iterator"),oS=!1,Cr,Fc,jc;[].keys&&(jc=[].keys(),"next"in jc?(Fc=cb(cb(jc)),Fc!==Object.prototype&&(Cr=Fc)):oS=!0);var FG=!RG(Cr)||AG(function(){var i={};return Cr[ff].call(i)!==i});FG?Cr={}:Cr=NG(Cr);DG(Cr[ff])||MG(Cr,ff,function(){return this});var sS={IteratorPrototype:Cr,BUGGY_SAFARI_ITERATORS:oS},jG=Dv,LG=un,zG=jG?{}.toString:function(){return"[object "+LG(this)+"]"},HG=Dv,VG=Ht.f,WG=Pa,UG=Qe,KG=zG,GG=xe,db=GG("toStringTag"),Ca=function(i,r,e,t){if(i){var n=e?i:i.prototype;UG(n,db)||VG(n,db,{configurable:!0,value:r}),t&&!HG&&WG(n,"toString",KG)}},Aa={},qG=sS.IteratorPrototype,YG=xa,XG=Go,JG=Ca,ZG=Aa,QG=function(){return this},eq=function(i,r,e,t){var n=r+" Iterator";return i.prototype=YG(qG,{next:XG(+!t,e)}),JG(i,n,!1,!0),ZG[n]=QG,i},tq=se,rq=sn,iq=function(i,r,e){try{return tq(rq(Object.getOwnPropertyDescriptor(i,r)[e]))}catch{}},nq=Xe,aq=String,oq=TypeError,sq=function(i){if(typeof i=="object"||nq(i))return i;throw new oq("Can't set "+aq(i)+" as a prototype")},uq=iq,lq=Vt,hq=sq,cq=Object.setPrototypeOf||("__proto__"in{}?function(){var i=!1,r={},e;try{e=uq(Object.prototype,"__proto__","set"),e(r,[]),i=r instanceof Array}catch{}return function(n,a){return lq(n),hq(a),i?e(n,a):n.__proto__=a,n}}():void 0),dq=q,fq=zt,vq=uG,pq=eq,gq=Ll,yq=Ca,fb=is,mq=xe,vb=Aa,bq=sS,$q=vq.PROPER,Gs=bq.BUGGY_SAFARI_ITERATORS,Lc=mq("iterator"),pb="keys",qs="values",gb="entries",wq=function(){return this},Mv=function(i,r,e,t,n,a,o){pq(e,r,t);var s=function(y){if(y===n&&d)return d;if(!Gs&&y&&y in h)return h[y];switch(y){case pb:return function(){return new e(this,y)};case qs:return function(){return new e(this,y)};case gb:return function(){return new e(this,y)}}return function(){return new e(this)}},u=r+" Iterator",l=!1,h=i.prototype,c=h[Lc]||h["@@iterator"]||n&&h[n],d=!Gs&&c||s(n),f=r==="Array"&&h.entries||c,v,p,g;if(f&&(v=gq(f.call(new i)),v!==Object.prototype&&v.next&&(yq(v,u,!0,!0),vb[u]=wq)),$q&&n===qs&&c&&c.name!==qs&&(l=!0,d=function(){return fq(c,this)}),n)if(p={values:s(qs),keys:a?d:s(pb),entries:s(gb)},o)for(g in p)(Gs||l||!(g in h))&&fb(h,g,p[g]);else dq({target:r,proto:!0,forced:Gs||l},p);return o&&h[Lc]!==d&&fb(h,Lc,d,{name:n}),vb[r]=d,p},Bv=function(i,r){return{value:i,done:r}},_q=UK.charAt,Eq=Er,uS=ln,Sq=Mv,yb=Bv,lS="String Iterator",Oq=uS.set,Tq=uS.getterFor(lS);Sq(String,"String",function(i){Oq(this,{type:lS,string:Eq(i),index:0})},function(){var r=Tq(this),e=r.string,t=r.index,n;return t>=e.length?yb(void 0,!0):(n=_q(e,t),r.index+=n.length,yb(n,!1))});var Iq=zt,mb=Vt,kq=kv,hS=function(i,r,e){var t,n;mb(i);try{if(t=kq(i,"return"),!t){if(r==="throw")throw e;return e}t=Iq(t,i)}catch(a){n=!0,t=a}if(r==="throw")throw e;if(n)throw t;return mb(t),e},Pq=Vt,xq=hS,Cq=function(i,r,e,t){try{return t?r(Pq(e)[0],e[1]):r(e)}catch(n){xq(i,"throw",n)}},Aq=xe,Dq=Aa,Rq=Aq("iterator"),Nq=Array.prototype,cS=function(i){return i!==void 0&&(Dq.Array===i||Nq[Rq]===i)},Mq=se,Bq=Xe,vf=Pv,Fq=Mq(Function.toString);Bq(vf.inspectSource)||(vf.inspectSource=function(i){return Fq(i)});var jq=vf.inspectSource,Lq=se,zq=ae,dS=Xe,Hq=un,Vq=Jt,Wq=jq,fS=function(){},Uq=[],vS=Vq("Reflect","construct"),Fv=/^\s*(?:class|function)\b/,Kq=Lq(Fv.exec),Gq=!Fv.test(fS),La=function(r){if(!dS(r))return!1;try{return vS(fS,Uq,r),!0}catch{return!1}},pS=function(r){if(!dS(r))return!1;switch(Hq(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Gq||!!Kq(Fv,Wq(r))}catch{return!0}};pS.sham=!0;var zl=!vS||zq(function(){var i;return La(La.call)||!La(Object)||!La(function(){i=!0})||i})?pS:La,qq=Rl,Yq=Ht,Xq=Go,Da=function(i,r,e){var t=qq(r);t in i?Yq.f(i,t,Xq(0,e)):i[t]=e},Jq=un,bb=kv,Zq=Oa,Qq=Aa,eY=xe,tY=eY("iterator"),Hl=function(i){if(!Zq(i))return bb(i,tY)||bb(i,"@@iterator")||Qq[Jq(i)]},rY=zt,iY=sn,nY=Vt,aY=Ia,oY=Hl,sY=TypeError,gS=function(i,r){var e=arguments.length<2?oY(i):r;if(iY(e))return nY(rY(e,i));throw new sY(aY(i)+" is not iterable")},uY=Qo,lY=zt,hY=At,cY=Cq,dY=cS,fY=zl,vY=Zt,$b=Da,pY=gS,gY=Hl,wb=Array,yY=function(r){var e=hY(r),t=fY(this),n=arguments.length,a=n>1?arguments[1]:void 0,o=a!==void 0;o&&(a=uY(a,n>2?arguments[2]:void 0));var s=gY(e),u=0,l,h,c,d,f,v;if(s&&!(this===wb&&dY(s)))for(d=pY(e,s),f=d.next,h=t?new this:[];!(c=lY(f,d)).done;u++)v=o?cY(d,a,[c.value,u],!0):c.value,$b(h,u,v);else for(l=vY(e),h=t?new this(l):wb(l);l>u;u++)v=o?a(e[u],u):e[u],$b(h,u,v);return h.length=u,h},mY=xe,yS=mY("iterator"),mS=!1;try{var bY=0,_b={next:function(){return{done:!!bY++}},return:function(){mS=!0}};_b[yS]=function(){return this},Array.from(_b,function(){throw 2})}catch{}var $Y=function(i,r){try{if(!r&&!mS)return!1}catch{return!1}var e=!1;try{var t={};t[yS]=function(){return{next:function(){return{done:e=!0}}}},i(t)}catch{}return e},wY=q,_Y=yY,EY=$Y,SY=!EY(function(i){Array.from(i)});wY({target:"Array",stat:!0,forced:SY},{from:_Y});var OY=oe,TY=OY.Array.from,IY=TY,bS=IY,kY=bS,hn=V(kY),PY=_r,Eb=Aa,$S=ln;Ht.f;var xY=Mv,Ys=Bv,wS="Array Iterator",CY=$S.set,AY=$S.getterFor(wS);xY(Array,"Array",function(i,r){CY(this,{type:wS,target:PY(i),index:0,kind:r})},function(){var i=AY(this),r=i.target,e=i.kind,t=i.index++;if(!r||t>=r.length)return i.target=void 0,Ys(void 0,!0);switch(e){case"keys":return Ys(t,!1);case"values":return Ys(r[t],!1)}return Ys([t,r[t]],!1)},"values");Eb.Arguments=Eb.Array;var DY=Hl,RY=DY,NY={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},MY=NY,BY=Pe,FY=un,jY=Pa,Sb=Aa,LY=xe,Ob=LY("toStringTag");for(var zc in MY){var Tb=BY[zc],Hc=Tb&&Tb.prototype;Hc&&FY(Hc)!==Ob&&jY(Hc,Ob,zc),Sb[zc]=Sb.Array}var zY=RY,HY=zY,VY=HY,WY=VY,UY=WY,KY=UY,_S=KY,ES=V(_S),GY=_S,cn=V(GY);function N(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")}var SS={exports:{}},qY=q,YY=Je,Ib=Ht.f;qY({target:"Object",stat:!0,forced:Object.defineProperty!==Ib,sham:!YY},{defineProperty:Ib});var XY=oe,OS=XY.Object,JY=SS.exports=function(r,e,t){return OS.defineProperty(r,e,t)};OS.defineProperty.sham&&(JY.sham=!0);var ZY=SS.exports,QY=ZY,TS=QY,eX=TS,tX=eX,rX=tX,iX=rX,nX=iX,Vl=V(nX),aX=Hr,dn=Array.isArray||function(r){return aX(r)==="Array"},oX=TypeError,sX=9007199254740991,jv=function(i){if(i>sX)throw oX("Maximum allowed index exceeded");return i},kb=dn,uX=zl,lX=Ze,hX=xe,cX=hX("species"),Pb=Array,dX=function(i){var r;return kb(i)&&(r=i.constructor,uX(r)&&(r===Pb||kb(r.prototype))?r=void 0:lX(r)&&(r=r[cX],r===null&&(r=void 0))),r===void 0?Pb:r},fX=dX,Lv=function(i,r){return new(fX(i))(r===0?0:r)},vX=ae,pX=xe,gX=Xo,yX=pX("species"),ns=function(i){return gX>=51||!vX(function(){var r=[],e=r.constructor={};return e[yX]=function(){return{foo:1}},r[i](Boolean).foo!==1})},mX=q,bX=ae,$X=dn,wX=Ze,_X=At,EX=Zt,xb=jv,Cb=Da,SX=Lv,OX=ns,TX=xe,IX=Xo,IS=TX("isConcatSpreadable"),kX=IX>=51||!bX(function(){var i=[];return i[IS]=!1,i.concat()[0]!==i}),PX=function(i){if(!wX(i))return!1;var r=i[IS];return r!==void 0?!!r:$X(i)},xX=!kX||!OX("concat");mX({target:"Array",proto:!0,arity:1,forced:xX},{concat:function(r){var e=_X(this),t=SX(e,0),n=0,a,o,s,u,l;for(a=-1,s=arguments.length;ag;g++)if((s||g in f)&&($=f[g],b=v($,g,d),i))if(r)m[g]=b;else if(b)switch(i){case 3:return!0;case 5:return $;case 6:return g;case 2:Rb(m,$)}else switch(i){case 4:return!1;case 7:Rb(m,$)}return a?-1:t||n?n:m}},wi={forEach:qr(0),map:qr(1),filter:qr(2),some:qr(3),every:qr(4),find:qr(5),findIndex:qr(6),filterReject:qr(7)},Ul=q,Kl=Pe,Hv=zt,iJ=se,ra=Je,ia=Ta,nJ=ae,Ge=Qe,aJ=Be,pf=Vt,Gl=_r,Vv=Rl,oJ=Er,gf=Go,mo=xa,AS=Ml,sJ=as,DS=Wl,uJ=rs,RS=Sa,NS=Ht,lJ=jl,MS=Cl,Nb=is,hJ=zv,Wv=ka,cJ=Fl,BS=ts,Mb=Dl,dJ=xe,fJ=os,vJ=Ce,pJ=CS,gJ=Ca,FS=ln,ql=wi.forEach,Ot=cJ("hidden"),Yl="Symbol",bo="prototype",yJ=FS.set,Bb=FS.getterFor(Yl),or=Object[bo],Fi=Kl.Symbol,Ga=Fi&&Fi[bo],mJ=Kl.RangeError,bJ=Kl.TypeError,Vc=Kl.QObject,jS=RS.f,ji=NS.f,LS=DS.f,$J=MS.f,zS=iJ([].push),Fr=Wv("symbols"),ss=Wv("op-symbols"),wJ=Wv("wks"),yf=!Vc||!Vc[bo]||!Vc[bo].findChild,HS=function(i,r,e){var t=jS(or,r);t&&delete or[r],ji(i,r,e),t&&i!==or&&ji(or,r,t)},mf=ra&&nJ(function(){return mo(ji({},"a",{get:function(){return ji(this,"a",{value:7}).a}})).a!==7})?HS:ji,Wc=function(i,r){var e=Fr[i]=mo(Ga);return yJ(e,{type:Yl,tag:i,description:r}),ra||(e.description=r),e},Xl=function(r,e,t){r===or&&Xl(ss,e,t),pf(r);var n=Vv(e);return pf(t),Ge(Fr,n)?(t.enumerable?(Ge(r,Ot)&&r[Ot][n]&&(r[Ot][n]=!1),t=mo(t,{enumerable:gf(0,!1)})):(Ge(r,Ot)||ji(r,Ot,gf(1,{})),r[Ot][n]=!0),mf(r,n,t)):ji(r,n,t)},Uv=function(r,e){pf(r);var t=Gl(e),n=AS(t).concat(KS(t));return ql(n,function(a){(!ra||Hv(VS,t,a))&&Xl(r,a,t[a])}),r},_J=function(r,e){return e===void 0?mo(r):Uv(mo(r),e)},VS=function(r){var e=Vv(r),t=Hv($J,this,e);return this===or&&Ge(Fr,e)&&!Ge(ss,e)?!1:t||!Ge(this,e)||!Ge(Fr,e)||Ge(this,Ot)&&this[Ot][e]?t:!0},WS=function(r,e){var t=Gl(r),n=Vv(e);if(!(t===or&&Ge(Fr,n)&&!Ge(ss,n))){var a=jS(t,n);return a&&Ge(Fr,n)&&!(Ge(t,Ot)&&t[Ot][n])&&(a.enumerable=!0),a}},US=function(r){var e=LS(Gl(r)),t=[];return ql(e,function(n){!Ge(Fr,n)&&!Ge(BS,n)&&zS(t,n)}),t},KS=function(i){var r=i===or,e=LS(r?ss:Gl(i)),t=[];return ql(e,function(n){Ge(Fr,n)&&(!r||Ge(or,n))&&zS(t,Fr[n])}),t};ia||(Fi=function(){if(aJ(Ga,this))throw new bJ("Symbol is not a constructor");var r=!arguments.length||arguments[0]===void 0?void 0:oJ(arguments[0]),e=Mb(r),t=function(n){this===or&&Hv(t,ss,n),Ge(this,Ot)&&Ge(this[Ot],e)&&(this[Ot][e]=!1);var a=gf(1,n);try{mf(this,e,a)}catch(o){if(!(o instanceof mJ))throw o;HS(this,e,a)}};return ra&&yf&&mf(or,e,{configurable:!0,set:t}),Wc(e,r)},Ga=Fi[bo],Nb(Ga,"toString",function(){return Bb(this).tag}),Nb(Fi,"withoutSetter",function(i){return Wc(Mb(i),i)}),MS.f=VS,NS.f=Xl,lJ.f=Uv,RS.f=WS,sJ.f=DS.f=US,uJ.f=KS,fJ.f=function(i){return Wc(dJ(i),i)},ra&&hJ(Ga,"description",{configurable:!0,get:function(){return Bb(this).description}}));Ul({global:!0,constructor:!0,wrap:!0,forced:!ia,sham:!ia},{Symbol:Fi});ql(AS(wJ),function(i){vJ(i)});Ul({target:Yl,stat:!0,forced:!ia},{useSetter:function(){yf=!0},useSimple:function(){yf=!1}});Ul({target:"Object",stat:!0,forced:!ia,sham:!ra},{create:_J,defineProperty:Xl,defineProperties:Uv,getOwnPropertyDescriptor:WS});Ul({target:"Object",stat:!0,forced:!ia},{getOwnPropertyNames:US});pJ();gJ(Fi,Yl);BS[Ot]=!0;var EJ=Ta,GS=EJ&&!!Symbol.for&&!!Symbol.keyFor,SJ=q,OJ=Jt,TJ=Qe,IJ=Er,qS=ka,kJ=GS,Uc=qS("string-to-symbol-registry"),PJ=qS("symbol-to-string-registry");SJ({target:"Symbol",stat:!0,forced:!kJ},{for:function(i){var r=IJ(i);if(TJ(Uc,r))return Uc[r];var e=OJ("Symbol")(r);return Uc[r]=e,PJ[e]=r,e}});var xJ=q,CJ=Qe,AJ=Jo,DJ=Ia,RJ=ka,NJ=GS,Fb=RJ("symbol-to-string-registry");xJ({target:"Symbol",stat:!0,forced:!NJ},{keyFor:function(r){if(!AJ(r))throw new TypeError(DJ(r)+" is not a symbol");if(CJ(Fb,r))return Fb[r]}});var MJ=se,jb=dn,BJ=Xe,Lb=Hr,FJ=Er,zb=MJ([].push),jJ=function(i){if(BJ(i))return i;if(jb(i)){for(var r=i.length,e=[],t=0;ti.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?arguments[1]:void 0)}});var lte=et,hte=lte("Array").map,cte=Be,dte=hte,Jc=Array.prototype,fte=function(i){var r=i.map;return i===Jc||cte(Jc,i)&&r===Jc.map?dte:r},vte=fte,pte=vte,gte=pte,na=V(gte),yte=q,mte=At,dO=Ml,bte=ae,$te=bte(function(){dO(1)});yte({target:"Object",stat:!0,forced:$te},{keys:function(r){return dO(mte(r))}});var wte=oe,_te=wte.Object.keys,Ete=_te,Ste=Ete,Ote=Ste,Oe=V(Ote),Tte=q,Ite=se,fO=Date,kte=Ite(fO.prototype.getTime);Tte({target:"Date",stat:!0},{now:function(){return kte(new fO)}});var Pte=oe,xte=Pte.Date.now,Cte=xte,Ate=Cte,Dte=Ate,Uu=V(Dte),Rte=ae,Ra=function(i,r){var e=[][i];return!!e&&Rte(function(){e.call(null,r||function(){return 1},1)})},Nte=wi.forEach,Mte=Ra,Bte=Mte("forEach"),Fte=Bte?[].forEach:function(r){return Nte(this,r,arguments.length>1?arguments[1]:void 0)},jte=q,n1=Fte;jte({target:"Array",proto:!0,forced:[].forEach!==n1},{forEach:n1});var Lte=et,zte=Lte("Array").forEach,Hte=zte,Vte=Hte,Wte=un,Ute=Qe,Kte=Be,Gte=Vte,Zc=Array.prototype,qte={DOMTokenList:!0,NodeList:!0},Yte=function(i){var r=i.forEach;return i===Zc||Kte(Zc,i)&&r===Zc.forEach||Ute(qte,Wte(i))?Gte:r},Xte=Yte,fe=V(Xte),Jte=q,Zte=se,Qte=dn,ere=Zte([].reverse),a1=[1,2];Jte({target:"Array",proto:!0,forced:String(a1)===String(a1.reverse())},{reverse:function(){return Qte(this)&&(this.length=this.length),ere(this)}});var tre=et,rre=tre("Array").reverse,ire=Be,nre=rre,Qc=Array.prototype,are=function(i){var r=i.reverse;return i===Qc||ire(Qc,i)&&r===Qc.reverse?nre:r},ore=are,sre=ore,ure=sre,Li=V(ure),o1=Ia,lre=TypeError,vO=function(i,r){if(!delete i[r])throw new lre("Cannot delete property "+o1(r)+" of "+o1(i))},hre=q,cre=At,dre=es,fre=Nl,vre=Zt,pre=uO,gre=jv,yre=Lv,mre=Da,ed=vO,bre=ns,$re=bre("splice"),wre=Math.max,_re=Math.min;hre({target:"Array",proto:!0,forced:!$re},{splice:function(r,e){var t=cre(this),n=vre(t),a=dre(r,n),o=arguments.length,s,u,l,h,c,d;for(o===0?s=u=0:o===1?(s=0,u=n-a):(s=o-2,u=_re(wre(fre(e),0),n-a)),gre(n+s-u),l=yre(t,u),h=0;hn-u+s;h--)ed(t,h-1)}else if(s>u)for(h=n-u;h>a;h--)c=h+u-1,d=h+s-1,c in t?t[d]=t[c]:ed(t,d);for(h=0;h1?arguments[1]:void 0)}});var Nre=et,Mre=Nre("Array").includes,Bre=Ze,Fre=Hr,jre=xe,Lre=jre("match"),zre=function(i){var r;return Bre(i)&&((r=i[Lre])!==void 0?!!r:Fre(i)==="RegExp")},Hre=zre,Vre=TypeError,Wre=function(i){if(Hre(i))throw new Vre("The method doesn't accept regular expressions");return i},Ure=xe,Kre=Ure("match"),Gre=function(i){var r=/./;try{"/./"[i](r)}catch{try{return r[Kre]=!1,"/./"[i](r)}catch{}}return!1},qre=q,Yre=se,Xre=Wre,Jre=qo,s1=Er,Zre=Gre,Qre=Yre("".indexOf);qre({target:"String",proto:!0,forced:!Zre("includes")},{includes:function(r){return!!~Qre(s1(Jre(this)),s1(Xre(r)),arguments.length>1?arguments[1]:void 0)}});var eie=et,tie=eie("String").includes,u1=Be,rie=Mre,iie=tie,rd=Array.prototype,id=String.prototype,nie=function(i){var r=i.includes;return i===rd||u1(rd,i)&&r===rd.includes?rie:typeof i=="string"||i===id||u1(id,i)&&r===id.includes?iie:r},aie=nie,oie=aie,sie=oie,hi=V(sie),uie=q,lie=ae,hie=At,pO=Ll,cie=aS,die=lie(function(){pO(1)});uie({target:"Object",stat:!0,forced:die,sham:!cie},{getPrototypeOf:function(r){return pO(hie(r))}});var fie=oe,vie=fie.Object.getPrototypeOf,pie=vie,gO=pie,gie=gO,l1=V(gie),yie=q,mie=wi.filter,bie=ns,$ie=bie("filter");yie({target:"Array",proto:!0,forced:!$ie},{filter:function(r){return mie(this,r,arguments.length>1?arguments[1]:void 0)}});var wie=et,_ie=wie("Array").filter,Eie=Be,Sie=_ie,nd=Array.prototype,Oie=function(i){var r=i.filter;return i===nd||Eie(nd,i)&&r===nd.filter?Sie:r},Tie=Oie,Iie=Tie,kie=Iie,Tt=V(kie),qv=` +\v\f\r                 \u2028\u2029\uFEFF`,Pie=se,xie=qo,Cie=Er,$f=qv,h1=Pie("".replace),Aie=RegExp("^["+$f+"]+"),Die=RegExp("(^|[^"+$f+"])["+$f+"]+$"),ad=function(i){return function(r){var e=Cie(xie(r));return i&1&&(e=h1(e,Aie,"")),i&2&&(e=h1(e,Die,"$1")),e}},yO={start:ad(1),end:ad(2),trim:ad(3)},mO=Pe,Rie=ae,Nie=se,Mie=Er,Bie=yO.trim,c1=qv,eo=mO.parseInt,d1=mO.Symbol,f1=d1&&d1.iterator,bO=/^[+-]?0x/i,Fie=Nie(bO.exec),jie=eo(c1+"08")!==8||eo(c1+"0x16")!==22||f1&&!Rie(function(){eo(Object(f1))}),Lie=jie?function(r,e){var t=Bie(Mie(r));return eo(t,e>>>0||(Fie(bO,t)?16:10))}:eo,zie=q,v1=Lie;zie({global:!0,forced:parseInt!==v1},{parseInt:v1});var Hie=oe,Vie=Hie.parseInt,Wie=Vie,Uie=Wie,Kie=Uie,nr=V(Kie),Gie=q,qie=Iv,Yie=xv.indexOf,Xie=Ra,wf=qie([].indexOf),$O=!!wf&&1/wf([1],1,-0)<0,Jie=$O||!Xie("indexOf");Gie({target:"Array",proto:!0,forced:Jie},{indexOf:function(r){var e=arguments.length>1?arguments[1]:void 0;return $O?wf(this,r,e)||0:Yie(this,r,e)}});var Zie=et,Qie=Zie("Array").indexOf,ene=Be,tne=Qie,od=Array.prototype,rne=function(i){var r=i.indexOf;return i===od||ene(od,i)&&r===od.indexOf?tne:r},ine=rne,nne=ine,ane=nne,ne=V(ane),one=q,sne=Je,une=xa;one({target:"Object",stat:!0,sham:!sne},{create:une});var lne=oe,hne=lne.Object,cne=function(r,e){return hne.create(r,e)},dne=cne,wO=dne,fne=wO,zi=V(fne),_f=oe,vne=Ko;_f.JSON||(_f.JSON={stringify:JSON.stringify});var pne=function(r,e,t){return vne(_f.JSON.stringify,null,arguments)},gne=pne,yne=gne,mne=yne,ls=V(mne),bne=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",$ne=TypeError,wne=function(i,r){if(ie,o=Ene(t)?t:kne(t),s=a?Tne(arguments,e):[],u=a?function(){_ne(o,this,s)}:o;return r?i(u,n):i(u)}:i},xne=q,SO=Pe,Cne=EO,p1=Cne(SO.setInterval,!0);xne({global:!0,bind:!0,forced:SO.setInterval!==p1},{setInterval:p1});var Ane=q,OO=Pe,Dne=EO,g1=Dne(OO.setTimeout,!0);Ane({global:!0,bind:!0,forced:OO.setTimeout!==g1},{setTimeout:g1});var Rne=oe,Nne=Rne.setTimeout,Mne=Nne,mr=V(Mne),Bne=At,y1=es,Fne=Zt,jne=function(r){for(var e=Bne(this),t=Fne(e),n=arguments.length,a=y1(n>1?arguments[1]:void 0,t),o=n>2?arguments[2]:void 0,s=o===void 0?t:y1(o,t);s>a;)e[a++]=r;return e},Lne=q,zne=jne;Lne({target:"Array",proto:!0},{fill:zne});var Hne=et,Vne=Hne("Array").fill,Wne=Be,Une=Vne,sd=Array.prototype,Kne=function(i){var r=i.fill;return i===sd||Wne(sd,i)&&r===sd.fill?Une:r},Gne=Kne,qne=Gne,Yne=qne,hs=V(Yne);/*! Hammer.JS - v2.0.17-rc - 2019-12-16 * http://naver.github.io/egjs * * Forked By Naver egjs * Copyright (c) hammerjs - * Licensed under the MIT license */function ur(){return ur=Object.assign||function(i){for(var r=1;r"u"?{style:{}}:document.createElement("div"),Xne="function",Hn=Math.round,Xi=Math.abs,Yv=Date.now;function Jl(i,r){for(var e,t,n=r[0].toUpperCase()+r.slice(1),a=0;a"u"?Dr={}:Dr=window;var TO=Jl(Yne.style,"touchAction"),IO=TO!==void 0;function Jne(){if(!IO)return!1;var i={},r=Dr.CSS&&Dr.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){return i[e]=r?Dr.CSS.supports("touch-action",e):!0}),i}var kO="compute",PO="auto",Sf="manipulation",Hi="none",$o="pan-x",wo="pan-y",Zs=Jne(),Zne=/mobile|tablet|ip(ad|hone|od)|android/i,xO="ontouchstart"in Dr,Qne=Jl(Dr,"PointerEvent")!==void 0,eae=xO&&Zne.test(navigator.userAgent),cs="touch",tae="pen",Xv="mouse",rae="kinect",iae=25,yt=1,fn=2,ze=4,kt=8,Ku=1,ds=2,fs=4,vs=8,aa=16,br=ds|fs,Vi=vs|aa,CO=br|Vi,AO=["x","y"],Gu=["clientX","clientY"];function Rr(i,r,e){var t;if(i)if(i.forEach)i.forEach(r,e);else if(i.length!==void 0)for(t=0;t-1}function nae(i){if(Ai(i,Hi))return Hi;var r=Ai(i,$o),e=Ai(i,wo);return r&&e?Hi:r||e?r?$o:wo:Ai(i,Sf)?Sf:PO}var DO=function(){function i(e,t){this.manager=e,this.set(t)}var r=i.prototype;return r.set=function(t){t===kO&&(t=this.compute()),IO&&this.manager.element.style&&Zs[t]&&(this.manager.element.style[TO]=t),this.actions=t.toLowerCase().trim()},r.update=function(){this.set(this.manager.options.touchAction)},r.compute=function(){var t=[];return Rr(this.manager.recognizers,function(n){Zl(n.options.enable,[n])&&(t=t.concat(n.getTouchAction()))}),nae(t.join(" "))},r.preventDefaults=function(t){var n=t.srcEvent,a=t.offsetDirection;if(this.manager.session.prevented){n.preventDefault();return}var o=this.actions,s=Ai(o,Hi)&&!Zs[Hi],u=Ai(o,wo)&&!Zs[wo],l=Ai(o,$o)&&!Zs[$o];if(s){var h=t.pointers.length===1,c=t.distance<2,d=t.deltaTime<250;if(h&&c&&d)return}if(!(l&&u)&&(s||u&&a&br||l&&a&Vi))return this.preventSrc(n)},r.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},i}();function Jv(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}function RO(i){var r=i.length;if(r===1)return{x:Hn(i[0].clientX),y:Hn(i[0].clientY)};for(var e=0,t=0,n=0;n=Xi(r)?i<0?ds:fs:r<0?vs:aa}function aae(i,r){var e=r.center,t=i.offsetDelta||{},n=i.prevDelta||{},a=i.prevInput||{};(r.eventType===yt||a.eventType===ze)&&(n=i.prevDelta={x:a.deltaX||0,y:a.deltaY||0},t=i.offsetDelta={x:e.x,y:e.y}),r.deltaX=n.x+(e.x-t.x),r.deltaY=n.y+(e.y-t.y)}function MO(i,r,e){return{x:r/i||0,y:e/i||0}}function oae(i,r){return qu(r[0],r[1],Gu)/qu(i[0],i[1],Gu)}function sae(i,r){return Of(r[1],r[0],Gu)+Of(i[1],i[0],Gu)}function uae(i,r){var e=i.lastInterval||r,t=r.timeStamp-e.timeStamp,n,a,o,s;if(r.eventType!==kt&&(t>iae||e.velocity===void 0)){var u=r.deltaX-e.deltaX,l=r.deltaY-e.deltaY,h=MO(t,u,l);a=h.x,o=h.y,n=Xi(h.x)>Xi(h.y)?h.x:h.y,s=NO(u,l),i.lastInterval=r}else n=e.velocity,a=e.velocityX,o=e.velocityY,s=e.direction;r.velocity=n,r.velocityX=a,r.velocityY=o,r.direction=s}function lae(i,r){var e=i.session,t=r.pointers,n=t.length;e.firstInput||(e.firstInput=b1(r)),n>1&&!e.firstMultiple?e.firstMultiple=b1(r):n===1&&(e.firstMultiple=!1);var a=e.firstInput,o=e.firstMultiple,s=o?o.center:a.center,u=r.center=RO(t);r.timeStamp=Yv(),r.deltaTime=r.timeStamp-a.timeStamp,r.angle=Of(s,u),r.distance=qu(s,u),aae(e,r),r.offsetDirection=NO(r.deltaX,r.deltaY);var l=MO(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=l.x,r.overallVelocityY=l.y,r.overallVelocity=Xi(l.x)>Xi(l.y)?l.x:l.y,r.scale=o?oae(o.pointers,t):1,r.rotation=o?sae(o.pointers,t):0,r.maxPointers=e.prevInput?r.pointers.length>e.prevInput.maxPointers?r.pointers.length:e.prevInput.maxPointers:r.pointers.length,uae(e,r);var h=i.element,c=r.srcEvent,d;c.composedPath?d=c.composedPath()[0]:c.path?d=c.path[0]:d=c.target,Jv(d,h)&&(h=d),r.target=h}function hae(i,r,e){var t=e.pointers.length,n=e.changedPointers.length,a=r&yt&&t-n===0,o=r&(ze|kt)&&t-n===0;e.isFirst=!!a,e.isFinal=!!o,a&&(i.session={}),e.eventType=r,lae(i,e),i.emit("hammer.input",e),i.recognize(e),i.session.prevInput=e}function _o(i){return i.trim().split(/\s+/g)}function to(i,r,e){Rr(_o(r),function(t){i.addEventListener(t,e,!1)})}function ro(i,r,e){Rr(_o(r),function(t){i.removeEventListener(t,e,!1)})}function $1(i){var r=i.ownerDocument||i;return r.defaultView||r.parentWindow||window}var Na=function(){function i(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(a){Zl(e.options.enable,[e])&&n.handler(a)},this.init()}var r=i.prototype;return r.handler=function(){},r.init=function(){this.evEl&&to(this.element,this.evEl,this.domHandler),this.evTarget&&to(this.target,this.evTarget,this.domHandler),this.evWin&&to($1(this.element),this.evWin,this.domHandler)},r.destroy=function(){this.evEl&&ro(this.element,this.evEl,this.domHandler),this.evTarget&&ro(this.target,this.evTarget,this.domHandler),this.evWin&&ro($1(this.element),this.evWin,this.domHandler)},i}();function Ji(i,r,e){if(i.indexOf&&!e)return i.indexOf(r);for(var t=0;tu[r]}):t=t.sort()),t}var fae={touchstart:yt,touchmove:fn,touchend:ze,touchcancel:kt},vae="touchstart touchmove touchend touchcancel",Qv=function(i){Qt(r,i);function r(){var t;return r.prototype.evTarget=vae,t=i.apply(this,arguments)||this,t.targetIds={},t}var e=r.prototype;return e.handler=function(n){var a=fae[n.type],o=pae.call(this,n,a);o&&this.callback(this.manager,a,{pointers:o[0],changedPointers:o[1],pointerType:cs,srcEvent:n})},r}(Na);function pae(i,r){var e=Eo(i.touches),t=this.targetIds;if(r&(yt|fn)&&e.length===1)return t[e[0].identifier]=!0,[e,e];var n,a,o=Eo(i.changedTouches),s=[],u=this.target;if(a=e.filter(function(l){return Jv(l.target,u)}),r===yt)for(n=0;n-1&&n.splice(s,1)};setTimeout(a,bae)}}function $ae(i,r){i&yt?(this.primaryTouch=r.changedPointers[0].identifier,_1.call(this,r)):i&(ze|kt)&&_1.call(this,r)}function wae(i){for(var r=i.srcEvent.clientX,e=i.srcEvent.clientY,t=0;t-1&&this.requireFail.splice(n,1),this},r.hasRequireFailures=function(){return this.requireFail.length>0},r.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},r.emit=function(t){var n=this,a=this.state;function o(s){n.manager.emit(s,t)}a=ci&&o(n.options.event+E1(a))},r.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=pr},r.canEmit=function(){for(var t=0;ta.threshold&&u&a.direction},e.attrTest=function(n){return sa.prototype.attrTest.call(this,n)&&(this.state&Yt||!(this.state&Yt)&&this.directionTest(n))},e.emit=function(n){this.pX=n.deltaX,this.pY=n.deltaY;var a=zO(n.direction);a&&(n.additionalEvent=this.options.event+a),i.prototype.emit.call(this,n)},r}(sa),HO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"swipe",threshold:10,velocity:.3,direction:br|Vi,pointers:1},t))||this}var e=r.prototype;return e.getTouchAction=function(){return tp.prototype.getTouchAction.call(this)},e.attrTest=function(n){var a=this.options.direction,o;return a&(br|Vi)?o=n.overallVelocity:a&br?o=n.overallVelocityX:a&Vi&&(o=n.overallVelocityY),i.prototype.attrTest.call(this,n)&&a&n.offsetDirection&&n.distance>this.options.threshold&&n.maxPointers===this.options.pointers&&Xi(o)>this.options.velocity&&n.eventType&ze},e.emit=function(n){var a=zO(n.offsetDirection);a&&this.manager.emit(this.options.event+a,n),this.manager.emit(this.options.event,n)},r}(sa),VO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"pinch",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Hi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.scale-1)>this.options.threshold||this.state&Yt)},e.emit=function(n){if(n.scale!==1){var a=n.scale<1?"in":"out";n.additionalEvent=this.options.event+a}i.prototype.emit.call(this,n)},r}(sa),WO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"rotate",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Hi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.rotation)>this.options.threshold||this.state&Yt)},r}(sa),UO=function(i){Qt(r,i);function r(t){var n;return t===void 0&&(t={}),n=i.call(this,ur({event:"press",pointers:1,time:251,threshold:9},t))||this,n._timer=null,n._input=null,n}var e=r.prototype;return e.getTouchAction=function(){return[PO]},e.process=function(n){var a=this,o=this.options,s=n.pointers.length===o.pointers,u=n.distanceo.time;if(this._input=n,!u||!s||n.eventType&(ze|kt)&&!l)this.reset();else if(n.eventType&yt)this.reset(),this._timer=setTimeout(function(){a.state=Nr,a.tryEmit()},o.time);else if(n.eventType&ze)return Nr;return pr},e.reset=function(){clearTimeout(this._timer)},e.emit=function(n){this.state===Nr&&(n&&n.eventType&ze?this.manager.emit(this.options.event+"up",n):(this._input.timeStamp=Yv(),this.manager.emit(this.options.event,this._input)))},r}(ps),KO={domEvents:!1,touchAction:kO,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},S1=[[WO,{enable:!1}],[VO,{enable:!1},["rotate"]],[HO,{direction:br}],[tp,{direction:br},["swipe"]],[Tf],[Tf,{event:"doubletap",taps:2},["tap"]],[UO]],Oae=1,O1=2;function T1(i,r){var e=i.element;if(e.style){var t;Rr(i.options.cssProps,function(n,a){t=Jl(e.style,a),r?(i.oldCssProps[t]=e.style[t],e.style[t]=n):e.style[t]=i.oldCssProps[t]||""}),r||(i.oldCssProps={})}}function Tae(i,r){var e=document.createEvent("Event");e.initEvent(i,!0,!0),e.gesture=r,r.target.dispatchEvent(e)}var I1=function(){function i(e,t){var n=this;this.options=Yi({},KO,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=_ae(this),this.touchAction=new DO(this,this.options.touchAction),T1(this,!0),Rr(this.options.recognizers,function(a){var o=n.add(new a[0](a[1]));a[2]&&o.recognizeWith(a[2]),a[3]&&o.requireFailure(a[3])},this)}var r=i.prototype;return r.set=function(t){return Yi(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},r.stop=function(t){this.session.stopped=t?O1:Oae},r.recognize=function(t){var n=this.session;if(!n.stopped){this.touchAction.preventDefaults(t);var a,o=this.recognizers,s=n.curRecognizer;(!s||s&&s.state&Nr)&&(n.curRecognizer=null,s=null);for(var u=0;u"u"?{style:{}}:document.createElement("div"),Jne="function",Hn=Math.round,Xi=Math.abs,Yv=Date.now;function Jl(i,r){for(var e,t,n=r[0].toUpperCase()+r.slice(1),a=0;a"u"?Dr={}:Dr=window;var TO=Jl(Xne.style,"touchAction"),IO=TO!==void 0;function Zne(){if(!IO)return!1;var i={},r=Dr.CSS&&Dr.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){return i[e]=r?Dr.CSS.supports("touch-action",e):!0}),i}var kO="compute",PO="auto",Sf="manipulation",Hi="none",$o="pan-x",wo="pan-y",Zs=Zne(),Qne=/mobile|tablet|ip(ad|hone|od)|android/i,xO="ontouchstart"in Dr,eae=Jl(Dr,"PointerEvent")!==void 0,tae=xO&&Qne.test(navigator.userAgent),cs="touch",rae="pen",Xv="mouse",iae="kinect",nae=25,yt=1,fn=2,ze=4,kt=8,Ku=1,ds=2,fs=4,vs=8,aa=16,br=ds|fs,Vi=vs|aa,CO=br|Vi,AO=["x","y"],Gu=["clientX","clientY"];function Rr(i,r,e){var t;if(i)if(i.forEach)i.forEach(r,e);else if(i.length!==void 0)for(t=0;t-1}function aae(i){if(Ai(i,Hi))return Hi;var r=Ai(i,$o),e=Ai(i,wo);return r&&e?Hi:r||e?r?$o:wo:Ai(i,Sf)?Sf:PO}var DO=function(){function i(e,t){this.manager=e,this.set(t)}var r=i.prototype;return r.set=function(t){t===kO&&(t=this.compute()),IO&&this.manager.element.style&&Zs[t]&&(this.manager.element.style[TO]=t),this.actions=t.toLowerCase().trim()},r.update=function(){this.set(this.manager.options.touchAction)},r.compute=function(){var t=[];return Rr(this.manager.recognizers,function(n){Zl(n.options.enable,[n])&&(t=t.concat(n.getTouchAction()))}),aae(t.join(" "))},r.preventDefaults=function(t){var n=t.srcEvent,a=t.offsetDirection;if(this.manager.session.prevented){n.preventDefault();return}var o=this.actions,s=Ai(o,Hi)&&!Zs[Hi],u=Ai(o,wo)&&!Zs[wo],l=Ai(o,$o)&&!Zs[$o];if(s){var h=t.pointers.length===1,c=t.distance<2,d=t.deltaTime<250;if(h&&c&&d)return}if(!(l&&u)&&(s||u&&a&br||l&&a&Vi))return this.preventSrc(n)},r.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},i}();function Jv(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}function RO(i){var r=i.length;if(r===1)return{x:Hn(i[0].clientX),y:Hn(i[0].clientY)};for(var e=0,t=0,n=0;n=Xi(r)?i<0?ds:fs:r<0?vs:aa}function oae(i,r){var e=r.center,t=i.offsetDelta||{},n=i.prevDelta||{},a=i.prevInput||{};(r.eventType===yt||a.eventType===ze)&&(n=i.prevDelta={x:a.deltaX||0,y:a.deltaY||0},t=i.offsetDelta={x:e.x,y:e.y}),r.deltaX=n.x+(e.x-t.x),r.deltaY=n.y+(e.y-t.y)}function MO(i,r,e){return{x:r/i||0,y:e/i||0}}function sae(i,r){return qu(r[0],r[1],Gu)/qu(i[0],i[1],Gu)}function uae(i,r){return Of(r[1],r[0],Gu)+Of(i[1],i[0],Gu)}function lae(i,r){var e=i.lastInterval||r,t=r.timeStamp-e.timeStamp,n,a,o,s;if(r.eventType!==kt&&(t>nae||e.velocity===void 0)){var u=r.deltaX-e.deltaX,l=r.deltaY-e.deltaY,h=MO(t,u,l);a=h.x,o=h.y,n=Xi(h.x)>Xi(h.y)?h.x:h.y,s=NO(u,l),i.lastInterval=r}else n=e.velocity,a=e.velocityX,o=e.velocityY,s=e.direction;r.velocity=n,r.velocityX=a,r.velocityY=o,r.direction=s}function hae(i,r){var e=i.session,t=r.pointers,n=t.length;e.firstInput||(e.firstInput=b1(r)),n>1&&!e.firstMultiple?e.firstMultiple=b1(r):n===1&&(e.firstMultiple=!1);var a=e.firstInput,o=e.firstMultiple,s=o?o.center:a.center,u=r.center=RO(t);r.timeStamp=Yv(),r.deltaTime=r.timeStamp-a.timeStamp,r.angle=Of(s,u),r.distance=qu(s,u),oae(e,r),r.offsetDirection=NO(r.deltaX,r.deltaY);var l=MO(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=l.x,r.overallVelocityY=l.y,r.overallVelocity=Xi(l.x)>Xi(l.y)?l.x:l.y,r.scale=o?sae(o.pointers,t):1,r.rotation=o?uae(o.pointers,t):0,r.maxPointers=e.prevInput?r.pointers.length>e.prevInput.maxPointers?r.pointers.length:e.prevInput.maxPointers:r.pointers.length,lae(e,r);var h=i.element,c=r.srcEvent,d;c.composedPath?d=c.composedPath()[0]:c.path?d=c.path[0]:d=c.target,Jv(d,h)&&(h=d),r.target=h}function cae(i,r,e){var t=e.pointers.length,n=e.changedPointers.length,a=r&yt&&t-n===0,o=r&(ze|kt)&&t-n===0;e.isFirst=!!a,e.isFinal=!!o,a&&(i.session={}),e.eventType=r,hae(i,e),i.emit("hammer.input",e),i.recognize(e),i.session.prevInput=e}function _o(i){return i.trim().split(/\s+/g)}function to(i,r,e){Rr(_o(r),function(t){i.addEventListener(t,e,!1)})}function ro(i,r,e){Rr(_o(r),function(t){i.removeEventListener(t,e,!1)})}function $1(i){var r=i.ownerDocument||i;return r.defaultView||r.parentWindow||window}var Na=function(){function i(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(a){Zl(e.options.enable,[e])&&n.handler(a)},this.init()}var r=i.prototype;return r.handler=function(){},r.init=function(){this.evEl&&to(this.element,this.evEl,this.domHandler),this.evTarget&&to(this.target,this.evTarget,this.domHandler),this.evWin&&to($1(this.element),this.evWin,this.domHandler)},r.destroy=function(){this.evEl&&ro(this.element,this.evEl,this.domHandler),this.evTarget&&ro(this.target,this.evTarget,this.domHandler),this.evWin&&ro($1(this.element),this.evWin,this.domHandler)},i}();function Ji(i,r,e){if(i.indexOf&&!e)return i.indexOf(r);for(var t=0;tu[r]}):t=t.sort()),t}var vae={touchstart:yt,touchmove:fn,touchend:ze,touchcancel:kt},pae="touchstart touchmove touchend touchcancel",Qv=function(i){Qt(r,i);function r(){var t;return r.prototype.evTarget=pae,t=i.apply(this,arguments)||this,t.targetIds={},t}var e=r.prototype;return e.handler=function(n){var a=vae[n.type],o=gae.call(this,n,a);o&&this.callback(this.manager,a,{pointers:o[0],changedPointers:o[1],pointerType:cs,srcEvent:n})},r}(Na);function gae(i,r){var e=Eo(i.touches),t=this.targetIds;if(r&(yt|fn)&&e.length===1)return t[e[0].identifier]=!0,[e,e];var n,a,o=Eo(i.changedTouches),s=[],u=this.target;if(a=e.filter(function(l){return Jv(l.target,u)}),r===yt)for(n=0;n-1&&n.splice(s,1)};setTimeout(a,$ae)}}function wae(i,r){i&yt?(this.primaryTouch=r.changedPointers[0].identifier,_1.call(this,r)):i&(ze|kt)&&_1.call(this,r)}function _ae(i){for(var r=i.srcEvent.clientX,e=i.srcEvent.clientY,t=0;t-1&&this.requireFail.splice(n,1),this},r.hasRequireFailures=function(){return this.requireFail.length>0},r.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},r.emit=function(t){var n=this,a=this.state;function o(s){n.manager.emit(s,t)}a=ci&&o(n.options.event+E1(a))},r.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=pr},r.canEmit=function(){for(var t=0;ta.threshold&&u&a.direction},e.attrTest=function(n){return sa.prototype.attrTest.call(this,n)&&(this.state&Yt||!(this.state&Yt)&&this.directionTest(n))},e.emit=function(n){this.pX=n.deltaX,this.pY=n.deltaY;var a=zO(n.direction);a&&(n.additionalEvent=this.options.event+a),i.prototype.emit.call(this,n)},r}(sa),HO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"swipe",threshold:10,velocity:.3,direction:br|Vi,pointers:1},t))||this}var e=r.prototype;return e.getTouchAction=function(){return tp.prototype.getTouchAction.call(this)},e.attrTest=function(n){var a=this.options.direction,o;return a&(br|Vi)?o=n.overallVelocity:a&br?o=n.overallVelocityX:a&Vi&&(o=n.overallVelocityY),i.prototype.attrTest.call(this,n)&&a&n.offsetDirection&&n.distance>this.options.threshold&&n.maxPointers===this.options.pointers&&Xi(o)>this.options.velocity&&n.eventType&ze},e.emit=function(n){var a=zO(n.offsetDirection);a&&this.manager.emit(this.options.event+a,n),this.manager.emit(this.options.event,n)},r}(sa),VO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"pinch",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Hi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.scale-1)>this.options.threshold||this.state&Yt)},e.emit=function(n){if(n.scale!==1){var a=n.scale<1?"in":"out";n.additionalEvent=this.options.event+a}i.prototype.emit.call(this,n)},r}(sa),WO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"rotate",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Hi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.rotation)>this.options.threshold||this.state&Yt)},r}(sa),UO=function(i){Qt(r,i);function r(t){var n;return t===void 0&&(t={}),n=i.call(this,ur({event:"press",pointers:1,time:251,threshold:9},t))||this,n._timer=null,n._input=null,n}var e=r.prototype;return e.getTouchAction=function(){return[PO]},e.process=function(n){var a=this,o=this.options,s=n.pointers.length===o.pointers,u=n.distanceo.time;if(this._input=n,!u||!s||n.eventType&(ze|kt)&&!l)this.reset();else if(n.eventType&yt)this.reset(),this._timer=setTimeout(function(){a.state=Nr,a.tryEmit()},o.time);else if(n.eventType&ze)return Nr;return pr},e.reset=function(){clearTimeout(this._timer)},e.emit=function(n){this.state===Nr&&(n&&n.eventType&ze?this.manager.emit(this.options.event+"up",n):(this._input.timeStamp=Yv(),this.manager.emit(this.options.event,this._input)))},r}(ps),KO={domEvents:!1,touchAction:kO,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},S1=[[WO,{enable:!1}],[VO,{enable:!1},["rotate"]],[HO,{direction:br}],[tp,{direction:br},["swipe"]],[Tf],[Tf,{event:"doubletap",taps:2},["tap"]],[UO]],Tae=1,O1=2;function T1(i,r){var e=i.element;if(e.style){var t;Rr(i.options.cssProps,function(n,a){t=Jl(e.style,a),r?(i.oldCssProps[t]=e.style[t],e.style[t]=n):e.style[t]=i.oldCssProps[t]||""}),r||(i.oldCssProps={})}}function Iae(i,r){var e=document.createEvent("Event");e.initEvent(i,!0,!0),e.gesture=r,r.target.dispatchEvent(e)}var I1=function(){function i(e,t){var n=this;this.options=Yi({},KO,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=Eae(this),this.touchAction=new DO(this,this.options.touchAction),T1(this,!0),Rr(this.options.recognizers,function(a){var o=n.add(new a[0](a[1]));a[2]&&o.recognizeWith(a[2]),a[3]&&o.requireFailure(a[3])},this)}var r=i.prototype;return r.set=function(t){return Yi(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},r.stop=function(t){this.session.stopped=t?O1:Tae},r.recognize=function(t){var n=this.session;if(!n.stopped){this.touchAction.preventDefaults(t);var a,o=this.recognizers,s=n.curRecognizer;(!s||s&&s.state&Nr)&&(n.curRecognizer=null,s=null);for(var u=0;u\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=window.console&&(window.console.warn||window.console.log);return o&&o.call(window.console,t,a),i.apply(this,arguments)}}var qO=GO(function(i,r,e){for(var t=Object.keys(r),n=0;n=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Nae(i,r){var e;if(i){if(typeof i=="string")return P1(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return P1(i,r)}}function P1(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e>>0,n-=i,n*=i,i=n>>>0,n-=i,i+=n*4294967296}return(i>>>0)*23283064365386963e-26}}function jae(){var i=function(){};return{on:i,off:i,destroy:i,emit:i,get:function(){return{set:i}}}}var rp=typeof window<"u"?window.Hammer||Rae:function(){return jae()};function gr(i){var r=this,e;this._cleanupQueue=[],this.active=!1,this._dom={container:i,overlay:document.createElement("div")},this._dom.overlay.classList.add("vis-overlay"),this._dom.container.appendChild(this._dom.overlay),this._cleanupQueue.push(function(){r._dom.overlay.parentNode.removeChild(r._dom.overlay)});var t=rp(this._dom.overlay);t.on("tap",k(e=this._onTapOverlay).call(e,this)),this._cleanupQueue.push(function(){t.destroy()});var n=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];fe(n).call(n,function(a){t.on(a,function(o){o.srcEvent.stopPropagation()})}),document&&document.body&&(this._onClick=function(a){Lae(a.target,i)||r.deactivate()},document.body.addEventListener("click",this._onClick),this._cleanupQueue.push(function(){document.body.removeEventListener("click",r._onClick)})),this._escListener=function(a){("key"in a?a.key==="Escape":a.keyCode===27)&&r.deactivate()}}ZE(gr.prototype);gr.current=null;gr.prototype.destroy=function(){var i,r;this.deactivate();var e=XO(Li(i=Ar(r=this._cleanupQueue).call(r,0)).call(i)),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n()}}catch(a){e.e(a)}finally{e.f()}};gr.prototype.activate=function(){gr.current&&gr.current.deactivate(),gr.current=this,this.active=!0,this._dom.overlay.style.display="none",this._dom.container.classList.add("vis-active"),this.emit("change"),this.emit("activate"),document.body.addEventListener("keydown",this._escListener)};gr.prototype.deactivate=function(){this.active=!1,this._dom.overlay.style.display="block",this._dom.container.classList.remove("vis-active"),document.body.removeEventListener("keydown",this._escListener),this.emit("change"),this.emit("deactivate")};gr.prototype._onTapOverlay=function(i){this.activate(),i.srcEvent.stopPropagation()};function Lae(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}var zae=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Hae=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Vae=/^rgb\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *\)$/i,Wae=/^rgba\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *([01]|0?\.\d+) *\)$/i;function Zr(i){if(i)for(;i.hasChildNodes()===!0;){var r=i.firstChild;r&&(Zr(r),i.removeChild(r))}}function Kn(i){return i instanceof String||typeof i=="string"}function x1(i){return de(i)==="object"&&i!==null}function Zi(i,r,e,t){var n=!1;t===!0&&(n=r[e]===null&&i[e]!==void 0),n?delete i[e]:i[e]=r[e]}function JO(i,r){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;for(var t in i)if(r[t]!==void 0)if(r[t]===null||de(r[t])!=="object")Zi(i,r,t,e);else{var n=i[t],a=r[t];x1(n)&&x1(a)&&JO(n,a,e)}}function Ma(i,r,e){var t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(he(e))throw new TypeError("Arrays are not supported by deepExtend");for(var n=0;n3&&arguments[3]!==void 0?arguments[3]:!1;if(he(e))throw new TypeError("Arrays are not supported by deepExtend");for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&!hi(i).call(i,n))if(e[n]&&e[n].constructor===Object)r[n]===void 0&&(r[n]={}),r[n].constructor===Object?pe(r[n],e[n]):Zi(r,e,n,t);else if(he(e[n])){r[n]=[];for(var a=0;a2&&arguments[2]!==void 0?arguments[2]:!1,t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)||e===!0)if(de(r[n])==="object"&&r[n]!==null&&l1(r[n])===Object.prototype)i[n]===void 0?i[n]=pe({},r[n],e):de(i[n])==="object"&&i[n]!==null&&l1(i[n])===Object.prototype?pe(i[n],r[n],e):Zi(i,r,n,t);else if(he(r[n])){var a;i[n]=it(a=r[n]).call(a)}else Zi(i,r,n,t);return i}function Xu(i,r){var e;return Gv(e=[]).call(e,fr(i),[r])}function Uae(i){return it(i).call(i)}function Kae(i){return i.getBoundingClientRect().left}function Gae(i){return i.getBoundingClientRect().top}function te(i,r){if(he(i))for(var e=i.length,t=0;t3&&arguments[3]!==void 0?arguments[3]:{},n=function(v){return v!=null},a=function(v){return v!==null&&de(v)==="object"},o=function(v){for(var p in v)if(Object.prototype.hasOwnProperty.call(v,p))return!1;return!0};if(!a(i))throw new Error("Parameter mergeTarget must be an object");if(!a(r))throw new Error("Parameter options must be an object");if(!n(e))throw new Error("Parameter option must have a value");if(!a(t))throw new Error("Parameter globalOptions must be an object");var s=function(v,p,g){a(v[g])||(v[g]={});var y=p[g],m=v[g];for(var $ in y)Object.prototype.hasOwnProperty.call(y,$)&&(m[$]=y[$])},u=r[e],l=a(t)&&!o(t),h=l?t[e]:void 0,c=h?h.enabled:void 0;if(u!==void 0){if(typeof u=="boolean"){a(i[e])||(i[e]={}),i[e].enabled=u;return}if(u===null&&!a(i[e]))if(n(h))i[e]=zi(h);else return;if(a(u)){var d=!0;u.enabled!==void 0?d=u.enabled:c!==void 0&&(d=h.enabled),s(i,r,e),i[e].enabled=d}}}var Xae={linear:function(r){return r},easeInQuad:function(r){return r*r},easeOutQuad:function(r){return r*(2-r)},easeInOutQuad:function(r){return r<.5?2*r*r:-1+(4-2*r)*r},easeInCubic:function(r){return r*r*r},easeOutCubic:function(r){return--r*r*r+1},easeInOutCubic:function(r){return r<.5?4*r*r*r:(r-1)*(2*r-2)*(2*r-2)+1},easeInQuart:function(r){return r*r*r*r},easeOutQuart:function(r){return 1- --r*r*r*r},easeInOutQuart:function(r){return r<.5?8*r*r*r*r:1-8*--r*r*r*r},easeInQuint:function(r){return r*r*r*r*r},easeOutQuint:function(r){return 1+--r*r*r*r*r},easeInOutQuint:function(r){return r<.5?16*r*r*r*r*r:1+16*--r*r*r*r*r}};function Qr(i,r){var e;he(r)||(r=[r]);var t=XO(i),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;if(a){e=a[r[0]];for(var o=1;o0&&arguments[0]!==void 0?arguments[0]:1;N(this,i),this.pixelRatio=r,this.generated=!1,this.centerCoordinates={x:289/2,y:289/2},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return M(i,[{key:"insertTo",value:function(e){this.hammer!==void 0&&(this.hammer.destroy(),this.hammer=void 0),this.container=e,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(e){if(typeof e=="function")this.updateCallback=e;else throw new Error("Function attempted to set as colorPicker update callback is not a function.")}},{key:"setCloseCallback",value:function(e){if(typeof e=="function")this.closeCallback=e;else throw new Error("Function attempted to set as colorPicker closing callback is not a function.")}},{key:"_isColorString",value:function(e){if(typeof e=="string")return Jae[e]}},{key:"setColor",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e!=="none"){var n,a=this._isColorString(e);if(a!==void 0&&(e=a),Kn(e)===!0){if(eT(e)===!0){var o=e.substr(4).substr(0,e.length-5).split(",");n={r:o[0],g:o[1],b:o[2],a:1}}else if(Yae(e)===!0){var s=e.substr(5).substr(0,e.length-6).split(",");n={r:s[0],g:s[1],b:s[2],a:s[3]}}else if(QO(e)===!0){var u=ip(e);n={r:u.r,g:u.g,b:u.b,a:1}}}else if(e instanceof Object&&e.r!==void 0&&e.g!==void 0&&e.b!==void 0){var l=e.a!==void 0?e.a:"1.0";n={r:e.r,g:e.g,b:e.b,a:l}}if(n===void 0)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+ls(e));this._setColor(n,t)}}},{key:"show",value:function(){this.closeCallback!==void 0&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;t===!0&&(this.previousColor=Le({},this.color)),this.applied===!0&&this.updateCallback(this.initialColor),this.frame.style.display="none",mr(function(){e.closeCallback!==void 0&&(e.closeCallback(),e.closeCallback=void 0)},0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){this.previousColor!==void 0?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;t===!0&&(this.initialColor=Le({},e)),this.color=e;var n=qa(e.r,e.g,e.b),a=2*Math.PI,o=this.r*n.s,s=this.centerCoordinates.x+o*Math.sin(a*n.h),u=this.centerCoordinates.y+o*Math.cos(a*n.h);this.colorPickerSelector.style.left=s-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=u-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(e)}},{key:"_setOpacity",value:function(e){this.color.a=e/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(e){var t=qa(this.color.r,this.color.g,this.color.b);t.v=e/100;var n=bu(t.h,t.s,t.v);n.a=this.color.a,this.color=n,this._updatePicker()}},{key:"_updatePicker",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.color,t=qa(e.r,e.g,e.b),n=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1)),n.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var a=this.colorPickerCanvas.clientWidth,o=this.colorPickerCanvas.clientHeight;n.clearRect(0,0,a,o),n.putImageData(this.hueCircle,0,0),n.fillStyle="rgba(0,0,0,"+(1-t.v)+")",n.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),hs(n).call(n),this.brightnessRange.value=100*t.v,this.opacityRange.value=100*e.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){var e,t,n,a;if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var s=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(s.webkitBackingStorePixelRatio||s.mozBackingStorePixelRatio||s.msBackingStorePixelRatio||s.oBackingStorePixelRatio||s.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var o=document.createElement("DIV");o.style.color="red",o.style.fontWeight="bold",o.style.padding="10px",o.innerText="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(o)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch{}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch{}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var u=this;this.opacityRange.onchange=function(){u._setOpacity(this.value)},this.opacityRange.oninput=function(){u._setOpacity(this.value)},this.brightnessRange.onchange=function(){u._setBrightness(this.value)},this.brightnessRange.oninput=function(){u._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerText="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerText="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerText="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerText="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerText="cancel",this.cancelButton.onclick=k(e=this._hide).call(e,this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerText="apply",this.applyButton.onclick=k(t=this._apply).call(t,this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerText="save",this.saveButton.onclick=k(n=this._save).call(n,this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerText="load last",this.loadButton.onclick=k(a=this._loadLast).call(a,this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var e=this;this.drag={},this.pinch={},this.hammer=new rp(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("hammer.input",function(t){t.isFirst&&e._moveSelector(t)}),this.hammer.on("tap",function(t){e._moveSelector(t)}),this.hammer.on("panstart",function(t){e._moveSelector(t)}),this.hammer.on("panmove",function(t){e._moveSelector(t)}),this.hammer.on("panend",function(t){e._moveSelector(t)})}},{key:"_generateHueCircle",value:function(){if(this.generated===!1){var e=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)),e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var t=this.colorPickerCanvas.clientWidth,n=this.colorPickerCanvas.clientHeight;e.clearRect(0,0,t,n);var a,o,s,u;this.centerCoordinates={x:t*.5,y:n*.5},this.r=.49*t;var l=2*Math.PI/360,h=1/360,c=1/this.r,d;for(s=0;s<360;s++)for(u=0;u3&&arguments[3]!==void 0?arguments[3]:1,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:function(){return!1};N(this,i),this.parent=r,this.changedOptions=[],this.container=e,this.allowCreation=!1,this.hideOption=a,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},Le(this.options,this.defaultOptions),this.configureOptions=t,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new Zae(n),this.wrapper=void 0}return M(i,[{key:"setOptions",value:function(e){if(e!==void 0){this.popupHistory={},this._removePopup();var t=!0;if(typeof e=="string")this.options.filter=e;else if(he(e))this.options.filter=e.join();else if(de(e)==="object"){if(e==null)throw new TypeError("options cannot be null");e.container!==void 0&&(this.options.container=e.container),Tt(e)!==void 0&&(this.options.filter=Tt(e)),e.showButton!==void 0&&(this.options.showButton=e.showButton),e.enabled!==void 0&&(t=e.enabled)}else typeof e=="boolean"?(this.options.filter=!0,t=e):typeof e=="function"&&(this.options.filter=e,t=!0);Tt(this.options)===!1&&(t=!1),this.options.enabled=t}this._clean()}},{key:"setModuleOptions",value:function(e){this.moduleOptions=e,this.options.enabled===!0&&(this._clean(),this.options.container!==void 0&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){this._clean(),this.changedOptions=[];var e=Tt(this.options),t=0,n=!1;for(var a in this.configureOptions)Object.prototype.hasOwnProperty.call(this.configureOptions,a)&&(this.allowCreation=!1,n=!1,typeof e=="function"?(n=e(a,[]),n=n||this._handleObject(this.configureOptions[a],[a],!0)):(e===!0||ne(e).call(e,a)!==-1)&&(n=!0),n!==!1&&(this.allowCreation=!0,t>0&&this._makeItem([]),this._makeHeader(a),this._handleObject(this.configureOptions[a],[a])),t++);this._makeButton(),this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var e=0;e1?n-1:0),o=1;o2&&arguments[2]!==void 0?arguments[2]:!1,a=document.createElement("div");if(a.className="vis-configuration vis-config-label vis-config-s"+t.length,n===!0){for(;a.firstChild;)a.removeChild(a.firstChild);a.appendChild(Pf("i","b",e))}else a.innerText=e+":";return a}},{key:"_makeDropdown",value:function(e,t,n){var a=document.createElement("select");a.className="vis-configuration vis-config-select";var o=0;t!==void 0&&ne(e).call(e,t)!==-1&&(o=ne(e).call(e,t));for(var s=0;ss&&s!==1&&(l.max=Math.ceil(t*d),c=l.max,h="range increased"),l.value=t}else l.value=a;var f=document.createElement("input");f.className="vis-configuration vis-config-rangeinput",f.value=l.value;var v=this;l.onchange=function(){f.value=this.value,v._update(Number(this.value),n)},l.oninput=function(){f.value=this.value};var p=this._makeLabel(n[n.length-1],n),g=this._makeItem(n,p,l,f);h!==""&&this.popupHistory[g]!==c&&(this.popupHistory[g]=c,this._setupPopup(h,g))}},{key:"_makeButton",value:function(){var e=this;if(this.options.showButton===!0){var t=document.createElement("div");t.className="vis-configuration vis-config-button",t.innerText="generate options",t.onclick=function(){e._printOptions()},t.onmouseover=function(){t.className="vis-configuration vis-config-button hover"},t.onmouseout=function(){t.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(t)}}},{key:"_setupPopup",value:function(e,t){var n=this;if(this.initialized===!0&&this.allowCreation===!0&&this.popupCounter1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=!1,o=Tt(this.options),s=!1;for(var u in e)if(Object.prototype.hasOwnProperty.call(e,u)){a=!0;var l=e[u],h=Xu(t,u);if(typeof o=="function"&&(a=o(u,t),a===!1&&!he(l)&&typeof l!="string"&&typeof l!="boolean"&&l instanceof Object&&(this.allowCreation=!1,a=this._handleObject(l,h,!0),this.allowCreation=n===!1)),a!==!1){s=!0;var c=this._getValue(h);if(he(l))this._handleArray(l,c,h);else if(typeof l=="string")this._makeTextInput(l,c,h);else if(typeof l=="boolean")this._makeCheckbox(l,c,h);else if(l instanceof Object){if(!this.hideOption(t,u,this.moduleOptions))if(l.enabled!==void 0){var d=Xu(h,"enabled"),f=this._getValue(d);if(f===!0){var v=this._makeLabel(u,h,!0);this._makeItem(h,v),s=this._handleObject(l,h)||s}else this._makeCheckbox(l,f,h)}else{var p=this._makeLabel(u,h,!0);this._makeItem(h,p),s=this._handleObject(l,h)||s}}else console.error("dont know how to handle",l,u,h)}}return s}},{key:"_handleArray",value:function(e,t,n){typeof e[0]=="string"&&e[0]==="color"?(this._makeColorField(e,t,n),e[1]!==t&&this.changedOptions.push({path:n,value:t})):typeof e[0]=="string"?(this._makeDropdown(e,t,n),e[0]!==t&&this.changedOptions.push({path:n,value:t})):typeof e[0]=="number"&&(this._makeRange(e,t,n),e[0]!==t&&this.changedOptions.push({path:n,value:Number(t)}))}},{key:"_update",value:function(e,t){var n=this._constructOptions(e,t);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",n),this.initialized=!0,this.parent.setOptions(n)}},{key:"_constructOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=n;e=e==="true"?!0:e,e=e==="false"?!1:e;for(var o=0;oo-this.padding&&(l=!0),l?s=this.x-n:s=this.x,h?u=this.y-t:u=this.y}else u=this.y-t,u+t+this.padding>a&&(u=a-t-this.padding),uo&&(s=o-n-this.padding),s\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=window.console&&(window.console.warn||window.console.log);return o&&o.call(window.console,t,a),i.apply(this,arguments)}}var qO=GO(function(i,r,e){for(var t=Object.keys(r),n=0;n=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Mae(i,r){var e;if(i){if(typeof i=="string")return P1(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return P1(i,r)}}function P1(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e>>0,n-=i,n*=i,i=n>>>0,n-=i,i+=n*4294967296}return(i>>>0)*23283064365386963e-26}}function Lae(){var i=function(){};return{on:i,off:i,destroy:i,emit:i,get:function(){return{set:i}}}}var rp=typeof window<"u"?window.Hammer||Nae:function(){return Lae()};function gr(i){var r=this,e;this._cleanupQueue=[],this.active=!1,this._dom={container:i,overlay:document.createElement("div")},this._dom.overlay.classList.add("vis-overlay"),this._dom.container.appendChild(this._dom.overlay),this._cleanupQueue.push(function(){r._dom.overlay.parentNode.removeChild(r._dom.overlay)});var t=rp(this._dom.overlay);t.on("tap",k(e=this._onTapOverlay).call(e,this)),this._cleanupQueue.push(function(){t.destroy()});var n=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];fe(n).call(n,function(a){t.on(a,function(o){o.srcEvent.stopPropagation()})}),document&&document.body&&(this._onClick=function(a){zae(a.target,i)||r.deactivate()},document.body.addEventListener("click",this._onClick),this._cleanupQueue.push(function(){document.body.removeEventListener("click",r._onClick)})),this._escListener=function(a){("key"in a?a.key==="Escape":a.keyCode===27)&&r.deactivate()}}ZE(gr.prototype);gr.current=null;gr.prototype.destroy=function(){var i,r;this.deactivate();var e=XO(Li(i=Ar(r=this._cleanupQueue).call(r,0)).call(i)),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n()}}catch(a){e.e(a)}finally{e.f()}};gr.prototype.activate=function(){gr.current&&gr.current.deactivate(),gr.current=this,this.active=!0,this._dom.overlay.style.display="none",this._dom.container.classList.add("vis-active"),this.emit("change"),this.emit("activate"),document.body.addEventListener("keydown",this._escListener)};gr.prototype.deactivate=function(){this.active=!1,this._dom.overlay.style.display="block",this._dom.container.classList.remove("vis-active"),document.body.removeEventListener("keydown",this._escListener),this.emit("change"),this.emit("deactivate")};gr.prototype._onTapOverlay=function(i){this.activate(),i.srcEvent.stopPropagation()};function zae(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}var Hae=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Vae=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Wae=/^rgb\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *\)$/i,Uae=/^rgba\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *([01]|0?\.\d+) *\)$/i;function Zr(i){if(i)for(;i.hasChildNodes()===!0;){var r=i.firstChild;r&&(Zr(r),i.removeChild(r))}}function Kn(i){return i instanceof String||typeof i=="string"}function x1(i){return de(i)==="object"&&i!==null}function Zi(i,r,e,t){var n=!1;t===!0&&(n=r[e]===null&&i[e]!==void 0),n?delete i[e]:i[e]=r[e]}function JO(i,r){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;for(var t in i)if(r[t]!==void 0)if(r[t]===null||de(r[t])!=="object")Zi(i,r,t,e);else{var n=i[t],a=r[t];x1(n)&&x1(a)&&JO(n,a,e)}}function Ma(i,r,e){var t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(he(e))throw new TypeError("Arrays are not supported by deepExtend");for(var n=0;n3&&arguments[3]!==void 0?arguments[3]:!1;if(he(e))throw new TypeError("Arrays are not supported by deepExtend");for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&!hi(i).call(i,n))if(e[n]&&e[n].constructor===Object)r[n]===void 0&&(r[n]={}),r[n].constructor===Object?pe(r[n],e[n]):Zi(r,e,n,t);else if(he(e[n])){r[n]=[];for(var a=0;a2&&arguments[2]!==void 0?arguments[2]:!1,t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)||e===!0)if(de(r[n])==="object"&&r[n]!==null&&l1(r[n])===Object.prototype)i[n]===void 0?i[n]=pe({},r[n],e):de(i[n])==="object"&&i[n]!==null&&l1(i[n])===Object.prototype?pe(i[n],r[n],e):Zi(i,r,n,t);else if(he(r[n])){var a;i[n]=it(a=r[n]).call(a)}else Zi(i,r,n,t);return i}function Xu(i,r){var e;return Gv(e=[]).call(e,fr(i),[r])}function Kae(i){return it(i).call(i)}function Gae(i){return i.getBoundingClientRect().left}function qae(i){return i.getBoundingClientRect().top}function te(i,r){if(he(i))for(var e=i.length,t=0;t3&&arguments[3]!==void 0?arguments[3]:{},n=function(v){return v!=null},a=function(v){return v!==null&&de(v)==="object"},o=function(v){for(var p in v)if(Object.prototype.hasOwnProperty.call(v,p))return!1;return!0};if(!a(i))throw new Error("Parameter mergeTarget must be an object");if(!a(r))throw new Error("Parameter options must be an object");if(!n(e))throw new Error("Parameter option must have a value");if(!a(t))throw new Error("Parameter globalOptions must be an object");var s=function(v,p,g){a(v[g])||(v[g]={});var y=p[g],m=v[g];for(var $ in y)Object.prototype.hasOwnProperty.call(y,$)&&(m[$]=y[$])},u=r[e],l=a(t)&&!o(t),h=l?t[e]:void 0,c=h?h.enabled:void 0;if(u!==void 0){if(typeof u=="boolean"){a(i[e])||(i[e]={}),i[e].enabled=u;return}if(u===null&&!a(i[e]))if(n(h))i[e]=zi(h);else return;if(a(u)){var d=!0;u.enabled!==void 0?d=u.enabled:c!==void 0&&(d=h.enabled),s(i,r,e),i[e].enabled=d}}}var Jae={linear:function(r){return r},easeInQuad:function(r){return r*r},easeOutQuad:function(r){return r*(2-r)},easeInOutQuad:function(r){return r<.5?2*r*r:-1+(4-2*r)*r},easeInCubic:function(r){return r*r*r},easeOutCubic:function(r){return--r*r*r+1},easeInOutCubic:function(r){return r<.5?4*r*r*r:(r-1)*(2*r-2)*(2*r-2)+1},easeInQuart:function(r){return r*r*r*r},easeOutQuart:function(r){return 1- --r*r*r*r},easeInOutQuart:function(r){return r<.5?8*r*r*r*r:1-8*--r*r*r*r},easeInQuint:function(r){return r*r*r*r*r},easeOutQuint:function(r){return 1+--r*r*r*r*r},easeInOutQuint:function(r){return r<.5?16*r*r*r*r*r:1+16*--r*r*r*r*r}};function Qr(i,r){var e;he(r)||(r=[r]);var t=XO(i),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;if(a){e=a[r[0]];for(var o=1;o0&&arguments[0]!==void 0?arguments[0]:1;N(this,i),this.pixelRatio=r,this.generated=!1,this.centerCoordinates={x:289/2,y:289/2},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return M(i,[{key:"insertTo",value:function(e){this.hammer!==void 0&&(this.hammer.destroy(),this.hammer=void 0),this.container=e,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(e){if(typeof e=="function")this.updateCallback=e;else throw new Error("Function attempted to set as colorPicker update callback is not a function.")}},{key:"setCloseCallback",value:function(e){if(typeof e=="function")this.closeCallback=e;else throw new Error("Function attempted to set as colorPicker closing callback is not a function.")}},{key:"_isColorString",value:function(e){if(typeof e=="string")return Zae[e]}},{key:"setColor",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e!=="none"){var n,a=this._isColorString(e);if(a!==void 0&&(e=a),Kn(e)===!0){if(eT(e)===!0){var o=e.substr(4).substr(0,e.length-5).split(",");n={r:o[0],g:o[1],b:o[2],a:1}}else if(Xae(e)===!0){var s=e.substr(5).substr(0,e.length-6).split(",");n={r:s[0],g:s[1],b:s[2],a:s[3]}}else if(QO(e)===!0){var u=ip(e);n={r:u.r,g:u.g,b:u.b,a:1}}}else if(e instanceof Object&&e.r!==void 0&&e.g!==void 0&&e.b!==void 0){var l=e.a!==void 0?e.a:"1.0";n={r:e.r,g:e.g,b:e.b,a:l}}if(n===void 0)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+ls(e));this._setColor(n,t)}}},{key:"show",value:function(){this.closeCallback!==void 0&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;t===!0&&(this.previousColor=Le({},this.color)),this.applied===!0&&this.updateCallback(this.initialColor),this.frame.style.display="none",mr(function(){e.closeCallback!==void 0&&(e.closeCallback(),e.closeCallback=void 0)},0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){this.previousColor!==void 0?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;t===!0&&(this.initialColor=Le({},e)),this.color=e;var n=qa(e.r,e.g,e.b),a=2*Math.PI,o=this.r*n.s,s=this.centerCoordinates.x+o*Math.sin(a*n.h),u=this.centerCoordinates.y+o*Math.cos(a*n.h);this.colorPickerSelector.style.left=s-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=u-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(e)}},{key:"_setOpacity",value:function(e){this.color.a=e/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(e){var t=qa(this.color.r,this.color.g,this.color.b);t.v=e/100;var n=bu(t.h,t.s,t.v);n.a=this.color.a,this.color=n,this._updatePicker()}},{key:"_updatePicker",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.color,t=qa(e.r,e.g,e.b),n=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1)),n.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var a=this.colorPickerCanvas.clientWidth,o=this.colorPickerCanvas.clientHeight;n.clearRect(0,0,a,o),n.putImageData(this.hueCircle,0,0),n.fillStyle="rgba(0,0,0,"+(1-t.v)+")",n.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),hs(n).call(n),this.brightnessRange.value=100*t.v,this.opacityRange.value=100*e.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){var e,t,n,a;if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var s=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(s.webkitBackingStorePixelRatio||s.mozBackingStorePixelRatio||s.msBackingStorePixelRatio||s.oBackingStorePixelRatio||s.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var o=document.createElement("DIV");o.style.color="red",o.style.fontWeight="bold",o.style.padding="10px",o.innerText="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(o)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch{}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch{}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var u=this;this.opacityRange.onchange=function(){u._setOpacity(this.value)},this.opacityRange.oninput=function(){u._setOpacity(this.value)},this.brightnessRange.onchange=function(){u._setBrightness(this.value)},this.brightnessRange.oninput=function(){u._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerText="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerText="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerText="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerText="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerText="cancel",this.cancelButton.onclick=k(e=this._hide).call(e,this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerText="apply",this.applyButton.onclick=k(t=this._apply).call(t,this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerText="save",this.saveButton.onclick=k(n=this._save).call(n,this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerText="load last",this.loadButton.onclick=k(a=this._loadLast).call(a,this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var e=this;this.drag={},this.pinch={},this.hammer=new rp(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("hammer.input",function(t){t.isFirst&&e._moveSelector(t)}),this.hammer.on("tap",function(t){e._moveSelector(t)}),this.hammer.on("panstart",function(t){e._moveSelector(t)}),this.hammer.on("panmove",function(t){e._moveSelector(t)}),this.hammer.on("panend",function(t){e._moveSelector(t)})}},{key:"_generateHueCircle",value:function(){if(this.generated===!1){var e=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)),e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var t=this.colorPickerCanvas.clientWidth,n=this.colorPickerCanvas.clientHeight;e.clearRect(0,0,t,n);var a,o,s,u;this.centerCoordinates={x:t*.5,y:n*.5},this.r=.49*t;var l=2*Math.PI/360,h=1/360,c=1/this.r,d;for(s=0;s<360;s++)for(u=0;u3&&arguments[3]!==void 0?arguments[3]:1,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:function(){return!1};N(this,i),this.parent=r,this.changedOptions=[],this.container=e,this.allowCreation=!1,this.hideOption=a,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},Le(this.options,this.defaultOptions),this.configureOptions=t,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new Qae(n),this.wrapper=void 0}return M(i,[{key:"setOptions",value:function(e){if(e!==void 0){this.popupHistory={},this._removePopup();var t=!0;if(typeof e=="string")this.options.filter=e;else if(he(e))this.options.filter=e.join();else if(de(e)==="object"){if(e==null)throw new TypeError("options cannot be null");e.container!==void 0&&(this.options.container=e.container),Tt(e)!==void 0&&(this.options.filter=Tt(e)),e.showButton!==void 0&&(this.options.showButton=e.showButton),e.enabled!==void 0&&(t=e.enabled)}else typeof e=="boolean"?(this.options.filter=!0,t=e):typeof e=="function"&&(this.options.filter=e,t=!0);Tt(this.options)===!1&&(t=!1),this.options.enabled=t}this._clean()}},{key:"setModuleOptions",value:function(e){this.moduleOptions=e,this.options.enabled===!0&&(this._clean(),this.options.container!==void 0&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){this._clean(),this.changedOptions=[];var e=Tt(this.options),t=0,n=!1;for(var a in this.configureOptions)Object.prototype.hasOwnProperty.call(this.configureOptions,a)&&(this.allowCreation=!1,n=!1,typeof e=="function"?(n=e(a,[]),n=n||this._handleObject(this.configureOptions[a],[a],!0)):(e===!0||ne(e).call(e,a)!==-1)&&(n=!0),n!==!1&&(this.allowCreation=!0,t>0&&this._makeItem([]),this._makeHeader(a),this._handleObject(this.configureOptions[a],[a])),t++);this._makeButton(),this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var e=0;e1?n-1:0),o=1;o2&&arguments[2]!==void 0?arguments[2]:!1,a=document.createElement("div");if(a.className="vis-configuration vis-config-label vis-config-s"+t.length,n===!0){for(;a.firstChild;)a.removeChild(a.firstChild);a.appendChild(Pf("i","b",e))}else a.innerText=e+":";return a}},{key:"_makeDropdown",value:function(e,t,n){var a=document.createElement("select");a.className="vis-configuration vis-config-select";var o=0;t!==void 0&&ne(e).call(e,t)!==-1&&(o=ne(e).call(e,t));for(var s=0;ss&&s!==1&&(l.max=Math.ceil(t*d),c=l.max,h="range increased"),l.value=t}else l.value=a;var f=document.createElement("input");f.className="vis-configuration vis-config-rangeinput",f.value=l.value;var v=this;l.onchange=function(){f.value=this.value,v._update(Number(this.value),n)},l.oninput=function(){f.value=this.value};var p=this._makeLabel(n[n.length-1],n),g=this._makeItem(n,p,l,f);h!==""&&this.popupHistory[g]!==c&&(this.popupHistory[g]=c,this._setupPopup(h,g))}},{key:"_makeButton",value:function(){var e=this;if(this.options.showButton===!0){var t=document.createElement("div");t.className="vis-configuration vis-config-button",t.innerText="generate options",t.onclick=function(){e._printOptions()},t.onmouseover=function(){t.className="vis-configuration vis-config-button hover"},t.onmouseout=function(){t.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(t)}}},{key:"_setupPopup",value:function(e,t){var n=this;if(this.initialized===!0&&this.allowCreation===!0&&this.popupCounter1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=!1,o=Tt(this.options),s=!1;for(var u in e)if(Object.prototype.hasOwnProperty.call(e,u)){a=!0;var l=e[u],h=Xu(t,u);if(typeof o=="function"&&(a=o(u,t),a===!1&&!he(l)&&typeof l!="string"&&typeof l!="boolean"&&l instanceof Object&&(this.allowCreation=!1,a=this._handleObject(l,h,!0),this.allowCreation=n===!1)),a!==!1){s=!0;var c=this._getValue(h);if(he(l))this._handleArray(l,c,h);else if(typeof l=="string")this._makeTextInput(l,c,h);else if(typeof l=="boolean")this._makeCheckbox(l,c,h);else if(l instanceof Object){if(!this.hideOption(t,u,this.moduleOptions))if(l.enabled!==void 0){var d=Xu(h,"enabled"),f=this._getValue(d);if(f===!0){var v=this._makeLabel(u,h,!0);this._makeItem(h,v),s=this._handleObject(l,h)||s}else this._makeCheckbox(l,f,h)}else{var p=this._makeLabel(u,h,!0);this._makeItem(h,p),s=this._handleObject(l,h)||s}}else console.error("dont know how to handle",l,u,h)}}return s}},{key:"_handleArray",value:function(e,t,n){typeof e[0]=="string"&&e[0]==="color"?(this._makeColorField(e,t,n),e[1]!==t&&this.changedOptions.push({path:n,value:t})):typeof e[0]=="string"?(this._makeDropdown(e,t,n),e[0]!==t&&this.changedOptions.push({path:n,value:t})):typeof e[0]=="number"&&(this._makeRange(e,t,n),e[0]!==t&&this.changedOptions.push({path:n,value:Number(t)}))}},{key:"_update",value:function(e,t){var n=this._constructOptions(e,t);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",n),this.initialized=!0,this.parent.setOptions(n)}},{key:"_constructOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=n;e=e==="true"?!0:e,e=e==="false"?!1:e;for(var o=0;oo-this.padding&&(l=!0),l?s=this.x-n:s=this.x,h?u=this.y-t:u=this.y}else u=this.y-t,u+t+this.padding>a&&(u=a-t-this.padding),uo&&(s=o-n-this.padding),so.distance?l=" in "+i.printLocation(a.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+i.printLocation(o.path,o.closestMatch,""):a.distance<=s?l='. Did you mean "'+a.closestMatch+'"?'+i.printLocation(a.path,e):l=". Did you mean one of these: "+i.print(Oe(t))+i.printLocation(n,e),console.error('%cUnknown option detected: "'+e+'"'+l,xf),za=!0}},{key:"findInOptions",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=1e9,s="",u=[],l=e.toLowerCase(),h=void 0;for(var c in t){var d=void 0;if(t[c].__type__!==void 0&&a===!0){var f=i.findInOptions(e,t[c],Xu(n,c));o>f.distance&&(s=f.closestMatch,u=f.path,o=f.distance,h=f.indexMatch)}else{var v;ne(v=c.toLowerCase()).call(v,l)!==-1&&(h=c),d=i.levenshteinDistance(e,c),o>d&&(s=c,u=Uae(n),o=d)}}return{closestMatch:s,path:u,distance:o,indexMatch:h}}},{key:"printLocation",value:function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`Problem value found at: +`:o.distance<=u&&a.distance>o.distance?l=" in "+i.printLocation(a.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+i.printLocation(o.path,o.closestMatch,""):a.distance<=s?l='. Did you mean "'+a.closestMatch+'"?'+i.printLocation(a.path,e):l=". Did you mean one of these: "+i.print(Oe(t))+i.printLocation(n,e),console.error('%cUnknown option detected: "'+e+'"'+l,xf),za=!0}},{key:"findInOptions",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=1e9,s="",u=[],l=e.toLowerCase(),h=void 0;for(var c in t){var d=void 0;if(t[c].__type__!==void 0&&a===!0){var f=i.findInOptions(e,t[c],Xu(n,c));o>f.distance&&(s=f.closestMatch,u=f.path,o=f.distance,h=f.indexMatch)}else{var v;ne(v=c.toLowerCase()).call(v,l)!==-1&&(h=c),d=i.levenshteinDistance(e,c),o>d&&(s=c,u=Kae(n),o=d)}}return{closestMatch:s,path:u,distance:o,indexMatch:h}}},{key:"printLocation",value:function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`Problem value found at: `,a=` `+n+`options = { @@ -126,27 +126,27 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `;for(var l=0;l":!0,"--":!0},ri="",ua=0,ee="",G="",_t=ft.NULL;function soe(){ua=0,ee=ri.charAt(0)}function Ue(){ua++,ee=ri.charAt(ua)}function kn(){return ri.charAt(ua+1)}function D1(i){var r=i.charCodeAt(0);return r<47?r===35||r===46:r<59?r>47:r<91?r>64:r<96?r===95:r<123?r>96:!1}function vi(i,r){if(i||(i={}),r)for(var e in r)r.hasOwnProperty(e)&&(i[e]=r[e]);return i}function uoe(i,r,e){for(var t=r.split("."),n=i;t.length;){var a=t.shift();t.length?(n[a]||(n[a]={}),n=n[a]):n[a]=e}}function iT(i,r){for(var e,t,n=null,a=[i],o=i;o.parent;)a.push(o.parent),o=o.parent;if(o.nodes){for(e=0,t=o.nodes.length;e=0;e--){var s,u=a[e];u.nodes||(u.nodes=[]),ne(s=u.nodes).call(s,n)===-1&&u.nodes.push(n)}r.attr&&(n.attr=vi(n.attr,r.attr))}function loe(i,r){if(i.edges||(i.edges=[]),i.edges.push(r),i.edge){var e=vi({},i.edge);r.attr=vi(e,r.attr)}}function nT(i,r,e,t,n){var a={from:r,to:e,type:t};return i.edge&&(a.attr=vi({},i.edge)),a.attr=vi(a.attr||{},n),n!=null&&n.hasOwnProperty("arrows")&&n.arrows!=null&&(a.arrows={to:{enabled:!0,type:n.arrows.type}},n.arrows=null),a}function ge(){for(_t=ft.NULL,G="";ee===" "||ee===" "||ee===` +`}},{key:"print",value:function(e){return ls(e).replace(/(")|(\[)|(\])|(,"__type__")/g,"").replace(/(,)/g,", ")}},{key:"levenshteinDistance",value:function(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;var n=[],a;for(a=0;a<=t.length;a++)n[a]=[a];var o;for(o=0;o<=e.length;o++)n[0][o]=o;for(a=1;a<=t.length;a++)for(o=1;o<=e.length;o++)t.charAt(a-1)==e.charAt(o-1)?n[a][o]=n[a-1][o-1]:n[a][o]=Math.min(n[a-1][o-1]+1,Math.min(n[a][o-1]+1,n[a-1][o]+1));return n[t.length][e.length]}}]),i}(),ioe=gr,noe=eoe,Gn=rp,aoe=toe,tT=xf,ooe=roe;function soe(i){return ri=i,coe()}var rT={fontsize:"font.size",fontcolor:"font.color",labelfontcolor:"font.color",fontname:"font.face",color:["color.border","color.background"],fillcolor:"color.background",tooltip:"title",labeltooltip:"title"},np=zi(rT);np.color="color.color";np.style="dashes";var ft={NULL:0,DELIMITER:1,IDENTIFIER:2,UNKNOWN:3},A1={"{":!0,"}":!0,"[":!0,"]":!0,";":!0,"=":!0,",":!0,"->":!0,"--":!0},ri="",ua=0,ee="",G="",_t=ft.NULL;function uoe(){ua=0,ee=ri.charAt(0)}function Ue(){ua++,ee=ri.charAt(ua)}function kn(){return ri.charAt(ua+1)}function D1(i){var r=i.charCodeAt(0);return r<47?r===35||r===46:r<59?r>47:r<91?r>64:r<96?r===95:r<123?r>96:!1}function vi(i,r){if(i||(i={}),r)for(var e in r)r.hasOwnProperty(e)&&(i[e]=r[e]);return i}function loe(i,r,e){for(var t=r.split("."),n=i;t.length;){var a=t.shift();t.length?(n[a]||(n[a]={}),n=n[a]):n[a]=e}}function iT(i,r){for(var e,t,n=null,a=[i],o=i;o.parent;)a.push(o.parent),o=o.parent;if(o.nodes){for(e=0,t=o.nodes.length;e=0;e--){var s,u=a[e];u.nodes||(u.nodes=[]),ne(s=u.nodes).call(s,n)===-1&&u.nodes.push(n)}r.attr&&(n.attr=vi(n.attr,r.attr))}function hoe(i,r){if(i.edges||(i.edges=[]),i.edges.push(r),i.edge){var e=vi({},i.edge);r.attr=vi(e,r.attr)}}function nT(i,r,e,t,n){var a={from:r,to:e,type:t};return i.edge&&(a.attr=vi({},i.edge)),a.attr=vi(a.attr||{},n),n!=null&&n.hasOwnProperty("arrows")&&n.arrows!=null&&(a.arrows={to:{enabled:!0,type:n.arrows.type}},n.arrows=null),a}function ge(){for(_t=ft.NULL,G="";ee===" "||ee===" "||ee===` `||ee==="\r";)Ue();do{var i=!1;if(ee==="#"){for(var r=ua-1;ri.charAt(r)===" "||ri.charAt(r)===" ";)r--;if(ri.charAt(r)===` `||ri.charAt(r)===""){for(;ee!=""&&ee!=` `;)Ue();i=!0}}if(ee==="/"&&kn()==="/"){for(;ee!=""&&ee!=` `;)Ue();i=!0}if(ee==="/"&&kn()==="*"){for(;ee!="";)if(ee==="*"&&kn()==="/"){Ue(),Ue();break}else Ue();i=!0}for(;ee===" "||ee===" "||ee===` `||ee==="\r";)Ue()}while(i);if(ee===""){_t=ft.DELIMITER;return}var e=ee+kn();if(A1[e]){_t=ft.DELIMITER,G=e,Ue(),Ue();return}if(A1[ee]){_t=ft.DELIMITER,G=ee,Ue();return}if(D1(ee)||ee==="-"){for(G+=ee,Ue();D1(ee);)G+=ee,Ue();G==="false"?G=!1:G==="true"?G=!0:isNaN(Number(G))||(G=Number(G)),_t=ft.IDENTIFIER;return}if(ee==='"'){for(Ue();ee!=""&&(ee!='"'||ee==='"'&&kn()==='"');)ee==='"'?(G+=ee,Ue()):ee==="\\"&&kn()==="n"?(G+=` -`,Ue()):G+=ee,Ue();if(ee!='"')throw vt('End of string " expected');Ue(),_t=ft.IDENTIFIER;return}for(_t=ft.UNKNOWN;ee!="";)G+=ee,Ue();throw new SyntaxError('Syntax error in part "'+uT(G,30)+'"')}function hoe(){var i={};if(soe(),ge(),G==="strict"&&(i.strict=!0,ge()),(G==="graph"||G==="digraph")&&(i.type=G,ge()),_t===ft.IDENTIFIER&&(i.id=G,ge()),G!="{")throw vt("Angle bracket { expected");if(ge(),aT(i),G!="}")throw vt("Angle bracket } expected");if(ge(),G!=="")throw vt("End of file expected");return ge(),delete i.node,delete i.edge,delete i.graph,i}function aT(i){for(;G!==""&&G!="}";)coe(i),G===";"&&ge()}function coe(i){var r=oT(i);if(r){sT(i,r);return}var e=doe(i);if(!e){if(_t!=ft.IDENTIFIER)throw vt("Identifier expected");var t=G;if(ge(),G==="="){if(ge(),_t!=ft.IDENTIFIER)throw vt("Identifier expected");i[t]=G,ge()}else foe(i,t)}}function oT(i){var r=null;if(G==="subgraph"&&(r={},r.type="subgraph",ge(),_t===ft.IDENTIFIER&&(r.id=G,ge())),G==="{"){if(ge(),r||(r={}),r.parent=i,r.node=i.node,r.edge=i.edge,r.graph=i.graph,aT(r),G!="}")throw vt("Angle bracket } expected");ge(),delete r.node,delete r.edge,delete r.graph,delete r.parent,i.subgraphs||(i.subgraphs=[]),i.subgraphs.push(r)}return r}function doe(i){return G==="node"?(ge(),i.node=io(),"node"):G==="edge"?(ge(),i.edge=io(),"edge"):G==="graph"?(ge(),i.graph=io(),"graph"):null}function foe(i,r){var e={id:r},t=io();t&&(e.attr=t),iT(i,e),sT(i,r)}function sT(i,r){for(;G==="->"||G==="--";){var e,t=G;ge();var n=oT(i);if(n)e=n;else{if(_t!=ft.IDENTIFIER)throw vt("Identifier or subgraph expected");e=G,iT(i,{id:e}),ge()}var a=io(),o=nT(i,r,e,t,a);loe(i,o),r=e}}function io(){for(var i,r=null,e={dashed:!0,solid:!1,dotted:[1,5]},t={dot:"circle",box:"box",crow:"crow",curve:"curve",icurve:"inv_curve",normal:"triangle",inv:"inv_triangle",diamond:"diamond",tee:"bar",vee:"vee"},n=new Array,a=new Array;G==="[";){for(ge(),r={};G!==""&&G!="]";){if(_t!=ft.IDENTIFIER)throw vt("Attribute name expected");var o=G;if(ge(),G!="=")throw vt("Equal sign = expected");if(ge(),_t!=ft.IDENTIFIER)throw vt("Attribute value expected");var s=G;o==="style"&&(s=e[s]);var u;o==="arrowhead"&&(u=t[s],o="arrows",s={to:{enabled:!0,type:u}}),o==="arrowtail"&&(u=t[s],o="arrows",s={from:{enabled:!0,type:u}}),n.push({attr:r,name:o,value:s}),a.push(o),ge(),G==","&&ge()}if(G!="]")throw vt("Bracket ] expected");ge()}if(hi(a).call(a,"dir")){var l={};for(l.arrows={},i=0;i"&&(u.arrows="to"),u};fe(n=r.edges).call(n,function(o){var s,u;if(o.from instanceof Object?s=o.from.nodes:s={id:o.from},o.to instanceof Object?u=o.to.nodes:u={id:o.to},o.from instanceof Object&&o.from.edges){var l;fe(l=o.from.edges).call(l,function(c){var d=a(c);e.edges.push(d)})}if(voe(s,u,function(c,d){var f=nT(e,c.id,d.id,o.type,o.attr),v=a(f);e.edges.push(v)}),o.to instanceof Object&&o.to.edges){var h;fe(h=o.to.edges).call(h,function(c){var d=a(c);e.edges.push(d)})}})}return r.attr&&(e.options=r.attr),e}function goe(i,r){var e,t={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};r!=null&&(r.fixed!=null&&(t.nodes.fixed=r.fixed),r.parseColor!=null&&(t.nodes.parseColor=r.parseColor),r.inheritColor!=null&&(t.edges.inheritColor=r.inheritColor));var n=i.edges,a=na(n).call(n,function(s){var u={from:s.source,id:s.id,to:s.target};return s.attributes!=null&&(u.attributes=s.attributes),s.label!=null&&(u.label=s.label),s.attributes!=null&&s.attributes.title!=null&&(u.title=s.attributes.title),s.type==="Directed"&&(u.arrows="to"),s.color&&t.edges.inheritColor===!1&&(u.color=s.color),u}),o=na(e=i.nodes).call(e,function(s){var u={id:s.id,fixed:t.nodes.fixed&&s.x!=null&&s.y!=null};return s.attributes!=null&&(u.attributes=s.attributes),s.label!=null&&(u.label=s.label),s.size!=null&&(u.size=s.size),s.attributes!=null&&s.attributes.title!=null&&(u.title=s.attributes.title),s.title!=null&&(u.title=s.title),s.x!=null&&(u.x=s.x),s.y!=null&&(u.y=s.y),s.color!=null&&(t.nodes.parseColor===!0?u.color=s.color:u.color={background:s.color,border:s.color,highlight:{background:s.color,border:s.color},hover:{background:s.color,border:s.color}}),u});return{nodes:o,edges:a}}var yoe={addDescription:"Click in an empty space to place a new node.",addEdge:"Add Edge",addNode:"Add Node",back:"Back",close:"Close",createEdgeError:"Cannot link edges to a cluster.",del:"Delete selected",deleteClusterError:"Clusters cannot be deleted.",edgeDescription:"Click on a node and drag the edge to another node to connect them.",edit:"Edit",editClusterError:"Clusters cannot be edited.",editEdge:"Edit Edge",editEdgeDescription:"Click on the control points and drag them to a node to connect to it.",editNode:"Edit Node"},moe={addDescription:"Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.",addEdge:"Kante hinzufügen",addNode:"Knoten hinzufügen",back:"Zurück",close:"Schließen",createEdgeError:"Es ist nicht möglich, Kanten mit Clustern zu verbinden.",del:"Lösche Auswahl",deleteClusterError:"Cluster können nicht gelöscht werden.",edgeDescription:"Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.",edit:"Editieren",editClusterError:"Cluster können nicht editiert werden.",editEdge:"Kante editieren",editEdgeDescription:"Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.",editNode:"Knoten editieren"},boe={addDescription:"Haga clic en un lugar vacío para colocar un nuevo nodo.",addEdge:"Añadir arista",addNode:"Añadir nodo",back:"Atrás",close:"Cerrar",createEdgeError:"No se puede conectar una arista a un grupo.",del:"Eliminar selección",deleteClusterError:"No es posible eliminar grupos.",edgeDescription:"Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.",edit:"Editar",editClusterError:"No es posible editar grupos.",editEdge:"Editar arista",editEdgeDescription:"Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.",editNode:"Editar nodo"},$oe={addDescription:"Clicca per aggiungere un nuovo nodo",addEdge:"Aggiungi un vertice",addNode:"Aggiungi un nodo",back:"Indietro",close:"Chiudere",createEdgeError:"Non si possono collegare vertici ad un cluster",del:"Cancella la selezione",deleteClusterError:"I cluster non possono essere cancellati",edgeDescription:"Clicca su un nodo e trascinalo ad un altro nodo per connetterli.",edit:"Modifica",editClusterError:"I clusters non possono essere modificati.",editEdge:"Modifica il vertice",editEdgeDescription:"Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.",editNode:"Modifica il nodo"},woe={addDescription:"Klik op een leeg gebied om een nieuwe node te maken.",addEdge:"Link toevoegen",addNode:"Node toevoegen",back:"Terug",close:"Sluiten",createEdgeError:"Kan geen link maken naar een cluster.",del:"Selectie verwijderen",deleteClusterError:"Clusters kunnen niet worden verwijderd.",edgeDescription:"Klik op een node en sleep de link naar een andere node om ze te verbinden.",edit:"Wijzigen",editClusterError:"Clusters kunnen niet worden aangepast.",editEdge:"Link wijzigen",editEdgeDescription:"Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.",editNode:"Node wijzigen"},_oe={addDescription:"Clique em um espaço em branco para adicionar um novo nó",addEdge:"Adicionar aresta",addNode:"Adicionar nó",back:"Voltar",close:"Fechar",createEdgeError:"Não foi possível linkar arestas a um cluster.",del:"Remover selecionado",deleteClusterError:"Clusters não puderam ser removidos.",edgeDescription:"Clique em um nó e arraste a aresta até outro nó para conectá-los",edit:"Editar",editClusterError:"Clusters não puderam ser editados.",editEdge:"Editar aresta",editEdgeDescription:"Clique nos pontos de controle e os arraste para um nó para conectá-los",editNode:"Editar nó"},Eoe={addDescription:"Кликните в свободное место, чтобы добавить новый узел.",addEdge:"Добавить ребро",addNode:"Добавить узел",back:"Назад",close:"Закрывать",createEdgeError:"Невозможно соединить ребра в кластер.",del:"Удалить выбранное",deleteClusterError:"Кластеры не могут быть удалены",edgeDescription:"Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.",edit:"Редактировать",editClusterError:"Кластеры недоступны для редактирования.",editEdge:"Редактировать ребро",editEdgeDescription:"Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.",editNode:"Редактировать узел"},Soe={addDescription:"单击空白处放置新节点。",addEdge:"添加连接线",addNode:"添加节点",back:"返回",close:"關閉",createEdgeError:"无法将连接线连接到群集。",del:"删除选定",deleteClusterError:"无法删除群集。",edgeDescription:"单击某个节点并将该连接线拖动到另一个节点以连接它们。",edit:"编辑",editClusterError:"无法编辑群集。",editEdge:"编辑连接线",editEdgeDescription:"单击控制节点并将它们拖到节点上连接。",editNode:"编辑节点"},Ooe={addDescription:"Kлікніть на вільне місце, щоб додати новий вузол.",addEdge:"Додати край",addNode:"Додати вузол",back:"Назад",close:"Закрити",createEdgeError:"Не можливо об'єднати краї в групу.",del:"Видалити обране",deleteClusterError:"Групи не можуть бути видалені.",edgeDescription:"Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з'єднати.",edit:"Редагувати",editClusterError:"Групи недоступні для редагування.",editEdge:"Редагувати край",editEdgeDescription:"Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.",editNode:"Редагувати вузол"},Toe={addDescription:"Cliquez dans un endroit vide pour placer un nœud.",addEdge:"Ajouter un lien",addNode:"Ajouter un nœud",back:"Retour",close:"Fermer",createEdgeError:"Impossible de créer un lien vers un cluster.",del:"Effacer la sélection",deleteClusterError:"Les clusters ne peuvent pas être effacés.",edgeDescription:"Cliquez sur un nœud et glissez le lien vers un autre nœud pour les connecter.",edit:"Éditer",editClusterError:"Les clusters ne peuvent pas être édités.",editEdge:"Éditer le lien",editEdgeDescription:"Cliquez sur les points de contrôle et glissez-les pour connecter un nœud.",editNode:"Éditer le nœud"},Ioe={addDescription:"Kluknutím do prázdného prostoru můžete přidat nový vrchol.",addEdge:"Přidat hranu",addNode:"Přidat vrchol",back:"Zpět",close:"Zavřít",createEdgeError:"Nelze připojit hranu ke shluku.",del:"Smazat výběr",deleteClusterError:"Nelze mazat shluky.",edgeDescription:"Přetažením z jednoho vrcholu do druhého můžete spojit tyto vrcholy novou hranou.",edit:"Upravit",editClusterError:"Nelze upravovat shluky.",editEdge:"Upravit hranu",editEdgeDescription:"Přetažením kontrolního vrcholu hrany ji můžete připojit k jinému vrcholu.",editNode:"Upravit vrchol"},koe=Object.freeze({__proto__:null,cn:Soe,cs:Ioe,de:moe,en:yoe,es:boe,fr:Toe,it:$oe,nl:woe,pt:_oe,ru:Eoe,uk:Ooe});function Poe(i,r){try{var e=r.split(/[-_ /]/,2),t=Te(e,2),n=t[0],a=t[1],o=n!=null?n.toLowerCase():null,s=a!=null?a.toUpperCase():null;if(o&&s){var u=o+"-"+s;if(Object.prototype.hasOwnProperty.call(i,u))return u;var l;console.warn(Gv(l="Unknown variant ".concat(s," of language ")).call(l,o,"."))}if(o){var h=o;if(Object.prototype.hasOwnProperty.call(i,h))return h;console.warn("Unknown language ".concat(o))}return console.warn("Unknown locale ".concat(r,", falling back to English.")),"en"}catch(c){return console.error(c),console.warn("Unexpected error while normalizing locale ".concat(r,", falling back to English.")),"en"}}var xoe=function(){function i(){N(this,i),this.NUM_ITERATIONS=4,this.image=new Image,this.canvas=document.createElement("canvas")}return M(i,[{key:"init",value:function(){if(!this.initialized()){this.src=this.image.src;var e=this.image.width,t=this.image.height;this.width=e,this.height=t;var n=Math.floor(t/2),a=Math.floor(t/4),o=Math.floor(t/8),s=Math.floor(t/16),u=Math.floor(e/2),l=Math.floor(e/4),h=Math.floor(e/8),c=Math.floor(e/16);this.canvas.width=3*l,this.canvas.height=n,this.coordinates=[[0,0,u,n],[u,0,l,a],[u,a,h,o],[5*h,a,c,s]],this._fillMipMap()}}},{key:"initialized",value:function(){return this.coordinates!==void 0}},{key:"_fillMipMap",value:function(){var e=this.canvas.getContext("2d"),t=this.coordinates[0];e.drawImage(this.image,t[0],t[1],t[2],t[3]);for(var n=1;n2){t*=.5;for(var u=0;t>2&&u=this.NUM_ITERATIONS&&(u=this.NUM_ITERATIONS-1);var l=this.coordinates[u];e.drawImage(this.canvas,l[0],l[1],l[2],l[3],n,a,o,s)}else e.drawImage(this.image,n,a,o,s)}}]),i}(),Coe=function(){function i(r){N(this,i),this.images={},this.imageBroken={},this.callback=r}return M(i,[{key:"_tryloadBrokenUrl",value:function(e,t,n){if(!(e===void 0||n===void 0)){if(t===void 0){console.warn("No broken url image defined");return}n.image.onerror=function(){console.error("Could not load brokenImage:",t)},n.image.src=t}}},{key:"_redrawWithImage",value:function(e){this.callback&&this.callback(e)}},{key:"load",value:function(e,t){var n=this,a=this.images[e];if(a)return a;var o=new xoe;return this.images[e]=o,o.image.onload=function(){n._fixImageCoordinates(o.image),o.init(),n._redrawWithImage(o)},o.image.onerror=function(){console.error("Could not load image:",e),n._tryloadBrokenUrl(e,t,o)},o.image.src=e,o}},{key:"_fixImageCoordinates",value:function(e){e.width===0&&(document.body.appendChild(e),e.width=e.offsetWidth,e.height=e.offsetHeight,document.body.removeChild(e))}}]),i}(),lT={exports:{}},Aoe=ae,Doe=Aoe(function(){if(typeof ArrayBuffer=="function"){var i=new ArrayBuffer(8);Object.isExtensible(i)&&Object.defineProperty(i,"a",{value:8})}}),Roe=ae,Noe=Ze,Moe=Hr,N1=Doe,$u=Object.isExtensible,Boe=Roe(function(){$u(1)}),Foe=Boe||N1?function(r){return!Noe(r)||N1&&Moe(r)==="ArrayBuffer"?!1:$u?$u(r):!0}:$u,joe=ae,hT=!joe(function(){return Object.isExtensible(Object.preventExtensions({}))}),Loe=q,zoe=se,Hoe=ts,Voe=Ze,ap=Qe,Woe=Ht.f,M1=as,Uoe=Wl,op=Foe,Koe=Dl,Goe=hT,cT=!1,jr=Koe("meta"),qoe=0,sp=function(i){Woe(i,jr,{value:{objectID:"O"+qoe++,weakData:{}}})},Yoe=function(i,r){if(!Voe(i))return typeof i=="symbol"?i:(typeof i=="string"?"S":"P")+i;if(!ap(i,jr)){if(!op(i))return"F";if(!r)return"E";sp(i)}return i[jr].objectID},Xoe=function(i,r){if(!ap(i,jr)){if(!op(i))return!0;if(!r)return!1;sp(i)}return i[jr].weakData},Joe=function(i){return Goe&&cT&&op(i)&&!ap(i,jr)&&sp(i),i},Zoe=function(){Qoe.enable=function(){},cT=!0;var i=M1.f,r=zoe([].splice),e={};e[jr]=1,i(e).length&&(M1.f=function(t){for(var n=i(t),a=0,o=n.length;ac;c++)if(f=y(i[c]),f&&B1(j1,f))return f;return new wu(!1)}l=ose(i,h)}for(v=a?i.next:l.next;!(p=tse(v,l)).done;){try{f=y(p.value)}catch(m){F1(l,"throw",m)}if(typeof f=="object"&&f&&B1(j1,f))return f}return new wu(!1)},lse=Be,hse=TypeError,lp=function(i,r){if(lse(r,i))return i;throw new hse("Incorrect invocation")},cse=q,dse=Pe,fse=eh,vse=ae,pse=Pa,gse=up,yse=lp,mse=Xe,bse=Ze,$se=Oa,wse=Ca,_se=Ht.f,Ese=wi.forEach,Sse=Je,dT=ln,Ose=dT.set,Tse=dT.getterFor,hp=function(i,r,e){var t=i.indexOf("Map")!==-1,n=i.indexOf("Weak")!==-1,a=t?"set":"add",o=dse[i],s=o&&o.prototype,u={},l;if(!Sse||!mse(o)||!(n||s.forEach&&!vse(function(){new o().entries().next()})))l=e.getConstructor(r,i,t,a),fse.enable();else{l=r(function(d,f){Ose(yse(d,h),{type:i,collection:new o}),$se(f)||gse(f,d[a],{that:d,AS_ENTRIES:t})});var h=l.prototype,c=Tse(i);Ese(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(d){var f=d==="add"||d==="set";d in s&&!(n&&d==="clear")&&pse(h,d,function(v,p){var g=c(this).collection;if(!f&&n&&!bse(v))return d==="get"?void 0:!1;var y=g[d](v===0?0:v,p);return f?this:y})}),n||_se(h,"size",{configurable:!0,get:function(){return c(this).collection.size}})}return wse(l,i,!1,!0),u[i]=l,cse({global:!0,forced:!0},u),n||e.setStrong(l,i,t),l},Ise=is,cp=function(i,r,e){for(var t in r)e&&e.unsafe&&i[t]?i[t]=r[t]:Ise(i,t,r[t],e);return i},kse=Jt,Pse=zv,xse=xe,Cse=Je,L1=xse("species"),Ase=function(i){var r=kse(i);Cse&&r&&!r[L1]&&Pse(r,L1,{configurable:!0,get:function(){return this}})},Dse=xa,Rse=zv,z1=cp,Nse=Qo,Mse=lp,Bse=Oa,Fse=up,jse=Mv,eu=Bv,Lse=Ase,Ha=Je,H1=eh.fastKey,fT=ln,V1=fT.set,ld=fT.getterFor,vT={getConstructor:function(i,r,e,t){var n=i(function(l,h){Mse(l,a),V1(l,{type:r,index:Dse(null),first:void 0,last:void 0,size:0}),Ha||(l.size=0),Bse(h)||Fse(h,l[t],{that:l,AS_ENTRIES:e})}),a=n.prototype,o=ld(r),s=function(l,h,c){var d=o(l),f=u(l,h),v,p;return f?f.value=c:(d.last=f={index:p=H1(h,!0),key:h,value:c,previous:v=d.last,next:void 0,removed:!1},d.first||(d.first=f),v&&(v.next=f),Ha?d.size++:l.size++,p!=="F"&&(d.index[p]=f)),l},u=function(l,h){var c=o(l),d=H1(h),f;if(d!=="F")return c.index[d];for(f=c.first;f;f=f.next)if(f.key===h)return f};return z1(a,{clear:function(){for(var h=this,c=o(h),d=c.index,f=c.first;f;)f.removed=!0,f.previous&&(f.previous=f.previous.next=void 0),delete d[f.index],f=f.next;c.first=c.last=void 0,Ha?c.size=0:h.size=0},delete:function(l){var h=this,c=o(h),d=u(h,l);if(d){var f=d.next,v=d.previous;delete c.index[d.index],d.removed=!0,v&&(v.next=f),f&&(f.previous=v),c.first===d&&(c.first=f),c.last===d&&(c.last=v),Ha?c.size--:h.size--}return!!d},forEach:function(h){for(var c=o(this),d=Nse(h,arguments.length>1?arguments[1]:void 0),f;f=f?f.next:c.first;)for(d(f.value,f.key,this);f&&f.removed;)f=f.previous},has:function(h){return!!u(this,h)}}),z1(a,e?{get:function(h){var c=u(this,h);return c&&c.value},set:function(h,c){return s(this,h===0?0:h,c)}}:{add:function(h){return s(this,h=h===0?0:h,h)}}),Ha&&Rse(a,"size",{configurable:!0,get:function(){return o(this).size}}),n},setStrong:function(i,r,e){var t=r+" Iterator",n=ld(r),a=ld(t);jse(i,r,function(o,s){V1(this,{type:t,target:o,state:n(o),kind:s,last:void 0})},function(){for(var o=a(this),s=o.kind,u=o.last;u&&u.removed;)u=u.previous;return!o.target||!(o.last=u=u?u.next:o.state.first)?(o.target=void 0,eu(void 0,!0)):eu(s==="keys"?u.key:s==="values"?u.value:[u.key,u.value],!1)},e?"entries":"values",!e,!0),Lse(r)}},zse=hp,Hse=vT;zse("Map",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},Hse);var Vse=oe,Wse=Vse.Map,Use=Wse,Kse=Use,Gse=Kse,pT=V(Gse),qse=function(){function i(){N(this,i),this.clear(),this._defaultIndex=0,this._groupIndex=0,this._defaultGroups=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}},{border:"#990000",background:"#EE0000",highlight:{border:"#BB0000",background:"#FF3333"},hover:{border:"#BB0000",background:"#FF3333"}},{border:"#FF6000",background:"#FF6000",highlight:{border:"#FF6000",background:"#FF6000"},hover:{border:"#FF6000",background:"#FF6000"}},{border:"#97C2FC",background:"#2B7CE9",highlight:{border:"#D2E5FF",background:"#2B7CE9"},hover:{border:"#D2E5FF",background:"#2B7CE9"}},{border:"#399605",background:"#255C03",highlight:{border:"#399605",background:"#255C03"},hover:{border:"#399605",background:"#255C03"}},{border:"#B70054",background:"#FF007E",highlight:{border:"#B70054",background:"#FF007E"},hover:{border:"#B70054",background:"#FF007E"}},{border:"#AD85E4",background:"#7C29F0",highlight:{border:"#D3BDF0",background:"#7C29F0"},hover:{border:"#D3BDF0",background:"#7C29F0"}},{border:"#4557FA",background:"#000EA1",highlight:{border:"#6E6EFD",background:"#000EA1"},hover:{border:"#6E6EFD",background:"#000EA1"}},{border:"#FFC0CB",background:"#FD5A77",highlight:{border:"#FFD1D9",background:"#FD5A77"},hover:{border:"#FFD1D9",background:"#FD5A77"}},{border:"#C2FABC",background:"#74D66A",highlight:{border:"#E6FFE3",background:"#74D66A"},hover:{border:"#E6FFE3",background:"#74D66A"}},{border:"#EE0000",background:"#990000",highlight:{border:"#FF3333",background:"#BB0000"},hover:{border:"#FF3333",background:"#BB0000"}}],this.options={},this.defaultOptions={useDefaultGroups:!0},Le(this.options,this.defaultOptions)}return M(i,[{key:"setOptions",value:function(e){var t=["useDefaultGroups"];if(e!==void 0){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&ne(t).call(t,n)===-1){var a=e[n];this.add(n,a)}}}},{key:"clear",value:function(){this._groups=new pT,this._groupNames=[]}},{key:"get",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this._groups.get(e);if(n===void 0&&t)if(this.options.useDefaultGroups===!1&&this._groupNames.length>0){var a=this._groupIndex%this._groupNames.length;++this._groupIndex,n={},n.color=this._groups.get(this._groupNames[a]),this._groups.set(e,n)}else{var o=this._defaultIndex%this._defaultGroups.length;this._defaultIndex++,n={},n.color=this._defaultGroups[o],this._groups.set(e,n)}return n}},{key:"add",value:function(e,t){return this._groups.has(e)||this._groupNames.push(e),this._groups.set(e,t),t}}]),i}(),Yse=q;Yse({target:"Number",stat:!0},{isNaN:function(r){return r!==r}});var Xse=oe,Jse=Xse.Number.isNaN,Zse=Jse,Qse=Zse,eue=Qse,Cf=V(eue),tue=Pe,rue=tue.isFinite,iue=Number.isFinite||function(r){return typeof r=="number"&&rue(r)},nue=q,aue=iue;nue({target:"Number",stat:!0},{isFinite:aue});var oue=oe,sue=oue.Number.isFinite,uue=sue,lue=uue,hue=lue,Di=V(hue),cue=q,due=wi.some,fue=Ra,vue=fue("some");cue({target:"Array",proto:!0,forced:!vue},{some:function(r){return due(this,r,arguments.length>1?arguments[1]:void 0)}});var pue=et,gue=pue("Array").some,yue=Be,mue=gue,hd=Array.prototype,bue=function(i){var r=i.some;return i===hd||yue(hd,i)&&r===hd.some?mue:r},$ue=bue,wue=$ue,_ue=wue,Eue=V(_ue),Sue=oe,Oue=Sue.Object.getOwnPropertySymbols,Tue=Oue,Iue=Tue,kue=Iue,pi=V(kue),gT={exports:{}},Pue=q,xue=ae,Cue=_r,yT=Sa.f,mT=Je,Aue=!mT||xue(function(){yT(1)});Pue({target:"Object",stat:!0,forced:Aue,sham:!mT},{getOwnPropertyDescriptor:function(r,e){return yT(Cue(r),e)}});var Due=oe,bT=Due.Object,Rue=gT.exports=function(r,e){return bT.getOwnPropertyDescriptor(r,e)};bT.getOwnPropertyDescriptor.sham&&(Rue.sham=!0);var Nue=gT.exports,Mue=Nue,$T=Mue,Bue=$T,Ei=V(Bue),Fue=q,jue=Je,Lue=rte,zue=_r,Hue=Sa,Vue=Da;Fue({target:"Object",stat:!0,sham:!jue},{getOwnPropertyDescriptors:function(r){for(var e=zue(r),t=Hue.f,n=Lue(e),a={},o=0,s,u;n.length>o;)u=t(e,s=n[o++]),u!==void 0&&Vue(a,s,u);return a}});var Wue=oe,Uue=Wue.Object.getOwnPropertyDescriptors,Kue=Uue,Gue=Kue,que=Gue,gi=V(que),wT={exports:{}},Yue=q,Xue=Je,W1=jl.f;Yue({target:"Object",stat:!0,forced:Object.defineProperties!==W1,sham:!Xue},{defineProperties:W1});var Jue=oe,_T=Jue.Object,Zue=wT.exports=function(r,e){return _T.defineProperties(r,e)};_T.defineProperties.sham&&(Zue.sham=!0);var Que=wT.exports,ele=Que,tle=ele,rle=tle,th=V(rle),ile=TS,rh=V(ile);function ih(i,r,e){return r=aO(r),r in i?Vl(i,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[r]=e,i}var ET=Pe,nle=ae,ale=se,ole=Er,sle=yO.trim,ule=qv,lle=ale("".charAt),Ju=ET.parseFloat,U1=ET.Symbol,K1=U1&&U1.iterator,hle=1/Ju(ule+"-0")!==-1/0||K1&&!nle(function(){Ju(Object(K1))}),cle=hle?function(r){var e=sle(ole(r)),t=Ju(e);return t===0&&lle(e,0)==="-"?-0:t}:Ju,dle=q,G1=cle;dle({global:!0,forced:parseFloat!==G1},{parseFloat:G1});var fle=oe,vle=fle.parseFloat,ple=vle,gle=ple,yle=gle,ST=V(yle),mle=q,ble=ae,$le=Wl.f,wle=ble(function(){return!Object.getOwnPropertyNames(1)});mle({target:"Object",stat:!0,forced:wle},{getOwnPropertyNames:$le});var _le=oe,Ele=_le.Object,Sle=function(r){return Ele.getOwnPropertyNames(r)},Ole=Sle,Tle=Ole,Ile=Tle,kle=V(Ile);function dp(i,r){var e=["node","edge","label"],t=!0,n=Qr(r,"chosen");if(typeof n=="boolean")t=n;else if(de(n)==="object"){if(ne(e).call(e,i)===-1)throw new Error("choosify: subOption '"+i+"' should be one of '"+e.join("', '")+"'");var a=Qr(r,["chosen",i]);(typeof a=="boolean"||typeof a=="function")&&(t=a)}return t}function Af(i,r,e){if(i.width<=0||i.height<=0)return!1;if(e!==void 0){var t={x:r.x-e.x,y:r.y-e.y};if(e.angle!==0){var n=-e.angle,a={x:Math.cos(n)*t.x-Math.sin(n)*t.y,y:Math.sin(n)*t.x+Math.cos(n)*t.y};r=a}else r=t}var o=i.x+i.width,s=i.y+i.width;return i.leftr.x&&i.topr.y}function Zu(i){return typeof i=="string"&&i!==""}function OT(i,r,e,t){var n=t.x,a=t.y;if(typeof t.distanceToBorder=="function"){var o=t.distanceToBorder(i,r),s=Math.sin(r)*o,u=Math.cos(r)*o;u===o?(n+=o,a=t.y):s===o?(n=t.x,a-=o):(n+=u,a-=s)}else t.shape.width>t.shape.height?(n=t.x+t.shape.width*.5,a=t.y-e):(n=t.x+e,a=t.y-t.shape.height*.5);return{x:n,y:a}}var Ple=et,xle=Ple("Array").values,Cle=xle,Ale=Cle,Dle=un,Rle=Qe,Nle=Be,Mle=Ale,cd=Array.prototype,Ble={DOMTokenList:!0,NodeList:!0},Fle=function(i){var r=i.values;return i===cd||Nle(cd,i)&&r===cd.values||Rle(Ble,Dle(i))?Mle:r},jle=Fle,TT=V(jle),Lle=function(){function i(r){N(this,i),this.measureText=r,this.current=0,this.width=0,this.height=0,this.lines=[]}return M(i,[{key:"_add",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"normal";this.lines[e]===void 0&&(this.lines[e]={width:0,height:0,blocks:[]});var a=t;(t===void 0||t==="")&&(a=" ");var o=this.measureText(a,n),s=Le({},TT(o));s.text=t,s.width=o.width,s.mod=n,(t===void 0||t==="")&&(s.width=0),this.lines[e].blocks.push(s),this.lines[e].width+=s.width}},{key:"curWidth",value:function(){var e=this.lines[this.current];return e===void 0?0:e.width}},{key:"append",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t)}},{key:"newLine",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t),this.current++}},{key:"determineLineHeights",value:function(){for(var e=0;ee&&(e=a.width),t+=a.height}this.width=e,this.height=t}},{key:"removeEmptyBlocks",value:function(){for(var e=[],t=0;t"://,""://,""://,"":/<\/b>/,"":/<\/i>/,"":/<\/code>/,"*":/\*/,_:/_/,"`":/`/,afterBold:/[^*]/,afterItal:/[^_]/,afterMono:/[^`]/},q1=function(){function i(r){N(this,i),this.text=r,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer="",this.modStack=[],this.blocks=[]}return M(i,[{key:"mod",value:function(){return this.modStack.length===0?"normal":this.modStack[0]}},{key:"modName",value:function(){if(this.modStack.length===0)return"normal";if(this.modStack[0]==="mono")return"mono";if(this.bold&&this.ital)return"boldital";if(this.bold)return"bold";if(this.ital)return"ital"}},{key:"emitBlock",value:function(){this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(this.blocks.push({text:this.buffer,mod:this.modName()}),this.buffer="")}},{key:"add",value:function(e){e===" "&&(this.spacing=!0),this.spacing&&(this.buffer+=" ",this.spacing=!1),e!=" "&&(this.buffer+=e)}},{key:"parseWS",value:function(e){return/[ \t]/.test(e)?(this.mono?this.add(e):this.spacing=!0,!0):!1}},{key:"setTag",value:function(e){this.emitBlock(),this[e]=!0,this.modStack.unshift(e)}},{key:"unsetTag",value:function(e){this.emitBlock(),this[e]=!1,this.modStack.shift()}},{key:"parseStartTag",value:function(e,t){return!this.mono&&!this[e]&&this.match(t)?(this.setTag(e),!0):!1}},{key:"match",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this.prepareRegExp(e),a=Te(n,2),o=a[0],s=a[1],u=o.test(this.text.substr(this.position,s));return u&&t&&(this.position+=s-1),u}},{key:"parseEndTag",value:function(e,t,n){var a=this.mod()===e;return e==="mono"?a=a&&this.mono:a=a&&!this.mono,a&&this.match(t)?(n!==void 0?(this.position===this.text.length-1||this.match(n,!1))&&this.unsetTag(e):this.unsetTag(e),!0):!1}},{key:"replace",value:function(e,t){return this.match(e)?(this.add(t),this.position+=length-1,!0):!1}},{key:"prepareRegExp",value:function(e){var t,n;if(e instanceof RegExp)n=e,t=1;else{var a=zle[e];a!==void 0?n=a:n=new RegExp(e),t=e.length}return[n,t]}}]),i}(),Hle=function(){function i(r,e,t,n){var a=this;N(this,i),this.ctx=r,this.parent=e,this.selected=t,this.hover=n;var o=function(u,l){if(u===void 0)return 0;var h=a.parent.getFormattingValues(r,t,n,l),c=0;if(u!==""){var d=a.ctx.measureText(u);c=d.width}return{width:c,values:h}};this.lines=new Lle(o)}return M(i,[{key:"process",value:function(e){if(!Zu(e))return this.lines.finalize();var t=this.parent.fontOptions;e=e.replace(/\r\n/g,` +`,Ue()):G+=ee,Ue();if(ee!='"')throw vt('End of string " expected');Ue(),_t=ft.IDENTIFIER;return}for(_t=ft.UNKNOWN;ee!="";)G+=ee,Ue();throw new SyntaxError('Syntax error in part "'+uT(G,30)+'"')}function coe(){var i={};if(uoe(),ge(),G==="strict"&&(i.strict=!0,ge()),(G==="graph"||G==="digraph")&&(i.type=G,ge()),_t===ft.IDENTIFIER&&(i.id=G,ge()),G!="{")throw vt("Angle bracket { expected");if(ge(),aT(i),G!="}")throw vt("Angle bracket } expected");if(ge(),G!=="")throw vt("End of file expected");return ge(),delete i.node,delete i.edge,delete i.graph,i}function aT(i){for(;G!==""&&G!="}";)doe(i),G===";"&&ge()}function doe(i){var r=oT(i);if(r){sT(i,r);return}var e=foe(i);if(!e){if(_t!=ft.IDENTIFIER)throw vt("Identifier expected");var t=G;if(ge(),G==="="){if(ge(),_t!=ft.IDENTIFIER)throw vt("Identifier expected");i[t]=G,ge()}else voe(i,t)}}function oT(i){var r=null;if(G==="subgraph"&&(r={},r.type="subgraph",ge(),_t===ft.IDENTIFIER&&(r.id=G,ge())),G==="{"){if(ge(),r||(r={}),r.parent=i,r.node=i.node,r.edge=i.edge,r.graph=i.graph,aT(r),G!="}")throw vt("Angle bracket } expected");ge(),delete r.node,delete r.edge,delete r.graph,delete r.parent,i.subgraphs||(i.subgraphs=[]),i.subgraphs.push(r)}return r}function foe(i){return G==="node"?(ge(),i.node=io(),"node"):G==="edge"?(ge(),i.edge=io(),"edge"):G==="graph"?(ge(),i.graph=io(),"graph"):null}function voe(i,r){var e={id:r},t=io();t&&(e.attr=t),iT(i,e),sT(i,r)}function sT(i,r){for(;G==="->"||G==="--";){var e,t=G;ge();var n=oT(i);if(n)e=n;else{if(_t!=ft.IDENTIFIER)throw vt("Identifier or subgraph expected");e=G,iT(i,{id:e}),ge()}var a=io(),o=nT(i,r,e,t,a);hoe(i,o),r=e}}function io(){for(var i,r=null,e={dashed:!0,solid:!1,dotted:[1,5]},t={dot:"circle",box:"box",crow:"crow",curve:"curve",icurve:"inv_curve",normal:"triangle",inv:"inv_triangle",diamond:"diamond",tee:"bar",vee:"vee"},n=new Array,a=new Array;G==="[";){for(ge(),r={};G!==""&&G!="]";){if(_t!=ft.IDENTIFIER)throw vt("Attribute name expected");var o=G;if(ge(),G!="=")throw vt("Equal sign = expected");if(ge(),_t!=ft.IDENTIFIER)throw vt("Attribute value expected");var s=G;o==="style"&&(s=e[s]);var u;o==="arrowhead"&&(u=t[s],o="arrows",s={to:{enabled:!0,type:u}}),o==="arrowtail"&&(u=t[s],o="arrows",s={from:{enabled:!0,type:u}}),n.push({attr:r,name:o,value:s}),a.push(o),ge(),G==","&&ge()}if(G!="]")throw vt("Bracket ] expected");ge()}if(hi(a).call(a,"dir")){var l={};for(l.arrows={},i=0;i"&&(u.arrows="to"),u};fe(n=r.edges).call(n,function(o){var s,u;if(o.from instanceof Object?s=o.from.nodes:s={id:o.from},o.to instanceof Object?u=o.to.nodes:u={id:o.to},o.from instanceof Object&&o.from.edges){var l;fe(l=o.from.edges).call(l,function(c){var d=a(c);e.edges.push(d)})}if(poe(s,u,function(c,d){var f=nT(e,c.id,d.id,o.type,o.attr),v=a(f);e.edges.push(v)}),o.to instanceof Object&&o.to.edges){var h;fe(h=o.to.edges).call(h,function(c){var d=a(c);e.edges.push(d)})}})}return r.attr&&(e.options=r.attr),e}function yoe(i,r){var e,t={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};r!=null&&(r.fixed!=null&&(t.nodes.fixed=r.fixed),r.parseColor!=null&&(t.nodes.parseColor=r.parseColor),r.inheritColor!=null&&(t.edges.inheritColor=r.inheritColor));var n=i.edges,a=na(n).call(n,function(s){var u={from:s.source,id:s.id,to:s.target};return s.attributes!=null&&(u.attributes=s.attributes),s.label!=null&&(u.label=s.label),s.attributes!=null&&s.attributes.title!=null&&(u.title=s.attributes.title),s.type==="Directed"&&(u.arrows="to"),s.color&&t.edges.inheritColor===!1&&(u.color=s.color),u}),o=na(e=i.nodes).call(e,function(s){var u={id:s.id,fixed:t.nodes.fixed&&s.x!=null&&s.y!=null};return s.attributes!=null&&(u.attributes=s.attributes),s.label!=null&&(u.label=s.label),s.size!=null&&(u.size=s.size),s.attributes!=null&&s.attributes.title!=null&&(u.title=s.attributes.title),s.title!=null&&(u.title=s.title),s.x!=null&&(u.x=s.x),s.y!=null&&(u.y=s.y),s.color!=null&&(t.nodes.parseColor===!0?u.color=s.color:u.color={background:s.color,border:s.color,highlight:{background:s.color,border:s.color},hover:{background:s.color,border:s.color}}),u});return{nodes:o,edges:a}}var moe={addDescription:"Click in an empty space to place a new node.",addEdge:"Add Edge",addNode:"Add Node",back:"Back",close:"Close",createEdgeError:"Cannot link edges to a cluster.",del:"Delete selected",deleteClusterError:"Clusters cannot be deleted.",edgeDescription:"Click on a node and drag the edge to another node to connect them.",edit:"Edit",editClusterError:"Clusters cannot be edited.",editEdge:"Edit Edge",editEdgeDescription:"Click on the control points and drag them to a node to connect to it.",editNode:"Edit Node"},boe={addDescription:"Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.",addEdge:"Kante hinzufügen",addNode:"Knoten hinzufügen",back:"Zurück",close:"Schließen",createEdgeError:"Es ist nicht möglich, Kanten mit Clustern zu verbinden.",del:"Lösche Auswahl",deleteClusterError:"Cluster können nicht gelöscht werden.",edgeDescription:"Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.",edit:"Editieren",editClusterError:"Cluster können nicht editiert werden.",editEdge:"Kante editieren",editEdgeDescription:"Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.",editNode:"Knoten editieren"},$oe={addDescription:"Haga clic en un lugar vacío para colocar un nuevo nodo.",addEdge:"Añadir arista",addNode:"Añadir nodo",back:"Atrás",close:"Cerrar",createEdgeError:"No se puede conectar una arista a un grupo.",del:"Eliminar selección",deleteClusterError:"No es posible eliminar grupos.",edgeDescription:"Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.",edit:"Editar",editClusterError:"No es posible editar grupos.",editEdge:"Editar arista",editEdgeDescription:"Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.",editNode:"Editar nodo"},woe={addDescription:"Clicca per aggiungere un nuovo nodo",addEdge:"Aggiungi un vertice",addNode:"Aggiungi un nodo",back:"Indietro",close:"Chiudere",createEdgeError:"Non si possono collegare vertici ad un cluster",del:"Cancella la selezione",deleteClusterError:"I cluster non possono essere cancellati",edgeDescription:"Clicca su un nodo e trascinalo ad un altro nodo per connetterli.",edit:"Modifica",editClusterError:"I clusters non possono essere modificati.",editEdge:"Modifica il vertice",editEdgeDescription:"Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.",editNode:"Modifica il nodo"},_oe={addDescription:"Klik op een leeg gebied om een nieuwe node te maken.",addEdge:"Link toevoegen",addNode:"Node toevoegen",back:"Terug",close:"Sluiten",createEdgeError:"Kan geen link maken naar een cluster.",del:"Selectie verwijderen",deleteClusterError:"Clusters kunnen niet worden verwijderd.",edgeDescription:"Klik op een node en sleep de link naar een andere node om ze te verbinden.",edit:"Wijzigen",editClusterError:"Clusters kunnen niet worden aangepast.",editEdge:"Link wijzigen",editEdgeDescription:"Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.",editNode:"Node wijzigen"},Eoe={addDescription:"Clique em um espaço em branco para adicionar um novo nó",addEdge:"Adicionar aresta",addNode:"Adicionar nó",back:"Voltar",close:"Fechar",createEdgeError:"Não foi possível linkar arestas a um cluster.",del:"Remover selecionado",deleteClusterError:"Clusters não puderam ser removidos.",edgeDescription:"Clique em um nó e arraste a aresta até outro nó para conectá-los",edit:"Editar",editClusterError:"Clusters não puderam ser editados.",editEdge:"Editar aresta",editEdgeDescription:"Clique nos pontos de controle e os arraste para um nó para conectá-los",editNode:"Editar nó"},Soe={addDescription:"Кликните в свободное место, чтобы добавить новый узел.",addEdge:"Добавить ребро",addNode:"Добавить узел",back:"Назад",close:"Закрывать",createEdgeError:"Невозможно соединить ребра в кластер.",del:"Удалить выбранное",deleteClusterError:"Кластеры не могут быть удалены",edgeDescription:"Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.",edit:"Редактировать",editClusterError:"Кластеры недоступны для редактирования.",editEdge:"Редактировать ребро",editEdgeDescription:"Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.",editNode:"Редактировать узел"},Ooe={addDescription:"单击空白处放置新节点。",addEdge:"添加连接线",addNode:"添加节点",back:"返回",close:"關閉",createEdgeError:"无法将连接线连接到群集。",del:"删除选定",deleteClusterError:"无法删除群集。",edgeDescription:"单击某个节点并将该连接线拖动到另一个节点以连接它们。",edit:"编辑",editClusterError:"无法编辑群集。",editEdge:"编辑连接线",editEdgeDescription:"单击控制节点并将它们拖到节点上连接。",editNode:"编辑节点"},Toe={addDescription:"Kлікніть на вільне місце, щоб додати новий вузол.",addEdge:"Додати край",addNode:"Додати вузол",back:"Назад",close:"Закрити",createEdgeError:"Не можливо об'єднати краї в групу.",del:"Видалити обране",deleteClusterError:"Групи не можуть бути видалені.",edgeDescription:"Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з'єднати.",edit:"Редагувати",editClusterError:"Групи недоступні для редагування.",editEdge:"Редагувати край",editEdgeDescription:"Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.",editNode:"Редагувати вузол"},Ioe={addDescription:"Cliquez dans un endroit vide pour placer un nœud.",addEdge:"Ajouter un lien",addNode:"Ajouter un nœud",back:"Retour",close:"Fermer",createEdgeError:"Impossible de créer un lien vers un cluster.",del:"Effacer la sélection",deleteClusterError:"Les clusters ne peuvent pas être effacés.",edgeDescription:"Cliquez sur un nœud et glissez le lien vers un autre nœud pour les connecter.",edit:"Éditer",editClusterError:"Les clusters ne peuvent pas être édités.",editEdge:"Éditer le lien",editEdgeDescription:"Cliquez sur les points de contrôle et glissez-les pour connecter un nœud.",editNode:"Éditer le nœud"},koe={addDescription:"Kluknutím do prázdného prostoru můžete přidat nový vrchol.",addEdge:"Přidat hranu",addNode:"Přidat vrchol",back:"Zpět",close:"Zavřít",createEdgeError:"Nelze připojit hranu ke shluku.",del:"Smazat výběr",deleteClusterError:"Nelze mazat shluky.",edgeDescription:"Přetažením z jednoho vrcholu do druhého můžete spojit tyto vrcholy novou hranou.",edit:"Upravit",editClusterError:"Nelze upravovat shluky.",editEdge:"Upravit hranu",editEdgeDescription:"Přetažením kontrolního vrcholu hrany ji můžete připojit k jinému vrcholu.",editNode:"Upravit vrchol"},Poe=Object.freeze({__proto__:null,cn:Ooe,cs:koe,de:boe,en:moe,es:$oe,fr:Ioe,it:woe,nl:_oe,pt:Eoe,ru:Soe,uk:Toe});function xoe(i,r){try{var e=r.split(/[-_ /]/,2),t=Te(e,2),n=t[0],a=t[1],o=n!=null?n.toLowerCase():null,s=a!=null?a.toUpperCase():null;if(o&&s){var u=o+"-"+s;if(Object.prototype.hasOwnProperty.call(i,u))return u;var l;console.warn(Gv(l="Unknown variant ".concat(s," of language ")).call(l,o,"."))}if(o){var h=o;if(Object.prototype.hasOwnProperty.call(i,h))return h;console.warn("Unknown language ".concat(o))}return console.warn("Unknown locale ".concat(r,", falling back to English.")),"en"}catch(c){return console.error(c),console.warn("Unexpected error while normalizing locale ".concat(r,", falling back to English.")),"en"}}var Coe=function(){function i(){N(this,i),this.NUM_ITERATIONS=4,this.image=new Image,this.canvas=document.createElement("canvas")}return M(i,[{key:"init",value:function(){if(!this.initialized()){this.src=this.image.src;var e=this.image.width,t=this.image.height;this.width=e,this.height=t;var n=Math.floor(t/2),a=Math.floor(t/4),o=Math.floor(t/8),s=Math.floor(t/16),u=Math.floor(e/2),l=Math.floor(e/4),h=Math.floor(e/8),c=Math.floor(e/16);this.canvas.width=3*l,this.canvas.height=n,this.coordinates=[[0,0,u,n],[u,0,l,a],[u,a,h,o],[5*h,a,c,s]],this._fillMipMap()}}},{key:"initialized",value:function(){return this.coordinates!==void 0}},{key:"_fillMipMap",value:function(){var e=this.canvas.getContext("2d"),t=this.coordinates[0];e.drawImage(this.image,t[0],t[1],t[2],t[3]);for(var n=1;n2){t*=.5;for(var u=0;t>2&&u=this.NUM_ITERATIONS&&(u=this.NUM_ITERATIONS-1);var l=this.coordinates[u];e.drawImage(this.canvas,l[0],l[1],l[2],l[3],n,a,o,s)}else e.drawImage(this.image,n,a,o,s)}}]),i}(),Aoe=function(){function i(r){N(this,i),this.images={},this.imageBroken={},this.callback=r}return M(i,[{key:"_tryloadBrokenUrl",value:function(e,t,n){if(!(e===void 0||n===void 0)){if(t===void 0){console.warn("No broken url image defined");return}n.image.onerror=function(){console.error("Could not load brokenImage:",t)},n.image.src=t}}},{key:"_redrawWithImage",value:function(e){this.callback&&this.callback(e)}},{key:"load",value:function(e,t){var n=this,a=this.images[e];if(a)return a;var o=new Coe;return this.images[e]=o,o.image.onload=function(){n._fixImageCoordinates(o.image),o.init(),n._redrawWithImage(o)},o.image.onerror=function(){console.error("Could not load image:",e),n._tryloadBrokenUrl(e,t,o)},o.image.src=e,o}},{key:"_fixImageCoordinates",value:function(e){e.width===0&&(document.body.appendChild(e),e.width=e.offsetWidth,e.height=e.offsetHeight,document.body.removeChild(e))}}]),i}(),lT={exports:{}},Doe=ae,Roe=Doe(function(){if(typeof ArrayBuffer=="function"){var i=new ArrayBuffer(8);Object.isExtensible(i)&&Object.defineProperty(i,"a",{value:8})}}),Noe=ae,Moe=Ze,Boe=Hr,N1=Roe,$u=Object.isExtensible,Foe=Noe(function(){$u(1)}),joe=Foe||N1?function(r){return!Moe(r)||N1&&Boe(r)==="ArrayBuffer"?!1:$u?$u(r):!0}:$u,Loe=ae,hT=!Loe(function(){return Object.isExtensible(Object.preventExtensions({}))}),zoe=q,Hoe=se,Voe=ts,Woe=Ze,ap=Qe,Uoe=Ht.f,M1=as,Koe=Wl,op=joe,Goe=Dl,qoe=hT,cT=!1,jr=Goe("meta"),Yoe=0,sp=function(i){Uoe(i,jr,{value:{objectID:"O"+Yoe++,weakData:{}}})},Xoe=function(i,r){if(!Woe(i))return typeof i=="symbol"?i:(typeof i=="string"?"S":"P")+i;if(!ap(i,jr)){if(!op(i))return"F";if(!r)return"E";sp(i)}return i[jr].objectID},Joe=function(i,r){if(!ap(i,jr)){if(!op(i))return!0;if(!r)return!1;sp(i)}return i[jr].weakData},Zoe=function(i){return qoe&&cT&&op(i)&&!ap(i,jr)&&sp(i),i},Qoe=function(){ese.enable=function(){},cT=!0;var i=M1.f,r=Hoe([].splice),e={};e[jr]=1,i(e).length&&(M1.f=function(t){for(var n=i(t),a=0,o=n.length;ac;c++)if(f=y(i[c]),f&&B1(j1,f))return f;return new wu(!1)}l=sse(i,h)}for(v=a?i.next:l.next;!(p=rse(v,l)).done;){try{f=y(p.value)}catch(m){F1(l,"throw",m)}if(typeof f=="object"&&f&&B1(j1,f))return f}return new wu(!1)},hse=Be,cse=TypeError,lp=function(i,r){if(hse(r,i))return i;throw new cse("Incorrect invocation")},dse=q,fse=Pe,vse=eh,pse=ae,gse=Pa,yse=up,mse=lp,bse=Xe,$se=Ze,wse=Oa,_se=Ca,Ese=Ht.f,Sse=wi.forEach,Ose=Je,dT=ln,Tse=dT.set,Ise=dT.getterFor,hp=function(i,r,e){var t=i.indexOf("Map")!==-1,n=i.indexOf("Weak")!==-1,a=t?"set":"add",o=fse[i],s=o&&o.prototype,u={},l;if(!Ose||!bse(o)||!(n||s.forEach&&!pse(function(){new o().entries().next()})))l=e.getConstructor(r,i,t,a),vse.enable();else{l=r(function(d,f){Tse(mse(d,h),{type:i,collection:new o}),wse(f)||yse(f,d[a],{that:d,AS_ENTRIES:t})});var h=l.prototype,c=Ise(i);Sse(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(d){var f=d==="add"||d==="set";d in s&&!(n&&d==="clear")&&gse(h,d,function(v,p){var g=c(this).collection;if(!f&&n&&!$se(v))return d==="get"?void 0:!1;var y=g[d](v===0?0:v,p);return f?this:y})}),n||Ese(h,"size",{configurable:!0,get:function(){return c(this).collection.size}})}return _se(l,i,!1,!0),u[i]=l,dse({global:!0,forced:!0},u),n||e.setStrong(l,i,t),l},kse=is,cp=function(i,r,e){for(var t in r)e&&e.unsafe&&i[t]?i[t]=r[t]:kse(i,t,r[t],e);return i},Pse=Jt,xse=zv,Cse=xe,Ase=Je,L1=Cse("species"),Dse=function(i){var r=Pse(i);Ase&&r&&!r[L1]&&xse(r,L1,{configurable:!0,get:function(){return this}})},Rse=xa,Nse=zv,z1=cp,Mse=Qo,Bse=lp,Fse=Oa,jse=up,Lse=Mv,eu=Bv,zse=Dse,Ha=Je,H1=eh.fastKey,fT=ln,V1=fT.set,ld=fT.getterFor,vT={getConstructor:function(i,r,e,t){var n=i(function(l,h){Bse(l,a),V1(l,{type:r,index:Rse(null),first:void 0,last:void 0,size:0}),Ha||(l.size=0),Fse(h)||jse(h,l[t],{that:l,AS_ENTRIES:e})}),a=n.prototype,o=ld(r),s=function(l,h,c){var d=o(l),f=u(l,h),v,p;return f?f.value=c:(d.last=f={index:p=H1(h,!0),key:h,value:c,previous:v=d.last,next:void 0,removed:!1},d.first||(d.first=f),v&&(v.next=f),Ha?d.size++:l.size++,p!=="F"&&(d.index[p]=f)),l},u=function(l,h){var c=o(l),d=H1(h),f;if(d!=="F")return c.index[d];for(f=c.first;f;f=f.next)if(f.key===h)return f};return z1(a,{clear:function(){for(var h=this,c=o(h),d=c.index,f=c.first;f;)f.removed=!0,f.previous&&(f.previous=f.previous.next=void 0),delete d[f.index],f=f.next;c.first=c.last=void 0,Ha?c.size=0:h.size=0},delete:function(l){var h=this,c=o(h),d=u(h,l);if(d){var f=d.next,v=d.previous;delete c.index[d.index],d.removed=!0,v&&(v.next=f),f&&(f.previous=v),c.first===d&&(c.first=f),c.last===d&&(c.last=v),Ha?c.size--:h.size--}return!!d},forEach:function(h){for(var c=o(this),d=Mse(h,arguments.length>1?arguments[1]:void 0),f;f=f?f.next:c.first;)for(d(f.value,f.key,this);f&&f.removed;)f=f.previous},has:function(h){return!!u(this,h)}}),z1(a,e?{get:function(h){var c=u(this,h);return c&&c.value},set:function(h,c){return s(this,h===0?0:h,c)}}:{add:function(h){return s(this,h=h===0?0:h,h)}}),Ha&&Nse(a,"size",{configurable:!0,get:function(){return o(this).size}}),n},setStrong:function(i,r,e){var t=r+" Iterator",n=ld(r),a=ld(t);Lse(i,r,function(o,s){V1(this,{type:t,target:o,state:n(o),kind:s,last:void 0})},function(){for(var o=a(this),s=o.kind,u=o.last;u&&u.removed;)u=u.previous;return!o.target||!(o.last=u=u?u.next:o.state.first)?(o.target=void 0,eu(void 0,!0)):eu(s==="keys"?u.key:s==="values"?u.value:[u.key,u.value],!1)},e?"entries":"values",!e,!0),zse(r)}},Hse=hp,Vse=vT;Hse("Map",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},Vse);var Wse=oe,Use=Wse.Map,Kse=Use,Gse=Kse,qse=Gse,pT=V(qse),Yse=function(){function i(){N(this,i),this.clear(),this._defaultIndex=0,this._groupIndex=0,this._defaultGroups=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}},{border:"#990000",background:"#EE0000",highlight:{border:"#BB0000",background:"#FF3333"},hover:{border:"#BB0000",background:"#FF3333"}},{border:"#FF6000",background:"#FF6000",highlight:{border:"#FF6000",background:"#FF6000"},hover:{border:"#FF6000",background:"#FF6000"}},{border:"#97C2FC",background:"#2B7CE9",highlight:{border:"#D2E5FF",background:"#2B7CE9"},hover:{border:"#D2E5FF",background:"#2B7CE9"}},{border:"#399605",background:"#255C03",highlight:{border:"#399605",background:"#255C03"},hover:{border:"#399605",background:"#255C03"}},{border:"#B70054",background:"#FF007E",highlight:{border:"#B70054",background:"#FF007E"},hover:{border:"#B70054",background:"#FF007E"}},{border:"#AD85E4",background:"#7C29F0",highlight:{border:"#D3BDF0",background:"#7C29F0"},hover:{border:"#D3BDF0",background:"#7C29F0"}},{border:"#4557FA",background:"#000EA1",highlight:{border:"#6E6EFD",background:"#000EA1"},hover:{border:"#6E6EFD",background:"#000EA1"}},{border:"#FFC0CB",background:"#FD5A77",highlight:{border:"#FFD1D9",background:"#FD5A77"},hover:{border:"#FFD1D9",background:"#FD5A77"}},{border:"#C2FABC",background:"#74D66A",highlight:{border:"#E6FFE3",background:"#74D66A"},hover:{border:"#E6FFE3",background:"#74D66A"}},{border:"#EE0000",background:"#990000",highlight:{border:"#FF3333",background:"#BB0000"},hover:{border:"#FF3333",background:"#BB0000"}}],this.options={},this.defaultOptions={useDefaultGroups:!0},Le(this.options,this.defaultOptions)}return M(i,[{key:"setOptions",value:function(e){var t=["useDefaultGroups"];if(e!==void 0){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&ne(t).call(t,n)===-1){var a=e[n];this.add(n,a)}}}},{key:"clear",value:function(){this._groups=new pT,this._groupNames=[]}},{key:"get",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this._groups.get(e);if(n===void 0&&t)if(this.options.useDefaultGroups===!1&&this._groupNames.length>0){var a=this._groupIndex%this._groupNames.length;++this._groupIndex,n={},n.color=this._groups.get(this._groupNames[a]),this._groups.set(e,n)}else{var o=this._defaultIndex%this._defaultGroups.length;this._defaultIndex++,n={},n.color=this._defaultGroups[o],this._groups.set(e,n)}return n}},{key:"add",value:function(e,t){return this._groups.has(e)||this._groupNames.push(e),this._groups.set(e,t),t}}]),i}(),Xse=q;Xse({target:"Number",stat:!0},{isNaN:function(r){return r!==r}});var Jse=oe,Zse=Jse.Number.isNaN,Qse=Zse,eue=Qse,tue=eue,Cf=V(tue),rue=Pe,iue=rue.isFinite,nue=Number.isFinite||function(r){return typeof r=="number"&&iue(r)},aue=q,oue=nue;aue({target:"Number",stat:!0},{isFinite:oue});var sue=oe,uue=sue.Number.isFinite,lue=uue,hue=lue,cue=hue,Di=V(cue),due=q,fue=wi.some,vue=Ra,pue=vue("some");due({target:"Array",proto:!0,forced:!pue},{some:function(r){return fue(this,r,arguments.length>1?arguments[1]:void 0)}});var gue=et,yue=gue("Array").some,mue=Be,bue=yue,hd=Array.prototype,$ue=function(i){var r=i.some;return i===hd||mue(hd,i)&&r===hd.some?bue:r},wue=$ue,_ue=wue,Eue=_ue,Sue=V(Eue),Oue=oe,Tue=Oue.Object.getOwnPropertySymbols,Iue=Tue,kue=Iue,Pue=kue,pi=V(Pue),gT={exports:{}},xue=q,Cue=ae,Aue=_r,yT=Sa.f,mT=Je,Due=!mT||Cue(function(){yT(1)});xue({target:"Object",stat:!0,forced:Due,sham:!mT},{getOwnPropertyDescriptor:function(r,e){return yT(Aue(r),e)}});var Rue=oe,bT=Rue.Object,Nue=gT.exports=function(r,e){return bT.getOwnPropertyDescriptor(r,e)};bT.getOwnPropertyDescriptor.sham&&(Nue.sham=!0);var Mue=gT.exports,Bue=Mue,$T=Bue,Fue=$T,Ei=V(Fue),jue=q,Lue=Je,zue=ite,Hue=_r,Vue=Sa,Wue=Da;jue({target:"Object",stat:!0,sham:!Lue},{getOwnPropertyDescriptors:function(r){for(var e=Hue(r),t=Vue.f,n=zue(e),a={},o=0,s,u;n.length>o;)u=t(e,s=n[o++]),u!==void 0&&Wue(a,s,u);return a}});var Uue=oe,Kue=Uue.Object.getOwnPropertyDescriptors,Gue=Kue,que=Gue,Yue=que,gi=V(Yue),wT={exports:{}},Xue=q,Jue=Je,W1=jl.f;Xue({target:"Object",stat:!0,forced:Object.defineProperties!==W1,sham:!Jue},{defineProperties:W1});var Zue=oe,_T=Zue.Object,Que=wT.exports=function(r,e){return _T.defineProperties(r,e)};_T.defineProperties.sham&&(Que.sham=!0);var ele=wT.exports,tle=ele,rle=tle,ile=rle,th=V(ile),nle=TS,rh=V(nle);function ih(i,r,e){return r=aO(r),r in i?Vl(i,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[r]=e,i}var ET=Pe,ale=ae,ole=se,sle=Er,ule=yO.trim,lle=qv,hle=ole("".charAt),Ju=ET.parseFloat,U1=ET.Symbol,K1=U1&&U1.iterator,cle=1/Ju(lle+"-0")!==-1/0||K1&&!ale(function(){Ju(Object(K1))}),dle=cle?function(r){var e=ule(sle(r)),t=Ju(e);return t===0&&hle(e,0)==="-"?-0:t}:Ju,fle=q,G1=dle;fle({global:!0,forced:parseFloat!==G1},{parseFloat:G1});var vle=oe,ple=vle.parseFloat,gle=ple,yle=gle,mle=yle,ST=V(mle),ble=q,$le=ae,wle=Wl.f,_le=$le(function(){return!Object.getOwnPropertyNames(1)});ble({target:"Object",stat:!0,forced:_le},{getOwnPropertyNames:wle});var Ele=oe,Sle=Ele.Object,Ole=function(r){return Sle.getOwnPropertyNames(r)},Tle=Ole,Ile=Tle,kle=Ile,Ple=V(kle);function dp(i,r){var e=["node","edge","label"],t=!0,n=Qr(r,"chosen");if(typeof n=="boolean")t=n;else if(de(n)==="object"){if(ne(e).call(e,i)===-1)throw new Error("choosify: subOption '"+i+"' should be one of '"+e.join("', '")+"'");var a=Qr(r,["chosen",i]);(typeof a=="boolean"||typeof a=="function")&&(t=a)}return t}function Af(i,r,e){if(i.width<=0||i.height<=0)return!1;if(e!==void 0){var t={x:r.x-e.x,y:r.y-e.y};if(e.angle!==0){var n=-e.angle,a={x:Math.cos(n)*t.x-Math.sin(n)*t.y,y:Math.sin(n)*t.x+Math.cos(n)*t.y};r=a}else r=t}var o=i.x+i.width,s=i.y+i.width;return i.leftr.x&&i.topr.y}function Zu(i){return typeof i=="string"&&i!==""}function OT(i,r,e,t){var n=t.x,a=t.y;if(typeof t.distanceToBorder=="function"){var o=t.distanceToBorder(i,r),s=Math.sin(r)*o,u=Math.cos(r)*o;u===o?(n+=o,a=t.y):s===o?(n=t.x,a-=o):(n+=u,a-=s)}else t.shape.width>t.shape.height?(n=t.x+t.shape.width*.5,a=t.y-e):(n=t.x+e,a=t.y-t.shape.height*.5);return{x:n,y:a}}var xle=et,Cle=xle("Array").values,Ale=Cle,Dle=Ale,Rle=un,Nle=Qe,Mle=Be,Ble=Dle,cd=Array.prototype,Fle={DOMTokenList:!0,NodeList:!0},jle=function(i){var r=i.values;return i===cd||Mle(cd,i)&&r===cd.values||Nle(Fle,Rle(i))?Ble:r},Lle=jle,TT=V(Lle),zle=function(){function i(r){N(this,i),this.measureText=r,this.current=0,this.width=0,this.height=0,this.lines=[]}return M(i,[{key:"_add",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"normal";this.lines[e]===void 0&&(this.lines[e]={width:0,height:0,blocks:[]});var a=t;(t===void 0||t==="")&&(a=" ");var o=this.measureText(a,n),s=Le({},TT(o));s.text=t,s.width=o.width,s.mod=n,(t===void 0||t==="")&&(s.width=0),this.lines[e].blocks.push(s),this.lines[e].width+=s.width}},{key:"curWidth",value:function(){var e=this.lines[this.current];return e===void 0?0:e.width}},{key:"append",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t)}},{key:"newLine",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t),this.current++}},{key:"determineLineHeights",value:function(){for(var e=0;ee&&(e=a.width),t+=a.height}this.width=e,this.height=t}},{key:"removeEmptyBlocks",value:function(){for(var e=[],t=0;t"://,""://,""://,"":/<\/b>/,"":/<\/i>/,"":/<\/code>/,"*":/\*/,_:/_/,"`":/`/,afterBold:/[^*]/,afterItal:/[^_]/,afterMono:/[^`]/},q1=function(){function i(r){N(this,i),this.text=r,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer="",this.modStack=[],this.blocks=[]}return M(i,[{key:"mod",value:function(){return this.modStack.length===0?"normal":this.modStack[0]}},{key:"modName",value:function(){if(this.modStack.length===0)return"normal";if(this.modStack[0]==="mono")return"mono";if(this.bold&&this.ital)return"boldital";if(this.bold)return"bold";if(this.ital)return"ital"}},{key:"emitBlock",value:function(){this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(this.blocks.push({text:this.buffer,mod:this.modName()}),this.buffer="")}},{key:"add",value:function(e){e===" "&&(this.spacing=!0),this.spacing&&(this.buffer+=" ",this.spacing=!1),e!=" "&&(this.buffer+=e)}},{key:"parseWS",value:function(e){return/[ \t]/.test(e)?(this.mono?this.add(e):this.spacing=!0,!0):!1}},{key:"setTag",value:function(e){this.emitBlock(),this[e]=!0,this.modStack.unshift(e)}},{key:"unsetTag",value:function(e){this.emitBlock(),this[e]=!1,this.modStack.shift()}},{key:"parseStartTag",value:function(e,t){return!this.mono&&!this[e]&&this.match(t)?(this.setTag(e),!0):!1}},{key:"match",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this.prepareRegExp(e),a=Te(n,2),o=a[0],s=a[1],u=o.test(this.text.substr(this.position,s));return u&&t&&(this.position+=s-1),u}},{key:"parseEndTag",value:function(e,t,n){var a=this.mod()===e;return e==="mono"?a=a&&this.mono:a=a&&!this.mono,a&&this.match(t)?(n!==void 0?(this.position===this.text.length-1||this.match(n,!1))&&this.unsetTag(e):this.unsetTag(e),!0):!1}},{key:"replace",value:function(e,t){return this.match(e)?(this.add(t),this.position+=length-1,!0):!1}},{key:"prepareRegExp",value:function(e){var t,n;if(e instanceof RegExp)n=e,t=1;else{var a=Hle[e];a!==void 0?n=a:n=new RegExp(e),t=e.length}return[n,t]}}]),i}(),Vle=function(){function i(r,e,t,n){var a=this;N(this,i),this.ctx=r,this.parent=e,this.selected=t,this.hover=n;var o=function(u,l){if(u===void 0)return 0;var h=a.parent.getFormattingValues(r,t,n,l),c=0;if(u!==""){var d=a.ctx.measureText(u);c=d.width}return{width:c,values:h}};this.lines=new zle(o)}return M(i,[{key:"process",value:function(e){if(!Zu(e))return this.lines.finalize();var t=this.parent.fontOptions;e=e.replace(/\r\n/g,` `),e=e.replace(/\r/g,` `);var n=String(e).split(` -`),a=n.length;if(t.multi)for(var o=0;o0)for(var u=0;u0)for(var v=0;v")||t.parseStartTag("ital","")||t.parseStartTag("mono","")||t.parseEndTag("bold","")||t.parseEndTag("ital","")||t.parseEndTag("mono",""))||n(a);o||t.add(a),t.position++}return t.emitBlock(),t.blocks}},{key:"splitMarkdownBlocks",value:function(e){for(var t=this,n=new q1(e),a=!0,o=function(h){return/\\/.test(h)?(n.positionthis.parent.fontOptions.maxWdt}},{key:"getLongestFit",value:function(e){for(var t="",n=0;n1&&arguments[1]!==void 0?arguments[1]:"normal",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t),e=e.replace(/^( +)/g,"$1\r"),e=e.replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r");for(var a=e.split("\r");a.length>0;){var o=this.getLongestFit(a);if(o===0){var s=a[0],u=this.getLongestFitWord(s);this.lines.newLine(it(s).call(s,0,u),t),a[0]=it(s).call(s,u)}else{var l=o;a[o-1]===" "?o--:a[l]===" "&&l++;var h=it(a).call(a,0,o).join("");o==a.length&&n?this.lines.append(h,t):this.lines.newLine(h,t),a=it(a).call(a,l)}}}}]),i}(),Va=["bold","ital","boldital","mono"],IT=function(){function i(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;N(this,i),this.body=r,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(e),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=t}return M(i,[{key:"setOptions",value:function(e){if(this.elementOptions=e,this.initFontOptions(e.font),Zu(e.label)?this.labelDirty=!0:e.label=void 0,e.font!==void 0&&e.font!==null){if(typeof e.font=="string")this.baseSize=this.fontOptions.size;else if(de(e.font)==="object"){var t=e.font.size;t!==void 0&&(this.baseSize=t)}}}},{key:"initFontOptions",value:function(e){var t=this;if(te(Va,function(n){t.fontOptions[n]={}}),i.parseFontString(this.fontOptions,e)){this.fontOptions.vadjust=0;return}te(e,function(n,a){n!=null&&de(n)!=="object"&&(t.fontOptions[a]=n)})}},{key:"constrain",value:function(e){var t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},n=Qr(e,"widthConstraint");if(typeof n=="number")t.maxWdt=Number(n),t.minWdt=Number(n);else if(de(n)==="object"){var a=Qr(e,["widthConstraint","maximum"]);typeof a=="number"&&(t.maxWdt=Number(a));var o=Qr(e,["widthConstraint","minimum"]);typeof o=="number"&&(t.minWdt=Number(o))}var s=Qr(e,"heightConstraint");if(typeof s=="number")t.minHgt=Number(s);else if(de(s)==="object"){var u=Qr(e,["heightConstraint","minimum"]);typeof u=="number"&&(t.minHgt=Number(u));var l=Qr(e,["heightConstraint","valign"]);typeof l=="string"&&(l==="top"||l==="bottom")&&(t.valign=l)}return t}},{key:"update",value:function(e,t){this.setOptions(e,!0),this.propagateFonts(t),pe(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=dp("label",t)}},{key:"adjustSizes",value:function(e){var t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);var n=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=n)}},{key:"addFontOptionsToPile",value:function(e,t){for(var n=0;n5&&arguments[5]!==void 0?arguments[5]:"middle";if(this.elementOptions.label!==void 0){var u=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&u=this.elementOptions.scaling.label.maxVisible&&(u=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,a,o,t,n,s),this._drawBackground(e),this._drawText(e,t,this.size.yLine,s,u))}}},{key:"_drawBackground",value:function(e){if(this.fontOptions.background!==void 0&&this.fontOptions.background!=="none"){e.fillStyle=this.fontOptions.background;var t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}},{key:"_drawText",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"middle",o=arguments.length>4?arguments[4]:void 0,s=this._setAlignment(e,t,n,a),u=Te(s,2);t=u[0],n=u[1],e.textAlign="left",t=t-this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&(this.fontOptions.valign==="top"&&(n-=(this.size.height-this.size.labelHeight)/2),this.fontOptions.valign==="bottom"&&(n+=(this.size.height-this.size.labelHeight)/2));for(var l=0;l0&&(e.lineWidth=f.strokeWidth,e.strokeStyle=y,e.lineJoin="round"),e.fillStyle=g,f.strokeWidth>0&&e.strokeText(f.text,t+c,n+f.vadjust),e.fillText(f.text,t+c,n+f.vadjust),c+=f.width}n+=h.height}}}},{key:"_setAlignment",value:function(e,t,n,a){if(this.isEdgeLabel&&this.fontOptions.align!=="horizontal"&&this.pointToSelf===!1){t=0,n=0;var o=2;this.fontOptions.align==="top"?(e.textBaseline="alphabetic",n-=2*o):this.fontOptions.align==="bottom"?(e.textBaseline="hanging",n+=2*o):e.textBaseline="middle"}else e.textBaseline=a;return[t,n]}},{key:"_getColor",value:function(e,t,n){var a=e||"#000000",o=n||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){var s=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));a=Kt(a,s),o=Kt(o,s)}return[a,o]}},{key:"getTextSize",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this._processLabel(e,t,n),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}},{key:"getSize",value:function(){var e=2,t=this.size.left,n=this.size.top-.5*e;if(this.isEdgeLabel){var a=-this.size.width*.5;switch(this.fontOptions.align){case"middle":t=a,n=-this.size.height*.5;break;case"top":t=a,n=-(this.size.height+e);break;case"bottom":t=a,n=e;break}}var o={left:t,top:n,width:this.size.width,height:this.size.height};return o}},{key:"calculateLabelSize",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";this._processLabel(e,t,n),this.size.left=a-this.size.width*.5,this.size.top=o-this.size.height*.5,this.size.yLine=o+(1-this.lineCount)*.5*this.fontOptions.size,s==="hanging"&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}},{key:"getFormattingValues",value:function(e,t,n,a){var o=function(h,c,d){return c==="normal"?d==="mod"?"":h[d]:h[c][d]!==void 0?h[c][d]:h[d]},s={color:o(this.fontOptions,a,"color"),size:o(this.fontOptions,a,"size"),face:o(this.fontOptions,a,"face"),mod:o(this.fontOptions,a,"mod"),vadjust:o(this.fontOptions,a,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||n)&&(a==="normal"&&this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?s.mod="bold":typeof this.fontOptions.chooser=="function"&&this.fontOptions.chooser(s,this.elementOptions.id,t,n));var u="";return s.mod!==void 0&&s.mod!==""&&(u+=s.mod+" "),u+=s.size+"px "+s.face,e.font=u.replace(/"/g,""),s.font=e.font,s.height=s.size,s}},{key:"differentState",value:function(e,t){return e!==this.selectedState||t!==this.hoverState}},{key:"_processLabelText",value:function(e,t,n,a){var o=new Hle(e,this,t,n);return o.process(a)}},{key:"_processLabel",value:function(e,t,n){if(!(this.labelDirty===!1&&!this.differentState(t,n))){var a=this._processLabelText(e,t,n,this.elementOptions.label);this.fontOptions.minWdt>0&&a.width0&&a.height0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}},{key:"performFill",value:function(e,t){e.save(),e.fillStyle=t.color,this.enableShadow(e,t),hs(e).call(e),this.disableShadow(e,t),e.restore(),this.performStroke(e,t)}},{key:"_addBoundingBoxMargin",value:function(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}},{key:"_updateBoundingBox",value:function(e,t,n,a,o){n!==void 0&&this.resize(n,a,o),this.left=e-this.width/2,this.top=t-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}},{key:"updateBoundingBox",value:function(e,t,n,a,o){this._updateBoundingBox(e,t,n,a,o)}},{key:"getDimensionsFromLabel",value:function(e,t,n){this.textSize=this.labelModule.getTextSize(e,t,n);var a=this.textSize.width,o=this.textSize.height,s=14;return a===0&&(a=s,o=s),{width:a,height:o}}}]),i}();function Dhe(i){var r=Rhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Rhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Nhe=function(i){ue(e,i);var r=Dhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o);this.width=s.width+this.margin.right+this.margin.left,this.height=s.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.initContextForDraw(n,l),qE(n,this.left,this.top,this.width,this.height,l.borderRadius),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u)}},{key:"updateBoundingBox",value:function(n,a,o,s,u){this._updateBoundingBox(n,a,o,s,u);var l=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(l)}},{key:"distanceToBorder",value:function(n,a){n&&this.resize(n);var o=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(a)),Math.abs(this.height/2/Math.sin(a)))+o}}]),e}(vn);function Mhe(i){var r=Bhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Bhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var pp=function(i){ue(e,i);var r=Mhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o.labelOffset=0,o.selected=!1,o}return M(e,[{key:"setOptions",value:function(n,a,o){this.options=n,a===void 0&&o===void 0||this.setImages(a,o)}},{key:"setImages",value:function(n,a){a&&this.selected?(this.imageObj=a,this.imageObjAlt=n):(this.imageObj=n,this.imageObjAlt=a)}},{key:"switchImages",value:function(n){var a=n&&!this.selected||!n&&this.selected;if(this.selected=n,this.imageObjAlt!==void 0&&a){var o=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=o}}},{key:"_getImagePadding",value:function(){var n={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){var a=this.options.imagePadding;de(a)=="object"?(n.top=a.top,n.right=a.right,n.bottom=a.bottom,n.left=a.left):(n.top=a,n.right=a,n.bottom=a,n.left=a)}return n}},{key:"_resizeImage",value:function(){var n,a;if(this.options.shapeProperties.useImageSize===!1){var o=1,s=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?o=this.imageObj.width/this.imageObj.height:s=this.imageObj.height/this.imageObj.width),n=this.options.size*2*o,a=this.options.size*2*s}else{var u=this._getImagePadding();n=this.imageObj.width+u.left+u.right,a=this.imageObj.height+u.top+u.bottom}this.width=n,this.height=a,this.radius=.5*this.width}},{key:"_drawRawCircle",value:function(n,a,o,s){this.initContextForDraw(n,s),Av(n,a,o,s.size),this.performFill(n,s)}},{key:"_drawImageAtPosition",value:function(n,a){if(this.imageObj.width!=0){n.globalAlpha=a.opacity!==void 0?a.opacity:1,this.enableShadow(n,a);var o=1;this.options.shapeProperties.interpolation===!0&&(o=this.imageObj.width/this.width/this.body.view.scale);var s=this._getImagePadding(),u=this.left+s.left,l=this.top+s.top,h=this.width-s.left-s.right,c=this.height-s.top-s.bottom;this.imageObj.drawImageAtPosition(n,o,u,l,h,c),this.disableShadow(n,a)}}},{key:"_drawImageLabel",value:function(n,a,o,s,u){var l=0;if(this.height!==void 0){l=this.height*.5;var h=this.labelModule.getTextSize(n,s,u);h.lineCount>=1&&(l+=h.height/2)}var c=o+l;this.options.label&&(this.labelOffset=l),this.labelModule.draw(n,a,c,s,u,"hanging")}}]),e}(vn);function Fhe(i){var r=jhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function jhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Lhe=function(i){ue(e,i);var r=Fhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o),u=Math.max(s.width+this.margin.right+this.margin.left,s.height+this.margin.top+this.margin.bottom);this.options.size=u/2,this.width=u,this.height=u,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this._drawRawCircle(n,a,o,l),this.updateBoundingBox(a,o),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,o,s,u)}},{key:"updateBoundingBox",value:function(n,a){this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.width*.5}}]),e}(pp);function zhe(i){var r=Hhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Hhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Vhe=function(i){ue(e,i);var r=zhe(e);function e(t,n,a,o,s){var u;return N(this,e),u=r.call(this,t,n,a),u.setImages(o,s),u}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0;if(s){var u=this.options.size*2;this.width=u,this.height=u,this.radius=.5*this.width;return}this.needsRefresh(a,o)&&this._resizeImage()}},{key:"draw",value:function(n,a,o,s,u,l){this.switchImages(s),this.resize();var h=a,c=o;this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=a,this.top=o,h+=this.width/2,c+=this.height/2):(this.left=a-this.width/2,this.top=o-this.height/2),this._drawRawCircle(n,h,c,l),n.save(),n.clip(),this._drawImageAtPosition(n,l),n.restore(),this._drawImageLabel(n,h,c,s,u),this.updateBoundingBox(a,o)}},{key:"updateBoundingBox",value:function(n,a){this.options.shapeProperties.coordinateOrigin==="top-left"?(this.boundingBox.top=a,this.boundingBox.left=n,this.boundingBox.right=n+this.options.size*2,this.boundingBox.bottom=a+this.options.size*2):(this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size),this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.width*.5}}]),e}(pp);function Whe(i){var r=Uhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Uhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Si=function(i){ue(e,i);var r=Whe(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{size:this.options.size};if(this.needsRefresh(a,o)){var u,l;this.labelModule.getTextSize(n,a,o);var h=2*s.size;this.width=(u=this.customSizeWidth)!==null&&u!==void 0?u:h,this.height=(l=this.customSizeHeight)!==null&&l!==void 0?l:h,this.radius=.5*this.width}}},{key:"_drawShape",value:function(n,a,o,s,u,l,h,c){var d=this;return this.resize(n,l,h,c),this.left=s-this.width/2,this.top=u-this.height/2,this.initContextForDraw(n,c),TK(a)(n,s,u,c.size),this.performFill(n,c),this.options.icon!==void 0&&this.options.icon.code!==void 0&&(n.font=(l?"bold ":"")+this.height/2+"px "+(this.options.icon.face||"FontAwesome"),n.fillStyle=this.options.icon.color||"black",n.textAlign="center",n.textBaseline="middle",n.fillText(this.options.icon.code,s,u)),{drawExternalLabel:function(){if(d.options.label!==void 0){d.labelModule.calculateLabelSize(n,l,h,s,u,"hanging");var v=u+.5*d.height+.5*d.labelModule.size.height;d.labelModule.draw(n,s,v,l,h,"hanging")}d.updateBoundingBox(s,u)}}}},{key:"updateBoundingBox",value:function(n,a){this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}]),e}(vn);function Q1(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function Khe(i){for(var r=1;r"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Yhe=function(i){ue(e,i);var r=Ghe(e);function e(t,n,a,o){var s;return N(this,e),s=r.call(this,t,n,a,o),s.ctxRenderer=o,s}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u,l),this.left=a-this.width/2,this.top=o-this.height/2,n.save();var h=this.ctxRenderer({ctx:n,id:this.options.id,x:a,y:o,state:{selected:s,hover:u},style:Khe({},l),label:this.options.label});if(h.drawNode!=null&&h.drawNode(),n.restore(),h.drawExternalLabel){var c=h.drawExternalLabel;h.drawExternalLabel=function(){n.save(),c(),n.restore()}}return h.nodeDimensions&&(this.customSizeWidth=h.nodeDimensions.width,this.customSizeHeight=h.nodeDimensions.height),h}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function Xhe(i){var r=Jhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Jhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Zhe=function(i){ue(e,i);var r=Xhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o),u=s.width+this.margin.right+this.margin.left;this.width=u,this.height=u,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.initContextForDraw(n,l),YE(n,a-this.width/2,o-this.height/2,this.width,this.height),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function Qhe(i){var r=ece();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function ece(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var tce=function(i){ue(e,i);var r=Qhe(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"diamond",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function rce(i){var r=ice();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function ice(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var nce=function(i){ue(e,i);var r=rce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"circle",2,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.options.size}}]),e}(Si);function ace(i){var r=oce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function oce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var e$=function(i){ue(e,i);var r=ace(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o);this.height=s.height*2,this.width=s.width+s.height,this.radius=.5*this.width}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width*.5,this.top=o-this.height*.5,this.initContextForDraw(n,l),sf(n,this.left,this.top,this.width,this.height),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,a,o,s,u)}},{key:"distanceToBorder",value:function(n,a){n&&this.resize(n);var o=this.width*.5,s=this.height*.5,u=Math.sin(a)*o,l=Math.cos(a)*s;return o*s/Math.sqrt(u*u+l*l)}}]),e}(vn);function sce(i){var r=uce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function uce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var lce=function(i){ue(e,i);var r=sce(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){this.needsRefresh(a,o)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(n,a,o,s,u,l){var h=this;return this.resize(n,s,u),this.options.icon.size=this.options.icon.size||50,this.left=a-this.width/2,this.top=o-this.height/2,this._icon(n,a,o,s,u,l),{drawExternalLabel:function(){if(h.options.label!==void 0){var d=5;h.labelModule.draw(n,h.left+h.iconSize.width/2+h.margin.left,o+h.height/2+d,s)}h.updateBoundingBox(a,o)}}}},{key:"updateBoundingBox",value:function(n,a){if(this.boundingBox.top=a-this.options.icon.size*.5,this.boundingBox.left=n-this.options.icon.size*.5,this.boundingBox.right=n+this.options.icon.size*.5,this.boundingBox.bottom=a+this.options.icon.size*.5,this.options.label!==void 0&&this.labelModule.size.width>0){var o=5;this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+o)}}},{key:"_icon",value:function(n,a,o,s,u,l){var h=Number(this.options.icon.size);this.options.icon.code!==void 0?(n.font=[this.options.icon.weight!=null?this.options.icon.weight:s?"bold":"",(this.options.icon.weight!=null&&s?5:0)+h+"px",this.options.icon.face].join(" "),n.fillStyle=this.options.icon.color||"black",n.textAlign="center",n.textBaseline="middle",this.enableShadow(n,l),n.fillText(this.options.icon.code,a,o),this.disableShadow(n,l)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function hce(i){var r=cce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function cce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var dce=function(i){ue(e,i);var r=hce(e);function e(t,n,a,o,s){var u;return N(this,e),u=r.call(this,t,n,a),u.setImages(o,s),u}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0;if(s){var u=this.options.size*2;this.width=u,this.height=u;return}this.needsRefresh(a,o)&&this._resizeImage()}},{key:"draw",value:function(n,a,o,s,u,l){n.save(),this.switchImages(s),this.resize();var h=a,c=o;if(this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=a,this.top=o,h+=this.width/2,c+=this.height/2):(this.left=a-this.width/2,this.top=o-this.height/2),this.options.shapeProperties.useBorderWithImage===!0){var d=this.options.borderWidth,f=this.options.borderWidthSelected||2*this.options.borderWidth,v=(s?f:d)/this.body.view.scale;n.lineWidth=Math.min(this.width,v),n.beginPath();var p=s?this.options.color.highlight.border:u?this.options.color.hover.border:this.options.color.border,g=s?this.options.color.highlight.background:u?this.options.color.hover.background:this.options.color.background;l.opacity!==void 0&&(p=Kt(p,l.opacity),g=Kt(g,l.opacity)),n.strokeStyle=p,n.fillStyle=g,n.rect(this.left-.5*n.lineWidth,this.top-.5*n.lineWidth,this.width+n.lineWidth,this.height+n.lineWidth),hs(n).call(n),this.performStroke(n,l),n.closePath()}this._drawImageAtPosition(n,l),this._drawImageLabel(n,h,c,s,u),this.updateBoundingBox(a,o),n.restore()}},{key:"updateBoundingBox",value:function(n,a){this.resize(),this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=n,this.top=a):(this.left=n-this.width/2,this.top=a-this.height/2),this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(pp);function fce(i){var r=vce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function vce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var pce=function(i){ue(e,i);var r=fce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"square",2,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function gce(i){var r=yce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function yce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var mce=function(i){ue(e,i);var r=gce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"hexagon",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function bce(i){var r=$ce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function $ce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var wce=function(i){ue(e,i);var r=bce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"star",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function _ce(i){var r=Ece();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Ece(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Sce=function(i){ue(e,i);var r=_ce(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){this.needsRefresh(a,o)&&(this.textSize=this.labelModule.getTextSize(n,a,o),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.enableShadow(n,l),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u),this.disableShadow(n,l),this.updateBoundingBox(a,o,n,s,u)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function Oce(i){var r=Tce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Tce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Ice=function(i){ue(e,i);var r=Oce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"triangle",3,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function kce(i){var r=Pce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Pce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var xce=function(i){ue(e,i);var r=kce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"triangleDown",3,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function t$(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function r$(i){for(var r=1;re.left&&this.shape.tope.top}},{key:"isBoundingBoxOverlappingWith",value:function(e){return this.shape.boundingBox.lefte.left&&this.shape.boundingBox.tope.top}}],[{key:"checkOpacity",value:function(e){return 0<=e&&e<=1}},{key:"checkCoordinateOrigin",value:function(e){return e===void 0||e==="center"||e==="top-left"}},{key:"updateGroupOptions",value:function(e,t,n){var a;if(n!==void 0){var o=e.group;if(t!==void 0&&t.group!==void 0&&o!==t.group)throw new Error("updateGroupOptions: group values in options don't match.");var s=typeof o=="number"||typeof o=="string"&&o!="";if(s){var u=n.get(o);u.opacity!==void 0&&t.opacity===void 0&&(i.checkOpacity(u.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+u.opacity),u.opacity=void 0));var l=Tt(a=kle(t)).call(a,function(h){return t[h]!=null});l.push("font"),Yu(l,e,u),e.color=If(e.color)}}}},{key:"parseOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=arguments.length>4?arguments[4]:void 0,s=["color","fixed","shadow"];if(Yu(s,e,t,n),i.checkMass(t),e.opacity!==void 0&&(i.checkOpacity(e.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity),e.opacity=void 0)),t.opacity!==void 0&&(i.checkOpacity(t.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+t.opacity),t.opacity=void 0)),t.shapeProperties&&!i.checkCoordinateOrigin(t.shapeProperties.coordinateOrigin)&&console.error("Invalid option for node coordinateOrigin, found: "+t.shapeProperties.coordinateOrigin),Ut(e,t,"shadow",a),t.color!==void 0&&t.color!==null){var u=If(t.color);JO(e.color,u)}else n===!0&&t.color===null&&(e.color=di(a.color));t.fixed!==void 0&&t.fixed!==null&&(typeof t.fixed=="boolean"?(e.fixed.x=t.fixed,e.fixed.y=t.fixed):(t.fixed.x!==void 0&&typeof t.fixed.x=="boolean"&&(e.fixed.x=t.fixed.x),t.fixed.y!==void 0&&typeof t.fixed.y=="boolean"&&(e.fixed.y=t.fixed.y))),n===!0&&t.font===null&&(e.font=di(a.font)),i.updateGroupOptions(e,t,o),t.scaling!==void 0&&Ut(e.scaling,t.scaling,"label",a.scaling)}},{key:"checkMass",value:function(e,t){if(e.mass!==void 0&&e.mass<=0){var n="";t!==void 0&&(n=" in node id: "+t),console.error("%cNegative or zero mass disallowed"+n+", setting mass to 1.",tT),e.mass=1}}}]),i}();function Cce(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=Ace(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Ace(i,r){var e;if(i){if(typeof i=="string")return i$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i$(i,r)}}function i$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity):this.options.opacity=e.opacity),e.shape!==void 0)for(var t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].updateShape();if(typeof e.font<"u"||typeof e.widthConstraint<"u"||typeof e.heightConstraint<"u")for(var n=0,a=Oe(this.body.nodes);n1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.data.nodes;if(IE("id",e))this.body.data.nodes=e;else if(he(e))this.body.data.nodes=new Lu,this.body.data.nodes.add(e);else if(!e)this.body.data.nodes=new Lu;else throw new TypeError("Array or DataSet expected");if(n&&te(this.nodesListeners,function(s,u){n.off(u,s)}),this.body.nodes={},this.body.data.nodes){var a=this;te(this.nodesListeners,function(s,u){a.body.data.nodes.on(u,s)});var o=this.body.data.nodes.getIds();this.add(o,!0)}t===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n,a=[],o=0;o1&&arguments[1]!==void 0?arguments[1]:Nt;return new t(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}},{key:"refresh",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;te(this.body.nodes,function(n,a){var o=e.body.data.nodes.get(a);o!==void 0&&(t===!0&&n.setOptions({x:null,y:null}),n.setOptions({fixed:!1}),n.setOptions(o))})}},{key:"getPositions",value:function(e){var t={};if(e!==void 0){if(he(e)===!0){for(var n=0;n0?(u=s/o,t+=u*u):t+=s;return o===1/0?1/0:o*ode(t)}});var ude=oe,lde=ude.Math.hypot,hde=lde,cde=hde,dde=cde,fde=V(dde);function AT(i){var r=vde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function vde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Ne=function(){function i(){N(this,i)}return M(i,null,[{key:"transform",value:function(e,t){he(e)||(e=[e]);for(var n=t.point.x,a=t.point.y,o=t.angle,s=t.length,u=0;u4&&arguments[4]!==void 0?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,t),e.lineWidth=t.width,t.dashes!==!1?this._drawDashedLine(e,t,o):this._drawLine(e,t,o)}},{key:"_drawLine",value:function(e,t,n,a,o){if(this.from!=this.to)this._line(e,t,n,a,o);else{var s=this._getCircleData(e),u=Te(s,3),l=u[0],h=u[1],c=u[2];this._circle(e,t,l,h,c)}}},{key:"_drawDashedLine",value:function(e,t,n,a,o){e.lineCap="round";var s=he(t.dashes)?t.dashes:[5,5];if(e.setLineDash!==void 0){if(e.save(),e.setLineDash(s),e.lineDashOffset=0,this.from!=this.to)this._line(e,t,n);else{var u=this._getCircleData(e),l=Te(u,3),h=l[0],c=l[1],d=l[2];this._circle(e,t,h,c,d)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)XE(e,this.from.x,this.from.y,this.to.x,this.to.y,s);else{var f=this._getCircleData(e),v=Te(f,3),p=v[0],g=v[1],y=v[2];this._circle(e,t,p,g,y)}this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}}},{key:"findBorderPosition",value:function(e,t,n){return this.from!=this.to?this._findBorderPosition(e,t,n):this._findBorderPositionCircle(e,t,n)}},{key:"findBorderPositions",value:function(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};var t,n=it(t=this._getCircleData(e)).call(t,0,2),a=Te(n,2),o=a[0],s=a[1];return{from:this._findBorderPositionCircle(this.from,e,{x:o,y:s,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:o,y:s,low:.6,high:.8,direction:1})}}},{key:"_getCircleData",value:function(e){var t=this.options.selfReference.size;e!==void 0&&this.from.shape.width===void 0&&this.from.shape.resize(e);var n=OT(e,this.options.selfReference.angle,t,this.from);return[n.x,n.y,t]}},{key:"_pointOnCircle",value:function(e,t,n,a){var o=a*2*Math.PI;return{x:e+n*Math.cos(o),y:t-n*Math.sin(o)}}},{key:"_findBorderPositionCircle",value:function(e,t,n){var a=n.x,o=n.y,s=n.low,u=n.high,l=n.direction,h=10,c=this.options.selfReference.size,d=.05,f,v=(s+u)*.5,p=0;this.options.arrowStrikethrough===!0&&(l===-1?p=this.options.endPointOffset.from:l===1&&(p=this.options.endPointOffset.to));var g=0;do{v=(s+u)*.5,f=this._pointOnCircle(a,o,c,v);var y=Math.atan2(e.y-f.y,e.x-f.x),m=e.distanceToBorder(t,y)+p,$=Math.sqrt(Math.pow(f.x-e.x,2)+Math.pow(f.y-e.y,2)),b=m-$;if(Math.abs(b)0?l>0?s=v:u=v:l>0?u=v:s=v,++g}while(s<=u&&g1?c=1:c<0&&(c=0);var d=e+c*u,f=t+c*l,v=d-o,p=f-s;return Math.sqrt(v*v+p*p)}},{key:"getArrowData",value:function(e,t,n,a,o,s){var u,l,h,c,d,f,v,p=s.width;t==="from"?(h=this.from,c=this.to,d=s.fromArrowScale<0,f=Math.abs(s.fromArrowScale),v=s.fromArrowType):t==="to"?(h=this.to,c=this.from,d=s.toArrowScale<0,f=Math.abs(s.toArrowScale),v=s.toArrowType):(h=this.to,c=this.from,d=s.middleArrowScale<0,f=Math.abs(s.middleArrowScale),v=s.middleArrowType);var g=15*f+3*p;if(h!=c){var y=fde(h.x-c.x,h.y-c.y),m=g/y;if(t!=="middle")if(this.options.smooth.enabled===!0){var $=this._findBorderPosition(h,e,{via:n}),b=this.getPoint($.t+m*(t==="from"?1:-1),n);u=Math.atan2($.y-b.y,$.x-b.x),l=$}else u=Math.atan2(h.y-c.y,h.x-c.x),l=this._findBorderPosition(h,e);else{var O=(d?-m:m)/2,_=this.getPoint(.5+O,n),D=this.getPoint(.5-O,n);u=Math.atan2(_.y-D.y,_.x-D.x),l=this.getPoint(.5,n)}}else{var R=this._getCircleData(e),P=Te(R,3),B=P[0],j=P[1],J=P[2];if(t==="from"){var U=this.options.selfReference.angle,ie=this.options.selfReference.angle+Math.PI,_e=this._findBorderPositionCircle(this.from,e,{x:B,y:j,low:U,high:ie,direction:-1});u=_e.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI,l=_e}else if(t==="to"){var ye=this.options.selfReference.angle,Ae=this.options.selfReference.angle+Math.PI,ht=this._findBorderPositionCircle(this.from,e,{x:B,y:j,low:ye,high:Ae,direction:1});u=ht.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI,l=ht}else{var at=this.options.selfReference.angle/(2*Math.PI);l=this._pointOnCircle(B,j,J,at),u=at*-2*Math.PI+1.5*Math.PI+.1*Math.PI}}var Dt=l.x-g*.9*Math.cos(u),ot=l.y-g*.9*Math.sin(u),me={x:Dt,y:ot};return{point:l,core:me,angle:u,length:g,type:v}}},{key:"drawArrowHead",value:function(e,t,n,a,o){e.strokeStyle=this.getColor(e,t),e.fillStyle=e.strokeStyle,e.lineWidth=t.width;var s=DT.draw(e,o);s&&(this.enableShadow(e,t),hs(e).call(e),this.disableShadow(e,t))}},{key:"enableShadow",value:function(e,t){t.shadow===!0&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}},{key:"disableShadow",value:function(e,t){t.shadow===!0&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}},{key:"drawBackground",value:function(e,t){if(t.background!==!1){var n={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),e.strokeStyle=n.strokeStyle,e.lineWidth=n.lineWidth,e.dashes=n.dashes,this.setStrokeDashed(e,t.dashes)}}},{key:"setStrokeDashed",value:function(e,t){if(t!==!1)if(e.setLineDash!==void 0){var n=he(t)?t:[5,5];e.setLineDash(n)}else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");else e.setLineDash!==void 0?e.setLineDash([]):console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.")}}]),i}();function l$(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function h$(i){for(var r=1;r"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var gp=function(i){ue(e,i);var r=Ide(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_findBorderPositionBezier",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this._getViaCoordinates(),s=10,u=.2,l=!1,h=1,c=0,d=this.to,f,v,p=this.options.endPointOffset?this.options.endPointOffset.to:0;n.id===this.from.id&&(d=this.from,l=!0,p=this.options.endPointOffset?this.options.endPointOffset.from:0),this.options.arrowStrikethrough===!1&&(p=0);var g=0;do{v=(c+h)*.5,f=this.getPoint(v,o);var y=Math.atan2(d.y-f.y,d.x-f.x),m=d.distanceToBorder(a,y)+p,$=Math.sqrt(Math.pow(f.x-d.x,2)+Math.pow(f.y-d.y,2)),b=m-$;if(Math.abs(b)0&&(d=this._getDistanceToLine(y,m,p,g,u,l),c=d"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var c$=function(i){ue(e,i);var r=Pde(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o.via=o.via,o._boundFunction=function(){o.positionBezierNode()},o._body.emitter.on("_repositionBezierNodes",o._boundFunction),o}return M(e,[{key:"setOptions",value:function(n){_u(L(e.prototype),"setOptions",this).call(this,n);var a=!1;this.options.physics!==n.physics&&(a=!0),this.options=n,this.id=this.options.id,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.setupSupportNode(),this.connect(),a===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}},{key:"connect",value:function(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.from===void 0||this.to===void 0||this.options.physics===!1?this.via.setOptions({physics:!1}):this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}},{key:"cleanup",value:function(){return this._body.emitter.off("_repositionBezierNodes",this._boundFunction),this.via!==void 0?(delete this._body.nodes[this.via.id],this.via=void 0,!0):!1}},{key:"setupSupportNode",value:function(){if(this.via===void 0){var n="edgeId:"+this.id,a=this._body.functions.createNode({id:n,shape:"circle",physics:!0,hidden:!0});this._body.nodes[n]=a,this.via=a,this.via.parentEdgeId=this.id,this.positionBezierNode()}}},{key:"positionBezierNode",value:function(){this.via!==void 0&&this.from!==void 0&&this.to!==void 0?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):this.via!==void 0&&(this.via.x=0,this.via.y=0)}},{key:"_line",value:function(n,a,o){this._bezierCurve(n,a,o)}},{key:"_getViaCoordinates",value:function(){return this.via}},{key:"getViaNode",value:function(){return this.via}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.via;if(this.from===this.to){var o=this._getCircleData(),s=Te(o,3),u=s[0],l=s[1],h=s[2],c=2*Math.PI*(1-n);return{x:u+h*Math.sin(c),y:l+h-h*(1-Math.cos(c))}}else return{x:Math.pow(1-n,2)*this.fromPoint.x+2*n*(1-n)*a.x+Math.pow(n,2)*this.toPoint.x,y:Math.pow(1-n,2)*this.fromPoint.y+2*n*(1-n)*a.y+Math.pow(n,2)*this.toPoint.y}}},{key:"_findBorderPosition",value:function(n,a){return this._findBorderPositionBezier(n,a,this.via)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){return this._getDistanceToBezierEdge(n,a,o,s,u,l,this.via)}}]),e}(gp);function Cde(i){var r=Ade();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Ade(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var d$=function(i){ue(e,i);var r=Cde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a,o){this._bezierCurve(n,a,o)}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_getViaCoordinates",value:function(){var n=this.options.smooth.roundness,a=this.options.smooth.type,o=Math.abs(this.from.x-this.to.x),s=Math.abs(this.from.y-this.to.y);if(a==="discrete"||a==="diagonalCross"){var u,l;o<=s?u=l=n*s:u=l=n*o,this.from.x>this.to.x&&(u=-u),this.from.y>=this.to.y&&(l=-l);var h=this.from.x+u,c=this.from.y+l;return a==="discrete"&&(o<=s?h=othis.to.x&&(R=-R),this.from.y>=this.to.y&&(P=-P);var B=this.from.x+R,j=this.from.y+P;return o<=s?this.from.x<=this.to.x?B=this.to.xB?this.to.x:B:this.from.y>=this.to.y?j=this.to.y>j?this.to.y:j:j=this.to.y2&&arguments[2]!==void 0?arguments[2]:{};return this._findBorderPositionBezier(n,a,o.via)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){var h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(n,a,o,s,u,l,h)}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),o=n,s=Math.pow(1-o,2)*this.fromPoint.x+2*o*(1-o)*a.x+Math.pow(o,2)*this.toPoint.x,u=Math.pow(1-o,2)*this.fromPoint.y+2*o*(1-o)*a.y+Math.pow(o,2)*this.toPoint.y;return{x:s,y:u}}}]),e}(gp);function Dde(i){var r=Rde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Rde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Nde=function(i){ue(e,i);var r=Dde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_getDistanceToBezierEdge2",value:function(n,a,o,s,u,l,h,c){for(var d=1e9,f=n,v=a,p=[0,0,0,0],g=1;g<10;g++){var y=.1*g;p[0]=Math.pow(1-y,3),p[1]=3*y*Math.pow(1-y,2),p[2]=3*Math.pow(y,2)*(1-y),p[3]=Math.pow(y,3);var m=p[0]*n+p[1]*h.x+p[2]*c.x+p[3]*o,$=p[0]*a+p[1]*h.y+p[2]*c.y+p[3]*s;if(g>0){var b=this._getDistanceToLine(f,v,m,$,u,l);d=b"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var f$=function(i){ue(e,i);var r=Mde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a,o){var s=o[0],u=o[1];this._bezierCurve(n,a,s,u)}},{key:"_getViaCoordinates",value:function(){var n=this.from.x-this.to.x,a=this.from.y-this.to.y,o,s,u,l,h=this.options.smooth.roundness;return(Math.abs(n)>Math.abs(a)||this.options.smooth.forceDirection===!0||this.options.smooth.forceDirection==="horizontal")&&this.options.smooth.forceDirection!=="vertical"?(s=this.from.y,l=this.to.y,o=this.from.x-h*n,u=this.to.x+h*n):(s=this.from.y-h*a,l=this.to.y+h*a,o=this.from.x,u=this.to.x),[{x:o,y:s},{x:u,y:l}]}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_findBorderPosition",value:function(n,a){return this._findBorderPositionBezier(n,a)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){var h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates(),c=Te(h,2),d=c[0],f=c[1];return this._getDistanceToBezierEdge2(n,a,o,s,u,l,d,f)}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),o=Te(a,2),s=o[0],u=o[1],l=n,h=[Math.pow(1-l,3),3*l*Math.pow(1-l,2),3*Math.pow(l,2)*(1-l),Math.pow(l,3)],c=h[0]*this.fromPoint.x+h[1]*s.x+h[2]*u.x+h[3]*this.toPoint.x,d=h[0]*this.fromPoint.y+h[1]*s.y+h[2]*u.y+h[3]*this.toPoint.y;return{x:c,y:d}}}]),e}(Nde);function Fde(i){var r=jde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function jde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var v$=function(i){ue(e,i);var r=Fde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a){n.beginPath(),n.moveTo(this.fromPoint.x,this.fromPoint.y),n.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(n,a),n.stroke(),this.disableShadow(n,a)}},{key:"getViaNode",value:function(){}},{key:"getPoint",value:function(n){return{x:(1-n)*this.fromPoint.x+n*this.toPoint.x,y:(1-n)*this.fromPoint.y+n*this.toPoint.y}}},{key:"_findBorderPosition",value:function(n,a){var o=this.to,s=this.from;n.id===this.from.id&&(o=this.from,s=this.to);var u=Math.atan2(o.y-s.y,o.x-s.x),l=o.x-s.x,h=o.y-s.y,c=Math.sqrt(l*l+h*h),d=n.distanceToBorder(a,u),f=(c-d)/c;return{x:(1-f)*s.x+f*o.x,y:(1-f)*s.y+f*o.y,t:0}}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){return this._getDistanceToLine(n,a,o,s,u,l)}}]),e}(RT),qn=function(){function i(r,e,t,n,a){if(N(this,i),e===void 0)throw new Error("No body provided");this.options=di(n),this.globalOptions=n,this.defaultOptions=a,this.body=e,this.imagelist=t,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new IT(this.body,this.options,!0),this.setOptions(r)}return M(i,[{key:"setOptions",value:function(e){if(e){var t=typeof e.physics<"u"&&this.options.physics!==e.physics||typeof e.hidden<"u"&&(this.options.hidden||!1)!==(e.hidden||!1)||typeof e.from<"u"&&this.options.from!==e.from||typeof e.to<"u"&&this.options.to!==e.to;i.parseOptions(this.options,e,!0,this.globalOptions),e.id!==void 0&&(this.id=e.id),e.from!==void 0&&(this.fromId=e.from),e.to!==void 0&&(this.toId=e.to),e.title!==void 0&&(this.title=e.title),e.value!==void 0&&(e.value=ST(e.value));var n=[e,this.options,this.defaultOptions];return this.chooser=dp("edge",n),this.updateLabelModule(e),t=this.updateEdgeType()||t,this._setInteractionWidths(),this.connect(),t}}},{key:"getFormattingValues",value:function(){var e=this.options.arrows.to===!0||this.options.arrows.to.enabled===!0,t=this.options.arrows.from===!0||this.options.arrows.from.enabled===!0,n=this.options.arrows.middle===!0||this.options.arrows.middle.enabled===!0,a=this.options.color.inherit,o={toArrow:e,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,toArrowSrc:this.options.arrows.to.src,toArrowImageWidth:this.options.arrows.to.imageWidth,toArrowImageHeight:this.options.arrows.to.imageHeight,middleArrow:n,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,middleArrowSrc:this.options.arrows.middle.src,middleArrowImageWidth:this.options.arrows.middle.imageWidth,middleArrowImageHeight:this.options.arrows.middle.imageHeight,fromArrow:t,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,fromArrowSrc:this.options.arrows.from.src,fromArrowImageWidth:this.options.arrows.from.imageWidth,fromArrowImageHeight:this.options.arrows.from.imageHeight,arrowStrikethrough:this.options.arrowStrikethrough,color:a?void 0:this.options.color.color,inheritsColor:a,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width,background:this.options.background.enabled,backgroundColor:this.options.background.color,backgroundSize:this.options.background.size,backgroundDashes:this.options.background.dashes};if(this.selected||this.hover)if(this.chooser===!0){if(this.selected){var s=this.options.selectionWidth;typeof s=="function"?o.width=s(o.width):typeof s=="number"&&(o.width+=s),o.width=Math.max(o.width,.3/this.body.view.scale),o.color=this.options.color.highlight,o.shadow=this.options.shadow.enabled}else if(this.hover){var u=this.options.hoverWidth;typeof u=="function"?o.width=u(o.width):typeof u=="number"&&(o.width+=u),o.width=Math.max(o.width,.3/this.body.view.scale),o.color=this.options.color.hover,o.shadow=this.options.shadow.enabled}}else typeof this.chooser=="function"&&(this.chooser(o,this.options.id,this.selected,this.hover),o.color!==void 0&&(o.inheritsColor=!1),o.shadow===!1&&(o.shadowColor!==this.options.shadow.color||o.shadowSize!==this.options.shadow.size||o.shadowX!==this.options.shadow.x||o.shadowY!==this.options.shadow.y)&&(o.shadow=!0));else o.shadow=this.options.shadow.enabled,o.width=Math.max(o.width,.3/this.body.view.scale);return o}},{key:"updateLabelModule",value:function(e){var t=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,t),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}},{key:"updateEdgeType",value:function(){var e=this.options.smooth,t=!1,n=!0;return this.edgeType!==void 0&&((this.edgeType instanceof c$&&e.enabled===!0&&e.type==="dynamic"||this.edgeType instanceof f$&&e.enabled===!0&&e.type==="cubicBezier"||this.edgeType instanceof d$&&e.enabled===!0&&e.type!=="dynamic"&&e.type!=="cubicBezier"||this.edgeType instanceof v$&&e.type.enabled===!1)&&(n=!1),n===!0&&(t=this.cleanup())),n===!0?e.enabled===!0?e.type==="dynamic"?(t=!0,this.edgeType=new c$(this.options,this.body,this.labelModule)):e.type==="cubicBezier"?this.edgeType=new f$(this.options,this.body,this.labelModule):this.edgeType=new d$(this.options,this.body,this.labelModule):this.edgeType=new v$(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),t}},{key:"connect",value:function(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=this.from!==void 0&&this.to!==void 0,this.connected===!0?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}},{key:"disconnect",value:function(){this.from&&(this.from.detachEdge(this),this.from=void 0),this.to&&(this.to.detachEdge(this),this.to=void 0),this.connected=!1}},{key:"getTitle",value:function(){return this.title}},{key:"isSelected",value:function(){return this.selected}},{key:"getValue",value:function(){return this.options.value}},{key:"setValueRange",value:function(e,t,n){if(this.options.value!==void 0){var a=this.options.scaling.customScalingFunction(e,t,n,this.options.value),o=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){var s=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+a*s}this.options.width=this.options.scaling.min+a*o}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}},{key:"_setInteractionWidths",value:function(){typeof this.options.hoverWidth=="function"?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,typeof this.options.selectionWidth=="function"?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}},{key:"draw",value:function(e){var t=this.getFormattingValues();if(!t.hidden){var n=this.edgeType.getViaNode();this.edgeType.drawLine(e,t,this.selected,this.hover,n),this.drawLabel(e,n)}}},{key:"drawArrows",value:function(e){var t=this.getFormattingValues();if(!t.hidden){var n=this.edgeType.getViaNode(),a={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,t.fromArrow&&(a.from=this.edgeType.getArrowData(e,"from",n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.fromPoint=a.from.core),t.fromArrowSrc&&(a.from.image=this.imagelist.load(t.fromArrowSrc)),t.fromArrowImageWidth&&(a.from.imageWidth=t.fromArrowImageWidth),t.fromArrowImageHeight&&(a.from.imageHeight=t.fromArrowImageHeight)),t.toArrow&&(a.to=this.edgeType.getArrowData(e,"to",n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.toPoint=a.to.core),t.toArrowSrc&&(a.to.image=this.imagelist.load(t.toArrowSrc)),t.toArrowImageWidth&&(a.to.imageWidth=t.toArrowImageWidth),t.toArrowImageHeight&&(a.to.imageHeight=t.toArrowImageHeight)),t.middleArrow&&(a.middle=this.edgeType.getArrowData(e,"middle",n,this.selected,this.hover,t),t.middleArrowSrc&&(a.middle.image=this.imagelist.load(t.middleArrowSrc)),t.middleArrowImageWidth&&(a.middle.imageWidth=t.middleArrowImageWidth),t.middleArrowImageHeight&&(a.middle.imageHeight=t.middleArrowImageHeight)),t.fromArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.from),t.middleArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.middle),t.toArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.to)}}},{key:"drawLabel",value:function(e,t){if(this.options.label!==void 0){var n=this.from,a=this.to;this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover);var o;if(n.id!=a.id){this.labelModule.pointToSelf=!1,o=this.edgeType.getPoint(.5,t),e.save();var s=this._getRotation(e);s.angle!=0&&(e.translate(s.x,s.y),e.rotate(s.angle)),this.labelModule.draw(e,o.x,o.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;var u=OT(e,this.options.selfReference.angle,this.options.selfReference.size,n);o=this._pointOnCircle(u.x,u.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(e,o.x,o.y,this.selected,this.hover)}}}},{key:"getItemsOnPoint",value:function(e){var t=[];if(this.labelModule.visible()){var n=this._getRotation();Af(this.labelModule.getSize(),e,n)&&t.push({edgeId:this.id,labelId:0})}var a={left:e.x,top:e.y};return this.isOverlappingWith(a)&&t.push({edgeId:this.id}),t}},{key:"isOverlappingWith",value:function(e){if(this.connected){var t=10,n=this.from.x,a=this.from.y,o=this.to.x,s=this.to.y,u=e.left,l=e.top,h=this.edgeType.getDistanceToEdge(n,a,o,s,u,l);return h0&&s<0)&&(u+=Math.PI),a.angle=u,a}},{key:"_pointOnCircle",value:function(e,t,n,a){return{x:e+n*Math.cos(a),y:t-n*Math.sin(a)}}},{key:"select",value:function(){this.selected=!0}},{key:"unselect",value:function(){this.selected=!1}},{key:"cleanup",value:function(){return this.edgeType.cleanup()}},{key:"remove",value:function(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}},{key:"endPointsValid",value:function(){return this.body.nodes[this.fromId]!==void 0&&this.body.nodes[this.toId]!==void 0}}],[{key:"parseOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,s=["endPointOffset","arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","selfReference","to","title","value","width","font","chosen","widthConstraint"];if(Ma(s,e,t,n),t.endPointOffset!==void 0&&t.endPointOffset.from!==void 0&&(Di(t.endPointOffset.from)?e.endPointOffset.from=t.endPointOffset.from:(e.endPointOffset.from=a.endPointOffset.from!==void 0?a.endPointOffset.from:0,console.error("endPointOffset.from is not a valid number"))),t.endPointOffset!==void 0&&t.endPointOffset.to!==void 0&&(Di(t.endPointOffset.to)?e.endPointOffset.to=t.endPointOffset.to:(e.endPointOffset.to=a.endPointOffset.to!==void 0?a.endPointOffset.to:0,console.error("endPointOffset.to is not a valid number"))),Zu(t.label)?e.label=t.label:Zu(e.label)||(e.label=void 0),Ut(e,t,"smooth",a),Ut(e,t,"shadow",a),Ut(e,t,"background",a),t.dashes!==void 0&&t.dashes!==null?e.dashes=t.dashes:n===!0&&t.dashes===null&&(e.dashes=zi(a.dashes)),t.scaling!==void 0&&t.scaling!==null?(t.scaling.min!==void 0&&(e.scaling.min=t.scaling.min),t.scaling.max!==void 0&&(e.scaling.max=t.scaling.max),Ut(e.scaling,t.scaling,"label",a.scaling)):n===!0&&t.scaling===null&&(e.scaling=zi(a.scaling)),t.arrows!==void 0&&t.arrows!==null)if(typeof t.arrows=="string"){var u=t.arrows.toLowerCase();e.arrows.to.enabled=ne(u).call(u,"to")!=-1,e.arrows.middle.enabled=ne(u).call(u,"middle")!=-1,e.arrows.from.enabled=ne(u).call(u,"from")!=-1}else if(de(t.arrows)==="object")Ut(e.arrows,t.arrows,"to",a.arrows),Ut(e.arrows,t.arrows,"middle",a.arrows),Ut(e.arrows,t.arrows,"from",a.arrows);else throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+ls(t.arrows));else n===!0&&t.arrows===null&&(e.arrows=zi(a.arrows));if(t.color!==void 0&&t.color!==null){var l=Kn(t.color)?{color:t.color,highlight:t.color,hover:t.color,inherit:!1,opacity:1}:t.color,h=e.color;if(o)pe(h,a.color,!1,n);else for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&delete h[c];if(Kn(h))h.color=h,h.highlight=h,h.hover=h,h.inherit=!1,l.opacity===void 0&&(h.opacity=1);else{var d=!1;l.color!==void 0&&(h.color=l.color,d=!0),l.highlight!==void 0&&(h.highlight=l.highlight,d=!0),l.hover!==void 0&&(h.hover=l.hover,d=!0),l.inherit!==void 0&&(h.inherit=l.inherit),l.opacity!==void 0&&(h.opacity=Math.min(1,Math.max(0,l.opacity))),d===!0?h.inherit=!1:h.inherit===void 0&&(h.inherit="from")}}else n===!0&&t.color===null&&(e.color=di(a.color));n===!0&&t.font===null&&(e.font=di(a.font)),Object.prototype.hasOwnProperty.call(t,"selfReferenceSize")&&(console.warn("The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}"),e.selfReference.size=t.selfReferenceSize)}}]),i}(),Lde=function(){function i(r,e,t){var n,a=this;N(this,i),this.body=r,this.images=e,this.groups=t,this.body.functions.createEdge=k(n=this.create).call(n,this),this.edgesListeners={add:function(s,u){a.add(u.items)},update:function(s,u){a.update(u.items)},remove:function(s,u){a.remove(u.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},endPointOffset:{from:0,to:0},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(s,u,l,h){if(u===s)return .5;var c=1/(u-s);return Math.max(0,(h-s)*c)}},selectionWidth:1.5,selfReference:{size:20,angle:Math.PI/4,renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},background:{enabled:!1,color:"rgba(111,111,111,1)",size:10,dashes:!1},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},pe(this.options,this.defaultOptions),this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this,t,n;this.body.emitter.on("_forceDisableDynamicCurves",function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a==="dynamic"&&(a="continuous");var s=!1;for(var u in e.body.edges)if(Object.prototype.hasOwnProperty.call(e.body.edges,u)){var l=e.body.edges[u],h=e.body.data.edges.get(u);if(h!=null){var c=h.smooth;c!==void 0&&c.enabled===!0&&c.type==="dynamic"&&(a===void 0?l.setOptions({smooth:!1}):l.setOptions({smooth:{type:a}}),s=!0)}}o===!0&&s===!0&&e.body.emitter.emit("_dataChanged")}),this.body.emitter.on("_dataUpdated",function(){e.reconnectEdges()}),this.body.emitter.on("refreshEdges",k(t=this.refresh).call(t,this)),this.body.emitter.on("refresh",k(n=this.refresh).call(n,this)),this.body.emitter.on("destroy",function(){te(e.edgesListeners,function(a,o){e.body.data.edges&&e.body.data.edges.off(o,a)}),delete e.body.functions.createEdge,delete e.edgesListeners.add,delete e.edgesListeners.update,delete e.edgesListeners.remove,delete e.edgesListeners})}},{key:"setOptions",value:function(e){if(e!==void 0){qn.parseOptions(this.options,e,!0,this.defaultOptions,!0);var t=!1;if(e.smooth!==void 0)for(var n in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,n)&&(t=this.body.edges[n].updateEdgeType()||t);if(e.font!==void 0)for(var a in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,a)&&this.body.edges[a].updateLabelModule();(e.hidden!==void 0||e.physics!==void 0||t===!0)&&this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.body.data.edges;if(IE("id",e))this.body.data.edges=e;else if(he(e))this.body.data.edges=new Lu,this.body.data.edges.add(e);else if(!e)this.body.data.edges=new Lu;else throw new TypeError("Array or DataSet expected");if(a&&te(this.edgesListeners,function(s,u){a.off(u,s)}),this.body.edges={},this.body.data.edges){te(this.edgesListeners,function(s,u){t.body.data.edges.on(u,s)});var o=this.body.data.edges.getIds();this.add(o,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),n===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.edges,a=this.body.data.edges,o=0;o1&&arguments[1]!==void 0?arguments[1]:!0;if(e.length!==0){var n=this.body.edges;te(e,function(a){var o=n[a];o!==void 0&&o.remove()}),t&&this.body.emitter.emit("_dataChanged")}}},{key:"refresh",value:function(){var e=this;te(this.body.edges,function(t,n){var a=e.body.data.edges.get(n);a!==void 0&&t.setOptions(a)})}},{key:"create",value:function(e){return new qn(e,this.body,this.images,this.options,this.defaultOptions)}},{key:"reconnectEdges",value:function(){var e,t=this.body.nodes,n=this.body.edges;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e].edges=[]);for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)){var a=n[e];a.from=null,a.to=null,a.connect()}}},{key:"getConnectedNodes",value:function(e){var t=[];if(this.body.edges[e]!==void 0){var n=this.body.edges[e];n.fromId!==void 0&&t.push(n.fromId),n.toId!==void 0&&t.push(n.toId)}return t}},{key:"_updateState",value:function(){this._addMissingEdges(),this._removeInvalidEdges()}},{key:"_removeInvalidEdges",value:function(){var e=this,t=[];te(this.body.edges,function(n,a){var o=e.body.nodes[n.toId],s=e.body.nodes[n.fromId];o!==void 0&&o.isCluster===!0||s!==void 0&&s.isCluster===!0||(o===void 0||s===void 0)&&t.push(a)}),this.remove(t,!1)}},{key:"_addMissingEdges",value:function(){var e=this.body.data.edges;if(e!=null){var t=this.body.edges,n=[];fe(e).call(e,function(a,o){var s=t[o];s===void 0&&n.push(o)}),this.add(n,!0)}}}]),i}(),NT=function(){function i(r,e,t){N(this,i),this.body=r,this.physicsBody=e,this.barnesHutTree,this.setOptions(t),this._rng=Ql("BARNES HUT SOLVER")}return M(i,[{key:"setOptions",value:function(e){this.options=e,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}},{key:"solve",value:function(){if(this.options.gravitationalConstant!==0&&this.physicsBody.physicsNodeIndices.length>0){var e,t=this.body.nodes,n=this.physicsBody.physicsNodeIndices,a=n.length,o=this._formBarnesHutTree(t,n);this.barnesHutTree=o;for(var s=0;s0&&this._getForceContributions(o.root,e)}}},{key:"_getForceContributions",value:function(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}},{key:"_getForceContribution",value:function(e,t){if(e.childrenCount>0){var n=e.centerOfMass.x-t.x,a=e.centerOfMass.y-t.y,o=Math.sqrt(n*n+a*a);o*e.calcSize>this.thetaInversed?this._calculateForces(o,n,a,t,e):e.childrenCount===4?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(o,n,a,t,e)}}},{key:"_calculateForces",value:function(e,t,n,a,o){e===0&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&a.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*a.shape.radius,e-a.shape.radius));var s=this.options.gravitationalConstant*o.mass*a.options.mass/Math.pow(e,3),u=t*s,l=n*s;this.physicsBody.forces[a.id].x+=u,this.physicsBody.forces[a.id].y+=l}},{key:"_formBarnesHutTree",value:function(e,t){for(var n,a=t.length,o=e[t[0]].x,s=e[t[0]].y,u=e[t[0]].x,l=e[t[0]].y,h=1;h0&&(du&&(u=d),fl&&(l=f))}var v=Math.abs(u-o)-Math.abs(l-s);v>0?(s-=.5*v,l+=.5*v):(o+=.5*v,u-=.5*v);var p=1e-5,g=Math.max(p,Math.abs(u-o)),y=.5*g,m=.5*(o+u),$=.5*(s+l),b={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:m-y,maxX:m+y,minY:$-y,maxY:$+y},size:g,calcSize:1/g,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(b.root);for(var O=0;O0&&this._placeInTree(b.root,n);return b}},{key:"_updateBranchMass",value:function(e,t){var n=e.centerOfMass,a=e.mass+t.options.mass,o=1/a;n.x=n.x*e.mass+t.x*t.options.mass,n.x*=o,n.y=n.y*e.mass+t.y*t.options.mass,n.y*=o,e.mass=a;var s=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidtht.x?a.maxY>t.y?o="NW":o="SW":a.maxY>t.y?o="NE":o="SE",this._placeInRegion(e,t,o)}},{key:"_placeInRegion",value:function(e,t,n){var a=e.children[n];switch(a.childrenCount){case 0:a.children.data=t,a.childrenCount=1,this._updateBranchMass(a,t);break;case 1:a.children.data.x===t.x&&a.children.data.y===t.y?(t.x+=this._rng(),t.y+=this._rng()):(this._splitBranch(a),this._placeInTree(a,t));break;case 4:this._placeInTree(a,t);break}}},{key:"_splitBranch",value:function(e){var t=null;e.childrenCount===1&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),t!=null&&this._placeInTree(e,t)}},{key:"_insertRegion",value:function(e,t){var n,a,o,s,u=.5*e.size;switch(t){case"NW":n=e.range.minX,a=e.range.minX+u,o=e.range.minY,s=e.range.minY+u;break;case"NE":n=e.range.minX+u,a=e.range.maxX,o=e.range.minY,s=e.range.minY+u;break;case"SW":n=e.range.minX,a=e.range.minX+u,o=e.range.minY+u,s=e.range.maxY;break;case"SE":n=e.range.minX+u,a=e.range.maxX,o=e.range.minY+u,s=e.range.maxY;break}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:n,maxX:a,minY:o,maxY:s},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}},{key:"_debug",value:function(e,t){this.barnesHutTree!==void 0&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}},{key:"_drawBranch",value:function(e,t,n){n===void 0&&(n="#FF0000"),e.childrenCount===4&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=n,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}]),i}(),zde=function(){function i(r,e,t){N(this,i),this._rng=Ql("REPULSION SOLVER"),this.body=r,this.physicsBody=e,this.setOptions(t)}return M(i,[{key:"setOptions",value:function(e){this.options=e}},{key:"solve",value:function(){for(var e,t,n,a,o,s,u,l,h=this.body.nodes,c=this.physicsBody.physicsNodeIndices,d=this.physicsBody.forces,f=this.options.nodeDistance,v=-2/3/f,p=4/3,g=0;g"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Kde=function(i){ue(e,i);var r=Wde(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._rng=Ql("FORCE ATLAS 2 BASED REPULSION SOLVER"),o}return M(e,[{key:"_calculateForces",value:function(n,a,o,s,u){n===0&&(n=.1*this._rng(),a=n),this.overlapAvoidanceFactor<1&&s.shape.radius&&(n=Math.max(.1+this.overlapAvoidanceFactor*s.shape.radius,n-s.shape.radius));var l=s.edges.length+1,h=this.options.gravitationalConstant*u.mass*s.options.mass*l/Math.pow(n,2),c=a*h,d=o*h;this.physicsBody.forces[s.id].x+=c,this.physicsBody.forces[s.id].y+=d}}]),e}(NT);function Gde(i){var r=qde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function qde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Yde=function(i){ue(e,i);var r=Gde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_calculateForces",value:function(n,a,o,s,u){if(n>0){var l=u.edges.length+1,h=this.options.centralGravity*l*u.options.mass;s[u.id].x=a*h,s[u.id].y=o*h}}}]),e}(Eu),Xde=function(){function i(r){N(this,i),this.body=r,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},Le(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("initPhysics",function(){e.initPhysics()}),this.body.emitter.on("_layoutFailed",function(){e.layoutFailed=!0}),this.body.emitter.on("resetPhysics",function(){e.stopSimulation(),e.ready=!1}),this.body.emitter.on("disablePhysics",function(){e.physicsEnabled=!1,e.stopSimulation()}),this.body.emitter.on("restorePhysics",function(){e.setOptions(e.options),e.ready===!0&&e.startSimulation()}),this.body.emitter.on("startSimulation",function(){e.ready===!0&&e.startSimulation()}),this.body.emitter.on("stopSimulation",function(){e.stopSimulation()}),this.body.emitter.on("destroy",function(){e.stopSimulation(!1),e.body.emitter.off()}),this.body.emitter.on("_dataChanged",function(){e.updatePhysicsData()})}},{key:"setOptions",value:function(e){if(e!==void 0)if(e===!1)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(e===!0)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,Yu(["stabilization"],this.options,e),Ut(this.options,e,"stabilization"),e.enabled===void 0&&(this.options.enabled=!0),this.options.enabled===!1&&(this.physicsEnabled=!1,this.stopSimulation());var t=this.options.wind;t&&((typeof t.x!="number"||Cf(t.x))&&(t.x=0),(typeof t.y!="number"||Cf(t.y))&&(t.y=0)),this.timestep=this.options.timestep}this.init()}},{key:"init",value:function(){var e;this.options.solver==="forceAtlas2Based"?(e=this.options.forceAtlas2Based,this.nodesSolver=new Kde(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Yde(this.body,this.physicsBody,e)):this.options.solver==="repulsion"?(e=this.options.repulsion,this.nodesSolver=new zde(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)):this.options.solver==="hierarchicalRepulsion"?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new Hde(this.body,this.physicsBody,e),this.edgesSolver=new Vde(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new NT(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)),this.modelOptions=e}},{key:"initPhysics",value:function(){this.physicsEnabled===!0&&this.options.enabled===!0?this.options.stabilization.enabled===!0?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}},{key:"startSimulation",value:function(){if(this.physicsEnabled===!0&&this.options.enabled===!0){if(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),this.viewFunction===void 0){var e;this.viewFunction=k(e=this.simulationStep).call(e,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}else this.body.emitter.emit("_redraw")}},{key:"stopSimulation",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.stabilized=!0,e===!0&&this._emitStabilized(),this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,e===!0&&this.body.emitter.emit("_stopRendering"))}},{key:"simulationStep",value:function(){var e=Uu();this.physicsTick();var t=Uu()-e;(t<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}},{key:"_emitStabilized",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&mr(function(){e.body.emitter.emit("stabilized",{iterations:t}),e.startedStabilization=!1,e.stabilizationIterations=0},0)}},{key:"physicsStep",value:function(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}},{key:"adjustTimeStep",value:function(){var e=1.2;this._evaluateStepQuality()===!0?this.timestep=e*this.timestep:this.timestep/es))return!1;return!0}},{key:"moveNodes",value:function(){for(var e=this.physicsBody.physicsNodeIndices,t=0,n=0,a=5,o=0;os&&(e=e>0?s:-s),e}},{key:"_performStep",value:function(e){var t=this.body.nodes[e],n=this.physicsBody.forces[e];this.options.wind&&(n.x+=this.options.wind.x,n.y+=this.options.wind.y);var a=this.physicsBody.velocities[e];this.previousStates[e]={x:t.x,y:t.y,vx:a.x,vy:a.y},t.options.fixed.x===!1?(a.x=this.calculateComponentVelocity(a.x,n.x,t.options.mass),t.x+=a.x*this.timestep):(n.x=0,a.x=0),t.options.fixed.y===!1?(a.y=this.calculateComponentVelocity(a.y,n.y,t.options.mass),t.y+=a.y*this.timestep):(n.y=0,a.y=0);var o=Math.sqrt(Math.pow(a.x,2)+Math.pow(a.y,2));return o}},{key:"_freezeNodes",value:function(){var e=this.body.nodes;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].x&&e[t].y){var n=e[t].options.fixed;this.freezeCache[t]={x:n.x,y:n.y},n.x=!0,n.y=!0}}},{key:"_restoreFrozenNodes",value:function(){var e=this.body.nodes;for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.freezeCache[t]!==void 0&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}},{key:"stabilize",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.stabilization.iterations;if(typeof t!="number"&&(t=this.options.stabilization.iterations,console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ",t)),this.physicsBody.physicsNodeIndices.length===0){this.ready=!0;return}this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=t,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,mr(function(){return e._stabilizationBatch()},0)}},{key:"_startStabilizing",value:function(){return this.startedStabilization===!0?!1:(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}},{key:"_stabilizationBatch",value:function(){var e=this,t=function(){return e.stabilized===!1&&e.stabilizationIterations1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,a=-1e9,o=1e9,s=-1e9,u;if(t.length>0)for(var l=0;lu.shape.boundingBox.left&&(o=u.shape.boundingBox.left),su.shape.boundingBox.top&&(n=u.shape.boundingBox.top),a1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,a=-1e9,o=1e9,s=-1e9,u;if(t.length>0)for(var l=0;lu.x&&(o=u.x),su.y&&(n=u.y),a"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var ife=function(i){ue(e,i);var r=tfe(e);function e(t,n,a,o,s,u){var l;return N(this,e),l=r.call(this,t,n,a,o,s,u),l.isCluster=!0,l.containedNodes={},l.containedEdges={},l}return M(e,[{key:"_openChildCluster",value:function(n){var a=this,o=this.body.nodes[n];if(this.containedNodes[n]===void 0)throw new Error("node with id: "+n+" not in current cluster");if(!o.isCluster)throw new Error("node with id: "+n+" is not a cluster");delete this.containedNodes[n],te(o.edges,function(s){delete a.containedEdges[s.id]}),te(o.containedNodes,function(s,u){a.containedNodes[u]=s}),o.containedNodes={},te(o.containedEdges,function(s,u){a.containedEdges[u]=s}),o.containedEdges={},te(o.edges,function(s){te(a.edges,function(u){var l,h,c=ne(l=u.clusteringEdgeReplacingIds).call(l,s.id);c!==-1&&(te(s.clusteringEdgeReplacingIds,function(d){u.clusteringEdgeReplacingIds.push(d),a.body.edges[d].edgeReplacedById=u.id}),Ar(h=u.clusteringEdgeReplacingIds).call(h,c,1))})}),o.edges=[]}}]),e}(Nt),nfe=function(){function i(r){var e=this;N(this,i),this.body=r,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},Le(this.options,this.defaultOptions),this.body.emitter.on("_resetData",function(){e.clusteredNodes={},e.clusteredEdges={}})}return M(i,[{key:"clusterByHubsize",value:function(e,t){e===void 0?e=this._getHubSize():de(e)==="object"&&(t=this._checkOptions(e),e=this._getHubSize());for(var n=[],a=0;a=e&&n.push(o.id)}for(var s=0;s0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.joinCondition===void 0)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");t=this._checkOptions(t);var a={},o={};te(this.body.nodes,function(s,u){s.options&&t.joinCondition(s.options)===!0&&(a[u]=s,te(s.edges,function(l){e.clusteredEdges[l.id]===void 0&&(o[l.id]=l)}))}),this._cluster(a,o,t,n)}},{key:"clusterByEdgeCount",value:function(e,t){var n=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;t=this._checkOptions(t);for(var o=[],s={},u,l,h,c=function(){var p={},g={},y=n.body.nodeIndices[d],m=n.body.nodes[y];if(s[y]===void 0){h=0,l=[];for(var $=0;$0&&Oe(g).length>0&&O===!0){var R=function(){for(var U=0;U1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(1,e,t)}},{key:"clusterBridges",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(2,e,t)}},{key:"clusterByConnection",value:function(e,t){var n,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No nodeId supplied to clusterByConnection!");if(this.body.nodes[e]===void 0)throw new Error("The nodeId given to clusterByConnection does not exist!");var o=this.body.nodes[e];t=this._checkOptions(t,o),t.clusterNodeProperties.x===void 0&&(t.clusterNodeProperties.x=o.x),t.clusterNodeProperties.y===void 0&&(t.clusterNodeProperties.y=o.y),t.clusterNodeProperties.fixed===void 0&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=o.options.fixed.x,t.clusterNodeProperties.fixed.y=o.options.fixed.y);var s={},u={},l=o.id,h=pt.cloneOptions(o);s[l]=o;for(var c=0;c-1&&(u[$.id]=$)}this._cluster(s,u,t,a)}},{key:"_createClusterEdges",value:function(e,t,n,a){for(var o,s,u,l,h,c,d=Oe(e),f=[],v=0;v0&&arguments[0]!==void 0?arguments[0]:{};return e.clusterEdgeProperties===void 0&&(e.clusterEdgeProperties={}),e.clusterNodeProperties===void 0&&(e.clusterNodeProperties={}),e}},{key:"_cluster",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&this.clusteredNodes[s]!==void 0&&o.push(s);for(var u=0;ua?u.x:a,o=u.ys?u.y:s;return{x:.5*(n+a),y:.5*(o+s)}}},{key:"openCluster",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No clusterNodeId supplied to openCluster.");var a=this.body.nodes[e];if(a===void 0)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(a.isCluster!==!0||a.containedNodes===void 0||a.containedEdges===void 0)throw new Error("The node:"+e+" is not a valid cluster.");var o=this.findNode(e),s=ne(o).call(o,e)-1;if(s>=0){var u=o[s],l=this.body.nodes[u];l._openChildCluster(e),delete this.body.nodes[e],n===!0&&this.body.emitter.emit("_dataChanged");return}var h=a.containedNodes,c=a.containedEdges;if(t!==void 0&&t.releaseFunction!==void 0&&typeof t.releaseFunction=="function"){var d={},f={x:a.x,y:a.y};for(var v in h)if(Object.prototype.hasOwnProperty.call(h,v)){var p=this.body.nodes[v];d[v]={x:p.x,y:p.y}}var g=t.releaseFunction(f,d);for(var y in h)if(Object.prototype.hasOwnProperty.call(h,y)){var m=this.body.nodes[y];g[y]!==void 0&&(m.x=g[y].x===void 0?a.x:g[y].x,m.y=g[y].y===void 0?a.y:g[y].y)}}else te(h,function(ht){ht.options.fixed.x===!1&&(ht.x=a.x),ht.options.fixed.y===!1&&(ht.y=a.y)});for(var $ in h)if(Object.prototype.hasOwnProperty.call(h,$)){var b=this.body.nodes[$];b.vx=a.vx,b.vy=a.vy,b.setOptions({physics:!0}),delete this.clusteredNodes[$]}for(var O=[],_=0;_0&&sa&&(a=s.edges.length),e+=s.edges.length,t+=Math.pow(s.edges.length,2),n+=1}e=e/n,t=t/n;var u=t-Math.pow(e,2),l=Math.sqrt(u),h=Math.floor(e+2*l);return h>a&&(h=a),h}},{key:"_createClusteredEdge",value:function(e,t,n,a,o){var s=pt.cloneOptions(n,"edge");pe(s,a),s.from=e,s.to=t,s.id="clusterEdge:"+no(),o!==void 0&&pe(s,o);var u=this.body.functions.createEdge(s);return u.clusteringEdgeReplacingIds=[n.id],u.connect(),this.body.edges[u.id]=u,u}},{key:"_clusterEdges",value:function(e,t,n,a){if(t instanceof qn){var o=t,s={};s[o.id]=o,t=s}if(e instanceof Nt){var u=e,l={};l[u.id]=u,e=l}if(n==null)throw new Error("_clusterEdges: parameter clusterNode required");a===void 0&&(a=n.clusterEdgeProperties),this._createClusterEdges(e,t,n,a);for(var h in t)if(Object.prototype.hasOwnProperty.call(t,h)&&this.body.edges[h]!==void 0){var c=this.body.edges[h];this._backupEdgeOptions(c),c.setOptions({physics:!1})}for(var d in e)Object.prototype.hasOwnProperty.call(e,d)&&(this.clusteredNodes[d]={clusterId:n.id,node:this.body.nodes[d]},this.body.nodes[d].setOptions({physics:!1}))}},{key:"_getClusterNodeForNode",value:function(e){if(e!==void 0){var t=this.clusteredNodes[e];if(t!==void 0){var n=t.clusterId;if(n!==void 0)return this.body.nodes[n]}}}},{key:"_filter",value:function(e,t){var n=[];return te(e,function(a){t(a)&&n.push(a)}),n}},{key:"_updateState",value:function(){var e=this,t,n=[],a={},o=function(v){te(e.body.nodes,function(p){p.isCluster===!0&&v(p)})};for(t in this.clusteredNodes)if(Object.prototype.hasOwnProperty.call(this.clusteredNodes,t)){var s=this.body.nodes[t];s===void 0&&n.push(t)}o(function(f){for(var v=0;v0}(!f.endPointsValid()||!p)&&(a[v]=v)}),o(function(f){te(a,function(v){delete f.containedEdges[v],te(f.edges,function(p,g){if(p.id===v){f.edges[g]=null;return}p.clusteringEdgeReplacingIds=e._filter(p.clusteringEdgeReplacingIds,function(y){return!a[y]})}),f.edges=e._filter(f.edges,function(p){return p!==null})})}),te(a,function(f){delete e.clusteredEdges[f]}),te(a,function(f){delete e.body.edges[f]});var l=Oe(this.body.edges);te(l,function(f){var v=e.body.edges[f],p=e._isClusteredNode(v.fromId)||e._isClusteredNode(v.toId);if(p!==e._isClusteredEdge(v.id))if(p){var g=e._getClusterNodeForNode(v.fromId);g!==void 0&&e._clusterEdges(e.body.nodes[v.fromId],v,g);var y=e._getClusterNodeForNode(v.toId);y!==void 0&&e._clusterEdges(e.body.nodes[v.toId],v,y)}else delete e._clusterEdges[f],e._restoreEdge(v)});for(var h=!1,c=!0,d=function(){var v=[];o(function(g){var y=Oe(g.containedNodes).length,m=g.options.allowSingleNodeCluster===!0;(m&&y<1||!m&&y<2)&&v.push(g.id)});for(var p=0;p0,h=h||c};c;)d();h&&this._updateState()}},{key:"_isClusteredNode",value:function(e){return this.clusteredNodes[e]!==void 0}},{key:"_isClusteredEdge",value:function(e){return this.clusteredEdges[e]!==void 0}}]),i}();function afe(){var i;window!==void 0&&(i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame),i===void 0?window.requestAnimationFrame=function(r){r()}:window.requestAnimationFrame=i}var ofe=function(){function i(r,e){N(this,i),afe(),this.body=r,this.canvas=e,this.redrawRequested=!1,this.renderTimer=void 0,this.requiresTimeout=!0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},Le(this.options,this.defaultOptions),this._determineBrowserMethod(),this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this,t;this.body.emitter.on("dragStart",function(){e.dragging=!0}),this.body.emitter.on("dragEnd",function(){e.dragging=!1}),this.body.emitter.on("zoom",function(){e.zooming=!0,window.clearTimeout(e.zoomTimeoutId),e.zoomTimeoutId=mr(function(){var n;e.zooming=!1,k(n=e._requestRedraw).call(n,e)()},250)}),this.body.emitter.on("_resizeNodes",function(){e._resizeNodes()}),this.body.emitter.on("_redraw",function(){e.renderingActive===!1&&e._redraw()}),this.body.emitter.on("_blockRedraw",function(){e.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",function(){e.allowRedraw=!0,e.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",k(t=this._requestRedraw).call(t,this)),this.body.emitter.on("_startRendering",function(){e.renderRequests+=1,e.renderingActive=!0,e._startRendering()}),this.body.emitter.on("_stopRendering",function(){e.renderRequests-=1,e.renderingActive=e.renderRequests>0,e.renderTimer=void 0}),this.body.emitter.on("destroy",function(){e.renderRequests=0,e.allowRedraw=!1,e.renderingActive=!1,e.requiresTimeout===!0?clearTimeout(e.renderTimer):window.cancelAnimationFrame(e.renderTimer),e.body.emitter.off()})}},{key:"setOptions",value:function(e){if(e!==void 0){var t=["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"];Ma(t,this.options,e)}}},{key:"_requestNextFrame",value:function(e,t){if(!(typeof window>"u")){var n,a=window;return this.requiresTimeout===!0?n=mr(e,t):a.requestAnimationFrame&&(n=a.requestAnimationFrame(e)),n}}},{key:"_startRendering",value:function(){if(this.renderingActive===!0&&this.renderTimer===void 0){var e;this.renderTimer=this._requestNextFrame(k(e=this._renderStep).call(e,this),this.simulationInterval)}}},{key:"_renderStep",value:function(){this.renderingActive===!0&&(this.renderTimer=void 0,this.requiresTimeout===!0&&this._startRendering(),this._redraw(),this.requiresTimeout===!1&&this._startRendering())}},{key:"redraw",value:function(){this.body.emitter.emit("setSize"),this._redraw()}},{key:"_requestRedraw",value:function(){var e=this;this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,this._requestNextFrame(function(){e._redraw(!1)},0))}},{key:"_redraw",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(this.allowRedraw===!0){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;var t={drawExternalLabels:null};(this.canvas.frame.canvas.width===0||this.canvas.frame.canvas.height===0)&&this.canvas.setSize(),this.canvas.setTransform();var n=this.canvas.getContext(),a=this.canvas.frame.canvas.clientWidth,o=this.canvas.frame.canvas.clientHeight;if(n.clearRect(0,0,a,o),this.canvas.frame.clientWidth===0)return;if(n.save(),n.translate(this.body.view.translation.x,this.body.view.translation.y),n.scale(this.body.view.scale,this.body.view.scale),n.beginPath(),this.body.emitter.emit("beforeDrawing",n),n.closePath(),e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawEdges(n),this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1){var s=this._drawNodes(n,e),u=s.drawExternalLabels;t.drawExternalLabels=u}e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawArrows(n),t.drawExternalLabels!=null&&t.drawExternalLabels(),e===!1&&this._drawSelectionBox(n),n.beginPath(),this.body.emitter.emit("afterDrawing",n),n.closePath(),n.restore(),e===!0&&n.clearRect(0,0,a,o)}}},{key:"_resizeNodes",value:function(){this.canvas.setTransform();var e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);var t=this.body.nodes,n;for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n=t[a],n.resize(e),n.updateBoundingBox(e,n.selected));e.restore()}},{key:"_drawNodes",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.nodes,a=this.body.nodeIndices,o,s=[],u=[],l=20,h=this.canvas.DOMtoCanvas({x:-20,y:-20}),c=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+l,y:this.canvas.frame.canvas.clientHeight+l}),d={top:h.y,left:h.x,bottom:c.y,right:c.x},f=[],v=0;v0&&arguments[0]!==void 0?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}},{key:"_setCameraState",value:function(){if(this.cameraState.scale!==void 0&&this.frame.canvas.clientWidth!==0&&this.frame.canvas.clientHeight!==0&&this.pixelRatio!==0&&this.cameraState.previousWidth>0&&this.cameraState.previousHeight>0){var e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight,n=this.cameraState.scale;e!=1&&t!=1?n=this.cameraState.scale*.5*(e+t):e!=1?n=this.cameraState.scale*e:t!=1&&(n=this.cameraState.scale*t),this.body.view.scale=n;var a=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),o={x:a.x-this.cameraState.position.x,y:a.y-this.cameraState.position.y};this.body.view.translation.x+=o.x*this.body.view.scale,this.body.view.translation.y+=o.y*this.body.view.scale}}},{key:"_prepareValue",value:function(e){if(typeof e=="number")return e+"px";if(typeof e=="string"){if(ne(e).call(e,"%")!==-1||ne(e).call(e,"px")!==-1)return e;if(ne(e).call(e,"%")===-1)return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}},{key:"_create",value:function(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=0,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{var e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerText="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}},{key:"_bindHammer",value:function(){var e=this;this.hammer!==void 0&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new Gn(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:Gn.DIRECTION_ALL}),Qu(this.hammer,function(t){e.body.eventListeners.onTouch(t)}),this.hammer.on("tap",function(t){e.body.eventListeners.onTap(t)}),this.hammer.on("doubletap",function(t){e.body.eventListeners.onDoubleTap(t)}),this.hammer.on("press",function(t){e.body.eventListeners.onHold(t)}),this.hammer.on("panstart",function(t){e.body.eventListeners.onDragStart(t)}),this.hammer.on("panmove",function(t){e.body.eventListeners.onDrag(t)}),this.hammer.on("panend",function(t){e.body.eventListeners.onDragEnd(t)}),this.hammer.on("pinch",function(t){e.body.eventListeners.onPinch(t)}),this.frame.canvas.addEventListener("wheel",function(t){e.body.eventListeners.onMouseWheel(t)}),this.frame.canvas.addEventListener("mousemove",function(t){e.body.eventListeners.onMouseMove(t)}),this.frame.canvas.addEventListener("contextmenu",function(t){e.body.eventListeners.onContext(t)}),this.hammerFrame=new Gn(this.frame),MT(this.hammerFrame,function(t){e.body.eventListeners.onRelease(t)})}},{key:"setSize",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.width,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);var n=!1,a=this.frame.canvas.width,o=this.frame.canvas.height,s=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(s),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},n=!0;else{var u=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),l=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);(this.frame.canvas.width!==u||this.frame.canvas.height!==l)&&this._getCameraState(s),this.frame.canvas.width!==u&&(this.frame.canvas.width=u,n=!0),this.frame.canvas.height!==l&&(this.frame.canvas.height=l,n=!0)}return n===!0&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(a/this.pixelRatio),oldHeight:Math.round(o/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,n}},{key:"getContext",value:function(){return this.frame.canvas.getContext("2d")}},{key:"_determinePixelRatio",value:function(){var e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");var t=1;typeof window<"u"&&(t=window.devicePixelRatio||1);var n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return t/n}},{key:"_setPixelRatio",value:function(){this.pixelRatio=this._determinePixelRatio()}},{key:"setTransform",value:function(){var e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}},{key:"_XconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.x)/this.body.view.scale}},{key:"_XconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.x}},{key:"_YconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.y)/this.body.view.scale}},{key:"_YconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.y}},{key:"canvasToDOM",value:function(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}},{key:"DOMtoCanvas",value:function(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}]),i}();function dfe(i,r){var e=Le({nodes:r,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},i??{});if(!he(e.nodes))throw new TypeError("Nodes has to be an array of ids.");if(e.nodes.length===0&&(e.nodes=r),!(typeof e.minZoomLevel=="number"&&e.minZoomLevel>0))throw new TypeError("Min zoom level has to be a number higher than zero.");if(!(typeof e.maxZoomLevel=="number"&&e.minZoomLevel<=e.maxZoomLevel))throw new TypeError("Max zoom level has to be a number higher than min zoom level.");return e}var ffe=function(){function i(r,e){var t,n=this,a;N(this,i),this.body=r,this.canvas=e,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",k(t=this.fit).call(t,this)),this.body.emitter.on("animationFinished",function(){n.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",k(a=this.releaseNode).call(a,this))}return M(i,[{key:"setOptions",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=e}},{key:"fit",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e=dfe(e,this.body.nodeIndices);var n=this.canvas.frame.canvas.clientWidth,a=this.canvas.frame.canvas.clientHeight,o,s;if(n===0||a===0)s=1,o=pt.getRange(this.body.nodes,e.nodes);else if(t===!0){var u=0;for(var l in this.body.nodes)if(Object.prototype.hasOwnProperty.call(this.body.nodes,l)){var h=this.body.nodes[l];h.predefinedPosition===!0&&(u+=1)}if(u>.5*this.body.nodeIndices.length){this.fit(e,!1);return}o=pt.getRange(this.body.nodes,e.nodes);var c=this.body.nodeIndices.length;s=12.662/(c+7.4147)+.0964822;var d=Math.min(n/600,a/600);s*=d}else{this.body.emitter.emit("_resizeNodes"),o=pt.getRange(this.body.nodes,e.nodes);var f=Math.abs(o.maxX-o.minX)*1.1,v=Math.abs(o.maxY-o.minY)*1.1,p=n/f,g=a/v;s=p<=g?p:g}s>e.maxZoomLevel?s=e.maxZoomLevel:s1&&arguments[1]!==void 0?arguments[1]:{};if(this.body.nodes[e]!==void 0){var n={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=n,t.lockedOnNode=e,this.moveTo(t)}else console.error("Node: "+e+" cannot be found.")}},{key:"moveTo",value:function(e){if(e===void 0){e={};return}if(e.offset!=null){if(e.offset.x!=null){if(e.offset.x=+e.offset.x,!Di(e.offset.x))throw new TypeError('The option "offset.x" has to be a finite number.')}else e.offset.x=0;if(e.offset.y!=null){if(e.offset.y=+e.offset.y,!Di(e.offset.y))throw new TypeError('The option "offset.y" has to be a finite number.')}else e.offset.x=0}else e.offset={x:0,y:0};if(e.position!=null){if(e.position.x!=null){if(e.position.x=+e.position.x,!Di(e.position.x))throw new TypeError('The option "position.x" has to be a finite number.')}else e.position.x=0;if(e.position.y!=null){if(e.position.y=+e.position.y,!Di(e.position.y))throw new TypeError('The option "position.y" has to be a finite number.')}else e.position.x=0}else e.position=this.getViewPosition();if(e.scale!=null){if(e.scale=+e.scale,!(e.scale>0))throw new TypeError('The option "scale" has to be a number greater than zero.')}else e.scale=this.body.view.scale;e.animation===void 0&&(e.animation={duration:0}),e.animation===!1&&(e.animation={duration:0}),e.animation===!0&&(e.animation={}),e.animation.duration===void 0&&(e.animation.duration=1e3),e.animation.easingFunction===void 0&&(e.animation.easingFunction="easeInOutQuad"),this.animateView(e)}},{key:"animateView",value:function(e){if(e!==void 0){this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),e.locked===!0&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),this.easingTime!=0&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;var t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.position.x,y:t.y-e.position.y};if(this.targetTranslation={x:this.sourceTranslation.x+n.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+n.y*this.targetScale+e.offset.y},e.animation.duration===0)if(this.lockedOnNodeId!=null){var a;this.viewFunction=k(a=this._lockedRedraw).call(a,this),this.body.emitter.on("initRedraw",this.viewFunction)}else this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw");else{var o;this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=k(o=this._transitionRedraw).call(o,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}}},{key:"_lockedRedraw",value:function(){var e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.x,y:t.y-e.y},a=this.body.view.translation,o={x:a.x+n.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:a.y+n.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=o}},{key:"releaseNode",value:function(){this.lockedOnNodeId!==void 0&&this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}},{key:"_transitionRedraw",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.easingTime+=this.animationSpeed,this.easingTime=e===!0?1:this.easingTime;var t=Xae[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1){if(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,this.lockedOnNodeId!=null){var n;this.viewFunction=k(n=this._lockedRedraw).call(n,this),this.body.emitter.on("initRedraw",this.viewFunction)}this.body.emitter.emit("animationFinished")}}},{key:"getScale",value:function(){return this.body.view.scale}},{key:"getViewPosition",value:function(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}]),i}();function g$(i){var r=i&&i.preventDefault||!1,e=i&&i.container||window,t={},n={keydown:{},keyup:{}},a={},o;for(o=97;o<=122;o++)a[String.fromCharCode(o)]={code:65+(o-97),shift:!1};for(o=65;o<=90;o++)a[String.fromCharCode(o)]={code:o,shift:!0};for(o=0;o<=9;o++)a[""+o]={code:48+o,shift:!1};for(o=1;o<=12;o++)a["F"+o]={code:111+o,shift:!1};for(o=0;o<=9;o++)a["num"+o]={code:96+o,shift:!1};a["num*"]={code:106,shift:!1},a["num+"]={code:107,shift:!1},a["num-"]={code:109,shift:!1},a["num/"]={code:111,shift:!1},a["num."]={code:110,shift:!1},a.left={code:37,shift:!1},a.up={code:38,shift:!1},a.right={code:39,shift:!1},a.down={code:40,shift:!1},a.space={code:32,shift:!1},a.enter={code:13,shift:!1},a.shift={code:16,shift:void 0},a.esc={code:27,shift:!1},a.backspace={code:8,shift:!1},a.tab={code:9,shift:!1},a.ctrl={code:17,shift:!1},a.alt={code:18,shift:!1},a.delete={code:46,shift:!1},a.pageup={code:33,shift:!1},a.pagedown={code:34,shift:!1},a["="]={code:187,shift:!1},a["-"]={code:189,shift:!1},a["]"]={code:221,shift:!1},a["["]={code:219,shift:!1};var s=function(h){l(h,"keydown")},u=function(h){l(h,"keyup")},l=function(h,c){if(n[c][h.keyCode]!==void 0){for(var d=n[c][h.keyCode],f=0;f700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=new Date().valueOf())}},{key:"_stopMovement",value:function(){for(var e in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}},{key:"_moveUp",value:function(){this.body.view.translation.y+=this.options.keyboard.speed.y}},{key:"_moveDown",value:function(){this.body.view.translation.y-=this.options.keyboard.speed.y}},{key:"_moveLeft",value:function(){this.body.view.translation.x+=this.options.keyboard.speed.x}},{key:"_moveRight",value:function(){this.body.view.translation.x-=this.options.keyboard.speed.x}},{key:"_zoomIn",value:function(){var e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,a=t/e,o=(1-a)*this.canvas.canvasViewCenter.x+n.x*a,s=(1-a)*this.canvas.canvasViewCenter.y+n.y*a;this.body.view.scale=t,this.body.view.translation={x:o,y:s},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}},{key:"_zoomOut",value:function(){var e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,a=t/e,o=(1-a)*this.canvas.canvasViewCenter.x+n.x*a,s=(1-a)*this.canvas.canvasViewCenter.y+n.y*a;this.body.view.scale=t,this.body.view.translation={x:o,y:s},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}},{key:"configureKeyboardBindings",value:function(){var e=this;if(this.keycharm!==void 0&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=g$({container:window,preventDefault:!0}):this.keycharm=g$({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0)){var t,n,a,o,s,u,l,h,c,d,f,v,p,g,y,m,$,b,O,_,D,R,P,B;k(t=this.keycharm).call(t,"up",function(){e.bindToRedraw("_moveUp")},"keydown"),k(n=this.keycharm).call(n,"down",function(){e.bindToRedraw("_moveDown")},"keydown"),k(a=this.keycharm).call(a,"left",function(){e.bindToRedraw("_moveLeft")},"keydown"),k(o=this.keycharm).call(o,"right",function(){e.bindToRedraw("_moveRight")},"keydown"),k(s=this.keycharm).call(s,"=",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(u=this.keycharm).call(u,"num+",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(l=this.keycharm).call(l,"num-",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(h=this.keycharm).call(h,"-",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(c=this.keycharm).call(c,"[",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(d=this.keycharm).call(d,"]",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(f=this.keycharm).call(f,"pageup",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(v=this.keycharm).call(v,"pagedown",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(p=this.keycharm).call(p,"up",function(){e.unbindFromRedraw("_moveUp")},"keyup"),k(g=this.keycharm).call(g,"down",function(){e.unbindFromRedraw("_moveDown")},"keyup"),k(y=this.keycharm).call(y,"left",function(){e.unbindFromRedraw("_moveLeft")},"keyup"),k(m=this.keycharm).call(m,"right",function(){e.unbindFromRedraw("_moveRight")},"keyup"),k($=this.keycharm).call($,"=",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(b=this.keycharm).call(b,"num+",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(O=this.keycharm).call(O,"num-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(_=this.keycharm).call(_,"-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(D=this.keycharm).call(D,"[",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(R=this.keycharm).call(R,"]",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(P=this.keycharm).call(P,"pageup",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(B=this.keycharm).call(B,"pagedown",function(){e.unbindFromRedraw("_zoomOut")},"keyup")}}}]),i}();function pfe(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=gfe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function gfe(i,r){var e;if(i){if(typeof i=="string")return y$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return y$(i,r)}}function y$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=new Date().valueOf())}},{key:"onTap",value:function(e){var t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t)}},{key:"onDoubleTap",value:function(e){var t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("doubleClick",e,t)}},{key:"onHold",value:function(e){var t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t),this.selectionHandler.generateClickEvent("hold",e,t)}},{key:"onRelease",value:function(e){if(new Date().valueOf()-this.touchTime>10){var t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("release",e,t),this.touchTime=new Date().valueOf()}}},{key:"onContext",value:function(e){var t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent("oncontext",e,t)}},{key:"checkSelectionChanges",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;t===!0?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}},{key:"_determineDifference",value:function(e,t){var n=function(o,s){for(var u=[],l=0;l=o.minX&&c.x<=o.maxX&&c.y>=o.minY&&c.y<=o.maxY});fe(s).call(s,function(h){return t.selectionHandler.selectObject(t.body.nodes[h])});var u=this.getPointer(e.center);this.selectionHandler.commitAndEmit(u,e),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw")}else{var l=this.drag.selection;l&&l.length?(fe(l).call(l,function(h){h.node.options.fixed.x=h.xFixed,h.node.options.fixed.y=h.yFixed}),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center)),this.body.emitter.emit("startSimulation")):(this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw"))}}},{key:"onPinch",value:function(e){var t=this.getPointer(e.center);this.drag.pinched=!0,this.pinch.scale===void 0&&(this.pinch.scale=1);var n=this.pinch.scale*e.scale;this.zoom(n,t)}},{key:"zoom",value:function(e,t){if(this.options.zoomView===!0){var n=this.body.view.scale;e<1e-5&&(e=1e-5),e>10&&(e=10);var a=void 0;this.drag!==void 0&&this.drag.dragging===!0&&(a=this.canvas.DOMtoCanvas(this.drag.pointer));var o=this.body.view.translation,s=e/n,u=(1-s)*t.x+o.x*s,l=(1-s)*t.y+o.y*s;if(this.body.view.scale=e,this.body.view.translation={x:u,y:l},a!=null){var h=this.canvas.canvasToDOM(a);this.drag.pointer.x=h.x,this.drag.pointer.y=h.y}this.body.emitter.emit("_requestRedraw"),n0&&(this.popupObj=h[d[d.length-1]],s=!0)}if(this.popupObj===void 0&&s===!1){for(var v=this.body.edgeIndices,p=this.body.edges,g,y=[],m=0;m0&&(this.popupObj=p[y[y.length-1]],u="edge")}this.popupObj!==void 0?this.popupObj.id!==o&&(this.popup===void 0&&(this.popup=new noe(this.canvas.frame)),this.popup.popupTargetType=u,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):this.popup!==void 0&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}},{key:"_checkHidePopup",value:function(e){var t=this.selectionHandler._pointerToPositionObject(e),n=!1;if(this.popup.popupTargetType==="node"){if(this.body.nodes[this.popup.popupTargetId]!==void 0&&(n=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),n===!0)){var a=this.selectionHandler.getNodeAt(e);n=a===void 0?!1:a.id===this.popup.popupTargetId}}else this.selectionHandler.getNodeAt(e)===void 0&&this.body.edges[this.popup.popupTargetId]!==void 0&&(n=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));n===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}]),i}(),mfe=hp,bfe=vT;mfe("Set",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},bfe);var $fe=oe,wfe=$fe.Set,_fe=wfe,Efe=_fe,Sfe=Efe,xi=V(Sfe),Ofe=se,m$=cp,ru=eh.getWeakData,Tfe=lp,Ife=Vt,kfe=Oa,vd=Ze,Pfe=up,BT=wi,b$=Qe,FT=ln,xfe=FT.set,Cfe=FT.getterFor,Afe=BT.find,Dfe=BT.findIndex,Rfe=Ofe([].splice),Nfe=0,iu=function(i){return i.frozen||(i.frozen=new jT)},jT=function(){this.entries=[]},pd=function(i,r){return Afe(i.entries,function(e){return e[0]===r})};jT.prototype={get:function(i){var r=pd(this,i);if(r)return r[1]},has:function(i){return!!pd(this,i)},set:function(i,r){var e=pd(this,i);e?e[1]=r:this.entries.push([i,r])},delete:function(i){var r=Dfe(this.entries,function(e){return e[0]===i});return~r&&Rfe(this.entries,r,1),!!~r}};var Mfe={getConstructor:function(i,r,e,t){var n=i(function(u,l){Tfe(u,a),xfe(u,{type:r,id:Nfe++,frozen:void 0}),kfe(l)||Pfe(l,u[t],{that:u,AS_ENTRIES:e})}),a=n.prototype,o=Cfe(r),s=function(u,l,h){var c=o(u),d=ru(Ife(l),!0);return d===!0?iu(c).set(l,h):d[c.id]=h,u};return m$(a,{delete:function(u){var l=o(this);if(!vd(u))return!1;var h=ru(u);return h===!0?iu(l).delete(u):h&&b$(h,l.id)&&delete h[l.id]},has:function(l){var h=o(this);if(!vd(l))return!1;var c=ru(l);return c===!0?iu(h).has(l):c&&b$(c,h.id)}}),m$(a,e?{get:function(l){var h=o(this);if(vd(l)){var c=ru(l);return c===!0?iu(h).get(l):c?c[h.id]:void 0}},set:function(l,h){return s(this,l,h)}}:{add:function(l){return s(this,l,!0)}}),n}},Bfe=hT,$$=Pe,Su=se,w$=cp,Ffe=eh,jfe=hp,LT=Mfe,nu=Ze,au=ln.enforce,Lfe=ae,zfe=eS,gs=Object,Hfe=Array.isArray,ou=gs.isExtensible,zT=gs.isFrozen,Vfe=gs.isSealed,HT=gs.freeze,Wfe=gs.seal,_$={},E$={},Ufe=!$$.ActiveXObject&&"ActiveXObject"in $$,Wa,VT=function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},WT=jfe("WeakMap",VT,LT),Cn=WT.prototype,Ou=Su(Cn.set),Kfe=function(){return Bfe&&Lfe(function(){var i=HT([]);return Ou(new WT,i,1),!zT(i)})};if(zfe)if(Ufe){Wa=LT.getConstructor(VT,"WeakMap",!0),Ffe.enable();var S$=Su(Cn.delete),su=Su(Cn.has),O$=Su(Cn.get);w$(Cn,{delete:function(i){if(nu(i)&&!ou(i)){var r=au(this);return r.frozen||(r.frozen=new Wa),S$(this,i)||r.frozen.delete(i)}return S$(this,i)},has:function(r){if(nu(r)&&!ou(r)){var e=au(this);return e.frozen||(e.frozen=new Wa),su(this,r)||e.frozen.has(r)}return su(this,r)},get:function(r){if(nu(r)&&!ou(r)){var e=au(this);return e.frozen||(e.frozen=new Wa),su(this,r)?O$(this,r):e.frozen.get(r)}return O$(this,r)},set:function(r,e){if(nu(r)&&!ou(r)){var t=au(this);t.frozen||(t.frozen=new Wa),su(this,r)?Ou(this,r,e):t.frozen.set(r,e)}else Ou(this,r,e);return this}})}else Kfe()&&w$(Cn,{set:function(r,e){var t;return Hfe(r)&&(zT(r)?t=_$:Vfe(r)&&(t=E$)),Ou(this,r,e),t===_$&&HT(r),t===E$&&Wfe(r),this}});var Gfe=oe,qfe=Gfe.WeakMap,Yfe=qfe,Xfe=Yfe,Jfe=Xfe,ao=V(Jfe);function ve(i,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?i!==r||!t:!r.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(i):t?t.value:r.get(i)}function Nf(i,r,e,t,n){if(typeof r=="function"?i!==r||!0:!r.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r.set(i,e),e}function Mf(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=Zfe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Zfe(i,r){var e;if(i){if(typeof i=="string")return T$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return T$(i,r)}}function T$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e0&&arguments[0]!==void 0?arguments[0]:function(){};N(this,i),Yr.set(this,new k$),Xr.set(this,new k$),Tu.set(this,void 0),Nf(this,Tu,r)}return M(i,[{key:"sizeNodes",get:function(){return ve(this,Yr,"f").size}},{key:"sizeEdges",get:function(){return ve(this,Xr,"f").size}},{key:"getNodes",value:function(){return ve(this,Yr,"f").getSelection()}},{key:"getEdges",value:function(){return ve(this,Xr,"f").getSelection()}},{key:"addNodes",value:function(){var e;(e=ve(this,Yr,"f")).add.apply(e,arguments)}},{key:"addEdges",value:function(){var e;(e=ve(this,Xr,"f")).add.apply(e,arguments)}},{key:"deleteNodes",value:function(e){ve(this,Yr,"f").delete(e)}},{key:"deleteEdges",value:function(e){ve(this,Xr,"f").delete(e)}},{key:"clear",value:function(){ve(this,Yr,"f").clear(),ve(this,Xr,"f").clear()}},{key:"commit",value:function(){for(var e,t,n={nodes:ve(this,Yr,"f").commit(),edges:ve(this,Xr,"f").commit()},a=arguments.length,o=new Array(a),s=0;s=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function eve(i,r){var e;if(i){if(typeof i=="string")return x$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return x$(i,r)}}function x$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e4&&arguments[4]!==void 0?arguments[4]:!1,s=this._initBaseEvent(t,n);if(o===!0)s.nodes=[],s.edges=[];else{var u=this.getSelection();s.nodes=u.nodes,s.edges=u.edges}a!==void 0&&(s.previousSelection=a),e=="click"&&(s.items=this.getClickedItems(n)),t.controlEdge!==void 0&&(s.controlEdge=t.controlEdge),this.body.emitter.emit(e,s)}},{key:"selectObject",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.selectConnectedEdges;if(e!==void 0){if(e instanceof Nt){if(t===!0){var n;(n=this._selectionAccumulator).addEdges.apply(n,fr(e.edges))}this._selectionAccumulator.addNodes(e)}else this._selectionAccumulator.addEdges(e);return!0}return!1}},{key:"deselectObject",value:function(e){e.isSelected()===!0&&(e.selected=!1,this._removeFromSelection(e))}},{key:"_getAllNodesOverlappingWith",value:function(e){for(var t=[],n=this.body.nodes,a=0;a1&&arguments[1]!==void 0?arguments[1]:!0,n=this._pointerToPositionObject(e),a=this._getAllNodesOverlappingWith(n);if(a.length>0)return t===!0?this.body.nodes[a[a.length-1]]:a[a.length-1]}},{key:"_getEdgesOverlappingWith",value:function(e,t){for(var n=this.body.edges,a=0;a1&&arguments[1]!==void 0?arguments[1]:!0,n=this.canvas.DOMtoCanvas(e),a=10,o=null,s=this.body.edges,u=0;u0&&(this.generateClickEvent("deselectEdge",t,e,o),n=!0),a.nodes.deleted.length>0&&(this.generateClickEvent("deselectNode",t,e,o),n=!0),a.nodes.added.length>0&&(this.generateClickEvent("selectNode",t,e),n=!0),a.edges.added.length>0&&(this.generateClickEvent("selectEdge",t,e),n=!0),n===!0&&this.generateClickEvent("select",t,e)}},{key:"getSelection",value:function(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}},{key:"getSelectedNodes",value:function(){return this._selectionAccumulator.getNodes()}},{key:"getSelectedEdges",value:function(){return this._selectionAccumulator.getEdges()}},{key:"getSelectedNodeIds",value:function(){var e;return na(e=this._selectionAccumulator.getNodes()).call(e,function(t){return t.id})}},{key:"getSelectedEdgeIds",value:function(){var e;return na(e=this._selectionAccumulator.getEdges()).call(e,function(t){return t.id})}},{key:"setSelection",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||!e.nodes&&!e.edges)throw new TypeError("Selection must be an object with nodes and/or edges properties");if((t.unselectAll||t.unselectAll===void 0)&&this.unselectAll(),e.nodes){var n=P$(e.nodes),a;try{for(n.s();!(a=n.n()).done;){var o=a.value,s=this.body.nodes[o];if(!s)throw new RangeError('Node with id "'+o+'" not found');this.selectObject(s,t.highlightEdges)}}catch(d){n.e(d)}finally{n.f()}}if(e.edges){var u=P$(e.edges),l;try{for(u.s();!(l=u.n()).done;){var h=l.value,c=this.body.edges[h];if(!c)throw new RangeError('Edge with id "'+h+'" not found');this.selectObject(c)}}catch(d){u.e(d)}finally{u.f()}}this.body.emitter.emit("_requestRedraw"),this._selectionAccumulator.commit()}},{key:"selectNodes",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:t})}},{key:"selectEdges",value:function(e){if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({edges:e})}},{key:"updateSelection",value:function(){for(var e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(var t in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,t.id)||this._selectionAccumulator.deleteEdges(t)}},{key:"getClickedItems",value:function(e){for(var t=this.canvas.DOMtoCanvas(e),n=[],a=this.body.nodeIndices,o=this.body.nodes,s=a.length-1;s>=0;s--){var u=o[a[s]],l=u.getItemsOnPoint(t);n.push.apply(n,l)}for(var h=this.body.edgeIndices,c=this.body.edges,d=h.length-1;d>=0;d--){var f=c[h[d]],v=f.getItemsOnPoint(t);n.push.apply(n,v)}return n}}]),i}(),C$=kS,rve=Math.floor,Bf=function(i,r){var e=i.length,t=rve(e/2);return e<8?ive(i,r):nve(i,Bf(C$(i,0,t),r),Bf(C$(i,t),r),r)},ive=function(i,r){for(var e=i.length,t=1,n,a;t0;)i[a]=i[--a];a!==t++&&(i[a]=n)}return i},nve=function(i,r,e,t){for(var n=r.length,a=e.length,o=0,s=0;o3)){if(mve)return!0;if(F$)return F$<603;var i="",r,e,t,n;for(r=65;r<76;r++){switch(e=String.fromCharCode(r),r){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(n=0;n<47;n++)ii.push({k:e+n,v:t})}for(ii.sort(function(a,o){return o.v-a.v}),n=0;nN$(e)?1:-1}};dve({target:"Array",proto:!0,forced:Eve},{sort:function(r){r!==void 0&&fve(r);var e=vve(this);if(KT)return r===void 0?j$(e):j$(e,r);var t=[],n=R$(e),a,o;for(o=0;o=0:s>u;u+=l)u in o&&(n=e(n,o[u],u,a));return n}},Fve={left:L$(!1),right:L$(!0)},jve=Pe,Lve=Hr,zve=Lve(jve.process)==="process",Hve=q,Vve=Fve.left,Wve=Ra,z$=Xo,Uve=zve,Kve=!Uve&&z$>79&&z$<83,Gve=Kve||!Wve("reduce");Hve({target:"Array",proto:!0,forced:Gve},{reduce:function(r){var e=arguments.length;return Vve(this,r,e,e>1?arguments[1]:void 0)}});var qve=et,Yve=qve("Array").reduce,Xve=Be,Jve=Yve,yd=Array.prototype,Zve=function(i){var r=i.reduce;return i===yd||Xve(yd,i)&&r===yd.reduce?Jve:r},Qve=Zve,epe=Qve,tpe=epe,GT=V(tpe);function qT(i){var r=rpe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function rpe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var YT=function(){function i(){N(this,i)}return M(i,[{key:"abstract",value:function(){throw new Error("Can't instantiate abstract class!")}},{key:"fake_use",value:function(){}},{key:"curveType",value:function(){return this.abstract()}},{key:"getPosition",value:function(e){return this.fake_use(e),this.abstract()}},{key:"setPosition",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;this.fake_use(e,t,n),this.abstract()}},{key:"getTreeSize",value:function(e){return this.fake_use(e),this.abstract()}},{key:"sort",value:function(e){this.fake_use(e),this.abstract()}},{key:"fix",value:function(e,t){this.fake_use(e,t),this.abstract()}},{key:"shift",value:function(e,t){this.fake_use(e,t),this.abstract()}}]),i}(),ipe=function(i){ue(e,i);var r=qT(e);function e(t){var n;return N(this,e),n=r.call(this),n.layout=t,n}return M(e,[{key:"curveType",value:function(){return"horizontal"}},{key:"getPosition",value:function(n){return n.x}},{key:"setPosition",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;o!==void 0&&this.layout.hierarchical.addToOrdering(n,o),n.x=a}},{key:"getTreeSize",value:function(n){var a=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,n);return{min:a.min_x,max:a.max_x}}},{key:"sort",value:function(n){oo(n).call(n,function(a,o){return a.x-o.x})}},{key:"fix",value:function(n,a){n.y=this.layout.options.hierarchical.levelSeparation*a,n.options.fixed.y=!0}},{key:"shift",value:function(n,a){this.layout.body.nodes[n].x+=a}}]),e}(YT),npe=function(i){ue(e,i);var r=qT(e);function e(t){var n;return N(this,e),n=r.call(this),n.layout=t,n}return M(e,[{key:"curveType",value:function(){return"vertical"}},{key:"getPosition",value:function(n){return n.y}},{key:"setPosition",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;o!==void 0&&this.layout.hierarchical.addToOrdering(n,o),n.y=a}},{key:"getTreeSize",value:function(n){var a=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,n);return{min:a.min_y,max:a.max_y}}},{key:"sort",value:function(n){oo(n).call(n,function(a,o){return a.y-o.y})}},{key:"fix",value:function(n,a){n.x=this.layout.options.hierarchical.levelSeparation*a,n.options.fixed.x=!0}},{key:"shift",value:function(n,a){this.layout.body.nodes[n].y+=a}}]),e}(YT),ape=q,ope=wi.every,spe=Ra,upe=spe("every");ape({target:"Array",proto:!0,forced:!upe},{every:function(r){return ope(this,r,arguments.length>1?arguments[1]:void 0)}});var lpe=et,hpe=lpe("Array").every,cpe=Be,dpe=hpe,md=Array.prototype,fpe=function(i){var r=i.every;return i===md||cpe(md,i)&&r===md.every?dpe:r},vpe=fpe,ppe=vpe,gpe=ppe,XT=V(gpe);function ype(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=mpe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function mpe(i,r){var e;if(i){if(typeof i=="string")return H$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return H$(i,r)}}function H$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e=r[a])&&(r[a]=r[n]+1)}),r}function $pe(i){return JT(function(r){var e,t;return XT(e=Tt(t=r.edges).call(t,function(n){return i.has(n.toId)})).call(e,function(n){return n.to===r})},function(r,e){return e>r},"from",i)}function wpe(i){return JT(function(r){var e,t;return XT(e=Tt(t=r.edges).call(t,function(n){return i.has(n.toId)})).call(e,function(n){return n.from===r})},function(r,e){return eo)return{v:{v:bpe(t,a)}};++m},O;$=y.pop();)if(O=b(),O!==0&&O)return O.v},d;for(l.s();!(h=l.n()).done;)if(d=c(),d!==0&&d)return d.v}catch(f){l.e(f)}finally{l.f()}return a}var _pe=function(){function i(){N(this,i),this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}return M(i,[{key:"addRelation",value:function(e,t){this.childrenReference[e]===void 0&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),this.parentReference[t]===void 0&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}},{key:"checkIfTree",value:function(){for(var e in this.parentReference)if(this.parentReference[e].length>1){this.isTree=!1;return}this.isTree=!0}},{key:"numTrees",value:function(){return this.treeIndex+1}},{key:"setTreeIndex",value:function(e,t){t!==void 0&&this.trees[e.id]===void 0&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}},{key:"ensureLevel",value:function(e){this.levels[e]===void 0&&(this.levels[e]=0)}},{key:"getMaxLevel",value:function(e){var t=this,n={},a=function o(s){if(n[s]!==void 0)return n[s];var u=t.levels[s];if(t.childrenReference[s]){var l=t.childrenReference[s];if(l.length>0)for(var h=0;h0&&(n.levelSeparation*=-1):n.levelSeparation<0&&(n.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(a===!0)return this.body.emitter.emit("refresh"),pe(t,this.optionsBackup)}return t}},{key:"_resetRNG",value:function(e){this.initialRandomSeed=e,this._rng=Ql(this.initialRandomSeed)}},{key:"adaptAllOptionsForHierarchicalLayout",value:function(e){if(this.options.hierarchical.enabled===!0){var t=this.optionsBackup.physics;e.physics===void 0||e.physics===!0?(e.physics={enabled:t.enabled===void 0?!0:t.enabled,solver:"hierarchicalRepulsion"},t.enabled=t.enabled===void 0?!0:t.enabled,t.solver=t.solver||"barnesHut"):de(e.physics)==="object"?(t.enabled=e.physics.enabled===void 0?!0:e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):e.physics!==!1&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});var n=this.direction.curveType();if(e.edges===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(e.edges.smooth===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if(typeof e.edges.smooth=="boolean")this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:n};else{var a=e.edges.smooth;a.type!==void 0&&a.type!=="dynamic"&&(n=a.type),this.optionsBackup.edges={smooth:{enabled:a.enabled===void 0?!0:a.enabled,type:a.type===void 0?"dynamic":a.type,roundness:a.roundness===void 0?.5:a.roundness,forceDirection:a.forceDirection===void 0?!1:a.forceDirection}},e.edges.smooth={enabled:a.enabled===void 0?!0:a.enabled,type:n,roundness:a.roundness===void 0?.5:a.roundness,forceDirection:a.forceDirection===void 0?!1:a.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",n)}return e}},{key:"positionInitially",value:function(e){if(this.options.hierarchical.enabled!==!0){this._resetRNG(this.initialRandomSeed);for(var t=e.length+50,n=0;nu){for(var h=e.length;e.length>u&&s<=o;){s+=1;var c=e.length;s%3===0?this.body.modules.clustering.clusterBridges(l):this.body.modules.clustering.clusterOutliers(l);var d=e.length;if(c==d&&s%3!==0){this._declusterAll(),this.body.emitter.emit("_layoutFailed"),console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.");return}}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*h)})}s>o&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();for(var f=70,v=0;v0){var e,t,n=!1,a=!1;this.lastNodeOnLevel={},this.hierarchical=new _pe;for(t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&(e=this.body.nodes[t],e.options.level!==void 0?(n=!0,this.hierarchical.levels[t]=e.options.level):a=!0);if(a===!0&&n===!0)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");if(a===!0){var o=this.options.hierarchical.sortMethod;o==="hubsize"?this._determineLevelsByHubsize():o==="directed"?this._determineLevelsDirected():o==="custom"&&this._determineLevelsCustomCallback()}for(var s in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,s)&&this.hierarchical.ensureLevel(s);var u=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(u),this._condenseHierarchy(),this._shiftToCenter()}}},{key:"_condenseHierarchy",value:function(){var e=this,t=!1,n={},a=function(){for(var $=s(),b=0,O=0;O<$.length-1;O++){var _=$[O].max-$[O+1].min;b+=_+e.options.hierarchical.treeSpacing,o(O+1,b)}},o=function($,b){var O=e.hierarchical.trees;for(var _ in O)Object.prototype.hasOwnProperty.call(O,_)&&O[_]===$&&e.direction.shift(_,b)},s=function(){for(var $=[],b=0;b0)for(var _=0;_1&&arguments[1]!==void 0?arguments[1]:1e9,O=1e9,_=1e9,D=1e9,R=-1e9;for(var P in $)if(Object.prototype.hasOwnProperty.call($,P)){var B=e.body.nodes[P],j=e.hierarchical.levels[B.id],J=e.direction.getPosition(B),U=e._getSpaceAroundNode(B,$),ie=Te(U,2),_e=ie[0],ye=ie[1];O=Math.min(_e,O),_=Math.min(ye,_),j<=b&&(D=Math.min(J,D),R=Math.max(J,R))}return[D,R,O,_]},h=function($,b){var O=e.hierarchical.getMaxLevel($.id),_=e.hierarchical.getMaxLevel(b.id);return Math.min(O,_)},c=function($,b,O){for(var _=e.hierarchical,D=0;D1)for(var B=0;B2&&arguments[2]!==void 0?arguments[2]:!1,_=e.direction.getPosition($),D=e.direction.getPosition(b),R=Math.abs(D-_),P=e.options.hierarchical.nodeSpacing;if(R>P){var B={},j={};u($,B),u(b,j);var J=h($,b),U=l(B,J),ie=l(j,J),_e=U[1],ye=ie[0],Ae=ie[2],ht=Math.abs(_e-ye);if(ht>P){var at=_e-ye+P;at<-Ae+P&&(at=-Ae+P),at<0&&(e._shiftBlock(b.id,at),t=!0,O===!0&&e._centerParent(b))}}},f=function($,b){for(var O=b.id,_=b.edges,D=e.hierarchical.levels[b.id],R=e.options.hierarchical.levelSeparation*e.options.hierarchical.levelSeparation,P={},B=[],j=0;j<_.length;j++){var J=_[j];if(J.toId!=J.fromId){var U=J.toId==O?J.from:J.to;P[_[j].id]=U,e.hierarchical.levels[U.id]0?ut=Math.min(Rt,Sr-e.options.hierarchical.nodeSpacing):Rt<0&&(ut=-Math.min(-Rt,st-e.options.hierarchical.nodeSpacing)),ut!=0&&(e._shiftBlock(b.id,ut),t=!0)},ht=function(ot){var me=e.direction.getPosition(b),Fe=e._getSpaceAroundNode(b),De=Te(Fe,2),st=De[0],Sr=De[1],Rt=ot-me,ut=me;Rt>0?ut=Math.min(me+(Sr-e.options.hierarchical.nodeSpacing),ot):Rt<0&&(ut=Math.max(me-(st-e.options.hierarchical.nodeSpacing),ot)),ut!==me&&(e.direction.setPosition(b,ut),t=!0)},at=ye($,B);Ae(at),at=ye($,_),ht(at)},v=function($){var b=e.hierarchical.getLevels();b=Li(b).call(b);for(var O=0;O<$;O++){t=!1;for(var _=0;_0&&Math.abs(v)0&&(h=this.direction.getPosition(a[s-1])+l),this.direction.setPosition(u,h,t),this._validatePositionAndContinue(u,t,h),o++}}}}},{key:"_placeBranchNodes",value:function(e,t){var n,a=this.hierarchical.childrenReference[e];if(a!==void 0){for(var o=[],s=0;st&&this.positionedNodes[l.id]===void 0){var c=this.options.hierarchical.nodeSpacing,d=void 0;u===0?d=this.direction.getPosition(this.body.nodes[e]):d=this.direction.getPosition(o[u-1])+c,this.direction.setPosition(l,d,h),this._validatePositionAndContinue(l,h,d)}else return}var f=this._getCenterPosition(o);this.direction.setPosition(this.body.nodes[e],f,t)}}},{key:"_validatePositionAndContinue",value:function(e,t,n){if(this.hierarchical.isTree){if(this.lastNodeOnLevel[t]!==void 0){var a=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(n-ae.hierarchical.levels[a.id]&&e.hierarchical.addRelation(a.id,o.id)};this._crawlNetwork(t),this.hierarchical.checkIfTree()}},{key:"_crawlNetwork",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){},n=arguments.length>1?arguments[1]:void 0,a={},o=function d(f,v){if(a[f.id]===void 0){e.hierarchical.setTreeIndex(f,v),a[f.id]=!0;for(var p,g=e._getActiveEdges(f),y=0;y=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Ope(i,r){var e;if(i){if(typeof i=="string")return V$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return V$(i,r)}}function V$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e0&&this.options.deleteNode!==!1?(u===!0&&this._createSeperator(4),this._createDeleteButton(s)):n===0&&this.options.deleteEdge!==!1&&(u===!0&&this._createSeperator(4),this._createDeleteButton(s))),this._bindElementEvents(this.closeDiv,k(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent("select",k(t=this.showManipulatorToolbar).call(t,this))}this.body.emitter.emit("_redraw")}},{key:"addNodeMode",value:function(){var e;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addNode",this.guiEnabled===!0){var t,n=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(n),this._createSeperator(),this._createDescription(n.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,k(t=this.toggleEditMode).call(t,this))}this._temporaryBindEvent("click",k(e=this._performAddNode).call(e,this))}},{key:"editNode",value:function(){var e=this;this.editMode!==!0&&this.enableEditMode(),this._clean();var t=this.selectionHandler.getSelectedNodes()[0];if(t!==void 0)if(this.inMode="editNode",typeof this.options.editNode=="function")if(t.isCluster!==!0){var n=pe({},t.options,!1);if(n.x=t.x,n.y=t.y,this.options.editNode.length===2)this.options.editNode(n,function(a){a!=null&&e.inMode==="editNode"&&e.body.data.nodes.getDataSet().update(a),e.showManipulatorToolbar()});else throw new Error("The function for edit does not support two arguments (data, callback)")}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError);else throw new Error("No function has been configured to handle the editing of nodes.");else this.showManipulatorToolbar()}},{key:"addEdgeMode",value:function(){var e,t,n,a,o;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addEdge",this.guiEnabled===!0){var s,u=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(u),this._createSeperator(),this._createDescription(u.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,k(s=this.toggleEditMode).call(s,this))}this._temporaryBindUI("onTouch",k(e=this._handleConnect).call(e,this)),this._temporaryBindUI("onDragEnd",k(t=this._finishConnect).call(t,this)),this._temporaryBindUI("onDrag",k(n=this._dragControlNode).call(n,this)),this._temporaryBindUI("onRelease",k(a=this._finishConnect).call(a,this)),this._temporaryBindUI("onDragStart",k(o=this._dragStartEdge).call(o,this)),this._temporaryBindUI("onHold",function(){})}},{key:"editEdgeMode",value:function(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="editEdge",de(this.options.editEdge)==="object"&&typeof this.options.editEdge.editWithoutDrag=="function"&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0)){var e=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(e.from.id,e.to.id);return}if(this.guiEnabled===!0){var t,n=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(n),this._createSeperator(),this._createDescription(n.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,k(t=this.toggleEditMode).call(t,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0){var a,o,s,u,l=this.body.edges[this.edgeBeingEditedId],h=this._getNewTargetNode(l.from.x,l.from.y),c=this._getNewTargetNode(l.to.x,l.to.y);this.temporaryIds.nodes.push(h.id),this.temporaryIds.nodes.push(c.id),this.body.nodes[h.id]=h,this.body.nodeIndices.push(h.id),this.body.nodes[c.id]=c,this.body.nodeIndices.push(c.id),this._temporaryBindUI("onTouch",k(a=this._controlNodeTouch).call(a,this)),this._temporaryBindUI("onTap",function(){}),this._temporaryBindUI("onHold",function(){}),this._temporaryBindUI("onDragStart",k(o=this._controlNodeDragStart).call(o,this)),this._temporaryBindUI("onDrag",k(s=this._controlNodeDrag).call(s,this)),this._temporaryBindUI("onDragEnd",k(u=this._controlNodeDragEnd).call(u,this)),this._temporaryBindUI("onMouseMove",function(){}),this._temporaryBindEvent("beforeDrawing",function(d){var f=l.edgeType.findBorderPositions(d);h.selected===!1&&(h.x=f.from.x,h.y=f.from.y),c.selected===!1&&(c.x=f.to.x,c.y=f.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}},{key:"deleteSelected",value:function(){var e=this;this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="delete";var t=this.selectionHandler.getSelectedNodeIds(),n=this.selectionHandler.getSelectedEdgeIds(),a=void 0;if(t.length>0){for(var o=0;o0&&typeof this.options.deleteEdge=="function"&&(a=this.options.deleteEdge);if(typeof a=="function"){var s={nodes:t,edges:n};if(a.length===2)a(s,function(u){u!=null&&e.inMode==="delete"?(e.body.data.edges.getDataSet().remove(u.edges),e.body.data.nodes.getDataSet().remove(u.nodes),e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar()):(e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar())});else throw new Error("The function for delete does not support two arguments (data, callback)")}else this.body.data.edges.getDataSet().remove(n),this.body.data.nodes.getDataSet().remove(t),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}},{key:"_setup",value:function(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}},{key:"_createWrappers",value:function(){if(this.manipulationDiv===void 0&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",this.editMode===!0?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),this.editModeDiv===void 0&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",this.editMode===!0?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),this.closeDiv===void 0){var e,t;this.closeDiv=document.createElement("button"),this.closeDiv.className="vis-close",this.closeDiv.setAttribute("aria-label",(e=(t=this.options.locales[this.options.locale])===null||t===void 0?void 0:t.close)!==null&&e!==void 0?e:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv)}}},{key:"_getNewTargetNode",value:function(e,t){var n=pe({},this.options.controlNodeStyle);n.id="targetNode"+no(),n.hidden=!1,n.physics=!1,n.x=e,n.y=t;var a=this.body.functions.createNode(n);return a.shape.boundingBox={left:e,right:e,top:t,bottom:t},a}},{key:"_createEditButton",value:function(){var e;this._clean(),this.manipulationDOM={},Zr(this.editModeDiv);var t=this.options.locales[this.options.locale],n=this._createButton("editMode","vis-edit vis-edit-mode",t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(n),this._bindElementEvents(n,k(e=this.toggleEditMode).call(e,this))}},{key:"_clean",value:function(){this.inMode=!1,this.guiEnabled===!0&&(Zr(this.editModeDiv),Zr(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}},{key:"_cleanupDOMEventListeners",value:function(){var e,t=Spe(Ar(e=this._domEventListenerCleanupQueue).call(e,0)),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;a()}}catch(o){t.e(o)}finally{t.f()}}},{key:"_removeManipulationDOM",value:function(){this._clean(),Zr(this.manipulationDiv),Zr(this.editModeDiv),Zr(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}},{key:"_createSeperator",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}},{key:"_createAddNodeButton",value:function(e){var t,n=this._createButton("addNode","vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.addNodeMode).call(t,this))}},{key:"_createAddEdgeButton",value:function(e){var t,n=this._createButton("addEdge","vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.addEdgeMode).call(t,this))}},{key:"_createEditNodeButton",value:function(e){var t,n=this._createButton("editNode","vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.editNode).call(t,this))}},{key:"_createEditEdgeButton",value:function(e){var t,n=this._createButton("editEdge","vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.editEdgeMode).call(t,this))}},{key:"_createDeleteButton",value:function(e){var t,n;this.options.rtl?n="vis-delete-rtl":n="vis-delete";var a=this._createButton("delete",n,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(a),this._bindElementEvents(a,k(t=this.deleteSelected).call(t,this))}},{key:"_createBackButton",value:function(e){var t,n=this._createButton("back","vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.showManipulatorToolbar).call(t,this))}},{key:"_createButton",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("button"),this.manipulationDOM[e+"Div"].className="vis-button "+t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=a,this.manipulationDOM[e+"Label"].innerText=n,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}},{key:"_createDescription",value:function(e){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}},{key:"_temporaryBindEvent",value:function(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}},{key:"_temporaryBindUI",value:function(e,t){if(this.body.eventListeners[e]!==void 0)this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t;else throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+ls(Oe(this.body.eventListeners)))}},{key:"_unbindTemporaryUIs",value:function(){for(var e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}},{key:"_unbindTemporaryEvents",value:function(){for(var e=0;e=0;u--)if(o[u]!==this.selectedControlNode.id){s=this.body.nodes[o[u]];break}if(s!==void 0&&this.selectedControlNode!==void 0)if(s.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var l=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===l.id?this._performEditEdge(s.id,a.to.id):this._performEditEdge(a.from.id,s.id)}else a.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}}},{key:"_handleConnect",value:function(e){if(new Date().valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=Le({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;var t=this.lastTouch,n=this.selectionHandler.getNodeAt(t);if(n!==void 0)if(n.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var a=this._getNewTargetNode(n.x,n.y);this.body.nodes[a.id]=a,this.body.nodeIndices.push(a.id);var o=this.body.functions.createEdge({id:"connectionEdge"+no(),from:n.id,to:a.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[o.id]=o,this.body.edgeIndices.push(o.id),this.temporaryIds.nodes.push(a.id),this.temporaryIds.edges.push(o.id)}this.touchTime=new Date().valueOf()}}},{key:"_dragControlNode",value:function(e){var t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),a=void 0;this.temporaryIds.edges[0]!==void 0&&(a=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var o=this.selectionHandler._getAllNodesOverlappingWith(n),s=void 0,u=o.length-1;u>=0;u--){var l;if(ne(l=this.temporaryIds.nodes).call(l,o[u])===-1){s=this.body.nodes[o[u]];break}}if(e.controlEdge={from:a,to:s?s.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",e,t),this.temporaryIds.nodes[0]!==void 0){var h=this.body.nodes[this.temporaryIds.nodes[0]];h.x=this.canvas._XconvertDOMtoCanvas(t.x),h.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(e)}},{key:"_finishConnect",value:function(e){var t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),a=void 0;this.temporaryIds.edges[0]!==void 0&&(a=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var o=this.selectionHandler._getAllNodesOverlappingWith(n),s=void 0,u=o.length-1;u>=0;u--){var l;if(ne(l=this.temporaryIds.nodes).call(l,o[u])===-1){s=this.body.nodes[o[u]];break}}this._cleanupTemporaryNodesAndEdges(),s!==void 0&&(s.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):this.body.nodes[a]!==void 0&&this.body.nodes[s.id]!==void 0&&this._performAddEdge(a,s.id)),e.controlEdge={from:a,to:s?s.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",e,t),this.body.emitter.emit("_redraw")}},{key:"_dragStartEdge",value:function(e){var t=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",e,t,void 0,!0)}},{key:"_performAddNode",value:function(e){var t=this,n={id:no(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if(typeof this.options.addNode=="function")if(this.options.addNode.length===2)this.options.addNode(n,function(a){a!=null&&t.inMode==="addNode"&&t.body.data.nodes.getDataSet().add(a),t.showManipulatorToolbar()});else throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");else this.body.data.nodes.getDataSet().add(n),this.showManipulatorToolbar()}},{key:"_performAddEdge",value:function(e,t){var n=this,a={from:e,to:t};if(typeof this.options.addEdge=="function")if(this.options.addEdge.length===2)this.options.addEdge(a,function(o){o!=null&&n.inMode==="addEdge"&&(n.body.data.edges.getDataSet().add(o),n.selectionHandler.unselectAll(),n.showManipulatorToolbar())});else throw new Error("The function for connect does not support two arguments (data,callback)");else this.body.data.edges.getDataSet().add(a),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}},{key:"_performEditEdge",value:function(e,t){var n=this,a={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges.get(this.edgeBeingEditedId).label},o=this.options.editEdge;if(de(o)==="object"&&(o=o.editWithoutDrag),typeof o=="function")if(o.length===2)o(a,function(s){s==null||n.inMode!=="editEdge"?(n.body.edges[a.id].updateEdgeType(),n.body.emitter.emit("_redraw"),n.showManipulatorToolbar()):(n.body.data.edges.getDataSet().update(s),n.selectionHandler.unselectAll(),n.showManipulatorToolbar())});else throw new Error("The function for edit does not support two arguments (data, callback)");else this.body.data.edges.getDataSet().update(a),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}]),i}(),A="string",I="boolean",w="number",Ya="array",H="object",ZT="dom",Ipe="any",bd=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],$d={borderWidth:{number:w},borderWidthSelected:{number:w,undefined:"undefined"},brokenImage:{string:A,undefined:"undefined"},chosen:{label:{boolean:I,function:"function"},node:{boolean:I,function:"function"},__type__:{object:H,boolean:I}},color:{border:{string:A},background:{string:A},highlight:{border:{string:A},background:{string:A},__type__:{object:H,string:A}},hover:{border:{string:A},background:{string:A},__type__:{object:H,string:A}},__type__:{object:H,string:A}},opacity:{number:w,undefined:"undefined"},fixed:{x:{boolean:I},y:{boolean:I},__type__:{object:H,boolean:I}},font:{align:{string:A},color:{string:A},size:{number:w},face:{string:A},background:{string:A},strokeWidth:{number:w},strokeColor:{string:A},vadjust:{number:w},multi:{boolean:I,string:A},bold:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},boldital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},ital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},mono:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},__type__:{object:H,string:A}},group:{string:A,number:w,undefined:"undefined"},heightConstraint:{minimum:{number:w},valign:{string:A},__type__:{object:H,boolean:I,number:w}},hidden:{boolean:I},icon:{face:{string:A},code:{string:A},size:{number:w},color:{string:A},weight:{string:A,number:w},__type__:{object:H}},id:{string:A,number:w},image:{selected:{string:A,undefined:"undefined"},unselected:{string:A,undefined:"undefined"},__type__:{object:H,string:A}},imagePadding:{top:{number:w},right:{number:w},bottom:{number:w},left:{number:w},__type__:{object:H,number:w}},label:{string:A,undefined:"undefined"},labelHighlightBold:{boolean:I},level:{number:w,undefined:"undefined"},margin:{top:{number:w},right:{number:w},bottom:{number:w},left:{number:w},__type__:{object:H,number:w}},mass:{number:w},physics:{boolean:I},scaling:{min:{number:w},max:{number:w},label:{enabled:{boolean:I},min:{number:w},max:{number:w},maxVisible:{number:w},drawThreshold:{number:w},__type__:{object:H,boolean:I}},customScalingFunction:{function:"function"},__type__:{object:H}},shadow:{enabled:{boolean:I},color:{string:A},size:{number:w},x:{number:w},y:{number:w},__type__:{object:H,boolean:I}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:I,array:Ya},borderRadius:{number:w},interpolation:{boolean:I},useImageSize:{boolean:I},useBorderWithImage:{boolean:I},coordinateOrigin:{string:["center","top-left"]},__type__:{object:H}},size:{number:w},title:{string:A,dom:ZT,undefined:"undefined"},value:{number:w,undefined:"undefined"},widthConstraint:{minimum:{number:w},maximum:{number:w},__type__:{object:H,boolean:I,number:w}},x:{number:w},y:{number:w},__type__:{object:H}},kpe={configure:{enabled:{boolean:I},filter:{boolean:I,string:A,array:Ya,function:"function"},container:{dom:ZT},showButton:{boolean:I},__type__:{object:H,boolean:I,string:A,array:Ya,function:"function"}},edges:{arrows:{to:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageHeight:{number:w},imageWidth:{number:w},src:{string:A},__type__:{object:H,boolean:I}},middle:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageWidth:{number:w},imageHeight:{number:w},src:{string:A},__type__:{object:H,boolean:I}},from:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageWidth:{number:w},imageHeight:{number:w},src:{string:A},__type__:{object:H,boolean:I}},__type__:{string:["from","to","middle"],object:H}},endPointOffset:{from:{number:w},to:{number:w},__type__:{object:H,number:w}},arrowStrikethrough:{boolean:I},background:{enabled:{boolean:I},color:{string:A},size:{number:w},dashes:{boolean:I,array:Ya},__type__:{object:H,boolean:I}},chosen:{label:{boolean:I,function:"function"},edge:{boolean:I,function:"function"},__type__:{object:H,boolean:I}},color:{color:{string:A},highlight:{string:A},hover:{string:A},inherit:{string:["from","to","both"],boolean:I},opacity:{number:w},__type__:{object:H,string:A}},dashes:{boolean:I,array:Ya},font:{color:{string:A},size:{number:w},face:{string:A},background:{string:A},strokeWidth:{number:w},strokeColor:{string:A},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:w},multi:{boolean:I,string:A},bold:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},boldital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},ital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},mono:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},__type__:{object:H,string:A}},hidden:{boolean:I},hoverWidth:{function:"function",number:w},label:{string:A,undefined:"undefined"},labelHighlightBold:{boolean:I},length:{number:w,undefined:"undefined"},physics:{boolean:I},scaling:{min:{number:w},max:{number:w},label:{enabled:{boolean:I},min:{number:w},max:{number:w},maxVisible:{number:w},drawThreshold:{number:w},__type__:{object:H,boolean:I}},customScalingFunction:{function:"function"},__type__:{object:H}},selectionWidth:{function:"function",number:w},selfReferenceSize:{number:w},selfReference:{size:{number:w},angle:{number:w},renderBehindTheNode:{boolean:I},__type__:{object:H}},shadow:{enabled:{boolean:I},color:{string:A},size:{number:w},x:{number:w},y:{number:w},__type__:{object:H,boolean:I}},smooth:{enabled:{boolean:I},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:w},forceDirection:{string:["horizontal","vertical","none"],boolean:I},__type__:{object:H,boolean:I}},title:{string:A,undefined:"undefined"},width:{number:w},widthConstraint:{maximum:{number:w},__type__:{object:H,boolean:I,number:w}},value:{number:w,undefined:"undefined"},__type__:{object:H}},groups:{useDefaultGroups:{boolean:I},__any__:$d,__type__:{object:H}},interaction:{dragNodes:{boolean:I},dragView:{boolean:I},hideEdgesOnDrag:{boolean:I},hideEdgesOnZoom:{boolean:I},hideNodesOnDrag:{boolean:I},hover:{boolean:I},keyboard:{enabled:{boolean:I},speed:{x:{number:w},y:{number:w},zoom:{number:w},__type__:{object:H}},bindToWindow:{boolean:I},autoFocus:{boolean:I},__type__:{object:H,boolean:I}},multiselect:{boolean:I},navigationButtons:{boolean:I},selectable:{boolean:I},selectConnectedEdges:{boolean:I},hoverConnectedEdges:{boolean:I},tooltipDelay:{number:w},zoomView:{boolean:I},zoomSpeed:{number:w},__type__:{object:H}},layout:{randomSeed:{undefined:"undefined",number:w,string:A},improvedLayout:{boolean:I},clusterThreshold:{number:w},hierarchical:{enabled:{boolean:I},levelSeparation:{number:w},nodeSpacing:{number:w},treeSpacing:{number:w},blockShifting:{boolean:I},edgeMinimization:{boolean:I},parentCentralization:{boolean:I},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:H,boolean:I}},__type__:{object:H}},manipulation:{enabled:{boolean:I},initiallyActive:{boolean:I},addNode:{boolean:I,function:"function"},addEdge:{boolean:I,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:H,boolean:I,function:"function"}},deleteNode:{boolean:I,function:"function"},deleteEdge:{boolean:I,function:"function"},controlNodeStyle:$d,__type__:{object:H,boolean:I}},nodes:$d,physics:{enabled:{boolean:I},barnesHut:{theta:{number:w},gravitationalConstant:{number:w},centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},forceAtlas2Based:{theta:{number:w},gravitationalConstant:{number:w},centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},repulsion:{centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},nodeDistance:{number:w},damping:{number:w},__type__:{object:H}},hierarchicalRepulsion:{centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},nodeDistance:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},maxVelocity:{number:w},minVelocity:{number:w},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:I},iterations:{number:w},updateInterval:{number:w},onlyDynamicEdges:{boolean:I},fit:{boolean:I},__type__:{object:H,boolean:I}},timestep:{number:w},adaptiveTimestep:{boolean:I},wind:{x:{number:w},y:{number:w},__type__:{object:H}},__type__:{object:H,boolean:I}},autoResize:{boolean:I},clickToUse:{boolean:I},locale:{string:A},locales:{__any__:{any:Ipe},__type__:{object:H}},height:{string:A},width:{string:A},__type__:{object:H}},QT={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:["color","#2B7CE9"],background:["color","#97C2FC"],highlight:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]},hover:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[0,0,50,1],strokeColor:["color","#ffffff"]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:["ellipse","box","circle","database","diamond","dot","square","star","text","triangle","triangleDown","hexagon"],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:["color","#848484"],highlight:["color","#848484"],hover:["color","#848484"],inherit:["from","to","both",!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[2,0,50,1],strokeColor:["color","#ffffff"],align:["horizontal","top","middle","bottom"]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"],forceDirection:["horizontal","vertical","none"],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:["UD","DU","LR","RL"],sortMethod:["hubsize","directed"],shakeTowards:["leaves","roots"]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0,autoFocus:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:["barnesHut","forceAtlas2Based","repulsion","hierarchicalRepulsion"],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},Ppe=function(r,e,t){var n;return!!(hi(r).call(r,"physics")&&hi(n=QT.physics.solver).call(n,e)&&t.physics.solver!==e&&e!=="wind")},xpe=function(){function i(){N(this,i)}return M(i,[{key:"getDistances",value:function(e,t,n){for(var a={},o=e.edges,s=0;s2&&arguments[2]!==void 0?arguments[2]:!1,a=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(a),this._createK_matrix(a),this._createE_matrix();for(var o=.01,s=1,u=0,l=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),h=5,c=1e9,d=0,f=0,v=0,p=0,g=0;c>o&&us&&gy.type==="downstream_subgraph_search")?.data||[],f=y=>{const m=y.json.nodes.map(b=>({id:b.id,label:b.type,color:{background:"#2B7CE9",border:"#1B5BB1"},font:{size:16,color:"#FFFFFF",face:"arial",bold:!0},margin:12,padding:10,shape:"box",widthConstraint:{minimum:100,maximum:200}})),$=y.json.links.map(b=>({from:b.origin_id,to:b.target_id,arrows:{to:{enabled:!0,scaleFactor:1.2}},color:"#000000",width:2}));return{nodes:m,edges:$}};We.useEffect(()=>()=>{c.current&&(c.current.destroy(),c.current=null)},[]);const v=We.useCallback((y,m)=>{c.current&&c.current.destroy();const $=f(m),b=new z(y,$,{nodes:{shape:"box",margin:12,padding:10,font:{size:16,color:"#FFFFFF",face:"arial",bold:!0},borderWidth:2,shadow:{enabled:!0,color:"rgba(0,0,0,0.2)",size:5}},edges:{arrows:"to",color:"#000000",width:2,smooth:{enabled:!0,type:"straightCross"}},physics:{enabled:!0,solver:"hierarchicalRepulsion",hierarchicalRepulsion:{nodeDistance:200,springLength:200}},layout:{hierarchical:{enabled:!0,direction:"UD",sortMethod:"directed",nodeSpacing:200,levelSeparation:150}},interaction:{dragNodes:!1,zoomView:!1,dragView:!1}});c.current=b},[]),p=async y=>{console.log("[DownstreamSubgraphs] Starting checkAndLoadSubgraph with node:",y),ai.trackEvent({event_type:"subgraph_accept",message_type:"subgraph",message_id:u.message_id,data:{subgraph_name:y.name,subgraph_tags:y.tags}});const m=y.json.nodes,$=Object.values(Mt.canvas.selected_nodes)[0];if(!$){console.warn("[DownstreamSubgraphs] No node selected"),alert("Please select a upstream node first before adding a subgraph.");return}const b=m.map(D=>D.type),O=s;console.log("[DownstreamSubgraphs] Required node types:",b),console.log("[DownstreamSubgraphs] Installed node types:",O);const _=b.filter(D=>!O.includes(D));if(console.log("[DownstreamSubgraphs] Missing node types:",_),_.length>0)try{console.log("[DownstreamSubgraphs] Fetching info for missing nodes");const D=await ai.batchGetNodeInfo(_);console.log("[DownstreamSubgraphs] Received node infos:",D);const R={text:"",ext:[{type:"node_install_guide",data:D.map(B=>({name:B.name,repository_url:B.github_url}))}]};console.log("[DownstreamSubgraphs] Created message content:",R);const P={id:dr(),role:"ai",content:JSON.stringify(R),format:"markdown",name:"Assistant",metadata:{pendingSubgraph:y}};console.log("[DownstreamSubgraphs] Created AI message:",P),t?.(P);return}catch(D){console.error("[DownstreamSubgraphs] Error fetching node info:",D),alert("Error checking required nodes. Please try again.");return}console.log("[DownstreamSubgraphs] All required nodes are installed, proceeding to load subgraph"),g(y,$)},g=(y,m)=>{const $=y.json.nodes,b=y.json.links,O=$.find(R=>R.id===0),_=O?.id;console.log("[DownstreamSubgraphs] Entry node ID:",_);const D={};_!==null&&(D[_]=m),Mt.canvas.emitBeforeChange();try{for(const R of $)if(R.id!==_){const P=O?.pos,B=[m._pos[0],m._pos[1]],j=[R.pos[0]+B[0]-P[0],R.pos[1]+B[1]-P[1]];D[R.id]=X$(R.type,{pos:j})}for(const R of b){const P=D[R.origin_id],B=D[R.target_id];P&&B&&P.connect(R.origin_slot,B,R.target_slot)}}finally{Mt.canvas.emitAfterChange()}};return We.useEffect(()=>{const y=()=>{const m=Mt.canvas.selected_nodes;Object.keys(m??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values(m)}):a({type:"SET_SELECTED_NODE",payload:null})};return document.addEventListener("click",y),()=>{document.removeEventListener("click",y)}},[]),S.jsx("div",{className:"rounded-lg bg-gray-500 p-3 text-gray-700 text-xs break-words overflow-visible",children:d.length>0&&S.jsx("div",{className:"space-y-3",children:S.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(y=>S.jsxs("div",{className:"relative group",children:[S.jsx("button",{className:`px-3 py-1.5 bg-blue-500 text-white rounded-md +`),a=n.length;if(t.multi)for(var o=0;o0)for(var u=0;u0)for(var v=0;v")||t.parseStartTag("ital","")||t.parseStartTag("mono","")||t.parseEndTag("bold","")||t.parseEndTag("ital","")||t.parseEndTag("mono",""))||n(a);o||t.add(a),t.position++}return t.emitBlock(),t.blocks}},{key:"splitMarkdownBlocks",value:function(e){for(var t=this,n=new q1(e),a=!0,o=function(h){return/\\/.test(h)?(n.positionthis.parent.fontOptions.maxWdt}},{key:"getLongestFit",value:function(e){for(var t="",n=0;n1&&arguments[1]!==void 0?arguments[1]:"normal",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t),e=e.replace(/^( +)/g,"$1\r"),e=e.replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r");for(var a=e.split("\r");a.length>0;){var o=this.getLongestFit(a);if(o===0){var s=a[0],u=this.getLongestFitWord(s);this.lines.newLine(it(s).call(s,0,u),t),a[0]=it(s).call(s,u)}else{var l=o;a[o-1]===" "?o--:a[l]===" "&&l++;var h=it(a).call(a,0,o).join("");o==a.length&&n?this.lines.append(h,t):this.lines.newLine(h,t),a=it(a).call(a,l)}}}}]),i}(),Va=["bold","ital","boldital","mono"],IT=function(){function i(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;N(this,i),this.body=r,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(e),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=t}return M(i,[{key:"setOptions",value:function(e){if(this.elementOptions=e,this.initFontOptions(e.font),Zu(e.label)?this.labelDirty=!0:e.label=void 0,e.font!==void 0&&e.font!==null){if(typeof e.font=="string")this.baseSize=this.fontOptions.size;else if(de(e.font)==="object"){var t=e.font.size;t!==void 0&&(this.baseSize=t)}}}},{key:"initFontOptions",value:function(e){var t=this;if(te(Va,function(n){t.fontOptions[n]={}}),i.parseFontString(this.fontOptions,e)){this.fontOptions.vadjust=0;return}te(e,function(n,a){n!=null&&de(n)!=="object"&&(t.fontOptions[a]=n)})}},{key:"constrain",value:function(e){var t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},n=Qr(e,"widthConstraint");if(typeof n=="number")t.maxWdt=Number(n),t.minWdt=Number(n);else if(de(n)==="object"){var a=Qr(e,["widthConstraint","maximum"]);typeof a=="number"&&(t.maxWdt=Number(a));var o=Qr(e,["widthConstraint","minimum"]);typeof o=="number"&&(t.minWdt=Number(o))}var s=Qr(e,"heightConstraint");if(typeof s=="number")t.minHgt=Number(s);else if(de(s)==="object"){var u=Qr(e,["heightConstraint","minimum"]);typeof u=="number"&&(t.minHgt=Number(u));var l=Qr(e,["heightConstraint","valign"]);typeof l=="string"&&(l==="top"||l==="bottom")&&(t.valign=l)}return t}},{key:"update",value:function(e,t){this.setOptions(e,!0),this.propagateFonts(t),pe(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=dp("label",t)}},{key:"adjustSizes",value:function(e){var t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);var n=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=n)}},{key:"addFontOptionsToPile",value:function(e,t){for(var n=0;n5&&arguments[5]!==void 0?arguments[5]:"middle";if(this.elementOptions.label!==void 0){var u=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&u=this.elementOptions.scaling.label.maxVisible&&(u=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,a,o,t,n,s),this._drawBackground(e),this._drawText(e,t,this.size.yLine,s,u))}}},{key:"_drawBackground",value:function(e){if(this.fontOptions.background!==void 0&&this.fontOptions.background!=="none"){e.fillStyle=this.fontOptions.background;var t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}},{key:"_drawText",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"middle",o=arguments.length>4?arguments[4]:void 0,s=this._setAlignment(e,t,n,a),u=Te(s,2);t=u[0],n=u[1],e.textAlign="left",t=t-this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&(this.fontOptions.valign==="top"&&(n-=(this.size.height-this.size.labelHeight)/2),this.fontOptions.valign==="bottom"&&(n+=(this.size.height-this.size.labelHeight)/2));for(var l=0;l0&&(e.lineWidth=f.strokeWidth,e.strokeStyle=y,e.lineJoin="round"),e.fillStyle=g,f.strokeWidth>0&&e.strokeText(f.text,t+c,n+f.vadjust),e.fillText(f.text,t+c,n+f.vadjust),c+=f.width}n+=h.height}}}},{key:"_setAlignment",value:function(e,t,n,a){if(this.isEdgeLabel&&this.fontOptions.align!=="horizontal"&&this.pointToSelf===!1){t=0,n=0;var o=2;this.fontOptions.align==="top"?(e.textBaseline="alphabetic",n-=2*o):this.fontOptions.align==="bottom"?(e.textBaseline="hanging",n+=2*o):e.textBaseline="middle"}else e.textBaseline=a;return[t,n]}},{key:"_getColor",value:function(e,t,n){var a=e||"#000000",o=n||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){var s=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));a=Kt(a,s),o=Kt(o,s)}return[a,o]}},{key:"getTextSize",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this._processLabel(e,t,n),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}},{key:"getSize",value:function(){var e=2,t=this.size.left,n=this.size.top-.5*e;if(this.isEdgeLabel){var a=-this.size.width*.5;switch(this.fontOptions.align){case"middle":t=a,n=-this.size.height*.5;break;case"top":t=a,n=-(this.size.height+e);break;case"bottom":t=a,n=e;break}}var o={left:t,top:n,width:this.size.width,height:this.size.height};return o}},{key:"calculateLabelSize",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";this._processLabel(e,t,n),this.size.left=a-this.size.width*.5,this.size.top=o-this.size.height*.5,this.size.yLine=o+(1-this.lineCount)*.5*this.fontOptions.size,s==="hanging"&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}},{key:"getFormattingValues",value:function(e,t,n,a){var o=function(h,c,d){return c==="normal"?d==="mod"?"":h[d]:h[c][d]!==void 0?h[c][d]:h[d]},s={color:o(this.fontOptions,a,"color"),size:o(this.fontOptions,a,"size"),face:o(this.fontOptions,a,"face"),mod:o(this.fontOptions,a,"mod"),vadjust:o(this.fontOptions,a,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||n)&&(a==="normal"&&this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?s.mod="bold":typeof this.fontOptions.chooser=="function"&&this.fontOptions.chooser(s,this.elementOptions.id,t,n));var u="";return s.mod!==void 0&&s.mod!==""&&(u+=s.mod+" "),u+=s.size+"px "+s.face,e.font=u.replace(/"/g,""),s.font=e.font,s.height=s.size,s}},{key:"differentState",value:function(e,t){return e!==this.selectedState||t!==this.hoverState}},{key:"_processLabelText",value:function(e,t,n,a){var o=new Vle(e,this,t,n);return o.process(a)}},{key:"_processLabel",value:function(e,t,n){if(!(this.labelDirty===!1&&!this.differentState(t,n))){var a=this._processLabelText(e,t,n,this.elementOptions.label);this.fontOptions.minWdt>0&&a.width0&&a.height0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}},{key:"performFill",value:function(e,t){e.save(),e.fillStyle=t.color,this.enableShadow(e,t),hs(e).call(e),this.disableShadow(e,t),e.restore(),this.performStroke(e,t)}},{key:"_addBoundingBoxMargin",value:function(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}},{key:"_updateBoundingBox",value:function(e,t,n,a,o){n!==void 0&&this.resize(n,a,o),this.left=e-this.width/2,this.top=t-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}},{key:"updateBoundingBox",value:function(e,t,n,a,o){this._updateBoundingBox(e,t,n,a,o)}},{key:"getDimensionsFromLabel",value:function(e,t,n){this.textSize=this.labelModule.getTextSize(e,t,n);var a=this.textSize.width,o=this.textSize.height,s=14;return a===0&&(a=s,o=s),{width:a,height:o}}}]),i}();function Rhe(i){var r=Nhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Nhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Mhe=function(i){ue(e,i);var r=Rhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o);this.width=s.width+this.margin.right+this.margin.left,this.height=s.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.initContextForDraw(n,l),qE(n,this.left,this.top,this.width,this.height,l.borderRadius),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u)}},{key:"updateBoundingBox",value:function(n,a,o,s,u){this._updateBoundingBox(n,a,o,s,u);var l=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(l)}},{key:"distanceToBorder",value:function(n,a){n&&this.resize(n);var o=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(a)),Math.abs(this.height/2/Math.sin(a)))+o}}]),e}(vn);function Bhe(i){var r=Fhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Fhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var pp=function(i){ue(e,i);var r=Bhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o.labelOffset=0,o.selected=!1,o}return M(e,[{key:"setOptions",value:function(n,a,o){this.options=n,a===void 0&&o===void 0||this.setImages(a,o)}},{key:"setImages",value:function(n,a){a&&this.selected?(this.imageObj=a,this.imageObjAlt=n):(this.imageObj=n,this.imageObjAlt=a)}},{key:"switchImages",value:function(n){var a=n&&!this.selected||!n&&this.selected;if(this.selected=n,this.imageObjAlt!==void 0&&a){var o=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=o}}},{key:"_getImagePadding",value:function(){var n={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){var a=this.options.imagePadding;de(a)=="object"?(n.top=a.top,n.right=a.right,n.bottom=a.bottom,n.left=a.left):(n.top=a,n.right=a,n.bottom=a,n.left=a)}return n}},{key:"_resizeImage",value:function(){var n,a;if(this.options.shapeProperties.useImageSize===!1){var o=1,s=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?o=this.imageObj.width/this.imageObj.height:s=this.imageObj.height/this.imageObj.width),n=this.options.size*2*o,a=this.options.size*2*s}else{var u=this._getImagePadding();n=this.imageObj.width+u.left+u.right,a=this.imageObj.height+u.top+u.bottom}this.width=n,this.height=a,this.radius=.5*this.width}},{key:"_drawRawCircle",value:function(n,a,o,s){this.initContextForDraw(n,s),Av(n,a,o,s.size),this.performFill(n,s)}},{key:"_drawImageAtPosition",value:function(n,a){if(this.imageObj.width!=0){n.globalAlpha=a.opacity!==void 0?a.opacity:1,this.enableShadow(n,a);var o=1;this.options.shapeProperties.interpolation===!0&&(o=this.imageObj.width/this.width/this.body.view.scale);var s=this._getImagePadding(),u=this.left+s.left,l=this.top+s.top,h=this.width-s.left-s.right,c=this.height-s.top-s.bottom;this.imageObj.drawImageAtPosition(n,o,u,l,h,c),this.disableShadow(n,a)}}},{key:"_drawImageLabel",value:function(n,a,o,s,u){var l=0;if(this.height!==void 0){l=this.height*.5;var h=this.labelModule.getTextSize(n,s,u);h.lineCount>=1&&(l+=h.height/2)}var c=o+l;this.options.label&&(this.labelOffset=l),this.labelModule.draw(n,a,c,s,u,"hanging")}}]),e}(vn);function jhe(i){var r=Lhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Lhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var zhe=function(i){ue(e,i);var r=jhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o),u=Math.max(s.width+this.margin.right+this.margin.left,s.height+this.margin.top+this.margin.bottom);this.options.size=u/2,this.width=u,this.height=u,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this._drawRawCircle(n,a,o,l),this.updateBoundingBox(a,o),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,o,s,u)}},{key:"updateBoundingBox",value:function(n,a){this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.width*.5}}]),e}(pp);function Hhe(i){var r=Vhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Vhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Whe=function(i){ue(e,i);var r=Hhe(e);function e(t,n,a,o,s){var u;return N(this,e),u=r.call(this,t,n,a),u.setImages(o,s),u}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0;if(s){var u=this.options.size*2;this.width=u,this.height=u,this.radius=.5*this.width;return}this.needsRefresh(a,o)&&this._resizeImage()}},{key:"draw",value:function(n,a,o,s,u,l){this.switchImages(s),this.resize();var h=a,c=o;this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=a,this.top=o,h+=this.width/2,c+=this.height/2):(this.left=a-this.width/2,this.top=o-this.height/2),this._drawRawCircle(n,h,c,l),n.save(),n.clip(),this._drawImageAtPosition(n,l),n.restore(),this._drawImageLabel(n,h,c,s,u),this.updateBoundingBox(a,o)}},{key:"updateBoundingBox",value:function(n,a){this.options.shapeProperties.coordinateOrigin==="top-left"?(this.boundingBox.top=a,this.boundingBox.left=n,this.boundingBox.right=n+this.options.size*2,this.boundingBox.bottom=a+this.options.size*2):(this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size),this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.width*.5}}]),e}(pp);function Uhe(i){var r=Khe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Khe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Si=function(i){ue(e,i);var r=Uhe(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{size:this.options.size};if(this.needsRefresh(a,o)){var u,l;this.labelModule.getTextSize(n,a,o);var h=2*s.size;this.width=(u=this.customSizeWidth)!==null&&u!==void 0?u:h,this.height=(l=this.customSizeHeight)!==null&&l!==void 0?l:h,this.radius=.5*this.width}}},{key:"_drawShape",value:function(n,a,o,s,u,l,h,c){var d=this;return this.resize(n,l,h,c),this.left=s-this.width/2,this.top=u-this.height/2,this.initContextForDraw(n,c),IK(a)(n,s,u,c.size),this.performFill(n,c),this.options.icon!==void 0&&this.options.icon.code!==void 0&&(n.font=(l?"bold ":"")+this.height/2+"px "+(this.options.icon.face||"FontAwesome"),n.fillStyle=this.options.icon.color||"black",n.textAlign="center",n.textBaseline="middle",n.fillText(this.options.icon.code,s,u)),{drawExternalLabel:function(){if(d.options.label!==void 0){d.labelModule.calculateLabelSize(n,l,h,s,u,"hanging");var v=u+.5*d.height+.5*d.labelModule.size.height;d.labelModule.draw(n,s,v,l,h,"hanging")}d.updateBoundingBox(s,u)}}}},{key:"updateBoundingBox",value:function(n,a){this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}]),e}(vn);function Q1(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function Ghe(i){for(var r=1;r"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Xhe=function(i){ue(e,i);var r=qhe(e);function e(t,n,a,o){var s;return N(this,e),s=r.call(this,t,n,a,o),s.ctxRenderer=o,s}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u,l),this.left=a-this.width/2,this.top=o-this.height/2,n.save();var h=this.ctxRenderer({ctx:n,id:this.options.id,x:a,y:o,state:{selected:s,hover:u},style:Ghe({},l),label:this.options.label});if(h.drawNode!=null&&h.drawNode(),n.restore(),h.drawExternalLabel){var c=h.drawExternalLabel;h.drawExternalLabel=function(){n.save(),c(),n.restore()}}return h.nodeDimensions&&(this.customSizeWidth=h.nodeDimensions.width,this.customSizeHeight=h.nodeDimensions.height),h}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function Jhe(i){var r=Zhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Zhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Qhe=function(i){ue(e,i);var r=Jhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o),u=s.width+this.margin.right+this.margin.left;this.width=u,this.height=u,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.initContextForDraw(n,l),YE(n,a-this.width/2,o-this.height/2,this.width,this.height),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function ece(i){var r=tce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function tce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var rce=function(i){ue(e,i);var r=ece(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"diamond",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function ice(i){var r=nce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function nce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var ace=function(i){ue(e,i);var r=ice(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"circle",2,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.options.size}}]),e}(Si);function oce(i){var r=sce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function sce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var e$=function(i){ue(e,i);var r=oce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o);this.height=s.height*2,this.width=s.width+s.height,this.radius=.5*this.width}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width*.5,this.top=o-this.height*.5,this.initContextForDraw(n,l),sf(n,this.left,this.top,this.width,this.height),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,a,o,s,u)}},{key:"distanceToBorder",value:function(n,a){n&&this.resize(n);var o=this.width*.5,s=this.height*.5,u=Math.sin(a)*o,l=Math.cos(a)*s;return o*s/Math.sqrt(u*u+l*l)}}]),e}(vn);function uce(i){var r=lce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function lce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var hce=function(i){ue(e,i);var r=uce(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){this.needsRefresh(a,o)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(n,a,o,s,u,l){var h=this;return this.resize(n,s,u),this.options.icon.size=this.options.icon.size||50,this.left=a-this.width/2,this.top=o-this.height/2,this._icon(n,a,o,s,u,l),{drawExternalLabel:function(){if(h.options.label!==void 0){var d=5;h.labelModule.draw(n,h.left+h.iconSize.width/2+h.margin.left,o+h.height/2+d,s)}h.updateBoundingBox(a,o)}}}},{key:"updateBoundingBox",value:function(n,a){if(this.boundingBox.top=a-this.options.icon.size*.5,this.boundingBox.left=n-this.options.icon.size*.5,this.boundingBox.right=n+this.options.icon.size*.5,this.boundingBox.bottom=a+this.options.icon.size*.5,this.options.label!==void 0&&this.labelModule.size.width>0){var o=5;this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+o)}}},{key:"_icon",value:function(n,a,o,s,u,l){var h=Number(this.options.icon.size);this.options.icon.code!==void 0?(n.font=[this.options.icon.weight!=null?this.options.icon.weight:s?"bold":"",(this.options.icon.weight!=null&&s?5:0)+h+"px",this.options.icon.face].join(" "),n.fillStyle=this.options.icon.color||"black",n.textAlign="center",n.textBaseline="middle",this.enableShadow(n,l),n.fillText(this.options.icon.code,a,o),this.disableShadow(n,l)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function cce(i){var r=dce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function dce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var fce=function(i){ue(e,i);var r=cce(e);function e(t,n,a,o,s){var u;return N(this,e),u=r.call(this,t,n,a),u.setImages(o,s),u}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0;if(s){var u=this.options.size*2;this.width=u,this.height=u;return}this.needsRefresh(a,o)&&this._resizeImage()}},{key:"draw",value:function(n,a,o,s,u,l){n.save(),this.switchImages(s),this.resize();var h=a,c=o;if(this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=a,this.top=o,h+=this.width/2,c+=this.height/2):(this.left=a-this.width/2,this.top=o-this.height/2),this.options.shapeProperties.useBorderWithImage===!0){var d=this.options.borderWidth,f=this.options.borderWidthSelected||2*this.options.borderWidth,v=(s?f:d)/this.body.view.scale;n.lineWidth=Math.min(this.width,v),n.beginPath();var p=s?this.options.color.highlight.border:u?this.options.color.hover.border:this.options.color.border,g=s?this.options.color.highlight.background:u?this.options.color.hover.background:this.options.color.background;l.opacity!==void 0&&(p=Kt(p,l.opacity),g=Kt(g,l.opacity)),n.strokeStyle=p,n.fillStyle=g,n.rect(this.left-.5*n.lineWidth,this.top-.5*n.lineWidth,this.width+n.lineWidth,this.height+n.lineWidth),hs(n).call(n),this.performStroke(n,l),n.closePath()}this._drawImageAtPosition(n,l),this._drawImageLabel(n,h,c,s,u),this.updateBoundingBox(a,o),n.restore()}},{key:"updateBoundingBox",value:function(n,a){this.resize(),this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=n,this.top=a):(this.left=n-this.width/2,this.top=a-this.height/2),this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(pp);function vce(i){var r=pce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function pce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var gce=function(i){ue(e,i);var r=vce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"square",2,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function yce(i){var r=mce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function mce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var bce=function(i){ue(e,i);var r=yce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"hexagon",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function $ce(i){var r=wce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function wce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var _ce=function(i){ue(e,i);var r=$ce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"star",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function Ece(i){var r=Sce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Sce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Oce=function(i){ue(e,i);var r=Ece(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){this.needsRefresh(a,o)&&(this.textSize=this.labelModule.getTextSize(n,a,o),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.enableShadow(n,l),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u),this.disableShadow(n,l),this.updateBoundingBox(a,o,n,s,u)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function Tce(i){var r=Ice();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Ice(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var kce=function(i){ue(e,i);var r=Tce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"triangle",3,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function Pce(i){var r=xce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function xce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Cce=function(i){ue(e,i);var r=Pce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"triangleDown",3,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function t$(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function r$(i){for(var r=1;re.left&&this.shape.tope.top}},{key:"isBoundingBoxOverlappingWith",value:function(e){return this.shape.boundingBox.lefte.left&&this.shape.boundingBox.tope.top}}],[{key:"checkOpacity",value:function(e){return 0<=e&&e<=1}},{key:"checkCoordinateOrigin",value:function(e){return e===void 0||e==="center"||e==="top-left"}},{key:"updateGroupOptions",value:function(e,t,n){var a;if(n!==void 0){var o=e.group;if(t!==void 0&&t.group!==void 0&&o!==t.group)throw new Error("updateGroupOptions: group values in options don't match.");var s=typeof o=="number"||typeof o=="string"&&o!="";if(s){var u=n.get(o);u.opacity!==void 0&&t.opacity===void 0&&(i.checkOpacity(u.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+u.opacity),u.opacity=void 0));var l=Tt(a=Ple(t)).call(a,function(h){return t[h]!=null});l.push("font"),Yu(l,e,u),e.color=If(e.color)}}}},{key:"parseOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=arguments.length>4?arguments[4]:void 0,s=["color","fixed","shadow"];if(Yu(s,e,t,n),i.checkMass(t),e.opacity!==void 0&&(i.checkOpacity(e.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity),e.opacity=void 0)),t.opacity!==void 0&&(i.checkOpacity(t.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+t.opacity),t.opacity=void 0)),t.shapeProperties&&!i.checkCoordinateOrigin(t.shapeProperties.coordinateOrigin)&&console.error("Invalid option for node coordinateOrigin, found: "+t.shapeProperties.coordinateOrigin),Ut(e,t,"shadow",a),t.color!==void 0&&t.color!==null){var u=If(t.color);JO(e.color,u)}else n===!0&&t.color===null&&(e.color=di(a.color));t.fixed!==void 0&&t.fixed!==null&&(typeof t.fixed=="boolean"?(e.fixed.x=t.fixed,e.fixed.y=t.fixed):(t.fixed.x!==void 0&&typeof t.fixed.x=="boolean"&&(e.fixed.x=t.fixed.x),t.fixed.y!==void 0&&typeof t.fixed.y=="boolean"&&(e.fixed.y=t.fixed.y))),n===!0&&t.font===null&&(e.font=di(a.font)),i.updateGroupOptions(e,t,o),t.scaling!==void 0&&Ut(e.scaling,t.scaling,"label",a.scaling)}},{key:"checkMass",value:function(e,t){if(e.mass!==void 0&&e.mass<=0){var n="";t!==void 0&&(n=" in node id: "+t),console.error("%cNegative or zero mass disallowed"+n+", setting mass to 1.",tT),e.mass=1}}}]),i}();function Ace(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=Dce(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Dce(i,r){var e;if(i){if(typeof i=="string")return i$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i$(i,r)}}function i$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity):this.options.opacity=e.opacity),e.shape!==void 0)for(var t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].updateShape();if(typeof e.font<"u"||typeof e.widthConstraint<"u"||typeof e.heightConstraint<"u")for(var n=0,a=Oe(this.body.nodes);n1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.data.nodes;if(IE("id",e))this.body.data.nodes=e;else if(he(e))this.body.data.nodes=new Lu,this.body.data.nodes.add(e);else if(!e)this.body.data.nodes=new Lu;else throw new TypeError("Array or DataSet expected");if(n&&te(this.nodesListeners,function(s,u){n.off(u,s)}),this.body.nodes={},this.body.data.nodes){var a=this;te(this.nodesListeners,function(s,u){a.body.data.nodes.on(u,s)});var o=this.body.data.nodes.getIds();this.add(o,!0)}t===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n,a=[],o=0;o1&&arguments[1]!==void 0?arguments[1]:Nt;return new t(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}},{key:"refresh",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;te(this.body.nodes,function(n,a){var o=e.body.data.nodes.get(a);o!==void 0&&(t===!0&&n.setOptions({x:null,y:null}),n.setOptions({fixed:!1}),n.setOptions(o))})}},{key:"getPositions",value:function(e){var t={};if(e!==void 0){if(he(e)===!0){for(var n=0;n0?(u=s/o,t+=u*u):t+=s;return o===1/0?1/0:o*sde(t)}});var lde=oe,hde=lde.Math.hypot,cde=hde,dde=cde,fde=dde,vde=V(fde);function AT(i){var r=pde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function pde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Ne=function(){function i(){N(this,i)}return M(i,null,[{key:"transform",value:function(e,t){he(e)||(e=[e]);for(var n=t.point.x,a=t.point.y,o=t.angle,s=t.length,u=0;u4&&arguments[4]!==void 0?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,t),e.lineWidth=t.width,t.dashes!==!1?this._drawDashedLine(e,t,o):this._drawLine(e,t,o)}},{key:"_drawLine",value:function(e,t,n,a,o){if(this.from!=this.to)this._line(e,t,n,a,o);else{var s=this._getCircleData(e),u=Te(s,3),l=u[0],h=u[1],c=u[2];this._circle(e,t,l,h,c)}}},{key:"_drawDashedLine",value:function(e,t,n,a,o){e.lineCap="round";var s=he(t.dashes)?t.dashes:[5,5];if(e.setLineDash!==void 0){if(e.save(),e.setLineDash(s),e.lineDashOffset=0,this.from!=this.to)this._line(e,t,n);else{var u=this._getCircleData(e),l=Te(u,3),h=l[0],c=l[1],d=l[2];this._circle(e,t,h,c,d)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)XE(e,this.from.x,this.from.y,this.to.x,this.to.y,s);else{var f=this._getCircleData(e),v=Te(f,3),p=v[0],g=v[1],y=v[2];this._circle(e,t,p,g,y)}this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}}},{key:"findBorderPosition",value:function(e,t,n){return this.from!=this.to?this._findBorderPosition(e,t,n):this._findBorderPositionCircle(e,t,n)}},{key:"findBorderPositions",value:function(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};var t,n=it(t=this._getCircleData(e)).call(t,0,2),a=Te(n,2),o=a[0],s=a[1];return{from:this._findBorderPositionCircle(this.from,e,{x:o,y:s,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:o,y:s,low:.6,high:.8,direction:1})}}},{key:"_getCircleData",value:function(e){var t=this.options.selfReference.size;e!==void 0&&this.from.shape.width===void 0&&this.from.shape.resize(e);var n=OT(e,this.options.selfReference.angle,t,this.from);return[n.x,n.y,t]}},{key:"_pointOnCircle",value:function(e,t,n,a){var o=a*2*Math.PI;return{x:e+n*Math.cos(o),y:t-n*Math.sin(o)}}},{key:"_findBorderPositionCircle",value:function(e,t,n){var a=n.x,o=n.y,s=n.low,u=n.high,l=n.direction,h=10,c=this.options.selfReference.size,d=.05,f,v=(s+u)*.5,p=0;this.options.arrowStrikethrough===!0&&(l===-1?p=this.options.endPointOffset.from:l===1&&(p=this.options.endPointOffset.to));var g=0;do{v=(s+u)*.5,f=this._pointOnCircle(a,o,c,v);var y=Math.atan2(e.y-f.y,e.x-f.x),m=e.distanceToBorder(t,y)+p,$=Math.sqrt(Math.pow(f.x-e.x,2)+Math.pow(f.y-e.y,2)),b=m-$;if(Math.abs(b)0?l>0?s=v:u=v:l>0?u=v:s=v,++g}while(s<=u&&g1?c=1:c<0&&(c=0);var d=e+c*u,f=t+c*l,v=d-o,p=f-s;return Math.sqrt(v*v+p*p)}},{key:"getArrowData",value:function(e,t,n,a,o,s){var u,l,h,c,d,f,v,p=s.width;t==="from"?(h=this.from,c=this.to,d=s.fromArrowScale<0,f=Math.abs(s.fromArrowScale),v=s.fromArrowType):t==="to"?(h=this.to,c=this.from,d=s.toArrowScale<0,f=Math.abs(s.toArrowScale),v=s.toArrowType):(h=this.to,c=this.from,d=s.middleArrowScale<0,f=Math.abs(s.middleArrowScale),v=s.middleArrowType);var g=15*f+3*p;if(h!=c){var y=vde(h.x-c.x,h.y-c.y),m=g/y;if(t!=="middle")if(this.options.smooth.enabled===!0){var $=this._findBorderPosition(h,e,{via:n}),b=this.getPoint($.t+m*(t==="from"?1:-1),n);u=Math.atan2($.y-b.y,$.x-b.x),l=$}else u=Math.atan2(h.y-c.y,h.x-c.x),l=this._findBorderPosition(h,e);else{var O=(d?-m:m)/2,_=this.getPoint(.5+O,n),D=this.getPoint(.5-O,n);u=Math.atan2(_.y-D.y,_.x-D.x),l=this.getPoint(.5,n)}}else{var R=this._getCircleData(e),P=Te(R,3),B=P[0],j=P[1],J=P[2];if(t==="from"){var U=this.options.selfReference.angle,ie=this.options.selfReference.angle+Math.PI,_e=this._findBorderPositionCircle(this.from,e,{x:B,y:j,low:U,high:ie,direction:-1});u=_e.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI,l=_e}else if(t==="to"){var ye=this.options.selfReference.angle,Ae=this.options.selfReference.angle+Math.PI,ht=this._findBorderPositionCircle(this.from,e,{x:B,y:j,low:ye,high:Ae,direction:1});u=ht.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI,l=ht}else{var at=this.options.selfReference.angle/(2*Math.PI);l=this._pointOnCircle(B,j,J,at),u=at*-2*Math.PI+1.5*Math.PI+.1*Math.PI}}var Dt=l.x-g*.9*Math.cos(u),ot=l.y-g*.9*Math.sin(u),me={x:Dt,y:ot};return{point:l,core:me,angle:u,length:g,type:v}}},{key:"drawArrowHead",value:function(e,t,n,a,o){e.strokeStyle=this.getColor(e,t),e.fillStyle=e.strokeStyle,e.lineWidth=t.width;var s=DT.draw(e,o);s&&(this.enableShadow(e,t),hs(e).call(e),this.disableShadow(e,t))}},{key:"enableShadow",value:function(e,t){t.shadow===!0&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}},{key:"disableShadow",value:function(e,t){t.shadow===!0&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}},{key:"drawBackground",value:function(e,t){if(t.background!==!1){var n={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),e.strokeStyle=n.strokeStyle,e.lineWidth=n.lineWidth,e.dashes=n.dashes,this.setStrokeDashed(e,t.dashes)}}},{key:"setStrokeDashed",value:function(e,t){if(t!==!1)if(e.setLineDash!==void 0){var n=he(t)?t:[5,5];e.setLineDash(n)}else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");else e.setLineDash!==void 0?e.setLineDash([]):console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.")}}]),i}();function l$(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function h$(i){for(var r=1;r"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var gp=function(i){ue(e,i);var r=kde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_findBorderPositionBezier",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this._getViaCoordinates(),s=10,u=.2,l=!1,h=1,c=0,d=this.to,f,v,p=this.options.endPointOffset?this.options.endPointOffset.to:0;n.id===this.from.id&&(d=this.from,l=!0,p=this.options.endPointOffset?this.options.endPointOffset.from:0),this.options.arrowStrikethrough===!1&&(p=0);var g=0;do{v=(c+h)*.5,f=this.getPoint(v,o);var y=Math.atan2(d.y-f.y,d.x-f.x),m=d.distanceToBorder(a,y)+p,$=Math.sqrt(Math.pow(f.x-d.x,2)+Math.pow(f.y-d.y,2)),b=m-$;if(Math.abs(b)0&&(d=this._getDistanceToLine(y,m,p,g,u,l),c=d"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var c$=function(i){ue(e,i);var r=xde(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o.via=o.via,o._boundFunction=function(){o.positionBezierNode()},o._body.emitter.on("_repositionBezierNodes",o._boundFunction),o}return M(e,[{key:"setOptions",value:function(n){_u(L(e.prototype),"setOptions",this).call(this,n);var a=!1;this.options.physics!==n.physics&&(a=!0),this.options=n,this.id=this.options.id,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.setupSupportNode(),this.connect(),a===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}},{key:"connect",value:function(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.from===void 0||this.to===void 0||this.options.physics===!1?this.via.setOptions({physics:!1}):this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}},{key:"cleanup",value:function(){return this._body.emitter.off("_repositionBezierNodes",this._boundFunction),this.via!==void 0?(delete this._body.nodes[this.via.id],this.via=void 0,!0):!1}},{key:"setupSupportNode",value:function(){if(this.via===void 0){var n="edgeId:"+this.id,a=this._body.functions.createNode({id:n,shape:"circle",physics:!0,hidden:!0});this._body.nodes[n]=a,this.via=a,this.via.parentEdgeId=this.id,this.positionBezierNode()}}},{key:"positionBezierNode",value:function(){this.via!==void 0&&this.from!==void 0&&this.to!==void 0?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):this.via!==void 0&&(this.via.x=0,this.via.y=0)}},{key:"_line",value:function(n,a,o){this._bezierCurve(n,a,o)}},{key:"_getViaCoordinates",value:function(){return this.via}},{key:"getViaNode",value:function(){return this.via}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.via;if(this.from===this.to){var o=this._getCircleData(),s=Te(o,3),u=s[0],l=s[1],h=s[2],c=2*Math.PI*(1-n);return{x:u+h*Math.sin(c),y:l+h-h*(1-Math.cos(c))}}else return{x:Math.pow(1-n,2)*this.fromPoint.x+2*n*(1-n)*a.x+Math.pow(n,2)*this.toPoint.x,y:Math.pow(1-n,2)*this.fromPoint.y+2*n*(1-n)*a.y+Math.pow(n,2)*this.toPoint.y}}},{key:"_findBorderPosition",value:function(n,a){return this._findBorderPositionBezier(n,a,this.via)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){return this._getDistanceToBezierEdge(n,a,o,s,u,l,this.via)}}]),e}(gp);function Ade(i){var r=Dde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Dde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var d$=function(i){ue(e,i);var r=Ade(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a,o){this._bezierCurve(n,a,o)}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_getViaCoordinates",value:function(){var n=this.options.smooth.roundness,a=this.options.smooth.type,o=Math.abs(this.from.x-this.to.x),s=Math.abs(this.from.y-this.to.y);if(a==="discrete"||a==="diagonalCross"){var u,l;o<=s?u=l=n*s:u=l=n*o,this.from.x>this.to.x&&(u=-u),this.from.y>=this.to.y&&(l=-l);var h=this.from.x+u,c=this.from.y+l;return a==="discrete"&&(o<=s?h=othis.to.x&&(R=-R),this.from.y>=this.to.y&&(P=-P);var B=this.from.x+R,j=this.from.y+P;return o<=s?this.from.x<=this.to.x?B=this.to.xB?this.to.x:B:this.from.y>=this.to.y?j=this.to.y>j?this.to.y:j:j=this.to.y2&&arguments[2]!==void 0?arguments[2]:{};return this._findBorderPositionBezier(n,a,o.via)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){var h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(n,a,o,s,u,l,h)}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),o=n,s=Math.pow(1-o,2)*this.fromPoint.x+2*o*(1-o)*a.x+Math.pow(o,2)*this.toPoint.x,u=Math.pow(1-o,2)*this.fromPoint.y+2*o*(1-o)*a.y+Math.pow(o,2)*this.toPoint.y;return{x:s,y:u}}}]),e}(gp);function Rde(i){var r=Nde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Nde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Mde=function(i){ue(e,i);var r=Rde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_getDistanceToBezierEdge2",value:function(n,a,o,s,u,l,h,c){for(var d=1e9,f=n,v=a,p=[0,0,0,0],g=1;g<10;g++){var y=.1*g;p[0]=Math.pow(1-y,3),p[1]=3*y*Math.pow(1-y,2),p[2]=3*Math.pow(y,2)*(1-y),p[3]=Math.pow(y,3);var m=p[0]*n+p[1]*h.x+p[2]*c.x+p[3]*o,$=p[0]*a+p[1]*h.y+p[2]*c.y+p[3]*s;if(g>0){var b=this._getDistanceToLine(f,v,m,$,u,l);d=b"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var f$=function(i){ue(e,i);var r=Bde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a,o){var s=o[0],u=o[1];this._bezierCurve(n,a,s,u)}},{key:"_getViaCoordinates",value:function(){var n=this.from.x-this.to.x,a=this.from.y-this.to.y,o,s,u,l,h=this.options.smooth.roundness;return(Math.abs(n)>Math.abs(a)||this.options.smooth.forceDirection===!0||this.options.smooth.forceDirection==="horizontal")&&this.options.smooth.forceDirection!=="vertical"?(s=this.from.y,l=this.to.y,o=this.from.x-h*n,u=this.to.x+h*n):(s=this.from.y-h*a,l=this.to.y+h*a,o=this.from.x,u=this.to.x),[{x:o,y:s},{x:u,y:l}]}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_findBorderPosition",value:function(n,a){return this._findBorderPositionBezier(n,a)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){var h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates(),c=Te(h,2),d=c[0],f=c[1];return this._getDistanceToBezierEdge2(n,a,o,s,u,l,d,f)}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),o=Te(a,2),s=o[0],u=o[1],l=n,h=[Math.pow(1-l,3),3*l*Math.pow(1-l,2),3*Math.pow(l,2)*(1-l),Math.pow(l,3)],c=h[0]*this.fromPoint.x+h[1]*s.x+h[2]*u.x+h[3]*this.toPoint.x,d=h[0]*this.fromPoint.y+h[1]*s.y+h[2]*u.y+h[3]*this.toPoint.y;return{x:c,y:d}}}]),e}(Mde);function jde(i){var r=Lde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Lde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var v$=function(i){ue(e,i);var r=jde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a){n.beginPath(),n.moveTo(this.fromPoint.x,this.fromPoint.y),n.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(n,a),n.stroke(),this.disableShadow(n,a)}},{key:"getViaNode",value:function(){}},{key:"getPoint",value:function(n){return{x:(1-n)*this.fromPoint.x+n*this.toPoint.x,y:(1-n)*this.fromPoint.y+n*this.toPoint.y}}},{key:"_findBorderPosition",value:function(n,a){var o=this.to,s=this.from;n.id===this.from.id&&(o=this.from,s=this.to);var u=Math.atan2(o.y-s.y,o.x-s.x),l=o.x-s.x,h=o.y-s.y,c=Math.sqrt(l*l+h*h),d=n.distanceToBorder(a,u),f=(c-d)/c;return{x:(1-f)*s.x+f*o.x,y:(1-f)*s.y+f*o.y,t:0}}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){return this._getDistanceToLine(n,a,o,s,u,l)}}]),e}(RT),qn=function(){function i(r,e,t,n,a){if(N(this,i),e===void 0)throw new Error("No body provided");this.options=di(n),this.globalOptions=n,this.defaultOptions=a,this.body=e,this.imagelist=t,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new IT(this.body,this.options,!0),this.setOptions(r)}return M(i,[{key:"setOptions",value:function(e){if(e){var t=typeof e.physics<"u"&&this.options.physics!==e.physics||typeof e.hidden<"u"&&(this.options.hidden||!1)!==(e.hidden||!1)||typeof e.from<"u"&&this.options.from!==e.from||typeof e.to<"u"&&this.options.to!==e.to;i.parseOptions(this.options,e,!0,this.globalOptions),e.id!==void 0&&(this.id=e.id),e.from!==void 0&&(this.fromId=e.from),e.to!==void 0&&(this.toId=e.to),e.title!==void 0&&(this.title=e.title),e.value!==void 0&&(e.value=ST(e.value));var n=[e,this.options,this.defaultOptions];return this.chooser=dp("edge",n),this.updateLabelModule(e),t=this.updateEdgeType()||t,this._setInteractionWidths(),this.connect(),t}}},{key:"getFormattingValues",value:function(){var e=this.options.arrows.to===!0||this.options.arrows.to.enabled===!0,t=this.options.arrows.from===!0||this.options.arrows.from.enabled===!0,n=this.options.arrows.middle===!0||this.options.arrows.middle.enabled===!0,a=this.options.color.inherit,o={toArrow:e,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,toArrowSrc:this.options.arrows.to.src,toArrowImageWidth:this.options.arrows.to.imageWidth,toArrowImageHeight:this.options.arrows.to.imageHeight,middleArrow:n,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,middleArrowSrc:this.options.arrows.middle.src,middleArrowImageWidth:this.options.arrows.middle.imageWidth,middleArrowImageHeight:this.options.arrows.middle.imageHeight,fromArrow:t,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,fromArrowSrc:this.options.arrows.from.src,fromArrowImageWidth:this.options.arrows.from.imageWidth,fromArrowImageHeight:this.options.arrows.from.imageHeight,arrowStrikethrough:this.options.arrowStrikethrough,color:a?void 0:this.options.color.color,inheritsColor:a,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width,background:this.options.background.enabled,backgroundColor:this.options.background.color,backgroundSize:this.options.background.size,backgroundDashes:this.options.background.dashes};if(this.selected||this.hover)if(this.chooser===!0){if(this.selected){var s=this.options.selectionWidth;typeof s=="function"?o.width=s(o.width):typeof s=="number"&&(o.width+=s),o.width=Math.max(o.width,.3/this.body.view.scale),o.color=this.options.color.highlight,o.shadow=this.options.shadow.enabled}else if(this.hover){var u=this.options.hoverWidth;typeof u=="function"?o.width=u(o.width):typeof u=="number"&&(o.width+=u),o.width=Math.max(o.width,.3/this.body.view.scale),o.color=this.options.color.hover,o.shadow=this.options.shadow.enabled}}else typeof this.chooser=="function"&&(this.chooser(o,this.options.id,this.selected,this.hover),o.color!==void 0&&(o.inheritsColor=!1),o.shadow===!1&&(o.shadowColor!==this.options.shadow.color||o.shadowSize!==this.options.shadow.size||o.shadowX!==this.options.shadow.x||o.shadowY!==this.options.shadow.y)&&(o.shadow=!0));else o.shadow=this.options.shadow.enabled,o.width=Math.max(o.width,.3/this.body.view.scale);return o}},{key:"updateLabelModule",value:function(e){var t=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,t),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}},{key:"updateEdgeType",value:function(){var e=this.options.smooth,t=!1,n=!0;return this.edgeType!==void 0&&((this.edgeType instanceof c$&&e.enabled===!0&&e.type==="dynamic"||this.edgeType instanceof f$&&e.enabled===!0&&e.type==="cubicBezier"||this.edgeType instanceof d$&&e.enabled===!0&&e.type!=="dynamic"&&e.type!=="cubicBezier"||this.edgeType instanceof v$&&e.type.enabled===!1)&&(n=!1),n===!0&&(t=this.cleanup())),n===!0?e.enabled===!0?e.type==="dynamic"?(t=!0,this.edgeType=new c$(this.options,this.body,this.labelModule)):e.type==="cubicBezier"?this.edgeType=new f$(this.options,this.body,this.labelModule):this.edgeType=new d$(this.options,this.body,this.labelModule):this.edgeType=new v$(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),t}},{key:"connect",value:function(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=this.from!==void 0&&this.to!==void 0,this.connected===!0?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}},{key:"disconnect",value:function(){this.from&&(this.from.detachEdge(this),this.from=void 0),this.to&&(this.to.detachEdge(this),this.to=void 0),this.connected=!1}},{key:"getTitle",value:function(){return this.title}},{key:"isSelected",value:function(){return this.selected}},{key:"getValue",value:function(){return this.options.value}},{key:"setValueRange",value:function(e,t,n){if(this.options.value!==void 0){var a=this.options.scaling.customScalingFunction(e,t,n,this.options.value),o=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){var s=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+a*s}this.options.width=this.options.scaling.min+a*o}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}},{key:"_setInteractionWidths",value:function(){typeof this.options.hoverWidth=="function"?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,typeof this.options.selectionWidth=="function"?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}},{key:"draw",value:function(e){var t=this.getFormattingValues();if(!t.hidden){var n=this.edgeType.getViaNode();this.edgeType.drawLine(e,t,this.selected,this.hover,n),this.drawLabel(e,n)}}},{key:"drawArrows",value:function(e){var t=this.getFormattingValues();if(!t.hidden){var n=this.edgeType.getViaNode(),a={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,t.fromArrow&&(a.from=this.edgeType.getArrowData(e,"from",n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.fromPoint=a.from.core),t.fromArrowSrc&&(a.from.image=this.imagelist.load(t.fromArrowSrc)),t.fromArrowImageWidth&&(a.from.imageWidth=t.fromArrowImageWidth),t.fromArrowImageHeight&&(a.from.imageHeight=t.fromArrowImageHeight)),t.toArrow&&(a.to=this.edgeType.getArrowData(e,"to",n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.toPoint=a.to.core),t.toArrowSrc&&(a.to.image=this.imagelist.load(t.toArrowSrc)),t.toArrowImageWidth&&(a.to.imageWidth=t.toArrowImageWidth),t.toArrowImageHeight&&(a.to.imageHeight=t.toArrowImageHeight)),t.middleArrow&&(a.middle=this.edgeType.getArrowData(e,"middle",n,this.selected,this.hover,t),t.middleArrowSrc&&(a.middle.image=this.imagelist.load(t.middleArrowSrc)),t.middleArrowImageWidth&&(a.middle.imageWidth=t.middleArrowImageWidth),t.middleArrowImageHeight&&(a.middle.imageHeight=t.middleArrowImageHeight)),t.fromArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.from),t.middleArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.middle),t.toArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.to)}}},{key:"drawLabel",value:function(e,t){if(this.options.label!==void 0){var n=this.from,a=this.to;this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover);var o;if(n.id!=a.id){this.labelModule.pointToSelf=!1,o=this.edgeType.getPoint(.5,t),e.save();var s=this._getRotation(e);s.angle!=0&&(e.translate(s.x,s.y),e.rotate(s.angle)),this.labelModule.draw(e,o.x,o.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;var u=OT(e,this.options.selfReference.angle,this.options.selfReference.size,n);o=this._pointOnCircle(u.x,u.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(e,o.x,o.y,this.selected,this.hover)}}}},{key:"getItemsOnPoint",value:function(e){var t=[];if(this.labelModule.visible()){var n=this._getRotation();Af(this.labelModule.getSize(),e,n)&&t.push({edgeId:this.id,labelId:0})}var a={left:e.x,top:e.y};return this.isOverlappingWith(a)&&t.push({edgeId:this.id}),t}},{key:"isOverlappingWith",value:function(e){if(this.connected){var t=10,n=this.from.x,a=this.from.y,o=this.to.x,s=this.to.y,u=e.left,l=e.top,h=this.edgeType.getDistanceToEdge(n,a,o,s,u,l);return h0&&s<0)&&(u+=Math.PI),a.angle=u,a}},{key:"_pointOnCircle",value:function(e,t,n,a){return{x:e+n*Math.cos(a),y:t-n*Math.sin(a)}}},{key:"select",value:function(){this.selected=!0}},{key:"unselect",value:function(){this.selected=!1}},{key:"cleanup",value:function(){return this.edgeType.cleanup()}},{key:"remove",value:function(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}},{key:"endPointsValid",value:function(){return this.body.nodes[this.fromId]!==void 0&&this.body.nodes[this.toId]!==void 0}}],[{key:"parseOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,s=["endPointOffset","arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","selfReference","to","title","value","width","font","chosen","widthConstraint"];if(Ma(s,e,t,n),t.endPointOffset!==void 0&&t.endPointOffset.from!==void 0&&(Di(t.endPointOffset.from)?e.endPointOffset.from=t.endPointOffset.from:(e.endPointOffset.from=a.endPointOffset.from!==void 0?a.endPointOffset.from:0,console.error("endPointOffset.from is not a valid number"))),t.endPointOffset!==void 0&&t.endPointOffset.to!==void 0&&(Di(t.endPointOffset.to)?e.endPointOffset.to=t.endPointOffset.to:(e.endPointOffset.to=a.endPointOffset.to!==void 0?a.endPointOffset.to:0,console.error("endPointOffset.to is not a valid number"))),Zu(t.label)?e.label=t.label:Zu(e.label)||(e.label=void 0),Ut(e,t,"smooth",a),Ut(e,t,"shadow",a),Ut(e,t,"background",a),t.dashes!==void 0&&t.dashes!==null?e.dashes=t.dashes:n===!0&&t.dashes===null&&(e.dashes=zi(a.dashes)),t.scaling!==void 0&&t.scaling!==null?(t.scaling.min!==void 0&&(e.scaling.min=t.scaling.min),t.scaling.max!==void 0&&(e.scaling.max=t.scaling.max),Ut(e.scaling,t.scaling,"label",a.scaling)):n===!0&&t.scaling===null&&(e.scaling=zi(a.scaling)),t.arrows!==void 0&&t.arrows!==null)if(typeof t.arrows=="string"){var u=t.arrows.toLowerCase();e.arrows.to.enabled=ne(u).call(u,"to")!=-1,e.arrows.middle.enabled=ne(u).call(u,"middle")!=-1,e.arrows.from.enabled=ne(u).call(u,"from")!=-1}else if(de(t.arrows)==="object")Ut(e.arrows,t.arrows,"to",a.arrows),Ut(e.arrows,t.arrows,"middle",a.arrows),Ut(e.arrows,t.arrows,"from",a.arrows);else throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+ls(t.arrows));else n===!0&&t.arrows===null&&(e.arrows=zi(a.arrows));if(t.color!==void 0&&t.color!==null){var l=Kn(t.color)?{color:t.color,highlight:t.color,hover:t.color,inherit:!1,opacity:1}:t.color,h=e.color;if(o)pe(h,a.color,!1,n);else for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&delete h[c];if(Kn(h))h.color=h,h.highlight=h,h.hover=h,h.inherit=!1,l.opacity===void 0&&(h.opacity=1);else{var d=!1;l.color!==void 0&&(h.color=l.color,d=!0),l.highlight!==void 0&&(h.highlight=l.highlight,d=!0),l.hover!==void 0&&(h.hover=l.hover,d=!0),l.inherit!==void 0&&(h.inherit=l.inherit),l.opacity!==void 0&&(h.opacity=Math.min(1,Math.max(0,l.opacity))),d===!0?h.inherit=!1:h.inherit===void 0&&(h.inherit="from")}}else n===!0&&t.color===null&&(e.color=di(a.color));n===!0&&t.font===null&&(e.font=di(a.font)),Object.prototype.hasOwnProperty.call(t,"selfReferenceSize")&&(console.warn("The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}"),e.selfReference.size=t.selfReferenceSize)}}]),i}(),zde=function(){function i(r,e,t){var n,a=this;N(this,i),this.body=r,this.images=e,this.groups=t,this.body.functions.createEdge=k(n=this.create).call(n,this),this.edgesListeners={add:function(s,u){a.add(u.items)},update:function(s,u){a.update(u.items)},remove:function(s,u){a.remove(u.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},endPointOffset:{from:0,to:0},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(s,u,l,h){if(u===s)return .5;var c=1/(u-s);return Math.max(0,(h-s)*c)}},selectionWidth:1.5,selfReference:{size:20,angle:Math.PI/4,renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},background:{enabled:!1,color:"rgba(111,111,111,1)",size:10,dashes:!1},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},pe(this.options,this.defaultOptions),this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this,t,n;this.body.emitter.on("_forceDisableDynamicCurves",function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a==="dynamic"&&(a="continuous");var s=!1;for(var u in e.body.edges)if(Object.prototype.hasOwnProperty.call(e.body.edges,u)){var l=e.body.edges[u],h=e.body.data.edges.get(u);if(h!=null){var c=h.smooth;c!==void 0&&c.enabled===!0&&c.type==="dynamic"&&(a===void 0?l.setOptions({smooth:!1}):l.setOptions({smooth:{type:a}}),s=!0)}}o===!0&&s===!0&&e.body.emitter.emit("_dataChanged")}),this.body.emitter.on("_dataUpdated",function(){e.reconnectEdges()}),this.body.emitter.on("refreshEdges",k(t=this.refresh).call(t,this)),this.body.emitter.on("refresh",k(n=this.refresh).call(n,this)),this.body.emitter.on("destroy",function(){te(e.edgesListeners,function(a,o){e.body.data.edges&&e.body.data.edges.off(o,a)}),delete e.body.functions.createEdge,delete e.edgesListeners.add,delete e.edgesListeners.update,delete e.edgesListeners.remove,delete e.edgesListeners})}},{key:"setOptions",value:function(e){if(e!==void 0){qn.parseOptions(this.options,e,!0,this.defaultOptions,!0);var t=!1;if(e.smooth!==void 0)for(var n in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,n)&&(t=this.body.edges[n].updateEdgeType()||t);if(e.font!==void 0)for(var a in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,a)&&this.body.edges[a].updateLabelModule();(e.hidden!==void 0||e.physics!==void 0||t===!0)&&this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.body.data.edges;if(IE("id",e))this.body.data.edges=e;else if(he(e))this.body.data.edges=new Lu,this.body.data.edges.add(e);else if(!e)this.body.data.edges=new Lu;else throw new TypeError("Array or DataSet expected");if(a&&te(this.edgesListeners,function(s,u){a.off(u,s)}),this.body.edges={},this.body.data.edges){te(this.edgesListeners,function(s,u){t.body.data.edges.on(u,s)});var o=this.body.data.edges.getIds();this.add(o,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),n===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.edges,a=this.body.data.edges,o=0;o1&&arguments[1]!==void 0?arguments[1]:!0;if(e.length!==0){var n=this.body.edges;te(e,function(a){var o=n[a];o!==void 0&&o.remove()}),t&&this.body.emitter.emit("_dataChanged")}}},{key:"refresh",value:function(){var e=this;te(this.body.edges,function(t,n){var a=e.body.data.edges.get(n);a!==void 0&&t.setOptions(a)})}},{key:"create",value:function(e){return new qn(e,this.body,this.images,this.options,this.defaultOptions)}},{key:"reconnectEdges",value:function(){var e,t=this.body.nodes,n=this.body.edges;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e].edges=[]);for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)){var a=n[e];a.from=null,a.to=null,a.connect()}}},{key:"getConnectedNodes",value:function(e){var t=[];if(this.body.edges[e]!==void 0){var n=this.body.edges[e];n.fromId!==void 0&&t.push(n.fromId),n.toId!==void 0&&t.push(n.toId)}return t}},{key:"_updateState",value:function(){this._addMissingEdges(),this._removeInvalidEdges()}},{key:"_removeInvalidEdges",value:function(){var e=this,t=[];te(this.body.edges,function(n,a){var o=e.body.nodes[n.toId],s=e.body.nodes[n.fromId];o!==void 0&&o.isCluster===!0||s!==void 0&&s.isCluster===!0||(o===void 0||s===void 0)&&t.push(a)}),this.remove(t,!1)}},{key:"_addMissingEdges",value:function(){var e=this.body.data.edges;if(e!=null){var t=this.body.edges,n=[];fe(e).call(e,function(a,o){var s=t[o];s===void 0&&n.push(o)}),this.add(n,!0)}}}]),i}(),NT=function(){function i(r,e,t){N(this,i),this.body=r,this.physicsBody=e,this.barnesHutTree,this.setOptions(t),this._rng=Ql("BARNES HUT SOLVER")}return M(i,[{key:"setOptions",value:function(e){this.options=e,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}},{key:"solve",value:function(){if(this.options.gravitationalConstant!==0&&this.physicsBody.physicsNodeIndices.length>0){var e,t=this.body.nodes,n=this.physicsBody.physicsNodeIndices,a=n.length,o=this._formBarnesHutTree(t,n);this.barnesHutTree=o;for(var s=0;s0&&this._getForceContributions(o.root,e)}}},{key:"_getForceContributions",value:function(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}},{key:"_getForceContribution",value:function(e,t){if(e.childrenCount>0){var n=e.centerOfMass.x-t.x,a=e.centerOfMass.y-t.y,o=Math.sqrt(n*n+a*a);o*e.calcSize>this.thetaInversed?this._calculateForces(o,n,a,t,e):e.childrenCount===4?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(o,n,a,t,e)}}},{key:"_calculateForces",value:function(e,t,n,a,o){e===0&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&a.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*a.shape.radius,e-a.shape.radius));var s=this.options.gravitationalConstant*o.mass*a.options.mass/Math.pow(e,3),u=t*s,l=n*s;this.physicsBody.forces[a.id].x+=u,this.physicsBody.forces[a.id].y+=l}},{key:"_formBarnesHutTree",value:function(e,t){for(var n,a=t.length,o=e[t[0]].x,s=e[t[0]].y,u=e[t[0]].x,l=e[t[0]].y,h=1;h0&&(du&&(u=d),fl&&(l=f))}var v=Math.abs(u-o)-Math.abs(l-s);v>0?(s-=.5*v,l+=.5*v):(o+=.5*v,u-=.5*v);var p=1e-5,g=Math.max(p,Math.abs(u-o)),y=.5*g,m=.5*(o+u),$=.5*(s+l),b={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:m-y,maxX:m+y,minY:$-y,maxY:$+y},size:g,calcSize:1/g,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(b.root);for(var O=0;O0&&this._placeInTree(b.root,n);return b}},{key:"_updateBranchMass",value:function(e,t){var n=e.centerOfMass,a=e.mass+t.options.mass,o=1/a;n.x=n.x*e.mass+t.x*t.options.mass,n.x*=o,n.y=n.y*e.mass+t.y*t.options.mass,n.y*=o,e.mass=a;var s=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidtht.x?a.maxY>t.y?o="NW":o="SW":a.maxY>t.y?o="NE":o="SE",this._placeInRegion(e,t,o)}},{key:"_placeInRegion",value:function(e,t,n){var a=e.children[n];switch(a.childrenCount){case 0:a.children.data=t,a.childrenCount=1,this._updateBranchMass(a,t);break;case 1:a.children.data.x===t.x&&a.children.data.y===t.y?(t.x+=this._rng(),t.y+=this._rng()):(this._splitBranch(a),this._placeInTree(a,t));break;case 4:this._placeInTree(a,t);break}}},{key:"_splitBranch",value:function(e){var t=null;e.childrenCount===1&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),t!=null&&this._placeInTree(e,t)}},{key:"_insertRegion",value:function(e,t){var n,a,o,s,u=.5*e.size;switch(t){case"NW":n=e.range.minX,a=e.range.minX+u,o=e.range.minY,s=e.range.minY+u;break;case"NE":n=e.range.minX+u,a=e.range.maxX,o=e.range.minY,s=e.range.minY+u;break;case"SW":n=e.range.minX,a=e.range.minX+u,o=e.range.minY+u,s=e.range.maxY;break;case"SE":n=e.range.minX+u,a=e.range.maxX,o=e.range.minY+u,s=e.range.maxY;break}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:n,maxX:a,minY:o,maxY:s},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}},{key:"_debug",value:function(e,t){this.barnesHutTree!==void 0&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}},{key:"_drawBranch",value:function(e,t,n){n===void 0&&(n="#FF0000"),e.childrenCount===4&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=n,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}]),i}(),Hde=function(){function i(r,e,t){N(this,i),this._rng=Ql("REPULSION SOLVER"),this.body=r,this.physicsBody=e,this.setOptions(t)}return M(i,[{key:"setOptions",value:function(e){this.options=e}},{key:"solve",value:function(){for(var e,t,n,a,o,s,u,l,h=this.body.nodes,c=this.physicsBody.physicsNodeIndices,d=this.physicsBody.forces,f=this.options.nodeDistance,v=-2/3/f,p=4/3,g=0;g"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Gde=function(i){ue(e,i);var r=Ude(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._rng=Ql("FORCE ATLAS 2 BASED REPULSION SOLVER"),o}return M(e,[{key:"_calculateForces",value:function(n,a,o,s,u){n===0&&(n=.1*this._rng(),a=n),this.overlapAvoidanceFactor<1&&s.shape.radius&&(n=Math.max(.1+this.overlapAvoidanceFactor*s.shape.radius,n-s.shape.radius));var l=s.edges.length+1,h=this.options.gravitationalConstant*u.mass*s.options.mass*l/Math.pow(n,2),c=a*h,d=o*h;this.physicsBody.forces[s.id].x+=c,this.physicsBody.forces[s.id].y+=d}}]),e}(NT);function qde(i){var r=Yde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Yde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Xde=function(i){ue(e,i);var r=qde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_calculateForces",value:function(n,a,o,s,u){if(n>0){var l=u.edges.length+1,h=this.options.centralGravity*l*u.options.mass;s[u.id].x=a*h,s[u.id].y=o*h}}}]),e}(Eu),Jde=function(){function i(r){N(this,i),this.body=r,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},Le(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("initPhysics",function(){e.initPhysics()}),this.body.emitter.on("_layoutFailed",function(){e.layoutFailed=!0}),this.body.emitter.on("resetPhysics",function(){e.stopSimulation(),e.ready=!1}),this.body.emitter.on("disablePhysics",function(){e.physicsEnabled=!1,e.stopSimulation()}),this.body.emitter.on("restorePhysics",function(){e.setOptions(e.options),e.ready===!0&&e.startSimulation()}),this.body.emitter.on("startSimulation",function(){e.ready===!0&&e.startSimulation()}),this.body.emitter.on("stopSimulation",function(){e.stopSimulation()}),this.body.emitter.on("destroy",function(){e.stopSimulation(!1),e.body.emitter.off()}),this.body.emitter.on("_dataChanged",function(){e.updatePhysicsData()})}},{key:"setOptions",value:function(e){if(e!==void 0)if(e===!1)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(e===!0)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,Yu(["stabilization"],this.options,e),Ut(this.options,e,"stabilization"),e.enabled===void 0&&(this.options.enabled=!0),this.options.enabled===!1&&(this.physicsEnabled=!1,this.stopSimulation());var t=this.options.wind;t&&((typeof t.x!="number"||Cf(t.x))&&(t.x=0),(typeof t.y!="number"||Cf(t.y))&&(t.y=0)),this.timestep=this.options.timestep}this.init()}},{key:"init",value:function(){var e;this.options.solver==="forceAtlas2Based"?(e=this.options.forceAtlas2Based,this.nodesSolver=new Gde(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Xde(this.body,this.physicsBody,e)):this.options.solver==="repulsion"?(e=this.options.repulsion,this.nodesSolver=new Hde(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)):this.options.solver==="hierarchicalRepulsion"?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new Vde(this.body,this.physicsBody,e),this.edgesSolver=new Wde(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new NT(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)),this.modelOptions=e}},{key:"initPhysics",value:function(){this.physicsEnabled===!0&&this.options.enabled===!0?this.options.stabilization.enabled===!0?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}},{key:"startSimulation",value:function(){if(this.physicsEnabled===!0&&this.options.enabled===!0){if(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),this.viewFunction===void 0){var e;this.viewFunction=k(e=this.simulationStep).call(e,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}else this.body.emitter.emit("_redraw")}},{key:"stopSimulation",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.stabilized=!0,e===!0&&this._emitStabilized(),this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,e===!0&&this.body.emitter.emit("_stopRendering"))}},{key:"simulationStep",value:function(){var e=Uu();this.physicsTick();var t=Uu()-e;(t<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}},{key:"_emitStabilized",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&mr(function(){e.body.emitter.emit("stabilized",{iterations:t}),e.startedStabilization=!1,e.stabilizationIterations=0},0)}},{key:"physicsStep",value:function(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}},{key:"adjustTimeStep",value:function(){var e=1.2;this._evaluateStepQuality()===!0?this.timestep=e*this.timestep:this.timestep/es))return!1;return!0}},{key:"moveNodes",value:function(){for(var e=this.physicsBody.physicsNodeIndices,t=0,n=0,a=5,o=0;os&&(e=e>0?s:-s),e}},{key:"_performStep",value:function(e){var t=this.body.nodes[e],n=this.physicsBody.forces[e];this.options.wind&&(n.x+=this.options.wind.x,n.y+=this.options.wind.y);var a=this.physicsBody.velocities[e];this.previousStates[e]={x:t.x,y:t.y,vx:a.x,vy:a.y},t.options.fixed.x===!1?(a.x=this.calculateComponentVelocity(a.x,n.x,t.options.mass),t.x+=a.x*this.timestep):(n.x=0,a.x=0),t.options.fixed.y===!1?(a.y=this.calculateComponentVelocity(a.y,n.y,t.options.mass),t.y+=a.y*this.timestep):(n.y=0,a.y=0);var o=Math.sqrt(Math.pow(a.x,2)+Math.pow(a.y,2));return o}},{key:"_freezeNodes",value:function(){var e=this.body.nodes;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].x&&e[t].y){var n=e[t].options.fixed;this.freezeCache[t]={x:n.x,y:n.y},n.x=!0,n.y=!0}}},{key:"_restoreFrozenNodes",value:function(){var e=this.body.nodes;for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.freezeCache[t]!==void 0&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}},{key:"stabilize",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.stabilization.iterations;if(typeof t!="number"&&(t=this.options.stabilization.iterations,console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ",t)),this.physicsBody.physicsNodeIndices.length===0){this.ready=!0;return}this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=t,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,mr(function(){return e._stabilizationBatch()},0)}},{key:"_startStabilizing",value:function(){return this.startedStabilization===!0?!1:(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}},{key:"_stabilizationBatch",value:function(){var e=this,t=function(){return e.stabilized===!1&&e.stabilizationIterations1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,a=-1e9,o=1e9,s=-1e9,u;if(t.length>0)for(var l=0;lu.shape.boundingBox.left&&(o=u.shape.boundingBox.left),su.shape.boundingBox.top&&(n=u.shape.boundingBox.top),a1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,a=-1e9,o=1e9,s=-1e9,u;if(t.length>0)for(var l=0;lu.x&&(o=u.x),su.y&&(n=u.y),a"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var nfe=function(i){ue(e,i);var r=rfe(e);function e(t,n,a,o,s,u){var l;return N(this,e),l=r.call(this,t,n,a,o,s,u),l.isCluster=!0,l.containedNodes={},l.containedEdges={},l}return M(e,[{key:"_openChildCluster",value:function(n){var a=this,o=this.body.nodes[n];if(this.containedNodes[n]===void 0)throw new Error("node with id: "+n+" not in current cluster");if(!o.isCluster)throw new Error("node with id: "+n+" is not a cluster");delete this.containedNodes[n],te(o.edges,function(s){delete a.containedEdges[s.id]}),te(o.containedNodes,function(s,u){a.containedNodes[u]=s}),o.containedNodes={},te(o.containedEdges,function(s,u){a.containedEdges[u]=s}),o.containedEdges={},te(o.edges,function(s){te(a.edges,function(u){var l,h,c=ne(l=u.clusteringEdgeReplacingIds).call(l,s.id);c!==-1&&(te(s.clusteringEdgeReplacingIds,function(d){u.clusteringEdgeReplacingIds.push(d),a.body.edges[d].edgeReplacedById=u.id}),Ar(h=u.clusteringEdgeReplacingIds).call(h,c,1))})}),o.edges=[]}}]),e}(Nt),afe=function(){function i(r){var e=this;N(this,i),this.body=r,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},Le(this.options,this.defaultOptions),this.body.emitter.on("_resetData",function(){e.clusteredNodes={},e.clusteredEdges={}})}return M(i,[{key:"clusterByHubsize",value:function(e,t){e===void 0?e=this._getHubSize():de(e)==="object"&&(t=this._checkOptions(e),e=this._getHubSize());for(var n=[],a=0;a=e&&n.push(o.id)}for(var s=0;s0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.joinCondition===void 0)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");t=this._checkOptions(t);var a={},o={};te(this.body.nodes,function(s,u){s.options&&t.joinCondition(s.options)===!0&&(a[u]=s,te(s.edges,function(l){e.clusteredEdges[l.id]===void 0&&(o[l.id]=l)}))}),this._cluster(a,o,t,n)}},{key:"clusterByEdgeCount",value:function(e,t){var n=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;t=this._checkOptions(t);for(var o=[],s={},u,l,h,c=function(){var p={},g={},y=n.body.nodeIndices[d],m=n.body.nodes[y];if(s[y]===void 0){h=0,l=[];for(var $=0;$0&&Oe(g).length>0&&O===!0){var R=function(){for(var U=0;U1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(1,e,t)}},{key:"clusterBridges",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(2,e,t)}},{key:"clusterByConnection",value:function(e,t){var n,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No nodeId supplied to clusterByConnection!");if(this.body.nodes[e]===void 0)throw new Error("The nodeId given to clusterByConnection does not exist!");var o=this.body.nodes[e];t=this._checkOptions(t,o),t.clusterNodeProperties.x===void 0&&(t.clusterNodeProperties.x=o.x),t.clusterNodeProperties.y===void 0&&(t.clusterNodeProperties.y=o.y),t.clusterNodeProperties.fixed===void 0&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=o.options.fixed.x,t.clusterNodeProperties.fixed.y=o.options.fixed.y);var s={},u={},l=o.id,h=pt.cloneOptions(o);s[l]=o;for(var c=0;c-1&&(u[$.id]=$)}this._cluster(s,u,t,a)}},{key:"_createClusterEdges",value:function(e,t,n,a){for(var o,s,u,l,h,c,d=Oe(e),f=[],v=0;v0&&arguments[0]!==void 0?arguments[0]:{};return e.clusterEdgeProperties===void 0&&(e.clusterEdgeProperties={}),e.clusterNodeProperties===void 0&&(e.clusterNodeProperties={}),e}},{key:"_cluster",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&this.clusteredNodes[s]!==void 0&&o.push(s);for(var u=0;ua?u.x:a,o=u.ys?u.y:s;return{x:.5*(n+a),y:.5*(o+s)}}},{key:"openCluster",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No clusterNodeId supplied to openCluster.");var a=this.body.nodes[e];if(a===void 0)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(a.isCluster!==!0||a.containedNodes===void 0||a.containedEdges===void 0)throw new Error("The node:"+e+" is not a valid cluster.");var o=this.findNode(e),s=ne(o).call(o,e)-1;if(s>=0){var u=o[s],l=this.body.nodes[u];l._openChildCluster(e),delete this.body.nodes[e],n===!0&&this.body.emitter.emit("_dataChanged");return}var h=a.containedNodes,c=a.containedEdges;if(t!==void 0&&t.releaseFunction!==void 0&&typeof t.releaseFunction=="function"){var d={},f={x:a.x,y:a.y};for(var v in h)if(Object.prototype.hasOwnProperty.call(h,v)){var p=this.body.nodes[v];d[v]={x:p.x,y:p.y}}var g=t.releaseFunction(f,d);for(var y in h)if(Object.prototype.hasOwnProperty.call(h,y)){var m=this.body.nodes[y];g[y]!==void 0&&(m.x=g[y].x===void 0?a.x:g[y].x,m.y=g[y].y===void 0?a.y:g[y].y)}}else te(h,function(ht){ht.options.fixed.x===!1&&(ht.x=a.x),ht.options.fixed.y===!1&&(ht.y=a.y)});for(var $ in h)if(Object.prototype.hasOwnProperty.call(h,$)){var b=this.body.nodes[$];b.vx=a.vx,b.vy=a.vy,b.setOptions({physics:!0}),delete this.clusteredNodes[$]}for(var O=[],_=0;_0&&sa&&(a=s.edges.length),e+=s.edges.length,t+=Math.pow(s.edges.length,2),n+=1}e=e/n,t=t/n;var u=t-Math.pow(e,2),l=Math.sqrt(u),h=Math.floor(e+2*l);return h>a&&(h=a),h}},{key:"_createClusteredEdge",value:function(e,t,n,a,o){var s=pt.cloneOptions(n,"edge");pe(s,a),s.from=e,s.to=t,s.id="clusterEdge:"+no(),o!==void 0&&pe(s,o);var u=this.body.functions.createEdge(s);return u.clusteringEdgeReplacingIds=[n.id],u.connect(),this.body.edges[u.id]=u,u}},{key:"_clusterEdges",value:function(e,t,n,a){if(t instanceof qn){var o=t,s={};s[o.id]=o,t=s}if(e instanceof Nt){var u=e,l={};l[u.id]=u,e=l}if(n==null)throw new Error("_clusterEdges: parameter clusterNode required");a===void 0&&(a=n.clusterEdgeProperties),this._createClusterEdges(e,t,n,a);for(var h in t)if(Object.prototype.hasOwnProperty.call(t,h)&&this.body.edges[h]!==void 0){var c=this.body.edges[h];this._backupEdgeOptions(c),c.setOptions({physics:!1})}for(var d in e)Object.prototype.hasOwnProperty.call(e,d)&&(this.clusteredNodes[d]={clusterId:n.id,node:this.body.nodes[d]},this.body.nodes[d].setOptions({physics:!1}))}},{key:"_getClusterNodeForNode",value:function(e){if(e!==void 0){var t=this.clusteredNodes[e];if(t!==void 0){var n=t.clusterId;if(n!==void 0)return this.body.nodes[n]}}}},{key:"_filter",value:function(e,t){var n=[];return te(e,function(a){t(a)&&n.push(a)}),n}},{key:"_updateState",value:function(){var e=this,t,n=[],a={},o=function(v){te(e.body.nodes,function(p){p.isCluster===!0&&v(p)})};for(t in this.clusteredNodes)if(Object.prototype.hasOwnProperty.call(this.clusteredNodes,t)){var s=this.body.nodes[t];s===void 0&&n.push(t)}o(function(f){for(var v=0;v0}(!f.endPointsValid()||!p)&&(a[v]=v)}),o(function(f){te(a,function(v){delete f.containedEdges[v],te(f.edges,function(p,g){if(p.id===v){f.edges[g]=null;return}p.clusteringEdgeReplacingIds=e._filter(p.clusteringEdgeReplacingIds,function(y){return!a[y]})}),f.edges=e._filter(f.edges,function(p){return p!==null})})}),te(a,function(f){delete e.clusteredEdges[f]}),te(a,function(f){delete e.body.edges[f]});var l=Oe(this.body.edges);te(l,function(f){var v=e.body.edges[f],p=e._isClusteredNode(v.fromId)||e._isClusteredNode(v.toId);if(p!==e._isClusteredEdge(v.id))if(p){var g=e._getClusterNodeForNode(v.fromId);g!==void 0&&e._clusterEdges(e.body.nodes[v.fromId],v,g);var y=e._getClusterNodeForNode(v.toId);y!==void 0&&e._clusterEdges(e.body.nodes[v.toId],v,y)}else delete e._clusterEdges[f],e._restoreEdge(v)});for(var h=!1,c=!0,d=function(){var v=[];o(function(g){var y=Oe(g.containedNodes).length,m=g.options.allowSingleNodeCluster===!0;(m&&y<1||!m&&y<2)&&v.push(g.id)});for(var p=0;p0,h=h||c};c;)d();h&&this._updateState()}},{key:"_isClusteredNode",value:function(e){return this.clusteredNodes[e]!==void 0}},{key:"_isClusteredEdge",value:function(e){return this.clusteredEdges[e]!==void 0}}]),i}();function ofe(){var i;window!==void 0&&(i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame),i===void 0?window.requestAnimationFrame=function(r){r()}:window.requestAnimationFrame=i}var sfe=function(){function i(r,e){N(this,i),ofe(),this.body=r,this.canvas=e,this.redrawRequested=!1,this.renderTimer=void 0,this.requiresTimeout=!0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},Le(this.options,this.defaultOptions),this._determineBrowserMethod(),this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this,t;this.body.emitter.on("dragStart",function(){e.dragging=!0}),this.body.emitter.on("dragEnd",function(){e.dragging=!1}),this.body.emitter.on("zoom",function(){e.zooming=!0,window.clearTimeout(e.zoomTimeoutId),e.zoomTimeoutId=mr(function(){var n;e.zooming=!1,k(n=e._requestRedraw).call(n,e)()},250)}),this.body.emitter.on("_resizeNodes",function(){e._resizeNodes()}),this.body.emitter.on("_redraw",function(){e.renderingActive===!1&&e._redraw()}),this.body.emitter.on("_blockRedraw",function(){e.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",function(){e.allowRedraw=!0,e.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",k(t=this._requestRedraw).call(t,this)),this.body.emitter.on("_startRendering",function(){e.renderRequests+=1,e.renderingActive=!0,e._startRendering()}),this.body.emitter.on("_stopRendering",function(){e.renderRequests-=1,e.renderingActive=e.renderRequests>0,e.renderTimer=void 0}),this.body.emitter.on("destroy",function(){e.renderRequests=0,e.allowRedraw=!1,e.renderingActive=!1,e.requiresTimeout===!0?clearTimeout(e.renderTimer):window.cancelAnimationFrame(e.renderTimer),e.body.emitter.off()})}},{key:"setOptions",value:function(e){if(e!==void 0){var t=["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"];Ma(t,this.options,e)}}},{key:"_requestNextFrame",value:function(e,t){if(!(typeof window>"u")){var n,a=window;return this.requiresTimeout===!0?n=mr(e,t):a.requestAnimationFrame&&(n=a.requestAnimationFrame(e)),n}}},{key:"_startRendering",value:function(){if(this.renderingActive===!0&&this.renderTimer===void 0){var e;this.renderTimer=this._requestNextFrame(k(e=this._renderStep).call(e,this),this.simulationInterval)}}},{key:"_renderStep",value:function(){this.renderingActive===!0&&(this.renderTimer=void 0,this.requiresTimeout===!0&&this._startRendering(),this._redraw(),this.requiresTimeout===!1&&this._startRendering())}},{key:"redraw",value:function(){this.body.emitter.emit("setSize"),this._redraw()}},{key:"_requestRedraw",value:function(){var e=this;this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,this._requestNextFrame(function(){e._redraw(!1)},0))}},{key:"_redraw",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(this.allowRedraw===!0){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;var t={drawExternalLabels:null};(this.canvas.frame.canvas.width===0||this.canvas.frame.canvas.height===0)&&this.canvas.setSize(),this.canvas.setTransform();var n=this.canvas.getContext(),a=this.canvas.frame.canvas.clientWidth,o=this.canvas.frame.canvas.clientHeight;if(n.clearRect(0,0,a,o),this.canvas.frame.clientWidth===0)return;if(n.save(),n.translate(this.body.view.translation.x,this.body.view.translation.y),n.scale(this.body.view.scale,this.body.view.scale),n.beginPath(),this.body.emitter.emit("beforeDrawing",n),n.closePath(),e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawEdges(n),this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1){var s=this._drawNodes(n,e),u=s.drawExternalLabels;t.drawExternalLabels=u}e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawArrows(n),t.drawExternalLabels!=null&&t.drawExternalLabels(),e===!1&&this._drawSelectionBox(n),n.beginPath(),this.body.emitter.emit("afterDrawing",n),n.closePath(),n.restore(),e===!0&&n.clearRect(0,0,a,o)}}},{key:"_resizeNodes",value:function(){this.canvas.setTransform();var e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);var t=this.body.nodes,n;for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n=t[a],n.resize(e),n.updateBoundingBox(e,n.selected));e.restore()}},{key:"_drawNodes",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.nodes,a=this.body.nodeIndices,o,s=[],u=[],l=20,h=this.canvas.DOMtoCanvas({x:-20,y:-20}),c=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+l,y:this.canvas.frame.canvas.clientHeight+l}),d={top:h.y,left:h.x,bottom:c.y,right:c.x},f=[],v=0;v0&&arguments[0]!==void 0?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}},{key:"_setCameraState",value:function(){if(this.cameraState.scale!==void 0&&this.frame.canvas.clientWidth!==0&&this.frame.canvas.clientHeight!==0&&this.pixelRatio!==0&&this.cameraState.previousWidth>0&&this.cameraState.previousHeight>0){var e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight,n=this.cameraState.scale;e!=1&&t!=1?n=this.cameraState.scale*.5*(e+t):e!=1?n=this.cameraState.scale*e:t!=1&&(n=this.cameraState.scale*t),this.body.view.scale=n;var a=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),o={x:a.x-this.cameraState.position.x,y:a.y-this.cameraState.position.y};this.body.view.translation.x+=o.x*this.body.view.scale,this.body.view.translation.y+=o.y*this.body.view.scale}}},{key:"_prepareValue",value:function(e){if(typeof e=="number")return e+"px";if(typeof e=="string"){if(ne(e).call(e,"%")!==-1||ne(e).call(e,"px")!==-1)return e;if(ne(e).call(e,"%")===-1)return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}},{key:"_create",value:function(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=0,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{var e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerText="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}},{key:"_bindHammer",value:function(){var e=this;this.hammer!==void 0&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new Gn(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:Gn.DIRECTION_ALL}),Qu(this.hammer,function(t){e.body.eventListeners.onTouch(t)}),this.hammer.on("tap",function(t){e.body.eventListeners.onTap(t)}),this.hammer.on("doubletap",function(t){e.body.eventListeners.onDoubleTap(t)}),this.hammer.on("press",function(t){e.body.eventListeners.onHold(t)}),this.hammer.on("panstart",function(t){e.body.eventListeners.onDragStart(t)}),this.hammer.on("panmove",function(t){e.body.eventListeners.onDrag(t)}),this.hammer.on("panend",function(t){e.body.eventListeners.onDragEnd(t)}),this.hammer.on("pinch",function(t){e.body.eventListeners.onPinch(t)}),this.frame.canvas.addEventListener("wheel",function(t){e.body.eventListeners.onMouseWheel(t)}),this.frame.canvas.addEventListener("mousemove",function(t){e.body.eventListeners.onMouseMove(t)}),this.frame.canvas.addEventListener("contextmenu",function(t){e.body.eventListeners.onContext(t)}),this.hammerFrame=new Gn(this.frame),MT(this.hammerFrame,function(t){e.body.eventListeners.onRelease(t)})}},{key:"setSize",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.width,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);var n=!1,a=this.frame.canvas.width,o=this.frame.canvas.height,s=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(s),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},n=!0;else{var u=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),l=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);(this.frame.canvas.width!==u||this.frame.canvas.height!==l)&&this._getCameraState(s),this.frame.canvas.width!==u&&(this.frame.canvas.width=u,n=!0),this.frame.canvas.height!==l&&(this.frame.canvas.height=l,n=!0)}return n===!0&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(a/this.pixelRatio),oldHeight:Math.round(o/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,n}},{key:"getContext",value:function(){return this.frame.canvas.getContext("2d")}},{key:"_determinePixelRatio",value:function(){var e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");var t=1;typeof window<"u"&&(t=window.devicePixelRatio||1);var n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return t/n}},{key:"_setPixelRatio",value:function(){this.pixelRatio=this._determinePixelRatio()}},{key:"setTransform",value:function(){var e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}},{key:"_XconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.x)/this.body.view.scale}},{key:"_XconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.x}},{key:"_YconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.y)/this.body.view.scale}},{key:"_YconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.y}},{key:"canvasToDOM",value:function(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}},{key:"DOMtoCanvas",value:function(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}]),i}();function ffe(i,r){var e=Le({nodes:r,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},i??{});if(!he(e.nodes))throw new TypeError("Nodes has to be an array of ids.");if(e.nodes.length===0&&(e.nodes=r),!(typeof e.minZoomLevel=="number"&&e.minZoomLevel>0))throw new TypeError("Min zoom level has to be a number higher than zero.");if(!(typeof e.maxZoomLevel=="number"&&e.minZoomLevel<=e.maxZoomLevel))throw new TypeError("Max zoom level has to be a number higher than min zoom level.");return e}var vfe=function(){function i(r,e){var t,n=this,a;N(this,i),this.body=r,this.canvas=e,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",k(t=this.fit).call(t,this)),this.body.emitter.on("animationFinished",function(){n.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",k(a=this.releaseNode).call(a,this))}return M(i,[{key:"setOptions",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=e}},{key:"fit",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e=ffe(e,this.body.nodeIndices);var n=this.canvas.frame.canvas.clientWidth,a=this.canvas.frame.canvas.clientHeight,o,s;if(n===0||a===0)s=1,o=pt.getRange(this.body.nodes,e.nodes);else if(t===!0){var u=0;for(var l in this.body.nodes)if(Object.prototype.hasOwnProperty.call(this.body.nodes,l)){var h=this.body.nodes[l];h.predefinedPosition===!0&&(u+=1)}if(u>.5*this.body.nodeIndices.length){this.fit(e,!1);return}o=pt.getRange(this.body.nodes,e.nodes);var c=this.body.nodeIndices.length;s=12.662/(c+7.4147)+.0964822;var d=Math.min(n/600,a/600);s*=d}else{this.body.emitter.emit("_resizeNodes"),o=pt.getRange(this.body.nodes,e.nodes);var f=Math.abs(o.maxX-o.minX)*1.1,v=Math.abs(o.maxY-o.minY)*1.1,p=n/f,g=a/v;s=p<=g?p:g}s>e.maxZoomLevel?s=e.maxZoomLevel:s1&&arguments[1]!==void 0?arguments[1]:{};if(this.body.nodes[e]!==void 0){var n={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=n,t.lockedOnNode=e,this.moveTo(t)}else console.error("Node: "+e+" cannot be found.")}},{key:"moveTo",value:function(e){if(e===void 0){e={};return}if(e.offset!=null){if(e.offset.x!=null){if(e.offset.x=+e.offset.x,!Di(e.offset.x))throw new TypeError('The option "offset.x" has to be a finite number.')}else e.offset.x=0;if(e.offset.y!=null){if(e.offset.y=+e.offset.y,!Di(e.offset.y))throw new TypeError('The option "offset.y" has to be a finite number.')}else e.offset.x=0}else e.offset={x:0,y:0};if(e.position!=null){if(e.position.x!=null){if(e.position.x=+e.position.x,!Di(e.position.x))throw new TypeError('The option "position.x" has to be a finite number.')}else e.position.x=0;if(e.position.y!=null){if(e.position.y=+e.position.y,!Di(e.position.y))throw new TypeError('The option "position.y" has to be a finite number.')}else e.position.x=0}else e.position=this.getViewPosition();if(e.scale!=null){if(e.scale=+e.scale,!(e.scale>0))throw new TypeError('The option "scale" has to be a number greater than zero.')}else e.scale=this.body.view.scale;e.animation===void 0&&(e.animation={duration:0}),e.animation===!1&&(e.animation={duration:0}),e.animation===!0&&(e.animation={}),e.animation.duration===void 0&&(e.animation.duration=1e3),e.animation.easingFunction===void 0&&(e.animation.easingFunction="easeInOutQuad"),this.animateView(e)}},{key:"animateView",value:function(e){if(e!==void 0){this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),e.locked===!0&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),this.easingTime!=0&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;var t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.position.x,y:t.y-e.position.y};if(this.targetTranslation={x:this.sourceTranslation.x+n.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+n.y*this.targetScale+e.offset.y},e.animation.duration===0)if(this.lockedOnNodeId!=null){var a;this.viewFunction=k(a=this._lockedRedraw).call(a,this),this.body.emitter.on("initRedraw",this.viewFunction)}else this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw");else{var o;this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=k(o=this._transitionRedraw).call(o,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}}},{key:"_lockedRedraw",value:function(){var e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.x,y:t.y-e.y},a=this.body.view.translation,o={x:a.x+n.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:a.y+n.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=o}},{key:"releaseNode",value:function(){this.lockedOnNodeId!==void 0&&this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}},{key:"_transitionRedraw",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.easingTime+=this.animationSpeed,this.easingTime=e===!0?1:this.easingTime;var t=Jae[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1){if(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,this.lockedOnNodeId!=null){var n;this.viewFunction=k(n=this._lockedRedraw).call(n,this),this.body.emitter.on("initRedraw",this.viewFunction)}this.body.emitter.emit("animationFinished")}}},{key:"getScale",value:function(){return this.body.view.scale}},{key:"getViewPosition",value:function(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}]),i}();function g$(i){var r=i&&i.preventDefault||!1,e=i&&i.container||window,t={},n={keydown:{},keyup:{}},a={},o;for(o=97;o<=122;o++)a[String.fromCharCode(o)]={code:65+(o-97),shift:!1};for(o=65;o<=90;o++)a[String.fromCharCode(o)]={code:o,shift:!0};for(o=0;o<=9;o++)a[""+o]={code:48+o,shift:!1};for(o=1;o<=12;o++)a["F"+o]={code:111+o,shift:!1};for(o=0;o<=9;o++)a["num"+o]={code:96+o,shift:!1};a["num*"]={code:106,shift:!1},a["num+"]={code:107,shift:!1},a["num-"]={code:109,shift:!1},a["num/"]={code:111,shift:!1},a["num."]={code:110,shift:!1},a.left={code:37,shift:!1},a.up={code:38,shift:!1},a.right={code:39,shift:!1},a.down={code:40,shift:!1},a.space={code:32,shift:!1},a.enter={code:13,shift:!1},a.shift={code:16,shift:void 0},a.esc={code:27,shift:!1},a.backspace={code:8,shift:!1},a.tab={code:9,shift:!1},a.ctrl={code:17,shift:!1},a.alt={code:18,shift:!1},a.delete={code:46,shift:!1},a.pageup={code:33,shift:!1},a.pagedown={code:34,shift:!1},a["="]={code:187,shift:!1},a["-"]={code:189,shift:!1},a["]"]={code:221,shift:!1},a["["]={code:219,shift:!1};var s=function(h){l(h,"keydown")},u=function(h){l(h,"keyup")},l=function(h,c){if(n[c][h.keyCode]!==void 0){for(var d=n[c][h.keyCode],f=0;f700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=new Date().valueOf())}},{key:"_stopMovement",value:function(){for(var e in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}},{key:"_moveUp",value:function(){this.body.view.translation.y+=this.options.keyboard.speed.y}},{key:"_moveDown",value:function(){this.body.view.translation.y-=this.options.keyboard.speed.y}},{key:"_moveLeft",value:function(){this.body.view.translation.x+=this.options.keyboard.speed.x}},{key:"_moveRight",value:function(){this.body.view.translation.x-=this.options.keyboard.speed.x}},{key:"_zoomIn",value:function(){var e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,a=t/e,o=(1-a)*this.canvas.canvasViewCenter.x+n.x*a,s=(1-a)*this.canvas.canvasViewCenter.y+n.y*a;this.body.view.scale=t,this.body.view.translation={x:o,y:s},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}},{key:"_zoomOut",value:function(){var e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,a=t/e,o=(1-a)*this.canvas.canvasViewCenter.x+n.x*a,s=(1-a)*this.canvas.canvasViewCenter.y+n.y*a;this.body.view.scale=t,this.body.view.translation={x:o,y:s},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}},{key:"configureKeyboardBindings",value:function(){var e=this;if(this.keycharm!==void 0&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=g$({container:window,preventDefault:!0}):this.keycharm=g$({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0)){var t,n,a,o,s,u,l,h,c,d,f,v,p,g,y,m,$,b,O,_,D,R,P,B;k(t=this.keycharm).call(t,"up",function(){e.bindToRedraw("_moveUp")},"keydown"),k(n=this.keycharm).call(n,"down",function(){e.bindToRedraw("_moveDown")},"keydown"),k(a=this.keycharm).call(a,"left",function(){e.bindToRedraw("_moveLeft")},"keydown"),k(o=this.keycharm).call(o,"right",function(){e.bindToRedraw("_moveRight")},"keydown"),k(s=this.keycharm).call(s,"=",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(u=this.keycharm).call(u,"num+",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(l=this.keycharm).call(l,"num-",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(h=this.keycharm).call(h,"-",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(c=this.keycharm).call(c,"[",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(d=this.keycharm).call(d,"]",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(f=this.keycharm).call(f,"pageup",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(v=this.keycharm).call(v,"pagedown",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(p=this.keycharm).call(p,"up",function(){e.unbindFromRedraw("_moveUp")},"keyup"),k(g=this.keycharm).call(g,"down",function(){e.unbindFromRedraw("_moveDown")},"keyup"),k(y=this.keycharm).call(y,"left",function(){e.unbindFromRedraw("_moveLeft")},"keyup"),k(m=this.keycharm).call(m,"right",function(){e.unbindFromRedraw("_moveRight")},"keyup"),k($=this.keycharm).call($,"=",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(b=this.keycharm).call(b,"num+",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(O=this.keycharm).call(O,"num-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(_=this.keycharm).call(_,"-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(D=this.keycharm).call(D,"[",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(R=this.keycharm).call(R,"]",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(P=this.keycharm).call(P,"pageup",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(B=this.keycharm).call(B,"pagedown",function(){e.unbindFromRedraw("_zoomOut")},"keyup")}}}]),i}();function gfe(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=yfe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function yfe(i,r){var e;if(i){if(typeof i=="string")return y$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return y$(i,r)}}function y$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=new Date().valueOf())}},{key:"onTap",value:function(e){var t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t)}},{key:"onDoubleTap",value:function(e){var t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("doubleClick",e,t)}},{key:"onHold",value:function(e){var t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t),this.selectionHandler.generateClickEvent("hold",e,t)}},{key:"onRelease",value:function(e){if(new Date().valueOf()-this.touchTime>10){var t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("release",e,t),this.touchTime=new Date().valueOf()}}},{key:"onContext",value:function(e){var t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent("oncontext",e,t)}},{key:"checkSelectionChanges",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;t===!0?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}},{key:"_determineDifference",value:function(e,t){var n=function(o,s){for(var u=[],l=0;l=o.minX&&c.x<=o.maxX&&c.y>=o.minY&&c.y<=o.maxY});fe(s).call(s,function(h){return t.selectionHandler.selectObject(t.body.nodes[h])});var u=this.getPointer(e.center);this.selectionHandler.commitAndEmit(u,e),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw")}else{var l=this.drag.selection;l&&l.length?(fe(l).call(l,function(h){h.node.options.fixed.x=h.xFixed,h.node.options.fixed.y=h.yFixed}),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center)),this.body.emitter.emit("startSimulation")):(this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw"))}}},{key:"onPinch",value:function(e){var t=this.getPointer(e.center);this.drag.pinched=!0,this.pinch.scale===void 0&&(this.pinch.scale=1);var n=this.pinch.scale*e.scale;this.zoom(n,t)}},{key:"zoom",value:function(e,t){if(this.options.zoomView===!0){var n=this.body.view.scale;e<1e-5&&(e=1e-5),e>10&&(e=10);var a=void 0;this.drag!==void 0&&this.drag.dragging===!0&&(a=this.canvas.DOMtoCanvas(this.drag.pointer));var o=this.body.view.translation,s=e/n,u=(1-s)*t.x+o.x*s,l=(1-s)*t.y+o.y*s;if(this.body.view.scale=e,this.body.view.translation={x:u,y:l},a!=null){var h=this.canvas.canvasToDOM(a);this.drag.pointer.x=h.x,this.drag.pointer.y=h.y}this.body.emitter.emit("_requestRedraw"),n0&&(this.popupObj=h[d[d.length-1]],s=!0)}if(this.popupObj===void 0&&s===!1){for(var v=this.body.edgeIndices,p=this.body.edges,g,y=[],m=0;m0&&(this.popupObj=p[y[y.length-1]],u="edge")}this.popupObj!==void 0?this.popupObj.id!==o&&(this.popup===void 0&&(this.popup=new aoe(this.canvas.frame)),this.popup.popupTargetType=u,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):this.popup!==void 0&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}},{key:"_checkHidePopup",value:function(e){var t=this.selectionHandler._pointerToPositionObject(e),n=!1;if(this.popup.popupTargetType==="node"){if(this.body.nodes[this.popup.popupTargetId]!==void 0&&(n=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),n===!0)){var a=this.selectionHandler.getNodeAt(e);n=a===void 0?!1:a.id===this.popup.popupTargetId}}else this.selectionHandler.getNodeAt(e)===void 0&&this.body.edges[this.popup.popupTargetId]!==void 0&&(n=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));n===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}]),i}(),bfe=hp,$fe=vT;bfe("Set",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},$fe);var wfe=oe,_fe=wfe.Set,Efe=_fe,Sfe=Efe,Ofe=Sfe,xi=V(Ofe),Tfe=se,m$=cp,ru=eh.getWeakData,Ife=lp,kfe=Vt,Pfe=Oa,vd=Ze,xfe=up,BT=wi,b$=Qe,FT=ln,Cfe=FT.set,Afe=FT.getterFor,Dfe=BT.find,Rfe=BT.findIndex,Nfe=Tfe([].splice),Mfe=0,iu=function(i){return i.frozen||(i.frozen=new jT)},jT=function(){this.entries=[]},pd=function(i,r){return Dfe(i.entries,function(e){return e[0]===r})};jT.prototype={get:function(i){var r=pd(this,i);if(r)return r[1]},has:function(i){return!!pd(this,i)},set:function(i,r){var e=pd(this,i);e?e[1]=r:this.entries.push([i,r])},delete:function(i){var r=Rfe(this.entries,function(e){return e[0]===i});return~r&&Nfe(this.entries,r,1),!!~r}};var Bfe={getConstructor:function(i,r,e,t){var n=i(function(u,l){Ife(u,a),Cfe(u,{type:r,id:Mfe++,frozen:void 0}),Pfe(l)||xfe(l,u[t],{that:u,AS_ENTRIES:e})}),a=n.prototype,o=Afe(r),s=function(u,l,h){var c=o(u),d=ru(kfe(l),!0);return d===!0?iu(c).set(l,h):d[c.id]=h,u};return m$(a,{delete:function(u){var l=o(this);if(!vd(u))return!1;var h=ru(u);return h===!0?iu(l).delete(u):h&&b$(h,l.id)&&delete h[l.id]},has:function(l){var h=o(this);if(!vd(l))return!1;var c=ru(l);return c===!0?iu(h).has(l):c&&b$(c,h.id)}}),m$(a,e?{get:function(l){var h=o(this);if(vd(l)){var c=ru(l);return c===!0?iu(h).get(l):c?c[h.id]:void 0}},set:function(l,h){return s(this,l,h)}}:{add:function(l){return s(this,l,!0)}}),n}},Ffe=hT,$$=Pe,Su=se,w$=cp,jfe=eh,Lfe=hp,LT=Bfe,nu=Ze,au=ln.enforce,zfe=ae,Hfe=eS,gs=Object,Vfe=Array.isArray,ou=gs.isExtensible,zT=gs.isFrozen,Wfe=gs.isSealed,HT=gs.freeze,Ufe=gs.seal,_$={},E$={},Kfe=!$$.ActiveXObject&&"ActiveXObject"in $$,Wa,VT=function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},WT=Lfe("WeakMap",VT,LT),Cn=WT.prototype,Ou=Su(Cn.set),Gfe=function(){return Ffe&&zfe(function(){var i=HT([]);return Ou(new WT,i,1),!zT(i)})};if(Hfe)if(Kfe){Wa=LT.getConstructor(VT,"WeakMap",!0),jfe.enable();var S$=Su(Cn.delete),su=Su(Cn.has),O$=Su(Cn.get);w$(Cn,{delete:function(i){if(nu(i)&&!ou(i)){var r=au(this);return r.frozen||(r.frozen=new Wa),S$(this,i)||r.frozen.delete(i)}return S$(this,i)},has:function(r){if(nu(r)&&!ou(r)){var e=au(this);return e.frozen||(e.frozen=new Wa),su(this,r)||e.frozen.has(r)}return su(this,r)},get:function(r){if(nu(r)&&!ou(r)){var e=au(this);return e.frozen||(e.frozen=new Wa),su(this,r)?O$(this,r):e.frozen.get(r)}return O$(this,r)},set:function(r,e){if(nu(r)&&!ou(r)){var t=au(this);t.frozen||(t.frozen=new Wa),su(this,r)?Ou(this,r,e):t.frozen.set(r,e)}else Ou(this,r,e);return this}})}else Gfe()&&w$(Cn,{set:function(r,e){var t;return Vfe(r)&&(zT(r)?t=_$:Wfe(r)&&(t=E$)),Ou(this,r,e),t===_$&&HT(r),t===E$&&Ufe(r),this}});var qfe=oe,Yfe=qfe.WeakMap,Xfe=Yfe,Jfe=Xfe,Zfe=Jfe,ao=V(Zfe);function ve(i,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?i!==r||!t:!r.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(i):t?t.value:r.get(i)}function Nf(i,r,e,t,n){if(typeof r=="function"?i!==r||!0:!r.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r.set(i,e),e}function Mf(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=Qfe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Qfe(i,r){var e;if(i){if(typeof i=="string")return T$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return T$(i,r)}}function T$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e0&&arguments[0]!==void 0?arguments[0]:function(){};N(this,i),Yr.set(this,new k$),Xr.set(this,new k$),Tu.set(this,void 0),Nf(this,Tu,r)}return M(i,[{key:"sizeNodes",get:function(){return ve(this,Yr,"f").size}},{key:"sizeEdges",get:function(){return ve(this,Xr,"f").size}},{key:"getNodes",value:function(){return ve(this,Yr,"f").getSelection()}},{key:"getEdges",value:function(){return ve(this,Xr,"f").getSelection()}},{key:"addNodes",value:function(){var e;(e=ve(this,Yr,"f")).add.apply(e,arguments)}},{key:"addEdges",value:function(){var e;(e=ve(this,Xr,"f")).add.apply(e,arguments)}},{key:"deleteNodes",value:function(e){ve(this,Yr,"f").delete(e)}},{key:"deleteEdges",value:function(e){ve(this,Xr,"f").delete(e)}},{key:"clear",value:function(){ve(this,Yr,"f").clear(),ve(this,Xr,"f").clear()}},{key:"commit",value:function(){for(var e,t,n={nodes:ve(this,Yr,"f").commit(),edges:ve(this,Xr,"f").commit()},a=arguments.length,o=new Array(a),s=0;s=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function tve(i,r){var e;if(i){if(typeof i=="string")return x$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return x$(i,r)}}function x$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e4&&arguments[4]!==void 0?arguments[4]:!1,s=this._initBaseEvent(t,n);if(o===!0)s.nodes=[],s.edges=[];else{var u=this.getSelection();s.nodes=u.nodes,s.edges=u.edges}a!==void 0&&(s.previousSelection=a),e=="click"&&(s.items=this.getClickedItems(n)),t.controlEdge!==void 0&&(s.controlEdge=t.controlEdge),this.body.emitter.emit(e,s)}},{key:"selectObject",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.selectConnectedEdges;if(e!==void 0){if(e instanceof Nt){if(t===!0){var n;(n=this._selectionAccumulator).addEdges.apply(n,fr(e.edges))}this._selectionAccumulator.addNodes(e)}else this._selectionAccumulator.addEdges(e);return!0}return!1}},{key:"deselectObject",value:function(e){e.isSelected()===!0&&(e.selected=!1,this._removeFromSelection(e))}},{key:"_getAllNodesOverlappingWith",value:function(e){for(var t=[],n=this.body.nodes,a=0;a1&&arguments[1]!==void 0?arguments[1]:!0,n=this._pointerToPositionObject(e),a=this._getAllNodesOverlappingWith(n);if(a.length>0)return t===!0?this.body.nodes[a[a.length-1]]:a[a.length-1]}},{key:"_getEdgesOverlappingWith",value:function(e,t){for(var n=this.body.edges,a=0;a1&&arguments[1]!==void 0?arguments[1]:!0,n=this.canvas.DOMtoCanvas(e),a=10,o=null,s=this.body.edges,u=0;u0&&(this.generateClickEvent("deselectEdge",t,e,o),n=!0),a.nodes.deleted.length>0&&(this.generateClickEvent("deselectNode",t,e,o),n=!0),a.nodes.added.length>0&&(this.generateClickEvent("selectNode",t,e),n=!0),a.edges.added.length>0&&(this.generateClickEvent("selectEdge",t,e),n=!0),n===!0&&this.generateClickEvent("select",t,e)}},{key:"getSelection",value:function(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}},{key:"getSelectedNodes",value:function(){return this._selectionAccumulator.getNodes()}},{key:"getSelectedEdges",value:function(){return this._selectionAccumulator.getEdges()}},{key:"getSelectedNodeIds",value:function(){var e;return na(e=this._selectionAccumulator.getNodes()).call(e,function(t){return t.id})}},{key:"getSelectedEdgeIds",value:function(){var e;return na(e=this._selectionAccumulator.getEdges()).call(e,function(t){return t.id})}},{key:"setSelection",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||!e.nodes&&!e.edges)throw new TypeError("Selection must be an object with nodes and/or edges properties");if((t.unselectAll||t.unselectAll===void 0)&&this.unselectAll(),e.nodes){var n=P$(e.nodes),a;try{for(n.s();!(a=n.n()).done;){var o=a.value,s=this.body.nodes[o];if(!s)throw new RangeError('Node with id "'+o+'" not found');this.selectObject(s,t.highlightEdges)}}catch(d){n.e(d)}finally{n.f()}}if(e.edges){var u=P$(e.edges),l;try{for(u.s();!(l=u.n()).done;){var h=l.value,c=this.body.edges[h];if(!c)throw new RangeError('Edge with id "'+h+'" not found');this.selectObject(c)}}catch(d){u.e(d)}finally{u.f()}}this.body.emitter.emit("_requestRedraw"),this._selectionAccumulator.commit()}},{key:"selectNodes",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:t})}},{key:"selectEdges",value:function(e){if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({edges:e})}},{key:"updateSelection",value:function(){for(var e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(var t in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,t.id)||this._selectionAccumulator.deleteEdges(t)}},{key:"getClickedItems",value:function(e){for(var t=this.canvas.DOMtoCanvas(e),n=[],a=this.body.nodeIndices,o=this.body.nodes,s=a.length-1;s>=0;s--){var u=o[a[s]],l=u.getItemsOnPoint(t);n.push.apply(n,l)}for(var h=this.body.edgeIndices,c=this.body.edges,d=h.length-1;d>=0;d--){var f=c[h[d]],v=f.getItemsOnPoint(t);n.push.apply(n,v)}return n}}]),i}(),C$=kS,ive=Math.floor,Bf=function(i,r){var e=i.length,t=ive(e/2);return e<8?nve(i,r):ave(i,Bf(C$(i,0,t),r),Bf(C$(i,t),r),r)},nve=function(i,r){for(var e=i.length,t=1,n,a;t0;)i[a]=i[--a];a!==t++&&(i[a]=n)}return i},ave=function(i,r,e,t){for(var n=r.length,a=e.length,o=0,s=0;o3)){if(bve)return!0;if(F$)return F$<603;var i="",r,e,t,n;for(r=65;r<76;r++){switch(e=String.fromCharCode(r),r){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(n=0;n<47;n++)ii.push({k:e+n,v:t})}for(ii.sort(function(a,o){return o.v-a.v}),n=0;nN$(e)?1:-1}};fve({target:"Array",proto:!0,forced:Sve},{sort:function(r){r!==void 0&&vve(r);var e=pve(this);if(KT)return r===void 0?j$(e):j$(e,r);var t=[],n=R$(e),a,o;for(o=0;o=0:s>u;u+=l)u in o&&(n=e(n,o[u],u,a));return n}},jve={left:L$(!1),right:L$(!0)},Lve=Pe,zve=Hr,Hve=zve(Lve.process)==="process",Vve=q,Wve=jve.left,Uve=Ra,z$=Xo,Kve=Hve,Gve=!Kve&&z$>79&&z$<83,qve=Gve||!Uve("reduce");Vve({target:"Array",proto:!0,forced:qve},{reduce:function(r){var e=arguments.length;return Wve(this,r,e,e>1?arguments[1]:void 0)}});var Yve=et,Xve=Yve("Array").reduce,Jve=Be,Zve=Xve,yd=Array.prototype,Qve=function(i){var r=i.reduce;return i===yd||Jve(yd,i)&&r===yd.reduce?Zve:r},epe=Qve,tpe=epe,rpe=tpe,GT=V(rpe);function qT(i){var r=ipe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function ipe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var YT=function(){function i(){N(this,i)}return M(i,[{key:"abstract",value:function(){throw new Error("Can't instantiate abstract class!")}},{key:"fake_use",value:function(){}},{key:"curveType",value:function(){return this.abstract()}},{key:"getPosition",value:function(e){return this.fake_use(e),this.abstract()}},{key:"setPosition",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;this.fake_use(e,t,n),this.abstract()}},{key:"getTreeSize",value:function(e){return this.fake_use(e),this.abstract()}},{key:"sort",value:function(e){this.fake_use(e),this.abstract()}},{key:"fix",value:function(e,t){this.fake_use(e,t),this.abstract()}},{key:"shift",value:function(e,t){this.fake_use(e,t),this.abstract()}}]),i}(),npe=function(i){ue(e,i);var r=qT(e);function e(t){var n;return N(this,e),n=r.call(this),n.layout=t,n}return M(e,[{key:"curveType",value:function(){return"horizontal"}},{key:"getPosition",value:function(n){return n.x}},{key:"setPosition",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;o!==void 0&&this.layout.hierarchical.addToOrdering(n,o),n.x=a}},{key:"getTreeSize",value:function(n){var a=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,n);return{min:a.min_x,max:a.max_x}}},{key:"sort",value:function(n){oo(n).call(n,function(a,o){return a.x-o.x})}},{key:"fix",value:function(n,a){n.y=this.layout.options.hierarchical.levelSeparation*a,n.options.fixed.y=!0}},{key:"shift",value:function(n,a){this.layout.body.nodes[n].x+=a}}]),e}(YT),ape=function(i){ue(e,i);var r=qT(e);function e(t){var n;return N(this,e),n=r.call(this),n.layout=t,n}return M(e,[{key:"curveType",value:function(){return"vertical"}},{key:"getPosition",value:function(n){return n.y}},{key:"setPosition",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;o!==void 0&&this.layout.hierarchical.addToOrdering(n,o),n.y=a}},{key:"getTreeSize",value:function(n){var a=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,n);return{min:a.min_y,max:a.max_y}}},{key:"sort",value:function(n){oo(n).call(n,function(a,o){return a.y-o.y})}},{key:"fix",value:function(n,a){n.x=this.layout.options.hierarchical.levelSeparation*a,n.options.fixed.x=!0}},{key:"shift",value:function(n,a){this.layout.body.nodes[n].y+=a}}]),e}(YT),ope=q,spe=wi.every,upe=Ra,lpe=upe("every");ope({target:"Array",proto:!0,forced:!lpe},{every:function(r){return spe(this,r,arguments.length>1?arguments[1]:void 0)}});var hpe=et,cpe=hpe("Array").every,dpe=Be,fpe=cpe,md=Array.prototype,vpe=function(i){var r=i.every;return i===md||dpe(md,i)&&r===md.every?fpe:r},ppe=vpe,gpe=ppe,ype=gpe,XT=V(ype);function mpe(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=bpe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function bpe(i,r){var e;if(i){if(typeof i=="string")return H$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return H$(i,r)}}function H$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e=r[a])&&(r[a]=r[n]+1)}),r}function wpe(i){return JT(function(r){var e,t;return XT(e=Tt(t=r.edges).call(t,function(n){return i.has(n.toId)})).call(e,function(n){return n.to===r})},function(r,e){return e>r},"from",i)}function _pe(i){return JT(function(r){var e,t;return XT(e=Tt(t=r.edges).call(t,function(n){return i.has(n.toId)})).call(e,function(n){return n.from===r})},function(r,e){return eo)return{v:{v:$pe(t,a)}};++m},O;$=y.pop();)if(O=b(),O!==0&&O)return O.v},d;for(l.s();!(h=l.n()).done;)if(d=c(),d!==0&&d)return d.v}catch(f){l.e(f)}finally{l.f()}return a}var Epe=function(){function i(){N(this,i),this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}return M(i,[{key:"addRelation",value:function(e,t){this.childrenReference[e]===void 0&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),this.parentReference[t]===void 0&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}},{key:"checkIfTree",value:function(){for(var e in this.parentReference)if(this.parentReference[e].length>1){this.isTree=!1;return}this.isTree=!0}},{key:"numTrees",value:function(){return this.treeIndex+1}},{key:"setTreeIndex",value:function(e,t){t!==void 0&&this.trees[e.id]===void 0&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}},{key:"ensureLevel",value:function(e){this.levels[e]===void 0&&(this.levels[e]=0)}},{key:"getMaxLevel",value:function(e){var t=this,n={},a=function o(s){if(n[s]!==void 0)return n[s];var u=t.levels[s];if(t.childrenReference[s]){var l=t.childrenReference[s];if(l.length>0)for(var h=0;h0&&(n.levelSeparation*=-1):n.levelSeparation<0&&(n.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(a===!0)return this.body.emitter.emit("refresh"),pe(t,this.optionsBackup)}return t}},{key:"_resetRNG",value:function(e){this.initialRandomSeed=e,this._rng=Ql(this.initialRandomSeed)}},{key:"adaptAllOptionsForHierarchicalLayout",value:function(e){if(this.options.hierarchical.enabled===!0){var t=this.optionsBackup.physics;e.physics===void 0||e.physics===!0?(e.physics={enabled:t.enabled===void 0?!0:t.enabled,solver:"hierarchicalRepulsion"},t.enabled=t.enabled===void 0?!0:t.enabled,t.solver=t.solver||"barnesHut"):de(e.physics)==="object"?(t.enabled=e.physics.enabled===void 0?!0:e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):e.physics!==!1&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});var n=this.direction.curveType();if(e.edges===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(e.edges.smooth===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if(typeof e.edges.smooth=="boolean")this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:n};else{var a=e.edges.smooth;a.type!==void 0&&a.type!=="dynamic"&&(n=a.type),this.optionsBackup.edges={smooth:{enabled:a.enabled===void 0?!0:a.enabled,type:a.type===void 0?"dynamic":a.type,roundness:a.roundness===void 0?.5:a.roundness,forceDirection:a.forceDirection===void 0?!1:a.forceDirection}},e.edges.smooth={enabled:a.enabled===void 0?!0:a.enabled,type:n,roundness:a.roundness===void 0?.5:a.roundness,forceDirection:a.forceDirection===void 0?!1:a.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",n)}return e}},{key:"positionInitially",value:function(e){if(this.options.hierarchical.enabled!==!0){this._resetRNG(this.initialRandomSeed);for(var t=e.length+50,n=0;nu){for(var h=e.length;e.length>u&&s<=o;){s+=1;var c=e.length;s%3===0?this.body.modules.clustering.clusterBridges(l):this.body.modules.clustering.clusterOutliers(l);var d=e.length;if(c==d&&s%3!==0){this._declusterAll(),this.body.emitter.emit("_layoutFailed"),console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.");return}}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*h)})}s>o&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();for(var f=70,v=0;v0){var e,t,n=!1,a=!1;this.lastNodeOnLevel={},this.hierarchical=new Epe;for(t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&(e=this.body.nodes[t],e.options.level!==void 0?(n=!0,this.hierarchical.levels[t]=e.options.level):a=!0);if(a===!0&&n===!0)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");if(a===!0){var o=this.options.hierarchical.sortMethod;o==="hubsize"?this._determineLevelsByHubsize():o==="directed"?this._determineLevelsDirected():o==="custom"&&this._determineLevelsCustomCallback()}for(var s in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,s)&&this.hierarchical.ensureLevel(s);var u=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(u),this._condenseHierarchy(),this._shiftToCenter()}}},{key:"_condenseHierarchy",value:function(){var e=this,t=!1,n={},a=function(){for(var $=s(),b=0,O=0;O<$.length-1;O++){var _=$[O].max-$[O+1].min;b+=_+e.options.hierarchical.treeSpacing,o(O+1,b)}},o=function($,b){var O=e.hierarchical.trees;for(var _ in O)Object.prototype.hasOwnProperty.call(O,_)&&O[_]===$&&e.direction.shift(_,b)},s=function(){for(var $=[],b=0;b0)for(var _=0;_1&&arguments[1]!==void 0?arguments[1]:1e9,O=1e9,_=1e9,D=1e9,R=-1e9;for(var P in $)if(Object.prototype.hasOwnProperty.call($,P)){var B=e.body.nodes[P],j=e.hierarchical.levels[B.id],J=e.direction.getPosition(B),U=e._getSpaceAroundNode(B,$),ie=Te(U,2),_e=ie[0],ye=ie[1];O=Math.min(_e,O),_=Math.min(ye,_),j<=b&&(D=Math.min(J,D),R=Math.max(J,R))}return[D,R,O,_]},h=function($,b){var O=e.hierarchical.getMaxLevel($.id),_=e.hierarchical.getMaxLevel(b.id);return Math.min(O,_)},c=function($,b,O){for(var _=e.hierarchical,D=0;D1)for(var B=0;B2&&arguments[2]!==void 0?arguments[2]:!1,_=e.direction.getPosition($),D=e.direction.getPosition(b),R=Math.abs(D-_),P=e.options.hierarchical.nodeSpacing;if(R>P){var B={},j={};u($,B),u(b,j);var J=h($,b),U=l(B,J),ie=l(j,J),_e=U[1],ye=ie[0],Ae=ie[2],ht=Math.abs(_e-ye);if(ht>P){var at=_e-ye+P;at<-Ae+P&&(at=-Ae+P),at<0&&(e._shiftBlock(b.id,at),t=!0,O===!0&&e._centerParent(b))}}},f=function($,b){for(var O=b.id,_=b.edges,D=e.hierarchical.levels[b.id],R=e.options.hierarchical.levelSeparation*e.options.hierarchical.levelSeparation,P={},B=[],j=0;j<_.length;j++){var J=_[j];if(J.toId!=J.fromId){var U=J.toId==O?J.from:J.to;P[_[j].id]=U,e.hierarchical.levels[U.id]0?ut=Math.min(Rt,Sr-e.options.hierarchical.nodeSpacing):Rt<0&&(ut=-Math.min(-Rt,st-e.options.hierarchical.nodeSpacing)),ut!=0&&(e._shiftBlock(b.id,ut),t=!0)},ht=function(ot){var me=e.direction.getPosition(b),Fe=e._getSpaceAroundNode(b),De=Te(Fe,2),st=De[0],Sr=De[1],Rt=ot-me,ut=me;Rt>0?ut=Math.min(me+(Sr-e.options.hierarchical.nodeSpacing),ot):Rt<0&&(ut=Math.max(me-(st-e.options.hierarchical.nodeSpacing),ot)),ut!==me&&(e.direction.setPosition(b,ut),t=!0)},at=ye($,B);Ae(at),at=ye($,_),ht(at)},v=function($){var b=e.hierarchical.getLevels();b=Li(b).call(b);for(var O=0;O<$;O++){t=!1;for(var _=0;_0&&Math.abs(v)0&&(h=this.direction.getPosition(a[s-1])+l),this.direction.setPosition(u,h,t),this._validatePositionAndContinue(u,t,h),o++}}}}},{key:"_placeBranchNodes",value:function(e,t){var n,a=this.hierarchical.childrenReference[e];if(a!==void 0){for(var o=[],s=0;st&&this.positionedNodes[l.id]===void 0){var c=this.options.hierarchical.nodeSpacing,d=void 0;u===0?d=this.direction.getPosition(this.body.nodes[e]):d=this.direction.getPosition(o[u-1])+c,this.direction.setPosition(l,d,h),this._validatePositionAndContinue(l,h,d)}else return}var f=this._getCenterPosition(o);this.direction.setPosition(this.body.nodes[e],f,t)}}},{key:"_validatePositionAndContinue",value:function(e,t,n){if(this.hierarchical.isTree){if(this.lastNodeOnLevel[t]!==void 0){var a=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(n-ae.hierarchical.levels[a.id]&&e.hierarchical.addRelation(a.id,o.id)};this._crawlNetwork(t),this.hierarchical.checkIfTree()}},{key:"_crawlNetwork",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){},n=arguments.length>1?arguments[1]:void 0,a={},o=function d(f,v){if(a[f.id]===void 0){e.hierarchical.setTreeIndex(f,v),a[f.id]=!0;for(var p,g=e._getActiveEdges(f),y=0;y=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Tpe(i,r){var e;if(i){if(typeof i=="string")return V$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return V$(i,r)}}function V$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e0&&this.options.deleteNode!==!1?(u===!0&&this._createSeperator(4),this._createDeleteButton(s)):n===0&&this.options.deleteEdge!==!1&&(u===!0&&this._createSeperator(4),this._createDeleteButton(s))),this._bindElementEvents(this.closeDiv,k(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent("select",k(t=this.showManipulatorToolbar).call(t,this))}this.body.emitter.emit("_redraw")}},{key:"addNodeMode",value:function(){var e;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addNode",this.guiEnabled===!0){var t,n=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(n),this._createSeperator(),this._createDescription(n.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,k(t=this.toggleEditMode).call(t,this))}this._temporaryBindEvent("click",k(e=this._performAddNode).call(e,this))}},{key:"editNode",value:function(){var e=this;this.editMode!==!0&&this.enableEditMode(),this._clean();var t=this.selectionHandler.getSelectedNodes()[0];if(t!==void 0)if(this.inMode="editNode",typeof this.options.editNode=="function")if(t.isCluster!==!0){var n=pe({},t.options,!1);if(n.x=t.x,n.y=t.y,this.options.editNode.length===2)this.options.editNode(n,function(a){a!=null&&e.inMode==="editNode"&&e.body.data.nodes.getDataSet().update(a),e.showManipulatorToolbar()});else throw new Error("The function for edit does not support two arguments (data, callback)")}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError);else throw new Error("No function has been configured to handle the editing of nodes.");else this.showManipulatorToolbar()}},{key:"addEdgeMode",value:function(){var e,t,n,a,o;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addEdge",this.guiEnabled===!0){var s,u=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(u),this._createSeperator(),this._createDescription(u.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,k(s=this.toggleEditMode).call(s,this))}this._temporaryBindUI("onTouch",k(e=this._handleConnect).call(e,this)),this._temporaryBindUI("onDragEnd",k(t=this._finishConnect).call(t,this)),this._temporaryBindUI("onDrag",k(n=this._dragControlNode).call(n,this)),this._temporaryBindUI("onRelease",k(a=this._finishConnect).call(a,this)),this._temporaryBindUI("onDragStart",k(o=this._dragStartEdge).call(o,this)),this._temporaryBindUI("onHold",function(){})}},{key:"editEdgeMode",value:function(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="editEdge",de(this.options.editEdge)==="object"&&typeof this.options.editEdge.editWithoutDrag=="function"&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0)){var e=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(e.from.id,e.to.id);return}if(this.guiEnabled===!0){var t,n=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(n),this._createSeperator(),this._createDescription(n.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,k(t=this.toggleEditMode).call(t,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0){var a,o,s,u,l=this.body.edges[this.edgeBeingEditedId],h=this._getNewTargetNode(l.from.x,l.from.y),c=this._getNewTargetNode(l.to.x,l.to.y);this.temporaryIds.nodes.push(h.id),this.temporaryIds.nodes.push(c.id),this.body.nodes[h.id]=h,this.body.nodeIndices.push(h.id),this.body.nodes[c.id]=c,this.body.nodeIndices.push(c.id),this._temporaryBindUI("onTouch",k(a=this._controlNodeTouch).call(a,this)),this._temporaryBindUI("onTap",function(){}),this._temporaryBindUI("onHold",function(){}),this._temporaryBindUI("onDragStart",k(o=this._controlNodeDragStart).call(o,this)),this._temporaryBindUI("onDrag",k(s=this._controlNodeDrag).call(s,this)),this._temporaryBindUI("onDragEnd",k(u=this._controlNodeDragEnd).call(u,this)),this._temporaryBindUI("onMouseMove",function(){}),this._temporaryBindEvent("beforeDrawing",function(d){var f=l.edgeType.findBorderPositions(d);h.selected===!1&&(h.x=f.from.x,h.y=f.from.y),c.selected===!1&&(c.x=f.to.x,c.y=f.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}},{key:"deleteSelected",value:function(){var e=this;this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="delete";var t=this.selectionHandler.getSelectedNodeIds(),n=this.selectionHandler.getSelectedEdgeIds(),a=void 0;if(t.length>0){for(var o=0;o0&&typeof this.options.deleteEdge=="function"&&(a=this.options.deleteEdge);if(typeof a=="function"){var s={nodes:t,edges:n};if(a.length===2)a(s,function(u){u!=null&&e.inMode==="delete"?(e.body.data.edges.getDataSet().remove(u.edges),e.body.data.nodes.getDataSet().remove(u.nodes),e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar()):(e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar())});else throw new Error("The function for delete does not support two arguments (data, callback)")}else this.body.data.edges.getDataSet().remove(n),this.body.data.nodes.getDataSet().remove(t),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}},{key:"_setup",value:function(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}},{key:"_createWrappers",value:function(){if(this.manipulationDiv===void 0&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",this.editMode===!0?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),this.editModeDiv===void 0&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",this.editMode===!0?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),this.closeDiv===void 0){var e,t;this.closeDiv=document.createElement("button"),this.closeDiv.className="vis-close",this.closeDiv.setAttribute("aria-label",(e=(t=this.options.locales[this.options.locale])===null||t===void 0?void 0:t.close)!==null&&e!==void 0?e:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv)}}},{key:"_getNewTargetNode",value:function(e,t){var n=pe({},this.options.controlNodeStyle);n.id="targetNode"+no(),n.hidden=!1,n.physics=!1,n.x=e,n.y=t;var a=this.body.functions.createNode(n);return a.shape.boundingBox={left:e,right:e,top:t,bottom:t},a}},{key:"_createEditButton",value:function(){var e;this._clean(),this.manipulationDOM={},Zr(this.editModeDiv);var t=this.options.locales[this.options.locale],n=this._createButton("editMode","vis-edit vis-edit-mode",t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(n),this._bindElementEvents(n,k(e=this.toggleEditMode).call(e,this))}},{key:"_clean",value:function(){this.inMode=!1,this.guiEnabled===!0&&(Zr(this.editModeDiv),Zr(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}},{key:"_cleanupDOMEventListeners",value:function(){var e,t=Ope(Ar(e=this._domEventListenerCleanupQueue).call(e,0)),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;a()}}catch(o){t.e(o)}finally{t.f()}}},{key:"_removeManipulationDOM",value:function(){this._clean(),Zr(this.manipulationDiv),Zr(this.editModeDiv),Zr(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}},{key:"_createSeperator",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}},{key:"_createAddNodeButton",value:function(e){var t,n=this._createButton("addNode","vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.addNodeMode).call(t,this))}},{key:"_createAddEdgeButton",value:function(e){var t,n=this._createButton("addEdge","vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.addEdgeMode).call(t,this))}},{key:"_createEditNodeButton",value:function(e){var t,n=this._createButton("editNode","vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.editNode).call(t,this))}},{key:"_createEditEdgeButton",value:function(e){var t,n=this._createButton("editEdge","vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.editEdgeMode).call(t,this))}},{key:"_createDeleteButton",value:function(e){var t,n;this.options.rtl?n="vis-delete-rtl":n="vis-delete";var a=this._createButton("delete",n,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(a),this._bindElementEvents(a,k(t=this.deleteSelected).call(t,this))}},{key:"_createBackButton",value:function(e){var t,n=this._createButton("back","vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.showManipulatorToolbar).call(t,this))}},{key:"_createButton",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("button"),this.manipulationDOM[e+"Div"].className="vis-button "+t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=a,this.manipulationDOM[e+"Label"].innerText=n,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}},{key:"_createDescription",value:function(e){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}},{key:"_temporaryBindEvent",value:function(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}},{key:"_temporaryBindUI",value:function(e,t){if(this.body.eventListeners[e]!==void 0)this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t;else throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+ls(Oe(this.body.eventListeners)))}},{key:"_unbindTemporaryUIs",value:function(){for(var e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}},{key:"_unbindTemporaryEvents",value:function(){for(var e=0;e=0;u--)if(o[u]!==this.selectedControlNode.id){s=this.body.nodes[o[u]];break}if(s!==void 0&&this.selectedControlNode!==void 0)if(s.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var l=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===l.id?this._performEditEdge(s.id,a.to.id):this._performEditEdge(a.from.id,s.id)}else a.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}}},{key:"_handleConnect",value:function(e){if(new Date().valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=Le({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;var t=this.lastTouch,n=this.selectionHandler.getNodeAt(t);if(n!==void 0)if(n.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var a=this._getNewTargetNode(n.x,n.y);this.body.nodes[a.id]=a,this.body.nodeIndices.push(a.id);var o=this.body.functions.createEdge({id:"connectionEdge"+no(),from:n.id,to:a.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[o.id]=o,this.body.edgeIndices.push(o.id),this.temporaryIds.nodes.push(a.id),this.temporaryIds.edges.push(o.id)}this.touchTime=new Date().valueOf()}}},{key:"_dragControlNode",value:function(e){var t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),a=void 0;this.temporaryIds.edges[0]!==void 0&&(a=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var o=this.selectionHandler._getAllNodesOverlappingWith(n),s=void 0,u=o.length-1;u>=0;u--){var l;if(ne(l=this.temporaryIds.nodes).call(l,o[u])===-1){s=this.body.nodes[o[u]];break}}if(e.controlEdge={from:a,to:s?s.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",e,t),this.temporaryIds.nodes[0]!==void 0){var h=this.body.nodes[this.temporaryIds.nodes[0]];h.x=this.canvas._XconvertDOMtoCanvas(t.x),h.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(e)}},{key:"_finishConnect",value:function(e){var t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),a=void 0;this.temporaryIds.edges[0]!==void 0&&(a=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var o=this.selectionHandler._getAllNodesOverlappingWith(n),s=void 0,u=o.length-1;u>=0;u--){var l;if(ne(l=this.temporaryIds.nodes).call(l,o[u])===-1){s=this.body.nodes[o[u]];break}}this._cleanupTemporaryNodesAndEdges(),s!==void 0&&(s.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):this.body.nodes[a]!==void 0&&this.body.nodes[s.id]!==void 0&&this._performAddEdge(a,s.id)),e.controlEdge={from:a,to:s?s.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",e,t),this.body.emitter.emit("_redraw")}},{key:"_dragStartEdge",value:function(e){var t=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",e,t,void 0,!0)}},{key:"_performAddNode",value:function(e){var t=this,n={id:no(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if(typeof this.options.addNode=="function")if(this.options.addNode.length===2)this.options.addNode(n,function(a){a!=null&&t.inMode==="addNode"&&t.body.data.nodes.getDataSet().add(a),t.showManipulatorToolbar()});else throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");else this.body.data.nodes.getDataSet().add(n),this.showManipulatorToolbar()}},{key:"_performAddEdge",value:function(e,t){var n=this,a={from:e,to:t};if(typeof this.options.addEdge=="function")if(this.options.addEdge.length===2)this.options.addEdge(a,function(o){o!=null&&n.inMode==="addEdge"&&(n.body.data.edges.getDataSet().add(o),n.selectionHandler.unselectAll(),n.showManipulatorToolbar())});else throw new Error("The function for connect does not support two arguments (data,callback)");else this.body.data.edges.getDataSet().add(a),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}},{key:"_performEditEdge",value:function(e,t){var n=this,a={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges.get(this.edgeBeingEditedId).label},o=this.options.editEdge;if(de(o)==="object"&&(o=o.editWithoutDrag),typeof o=="function")if(o.length===2)o(a,function(s){s==null||n.inMode!=="editEdge"?(n.body.edges[a.id].updateEdgeType(),n.body.emitter.emit("_redraw"),n.showManipulatorToolbar()):(n.body.data.edges.getDataSet().update(s),n.selectionHandler.unselectAll(),n.showManipulatorToolbar())});else throw new Error("The function for edit does not support two arguments (data, callback)");else this.body.data.edges.getDataSet().update(a),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}]),i}(),A="string",I="boolean",w="number",Ya="array",H="object",ZT="dom",kpe="any",bd=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],$d={borderWidth:{number:w},borderWidthSelected:{number:w,undefined:"undefined"},brokenImage:{string:A,undefined:"undefined"},chosen:{label:{boolean:I,function:"function"},node:{boolean:I,function:"function"},__type__:{object:H,boolean:I}},color:{border:{string:A},background:{string:A},highlight:{border:{string:A},background:{string:A},__type__:{object:H,string:A}},hover:{border:{string:A},background:{string:A},__type__:{object:H,string:A}},__type__:{object:H,string:A}},opacity:{number:w,undefined:"undefined"},fixed:{x:{boolean:I},y:{boolean:I},__type__:{object:H,boolean:I}},font:{align:{string:A},color:{string:A},size:{number:w},face:{string:A},background:{string:A},strokeWidth:{number:w},strokeColor:{string:A},vadjust:{number:w},multi:{boolean:I,string:A},bold:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},boldital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},ital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},mono:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},__type__:{object:H,string:A}},group:{string:A,number:w,undefined:"undefined"},heightConstraint:{minimum:{number:w},valign:{string:A},__type__:{object:H,boolean:I,number:w}},hidden:{boolean:I},icon:{face:{string:A},code:{string:A},size:{number:w},color:{string:A},weight:{string:A,number:w},__type__:{object:H}},id:{string:A,number:w},image:{selected:{string:A,undefined:"undefined"},unselected:{string:A,undefined:"undefined"},__type__:{object:H,string:A}},imagePadding:{top:{number:w},right:{number:w},bottom:{number:w},left:{number:w},__type__:{object:H,number:w}},label:{string:A,undefined:"undefined"},labelHighlightBold:{boolean:I},level:{number:w,undefined:"undefined"},margin:{top:{number:w},right:{number:w},bottom:{number:w},left:{number:w},__type__:{object:H,number:w}},mass:{number:w},physics:{boolean:I},scaling:{min:{number:w},max:{number:w},label:{enabled:{boolean:I},min:{number:w},max:{number:w},maxVisible:{number:w},drawThreshold:{number:w},__type__:{object:H,boolean:I}},customScalingFunction:{function:"function"},__type__:{object:H}},shadow:{enabled:{boolean:I},color:{string:A},size:{number:w},x:{number:w},y:{number:w},__type__:{object:H,boolean:I}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:I,array:Ya},borderRadius:{number:w},interpolation:{boolean:I},useImageSize:{boolean:I},useBorderWithImage:{boolean:I},coordinateOrigin:{string:["center","top-left"]},__type__:{object:H}},size:{number:w},title:{string:A,dom:ZT,undefined:"undefined"},value:{number:w,undefined:"undefined"},widthConstraint:{minimum:{number:w},maximum:{number:w},__type__:{object:H,boolean:I,number:w}},x:{number:w},y:{number:w},__type__:{object:H}},Ppe={configure:{enabled:{boolean:I},filter:{boolean:I,string:A,array:Ya,function:"function"},container:{dom:ZT},showButton:{boolean:I},__type__:{object:H,boolean:I,string:A,array:Ya,function:"function"}},edges:{arrows:{to:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageHeight:{number:w},imageWidth:{number:w},src:{string:A},__type__:{object:H,boolean:I}},middle:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageWidth:{number:w},imageHeight:{number:w},src:{string:A},__type__:{object:H,boolean:I}},from:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageWidth:{number:w},imageHeight:{number:w},src:{string:A},__type__:{object:H,boolean:I}},__type__:{string:["from","to","middle"],object:H}},endPointOffset:{from:{number:w},to:{number:w},__type__:{object:H,number:w}},arrowStrikethrough:{boolean:I},background:{enabled:{boolean:I},color:{string:A},size:{number:w},dashes:{boolean:I,array:Ya},__type__:{object:H,boolean:I}},chosen:{label:{boolean:I,function:"function"},edge:{boolean:I,function:"function"},__type__:{object:H,boolean:I}},color:{color:{string:A},highlight:{string:A},hover:{string:A},inherit:{string:["from","to","both"],boolean:I},opacity:{number:w},__type__:{object:H,string:A}},dashes:{boolean:I,array:Ya},font:{color:{string:A},size:{number:w},face:{string:A},background:{string:A},strokeWidth:{number:w},strokeColor:{string:A},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:w},multi:{boolean:I,string:A},bold:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},boldital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},ital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},mono:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},__type__:{object:H,string:A}},hidden:{boolean:I},hoverWidth:{function:"function",number:w},label:{string:A,undefined:"undefined"},labelHighlightBold:{boolean:I},length:{number:w,undefined:"undefined"},physics:{boolean:I},scaling:{min:{number:w},max:{number:w},label:{enabled:{boolean:I},min:{number:w},max:{number:w},maxVisible:{number:w},drawThreshold:{number:w},__type__:{object:H,boolean:I}},customScalingFunction:{function:"function"},__type__:{object:H}},selectionWidth:{function:"function",number:w},selfReferenceSize:{number:w},selfReference:{size:{number:w},angle:{number:w},renderBehindTheNode:{boolean:I},__type__:{object:H}},shadow:{enabled:{boolean:I},color:{string:A},size:{number:w},x:{number:w},y:{number:w},__type__:{object:H,boolean:I}},smooth:{enabled:{boolean:I},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:w},forceDirection:{string:["horizontal","vertical","none"],boolean:I},__type__:{object:H,boolean:I}},title:{string:A,undefined:"undefined"},width:{number:w},widthConstraint:{maximum:{number:w},__type__:{object:H,boolean:I,number:w}},value:{number:w,undefined:"undefined"},__type__:{object:H}},groups:{useDefaultGroups:{boolean:I},__any__:$d,__type__:{object:H}},interaction:{dragNodes:{boolean:I},dragView:{boolean:I},hideEdgesOnDrag:{boolean:I},hideEdgesOnZoom:{boolean:I},hideNodesOnDrag:{boolean:I},hover:{boolean:I},keyboard:{enabled:{boolean:I},speed:{x:{number:w},y:{number:w},zoom:{number:w},__type__:{object:H}},bindToWindow:{boolean:I},autoFocus:{boolean:I},__type__:{object:H,boolean:I}},multiselect:{boolean:I},navigationButtons:{boolean:I},selectable:{boolean:I},selectConnectedEdges:{boolean:I},hoverConnectedEdges:{boolean:I},tooltipDelay:{number:w},zoomView:{boolean:I},zoomSpeed:{number:w},__type__:{object:H}},layout:{randomSeed:{undefined:"undefined",number:w,string:A},improvedLayout:{boolean:I},clusterThreshold:{number:w},hierarchical:{enabled:{boolean:I},levelSeparation:{number:w},nodeSpacing:{number:w},treeSpacing:{number:w},blockShifting:{boolean:I},edgeMinimization:{boolean:I},parentCentralization:{boolean:I},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:H,boolean:I}},__type__:{object:H}},manipulation:{enabled:{boolean:I},initiallyActive:{boolean:I},addNode:{boolean:I,function:"function"},addEdge:{boolean:I,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:H,boolean:I,function:"function"}},deleteNode:{boolean:I,function:"function"},deleteEdge:{boolean:I,function:"function"},controlNodeStyle:$d,__type__:{object:H,boolean:I}},nodes:$d,physics:{enabled:{boolean:I},barnesHut:{theta:{number:w},gravitationalConstant:{number:w},centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},forceAtlas2Based:{theta:{number:w},gravitationalConstant:{number:w},centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},repulsion:{centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},nodeDistance:{number:w},damping:{number:w},__type__:{object:H}},hierarchicalRepulsion:{centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},nodeDistance:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},maxVelocity:{number:w},minVelocity:{number:w},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:I},iterations:{number:w},updateInterval:{number:w},onlyDynamicEdges:{boolean:I},fit:{boolean:I},__type__:{object:H,boolean:I}},timestep:{number:w},adaptiveTimestep:{boolean:I},wind:{x:{number:w},y:{number:w},__type__:{object:H}},__type__:{object:H,boolean:I}},autoResize:{boolean:I},clickToUse:{boolean:I},locale:{string:A},locales:{__any__:{any:kpe},__type__:{object:H}},height:{string:A},width:{string:A},__type__:{object:H}},QT={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:["color","#2B7CE9"],background:["color","#97C2FC"],highlight:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]},hover:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[0,0,50,1],strokeColor:["color","#ffffff"]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:["ellipse","box","circle","database","diamond","dot","square","star","text","triangle","triangleDown","hexagon"],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:["color","#848484"],highlight:["color","#848484"],hover:["color","#848484"],inherit:["from","to","both",!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[2,0,50,1],strokeColor:["color","#ffffff"],align:["horizontal","top","middle","bottom"]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"],forceDirection:["horizontal","vertical","none"],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:["UD","DU","LR","RL"],sortMethod:["hubsize","directed"],shakeTowards:["leaves","roots"]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0,autoFocus:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:["barnesHut","forceAtlas2Based","repulsion","hierarchicalRepulsion"],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},xpe=function(r,e,t){var n;return!!(hi(r).call(r,"physics")&&hi(n=QT.physics.solver).call(n,e)&&t.physics.solver!==e&&e!=="wind")},Cpe=function(){function i(){N(this,i)}return M(i,[{key:"getDistances",value:function(e,t,n){for(var a={},o=e.edges,s=0;s2&&arguments[2]!==void 0?arguments[2]:!1,a=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(a),this._createK_matrix(a),this._createE_matrix();for(var o=.01,s=1,u=0,l=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),h=5,c=1e9,d=0,f=0,v=0,p=0,g=0;c>o&&us&&gy.type==="downstream_subgraph_search")?.data||[],f=y=>{const m=y.json.nodes.map(b=>({id:b.id,label:b.type,color:{background:"#2B7CE9",border:"#1B5BB1"},font:{size:16,color:"#FFFFFF",face:"arial",bold:!0},margin:12,padding:10,shape:"box",widthConstraint:{minimum:100,maximum:200}})),$=y.json.links.map(b=>({from:b.origin_id,to:b.target_id,arrows:{to:{enabled:!0,scaleFactor:1.2}},color:"#000000",width:2}));return{nodes:m,edges:$}};We.useEffect(()=>()=>{c.current&&(c.current.destroy(),c.current=null)},[]);const v=We.useCallback((y,m)=>{c.current&&c.current.destroy();const $=f(m),b=new z(y,$,{nodes:{shape:"box",margin:12,padding:10,font:{size:16,color:"#FFFFFF",face:"arial",bold:!0},borderWidth:2,shadow:{enabled:!0,color:"rgba(0,0,0,0.2)",size:5}},edges:{arrows:"to",color:"#000000",width:2,smooth:{enabled:!0,type:"straightCross"}},physics:{enabled:!0,solver:"hierarchicalRepulsion",hierarchicalRepulsion:{nodeDistance:200,springLength:200}},layout:{hierarchical:{enabled:!0,direction:"UD",sortMethod:"directed",nodeSpacing:200,levelSeparation:150}},interaction:{dragNodes:!1,zoomView:!1,dragView:!1}});c.current=b},[]),p=async y=>{console.log("[DownstreamSubgraphs] Starting checkAndLoadSubgraph with node:",y),ai.trackEvent({event_type:"subgraph_accept",message_type:"subgraph",message_id:u.message_id,data:{subgraph_name:y.name,subgraph_tags:y.tags}});const m=y.json.nodes,$=Object.values(Mt.canvas.selected_nodes)[0];if(!$){console.warn("[DownstreamSubgraphs] No node selected"),alert("Please select a upstream node first before adding a subgraph.");return}const b=m.map(D=>D.type),O=s;console.log("[DownstreamSubgraphs] Required node types:",b),console.log("[DownstreamSubgraphs] Installed node types:",O);const _=b.filter(D=>!O.includes(D));if(console.log("[DownstreamSubgraphs] Missing node types:",_),_.length>0)try{console.log("[DownstreamSubgraphs] Fetching info for missing nodes");const D=await ai.batchGetNodeInfo(_);console.log("[DownstreamSubgraphs] Received node infos:",D);const R={text:"",ext:[{type:"node_install_guide",data:D.map(B=>({name:B.name,repository_url:B.github_url}))}]};console.log("[DownstreamSubgraphs] Created message content:",R);const P={id:dr(),role:"ai",content:JSON.stringify(R),format:"markdown",name:"Assistant",metadata:{pendingSubgraph:y}};console.log("[DownstreamSubgraphs] Created AI message:",P),t?.(P);return}catch(D){console.error("[DownstreamSubgraphs] Error fetching node info:",D),alert("Error checking required nodes. Please try again.");return}console.log("[DownstreamSubgraphs] All required nodes are installed, proceeding to load subgraph"),g(y,$)},g=(y,m)=>{const $=y.json.nodes,b=y.json.links,O=$.find(R=>R.id===0),_=O?.id;console.log("[DownstreamSubgraphs] Entry node ID:",_);const D={};_!==null&&(D[_]=m),Mt.canvas.emitBeforeChange();try{for(const R of $)if(R.id!==_){const P=O?.pos,B=[m._pos[0],m._pos[1]],j=[R.pos[0]+B[0]-P[0],R.pos[1]+B[1]-P[1]];D[R.id]=X$(R.type,{pos:j})}for(const R of b){const P=D[R.origin_id],B=D[R.target_id];P&&B&&P.connect(R.origin_slot,B,R.target_slot)}}finally{Mt.canvas.emitAfterChange()}};return We.useEffect(()=>{const y=()=>{const m=Mt.canvas.selected_nodes;Object.keys(m??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values(m)}):a({type:"SET_SELECTED_NODE",payload:null})};return document.addEventListener("click",y),()=>{document.removeEventListener("click",y)}},[]),S.jsx("div",{className:"rounded-lg bg-gray-500 p-3 text-gray-700 text-xs break-words overflow-visible",children:d.length>0&&S.jsx("div",{className:"space-y-3",children:S.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(y=>S.jsxs("div",{className:"relative group",children:[S.jsx("button",{className:`px-3 py-1.5 bg-blue-500 text-white rounded-md hover:bg-blue-600 transition-colors text-xs`,onClick:()=>p(y),onMouseEnter:()=>h(y.name),onMouseLeave:()=>h(null),children:y.name}),S.jsxs("p",{className:"text-xs ml-3 text-white",children:["[",y.tags.join(", "),"]"]}),l===y.name&&S.jsx("div",{className:`fixed -translate-y-full z-[9999] w-[500px] p-4 bg-gray-800 text-white text-xs - rounded-md shadow-lg mb-2 border border-gray-700`,style:{left:"calc(var(--mouse-x, 0) + 16px)",top:"calc(var(--mouse-y, 0) - 8px)"},children:S.jsx("div",{style:{width:"100%",height:"300px"},ref:m=>{m&&v(m,y)}})})]},y.name))})})})}const Vpe=Object.freeze(Object.defineProperty({__proto__:null,DownstreamSubgraphs:Ape},Symbol.toStringTag,{value:"Module"}));function Dpe({content:i,onLoadSubgraph:r}){const n=(JSON.parse(i).ext?.find(a=>a.type==="node_install_guide")?.data||[]).reduce((a,o)=>(a.some(s=>s.name===o.name)||a.push(o),a),[]);return S.jsxs("div",{children:[S.jsx("p",{children:"Before loading the graph to canvas, the following nodes need to be installed. Please visit the corresponding GitHub repositories to install them:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:n.map((a,o)=>S.jsx("div",{className:`w-full p-3 rounded-lg border border-gray-200 + rounded-md shadow-lg mb-2 border border-gray-700`,style:{left:"calc(var(--mouse-x, 0) + 16px)",top:"calc(var(--mouse-y, 0) - 8px)"},children:S.jsx("div",{style:{width:"100%",height:"300px"},ref:m=>{m&&v(m,y)}})})]},y.name))})})})}const Wpe=Object.freeze(Object.defineProperty({__proto__:null,DownstreamSubgraphs:Dpe},Symbol.toStringTag,{value:"Module"}));function Rpe({content:i,onLoadSubgraph:r}){const n=(JSON.parse(i).ext?.find(a=>a.type==="node_install_guide")?.data||[]).reduce((a,o)=>(a.some(s=>s.name===o.name)||a.push(o),a),[]);return S.jsxs("div",{children:[S.jsx("p",{children:"Before loading the graph to canvas, the following nodes need to be installed. Please visit the corresponding GitHub repositories to install them:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:n.map((a,o)=>S.jsx("div",{className:`w-full p-3 rounded-lg border border-gray-200 hover:shadow-sm transition-all duration-200`,children:S.jsxs("div",{className:"flex flex-col",children:[S.jsx("h3",{className:"text-[12px] font-medium text-gray-800 mb-4",children:a.name}),S.jsx("div",{className:"flex justify-end",children:a.repository_url?S.jsxs("a",{href:a.repository_url,target:"_blank",rel:"noopener noreferrer",className:`px-2 py-1 text-gray-900 rounded-md border border-gray-900 hover:bg-gray-100 transition-colors text-[10px] flex items-center gap-1`,children:[S.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}):S.jsxs("a",{href:`https://www.google.com/search?q=${encodeURIComponent(a.name+" comfyui custom node")}`,target:"_blank",rel:"noopener noreferrer",className:`px-2 py-1 bg-gray-100 text-gray-500 rounded-md border border-gray-300 text-[10px] flex items-center gap-1`,children:[S.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 21h7a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v11m0 5l4.879-4.879m0 0a3 3 0 104.243-4.242 3 3 0 00-4.243 4.242z"})}),"Search on Google"]})})]})},o))}),S.jsx("p",{className:"mt-4"}),S.jsx("p",{children:"After installation, please click the continue loading graph button to load the graph to the canvas:"}),S.jsx("div",{className:"mt-4",children:S.jsx("button",{className:`px-3 py-2 bg-blue-500 text-white rounded-md - hover:bg-blue-600 transition-colors text-xs block mx-auto`,onClick:r,children:"Loading graph directly"})})]})}const Wpe=Object.freeze(Object.defineProperty({__proto__:null,NodeInstallGuide:Dpe},Symbol.toStringTag,{value:"Module"}));export{zpe as A,Y$ as B,Bpe as C,Vpe as D,BI as M,Hpe as N,Lpe as U,ai as W,Mt as a,X$ as b,oI as c,Wpe as d,Fpe as f,dr as g,uI as u,jpe as v,Mpe as w}; + hover:bg-blue-600 transition-colors text-xs block mx-auto`,onClick:r,children:"Loading graph directly"})})]})}const Upe=Object.freeze(Object.defineProperty({__proto__:null,NodeInstallGuide:Rpe},Symbol.toStringTag,{value:"Module"}));export{Hpe as A,Y$ as B,Fpe as C,Wpe as D,FI as M,Vpe as N,zpe as U,ai as W,Mt as a,X$ as b,oI as c,Upe as d,jpe as f,dr as g,uI as u,Lpe as v,Bpe as w}; diff --git a/dist/copilot_web/workflowChat-DztaEqXX.js b/dist/copilot_web/workflowChat-CIPsWdia.js similarity index 99% rename from dist/copilot_web/workflowChat-DztaEqXX.js rename to dist/copilot_web/workflowChat-CIPsWdia.js index 8397028..384676f 100644 --- a/dist/copilot_web/workflowChat-DztaEqXX.js +++ b/dist/copilot_web/workflowChat-CIPsWdia.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-Ci2jcBGf.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"])))=>i.map(i=>d[i]); -import{_ as Ot}from"./input.js";import{j as h,r as xg,b as yg}from"./vendor-markdown-Dek94WS0.js";import{r as I,R as wn,c as Rt}from"./vendor-react-V04_Axys.js";import{f as wg,v as bg,W as ft,a as fn,B as Sg,U as Ag,A as Er,b as Eg,g as en,c as Mt,u as ts,M as Ig}from"./message-components-BQDbTDiL.js";/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-WINGBPvy.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DHp7C_am.js","copilot_web/ParameterDebugInterfaceV2-DfZJN3da.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"])))=>i.map(i=>d[i]); +import{_ as Ot}from"./input.js";import{j as h,r as xg,b as yg}from"./vendor-markdown-Dek94WS0.js";import{r as I,R as wn,c as Rt}from"./vendor-react-V04_Axys.js";import{f as wg,v as bg,W as ft,a as fn,B as Sg,U as Ag,A as Er,b as Eg,g as en,c as Mt,u as ts,M as Ig}from"./message-components-DHp7C_am.js";/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. @@ -100,7 +100,7 @@ ${de.join(` hover:bg-gray-50`,children:"Close"})})]})})]})}function Hg(m){const b=m[0],a=new Set;function U(M,E){if(!(!M||E>=1)&&M.inputs)for(const W of Object.values(M.inputs)){const re=W.link;if(re&&fn.graph.links[re]){const y=fn.graph.links[re].origin_id,q=fn.graph._nodes_by_id[y];q&&(a.add(q.type),U(q,E+1))}}}return b?(U(b,0),[{type:"upstream_node_types",data:Array.from(a)}]):null}function qg({nodeInfo:m,onSendWithIntent:b,loading:a,onSendWithContent:U}){return console.log("SelectedNodeInfo nodeInfo:",m[0]),h.jsx("div",{className:"mb-3 p-3 rounded-md bg-gray-50 border border-gray-200",children:h.jsxs("div",{className:"text-sm text-gray-700",children:[h.jsxs("p",{children:["Selected node: ",m[0].type]}),h.jsxs("div",{className:"flex gap-2 mt-2",children:[h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-blue-50 text-blue-700 hover:bg-blue-100`,onClick:()=>U(`Reply in ${navigator.language} language: How does the ${m[0].type} node work? I need its official usage guide.`),disabled:a,children:"Usage"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-green-100 text-green-700 hover:bg-green-200`,onClick:()=>U(`Reply in ${navigator.language} language: Show me the technical specifications for the ${m[0].type} node's inputs and outputs.`),disabled:a,children:"Parameters"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-purple-100 - text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import("./WorkflowOption-Ci2jcBGf.js"),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import("./message-components-BQDbTDiL.js").then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import("./message-components-BQDbTDiL.js").then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import("./message-components-BQDbTDiL.js").then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** + text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import("./WorkflowOption-WINGBPvy.js"),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import("./message-components-DHp7C_am.js").then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import("./message-components-DHp7C_am.js").then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import("./message-components-DHp7C_am.js").then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors @@ -126,4 +126,4 @@ __p += '`),z&&(v+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+v+`return __p -}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import("./ParameterDebugInterfaceV2-xZYi4DyT.js"),__vite__mapDeps([4,1,2,3,5,6,7])).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w}; +}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import("./ParameterDebugInterfaceV2-DfZJN3da.js"),__vite__mapDeps([4,1,2,3,5,6,7])).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w}; diff --git a/ui/package.json b/ui/package.json index b739dfe..7a4c20e 100644 --- a/ui/package.json +++ b/ui/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "vite build", + "build": "vite build && node scripts/post-build.js", "build:css": "tailwindcss -i ./src/scoped-tailwind.css -o ./src/output.css --watch", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", diff --git a/ui/scripts/post-build.js b/ui/scripts/post-build.js index 6273312..919fd72 100644 --- a/ui/scripts/post-build.js +++ b/ui/scripts/post-build.js @@ -2,7 +2,7 @@ * @Author: ai-business-hql qingli.hql@alibaba-inc.com * @Date: 2025-02-17 20:53:45 * @LastEditors: ai-business-hql qingli.hql@alibaba-inc.com - * @LastEditTime: 2025-06-04 17:16:22 + * @LastEditTime: 2025-06-04 19:22:30 * @FilePath: /comfyui_copilot/ui/scripts/post-build.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -31,36 +31,13 @@ files.forEach(file => { const originalDeps = depsMatch[1]; // 如果文件中还没有路径转换逻辑,则添加 - if (!content.includes('window.location.protocol')) { + if (!content.includes('window.comfyAPI?.api?.api?.api_base')) { content = content.replace( /const __vite__mapDeps=.*?\)=>i\.map\(i=>d\[i\]\);/, `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[${originalDeps}].map(path => { - // 判断是否在代理环境下(如 nebula-notebook) - let baseUrl = ''; - try { - if (window.location && window.location.pathname.includes('/proxy/')) { - // 在代理环境下使用完整路径 - const protocol = window.location.protocol; - const host = window.location.host; - const pathname = window.location.pathname; - baseUrl = \`\${protocol}//\${host}\${pathname}\`; - // 确保路径以 / 结尾 - if (!baseUrl.endsWith('/')) { - baseUrl += '/'; - } - } else { - // 在本地环境下使用相对路径或API base - const apiBase = window.comfyAPI?.api?.api?.api_base; - baseUrl = apiBase ? \`\${apiBase.substring(1)}/\` : ''; - } - } catch (e) { - console.warn('Failed to get base URL:', e); - // 回退到原来的方式 - const apiBase = window.comfyAPI?.api?.api?.api_base; - baseUrl = apiBase ? \`\${apiBase.substring(1)}/\` : ''; - } - - return \`\${baseUrl}\${path}\`; + const apiBase = window.comfyAPI?.api?.api?.api_base; + const prefix = apiBase ? \`\${apiBase.substring(1)}/\` : ''; + return \`\${prefix}\${path}\`; }))))=>i.map(i=>d[i]);` ); } else { @@ -76,7 +53,35 @@ files.forEach(file => { } else { console.log(`No deps pattern found in ${path.basename(file)}`); } + } + + // 处理直接的 import() 调用 + if (content.includes('import("./')) { + // 添加路径转换函数(如果还没有) + if (!content.includes('function getImportPath')) { + const pathTransformFunction = ` +const getImportPath = (relativePath) => { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用绝对路径 + const prefix = apiBase.substring(1); // 移除开头的 / + return \`/\${prefix}/copilot_web/\${relativePath}\`; } else { - console.log(`No __vite__mapDeps found in ${path.basename(file)}`); + // 没有 API base 时,使用相对路径 + return \`./\${relativePath}\`; + } +};`; + content = pathTransformFunction + content; + } + + // 替换所有直接的 import() 调用,保留相对路径前缀 + content = content.replace(/import\("\.\/([^"]+)"\)/g, 'import(getImportPath("$1"))'); + + fs.writeFileSync(file, content, 'utf-8'); + console.log(`Modified direct import() calls in ${path.basename(file)}`); + } + + if (!content.includes('__vite__mapDeps') && !content.includes('import("./')) { + console.log(`No __vite__mapDeps or direct imports found in ${path.basename(file)}`); } }); \ No newline at end of file From 8db6c209d1340d9fe79ea52ae7064790d837774d Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Wed, 4 Jun 2025 20:13:27 +0800 Subject: [PATCH 08/14] =?UTF-8?q?feat:=E8=A7=A3=E5=86=B3dynamic=20import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/copilot_web/App-Bjq6Zxw-.js | 21 ++++ dist/copilot_web/App-ByZR41yl.js | 17 --- ... => ParameterDebugInterfaceV2-xZYi4DyT.js} | 12 +- ...WINGBPvy.js => WorkflowOption-Ci2jcBGf.js} | 12 +- dist/copilot_web/input.js | 23 +++- ...C_am.js => message-components-BQDbTDiL.js} | 84 +++++++------- dist/copilot_web/vendor-markdown-Dek94WS0.js | 10 ++ dist/copilot_web/vendor-react-V04_Axys.js | 10 ++ dist/copilot_web/vendor-ui-Dzvx2fKw.js | 10 ++ ...t-CIPsWdia.js => workflowChat-DztaEqXX.js} | 27 ++++- ui/scripts/post-build.js | 103 ++++++++++-------- 11 files changed, 220 insertions(+), 109 deletions(-) create mode 100644 dist/copilot_web/App-Bjq6Zxw-.js delete mode 100644 dist/copilot_web/App-ByZR41yl.js rename dist/copilot_web/{ParameterDebugInterfaceV2-DfZJN3da.js => ParameterDebugInterfaceV2-xZYi4DyT.js} (99%) rename dist/copilot_web/{WorkflowOption-WINGBPvy.js => WorkflowOption-Ci2jcBGf.js} (91%) rename dist/copilot_web/{message-components-DHp7C_am.js => message-components-BQDbTDiL.js} (80%) rename dist/copilot_web/{workflowChat-CIPsWdia.js => workflowChat-DztaEqXX.js} (87%) diff --git a/dist/copilot_web/App-Bjq6Zxw-.js b/dist/copilot_web/App-Bjq6Zxw-.js new file mode 100644 index 0000000..cceb5c1 --- /dev/null +++ b/dist/copilot_web/App-Bjq6Zxw-.js @@ -0,0 +1,21 @@ +function getImportPath(filename) { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return `${apiBase.substring(1)}/copilot_web/${filename}`; + } else { + // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) + return `./${filename}`; + } +} +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-DztaEqXX.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return `${apiBase.substring(1)}/${path}`; + } else { + // 没有 API base 时,使用相对路径 + return `./${path}`; + } + }))))=>i.map(i=>d[i]); +import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-BQDbTDiL.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-DztaEqXX.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/dist/copilot_web/App-ByZR41yl.js b/dist/copilot_web/App-ByZR41yl.js deleted file mode 100644 index ec241c6..0000000 --- a/dist/copilot_web/App-ByZR41yl.js +++ /dev/null @@ -1,17 +0,0 @@ - -const getImportPath = (relativePath) => { - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase) { - // 有 API base 时,使用绝对路径 - const prefix = apiBase.substring(1); // 移除开头的 / - return `/${prefix}/copilot_web/${relativePath}`; - } else { - // 没有 API base 时,使用相对路径 - return `./${relativePath}`; - } -};const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-CIPsWdia.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DHp7C_am.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { - const apiBase = window.comfyAPI?.api?.api?.api_base; - const prefix = apiBase ? `${apiBase.substring(1)}/` : ''; - return `${prefix}${path}`; - }))))=>i.map(i=>d[i]); -import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-DHp7C_am.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-CIPsWdia.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/dist/copilot_web/ParameterDebugInterfaceV2-DfZJN3da.js b/dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js similarity index 99% rename from dist/copilot_web/ParameterDebugInterfaceV2-DfZJN3da.js rename to dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js index 2def542..0820ff3 100644 --- a/dist/copilot_web/ParameterDebugInterfaceV2-DfZJN3da.js +++ b/dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js @@ -1,4 +1,14 @@ -import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-DHp7C_am.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-CIPsWdia.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white +function getImportPath(filename) { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return `${apiBase.substring(1)}/copilot_web/${filename}`; + } else { + // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) + return `./${filename}`; + } +} +import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-BQDbTDiL.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-DztaEqXX.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white bg-gray-50 dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-400 diff --git a/dist/copilot_web/WorkflowOption-WINGBPvy.js b/dist/copilot_web/WorkflowOption-Ci2jcBGf.js similarity index 91% rename from dist/copilot_web/WorkflowOption-WINGBPvy.js rename to dist/copilot_web/WorkflowOption-Ci2jcBGf.js index 9fa4e33..aa78132 100644 --- a/dist/copilot_web/WorkflowOption-WINGBPvy.js +++ b/dist/copilot_web/WorkflowOption-Ci2jcBGf.js @@ -1 +1,11 @@ -import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-DHp7C_am.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; +function getImportPath(filename) { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return `${apiBase.substring(1)}/copilot_web/${filename}`; + } else { + // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) + return `./${filename}`; + } +} +import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-BQDbTDiL.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; diff --git a/dist/copilot_web/input.js b/dist/copilot_web/input.js index fc60c55..c219db7 100644 --- a/dist/copilot_web/input.js +++ b/dist/copilot_web/input.js @@ -1,2 +1,21 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-ByZR41yl.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DHp7C_am.js","copilot_web/fonts.css"])))=>i.map(i=>d[i]); -import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-DHp7C_am.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import("./App-ByZR41yl.js");return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; +function getImportPath(filename) { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return `${apiBase.substring(1)}/copilot_web/${filename}`; + } else { + // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) + return `./${filename}`; + } +} +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-Bjq6Zxw-.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/fonts.css"].map(path => { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return `${apiBase.substring(1)}/${path}`; + } else { + // 没有 API base 时,使用相对路径 + return `./${path}`; + } + }))))=>i.map(i=>d[i]); +import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-BQDbTDiL.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import(getImportPath("App-Bjq6Zxw-.js"));return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; diff --git a/dist/copilot_web/message-components-DHp7C_am.js b/dist/copilot_web/message-components-BQDbTDiL.js similarity index 80% rename from dist/copilot_web/message-components-DHp7C_am.js rename to dist/copilot_web/message-components-BQDbTDiL.js index 01f3091..880ba81 100644 --- a/dist/copilot_web/message-components-DHp7C_am.js +++ b/dist/copilot_web/message-components-BQDbTDiL.js @@ -1,11 +1,21 @@ -import{r as We,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Bpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=We.createContext({state:W$,dispatch:()=>null});function Fpe({children:i}){const[r,e]=We.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=We.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const lI="http://localhost:8000",Ff={apiBaseUrl:lI};function dr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var hI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return hI.charAt(i)}function cI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function dI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function fI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,vI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f +function getImportPath(filename) { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return `${apiBase.substring(1)}/copilot_web/${filename}`; + } else { + // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) + return `./${filename}`; + } +} +import{r as We,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Mpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=We.createContext({state:W$,dispatch:()=>null});function Bpe({children:i}){const[r,e]=We.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=We.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const Ff={apiBaseUrl:"https://comfyui-copilot-server-pre.onrender.com"};function dr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var lI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return lI.charAt(i)}function hI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function cI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function dI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,fI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f \r  \u2028\u2029`;for(pn={},r=0;r<16;++r)pn[e.charAt(r)]=r;for(e=e.toLowerCase(),r=10;r<16;++r)pn[e.charAt(r)]=r;for(r=0;r=2?(n[n.length]=a,a=0,o=0):a<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},Ii,wd={decode:function(i){var r;if(Ii===void 0){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=`= \f -\r  \u2028\u2029`;for(Ii=Object.create(null),r=0;r<64;++r)Ii[e.charAt(r)]=r;for(Ii["-"]=62,Ii._=63,r=0;r=4?(n[n.length]=a>>16,n[n.length]=a>>8&255,n[n.length]=a&255,a=0,o=0):a<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=a>>10;break;case 3:n[n.length]=a>>16,n[n.length]=a>>8&255;break}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(i){var r=wd.re.exec(i);if(r)if(r[1])i=r[1];else if(r[2])i=r[2];else throw new Error("RegExp out of sync");return wd.decode(i)}},gn=1e13,Ua=function(){function i(r){this.buf=[+r||0]}return i.prototype.mulAdd=function(r,e){var t=this.buf,n=t.length,a,o;for(a=0;a0&&(t[a]=e)},i.prototype.sub=function(r){var e=this.buf,t=e.length,n,a;for(n=0;n=0;--n)t+=(gn+e[n]).toString().substring(1);return t},i.prototype.valueOf=function(){for(var r=this.buf,e=0,t=r.length-1;t>=0;--t)e=e*gn+r[t];return e},i.prototype.simplify=function(){var r=this.buf;return r.length==1?r[0]:this},i}(),G$="…",pI=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,gI=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Wn(i,r){return i.length>r&&(i=i.substring(0,r)+G$),i}var nh=function(){function i(r,e){this.hexDigits="0123456789ABCDEF",r instanceof i?(this.enc=r.enc,this.pos=r.pos):(this.enc=r,this.pos=e)}return i.prototype.get=function(r){if(r===void 0&&(r=this.pos++),r>=this.enc.length)throw new Error("Requesting byte offset ".concat(r," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(r):this.enc[r]},i.prototype.hexByte=function(r){return this.hexDigits.charAt(r>>4&15)+this.hexDigits.charAt(r&15)},i.prototype.hexDump=function(r,e,t){for(var n="",a=r;a176)return!1}return!0},i.prototype.parseStringISO=function(r,e){for(var t="",n=r;n191&&a<224?t+=String.fromCharCode((a&31)<<6|this.get(n++)&63):t+=String.fromCharCode((a&15)<<12|(this.get(n++)&63)<<6|this.get(n++)&63)}return t},i.prototype.parseStringBMP=function(r,e){for(var t="",n,a,o=r;o127,a=n?255:0,o,s="";t==a&&++r4){for(s=t,o<<=3;!((+s^a)&128);)s=+s<<1,--o;s="("+o+` bit) +\r  \u2028\u2029`;for(Ii=Object.create(null),r=0;r<64;++r)Ii[e.charAt(r)]=r;for(Ii["-"]=62,Ii._=63,r=0;r=4?(n[n.length]=a>>16,n[n.length]=a>>8&255,n[n.length]=a&255,a=0,o=0):a<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=a>>10;break;case 3:n[n.length]=a>>16,n[n.length]=a>>8&255;break}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(i){var r=wd.re.exec(i);if(r)if(r[1])i=r[1];else if(r[2])i=r[2];else throw new Error("RegExp out of sync");return wd.decode(i)}},gn=1e13,Ua=function(){function i(r){this.buf=[+r||0]}return i.prototype.mulAdd=function(r,e){var t=this.buf,n=t.length,a,o;for(a=0;a0&&(t[a]=e)},i.prototype.sub=function(r){var e=this.buf,t=e.length,n,a;for(n=0;n=0;--n)t+=(gn+e[n]).toString().substring(1);return t},i.prototype.valueOf=function(){for(var r=this.buf,e=0,t=r.length-1;t>=0;--t)e=e*gn+r[t];return e},i.prototype.simplify=function(){var r=this.buf;return r.length==1?r[0]:this},i}(),G$="…",vI=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,pI=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Wn(i,r){return i.length>r&&(i=i.substring(0,r)+G$),i}var nh=function(){function i(r,e){this.hexDigits="0123456789ABCDEF",r instanceof i?(this.enc=r.enc,this.pos=r.pos):(this.enc=r,this.pos=e)}return i.prototype.get=function(r){if(r===void 0&&(r=this.pos++),r>=this.enc.length)throw new Error("Requesting byte offset ".concat(r," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(r):this.enc[r]},i.prototype.hexByte=function(r){return this.hexDigits.charAt(r>>4&15)+this.hexDigits.charAt(r&15)},i.prototype.hexDump=function(r,e,t){for(var n="",a=r;a176)return!1}return!0},i.prototype.parseStringISO=function(r,e){for(var t="",n=r;n191&&a<224?t+=String.fromCharCode((a&31)<<6|this.get(n++)&63):t+=String.fromCharCode((a&15)<<12|(this.get(n++)&63)<<6|this.get(n++)&63)}return t},i.prototype.parseStringBMP=function(r,e){for(var t="",n,a,o=r;o127,a=n?255:0,o,s="";t==a&&++r4){for(s=t,o<<=3;!((+s^a)&128);)s=+s<<1,--o;s="("+o+` bit) `}n&&(t=t-256);for(var u=new Ua(t),l=r+1;l=h;--c)s+=l>>c&1?"1":"0";if(s.length>t)return o+Wn(s,t)}return o+s},i.prototype.parseOctetString=function(r,e,t){if(this.isASCII(r,e))return Wn(this.parseStringISO(r,e),t);var n=e-r,a="("+n+` byte) -`;t/=2,n>t&&(e=r+t);for(var o=r;ot&&(a+=G$),a},i.prototype.parseOID=function(r,e,t){for(var n="",a=new Ua,o=0,s=r;st)return Wn(n,t);a=new Ua,o=0}}return o>0&&(n+=".incomplete"),n},i}(),yI=function(){function i(r,e,t,n,a){if(!(n instanceof _p))throw new Error("Invalid tag value.");this.stream=r,this.header=e,this.length=t,this.tag=n,this.sub=a}return i.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},i.prototype.content=function(r){if(this.tag===void 0)return null;r===void 0&&(r=1/0);var e=this.posContent(),t=Math.abs(this.length);if(!this.tag.isUniversal())return this.sub!==null?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+t,r);switch(this.tag.tagNumber){case 1:return this.stream.get(e)===0?"false":"true";case 2:return this.stream.parseInteger(e,e+t);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+t,r);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+t,r);case 6:return this.stream.parseOID(e,e+t,r);case 16:case 17:return this.sub!==null?"("+this.sub.length+" elem)":"(no elem)";case 12:return Wn(this.stream.parseStringUTF(e,e+t),r);case 18:case 19:case 20:case 21:case 22:case 26:return Wn(this.stream.parseStringISO(e,e+t),r);case 30:return Wn(this.stream.parseStringBMP(e,e+t),r);case 23:case 24:return this.stream.parseTime(e,e+t,this.tag.tagNumber==23)}return null},i.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(this.sub===null?"null":this.sub.length)+"]"},i.prototype.toPrettyString=function(r){r===void 0&&(r="");var e=r+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":this.tag.isUniversal()&&(this.tag.tagNumber==3||this.tag.tagNumber==4)&&this.sub!==null&&(e+=" (encapsulates)"),e+=` -`,this.sub!==null){r+=" ";for(var t=0,n=this.sub.length;t6)throw new Error("Length over 48 bits not supported at position "+(r.pos-1));if(t===0)return null;e=0;for(var n=0;n>6,this.tagConstructed=(e&32)!==0,this.tagNumber=e&31,this.tagNumber==31){var t=new Ua;do e=r.get(),t.mulAdd(128,e&127);while(e&128);this.tagNumber=t.simplify()}}return i.prototype.isUniversal=function(){return this.tagClass===0},i.prototype.isEOC=function(){return this.tagClass===0&&this.tagNumber===0},i}(),ni,mI=0xdeadbeefcafe,Ep=(mI&16777215)==15715070,dt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],bI=(1<<26)/dt[dt.length-1],Q=function(){function i(r,e,t){r!=null&&(typeof r=="number"?this.fromNumber(r,e,t):e==null&&typeof r!="string"?this.fromString(r,256):this.fromString(r,e))}return i.prototype.toString=function(r){if(this.s<0)return"-"+this.negate().toString(r);var e;if(r==16)e=4;else if(r==8)e=3;else if(r==2)e=1;else if(r==32)e=5;else if(r==4)e=2;else return this.toRadix(r);var t=(1<0)for(u>u)>0&&(a=!0,o=Or(n));s>=0;)u>(u+=this.DB-e)):(n=this[s]>>(u-=e)&t,u<=0&&(u+=this.DB,--s)),n>0&&(a=!0),a&&(o+=Or(n));return a?o:"0"},i.prototype.negate=function(){var r=re();return i.ZERO.subTo(this,r),r},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(r){var e=this.s-r.s;if(e!=0)return e;var t=this.t;if(e=t-r.t,e!=0)return this.s<0?-e:e;for(;--t>=0;)if((e=this[t]-r[t])!=0)return e;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+ms(this[this.t-1]^this.s&this.DM)},i.prototype.mod=function(r){var e=re();return this.abs().divRemTo(r,null,e),this.s<0&&e.compareTo(i.ZERO)>0&&r.subTo(e,e),e},i.prototype.modPowInt=function(r,e){var t;return r<256||e.isEven()?t=new Sp(e):t=new Op(e),this.exp(r,t)},i.prototype.clone=function(){var r=re();return this.copyTo(r),r},i.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24},i.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},i.prototype.toByteArray=function(){var r=this.t,e=[];e[0]=this.s;var t=this.DB-r*this.DB%8,n,a=0;if(r-- >0)for(t>t)!=(this.s&this.DM)>>t&&(e[a++]=n|this.s<=0;)t<8?(n=(this[r]&(1<>(t+=this.DB-8)):(n=this[r]>>(t-=8)&255,t<=0&&(t+=this.DB,--r)),n&128&&(n|=-256),a==0&&(this.s&128)!=(n&128)&&++a,(a>0||n!=this.s)&&(e[a++]=n);return e},i.prototype.equals=function(r){return this.compareTo(r)==0},i.prototype.min=function(r){return this.compareTo(r)<0?this:r},i.prototype.max=function(r){return this.compareTo(r)>0?this:r},i.prototype.and=function(r){var e=re();return this.bitwiseTo(r,cI,e),e},i.prototype.or=function(r){var e=re();return this.bitwiseTo(r,ys,e),e},i.prototype.xor=function(r){var e=re();return this.bitwiseTo(r,bp,e),e},i.prototype.andNot=function(r){var e=re();return this.bitwiseTo(r,$p,e),e},i.prototype.not=function(){for(var r=re(),e=0;e=this.t?this.s!=0:(this[e]&1<1){var c=re();for(o.sqrTo(s[1],c);u<=h;)s[u]=re(),o.mulTo(c,s[u-2],s[u]),u+=2}var d=r.t-1,f,v=!0,p=re(),g;for(t=ms(r[d])-1;d>=0;){for(t>=l?f=r[d]>>t-l&h:(f=(r[d]&(1<0&&(f|=r[d-1]>>this.DB+t-l)),u=n;!(f&1);)f>>=1,--u;if((t-=u)<0&&(t+=this.DB,--d),v)s[f].copyTo(a),v=!1;else{for(;u>1;)o.sqrTo(a,p),o.sqrTo(p,a),u-=2;u>0?o.sqrTo(a,p):(g=a,a=p,p=g),o.mulTo(p,s[f],a)}for(;d>=0&&!(r[d]&1<=0?(t.subTo(n,t),e&&a.subTo(s,a),o.subTo(u,o)):(n.subTo(t,n),e&&s.subTo(a,s),u.subTo(o,u))}if(n.compareTo(i.ONE)!=0)return i.ZERO;if(u.compareTo(r)>=0)return u.subtract(r);if(u.signum()<0)u.addTo(r,u);else return u;return u.signum()<0?u.add(r):u},i.prototype.pow=function(r){return this.exp(r,new $I)},i.prototype.gcd=function(r){var e=this.s<0?this.negate():this.clone(),t=r.s<0?r.negate():r.clone();if(e.compareTo(t)<0){var n=e;e=t,t=n}var a=e.getLowestSetBit(),o=t.getLowestSetBit();if(o<0)return e;for(a0&&(e.rShiftTo(o,e),t.rShiftTo(o,t));e.signum()>0;)(a=e.getLowestSetBit())>0&&e.rShiftTo(a,e),(a=t.getLowestSetBit())>0&&t.rShiftTo(a,t),e.compareTo(t)>=0?(e.subTo(t,e),e.rShiftTo(1,e)):(t.subTo(e,t),t.rShiftTo(1,t));return o>0&&t.lShiftTo(o,t),t},i.prototype.isProbablePrime=function(r){var e,t=this.abs();if(t.t==1&&t[0]<=dt[dt.length-1]){for(e=0;e=0;--e)r[e]=this[e];r.t=this.t,r.s=this.s},i.prototype.fromInt=function(r){this.t=1,this.s=r<0?-1:0,r>0?this[0]=r:r<-1?this[0]=r+this.DV:this.t=0},i.prototype.fromString=function(r,e){var t;if(e==16)t=4;else if(e==8)t=3;else if(e==256)t=8;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else{this.fromRadix(r,e);return}this.t=0,this.s=0;for(var n=r.length,a=!1,o=0;--n>=0;){var s=t==8?+r[n]&255:Ip(r,n);if(s<0){r.charAt(n)=="-"&&(a=!0);continue}a=!1,o==0?this[this.t++]=s:o+t>this.DB?(this[this.t-1]|=(s&(1<>this.DB-o):this[this.t-1]|=s<=this.DB&&(o-=this.DB)}t==8&&+r[0]&128&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==r;)--this.t},i.prototype.dlShiftTo=function(r,e){var t;for(t=this.t-1;t>=0;--t)e[t+r]=this[t];for(t=r-1;t>=0;--t)e[t]=0;e.t=this.t+r,e.s=this.s},i.prototype.drShiftTo=function(r,e){for(var t=r;t=0;--u)e[u+o+1]=this[u]>>n|s,s=(this[u]&a)<=0;--u)e[u]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},i.prototype.rShiftTo=function(r,e){e.s=this.s;var t=Math.floor(r/this.DB);if(t>=this.t){e.t=0;return}var n=r%this.DB,a=this.DB-n,o=(1<>n;for(var s=t+1;s>n;n>0&&(e[this.t-t-1]|=(this.s&o)<>=this.DB;if(r.t>=this.DB;n+=this.s}else{for(n+=this.s;t>=this.DB;n-=r.s}e.s=n<0?-1:0,n<-1?e[t++]=this.DV+n:n>0&&(e[t++]=n),e.t=t,e.clamp()},i.prototype.multiplyTo=function(r,e){var t=this.abs(),n=r.abs(),a=t.t;for(e.t=a+n.t;--a>=0;)e[a]=0;for(a=0;a=0;)r[t]=0;for(t=0;t=e.DV&&(r[t+e.t]-=e.DV,r[t+e.t+1]=1)}r.t>0&&(r[r.t-1]+=e.am(t,e[t],r,2*t,0,1)),r.s=0,r.clamp()},i.prototype.divRemTo=function(r,e,t){var n=r.abs();if(!(n.t<=0)){var a=this.abs();if(a.t0?(n.lShiftTo(l,o),a.lShiftTo(l,t)):(n.copyTo(o),a.copyTo(t));var h=o.t,c=o[h-1];if(c!=0){var d=c*(1<1?o[h-2]>>this.F2:0),f=this.FV/d,v=(1<=0&&(t[t.t++]=1,t.subTo(m,t)),i.ONE.dlShiftTo(h,m),m.subTo(o,o);o.t=0;){var $=t[--g]==c?this.DM:Math.floor(t[g]*f+(t[g-1]+p)*v);if((t[g]+=o.am(0,$,t,y,0,h))<$)for(o.dlShiftTo(y,m),t.subTo(m,t);t[g]<--$;)t.subTo(m,t)}e!=null&&(t.drShiftTo(h,e),s!=u&&i.ZERO.subTo(e,e)),t.t=h,t.clamp(),l>0&&t.rShiftTo(l,t),s<0&&i.ZERO.subTo(t,t)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var r=this[0];if(!(r&1))return 0;var e=r&3;return e=e*(2-(r&15)*e)&15,e=e*(2-(r&255)*e)&255,e=e*(2-((r&65535)*e&65535))&65535,e=e*(2-r*e%this.DV)%this.DV,e>0?this.DV-e:-e},i.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0},i.prototype.exp=function(r,e){if(r>4294967295||r<1)return i.ONE;var t=re(),n=re(),a=e.convert(this),o=ms(r)-1;for(a.copyTo(t);--o>=0;)if(e.sqrTo(t,n),(r&1<0)e.mulTo(n,a,t);else{var s=t;t=n,n=s}return e.revert(t)},i.prototype.chunkSize=function(r){return Math.floor(Math.LN2*this.DB/Math.log(r))},i.prototype.toRadix=function(r){if(r==null&&(r=10),this.signum()==0||r<2||r>36)return"0";var e=this.chunkSize(r),t=Math.pow(r,e),n=Jr(t),a=re(),o=re(),s="";for(this.divRemTo(n,a,o);a.signum()>0;)s=(t+o.intValue()).toString(r).substr(1)+s,a.divRemTo(n,a,o);return o.intValue().toString(r)+s},i.prototype.fromRadix=function(r,e){this.fromInt(0),e==null&&(e=10);for(var t=this.chunkSize(e),n=Math.pow(e,t),a=!1,o=0,s=0,u=0;u=t&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),a&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(r,e,t){if(typeof e=="number")if(r<2)this.fromInt(1);else for(this.fromNumber(r,t),this.testBit(r-1)||this.bitwiseTo(i.ONE.shiftLeft(r-1),ys,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>r&&this.subTo(i.ONE.shiftLeft(r-1),this);else{var n=[],a=r&7;n.length=(r>>3)+1,e.nextBytes(n),a>0?n[0]&=(1<>=this.DB;if(r.t>=this.DB;n+=this.s}else{for(n+=this.s;t>=this.DB;n+=r.s}e.s=n<0?-1:0,n>0?e[t++]=n:n<-1&&(e[t++]=this.DV+n),e.t=t,e.clamp()},i.prototype.dMultiply=function(r){this[this.t]=this.am(0,r-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(r,e){if(r!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=r;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},i.prototype.multiplyLowerTo=function(r,e,t){var n=Math.min(this.t+r.t,e);for(t.s=0,t.t=n;n>0;)t[--n]=0;for(var a=t.t-this.t;n=0;)t[n]=0;for(n=Math.max(e-this.t,0);n0)if(e==0)t=this[0]%r;else for(var n=this.t-1;n>=0;--n)t=(e*t+this[n])%r;return t},i.prototype.millerRabin=function(r){var e=this.subtract(i.ONE),t=e.getLowestSetBit();if(t<=0)return!1;var n=e.shiftRight(t);r=r+1>>1,r>dt.length&&(r=dt.length);for(var a=re(),o=0;o0&&(t.rShiftTo(s,t),n.rShiftTo(s,n));var u=function(){(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n)),t.signum()>0?setTimeout(u,0):(s>0&&n.lShiftTo(s,n),setTimeout(function(){e(n)},0))};setTimeout(u,10)},i.prototype.fromNumberAsync=function(r,e,t,n){if(typeof e=="number")if(r<2)this.fromInt(1);else{this.fromNumber(r,t),this.testBit(r-1)||this.bitwiseTo(i.ONE.shiftLeft(r-1),ys,this),this.isEven()&&this.dAddOffset(1,0);var a=this,o=function(){a.dAddOffset(2,0),a.bitLength()>r&&a.subTo(i.ONE.shiftLeft(r-1),a),a.isProbablePrime(e)?setTimeout(function(){n()},0):setTimeout(o,0)};setTimeout(o,0)}else{var s=[],u=r&7;s.length=(r>>3)+1,e.nextBytes(s),u>0?s[0]&=(1<=0?r.mod(this.m):r},i.prototype.revert=function(r){return r},i.prototype.reduce=function(r){r.divRemTo(this.m,null,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}(),Op=function(){function i(r){this.m=r,this.mp=r.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e},i.prototype.revert=function(r){var e=re();return r.copyTo(e),this.reduce(e),e},i.prototype.reduce=function(r){for(;r.t<=this.mt2;)r[r.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&r.DM;for(t=e+this.m.t,r[t]+=this.m.am(0,n,r,e,0,this.m.t);r[t]>=r.DV;)r[t]-=r.DV,r[++t]++}r.clamp(),r.drShiftTo(this.m.t,r),r.compareTo(this.m)>=0&&r.subTo(this.m,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}(),wI=function(){function i(r){this.m=r,this.r2=re(),this.q3=re(),Q.ONE.dlShiftTo(2*r.t,this.r2),this.mu=this.r2.divide(r)}return i.prototype.convert=function(r){if(r.s<0||r.t>2*this.m.t)return r.mod(this.m);if(r.compareTo(this.m)<0)return r;var e=re();return r.copyTo(e),this.reduce(e),e},i.prototype.revert=function(r){return r},i.prototype.reduce=function(r){for(r.drShiftTo(this.m.t-1,this.r2),r.t>this.m.t+1&&(r.t=this.m.t+1,r.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);r.compareTo(this.r2)<0;)r.dAddOffset(1,this.m.t+1);for(r.subTo(this.r2,r);r.compareTo(this.m)>=0;)r.subTo(this.m,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}();function re(){return new Q(null)}function Se(i,r){return new Q(i,r)}var Tp=typeof navigator<"u";Tp&&Ep&&navigator.appName=="Microsoft Internet Explorer"?(Q.prototype.am=function(r,e,t,n,a,o){for(var s=e&32767,u=e>>15;--o>=0;){var l=this[r]&32767,h=this[r++]>>15,c=u*l+h*s;l=s*l+((c&32767)<<15)+t[n]+(a&1073741823),a=(l>>>30)+(c>>>15)+u*h+(a>>>30),t[n++]=l&1073741823}return a},ni=30):Tp&&Ep&&navigator.appName!="Netscape"?(Q.prototype.am=function(r,e,t,n,a,o){for(;--o>=0;){var s=e*this[r++]+t[n]+a;a=Math.floor(s/67108864),t[n++]=s&67108863}return a},ni=26):(Q.prototype.am=function(r,e,t,n,a,o){for(var s=e&16383,u=e>>14;--o>=0;){var l=this[r]&16383,h=this[r++]>>14,c=u*l+h*s;l=s*l+((c&16383)<<14)+t[n]+a,a=(l>>28)+(c>>14)+u*h,t[n++]=l&268435455}return a},ni=28);Q.prototype.DB=ni;Q.prototype.DM=(1<>>16)!=0&&(i=e,r+=16),(e=i>>8)!=0&&(i=e,r+=8),(e=i>>4)!=0&&(i=e,r+=4),(e=i>>2)!=0&&(i=e,r+=2),(e=i>>1)!=0&&(i=e,r+=1),r}Q.ZERO=Jr(0);Q.ONE=Jr(1);var _I=function(){function i(){this.i=0,this.j=0,this.S=[]}return i.prototype.init=function(r){var e,t,n;for(e=0;e<256;++e)this.S[e]=e;for(t=0,e=0;e<256;++e)t=t+this.S[e]+r[e%r.length]&255,n=this.S[e],this.S[e]=this.S[t],this.S[t]=n;this.i=0,this.j=0},i.prototype.next=function(){var r;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,r=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=r,this.S[r+this.S[this.i]&255]},i}();function EI(){return new _I}var q$=256,bs,ei=null,er;if(ei==null){ei=[],er=0;var $s=void 0;if(typeof window<"u"&&window.crypto&&window.crypto.getRandomValues){var ah=new Uint32Array(256);for(window.crypto.getRandomValues(ah),$s=0;$s=256||er>=q$){window.removeEventListener?window.removeEventListener("mousemove",_s,!1):window.detachEvent&&window.detachEvent("onmousemove",_s);return}try{var r=i.x+i.y;ei[er++]=r&255,ws+=1}catch{}};typeof window<"u"&&(window.addEventListener?window.addEventListener("mousemove",_s,!1):window.attachEvent&&window.attachEvent("onmousemove",_s))}function SI(){if(bs==null){for(bs=EI();er=0&&r>0;){var n=i.charCodeAt(t--);n<128?e[--r]=n:n>127&&n<2048?(e[--r]=n&63|128,e[--r]=n>>6|192):(e[--r]=n&63|128,e[--r]=n>>6&63|128,e[--r]=n>>12|224)}e[--r]=0;for(var a=new _d,o=[];r>2;){for(o[0]=0;o[0]==0;)a.nextBytes(o);e[--r]=o[0]}return e[--r]=2,e[--r]=0,new Q(e)}var II=function(){function i(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return i.prototype.doPublic=function(r){return r.modPowInt(this.e,this.n)},i.prototype.doPrivate=function(r){if(this.p==null||this.q==null)return r.modPow(this.d,this.n);for(var e=r.mod(this.p).modPow(this.dmp1,this.p),t=r.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(t)<0;)e=e.add(this.p);return e.subtract(t).multiply(this.coeff).mod(this.p).multiply(this.q).add(t)},i.prototype.setPublic=function(r,e){r!=null&&e!=null&&r.length>0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},i.prototype.encrypt=function(r){var e=this.n.bitLength()+7>>3,t=TI(r,e);if(t==null)return null;var n=this.doPublic(t);if(n==null)return null;for(var a=n.toString(16),o=a.length,s=0;s0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16),this.d=Se(t,16)):console.error("Invalid RSA private key")},i.prototype.setPrivateEx=function(r,e,t,n,a,o,s,u){r!=null&&e!=null&&r.length>0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16),this.d=Se(t,16),this.p=Se(n,16),this.q=Se(a,16),this.dmp1=Se(o,16),this.dmq1=Se(s,16),this.coeff=Se(u,16)):console.error("Invalid RSA private key")},i.prototype.generate=function(r,e){var t=new _d,n=r>>1;this.e=parseInt(e,16);for(var a=new Q(e,16);;){for(;this.p=new Q(r-n,1,t),!(this.p.subtract(Q.ONE).gcd(a).compareTo(Q.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new Q(n,1,t),!(this.q.subtract(Q.ONE).gcd(a).compareTo(Q.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(Q.ONE),u=this.q.subtract(Q.ONE),l=s.multiply(u);if(l.gcd(a).compareTo(Q.ONE)==0){this.n=this.p.multiply(this.q),this.d=a.modInverse(l),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(u),this.coeff=this.q.modInverse(this.p);break}}},i.prototype.decrypt=function(r){var e=Se(r,16),t=this.doPrivate(e);return t==null?null:kI(t,this.n.bitLength()+7>>3)},i.prototype.generateAsync=function(r,e,t){var n=new _d,a=r>>1;this.e=parseInt(e,16);var o=new Q(e,16),s=this,u=function(){var l=function(){if(s.p.compareTo(s.q)<=0){var d=s.p;s.p=s.q,s.q=d}var f=s.p.subtract(Q.ONE),v=s.q.subtract(Q.ONE),p=f.multiply(v);p.gcd(o).compareTo(Q.ONE)==0?(s.n=s.p.multiply(s.q),s.d=o.modInverse(p),s.dmp1=s.d.mod(f),s.dmq1=s.d.mod(v),s.coeff=s.q.modInverse(s.p),setTimeout(function(){t()},0)):setTimeout(u,0)},h=function(){s.q=re(),s.q.fromNumberAsync(a,1,n,function(){s.q.subtract(Q.ONE).gcda(o,function(d){d.compareTo(Q.ONE)==0&&s.q.isProbablePrime(10)?setTimeout(l,0):setTimeout(h,0)})})},c=function(){s.p=re(),s.p.fromNumberAsync(r-a,1,n,function(){s.p.subtract(Q.ONE).gcda(o,function(d){d.compareTo(Q.ONE)==0&&s.p.isProbablePrime(10)?setTimeout(h,0):setTimeout(c,0)})})};setTimeout(c,0)};setTimeout(u,0)},i.prototype.sign=function(r,e,t){var n=PI(t),a=n+e(r).toString(),o=OI(a,this.n.bitLength()/4);if(o==null)return null;var s=this.doPrivate(o);if(s==null)return null;var u=s.toString(16);return u.length&1?"0"+u:u},i.prototype.verify=function(r,e,t){var n=Se(e,16),a=this.doPublic(n);if(a==null)return null;var o=a.toString(16).replace(/^1f+00/,""),s=xI(o);return s==t(r).toString()},i}();function kI(i,r){for(var e=i.toByteArray(),t=0;t=e.length)return null;for(var n="";++t191&&a<224?(n+=String.fromCharCode((a&31)<<6|e[t+1]&63),++t):(n+=String.fromCharCode((a&15)<<12|(e[t+1]&63)<<6|e[t+2]&63),t+=2)}return n}var uu={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function PI(i){return uu[i]||""}function xI(i){for(var r in uu)if(uu.hasOwnProperty(r)){var e=uu[r],t=e.length;if(i.substr(0,t)==e)return i.substr(t)}return i}/*! +`;t/=2,n>t&&(e=r+t);for(var o=r;ot&&(a+=G$),a},i.prototype.parseOID=function(r,e,t){for(var n="",a=new Ua,o=0,s=r;st)return Wn(n,t);a=new Ua,o=0}}return o>0&&(n+=".incomplete"),n},i}(),gI=function(){function i(r,e,t,n,a){if(!(n instanceof _p))throw new Error("Invalid tag value.");this.stream=r,this.header=e,this.length=t,this.tag=n,this.sub=a}return i.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},i.prototype.content=function(r){if(this.tag===void 0)return null;r===void 0&&(r=1/0);var e=this.posContent(),t=Math.abs(this.length);if(!this.tag.isUniversal())return this.sub!==null?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+t,r);switch(this.tag.tagNumber){case 1:return this.stream.get(e)===0?"false":"true";case 2:return this.stream.parseInteger(e,e+t);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+t,r);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+t,r);case 6:return this.stream.parseOID(e,e+t,r);case 16:case 17:return this.sub!==null?"("+this.sub.length+" elem)":"(no elem)";case 12:return Wn(this.stream.parseStringUTF(e,e+t),r);case 18:case 19:case 20:case 21:case 22:case 26:return Wn(this.stream.parseStringISO(e,e+t),r);case 30:return Wn(this.stream.parseStringBMP(e,e+t),r);case 23:case 24:return this.stream.parseTime(e,e+t,this.tag.tagNumber==23)}return null},i.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(this.sub===null?"null":this.sub.length)+"]"},i.prototype.toPrettyString=function(r){r===void 0&&(r="");var e=r+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":this.tag.isUniversal()&&(this.tag.tagNumber==3||this.tag.tagNumber==4)&&this.sub!==null&&(e+=" (encapsulates)"),e+=` +`,this.sub!==null){r+=" ";for(var t=0,n=this.sub.length;t6)throw new Error("Length over 48 bits not supported at position "+(r.pos-1));if(t===0)return null;e=0;for(var n=0;n>6,this.tagConstructed=(e&32)!==0,this.tagNumber=e&31,this.tagNumber==31){var t=new Ua;do e=r.get(),t.mulAdd(128,e&127);while(e&128);this.tagNumber=t.simplify()}}return i.prototype.isUniversal=function(){return this.tagClass===0},i.prototype.isEOC=function(){return this.tagClass===0&&this.tagNumber===0},i}(),ni,yI=0xdeadbeefcafe,Ep=(yI&16777215)==15715070,dt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],mI=(1<<26)/dt[dt.length-1],Q=function(){function i(r,e,t){r!=null&&(typeof r=="number"?this.fromNumber(r,e,t):e==null&&typeof r!="string"?this.fromString(r,256):this.fromString(r,e))}return i.prototype.toString=function(r){if(this.s<0)return"-"+this.negate().toString(r);var e;if(r==16)e=4;else if(r==8)e=3;else if(r==2)e=1;else if(r==32)e=5;else if(r==4)e=2;else return this.toRadix(r);var t=(1<0)for(u>u)>0&&(a=!0,o=Or(n));s>=0;)u>(u+=this.DB-e)):(n=this[s]>>(u-=e)&t,u<=0&&(u+=this.DB,--s)),n>0&&(a=!0),a&&(o+=Or(n));return a?o:"0"},i.prototype.negate=function(){var r=re();return i.ZERO.subTo(this,r),r},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(r){var e=this.s-r.s;if(e!=0)return e;var t=this.t;if(e=t-r.t,e!=0)return this.s<0?-e:e;for(;--t>=0;)if((e=this[t]-r[t])!=0)return e;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+ms(this[this.t-1]^this.s&this.DM)},i.prototype.mod=function(r){var e=re();return this.abs().divRemTo(r,null,e),this.s<0&&e.compareTo(i.ZERO)>0&&r.subTo(e,e),e},i.prototype.modPowInt=function(r,e){var t;return r<256||e.isEven()?t=new Sp(e):t=new Op(e),this.exp(r,t)},i.prototype.clone=function(){var r=re();return this.copyTo(r),r},i.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24},i.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},i.prototype.toByteArray=function(){var r=this.t,e=[];e[0]=this.s;var t=this.DB-r*this.DB%8,n,a=0;if(r-- >0)for(t>t)!=(this.s&this.DM)>>t&&(e[a++]=n|this.s<=0;)t<8?(n=(this[r]&(1<>(t+=this.DB-8)):(n=this[r]>>(t-=8)&255,t<=0&&(t+=this.DB,--r)),n&128&&(n|=-256),a==0&&(this.s&128)!=(n&128)&&++a,(a>0||n!=this.s)&&(e[a++]=n);return e},i.prototype.equals=function(r){return this.compareTo(r)==0},i.prototype.min=function(r){return this.compareTo(r)<0?this:r},i.prototype.max=function(r){return this.compareTo(r)>0?this:r},i.prototype.and=function(r){var e=re();return this.bitwiseTo(r,hI,e),e},i.prototype.or=function(r){var e=re();return this.bitwiseTo(r,ys,e),e},i.prototype.xor=function(r){var e=re();return this.bitwiseTo(r,bp,e),e},i.prototype.andNot=function(r){var e=re();return this.bitwiseTo(r,$p,e),e},i.prototype.not=function(){for(var r=re(),e=0;e=this.t?this.s!=0:(this[e]&1<1){var c=re();for(o.sqrTo(s[1],c);u<=h;)s[u]=re(),o.mulTo(c,s[u-2],s[u]),u+=2}var d=r.t-1,f,v=!0,p=re(),g;for(t=ms(r[d])-1;d>=0;){for(t>=l?f=r[d]>>t-l&h:(f=(r[d]&(1<0&&(f|=r[d-1]>>this.DB+t-l)),u=n;!(f&1);)f>>=1,--u;if((t-=u)<0&&(t+=this.DB,--d),v)s[f].copyTo(a),v=!1;else{for(;u>1;)o.sqrTo(a,p),o.sqrTo(p,a),u-=2;u>0?o.sqrTo(a,p):(g=a,a=p,p=g),o.mulTo(p,s[f],a)}for(;d>=0&&!(r[d]&1<=0?(t.subTo(n,t),e&&a.subTo(s,a),o.subTo(u,o)):(n.subTo(t,n),e&&s.subTo(a,s),u.subTo(o,u))}if(n.compareTo(i.ONE)!=0)return i.ZERO;if(u.compareTo(r)>=0)return u.subtract(r);if(u.signum()<0)u.addTo(r,u);else return u;return u.signum()<0?u.add(r):u},i.prototype.pow=function(r){return this.exp(r,new bI)},i.prototype.gcd=function(r){var e=this.s<0?this.negate():this.clone(),t=r.s<0?r.negate():r.clone();if(e.compareTo(t)<0){var n=e;e=t,t=n}var a=e.getLowestSetBit(),o=t.getLowestSetBit();if(o<0)return e;for(a0&&(e.rShiftTo(o,e),t.rShiftTo(o,t));e.signum()>0;)(a=e.getLowestSetBit())>0&&e.rShiftTo(a,e),(a=t.getLowestSetBit())>0&&t.rShiftTo(a,t),e.compareTo(t)>=0?(e.subTo(t,e),e.rShiftTo(1,e)):(t.subTo(e,t),t.rShiftTo(1,t));return o>0&&t.lShiftTo(o,t),t},i.prototype.isProbablePrime=function(r){var e,t=this.abs();if(t.t==1&&t[0]<=dt[dt.length-1]){for(e=0;e=0;--e)r[e]=this[e];r.t=this.t,r.s=this.s},i.prototype.fromInt=function(r){this.t=1,this.s=r<0?-1:0,r>0?this[0]=r:r<-1?this[0]=r+this.DV:this.t=0},i.prototype.fromString=function(r,e){var t;if(e==16)t=4;else if(e==8)t=3;else if(e==256)t=8;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else{this.fromRadix(r,e);return}this.t=0,this.s=0;for(var n=r.length,a=!1,o=0;--n>=0;){var s=t==8?+r[n]&255:Ip(r,n);if(s<0){r.charAt(n)=="-"&&(a=!0);continue}a=!1,o==0?this[this.t++]=s:o+t>this.DB?(this[this.t-1]|=(s&(1<>this.DB-o):this[this.t-1]|=s<=this.DB&&(o-=this.DB)}t==8&&+r[0]&128&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==r;)--this.t},i.prototype.dlShiftTo=function(r,e){var t;for(t=this.t-1;t>=0;--t)e[t+r]=this[t];for(t=r-1;t>=0;--t)e[t]=0;e.t=this.t+r,e.s=this.s},i.prototype.drShiftTo=function(r,e){for(var t=r;t=0;--u)e[u+o+1]=this[u]>>n|s,s=(this[u]&a)<=0;--u)e[u]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},i.prototype.rShiftTo=function(r,e){e.s=this.s;var t=Math.floor(r/this.DB);if(t>=this.t){e.t=0;return}var n=r%this.DB,a=this.DB-n,o=(1<>n;for(var s=t+1;s>n;n>0&&(e[this.t-t-1]|=(this.s&o)<>=this.DB;if(r.t>=this.DB;n+=this.s}else{for(n+=this.s;t>=this.DB;n-=r.s}e.s=n<0?-1:0,n<-1?e[t++]=this.DV+n:n>0&&(e[t++]=n),e.t=t,e.clamp()},i.prototype.multiplyTo=function(r,e){var t=this.abs(),n=r.abs(),a=t.t;for(e.t=a+n.t;--a>=0;)e[a]=0;for(a=0;a=0;)r[t]=0;for(t=0;t=e.DV&&(r[t+e.t]-=e.DV,r[t+e.t+1]=1)}r.t>0&&(r[r.t-1]+=e.am(t,e[t],r,2*t,0,1)),r.s=0,r.clamp()},i.prototype.divRemTo=function(r,e,t){var n=r.abs();if(!(n.t<=0)){var a=this.abs();if(a.t0?(n.lShiftTo(l,o),a.lShiftTo(l,t)):(n.copyTo(o),a.copyTo(t));var h=o.t,c=o[h-1];if(c!=0){var d=c*(1<1?o[h-2]>>this.F2:0),f=this.FV/d,v=(1<=0&&(t[t.t++]=1,t.subTo(m,t)),i.ONE.dlShiftTo(h,m),m.subTo(o,o);o.t=0;){var $=t[--g]==c?this.DM:Math.floor(t[g]*f+(t[g-1]+p)*v);if((t[g]+=o.am(0,$,t,y,0,h))<$)for(o.dlShiftTo(y,m),t.subTo(m,t);t[g]<--$;)t.subTo(m,t)}e!=null&&(t.drShiftTo(h,e),s!=u&&i.ZERO.subTo(e,e)),t.t=h,t.clamp(),l>0&&t.rShiftTo(l,t),s<0&&i.ZERO.subTo(t,t)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var r=this[0];if(!(r&1))return 0;var e=r&3;return e=e*(2-(r&15)*e)&15,e=e*(2-(r&255)*e)&255,e=e*(2-((r&65535)*e&65535))&65535,e=e*(2-r*e%this.DV)%this.DV,e>0?this.DV-e:-e},i.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0},i.prototype.exp=function(r,e){if(r>4294967295||r<1)return i.ONE;var t=re(),n=re(),a=e.convert(this),o=ms(r)-1;for(a.copyTo(t);--o>=0;)if(e.sqrTo(t,n),(r&1<0)e.mulTo(n,a,t);else{var s=t;t=n,n=s}return e.revert(t)},i.prototype.chunkSize=function(r){return Math.floor(Math.LN2*this.DB/Math.log(r))},i.prototype.toRadix=function(r){if(r==null&&(r=10),this.signum()==0||r<2||r>36)return"0";var e=this.chunkSize(r),t=Math.pow(r,e),n=Jr(t),a=re(),o=re(),s="";for(this.divRemTo(n,a,o);a.signum()>0;)s=(t+o.intValue()).toString(r).substr(1)+s,a.divRemTo(n,a,o);return o.intValue().toString(r)+s},i.prototype.fromRadix=function(r,e){this.fromInt(0),e==null&&(e=10);for(var t=this.chunkSize(e),n=Math.pow(e,t),a=!1,o=0,s=0,u=0;u=t&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),a&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(r,e,t){if(typeof e=="number")if(r<2)this.fromInt(1);else for(this.fromNumber(r,t),this.testBit(r-1)||this.bitwiseTo(i.ONE.shiftLeft(r-1),ys,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>r&&this.subTo(i.ONE.shiftLeft(r-1),this);else{var n=[],a=r&7;n.length=(r>>3)+1,e.nextBytes(n),a>0?n[0]&=(1<>=this.DB;if(r.t>=this.DB;n+=this.s}else{for(n+=this.s;t>=this.DB;n+=r.s}e.s=n<0?-1:0,n>0?e[t++]=n:n<-1&&(e[t++]=this.DV+n),e.t=t,e.clamp()},i.prototype.dMultiply=function(r){this[this.t]=this.am(0,r-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(r,e){if(r!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=r;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},i.prototype.multiplyLowerTo=function(r,e,t){var n=Math.min(this.t+r.t,e);for(t.s=0,t.t=n;n>0;)t[--n]=0;for(var a=t.t-this.t;n=0;)t[n]=0;for(n=Math.max(e-this.t,0);n0)if(e==0)t=this[0]%r;else for(var n=this.t-1;n>=0;--n)t=(e*t+this[n])%r;return t},i.prototype.millerRabin=function(r){var e=this.subtract(i.ONE),t=e.getLowestSetBit();if(t<=0)return!1;var n=e.shiftRight(t);r=r+1>>1,r>dt.length&&(r=dt.length);for(var a=re(),o=0;o0&&(t.rShiftTo(s,t),n.rShiftTo(s,n));var u=function(){(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n)),t.signum()>0?setTimeout(u,0):(s>0&&n.lShiftTo(s,n),setTimeout(function(){e(n)},0))};setTimeout(u,10)},i.prototype.fromNumberAsync=function(r,e,t,n){if(typeof e=="number")if(r<2)this.fromInt(1);else{this.fromNumber(r,t),this.testBit(r-1)||this.bitwiseTo(i.ONE.shiftLeft(r-1),ys,this),this.isEven()&&this.dAddOffset(1,0);var a=this,o=function(){a.dAddOffset(2,0),a.bitLength()>r&&a.subTo(i.ONE.shiftLeft(r-1),a),a.isProbablePrime(e)?setTimeout(function(){n()},0):setTimeout(o,0)};setTimeout(o,0)}else{var s=[],u=r&7;s.length=(r>>3)+1,e.nextBytes(s),u>0?s[0]&=(1<=0?r.mod(this.m):r},i.prototype.revert=function(r){return r},i.prototype.reduce=function(r){r.divRemTo(this.m,null,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}(),Op=function(){function i(r){this.m=r,this.mp=r.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e},i.prototype.revert=function(r){var e=re();return r.copyTo(e),this.reduce(e),e},i.prototype.reduce=function(r){for(;r.t<=this.mt2;)r[r.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&r.DM;for(t=e+this.m.t,r[t]+=this.m.am(0,n,r,e,0,this.m.t);r[t]>=r.DV;)r[t]-=r.DV,r[++t]++}r.clamp(),r.drShiftTo(this.m.t,r),r.compareTo(this.m)>=0&&r.subTo(this.m,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}(),$I=function(){function i(r){this.m=r,this.r2=re(),this.q3=re(),Q.ONE.dlShiftTo(2*r.t,this.r2),this.mu=this.r2.divide(r)}return i.prototype.convert=function(r){if(r.s<0||r.t>2*this.m.t)return r.mod(this.m);if(r.compareTo(this.m)<0)return r;var e=re();return r.copyTo(e),this.reduce(e),e},i.prototype.revert=function(r){return r},i.prototype.reduce=function(r){for(r.drShiftTo(this.m.t-1,this.r2),r.t>this.m.t+1&&(r.t=this.m.t+1,r.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);r.compareTo(this.r2)<0;)r.dAddOffset(1,this.m.t+1);for(r.subTo(this.r2,r);r.compareTo(this.m)>=0;)r.subTo(this.m,r)},i.prototype.mulTo=function(r,e,t){r.multiplyTo(e,t),this.reduce(t)},i.prototype.sqrTo=function(r,e){r.squareTo(e),this.reduce(e)},i}();function re(){return new Q(null)}function Se(i,r){return new Q(i,r)}var Tp=typeof navigator<"u";Tp&&Ep&&navigator.appName=="Microsoft Internet Explorer"?(Q.prototype.am=function(r,e,t,n,a,o){for(var s=e&32767,u=e>>15;--o>=0;){var l=this[r]&32767,h=this[r++]>>15,c=u*l+h*s;l=s*l+((c&32767)<<15)+t[n]+(a&1073741823),a=(l>>>30)+(c>>>15)+u*h+(a>>>30),t[n++]=l&1073741823}return a},ni=30):Tp&&Ep&&navigator.appName!="Netscape"?(Q.prototype.am=function(r,e,t,n,a,o){for(;--o>=0;){var s=e*this[r++]+t[n]+a;a=Math.floor(s/67108864),t[n++]=s&67108863}return a},ni=26):(Q.prototype.am=function(r,e,t,n,a,o){for(var s=e&16383,u=e>>14;--o>=0;){var l=this[r]&16383,h=this[r++]>>14,c=u*l+h*s;l=s*l+((c&16383)<<14)+t[n]+a,a=(l>>28)+(c>>14)+u*h,t[n++]=l&268435455}return a},ni=28);Q.prototype.DB=ni;Q.prototype.DM=(1<>>16)!=0&&(i=e,r+=16),(e=i>>8)!=0&&(i=e,r+=8),(e=i>>4)!=0&&(i=e,r+=4),(e=i>>2)!=0&&(i=e,r+=2),(e=i>>1)!=0&&(i=e,r+=1),r}Q.ZERO=Jr(0);Q.ONE=Jr(1);var wI=function(){function i(){this.i=0,this.j=0,this.S=[]}return i.prototype.init=function(r){var e,t,n;for(e=0;e<256;++e)this.S[e]=e;for(t=0,e=0;e<256;++e)t=t+this.S[e]+r[e%r.length]&255,n=this.S[e],this.S[e]=this.S[t],this.S[t]=n;this.i=0,this.j=0},i.prototype.next=function(){var r;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,r=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=r,this.S[r+this.S[this.i]&255]},i}();function _I(){return new wI}var q$=256,bs,ei=null,er;if(ei==null){ei=[],er=0;var $s=void 0;if(typeof window<"u"&&window.crypto&&window.crypto.getRandomValues){var ah=new Uint32Array(256);for(window.crypto.getRandomValues(ah),$s=0;$s=256||er>=q$){window.removeEventListener?window.removeEventListener("mousemove",_s,!1):window.detachEvent&&window.detachEvent("onmousemove",_s);return}try{var r=i.x+i.y;ei[er++]=r&255,ws+=1}catch{}};typeof window<"u"&&(window.addEventListener?window.addEventListener("mousemove",_s,!1):window.attachEvent&&window.attachEvent("onmousemove",_s))}function EI(){if(bs==null){for(bs=_I();er=0&&r>0;){var n=i.charCodeAt(t--);n<128?e[--r]=n:n>127&&n<2048?(e[--r]=n&63|128,e[--r]=n>>6|192):(e[--r]=n&63|128,e[--r]=n>>6&63|128,e[--r]=n>>12|224)}e[--r]=0;for(var a=new _d,o=[];r>2;){for(o[0]=0;o[0]==0;)a.nextBytes(o);e[--r]=o[0]}return e[--r]=2,e[--r]=0,new Q(e)}var TI=function(){function i(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return i.prototype.doPublic=function(r){return r.modPowInt(this.e,this.n)},i.prototype.doPrivate=function(r){if(this.p==null||this.q==null)return r.modPow(this.d,this.n);for(var e=r.mod(this.p).modPow(this.dmp1,this.p),t=r.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(t)<0;)e=e.add(this.p);return e.subtract(t).multiply(this.coeff).mod(this.p).multiply(this.q).add(t)},i.prototype.setPublic=function(r,e){r!=null&&e!=null&&r.length>0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},i.prototype.encrypt=function(r){var e=this.n.bitLength()+7>>3,t=OI(r,e);if(t==null)return null;var n=this.doPublic(t);if(n==null)return null;for(var a=n.toString(16),o=a.length,s=0;s0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16),this.d=Se(t,16)):console.error("Invalid RSA private key")},i.prototype.setPrivateEx=function(r,e,t,n,a,o,s,u){r!=null&&e!=null&&r.length>0&&e.length>0?(this.n=Se(r,16),this.e=parseInt(e,16),this.d=Se(t,16),this.p=Se(n,16),this.q=Se(a,16),this.dmp1=Se(o,16),this.dmq1=Se(s,16),this.coeff=Se(u,16)):console.error("Invalid RSA private key")},i.prototype.generate=function(r,e){var t=new _d,n=r>>1;this.e=parseInt(e,16);for(var a=new Q(e,16);;){for(;this.p=new Q(r-n,1,t),!(this.p.subtract(Q.ONE).gcd(a).compareTo(Q.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new Q(n,1,t),!(this.q.subtract(Q.ONE).gcd(a).compareTo(Q.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(Q.ONE),u=this.q.subtract(Q.ONE),l=s.multiply(u);if(l.gcd(a).compareTo(Q.ONE)==0){this.n=this.p.multiply(this.q),this.d=a.modInverse(l),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(u),this.coeff=this.q.modInverse(this.p);break}}},i.prototype.decrypt=function(r){var e=Se(r,16),t=this.doPrivate(e);return t==null?null:II(t,this.n.bitLength()+7>>3)},i.prototype.generateAsync=function(r,e,t){var n=new _d,a=r>>1;this.e=parseInt(e,16);var o=new Q(e,16),s=this,u=function(){var l=function(){if(s.p.compareTo(s.q)<=0){var d=s.p;s.p=s.q,s.q=d}var f=s.p.subtract(Q.ONE),v=s.q.subtract(Q.ONE),p=f.multiply(v);p.gcd(o).compareTo(Q.ONE)==0?(s.n=s.p.multiply(s.q),s.d=o.modInverse(p),s.dmp1=s.d.mod(f),s.dmq1=s.d.mod(v),s.coeff=s.q.modInverse(s.p),setTimeout(function(){t()},0)):setTimeout(u,0)},h=function(){s.q=re(),s.q.fromNumberAsync(a,1,n,function(){s.q.subtract(Q.ONE).gcda(o,function(d){d.compareTo(Q.ONE)==0&&s.q.isProbablePrime(10)?setTimeout(l,0):setTimeout(h,0)})})},c=function(){s.p=re(),s.p.fromNumberAsync(r-a,1,n,function(){s.p.subtract(Q.ONE).gcda(o,function(d){d.compareTo(Q.ONE)==0&&s.p.isProbablePrime(10)?setTimeout(h,0):setTimeout(c,0)})})};setTimeout(c,0)};setTimeout(u,0)},i.prototype.sign=function(r,e,t){var n=kI(t),a=n+e(r).toString(),o=SI(a,this.n.bitLength()/4);if(o==null)return null;var s=this.doPrivate(o);if(s==null)return null;var u=s.toString(16);return u.length&1?"0"+u:u},i.prototype.verify=function(r,e,t){var n=Se(e,16),a=this.doPublic(n);if(a==null)return null;var o=a.toString(16).replace(/^1f+00/,""),s=PI(o);return s==t(r).toString()},i}();function II(i,r){for(var e=i.toByteArray(),t=0;t=e.length)return null;for(var n="";++t191&&a<224?(n+=String.fromCharCode((a&31)<<6|e[t+1]&63),++t):(n+=String.fromCharCode((a&15)<<12|(e[t+1]&63)<<6|e[t+2]&63),t+=2)}return n}var uu={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function kI(i){return uu[i]||""}function PI(i){for(var r in uu)if(uu.hasOwnProperty(r)){var e=uu[r],t=e.length;if(i.substr(0,t)==e)return i.substr(t)}return i}/*! Copyright (c) 2011, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html @@ -17,14 +27,14 @@ version: 2.9.0 * @version asn1 1.0.13 (2017-Jun-02) * @since jsrsasign 2.1 * @license MIT License - */var T={};(typeof T.asn1>"u"||!T.asn1)&&(T.asn1={});T.asn1.ASN1Util=new function(){this.integerToByteHex=function(i){var r=i.toString(16);return r.length%2==1&&(r="0"+r),r},this.bigIntToMinTwosComplementsHex=function(i){var r=i.toString(16);if(r.substr(0,1)!="-")r.length%2==1?r="0"+r:r.match(/^[0-7]/)||(r="00"+r);else{var e=r.substr(1),t=e.length;t%2==1?t+=1:r.match(/^[0-7]/)||(t+=2);for(var n="",a=0;a"u"||this.hV==null)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+i.length+",v="+this.hV;var r=this.hV.length/2,e=r.toString(16);if(e.length%2==1&&(e="0"+e),r<128)return e;var t=e.length/2;if(t>15)throw"ASN.1 length too long to represent by 8x: n = "+r.toString(16);var n=128+t;return n.toString(16)+e},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}};T.asn1.DERAbstractString=function(i){T.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(r){this.hTLV=null,this.isModified=!0,this.s=r,this.hV=stohex(this.s)},this.setStringHex=function(r){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i=="string"?this.setString(i):typeof i.str<"u"?this.setString(i.str):typeof i.hex<"u"&&this.setStringHex(i.hex))};Me.lang.extend(T.asn1.DERAbstractString,T.asn1.ASN1Object);T.asn1.DERAbstractTime=function(i){T.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(r){utc=r.getTime()+r.getTimezoneOffset()*6e4;var e=new Date(utc);return e},this.formatDate=function(r,e,t){var n=this.zeroPadding,a=this.localDateToUTC(r),o=String(a.getFullYear());e=="utc"&&(o=o.substr(2,2));var s=n(String(a.getMonth()+1),2),u=n(String(a.getDate()),2),l=n(String(a.getHours()),2),h=n(String(a.getMinutes()),2),c=n(String(a.getSeconds()),2),d=o+s+u+l+h+c;if(t===!0){var f=a.getMilliseconds();if(f!=0){var v=n(String(f),3);v=v.replace(/[0]+$/,""),d=d+"."+v}}return d+"Z"},this.zeroPadding=function(r,e){return r.length>=e?r:new Array(e-r.length+1).join("0")+r},this.getString=function(){return this.s},this.setString=function(r){this.hTLV=null,this.isModified=!0,this.s=r,this.hV=stohex(r)},this.setByDateValue=function(r,e,t,n,a,o){var s=new Date(Date.UTC(r,e-1,t,n,a,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}};Me.lang.extend(T.asn1.DERAbstractTime,T.asn1.ASN1Object);T.asn1.DERAbstractStructured=function(i){T.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array=r},this.appendASN1Object=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array.push(r)},this.asn1Array=new Array,typeof i<"u"&&typeof i.array<"u"&&(this.asn1Array=i.array)};Me.lang.extend(T.asn1.DERAbstractStructured,T.asn1.ASN1Object);T.asn1.DERBoolean=function(){T.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"};Me.lang.extend(T.asn1.DERBoolean,T.asn1.ASN1Object);T.asn1.DERInteger=function(i){T.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(r){this.hTLV=null,this.isModified=!0,this.hV=T.asn1.ASN1Util.bigIntToMinTwosComplementsHex(r)},this.setByInteger=function(r){var e=new Q(String(r),10);this.setByBigInteger(e)},this.setValueHex=function(r){this.hV=r},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i.bigint<"u"?this.setByBigInteger(i.bigint):typeof i.int<"u"?this.setByInteger(i.int):typeof i=="number"?this.setByInteger(i):typeof i.hex<"u"&&this.setValueHex(i.hex))};Me.lang.extend(T.asn1.DERInteger,T.asn1.ASN1Object);T.asn1.DERBitString=function(i){if(i!==void 0&&typeof i.obj<"u"){var r=T.asn1.ASN1Util.newObject(i.obj);i.hex="00"+r.getEncodedHex()}T.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7"u"&&typeof this.s>"u"&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{12}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date))};Me.lang.extend(T.asn1.DERUTCTime,T.asn1.DERAbstractTime);T.asn1.DERGeneralizedTime=function(i){T.asn1.DERGeneralizedTime.superclass.constructor.call(this,i),this.hT="18",this.withMillis=!1,this.setByDate=function(r){this.hTLV=null,this.isModified=!0,this.date=r,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{14}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date),i.millis===!0&&(this.withMillis=!0))};Me.lang.extend(T.asn1.DERGeneralizedTime,T.asn1.DERAbstractTime);T.asn1.DERSequence=function(i){T.asn1.DERSequence.superclass.constructor.call(this,i),this.hT="30",this.getFreshValueHex=function(){for(var r="",e=0;e"u"||!T.asn1)&&(T.asn1={});T.asn1.ASN1Util=new function(){this.integerToByteHex=function(i){var r=i.toString(16);return r.length%2==1&&(r="0"+r),r},this.bigIntToMinTwosComplementsHex=function(i){var r=i.toString(16);if(r.substr(0,1)!="-")r.length%2==1?r="0"+r:r.match(/^[0-7]/)||(r="00"+r);else{var e=r.substr(1),t=e.length;t%2==1?t+=1:r.match(/^[0-7]/)||(t+=2);for(var n="",a=0;a"u"||this.hV==null)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+i.length+",v="+this.hV;var r=this.hV.length/2,e=r.toString(16);if(e.length%2==1&&(e="0"+e),r<128)return e;var t=e.length/2;if(t>15)throw"ASN.1 length too long to represent by 8x: n = "+r.toString(16);var n=128+t;return n.toString(16)+e},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}};T.asn1.DERAbstractString=function(i){T.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(r){this.hTLV=null,this.isModified=!0,this.s=r,this.hV=stohex(this.s)},this.setStringHex=function(r){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i=="string"?this.setString(i):typeof i.str<"u"?this.setString(i.str):typeof i.hex<"u"&&this.setStringHex(i.hex))};Me.lang.extend(T.asn1.DERAbstractString,T.asn1.ASN1Object);T.asn1.DERAbstractTime=function(i){T.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(r){utc=r.getTime()+r.getTimezoneOffset()*6e4;var e=new Date(utc);return e},this.formatDate=function(r,e,t){var n=this.zeroPadding,a=this.localDateToUTC(r),o=String(a.getFullYear());e=="utc"&&(o=o.substr(2,2));var s=n(String(a.getMonth()+1),2),u=n(String(a.getDate()),2),l=n(String(a.getHours()),2),h=n(String(a.getMinutes()),2),c=n(String(a.getSeconds()),2),d=o+s+u+l+h+c;if(t===!0){var f=a.getMilliseconds();if(f!=0){var v=n(String(f),3);v=v.replace(/[0]+$/,""),d=d+"."+v}}return d+"Z"},this.zeroPadding=function(r,e){return r.length>=e?r:new Array(e-r.length+1).join("0")+r},this.getString=function(){return this.s},this.setString=function(r){this.hTLV=null,this.isModified=!0,this.s=r,this.hV=stohex(r)},this.setByDateValue=function(r,e,t,n,a,o){var s=new Date(Date.UTC(r,e-1,t,n,a,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}};Me.lang.extend(T.asn1.DERAbstractTime,T.asn1.ASN1Object);T.asn1.DERAbstractStructured=function(i){T.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array=r},this.appendASN1Object=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array.push(r)},this.asn1Array=new Array,typeof i<"u"&&typeof i.array<"u"&&(this.asn1Array=i.array)};Me.lang.extend(T.asn1.DERAbstractStructured,T.asn1.ASN1Object);T.asn1.DERBoolean=function(){T.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"};Me.lang.extend(T.asn1.DERBoolean,T.asn1.ASN1Object);T.asn1.DERInteger=function(i){T.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(r){this.hTLV=null,this.isModified=!0,this.hV=T.asn1.ASN1Util.bigIntToMinTwosComplementsHex(r)},this.setByInteger=function(r){var e=new Q(String(r),10);this.setByBigInteger(e)},this.setValueHex=function(r){this.hV=r},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i.bigint<"u"?this.setByBigInteger(i.bigint):typeof i.int<"u"?this.setByInteger(i.int):typeof i=="number"?this.setByInteger(i):typeof i.hex<"u"&&this.setValueHex(i.hex))};Me.lang.extend(T.asn1.DERInteger,T.asn1.ASN1Object);T.asn1.DERBitString=function(i){if(i!==void 0&&typeof i.obj<"u"){var r=T.asn1.ASN1Util.newObject(i.obj);i.hex="00"+r.getEncodedHex()}T.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7"u"&&typeof this.s>"u"&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{12}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date))};Me.lang.extend(T.asn1.DERUTCTime,T.asn1.DERAbstractTime);T.asn1.DERGeneralizedTime=function(i){T.asn1.DERGeneralizedTime.superclass.constructor.call(this,i),this.hT="18",this.withMillis=!1,this.setByDate=function(r){this.hTLV=null,this.isModified=!0,this.date=r,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{14}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date),i.millis===!0&&(this.withMillis=!0))};Me.lang.extend(T.asn1.DERGeneralizedTime,T.asn1.DERAbstractTime);T.asn1.DERSequence=function(i){T.asn1.DERSequence.superclass.constructor.call(this,i),this.hT="30",this.getFreshValueHex=function(){for(var r="",e=0;elocalStorage.getItem("chatApiKey"),Ba=()=>{const i=localStorage.getItem("openaiApiKey"),r=localStorage.getItem("openaiBaseUrl")||"https://api.openai.com/v1",e=localStorage.getItem("rsaPublicKey");return{openaiApiKey:i||"",openaiBaseUrl:r,rsaPublicKey:e}},Kr=()=>navigator.language||"zh-CN",yn=i=>{const r=i.headers.get("User-Api-Key");r&&!localStorage.getItem("chatApiKey")&&localStorage.setItem("chatApiKey",r)};var ai;(i=>{async function r(l){try{const h=Ur(),c=Kr();l.session_id=localStorage.getItem("sessionId")||null,fetch(`${Wr}/api/chat/track_event`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${h}`,"trace-id":dr(),"Accept-Language":c},body:JSON.stringify(l)}).catch(d=>{console.warn("Track event failed:",d)})}catch(h){console.warn("Error preparing track event:",h)}return Promise.resolve()}i.trackEvent=r;async function*e(l,h,c=[],d=null,f=null,v){try{const p=Ur(),g=Kr(),{openaiApiKey:y,openaiBaseUrl:m,rsaPublicKey:$}=Ba(),b=dr(),O=(c||[]).map(ie=>new Promise((_e,ye)=>{const Ae=new FileReader;Ae.onloadend=()=>_e(Ae.result),Ae.onerror=ye,Ae.readAsDataURL(ie)})),_=await Promise.all(O);let D=f?Array.isArray(f)?f:[f]:[];const R={"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${p}`,"trace-id":v||dr(),"Accept-Language":g};if(y&&y.trim()!==""&&$)try{const ie=await xn(y,$);R["Encrypted-Openai-Api-Key"]=ie,R["Openai-Base-Url"]=m}catch(ie){console.error("Error encrypting OpenAI API key:",ie)}const P=new AbortController,B=setTimeout(()=>P.abort(),12e4),j=await fetch(`${Wr}/api/chat/invoke`,{method:"POST",headers:R,body:JSON.stringify({session_id:l,prompt:h,mock:!1,intent:d,ext:D,images:_.map((ie,_e)=>({filename:c[_e].name,data:ie}))}),signal:P.signal});clearTimeout(B),yn(j);const J=j.body.getReader();let U="";for(;;){const{done:ie,value:_e}=await J.read();if(ie)break;U+=new TextDecoder().decode(_e);const ye=U.split(` -`);U=ye.pop()||"";for(const Ae of ye)Ae.trim()&&(yield{...JSON.parse(Ae),message_id:b})}U.trim()&&(yield{...JSON.parse(U),message_id:b})}catch(p){throw console.error("Error in streamInvokeServer:",p),p.name==="AbortError"?alert("Request timed out after 2 minutes. Please try again."):alert(p instanceof Error?p.message:"An error occurred while streaming, please refresh the page and try again."),p}}i.streamInvokeServer=e;async function t(l,h){try{const c=Ur(),d=Kr(),{openaiApiKey:f,openaiBaseUrl:v,rsaPublicKey:p}=Ba(),g={"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${c}`,"trace-id":dr(),"Accept-Language":d};if(f&&f.trim()!==""&&p)try{const $=await xn(f,p);g["Encrypted-Openai-Api-Key"]=$,g["Openai-Base-Url"]=v}catch($){console.error("Error encrypting OpenAI API key:",$)}const y=await fetch(`${Wr}/api/chat/get_optimized_workflow`,{method:"POST",headers:g,body:JSON.stringify({workflow_id:l,prompt:h})});yn(y);const m=await y.json();if(!m.success){const $=m.message||"Failed to get optimized workflow";throw alert($),new Error($)}return m.data}catch(c){throw console.error("Error getting optimized workflow:",c),alert(c instanceof Error?c.message:"Failed to get optimized workflow"),c}}i.getOptimizedWorkflow=t;async function n(l){const h=Ur(),c=Kr(),{openaiApiKey:d,openaiBaseUrl:f,rsaPublicKey:v}=Ba(),p={"Content-Type":"application/json",Authorization:`Bearer ${h}`,"trace-id":dr(),"Accept-Language":c};if(d&&d.trim()!==""&&v)try{const m=await xn(d,v);p["Encrypted-Openai-Api-Key"]=m,p["Openai-Base-Url"]=f}catch(m){console.error("Error encrypting OpenAI API key:",m)}const g=await fetch(`${Wr}/api/chat/get_node_info_by_types`,{method:"POST",headers:p,body:JSON.stringify({node_types:l})});yn(g);const y=await g.json();if(!y.success){const m=y.message||"Failed to get node info by types";throw alert(m),new Error(m)}return y.data}i.batchGetNodeInfo=n;async function a(l){try{const h=localStorage.getItem(`messages_${l}`);if(h)return console.log("Using cached messages from localStorage"),JSON.parse(h);const c=Ur(),d=Kr(),{openaiApiKey:f,openaiBaseUrl:v,rsaPublicKey:p}=Ba(),g={accept:"application/json",Authorization:`Bearer ${c}`,"trace-id":dr(),"Accept-Language":d};if(f&&f.trim()!==""&&p)try{const b=await xn(f,p);g["Encrypted-Openai-Api-Key"]=b,g["Openai-Base-Url"]=v}catch(b){console.error("Error encrypting OpenAI API key:",b)}const y=await fetch(`${Wr}/api/chat/get_messages_by_session_id?session_id=${l}`,{method:"GET",headers:g});yn(y);const m=await y.json();if(!m.success){const b=m.message||"Failed to fetch messages";throw alert(b+", please refresh the page and try again."),new Error(b)}const $=m.data.map(b=>(console.log("msg.ext",b.ext),{id:b.id.toString(),content:b.role==="ai"?JSON.stringify({session_id:l,text:b.content,finished:b.finished||!1,format:b.format||"markdown",ext:b.ext}):b.content,role:b.role,name:b.role==="ai"?"Assistant":void 0,format:b.format||"markdown",finished:b.finished}));return localStorage.setItem(`messages_${l}`,JSON.stringify($)),$}catch(h){throw console.error("Error fetching messages:",h),alert(h instanceof Error?h.message:"Failed to fetch messages, please refresh the page and try again."),h}}i.fetchMessages=a;async function o(){try{const l=Ur(),h=Kr(),{openaiApiKey:c,openaiBaseUrl:d,rsaPublicKey:f}=Ba(),v={accept:"application/json",Authorization:`Bearer ${l}`,"trace-id":dr(),"Accept-Language":h};if(c&&c.trim()!==""&&f)try{const y=await xn(c,f);v["Encrypted-Openai-Api-Key"]=y,v["Openai-Base-Url"]=d}catch(y){console.error("Error encrypting OpenAI API key:",y)}const p=await fetch(`${Wr}/api/chat/announcement`,{method:"GET",headers:v});yn(p);const g=await p.json();if(!g.success){const y=g.message||"Failed to fetch announcement";return console.error(y),""}return g.data}catch(l){return console.error("Error fetching announcement:",l),""}}i.fetchAnnouncement=o;async function s(l){let c=0,d;for(;c<3;)try{const f=Ur(),v=Kr(),p={"Content-Type":"application/json",accept:"application/json",Authorization:`Bearer ${f}`,"trace-id":dr(),"Accept-Language":v},g=await fetch(`${Wr}/api/param_debug/generate_sd_prompts`,{method:"POST",headers:p,body:JSON.stringify({text:l})});yn(g);const y=await g.json();if(!y.success){const m=y.message||"Failed to generate SD prompts";throw new Error(m)}return y.data}catch(f){if(d=f,c++,c>=3)throw console.error("Error generating SD prompts after 3 attempts:",f),f;console.warn(`Attempt ${c} failed, retrying... Error: ${f instanceof Error?f.message:"Unknown error"}`),await new Promise(v=>setTimeout(v,500*Math.pow(2,c-1)))}throw d}i.generateSDPrompts=s;async function u(){const l=Ur(),h=Kr(),c={"Content-Type":"application/json",accept:"application/json",Authorization:`Bearer ${l}`,"trace-id":dr(),"Accept-Language":h};return await(await fetch(`${Wr}/v1/models`,{method:"GET",headers:c})).json()}i.listModels=u})(ai||(ai={}));function Y$({name:i,isUser:r=!1,children:e}){return S.jsx("div",{className:"flex flex-col w-full items-start gap-2 py-2 animate-fadeIn",children:S.jsx("div",{className:"w-full",children:e})})}function MI({title:i,titleId:r,...e},t){return We.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},e),i?We.createElement("title",{id:r},i):null,We.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const BI=We.forwardRef(MI);function zpe({content:i,trace_id:r}){const[e,t]=We.useState(!1),[n,a]=We.useState(!1),o=async()=>{r&&(await navigator.clipboard.writeText(r),a(!0),setTimeout(()=>a(!1),2e3))};return S.jsx(Y$,{name:"User",isUser:!0,children:S.jsxs("div",{className:"w-full rounded-lg border border-gray-700 py-4 px-4 text-gray-700 text-sm break-words relative",children:[S.jsx("p",{className:"whitespace-pre-wrap leading-snug",children:i}),r&&S.jsxs("div",{className:"absolute bottom-1 right-1.5 cursor-pointer opacity-40 hover:opacity-100 transition-opacity",onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),onClick:o,children:[S.jsx(BI,{className:"h-3.5 w-3.5 text-gray-500 hover:text-gray-700"}),e&&S.jsx("div",{className:"absolute right-0 -top-6 bg-gray-700 text-white text-[10px] py-0.5 px-1.5 rounded shadow-sm whitespace-nowrap",children:n?"Copied!":"Copy trace ID"})]})]})})}const FI=We.memo(tI,(i,r)=>i.children===r.children&&i.className===r.className),jI=({content:i})=>S.jsxs("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-1 shadow-sm",children:[S.jsxs("div",{className:"flex items-center mb-1",children:[S.jsx("div",{className:"bg-blue-100 rounded-full p-1 mr-1",children:S.jsx("svg",{className:"h-4 w-4 text-blue-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),S.jsx("h3",{className:"text-sm font-medium text-blue-800",children:"Node Usage Guide"})]}),S.jsx("div",{className:"markdown-content text-blue-900",children:i})]}),LI=({content:i})=>S.jsxs("div",{className:"rounded-lg border border-green-200 bg-green-50 p-1 shadow-sm",children:[S.jsxs("div",{className:"flex items-center mb-1",children:[S.jsx("div",{className:"bg-green-100 rounded-full p-1 mr-1",children:S.jsxs("svg",{className:"h-4 w-4 text-green-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),S.jsx("h3",{className:"text-sm font-medium text-green-800",children:"Node Parameter Reference"})]}),S.jsx("div",{className:"markdown-content text-green-900",children:i})]});function Hpe({content:i,name:r="Assistant",avatar:e,format:t,onOptionClick:n,extComponent:a,metadata:o}){const s=We.useRef(),u=(h,c)=>S.jsx(FI,{rehypePlugins:[[rI,{target:"_blank"}],iI],remarkPlugins:[nI,aI],className:`prose prose-xs prose-neutral prose-a:text-accent-foreground/50 break-words [&>*]:!my-1 leading-relaxed text-xs text-gray-800 +`,e+="-----END PUBLIC KEY-----",e},r.hasPublicKeyProperty=function(e){return e=e||{},e.hasOwnProperty("n")&&e.hasOwnProperty("e")},r.hasPrivateKeyProperty=function(e){return e=e||{},e.hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")},r.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},r}(TI),CI={},oh,AI=typeof process<"u"?(oh=CI)===null||oh===void 0?void 0:oh.npm_package_version:void 0,DI=function(){function i(r){r===void 0&&(r={}),r=r||{},this.default_key_size=r.default_key_size?parseInt(r.default_key_size,10):1024,this.default_public_exponent=r.default_public_exponent||"010001",this.log=r.log||!1,this.key=null}return i.prototype.setKey=function(r){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new kp(r)},i.prototype.setPrivateKey=function(r){this.setKey(r)},i.prototype.setPublicKey=function(r){this.setKey(r)},i.prototype.decrypt=function(r){try{return this.getKey().decrypt(wp(r))}catch{return!1}},i.prototype.encrypt=function(r){try{return Iu(this.getKey().encrypt(r))}catch{return!1}},i.prototype.sign=function(r,e,t){try{return Iu(this.getKey().sign(r,e,t))}catch{return!1}},i.prototype.verify=function(r,e,t){try{return this.getKey().verify(r,wp(e),t)}catch{return!1}},i.prototype.getKey=function(r){if(!this.key){if(this.key=new kp,r&&{}.toString.call(r)==="[object Function]"){this.key.generateAsync(this.default_key_size,this.default_public_exponent,r);return}this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},i.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},i.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},i.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},i.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},i.version=AI,i}();async function Fpe(){try{const r=await(await fetch(`${Ff.apiBaseUrl}/api/chat/rsa_public_key`)).json();if(!r.success)throw new Error(r.message||"Failed to fetch RSA public key");return r.data}catch(i){throw console.error("Error fetching RSA public key:",i),i}}async function xn(i,r){try{if(window.crypto&&window.crypto.subtle){const e="-----BEGIN PUBLIC KEY-----",n=r.substring(r.indexOf(e)+e.length,r.indexOf("-----END PUBLIC KEY-----")).replace(/\s/g,""),a=window.atob(n),o=new ArrayBuffer(a.length),s=new Uint8Array(o);for(let d=0;dlocalStorage.getItem("chatApiKey"),Ba=()=>{const i=localStorage.getItem("openaiApiKey"),r=localStorage.getItem("openaiBaseUrl")||"https://api.openai.com/v1",e=localStorage.getItem("rsaPublicKey");return{openaiApiKey:i||"",openaiBaseUrl:r,rsaPublicKey:e}},Kr=()=>navigator.language||"zh-CN",yn=i=>{const r=i.headers.get("User-Api-Key");r&&!localStorage.getItem("chatApiKey")&&localStorage.setItem("chatApiKey",r)};var ai;(i=>{async function r(l){try{const h=Ur(),c=Kr();l.session_id=localStorage.getItem("sessionId")||null,fetch(`${Wr}/api/chat/track_event`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${h}`,"trace-id":dr(),"Accept-Language":c},body:JSON.stringify(l)}).catch(d=>{console.warn("Track event failed:",d)})}catch(h){console.warn("Error preparing track event:",h)}return Promise.resolve()}i.trackEvent=r;async function*e(l,h,c=[],d=null,f=null,v){try{const p=Ur(),g=Kr(),{openaiApiKey:y,openaiBaseUrl:m,rsaPublicKey:$}=Ba(),b=dr(),O=(c||[]).map(ie=>new Promise((_e,ye)=>{const Ae=new FileReader;Ae.onloadend=()=>_e(Ae.result),Ae.onerror=ye,Ae.readAsDataURL(ie)})),_=await Promise.all(O);let D=f?Array.isArray(f)?f:[f]:[];const R={"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${p}`,"trace-id":v||dr(),"Accept-Language":g};if(y&&y.trim()!==""&&$)try{const ie=await xn(y,$);R["Encrypted-Openai-Api-Key"]=ie,R["Openai-Base-Url"]=m}catch(ie){console.error("Error encrypting OpenAI API key:",ie)}const P=new AbortController,B=setTimeout(()=>P.abort(),12e4),j=await fetch(`${Wr}/api/chat/invoke`,{method:"POST",headers:R,body:JSON.stringify({session_id:l,prompt:h,mock:!1,intent:d,ext:D,images:_.map((ie,_e)=>({filename:c[_e].name,data:ie}))}),signal:P.signal});clearTimeout(B),yn(j);const J=j.body.getReader();let U="";for(;;){const{done:ie,value:_e}=await J.read();if(ie)break;U+=new TextDecoder().decode(_e);const ye=U.split(` +`);U=ye.pop()||"";for(const Ae of ye)Ae.trim()&&(yield{...JSON.parse(Ae),message_id:b})}U.trim()&&(yield{...JSON.parse(U),message_id:b})}catch(p){throw console.error("Error in streamInvokeServer:",p),p.name==="AbortError"?alert("Request timed out after 2 minutes. Please try again."):alert(p instanceof Error?p.message:"An error occurred while streaming, please refresh the page and try again."),p}}i.streamInvokeServer=e;async function t(l,h){try{const c=Ur(),d=Kr(),{openaiApiKey:f,openaiBaseUrl:v,rsaPublicKey:p}=Ba(),g={"Content-Type":"application/json",accept:"application/json","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${c}`,"trace-id":dr(),"Accept-Language":d};if(f&&f.trim()!==""&&p)try{const $=await xn(f,p);g["Encrypted-Openai-Api-Key"]=$,g["Openai-Base-Url"]=v}catch($){console.error("Error encrypting OpenAI API key:",$)}const y=await fetch(`${Wr}/api/chat/get_optimized_workflow`,{method:"POST",headers:g,body:JSON.stringify({workflow_id:l,prompt:h})});yn(y);const m=await y.json();if(!m.success){const $=m.message||"Failed to get optimized workflow";throw alert($),new Error($)}return m.data}catch(c){throw console.error("Error getting optimized workflow:",c),alert(c instanceof Error?c.message:"Failed to get optimized workflow"),c}}i.getOptimizedWorkflow=t;async function n(l){const h=Ur(),c=Kr(),{openaiApiKey:d,openaiBaseUrl:f,rsaPublicKey:v}=Ba(),p={"Content-Type":"application/json",Authorization:`Bearer ${h}`,"trace-id":dr(),"Accept-Language":c};if(d&&d.trim()!==""&&v)try{const m=await xn(d,v);p["Encrypted-Openai-Api-Key"]=m,p["Openai-Base-Url"]=f}catch(m){console.error("Error encrypting OpenAI API key:",m)}const g=await fetch(`${Wr}/api/chat/get_node_info_by_types`,{method:"POST",headers:p,body:JSON.stringify({node_types:l})});yn(g);const y=await g.json();if(!y.success){const m=y.message||"Failed to get node info by types";throw alert(m),new Error(m)}return y.data}i.batchGetNodeInfo=n;async function a(l){try{const h=localStorage.getItem(`messages_${l}`);if(h)return console.log("Using cached messages from localStorage"),JSON.parse(h);const c=Ur(),d=Kr(),{openaiApiKey:f,openaiBaseUrl:v,rsaPublicKey:p}=Ba(),g={accept:"application/json",Authorization:`Bearer ${c}`,"trace-id":dr(),"Accept-Language":d};if(f&&f.trim()!==""&&p)try{const b=await xn(f,p);g["Encrypted-Openai-Api-Key"]=b,g["Openai-Base-Url"]=v}catch(b){console.error("Error encrypting OpenAI API key:",b)}const y=await fetch(`${Wr}/api/chat/get_messages_by_session_id?session_id=${l}`,{method:"GET",headers:g});yn(y);const m=await y.json();if(!m.success){const b=m.message||"Failed to fetch messages";throw alert(b+", please refresh the page and try again."),new Error(b)}const $=m.data.map(b=>(console.log("msg.ext",b.ext),{id:b.id.toString(),content:b.role==="ai"?JSON.stringify({session_id:l,text:b.content,finished:b.finished||!1,format:b.format||"markdown",ext:b.ext}):b.content,role:b.role,name:b.role==="ai"?"Assistant":void 0,format:b.format||"markdown",finished:b.finished}));return localStorage.setItem(`messages_${l}`,JSON.stringify($)),$}catch(h){throw console.error("Error fetching messages:",h),alert(h instanceof Error?h.message:"Failed to fetch messages, please refresh the page and try again."),h}}i.fetchMessages=a;async function o(){try{const l=Ur(),h=Kr(),{openaiApiKey:c,openaiBaseUrl:d,rsaPublicKey:f}=Ba(),v={accept:"application/json",Authorization:`Bearer ${l}`,"trace-id":dr(),"Accept-Language":h};if(c&&c.trim()!==""&&f)try{const y=await xn(c,f);v["Encrypted-Openai-Api-Key"]=y,v["Openai-Base-Url"]=d}catch(y){console.error("Error encrypting OpenAI API key:",y)}const p=await fetch(`${Wr}/api/chat/announcement`,{method:"GET",headers:v});yn(p);const g=await p.json();if(!g.success){const y=g.message||"Failed to fetch announcement";return console.error(y),""}return g.data}catch(l){return console.error("Error fetching announcement:",l),""}}i.fetchAnnouncement=o;async function s(l){let c=0,d;for(;c<3;)try{const f=Ur(),v=Kr(),p={"Content-Type":"application/json",accept:"application/json",Authorization:`Bearer ${f}`,"trace-id":dr(),"Accept-Language":v},g=await fetch(`${Wr}/api/param_debug/generate_sd_prompts`,{method:"POST",headers:p,body:JSON.stringify({text:l})});yn(g);const y=await g.json();if(!y.success){const m=y.message||"Failed to generate SD prompts";throw new Error(m)}return y.data}catch(f){if(d=f,c++,c>=3)throw console.error("Error generating SD prompts after 3 attempts:",f),f;console.warn(`Attempt ${c} failed, retrying... Error: ${f instanceof Error?f.message:"Unknown error"}`),await new Promise(v=>setTimeout(v,500*Math.pow(2,c-1)))}throw d}i.generateSDPrompts=s;async function u(){const l=Ur(),h=Kr(),c={"Content-Type":"application/json",accept:"application/json",Authorization:`Bearer ${l}`,"trace-id":dr(),"Accept-Language":h};return await(await fetch(`${Wr}/v1/models`,{method:"GET",headers:c})).json()}i.listModels=u})(ai||(ai={}));function Y$({name:i,isUser:r=!1,children:e}){return S.jsx("div",{className:"flex flex-col w-full items-start gap-2 py-2 animate-fadeIn",children:S.jsx("div",{className:"w-full",children:e})})}function NI({title:i,titleId:r,...e},t){return We.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},e),i?We.createElement("title",{id:r},i):null,We.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const MI=We.forwardRef(NI);function Lpe({content:i,trace_id:r}){const[e,t]=We.useState(!1),[n,a]=We.useState(!1),o=async()=>{r&&(await navigator.clipboard.writeText(r),a(!0),setTimeout(()=>a(!1),2e3))};return S.jsx(Y$,{name:"User",isUser:!0,children:S.jsxs("div",{className:"w-full rounded-lg border border-gray-700 py-4 px-4 text-gray-700 text-sm break-words relative",children:[S.jsx("p",{className:"whitespace-pre-wrap leading-snug",children:i}),r&&S.jsxs("div",{className:"absolute bottom-1 right-1.5 cursor-pointer opacity-40 hover:opacity-100 transition-opacity",onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),onClick:o,children:[S.jsx(MI,{className:"h-3.5 w-3.5 text-gray-500 hover:text-gray-700"}),e&&S.jsx("div",{className:"absolute right-0 -top-6 bg-gray-700 text-white text-[10px] py-0.5 px-1.5 rounded shadow-sm whitespace-nowrap",children:n?"Copied!":"Copy trace ID"})]})]})})}const BI=We.memo(tI,(i,r)=>i.children===r.children&&i.className===r.className),FI=({content:i})=>S.jsxs("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-1 shadow-sm",children:[S.jsxs("div",{className:"flex items-center mb-1",children:[S.jsx("div",{className:"bg-blue-100 rounded-full p-1 mr-1",children:S.jsx("svg",{className:"h-4 w-4 text-blue-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),S.jsx("h3",{className:"text-sm font-medium text-blue-800",children:"Node Usage Guide"})]}),S.jsx("div",{className:"markdown-content text-blue-900",children:i})]}),jI=({content:i})=>S.jsxs("div",{className:"rounded-lg border border-green-200 bg-green-50 p-1 shadow-sm",children:[S.jsxs("div",{className:"flex items-center mb-1",children:[S.jsx("div",{className:"bg-green-100 rounded-full p-1 mr-1",children:S.jsxs("svg",{className:"h-4 w-4 text-green-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),S.jsx("h3",{className:"text-sm font-medium text-green-800",children:"Node Parameter Reference"})]}),S.jsx("div",{className:"markdown-content text-green-900",children:i})]});function zpe({content:i,name:r="Assistant",avatar:e,format:t,onOptionClick:n,extComponent:a,metadata:o}){const s=We.useRef(),u=(h,c)=>S.jsx(BI,{rehypePlugins:[[rI,{target:"_blank"}],iI],remarkPlugins:[nI,aI],className:`prose prose-xs prose-neutral prose-a:text-accent-foreground/50 break-words [&>*]:!my-1 leading-relaxed text-xs text-gray-800 prose-headings:font-semibold prose-h1:text-base prose-h2:text-sm @@ -36,7 +46,7 @@ version: 2.9.0 prose-li:text-xs prose-code:text-xs prose-pre:text-xs - `,components:{p:({children:d})=>S.jsx("p",{className:"!my-0.5 leading-relaxed text-xs",children:d}),strong:({children:d})=>S.jsx("strong",{className:"text-gray-900",children:d}),h1:({children:d})=>S.jsx("h1",{className:"text-base font-semibold !my-1",children:d}),h2:({children:d})=>S.jsx("h2",{className:"text-sm font-semibold !my-1",children:d}),h3:({children:d})=>S.jsx("h3",{className:"text-xs font-semibold !my-1",children:d}),h4:({children:d})=>S.jsx("h4",{className:"text-xs font-semibold !my-1",children:d}),table:({children:d})=>S.jsx("table",{className:"border-solid border w-[100%] text-xs",children:d}),th:({children:d})=>S.jsx("th",{className:"border-solid border text-center pt-2 text-xs",children:d}),td:({children:d})=>{if(Array.isArray(d)&&d?.length>0){const f=[],v=d.length;for(let p=0;p"?f.push(S.jsx("br",{})):f.push(d[p]);d=f}return S.jsx("td",{className:"border-solid border border-[#979797] text-center text-xs",children:d})},code:({children:d})=>{const[f,v]=We.useState(!1),p=async()=>{try{await navigator.clipboard.writeText(d),v(!0),setTimeout(()=>v(!1),2e3)}catch(g){console.error("Failed to copy text:",g)}};return S.jsxs("span",{className:"relative group inline-flex items-center",children:[S.jsx("code",{className:"text-xs bg-gray-100 text-gray-900 rounded px-1",children:d}),S.jsx("button",{onClick:p,className:"absolute top-0 right-0 bg-gray-200 rounded p-1 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-gray-300 z-10","aria-label":"Copy code",children:f?S.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:S.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):S.jsxs("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:[S.jsx("path",{d:"M8 2a1 1 0 000 2h2a1 1 0 100-2H8z"}),S.jsx("path",{d:"M3 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v6h-4.586l1.293-1.293a1 1 0 00-1.414-1.414l-3 3a1 1 0 000 1.414l3 3a1 1 0 001.414-1.414L10.414 13H15v3a2 2 0 01-2 2H5a2 2 0 01-2-2V5z"})]})})]})},pre:({children:d})=>S.jsx("pre",{className:"text-xs bg-gray-100 text-gray-800 rounded p-2 overflow-x-auto",children:d}),img:({node:d,...f})=>S.jsx("div",{className:"w-1/2 mx-auto",children:S.jsx("img",{...f,loading:"lazy",className:"w-full h-auto block",onError:v=>{console.warn("Image failed to load:",f.src,"Error:",v),v.currentTarget.style.opacity="0"}})}),a:({href:d,children:f})=>{let v="markdown",p=null;try{const g=JSON.parse(i);v=g.ext?.[0]?.type||"markdown",p=g?.message_id}catch(g){console.error("Error parsing content:",g)}return S.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",onClick:()=>{ai.trackEvent({event_type:"markdown_link_click",message_type:v,message_id:p,data:{link_url:d,link_text:f}})},children:f})}},children:h}),l=()=>{try{const h=JSON.parse(i),c=h.ext?.find(d=>d.type==="guides")?.data||[];if(o?.intent){const d=o.intent;if(d==="node_explain")return S.jsx(jI,{content:u(h.text||"")});if(d==="node_params")return S.jsx(LI,{content:u(h.text||"")})}return S.jsxs("div",{className:"space-y-3",children:[t==="markdown"&&h.text?S.jsx("div",{ref:s,children:u(h.text)}):h.text?S.jsx("p",{className:"whitespace-pre-wrap text-left",children:h.text}):null,c.length>0&&S.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:c.map((d,f)=>S.jsx("button",{className:"px-3 py-1.5 text-gray-700 rounded-md hover:bg-gray-50 transition-colors text-[12px] w-[calc(50%-0.25rem)]",onClick:()=>n?.(d),children:d},f))}),a]})}catch{return S.jsx("p",{className:"whitespace-pre-wrap text-left",children:i})}};return S.jsx(Y$,{name:r,children:S.jsx("div",{className:"w-full rounded-lg bg-gray-50 p-4 text-gray-900 text-sm break-words overflow-hidden",children:l()})})}const zI=LiteGraph;function X$(i,r={}){const e=zI.createNode(i,"",r);if(!r.pos){const t=Mt.canvas.canvas.getBoundingClientRect(),n=t.width/2/Mt.canvas.ds.scale+-Mt.canvas.ds.offset[0]/Mt.canvas.ds.scale,a=t.height/2/Mt.canvas.ds.scale+-Mt.canvas.ds.offset[1]/Mt.canvas.ds.scale;e.pos=[n-e.size[0]/2,a-e.size[1]/2]}return Mt.graph.add(e),e}function HI({content:i,name:r="Assistant",avatar:e,installedNodes:t}){const n=JSON.parse(i),[a,o]=We.useState(null),[s,u]=We.useState(null),l=n.ext?.find(g=>g.type==="node")?.data||[],h=g=>t.some(y=>y===g),c=l.filter(g=>h(g.name)),d=l.filter(g=>!h(g.name)),f=g=>g>=1e4?`${(g/1e4).toFixed(1)}w`:g>=1e3?`${(g/1e3).toFixed(1)}k`:g.toString(),v=g=>{o(g.name),u(g)},p=()=>{o(null),u(null)};return S.jsxs("div",{className:"rounded-lg bg-gray-50 p-3 text-gray-700 text-xs break-words overflow-visible",children:[c.length>0&&S.jsxs("div",{className:"space-y-3",children:[S.jsx("p",{className:"text-xs font-medium",children:"Installed nodes:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:c.map(g=>S.jsxs("div",{className:`w-full p-3 rounded-lg border border-gray-200 + `,components:{p:({children:d})=>S.jsx("p",{className:"!my-0.5 leading-relaxed text-xs",children:d}),strong:({children:d})=>S.jsx("strong",{className:"text-gray-900",children:d}),h1:({children:d})=>S.jsx("h1",{className:"text-base font-semibold !my-1",children:d}),h2:({children:d})=>S.jsx("h2",{className:"text-sm font-semibold !my-1",children:d}),h3:({children:d})=>S.jsx("h3",{className:"text-xs font-semibold !my-1",children:d}),h4:({children:d})=>S.jsx("h4",{className:"text-xs font-semibold !my-1",children:d}),table:({children:d})=>S.jsx("table",{className:"border-solid border w-[100%] text-xs",children:d}),th:({children:d})=>S.jsx("th",{className:"border-solid border text-center pt-2 text-xs",children:d}),td:({children:d})=>{if(Array.isArray(d)&&d?.length>0){const f=[],v=d.length;for(let p=0;p"?f.push(S.jsx("br",{})):f.push(d[p]);d=f}return S.jsx("td",{className:"border-solid border border-[#979797] text-center text-xs",children:d})},code:({children:d})=>{const[f,v]=We.useState(!1),p=async()=>{try{await navigator.clipboard.writeText(d),v(!0),setTimeout(()=>v(!1),2e3)}catch(g){console.error("Failed to copy text:",g)}};return S.jsxs("span",{className:"relative group inline-flex items-center",children:[S.jsx("code",{className:"text-xs bg-gray-100 text-gray-900 rounded px-1",children:d}),S.jsx("button",{onClick:p,className:"absolute top-0 right-0 bg-gray-200 rounded p-1 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-gray-300 z-10","aria-label":"Copy code",children:f?S.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:S.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):S.jsxs("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:[S.jsx("path",{d:"M8 2a1 1 0 000 2h2a1 1 0 100-2H8z"}),S.jsx("path",{d:"M3 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v6h-4.586l1.293-1.293a1 1 0 00-1.414-1.414l-3 3a1 1 0 000 1.414l3 3a1 1 0 001.414-1.414L10.414 13H15v3a2 2 0 01-2 2H5a2 2 0 01-2-2V5z"})]})})]})},pre:({children:d})=>S.jsx("pre",{className:"text-xs bg-gray-100 text-gray-800 rounded p-2 overflow-x-auto",children:d}),img:({node:d,...f})=>S.jsx("div",{className:"w-1/2 mx-auto",children:S.jsx("img",{...f,loading:"lazy",className:"w-full h-auto block",onError:v=>{console.warn("Image failed to load:",f.src,"Error:",v),v.currentTarget.style.opacity="0"}})}),a:({href:d,children:f})=>{let v="markdown",p=null;try{const g=JSON.parse(i);v=g.ext?.[0]?.type||"markdown",p=g?.message_id}catch(g){console.error("Error parsing content:",g)}return S.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",onClick:()=>{ai.trackEvent({event_type:"markdown_link_click",message_type:v,message_id:p,data:{link_url:d,link_text:f}})},children:f})}},children:h}),l=()=>{try{const h=JSON.parse(i),c=h.ext?.find(d=>d.type==="guides")?.data||[];if(o?.intent){const d=o.intent;if(d==="node_explain")return S.jsx(FI,{content:u(h.text||"")});if(d==="node_params")return S.jsx(jI,{content:u(h.text||"")})}return S.jsxs("div",{className:"space-y-3",children:[t==="markdown"&&h.text?S.jsx("div",{ref:s,children:u(h.text)}):h.text?S.jsx("p",{className:"whitespace-pre-wrap text-left",children:h.text}):null,c.length>0&&S.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:c.map((d,f)=>S.jsx("button",{className:"px-3 py-1.5 text-gray-700 rounded-md hover:bg-gray-50 transition-colors text-[12px] w-[calc(50%-0.25rem)]",onClick:()=>n?.(d),children:d},f))}),a]})}catch{return S.jsx("p",{className:"whitespace-pre-wrap text-left",children:i})}};return S.jsx(Y$,{name:r,children:S.jsx("div",{className:"w-full rounded-lg bg-gray-50 p-4 text-gray-900 text-sm break-words overflow-hidden",children:l()})})}const LI=LiteGraph;function X$(i,r={}){const e=LI.createNode(i,"",r);if(!r.pos){const t=Mt.canvas.canvas.getBoundingClientRect(),n=t.width/2/Mt.canvas.ds.scale+-Mt.canvas.ds.offset[0]/Mt.canvas.ds.scale,a=t.height/2/Mt.canvas.ds.scale+-Mt.canvas.ds.offset[1]/Mt.canvas.ds.scale;e.pos=[n-e.size[0]/2,a-e.size[1]/2]}return Mt.graph.add(e),e}function zI({content:i,name:r="Assistant",avatar:e,installedNodes:t}){const n=JSON.parse(i),[a,o]=We.useState(null),[s,u]=We.useState(null),l=n.ext?.find(g=>g.type==="node")?.data||[],h=g=>t.some(y=>y===g),c=l.filter(g=>h(g.name)),d=l.filter(g=>!h(g.name)),f=g=>g>=1e4?`${(g/1e4).toFixed(1)}w`:g>=1e3?`${(g/1e3).toFixed(1)}k`:g.toString(),v=g=>{o(g.name),u(g)},p=()=>{o(null),u(null)};return S.jsxs("div",{className:"rounded-lg bg-gray-50 p-3 text-gray-700 text-xs break-words overflow-visible",children:[c.length>0&&S.jsxs("div",{className:"space-y-3",children:[S.jsx("p",{className:"text-xs font-medium",children:"Installed nodes:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:c.map(g=>S.jsxs("div",{className:`w-full p-3 rounded-lg border border-gray-200 hover:shadow-sm transition-all duration-200 relative group`,onMouseEnter:()=>v(g),onMouseLeave:p,children:[S.jsx("h3",{className:"text-[12px] font-medium text-gray-800 mb-4",children:g.name}),S.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[S.jsxs("div",{className:"flex items-center gap-1 text-gray-600",children:[S.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{d:"M12 .25a.75.75 0 0 1 .673.418l3.058 6.197 6.839.994a.75.75 0 0 1 .415 1.279l-4.948 4.823 1.168 6.811a.75.75 0 0 1-1.088.791L12 18.347l-6.117 3.216a.75.75 0 0 1-1.088-.79l1.168-6.812-4.948-4.823a.75.75 0 0 1 .416-1.28l6.838-.993L11.327.668A.75.75 0 0 1 12 .25z"})}),S.jsx("span",{children:f(g.github_stars||0)})]}),S.jsxs("button",{className:`px-2 py-1 bg-blue-500 text-white rounded-md hover:bg-blue-600 transition-colors text-[10px] flex items-center gap-1`,onClick:()=>{const y=X$(g.name);y&&(y.connect(g.from_index,y,g.to_index),ai.trackEvent({event_type:"node_add_to_canvas",message_type:"node",message_id:n.message_id,data:{node_name:g.name}}))},children:[S.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add to Canvas"]})]})]},g.name))})]}),d.length>0&&S.jsxs("div",{className:`space-y-3 ${c.length>0?"mt-4":""}`,children:[S.jsx("p",{className:"text-xs font-medium",children:"Uninstalled nodes:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:d.map(g=>S.jsxs("div",{className:`w-full p-3 rounded-lg border border-gray-200 hover:shadow-sm transition-all duration-200 relative group`,onMouseEnter:()=>v(g),onMouseLeave:p,children:[S.jsx("h3",{className:"text-[12px] font-medium text-gray-800 mb-4",children:g.name}),S.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[S.jsxs("div",{className:"flex items-center gap-1 text-gray-600",children:[S.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{d:"M12 .25a.75.75 0 0 1 .673.418l3.058 6.197 6.839.994a.75.75 0 0 1 .415 1.279l-4.948 4.823 1.168 6.811a.75.75 0 0 1-1.088.791L12 18.347l-6.117 3.216a.75.75 0 0 1-1.088-.79l1.168-6.812-4.948-4.823a.75.75 0 0 1 .416-1.28l6.838-.993L11.327.668A.75.75 0 0 1 12 .25z"})}),S.jsx("span",{children:f(g.github_stars||0)})]}),g.github_url?S.jsxs("a",{href:g.github_url,target:"_blank",rel:"noopener noreferrer",className:`px-2 py-1 text-gray-900 rounded-md @@ -44,7 +54,7 @@ version: 2.9.0 transition-colors text-[10px] flex items-center gap-1`,onClick:()=>{ai.trackEvent({event_type:"node_download",message_type:"node",message_id:n.message_id,data:{node_name:g.name,github_url:g.github_url}})},children:[S.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}):S.jsxs("a",{href:`https://www.google.com/search?q=${encodeURIComponent(g.name+" comfyui custom node")}`,target:"_blank",rel:"noopener noreferrer",className:`px-2 py-1 bg-gray-100 text-gray-500 rounded-md border border-gray-300 text-[10px] flex items-center gap-1`,onClick:()=>{ai.trackEvent({event_type:"node_search",message_type:"node",message_id:n.message_id,data:{node_name:g.name}})},children:[S.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 21h7a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v11m0 5l4.879-4.879m0 0a3 3 0 104.243-4.242 3 3 0 00-4.243 4.242z"})}),"Search on Google"]})]})]},g.name))})]}),a&&s?.description&&S.jsxs("div",{className:`fixed -translate-y-full z-[9999] w-64 p-2 bg-gray-800 text-white text-xs rounded-md shadow-lg mb-2`,style:{left:"calc(var(--mouse-x, 0) + 16px)",top:"calc(var(--mouse-y, 0) - 8px)"},children:[s.description,S.jsx("div",{className:`absolute -bottom-1 left-1/2 -translate-x-1/2 - border-4 border-transparent border-t-gray-800`})]})]})}const Vpe=Object.freeze(Object.defineProperty({__proto__:null,NodeSearch:HI},Symbol.toStringTag,{value:"Module"}));/** + border-4 border-transparent border-t-gray-800`})]})]})}const Hpe=Object.freeze(Object.defineProperty({__proto__:null,NodeSearch:zI},Symbol.toStringTag,{value:"Module"}));/** * vis-data * http://visjs.org/ * @@ -68,19 +78,19 @@ version: 2.9.0 * http://opensource.org/licenses/MIT * * vis.js may be distributed under either license. - */function tl(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")}var sh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Y(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var J$={exports:{}},Es=function(i){return i&&i.Math===Math&&i},$e=Es(typeof globalThis=="object"&&globalThis)||Es(typeof window=="object"&&window)||Es(typeof self=="object"&&self)||Es(typeof sh=="object"&&sh)||function(){return this}()||sh||Function("return this")(),le=function(i){try{return!!i()}catch{return!0}},VI=le,Oo=!VI(function(){var i=function(){}.bind();return typeof i!="function"||i.hasOwnProperty("prototype")}),WI=Oo,Z$=Function.prototype,Pp=Z$.apply,xp=Z$.call,ha=typeof Reflect=="object"&&Reflect.apply||(WI?xp.bind(Pp):function(){return xp.apply(Pp,arguments)}),Q$=Oo,e0=Function.prototype,Ed=e0.call,UI=Q$&&e0.bind.bind(Ed,Ed),be=Q$?UI:function(i){return function(){return Ed.apply(i,arguments)}},t0=be,KI=t0({}.toString),GI=t0("".slice),yi=function(i){return GI(KI(i),8,-1)},qI=yi,YI=be,r0=function(i){if(qI(i)==="Function")return YI(i)},Sd=typeof document=="object"&&document.all,XI=typeof Sd>"u"&&Sd!==void 0,i0={all:Sd,IS_HTMLDDA:XI},n0=i0,JI=n0.all,Ie=n0.IS_HTMLDDA?function(i){return typeof i=="function"||i===JI}:function(i){return typeof i=="function"},Qi={},ZI=le,qe=!ZI(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),QI=Oo,Ss=Function.prototype.call,Ye=QI?Ss.bind(Ss):function(){return Ss.apply(Ss,arguments)},rl={},a0={}.propertyIsEnumerable,o0=Object.getOwnPropertyDescriptor,ek=o0&&!a0.call({1:2},1);rl.f=ek?function(r){var e=o0(this,r);return!!e&&e.enumerable}:a0;var en=function(i,r){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:r}},tk=be,rk=le,ik=yi,uh=Object,nk=tk("".split),il=rk(function(){return!uh("z").propertyIsEnumerable(0)})?function(i){return ik(i)==="String"?nk(i,""):uh(i)}:uh,ca=function(i){return i==null},ak=ca,ok=TypeError,Lf=function(i){if(ak(i))throw new ok("Can't call method on "+i);return i},sk=il,uk=Lf,$r=function(i){return sk(uk(i))},Cp=Ie,s0=i0,lk=s0.all,nt=s0.IS_HTMLDDA?function(i){return typeof i=="object"?i!==null:Cp(i)||i===lk}:function(i){return typeof i=="object"?i!==null:Cp(i)},we={},lh=we,hh=$e,hk=Ie,Ap=function(i){return hk(i)?i:void 0},mt=function(i,r){return arguments.length<2?Ap(lh[i])||Ap(hh[i]):lh[i]&&lh[i][r]||hh[i]&&hh[i][r]},ck=be,He=ck({}.isPrototypeOf),mi=typeof navigator<"u"&&String(navigator.userAgent)||"",u0=$e,ch=mi,Dp=u0.process,Rp=u0.Deno,Np=Dp&&Dp.versions||Rp&&Rp.version,Mp=Np&&Np.v8,tr,ku;Mp&&(tr=Mp.split("."),ku=tr[0]>0&&tr[0]<4?1:+(tr[0]+tr[1]));!ku&&ch&&(tr=ch.match(/Edge\/(\d+)/),(!tr||tr[1]>=74)&&(tr=ch.match(/Chrome\/(\d+)/),tr&&(ku=+tr[1])));var da=ku,Bp=da,dk=le,fk=$e,vk=fk.String,fa=!!Object.getOwnPropertySymbols&&!dk(function(){var i=Symbol("symbol detection");return!vk(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&Bp&&Bp<41}),pk=fa,l0=pk&&!Symbol.sham&&typeof Symbol.iterator=="symbol",gk=mt,yk=Ie,mk=He,bk=l0,$k=Object,To=bk?function(i){return typeof i=="symbol"}:function(i){var r=gk("Symbol");return yk(r)&&mk(r.prototype,$k(i))},wk=String,va=function(i){try{return wk(i)}catch{return"Object"}},_k=Ie,Ek=va,Sk=TypeError,Pt=function(i){if(_k(i))return i;throw new Sk(Ek(i)+" is not a function")},Ok=Pt,Tk=ca,zf=function(i,r){var e=i[r];return Tk(e)?void 0:Ok(e)},dh=Ye,fh=Ie,vh=nt,Ik=TypeError,kk=function(i,r){var e,t;if(r==="string"&&fh(e=i.toString)&&!vh(t=dh(e,i))||fh(e=i.valueOf)&&!vh(t=dh(e,i))||r!=="string"&&fh(e=i.toString)&&!vh(t=dh(e,i)))return t;throw new Ik("Can't convert object to primitive value")},h0={exports:{}},Pk=!0,Fp=$e,xk=Object.defineProperty,Ck=function(i,r){try{xk(Fp,i,{value:r,configurable:!0,writable:!0})}catch{Fp[i]=r}return r},Ak=$e,Dk=Ck,jp="__core-js_shared__",Rk=Ak[jp]||Dk(jp,{}),Hf=Rk,Lp=Hf;(h0.exports=function(i,r){return Lp[i]||(Lp[i]=r!==void 0?r:{})})("versions",[]).push({version:"3.33.2",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.2/LICENSE",source:"https://github.com/zloirock/core-js"});var pa=h0.exports,Nk=Lf,Mk=Object,xt=function(i){return Mk(Nk(i))},Bk=be,Fk=xt,jk=Bk({}.hasOwnProperty),Ve=Object.hasOwn||function(r,e){return jk(Fk(r),e)},Lk=be,zk=0,Hk=Math.random(),Vk=Lk(1 .toString),nl=function(i){return"Symbol("+(i===void 0?"":i)+")_"+Vk(++zk+Hk,36)},Wk=$e,Uk=pa,zp=Ve,Kk=nl,Gk=fa,qk=l0,An=Wk.Symbol,ph=Uk("wks"),Yk=qk?An.for||An:An&&An.withoutSetter||Kk,Ee=function(i){return zp(ph,i)||(ph[i]=Gk&&zp(An,i)?An[i]:Yk("Symbol."+i)),ph[i]},Xk=Ye,Hp=nt,Vp=To,Jk=zf,Zk=kk,Qk=Ee,eP=TypeError,tP=Qk("toPrimitive"),rP=function(i,r){if(!Hp(i)||Vp(i))return i;var e=Jk(i,tP),t;if(e){if(r===void 0&&(r="default"),t=Xk(e,i,r),!Hp(t)||Vp(t))return t;throw new eP("Can't convert object to primitive value")}return r===void 0&&(r="number"),Zk(i,r)},iP=rP,nP=To,al=function(i){var r=iP(i,"string");return nP(r)?r:r+""},aP=$e,Wp=nt,Od=aP.document,oP=Wp(Od)&&Wp(Od.createElement),Vf=function(i){return oP?Od.createElement(i):{}},sP=qe,uP=le,lP=Vf,c0=!sP&&!uP(function(){return Object.defineProperty(lP("div"),"a",{get:function(){return 7}}).a!==7}),hP=qe,cP=Ye,dP=rl,fP=en,vP=$r,pP=al,gP=Ve,yP=c0,Up=Object.getOwnPropertyDescriptor;Qi.f=hP?Up:function(r,e){if(r=vP(r),e=pP(e),yP)try{return Up(r,e)}catch{}if(gP(r,e))return fP(!cP(dP.f,r,e),r[e])};var mP=le,bP=Ie,$P=/#|\.prototype\./,Io=function(i,r){var e=_P[wP(i)];return e===SP?!0:e===EP?!1:bP(r)?mP(r):!!r},wP=Io.normalize=function(i){return String(i).replace($P,".").toLowerCase()},_P=Io.data={},EP=Io.NATIVE="N",SP=Io.POLYFILL="P",d0=Io,Kp=r0,OP=Pt,TP=Oo,IP=Kp(Kp.bind),bi=function(i,r){return OP(i),r===void 0?i:TP?IP(i,r):function(){return i.apply(r,arguments)}},Ct={},kP=qe,PP=le,f0=kP&&PP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),xP=nt,CP=String,AP=TypeError,jt=function(i){if(xP(i))return i;throw new AP(CP(i)+" is not an object")},DP=qe,RP=c0,NP=f0,Os=jt,Gp=al,MP=TypeError,gh=Object.defineProperty,BP=Object.getOwnPropertyDescriptor,yh="enumerable",mh="configurable",bh="writable";Ct.f=DP?NP?function(r,e,t){if(Os(r),e=Gp(e),Os(t),typeof r=="function"&&e==="prototype"&&"value"in t&&bh in t&&!t[bh]){var n=BP(r,e);n&&n[bh]&&(r[e]=t.value,t={configurable:mh in t?t[mh]:n[mh],enumerable:yh in t?t[yh]:n[yh],writable:!1})}return gh(r,e,t)}:gh:function(r,e,t){if(Os(r),e=Gp(e),Os(t),RP)try{return gh(r,e,t)}catch{}if("get"in t||"set"in t)throw new MP("Accessors not supported");return"value"in t&&(r[e]=t.value),r};var FP=qe,jP=Ct,LP=en,Lr=FP?function(i,r,e){return jP.f(i,r,LP(1,e))}:function(i,r,e){return i[r]=e,i},Ts=$e,zP=ha,HP=r0,VP=Ie,WP=Qi.f,UP=d0,mn=we,KP=bi,bn=Lr,qp=Ve,GP=function(i){var r=function(e,t,n){if(this instanceof r){switch(arguments.length){case 0:return new i;case 1:return new i(e);case 2:return new i(e,t)}return new i(e,t,n)}return zP(i,this,arguments)};return r.prototype=i.prototype,r},K=function(i,r){var e=i.target,t=i.global,n=i.stat,a=i.proto,o=t?Ts:n?Ts[e]:(Ts[e]||{}).prototype,s=t?mn:mn[e]||bn(mn,e,{})[e],u=s.prototype,l,h,c,d,f,v,p,g,y;for(d in r)l=UP(t?d:e+(n?".":"#")+d,i.forced),h=!l&&o&&qp(o,d),v=s[d],h&&(i.dontCallGetSet?(y=WP(o,d),p=y&&y.value):p=o[d]),f=h&&p?p:r[d],!(h&&typeof v==typeof f)&&(i.bind&&h?g=KP(f,Ts):i.wrap&&h?g=GP(f):a&&VP(f)?g=HP(f):g=f,(i.sham||f&&f.sham||v&&v.sham)&&bn(g,"sham",!0),bn(s,d,g),a&&(c=e+"Prototype",qp(mn,c)||bn(mn,c,{}),bn(mn[c],d,f),i.real&&u&&(l||!u[d])&&bn(u,d,f)))},qP=K,YP=qe,Yp=Ct.f;qP({target:"Object",stat:!0,forced:Object.defineProperty!==Yp,sham:!YP},{defineProperty:Yp});var XP=we,v0=XP.Object,JP=J$.exports=function(r,e,t){return v0.defineProperty(r,e,t)};v0.defineProperty.sham&&(JP.sham=!0);var ZP=J$.exports,QP=ZP,p0=QP,ex=p0,tx=ex,rx=tx,ix=rx,g0=ix,ol=Y(g0),nx=yi,$i=Array.isArray||function(r){return nx(r)==="Array"},ax=Math.ceil,ox=Math.floor,sx=Math.trunc||function(r){var e=+r;return(e>0?ox:ax)(e)},ux=sx,sl=function(i){var r=+i;return r!==r||r===0?0:ux(r)},lx=sl,hx=Math.min,cx=function(i){return i>0?hx(lx(i),9007199254740991):0},dx=cx,Lt=function(i){return dx(i.length)},fx=TypeError,vx=9007199254740991,ul=function(i){if(i>vx)throw fx("Maximum allowed index exceeded");return i},px=al,gx=Ct,yx=en,ga=function(i,r,e){var t=px(r);t in i?gx.f(i,t,yx(0,e)):i[t]=e},mx=Ee,bx=mx("toStringTag"),y0={};y0[bx]="z";var Wf=String(y0)==="[object z]",$x=Wf,wx=Ie,lu=yi,_x=Ee,Ex=_x("toStringTag"),Sx=Object,Ox=lu(function(){return arguments}())==="Arguments",Tx=function(i,r){try{return i[r]}catch{}},zr=$x?lu:function(i){var r,e,t;return i===void 0?"Undefined":i===null?"Null":typeof(e=Tx(r=Sx(i),Ex))=="string"?e:Ox?lu(r):(t=lu(r))==="Object"&&wx(r.callee)?"Arguments":t},Ix=be,kx=Ie,Td=Hf,Px=Ix(Function.toString);kx(Td.inspectSource)||(Td.inspectSource=function(i){return Px(i)});var m0=Td.inspectSource,xx=be,Cx=le,b0=Ie,Ax=zr,Dx=mt,Rx=m0,$0=function(){},Nx=[],w0=Dx("Reflect","construct"),Uf=/^\s*(?:class|function)\b/,Mx=xx(Uf.exec),Bx=!Uf.test($0),Fa=function(r){if(!b0(r))return!1;try{return w0($0,Nx,r),!0}catch{return!1}},_0=function(r){if(!b0(r))return!1;switch(Ax(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Bx||!!Mx(Uf,Rx(r))}catch{return!0}};_0.sham=!0;var ll=!w0||Cx(function(){var i;return Fa(Fa.call)||!Fa(Object)||!Fa(function(){i=!0})||i})?_0:Fa,Xp=$i,Fx=ll,jx=nt,Lx=Ee,zx=Lx("species"),Jp=Array,Hx=function(i){var r;return Xp(i)&&(r=i.constructor,Fx(r)&&(r===Jp||Xp(r.prototype))?r=void 0:jx(r)&&(r=r[zx],r===null&&(r=void 0))),r===void 0?Jp:r},Vx=Hx,hl=function(i,r){return new(Vx(i))(r===0?0:r)},Wx=le,Ux=Ee,Kx=da,Gx=Ux("species"),ko=function(i){return Kx>=51||!Wx(function(){var r=[],e=r.constructor={};return e[Gx]=function(){return{foo:1}},r[i](Boolean).foo!==1})},qx=K,Yx=le,Xx=$i,Jx=nt,Zx=xt,Qx=Lt,Zp=ul,Qp=ga,eC=hl,tC=ko,rC=Ee,iC=da,E0=rC("isConcatSpreadable"),nC=iC>=51||!Yx(function(){var i=[];return i[E0]=!1,i.concat()[0]!==i}),aC=function(i){if(!Jx(i))return!1;var r=i[E0];return r!==void 0?!!r:Xx(i)},oC=!nC||!tC("concat");qx({target:"Array",proto:!0,arity:1,forced:oC},{concat:function(r){var e=Zx(this),t=eC(e,0),n=0,a,o,s,u,l;for(a=-1,s=arguments.length;ao;)if(s=n[o++],s!==s)return!0}else for(;a>o;o++)if((i||o in n)&&n[o]===e)return i||o||0;return!i&&-1}},pC={includes:eg(!0),indexOf:eg(!1)},Po={},gC=be,$h=Ve,yC=$r,mC=pC.indexOf,bC=Po,tg=gC([].push),S0=function(i,r){var e=yC(i),t=0,n=[],a;for(a in e)!$h(bC,a)&&$h(e,a)&&tg(n,a);for(;r.length>t;)$h(e,a=r[t++])&&(~mC(n,a)||tg(n,a));return n},Kf=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],$C=S0,wC=Kf,fl=Object.keys||function(r){return $C(r,wC)},_C=qe,EC=f0,SC=Ct,OC=jt,TC=$r,IC=fl;cl.f=_C&&!EC?Object.defineProperties:function(r,e){OC(r);for(var t=TC(e),n=IC(e),a=n.length,o=0,s;a>o;)SC.f(r,s=n[o++],t[s]);return r};var kC=mt,O0=kC("document","documentElement"),PC=pa,xC=nl,rg=PC("keys"),vl=function(i){return rg[i]||(rg[i]=xC(i))},CC=jt,AC=cl,ig=Kf,DC=Po,RC=O0,NC=Vf,MC=vl,ng=">",ag="<",Id="prototype",kd="script",T0=MC("IE_PROTO"),wh=function(){},I0=function(i){return ag+kd+ng+i+ag+"/"+kd+ng},og=function(i){i.write(I0("")),i.close();var r=i.parentWindow.Object;return i=null,r},BC=function(){var i=NC("iframe"),r="java"+kd+":",e;return i.style.display="none",RC.appendChild(i),i.src=String(r),e=i.contentWindow.document,e.open(),e.write(I0("document.F=Object")),e.close(),e.F},Is,hu=function(){try{Is=new ActiveXObject("htmlfile")}catch{}hu=typeof document<"u"?document.domain&&Is?og(Is):BC():og(Is);for(var i=ig.length;i--;)delete hu[Id][ig[i]];return hu()};DC[T0]=!0;var rn=Object.create||function(r,e){var t;return r!==null?(wh[Id]=CC(r),t=new wh,wh[Id]=null,t[T0]=r):t=hu(),e===void 0?t:AC.f(t,e)},xo={},FC=S0,jC=Kf,LC=jC.concat("length","prototype");xo.f=Object.getOwnPropertyNames||function(r){return FC(r,LC)};var Gf={},sg=dl,zC=Lt,HC=ga,VC=Array,WC=Math.max,k0=function(i,r,e){for(var t=zC(i),n=sg(r,t),a=sg(e===void 0?t:e,t),o=VC(WC(a-n,0)),s=0;ng;g++)if((s||g in f)&&($=f[g],b=v($,g,d),i))if(r)m[g]=b;else if(b)switch(i){case 3:return!0;case 5:return $;case 6:return g;case 2:dg(m,$)}else switch(i){case 4:return!1;case 7:dg(m,$)}return a?-1:t||n?n:m}},ba={forEach:Gr(0),map:Gr(1),filter:Gr(2),some:Gr(3),every:Gr(4),find:Gr(5),findIndex:Gr(6),filterReject:Gr(7)},pl=K,Do=$e,Yf=Ye,C2=be,Yn=qe,Xn=fa,A2=le,Ke=Ve,D2=He,xd=jt,gl=$r,Xf=al,R2=tn,Cd=en,uo=rn,D0=fl,N2=xo,R0=Gf,M2=Co,N0=Qi,M0=Ct,B2=cl,B0=rl,fg=ya,F2=qf,Jf=pa,j2=vl,F0=Po,vg=nl,L2=Ee,z2=Ao,H2=ke,V2=C0,W2=nn,j0=ma,yl=ba.forEach,Et=j2("hidden"),ml="Symbol",lo="prototype",U2=j0.set,pg=j0.getterFor(ml),ar=Object[lo],Ri=Do.Symbol,Ka=Ri&&Ri[lo],K2=Do.RangeError,G2=Do.TypeError,Sh=Do.QObject,L0=N0.f,Ni=M0.f,z0=R0.f,q2=B0.f,H0=C2([].push),Mr=Jf("symbols"),Ro=Jf("op-symbols"),Y2=Jf("wks"),Ad=!Sh||!Sh[lo]||!Sh[lo].findChild,V0=function(i,r,e){var t=L0(ar,r);t&&delete ar[r],Ni(i,r,e),t&&i!==ar&&Ni(ar,r,t)},Dd=Yn&&A2(function(){return uo(Ni({},"a",{get:function(){return Ni(this,"a",{value:7}).a}})).a!==7})?V0:Ni,Oh=function(i,r){var e=Mr[i]=uo(Ka);return U2(e,{type:ml,tag:i,description:r}),Yn||(e.description=r),e},bl=function(r,e,t){r===ar&&bl(Ro,e,t),xd(r);var n=Xf(e);return xd(t),Ke(Mr,n)?(t.enumerable?(Ke(r,Et)&&r[Et][n]&&(r[Et][n]=!1),t=uo(t,{enumerable:Cd(0,!1)})):(Ke(r,Et)||Ni(r,Et,Cd(1,{})),r[Et][n]=!0),Dd(r,n,t)):Ni(r,n,t)},Zf=function(r,e){xd(r);var t=gl(e),n=D0(t).concat(G0(t));return yl(n,function(a){(!Yn||Yf(W0,t,a))&&bl(r,a,t[a])}),r},X2=function(r,e){return e===void 0?uo(r):Zf(uo(r),e)},W0=function(r){var e=Xf(r),t=Yf(q2,this,e);return this===ar&&Ke(Mr,e)&&!Ke(Ro,e)?!1:t||!Ke(this,e)||!Ke(Mr,e)||Ke(this,Et)&&this[Et][e]?t:!0},U0=function(r,e){var t=gl(r),n=Xf(e);if(!(t===ar&&Ke(Mr,n)&&!Ke(Ro,n))){var a=L0(t,n);return a&&Ke(Mr,n)&&!(Ke(t,Et)&&t[Et][n])&&(a.enumerable=!0),a}},K0=function(r){var e=z0(gl(r)),t=[];return yl(e,function(n){!Ke(Mr,n)&&!Ke(F0,n)&&H0(t,n)}),t},G0=function(i){var r=i===ar,e=z0(r?Ro:gl(i)),t=[];return yl(e,function(n){Ke(Mr,n)&&(!r||Ke(ar,n))&&H0(t,Mr[n])}),t};Xn||(Ri=function(){if(D2(Ka,this))throw new G2("Symbol is not a constructor");var r=!arguments.length||arguments[0]===void 0?void 0:R2(arguments[0]),e=vg(r),t=function(n){var a=this===void 0?Do:this;a===ar&&Yf(t,Ro,n),Ke(a,Et)&&Ke(a[Et],e)&&(a[Et][e]=!1);var o=Cd(1,n);try{Dd(a,e,o)}catch(s){if(!(s instanceof K2))throw s;V0(a,e,o)}};return Yn&&Ad&&Dd(ar,e,{configurable:!0,set:t}),Oh(e,r)},Ka=Ri[lo],fg(Ka,"toString",function(){return pg(this).tag}),fg(Ri,"withoutSetter",function(i){return Oh(vg(i),i)}),B0.f=W0,M0.f=bl,B2.f=Zf,N0.f=U0,N2.f=R0.f=K0,M2.f=G0,z2.f=function(i){return Oh(L2(i),i)},Yn&&F2(Ka,"description",{configurable:!0,get:function(){return pg(this).description}}));pl({global:!0,constructor:!0,wrap:!0,forced:!Xn,sham:!Xn},{Symbol:Ri});yl(D0(Y2),function(i){H2(i)});pl({target:ml,stat:!0,forced:!Xn},{useSetter:function(){Ad=!0},useSimple:function(){Ad=!1}});pl({target:"Object",stat:!0,forced:!Xn,sham:!Yn},{create:X2,defineProperty:bl,defineProperties:Zf,getOwnPropertyDescriptor:U0});pl({target:"Object",stat:!0,forced:!Xn},{getOwnPropertyNames:K0});V2();W2(Ri,ml);F0[Et]=!0;var J2=fa,q0=J2&&!!Symbol.for&&!!Symbol.keyFor,Z2=K,Q2=mt,eA=Ve,tA=tn,Y0=pa,rA=q0,Th=Y0("string-to-symbol-registry"),iA=Y0("symbol-to-string-registry");Z2({target:"Symbol",stat:!0,forced:!rA},{for:function(i){var r=tA(i);if(eA(Th,r))return Th[r];var e=Q2("Symbol")(r);return Th[r]=e,iA[e]=r,e}});var nA=K,aA=Ve,oA=To,sA=va,uA=pa,lA=q0,gg=uA("symbol-to-string-registry");nA({target:"Symbol",stat:!0,forced:!lA},{keyFor:function(r){if(!oA(r))throw new TypeError(sA(r)+" is not a symbol");if(aA(gg,r))return gg[r]}});var hA=be,No=hA([].slice),cA=be,yg=$i,dA=Ie,mg=yi,fA=tn,bg=cA([].push),vA=function(i){if(dA(i))return i;if(yg(i)){for(var r=i.length,e=[],t=0;t=r.length)return i.target=void 0,Cs(void 0,!0);switch(i.kind){case"keys":return Cs(e,!1);case"values":return Cs(r[e],!1)}return Cs([e,r[e]],!1)},"values");Dg.Arguments=Dg.Array;var GD={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},qD=GD,YD=$e,XD=zr,JD=Lr,Rg=$a,ZD=Ee,Ng=ZD("toStringTag");for(var xh in qD){var Mg=YD[xh],Ch=Mg&&Mg.prototype;Ch&&XD(Ch)!==Ng&&JD(Ch,Ng,xh),Rg[xh]=Rg.Array}var QD=XA,uw=QD,eR=Ee,tR=Ct.f,Bg=eR("metadata"),Fg=Function.prototype;Fg[Bg]===void 0&&tR(Fg,Bg,{value:null});var rR=ke;rR("asyncDispose");var iR=ke;iR("dispose");var nR=ke;nR("metadata");var aR=uw,oR=aR,sR=mt,uR=be,rv=sR("Symbol"),lR=rv.keyFor,hR=uR(rv.prototype.valueOf),lw=rv.isRegisteredSymbol||function(r){try{return lR(hR(r))!==void 0}catch{return!1}},cR=K,dR=lw;cR({target:"Symbol",stat:!0},{isRegisteredSymbol:dR});var fR=pa,hw=mt,vR=be,pR=To,gR=Ee,Cu=hw("Symbol"),jg=Cu.isWellKnownSymbol,cw=hw("Object","getOwnPropertyNames"),yR=vR(Cu.prototype.valueOf),Lg=fR("wks");for(var Ah=0,zg=cw(Cu),mR=zg.length;Ah=a?i?"":void 0:(o=Vg(t,n),o<55296||o>56319||n+1===a||(s=Vg(t,n+1))<56320||s>57343?i?NR(t,n):o:i?MR(t,n,n+2):(o-55296<<10)+(s-56320)+65536)}},BR={codeAt:Wg(!1),charAt:Wg(!0)},FR=BR.charAt,jR=tn,fw=ma,LR=ev,Ug=tv,vw="String Iterator",zR=fw.set,HR=fw.getterFor(vw);LR(String,"String",function(i){zR(this,{type:vw,string:jR(i),index:0})},function(){var r=HR(this),e=r.string,t=r.index,n;return t>=e.length?Ug(void 0,!0):(n=FR(e,t),r.index+=n.length,Ug(n,!1))});var VR=Ao,WR=VR.f("iterator"),UR=WR,pw=UR,KR=pw,GR=KR,qR=GR,YR=qR,gw=YR,XR=Y(gw);function Jn(i){"@babel/helpers - typeof";return Jn=typeof Dn=="function"&&typeof XR=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Dn=="function"&&r.constructor===Dn&&r!==Dn.prototype?"symbol":typeof r},Jn(i)}var JR=Ao,ZR=JR.f("toPrimitive"),QR=ZR,eN=QR,tN=eN,rN=tN,iN=rN,nN=iN,aN=nN,oN=Y(aN);function sN(i,r){if(Jn(i)!=="object"||i===null)return i;var e=i[oN];if(e!==void 0){var t=e.call(i,r||"default");if(Jn(t)!=="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(i)}function yw(i){var r=sN(i,"string");return Jn(r)==="symbol"?r:String(r)}function Kg(i,r){for(var e=0;e=0:s>u;u+=l)u in o&&(n=e(n,o[u],u,a));return n}},xN={left:Yg(!1),right:Yg(!0)},CN=le,_l=function(i,r){var e=[][i];return!!e&&CN(function(){e.call(null,r||function(){return 1},1)})},AN=$e,DN=yi,Bo=DN(AN.process)==="process",RN=K,NN=xN.left,MN=_l,Xg=da,BN=Bo,FN=!BN&&Xg>79&&Xg<83,jN=FN||!MN("reduce");RN({target:"Array",proto:!0,forced:jN},{reduce:function(r){var e=arguments.length;return NN(this,r,e,e>1?arguments[1]:void 0)}});var LN=lt,zN=LN("Array","reduce"),HN=He,VN=zN,Nh=Array.prototype,WN=function(i){var r=i.reduce;return i===Nh||HN(Nh,i)&&r===Nh.reduce?VN:r},UN=WN,KN=UN,GN=KN,qN=Y(GN),YN=K,XN=ba.filter,JN=ko,ZN=JN("filter");YN({target:"Array",proto:!0,forced:!ZN},{filter:function(r){return XN(this,r,arguments.length>1?arguments[1]:void 0)}});var QN=lt,eM=QN("Array","filter"),tM=He,rM=eM,Mh=Array.prototype,iM=function(i){var r=i.filter;return i===Mh||tM(Mh,i)&&r===Mh.filter?rM:r},nM=iM,aM=nM,oM=aM,Rn=Y(oM),sM=K,uM=ba.map,lM=ko,hM=lM("map");sM({target:"Array",proto:!0,forced:!hM},{map:function(r){return uM(this,r,arguments.length>1?arguments[1]:void 0)}});var cM=lt,dM=cM("Array","map"),fM=He,vM=dM,Bh=Array.prototype,pM=function(i){var r=i.map;return i===Bh||fM(Bh,i)&&r===Bh.map?vM:r},gM=pM,yM=gM,mM=yM,rr=Y(mM),bM=$i,$M=Lt,wM=ul,_M=bi,Ew=function(i,r,e,t,n,a,o,s){for(var u=n,l=0,h=o?_M(o,s):!1,c,d;l0&&bM(c)?(d=$M(c),u=Ew(i,r,c,d,u,a-1)-1):(wM(u+1),i[u]=c),u++),l++;return u},EM=Ew,SM=K,OM=EM,TM=Pt,IM=xt,kM=Lt,PM=hl;SM({target:"Array",proto:!0},{flatMap:function(r){var e=IM(this),t=kM(e),n;return TM(r),n=PM(e,0),n.length=OM(n,e,e,t,0,1,r,arguments.length>1?arguments[1]:void 0),n}});var xM=lt;xM("Array","flatMap");var CM=Ye,Jg=jt,AM=zf,Sw=function(i,r,e){var t,n;Jg(i);try{if(t=AM(i,"return"),!t){if(r==="throw")throw e;return e}t=CM(t,i)}catch(a){n=!0,t=a}if(r==="throw")throw e;if(n)throw t;return Jg(t),e},DM=jt,RM=Sw,NM=function(i,r,e,t){try{return t?r(DM(e)[0],e[1]):r(e)}catch(n){RM(i,"throw",n)}},MM=Ee,BM=$a,FM=MM("iterator"),jM=Array.prototype,Ow=function(i){return i!==void 0&&(BM.Array===i||jM[FM]===i)},LM=zr,Zg=zf,zM=ca,HM=$a,VM=Ee,WM=VM("iterator"),El=function(i){if(!zM(i))return Zg(i,WM)||Zg(i,"@@iterator")||HM[LM(i)]},UM=Ye,KM=Pt,GM=jt,qM=va,YM=El,XM=TypeError,av=function(i,r){var e=arguments.length<2?YM(i):r;if(KM(e))return GM(UM(e,i));throw new XM(qM(i)+" is not iterable")},JM=bi,ZM=Ye,QM=xt,eB=NM,tB=Ow,rB=ll,iB=Lt,Qg=ga,nB=av,aB=El,ey=Array,oB=function(r){var e=QM(r),t=rB(this),n=arguments.length,a=n>1?arguments[1]:void 0,o=a!==void 0;o&&(a=JM(a,n>2?arguments[2]:void 0));var s=aB(e),u=0,l,h,c,d,f,v;if(s&&!(this===ey&&tB(s)))for(d=nB(e,s),f=d.next,h=t?new this:[];!(c=ZM(f,d)).done;u++)v=o?eB(d,a,[c.value,u],!0):c.value,Qg(h,u,v);else for(l=iB(e),h=t?new this(l):ey(l);l>u;u++)v=o?a(e[u],u):e[u],Qg(h,u,v);return h.length=u,h},sB=Ee,Tw=sB("iterator"),Iw=!1;try{var uB=0,ty={next:function(){return{done:!!uB++}},return:function(){Iw=!0}};ty[Tw]=function(){return this},Array.from(ty,function(){throw 2})}catch{}var kw=function(i,r){try{if(!r&&!Iw)return!1}catch{return!1}var e=!1;try{var t={};t[Tw]=function(){return{next:function(){return{done:e=!0}}}},i(t)}catch{}return e},lB=K,hB=oB,cB=kw,dB=!cB(function(i){Array.from(i)});lB({target:"Array",stat:!0,forced:dB},{from:hB});var fB=we,vB=fB.Array.from,pB=vB,Pw=pB,gB=Pw,ov=Y(gB),yB=El,mB=yB,bB=mB,$B=bB,wB=$B,_B=wB,EB=_B,SB=EB,xw=SB,Cw=Y(xw),OB=xw,sv=Y(OB),TB=K,IB=$i;TB({target:"Array",stat:!0},{isArray:IB});var kB=we,PB=kB.Array.isArray,xB=PB,Aw=xB,CB=Aw,AB=CB,DB=AB,RB=DB,NB=RB,Dw=Y(NB);function MB(i){if(Dw(i))return i}var BB=qe,FB=$i,jB=TypeError,LB=Object.getOwnPropertyDescriptor,zB=BB&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(i){return i instanceof TypeError}}(),Rw=zB?function(i,r){if(FB(i)&&!LB(i,"length").writable)throw new jB("Cannot set read only .length");return i.length=r}:function(i,r){return i.length=r},HB=K,VB=xt,WB=Lt,UB=Rw,KB=ul,GB=le,qB=GB(function(){return[].push.call({length:4294967296},1)!==4294967297}),YB=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(i){return i instanceof TypeError}},XB=qB||!YB();HB({target:"Array",proto:!0,arity:1,forced:XB},{push:function(r){var e=VB(this),t=WB(e),n=arguments.length;KB(t+n);for(var a=0;ai.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?arguments[1]:void 0)},Tj=K,ny=Oj;Tj({target:"Array",proto:!0,forced:[].forEach!==ny},{forEach:ny});var Ij=lt,kj=Ij("Array","forEach"),Pj=kj,xj=Pj,Cj=zr,Aj=Ve,Dj=He,Rj=xj,Hh=Array.prototype,Nj={DOMTokenList:!0,NodeList:!0},zw=function(i){var r=i.forEach;return i===Hh||Dj(Hh,i)&&r===Hh.forEach||Aj(Nj,Cj(i))?Rj:r},Mj=zw,Wi=Y(Mj),Bj=K,Fj=be,jj=$i,Lj=Fj([].reverse),ay=[1,2];Bj({target:"Array",proto:!0,forced:String(ay)===String(ay.reverse())},{reverse:function(){return jj(this)&&(this.length=this.length),Lj(this)}});var zj=lt,Hj=zj("Array","reverse"),Vj=He,Wj=Hj,Vh=Array.prototype,Uj=function(i){var r=i.reverse;return i===Vh||Vj(Vh,i)&&r===Vh.reverse?Wj:r},Kj=Uj,Hw=Kj,Gj=Hw,qj=Y(Gj),oy=va,Yj=TypeError,Vw=function(i,r){if(!delete i[r])throw new Yj("Cannot delete property "+oy(r)+" of "+oy(i))},Xj=K,Jj=xt,Zj=dl,Qj=sl,e3=Lt,t3=Rw,r3=ul,i3=hl,n3=ga,Wh=Vw,a3=ko,o3=a3("splice"),s3=Math.max,u3=Math.min;Xj({target:"Array",proto:!0,forced:!o3},{splice:function(r,e){var t=Jj(this),n=e3(t),a=Zj(r,n),o=arguments.length,s,u,l,h,c,d;for(o===0?s=u=0:o===1?(s=0,u=n-a):(s=o-2,u=u3(s3(Qj(e),0),n-a)),r3(n+s-u),l=i3(t,u),h=0;hn-u+s;h--)Wh(t,h-1)}else if(s>u)for(h=n-u;h>a;h--)c=h+u-1,d=h+s-1,c in t?t[d]=t[c]:Wh(t,d);for(h=0;ha;)for(var u=E3(arguments[a++]),l=o?S3(Kh(u),o(u)):Kh(u),h=l.length,c=0,d;h>c;)d=l[c++],(!sy||m3(s,u,d))&&(t[d]=u[d]);return t}:wn,T3=K,ly=O3;T3({target:"Object",stat:!0,arity:2,forced:Object.assign!==ly},{assign:ly});var I3=we,k3=I3.Object.assign,P3=k3,x3=P3,C3=x3,A3=Y(C3),D3=K,R3=le,N3=xt,Uw=$l,M3=rw,B3=R3(function(){Uw(1)});D3({target:"Object",stat:!0,forced:B3,sham:!M3},{getPrototypeOf:function(r){return Uw(N3(r))}});var F3=we,j3=F3.Object.getPrototypeOf,L3=j3,z3=L3,H3=K,V3=qe,W3=rn;H3({target:"Object",stat:!0,sham:!V3},{create:W3});var U3=we,K3=U3.Object,G3=function(r,e){return K3.create(r,e)},q3=G3,Kw=q3,Y3=Kw,X3=Y(Y3),Fd=we,J3=ha;Fd.JSON||(Fd.JSON={stringify:JSON.stringify});var Z3=function(r,e,t){return J3(Fd.JSON.stringify,null,arguments)},Q3=Z3,eL=Q3,tL=eL,rL=Y(tL),iL=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",nL=TypeError,Gw=function(i,r){if(ie,o=oL(t)?t:cL(t),s=a?lL(arguments,e):[],u=a?function(){aL(o,this,s)}:o;return r?i(u,n):i(u)}:i},fL=K,Xw=$e,vL=Yw,hy=vL(Xw.setInterval,!0);fL({global:!0,bind:!0,forced:Xw.setInterval!==hy},{setInterval:hy});var pL=K,Jw=$e,gL=Yw,cy=gL(Jw.setTimeout,!0);pL({global:!0,bind:!0,forced:Jw.setTimeout!==cy},{setTimeout:cy});var yL=we,mL=yL.setTimeout,bL=mL,$L=Y(bL),Zw={exports:{}};(function(i){function r(t){if(t)return e(t);this._callbacks=new Map}function e(t){return Object.assign(t,r.prototype),t._callbacks=new Map,t}r.prototype.on=function(t,n){const a=this._callbacks.get(t)??[];return a.push(n),this._callbacks.set(t,a),this},r.prototype.once=function(t,n){const a=(...o)=>{this.off(t,a),n.apply(this,o)};return a.fn=n,this.on(t,a),this},r.prototype.off=function(t,n){if(t===void 0&&n===void 0)return this._callbacks.clear(),this;if(n===void 0)return this._callbacks.delete(t),this;const a=this._callbacks.get(t);if(a){for(const[o,s]of a.entries())if(s===n||s.fn===n){a.splice(o,1);break}a.length===0?this._callbacks.delete(t):this._callbacks.set(t,a)}return this},r.prototype.emit=function(t,...n){const a=this._callbacks.get(t);if(a){const o=[...a];for(const s of o)s.apply(this,n)}return this},r.prototype.listeners=function(t){return this._callbacks.get(t)??[]},r.prototype.listenerCount=function(t){if(t)return this.listeners(t).length;let n=0;for(const a of this._callbacks.values())n+=a.length;return n},r.prototype.hasListeners=function(t){return this.listenerCount(t)>0},r.prototype.addEventListener=r.prototype.on,r.prototype.removeListener=r.prototype.off,r.prototype.removeEventListener=r.prototype.off,r.prototype.removeAllListeners=r.prototype.off,i.exports=r})(Zw);var wL=Zw.exports,_L=Y(wL);/*! Hammer.JS - v2.0.17-rc - 2019-12-16 + */function tl(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")}var sh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Y(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var J$={exports:{}},Es=function(i){return i&&i.Math===Math&&i},$e=Es(typeof globalThis=="object"&&globalThis)||Es(typeof window=="object"&&window)||Es(typeof self=="object"&&self)||Es(typeof sh=="object"&&sh)||function(){return this}()||sh||Function("return this")(),le=function(i){try{return!!i()}catch{return!0}},HI=le,Oo=!HI(function(){var i=function(){}.bind();return typeof i!="function"||i.hasOwnProperty("prototype")}),VI=Oo,Z$=Function.prototype,Pp=Z$.apply,xp=Z$.call,ha=typeof Reflect=="object"&&Reflect.apply||(VI?xp.bind(Pp):function(){return xp.apply(Pp,arguments)}),Q$=Oo,e0=Function.prototype,Ed=e0.call,WI=Q$&&e0.bind.bind(Ed,Ed),be=Q$?WI:function(i){return function(){return Ed.apply(i,arguments)}},t0=be,UI=t0({}.toString),KI=t0("".slice),yi=function(i){return KI(UI(i),8,-1)},GI=yi,qI=be,r0=function(i){if(GI(i)==="Function")return qI(i)},Sd=typeof document=="object"&&document.all,YI=typeof Sd>"u"&&Sd!==void 0,i0={all:Sd,IS_HTMLDDA:YI},n0=i0,XI=n0.all,Ie=n0.IS_HTMLDDA?function(i){return typeof i=="function"||i===XI}:function(i){return typeof i=="function"},Qi={},JI=le,qe=!JI(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),ZI=Oo,Ss=Function.prototype.call,Ye=ZI?Ss.bind(Ss):function(){return Ss.apply(Ss,arguments)},rl={},a0={}.propertyIsEnumerable,o0=Object.getOwnPropertyDescriptor,QI=o0&&!a0.call({1:2},1);rl.f=QI?function(r){var e=o0(this,r);return!!e&&e.enumerable}:a0;var en=function(i,r){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:r}},ek=be,tk=le,rk=yi,uh=Object,ik=ek("".split),il=tk(function(){return!uh("z").propertyIsEnumerable(0)})?function(i){return rk(i)==="String"?ik(i,""):uh(i)}:uh,ca=function(i){return i==null},nk=ca,ak=TypeError,Lf=function(i){if(nk(i))throw new ak("Can't call method on "+i);return i},ok=il,sk=Lf,$r=function(i){return ok(sk(i))},Cp=Ie,s0=i0,uk=s0.all,nt=s0.IS_HTMLDDA?function(i){return typeof i=="object"?i!==null:Cp(i)||i===uk}:function(i){return typeof i=="object"?i!==null:Cp(i)},we={},lh=we,hh=$e,lk=Ie,Ap=function(i){return lk(i)?i:void 0},mt=function(i,r){return arguments.length<2?Ap(lh[i])||Ap(hh[i]):lh[i]&&lh[i][r]||hh[i]&&hh[i][r]},hk=be,He=hk({}.isPrototypeOf),mi=typeof navigator<"u"&&String(navigator.userAgent)||"",u0=$e,ch=mi,Dp=u0.process,Rp=u0.Deno,Np=Dp&&Dp.versions||Rp&&Rp.version,Mp=Np&&Np.v8,tr,ku;Mp&&(tr=Mp.split("."),ku=tr[0]>0&&tr[0]<4?1:+(tr[0]+tr[1]));!ku&&ch&&(tr=ch.match(/Edge\/(\d+)/),(!tr||tr[1]>=74)&&(tr=ch.match(/Chrome\/(\d+)/),tr&&(ku=+tr[1])));var da=ku,Bp=da,ck=le,dk=$e,fk=dk.String,fa=!!Object.getOwnPropertySymbols&&!ck(function(){var i=Symbol("symbol detection");return!fk(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&Bp&&Bp<41}),vk=fa,l0=vk&&!Symbol.sham&&typeof Symbol.iterator=="symbol",pk=mt,gk=Ie,yk=He,mk=l0,bk=Object,To=mk?function(i){return typeof i=="symbol"}:function(i){var r=pk("Symbol");return gk(r)&&yk(r.prototype,bk(i))},$k=String,va=function(i){try{return $k(i)}catch{return"Object"}},wk=Ie,_k=va,Ek=TypeError,Pt=function(i){if(wk(i))return i;throw new Ek(_k(i)+" is not a function")},Sk=Pt,Ok=ca,zf=function(i,r){var e=i[r];return Ok(e)?void 0:Sk(e)},dh=Ye,fh=Ie,vh=nt,Tk=TypeError,Ik=function(i,r){var e,t;if(r==="string"&&fh(e=i.toString)&&!vh(t=dh(e,i))||fh(e=i.valueOf)&&!vh(t=dh(e,i))||r!=="string"&&fh(e=i.toString)&&!vh(t=dh(e,i)))return t;throw new Tk("Can't convert object to primitive value")},h0={exports:{}},kk=!0,Fp=$e,Pk=Object.defineProperty,xk=function(i,r){try{Pk(Fp,i,{value:r,configurable:!0,writable:!0})}catch{Fp[i]=r}return r},Ck=$e,Ak=xk,jp="__core-js_shared__",Dk=Ck[jp]||Ak(jp,{}),Hf=Dk,Lp=Hf;(h0.exports=function(i,r){return Lp[i]||(Lp[i]=r!==void 0?r:{})})("versions",[]).push({version:"3.33.2",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.2/LICENSE",source:"https://github.com/zloirock/core-js"});var pa=h0.exports,Rk=Lf,Nk=Object,xt=function(i){return Nk(Rk(i))},Mk=be,Bk=xt,Fk=Mk({}.hasOwnProperty),Ve=Object.hasOwn||function(r,e){return Fk(Bk(r),e)},jk=be,Lk=0,zk=Math.random(),Hk=jk(1 .toString),nl=function(i){return"Symbol("+(i===void 0?"":i)+")_"+Hk(++Lk+zk,36)},Vk=$e,Wk=pa,zp=Ve,Uk=nl,Kk=fa,Gk=l0,An=Vk.Symbol,ph=Wk("wks"),qk=Gk?An.for||An:An&&An.withoutSetter||Uk,Ee=function(i){return zp(ph,i)||(ph[i]=Kk&&zp(An,i)?An[i]:qk("Symbol."+i)),ph[i]},Yk=Ye,Hp=nt,Vp=To,Xk=zf,Jk=Ik,Zk=Ee,Qk=TypeError,eP=Zk("toPrimitive"),tP=function(i,r){if(!Hp(i)||Vp(i))return i;var e=Xk(i,eP),t;if(e){if(r===void 0&&(r="default"),t=Yk(e,i,r),!Hp(t)||Vp(t))return t;throw new Qk("Can't convert object to primitive value")}return r===void 0&&(r="number"),Jk(i,r)},rP=tP,iP=To,al=function(i){var r=rP(i,"string");return iP(r)?r:r+""},nP=$e,Wp=nt,Od=nP.document,aP=Wp(Od)&&Wp(Od.createElement),Vf=function(i){return aP?Od.createElement(i):{}},oP=qe,sP=le,uP=Vf,c0=!oP&&!sP(function(){return Object.defineProperty(uP("div"),"a",{get:function(){return 7}}).a!==7}),lP=qe,hP=Ye,cP=rl,dP=en,fP=$r,vP=al,pP=Ve,gP=c0,Up=Object.getOwnPropertyDescriptor;Qi.f=lP?Up:function(r,e){if(r=fP(r),e=vP(e),gP)try{return Up(r,e)}catch{}if(pP(r,e))return dP(!hP(cP.f,r,e),r[e])};var yP=le,mP=Ie,bP=/#|\.prototype\./,Io=function(i,r){var e=wP[$P(i)];return e===EP?!0:e===_P?!1:mP(r)?yP(r):!!r},$P=Io.normalize=function(i){return String(i).replace(bP,".").toLowerCase()},wP=Io.data={},_P=Io.NATIVE="N",EP=Io.POLYFILL="P",d0=Io,Kp=r0,SP=Pt,OP=Oo,TP=Kp(Kp.bind),bi=function(i,r){return SP(i),r===void 0?i:OP?TP(i,r):function(){return i.apply(r,arguments)}},Ct={},IP=qe,kP=le,f0=IP&&kP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),PP=nt,xP=String,CP=TypeError,jt=function(i){if(PP(i))return i;throw new CP(xP(i)+" is not an object")},AP=qe,DP=c0,RP=f0,Os=jt,Gp=al,NP=TypeError,gh=Object.defineProperty,MP=Object.getOwnPropertyDescriptor,yh="enumerable",mh="configurable",bh="writable";Ct.f=AP?RP?function(r,e,t){if(Os(r),e=Gp(e),Os(t),typeof r=="function"&&e==="prototype"&&"value"in t&&bh in t&&!t[bh]){var n=MP(r,e);n&&n[bh]&&(r[e]=t.value,t={configurable:mh in t?t[mh]:n[mh],enumerable:yh in t?t[yh]:n[yh],writable:!1})}return gh(r,e,t)}:gh:function(r,e,t){if(Os(r),e=Gp(e),Os(t),DP)try{return gh(r,e,t)}catch{}if("get"in t||"set"in t)throw new NP("Accessors not supported");return"value"in t&&(r[e]=t.value),r};var BP=qe,FP=Ct,jP=en,Lr=BP?function(i,r,e){return FP.f(i,r,jP(1,e))}:function(i,r,e){return i[r]=e,i},Ts=$e,LP=ha,zP=r0,HP=Ie,VP=Qi.f,WP=d0,mn=we,UP=bi,bn=Lr,qp=Ve,KP=function(i){var r=function(e,t,n){if(this instanceof r){switch(arguments.length){case 0:return new i;case 1:return new i(e);case 2:return new i(e,t)}return new i(e,t,n)}return LP(i,this,arguments)};return r.prototype=i.prototype,r},K=function(i,r){var e=i.target,t=i.global,n=i.stat,a=i.proto,o=t?Ts:n?Ts[e]:(Ts[e]||{}).prototype,s=t?mn:mn[e]||bn(mn,e,{})[e],u=s.prototype,l,h,c,d,f,v,p,g,y;for(d in r)l=WP(t?d:e+(n?".":"#")+d,i.forced),h=!l&&o&&qp(o,d),v=s[d],h&&(i.dontCallGetSet?(y=VP(o,d),p=y&&y.value):p=o[d]),f=h&&p?p:r[d],!(h&&typeof v==typeof f)&&(i.bind&&h?g=UP(f,Ts):i.wrap&&h?g=KP(f):a&&HP(f)?g=zP(f):g=f,(i.sham||f&&f.sham||v&&v.sham)&&bn(g,"sham",!0),bn(s,d,g),a&&(c=e+"Prototype",qp(mn,c)||bn(mn,c,{}),bn(mn[c],d,f),i.real&&u&&(l||!u[d])&&bn(u,d,f)))},GP=K,qP=qe,Yp=Ct.f;GP({target:"Object",stat:!0,forced:Object.defineProperty!==Yp,sham:!qP},{defineProperty:Yp});var YP=we,v0=YP.Object,XP=J$.exports=function(r,e,t){return v0.defineProperty(r,e,t)};v0.defineProperty.sham&&(XP.sham=!0);var JP=J$.exports,ZP=JP,p0=ZP,QP=p0,ex=QP,tx=ex,rx=tx,g0=rx,ol=Y(g0),ix=yi,$i=Array.isArray||function(r){return ix(r)==="Array"},nx=Math.ceil,ax=Math.floor,ox=Math.trunc||function(r){var e=+r;return(e>0?ax:nx)(e)},sx=ox,sl=function(i){var r=+i;return r!==r||r===0?0:sx(r)},ux=sl,lx=Math.min,hx=function(i){return i>0?lx(ux(i),9007199254740991):0},cx=hx,Lt=function(i){return cx(i.length)},dx=TypeError,fx=9007199254740991,ul=function(i){if(i>fx)throw dx("Maximum allowed index exceeded");return i},vx=al,px=Ct,gx=en,ga=function(i,r,e){var t=vx(r);t in i?px.f(i,t,gx(0,e)):i[t]=e},yx=Ee,mx=yx("toStringTag"),y0={};y0[mx]="z";var Wf=String(y0)==="[object z]",bx=Wf,$x=Ie,lu=yi,wx=Ee,_x=wx("toStringTag"),Ex=Object,Sx=lu(function(){return arguments}())==="Arguments",Ox=function(i,r){try{return i[r]}catch{}},zr=bx?lu:function(i){var r,e,t;return i===void 0?"Undefined":i===null?"Null":typeof(e=Ox(r=Ex(i),_x))=="string"?e:Sx?lu(r):(t=lu(r))==="Object"&&$x(r.callee)?"Arguments":t},Tx=be,Ix=Ie,Td=Hf,kx=Tx(Function.toString);Ix(Td.inspectSource)||(Td.inspectSource=function(i){return kx(i)});var m0=Td.inspectSource,Px=be,xx=le,b0=Ie,Cx=zr,Ax=mt,Dx=m0,$0=function(){},Rx=[],w0=Ax("Reflect","construct"),Uf=/^\s*(?:class|function)\b/,Nx=Px(Uf.exec),Mx=!Uf.test($0),Fa=function(r){if(!b0(r))return!1;try{return w0($0,Rx,r),!0}catch{return!1}},_0=function(r){if(!b0(r))return!1;switch(Cx(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Mx||!!Nx(Uf,Dx(r))}catch{return!0}};_0.sham=!0;var ll=!w0||xx(function(){var i;return Fa(Fa.call)||!Fa(Object)||!Fa(function(){i=!0})||i})?_0:Fa,Xp=$i,Bx=ll,Fx=nt,jx=Ee,Lx=jx("species"),Jp=Array,zx=function(i){var r;return Xp(i)&&(r=i.constructor,Bx(r)&&(r===Jp||Xp(r.prototype))?r=void 0:Fx(r)&&(r=r[Lx],r===null&&(r=void 0))),r===void 0?Jp:r},Hx=zx,hl=function(i,r){return new(Hx(i))(r===0?0:r)},Vx=le,Wx=Ee,Ux=da,Kx=Wx("species"),ko=function(i){return Ux>=51||!Vx(function(){var r=[],e=r.constructor={};return e[Kx]=function(){return{foo:1}},r[i](Boolean).foo!==1})},Gx=K,qx=le,Yx=$i,Xx=nt,Jx=xt,Zx=Lt,Zp=ul,Qp=ga,Qx=hl,eC=ko,tC=Ee,rC=da,E0=tC("isConcatSpreadable"),iC=rC>=51||!qx(function(){var i=[];return i[E0]=!1,i.concat()[0]!==i}),nC=function(i){if(!Xx(i))return!1;var r=i[E0];return r!==void 0?!!r:Yx(i)},aC=!iC||!eC("concat");Gx({target:"Array",proto:!0,arity:1,forced:aC},{concat:function(r){var e=Jx(this),t=Qx(e,0),n=0,a,o,s,u,l;for(a=-1,s=arguments.length;ao;)if(s=n[o++],s!==s)return!0}else for(;a>o;o++)if((i||o in n)&&n[o]===e)return i||o||0;return!i&&-1}},vC={includes:eg(!0),indexOf:eg(!1)},Po={},pC=be,$h=Ve,gC=$r,yC=vC.indexOf,mC=Po,tg=pC([].push),S0=function(i,r){var e=gC(i),t=0,n=[],a;for(a in e)!$h(mC,a)&&$h(e,a)&&tg(n,a);for(;r.length>t;)$h(e,a=r[t++])&&(~yC(n,a)||tg(n,a));return n},Kf=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],bC=S0,$C=Kf,fl=Object.keys||function(r){return bC(r,$C)},wC=qe,_C=f0,EC=Ct,SC=jt,OC=$r,TC=fl;cl.f=wC&&!_C?Object.defineProperties:function(r,e){SC(r);for(var t=OC(e),n=TC(e),a=n.length,o=0,s;a>o;)EC.f(r,s=n[o++],t[s]);return r};var IC=mt,O0=IC("document","documentElement"),kC=pa,PC=nl,rg=kC("keys"),vl=function(i){return rg[i]||(rg[i]=PC(i))},xC=jt,CC=cl,ig=Kf,AC=Po,DC=O0,RC=Vf,NC=vl,ng=">",ag="<",Id="prototype",kd="script",T0=NC("IE_PROTO"),wh=function(){},I0=function(i){return ag+kd+ng+i+ag+"/"+kd+ng},og=function(i){i.write(I0("")),i.close();var r=i.parentWindow.Object;return i=null,r},MC=function(){var i=RC("iframe"),r="java"+kd+":",e;return i.style.display="none",DC.appendChild(i),i.src=String(r),e=i.contentWindow.document,e.open(),e.write(I0("document.F=Object")),e.close(),e.F},Is,hu=function(){try{Is=new ActiveXObject("htmlfile")}catch{}hu=typeof document<"u"?document.domain&&Is?og(Is):MC():og(Is);for(var i=ig.length;i--;)delete hu[Id][ig[i]];return hu()};AC[T0]=!0;var rn=Object.create||function(r,e){var t;return r!==null?(wh[Id]=xC(r),t=new wh,wh[Id]=null,t[T0]=r):t=hu(),e===void 0?t:CC.f(t,e)},xo={},BC=S0,FC=Kf,jC=FC.concat("length","prototype");xo.f=Object.getOwnPropertyNames||function(r){return BC(r,jC)};var Gf={},sg=dl,LC=Lt,zC=ga,HC=Array,VC=Math.max,k0=function(i,r,e){for(var t=LC(i),n=sg(r,t),a=sg(e===void 0?t:e,t),o=HC(VC(a-n,0)),s=0;ng;g++)if((s||g in f)&&($=f[g],b=v($,g,d),i))if(r)m[g]=b;else if(b)switch(i){case 3:return!0;case 5:return $;case 6:return g;case 2:dg(m,$)}else switch(i){case 4:return!1;case 7:dg(m,$)}return a?-1:t||n?n:m}},ba={forEach:Gr(0),map:Gr(1),filter:Gr(2),some:Gr(3),every:Gr(4),find:Gr(5),findIndex:Gr(6),filterReject:Gr(7)},pl=K,Do=$e,Yf=Ye,x2=be,Yn=qe,Xn=fa,C2=le,Ke=Ve,A2=He,xd=jt,gl=$r,Xf=al,D2=tn,Cd=en,uo=rn,D0=fl,R2=xo,R0=Gf,N2=Co,N0=Qi,M0=Ct,M2=cl,B0=rl,fg=ya,B2=qf,Jf=pa,F2=vl,F0=Po,vg=nl,j2=Ee,L2=Ao,z2=ke,H2=C0,V2=nn,j0=ma,yl=ba.forEach,Et=F2("hidden"),ml="Symbol",lo="prototype",W2=j0.set,pg=j0.getterFor(ml),ar=Object[lo],Ri=Do.Symbol,Ka=Ri&&Ri[lo],U2=Do.RangeError,K2=Do.TypeError,Sh=Do.QObject,L0=N0.f,Ni=M0.f,z0=R0.f,G2=B0.f,H0=x2([].push),Mr=Jf("symbols"),Ro=Jf("op-symbols"),q2=Jf("wks"),Ad=!Sh||!Sh[lo]||!Sh[lo].findChild,V0=function(i,r,e){var t=L0(ar,r);t&&delete ar[r],Ni(i,r,e),t&&i!==ar&&Ni(ar,r,t)},Dd=Yn&&C2(function(){return uo(Ni({},"a",{get:function(){return Ni(this,"a",{value:7}).a}})).a!==7})?V0:Ni,Oh=function(i,r){var e=Mr[i]=uo(Ka);return W2(e,{type:ml,tag:i,description:r}),Yn||(e.description=r),e},bl=function(r,e,t){r===ar&&bl(Ro,e,t),xd(r);var n=Xf(e);return xd(t),Ke(Mr,n)?(t.enumerable?(Ke(r,Et)&&r[Et][n]&&(r[Et][n]=!1),t=uo(t,{enumerable:Cd(0,!1)})):(Ke(r,Et)||Ni(r,Et,Cd(1,{})),r[Et][n]=!0),Dd(r,n,t)):Ni(r,n,t)},Zf=function(r,e){xd(r);var t=gl(e),n=D0(t).concat(G0(t));return yl(n,function(a){(!Yn||Yf(W0,t,a))&&bl(r,a,t[a])}),r},Y2=function(r,e){return e===void 0?uo(r):Zf(uo(r),e)},W0=function(r){var e=Xf(r),t=Yf(G2,this,e);return this===ar&&Ke(Mr,e)&&!Ke(Ro,e)?!1:t||!Ke(this,e)||!Ke(Mr,e)||Ke(this,Et)&&this[Et][e]?t:!0},U0=function(r,e){var t=gl(r),n=Xf(e);if(!(t===ar&&Ke(Mr,n)&&!Ke(Ro,n))){var a=L0(t,n);return a&&Ke(Mr,n)&&!(Ke(t,Et)&&t[Et][n])&&(a.enumerable=!0),a}},K0=function(r){var e=z0(gl(r)),t=[];return yl(e,function(n){!Ke(Mr,n)&&!Ke(F0,n)&&H0(t,n)}),t},G0=function(i){var r=i===ar,e=z0(r?Ro:gl(i)),t=[];return yl(e,function(n){Ke(Mr,n)&&(!r||Ke(ar,n))&&H0(t,Mr[n])}),t};Xn||(Ri=function(){if(A2(Ka,this))throw new K2("Symbol is not a constructor");var r=!arguments.length||arguments[0]===void 0?void 0:D2(arguments[0]),e=vg(r),t=function(n){var a=this===void 0?Do:this;a===ar&&Yf(t,Ro,n),Ke(a,Et)&&Ke(a[Et],e)&&(a[Et][e]=!1);var o=Cd(1,n);try{Dd(a,e,o)}catch(s){if(!(s instanceof U2))throw s;V0(a,e,o)}};return Yn&&Ad&&Dd(ar,e,{configurable:!0,set:t}),Oh(e,r)},Ka=Ri[lo],fg(Ka,"toString",function(){return pg(this).tag}),fg(Ri,"withoutSetter",function(i){return Oh(vg(i),i)}),B0.f=W0,M0.f=bl,M2.f=Zf,N0.f=U0,R2.f=R0.f=K0,N2.f=G0,L2.f=function(i){return Oh(j2(i),i)},Yn&&B2(Ka,"description",{configurable:!0,get:function(){return pg(this).description}}));pl({global:!0,constructor:!0,wrap:!0,forced:!Xn,sham:!Xn},{Symbol:Ri});yl(D0(q2),function(i){z2(i)});pl({target:ml,stat:!0,forced:!Xn},{useSetter:function(){Ad=!0},useSimple:function(){Ad=!1}});pl({target:"Object",stat:!0,forced:!Xn,sham:!Yn},{create:Y2,defineProperty:bl,defineProperties:Zf,getOwnPropertyDescriptor:U0});pl({target:"Object",stat:!0,forced:!Xn},{getOwnPropertyNames:K0});H2();V2(Ri,ml);F0[Et]=!0;var X2=fa,q0=X2&&!!Symbol.for&&!!Symbol.keyFor,J2=K,Z2=mt,Q2=Ve,eA=tn,Y0=pa,tA=q0,Th=Y0("string-to-symbol-registry"),rA=Y0("symbol-to-string-registry");J2({target:"Symbol",stat:!0,forced:!tA},{for:function(i){var r=eA(i);if(Q2(Th,r))return Th[r];var e=Z2("Symbol")(r);return Th[r]=e,rA[e]=r,e}});var iA=K,nA=Ve,aA=To,oA=va,sA=pa,uA=q0,gg=sA("symbol-to-string-registry");iA({target:"Symbol",stat:!0,forced:!uA},{keyFor:function(r){if(!aA(r))throw new TypeError(oA(r)+" is not a symbol");if(nA(gg,r))return gg[r]}});var lA=be,No=lA([].slice),hA=be,yg=$i,cA=Ie,mg=yi,dA=tn,bg=hA([].push),fA=function(i){if(cA(i))return i;if(yg(i)){for(var r=i.length,e=[],t=0;t=r.length)return i.target=void 0,Cs(void 0,!0);switch(i.kind){case"keys":return Cs(e,!1);case"values":return Cs(r[e],!1)}return Cs([e,r[e]],!1)},"values");Dg.Arguments=Dg.Array;var KD={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},GD=KD,qD=$e,YD=zr,XD=Lr,Rg=$a,JD=Ee,Ng=JD("toStringTag");for(var xh in GD){var Mg=qD[xh],Ch=Mg&&Mg.prototype;Ch&&YD(Ch)!==Ng&&XD(Ch,Ng,xh),Rg[xh]=Rg.Array}var ZD=YA,uw=ZD,QD=Ee,eR=Ct.f,Bg=QD("metadata"),Fg=Function.prototype;Fg[Bg]===void 0&&eR(Fg,Bg,{value:null});var tR=ke;tR("asyncDispose");var rR=ke;rR("dispose");var iR=ke;iR("metadata");var nR=uw,aR=nR,oR=mt,sR=be,rv=oR("Symbol"),uR=rv.keyFor,lR=sR(rv.prototype.valueOf),lw=rv.isRegisteredSymbol||function(r){try{return uR(lR(r))!==void 0}catch{return!1}},hR=K,cR=lw;hR({target:"Symbol",stat:!0},{isRegisteredSymbol:cR});var dR=pa,hw=mt,fR=be,vR=To,pR=Ee,Cu=hw("Symbol"),jg=Cu.isWellKnownSymbol,cw=hw("Object","getOwnPropertyNames"),gR=fR(Cu.prototype.valueOf),Lg=dR("wks");for(var Ah=0,zg=cw(Cu),yR=zg.length;Ah=a?i?"":void 0:(o=Vg(t,n),o<55296||o>56319||n+1===a||(s=Vg(t,n+1))<56320||s>57343?i?RR(t,n):o:i?NR(t,n,n+2):(o-55296<<10)+(s-56320)+65536)}},MR={codeAt:Wg(!1),charAt:Wg(!0)},BR=MR.charAt,FR=tn,fw=ma,jR=ev,Ug=tv,vw="String Iterator",LR=fw.set,zR=fw.getterFor(vw);jR(String,"String",function(i){LR(this,{type:vw,string:FR(i),index:0})},function(){var r=zR(this),e=r.string,t=r.index,n;return t>=e.length?Ug(void 0,!0):(n=BR(e,t),r.index+=n.length,Ug(n,!1))});var HR=Ao,VR=HR.f("iterator"),WR=VR,pw=WR,UR=pw,KR=UR,GR=KR,qR=GR,gw=qR,YR=Y(gw);function Jn(i){"@babel/helpers - typeof";return Jn=typeof Dn=="function"&&typeof YR=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Dn=="function"&&r.constructor===Dn&&r!==Dn.prototype?"symbol":typeof r},Jn(i)}var XR=Ao,JR=XR.f("toPrimitive"),ZR=JR,QR=ZR,eN=QR,tN=eN,rN=tN,iN=rN,nN=iN,aN=Y(nN);function oN(i,r){if(Jn(i)!=="object"||i===null)return i;var e=i[aN];if(e!==void 0){var t=e.call(i,r||"default");if(Jn(t)!=="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(i)}function yw(i){var r=oN(i,"string");return Jn(r)==="symbol"?r:String(r)}function Kg(i,r){for(var e=0;e=0:s>u;u+=l)u in o&&(n=e(n,o[u],u,a));return n}},PN={left:Yg(!1),right:Yg(!0)},xN=le,_l=function(i,r){var e=[][i];return!!e&&xN(function(){e.call(null,r||function(){return 1},1)})},CN=$e,AN=yi,Bo=AN(CN.process)==="process",DN=K,RN=PN.left,NN=_l,Xg=da,MN=Bo,BN=!MN&&Xg>79&&Xg<83,FN=BN||!NN("reduce");DN({target:"Array",proto:!0,forced:FN},{reduce:function(r){var e=arguments.length;return RN(this,r,e,e>1?arguments[1]:void 0)}});var jN=lt,LN=jN("Array","reduce"),zN=He,HN=LN,Nh=Array.prototype,VN=function(i){var r=i.reduce;return i===Nh||zN(Nh,i)&&r===Nh.reduce?HN:r},WN=VN,UN=WN,KN=UN,GN=Y(KN),qN=K,YN=ba.filter,XN=ko,JN=XN("filter");qN({target:"Array",proto:!0,forced:!JN},{filter:function(r){return YN(this,r,arguments.length>1?arguments[1]:void 0)}});var ZN=lt,QN=ZN("Array","filter"),eM=He,tM=QN,Mh=Array.prototype,rM=function(i){var r=i.filter;return i===Mh||eM(Mh,i)&&r===Mh.filter?tM:r},iM=rM,nM=iM,aM=nM,Rn=Y(aM),oM=K,sM=ba.map,uM=ko,lM=uM("map");oM({target:"Array",proto:!0,forced:!lM},{map:function(r){return sM(this,r,arguments.length>1?arguments[1]:void 0)}});var hM=lt,cM=hM("Array","map"),dM=He,fM=cM,Bh=Array.prototype,vM=function(i){var r=i.map;return i===Bh||dM(Bh,i)&&r===Bh.map?fM:r},pM=vM,gM=pM,yM=gM,rr=Y(yM),mM=$i,bM=Lt,$M=ul,wM=bi,Ew=function(i,r,e,t,n,a,o,s){for(var u=n,l=0,h=o?wM(o,s):!1,c,d;l0&&mM(c)?(d=bM(c),u=Ew(i,r,c,d,u,a-1)-1):($M(u+1),i[u]=c),u++),l++;return u},_M=Ew,EM=K,SM=_M,OM=Pt,TM=xt,IM=Lt,kM=hl;EM({target:"Array",proto:!0},{flatMap:function(r){var e=TM(this),t=IM(e),n;return OM(r),n=kM(e,0),n.length=SM(n,e,e,t,0,1,r,arguments.length>1?arguments[1]:void 0),n}});var PM=lt;PM("Array","flatMap");var xM=Ye,Jg=jt,CM=zf,Sw=function(i,r,e){var t,n;Jg(i);try{if(t=CM(i,"return"),!t){if(r==="throw")throw e;return e}t=xM(t,i)}catch(a){n=!0,t=a}if(r==="throw")throw e;if(n)throw t;return Jg(t),e},AM=jt,DM=Sw,RM=function(i,r,e,t){try{return t?r(AM(e)[0],e[1]):r(e)}catch(n){DM(i,"throw",n)}},NM=Ee,MM=$a,BM=NM("iterator"),FM=Array.prototype,Ow=function(i){return i!==void 0&&(MM.Array===i||FM[BM]===i)},jM=zr,Zg=zf,LM=ca,zM=$a,HM=Ee,VM=HM("iterator"),El=function(i){if(!LM(i))return Zg(i,VM)||Zg(i,"@@iterator")||zM[jM(i)]},WM=Ye,UM=Pt,KM=jt,GM=va,qM=El,YM=TypeError,av=function(i,r){var e=arguments.length<2?qM(i):r;if(UM(e))return KM(WM(e,i));throw new YM(GM(i)+" is not iterable")},XM=bi,JM=Ye,ZM=xt,QM=RM,eB=Ow,tB=ll,rB=Lt,Qg=ga,iB=av,nB=El,ey=Array,aB=function(r){var e=ZM(r),t=tB(this),n=arguments.length,a=n>1?arguments[1]:void 0,o=a!==void 0;o&&(a=XM(a,n>2?arguments[2]:void 0));var s=nB(e),u=0,l,h,c,d,f,v;if(s&&!(this===ey&&eB(s)))for(d=iB(e,s),f=d.next,h=t?new this:[];!(c=JM(f,d)).done;u++)v=o?QM(d,a,[c.value,u],!0):c.value,Qg(h,u,v);else for(l=rB(e),h=t?new this(l):ey(l);l>u;u++)v=o?a(e[u],u):e[u],Qg(h,u,v);return h.length=u,h},oB=Ee,Tw=oB("iterator"),Iw=!1;try{var sB=0,ty={next:function(){return{done:!!sB++}},return:function(){Iw=!0}};ty[Tw]=function(){return this},Array.from(ty,function(){throw 2})}catch{}var kw=function(i,r){try{if(!r&&!Iw)return!1}catch{return!1}var e=!1;try{var t={};t[Tw]=function(){return{next:function(){return{done:e=!0}}}},i(t)}catch{}return e},uB=K,lB=aB,hB=kw,cB=!hB(function(i){Array.from(i)});uB({target:"Array",stat:!0,forced:cB},{from:lB});var dB=we,fB=dB.Array.from,vB=fB,Pw=vB,pB=Pw,ov=Y(pB),gB=El,yB=gB,mB=yB,bB=mB,$B=bB,wB=$B,_B=wB,EB=_B,xw=EB,Cw=Y(xw),SB=xw,sv=Y(SB),OB=K,TB=$i;OB({target:"Array",stat:!0},{isArray:TB});var IB=we,kB=IB.Array.isArray,PB=kB,Aw=PB,xB=Aw,CB=xB,AB=CB,DB=AB,RB=DB,Dw=Y(RB);function NB(i){if(Dw(i))return i}var MB=qe,BB=$i,FB=TypeError,jB=Object.getOwnPropertyDescriptor,LB=MB&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(i){return i instanceof TypeError}}(),Rw=LB?function(i,r){if(BB(i)&&!jB(i,"length").writable)throw new FB("Cannot set read only .length");return i.length=r}:function(i,r){return i.length=r},zB=K,HB=xt,VB=Lt,WB=Rw,UB=ul,KB=le,GB=KB(function(){return[].push.call({length:4294967296},1)!==4294967297}),qB=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(i){return i instanceof TypeError}},YB=GB||!qB();zB({target:"Array",proto:!0,arity:1,forced:YB},{push:function(r){var e=HB(this),t=VB(e),n=arguments.length;UB(t+n);for(var a=0;ai.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?arguments[1]:void 0)},Oj=K,ny=Sj;Oj({target:"Array",proto:!0,forced:[].forEach!==ny},{forEach:ny});var Tj=lt,Ij=Tj("Array","forEach"),kj=Ij,Pj=kj,xj=zr,Cj=Ve,Aj=He,Dj=Pj,Hh=Array.prototype,Rj={DOMTokenList:!0,NodeList:!0},zw=function(i){var r=i.forEach;return i===Hh||Aj(Hh,i)&&r===Hh.forEach||Cj(Rj,xj(i))?Dj:r},Nj=zw,Wi=Y(Nj),Mj=K,Bj=be,Fj=$i,jj=Bj([].reverse),ay=[1,2];Mj({target:"Array",proto:!0,forced:String(ay)===String(ay.reverse())},{reverse:function(){return Fj(this)&&(this.length=this.length),jj(this)}});var Lj=lt,zj=Lj("Array","reverse"),Hj=He,Vj=zj,Vh=Array.prototype,Wj=function(i){var r=i.reverse;return i===Vh||Hj(Vh,i)&&r===Vh.reverse?Vj:r},Uj=Wj,Hw=Uj,Kj=Hw,Gj=Y(Kj),oy=va,qj=TypeError,Vw=function(i,r){if(!delete i[r])throw new qj("Cannot delete property "+oy(r)+" of "+oy(i))},Yj=K,Xj=xt,Jj=dl,Zj=sl,Qj=Lt,e3=Rw,t3=ul,r3=hl,i3=ga,Wh=Vw,n3=ko,a3=n3("splice"),o3=Math.max,s3=Math.min;Yj({target:"Array",proto:!0,forced:!a3},{splice:function(r,e){var t=Xj(this),n=Qj(t),a=Jj(r,n),o=arguments.length,s,u,l,h,c,d;for(o===0?s=u=0:o===1?(s=0,u=n-a):(s=o-2,u=s3(o3(Zj(e),0),n-a)),t3(n+s-u),l=r3(t,u),h=0;hn-u+s;h--)Wh(t,h-1)}else if(s>u)for(h=n-u;h>a;h--)c=h+u-1,d=h+s-1,c in t?t[d]=t[c]:Wh(t,d);for(h=0;ha;)for(var u=_3(arguments[a++]),l=o?E3(Kh(u),o(u)):Kh(u),h=l.length,c=0,d;h>c;)d=l[c++],(!sy||y3(s,u,d))&&(t[d]=u[d]);return t}:wn,O3=K,ly=S3;O3({target:"Object",stat:!0,arity:2,forced:Object.assign!==ly},{assign:ly});var T3=we,I3=T3.Object.assign,k3=I3,P3=k3,x3=P3,C3=Y(x3),A3=K,D3=le,R3=xt,Uw=$l,N3=rw,M3=D3(function(){Uw(1)});A3({target:"Object",stat:!0,forced:M3,sham:!N3},{getPrototypeOf:function(r){return Uw(R3(r))}});var B3=we,F3=B3.Object.getPrototypeOf,j3=F3,L3=j3,z3=K,H3=qe,V3=rn;z3({target:"Object",stat:!0,sham:!H3},{create:V3});var W3=we,U3=W3.Object,K3=function(r,e){return U3.create(r,e)},G3=K3,Kw=G3,q3=Kw,Y3=Y(q3),Fd=we,X3=ha;Fd.JSON||(Fd.JSON={stringify:JSON.stringify});var J3=function(r,e,t){return X3(Fd.JSON.stringify,null,arguments)},Z3=J3,Q3=Z3,eL=Q3,tL=Y(eL),rL=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",iL=TypeError,Gw=function(i,r){if(ie,o=aL(t)?t:hL(t),s=a?uL(arguments,e):[],u=a?function(){nL(o,this,s)}:o;return r?i(u,n):i(u)}:i},dL=K,Xw=$e,fL=Yw,hy=fL(Xw.setInterval,!0);dL({global:!0,bind:!0,forced:Xw.setInterval!==hy},{setInterval:hy});var vL=K,Jw=$e,pL=Yw,cy=pL(Jw.setTimeout,!0);vL({global:!0,bind:!0,forced:Jw.setTimeout!==cy},{setTimeout:cy});var gL=we,yL=gL.setTimeout,mL=yL,bL=Y(mL),Zw={exports:{}};(function(i){function r(t){if(t)return e(t);this._callbacks=new Map}function e(t){return Object.assign(t,r.prototype),t._callbacks=new Map,t}r.prototype.on=function(t,n){const a=this._callbacks.get(t)??[];return a.push(n),this._callbacks.set(t,a),this},r.prototype.once=function(t,n){const a=(...o)=>{this.off(t,a),n.apply(this,o)};return a.fn=n,this.on(t,a),this},r.prototype.off=function(t,n){if(t===void 0&&n===void 0)return this._callbacks.clear(),this;if(n===void 0)return this._callbacks.delete(t),this;const a=this._callbacks.get(t);if(a){for(const[o,s]of a.entries())if(s===n||s.fn===n){a.splice(o,1);break}a.length===0?this._callbacks.delete(t):this._callbacks.set(t,a)}return this},r.prototype.emit=function(t,...n){const a=this._callbacks.get(t);if(a){const o=[...a];for(const s of o)s.apply(this,n)}return this},r.prototype.listeners=function(t){return this._callbacks.get(t)??[]},r.prototype.listenerCount=function(t){if(t)return this.listeners(t).length;let n=0;for(const a of this._callbacks.values())n+=a.length;return n},r.prototype.hasListeners=function(t){return this.listenerCount(t)>0},r.prototype.addEventListener=r.prototype.on,r.prototype.removeListener=r.prototype.off,r.prototype.removeEventListener=r.prototype.off,r.prototype.removeAllListeners=r.prototype.off,i.exports=r})(Zw);var $L=Zw.exports,wL=Y($L);/*! Hammer.JS - v2.0.17-rc - 2019-12-16 * http://naver.github.io/egjs * * Forked By Naver egjs * Copyright (c) hammerjs - * Licensed under the MIT license */function sr(){return sr=Object.assign||function(i){for(var r=1;r"u"?{style:{}}:document.createElement("div"),SL="function",Nn=Math.round,Ki=Math.abs,hv=Date.now;function Il(i,r){for(var e,t,n=r[0].toUpperCase()+r.slice(1),a=0;a"u"?kr={}:kr=window;var Qw=Il(EL.style,"touchAction"),e_=Qw!==void 0;function OL(){if(!e_)return!1;var i={},r=kr.CSS&&kr.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){return i[e]=r?kr.CSS.supports("touch-action",e):!0}),i}var t_="compute",r_="auto",Ld="manipulation",Mi="none",ho="pan-x",co="pan-y",Ds=OL(),TL=/mobile|tablet|ip(ad|hone|od)|android/i,i_="ontouchstart"in kr,IL=Il(kr,"PointerEvent")!==void 0,kL=i_&&TL.test(navigator.userAgent),Fo="touch",PL="pen",cv="mouse",xL="kinect",CL=25,gt=1,an=2,je=4,It=8,Au=1,jo=2,Lo=4,zo=8,Zn=16,yr=jo|Lo,Bi=zo|Zn,n_=yr|Bi,a_=["x","y"],Du=["clientX","clientY"];function Pr(i,r,e){var t;if(i)if(i.forEach)i.forEach(r,e);else if(i.length!==void 0)for(t=0;t-1}function AL(i){if(Ci(i,Mi))return Mi;var r=Ci(i,ho),e=Ci(i,co);return r&&e?Mi:r||e?r?ho:co:Ci(i,Ld)?Ld:r_}var o_=function(){function i(e,t){this.manager=e,this.set(t)}var r=i.prototype;return r.set=function(t){t===t_&&(t=this.compute()),e_&&this.manager.element.style&&Ds[t]&&(this.manager.element.style[Qw]=t),this.actions=t.toLowerCase().trim()},r.update=function(){this.set(this.manager.options.touchAction)},r.compute=function(){var t=[];return Pr(this.manager.recognizers,function(n){kl(n.options.enable,[n])&&(t=t.concat(n.getTouchAction()))}),AL(t.join(" "))},r.preventDefaults=function(t){var n=t.srcEvent,a=t.offsetDirection;if(this.manager.session.prevented){n.preventDefault();return}var o=this.actions,s=Ci(o,Mi)&&!Ds[Mi],u=Ci(o,co)&&!Ds[co],l=Ci(o,ho)&&!Ds[ho];if(s){var h=t.pointers.length===1,c=t.distance<2,d=t.deltaTime<250;if(h&&c&&d)return}if(!(l&&u)&&(s||u&&a&yr||l&&a&Bi))return this.preventSrc(n)},r.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},i}();function dv(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}function s_(i){var r=i.length;if(r===1)return{x:Nn(i[0].clientX),y:Nn(i[0].clientY)};for(var e=0,t=0,n=0;n=Ki(r)?i<0?jo:Lo:r<0?zo:Zn}function DL(i,r){var e=r.center,t=i.offsetDelta||{},n=i.prevDelta||{},a=i.prevInput||{};(r.eventType===gt||a.eventType===je)&&(n=i.prevDelta={x:a.deltaX||0,y:a.deltaY||0},t=i.offsetDelta={x:e.x,y:e.y}),r.deltaX=n.x+(e.x-t.x),r.deltaY=n.y+(e.y-t.y)}function l_(i,r,e){return{x:r/i||0,y:e/i||0}}function RL(i,r){return Ru(r[0],r[1],Du)/Ru(i[0],i[1],Du)}function NL(i,r){return zd(r[1],r[0],Du)+zd(i[1],i[0],Du)}function ML(i,r){var e=i.lastInterval||r,t=r.timeStamp-e.timeStamp,n,a,o,s;if(r.eventType!==It&&(t>CL||e.velocity===void 0)){var u=r.deltaX-e.deltaX,l=r.deltaY-e.deltaY,h=l_(t,u,l);a=h.x,o=h.y,n=Ki(h.x)>Ki(h.y)?h.x:h.y,s=u_(u,l),i.lastInterval=r}else n=e.velocity,a=e.velocityX,o=e.velocityY,s=e.direction;r.velocity=n,r.velocityX=a,r.velocityY=o,r.direction=s}function BL(i,r){var e=i.session,t=r.pointers,n=t.length;e.firstInput||(e.firstInput=fy(r)),n>1&&!e.firstMultiple?e.firstMultiple=fy(r):n===1&&(e.firstMultiple=!1);var a=e.firstInput,o=e.firstMultiple,s=o?o.center:a.center,u=r.center=s_(t);r.timeStamp=hv(),r.deltaTime=r.timeStamp-a.timeStamp,r.angle=zd(s,u),r.distance=Ru(s,u),DL(e,r),r.offsetDirection=u_(r.deltaX,r.deltaY);var l=l_(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=l.x,r.overallVelocityY=l.y,r.overallVelocity=Ki(l.x)>Ki(l.y)?l.x:l.y,r.scale=o?RL(o.pointers,t):1,r.rotation=o?NL(o.pointers,t):0,r.maxPointers=e.prevInput?r.pointers.length>e.prevInput.maxPointers?r.pointers.length:e.prevInput.maxPointers:r.pointers.length,ML(e,r);var h=i.element,c=r.srcEvent,d;c.composedPath?d=c.composedPath()[0]:c.path?d=c.path[0]:d=c.target,dv(d,h)&&(h=d),r.target=h}function FL(i,r,e){var t=e.pointers.length,n=e.changedPointers.length,a=r>&&t-n===0,o=r&(je|It)&&t-n===0;e.isFirst=!!a,e.isFinal=!!o,a&&(i.session={}),e.eventType=r,BL(i,e),i.emit("hammer.input",e),i.recognize(e),i.session.prevInput=e}function fo(i){return i.trim().split(/\s+/g)}function Xa(i,r,e){Pr(fo(r),function(t){i.addEventListener(t,e,!1)})}function Ja(i,r,e){Pr(fo(r),function(t){i.removeEventListener(t,e,!1)})}function vy(i){var r=i.ownerDocument||i;return r.defaultView||r.parentWindow||window}var wa=function(){function i(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(a){kl(e.options.enable,[e])&&n.handler(a)},this.init()}var r=i.prototype;return r.handler=function(){},r.init=function(){this.evEl&&Xa(this.element,this.evEl,this.domHandler),this.evTarget&&Xa(this.target,this.evTarget,this.domHandler),this.evWin&&Xa(vy(this.element),this.evWin,this.domHandler)},r.destroy=function(){this.evEl&&Ja(this.element,this.evEl,this.domHandler),this.evTarget&&Ja(this.target,this.evTarget,this.domHandler),this.evWin&&Ja(vy(this.element),this.evWin,this.domHandler)},i}();function Gi(i,r,e){if(i.indexOf&&!e)return i.indexOf(r);for(var t=0;tu[r]}):t=t.sort()),t}var zL={touchstart:gt,touchmove:an,touchend:je,touchcancel:It},HL="touchstart touchmove touchend touchcancel",vv=function(i){Xt(r,i);function r(){var t;return r.prototype.evTarget=HL,t=i.apply(this,arguments)||this,t.targetIds={},t}var e=r.prototype;return e.handler=function(n){var a=zL[n.type],o=VL.call(this,n,a);o&&this.callback(this.manager,a,{pointers:o[0],changedPointers:o[1],pointerType:Fo,srcEvent:n})},r}(wa);function VL(i,r){var e=vo(i.touches),t=this.targetIds;if(r&(gt|an)&&e.length===1)return t[e[0].identifier]=!0,[e,e];var n,a,o=vo(i.changedTouches),s=[],u=this.target;if(a=e.filter(function(l){return dv(l.target,u)}),r===gt)for(n=0;n-1&&n.splice(s,1)};setTimeout(a,GL)}}function qL(i,r){i>?(this.primaryTouch=r.changedPointers[0].identifier,gy.call(this,r)):i&(je|It)&&gy.call(this,r)}function YL(i){for(var r=i.srcEvent.clientX,e=i.srcEvent.clientY,t=0;t-1&&this.requireFail.splice(n,1),this},r.hasRequireFailures=function(){return this.requireFail.length>0},r.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},r.emit=function(t){var n=this,a=this.state;function o(s){n.manager.emit(s,t)}a=ui&&o(n.options.event+yy(a))},r.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=vr},r.canEmit=function(){for(var t=0;ta.threshold&&u&a.direction},e.attrTest=function(n){return ea.prototype.attrTest.call(this,n)&&(this.state&qt||!(this.state&qt)&&this.directionTest(n))},e.emit=function(n){this.pX=n.deltaX,this.pY=n.deltaY;var a=v_(n.direction);a&&(n.additionalEvent=this.options.event+a),i.prototype.emit.call(this,n)},r}(ea),p_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"swipe",threshold:10,velocity:.3,direction:yr|Bi,pointers:1},t))||this}var e=r.prototype;return e.getTouchAction=function(){return gv.prototype.getTouchAction.call(this)},e.attrTest=function(n){var a=this.options.direction,o;return a&(yr|Bi)?o=n.overallVelocity:a&yr?o=n.overallVelocityX:a&Bi&&(o=n.overallVelocityY),i.prototype.attrTest.call(this,n)&&a&n.offsetDirection&&n.distance>this.options.threshold&&n.maxPointers===this.options.pointers&&Ki(o)>this.options.velocity&&n.eventType&je},e.emit=function(n){var a=v_(n.offsetDirection);a&&this.manager.emit(this.options.event+a,n),this.manager.emit(this.options.event,n)},r}(ea),g_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"pinch",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Mi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.scale-1)>this.options.threshold||this.state&qt)},e.emit=function(n){if(n.scale!==1){var a=n.scale<1?"in":"out";n.additionalEvent=this.options.event+a}i.prototype.emit.call(this,n)},r}(ea),y_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"rotate",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Mi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.rotation)>this.options.threshold||this.state&qt)},r}(ea),m_=function(i){Xt(r,i);function r(t){var n;return t===void 0&&(t={}),n=i.call(this,sr({event:"press",pointers:1,time:251,threshold:9},t))||this,n._timer=null,n._input=null,n}var e=r.prototype;return e.getTouchAction=function(){return[r_]},e.process=function(n){var a=this,o=this.options,s=n.pointers.length===o.pointers,u=n.distanceo.time;if(this._input=n,!u||!s||n.eventType&(je|It)&&!l)this.reset();else if(n.eventType>)this.reset(),this._timer=setTimeout(function(){a.state=xr,a.tryEmit()},o.time);else if(n.eventType&je)return xr;return vr},e.reset=function(){clearTimeout(this._timer)},e.emit=function(n){this.state===xr&&(n&&n.eventType&je?this.manager.emit(this.options.event+"up",n):(this._input.timeStamp=hv(),this.manager.emit(this.options.event,this._input)))},r}(Ho),b_={domEvents:!1,touchAction:t_,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},my=[[y_,{enable:!1}],[g_,{enable:!1},["rotate"]],[p_,{direction:yr}],[gv,{direction:yr},["swipe"]],[Hd],[Hd,{event:"doubletap",taps:2},["tap"]],[m_]],QL=1,by=2;function $y(i,r){var e=i.element;if(e.style){var t;Pr(i.options.cssProps,function(n,a){t=Il(e.style,a),r?(i.oldCssProps[t]=e.style[t],e.style[t]=n):e.style[t]=i.oldCssProps[t]||""}),r||(i.oldCssProps={})}}function e5(i,r){var e=document.createEvent("Event");e.initEvent(i,!0,!0),e.gesture=r,r.target.dispatchEvent(e)}var wy=function(){function i(e,t){var n=this;this.options=Ui({},b_,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=XL(this),this.touchAction=new o_(this,this.options.touchAction),$y(this,!0),Pr(this.options.recognizers,function(a){var o=n.add(new a[0](a[1]));a[2]&&o.recognizeWith(a[2]),a[3]&&o.requireFailure(a[3])},this)}var r=i.prototype;return r.set=function(t){return Ui(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},r.stop=function(t){this.session.stopped=t?by:QL},r.recognize=function(t){var n=this.session;if(!n.stopped){this.touchAction.preventDefaults(t);var a,o=this.recognizers,s=n.curRecognizer;(!s||s&&s.state&xr)&&(n.curRecognizer=null,s=null);for(var u=0;u"u"?{style:{}}:document.createElement("div"),EL="function",Nn=Math.round,Ki=Math.abs,hv=Date.now;function Il(i,r){for(var e,t,n=r[0].toUpperCase()+r.slice(1),a=0;a"u"?kr={}:kr=window;var Qw=Il(_L.style,"touchAction"),e_=Qw!==void 0;function SL(){if(!e_)return!1;var i={},r=kr.CSS&&kr.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){return i[e]=r?kr.CSS.supports("touch-action",e):!0}),i}var t_="compute",r_="auto",Ld="manipulation",Mi="none",ho="pan-x",co="pan-y",Ds=SL(),OL=/mobile|tablet|ip(ad|hone|od)|android/i,i_="ontouchstart"in kr,TL=Il(kr,"PointerEvent")!==void 0,IL=i_&&OL.test(navigator.userAgent),Fo="touch",kL="pen",cv="mouse",PL="kinect",xL=25,gt=1,an=2,je=4,It=8,Au=1,jo=2,Lo=4,zo=8,Zn=16,yr=jo|Lo,Bi=zo|Zn,n_=yr|Bi,a_=["x","y"],Du=["clientX","clientY"];function Pr(i,r,e){var t;if(i)if(i.forEach)i.forEach(r,e);else if(i.length!==void 0)for(t=0;t-1}function CL(i){if(Ci(i,Mi))return Mi;var r=Ci(i,ho),e=Ci(i,co);return r&&e?Mi:r||e?r?ho:co:Ci(i,Ld)?Ld:r_}var o_=function(){function i(e,t){this.manager=e,this.set(t)}var r=i.prototype;return r.set=function(t){t===t_&&(t=this.compute()),e_&&this.manager.element.style&&Ds[t]&&(this.manager.element.style[Qw]=t),this.actions=t.toLowerCase().trim()},r.update=function(){this.set(this.manager.options.touchAction)},r.compute=function(){var t=[];return Pr(this.manager.recognizers,function(n){kl(n.options.enable,[n])&&(t=t.concat(n.getTouchAction()))}),CL(t.join(" "))},r.preventDefaults=function(t){var n=t.srcEvent,a=t.offsetDirection;if(this.manager.session.prevented){n.preventDefault();return}var o=this.actions,s=Ci(o,Mi)&&!Ds[Mi],u=Ci(o,co)&&!Ds[co],l=Ci(o,ho)&&!Ds[ho];if(s){var h=t.pointers.length===1,c=t.distance<2,d=t.deltaTime<250;if(h&&c&&d)return}if(!(l&&u)&&(s||u&&a&yr||l&&a&Bi))return this.preventSrc(n)},r.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},i}();function dv(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}function s_(i){var r=i.length;if(r===1)return{x:Nn(i[0].clientX),y:Nn(i[0].clientY)};for(var e=0,t=0,n=0;n=Ki(r)?i<0?jo:Lo:r<0?zo:Zn}function AL(i,r){var e=r.center,t=i.offsetDelta||{},n=i.prevDelta||{},a=i.prevInput||{};(r.eventType===gt||a.eventType===je)&&(n=i.prevDelta={x:a.deltaX||0,y:a.deltaY||0},t=i.offsetDelta={x:e.x,y:e.y}),r.deltaX=n.x+(e.x-t.x),r.deltaY=n.y+(e.y-t.y)}function l_(i,r,e){return{x:r/i||0,y:e/i||0}}function DL(i,r){return Ru(r[0],r[1],Du)/Ru(i[0],i[1],Du)}function RL(i,r){return zd(r[1],r[0],Du)+zd(i[1],i[0],Du)}function NL(i,r){var e=i.lastInterval||r,t=r.timeStamp-e.timeStamp,n,a,o,s;if(r.eventType!==It&&(t>xL||e.velocity===void 0)){var u=r.deltaX-e.deltaX,l=r.deltaY-e.deltaY,h=l_(t,u,l);a=h.x,o=h.y,n=Ki(h.x)>Ki(h.y)?h.x:h.y,s=u_(u,l),i.lastInterval=r}else n=e.velocity,a=e.velocityX,o=e.velocityY,s=e.direction;r.velocity=n,r.velocityX=a,r.velocityY=o,r.direction=s}function ML(i,r){var e=i.session,t=r.pointers,n=t.length;e.firstInput||(e.firstInput=fy(r)),n>1&&!e.firstMultiple?e.firstMultiple=fy(r):n===1&&(e.firstMultiple=!1);var a=e.firstInput,o=e.firstMultiple,s=o?o.center:a.center,u=r.center=s_(t);r.timeStamp=hv(),r.deltaTime=r.timeStamp-a.timeStamp,r.angle=zd(s,u),r.distance=Ru(s,u),AL(e,r),r.offsetDirection=u_(r.deltaX,r.deltaY);var l=l_(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=l.x,r.overallVelocityY=l.y,r.overallVelocity=Ki(l.x)>Ki(l.y)?l.x:l.y,r.scale=o?DL(o.pointers,t):1,r.rotation=o?RL(o.pointers,t):0,r.maxPointers=e.prevInput?r.pointers.length>e.prevInput.maxPointers?r.pointers.length:e.prevInput.maxPointers:r.pointers.length,NL(e,r);var h=i.element,c=r.srcEvent,d;c.composedPath?d=c.composedPath()[0]:c.path?d=c.path[0]:d=c.target,dv(d,h)&&(h=d),r.target=h}function BL(i,r,e){var t=e.pointers.length,n=e.changedPointers.length,a=r>&&t-n===0,o=r&(je|It)&&t-n===0;e.isFirst=!!a,e.isFinal=!!o,a&&(i.session={}),e.eventType=r,ML(i,e),i.emit("hammer.input",e),i.recognize(e),i.session.prevInput=e}function fo(i){return i.trim().split(/\s+/g)}function Xa(i,r,e){Pr(fo(r),function(t){i.addEventListener(t,e,!1)})}function Ja(i,r,e){Pr(fo(r),function(t){i.removeEventListener(t,e,!1)})}function vy(i){var r=i.ownerDocument||i;return r.defaultView||r.parentWindow||window}var wa=function(){function i(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(a){kl(e.options.enable,[e])&&n.handler(a)},this.init()}var r=i.prototype;return r.handler=function(){},r.init=function(){this.evEl&&Xa(this.element,this.evEl,this.domHandler),this.evTarget&&Xa(this.target,this.evTarget,this.domHandler),this.evWin&&Xa(vy(this.element),this.evWin,this.domHandler)},r.destroy=function(){this.evEl&&Ja(this.element,this.evEl,this.domHandler),this.evTarget&&Ja(this.target,this.evTarget,this.domHandler),this.evWin&&Ja(vy(this.element),this.evWin,this.domHandler)},i}();function Gi(i,r,e){if(i.indexOf&&!e)return i.indexOf(r);for(var t=0;tu[r]}):t=t.sort()),t}var LL={touchstart:gt,touchmove:an,touchend:je,touchcancel:It},zL="touchstart touchmove touchend touchcancel",vv=function(i){Xt(r,i);function r(){var t;return r.prototype.evTarget=zL,t=i.apply(this,arguments)||this,t.targetIds={},t}var e=r.prototype;return e.handler=function(n){var a=LL[n.type],o=HL.call(this,n,a);o&&this.callback(this.manager,a,{pointers:o[0],changedPointers:o[1],pointerType:Fo,srcEvent:n})},r}(wa);function HL(i,r){var e=vo(i.touches),t=this.targetIds;if(r&(gt|an)&&e.length===1)return t[e[0].identifier]=!0,[e,e];var n,a,o=vo(i.changedTouches),s=[],u=this.target;if(a=e.filter(function(l){return dv(l.target,u)}),r===gt)for(n=0;n-1&&n.splice(s,1)};setTimeout(a,KL)}}function GL(i,r){i>?(this.primaryTouch=r.changedPointers[0].identifier,gy.call(this,r)):i&(je|It)&&gy.call(this,r)}function qL(i){for(var r=i.srcEvent.clientX,e=i.srcEvent.clientY,t=0;t-1&&this.requireFail.splice(n,1),this},r.hasRequireFailures=function(){return this.requireFail.length>0},r.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},r.emit=function(t){var n=this,a=this.state;function o(s){n.manager.emit(s,t)}a=ui&&o(n.options.event+yy(a))},r.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=vr},r.canEmit=function(){for(var t=0;ta.threshold&&u&a.direction},e.attrTest=function(n){return ea.prototype.attrTest.call(this,n)&&(this.state&qt||!(this.state&qt)&&this.directionTest(n))},e.emit=function(n){this.pX=n.deltaX,this.pY=n.deltaY;var a=v_(n.direction);a&&(n.additionalEvent=this.options.event+a),i.prototype.emit.call(this,n)},r}(ea),p_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"swipe",threshold:10,velocity:.3,direction:yr|Bi,pointers:1},t))||this}var e=r.prototype;return e.getTouchAction=function(){return gv.prototype.getTouchAction.call(this)},e.attrTest=function(n){var a=this.options.direction,o;return a&(yr|Bi)?o=n.overallVelocity:a&yr?o=n.overallVelocityX:a&Bi&&(o=n.overallVelocityY),i.prototype.attrTest.call(this,n)&&a&n.offsetDirection&&n.distance>this.options.threshold&&n.maxPointers===this.options.pointers&&Ki(o)>this.options.velocity&&n.eventType&je},e.emit=function(n){var a=v_(n.offsetDirection);a&&this.manager.emit(this.options.event+a,n),this.manager.emit(this.options.event,n)},r}(ea),g_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"pinch",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Mi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.scale-1)>this.options.threshold||this.state&qt)},e.emit=function(n){if(n.scale!==1){var a=n.scale<1?"in":"out";n.additionalEvent=this.options.event+a}i.prototype.emit.call(this,n)},r}(ea),y_=function(i){Xt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,sr({event:"rotate",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Mi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.rotation)>this.options.threshold||this.state&qt)},r}(ea),m_=function(i){Xt(r,i);function r(t){var n;return t===void 0&&(t={}),n=i.call(this,sr({event:"press",pointers:1,time:251,threshold:9},t))||this,n._timer=null,n._input=null,n}var e=r.prototype;return e.getTouchAction=function(){return[r_]},e.process=function(n){var a=this,o=this.options,s=n.pointers.length===o.pointers,u=n.distanceo.time;if(this._input=n,!u||!s||n.eventType&(je|It)&&!l)this.reset();else if(n.eventType>)this.reset(),this._timer=setTimeout(function(){a.state=xr,a.tryEmit()},o.time);else if(n.eventType&je)return xr;return vr},e.reset=function(){clearTimeout(this._timer)},e.emit=function(n){this.state===xr&&(n&&n.eventType&je?this.manager.emit(this.options.event+"up",n):(this._input.timeStamp=hv(),this.manager.emit(this.options.event,this._input)))},r}(Ho),b_={domEvents:!1,touchAction:t_,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},my=[[y_,{enable:!1}],[g_,{enable:!1},["rotate"]],[p_,{direction:yr}],[gv,{direction:yr},["swipe"]],[Hd],[Hd,{event:"doubletap",taps:2},["tap"]],[m_]],ZL=1,by=2;function $y(i,r){var e=i.element;if(e.style){var t;Pr(i.options.cssProps,function(n,a){t=Il(e.style,a),r?(i.oldCssProps[t]=e.style[t],e.style[t]=n):e.style[t]=i.oldCssProps[t]||""}),r||(i.oldCssProps={})}}function QL(i,r){var e=document.createEvent("Event");e.initEvent(i,!0,!0),e.gesture=r,r.target.dispatchEvent(e)}var wy=function(){function i(e,t){var n=this;this.options=Ui({},b_,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=YL(this),this.touchAction=new o_(this,this.options.touchAction),$y(this,!0),Pr(this.options.recognizers,function(a){var o=n.add(new a[0](a[1]));a[2]&&o.recognizeWith(a[2]),a[3]&&o.requireFailure(a[3])},this)}var r=i.prototype;return r.set=function(t){return Ui(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},r.stop=function(t){this.session.stopped=t?by:ZL},r.recognize=function(t){var n=this.session;if(!n.stopped){this.touchAction.preventDefaults(t);var a,o=this.recognizers,s=n.curRecognizer;(!s||s&&s.state&xr)&&(n.curRecognizer=null,s=null);for(var u=0;u\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=window.console&&(window.console.warn||window.console.log);return o&&o.call(window.console,t,a),i.apply(this,arguments)}}var w_=$_(function(i,r,e){for(var t=Object.keys(r),n=0;n=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function h5(i,r){var e;if(i){if(typeof i=="string")return Ey(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ey(i,r)}}function Ey(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?e-1:0),n=1;n2){var t;return Nu.apply(void 0,Ol(t=[S_(r[0],r[1])]).call(t,St(Tl(r).call(r,2))))}var n=r[0],a=r[1];if(n instanceof Date&&a instanceof Date)return n.setTime(a.getTime()),n;var o=__(cj(a)),s;try{for(o.s();!(s=o.n()).done;){var u=s.value;Object.prototype.propertyIsEnumerable.call(a,u)&&(a[u]===E_?delete n[u]:n[u]!==null&&a[u]!==null&&typeof n[u]=="object"&&typeof a[u]=="object"&&!Bt(n[u])&&!Bt(a[u])?n[u]=Nu(n[u],a[u]):n[u]=O_(a[u]))}}catch(l){o.e(l)}finally{o.f()}return n}function O_(i){return Bt(i)?rr(i).call(i,function(r){return O_(r)}):typeof i=="object"&&i!==null?i instanceof Date?new Date(i.getTime()):Nu({},i):i}function T_(i){for(var r=0,e=lv(i);ro;)u=t(e,s=n[o++]),u!==void 0&&X5(a,s,u);return a}});var J5=we,Z5=J5.Object.getOwnPropertyDescriptors,Q5=Z5,ez=Q5,tz=ez,ky=Y(tz),M_={exports:{}},rz=K,iz=qe,Py=cl.f;rz({target:"Object",stat:!0,forced:Object.defineProperties!==Py,sham:!iz},{defineProperties:Py});var nz=we,B_=nz.Object,az=M_.exports=function(r,e){return B_.defineProperties(r,e)};B_.defineProperties.sham&&(az.sham=!0);var oz=M_.exports,sz=oz,uz=sz,lz=uz,hz=Y(lz),cz=p0,dz=Y(cz);function F_(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}var fz=Kw,vz=fz,pz=vz,gz=pz,j_=gz,yz=Y(j_),mz=K,bz=aw;mz({target:"Object",stat:!0},{setPrototypeOf:bz});var $z=we,wz=$z.Object.setPrototypeOf,_z=wz,Ez=_z,Sz=Ez,Oz=Sz,Tz=Oz,Iz=Tz,L_=Iz,Vd=Y(L_),kz=ww,Pz=kz,xz=Pz,Cz=xz,Az=Cz,z_=Y(Az);function Wd(i,r){var e;return Wd=Vd?z_(e=Vd).call(e):function(n,a){return n.__proto__=a,n},Wd(i,r)}function Dz(i,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=yz(r.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),ol(i,"prototype",{writable:!1}),Wd(i,r)}function Rz(i,r){if(r&&(Jn(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F_(i)}var Nz=z3,Mz=Nz,Bz=Mz,Fz=Bz,H_=Fz,xy=Y(H_);function Mu(i){var r;return Mu=Vd?z_(r=xy).call(r):function(t){return t.__proto__||xy(t)},Mu(i)}var V_={exports:{}},W_={exports:{}};(function(i){var r=iv,e=gw;function t(n){"@babel/helpers - typeof";return i.exports=t=typeof r=="function"&&typeof e=="symbol"?function(a){return typeof a}:function(a){return a&&typeof r=="function"&&a.constructor===r&&a!==r.prototype?"symbol":typeof a},i.exports.__esModule=!0,i.exports.default=i.exports,t(n)}i.exports=t,i.exports.__esModule=!0,i.exports.default=i.exports})(W_);var jz=W_.exports,Lz=zw,zz=Lz,Hz=zz,Vz=Hz,Wz=Vz,Cy=Ve,Uz=uv,Kz=Qi,Gz=Ct,qz=function(i,r,e){for(var t=Uz(r),n=Gz.f,a=Kz.f,o=0;oc;c++)if(f=y(i[c]),f&&Dy(Ny,f))return f;return new fu(!1)}l=g4(i,h)}for(v=a?i.next:l.next;!(p=c4(v,l)).done;){try{f=y(p.value)}catch(m){Ry(l,"throw",m)}if(typeof f=="object"&&f&&Dy(Ny,f))return f}return new fu(!1)},b4=tn,$4=function(i,r){return i===void 0?arguments.length<2?"":r:b4(i)},w4=K,_4=He,E4=$l,Bu=aw,S4=qz,G_=rn,qh=Lr,Yh=en,O4=Jz,T4=l4,I4=on,k4=$4,P4=Ee,x4=P4("toStringTag"),Fu=Error,C4=[].push,ta=function(r,e){var t=_4(Xh,this),n;Bu?n=Bu(new Fu,t?E4(this):Xh):(n=t?this:G_(Xh),qh(n,x4,"Error")),e!==void 0&&qh(n,"message",k4(e)),T4(n,ta,n.stack,1),arguments.length>2&&O4(n,arguments[2]);var a=[];return I4(r,C4,{that:a}),qh(n,"errors",a),n};Bu?Bu(ta,Fu):S4(ta,Fu,{name:!0});var Xh=ta.prototype=G_(Fu.prototype,{constructor:Yh(1,ta),message:Yh(1,""),name:Yh(1,"AggregateError")});w4({global:!0,constructor:!0,arity:2},{AggregateError:ta});var A4=mt,D4=qf,R4=Ee,N4=qe,My=R4("species"),q_=function(i){var r=A4(i);N4&&r&&!r[My]&&D4(r,My,{configurable:!0,get:function(){return this}})},M4=He,B4=TypeError,mv=function(i,r){if(M4(r,i))return i;throw new B4("Incorrect invocation")},By=jt,F4=I_,j4=ca,L4=Ee,z4=L4("species"),Y_=function(i,r){var e=By(i).constructor,t;return e===void 0||j4(t=By(e)[z4])?r:F4(t)},H4=mi,X_=/(?:ipad|iphone|ipod).*applewebkit/i.test(H4),Ft=$e,V4=ha,W4=bi,Fy=Ie,U4=Ve,J_=le,jy=O0,K4=No,Ly=Vf,G4=Gw,q4=X_,Y4=Bo,Ud=Ft.setImmediate,Kd=Ft.clearImmediate,X4=Ft.process,Jh=Ft.Dispatch,J4=Ft.Function,zy=Ft.MessageChannel,Z4=Ft.String,Zh=0,Za={},Hy="onreadystatechange",go,ki,Qh,ec;J_(function(){go=Ft.location});var bv=function(i){if(U4(Za,i)){var r=Za[i];delete Za[i],r()}},tc=function(i){return function(){bv(i)}},Vy=function(i){bv(i.data)},Wy=function(i){Ft.postMessage(Z4(i),go.protocol+"//"+go.host)};(!Ud||!Kd)&&(Ud=function(r){G4(arguments.length,1);var e=Fy(r)?r:J4(r),t=K4(arguments,1);return Za[++Zh]=function(){V4(e,void 0,t)},ki(Zh),Zh},Kd=function(r){delete Za[r]},Y4?ki=function(i){X4.nextTick(tc(i))}:Jh&&Jh.now?ki=function(i){Jh.now(tc(i))}:zy&&!q4?(Qh=new zy,ec=Qh.port2,Qh.port1.onmessage=Vy,ki=W4(ec.postMessage,ec)):Ft.addEventListener&&Fy(Ft.postMessage)&&!Ft.importScripts&&go&&go.protocol!=="file:"&&!J_(Wy)?(ki=Wy,Ft.addEventListener("message",Vy,!1)):Hy in Ly("script")?ki=function(i){jy.appendChild(Ly("script"))[Hy]=function(){jy.removeChild(this),bv(i)}}:ki=function(i){setTimeout(tc(i),0)});var Z_={set:Ud,clear:Kd},Q_=function(){this.head=null,this.tail=null};Q_.prototype={add:function(i){var r={item:i,next:null},e=this.tail;e?e.next=r:this.head=r,this.tail=r},get:function(){var i=this.head;if(i){var r=this.head=i.next;return r===null&&(this.tail=null),i.item}}};var eE=Q_,Q4=mi,e6=/ipad|iphone|ipod/i.test(Q4)&&typeof Pebble<"u",t6=mi,r6=/web0s(?!.*chrome)/i.test(t6),qi=$e,Uy=bi,i6=Qi.f,rc=Z_.set,n6=eE,a6=X_,o6=e6,s6=r6,ic=Bo,Ky=qi.MutationObserver||qi.WebKitMutationObserver,Gy=qi.document,qy=qi.process,Ns=qi.Promise,Yy=i6(qi,"queueMicrotask"),Gd=Yy&&Yy.value,_n,nc,ac,Ms,Xy;if(!Gd){var Bs=new n6,Fs=function(){var i,r;for(ic&&(i=qy.domain)&&i.exit();r=Bs.get();)try{r()}catch(e){throw Bs.head&&_n(),e}i&&i.enter()};!a6&&!ic&&!s6&&Ky&&Gy?(nc=!0,ac=Gy.createTextNode(""),new Ky(Fs).observe(ac,{characterData:!0}),_n=function(){ac.data=nc=!nc}):!o6&&Ns&&Ns.resolve?(Ms=Ns.resolve(void 0),Ms.constructor=Ns,Xy=Uy(Ms.then,Ms),_n=function(){Xy(Fs)}):ic?_n=function(){qy.nextTick(Fs)}:(rc=Uy(rc,qi),_n=function(){rc(Fs)}),Gd=function(i){Bs.head||_n(),Bs.add(i)}}var u6=Gd,l6=function(i,r){try{arguments.length===1?console.error(i):console.error(i,r)}catch{}},_a=function(i){try{return{error:!1,value:i()}}catch(r){return{error:!0,value:r}}},h6=$e,Ea=h6.Promise,tE=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",c6=tE,d6=Bo,f6=!c6&&!d6&&typeof window=="object"&&typeof document=="object",v6=$e,Qa=Ea,p6=Ie,g6=d0,y6=m0,m6=Ee,b6=f6,$6=tE,oc=da,Jy=Qa&&Qa.prototype,w6=m6("species"),qd=!1,rE=p6(v6.PromiseRejectionEvent),_6=g6("Promise",function(){var i=y6(Qa),r=i!==String(Qa);if(!r&&oc===66||!(Jy.catch&&Jy.finally))return!0;if(!oc||oc<51||!/native code/.test(i)){var e=new Qa(function(a){a(1)}),t=function(a){a(function(){},function(){})},n=e.constructor={};if(n[w6]=t,qd=e.then(function(){})instanceof t,!qd)return!0}return!r&&(b6||$6)&&!rE}),Vo={CONSTRUCTOR:_6,REJECTION_EVENT:rE,SUBCLASSING:qd},wr={},Zy=Pt,E6=TypeError,S6=function(i){var r,e;this.promise=new i(function(t,n){if(r!==void 0||e!==void 0)throw new E6("Bad Promise constructor");r=t,e=n}),this.resolve=Zy(r),this.reject=Zy(e)};wr.f=function(i){return new S6(i)};var O6=K,ju=Bo,fi=$e,Wo=Ye,T6=ya,I6=nn,k6=q_,P6=Pt,Yd=Ie,x6=nt,C6=mv,A6=Y_,iE=Z_.set,$v=u6,D6=l6,R6=_a,N6=eE,nE=ma,Xd=Ea,aE=Vo,oE=wr,Pl="Promise",sE=aE.CONSTRUCTOR,M6=aE.REJECTION_EVENT,sc=nE.getterFor(Pl),B6=nE.set,F6=Xd&&Xd.prototype,Bn=Xd,uc=F6,uE=fi.TypeError,Jd=fi.document,wv=fi.process,Zd=oE.f,j6=Zd,L6=!!(Jd&&Jd.createEvent&&fi.dispatchEvent),lE="unhandledrejection",z6="rejectionhandled",Qy=0,hE=1,H6=2,_v=1,cE=2,js,em,V6,dE=function(i){var r;return x6(i)&&Yd(r=i.then)?r:!1},fE=function(i,r){var e=r.value,t=r.state===hE,n=t?i.ok:i.fail,a=i.resolve,o=i.reject,s=i.domain,u,l,h;try{n?(t||(r.rejection===cE&&U6(r),r.rejection=_v),n===!0?u=e:(s&&s.enter(),u=n(e),s&&(s.exit(),h=!0)),u===i.promise?o(new uE("Promise-chain cycle")):(l=dE(u))?Wo(l,u,a,o):a(u)):o(e)}catch(c){s&&!h&&s.exit(),o(c)}},vE=function(i,r){i.notified||(i.notified=!0,$v(function(){for(var e=i.reactions,t;t=e.get();)fE(t,i);i.notified=!1,r&&!i.rejection&&W6(i)}))},pE=function(i,r,e){var t,n;L6?(t=Jd.createEvent("Event"),t.promise=r,t.reason=e,t.initEvent(i,!1,!0),fi.dispatchEvent(t)):t={promise:r,reason:e},!M6&&(n=fi["on"+i])?n(t):i===lE&&D6("Unhandled promise rejection",e)},W6=function(i){Wo(iE,fi,function(){var r=i.facade,e=i.value,t=tm(i),n;if(t&&(n=R6(function(){ju?wv.emit("unhandledRejection",e,r):pE(lE,r,e)}),i.rejection=ju||tm(i)?cE:_v,n.error))throw n.value})},tm=function(i){return i.rejection!==_v&&!i.parent},U6=function(i){Wo(iE,fi,function(){var r=i.facade;ju?wv.emit("rejectionHandled",r):pE(z6,r,i.value)})},Fn=function(i,r,e){return function(t){i(r,t,e)}},Un=function(i,r,e){i.done||(i.done=!0,e&&(i=e),i.value=r,i.state=H6,vE(i,!0))},Qd=function(i,r,e){if(!i.done){i.done=!0,e&&(i=e);try{if(i.facade===r)throw new uE("Promise can't be resolved itself");var t=dE(r);t?$v(function(){var n={done:!1};try{Wo(t,r,Fn(Qd,n,i),Fn(Un,n,i))}catch(a){Un(n,a,i)}}):(i.value=r,i.state=hE,vE(i,!1))}catch(n){Un({done:!1},n,i)}}};sE&&(Bn=function(r){C6(this,uc),P6(r),Wo(js,this);var e=sc(this);try{r(Fn(Qd,e),Fn(Un,e))}catch(t){Un(e,t)}},uc=Bn.prototype,js=function(r){B6(this,{type:Pl,done:!1,notified:!1,parent:!1,reactions:new N6,rejection:!1,state:Qy,value:void 0})},js.prototype=T6(uc,"then",function(r,e){var t=sc(this),n=Zd(A6(this,Bn));return t.parent=!0,n.ok=Yd(r)?r:!0,n.fail=Yd(e)&&e,n.domain=ju?wv.domain:void 0,t.state===Qy?t.reactions.add(n):$v(function(){fE(n,t)}),n.promise}),em=function(){var i=new js,r=sc(i);this.promise=i,this.resolve=Fn(Qd,r),this.reject=Fn(Un,r)},oE.f=Zd=function(i){return i===Bn||i===V6?new em(i):j6(i)});O6({global:!0,constructor:!0,wrap:!0,forced:sE},{Promise:Bn});I6(Bn,Pl,!1,!0);k6(Pl);var K6=Ea,G6=kw,q6=Vo.CONSTRUCTOR,xl=q6||!G6(function(i){K6.all(i).then(void 0,function(){})}),Y6=K,X6=Ye,J6=Pt,Z6=wr,Q6=_a,eH=on,tH=xl;Y6({target:"Promise",stat:!0,forced:tH},{all:function(r){var e=this,t=Z6.f(e),n=t.resolve,a=t.reject,o=Q6(function(){var s=J6(e.resolve),u=[],l=0,h=1;eH(r,function(c){var d=l++,f=!1;h++,X6(s,e,c).then(function(v){f||(f=!0,u[d]=v,--h||n(u))},a)}),--h||n(u)});return o.error&&a(o.value),t.promise}});var rH=K,iH=Vo.CONSTRUCTOR,rm=Ea;rm&&rm.prototype;rH({target:"Promise",proto:!0,forced:iH,real:!0},{catch:function(i){return this.then(void 0,i)}});var nH=K,aH=Ye,oH=Pt,sH=wr,uH=_a,lH=on,hH=xl;nH({target:"Promise",stat:!0,forced:hH},{race:function(r){var e=this,t=sH.f(e),n=t.reject,a=uH(function(){var o=oH(e.resolve);lH(r,function(s){aH(o,e,s).then(t.resolve,n)})});return a.error&&n(a.value),t.promise}});var cH=K,dH=Ye,fH=wr,vH=Vo.CONSTRUCTOR;cH({target:"Promise",stat:!0,forced:vH},{reject:function(r){var e=fH.f(this);return dH(e.reject,void 0,r),e.promise}});var pH=jt,gH=nt,yH=wr,gE=function(i,r){if(pH(i),gH(r)&&r.constructor===i)return r;var e=yH.f(i),t=e.resolve;return t(r),e.promise},mH=K,bH=mt,$H=Pk,wH=Ea,_H=Vo.CONSTRUCTOR,EH=gE,SH=bH("Promise"),OH=!_H;mH({target:"Promise",stat:!0,forced:$H},{resolve:function(r){return EH(OH&&this===SH?wH:this,r)}});var TH=K,IH=Ye,kH=Pt,PH=wr,xH=_a,CH=on,AH=xl;TH({target:"Promise",stat:!0,forced:AH},{allSettled:function(r){var e=this,t=PH.f(e),n=t.resolve,a=t.reject,o=xH(function(){var s=kH(e.resolve),u=[],l=0,h=1;CH(r,function(c){var d=l++,f=!1;h++,IH(s,e,c).then(function(v){f||(f=!0,u[d]={status:"fulfilled",value:v},--h||n(u))},function(v){f||(f=!0,u[d]={status:"rejected",reason:v},--h||n(u))})}),--h||n(u)});return o.error&&a(o.value),t.promise}});var DH=K,RH=Ye,NH=Pt,MH=mt,BH=wr,FH=_a,jH=on,LH=xl,im="No one promise resolved";DH({target:"Promise",stat:!0,forced:LH},{any:function(r){var e=this,t=MH("AggregateError"),n=BH.f(e),a=n.resolve,o=n.reject,s=FH(function(){var u=NH(e.resolve),l=[],h=0,c=1,d=!1;jH(r,function(f){var v=h++,p=!1;c++,RH(u,e,f).then(function(g){p||d||(d=!0,a(g))},function(g){p||d||(p=!0,l[v]=g,--c||o(new t(l,im)))})}),--c||o(new t(l,im))});return s.error&&o(s.value),n.promise}});var zH=K,ef=Ea,HH=le,VH=mt,WH=Ie,UH=Y_,nm=gE,KH=ef&&ef.prototype,GH=!!ef&&HH(function(){KH.finally.call({then:function(){}},function(){})});zH({target:"Promise",proto:!0,real:!0,forced:GH},{finally:function(i){var r=UH(this,VH("Promise")),e=WH(i);return this.then(e?function(t){return nm(r,i()).then(function(){return t})}:i,e?function(t){return nm(r,i()).then(function(){throw t})}:i)}});var qH=we,YH=qH.Promise,XH=YH,JH=XH,ZH=K,QH=wr;ZH({target:"Promise",stat:!0},{withResolvers:function(){var r=QH.f(this);return{promise:r.promise,resolve:r.resolve,reject:r.reject}}});var e8=JH,t8=e8,r8=K,i8=wr,n8=_a;r8({target:"Promise",stat:!0,forced:!0},{try:function(i){var r=i8.f(this),e=n8(i);return(e.error?r.reject:r.resolve)(e.value),r.promise}});var a8=t8,o8=a8,s8=o8,u8=Hw,l8=u8,h8=l8,c8=h8,d8=c8;(function(i){var r=jz.default,e=g0,t=iv,n=j_,a=H_,o=Wz,s=Nw,u=L_,l=s8,h=d8,c=Bw;function d(){i.exports=d=function(){return v},i.exports.__esModule=!0,i.exports.default=i.exports;var f,v={},p=Object.prototype,g=p.hasOwnProperty,y=e||function(F,x,C){F[x]=C.value},m=typeof t=="function"?t:{},$=m.iterator||"@@iterator",b=m.asyncIterator||"@@asyncIterator",O=m.toStringTag||"@@toStringTag";function _(F,x,C){return e(F,x,{value:C,enumerable:!0,configurable:!0,writable:!0}),F[x]}try{_({},"")}catch{_=function(C,W,Z){return C[W]=Z}}function D(F,x,C,W){var Z=x&&x.prototype instanceof ie?x:ie,X=n(Z.prototype),Re=new Rt(W||[]);return y(X,"_invoke",{value:Fe(F,C,Re)}),X}function R(F,x,C){try{return{type:"normal",arg:F.call(x,C)}}catch(W){return{type:"throw",arg:W}}}v.wrap=D;var P="suspendedStart",B="suspendedYield",j="executing",J="completed",U={};function ie(){}function _e(){}function ye(){}var Ae={};_(Ae,$,function(){return this});var ht=a,at=ht&&ht(ht(ut([])));at&&at!==p&&g.call(at,$)&&(Ae=at);var Dt=ye.prototype=ie.prototype=n(Ae);function ot(F){var x;o(x=["next","throw","return"]).call(x,function(C){_(F,C,function(W){return this._invoke(C,W)})})}function me(F,x){function C(Z,X,Re,ct){var bt=R(F[Z],F,X);if(bt.type!=="throw"){var Oi=bt.arg,Vr=Oi.value;return Vr&&r(Vr)=="object"&&g.call(Vr,"__await")?x.resolve(Vr.__await).then(function(Ti){C("next",Ti,Re,ct)},function(Ti){C("throw",Ti,Re,ct)}):x.resolve(Vr).then(function(Ti){Oi.value=Ti,Re(Oi)},function(Ti){return C("throw",Ti,Re,ct)})}ct(bt.arg)}var W;y(this,"_invoke",{value:function(X,Re){function ct(){return new x(function(bt,Oi){C(X,Re,bt,Oi)})}return W=W?W.then(ct,ct):ct()}})}function Fe(F,x,C){var W=P;return function(Z,X){if(W===j)throw new Error("Generator is already running");if(W===J){if(Z==="throw")throw X;return{value:f,done:!0}}for(C.method=Z,C.arg=X;;){var Re=C.delegate;if(Re){var ct=De(Re,C);if(ct){if(ct===U)continue;return ct}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(W===P)throw W=J,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);W=j;var bt=R(F,x,C);if(bt.type==="normal"){if(W=C.done?J:B,bt.arg===U)continue;return{value:bt.arg,done:C.done}}bt.type==="throw"&&(W=J,C.method="throw",C.arg=bt.arg)}}}function De(F,x){var C=x.method,W=F.iterator[C];if(W===f)return x.delegate=null,C==="throw"&&F.iterator.return&&(x.method="return",x.arg=f,De(F,x),x.method==="throw")||C!=="return"&&(x.method="throw",x.arg=new TypeError("The iterator does not provide a '"+C+"' method")),U;var Z=R(W,F.iterator,x.arg);if(Z.type==="throw")return x.method="throw",x.arg=Z.arg,x.delegate=null,U;var X=Z.arg;return X?X.done?(x[F.resultName]=X.value,x.next=F.nextLoc,x.method!=="return"&&(x.method="next",x.arg=f),x.delegate=null,U):X:(x.method="throw",x.arg=new TypeError("iterator result is not an object"),x.delegate=null,U)}function st(F){var x,C={tryLoc:F[0]};1 in F&&(C.catchLoc=F[1]),2 in F&&(C.finallyLoc=F[2],C.afterLoc=F[3]),s(x=this.tryEntries).call(x,C)}function Sr(F){var x=F.completion||{};x.type="normal",delete x.arg,F.completion=x}function Rt(F){this.tryEntries=[{tryLoc:"root"}],o(F).call(F,st,this),this.reset(!0)}function ut(F){if(F||F===""){var x=F[$];if(x)return x.call(F);if(typeof F.next=="function")return F;if(!isNaN(F.length)){var C=-1,W=function Z(){for(;++C=0;--Z){var X=this.tryEntries[Z],Re=X.completion;if(X.tryLoc==="root")return W("end");if(X.tryLoc<=this.prev){var ct=g.call(X,"catchLoc"),bt=g.call(X,"finallyLoc");if(ct&&bt){if(this.prev=0;--W){var Z=this.tryEntries[W];if(Z.tryLoc<=this.prev&&g.call(Z,"finallyLoc")&&this.prev=0;--C){var W=this.tryEntries[C];if(W.finallyLoc===x)return this.complete(W.completion,W.afterLoc),Sr(W),U}},catch:function(x){for(var C=this.tryEntries.length-1;C>=0;--C){var W=this.tryEntries[C];if(W.tryLoc===x){var Z=W.completion;if(Z.type==="throw"){var X=Z.arg;Sr(W)}return X}}throw new Error("illegal catch attempt")},delegateYield:function(x,C,W){return this.delegate={iterator:ut(x),resultName:C,nextLoc:W},this.method==="next"&&(this.arg=f),U}},v}i.exports=d,i.exports.__esModule=!0,i.exports.default=i.exports})(V_);var f8=V_.exports,vu=f8(),v8=vu;try{regeneratorRuntime=vu}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=vu:Function("r","regeneratorRuntime = r")(vu)}var wt=Y(v8),yE={exports:{}},p8=le,g8=p8(function(){if(typeof ArrayBuffer=="function"){var i=new ArrayBuffer(8);Object.isExtensible(i)&&Object.defineProperty(i,"a",{value:8})}}),y8=le,m8=nt,b8=yi,am=g8,pu=Object.isExtensible,$8=y8(function(){pu(1)}),w8=$8||am?function(r){return!m8(r)||am&&b8(r)==="ArrayBuffer"?!1:pu?pu(r):!0}:pu,_8=le,E8=!_8(function(){return Object.isExtensible(Object.preventExtensions({}))}),S8=K,O8=be,T8=Po,I8=nt,Ev=Ve,k8=Ct.f,om=xo,P8=Gf,Sv=w8,x8=nl,C8=E8,mE=!1,Br=x8("meta"),A8=0,Ov=function(i){k8(i,Br,{value:{objectID:"O"+A8++,weakData:{}}})},D8=function(i,r){if(!I8(i))return typeof i=="symbol"?i:(typeof i=="string"?"S":"P")+i;if(!Ev(i,Br)){if(!Sv(i))return"F";if(!r)return"E";Ov(i)}return i[Br].objectID},R8=function(i,r){if(!Ev(i,Br)){if(!Sv(i))return!0;if(!r)return!1;Ov(i)}return i[Br].weakData},N8=function(i){return C8&&mE&&Sv(i)&&!Ev(i,Br)&&Ov(i),i},M8=function(){B8.enable=function(){},mE=!0;var i=om.f,r=O8([].splice),e={};e[Br]=1,i(e).length&&(om.f=function(t){for(var n=i(t),a=0,o=n.length;a1?arguments[1]:void 0),f;f=f?f.next:c.first;)for(d(f.value,f.key,this);f&&f.removed;)f=f.previous},has:function(h){return!!u(this,h)}}),sm(a,e?{get:function(h){var c=u(this,h);return c&&c.value},set:function(h,c){return s(this,h===0?0:h,c)}}:{add:function(h){return s(this,h=h===0?0:h,h)}}),ja&&i7(a,"size",{configurable:!0,get:function(){return o(this).size}}),n},setStrong:function(i,r,e){var t=r+" Iterator",n=lc(r),a=lc(t);u7(i,r,function(o,s){lm(this,{type:t,target:o,state:n(o),kind:s,last:void 0})},function(){for(var o=a(this),s=o.kind,u=o.last;u&&u.removed;)u=u.previous;return!o.target||!(o.last=u=u?u.next:o.state.first)?(o.target=void 0,Ls(void 0,!0)):Ls(s==="keys"?u.key:s==="values"?u.value:[u.key,u.value],!1)},e?"entries":"values",!e,!0),l7(r)}},h7=wE,c7=EE;h7("Map",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},c7);var d7=we,f7=d7.Map,v7=f7,p7=v7,g7=p7,SE=Y(g7),y7=K,m7=ba.some,b7=_l,$7=b7("some");y7({target:"Array",proto:!0,forced:!$7},{some:function(r){return m7(this,r,arguments.length>1?arguments[1]:void 0)}});var w7=lt,_7=w7("Array","some"),E7=He,S7=_7,hc=Array.prototype,O7=function(i){var r=i.some;return i===hc||E7(hc,i)&&r===hc.some?S7:r},T7=O7,I7=T7,k7=I7,P7=Y(k7),x7=lt,C7=x7("Array","keys"),A7=C7,D7=A7,R7=zr,N7=Ve,M7=He,B7=D7,cc=Array.prototype,F7={DOMTokenList:!0,NodeList:!0},j7=function(i){var r=i.keys;return i===cc||M7(cc,i)&&r===cc.keys||N7(F7,R7(i))?B7:r},L7=j7,En=Y(L7),hm=k0,z7=Math.floor,tf=function(i,r){var e=i.length,t=z7(e/2);return e<8?H7(i,r):V7(i,tf(hm(i,0,t),r),tf(hm(i,t),r),r)},H7=function(i,r){for(var e=i.length,t=1,n,a;t0;)i[a]=i[--a];a!==t++&&(i[a]=n)}return i},V7=function(i,r,e,t){for(var n=r.length,a=e.length,o=0,s=0;o3)){if(iV)return!0;if(ym)return ym<603;var i="",r,e,t,n;for(r=65;r<76;r++){switch(e=String.fromCharCode(r),r){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(n=0;n<47;n++)ti.push({k:e+n,v:t})}for(ti.sort(function(a,o){return o.v-a.v}),n=0;nvm(e)?1:-1}};J7({target:"Array",proto:!0,forced:uV},{sort:function(r){r!==void 0&&Z7(r);var e=Q7(this);if(TE)return r===void 0?mm(e):mm(e,r);var t=[],n=fm(e),a,o;for(o=0;othis.max&&this.flush(),this._timeout!=null&&(clearTimeout(this._timeout),this._timeout=null),this.queue.length>0&&typeof this.delay=="number"&&(this._timeout=$L(function(){e.flush()},this.delay))}},{key:"flush",value:function(){var e,t;Wi(e=Ww(t=this._queue).call(t,0)).call(e,function(n){n.fn.apply(n.context||n.fn,n.args||[])})}}],[{key:"extend",value:function(e,t){var n=new i(t);if(e.flush!==void 0)throw new Error("Target object already has a property flush");e.flush=function(){n.flush()};var a=[{name:"flush",original:void 0}];if(t&&t.replace)for(var o=0;o=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function dW(i,r){var e;if(i){if(typeof i=="string")return _m(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _m(i,r)}}function _m(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);es&&(s=c,o=h)}return o}},{key:"min",value:function(t){var n=gc(this._pairs),a=n.next();if(a.done)return null;for(var o=a.value[1],s=t(a.value[1],a.value[0]);!(a=n.next()).done;){var u=$t(a.value,2),l=u[0],h=u[1],c=t(h,l);c=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function fW(i,r){var e;if(i){if(typeof i=="string")return Tm(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Tm(i,r)}}function Tm(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e"u"||!du||du.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(du(Boolean,[],function(){})),!0}catch{return!1}}function gW(i,r){return i[r]==null&&(i[r]=KV()),i}var Lu=function(i){Dz(e,i);var r=vW(e);function e(t,n){var a;return tl(this,e),a=r.call(this),si(F_(a),"_queue",null),t&&!Bt(t)&&(n=t,t=[]),a._options=n||{},a._data=new SE,a.length=0,a._idProp=a._options.fieldId||"id",t&&t.length&&a.add(t),a.setOptions(n),a}return wl(e,[{key:"idProp",get:function(){return this._idProp}},{key:"setOptions",value:function(n){n&&n.queue!==void 0&&(n.queue===!1?this._queue&&(this._queue.destroy(),this._queue=null):(this._queue||(this._queue=GV.extend(this,{replace:["add","update","remove"]})),n.queue&&typeof n.queue=="object"&&this._queue.setOptions(n.queue)))}},{key:"add",value:function(n,a){var o=this,s=[],u;if(Bt(n)){var l=rr(n).call(n,function(d){return d[o._idProp]});if(P7(l).call(l,function(d){return o._data.has(d)}))throw new Error("A duplicate id was found in the parameter array.");for(var h=0,c=n.length;hh?1:ls)&&(o=h,s=c)}}catch(d){u.e(d)}finally{u.f()}return o||null}},{key:"min",value:function(n){var a,o=null,s=null,u=yc(bm(a=this._data).call(a)),l;try{for(u.s();!(l=u.n()).done;){var h=l.value,c=h[n];typeof c=="number"&&(s==null||c\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=window.console&&(window.console.warn||window.console.log);return o&&o.call(window.console,t,a),i.apply(this,arguments)}}var w_=$_(function(i,r,e){for(var t=Object.keys(r),n=0;n=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function l5(i,r){var e;if(i){if(typeof i=="string")return Ey(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ey(i,r)}}function Ey(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?e-1:0),n=1;n2){var t;return Nu.apply(void 0,Ol(t=[S_(r[0],r[1])]).call(t,St(Tl(r).call(r,2))))}var n=r[0],a=r[1];if(n instanceof Date&&a instanceof Date)return n.setTime(a.getTime()),n;var o=__(hj(a)),s;try{for(o.s();!(s=o.n()).done;){var u=s.value;Object.prototype.propertyIsEnumerable.call(a,u)&&(a[u]===E_?delete n[u]:n[u]!==null&&a[u]!==null&&typeof n[u]=="object"&&typeof a[u]=="object"&&!Bt(n[u])&&!Bt(a[u])?n[u]=Nu(n[u],a[u]):n[u]=O_(a[u]))}}catch(l){o.e(l)}finally{o.f()}return n}function O_(i){return Bt(i)?rr(i).call(i,function(r){return O_(r)}):typeof i=="object"&&i!==null?i instanceof Date?new Date(i.getTime()):Nu({},i):i}function T_(i){for(var r=0,e=lv(i);ro;)u=t(e,s=n[o++]),u!==void 0&&Y5(a,s,u);return a}});var X5=we,J5=X5.Object.getOwnPropertyDescriptors,Z5=J5,Q5=Z5,ez=Q5,ky=Y(ez),M_={exports:{}},tz=K,rz=qe,Py=cl.f;tz({target:"Object",stat:!0,forced:Object.defineProperties!==Py,sham:!rz},{defineProperties:Py});var iz=we,B_=iz.Object,nz=M_.exports=function(r,e){return B_.defineProperties(r,e)};B_.defineProperties.sham&&(nz.sham=!0);var az=M_.exports,oz=az,sz=oz,uz=sz,lz=Y(uz),hz=p0,cz=Y(hz);function F_(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}var dz=Kw,fz=dz,vz=fz,pz=vz,j_=pz,gz=Y(j_),yz=K,mz=aw;yz({target:"Object",stat:!0},{setPrototypeOf:mz});var bz=we,$z=bz.Object.setPrototypeOf,wz=$z,_z=wz,Ez=_z,Sz=Ez,Oz=Sz,Tz=Oz,L_=Tz,Vd=Y(L_),Iz=ww,kz=Iz,Pz=kz,xz=Pz,Cz=xz,z_=Y(Cz);function Wd(i,r){var e;return Wd=Vd?z_(e=Vd).call(e):function(n,a){return n.__proto__=a,n},Wd(i,r)}function Az(i,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=gz(r.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),ol(i,"prototype",{writable:!1}),Wd(i,r)}function Dz(i,r){if(r&&(Jn(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F_(i)}var Rz=L3,Nz=Rz,Mz=Nz,Bz=Mz,H_=Bz,xy=Y(H_);function Mu(i){var r;return Mu=Vd?z_(r=xy).call(r):function(t){return t.__proto__||xy(t)},Mu(i)}var V_={exports:{}},W_={exports:{}};(function(i){var r=iv,e=gw;function t(n){"@babel/helpers - typeof";return i.exports=t=typeof r=="function"&&typeof e=="symbol"?function(a){return typeof a}:function(a){return a&&typeof r=="function"&&a.constructor===r&&a!==r.prototype?"symbol":typeof a},i.exports.__esModule=!0,i.exports.default=i.exports,t(n)}i.exports=t,i.exports.__esModule=!0,i.exports.default=i.exports})(W_);var Fz=W_.exports,jz=zw,Lz=jz,zz=Lz,Hz=zz,Vz=Hz,Cy=Ve,Wz=uv,Uz=Qi,Kz=Ct,Gz=function(i,r,e){for(var t=Wz(r),n=Kz.f,a=Uz.f,o=0;oc;c++)if(f=y(i[c]),f&&Dy(Ny,f))return f;return new fu(!1)}l=p4(i,h)}for(v=a?i.next:l.next;!(p=h4(v,l)).done;){try{f=y(p.value)}catch(m){Ry(l,"throw",m)}if(typeof f=="object"&&f&&Dy(Ny,f))return f}return new fu(!1)},m4=tn,b4=function(i,r){return i===void 0?arguments.length<2?"":r:m4(i)},$4=K,w4=He,_4=$l,Bu=aw,E4=Gz,G_=rn,qh=Lr,Yh=en,S4=Xz,O4=u4,T4=on,I4=b4,k4=Ee,P4=k4("toStringTag"),Fu=Error,x4=[].push,ta=function(r,e){var t=w4(Xh,this),n;Bu?n=Bu(new Fu,t?_4(this):Xh):(n=t?this:G_(Xh),qh(n,P4,"Error")),e!==void 0&&qh(n,"message",I4(e)),O4(n,ta,n.stack,1),arguments.length>2&&S4(n,arguments[2]);var a=[];return T4(r,x4,{that:a}),qh(n,"errors",a),n};Bu?Bu(ta,Fu):E4(ta,Fu,{name:!0});var Xh=ta.prototype=G_(Fu.prototype,{constructor:Yh(1,ta),message:Yh(1,""),name:Yh(1,"AggregateError")});$4({global:!0,constructor:!0,arity:2},{AggregateError:ta});var C4=mt,A4=qf,D4=Ee,R4=qe,My=D4("species"),q_=function(i){var r=C4(i);R4&&r&&!r[My]&&A4(r,My,{configurable:!0,get:function(){return this}})},N4=He,M4=TypeError,mv=function(i,r){if(N4(r,i))return i;throw new M4("Incorrect invocation")},By=jt,B4=I_,F4=ca,j4=Ee,L4=j4("species"),Y_=function(i,r){var e=By(i).constructor,t;return e===void 0||F4(t=By(e)[L4])?r:B4(t)},z4=mi,X_=/(?:ipad|iphone|ipod).*applewebkit/i.test(z4),Ft=$e,H4=ha,V4=bi,Fy=Ie,W4=Ve,J_=le,jy=O0,U4=No,Ly=Vf,K4=Gw,G4=X_,q4=Bo,Ud=Ft.setImmediate,Kd=Ft.clearImmediate,Y4=Ft.process,Jh=Ft.Dispatch,X4=Ft.Function,zy=Ft.MessageChannel,J4=Ft.String,Zh=0,Za={},Hy="onreadystatechange",go,ki,Qh,ec;J_(function(){go=Ft.location});var bv=function(i){if(W4(Za,i)){var r=Za[i];delete Za[i],r()}},tc=function(i){return function(){bv(i)}},Vy=function(i){bv(i.data)},Wy=function(i){Ft.postMessage(J4(i),go.protocol+"//"+go.host)};(!Ud||!Kd)&&(Ud=function(r){K4(arguments.length,1);var e=Fy(r)?r:X4(r),t=U4(arguments,1);return Za[++Zh]=function(){H4(e,void 0,t)},ki(Zh),Zh},Kd=function(r){delete Za[r]},q4?ki=function(i){Y4.nextTick(tc(i))}:Jh&&Jh.now?ki=function(i){Jh.now(tc(i))}:zy&&!G4?(Qh=new zy,ec=Qh.port2,Qh.port1.onmessage=Vy,ki=V4(ec.postMessage,ec)):Ft.addEventListener&&Fy(Ft.postMessage)&&!Ft.importScripts&&go&&go.protocol!=="file:"&&!J_(Wy)?(ki=Wy,Ft.addEventListener("message",Vy,!1)):Hy in Ly("script")?ki=function(i){jy.appendChild(Ly("script"))[Hy]=function(){jy.removeChild(this),bv(i)}}:ki=function(i){setTimeout(tc(i),0)});var Z_={set:Ud,clear:Kd},Q_=function(){this.head=null,this.tail=null};Q_.prototype={add:function(i){var r={item:i,next:null},e=this.tail;e?e.next=r:this.head=r,this.tail=r},get:function(){var i=this.head;if(i){var r=this.head=i.next;return r===null&&(this.tail=null),i.item}}};var eE=Q_,Z4=mi,Q4=/ipad|iphone|ipod/i.test(Z4)&&typeof Pebble<"u",e6=mi,t6=/web0s(?!.*chrome)/i.test(e6),qi=$e,Uy=bi,r6=Qi.f,rc=Z_.set,i6=eE,n6=X_,a6=Q4,o6=t6,ic=Bo,Ky=qi.MutationObserver||qi.WebKitMutationObserver,Gy=qi.document,qy=qi.process,Ns=qi.Promise,Yy=r6(qi,"queueMicrotask"),Gd=Yy&&Yy.value,_n,nc,ac,Ms,Xy;if(!Gd){var Bs=new i6,Fs=function(){var i,r;for(ic&&(i=qy.domain)&&i.exit();r=Bs.get();)try{r()}catch(e){throw Bs.head&&_n(),e}i&&i.enter()};!n6&&!ic&&!o6&&Ky&&Gy?(nc=!0,ac=Gy.createTextNode(""),new Ky(Fs).observe(ac,{characterData:!0}),_n=function(){ac.data=nc=!nc}):!a6&&Ns&&Ns.resolve?(Ms=Ns.resolve(void 0),Ms.constructor=Ns,Xy=Uy(Ms.then,Ms),_n=function(){Xy(Fs)}):ic?_n=function(){qy.nextTick(Fs)}:(rc=Uy(rc,qi),_n=function(){rc(Fs)}),Gd=function(i){Bs.head||_n(),Bs.add(i)}}var s6=Gd,u6=function(i,r){try{arguments.length===1?console.error(i):console.error(i,r)}catch{}},_a=function(i){try{return{error:!1,value:i()}}catch(r){return{error:!0,value:r}}},l6=$e,Ea=l6.Promise,tE=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",h6=tE,c6=Bo,d6=!h6&&!c6&&typeof window=="object"&&typeof document=="object",f6=$e,Qa=Ea,v6=Ie,p6=d0,g6=m0,y6=Ee,m6=d6,b6=tE,oc=da,Jy=Qa&&Qa.prototype,$6=y6("species"),qd=!1,rE=v6(f6.PromiseRejectionEvent),w6=p6("Promise",function(){var i=g6(Qa),r=i!==String(Qa);if(!r&&oc===66||!(Jy.catch&&Jy.finally))return!0;if(!oc||oc<51||!/native code/.test(i)){var e=new Qa(function(a){a(1)}),t=function(a){a(function(){},function(){})},n=e.constructor={};if(n[$6]=t,qd=e.then(function(){})instanceof t,!qd)return!0}return!r&&(m6||b6)&&!rE}),Vo={CONSTRUCTOR:w6,REJECTION_EVENT:rE,SUBCLASSING:qd},wr={},Zy=Pt,_6=TypeError,E6=function(i){var r,e;this.promise=new i(function(t,n){if(r!==void 0||e!==void 0)throw new _6("Bad Promise constructor");r=t,e=n}),this.resolve=Zy(r),this.reject=Zy(e)};wr.f=function(i){return new E6(i)};var S6=K,ju=Bo,fi=$e,Wo=Ye,O6=ya,T6=nn,I6=q_,k6=Pt,Yd=Ie,P6=nt,x6=mv,C6=Y_,iE=Z_.set,$v=s6,A6=u6,D6=_a,R6=eE,nE=ma,Xd=Ea,aE=Vo,oE=wr,Pl="Promise",sE=aE.CONSTRUCTOR,N6=aE.REJECTION_EVENT,sc=nE.getterFor(Pl),M6=nE.set,B6=Xd&&Xd.prototype,Bn=Xd,uc=B6,uE=fi.TypeError,Jd=fi.document,wv=fi.process,Zd=oE.f,F6=Zd,j6=!!(Jd&&Jd.createEvent&&fi.dispatchEvent),lE="unhandledrejection",L6="rejectionhandled",Qy=0,hE=1,z6=2,_v=1,cE=2,js,em,H6,dE=function(i){var r;return P6(i)&&Yd(r=i.then)?r:!1},fE=function(i,r){var e=r.value,t=r.state===hE,n=t?i.ok:i.fail,a=i.resolve,o=i.reject,s=i.domain,u,l,h;try{n?(t||(r.rejection===cE&&W6(r),r.rejection=_v),n===!0?u=e:(s&&s.enter(),u=n(e),s&&(s.exit(),h=!0)),u===i.promise?o(new uE("Promise-chain cycle")):(l=dE(u))?Wo(l,u,a,o):a(u)):o(e)}catch(c){s&&!h&&s.exit(),o(c)}},vE=function(i,r){i.notified||(i.notified=!0,$v(function(){for(var e=i.reactions,t;t=e.get();)fE(t,i);i.notified=!1,r&&!i.rejection&&V6(i)}))},pE=function(i,r,e){var t,n;j6?(t=Jd.createEvent("Event"),t.promise=r,t.reason=e,t.initEvent(i,!1,!0),fi.dispatchEvent(t)):t={promise:r,reason:e},!N6&&(n=fi["on"+i])?n(t):i===lE&&A6("Unhandled promise rejection",e)},V6=function(i){Wo(iE,fi,function(){var r=i.facade,e=i.value,t=tm(i),n;if(t&&(n=D6(function(){ju?wv.emit("unhandledRejection",e,r):pE(lE,r,e)}),i.rejection=ju||tm(i)?cE:_v,n.error))throw n.value})},tm=function(i){return i.rejection!==_v&&!i.parent},W6=function(i){Wo(iE,fi,function(){var r=i.facade;ju?wv.emit("rejectionHandled",r):pE(L6,r,i.value)})},Fn=function(i,r,e){return function(t){i(r,t,e)}},Un=function(i,r,e){i.done||(i.done=!0,e&&(i=e),i.value=r,i.state=z6,vE(i,!0))},Qd=function(i,r,e){if(!i.done){i.done=!0,e&&(i=e);try{if(i.facade===r)throw new uE("Promise can't be resolved itself");var t=dE(r);t?$v(function(){var n={done:!1};try{Wo(t,r,Fn(Qd,n,i),Fn(Un,n,i))}catch(a){Un(n,a,i)}}):(i.value=r,i.state=hE,vE(i,!1))}catch(n){Un({done:!1},n,i)}}};sE&&(Bn=function(r){x6(this,uc),k6(r),Wo(js,this);var e=sc(this);try{r(Fn(Qd,e),Fn(Un,e))}catch(t){Un(e,t)}},uc=Bn.prototype,js=function(r){M6(this,{type:Pl,done:!1,notified:!1,parent:!1,reactions:new R6,rejection:!1,state:Qy,value:void 0})},js.prototype=O6(uc,"then",function(r,e){var t=sc(this),n=Zd(C6(this,Bn));return t.parent=!0,n.ok=Yd(r)?r:!0,n.fail=Yd(e)&&e,n.domain=ju?wv.domain:void 0,t.state===Qy?t.reactions.add(n):$v(function(){fE(n,t)}),n.promise}),em=function(){var i=new js,r=sc(i);this.promise=i,this.resolve=Fn(Qd,r),this.reject=Fn(Un,r)},oE.f=Zd=function(i){return i===Bn||i===H6?new em(i):F6(i)});S6({global:!0,constructor:!0,wrap:!0,forced:sE},{Promise:Bn});T6(Bn,Pl,!1,!0);I6(Pl);var U6=Ea,K6=kw,G6=Vo.CONSTRUCTOR,xl=G6||!K6(function(i){U6.all(i).then(void 0,function(){})}),q6=K,Y6=Ye,X6=Pt,J6=wr,Z6=_a,Q6=on,eH=xl;q6({target:"Promise",stat:!0,forced:eH},{all:function(r){var e=this,t=J6.f(e),n=t.resolve,a=t.reject,o=Z6(function(){var s=X6(e.resolve),u=[],l=0,h=1;Q6(r,function(c){var d=l++,f=!1;h++,Y6(s,e,c).then(function(v){f||(f=!0,u[d]=v,--h||n(u))},a)}),--h||n(u)});return o.error&&a(o.value),t.promise}});var tH=K,rH=Vo.CONSTRUCTOR,rm=Ea;rm&&rm.prototype;tH({target:"Promise",proto:!0,forced:rH,real:!0},{catch:function(i){return this.then(void 0,i)}});var iH=K,nH=Ye,aH=Pt,oH=wr,sH=_a,uH=on,lH=xl;iH({target:"Promise",stat:!0,forced:lH},{race:function(r){var e=this,t=oH.f(e),n=t.reject,a=sH(function(){var o=aH(e.resolve);uH(r,function(s){nH(o,e,s).then(t.resolve,n)})});return a.error&&n(a.value),t.promise}});var hH=K,cH=Ye,dH=wr,fH=Vo.CONSTRUCTOR;hH({target:"Promise",stat:!0,forced:fH},{reject:function(r){var e=dH.f(this);return cH(e.reject,void 0,r),e.promise}});var vH=jt,pH=nt,gH=wr,gE=function(i,r){if(vH(i),pH(r)&&r.constructor===i)return r;var e=gH.f(i),t=e.resolve;return t(r),e.promise},yH=K,mH=mt,bH=kk,$H=Ea,wH=Vo.CONSTRUCTOR,_H=gE,EH=mH("Promise"),SH=!wH;yH({target:"Promise",stat:!0,forced:bH},{resolve:function(r){return _H(SH&&this===EH?$H:this,r)}});var OH=K,TH=Ye,IH=Pt,kH=wr,PH=_a,xH=on,CH=xl;OH({target:"Promise",stat:!0,forced:CH},{allSettled:function(r){var e=this,t=kH.f(e),n=t.resolve,a=t.reject,o=PH(function(){var s=IH(e.resolve),u=[],l=0,h=1;xH(r,function(c){var d=l++,f=!1;h++,TH(s,e,c).then(function(v){f||(f=!0,u[d]={status:"fulfilled",value:v},--h||n(u))},function(v){f||(f=!0,u[d]={status:"rejected",reason:v},--h||n(u))})}),--h||n(u)});return o.error&&a(o.value),t.promise}});var AH=K,DH=Ye,RH=Pt,NH=mt,MH=wr,BH=_a,FH=on,jH=xl,im="No one promise resolved";AH({target:"Promise",stat:!0,forced:jH},{any:function(r){var e=this,t=NH("AggregateError"),n=MH.f(e),a=n.resolve,o=n.reject,s=BH(function(){var u=RH(e.resolve),l=[],h=0,c=1,d=!1;FH(r,function(f){var v=h++,p=!1;c++,DH(u,e,f).then(function(g){p||d||(d=!0,a(g))},function(g){p||d||(p=!0,l[v]=g,--c||o(new t(l,im)))})}),--c||o(new t(l,im))});return s.error&&o(s.value),n.promise}});var LH=K,ef=Ea,zH=le,HH=mt,VH=Ie,WH=Y_,nm=gE,UH=ef&&ef.prototype,KH=!!ef&&zH(function(){UH.finally.call({then:function(){}},function(){})});LH({target:"Promise",proto:!0,real:!0,forced:KH},{finally:function(i){var r=WH(this,HH("Promise")),e=VH(i);return this.then(e?function(t){return nm(r,i()).then(function(){return t})}:i,e?function(t){return nm(r,i()).then(function(){throw t})}:i)}});var GH=we,qH=GH.Promise,YH=qH,XH=YH,JH=K,ZH=wr;JH({target:"Promise",stat:!0},{withResolvers:function(){var r=ZH.f(this);return{promise:r.promise,resolve:r.resolve,reject:r.reject}}});var QH=XH,e8=QH,t8=K,r8=wr,i8=_a;t8({target:"Promise",stat:!0,forced:!0},{try:function(i){var r=r8.f(this),e=i8(i);return(e.error?r.reject:r.resolve)(e.value),r.promise}});var n8=e8,a8=n8,o8=a8,s8=Hw,u8=s8,l8=u8,h8=l8,c8=h8;(function(i){var r=Fz.default,e=g0,t=iv,n=j_,a=H_,o=Vz,s=Nw,u=L_,l=o8,h=c8,c=Bw;function d(){i.exports=d=function(){return v},i.exports.__esModule=!0,i.exports.default=i.exports;var f,v={},p=Object.prototype,g=p.hasOwnProperty,y=e||function(F,x,C){F[x]=C.value},m=typeof t=="function"?t:{},$=m.iterator||"@@iterator",b=m.asyncIterator||"@@asyncIterator",O=m.toStringTag||"@@toStringTag";function _(F,x,C){return e(F,x,{value:C,enumerable:!0,configurable:!0,writable:!0}),F[x]}try{_({},"")}catch{_=function(C,W,Z){return C[W]=Z}}function D(F,x,C,W){var Z=x&&x.prototype instanceof ie?x:ie,X=n(Z.prototype),Re=new Rt(W||[]);return y(X,"_invoke",{value:Fe(F,C,Re)}),X}function R(F,x,C){try{return{type:"normal",arg:F.call(x,C)}}catch(W){return{type:"throw",arg:W}}}v.wrap=D;var P="suspendedStart",B="suspendedYield",j="executing",J="completed",U={};function ie(){}function _e(){}function ye(){}var Ae={};_(Ae,$,function(){return this});var ht=a,at=ht&&ht(ht(ut([])));at&&at!==p&&g.call(at,$)&&(Ae=at);var Dt=ye.prototype=ie.prototype=n(Ae);function ot(F){var x;o(x=["next","throw","return"]).call(x,function(C){_(F,C,function(W){return this._invoke(C,W)})})}function me(F,x){function C(Z,X,Re,ct){var bt=R(F[Z],F,X);if(bt.type!=="throw"){var Oi=bt.arg,Vr=Oi.value;return Vr&&r(Vr)=="object"&&g.call(Vr,"__await")?x.resolve(Vr.__await).then(function(Ti){C("next",Ti,Re,ct)},function(Ti){C("throw",Ti,Re,ct)}):x.resolve(Vr).then(function(Ti){Oi.value=Ti,Re(Oi)},function(Ti){return C("throw",Ti,Re,ct)})}ct(bt.arg)}var W;y(this,"_invoke",{value:function(X,Re){function ct(){return new x(function(bt,Oi){C(X,Re,bt,Oi)})}return W=W?W.then(ct,ct):ct()}})}function Fe(F,x,C){var W=P;return function(Z,X){if(W===j)throw new Error("Generator is already running");if(W===J){if(Z==="throw")throw X;return{value:f,done:!0}}for(C.method=Z,C.arg=X;;){var Re=C.delegate;if(Re){var ct=De(Re,C);if(ct){if(ct===U)continue;return ct}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(W===P)throw W=J,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);W=j;var bt=R(F,x,C);if(bt.type==="normal"){if(W=C.done?J:B,bt.arg===U)continue;return{value:bt.arg,done:C.done}}bt.type==="throw"&&(W=J,C.method="throw",C.arg=bt.arg)}}}function De(F,x){var C=x.method,W=F.iterator[C];if(W===f)return x.delegate=null,C==="throw"&&F.iterator.return&&(x.method="return",x.arg=f,De(F,x),x.method==="throw")||C!=="return"&&(x.method="throw",x.arg=new TypeError("The iterator does not provide a '"+C+"' method")),U;var Z=R(W,F.iterator,x.arg);if(Z.type==="throw")return x.method="throw",x.arg=Z.arg,x.delegate=null,U;var X=Z.arg;return X?X.done?(x[F.resultName]=X.value,x.next=F.nextLoc,x.method!=="return"&&(x.method="next",x.arg=f),x.delegate=null,U):X:(x.method="throw",x.arg=new TypeError("iterator result is not an object"),x.delegate=null,U)}function st(F){var x,C={tryLoc:F[0]};1 in F&&(C.catchLoc=F[1]),2 in F&&(C.finallyLoc=F[2],C.afterLoc=F[3]),s(x=this.tryEntries).call(x,C)}function Sr(F){var x=F.completion||{};x.type="normal",delete x.arg,F.completion=x}function Rt(F){this.tryEntries=[{tryLoc:"root"}],o(F).call(F,st,this),this.reset(!0)}function ut(F){if(F||F===""){var x=F[$];if(x)return x.call(F);if(typeof F.next=="function")return F;if(!isNaN(F.length)){var C=-1,W=function Z(){for(;++C=0;--Z){var X=this.tryEntries[Z],Re=X.completion;if(X.tryLoc==="root")return W("end");if(X.tryLoc<=this.prev){var ct=g.call(X,"catchLoc"),bt=g.call(X,"finallyLoc");if(ct&&bt){if(this.prev=0;--W){var Z=this.tryEntries[W];if(Z.tryLoc<=this.prev&&g.call(Z,"finallyLoc")&&this.prev=0;--C){var W=this.tryEntries[C];if(W.finallyLoc===x)return this.complete(W.completion,W.afterLoc),Sr(W),U}},catch:function(x){for(var C=this.tryEntries.length-1;C>=0;--C){var W=this.tryEntries[C];if(W.tryLoc===x){var Z=W.completion;if(Z.type==="throw"){var X=Z.arg;Sr(W)}return X}}throw new Error("illegal catch attempt")},delegateYield:function(x,C,W){return this.delegate={iterator:ut(x),resultName:C,nextLoc:W},this.method==="next"&&(this.arg=f),U}},v}i.exports=d,i.exports.__esModule=!0,i.exports.default=i.exports})(V_);var d8=V_.exports,vu=d8(),f8=vu;try{regeneratorRuntime=vu}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=vu:Function("r","regeneratorRuntime = r")(vu)}var wt=Y(f8),yE={exports:{}},v8=le,p8=v8(function(){if(typeof ArrayBuffer=="function"){var i=new ArrayBuffer(8);Object.isExtensible(i)&&Object.defineProperty(i,"a",{value:8})}}),g8=le,y8=nt,m8=yi,am=p8,pu=Object.isExtensible,b8=g8(function(){pu(1)}),$8=b8||am?function(r){return!y8(r)||am&&m8(r)==="ArrayBuffer"?!1:pu?pu(r):!0}:pu,w8=le,_8=!w8(function(){return Object.isExtensible(Object.preventExtensions({}))}),E8=K,S8=be,O8=Po,T8=nt,Ev=Ve,I8=Ct.f,om=xo,k8=Gf,Sv=$8,P8=nl,x8=_8,mE=!1,Br=P8("meta"),C8=0,Ov=function(i){I8(i,Br,{value:{objectID:"O"+C8++,weakData:{}}})},A8=function(i,r){if(!T8(i))return typeof i=="symbol"?i:(typeof i=="string"?"S":"P")+i;if(!Ev(i,Br)){if(!Sv(i))return"F";if(!r)return"E";Ov(i)}return i[Br].objectID},D8=function(i,r){if(!Ev(i,Br)){if(!Sv(i))return!0;if(!r)return!1;Ov(i)}return i[Br].weakData},R8=function(i){return x8&&mE&&Sv(i)&&!Ev(i,Br)&&Ov(i),i},N8=function(){M8.enable=function(){},mE=!0;var i=om.f,r=S8([].splice),e={};e[Br]=1,i(e).length&&(om.f=function(t){for(var n=i(t),a=0,o=n.length;a1?arguments[1]:void 0),f;f=f?f.next:c.first;)for(d(f.value,f.key,this);f&&f.removed;)f=f.previous},has:function(h){return!!u(this,h)}}),sm(a,e?{get:function(h){var c=u(this,h);return c&&c.value},set:function(h,c){return s(this,h===0?0:h,c)}}:{add:function(h){return s(this,h=h===0?0:h,h)}}),ja&&r7(a,"size",{configurable:!0,get:function(){return o(this).size}}),n},setStrong:function(i,r,e){var t=r+" Iterator",n=lc(r),a=lc(t);s7(i,r,function(o,s){lm(this,{type:t,target:o,state:n(o),kind:s,last:void 0})},function(){for(var o=a(this),s=o.kind,u=o.last;u&&u.removed;)u=u.previous;return!o.target||!(o.last=u=u?u.next:o.state.first)?(o.target=void 0,Ls(void 0,!0)):Ls(s==="keys"?u.key:s==="values"?u.value:[u.key,u.value],!1)},e?"entries":"values",!e,!0),u7(r)}},l7=wE,h7=EE;l7("Map",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},h7);var c7=we,d7=c7.Map,f7=d7,v7=f7,p7=v7,SE=Y(p7),g7=K,y7=ba.some,m7=_l,b7=m7("some");g7({target:"Array",proto:!0,forced:!b7},{some:function(r){return y7(this,r,arguments.length>1?arguments[1]:void 0)}});var $7=lt,w7=$7("Array","some"),_7=He,E7=w7,hc=Array.prototype,S7=function(i){var r=i.some;return i===hc||_7(hc,i)&&r===hc.some?E7:r},O7=S7,T7=O7,I7=T7,k7=Y(I7),P7=lt,x7=P7("Array","keys"),C7=x7,A7=C7,D7=zr,R7=Ve,N7=He,M7=A7,cc=Array.prototype,B7={DOMTokenList:!0,NodeList:!0},F7=function(i){var r=i.keys;return i===cc||N7(cc,i)&&r===cc.keys||R7(B7,D7(i))?M7:r},j7=F7,En=Y(j7),hm=k0,L7=Math.floor,tf=function(i,r){var e=i.length,t=L7(e/2);return e<8?z7(i,r):H7(i,tf(hm(i,0,t),r),tf(hm(i,t),r),r)},z7=function(i,r){for(var e=i.length,t=1,n,a;t0;)i[a]=i[--a];a!==t++&&(i[a]=n)}return i},H7=function(i,r,e,t){for(var n=r.length,a=e.length,o=0,s=0;o3)){if(rV)return!0;if(ym)return ym<603;var i="",r,e,t,n;for(r=65;r<76;r++){switch(e=String.fromCharCode(r),r){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(n=0;n<47;n++)ti.push({k:e+n,v:t})}for(ti.sort(function(a,o){return o.v-a.v}),n=0;nvm(e)?1:-1}};X7({target:"Array",proto:!0,forced:sV},{sort:function(r){r!==void 0&&J7(r);var e=Z7(this);if(TE)return r===void 0?mm(e):mm(e,r);var t=[],n=fm(e),a,o;for(o=0;othis.max&&this.flush(),this._timeout!=null&&(clearTimeout(this._timeout),this._timeout=null),this.queue.length>0&&typeof this.delay=="number"&&(this._timeout=bL(function(){e.flush()},this.delay))}},{key:"flush",value:function(){var e,t;Wi(e=Ww(t=this._queue).call(t,0)).call(e,function(n){n.fn.apply(n.context||n.fn,n.args||[])})}}],[{key:"extend",value:function(e,t){var n=new i(t);if(e.flush!==void 0)throw new Error("Target object already has a property flush");e.flush=function(){n.flush()};var a=[{name:"flush",original:void 0}];if(t&&t.replace)for(var o=0;o=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function cW(i,r){var e;if(i){if(typeof i=="string")return _m(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _m(i,r)}}function _m(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);es&&(s=c,o=h)}return o}},{key:"min",value:function(t){var n=gc(this._pairs),a=n.next();if(a.done)return null;for(var o=a.value[1],s=t(a.value[1],a.value[0]);!(a=n.next()).done;){var u=$t(a.value,2),l=u[0],h=u[1],c=t(h,l);c=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function dW(i,r){var e;if(i){if(typeof i=="string")return Tm(i,r);var t=Tl(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return ov(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Tm(i,r)}}function Tm(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e"u"||!du||du.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(du(Boolean,[],function(){})),!0}catch{return!1}}function pW(i,r){return i[r]==null&&(i[r]=UV()),i}var Lu=function(i){Az(e,i);var r=fW(e);function e(t,n){var a;return tl(this,e),a=r.call(this),si(F_(a),"_queue",null),t&&!Bt(t)&&(n=t,t=[]),a._options=n||{},a._data=new SE,a.length=0,a._idProp=a._options.fieldId||"id",t&&t.length&&a.add(t),a.setOptions(n),a}return wl(e,[{key:"idProp",get:function(){return this._idProp}},{key:"setOptions",value:function(n){n&&n.queue!==void 0&&(n.queue===!1?this._queue&&(this._queue.destroy(),this._queue=null):(this._queue||(this._queue=KV.extend(this,{replace:["add","update","remove"]})),n.queue&&typeof n.queue=="object"&&this._queue.setOptions(n.queue)))}},{key:"add",value:function(n,a){var o=this,s=[],u;if(Bt(n)){var l=rr(n).call(n,function(d){return d[o._idProp]});if(k7(l).call(l,function(d){return o._data.has(d)}))throw new Error("A duplicate id was found in the parameter array.");for(var h=0,c=n.length;hh?1:ls)&&(o=h,s=c)}}catch(d){u.e(d)}finally{u.f()}return o||null}},{key:"min",value:function(n){var a,o=null,s=null,u=yc(bm(a=this._data).call(a)),l;try{for(u.s();!(l=u.n()).done;){var h=l.value,c=h[n];typeof c=="number"&&(s==null||c"u"&&af!==void 0,AE={all:af,IS_HTMLDDA:OW},DE=AE,TW=DE.all,Xe=DE.IS_HTMLDDA?function(i){return typeof i=="function"||i===TW}:function(i){return typeof i=="function"},Sa={},IW=ae,Je=!IW(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),kW=Uo,Vs=Function.prototype.call,zt=kW?Vs.bind(Vs):function(){return Vs.apply(Vs,arguments)},Cl={},RE={}.propertyIsEnumerable,NE=Object.getOwnPropertyDescriptor,PW=NE&&!RE.call({1:2},1);Cl.f=PW?function(r){var e=NE(this,r);return!!e&&e.enumerable}:RE;var Go=function(i,r){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:r}},xW=se,CW=ae,AW=Hr,bc=Object,DW=xW("".split),Al=CW(function(){return!bc("z").propertyIsEnumerable(0)})?function(i){return AW(i)==="String"?DW(i,""):bc(i)}:bc,Oa=function(i){return i==null},RW=Oa,NW=TypeError,qo=function(i){if(RW(i))throw new NW("Can't call method on "+i);return i},MW=Al,BW=qo,_r=function(i){return MW(BW(i))},Pm=Xe,ME=AE,FW=ME.all,Ze=ME.IS_HTMLDDA?function(i){return typeof i=="object"?i!==null:Pm(i)||i===FW}:function(i){return typeof i=="object"?i!==null:Pm(i)},oe={},$c=oe,wc=Pe,jW=Xe,xm=function(i){return jW(i)?i:void 0},Jt=function(i,r){return arguments.length<2?xm($c[i])||xm(wc[i]):$c[i]&&$c[i][r]||wc[i]&&wc[i][r]},LW=se,Be=LW({}.isPrototypeOf),Yo=typeof navigator<"u"&&String(navigator.userAgent)||"",BE=Pe,_c=Yo,Cm=BE.process,Am=BE.Deno,Dm=Cm&&Cm.versions||Am&&Am.version,Rm=Dm&&Dm.v8,ir,zu;Rm&&(ir=Rm.split("."),zu=ir[0]>0&&ir[0]<4?1:+(ir[0]+ir[1]));!zu&&_c&&(ir=_c.match(/Edge\/(\d+)/),(!ir||ir[1]>=74)&&(ir=_c.match(/Chrome\/(\d+)/),ir&&(zu=+ir[1])));var Xo=zu,Nm=Xo,zW=ae,HW=Pe,VW=HW.String,Ta=!!Object.getOwnPropertySymbols&&!zW(function(){var i=Symbol("symbol detection");return!VW(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&Nm&&Nm<41}),WW=Ta,FE=WW&&!Symbol.sham&&typeof Symbol.iterator=="symbol",UW=Jt,KW=Xe,GW=Be,qW=FE,YW=Object,Jo=qW?function(i){return typeof i=="symbol"}:function(i){var r=UW("Symbol");return KW(r)&&GW(r.prototype,YW(i))},XW=String,Ia=function(i){try{return XW(i)}catch{return"Object"}},JW=Xe,ZW=Ia,QW=TypeError,sn=function(i){if(JW(i))return i;throw new QW(ZW(i)+" is not a function")},e9=sn,t9=Oa,kv=function(i,r){var e=i[r];return t9(e)?void 0:e9(e)},Ec=zt,Sc=Xe,Oc=Ze,r9=TypeError,i9=function(i,r){var e,t;if(r==="string"&&Sc(e=i.toString)&&!Oc(t=Ec(e,i))||Sc(e=i.valueOf)&&!Oc(t=Ec(e,i))||r!=="string"&&Sc(e=i.toString)&&!Oc(t=Ec(e,i)))return t;throw new r9("Can't convert object to primitive value")},jE={exports:{}},Mm=Pe,n9=Object.defineProperty,a9=function(i,r){try{n9(Mm,i,{value:r,configurable:!0,writable:!0})}catch{Mm[i]=r}return r},o9=Pe,s9=a9,Bm="__core-js_shared__",u9=o9[Bm]||s9(Bm,{}),Pv=u9,Fm=Pv;(jE.exports=function(i,r){return Fm[i]||(Fm[i]=r!==void 0?r:{})})("versions",[]).push({version:"3.33.0",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ka=jE.exports,l9=qo,h9=Object,At=function(i){return h9(l9(i))},c9=se,d9=At,f9=c9({}.hasOwnProperty),Qe=Object.hasOwn||function(r,e){return f9(d9(r),e)},v9=se,p9=0,g9=Math.random(),y9=v9(1 .toString),Dl=function(i){return"Symbol("+(i===void 0?"":i)+")_"+y9(++p9+g9,36)},m9=Pe,b9=ka,jm=Qe,$9=Dl,w9=Ta,_9=FE,Ln=m9.Symbol,Tc=b9("wks"),E9=_9?Ln.for||Ln:Ln&&Ln.withoutSetter||$9,xe=function(i){return jm(Tc,i)||(Tc[i]=w9&&jm(Ln,i)?Ln[i]:E9("Symbol."+i)),Tc[i]},S9=zt,Lm=Ze,zm=Jo,O9=kv,T9=i9,I9=xe,k9=TypeError,P9=I9("toPrimitive"),x9=function(i,r){if(!Lm(i)||zm(i))return i;var e=O9(i,P9),t;if(e){if(r===void 0&&(r="default"),t=S9(e,i,r),!Lm(t)||zm(t))return t;throw new k9("Can't convert object to primitive value")}return r===void 0&&(r="number"),T9(i,r)},C9=x9,A9=Jo,Rl=function(i){var r=C9(i,"string");return A9(r)?r:r+""},D9=Pe,Hm=Ze,of=D9.document,R9=Hm(of)&&Hm(of.createElement),LE=function(i){return R9?of.createElement(i):{}},N9=Je,M9=ae,B9=LE,zE=!N9&&!M9(function(){return Object.defineProperty(B9("div"),"a",{get:function(){return 7}}).a!==7}),F9=Je,j9=zt,L9=Cl,z9=Go,H9=_r,V9=Rl,W9=Qe,U9=zE,Vm=Object.getOwnPropertyDescriptor;Sa.f=F9?Vm:function(r,e){if(r=H9(r),e=V9(e),U9)try{return Vm(r,e)}catch{}if(W9(r,e))return z9(!j9(L9.f,r,e),r[e])};var K9=ae,G9=Xe,q9=/#|\.prototype\./,Zo=function(i,r){var e=X9[Y9(i)];return e===Z9?!0:e===J9?!1:G9(r)?K9(r):!!r},Y9=Zo.normalize=function(i){return String(i).replace(q9,".").toLowerCase()},X9=Zo.data={},J9=Zo.NATIVE="N",Z9=Zo.POLYFILL="P",Q9=Zo,Wm=Iv,eU=sn,tU=Uo,rU=Wm(Wm.bind),Qo=function(i,r){return eU(i),r===void 0?i:tU?rU(i,r):function(){return i.apply(r,arguments)}},Ht={},iU=Je,nU=ae,HE=iU&&nU(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),aU=Ze,oU=String,sU=TypeError,Vt=function(i){if(aU(i))return i;throw new sU(oU(i)+" is not an object")},uU=Je,lU=zE,hU=HE,Ws=Vt,Um=Rl,cU=TypeError,Ic=Object.defineProperty,dU=Object.getOwnPropertyDescriptor,kc="enumerable",Pc="configurable",xc="writable";Ht.f=uU?hU?function(r,e,t){if(Ws(r),e=Um(e),Ws(t),typeof r=="function"&&e==="prototype"&&"value"in t&&xc in t&&!t[xc]){var n=dU(r,e);n&&n[xc]&&(r[e]=t.value,t={configurable:Pc in t?t[Pc]:n[Pc],enumerable:kc in t?t[kc]:n[kc],writable:!1})}return Ic(r,e,t)}:Ic:function(r,e,t){if(Ws(r),e=Um(e),Ws(t),lU)try{return Ic(r,e,t)}catch{}if("get"in t||"set"in t)throw new cU("Accessors not supported");return"value"in t&&(r[e]=t.value),r};var fU=Je,vU=Ht,pU=Go,Pa=fU?function(i,r,e){return vU.f(i,r,pU(1,e))}:function(i,r,e){return i[r]=e,i},Us=Pe,gU=Ko,yU=Iv,mU=Xe,bU=Sa.f,$U=Q9,Sn=oe,wU=Qo,On=Pa,Km=Qe,_U=function(i){var r=function(e,t,n){if(this instanceof r){switch(arguments.length){case 0:return new i;case 1:return new i(e);case 2:return new i(e,t)}return new i(e,t,n)}return gU(i,this,arguments)};return r.prototype=i.prototype,r},q=function(i,r){var e=i.target,t=i.global,n=i.stat,a=i.proto,o=t?Us:n?Us[e]:(Us[e]||{}).prototype,s=t?Sn:Sn[e]||On(Sn,e,{})[e],u=s.prototype,l,h,c,d,f,v,p,g,y;for(d in r)l=$U(t?d:e+(n?".":"#")+d,i.forced),h=!l&&o&&Km(o,d),v=s[d],h&&(i.dontCallGetSet?(y=bU(o,d),p=y&&y.value):p=o[d]),f=h&&p?p:r[d],!(h&&typeof v==typeof f)&&(i.bind&&h?g=wU(f,Us):i.wrap&&h?g=_U(f):a&&mU(f)?g=yU(f):g=f,(i.sham||f&&f.sham||v&&v.sham)&&On(g,"sham",!0),On(s,d,g),a&&(c=e+"Prototype",Km(Sn,c)||On(Sn,c,{}),On(Sn[c],d,f),i.real&&u&&(l||!u[d])&&On(u,d,f)))},EU=Math.ceil,SU=Math.floor,OU=Math.trunc||function(r){var e=+r;return(e>0?SU:EU)(e)},TU=OU,Nl=function(i){var r=+i;return r!==r||r===0?0:TU(r)},IU=Nl,kU=Math.max,PU=Math.min,es=function(i,r){var e=IU(i);return e<0?kU(e+r,0):PU(e,r)},xU=Nl,CU=Math.min,AU=function(i){return i>0?CU(xU(i),9007199254740991):0},DU=AU,Zt=function(i){return DU(i.length)},RU=_r,NU=es,MU=Zt,Gm=function(i){return function(r,e,t){var n=RU(r),a=MU(n),o=NU(t,a),s;if(i&&e!==e){for(;a>o;)if(s=n[o++],s!==s)return!0}else for(;a>o;o++)if((i||o in n)&&n[o]===e)return i||o||0;return!i&&-1}},xv={includes:Gm(!0),indexOf:Gm(!1)},ts={},BU=se,Cc=Qe,FU=_r,jU=xv.indexOf,LU=ts,qm=BU([].push),VE=function(i,r){var e=FU(i),t=0,n=[],a;for(a in e)!Cc(LU,a)&&Cc(e,a)&&qm(n,a);for(;r.length>t;)Cc(e,a=r[t++])&&(~jU(n,a)||qm(n,a));return n},Cv=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],zU=VE,HU=Cv,Ml=Object.keys||function(r){return zU(r,HU)},rs={};rs.f=Object.getOwnPropertySymbols;var Ym=Je,VU=se,WU=zt,UU=ae,Ac=Ml,KU=rs,GU=Cl,qU=At,YU=Al,Tn=Object.assign,Xm=Object.defineProperty,XU=VU([].concat),JU=!Tn||UU(function(){if(Ym&&Tn({b:1},Tn(Xm({},"a",{enumerable:!0,get:function(){Xm(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var i={},r={},e=Symbol("assign detection"),t="abcdefghijklmnopqrst";return i[e]=7,t.split("").forEach(function(n){r[n]=n}),Tn({},i)[e]!==7||Ac(Tn({},r)).join("")!==t})?function(r,e){for(var t=qU(r),n=arguments.length,a=1,o=KU.f,s=GU.f;n>a;)for(var u=YU(arguments[a++]),l=o?XU(Ac(u),o(u)):Ac(u),h=l.length,c=0,d;h>c;)d=l[c++],(!Ym||WU(s,u,d))&&(t[d]=u[d]);return t}:Tn,ZU=q,Jm=JU;ZU({target:"Object",stat:!0,arity:2,forced:Object.assign!==Jm},{assign:Jm});var QU=oe,eK=QU.Object.assign,tK=eK,rK=tK,iK=rK,Le=V(iK),nK=se,Bl=nK([].slice),WE=se,aK=sn,oK=Ze,sK=Qe,Zm=Bl,uK=Uo,UE=Function,lK=WE([].concat),hK=WE([].join),Dc={},cK=function(i,r,e){if(!sK(Dc,r)){for(var t=[],n=0;n=.1;)v=+a[c++%o],v>h&&(v=h),f=Math.sqrt(v*v/(1+l*l)),f=s<0?-f:f,r+=f,e+=l*f,d===!0?i.lineTo(r,e):i.moveTo(r,e),h-=v,d=!d}function TK(i,r,e,t){i.beginPath();var n=6,a=Math.PI*2/n;i.moveTo(r+t,e);for(var o=1;o1?e-1:0),n=1;n=a?i?"":void 0:(o=tb(t,n),o<55296||o>56319||n+1===a||(s=tb(t,n+1))<56320||s>57343?i?VK(t,n):o:i?WK(t,n,n+2):(o-55296<<10)+(s-56320)+65536)}},UK={codeAt:rb(!1),charAt:rb(!0)},KK=Pe,GK=Xe,ib=KK.WeakMap,eS=GK(ib)&&/native code/.test(String(ib)),qK=ka,YK=Dl,nb=qK("keys"),Fl=function(i){return nb[i]||(nb[i]=YK(i))},XK=eS,tS=Pe,JK=Ze,ZK=Pa,Nc=Qe,Mc=Pv,QK=Fl,eG=ts,ab="Object already initialized",uf=tS.TypeError,tG=tS.WeakMap,Hu,yo,Vu,rG=function(i){return Vu(i)?yo(i):Hu(i,{})},iG=function(i){return function(r){var e;if(!JK(r)||(e=yo(r)).type!==i)throw new uf("Incompatible receiver, "+i+" required");return e}};if(XK||Mc.state){var cr=Mc.state||(Mc.state=new tG);cr.get=cr.get,cr.has=cr.has,cr.set=cr.set,Hu=function(i,r){if(cr.has(i))throw new uf(ab);return r.facade=i,cr.set(i,r),r},yo=function(i){return cr.get(i)||{}},Vu=function(i){return cr.has(i)}}else{var In=QK("state");eG[In]=!0,Hu=function(i,r){if(Nc(i,In))throw new uf(ab);return r.facade=i,ZK(i,In,r),r},yo=function(i){return Nc(i,In)?i[In]:{}},Vu=function(i){return Nc(i,In)}}var ln={set:Hu,get:yo,has:Vu,enforce:rG,getterFor:iG},lf=Je,nG=Qe,rS=Function.prototype,aG=lf&&Object.getOwnPropertyDescriptor,Nv=nG(rS,"name"),oG=Nv&&function(){}.name==="something",sG=Nv&&(!lf||lf&&aG(rS,"name").configurable),uG={EXISTS:Nv,PROPER:oG,CONFIGURABLE:sG},jl={},lG=Je,hG=HE,cG=Ht,dG=Vt,fG=_r,vG=Ml;jl.f=lG&&!hG?Object.defineProperties:function(r,e){dG(r);for(var t=fG(e),n=vG(e),a=n.length,o=0,s;a>o;)cG.f(r,s=n[o++],t[s]);return r};var pG=Jt,gG=pG("document","documentElement"),yG=Vt,mG=jl,ob=Cv,bG=ts,$G=gG,wG=LE,_G=Fl,sb=">",ub="<",hf="prototype",cf="script",iS=_G("IE_PROTO"),Bc=function(){},nS=function(i){return ub+cf+sb+i+ub+"/"+cf+sb},lb=function(i){i.write(nS("")),i.close();var r=i.parentWindow.Object;return i=null,r},EG=function(){var i=wG("iframe"),r="java"+cf+":",e;return i.style.display="none",$G.appendChild(i),i.src=String(r),e=i.contentWindow.document,e.open(),e.write(nS("document.F=Object")),e.close(),e.F},Ks,yu=function(){try{Ks=new ActiveXObject("htmlfile")}catch{}yu=typeof document<"u"?document.domain&&Ks?lb(Ks):EG():lb(Ks);for(var i=ob.length;i--;)delete yu[hf][ob[i]];return yu()};bG[iS]=!0;var xa=Object.create||function(r,e){var t;return r!==null?(Bc[hf]=yG(r),t=new Bc,Bc[hf]=null,t[iS]=r):t=yu(),e===void 0?t:mG.f(t,e)},SG=ae,aS=!SG(function(){function i(){}return i.prototype.constructor=null,Object.getPrototypeOf(new i)!==i.prototype}),OG=Qe,TG=Xe,IG=At,kG=Fl,PG=aS,hb=kG("IE_PROTO"),df=Object,xG=df.prototype,Ll=PG?df.getPrototypeOf:function(i){var r=IG(i);if(OG(r,hb))return r[hb];var e=r.constructor;return TG(e)&&r instanceof e?e.prototype:r instanceof df?xG:null},CG=Pa,is=function(i,r,e,t){return t&&t.enumerable?i[r]=e:CG(i,r,e),i},AG=ae,DG=Xe,RG=Ze,NG=xa,cb=Ll,MG=is,BG=xe,ff=BG("iterator"),oS=!1,Cr,Fc,jc;[].keys&&(jc=[].keys(),"next"in jc?(Fc=cb(cb(jc)),Fc!==Object.prototype&&(Cr=Fc)):oS=!0);var FG=!RG(Cr)||AG(function(){var i={};return Cr[ff].call(i)!==i});FG?Cr={}:Cr=NG(Cr);DG(Cr[ff])||MG(Cr,ff,function(){return this});var sS={IteratorPrototype:Cr,BUGGY_SAFARI_ITERATORS:oS},jG=Dv,LG=un,zG=jG?{}.toString:function(){return"[object "+LG(this)+"]"},HG=Dv,VG=Ht.f,WG=Pa,UG=Qe,KG=zG,GG=xe,db=GG("toStringTag"),Ca=function(i,r,e,t){if(i){var n=e?i:i.prototype;UG(n,db)||VG(n,db,{configurable:!0,value:r}),t&&!HG&&WG(n,"toString",KG)}},Aa={},qG=sS.IteratorPrototype,YG=xa,XG=Go,JG=Ca,ZG=Aa,QG=function(){return this},eq=function(i,r,e,t){var n=r+" Iterator";return i.prototype=YG(qG,{next:XG(+!t,e)}),JG(i,n,!1,!0),ZG[n]=QG,i},tq=se,rq=sn,iq=function(i,r,e){try{return tq(rq(Object.getOwnPropertyDescriptor(i,r)[e]))}catch{}},nq=Xe,aq=String,oq=TypeError,sq=function(i){if(typeof i=="object"||nq(i))return i;throw new oq("Can't set "+aq(i)+" as a prototype")},uq=iq,lq=Vt,hq=sq,cq=Object.setPrototypeOf||("__proto__"in{}?function(){var i=!1,r={},e;try{e=uq(Object.prototype,"__proto__","set"),e(r,[]),i=r instanceof Array}catch{}return function(n,a){return lq(n),hq(a),i?e(n,a):n.__proto__=a,n}}():void 0),dq=q,fq=zt,vq=uG,pq=eq,gq=Ll,yq=Ca,fb=is,mq=xe,vb=Aa,bq=sS,$q=vq.PROPER,Gs=bq.BUGGY_SAFARI_ITERATORS,Lc=mq("iterator"),pb="keys",qs="values",gb="entries",wq=function(){return this},Mv=function(i,r,e,t,n,a,o){pq(e,r,t);var s=function(y){if(y===n&&d)return d;if(!Gs&&y&&y in h)return h[y];switch(y){case pb:return function(){return new e(this,y)};case qs:return function(){return new e(this,y)};case gb:return function(){return new e(this,y)}}return function(){return new e(this)}},u=r+" Iterator",l=!1,h=i.prototype,c=h[Lc]||h["@@iterator"]||n&&h[n],d=!Gs&&c||s(n),f=r==="Array"&&h.entries||c,v,p,g;if(f&&(v=gq(f.call(new i)),v!==Object.prototype&&v.next&&(yq(v,u,!0,!0),vb[u]=wq)),$q&&n===qs&&c&&c.name!==qs&&(l=!0,d=function(){return fq(c,this)}),n)if(p={values:s(qs),keys:a?d:s(pb),entries:s(gb)},o)for(g in p)(Gs||l||!(g in h))&&fb(h,g,p[g]);else dq({target:r,proto:!0,forced:Gs||l},p);return o&&h[Lc]!==d&&fb(h,Lc,d,{name:n}),vb[r]=d,p},Bv=function(i,r){return{value:i,done:r}},_q=UK.charAt,Eq=Er,uS=ln,Sq=Mv,yb=Bv,lS="String Iterator",Oq=uS.set,Tq=uS.getterFor(lS);Sq(String,"String",function(i){Oq(this,{type:lS,string:Eq(i),index:0})},function(){var r=Tq(this),e=r.string,t=r.index,n;return t>=e.length?yb(void 0,!0):(n=_q(e,t),r.index+=n.length,yb(n,!1))});var Iq=zt,mb=Vt,kq=kv,hS=function(i,r,e){var t,n;mb(i);try{if(t=kq(i,"return"),!t){if(r==="throw")throw e;return e}t=Iq(t,i)}catch(a){n=!0,t=a}if(r==="throw")throw e;if(n)throw t;return mb(t),e},Pq=Vt,xq=hS,Cq=function(i,r,e,t){try{return t?r(Pq(e)[0],e[1]):r(e)}catch(n){xq(i,"throw",n)}},Aq=xe,Dq=Aa,Rq=Aq("iterator"),Nq=Array.prototype,cS=function(i){return i!==void 0&&(Dq.Array===i||Nq[Rq]===i)},Mq=se,Bq=Xe,vf=Pv,Fq=Mq(Function.toString);Bq(vf.inspectSource)||(vf.inspectSource=function(i){return Fq(i)});var jq=vf.inspectSource,Lq=se,zq=ae,dS=Xe,Hq=un,Vq=Jt,Wq=jq,fS=function(){},Uq=[],vS=Vq("Reflect","construct"),Fv=/^\s*(?:class|function)\b/,Kq=Lq(Fv.exec),Gq=!Fv.test(fS),La=function(r){if(!dS(r))return!1;try{return vS(fS,Uq,r),!0}catch{return!1}},pS=function(r){if(!dS(r))return!1;switch(Hq(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Gq||!!Kq(Fv,Wq(r))}catch{return!0}};pS.sham=!0;var zl=!vS||zq(function(){var i;return La(La.call)||!La(Object)||!La(function(){i=!0})||i})?pS:La,qq=Rl,Yq=Ht,Xq=Go,Da=function(i,r,e){var t=qq(r);t in i?Yq.f(i,t,Xq(0,e)):i[t]=e},Jq=un,bb=kv,Zq=Oa,Qq=Aa,eY=xe,tY=eY("iterator"),Hl=function(i){if(!Zq(i))return bb(i,tY)||bb(i,"@@iterator")||Qq[Jq(i)]},rY=zt,iY=sn,nY=Vt,aY=Ia,oY=Hl,sY=TypeError,gS=function(i,r){var e=arguments.length<2?oY(i):r;if(iY(e))return nY(rY(e,i));throw new sY(aY(i)+" is not iterable")},uY=Qo,lY=zt,hY=At,cY=Cq,dY=cS,fY=zl,vY=Zt,$b=Da,pY=gS,gY=Hl,wb=Array,yY=function(r){var e=hY(r),t=fY(this),n=arguments.length,a=n>1?arguments[1]:void 0,o=a!==void 0;o&&(a=uY(a,n>2?arguments[2]:void 0));var s=gY(e),u=0,l,h,c,d,f,v;if(s&&!(this===wb&&dY(s)))for(d=pY(e,s),f=d.next,h=t?new this:[];!(c=lY(f,d)).done;u++)v=o?cY(d,a,[c.value,u],!0):c.value,$b(h,u,v);else for(l=vY(e),h=t?new this(l):wb(l);l>u;u++)v=o?a(e[u],u):e[u],$b(h,u,v);return h.length=u,h},mY=xe,yS=mY("iterator"),mS=!1;try{var bY=0,_b={next:function(){return{done:!!bY++}},return:function(){mS=!0}};_b[yS]=function(){return this},Array.from(_b,function(){throw 2})}catch{}var $Y=function(i,r){try{if(!r&&!mS)return!1}catch{return!1}var e=!1;try{var t={};t[yS]=function(){return{next:function(){return{done:e=!0}}}},i(t)}catch{}return e},wY=q,_Y=yY,EY=$Y,SY=!EY(function(i){Array.from(i)});wY({target:"Array",stat:!0,forced:SY},{from:_Y});var OY=oe,TY=OY.Array.from,IY=TY,bS=IY,kY=bS,hn=V(kY),PY=_r,Eb=Aa,$S=ln;Ht.f;var xY=Mv,Ys=Bv,wS="Array Iterator",CY=$S.set,AY=$S.getterFor(wS);xY(Array,"Array",function(i,r){CY(this,{type:wS,target:PY(i),index:0,kind:r})},function(){var i=AY(this),r=i.target,e=i.kind,t=i.index++;if(!r||t>=r.length)return i.target=void 0,Ys(void 0,!0);switch(e){case"keys":return Ys(t,!1);case"values":return Ys(r[t],!1)}return Ys([t,r[t]],!1)},"values");Eb.Arguments=Eb.Array;var DY=Hl,RY=DY,NY={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},MY=NY,BY=Pe,FY=un,jY=Pa,Sb=Aa,LY=xe,Ob=LY("toStringTag");for(var zc in MY){var Tb=BY[zc],Hc=Tb&&Tb.prototype;Hc&&FY(Hc)!==Ob&&jY(Hc,Ob,zc),Sb[zc]=Sb.Array}var zY=RY,HY=zY,VY=HY,WY=VY,UY=WY,KY=UY,_S=KY,ES=V(_S),GY=_S,cn=V(GY);function N(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")}var SS={exports:{}},qY=q,YY=Je,Ib=Ht.f;qY({target:"Object",stat:!0,forced:Object.defineProperty!==Ib,sham:!YY},{defineProperty:Ib});var XY=oe,OS=XY.Object,JY=SS.exports=function(r,e,t){return OS.defineProperty(r,e,t)};OS.defineProperty.sham&&(JY.sham=!0);var ZY=SS.exports,QY=ZY,TS=QY,eX=TS,tX=eX,rX=tX,iX=rX,nX=iX,Vl=V(nX),aX=Hr,dn=Array.isArray||function(r){return aX(r)==="Array"},oX=TypeError,sX=9007199254740991,jv=function(i){if(i>sX)throw oX("Maximum allowed index exceeded");return i},kb=dn,uX=zl,lX=Ze,hX=xe,cX=hX("species"),Pb=Array,dX=function(i){var r;return kb(i)&&(r=i.constructor,uX(r)&&(r===Pb||kb(r.prototype))?r=void 0:lX(r)&&(r=r[cX],r===null&&(r=void 0))),r===void 0?Pb:r},fX=dX,Lv=function(i,r){return new(fX(i))(r===0?0:r)},vX=ae,pX=xe,gX=Xo,yX=pX("species"),ns=function(i){return gX>=51||!vX(function(){var r=[],e=r.constructor={};return e[yX]=function(){return{foo:1}},r[i](Boolean).foo!==1})},mX=q,bX=ae,$X=dn,wX=Ze,_X=At,EX=Zt,xb=jv,Cb=Da,SX=Lv,OX=ns,TX=xe,IX=Xo,IS=TX("isConcatSpreadable"),kX=IX>=51||!bX(function(){var i=[];return i[IS]=!1,i.concat()[0]!==i}),PX=function(i){if(!wX(i))return!1;var r=i[IS];return r!==void 0?!!r:$X(i)},xX=!kX||!OX("concat");mX({target:"Array",proto:!0,arity:1,forced:xX},{concat:function(r){var e=_X(this),t=SX(e,0),n=0,a,o,s,u,l;for(a=-1,s=arguments.length;ag;g++)if((s||g in f)&&($=f[g],b=v($,g,d),i))if(r)m[g]=b;else if(b)switch(i){case 3:return!0;case 5:return $;case 6:return g;case 2:Rb(m,$)}else switch(i){case 4:return!1;case 7:Rb(m,$)}return a?-1:t||n?n:m}},wi={forEach:qr(0),map:qr(1),filter:qr(2),some:qr(3),every:qr(4),find:qr(5),findIndex:qr(6),filterReject:qr(7)},Ul=q,Kl=Pe,Hv=zt,iJ=se,ra=Je,ia=Ta,nJ=ae,Ge=Qe,aJ=Be,pf=Vt,Gl=_r,Vv=Rl,oJ=Er,gf=Go,mo=xa,AS=Ml,sJ=as,DS=Wl,uJ=rs,RS=Sa,NS=Ht,lJ=jl,MS=Cl,Nb=is,hJ=zv,Wv=ka,cJ=Fl,BS=ts,Mb=Dl,dJ=xe,fJ=os,vJ=Ce,pJ=CS,gJ=Ca,FS=ln,ql=wi.forEach,Ot=cJ("hidden"),Yl="Symbol",bo="prototype",yJ=FS.set,Bb=FS.getterFor(Yl),or=Object[bo],Fi=Kl.Symbol,Ga=Fi&&Fi[bo],mJ=Kl.RangeError,bJ=Kl.TypeError,Vc=Kl.QObject,jS=RS.f,ji=NS.f,LS=DS.f,$J=MS.f,zS=iJ([].push),Fr=Wv("symbols"),ss=Wv("op-symbols"),wJ=Wv("wks"),yf=!Vc||!Vc[bo]||!Vc[bo].findChild,HS=function(i,r,e){var t=jS(or,r);t&&delete or[r],ji(i,r,e),t&&i!==or&&ji(or,r,t)},mf=ra&&nJ(function(){return mo(ji({},"a",{get:function(){return ji(this,"a",{value:7}).a}})).a!==7})?HS:ji,Wc=function(i,r){var e=Fr[i]=mo(Ga);return yJ(e,{type:Yl,tag:i,description:r}),ra||(e.description=r),e},Xl=function(r,e,t){r===or&&Xl(ss,e,t),pf(r);var n=Vv(e);return pf(t),Ge(Fr,n)?(t.enumerable?(Ge(r,Ot)&&r[Ot][n]&&(r[Ot][n]=!1),t=mo(t,{enumerable:gf(0,!1)})):(Ge(r,Ot)||ji(r,Ot,gf(1,{})),r[Ot][n]=!0),mf(r,n,t)):ji(r,n,t)},Uv=function(r,e){pf(r);var t=Gl(e),n=AS(t).concat(KS(t));return ql(n,function(a){(!ra||Hv(VS,t,a))&&Xl(r,a,t[a])}),r},_J=function(r,e){return e===void 0?mo(r):Uv(mo(r),e)},VS=function(r){var e=Vv(r),t=Hv($J,this,e);return this===or&&Ge(Fr,e)&&!Ge(ss,e)?!1:t||!Ge(this,e)||!Ge(Fr,e)||Ge(this,Ot)&&this[Ot][e]?t:!0},WS=function(r,e){var t=Gl(r),n=Vv(e);if(!(t===or&&Ge(Fr,n)&&!Ge(ss,n))){var a=jS(t,n);return a&&Ge(Fr,n)&&!(Ge(t,Ot)&&t[Ot][n])&&(a.enumerable=!0),a}},US=function(r){var e=LS(Gl(r)),t=[];return ql(e,function(n){!Ge(Fr,n)&&!Ge(BS,n)&&zS(t,n)}),t},KS=function(i){var r=i===or,e=LS(r?ss:Gl(i)),t=[];return ql(e,function(n){Ge(Fr,n)&&(!r||Ge(or,n))&&zS(t,Fr[n])}),t};ia||(Fi=function(){if(aJ(Ga,this))throw new bJ("Symbol is not a constructor");var r=!arguments.length||arguments[0]===void 0?void 0:oJ(arguments[0]),e=Mb(r),t=function(n){this===or&&Hv(t,ss,n),Ge(this,Ot)&&Ge(this[Ot],e)&&(this[Ot][e]=!1);var a=gf(1,n);try{mf(this,e,a)}catch(o){if(!(o instanceof mJ))throw o;HS(this,e,a)}};return ra&&yf&&mf(or,e,{configurable:!0,set:t}),Wc(e,r)},Ga=Fi[bo],Nb(Ga,"toString",function(){return Bb(this).tag}),Nb(Fi,"withoutSetter",function(i){return Wc(Mb(i),i)}),MS.f=VS,NS.f=Xl,lJ.f=Uv,RS.f=WS,sJ.f=DS.f=US,uJ.f=KS,fJ.f=function(i){return Wc(dJ(i),i)},ra&&hJ(Ga,"description",{configurable:!0,get:function(){return Bb(this).description}}));Ul({global:!0,constructor:!0,wrap:!0,forced:!ia,sham:!ia},{Symbol:Fi});ql(AS(wJ),function(i){vJ(i)});Ul({target:Yl,stat:!0,forced:!ia},{useSetter:function(){yf=!0},useSimple:function(){yf=!1}});Ul({target:"Object",stat:!0,forced:!ia,sham:!ra},{create:_J,defineProperty:Xl,defineProperties:Uv,getOwnPropertyDescriptor:WS});Ul({target:"Object",stat:!0,forced:!ia},{getOwnPropertyNames:US});pJ();gJ(Fi,Yl);BS[Ot]=!0;var EJ=Ta,GS=EJ&&!!Symbol.for&&!!Symbol.keyFor,SJ=q,OJ=Jt,TJ=Qe,IJ=Er,qS=ka,kJ=GS,Uc=qS("string-to-symbol-registry"),PJ=qS("symbol-to-string-registry");SJ({target:"Symbol",stat:!0,forced:!kJ},{for:function(i){var r=IJ(i);if(TJ(Uc,r))return Uc[r];var e=OJ("Symbol")(r);return Uc[r]=e,PJ[e]=r,e}});var xJ=q,CJ=Qe,AJ=Jo,DJ=Ia,RJ=ka,NJ=GS,Fb=RJ("symbol-to-string-registry");xJ({target:"Symbol",stat:!0,forced:!NJ},{keyFor:function(r){if(!AJ(r))throw new TypeError(DJ(r)+" is not a symbol");if(CJ(Fb,r))return Fb[r]}});var MJ=se,jb=dn,BJ=Xe,Lb=Hr,FJ=Er,zb=MJ([].push),jJ=function(i){if(BJ(i))return i;if(jb(i)){for(var r=i.length,e=[],t=0;ti.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?arguments[1]:void 0)}});var lte=et,hte=lte("Array").map,cte=Be,dte=hte,Jc=Array.prototype,fte=function(i){var r=i.map;return i===Jc||cte(Jc,i)&&r===Jc.map?dte:r},vte=fte,pte=vte,gte=pte,na=V(gte),yte=q,mte=At,dO=Ml,bte=ae,$te=bte(function(){dO(1)});yte({target:"Object",stat:!0,forced:$te},{keys:function(r){return dO(mte(r))}});var wte=oe,_te=wte.Object.keys,Ete=_te,Ste=Ete,Ote=Ste,Oe=V(Ote),Tte=q,Ite=se,fO=Date,kte=Ite(fO.prototype.getTime);Tte({target:"Date",stat:!0},{now:function(){return kte(new fO)}});var Pte=oe,xte=Pte.Date.now,Cte=xte,Ate=Cte,Dte=Ate,Uu=V(Dte),Rte=ae,Ra=function(i,r){var e=[][i];return!!e&&Rte(function(){e.call(null,r||function(){return 1},1)})},Nte=wi.forEach,Mte=Ra,Bte=Mte("forEach"),Fte=Bte?[].forEach:function(r){return Nte(this,r,arguments.length>1?arguments[1]:void 0)},jte=q,n1=Fte;jte({target:"Array",proto:!0,forced:[].forEach!==n1},{forEach:n1});var Lte=et,zte=Lte("Array").forEach,Hte=zte,Vte=Hte,Wte=un,Ute=Qe,Kte=Be,Gte=Vte,Zc=Array.prototype,qte={DOMTokenList:!0,NodeList:!0},Yte=function(i){var r=i.forEach;return i===Zc||Kte(Zc,i)&&r===Zc.forEach||Ute(qte,Wte(i))?Gte:r},Xte=Yte,fe=V(Xte),Jte=q,Zte=se,Qte=dn,ere=Zte([].reverse),a1=[1,2];Jte({target:"Array",proto:!0,forced:String(a1)===String(a1.reverse())},{reverse:function(){return Qte(this)&&(this.length=this.length),ere(this)}});var tre=et,rre=tre("Array").reverse,ire=Be,nre=rre,Qc=Array.prototype,are=function(i){var r=i.reverse;return i===Qc||ire(Qc,i)&&r===Qc.reverse?nre:r},ore=are,sre=ore,ure=sre,Li=V(ure),o1=Ia,lre=TypeError,vO=function(i,r){if(!delete i[r])throw new lre("Cannot delete property "+o1(r)+" of "+o1(i))},hre=q,cre=At,dre=es,fre=Nl,vre=Zt,pre=uO,gre=jv,yre=Lv,mre=Da,ed=vO,bre=ns,$re=bre("splice"),wre=Math.max,_re=Math.min;hre({target:"Array",proto:!0,forced:!$re},{splice:function(r,e){var t=cre(this),n=vre(t),a=dre(r,n),o=arguments.length,s,u,l,h,c,d;for(o===0?s=u=0:o===1?(s=0,u=n-a):(s=o-2,u=_re(wre(fre(e),0),n-a)),gre(n+s-u),l=yre(t,u),h=0;hn-u+s;h--)ed(t,h-1)}else if(s>u)for(h=n-u;h>a;h--)c=h+u-1,d=h+s-1,c in t?t[d]=t[c]:ed(t,d);for(h=0;h1?arguments[1]:void 0)}});var Nre=et,Mre=Nre("Array").includes,Bre=Ze,Fre=Hr,jre=xe,Lre=jre("match"),zre=function(i){var r;return Bre(i)&&((r=i[Lre])!==void 0?!!r:Fre(i)==="RegExp")},Hre=zre,Vre=TypeError,Wre=function(i){if(Hre(i))throw new Vre("The method doesn't accept regular expressions");return i},Ure=xe,Kre=Ure("match"),Gre=function(i){var r=/./;try{"/./"[i](r)}catch{try{return r[Kre]=!1,"/./"[i](r)}catch{}}return!1},qre=q,Yre=se,Xre=Wre,Jre=qo,s1=Er,Zre=Gre,Qre=Yre("".indexOf);qre({target:"String",proto:!0,forced:!Zre("includes")},{includes:function(r){return!!~Qre(s1(Jre(this)),s1(Xre(r)),arguments.length>1?arguments[1]:void 0)}});var eie=et,tie=eie("String").includes,u1=Be,rie=Mre,iie=tie,rd=Array.prototype,id=String.prototype,nie=function(i){var r=i.includes;return i===rd||u1(rd,i)&&r===rd.includes?rie:typeof i=="string"||i===id||u1(id,i)&&r===id.includes?iie:r},aie=nie,oie=aie,sie=oie,hi=V(sie),uie=q,lie=ae,hie=At,pO=Ll,cie=aS,die=lie(function(){pO(1)});uie({target:"Object",stat:!0,forced:die,sham:!cie},{getPrototypeOf:function(r){return pO(hie(r))}});var fie=oe,vie=fie.Object.getPrototypeOf,pie=vie,gO=pie,gie=gO,l1=V(gie),yie=q,mie=wi.filter,bie=ns,$ie=bie("filter");yie({target:"Array",proto:!0,forced:!$ie},{filter:function(r){return mie(this,r,arguments.length>1?arguments[1]:void 0)}});var wie=et,_ie=wie("Array").filter,Eie=Be,Sie=_ie,nd=Array.prototype,Oie=function(i){var r=i.filter;return i===nd||Eie(nd,i)&&r===nd.filter?Sie:r},Tie=Oie,Iie=Tie,kie=Iie,Tt=V(kie),qv=` -\v\f\r                 \u2028\u2029\uFEFF`,Pie=se,xie=qo,Cie=Er,$f=qv,h1=Pie("".replace),Aie=RegExp("^["+$f+"]+"),Die=RegExp("(^|[^"+$f+"])["+$f+"]+$"),ad=function(i){return function(r){var e=Cie(xie(r));return i&1&&(e=h1(e,Aie,"")),i&2&&(e=h1(e,Die,"$1")),e}},yO={start:ad(1),end:ad(2),trim:ad(3)},mO=Pe,Rie=ae,Nie=se,Mie=Er,Bie=yO.trim,c1=qv,eo=mO.parseInt,d1=mO.Symbol,f1=d1&&d1.iterator,bO=/^[+-]?0x/i,Fie=Nie(bO.exec),jie=eo(c1+"08")!==8||eo(c1+"0x16")!==22||f1&&!Rie(function(){eo(Object(f1))}),Lie=jie?function(r,e){var t=Bie(Mie(r));return eo(t,e>>>0||(Fie(bO,t)?16:10))}:eo,zie=q,v1=Lie;zie({global:!0,forced:parseInt!==v1},{parseInt:v1});var Hie=oe,Vie=Hie.parseInt,Wie=Vie,Uie=Wie,Kie=Uie,nr=V(Kie),Gie=q,qie=Iv,Yie=xv.indexOf,Xie=Ra,wf=qie([].indexOf),$O=!!wf&&1/wf([1],1,-0)<0,Jie=$O||!Xie("indexOf");Gie({target:"Array",proto:!0,forced:Jie},{indexOf:function(r){var e=arguments.length>1?arguments[1]:void 0;return $O?wf(this,r,e)||0:Yie(this,r,e)}});var Zie=et,Qie=Zie("Array").indexOf,ene=Be,tne=Qie,od=Array.prototype,rne=function(i){var r=i.indexOf;return i===od||ene(od,i)&&r===od.indexOf?tne:r},ine=rne,nne=ine,ane=nne,ne=V(ane),one=q,sne=Je,une=xa;one({target:"Object",stat:!0,sham:!sne},{create:une});var lne=oe,hne=lne.Object,cne=function(r,e){return hne.create(r,e)},dne=cne,wO=dne,fne=wO,zi=V(fne),_f=oe,vne=Ko;_f.JSON||(_f.JSON={stringify:JSON.stringify});var pne=function(r,e,t){return vne(_f.JSON.stringify,null,arguments)},gne=pne,yne=gne,mne=yne,ls=V(mne),bne=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",$ne=TypeError,wne=function(i,r){if(ie,o=Ene(t)?t:kne(t),s=a?Tne(arguments,e):[],u=a?function(){_ne(o,this,s)}:o;return r?i(u,n):i(u)}:i},xne=q,SO=Pe,Cne=EO,p1=Cne(SO.setInterval,!0);xne({global:!0,bind:!0,forced:SO.setInterval!==p1},{setInterval:p1});var Ane=q,OO=Pe,Dne=EO,g1=Dne(OO.setTimeout,!0);Ane({global:!0,bind:!0,forced:OO.setTimeout!==g1},{setTimeout:g1});var Rne=oe,Nne=Rne.setTimeout,Mne=Nne,mr=V(Mne),Bne=At,y1=es,Fne=Zt,jne=function(r){for(var e=Bne(this),t=Fne(e),n=arguments.length,a=y1(n>1?arguments[1]:void 0,t),o=n>2?arguments[2]:void 0,s=o===void 0?t:y1(o,t);s>a;)e[a++]=r;return e},Lne=q,zne=jne;Lne({target:"Array",proto:!0},{fill:zne});var Hne=et,Vne=Hne("Array").fill,Wne=Be,Une=Vne,sd=Array.prototype,Kne=function(i){var r=i.fill;return i===sd||Wne(sd,i)&&r===sd.fill?Une:r},Gne=Kne,qne=Gne,Yne=qne,hs=V(Yne);/*! Hammer.JS - v2.0.17-rc - 2019-12-16 + */var mc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function V(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Hs=function(i){return i&&i.Math===Math&&i},Pe=Hs(typeof globalThis=="object"&&globalThis)||Hs(typeof window=="object"&&window)||Hs(typeof self=="object"&&self)||Hs(typeof mc=="object"&&mc)||function(){return this}()||mc||Function("return this")(),ae=function(i){try{return!!i()}catch{return!0}},yW=ae,Uo=!yW(function(){var i=function(){}.bind();return typeof i!="function"||i.hasOwnProperty("prototype")}),mW=Uo,kE=Function.prototype,Im=kE.apply,km=kE.call,Ko=typeof Reflect=="object"&&Reflect.apply||(mW?km.bind(Im):function(){return km.apply(Im,arguments)}),PE=Uo,xE=Function.prototype,nf=xE.call,bW=PE&&xE.bind.bind(nf,nf),se=PE?bW:function(i){return function(){return nf.apply(i,arguments)}},CE=se,$W=CE({}.toString),wW=CE("".slice),Hr=function(i){return wW($W(i),8,-1)},_W=Hr,EW=se,Iv=function(i){if(_W(i)==="Function")return EW(i)},af=typeof document=="object"&&document.all,SW=typeof af>"u"&&af!==void 0,AE={all:af,IS_HTMLDDA:SW},DE=AE,OW=DE.all,Xe=DE.IS_HTMLDDA?function(i){return typeof i=="function"||i===OW}:function(i){return typeof i=="function"},Sa={},TW=ae,Je=!TW(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),IW=Uo,Vs=Function.prototype.call,zt=IW?Vs.bind(Vs):function(){return Vs.apply(Vs,arguments)},Cl={},RE={}.propertyIsEnumerable,NE=Object.getOwnPropertyDescriptor,kW=NE&&!RE.call({1:2},1);Cl.f=kW?function(r){var e=NE(this,r);return!!e&&e.enumerable}:RE;var Go=function(i,r){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:r}},PW=se,xW=ae,CW=Hr,bc=Object,AW=PW("".split),Al=xW(function(){return!bc("z").propertyIsEnumerable(0)})?function(i){return CW(i)==="String"?AW(i,""):bc(i)}:bc,Oa=function(i){return i==null},DW=Oa,RW=TypeError,qo=function(i){if(DW(i))throw new RW("Can't call method on "+i);return i},NW=Al,MW=qo,_r=function(i){return NW(MW(i))},Pm=Xe,ME=AE,BW=ME.all,Ze=ME.IS_HTMLDDA?function(i){return typeof i=="object"?i!==null:Pm(i)||i===BW}:function(i){return typeof i=="object"?i!==null:Pm(i)},oe={},$c=oe,wc=Pe,FW=Xe,xm=function(i){return FW(i)?i:void 0},Jt=function(i,r){return arguments.length<2?xm($c[i])||xm(wc[i]):$c[i]&&$c[i][r]||wc[i]&&wc[i][r]},jW=se,Be=jW({}.isPrototypeOf),Yo=typeof navigator<"u"&&String(navigator.userAgent)||"",BE=Pe,_c=Yo,Cm=BE.process,Am=BE.Deno,Dm=Cm&&Cm.versions||Am&&Am.version,Rm=Dm&&Dm.v8,ir,zu;Rm&&(ir=Rm.split("."),zu=ir[0]>0&&ir[0]<4?1:+(ir[0]+ir[1]));!zu&&_c&&(ir=_c.match(/Edge\/(\d+)/),(!ir||ir[1]>=74)&&(ir=_c.match(/Chrome\/(\d+)/),ir&&(zu=+ir[1])));var Xo=zu,Nm=Xo,LW=ae,zW=Pe,HW=zW.String,Ta=!!Object.getOwnPropertySymbols&&!LW(function(){var i=Symbol("symbol detection");return!HW(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&Nm&&Nm<41}),VW=Ta,FE=VW&&!Symbol.sham&&typeof Symbol.iterator=="symbol",WW=Jt,UW=Xe,KW=Be,GW=FE,qW=Object,Jo=GW?function(i){return typeof i=="symbol"}:function(i){var r=WW("Symbol");return UW(r)&&KW(r.prototype,qW(i))},YW=String,Ia=function(i){try{return YW(i)}catch{return"Object"}},XW=Xe,JW=Ia,ZW=TypeError,sn=function(i){if(XW(i))return i;throw new ZW(JW(i)+" is not a function")},QW=sn,e9=Oa,kv=function(i,r){var e=i[r];return e9(e)?void 0:QW(e)},Ec=zt,Sc=Xe,Oc=Ze,t9=TypeError,r9=function(i,r){var e,t;if(r==="string"&&Sc(e=i.toString)&&!Oc(t=Ec(e,i))||Sc(e=i.valueOf)&&!Oc(t=Ec(e,i))||r!=="string"&&Sc(e=i.toString)&&!Oc(t=Ec(e,i)))return t;throw new t9("Can't convert object to primitive value")},jE={exports:{}},Mm=Pe,i9=Object.defineProperty,n9=function(i,r){try{i9(Mm,i,{value:r,configurable:!0,writable:!0})}catch{Mm[i]=r}return r},a9=Pe,o9=n9,Bm="__core-js_shared__",s9=a9[Bm]||o9(Bm,{}),Pv=s9,Fm=Pv;(jE.exports=function(i,r){return Fm[i]||(Fm[i]=r!==void 0?r:{})})("versions",[]).push({version:"3.33.0",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ka=jE.exports,u9=qo,l9=Object,At=function(i){return l9(u9(i))},h9=se,c9=At,d9=h9({}.hasOwnProperty),Qe=Object.hasOwn||function(r,e){return d9(c9(r),e)},f9=se,v9=0,p9=Math.random(),g9=f9(1 .toString),Dl=function(i){return"Symbol("+(i===void 0?"":i)+")_"+g9(++v9+p9,36)},y9=Pe,m9=ka,jm=Qe,b9=Dl,$9=Ta,w9=FE,Ln=y9.Symbol,Tc=m9("wks"),_9=w9?Ln.for||Ln:Ln&&Ln.withoutSetter||b9,xe=function(i){return jm(Tc,i)||(Tc[i]=$9&&jm(Ln,i)?Ln[i]:_9("Symbol."+i)),Tc[i]},E9=zt,Lm=Ze,zm=Jo,S9=kv,O9=r9,T9=xe,I9=TypeError,k9=T9("toPrimitive"),P9=function(i,r){if(!Lm(i)||zm(i))return i;var e=S9(i,k9),t;if(e){if(r===void 0&&(r="default"),t=E9(e,i,r),!Lm(t)||zm(t))return t;throw new I9("Can't convert object to primitive value")}return r===void 0&&(r="number"),O9(i,r)},x9=P9,C9=Jo,Rl=function(i){var r=x9(i,"string");return C9(r)?r:r+""},A9=Pe,Hm=Ze,of=A9.document,D9=Hm(of)&&Hm(of.createElement),LE=function(i){return D9?of.createElement(i):{}},R9=Je,N9=ae,M9=LE,zE=!R9&&!N9(function(){return Object.defineProperty(M9("div"),"a",{get:function(){return 7}}).a!==7}),B9=Je,F9=zt,j9=Cl,L9=Go,z9=_r,H9=Rl,V9=Qe,W9=zE,Vm=Object.getOwnPropertyDescriptor;Sa.f=B9?Vm:function(r,e){if(r=z9(r),e=H9(e),W9)try{return Vm(r,e)}catch{}if(V9(r,e))return L9(!F9(j9.f,r,e),r[e])};var U9=ae,K9=Xe,G9=/#|\.prototype\./,Zo=function(i,r){var e=Y9[q9(i)];return e===J9?!0:e===X9?!1:K9(r)?U9(r):!!r},q9=Zo.normalize=function(i){return String(i).replace(G9,".").toLowerCase()},Y9=Zo.data={},X9=Zo.NATIVE="N",J9=Zo.POLYFILL="P",Z9=Zo,Wm=Iv,Q9=sn,eU=Uo,tU=Wm(Wm.bind),Qo=function(i,r){return Q9(i),r===void 0?i:eU?tU(i,r):function(){return i.apply(r,arguments)}},Ht={},rU=Je,iU=ae,HE=rU&&iU(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),nU=Ze,aU=String,oU=TypeError,Vt=function(i){if(nU(i))return i;throw new oU(aU(i)+" is not an object")},sU=Je,uU=zE,lU=HE,Ws=Vt,Um=Rl,hU=TypeError,Ic=Object.defineProperty,cU=Object.getOwnPropertyDescriptor,kc="enumerable",Pc="configurable",xc="writable";Ht.f=sU?lU?function(r,e,t){if(Ws(r),e=Um(e),Ws(t),typeof r=="function"&&e==="prototype"&&"value"in t&&xc in t&&!t[xc]){var n=cU(r,e);n&&n[xc]&&(r[e]=t.value,t={configurable:Pc in t?t[Pc]:n[Pc],enumerable:kc in t?t[kc]:n[kc],writable:!1})}return Ic(r,e,t)}:Ic:function(r,e,t){if(Ws(r),e=Um(e),Ws(t),uU)try{return Ic(r,e,t)}catch{}if("get"in t||"set"in t)throw new hU("Accessors not supported");return"value"in t&&(r[e]=t.value),r};var dU=Je,fU=Ht,vU=Go,Pa=dU?function(i,r,e){return fU.f(i,r,vU(1,e))}:function(i,r,e){return i[r]=e,i},Us=Pe,pU=Ko,gU=Iv,yU=Xe,mU=Sa.f,bU=Z9,Sn=oe,$U=Qo,On=Pa,Km=Qe,wU=function(i){var r=function(e,t,n){if(this instanceof r){switch(arguments.length){case 0:return new i;case 1:return new i(e);case 2:return new i(e,t)}return new i(e,t,n)}return pU(i,this,arguments)};return r.prototype=i.prototype,r},q=function(i,r){var e=i.target,t=i.global,n=i.stat,a=i.proto,o=t?Us:n?Us[e]:(Us[e]||{}).prototype,s=t?Sn:Sn[e]||On(Sn,e,{})[e],u=s.prototype,l,h,c,d,f,v,p,g,y;for(d in r)l=bU(t?d:e+(n?".":"#")+d,i.forced),h=!l&&o&&Km(o,d),v=s[d],h&&(i.dontCallGetSet?(y=mU(o,d),p=y&&y.value):p=o[d]),f=h&&p?p:r[d],!(h&&typeof v==typeof f)&&(i.bind&&h?g=$U(f,Us):i.wrap&&h?g=wU(f):a&&yU(f)?g=gU(f):g=f,(i.sham||f&&f.sham||v&&v.sham)&&On(g,"sham",!0),On(s,d,g),a&&(c=e+"Prototype",Km(Sn,c)||On(Sn,c,{}),On(Sn[c],d,f),i.real&&u&&(l||!u[d])&&On(u,d,f)))},_U=Math.ceil,EU=Math.floor,SU=Math.trunc||function(r){var e=+r;return(e>0?EU:_U)(e)},OU=SU,Nl=function(i){var r=+i;return r!==r||r===0?0:OU(r)},TU=Nl,IU=Math.max,kU=Math.min,es=function(i,r){var e=TU(i);return e<0?IU(e+r,0):kU(e,r)},PU=Nl,xU=Math.min,CU=function(i){return i>0?xU(PU(i),9007199254740991):0},AU=CU,Zt=function(i){return AU(i.length)},DU=_r,RU=es,NU=Zt,Gm=function(i){return function(r,e,t){var n=DU(r),a=NU(n),o=RU(t,a),s;if(i&&e!==e){for(;a>o;)if(s=n[o++],s!==s)return!0}else for(;a>o;o++)if((i||o in n)&&n[o]===e)return i||o||0;return!i&&-1}},xv={includes:Gm(!0),indexOf:Gm(!1)},ts={},MU=se,Cc=Qe,BU=_r,FU=xv.indexOf,jU=ts,qm=MU([].push),VE=function(i,r){var e=BU(i),t=0,n=[],a;for(a in e)!Cc(jU,a)&&Cc(e,a)&&qm(n,a);for(;r.length>t;)Cc(e,a=r[t++])&&(~FU(n,a)||qm(n,a));return n},Cv=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],LU=VE,zU=Cv,Ml=Object.keys||function(r){return LU(r,zU)},rs={};rs.f=Object.getOwnPropertySymbols;var Ym=Je,HU=se,VU=zt,WU=ae,Ac=Ml,UU=rs,KU=Cl,GU=At,qU=Al,Tn=Object.assign,Xm=Object.defineProperty,YU=HU([].concat),XU=!Tn||WU(function(){if(Ym&&Tn({b:1},Tn(Xm({},"a",{enumerable:!0,get:function(){Xm(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var i={},r={},e=Symbol("assign detection"),t="abcdefghijklmnopqrst";return i[e]=7,t.split("").forEach(function(n){r[n]=n}),Tn({},i)[e]!==7||Ac(Tn({},r)).join("")!==t})?function(r,e){for(var t=GU(r),n=arguments.length,a=1,o=UU.f,s=KU.f;n>a;)for(var u=qU(arguments[a++]),l=o?YU(Ac(u),o(u)):Ac(u),h=l.length,c=0,d;h>c;)d=l[c++],(!Ym||VU(s,u,d))&&(t[d]=u[d]);return t}:Tn,JU=q,Jm=XU;JU({target:"Object",stat:!0,arity:2,forced:Object.assign!==Jm},{assign:Jm});var ZU=oe,QU=ZU.Object.assign,eK=QU,tK=eK,rK=tK,Le=V(rK),iK=se,Bl=iK([].slice),WE=se,nK=sn,aK=Ze,oK=Qe,Zm=Bl,sK=Uo,UE=Function,uK=WE([].concat),lK=WE([].join),Dc={},hK=function(i,r,e){if(!oK(Dc,r)){for(var t=[],n=0;n=.1;)v=+a[c++%o],v>h&&(v=h),f=Math.sqrt(v*v/(1+l*l)),f=s<0?-f:f,r+=f,e+=l*f,d===!0?i.lineTo(r,e):i.moveTo(r,e),h-=v,d=!d}function OK(i,r,e,t){i.beginPath();var n=6,a=Math.PI*2/n;i.moveTo(r+t,e);for(var o=1;o1?e-1:0),n=1;n=a?i?"":void 0:(o=tb(t,n),o<55296||o>56319||n+1===a||(s=tb(t,n+1))<56320||s>57343?i?HK(t,n):o:i?VK(t,n,n+2):(o-55296<<10)+(s-56320)+65536)}},WK={codeAt:rb(!1),charAt:rb(!0)},UK=Pe,KK=Xe,ib=UK.WeakMap,eS=KK(ib)&&/native code/.test(String(ib)),GK=ka,qK=Dl,nb=GK("keys"),Fl=function(i){return nb[i]||(nb[i]=qK(i))},YK=eS,tS=Pe,XK=Ze,JK=Pa,Nc=Qe,Mc=Pv,ZK=Fl,QK=ts,ab="Object already initialized",uf=tS.TypeError,eG=tS.WeakMap,Hu,yo,Vu,tG=function(i){return Vu(i)?yo(i):Hu(i,{})},rG=function(i){return function(r){var e;if(!XK(r)||(e=yo(r)).type!==i)throw new uf("Incompatible receiver, "+i+" required");return e}};if(YK||Mc.state){var cr=Mc.state||(Mc.state=new eG);cr.get=cr.get,cr.has=cr.has,cr.set=cr.set,Hu=function(i,r){if(cr.has(i))throw new uf(ab);return r.facade=i,cr.set(i,r),r},yo=function(i){return cr.get(i)||{}},Vu=function(i){return cr.has(i)}}else{var In=ZK("state");QK[In]=!0,Hu=function(i,r){if(Nc(i,In))throw new uf(ab);return r.facade=i,JK(i,In,r),r},yo=function(i){return Nc(i,In)?i[In]:{}},Vu=function(i){return Nc(i,In)}}var ln={set:Hu,get:yo,has:Vu,enforce:tG,getterFor:rG},lf=Je,iG=Qe,rS=Function.prototype,nG=lf&&Object.getOwnPropertyDescriptor,Nv=iG(rS,"name"),aG=Nv&&function(){}.name==="something",oG=Nv&&(!lf||lf&&nG(rS,"name").configurable),sG={EXISTS:Nv,PROPER:aG,CONFIGURABLE:oG},jl={},uG=Je,lG=HE,hG=Ht,cG=Vt,dG=_r,fG=Ml;jl.f=uG&&!lG?Object.defineProperties:function(r,e){cG(r);for(var t=dG(e),n=fG(e),a=n.length,o=0,s;a>o;)hG.f(r,s=n[o++],t[s]);return r};var vG=Jt,pG=vG("document","documentElement"),gG=Vt,yG=jl,ob=Cv,mG=ts,bG=pG,$G=LE,wG=Fl,sb=">",ub="<",hf="prototype",cf="script",iS=wG("IE_PROTO"),Bc=function(){},nS=function(i){return ub+cf+sb+i+ub+"/"+cf+sb},lb=function(i){i.write(nS("")),i.close();var r=i.parentWindow.Object;return i=null,r},_G=function(){var i=$G("iframe"),r="java"+cf+":",e;return i.style.display="none",bG.appendChild(i),i.src=String(r),e=i.contentWindow.document,e.open(),e.write(nS("document.F=Object")),e.close(),e.F},Ks,yu=function(){try{Ks=new ActiveXObject("htmlfile")}catch{}yu=typeof document<"u"?document.domain&&Ks?lb(Ks):_G():lb(Ks);for(var i=ob.length;i--;)delete yu[hf][ob[i]];return yu()};mG[iS]=!0;var xa=Object.create||function(r,e){var t;return r!==null?(Bc[hf]=gG(r),t=new Bc,Bc[hf]=null,t[iS]=r):t=yu(),e===void 0?t:yG.f(t,e)},EG=ae,aS=!EG(function(){function i(){}return i.prototype.constructor=null,Object.getPrototypeOf(new i)!==i.prototype}),SG=Qe,OG=Xe,TG=At,IG=Fl,kG=aS,hb=IG("IE_PROTO"),df=Object,PG=df.prototype,Ll=kG?df.getPrototypeOf:function(i){var r=TG(i);if(SG(r,hb))return r[hb];var e=r.constructor;return OG(e)&&r instanceof e?e.prototype:r instanceof df?PG:null},xG=Pa,is=function(i,r,e,t){return t&&t.enumerable?i[r]=e:xG(i,r,e),i},CG=ae,AG=Xe,DG=Ze,RG=xa,cb=Ll,NG=is,MG=xe,ff=MG("iterator"),oS=!1,Cr,Fc,jc;[].keys&&(jc=[].keys(),"next"in jc?(Fc=cb(cb(jc)),Fc!==Object.prototype&&(Cr=Fc)):oS=!0);var BG=!DG(Cr)||CG(function(){var i={};return Cr[ff].call(i)!==i});BG?Cr={}:Cr=RG(Cr);AG(Cr[ff])||NG(Cr,ff,function(){return this});var sS={IteratorPrototype:Cr,BUGGY_SAFARI_ITERATORS:oS},FG=Dv,jG=un,LG=FG?{}.toString:function(){return"[object "+jG(this)+"]"},zG=Dv,HG=Ht.f,VG=Pa,WG=Qe,UG=LG,KG=xe,db=KG("toStringTag"),Ca=function(i,r,e,t){if(i){var n=e?i:i.prototype;WG(n,db)||HG(n,db,{configurable:!0,value:r}),t&&!zG&&VG(n,"toString",UG)}},Aa={},GG=sS.IteratorPrototype,qG=xa,YG=Go,XG=Ca,JG=Aa,ZG=function(){return this},QG=function(i,r,e,t){var n=r+" Iterator";return i.prototype=qG(GG,{next:YG(+!t,e)}),XG(i,n,!1,!0),JG[n]=ZG,i},eq=se,tq=sn,rq=function(i,r,e){try{return eq(tq(Object.getOwnPropertyDescriptor(i,r)[e]))}catch{}},iq=Xe,nq=String,aq=TypeError,oq=function(i){if(typeof i=="object"||iq(i))return i;throw new aq("Can't set "+nq(i)+" as a prototype")},sq=rq,uq=Vt,lq=oq,hq=Object.setPrototypeOf||("__proto__"in{}?function(){var i=!1,r={},e;try{e=sq(Object.prototype,"__proto__","set"),e(r,[]),i=r instanceof Array}catch{}return function(n,a){return uq(n),lq(a),i?e(n,a):n.__proto__=a,n}}():void 0),cq=q,dq=zt,fq=sG,vq=QG,pq=Ll,gq=Ca,fb=is,yq=xe,vb=Aa,mq=sS,bq=fq.PROPER,Gs=mq.BUGGY_SAFARI_ITERATORS,Lc=yq("iterator"),pb="keys",qs="values",gb="entries",$q=function(){return this},Mv=function(i,r,e,t,n,a,o){vq(e,r,t);var s=function(y){if(y===n&&d)return d;if(!Gs&&y&&y in h)return h[y];switch(y){case pb:return function(){return new e(this,y)};case qs:return function(){return new e(this,y)};case gb:return function(){return new e(this,y)}}return function(){return new e(this)}},u=r+" Iterator",l=!1,h=i.prototype,c=h[Lc]||h["@@iterator"]||n&&h[n],d=!Gs&&c||s(n),f=r==="Array"&&h.entries||c,v,p,g;if(f&&(v=pq(f.call(new i)),v!==Object.prototype&&v.next&&(gq(v,u,!0,!0),vb[u]=$q)),bq&&n===qs&&c&&c.name!==qs&&(l=!0,d=function(){return dq(c,this)}),n)if(p={values:s(qs),keys:a?d:s(pb),entries:s(gb)},o)for(g in p)(Gs||l||!(g in h))&&fb(h,g,p[g]);else cq({target:r,proto:!0,forced:Gs||l},p);return o&&h[Lc]!==d&&fb(h,Lc,d,{name:n}),vb[r]=d,p},Bv=function(i,r){return{value:i,done:r}},wq=WK.charAt,_q=Er,uS=ln,Eq=Mv,yb=Bv,lS="String Iterator",Sq=uS.set,Oq=uS.getterFor(lS);Eq(String,"String",function(i){Sq(this,{type:lS,string:_q(i),index:0})},function(){var r=Oq(this),e=r.string,t=r.index,n;return t>=e.length?yb(void 0,!0):(n=wq(e,t),r.index+=n.length,yb(n,!1))});var Tq=zt,mb=Vt,Iq=kv,hS=function(i,r,e){var t,n;mb(i);try{if(t=Iq(i,"return"),!t){if(r==="throw")throw e;return e}t=Tq(t,i)}catch(a){n=!0,t=a}if(r==="throw")throw e;if(n)throw t;return mb(t),e},kq=Vt,Pq=hS,xq=function(i,r,e,t){try{return t?r(kq(e)[0],e[1]):r(e)}catch(n){Pq(i,"throw",n)}},Cq=xe,Aq=Aa,Dq=Cq("iterator"),Rq=Array.prototype,cS=function(i){return i!==void 0&&(Aq.Array===i||Rq[Dq]===i)},Nq=se,Mq=Xe,vf=Pv,Bq=Nq(Function.toString);Mq(vf.inspectSource)||(vf.inspectSource=function(i){return Bq(i)});var Fq=vf.inspectSource,jq=se,Lq=ae,dS=Xe,zq=un,Hq=Jt,Vq=Fq,fS=function(){},Wq=[],vS=Hq("Reflect","construct"),Fv=/^\s*(?:class|function)\b/,Uq=jq(Fv.exec),Kq=!Fv.test(fS),La=function(r){if(!dS(r))return!1;try{return vS(fS,Wq,r),!0}catch{return!1}},pS=function(r){if(!dS(r))return!1;switch(zq(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Kq||!!Uq(Fv,Vq(r))}catch{return!0}};pS.sham=!0;var zl=!vS||Lq(function(){var i;return La(La.call)||!La(Object)||!La(function(){i=!0})||i})?pS:La,Gq=Rl,qq=Ht,Yq=Go,Da=function(i,r,e){var t=Gq(r);t in i?qq.f(i,t,Yq(0,e)):i[t]=e},Xq=un,bb=kv,Jq=Oa,Zq=Aa,Qq=xe,eY=Qq("iterator"),Hl=function(i){if(!Jq(i))return bb(i,eY)||bb(i,"@@iterator")||Zq[Xq(i)]},tY=zt,rY=sn,iY=Vt,nY=Ia,aY=Hl,oY=TypeError,gS=function(i,r){var e=arguments.length<2?aY(i):r;if(rY(e))return iY(tY(e,i));throw new oY(nY(i)+" is not iterable")},sY=Qo,uY=zt,lY=At,hY=xq,cY=cS,dY=zl,fY=Zt,$b=Da,vY=gS,pY=Hl,wb=Array,gY=function(r){var e=lY(r),t=dY(this),n=arguments.length,a=n>1?arguments[1]:void 0,o=a!==void 0;o&&(a=sY(a,n>2?arguments[2]:void 0));var s=pY(e),u=0,l,h,c,d,f,v;if(s&&!(this===wb&&cY(s)))for(d=vY(e,s),f=d.next,h=t?new this:[];!(c=uY(f,d)).done;u++)v=o?hY(d,a,[c.value,u],!0):c.value,$b(h,u,v);else for(l=fY(e),h=t?new this(l):wb(l);l>u;u++)v=o?a(e[u],u):e[u],$b(h,u,v);return h.length=u,h},yY=xe,yS=yY("iterator"),mS=!1;try{var mY=0,_b={next:function(){return{done:!!mY++}},return:function(){mS=!0}};_b[yS]=function(){return this},Array.from(_b,function(){throw 2})}catch{}var bY=function(i,r){try{if(!r&&!mS)return!1}catch{return!1}var e=!1;try{var t={};t[yS]=function(){return{next:function(){return{done:e=!0}}}},i(t)}catch{}return e},$Y=q,wY=gY,_Y=bY,EY=!_Y(function(i){Array.from(i)});$Y({target:"Array",stat:!0,forced:EY},{from:wY});var SY=oe,OY=SY.Array.from,TY=OY,bS=TY,IY=bS,hn=V(IY),kY=_r,Eb=Aa,$S=ln;Ht.f;var PY=Mv,Ys=Bv,wS="Array Iterator",xY=$S.set,CY=$S.getterFor(wS);PY(Array,"Array",function(i,r){xY(this,{type:wS,target:kY(i),index:0,kind:r})},function(){var i=CY(this),r=i.target,e=i.kind,t=i.index++;if(!r||t>=r.length)return i.target=void 0,Ys(void 0,!0);switch(e){case"keys":return Ys(t,!1);case"values":return Ys(r[t],!1)}return Ys([t,r[t]],!1)},"values");Eb.Arguments=Eb.Array;var AY=Hl,DY=AY,RY={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},NY=RY,MY=Pe,BY=un,FY=Pa,Sb=Aa,jY=xe,Ob=jY("toStringTag");for(var zc in NY){var Tb=MY[zc],Hc=Tb&&Tb.prototype;Hc&&BY(Hc)!==Ob&&FY(Hc,Ob,zc),Sb[zc]=Sb.Array}var LY=DY,zY=LY,HY=zY,VY=HY,WY=VY,UY=WY,_S=UY,ES=V(_S),KY=_S,cn=V(KY);function N(i,r){if(!(i instanceof r))throw new TypeError("Cannot call a class as a function")}var SS={exports:{}},GY=q,qY=Je,Ib=Ht.f;GY({target:"Object",stat:!0,forced:Object.defineProperty!==Ib,sham:!qY},{defineProperty:Ib});var YY=oe,OS=YY.Object,XY=SS.exports=function(r,e,t){return OS.defineProperty(r,e,t)};OS.defineProperty.sham&&(XY.sham=!0);var JY=SS.exports,ZY=JY,TS=ZY,QY=TS,eX=QY,tX=eX,rX=tX,iX=rX,Vl=V(iX),nX=Hr,dn=Array.isArray||function(r){return nX(r)==="Array"},aX=TypeError,oX=9007199254740991,jv=function(i){if(i>oX)throw aX("Maximum allowed index exceeded");return i},kb=dn,sX=zl,uX=Ze,lX=xe,hX=lX("species"),Pb=Array,cX=function(i){var r;return kb(i)&&(r=i.constructor,sX(r)&&(r===Pb||kb(r.prototype))?r=void 0:uX(r)&&(r=r[hX],r===null&&(r=void 0))),r===void 0?Pb:r},dX=cX,Lv=function(i,r){return new(dX(i))(r===0?0:r)},fX=ae,vX=xe,pX=Xo,gX=vX("species"),ns=function(i){return pX>=51||!fX(function(){var r=[],e=r.constructor={};return e[gX]=function(){return{foo:1}},r[i](Boolean).foo!==1})},yX=q,mX=ae,bX=dn,$X=Ze,wX=At,_X=Zt,xb=jv,Cb=Da,EX=Lv,SX=ns,OX=xe,TX=Xo,IS=OX("isConcatSpreadable"),IX=TX>=51||!mX(function(){var i=[];return i[IS]=!1,i.concat()[0]!==i}),kX=function(i){if(!$X(i))return!1;var r=i[IS];return r!==void 0?!!r:bX(i)},PX=!IX||!SX("concat");yX({target:"Array",proto:!0,arity:1,forced:PX},{concat:function(r){var e=wX(this),t=EX(e,0),n=0,a,o,s,u,l;for(a=-1,s=arguments.length;ag;g++)if((s||g in f)&&($=f[g],b=v($,g,d),i))if(r)m[g]=b;else if(b)switch(i){case 3:return!0;case 5:return $;case 6:return g;case 2:Rb(m,$)}else switch(i){case 4:return!1;case 7:Rb(m,$)}return a?-1:t||n?n:m}},wi={forEach:qr(0),map:qr(1),filter:qr(2),some:qr(3),every:qr(4),find:qr(5),findIndex:qr(6),filterReject:qr(7)},Ul=q,Kl=Pe,Hv=zt,rJ=se,ra=Je,ia=Ta,iJ=ae,Ge=Qe,nJ=Be,pf=Vt,Gl=_r,Vv=Rl,aJ=Er,gf=Go,mo=xa,AS=Ml,oJ=as,DS=Wl,sJ=rs,RS=Sa,NS=Ht,uJ=jl,MS=Cl,Nb=is,lJ=zv,Wv=ka,hJ=Fl,BS=ts,Mb=Dl,cJ=xe,dJ=os,fJ=Ce,vJ=CS,pJ=Ca,FS=ln,ql=wi.forEach,Ot=hJ("hidden"),Yl="Symbol",bo="prototype",gJ=FS.set,Bb=FS.getterFor(Yl),or=Object[bo],Fi=Kl.Symbol,Ga=Fi&&Fi[bo],yJ=Kl.RangeError,mJ=Kl.TypeError,Vc=Kl.QObject,jS=RS.f,ji=NS.f,LS=DS.f,bJ=MS.f,zS=rJ([].push),Fr=Wv("symbols"),ss=Wv("op-symbols"),$J=Wv("wks"),yf=!Vc||!Vc[bo]||!Vc[bo].findChild,HS=function(i,r,e){var t=jS(or,r);t&&delete or[r],ji(i,r,e),t&&i!==or&&ji(or,r,t)},mf=ra&&iJ(function(){return mo(ji({},"a",{get:function(){return ji(this,"a",{value:7}).a}})).a!==7})?HS:ji,Wc=function(i,r){var e=Fr[i]=mo(Ga);return gJ(e,{type:Yl,tag:i,description:r}),ra||(e.description=r),e},Xl=function(r,e,t){r===or&&Xl(ss,e,t),pf(r);var n=Vv(e);return pf(t),Ge(Fr,n)?(t.enumerable?(Ge(r,Ot)&&r[Ot][n]&&(r[Ot][n]=!1),t=mo(t,{enumerable:gf(0,!1)})):(Ge(r,Ot)||ji(r,Ot,gf(1,{})),r[Ot][n]=!0),mf(r,n,t)):ji(r,n,t)},Uv=function(r,e){pf(r);var t=Gl(e),n=AS(t).concat(KS(t));return ql(n,function(a){(!ra||Hv(VS,t,a))&&Xl(r,a,t[a])}),r},wJ=function(r,e){return e===void 0?mo(r):Uv(mo(r),e)},VS=function(r){var e=Vv(r),t=Hv(bJ,this,e);return this===or&&Ge(Fr,e)&&!Ge(ss,e)?!1:t||!Ge(this,e)||!Ge(Fr,e)||Ge(this,Ot)&&this[Ot][e]?t:!0},WS=function(r,e){var t=Gl(r),n=Vv(e);if(!(t===or&&Ge(Fr,n)&&!Ge(ss,n))){var a=jS(t,n);return a&&Ge(Fr,n)&&!(Ge(t,Ot)&&t[Ot][n])&&(a.enumerable=!0),a}},US=function(r){var e=LS(Gl(r)),t=[];return ql(e,function(n){!Ge(Fr,n)&&!Ge(BS,n)&&zS(t,n)}),t},KS=function(i){var r=i===or,e=LS(r?ss:Gl(i)),t=[];return ql(e,function(n){Ge(Fr,n)&&(!r||Ge(or,n))&&zS(t,Fr[n])}),t};ia||(Fi=function(){if(nJ(Ga,this))throw new mJ("Symbol is not a constructor");var r=!arguments.length||arguments[0]===void 0?void 0:aJ(arguments[0]),e=Mb(r),t=function(n){this===or&&Hv(t,ss,n),Ge(this,Ot)&&Ge(this[Ot],e)&&(this[Ot][e]=!1);var a=gf(1,n);try{mf(this,e,a)}catch(o){if(!(o instanceof yJ))throw o;HS(this,e,a)}};return ra&&yf&&mf(or,e,{configurable:!0,set:t}),Wc(e,r)},Ga=Fi[bo],Nb(Ga,"toString",function(){return Bb(this).tag}),Nb(Fi,"withoutSetter",function(i){return Wc(Mb(i),i)}),MS.f=VS,NS.f=Xl,uJ.f=Uv,RS.f=WS,oJ.f=DS.f=US,sJ.f=KS,dJ.f=function(i){return Wc(cJ(i),i)},ra&&lJ(Ga,"description",{configurable:!0,get:function(){return Bb(this).description}}));Ul({global:!0,constructor:!0,wrap:!0,forced:!ia,sham:!ia},{Symbol:Fi});ql(AS($J),function(i){fJ(i)});Ul({target:Yl,stat:!0,forced:!ia},{useSetter:function(){yf=!0},useSimple:function(){yf=!1}});Ul({target:"Object",stat:!0,forced:!ia,sham:!ra},{create:wJ,defineProperty:Xl,defineProperties:Uv,getOwnPropertyDescriptor:WS});Ul({target:"Object",stat:!0,forced:!ia},{getOwnPropertyNames:US});vJ();pJ(Fi,Yl);BS[Ot]=!0;var _J=Ta,GS=_J&&!!Symbol.for&&!!Symbol.keyFor,EJ=q,SJ=Jt,OJ=Qe,TJ=Er,qS=ka,IJ=GS,Uc=qS("string-to-symbol-registry"),kJ=qS("symbol-to-string-registry");EJ({target:"Symbol",stat:!0,forced:!IJ},{for:function(i){var r=TJ(i);if(OJ(Uc,r))return Uc[r];var e=SJ("Symbol")(r);return Uc[r]=e,kJ[e]=r,e}});var PJ=q,xJ=Qe,CJ=Jo,AJ=Ia,DJ=ka,RJ=GS,Fb=DJ("symbol-to-string-registry");PJ({target:"Symbol",stat:!0,forced:!RJ},{keyFor:function(r){if(!CJ(r))throw new TypeError(AJ(r)+" is not a symbol");if(xJ(Fb,r))return Fb[r]}});var NJ=se,jb=dn,MJ=Xe,Lb=Hr,BJ=Er,zb=NJ([].push),FJ=function(i){if(MJ(i))return i;if(jb(i)){for(var r=i.length,e=[],t=0;ti.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?arguments[1]:void 0)}});var ute=et,lte=ute("Array").map,hte=Be,cte=lte,Jc=Array.prototype,dte=function(i){var r=i.map;return i===Jc||hte(Jc,i)&&r===Jc.map?cte:r},fte=dte,vte=fte,pte=vte,na=V(pte),gte=q,yte=At,dO=Ml,mte=ae,bte=mte(function(){dO(1)});gte({target:"Object",stat:!0,forced:bte},{keys:function(r){return dO(yte(r))}});var $te=oe,wte=$te.Object.keys,_te=wte,Ete=_te,Ste=Ete,Oe=V(Ste),Ote=q,Tte=se,fO=Date,Ite=Tte(fO.prototype.getTime);Ote({target:"Date",stat:!0},{now:function(){return Ite(new fO)}});var kte=oe,Pte=kte.Date.now,xte=Pte,Cte=xte,Ate=Cte,Uu=V(Ate),Dte=ae,Ra=function(i,r){var e=[][i];return!!e&&Dte(function(){e.call(null,r||function(){return 1},1)})},Rte=wi.forEach,Nte=Ra,Mte=Nte("forEach"),Bte=Mte?[].forEach:function(r){return Rte(this,r,arguments.length>1?arguments[1]:void 0)},Fte=q,n1=Bte;Fte({target:"Array",proto:!0,forced:[].forEach!==n1},{forEach:n1});var jte=et,Lte=jte("Array").forEach,zte=Lte,Hte=zte,Vte=un,Wte=Qe,Ute=Be,Kte=Hte,Zc=Array.prototype,Gte={DOMTokenList:!0,NodeList:!0},qte=function(i){var r=i.forEach;return i===Zc||Ute(Zc,i)&&r===Zc.forEach||Wte(Gte,Vte(i))?Kte:r},Yte=qte,fe=V(Yte),Xte=q,Jte=se,Zte=dn,Qte=Jte([].reverse),a1=[1,2];Xte({target:"Array",proto:!0,forced:String(a1)===String(a1.reverse())},{reverse:function(){return Zte(this)&&(this.length=this.length),Qte(this)}});var ere=et,tre=ere("Array").reverse,rre=Be,ire=tre,Qc=Array.prototype,nre=function(i){var r=i.reverse;return i===Qc||rre(Qc,i)&&r===Qc.reverse?ire:r},are=nre,ore=are,sre=ore,Li=V(sre),o1=Ia,ure=TypeError,vO=function(i,r){if(!delete i[r])throw new ure("Cannot delete property "+o1(r)+" of "+o1(i))},lre=q,hre=At,cre=es,dre=Nl,fre=Zt,vre=uO,pre=jv,gre=Lv,yre=Da,ed=vO,mre=ns,bre=mre("splice"),$re=Math.max,wre=Math.min;lre({target:"Array",proto:!0,forced:!bre},{splice:function(r,e){var t=hre(this),n=fre(t),a=cre(r,n),o=arguments.length,s,u,l,h,c,d;for(o===0?s=u=0:o===1?(s=0,u=n-a):(s=o-2,u=wre($re(dre(e),0),n-a)),pre(n+s-u),l=gre(t,u),h=0;hn-u+s;h--)ed(t,h-1)}else if(s>u)for(h=n-u;h>a;h--)c=h+u-1,d=h+s-1,c in t?t[d]=t[c]:ed(t,d);for(h=0;h1?arguments[1]:void 0)}});var Rre=et,Nre=Rre("Array").includes,Mre=Ze,Bre=Hr,Fre=xe,jre=Fre("match"),Lre=function(i){var r;return Mre(i)&&((r=i[jre])!==void 0?!!r:Bre(i)==="RegExp")},zre=Lre,Hre=TypeError,Vre=function(i){if(zre(i))throw new Hre("The method doesn't accept regular expressions");return i},Wre=xe,Ure=Wre("match"),Kre=function(i){var r=/./;try{"/./"[i](r)}catch{try{return r[Ure]=!1,"/./"[i](r)}catch{}}return!1},Gre=q,qre=se,Yre=Vre,Xre=qo,s1=Er,Jre=Kre,Zre=qre("".indexOf);Gre({target:"String",proto:!0,forced:!Jre("includes")},{includes:function(r){return!!~Zre(s1(Xre(this)),s1(Yre(r)),arguments.length>1?arguments[1]:void 0)}});var Qre=et,eie=Qre("String").includes,u1=Be,tie=Nre,rie=eie,rd=Array.prototype,id=String.prototype,iie=function(i){var r=i.includes;return i===rd||u1(rd,i)&&r===rd.includes?tie:typeof i=="string"||i===id||u1(id,i)&&r===id.includes?rie:r},nie=iie,aie=nie,oie=aie,hi=V(oie),sie=q,uie=ae,lie=At,pO=Ll,hie=aS,cie=uie(function(){pO(1)});sie({target:"Object",stat:!0,forced:cie,sham:!hie},{getPrototypeOf:function(r){return pO(lie(r))}});var die=oe,fie=die.Object.getPrototypeOf,vie=fie,gO=vie,pie=gO,l1=V(pie),gie=q,yie=wi.filter,mie=ns,bie=mie("filter");gie({target:"Array",proto:!0,forced:!bie},{filter:function(r){return yie(this,r,arguments.length>1?arguments[1]:void 0)}});var $ie=et,wie=$ie("Array").filter,_ie=Be,Eie=wie,nd=Array.prototype,Sie=function(i){var r=i.filter;return i===nd||_ie(nd,i)&&r===nd.filter?Eie:r},Oie=Sie,Tie=Oie,Iie=Tie,Tt=V(Iie),qv=` +\v\f\r                 \u2028\u2029\uFEFF`,kie=se,Pie=qo,xie=Er,$f=qv,h1=kie("".replace),Cie=RegExp("^["+$f+"]+"),Aie=RegExp("(^|[^"+$f+"])["+$f+"]+$"),ad=function(i){return function(r){var e=xie(Pie(r));return i&1&&(e=h1(e,Cie,"")),i&2&&(e=h1(e,Aie,"$1")),e}},yO={start:ad(1),end:ad(2),trim:ad(3)},mO=Pe,Die=ae,Rie=se,Nie=Er,Mie=yO.trim,c1=qv,eo=mO.parseInt,d1=mO.Symbol,f1=d1&&d1.iterator,bO=/^[+-]?0x/i,Bie=Rie(bO.exec),Fie=eo(c1+"08")!==8||eo(c1+"0x16")!==22||f1&&!Die(function(){eo(Object(f1))}),jie=Fie?function(r,e){var t=Mie(Nie(r));return eo(t,e>>>0||(Bie(bO,t)?16:10))}:eo,Lie=q,v1=jie;Lie({global:!0,forced:parseInt!==v1},{parseInt:v1});var zie=oe,Hie=zie.parseInt,Vie=Hie,Wie=Vie,Uie=Wie,nr=V(Uie),Kie=q,Gie=Iv,qie=xv.indexOf,Yie=Ra,wf=Gie([].indexOf),$O=!!wf&&1/wf([1],1,-0)<0,Xie=$O||!Yie("indexOf");Kie({target:"Array",proto:!0,forced:Xie},{indexOf:function(r){var e=arguments.length>1?arguments[1]:void 0;return $O?wf(this,r,e)||0:qie(this,r,e)}});var Jie=et,Zie=Jie("Array").indexOf,Qie=Be,ene=Zie,od=Array.prototype,tne=function(i){var r=i.indexOf;return i===od||Qie(od,i)&&r===od.indexOf?ene:r},rne=tne,ine=rne,nne=ine,ne=V(nne),ane=q,one=Je,sne=xa;ane({target:"Object",stat:!0,sham:!one},{create:sne});var une=oe,lne=une.Object,hne=function(r,e){return lne.create(r,e)},cne=hne,wO=cne,dne=wO,zi=V(dne),_f=oe,fne=Ko;_f.JSON||(_f.JSON={stringify:JSON.stringify});var vne=function(r,e,t){return fne(_f.JSON.stringify,null,arguments)},pne=vne,gne=pne,yne=gne,ls=V(yne),mne=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",bne=TypeError,$ne=function(i,r){if(ie,o=_ne(t)?t:Ine(t),s=a?One(arguments,e):[],u=a?function(){wne(o,this,s)}:o;return r?i(u,n):i(u)}:i},Pne=q,SO=Pe,xne=EO,p1=xne(SO.setInterval,!0);Pne({global:!0,bind:!0,forced:SO.setInterval!==p1},{setInterval:p1});var Cne=q,OO=Pe,Ane=EO,g1=Ane(OO.setTimeout,!0);Cne({global:!0,bind:!0,forced:OO.setTimeout!==g1},{setTimeout:g1});var Dne=oe,Rne=Dne.setTimeout,Nne=Rne,mr=V(Nne),Mne=At,y1=es,Bne=Zt,Fne=function(r){for(var e=Mne(this),t=Bne(e),n=arguments.length,a=y1(n>1?arguments[1]:void 0,t),o=n>2?arguments[2]:void 0,s=o===void 0?t:y1(o,t);s>a;)e[a++]=r;return e},jne=q,Lne=Fne;jne({target:"Array",proto:!0},{fill:Lne});var zne=et,Hne=zne("Array").fill,Vne=Be,Wne=Hne,sd=Array.prototype,Une=function(i){var r=i.fill;return i===sd||Vne(sd,i)&&r===sd.fill?Wne:r},Kne=Une,Gne=Kne,qne=Gne,hs=V(qne);/*! Hammer.JS - v2.0.17-rc - 2019-12-16 * http://naver.github.io/egjs * * Forked By Naver egjs * Copyright (c) hammerjs - * Licensed under the MIT license */function ur(){return ur=Object.assign||function(i){for(var r=1;r"u"?{style:{}}:document.createElement("div"),Jne="function",Hn=Math.round,Xi=Math.abs,Yv=Date.now;function Jl(i,r){for(var e,t,n=r[0].toUpperCase()+r.slice(1),a=0;a"u"?Dr={}:Dr=window;var TO=Jl(Xne.style,"touchAction"),IO=TO!==void 0;function Zne(){if(!IO)return!1;var i={},r=Dr.CSS&&Dr.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){return i[e]=r?Dr.CSS.supports("touch-action",e):!0}),i}var kO="compute",PO="auto",Sf="manipulation",Hi="none",$o="pan-x",wo="pan-y",Zs=Zne(),Qne=/mobile|tablet|ip(ad|hone|od)|android/i,xO="ontouchstart"in Dr,eae=Jl(Dr,"PointerEvent")!==void 0,tae=xO&&Qne.test(navigator.userAgent),cs="touch",rae="pen",Xv="mouse",iae="kinect",nae=25,yt=1,fn=2,ze=4,kt=8,Ku=1,ds=2,fs=4,vs=8,aa=16,br=ds|fs,Vi=vs|aa,CO=br|Vi,AO=["x","y"],Gu=["clientX","clientY"];function Rr(i,r,e){var t;if(i)if(i.forEach)i.forEach(r,e);else if(i.length!==void 0)for(t=0;t-1}function aae(i){if(Ai(i,Hi))return Hi;var r=Ai(i,$o),e=Ai(i,wo);return r&&e?Hi:r||e?r?$o:wo:Ai(i,Sf)?Sf:PO}var DO=function(){function i(e,t){this.manager=e,this.set(t)}var r=i.prototype;return r.set=function(t){t===kO&&(t=this.compute()),IO&&this.manager.element.style&&Zs[t]&&(this.manager.element.style[TO]=t),this.actions=t.toLowerCase().trim()},r.update=function(){this.set(this.manager.options.touchAction)},r.compute=function(){var t=[];return Rr(this.manager.recognizers,function(n){Zl(n.options.enable,[n])&&(t=t.concat(n.getTouchAction()))}),aae(t.join(" "))},r.preventDefaults=function(t){var n=t.srcEvent,a=t.offsetDirection;if(this.manager.session.prevented){n.preventDefault();return}var o=this.actions,s=Ai(o,Hi)&&!Zs[Hi],u=Ai(o,wo)&&!Zs[wo],l=Ai(o,$o)&&!Zs[$o];if(s){var h=t.pointers.length===1,c=t.distance<2,d=t.deltaTime<250;if(h&&c&&d)return}if(!(l&&u)&&(s||u&&a&br||l&&a&Vi))return this.preventSrc(n)},r.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},i}();function Jv(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}function RO(i){var r=i.length;if(r===1)return{x:Hn(i[0].clientX),y:Hn(i[0].clientY)};for(var e=0,t=0,n=0;n=Xi(r)?i<0?ds:fs:r<0?vs:aa}function oae(i,r){var e=r.center,t=i.offsetDelta||{},n=i.prevDelta||{},a=i.prevInput||{};(r.eventType===yt||a.eventType===ze)&&(n=i.prevDelta={x:a.deltaX||0,y:a.deltaY||0},t=i.offsetDelta={x:e.x,y:e.y}),r.deltaX=n.x+(e.x-t.x),r.deltaY=n.y+(e.y-t.y)}function MO(i,r,e){return{x:r/i||0,y:e/i||0}}function sae(i,r){return qu(r[0],r[1],Gu)/qu(i[0],i[1],Gu)}function uae(i,r){return Of(r[1],r[0],Gu)+Of(i[1],i[0],Gu)}function lae(i,r){var e=i.lastInterval||r,t=r.timeStamp-e.timeStamp,n,a,o,s;if(r.eventType!==kt&&(t>nae||e.velocity===void 0)){var u=r.deltaX-e.deltaX,l=r.deltaY-e.deltaY,h=MO(t,u,l);a=h.x,o=h.y,n=Xi(h.x)>Xi(h.y)?h.x:h.y,s=NO(u,l),i.lastInterval=r}else n=e.velocity,a=e.velocityX,o=e.velocityY,s=e.direction;r.velocity=n,r.velocityX=a,r.velocityY=o,r.direction=s}function hae(i,r){var e=i.session,t=r.pointers,n=t.length;e.firstInput||(e.firstInput=b1(r)),n>1&&!e.firstMultiple?e.firstMultiple=b1(r):n===1&&(e.firstMultiple=!1);var a=e.firstInput,o=e.firstMultiple,s=o?o.center:a.center,u=r.center=RO(t);r.timeStamp=Yv(),r.deltaTime=r.timeStamp-a.timeStamp,r.angle=Of(s,u),r.distance=qu(s,u),oae(e,r),r.offsetDirection=NO(r.deltaX,r.deltaY);var l=MO(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=l.x,r.overallVelocityY=l.y,r.overallVelocity=Xi(l.x)>Xi(l.y)?l.x:l.y,r.scale=o?sae(o.pointers,t):1,r.rotation=o?uae(o.pointers,t):0,r.maxPointers=e.prevInput?r.pointers.length>e.prevInput.maxPointers?r.pointers.length:e.prevInput.maxPointers:r.pointers.length,lae(e,r);var h=i.element,c=r.srcEvent,d;c.composedPath?d=c.composedPath()[0]:c.path?d=c.path[0]:d=c.target,Jv(d,h)&&(h=d),r.target=h}function cae(i,r,e){var t=e.pointers.length,n=e.changedPointers.length,a=r&yt&&t-n===0,o=r&(ze|kt)&&t-n===0;e.isFirst=!!a,e.isFinal=!!o,a&&(i.session={}),e.eventType=r,hae(i,e),i.emit("hammer.input",e),i.recognize(e),i.session.prevInput=e}function _o(i){return i.trim().split(/\s+/g)}function to(i,r,e){Rr(_o(r),function(t){i.addEventListener(t,e,!1)})}function ro(i,r,e){Rr(_o(r),function(t){i.removeEventListener(t,e,!1)})}function $1(i){var r=i.ownerDocument||i;return r.defaultView||r.parentWindow||window}var Na=function(){function i(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(a){Zl(e.options.enable,[e])&&n.handler(a)},this.init()}var r=i.prototype;return r.handler=function(){},r.init=function(){this.evEl&&to(this.element,this.evEl,this.domHandler),this.evTarget&&to(this.target,this.evTarget,this.domHandler),this.evWin&&to($1(this.element),this.evWin,this.domHandler)},r.destroy=function(){this.evEl&&ro(this.element,this.evEl,this.domHandler),this.evTarget&&ro(this.target,this.evTarget,this.domHandler),this.evWin&&ro($1(this.element),this.evWin,this.domHandler)},i}();function Ji(i,r,e){if(i.indexOf&&!e)return i.indexOf(r);for(var t=0;tu[r]}):t=t.sort()),t}var vae={touchstart:yt,touchmove:fn,touchend:ze,touchcancel:kt},pae="touchstart touchmove touchend touchcancel",Qv=function(i){Qt(r,i);function r(){var t;return r.prototype.evTarget=pae,t=i.apply(this,arguments)||this,t.targetIds={},t}var e=r.prototype;return e.handler=function(n){var a=vae[n.type],o=gae.call(this,n,a);o&&this.callback(this.manager,a,{pointers:o[0],changedPointers:o[1],pointerType:cs,srcEvent:n})},r}(Na);function gae(i,r){var e=Eo(i.touches),t=this.targetIds;if(r&(yt|fn)&&e.length===1)return t[e[0].identifier]=!0,[e,e];var n,a,o=Eo(i.changedTouches),s=[],u=this.target;if(a=e.filter(function(l){return Jv(l.target,u)}),r===yt)for(n=0;n-1&&n.splice(s,1)};setTimeout(a,$ae)}}function wae(i,r){i&yt?(this.primaryTouch=r.changedPointers[0].identifier,_1.call(this,r)):i&(ze|kt)&&_1.call(this,r)}function _ae(i){for(var r=i.srcEvent.clientX,e=i.srcEvent.clientY,t=0;t-1&&this.requireFail.splice(n,1),this},r.hasRequireFailures=function(){return this.requireFail.length>0},r.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},r.emit=function(t){var n=this,a=this.state;function o(s){n.manager.emit(s,t)}a=ci&&o(n.options.event+E1(a))},r.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=pr},r.canEmit=function(){for(var t=0;ta.threshold&&u&a.direction},e.attrTest=function(n){return sa.prototype.attrTest.call(this,n)&&(this.state&Yt||!(this.state&Yt)&&this.directionTest(n))},e.emit=function(n){this.pX=n.deltaX,this.pY=n.deltaY;var a=zO(n.direction);a&&(n.additionalEvent=this.options.event+a),i.prototype.emit.call(this,n)},r}(sa),HO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"swipe",threshold:10,velocity:.3,direction:br|Vi,pointers:1},t))||this}var e=r.prototype;return e.getTouchAction=function(){return tp.prototype.getTouchAction.call(this)},e.attrTest=function(n){var a=this.options.direction,o;return a&(br|Vi)?o=n.overallVelocity:a&br?o=n.overallVelocityX:a&Vi&&(o=n.overallVelocityY),i.prototype.attrTest.call(this,n)&&a&n.offsetDirection&&n.distance>this.options.threshold&&n.maxPointers===this.options.pointers&&Xi(o)>this.options.velocity&&n.eventType&ze},e.emit=function(n){var a=zO(n.offsetDirection);a&&this.manager.emit(this.options.event+a,n),this.manager.emit(this.options.event,n)},r}(sa),VO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"pinch",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Hi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.scale-1)>this.options.threshold||this.state&Yt)},e.emit=function(n){if(n.scale!==1){var a=n.scale<1?"in":"out";n.additionalEvent=this.options.event+a}i.prototype.emit.call(this,n)},r}(sa),WO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"rotate",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Hi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.rotation)>this.options.threshold||this.state&Yt)},r}(sa),UO=function(i){Qt(r,i);function r(t){var n;return t===void 0&&(t={}),n=i.call(this,ur({event:"press",pointers:1,time:251,threshold:9},t))||this,n._timer=null,n._input=null,n}var e=r.prototype;return e.getTouchAction=function(){return[PO]},e.process=function(n){var a=this,o=this.options,s=n.pointers.length===o.pointers,u=n.distanceo.time;if(this._input=n,!u||!s||n.eventType&(ze|kt)&&!l)this.reset();else if(n.eventType&yt)this.reset(),this._timer=setTimeout(function(){a.state=Nr,a.tryEmit()},o.time);else if(n.eventType&ze)return Nr;return pr},e.reset=function(){clearTimeout(this._timer)},e.emit=function(n){this.state===Nr&&(n&&n.eventType&ze?this.manager.emit(this.options.event+"up",n):(this._input.timeStamp=Yv(),this.manager.emit(this.options.event,this._input)))},r}(ps),KO={domEvents:!1,touchAction:kO,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},S1=[[WO,{enable:!1}],[VO,{enable:!1},["rotate"]],[HO,{direction:br}],[tp,{direction:br},["swipe"]],[Tf],[Tf,{event:"doubletap",taps:2},["tap"]],[UO]],Tae=1,O1=2;function T1(i,r){var e=i.element;if(e.style){var t;Rr(i.options.cssProps,function(n,a){t=Jl(e.style,a),r?(i.oldCssProps[t]=e.style[t],e.style[t]=n):e.style[t]=i.oldCssProps[t]||""}),r||(i.oldCssProps={})}}function Iae(i,r){var e=document.createEvent("Event");e.initEvent(i,!0,!0),e.gesture=r,r.target.dispatchEvent(e)}var I1=function(){function i(e,t){var n=this;this.options=Yi({},KO,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=Eae(this),this.touchAction=new DO(this,this.options.touchAction),T1(this,!0),Rr(this.options.recognizers,function(a){var o=n.add(new a[0](a[1]));a[2]&&o.recognizeWith(a[2]),a[3]&&o.requireFailure(a[3])},this)}var r=i.prototype;return r.set=function(t){return Yi(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},r.stop=function(t){this.session.stopped=t?O1:Tae},r.recognize=function(t){var n=this.session;if(!n.stopped){this.touchAction.preventDefaults(t);var a,o=this.recognizers,s=n.curRecognizer;(!s||s&&s.state&Nr)&&(n.curRecognizer=null,s=null);for(var u=0;u"u"?{style:{}}:document.createElement("div"),Xne="function",Hn=Math.round,Xi=Math.abs,Yv=Date.now;function Jl(i,r){for(var e,t,n=r[0].toUpperCase()+r.slice(1),a=0;a"u"?Dr={}:Dr=window;var TO=Jl(Yne.style,"touchAction"),IO=TO!==void 0;function Jne(){if(!IO)return!1;var i={},r=Dr.CSS&&Dr.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){return i[e]=r?Dr.CSS.supports("touch-action",e):!0}),i}var kO="compute",PO="auto",Sf="manipulation",Hi="none",$o="pan-x",wo="pan-y",Zs=Jne(),Zne=/mobile|tablet|ip(ad|hone|od)|android/i,xO="ontouchstart"in Dr,Qne=Jl(Dr,"PointerEvent")!==void 0,eae=xO&&Zne.test(navigator.userAgent),cs="touch",tae="pen",Xv="mouse",rae="kinect",iae=25,yt=1,fn=2,ze=4,kt=8,Ku=1,ds=2,fs=4,vs=8,aa=16,br=ds|fs,Vi=vs|aa,CO=br|Vi,AO=["x","y"],Gu=["clientX","clientY"];function Rr(i,r,e){var t;if(i)if(i.forEach)i.forEach(r,e);else if(i.length!==void 0)for(t=0;t-1}function nae(i){if(Ai(i,Hi))return Hi;var r=Ai(i,$o),e=Ai(i,wo);return r&&e?Hi:r||e?r?$o:wo:Ai(i,Sf)?Sf:PO}var DO=function(){function i(e,t){this.manager=e,this.set(t)}var r=i.prototype;return r.set=function(t){t===kO&&(t=this.compute()),IO&&this.manager.element.style&&Zs[t]&&(this.manager.element.style[TO]=t),this.actions=t.toLowerCase().trim()},r.update=function(){this.set(this.manager.options.touchAction)},r.compute=function(){var t=[];return Rr(this.manager.recognizers,function(n){Zl(n.options.enable,[n])&&(t=t.concat(n.getTouchAction()))}),nae(t.join(" "))},r.preventDefaults=function(t){var n=t.srcEvent,a=t.offsetDirection;if(this.manager.session.prevented){n.preventDefault();return}var o=this.actions,s=Ai(o,Hi)&&!Zs[Hi],u=Ai(o,wo)&&!Zs[wo],l=Ai(o,$o)&&!Zs[$o];if(s){var h=t.pointers.length===1,c=t.distance<2,d=t.deltaTime<250;if(h&&c&&d)return}if(!(l&&u)&&(s||u&&a&br||l&&a&Vi))return this.preventSrc(n)},r.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},i}();function Jv(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}function RO(i){var r=i.length;if(r===1)return{x:Hn(i[0].clientX),y:Hn(i[0].clientY)};for(var e=0,t=0,n=0;n=Xi(r)?i<0?ds:fs:r<0?vs:aa}function aae(i,r){var e=r.center,t=i.offsetDelta||{},n=i.prevDelta||{},a=i.prevInput||{};(r.eventType===yt||a.eventType===ze)&&(n=i.prevDelta={x:a.deltaX||0,y:a.deltaY||0},t=i.offsetDelta={x:e.x,y:e.y}),r.deltaX=n.x+(e.x-t.x),r.deltaY=n.y+(e.y-t.y)}function MO(i,r,e){return{x:r/i||0,y:e/i||0}}function oae(i,r){return qu(r[0],r[1],Gu)/qu(i[0],i[1],Gu)}function sae(i,r){return Of(r[1],r[0],Gu)+Of(i[1],i[0],Gu)}function uae(i,r){var e=i.lastInterval||r,t=r.timeStamp-e.timeStamp,n,a,o,s;if(r.eventType!==kt&&(t>iae||e.velocity===void 0)){var u=r.deltaX-e.deltaX,l=r.deltaY-e.deltaY,h=MO(t,u,l);a=h.x,o=h.y,n=Xi(h.x)>Xi(h.y)?h.x:h.y,s=NO(u,l),i.lastInterval=r}else n=e.velocity,a=e.velocityX,o=e.velocityY,s=e.direction;r.velocity=n,r.velocityX=a,r.velocityY=o,r.direction=s}function lae(i,r){var e=i.session,t=r.pointers,n=t.length;e.firstInput||(e.firstInput=b1(r)),n>1&&!e.firstMultiple?e.firstMultiple=b1(r):n===1&&(e.firstMultiple=!1);var a=e.firstInput,o=e.firstMultiple,s=o?o.center:a.center,u=r.center=RO(t);r.timeStamp=Yv(),r.deltaTime=r.timeStamp-a.timeStamp,r.angle=Of(s,u),r.distance=qu(s,u),aae(e,r),r.offsetDirection=NO(r.deltaX,r.deltaY);var l=MO(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=l.x,r.overallVelocityY=l.y,r.overallVelocity=Xi(l.x)>Xi(l.y)?l.x:l.y,r.scale=o?oae(o.pointers,t):1,r.rotation=o?sae(o.pointers,t):0,r.maxPointers=e.prevInput?r.pointers.length>e.prevInput.maxPointers?r.pointers.length:e.prevInput.maxPointers:r.pointers.length,uae(e,r);var h=i.element,c=r.srcEvent,d;c.composedPath?d=c.composedPath()[0]:c.path?d=c.path[0]:d=c.target,Jv(d,h)&&(h=d),r.target=h}function hae(i,r,e){var t=e.pointers.length,n=e.changedPointers.length,a=r&yt&&t-n===0,o=r&(ze|kt)&&t-n===0;e.isFirst=!!a,e.isFinal=!!o,a&&(i.session={}),e.eventType=r,lae(i,e),i.emit("hammer.input",e),i.recognize(e),i.session.prevInput=e}function _o(i){return i.trim().split(/\s+/g)}function to(i,r,e){Rr(_o(r),function(t){i.addEventListener(t,e,!1)})}function ro(i,r,e){Rr(_o(r),function(t){i.removeEventListener(t,e,!1)})}function $1(i){var r=i.ownerDocument||i;return r.defaultView||r.parentWindow||window}var Na=function(){function i(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(a){Zl(e.options.enable,[e])&&n.handler(a)},this.init()}var r=i.prototype;return r.handler=function(){},r.init=function(){this.evEl&&to(this.element,this.evEl,this.domHandler),this.evTarget&&to(this.target,this.evTarget,this.domHandler),this.evWin&&to($1(this.element),this.evWin,this.domHandler)},r.destroy=function(){this.evEl&&ro(this.element,this.evEl,this.domHandler),this.evTarget&&ro(this.target,this.evTarget,this.domHandler),this.evWin&&ro($1(this.element),this.evWin,this.domHandler)},i}();function Ji(i,r,e){if(i.indexOf&&!e)return i.indexOf(r);for(var t=0;tu[r]}):t=t.sort()),t}var fae={touchstart:yt,touchmove:fn,touchend:ze,touchcancel:kt},vae="touchstart touchmove touchend touchcancel",Qv=function(i){Qt(r,i);function r(){var t;return r.prototype.evTarget=vae,t=i.apply(this,arguments)||this,t.targetIds={},t}var e=r.prototype;return e.handler=function(n){var a=fae[n.type],o=pae.call(this,n,a);o&&this.callback(this.manager,a,{pointers:o[0],changedPointers:o[1],pointerType:cs,srcEvent:n})},r}(Na);function pae(i,r){var e=Eo(i.touches),t=this.targetIds;if(r&(yt|fn)&&e.length===1)return t[e[0].identifier]=!0,[e,e];var n,a,o=Eo(i.changedTouches),s=[],u=this.target;if(a=e.filter(function(l){return Jv(l.target,u)}),r===yt)for(n=0;n-1&&n.splice(s,1)};setTimeout(a,bae)}}function $ae(i,r){i&yt?(this.primaryTouch=r.changedPointers[0].identifier,_1.call(this,r)):i&(ze|kt)&&_1.call(this,r)}function wae(i){for(var r=i.srcEvent.clientX,e=i.srcEvent.clientY,t=0;t-1&&this.requireFail.splice(n,1),this},r.hasRequireFailures=function(){return this.requireFail.length>0},r.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},r.emit=function(t){var n=this,a=this.state;function o(s){n.manager.emit(s,t)}a=ci&&o(n.options.event+E1(a))},r.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=pr},r.canEmit=function(){for(var t=0;ta.threshold&&u&a.direction},e.attrTest=function(n){return sa.prototype.attrTest.call(this,n)&&(this.state&Yt||!(this.state&Yt)&&this.directionTest(n))},e.emit=function(n){this.pX=n.deltaX,this.pY=n.deltaY;var a=zO(n.direction);a&&(n.additionalEvent=this.options.event+a),i.prototype.emit.call(this,n)},r}(sa),HO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"swipe",threshold:10,velocity:.3,direction:br|Vi,pointers:1},t))||this}var e=r.prototype;return e.getTouchAction=function(){return tp.prototype.getTouchAction.call(this)},e.attrTest=function(n){var a=this.options.direction,o;return a&(br|Vi)?o=n.overallVelocity:a&br?o=n.overallVelocityX:a&Vi&&(o=n.overallVelocityY),i.prototype.attrTest.call(this,n)&&a&n.offsetDirection&&n.distance>this.options.threshold&&n.maxPointers===this.options.pointers&&Xi(o)>this.options.velocity&&n.eventType&ze},e.emit=function(n){var a=zO(n.offsetDirection);a&&this.manager.emit(this.options.event+a,n),this.manager.emit(this.options.event,n)},r}(sa),VO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"pinch",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Hi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.scale-1)>this.options.threshold||this.state&Yt)},e.emit=function(n){if(n.scale!==1){var a=n.scale<1?"in":"out";n.additionalEvent=this.options.event+a}i.prototype.emit.call(this,n)},r}(sa),WO=function(i){Qt(r,i);function r(t){return t===void 0&&(t={}),i.call(this,ur({event:"rotate",threshold:0,pointers:2},t))||this}var e=r.prototype;return e.getTouchAction=function(){return[Hi]},e.attrTest=function(n){return i.prototype.attrTest.call(this,n)&&(Math.abs(n.rotation)>this.options.threshold||this.state&Yt)},r}(sa),UO=function(i){Qt(r,i);function r(t){var n;return t===void 0&&(t={}),n=i.call(this,ur({event:"press",pointers:1,time:251,threshold:9},t))||this,n._timer=null,n._input=null,n}var e=r.prototype;return e.getTouchAction=function(){return[PO]},e.process=function(n){var a=this,o=this.options,s=n.pointers.length===o.pointers,u=n.distanceo.time;if(this._input=n,!u||!s||n.eventType&(ze|kt)&&!l)this.reset();else if(n.eventType&yt)this.reset(),this._timer=setTimeout(function(){a.state=Nr,a.tryEmit()},o.time);else if(n.eventType&ze)return Nr;return pr},e.reset=function(){clearTimeout(this._timer)},e.emit=function(n){this.state===Nr&&(n&&n.eventType&ze?this.manager.emit(this.options.event+"up",n):(this._input.timeStamp=Yv(),this.manager.emit(this.options.event,this._input)))},r}(ps),KO={domEvents:!1,touchAction:kO,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},S1=[[WO,{enable:!1}],[VO,{enable:!1},["rotate"]],[HO,{direction:br}],[tp,{direction:br},["swipe"]],[Tf],[Tf,{event:"doubletap",taps:2},["tap"]],[UO]],Oae=1,O1=2;function T1(i,r){var e=i.element;if(e.style){var t;Rr(i.options.cssProps,function(n,a){t=Jl(e.style,a),r?(i.oldCssProps[t]=e.style[t],e.style[t]=n):e.style[t]=i.oldCssProps[t]||""}),r||(i.oldCssProps={})}}function Tae(i,r){var e=document.createEvent("Event");e.initEvent(i,!0,!0),e.gesture=r,r.target.dispatchEvent(e)}var I1=function(){function i(e,t){var n=this;this.options=Yi({},KO,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=_ae(this),this.touchAction=new DO(this,this.options.touchAction),T1(this,!0),Rr(this.options.recognizers,function(a){var o=n.add(new a[0](a[1]));a[2]&&o.recognizeWith(a[2]),a[3]&&o.requireFailure(a[3])},this)}var r=i.prototype;return r.set=function(t){return Yi(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},r.stop=function(t){this.session.stopped=t?O1:Oae},r.recognize=function(t){var n=this.session;if(!n.stopped){this.touchAction.preventDefaults(t);var a,o=this.recognizers,s=n.curRecognizer;(!s||s&&s.state&Nr)&&(n.curRecognizer=null,s=null);for(var u=0;u\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=window.console&&(window.console.warn||window.console.log);return o&&o.call(window.console,t,a),i.apply(this,arguments)}}var qO=GO(function(i,r,e){for(var t=Object.keys(r),n=0;n=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Mae(i,r){var e;if(i){if(typeof i=="string")return P1(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return P1(i,r)}}function P1(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e>>0,n-=i,n*=i,i=n>>>0,n-=i,i+=n*4294967296}return(i>>>0)*23283064365386963e-26}}function Lae(){var i=function(){};return{on:i,off:i,destroy:i,emit:i,get:function(){return{set:i}}}}var rp=typeof window<"u"?window.Hammer||Nae:function(){return Lae()};function gr(i){var r=this,e;this._cleanupQueue=[],this.active=!1,this._dom={container:i,overlay:document.createElement("div")},this._dom.overlay.classList.add("vis-overlay"),this._dom.container.appendChild(this._dom.overlay),this._cleanupQueue.push(function(){r._dom.overlay.parentNode.removeChild(r._dom.overlay)});var t=rp(this._dom.overlay);t.on("tap",k(e=this._onTapOverlay).call(e,this)),this._cleanupQueue.push(function(){t.destroy()});var n=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];fe(n).call(n,function(a){t.on(a,function(o){o.srcEvent.stopPropagation()})}),document&&document.body&&(this._onClick=function(a){zae(a.target,i)||r.deactivate()},document.body.addEventListener("click",this._onClick),this._cleanupQueue.push(function(){document.body.removeEventListener("click",r._onClick)})),this._escListener=function(a){("key"in a?a.key==="Escape":a.keyCode===27)&&r.deactivate()}}ZE(gr.prototype);gr.current=null;gr.prototype.destroy=function(){var i,r;this.deactivate();var e=XO(Li(i=Ar(r=this._cleanupQueue).call(r,0)).call(i)),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n()}}catch(a){e.e(a)}finally{e.f()}};gr.prototype.activate=function(){gr.current&&gr.current.deactivate(),gr.current=this,this.active=!0,this._dom.overlay.style.display="none",this._dom.container.classList.add("vis-active"),this.emit("change"),this.emit("activate"),document.body.addEventListener("keydown",this._escListener)};gr.prototype.deactivate=function(){this.active=!1,this._dom.overlay.style.display="block",this._dom.container.classList.remove("vis-active"),document.body.removeEventListener("keydown",this._escListener),this.emit("change"),this.emit("deactivate")};gr.prototype._onTapOverlay=function(i){this.activate(),i.srcEvent.stopPropagation()};function zae(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}var Hae=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Vae=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Wae=/^rgb\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *\)$/i,Uae=/^rgba\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *([01]|0?\.\d+) *\)$/i;function Zr(i){if(i)for(;i.hasChildNodes()===!0;){var r=i.firstChild;r&&(Zr(r),i.removeChild(r))}}function Kn(i){return i instanceof String||typeof i=="string"}function x1(i){return de(i)==="object"&&i!==null}function Zi(i,r,e,t){var n=!1;t===!0&&(n=r[e]===null&&i[e]!==void 0),n?delete i[e]:i[e]=r[e]}function JO(i,r){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;for(var t in i)if(r[t]!==void 0)if(r[t]===null||de(r[t])!=="object")Zi(i,r,t,e);else{var n=i[t],a=r[t];x1(n)&&x1(a)&&JO(n,a,e)}}function Ma(i,r,e){var t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(he(e))throw new TypeError("Arrays are not supported by deepExtend");for(var n=0;n3&&arguments[3]!==void 0?arguments[3]:!1;if(he(e))throw new TypeError("Arrays are not supported by deepExtend");for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&!hi(i).call(i,n))if(e[n]&&e[n].constructor===Object)r[n]===void 0&&(r[n]={}),r[n].constructor===Object?pe(r[n],e[n]):Zi(r,e,n,t);else if(he(e[n])){r[n]=[];for(var a=0;a2&&arguments[2]!==void 0?arguments[2]:!1,t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)||e===!0)if(de(r[n])==="object"&&r[n]!==null&&l1(r[n])===Object.prototype)i[n]===void 0?i[n]=pe({},r[n],e):de(i[n])==="object"&&i[n]!==null&&l1(i[n])===Object.prototype?pe(i[n],r[n],e):Zi(i,r,n,t);else if(he(r[n])){var a;i[n]=it(a=r[n]).call(a)}else Zi(i,r,n,t);return i}function Xu(i,r){var e;return Gv(e=[]).call(e,fr(i),[r])}function Kae(i){return it(i).call(i)}function Gae(i){return i.getBoundingClientRect().left}function qae(i){return i.getBoundingClientRect().top}function te(i,r){if(he(i))for(var e=i.length,t=0;t3&&arguments[3]!==void 0?arguments[3]:{},n=function(v){return v!=null},a=function(v){return v!==null&&de(v)==="object"},o=function(v){for(var p in v)if(Object.prototype.hasOwnProperty.call(v,p))return!1;return!0};if(!a(i))throw new Error("Parameter mergeTarget must be an object");if(!a(r))throw new Error("Parameter options must be an object");if(!n(e))throw new Error("Parameter option must have a value");if(!a(t))throw new Error("Parameter globalOptions must be an object");var s=function(v,p,g){a(v[g])||(v[g]={});var y=p[g],m=v[g];for(var $ in y)Object.prototype.hasOwnProperty.call(y,$)&&(m[$]=y[$])},u=r[e],l=a(t)&&!o(t),h=l?t[e]:void 0,c=h?h.enabled:void 0;if(u!==void 0){if(typeof u=="boolean"){a(i[e])||(i[e]={}),i[e].enabled=u;return}if(u===null&&!a(i[e]))if(n(h))i[e]=zi(h);else return;if(a(u)){var d=!0;u.enabled!==void 0?d=u.enabled:c!==void 0&&(d=h.enabled),s(i,r,e),i[e].enabled=d}}}var Jae={linear:function(r){return r},easeInQuad:function(r){return r*r},easeOutQuad:function(r){return r*(2-r)},easeInOutQuad:function(r){return r<.5?2*r*r:-1+(4-2*r)*r},easeInCubic:function(r){return r*r*r},easeOutCubic:function(r){return--r*r*r+1},easeInOutCubic:function(r){return r<.5?4*r*r*r:(r-1)*(2*r-2)*(2*r-2)+1},easeInQuart:function(r){return r*r*r*r},easeOutQuart:function(r){return 1- --r*r*r*r},easeInOutQuart:function(r){return r<.5?8*r*r*r*r:1-8*--r*r*r*r},easeInQuint:function(r){return r*r*r*r*r},easeOutQuint:function(r){return 1+--r*r*r*r*r},easeInOutQuint:function(r){return r<.5?16*r*r*r*r*r:1+16*--r*r*r*r*r}};function Qr(i,r){var e;he(r)||(r=[r]);var t=XO(i),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;if(a){e=a[r[0]];for(var o=1;o0&&arguments[0]!==void 0?arguments[0]:1;N(this,i),this.pixelRatio=r,this.generated=!1,this.centerCoordinates={x:289/2,y:289/2},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return M(i,[{key:"insertTo",value:function(e){this.hammer!==void 0&&(this.hammer.destroy(),this.hammer=void 0),this.container=e,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(e){if(typeof e=="function")this.updateCallback=e;else throw new Error("Function attempted to set as colorPicker update callback is not a function.")}},{key:"setCloseCallback",value:function(e){if(typeof e=="function")this.closeCallback=e;else throw new Error("Function attempted to set as colorPicker closing callback is not a function.")}},{key:"_isColorString",value:function(e){if(typeof e=="string")return Zae[e]}},{key:"setColor",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e!=="none"){var n,a=this._isColorString(e);if(a!==void 0&&(e=a),Kn(e)===!0){if(eT(e)===!0){var o=e.substr(4).substr(0,e.length-5).split(",");n={r:o[0],g:o[1],b:o[2],a:1}}else if(Xae(e)===!0){var s=e.substr(5).substr(0,e.length-6).split(",");n={r:s[0],g:s[1],b:s[2],a:s[3]}}else if(QO(e)===!0){var u=ip(e);n={r:u.r,g:u.g,b:u.b,a:1}}}else if(e instanceof Object&&e.r!==void 0&&e.g!==void 0&&e.b!==void 0){var l=e.a!==void 0?e.a:"1.0";n={r:e.r,g:e.g,b:e.b,a:l}}if(n===void 0)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+ls(e));this._setColor(n,t)}}},{key:"show",value:function(){this.closeCallback!==void 0&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;t===!0&&(this.previousColor=Le({},this.color)),this.applied===!0&&this.updateCallback(this.initialColor),this.frame.style.display="none",mr(function(){e.closeCallback!==void 0&&(e.closeCallback(),e.closeCallback=void 0)},0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){this.previousColor!==void 0?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;t===!0&&(this.initialColor=Le({},e)),this.color=e;var n=qa(e.r,e.g,e.b),a=2*Math.PI,o=this.r*n.s,s=this.centerCoordinates.x+o*Math.sin(a*n.h),u=this.centerCoordinates.y+o*Math.cos(a*n.h);this.colorPickerSelector.style.left=s-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=u-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(e)}},{key:"_setOpacity",value:function(e){this.color.a=e/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(e){var t=qa(this.color.r,this.color.g,this.color.b);t.v=e/100;var n=bu(t.h,t.s,t.v);n.a=this.color.a,this.color=n,this._updatePicker()}},{key:"_updatePicker",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.color,t=qa(e.r,e.g,e.b),n=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1)),n.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var a=this.colorPickerCanvas.clientWidth,o=this.colorPickerCanvas.clientHeight;n.clearRect(0,0,a,o),n.putImageData(this.hueCircle,0,0),n.fillStyle="rgba(0,0,0,"+(1-t.v)+")",n.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),hs(n).call(n),this.brightnessRange.value=100*t.v,this.opacityRange.value=100*e.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){var e,t,n,a;if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var s=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(s.webkitBackingStorePixelRatio||s.mozBackingStorePixelRatio||s.msBackingStorePixelRatio||s.oBackingStorePixelRatio||s.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var o=document.createElement("DIV");o.style.color="red",o.style.fontWeight="bold",o.style.padding="10px",o.innerText="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(o)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch{}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch{}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var u=this;this.opacityRange.onchange=function(){u._setOpacity(this.value)},this.opacityRange.oninput=function(){u._setOpacity(this.value)},this.brightnessRange.onchange=function(){u._setBrightness(this.value)},this.brightnessRange.oninput=function(){u._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerText="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerText="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerText="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerText="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerText="cancel",this.cancelButton.onclick=k(e=this._hide).call(e,this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerText="apply",this.applyButton.onclick=k(t=this._apply).call(t,this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerText="save",this.saveButton.onclick=k(n=this._save).call(n,this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerText="load last",this.loadButton.onclick=k(a=this._loadLast).call(a,this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var e=this;this.drag={},this.pinch={},this.hammer=new rp(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("hammer.input",function(t){t.isFirst&&e._moveSelector(t)}),this.hammer.on("tap",function(t){e._moveSelector(t)}),this.hammer.on("panstart",function(t){e._moveSelector(t)}),this.hammer.on("panmove",function(t){e._moveSelector(t)}),this.hammer.on("panend",function(t){e._moveSelector(t)})}},{key:"_generateHueCircle",value:function(){if(this.generated===!1){var e=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)),e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var t=this.colorPickerCanvas.clientWidth,n=this.colorPickerCanvas.clientHeight;e.clearRect(0,0,t,n);var a,o,s,u;this.centerCoordinates={x:t*.5,y:n*.5},this.r=.49*t;var l=2*Math.PI/360,h=1/360,c=1/this.r,d;for(s=0;s<360;s++)for(u=0;u3&&arguments[3]!==void 0?arguments[3]:1,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:function(){return!1};N(this,i),this.parent=r,this.changedOptions=[],this.container=e,this.allowCreation=!1,this.hideOption=a,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},Le(this.options,this.defaultOptions),this.configureOptions=t,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new Qae(n),this.wrapper=void 0}return M(i,[{key:"setOptions",value:function(e){if(e!==void 0){this.popupHistory={},this._removePopup();var t=!0;if(typeof e=="string")this.options.filter=e;else if(he(e))this.options.filter=e.join();else if(de(e)==="object"){if(e==null)throw new TypeError("options cannot be null");e.container!==void 0&&(this.options.container=e.container),Tt(e)!==void 0&&(this.options.filter=Tt(e)),e.showButton!==void 0&&(this.options.showButton=e.showButton),e.enabled!==void 0&&(t=e.enabled)}else typeof e=="boolean"?(this.options.filter=!0,t=e):typeof e=="function"&&(this.options.filter=e,t=!0);Tt(this.options)===!1&&(t=!1),this.options.enabled=t}this._clean()}},{key:"setModuleOptions",value:function(e){this.moduleOptions=e,this.options.enabled===!0&&(this._clean(),this.options.container!==void 0&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){this._clean(),this.changedOptions=[];var e=Tt(this.options),t=0,n=!1;for(var a in this.configureOptions)Object.prototype.hasOwnProperty.call(this.configureOptions,a)&&(this.allowCreation=!1,n=!1,typeof e=="function"?(n=e(a,[]),n=n||this._handleObject(this.configureOptions[a],[a],!0)):(e===!0||ne(e).call(e,a)!==-1)&&(n=!0),n!==!1&&(this.allowCreation=!0,t>0&&this._makeItem([]),this._makeHeader(a),this._handleObject(this.configureOptions[a],[a])),t++);this._makeButton(),this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var e=0;e1?n-1:0),o=1;o2&&arguments[2]!==void 0?arguments[2]:!1,a=document.createElement("div");if(a.className="vis-configuration vis-config-label vis-config-s"+t.length,n===!0){for(;a.firstChild;)a.removeChild(a.firstChild);a.appendChild(Pf("i","b",e))}else a.innerText=e+":";return a}},{key:"_makeDropdown",value:function(e,t,n){var a=document.createElement("select");a.className="vis-configuration vis-config-select";var o=0;t!==void 0&&ne(e).call(e,t)!==-1&&(o=ne(e).call(e,t));for(var s=0;ss&&s!==1&&(l.max=Math.ceil(t*d),c=l.max,h="range increased"),l.value=t}else l.value=a;var f=document.createElement("input");f.className="vis-configuration vis-config-rangeinput",f.value=l.value;var v=this;l.onchange=function(){f.value=this.value,v._update(Number(this.value),n)},l.oninput=function(){f.value=this.value};var p=this._makeLabel(n[n.length-1],n),g=this._makeItem(n,p,l,f);h!==""&&this.popupHistory[g]!==c&&(this.popupHistory[g]=c,this._setupPopup(h,g))}},{key:"_makeButton",value:function(){var e=this;if(this.options.showButton===!0){var t=document.createElement("div");t.className="vis-configuration vis-config-button",t.innerText="generate options",t.onclick=function(){e._printOptions()},t.onmouseover=function(){t.className="vis-configuration vis-config-button hover"},t.onmouseout=function(){t.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(t)}}},{key:"_setupPopup",value:function(e,t){var n=this;if(this.initialized===!0&&this.allowCreation===!0&&this.popupCounter1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=!1,o=Tt(this.options),s=!1;for(var u in e)if(Object.prototype.hasOwnProperty.call(e,u)){a=!0;var l=e[u],h=Xu(t,u);if(typeof o=="function"&&(a=o(u,t),a===!1&&!he(l)&&typeof l!="string"&&typeof l!="boolean"&&l instanceof Object&&(this.allowCreation=!1,a=this._handleObject(l,h,!0),this.allowCreation=n===!1)),a!==!1){s=!0;var c=this._getValue(h);if(he(l))this._handleArray(l,c,h);else if(typeof l=="string")this._makeTextInput(l,c,h);else if(typeof l=="boolean")this._makeCheckbox(l,c,h);else if(l instanceof Object){if(!this.hideOption(t,u,this.moduleOptions))if(l.enabled!==void 0){var d=Xu(h,"enabled"),f=this._getValue(d);if(f===!0){var v=this._makeLabel(u,h,!0);this._makeItem(h,v),s=this._handleObject(l,h)||s}else this._makeCheckbox(l,f,h)}else{var p=this._makeLabel(u,h,!0);this._makeItem(h,p),s=this._handleObject(l,h)||s}}else console.error("dont know how to handle",l,u,h)}}return s}},{key:"_handleArray",value:function(e,t,n){typeof e[0]=="string"&&e[0]==="color"?(this._makeColorField(e,t,n),e[1]!==t&&this.changedOptions.push({path:n,value:t})):typeof e[0]=="string"?(this._makeDropdown(e,t,n),e[0]!==t&&this.changedOptions.push({path:n,value:t})):typeof e[0]=="number"&&(this._makeRange(e,t,n),e[0]!==t&&this.changedOptions.push({path:n,value:Number(t)}))}},{key:"_update",value:function(e,t){var n=this._constructOptions(e,t);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",n),this.initialized=!0,this.parent.setOptions(n)}},{key:"_constructOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=n;e=e==="true"?!0:e,e=e==="false"?!1:e;for(var o=0;oo-this.padding&&(l=!0),l?s=this.x-n:s=this.x,h?u=this.y-t:u=this.y}else u=this.y-t,u+t+this.padding>a&&(u=a-t-this.padding),uo&&(s=o-n-this.padding),s\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=window.console&&(window.console.warn||window.console.log);return o&&o.call(window.console,t,a),i.apply(this,arguments)}}var qO=GO(function(i,r,e){for(var t=Object.keys(r),n=0;n=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Nae(i,r){var e;if(i){if(typeof i=="string")return P1(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return P1(i,r)}}function P1(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e>>0,n-=i,n*=i,i=n>>>0,n-=i,i+=n*4294967296}return(i>>>0)*23283064365386963e-26}}function jae(){var i=function(){};return{on:i,off:i,destroy:i,emit:i,get:function(){return{set:i}}}}var rp=typeof window<"u"?window.Hammer||Rae:function(){return jae()};function gr(i){var r=this,e;this._cleanupQueue=[],this.active=!1,this._dom={container:i,overlay:document.createElement("div")},this._dom.overlay.classList.add("vis-overlay"),this._dom.container.appendChild(this._dom.overlay),this._cleanupQueue.push(function(){r._dom.overlay.parentNode.removeChild(r._dom.overlay)});var t=rp(this._dom.overlay);t.on("tap",k(e=this._onTapOverlay).call(e,this)),this._cleanupQueue.push(function(){t.destroy()});var n=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];fe(n).call(n,function(a){t.on(a,function(o){o.srcEvent.stopPropagation()})}),document&&document.body&&(this._onClick=function(a){Lae(a.target,i)||r.deactivate()},document.body.addEventListener("click",this._onClick),this._cleanupQueue.push(function(){document.body.removeEventListener("click",r._onClick)})),this._escListener=function(a){("key"in a?a.key==="Escape":a.keyCode===27)&&r.deactivate()}}ZE(gr.prototype);gr.current=null;gr.prototype.destroy=function(){var i,r;this.deactivate();var e=XO(Li(i=Ar(r=this._cleanupQueue).call(r,0)).call(i)),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n()}}catch(a){e.e(a)}finally{e.f()}};gr.prototype.activate=function(){gr.current&&gr.current.deactivate(),gr.current=this,this.active=!0,this._dom.overlay.style.display="none",this._dom.container.classList.add("vis-active"),this.emit("change"),this.emit("activate"),document.body.addEventListener("keydown",this._escListener)};gr.prototype.deactivate=function(){this.active=!1,this._dom.overlay.style.display="block",this._dom.container.classList.remove("vis-active"),document.body.removeEventListener("keydown",this._escListener),this.emit("change"),this.emit("deactivate")};gr.prototype._onTapOverlay=function(i){this.activate(),i.srcEvent.stopPropagation()};function Lae(i,r){for(;i;){if(i===r)return!0;i=i.parentNode}return!1}var zae=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Hae=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Vae=/^rgb\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *\)$/i,Wae=/^rgba\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *([01]|0?\.\d+) *\)$/i;function Zr(i){if(i)for(;i.hasChildNodes()===!0;){var r=i.firstChild;r&&(Zr(r),i.removeChild(r))}}function Kn(i){return i instanceof String||typeof i=="string"}function x1(i){return de(i)==="object"&&i!==null}function Zi(i,r,e,t){var n=!1;t===!0&&(n=r[e]===null&&i[e]!==void 0),n?delete i[e]:i[e]=r[e]}function JO(i,r){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;for(var t in i)if(r[t]!==void 0)if(r[t]===null||de(r[t])!=="object")Zi(i,r,t,e);else{var n=i[t],a=r[t];x1(n)&&x1(a)&&JO(n,a,e)}}function Ma(i,r,e){var t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(he(e))throw new TypeError("Arrays are not supported by deepExtend");for(var n=0;n3&&arguments[3]!==void 0?arguments[3]:!1;if(he(e))throw new TypeError("Arrays are not supported by deepExtend");for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&!hi(i).call(i,n))if(e[n]&&e[n].constructor===Object)r[n]===void 0&&(r[n]={}),r[n].constructor===Object?pe(r[n],e[n]):Zi(r,e,n,t);else if(he(e[n])){r[n]=[];for(var a=0;a2&&arguments[2]!==void 0?arguments[2]:!1,t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)||e===!0)if(de(r[n])==="object"&&r[n]!==null&&l1(r[n])===Object.prototype)i[n]===void 0?i[n]=pe({},r[n],e):de(i[n])==="object"&&i[n]!==null&&l1(i[n])===Object.prototype?pe(i[n],r[n],e):Zi(i,r,n,t);else if(he(r[n])){var a;i[n]=it(a=r[n]).call(a)}else Zi(i,r,n,t);return i}function Xu(i,r){var e;return Gv(e=[]).call(e,fr(i),[r])}function Uae(i){return it(i).call(i)}function Kae(i){return i.getBoundingClientRect().left}function Gae(i){return i.getBoundingClientRect().top}function te(i,r){if(he(i))for(var e=i.length,t=0;t3&&arguments[3]!==void 0?arguments[3]:{},n=function(v){return v!=null},a=function(v){return v!==null&&de(v)==="object"},o=function(v){for(var p in v)if(Object.prototype.hasOwnProperty.call(v,p))return!1;return!0};if(!a(i))throw new Error("Parameter mergeTarget must be an object");if(!a(r))throw new Error("Parameter options must be an object");if(!n(e))throw new Error("Parameter option must have a value");if(!a(t))throw new Error("Parameter globalOptions must be an object");var s=function(v,p,g){a(v[g])||(v[g]={});var y=p[g],m=v[g];for(var $ in y)Object.prototype.hasOwnProperty.call(y,$)&&(m[$]=y[$])},u=r[e],l=a(t)&&!o(t),h=l?t[e]:void 0,c=h?h.enabled:void 0;if(u!==void 0){if(typeof u=="boolean"){a(i[e])||(i[e]={}),i[e].enabled=u;return}if(u===null&&!a(i[e]))if(n(h))i[e]=zi(h);else return;if(a(u)){var d=!0;u.enabled!==void 0?d=u.enabled:c!==void 0&&(d=h.enabled),s(i,r,e),i[e].enabled=d}}}var Xae={linear:function(r){return r},easeInQuad:function(r){return r*r},easeOutQuad:function(r){return r*(2-r)},easeInOutQuad:function(r){return r<.5?2*r*r:-1+(4-2*r)*r},easeInCubic:function(r){return r*r*r},easeOutCubic:function(r){return--r*r*r+1},easeInOutCubic:function(r){return r<.5?4*r*r*r:(r-1)*(2*r-2)*(2*r-2)+1},easeInQuart:function(r){return r*r*r*r},easeOutQuart:function(r){return 1- --r*r*r*r},easeInOutQuart:function(r){return r<.5?8*r*r*r*r:1-8*--r*r*r*r},easeInQuint:function(r){return r*r*r*r*r},easeOutQuint:function(r){return 1+--r*r*r*r*r},easeInOutQuint:function(r){return r<.5?16*r*r*r*r*r:1+16*--r*r*r*r*r}};function Qr(i,r){var e;he(r)||(r=[r]);var t=XO(i),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;if(a){e=a[r[0]];for(var o=1;o0&&arguments[0]!==void 0?arguments[0]:1;N(this,i),this.pixelRatio=r,this.generated=!1,this.centerCoordinates={x:289/2,y:289/2},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return M(i,[{key:"insertTo",value:function(e){this.hammer!==void 0&&(this.hammer.destroy(),this.hammer=void 0),this.container=e,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(e){if(typeof e=="function")this.updateCallback=e;else throw new Error("Function attempted to set as colorPicker update callback is not a function.")}},{key:"setCloseCallback",value:function(e){if(typeof e=="function")this.closeCallback=e;else throw new Error("Function attempted to set as colorPicker closing callback is not a function.")}},{key:"_isColorString",value:function(e){if(typeof e=="string")return Jae[e]}},{key:"setColor",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e!=="none"){var n,a=this._isColorString(e);if(a!==void 0&&(e=a),Kn(e)===!0){if(eT(e)===!0){var o=e.substr(4).substr(0,e.length-5).split(",");n={r:o[0],g:o[1],b:o[2],a:1}}else if(Yae(e)===!0){var s=e.substr(5).substr(0,e.length-6).split(",");n={r:s[0],g:s[1],b:s[2],a:s[3]}}else if(QO(e)===!0){var u=ip(e);n={r:u.r,g:u.g,b:u.b,a:1}}}else if(e instanceof Object&&e.r!==void 0&&e.g!==void 0&&e.b!==void 0){var l=e.a!==void 0?e.a:"1.0";n={r:e.r,g:e.g,b:e.b,a:l}}if(n===void 0)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+ls(e));this._setColor(n,t)}}},{key:"show",value:function(){this.closeCallback!==void 0&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;t===!0&&(this.previousColor=Le({},this.color)),this.applied===!0&&this.updateCallback(this.initialColor),this.frame.style.display="none",mr(function(){e.closeCallback!==void 0&&(e.closeCallback(),e.closeCallback=void 0)},0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){this.previousColor!==void 0?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;t===!0&&(this.initialColor=Le({},e)),this.color=e;var n=qa(e.r,e.g,e.b),a=2*Math.PI,o=this.r*n.s,s=this.centerCoordinates.x+o*Math.sin(a*n.h),u=this.centerCoordinates.y+o*Math.cos(a*n.h);this.colorPickerSelector.style.left=s-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=u-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(e)}},{key:"_setOpacity",value:function(e){this.color.a=e/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(e){var t=qa(this.color.r,this.color.g,this.color.b);t.v=e/100;var n=bu(t.h,t.s,t.v);n.a=this.color.a,this.color=n,this._updatePicker()}},{key:"_updatePicker",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.color,t=qa(e.r,e.g,e.b),n=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1)),n.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var a=this.colorPickerCanvas.clientWidth,o=this.colorPickerCanvas.clientHeight;n.clearRect(0,0,a,o),n.putImageData(this.hueCircle,0,0),n.fillStyle="rgba(0,0,0,"+(1-t.v)+")",n.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),hs(n).call(n),this.brightnessRange.value=100*t.v,this.opacityRange.value=100*e.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){var e,t,n,a;if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var s=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(s.webkitBackingStorePixelRatio||s.mozBackingStorePixelRatio||s.msBackingStorePixelRatio||s.oBackingStorePixelRatio||s.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var o=document.createElement("DIV");o.style.color="red",o.style.fontWeight="bold",o.style.padding="10px",o.innerText="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(o)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch{}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch{}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var u=this;this.opacityRange.onchange=function(){u._setOpacity(this.value)},this.opacityRange.oninput=function(){u._setOpacity(this.value)},this.brightnessRange.onchange=function(){u._setBrightness(this.value)},this.brightnessRange.oninput=function(){u._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerText="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerText="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerText="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerText="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerText="cancel",this.cancelButton.onclick=k(e=this._hide).call(e,this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerText="apply",this.applyButton.onclick=k(t=this._apply).call(t,this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerText="save",this.saveButton.onclick=k(n=this._save).call(n,this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerText="load last",this.loadButton.onclick=k(a=this._loadLast).call(a,this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var e=this;this.drag={},this.pinch={},this.hammer=new rp(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("hammer.input",function(t){t.isFirst&&e._moveSelector(t)}),this.hammer.on("tap",function(t){e._moveSelector(t)}),this.hammer.on("panstart",function(t){e._moveSelector(t)}),this.hammer.on("panmove",function(t){e._moveSelector(t)}),this.hammer.on("panend",function(t){e._moveSelector(t)})}},{key:"_generateHueCircle",value:function(){if(this.generated===!1){var e=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)),e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var t=this.colorPickerCanvas.clientWidth,n=this.colorPickerCanvas.clientHeight;e.clearRect(0,0,t,n);var a,o,s,u;this.centerCoordinates={x:t*.5,y:n*.5},this.r=.49*t;var l=2*Math.PI/360,h=1/360,c=1/this.r,d;for(s=0;s<360;s++)for(u=0;u3&&arguments[3]!==void 0?arguments[3]:1,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:function(){return!1};N(this,i),this.parent=r,this.changedOptions=[],this.container=e,this.allowCreation=!1,this.hideOption=a,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},Le(this.options,this.defaultOptions),this.configureOptions=t,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new Zae(n),this.wrapper=void 0}return M(i,[{key:"setOptions",value:function(e){if(e!==void 0){this.popupHistory={},this._removePopup();var t=!0;if(typeof e=="string")this.options.filter=e;else if(he(e))this.options.filter=e.join();else if(de(e)==="object"){if(e==null)throw new TypeError("options cannot be null");e.container!==void 0&&(this.options.container=e.container),Tt(e)!==void 0&&(this.options.filter=Tt(e)),e.showButton!==void 0&&(this.options.showButton=e.showButton),e.enabled!==void 0&&(t=e.enabled)}else typeof e=="boolean"?(this.options.filter=!0,t=e):typeof e=="function"&&(this.options.filter=e,t=!0);Tt(this.options)===!1&&(t=!1),this.options.enabled=t}this._clean()}},{key:"setModuleOptions",value:function(e){this.moduleOptions=e,this.options.enabled===!0&&(this._clean(),this.options.container!==void 0&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){this._clean(),this.changedOptions=[];var e=Tt(this.options),t=0,n=!1;for(var a in this.configureOptions)Object.prototype.hasOwnProperty.call(this.configureOptions,a)&&(this.allowCreation=!1,n=!1,typeof e=="function"?(n=e(a,[]),n=n||this._handleObject(this.configureOptions[a],[a],!0)):(e===!0||ne(e).call(e,a)!==-1)&&(n=!0),n!==!1&&(this.allowCreation=!0,t>0&&this._makeItem([]),this._makeHeader(a),this._handleObject(this.configureOptions[a],[a])),t++);this._makeButton(),this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var e=0;e1?n-1:0),o=1;o2&&arguments[2]!==void 0?arguments[2]:!1,a=document.createElement("div");if(a.className="vis-configuration vis-config-label vis-config-s"+t.length,n===!0){for(;a.firstChild;)a.removeChild(a.firstChild);a.appendChild(Pf("i","b",e))}else a.innerText=e+":";return a}},{key:"_makeDropdown",value:function(e,t,n){var a=document.createElement("select");a.className="vis-configuration vis-config-select";var o=0;t!==void 0&&ne(e).call(e,t)!==-1&&(o=ne(e).call(e,t));for(var s=0;ss&&s!==1&&(l.max=Math.ceil(t*d),c=l.max,h="range increased"),l.value=t}else l.value=a;var f=document.createElement("input");f.className="vis-configuration vis-config-rangeinput",f.value=l.value;var v=this;l.onchange=function(){f.value=this.value,v._update(Number(this.value),n)},l.oninput=function(){f.value=this.value};var p=this._makeLabel(n[n.length-1],n),g=this._makeItem(n,p,l,f);h!==""&&this.popupHistory[g]!==c&&(this.popupHistory[g]=c,this._setupPopup(h,g))}},{key:"_makeButton",value:function(){var e=this;if(this.options.showButton===!0){var t=document.createElement("div");t.className="vis-configuration vis-config-button",t.innerText="generate options",t.onclick=function(){e._printOptions()},t.onmouseover=function(){t.className="vis-configuration vis-config-button hover"},t.onmouseout=function(){t.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(t)}}},{key:"_setupPopup",value:function(e,t){var n=this;if(this.initialized===!0&&this.allowCreation===!0&&this.popupCounter1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=!1,o=Tt(this.options),s=!1;for(var u in e)if(Object.prototype.hasOwnProperty.call(e,u)){a=!0;var l=e[u],h=Xu(t,u);if(typeof o=="function"&&(a=o(u,t),a===!1&&!he(l)&&typeof l!="string"&&typeof l!="boolean"&&l instanceof Object&&(this.allowCreation=!1,a=this._handleObject(l,h,!0),this.allowCreation=n===!1)),a!==!1){s=!0;var c=this._getValue(h);if(he(l))this._handleArray(l,c,h);else if(typeof l=="string")this._makeTextInput(l,c,h);else if(typeof l=="boolean")this._makeCheckbox(l,c,h);else if(l instanceof Object){if(!this.hideOption(t,u,this.moduleOptions))if(l.enabled!==void 0){var d=Xu(h,"enabled"),f=this._getValue(d);if(f===!0){var v=this._makeLabel(u,h,!0);this._makeItem(h,v),s=this._handleObject(l,h)||s}else this._makeCheckbox(l,f,h)}else{var p=this._makeLabel(u,h,!0);this._makeItem(h,p),s=this._handleObject(l,h)||s}}else console.error("dont know how to handle",l,u,h)}}return s}},{key:"_handleArray",value:function(e,t,n){typeof e[0]=="string"&&e[0]==="color"?(this._makeColorField(e,t,n),e[1]!==t&&this.changedOptions.push({path:n,value:t})):typeof e[0]=="string"?(this._makeDropdown(e,t,n),e[0]!==t&&this.changedOptions.push({path:n,value:t})):typeof e[0]=="number"&&(this._makeRange(e,t,n),e[0]!==t&&this.changedOptions.push({path:n,value:Number(t)}))}},{key:"_update",value:function(e,t){var n=this._constructOptions(e,t);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",n),this.initialized=!0,this.parent.setOptions(n)}},{key:"_constructOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=n;e=e==="true"?!0:e,e=e==="false"?!1:e;for(var o=0;oo-this.padding&&(l=!0),l?s=this.x-n:s=this.x,h?u=this.y-t:u=this.y}else u=this.y-t,u+t+this.padding>a&&(u=a-t-this.padding),uo&&(s=o-n-this.padding),so.distance?l=" in "+i.printLocation(a.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+i.printLocation(o.path,o.closestMatch,""):a.distance<=s?l='. Did you mean "'+a.closestMatch+'"?'+i.printLocation(a.path,e):l=". Did you mean one of these: "+i.print(Oe(t))+i.printLocation(n,e),console.error('%cUnknown option detected: "'+e+'"'+l,xf),za=!0}},{key:"findInOptions",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=1e9,s="",u=[],l=e.toLowerCase(),h=void 0;for(var c in t){var d=void 0;if(t[c].__type__!==void 0&&a===!0){var f=i.findInOptions(e,t[c],Xu(n,c));o>f.distance&&(s=f.closestMatch,u=f.path,o=f.distance,h=f.indexMatch)}else{var v;ne(v=c.toLowerCase()).call(v,l)!==-1&&(h=c),d=i.levenshteinDistance(e,c),o>d&&(s=c,u=Kae(n),o=d)}}return{closestMatch:s,path:u,distance:o,indexMatch:h}}},{key:"printLocation",value:function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`Problem value found at: +`:o.distance<=u&&a.distance>o.distance?l=" in "+i.printLocation(a.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+i.printLocation(o.path,o.closestMatch,""):a.distance<=s?l='. Did you mean "'+a.closestMatch+'"?'+i.printLocation(a.path,e):l=". Did you mean one of these: "+i.print(Oe(t))+i.printLocation(n,e),console.error('%cUnknown option detected: "'+e+'"'+l,xf),za=!0}},{key:"findInOptions",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=1e9,s="",u=[],l=e.toLowerCase(),h=void 0;for(var c in t){var d=void 0;if(t[c].__type__!==void 0&&a===!0){var f=i.findInOptions(e,t[c],Xu(n,c));o>f.distance&&(s=f.closestMatch,u=f.path,o=f.distance,h=f.indexMatch)}else{var v;ne(v=c.toLowerCase()).call(v,l)!==-1&&(h=c),d=i.levenshteinDistance(e,c),o>d&&(s=c,u=Uae(n),o=d)}}return{closestMatch:s,path:u,distance:o,indexMatch:h}}},{key:"printLocation",value:function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`Problem value found at: `,a=` `+n+`options = { @@ -126,27 +136,27 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `;for(var l=0;l":!0,"--":!0},ri="",ua=0,ee="",G="",_t=ft.NULL;function uoe(){ua=0,ee=ri.charAt(0)}function Ue(){ua++,ee=ri.charAt(ua)}function kn(){return ri.charAt(ua+1)}function D1(i){var r=i.charCodeAt(0);return r<47?r===35||r===46:r<59?r>47:r<91?r>64:r<96?r===95:r<123?r>96:!1}function vi(i,r){if(i||(i={}),r)for(var e in r)r.hasOwnProperty(e)&&(i[e]=r[e]);return i}function loe(i,r,e){for(var t=r.split("."),n=i;t.length;){var a=t.shift();t.length?(n[a]||(n[a]={}),n=n[a]):n[a]=e}}function iT(i,r){for(var e,t,n=null,a=[i],o=i;o.parent;)a.push(o.parent),o=o.parent;if(o.nodes){for(e=0,t=o.nodes.length;e=0;e--){var s,u=a[e];u.nodes||(u.nodes=[]),ne(s=u.nodes).call(s,n)===-1&&u.nodes.push(n)}r.attr&&(n.attr=vi(n.attr,r.attr))}function hoe(i,r){if(i.edges||(i.edges=[]),i.edges.push(r),i.edge){var e=vi({},i.edge);r.attr=vi(e,r.attr)}}function nT(i,r,e,t,n){var a={from:r,to:e,type:t};return i.edge&&(a.attr=vi({},i.edge)),a.attr=vi(a.attr||{},n),n!=null&&n.hasOwnProperty("arrows")&&n.arrows!=null&&(a.arrows={to:{enabled:!0,type:n.arrows.type}},n.arrows=null),a}function ge(){for(_t=ft.NULL,G="";ee===" "||ee===" "||ee===` +`}},{key:"print",value:function(e){return ls(e).replace(/(")|(\[)|(\])|(,"__type__")/g,"").replace(/(,)/g,", ")}},{key:"levenshteinDistance",value:function(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;var n=[],a;for(a=0;a<=t.length;a++)n[a]=[a];var o;for(o=0;o<=e.length;o++)n[0][o]=o;for(a=1;a<=t.length;a++)for(o=1;o<=e.length;o++)t.charAt(a-1)==e.charAt(o-1)?n[a][o]=n[a-1][o-1]:n[a][o]=Math.min(n[a-1][o-1]+1,Math.min(n[a][o-1]+1,n[a-1][o]+1));return n[t.length][e.length]}}]),i}(),roe=gr,ioe=Qae,Gn=rp,noe=eoe,tT=xf,aoe=toe;function ooe(i){return ri=i,hoe()}var rT={fontsize:"font.size",fontcolor:"font.color",labelfontcolor:"font.color",fontname:"font.face",color:["color.border","color.background"],fillcolor:"color.background",tooltip:"title",labeltooltip:"title"},np=zi(rT);np.color="color.color";np.style="dashes";var ft={NULL:0,DELIMITER:1,IDENTIFIER:2,UNKNOWN:3},A1={"{":!0,"}":!0,"[":!0,"]":!0,";":!0,"=":!0,",":!0,"->":!0,"--":!0},ri="",ua=0,ee="",G="",_t=ft.NULL;function soe(){ua=0,ee=ri.charAt(0)}function Ue(){ua++,ee=ri.charAt(ua)}function kn(){return ri.charAt(ua+1)}function D1(i){var r=i.charCodeAt(0);return r<47?r===35||r===46:r<59?r>47:r<91?r>64:r<96?r===95:r<123?r>96:!1}function vi(i,r){if(i||(i={}),r)for(var e in r)r.hasOwnProperty(e)&&(i[e]=r[e]);return i}function uoe(i,r,e){for(var t=r.split("."),n=i;t.length;){var a=t.shift();t.length?(n[a]||(n[a]={}),n=n[a]):n[a]=e}}function iT(i,r){for(var e,t,n=null,a=[i],o=i;o.parent;)a.push(o.parent),o=o.parent;if(o.nodes){for(e=0,t=o.nodes.length;e=0;e--){var s,u=a[e];u.nodes||(u.nodes=[]),ne(s=u.nodes).call(s,n)===-1&&u.nodes.push(n)}r.attr&&(n.attr=vi(n.attr,r.attr))}function loe(i,r){if(i.edges||(i.edges=[]),i.edges.push(r),i.edge){var e=vi({},i.edge);r.attr=vi(e,r.attr)}}function nT(i,r,e,t,n){var a={from:r,to:e,type:t};return i.edge&&(a.attr=vi({},i.edge)),a.attr=vi(a.attr||{},n),n!=null&&n.hasOwnProperty("arrows")&&n.arrows!=null&&(a.arrows={to:{enabled:!0,type:n.arrows.type}},n.arrows=null),a}function ge(){for(_t=ft.NULL,G="";ee===" "||ee===" "||ee===` `||ee==="\r";)Ue();do{var i=!1;if(ee==="#"){for(var r=ua-1;ri.charAt(r)===" "||ri.charAt(r)===" ";)r--;if(ri.charAt(r)===` `||ri.charAt(r)===""){for(;ee!=""&&ee!=` `;)Ue();i=!0}}if(ee==="/"&&kn()==="/"){for(;ee!=""&&ee!=` `;)Ue();i=!0}if(ee==="/"&&kn()==="*"){for(;ee!="";)if(ee==="*"&&kn()==="/"){Ue(),Ue();break}else Ue();i=!0}for(;ee===" "||ee===" "||ee===` `||ee==="\r";)Ue()}while(i);if(ee===""){_t=ft.DELIMITER;return}var e=ee+kn();if(A1[e]){_t=ft.DELIMITER,G=e,Ue(),Ue();return}if(A1[ee]){_t=ft.DELIMITER,G=ee,Ue();return}if(D1(ee)||ee==="-"){for(G+=ee,Ue();D1(ee);)G+=ee,Ue();G==="false"?G=!1:G==="true"?G=!0:isNaN(Number(G))||(G=Number(G)),_t=ft.IDENTIFIER;return}if(ee==='"'){for(Ue();ee!=""&&(ee!='"'||ee==='"'&&kn()==='"');)ee==='"'?(G+=ee,Ue()):ee==="\\"&&kn()==="n"?(G+=` -`,Ue()):G+=ee,Ue();if(ee!='"')throw vt('End of string " expected');Ue(),_t=ft.IDENTIFIER;return}for(_t=ft.UNKNOWN;ee!="";)G+=ee,Ue();throw new SyntaxError('Syntax error in part "'+uT(G,30)+'"')}function coe(){var i={};if(uoe(),ge(),G==="strict"&&(i.strict=!0,ge()),(G==="graph"||G==="digraph")&&(i.type=G,ge()),_t===ft.IDENTIFIER&&(i.id=G,ge()),G!="{")throw vt("Angle bracket { expected");if(ge(),aT(i),G!="}")throw vt("Angle bracket } expected");if(ge(),G!=="")throw vt("End of file expected");return ge(),delete i.node,delete i.edge,delete i.graph,i}function aT(i){for(;G!==""&&G!="}";)doe(i),G===";"&&ge()}function doe(i){var r=oT(i);if(r){sT(i,r);return}var e=foe(i);if(!e){if(_t!=ft.IDENTIFIER)throw vt("Identifier expected");var t=G;if(ge(),G==="="){if(ge(),_t!=ft.IDENTIFIER)throw vt("Identifier expected");i[t]=G,ge()}else voe(i,t)}}function oT(i){var r=null;if(G==="subgraph"&&(r={},r.type="subgraph",ge(),_t===ft.IDENTIFIER&&(r.id=G,ge())),G==="{"){if(ge(),r||(r={}),r.parent=i,r.node=i.node,r.edge=i.edge,r.graph=i.graph,aT(r),G!="}")throw vt("Angle bracket } expected");ge(),delete r.node,delete r.edge,delete r.graph,delete r.parent,i.subgraphs||(i.subgraphs=[]),i.subgraphs.push(r)}return r}function foe(i){return G==="node"?(ge(),i.node=io(),"node"):G==="edge"?(ge(),i.edge=io(),"edge"):G==="graph"?(ge(),i.graph=io(),"graph"):null}function voe(i,r){var e={id:r},t=io();t&&(e.attr=t),iT(i,e),sT(i,r)}function sT(i,r){for(;G==="->"||G==="--";){var e,t=G;ge();var n=oT(i);if(n)e=n;else{if(_t!=ft.IDENTIFIER)throw vt("Identifier or subgraph expected");e=G,iT(i,{id:e}),ge()}var a=io(),o=nT(i,r,e,t,a);hoe(i,o),r=e}}function io(){for(var i,r=null,e={dashed:!0,solid:!1,dotted:[1,5]},t={dot:"circle",box:"box",crow:"crow",curve:"curve",icurve:"inv_curve",normal:"triangle",inv:"inv_triangle",diamond:"diamond",tee:"bar",vee:"vee"},n=new Array,a=new Array;G==="[";){for(ge(),r={};G!==""&&G!="]";){if(_t!=ft.IDENTIFIER)throw vt("Attribute name expected");var o=G;if(ge(),G!="=")throw vt("Equal sign = expected");if(ge(),_t!=ft.IDENTIFIER)throw vt("Attribute value expected");var s=G;o==="style"&&(s=e[s]);var u;o==="arrowhead"&&(u=t[s],o="arrows",s={to:{enabled:!0,type:u}}),o==="arrowtail"&&(u=t[s],o="arrows",s={from:{enabled:!0,type:u}}),n.push({attr:r,name:o,value:s}),a.push(o),ge(),G==","&&ge()}if(G!="]")throw vt("Bracket ] expected");ge()}if(hi(a).call(a,"dir")){var l={};for(l.arrows={},i=0;i"&&(u.arrows="to"),u};fe(n=r.edges).call(n,function(o){var s,u;if(o.from instanceof Object?s=o.from.nodes:s={id:o.from},o.to instanceof Object?u=o.to.nodes:u={id:o.to},o.from instanceof Object&&o.from.edges){var l;fe(l=o.from.edges).call(l,function(c){var d=a(c);e.edges.push(d)})}if(poe(s,u,function(c,d){var f=nT(e,c.id,d.id,o.type,o.attr),v=a(f);e.edges.push(v)}),o.to instanceof Object&&o.to.edges){var h;fe(h=o.to.edges).call(h,function(c){var d=a(c);e.edges.push(d)})}})}return r.attr&&(e.options=r.attr),e}function yoe(i,r){var e,t={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};r!=null&&(r.fixed!=null&&(t.nodes.fixed=r.fixed),r.parseColor!=null&&(t.nodes.parseColor=r.parseColor),r.inheritColor!=null&&(t.edges.inheritColor=r.inheritColor));var n=i.edges,a=na(n).call(n,function(s){var u={from:s.source,id:s.id,to:s.target};return s.attributes!=null&&(u.attributes=s.attributes),s.label!=null&&(u.label=s.label),s.attributes!=null&&s.attributes.title!=null&&(u.title=s.attributes.title),s.type==="Directed"&&(u.arrows="to"),s.color&&t.edges.inheritColor===!1&&(u.color=s.color),u}),o=na(e=i.nodes).call(e,function(s){var u={id:s.id,fixed:t.nodes.fixed&&s.x!=null&&s.y!=null};return s.attributes!=null&&(u.attributes=s.attributes),s.label!=null&&(u.label=s.label),s.size!=null&&(u.size=s.size),s.attributes!=null&&s.attributes.title!=null&&(u.title=s.attributes.title),s.title!=null&&(u.title=s.title),s.x!=null&&(u.x=s.x),s.y!=null&&(u.y=s.y),s.color!=null&&(t.nodes.parseColor===!0?u.color=s.color:u.color={background:s.color,border:s.color,highlight:{background:s.color,border:s.color},hover:{background:s.color,border:s.color}}),u});return{nodes:o,edges:a}}var moe={addDescription:"Click in an empty space to place a new node.",addEdge:"Add Edge",addNode:"Add Node",back:"Back",close:"Close",createEdgeError:"Cannot link edges to a cluster.",del:"Delete selected",deleteClusterError:"Clusters cannot be deleted.",edgeDescription:"Click on a node and drag the edge to another node to connect them.",edit:"Edit",editClusterError:"Clusters cannot be edited.",editEdge:"Edit Edge",editEdgeDescription:"Click on the control points and drag them to a node to connect to it.",editNode:"Edit Node"},boe={addDescription:"Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.",addEdge:"Kante hinzufügen",addNode:"Knoten hinzufügen",back:"Zurück",close:"Schließen",createEdgeError:"Es ist nicht möglich, Kanten mit Clustern zu verbinden.",del:"Lösche Auswahl",deleteClusterError:"Cluster können nicht gelöscht werden.",edgeDescription:"Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.",edit:"Editieren",editClusterError:"Cluster können nicht editiert werden.",editEdge:"Kante editieren",editEdgeDescription:"Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.",editNode:"Knoten editieren"},$oe={addDescription:"Haga clic en un lugar vacío para colocar un nuevo nodo.",addEdge:"Añadir arista",addNode:"Añadir nodo",back:"Atrás",close:"Cerrar",createEdgeError:"No se puede conectar una arista a un grupo.",del:"Eliminar selección",deleteClusterError:"No es posible eliminar grupos.",edgeDescription:"Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.",edit:"Editar",editClusterError:"No es posible editar grupos.",editEdge:"Editar arista",editEdgeDescription:"Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.",editNode:"Editar nodo"},woe={addDescription:"Clicca per aggiungere un nuovo nodo",addEdge:"Aggiungi un vertice",addNode:"Aggiungi un nodo",back:"Indietro",close:"Chiudere",createEdgeError:"Non si possono collegare vertici ad un cluster",del:"Cancella la selezione",deleteClusterError:"I cluster non possono essere cancellati",edgeDescription:"Clicca su un nodo e trascinalo ad un altro nodo per connetterli.",edit:"Modifica",editClusterError:"I clusters non possono essere modificati.",editEdge:"Modifica il vertice",editEdgeDescription:"Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.",editNode:"Modifica il nodo"},_oe={addDescription:"Klik op een leeg gebied om een nieuwe node te maken.",addEdge:"Link toevoegen",addNode:"Node toevoegen",back:"Terug",close:"Sluiten",createEdgeError:"Kan geen link maken naar een cluster.",del:"Selectie verwijderen",deleteClusterError:"Clusters kunnen niet worden verwijderd.",edgeDescription:"Klik op een node en sleep de link naar een andere node om ze te verbinden.",edit:"Wijzigen",editClusterError:"Clusters kunnen niet worden aangepast.",editEdge:"Link wijzigen",editEdgeDescription:"Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.",editNode:"Node wijzigen"},Eoe={addDescription:"Clique em um espaço em branco para adicionar um novo nó",addEdge:"Adicionar aresta",addNode:"Adicionar nó",back:"Voltar",close:"Fechar",createEdgeError:"Não foi possível linkar arestas a um cluster.",del:"Remover selecionado",deleteClusterError:"Clusters não puderam ser removidos.",edgeDescription:"Clique em um nó e arraste a aresta até outro nó para conectá-los",edit:"Editar",editClusterError:"Clusters não puderam ser editados.",editEdge:"Editar aresta",editEdgeDescription:"Clique nos pontos de controle e os arraste para um nó para conectá-los",editNode:"Editar nó"},Soe={addDescription:"Кликните в свободное место, чтобы добавить новый узел.",addEdge:"Добавить ребро",addNode:"Добавить узел",back:"Назад",close:"Закрывать",createEdgeError:"Невозможно соединить ребра в кластер.",del:"Удалить выбранное",deleteClusterError:"Кластеры не могут быть удалены",edgeDescription:"Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.",edit:"Редактировать",editClusterError:"Кластеры недоступны для редактирования.",editEdge:"Редактировать ребро",editEdgeDescription:"Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.",editNode:"Редактировать узел"},Ooe={addDescription:"单击空白处放置新节点。",addEdge:"添加连接线",addNode:"添加节点",back:"返回",close:"關閉",createEdgeError:"无法将连接线连接到群集。",del:"删除选定",deleteClusterError:"无法删除群集。",edgeDescription:"单击某个节点并将该连接线拖动到另一个节点以连接它们。",edit:"编辑",editClusterError:"无法编辑群集。",editEdge:"编辑连接线",editEdgeDescription:"单击控制节点并将它们拖到节点上连接。",editNode:"编辑节点"},Toe={addDescription:"Kлікніть на вільне місце, щоб додати новий вузол.",addEdge:"Додати край",addNode:"Додати вузол",back:"Назад",close:"Закрити",createEdgeError:"Не можливо об'єднати краї в групу.",del:"Видалити обране",deleteClusterError:"Групи не можуть бути видалені.",edgeDescription:"Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з'єднати.",edit:"Редагувати",editClusterError:"Групи недоступні для редагування.",editEdge:"Редагувати край",editEdgeDescription:"Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.",editNode:"Редагувати вузол"},Ioe={addDescription:"Cliquez dans un endroit vide pour placer un nœud.",addEdge:"Ajouter un lien",addNode:"Ajouter un nœud",back:"Retour",close:"Fermer",createEdgeError:"Impossible de créer un lien vers un cluster.",del:"Effacer la sélection",deleteClusterError:"Les clusters ne peuvent pas être effacés.",edgeDescription:"Cliquez sur un nœud et glissez le lien vers un autre nœud pour les connecter.",edit:"Éditer",editClusterError:"Les clusters ne peuvent pas être édités.",editEdge:"Éditer le lien",editEdgeDescription:"Cliquez sur les points de contrôle et glissez-les pour connecter un nœud.",editNode:"Éditer le nœud"},koe={addDescription:"Kluknutím do prázdného prostoru můžete přidat nový vrchol.",addEdge:"Přidat hranu",addNode:"Přidat vrchol",back:"Zpět",close:"Zavřít",createEdgeError:"Nelze připojit hranu ke shluku.",del:"Smazat výběr",deleteClusterError:"Nelze mazat shluky.",edgeDescription:"Přetažením z jednoho vrcholu do druhého můžete spojit tyto vrcholy novou hranou.",edit:"Upravit",editClusterError:"Nelze upravovat shluky.",editEdge:"Upravit hranu",editEdgeDescription:"Přetažením kontrolního vrcholu hrany ji můžete připojit k jinému vrcholu.",editNode:"Upravit vrchol"},Poe=Object.freeze({__proto__:null,cn:Ooe,cs:koe,de:boe,en:moe,es:$oe,fr:Ioe,it:woe,nl:_oe,pt:Eoe,ru:Soe,uk:Toe});function xoe(i,r){try{var e=r.split(/[-_ /]/,2),t=Te(e,2),n=t[0],a=t[1],o=n!=null?n.toLowerCase():null,s=a!=null?a.toUpperCase():null;if(o&&s){var u=o+"-"+s;if(Object.prototype.hasOwnProperty.call(i,u))return u;var l;console.warn(Gv(l="Unknown variant ".concat(s," of language ")).call(l,o,"."))}if(o){var h=o;if(Object.prototype.hasOwnProperty.call(i,h))return h;console.warn("Unknown language ".concat(o))}return console.warn("Unknown locale ".concat(r,", falling back to English.")),"en"}catch(c){return console.error(c),console.warn("Unexpected error while normalizing locale ".concat(r,", falling back to English.")),"en"}}var Coe=function(){function i(){N(this,i),this.NUM_ITERATIONS=4,this.image=new Image,this.canvas=document.createElement("canvas")}return M(i,[{key:"init",value:function(){if(!this.initialized()){this.src=this.image.src;var e=this.image.width,t=this.image.height;this.width=e,this.height=t;var n=Math.floor(t/2),a=Math.floor(t/4),o=Math.floor(t/8),s=Math.floor(t/16),u=Math.floor(e/2),l=Math.floor(e/4),h=Math.floor(e/8),c=Math.floor(e/16);this.canvas.width=3*l,this.canvas.height=n,this.coordinates=[[0,0,u,n],[u,0,l,a],[u,a,h,o],[5*h,a,c,s]],this._fillMipMap()}}},{key:"initialized",value:function(){return this.coordinates!==void 0}},{key:"_fillMipMap",value:function(){var e=this.canvas.getContext("2d"),t=this.coordinates[0];e.drawImage(this.image,t[0],t[1],t[2],t[3]);for(var n=1;n2){t*=.5;for(var u=0;t>2&&u=this.NUM_ITERATIONS&&(u=this.NUM_ITERATIONS-1);var l=this.coordinates[u];e.drawImage(this.canvas,l[0],l[1],l[2],l[3],n,a,o,s)}else e.drawImage(this.image,n,a,o,s)}}]),i}(),Aoe=function(){function i(r){N(this,i),this.images={},this.imageBroken={},this.callback=r}return M(i,[{key:"_tryloadBrokenUrl",value:function(e,t,n){if(!(e===void 0||n===void 0)){if(t===void 0){console.warn("No broken url image defined");return}n.image.onerror=function(){console.error("Could not load brokenImage:",t)},n.image.src=t}}},{key:"_redrawWithImage",value:function(e){this.callback&&this.callback(e)}},{key:"load",value:function(e,t){var n=this,a=this.images[e];if(a)return a;var o=new Coe;return this.images[e]=o,o.image.onload=function(){n._fixImageCoordinates(o.image),o.init(),n._redrawWithImage(o)},o.image.onerror=function(){console.error("Could not load image:",e),n._tryloadBrokenUrl(e,t,o)},o.image.src=e,o}},{key:"_fixImageCoordinates",value:function(e){e.width===0&&(document.body.appendChild(e),e.width=e.offsetWidth,e.height=e.offsetHeight,document.body.removeChild(e))}}]),i}(),lT={exports:{}},Doe=ae,Roe=Doe(function(){if(typeof ArrayBuffer=="function"){var i=new ArrayBuffer(8);Object.isExtensible(i)&&Object.defineProperty(i,"a",{value:8})}}),Noe=ae,Moe=Ze,Boe=Hr,N1=Roe,$u=Object.isExtensible,Foe=Noe(function(){$u(1)}),joe=Foe||N1?function(r){return!Moe(r)||N1&&Boe(r)==="ArrayBuffer"?!1:$u?$u(r):!0}:$u,Loe=ae,hT=!Loe(function(){return Object.isExtensible(Object.preventExtensions({}))}),zoe=q,Hoe=se,Voe=ts,Woe=Ze,ap=Qe,Uoe=Ht.f,M1=as,Koe=Wl,op=joe,Goe=Dl,qoe=hT,cT=!1,jr=Goe("meta"),Yoe=0,sp=function(i){Uoe(i,jr,{value:{objectID:"O"+Yoe++,weakData:{}}})},Xoe=function(i,r){if(!Woe(i))return typeof i=="symbol"?i:(typeof i=="string"?"S":"P")+i;if(!ap(i,jr)){if(!op(i))return"F";if(!r)return"E";sp(i)}return i[jr].objectID},Joe=function(i,r){if(!ap(i,jr)){if(!op(i))return!0;if(!r)return!1;sp(i)}return i[jr].weakData},Zoe=function(i){return qoe&&cT&&op(i)&&!ap(i,jr)&&sp(i),i},Qoe=function(){ese.enable=function(){},cT=!0;var i=M1.f,r=Hoe([].splice),e={};e[jr]=1,i(e).length&&(M1.f=function(t){for(var n=i(t),a=0,o=n.length;ac;c++)if(f=y(i[c]),f&&B1(j1,f))return f;return new wu(!1)}l=sse(i,h)}for(v=a?i.next:l.next;!(p=rse(v,l)).done;){try{f=y(p.value)}catch(m){F1(l,"throw",m)}if(typeof f=="object"&&f&&B1(j1,f))return f}return new wu(!1)},hse=Be,cse=TypeError,lp=function(i,r){if(hse(r,i))return i;throw new cse("Incorrect invocation")},dse=q,fse=Pe,vse=eh,pse=ae,gse=Pa,yse=up,mse=lp,bse=Xe,$se=Ze,wse=Oa,_se=Ca,Ese=Ht.f,Sse=wi.forEach,Ose=Je,dT=ln,Tse=dT.set,Ise=dT.getterFor,hp=function(i,r,e){var t=i.indexOf("Map")!==-1,n=i.indexOf("Weak")!==-1,a=t?"set":"add",o=fse[i],s=o&&o.prototype,u={},l;if(!Ose||!bse(o)||!(n||s.forEach&&!pse(function(){new o().entries().next()})))l=e.getConstructor(r,i,t,a),vse.enable();else{l=r(function(d,f){Tse(mse(d,h),{type:i,collection:new o}),wse(f)||yse(f,d[a],{that:d,AS_ENTRIES:t})});var h=l.prototype,c=Ise(i);Sse(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(d){var f=d==="add"||d==="set";d in s&&!(n&&d==="clear")&&gse(h,d,function(v,p){var g=c(this).collection;if(!f&&n&&!$se(v))return d==="get"?void 0:!1;var y=g[d](v===0?0:v,p);return f?this:y})}),n||Ese(h,"size",{configurable:!0,get:function(){return c(this).collection.size}})}return _se(l,i,!1,!0),u[i]=l,dse({global:!0,forced:!0},u),n||e.setStrong(l,i,t),l},kse=is,cp=function(i,r,e){for(var t in r)e&&e.unsafe&&i[t]?i[t]=r[t]:kse(i,t,r[t],e);return i},Pse=Jt,xse=zv,Cse=xe,Ase=Je,L1=Cse("species"),Dse=function(i){var r=Pse(i);Ase&&r&&!r[L1]&&xse(r,L1,{configurable:!0,get:function(){return this}})},Rse=xa,Nse=zv,z1=cp,Mse=Qo,Bse=lp,Fse=Oa,jse=up,Lse=Mv,eu=Bv,zse=Dse,Ha=Je,H1=eh.fastKey,fT=ln,V1=fT.set,ld=fT.getterFor,vT={getConstructor:function(i,r,e,t){var n=i(function(l,h){Bse(l,a),V1(l,{type:r,index:Rse(null),first:void 0,last:void 0,size:0}),Ha||(l.size=0),Fse(h)||jse(h,l[t],{that:l,AS_ENTRIES:e})}),a=n.prototype,o=ld(r),s=function(l,h,c){var d=o(l),f=u(l,h),v,p;return f?f.value=c:(d.last=f={index:p=H1(h,!0),key:h,value:c,previous:v=d.last,next:void 0,removed:!1},d.first||(d.first=f),v&&(v.next=f),Ha?d.size++:l.size++,p!=="F"&&(d.index[p]=f)),l},u=function(l,h){var c=o(l),d=H1(h),f;if(d!=="F")return c.index[d];for(f=c.first;f;f=f.next)if(f.key===h)return f};return z1(a,{clear:function(){for(var h=this,c=o(h),d=c.index,f=c.first;f;)f.removed=!0,f.previous&&(f.previous=f.previous.next=void 0),delete d[f.index],f=f.next;c.first=c.last=void 0,Ha?c.size=0:h.size=0},delete:function(l){var h=this,c=o(h),d=u(h,l);if(d){var f=d.next,v=d.previous;delete c.index[d.index],d.removed=!0,v&&(v.next=f),f&&(f.previous=v),c.first===d&&(c.first=f),c.last===d&&(c.last=v),Ha?c.size--:h.size--}return!!d},forEach:function(h){for(var c=o(this),d=Mse(h,arguments.length>1?arguments[1]:void 0),f;f=f?f.next:c.first;)for(d(f.value,f.key,this);f&&f.removed;)f=f.previous},has:function(h){return!!u(this,h)}}),z1(a,e?{get:function(h){var c=u(this,h);return c&&c.value},set:function(h,c){return s(this,h===0?0:h,c)}}:{add:function(h){return s(this,h=h===0?0:h,h)}}),Ha&&Nse(a,"size",{configurable:!0,get:function(){return o(this).size}}),n},setStrong:function(i,r,e){var t=r+" Iterator",n=ld(r),a=ld(t);Lse(i,r,function(o,s){V1(this,{type:t,target:o,state:n(o),kind:s,last:void 0})},function(){for(var o=a(this),s=o.kind,u=o.last;u&&u.removed;)u=u.previous;return!o.target||!(o.last=u=u?u.next:o.state.first)?(o.target=void 0,eu(void 0,!0)):eu(s==="keys"?u.key:s==="values"?u.value:[u.key,u.value],!1)},e?"entries":"values",!e,!0),zse(r)}},Hse=hp,Vse=vT;Hse("Map",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},Vse);var Wse=oe,Use=Wse.Map,Kse=Use,Gse=Kse,qse=Gse,pT=V(qse),Yse=function(){function i(){N(this,i),this.clear(),this._defaultIndex=0,this._groupIndex=0,this._defaultGroups=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}},{border:"#990000",background:"#EE0000",highlight:{border:"#BB0000",background:"#FF3333"},hover:{border:"#BB0000",background:"#FF3333"}},{border:"#FF6000",background:"#FF6000",highlight:{border:"#FF6000",background:"#FF6000"},hover:{border:"#FF6000",background:"#FF6000"}},{border:"#97C2FC",background:"#2B7CE9",highlight:{border:"#D2E5FF",background:"#2B7CE9"},hover:{border:"#D2E5FF",background:"#2B7CE9"}},{border:"#399605",background:"#255C03",highlight:{border:"#399605",background:"#255C03"},hover:{border:"#399605",background:"#255C03"}},{border:"#B70054",background:"#FF007E",highlight:{border:"#B70054",background:"#FF007E"},hover:{border:"#B70054",background:"#FF007E"}},{border:"#AD85E4",background:"#7C29F0",highlight:{border:"#D3BDF0",background:"#7C29F0"},hover:{border:"#D3BDF0",background:"#7C29F0"}},{border:"#4557FA",background:"#000EA1",highlight:{border:"#6E6EFD",background:"#000EA1"},hover:{border:"#6E6EFD",background:"#000EA1"}},{border:"#FFC0CB",background:"#FD5A77",highlight:{border:"#FFD1D9",background:"#FD5A77"},hover:{border:"#FFD1D9",background:"#FD5A77"}},{border:"#C2FABC",background:"#74D66A",highlight:{border:"#E6FFE3",background:"#74D66A"},hover:{border:"#E6FFE3",background:"#74D66A"}},{border:"#EE0000",background:"#990000",highlight:{border:"#FF3333",background:"#BB0000"},hover:{border:"#FF3333",background:"#BB0000"}}],this.options={},this.defaultOptions={useDefaultGroups:!0},Le(this.options,this.defaultOptions)}return M(i,[{key:"setOptions",value:function(e){var t=["useDefaultGroups"];if(e!==void 0){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&ne(t).call(t,n)===-1){var a=e[n];this.add(n,a)}}}},{key:"clear",value:function(){this._groups=new pT,this._groupNames=[]}},{key:"get",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this._groups.get(e);if(n===void 0&&t)if(this.options.useDefaultGroups===!1&&this._groupNames.length>0){var a=this._groupIndex%this._groupNames.length;++this._groupIndex,n={},n.color=this._groups.get(this._groupNames[a]),this._groups.set(e,n)}else{var o=this._defaultIndex%this._defaultGroups.length;this._defaultIndex++,n={},n.color=this._defaultGroups[o],this._groups.set(e,n)}return n}},{key:"add",value:function(e,t){return this._groups.has(e)||this._groupNames.push(e),this._groups.set(e,t),t}}]),i}(),Xse=q;Xse({target:"Number",stat:!0},{isNaN:function(r){return r!==r}});var Jse=oe,Zse=Jse.Number.isNaN,Qse=Zse,eue=Qse,tue=eue,Cf=V(tue),rue=Pe,iue=rue.isFinite,nue=Number.isFinite||function(r){return typeof r=="number"&&iue(r)},aue=q,oue=nue;aue({target:"Number",stat:!0},{isFinite:oue});var sue=oe,uue=sue.Number.isFinite,lue=uue,hue=lue,cue=hue,Di=V(cue),due=q,fue=wi.some,vue=Ra,pue=vue("some");due({target:"Array",proto:!0,forced:!pue},{some:function(r){return fue(this,r,arguments.length>1?arguments[1]:void 0)}});var gue=et,yue=gue("Array").some,mue=Be,bue=yue,hd=Array.prototype,$ue=function(i){var r=i.some;return i===hd||mue(hd,i)&&r===hd.some?bue:r},wue=$ue,_ue=wue,Eue=_ue,Sue=V(Eue),Oue=oe,Tue=Oue.Object.getOwnPropertySymbols,Iue=Tue,kue=Iue,Pue=kue,pi=V(Pue),gT={exports:{}},xue=q,Cue=ae,Aue=_r,yT=Sa.f,mT=Je,Due=!mT||Cue(function(){yT(1)});xue({target:"Object",stat:!0,forced:Due,sham:!mT},{getOwnPropertyDescriptor:function(r,e){return yT(Aue(r),e)}});var Rue=oe,bT=Rue.Object,Nue=gT.exports=function(r,e){return bT.getOwnPropertyDescriptor(r,e)};bT.getOwnPropertyDescriptor.sham&&(Nue.sham=!0);var Mue=gT.exports,Bue=Mue,$T=Bue,Fue=$T,Ei=V(Fue),jue=q,Lue=Je,zue=ite,Hue=_r,Vue=Sa,Wue=Da;jue({target:"Object",stat:!0,sham:!Lue},{getOwnPropertyDescriptors:function(r){for(var e=Hue(r),t=Vue.f,n=zue(e),a={},o=0,s,u;n.length>o;)u=t(e,s=n[o++]),u!==void 0&&Wue(a,s,u);return a}});var Uue=oe,Kue=Uue.Object.getOwnPropertyDescriptors,Gue=Kue,que=Gue,Yue=que,gi=V(Yue),wT={exports:{}},Xue=q,Jue=Je,W1=jl.f;Xue({target:"Object",stat:!0,forced:Object.defineProperties!==W1,sham:!Jue},{defineProperties:W1});var Zue=oe,_T=Zue.Object,Que=wT.exports=function(r,e){return _T.defineProperties(r,e)};_T.defineProperties.sham&&(Que.sham=!0);var ele=wT.exports,tle=ele,rle=tle,ile=rle,th=V(ile),nle=TS,rh=V(nle);function ih(i,r,e){return r=aO(r),r in i?Vl(i,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[r]=e,i}var ET=Pe,ale=ae,ole=se,sle=Er,ule=yO.trim,lle=qv,hle=ole("".charAt),Ju=ET.parseFloat,U1=ET.Symbol,K1=U1&&U1.iterator,cle=1/Ju(lle+"-0")!==-1/0||K1&&!ale(function(){Ju(Object(K1))}),dle=cle?function(r){var e=ule(sle(r)),t=Ju(e);return t===0&&hle(e,0)==="-"?-0:t}:Ju,fle=q,G1=dle;fle({global:!0,forced:parseFloat!==G1},{parseFloat:G1});var vle=oe,ple=vle.parseFloat,gle=ple,yle=gle,mle=yle,ST=V(mle),ble=q,$le=ae,wle=Wl.f,_le=$le(function(){return!Object.getOwnPropertyNames(1)});ble({target:"Object",stat:!0,forced:_le},{getOwnPropertyNames:wle});var Ele=oe,Sle=Ele.Object,Ole=function(r){return Sle.getOwnPropertyNames(r)},Tle=Ole,Ile=Tle,kle=Ile,Ple=V(kle);function dp(i,r){var e=["node","edge","label"],t=!0,n=Qr(r,"chosen");if(typeof n=="boolean")t=n;else if(de(n)==="object"){if(ne(e).call(e,i)===-1)throw new Error("choosify: subOption '"+i+"' should be one of '"+e.join("', '")+"'");var a=Qr(r,["chosen",i]);(typeof a=="boolean"||typeof a=="function")&&(t=a)}return t}function Af(i,r,e){if(i.width<=0||i.height<=0)return!1;if(e!==void 0){var t={x:r.x-e.x,y:r.y-e.y};if(e.angle!==0){var n=-e.angle,a={x:Math.cos(n)*t.x-Math.sin(n)*t.y,y:Math.sin(n)*t.x+Math.cos(n)*t.y};r=a}else r=t}var o=i.x+i.width,s=i.y+i.width;return i.leftr.x&&i.topr.y}function Zu(i){return typeof i=="string"&&i!==""}function OT(i,r,e,t){var n=t.x,a=t.y;if(typeof t.distanceToBorder=="function"){var o=t.distanceToBorder(i,r),s=Math.sin(r)*o,u=Math.cos(r)*o;u===o?(n+=o,a=t.y):s===o?(n=t.x,a-=o):(n+=u,a-=s)}else t.shape.width>t.shape.height?(n=t.x+t.shape.width*.5,a=t.y-e):(n=t.x+e,a=t.y-t.shape.height*.5);return{x:n,y:a}}var xle=et,Cle=xle("Array").values,Ale=Cle,Dle=Ale,Rle=un,Nle=Qe,Mle=Be,Ble=Dle,cd=Array.prototype,Fle={DOMTokenList:!0,NodeList:!0},jle=function(i){var r=i.values;return i===cd||Mle(cd,i)&&r===cd.values||Nle(Fle,Rle(i))?Ble:r},Lle=jle,TT=V(Lle),zle=function(){function i(r){N(this,i),this.measureText=r,this.current=0,this.width=0,this.height=0,this.lines=[]}return M(i,[{key:"_add",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"normal";this.lines[e]===void 0&&(this.lines[e]={width:0,height:0,blocks:[]});var a=t;(t===void 0||t==="")&&(a=" ");var o=this.measureText(a,n),s=Le({},TT(o));s.text=t,s.width=o.width,s.mod=n,(t===void 0||t==="")&&(s.width=0),this.lines[e].blocks.push(s),this.lines[e].width+=s.width}},{key:"curWidth",value:function(){var e=this.lines[this.current];return e===void 0?0:e.width}},{key:"append",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t)}},{key:"newLine",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t),this.current++}},{key:"determineLineHeights",value:function(){for(var e=0;ee&&(e=a.width),t+=a.height}this.width=e,this.height=t}},{key:"removeEmptyBlocks",value:function(){for(var e=[],t=0;t"://,""://,""://,"":/<\/b>/,"":/<\/i>/,"":/<\/code>/,"*":/\*/,_:/_/,"`":/`/,afterBold:/[^*]/,afterItal:/[^_]/,afterMono:/[^`]/},q1=function(){function i(r){N(this,i),this.text=r,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer="",this.modStack=[],this.blocks=[]}return M(i,[{key:"mod",value:function(){return this.modStack.length===0?"normal":this.modStack[0]}},{key:"modName",value:function(){if(this.modStack.length===0)return"normal";if(this.modStack[0]==="mono")return"mono";if(this.bold&&this.ital)return"boldital";if(this.bold)return"bold";if(this.ital)return"ital"}},{key:"emitBlock",value:function(){this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(this.blocks.push({text:this.buffer,mod:this.modName()}),this.buffer="")}},{key:"add",value:function(e){e===" "&&(this.spacing=!0),this.spacing&&(this.buffer+=" ",this.spacing=!1),e!=" "&&(this.buffer+=e)}},{key:"parseWS",value:function(e){return/[ \t]/.test(e)?(this.mono?this.add(e):this.spacing=!0,!0):!1}},{key:"setTag",value:function(e){this.emitBlock(),this[e]=!0,this.modStack.unshift(e)}},{key:"unsetTag",value:function(e){this.emitBlock(),this[e]=!1,this.modStack.shift()}},{key:"parseStartTag",value:function(e,t){return!this.mono&&!this[e]&&this.match(t)?(this.setTag(e),!0):!1}},{key:"match",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this.prepareRegExp(e),a=Te(n,2),o=a[0],s=a[1],u=o.test(this.text.substr(this.position,s));return u&&t&&(this.position+=s-1),u}},{key:"parseEndTag",value:function(e,t,n){var a=this.mod()===e;return e==="mono"?a=a&&this.mono:a=a&&!this.mono,a&&this.match(t)?(n!==void 0?(this.position===this.text.length-1||this.match(n,!1))&&this.unsetTag(e):this.unsetTag(e),!0):!1}},{key:"replace",value:function(e,t){return this.match(e)?(this.add(t),this.position+=length-1,!0):!1}},{key:"prepareRegExp",value:function(e){var t,n;if(e instanceof RegExp)n=e,t=1;else{var a=Hle[e];a!==void 0?n=a:n=new RegExp(e),t=e.length}return[n,t]}}]),i}(),Vle=function(){function i(r,e,t,n){var a=this;N(this,i),this.ctx=r,this.parent=e,this.selected=t,this.hover=n;var o=function(u,l){if(u===void 0)return 0;var h=a.parent.getFormattingValues(r,t,n,l),c=0;if(u!==""){var d=a.ctx.measureText(u);c=d.width}return{width:c,values:h}};this.lines=new zle(o)}return M(i,[{key:"process",value:function(e){if(!Zu(e))return this.lines.finalize();var t=this.parent.fontOptions;e=e.replace(/\r\n/g,` +`,Ue()):G+=ee,Ue();if(ee!='"')throw vt('End of string " expected');Ue(),_t=ft.IDENTIFIER;return}for(_t=ft.UNKNOWN;ee!="";)G+=ee,Ue();throw new SyntaxError('Syntax error in part "'+uT(G,30)+'"')}function hoe(){var i={};if(soe(),ge(),G==="strict"&&(i.strict=!0,ge()),(G==="graph"||G==="digraph")&&(i.type=G,ge()),_t===ft.IDENTIFIER&&(i.id=G,ge()),G!="{")throw vt("Angle bracket { expected");if(ge(),aT(i),G!="}")throw vt("Angle bracket } expected");if(ge(),G!=="")throw vt("End of file expected");return ge(),delete i.node,delete i.edge,delete i.graph,i}function aT(i){for(;G!==""&&G!="}";)coe(i),G===";"&&ge()}function coe(i){var r=oT(i);if(r){sT(i,r);return}var e=doe(i);if(!e){if(_t!=ft.IDENTIFIER)throw vt("Identifier expected");var t=G;if(ge(),G==="="){if(ge(),_t!=ft.IDENTIFIER)throw vt("Identifier expected");i[t]=G,ge()}else foe(i,t)}}function oT(i){var r=null;if(G==="subgraph"&&(r={},r.type="subgraph",ge(),_t===ft.IDENTIFIER&&(r.id=G,ge())),G==="{"){if(ge(),r||(r={}),r.parent=i,r.node=i.node,r.edge=i.edge,r.graph=i.graph,aT(r),G!="}")throw vt("Angle bracket } expected");ge(),delete r.node,delete r.edge,delete r.graph,delete r.parent,i.subgraphs||(i.subgraphs=[]),i.subgraphs.push(r)}return r}function doe(i){return G==="node"?(ge(),i.node=io(),"node"):G==="edge"?(ge(),i.edge=io(),"edge"):G==="graph"?(ge(),i.graph=io(),"graph"):null}function foe(i,r){var e={id:r},t=io();t&&(e.attr=t),iT(i,e),sT(i,r)}function sT(i,r){for(;G==="->"||G==="--";){var e,t=G;ge();var n=oT(i);if(n)e=n;else{if(_t!=ft.IDENTIFIER)throw vt("Identifier or subgraph expected");e=G,iT(i,{id:e}),ge()}var a=io(),o=nT(i,r,e,t,a);loe(i,o),r=e}}function io(){for(var i,r=null,e={dashed:!0,solid:!1,dotted:[1,5]},t={dot:"circle",box:"box",crow:"crow",curve:"curve",icurve:"inv_curve",normal:"triangle",inv:"inv_triangle",diamond:"diamond",tee:"bar",vee:"vee"},n=new Array,a=new Array;G==="[";){for(ge(),r={};G!==""&&G!="]";){if(_t!=ft.IDENTIFIER)throw vt("Attribute name expected");var o=G;if(ge(),G!="=")throw vt("Equal sign = expected");if(ge(),_t!=ft.IDENTIFIER)throw vt("Attribute value expected");var s=G;o==="style"&&(s=e[s]);var u;o==="arrowhead"&&(u=t[s],o="arrows",s={to:{enabled:!0,type:u}}),o==="arrowtail"&&(u=t[s],o="arrows",s={from:{enabled:!0,type:u}}),n.push({attr:r,name:o,value:s}),a.push(o),ge(),G==","&&ge()}if(G!="]")throw vt("Bracket ] expected");ge()}if(hi(a).call(a,"dir")){var l={};for(l.arrows={},i=0;i"&&(u.arrows="to"),u};fe(n=r.edges).call(n,function(o){var s,u;if(o.from instanceof Object?s=o.from.nodes:s={id:o.from},o.to instanceof Object?u=o.to.nodes:u={id:o.to},o.from instanceof Object&&o.from.edges){var l;fe(l=o.from.edges).call(l,function(c){var d=a(c);e.edges.push(d)})}if(voe(s,u,function(c,d){var f=nT(e,c.id,d.id,o.type,o.attr),v=a(f);e.edges.push(v)}),o.to instanceof Object&&o.to.edges){var h;fe(h=o.to.edges).call(h,function(c){var d=a(c);e.edges.push(d)})}})}return r.attr&&(e.options=r.attr),e}function goe(i,r){var e,t={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};r!=null&&(r.fixed!=null&&(t.nodes.fixed=r.fixed),r.parseColor!=null&&(t.nodes.parseColor=r.parseColor),r.inheritColor!=null&&(t.edges.inheritColor=r.inheritColor));var n=i.edges,a=na(n).call(n,function(s){var u={from:s.source,id:s.id,to:s.target};return s.attributes!=null&&(u.attributes=s.attributes),s.label!=null&&(u.label=s.label),s.attributes!=null&&s.attributes.title!=null&&(u.title=s.attributes.title),s.type==="Directed"&&(u.arrows="to"),s.color&&t.edges.inheritColor===!1&&(u.color=s.color),u}),o=na(e=i.nodes).call(e,function(s){var u={id:s.id,fixed:t.nodes.fixed&&s.x!=null&&s.y!=null};return s.attributes!=null&&(u.attributes=s.attributes),s.label!=null&&(u.label=s.label),s.size!=null&&(u.size=s.size),s.attributes!=null&&s.attributes.title!=null&&(u.title=s.attributes.title),s.title!=null&&(u.title=s.title),s.x!=null&&(u.x=s.x),s.y!=null&&(u.y=s.y),s.color!=null&&(t.nodes.parseColor===!0?u.color=s.color:u.color={background:s.color,border:s.color,highlight:{background:s.color,border:s.color},hover:{background:s.color,border:s.color}}),u});return{nodes:o,edges:a}}var yoe={addDescription:"Click in an empty space to place a new node.",addEdge:"Add Edge",addNode:"Add Node",back:"Back",close:"Close",createEdgeError:"Cannot link edges to a cluster.",del:"Delete selected",deleteClusterError:"Clusters cannot be deleted.",edgeDescription:"Click on a node and drag the edge to another node to connect them.",edit:"Edit",editClusterError:"Clusters cannot be edited.",editEdge:"Edit Edge",editEdgeDescription:"Click on the control points and drag them to a node to connect to it.",editNode:"Edit Node"},moe={addDescription:"Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.",addEdge:"Kante hinzufügen",addNode:"Knoten hinzufügen",back:"Zurück",close:"Schließen",createEdgeError:"Es ist nicht möglich, Kanten mit Clustern zu verbinden.",del:"Lösche Auswahl",deleteClusterError:"Cluster können nicht gelöscht werden.",edgeDescription:"Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.",edit:"Editieren",editClusterError:"Cluster können nicht editiert werden.",editEdge:"Kante editieren",editEdgeDescription:"Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.",editNode:"Knoten editieren"},boe={addDescription:"Haga clic en un lugar vacío para colocar un nuevo nodo.",addEdge:"Añadir arista",addNode:"Añadir nodo",back:"Atrás",close:"Cerrar",createEdgeError:"No se puede conectar una arista a un grupo.",del:"Eliminar selección",deleteClusterError:"No es posible eliminar grupos.",edgeDescription:"Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.",edit:"Editar",editClusterError:"No es posible editar grupos.",editEdge:"Editar arista",editEdgeDescription:"Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.",editNode:"Editar nodo"},$oe={addDescription:"Clicca per aggiungere un nuovo nodo",addEdge:"Aggiungi un vertice",addNode:"Aggiungi un nodo",back:"Indietro",close:"Chiudere",createEdgeError:"Non si possono collegare vertici ad un cluster",del:"Cancella la selezione",deleteClusterError:"I cluster non possono essere cancellati",edgeDescription:"Clicca su un nodo e trascinalo ad un altro nodo per connetterli.",edit:"Modifica",editClusterError:"I clusters non possono essere modificati.",editEdge:"Modifica il vertice",editEdgeDescription:"Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.",editNode:"Modifica il nodo"},woe={addDescription:"Klik op een leeg gebied om een nieuwe node te maken.",addEdge:"Link toevoegen",addNode:"Node toevoegen",back:"Terug",close:"Sluiten",createEdgeError:"Kan geen link maken naar een cluster.",del:"Selectie verwijderen",deleteClusterError:"Clusters kunnen niet worden verwijderd.",edgeDescription:"Klik op een node en sleep de link naar een andere node om ze te verbinden.",edit:"Wijzigen",editClusterError:"Clusters kunnen niet worden aangepast.",editEdge:"Link wijzigen",editEdgeDescription:"Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.",editNode:"Node wijzigen"},_oe={addDescription:"Clique em um espaço em branco para adicionar um novo nó",addEdge:"Adicionar aresta",addNode:"Adicionar nó",back:"Voltar",close:"Fechar",createEdgeError:"Não foi possível linkar arestas a um cluster.",del:"Remover selecionado",deleteClusterError:"Clusters não puderam ser removidos.",edgeDescription:"Clique em um nó e arraste a aresta até outro nó para conectá-los",edit:"Editar",editClusterError:"Clusters não puderam ser editados.",editEdge:"Editar aresta",editEdgeDescription:"Clique nos pontos de controle e os arraste para um nó para conectá-los",editNode:"Editar nó"},Eoe={addDescription:"Кликните в свободное место, чтобы добавить новый узел.",addEdge:"Добавить ребро",addNode:"Добавить узел",back:"Назад",close:"Закрывать",createEdgeError:"Невозможно соединить ребра в кластер.",del:"Удалить выбранное",deleteClusterError:"Кластеры не могут быть удалены",edgeDescription:"Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.",edit:"Редактировать",editClusterError:"Кластеры недоступны для редактирования.",editEdge:"Редактировать ребро",editEdgeDescription:"Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.",editNode:"Редактировать узел"},Soe={addDescription:"单击空白处放置新节点。",addEdge:"添加连接线",addNode:"添加节点",back:"返回",close:"關閉",createEdgeError:"无法将连接线连接到群集。",del:"删除选定",deleteClusterError:"无法删除群集。",edgeDescription:"单击某个节点并将该连接线拖动到另一个节点以连接它们。",edit:"编辑",editClusterError:"无法编辑群集。",editEdge:"编辑连接线",editEdgeDescription:"单击控制节点并将它们拖到节点上连接。",editNode:"编辑节点"},Ooe={addDescription:"Kлікніть на вільне місце, щоб додати новий вузол.",addEdge:"Додати край",addNode:"Додати вузол",back:"Назад",close:"Закрити",createEdgeError:"Не можливо об'єднати краї в групу.",del:"Видалити обране",deleteClusterError:"Групи не можуть бути видалені.",edgeDescription:"Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з'єднати.",edit:"Редагувати",editClusterError:"Групи недоступні для редагування.",editEdge:"Редагувати край",editEdgeDescription:"Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.",editNode:"Редагувати вузол"},Toe={addDescription:"Cliquez dans un endroit vide pour placer un nœud.",addEdge:"Ajouter un lien",addNode:"Ajouter un nœud",back:"Retour",close:"Fermer",createEdgeError:"Impossible de créer un lien vers un cluster.",del:"Effacer la sélection",deleteClusterError:"Les clusters ne peuvent pas être effacés.",edgeDescription:"Cliquez sur un nœud et glissez le lien vers un autre nœud pour les connecter.",edit:"Éditer",editClusterError:"Les clusters ne peuvent pas être édités.",editEdge:"Éditer le lien",editEdgeDescription:"Cliquez sur les points de contrôle et glissez-les pour connecter un nœud.",editNode:"Éditer le nœud"},Ioe={addDescription:"Kluknutím do prázdného prostoru můžete přidat nový vrchol.",addEdge:"Přidat hranu",addNode:"Přidat vrchol",back:"Zpět",close:"Zavřít",createEdgeError:"Nelze připojit hranu ke shluku.",del:"Smazat výběr",deleteClusterError:"Nelze mazat shluky.",edgeDescription:"Přetažením z jednoho vrcholu do druhého můžete spojit tyto vrcholy novou hranou.",edit:"Upravit",editClusterError:"Nelze upravovat shluky.",editEdge:"Upravit hranu",editEdgeDescription:"Přetažením kontrolního vrcholu hrany ji můžete připojit k jinému vrcholu.",editNode:"Upravit vrchol"},koe=Object.freeze({__proto__:null,cn:Soe,cs:Ioe,de:moe,en:yoe,es:boe,fr:Toe,it:$oe,nl:woe,pt:_oe,ru:Eoe,uk:Ooe});function Poe(i,r){try{var e=r.split(/[-_ /]/,2),t=Te(e,2),n=t[0],a=t[1],o=n!=null?n.toLowerCase():null,s=a!=null?a.toUpperCase():null;if(o&&s){var u=o+"-"+s;if(Object.prototype.hasOwnProperty.call(i,u))return u;var l;console.warn(Gv(l="Unknown variant ".concat(s," of language ")).call(l,o,"."))}if(o){var h=o;if(Object.prototype.hasOwnProperty.call(i,h))return h;console.warn("Unknown language ".concat(o))}return console.warn("Unknown locale ".concat(r,", falling back to English.")),"en"}catch(c){return console.error(c),console.warn("Unexpected error while normalizing locale ".concat(r,", falling back to English.")),"en"}}var xoe=function(){function i(){N(this,i),this.NUM_ITERATIONS=4,this.image=new Image,this.canvas=document.createElement("canvas")}return M(i,[{key:"init",value:function(){if(!this.initialized()){this.src=this.image.src;var e=this.image.width,t=this.image.height;this.width=e,this.height=t;var n=Math.floor(t/2),a=Math.floor(t/4),o=Math.floor(t/8),s=Math.floor(t/16),u=Math.floor(e/2),l=Math.floor(e/4),h=Math.floor(e/8),c=Math.floor(e/16);this.canvas.width=3*l,this.canvas.height=n,this.coordinates=[[0,0,u,n],[u,0,l,a],[u,a,h,o],[5*h,a,c,s]],this._fillMipMap()}}},{key:"initialized",value:function(){return this.coordinates!==void 0}},{key:"_fillMipMap",value:function(){var e=this.canvas.getContext("2d"),t=this.coordinates[0];e.drawImage(this.image,t[0],t[1],t[2],t[3]);for(var n=1;n2){t*=.5;for(var u=0;t>2&&u=this.NUM_ITERATIONS&&(u=this.NUM_ITERATIONS-1);var l=this.coordinates[u];e.drawImage(this.canvas,l[0],l[1],l[2],l[3],n,a,o,s)}else e.drawImage(this.image,n,a,o,s)}}]),i}(),Coe=function(){function i(r){N(this,i),this.images={},this.imageBroken={},this.callback=r}return M(i,[{key:"_tryloadBrokenUrl",value:function(e,t,n){if(!(e===void 0||n===void 0)){if(t===void 0){console.warn("No broken url image defined");return}n.image.onerror=function(){console.error("Could not load brokenImage:",t)},n.image.src=t}}},{key:"_redrawWithImage",value:function(e){this.callback&&this.callback(e)}},{key:"load",value:function(e,t){var n=this,a=this.images[e];if(a)return a;var o=new xoe;return this.images[e]=o,o.image.onload=function(){n._fixImageCoordinates(o.image),o.init(),n._redrawWithImage(o)},o.image.onerror=function(){console.error("Could not load image:",e),n._tryloadBrokenUrl(e,t,o)},o.image.src=e,o}},{key:"_fixImageCoordinates",value:function(e){e.width===0&&(document.body.appendChild(e),e.width=e.offsetWidth,e.height=e.offsetHeight,document.body.removeChild(e))}}]),i}(),lT={exports:{}},Aoe=ae,Doe=Aoe(function(){if(typeof ArrayBuffer=="function"){var i=new ArrayBuffer(8);Object.isExtensible(i)&&Object.defineProperty(i,"a",{value:8})}}),Roe=ae,Noe=Ze,Moe=Hr,N1=Doe,$u=Object.isExtensible,Boe=Roe(function(){$u(1)}),Foe=Boe||N1?function(r){return!Noe(r)||N1&&Moe(r)==="ArrayBuffer"?!1:$u?$u(r):!0}:$u,joe=ae,hT=!joe(function(){return Object.isExtensible(Object.preventExtensions({}))}),Loe=q,zoe=se,Hoe=ts,Voe=Ze,ap=Qe,Woe=Ht.f,M1=as,Uoe=Wl,op=Foe,Koe=Dl,Goe=hT,cT=!1,jr=Koe("meta"),qoe=0,sp=function(i){Woe(i,jr,{value:{objectID:"O"+qoe++,weakData:{}}})},Yoe=function(i,r){if(!Voe(i))return typeof i=="symbol"?i:(typeof i=="string"?"S":"P")+i;if(!ap(i,jr)){if(!op(i))return"F";if(!r)return"E";sp(i)}return i[jr].objectID},Xoe=function(i,r){if(!ap(i,jr)){if(!op(i))return!0;if(!r)return!1;sp(i)}return i[jr].weakData},Joe=function(i){return Goe&&cT&&op(i)&&!ap(i,jr)&&sp(i),i},Zoe=function(){Qoe.enable=function(){},cT=!0;var i=M1.f,r=zoe([].splice),e={};e[jr]=1,i(e).length&&(M1.f=function(t){for(var n=i(t),a=0,o=n.length;ac;c++)if(f=y(i[c]),f&&B1(j1,f))return f;return new wu(!1)}l=ose(i,h)}for(v=a?i.next:l.next;!(p=tse(v,l)).done;){try{f=y(p.value)}catch(m){F1(l,"throw",m)}if(typeof f=="object"&&f&&B1(j1,f))return f}return new wu(!1)},lse=Be,hse=TypeError,lp=function(i,r){if(lse(r,i))return i;throw new hse("Incorrect invocation")},cse=q,dse=Pe,fse=eh,vse=ae,pse=Pa,gse=up,yse=lp,mse=Xe,bse=Ze,$se=Oa,wse=Ca,_se=Ht.f,Ese=wi.forEach,Sse=Je,dT=ln,Ose=dT.set,Tse=dT.getterFor,hp=function(i,r,e){var t=i.indexOf("Map")!==-1,n=i.indexOf("Weak")!==-1,a=t?"set":"add",o=dse[i],s=o&&o.prototype,u={},l;if(!Sse||!mse(o)||!(n||s.forEach&&!vse(function(){new o().entries().next()})))l=e.getConstructor(r,i,t,a),fse.enable();else{l=r(function(d,f){Ose(yse(d,h),{type:i,collection:new o}),$se(f)||gse(f,d[a],{that:d,AS_ENTRIES:t})});var h=l.prototype,c=Tse(i);Ese(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(d){var f=d==="add"||d==="set";d in s&&!(n&&d==="clear")&&pse(h,d,function(v,p){var g=c(this).collection;if(!f&&n&&!bse(v))return d==="get"?void 0:!1;var y=g[d](v===0?0:v,p);return f?this:y})}),n||_se(h,"size",{configurable:!0,get:function(){return c(this).collection.size}})}return wse(l,i,!1,!0),u[i]=l,cse({global:!0,forced:!0},u),n||e.setStrong(l,i,t),l},Ise=is,cp=function(i,r,e){for(var t in r)e&&e.unsafe&&i[t]?i[t]=r[t]:Ise(i,t,r[t],e);return i},kse=Jt,Pse=zv,xse=xe,Cse=Je,L1=xse("species"),Ase=function(i){var r=kse(i);Cse&&r&&!r[L1]&&Pse(r,L1,{configurable:!0,get:function(){return this}})},Dse=xa,Rse=zv,z1=cp,Nse=Qo,Mse=lp,Bse=Oa,Fse=up,jse=Mv,eu=Bv,Lse=Ase,Ha=Je,H1=eh.fastKey,fT=ln,V1=fT.set,ld=fT.getterFor,vT={getConstructor:function(i,r,e,t){var n=i(function(l,h){Mse(l,a),V1(l,{type:r,index:Dse(null),first:void 0,last:void 0,size:0}),Ha||(l.size=0),Bse(h)||Fse(h,l[t],{that:l,AS_ENTRIES:e})}),a=n.prototype,o=ld(r),s=function(l,h,c){var d=o(l),f=u(l,h),v,p;return f?f.value=c:(d.last=f={index:p=H1(h,!0),key:h,value:c,previous:v=d.last,next:void 0,removed:!1},d.first||(d.first=f),v&&(v.next=f),Ha?d.size++:l.size++,p!=="F"&&(d.index[p]=f)),l},u=function(l,h){var c=o(l),d=H1(h),f;if(d!=="F")return c.index[d];for(f=c.first;f;f=f.next)if(f.key===h)return f};return z1(a,{clear:function(){for(var h=this,c=o(h),d=c.index,f=c.first;f;)f.removed=!0,f.previous&&(f.previous=f.previous.next=void 0),delete d[f.index],f=f.next;c.first=c.last=void 0,Ha?c.size=0:h.size=0},delete:function(l){var h=this,c=o(h),d=u(h,l);if(d){var f=d.next,v=d.previous;delete c.index[d.index],d.removed=!0,v&&(v.next=f),f&&(f.previous=v),c.first===d&&(c.first=f),c.last===d&&(c.last=v),Ha?c.size--:h.size--}return!!d},forEach:function(h){for(var c=o(this),d=Nse(h,arguments.length>1?arguments[1]:void 0),f;f=f?f.next:c.first;)for(d(f.value,f.key,this);f&&f.removed;)f=f.previous},has:function(h){return!!u(this,h)}}),z1(a,e?{get:function(h){var c=u(this,h);return c&&c.value},set:function(h,c){return s(this,h===0?0:h,c)}}:{add:function(h){return s(this,h=h===0?0:h,h)}}),Ha&&Rse(a,"size",{configurable:!0,get:function(){return o(this).size}}),n},setStrong:function(i,r,e){var t=r+" Iterator",n=ld(r),a=ld(t);jse(i,r,function(o,s){V1(this,{type:t,target:o,state:n(o),kind:s,last:void 0})},function(){for(var o=a(this),s=o.kind,u=o.last;u&&u.removed;)u=u.previous;return!o.target||!(o.last=u=u?u.next:o.state.first)?(o.target=void 0,eu(void 0,!0)):eu(s==="keys"?u.key:s==="values"?u.value:[u.key,u.value],!1)},e?"entries":"values",!e,!0),Lse(r)}},zse=hp,Hse=vT;zse("Map",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},Hse);var Vse=oe,Wse=Vse.Map,Use=Wse,Kse=Use,Gse=Kse,pT=V(Gse),qse=function(){function i(){N(this,i),this.clear(),this._defaultIndex=0,this._groupIndex=0,this._defaultGroups=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}},{border:"#990000",background:"#EE0000",highlight:{border:"#BB0000",background:"#FF3333"},hover:{border:"#BB0000",background:"#FF3333"}},{border:"#FF6000",background:"#FF6000",highlight:{border:"#FF6000",background:"#FF6000"},hover:{border:"#FF6000",background:"#FF6000"}},{border:"#97C2FC",background:"#2B7CE9",highlight:{border:"#D2E5FF",background:"#2B7CE9"},hover:{border:"#D2E5FF",background:"#2B7CE9"}},{border:"#399605",background:"#255C03",highlight:{border:"#399605",background:"#255C03"},hover:{border:"#399605",background:"#255C03"}},{border:"#B70054",background:"#FF007E",highlight:{border:"#B70054",background:"#FF007E"},hover:{border:"#B70054",background:"#FF007E"}},{border:"#AD85E4",background:"#7C29F0",highlight:{border:"#D3BDF0",background:"#7C29F0"},hover:{border:"#D3BDF0",background:"#7C29F0"}},{border:"#4557FA",background:"#000EA1",highlight:{border:"#6E6EFD",background:"#000EA1"},hover:{border:"#6E6EFD",background:"#000EA1"}},{border:"#FFC0CB",background:"#FD5A77",highlight:{border:"#FFD1D9",background:"#FD5A77"},hover:{border:"#FFD1D9",background:"#FD5A77"}},{border:"#C2FABC",background:"#74D66A",highlight:{border:"#E6FFE3",background:"#74D66A"},hover:{border:"#E6FFE3",background:"#74D66A"}},{border:"#EE0000",background:"#990000",highlight:{border:"#FF3333",background:"#BB0000"},hover:{border:"#FF3333",background:"#BB0000"}}],this.options={},this.defaultOptions={useDefaultGroups:!0},Le(this.options,this.defaultOptions)}return M(i,[{key:"setOptions",value:function(e){var t=["useDefaultGroups"];if(e!==void 0){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&ne(t).call(t,n)===-1){var a=e[n];this.add(n,a)}}}},{key:"clear",value:function(){this._groups=new pT,this._groupNames=[]}},{key:"get",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this._groups.get(e);if(n===void 0&&t)if(this.options.useDefaultGroups===!1&&this._groupNames.length>0){var a=this._groupIndex%this._groupNames.length;++this._groupIndex,n={},n.color=this._groups.get(this._groupNames[a]),this._groups.set(e,n)}else{var o=this._defaultIndex%this._defaultGroups.length;this._defaultIndex++,n={},n.color=this._defaultGroups[o],this._groups.set(e,n)}return n}},{key:"add",value:function(e,t){return this._groups.has(e)||this._groupNames.push(e),this._groups.set(e,t),t}}]),i}(),Yse=q;Yse({target:"Number",stat:!0},{isNaN:function(r){return r!==r}});var Xse=oe,Jse=Xse.Number.isNaN,Zse=Jse,Qse=Zse,eue=Qse,Cf=V(eue),tue=Pe,rue=tue.isFinite,iue=Number.isFinite||function(r){return typeof r=="number"&&rue(r)},nue=q,aue=iue;nue({target:"Number",stat:!0},{isFinite:aue});var oue=oe,sue=oue.Number.isFinite,uue=sue,lue=uue,hue=lue,Di=V(hue),cue=q,due=wi.some,fue=Ra,vue=fue("some");cue({target:"Array",proto:!0,forced:!vue},{some:function(r){return due(this,r,arguments.length>1?arguments[1]:void 0)}});var pue=et,gue=pue("Array").some,yue=Be,mue=gue,hd=Array.prototype,bue=function(i){var r=i.some;return i===hd||yue(hd,i)&&r===hd.some?mue:r},$ue=bue,wue=$ue,_ue=wue,Eue=V(_ue),Sue=oe,Oue=Sue.Object.getOwnPropertySymbols,Tue=Oue,Iue=Tue,kue=Iue,pi=V(kue),gT={exports:{}},Pue=q,xue=ae,Cue=_r,yT=Sa.f,mT=Je,Aue=!mT||xue(function(){yT(1)});Pue({target:"Object",stat:!0,forced:Aue,sham:!mT},{getOwnPropertyDescriptor:function(r,e){return yT(Cue(r),e)}});var Due=oe,bT=Due.Object,Rue=gT.exports=function(r,e){return bT.getOwnPropertyDescriptor(r,e)};bT.getOwnPropertyDescriptor.sham&&(Rue.sham=!0);var Nue=gT.exports,Mue=Nue,$T=Mue,Bue=$T,Ei=V(Bue),Fue=q,jue=Je,Lue=rte,zue=_r,Hue=Sa,Vue=Da;Fue({target:"Object",stat:!0,sham:!jue},{getOwnPropertyDescriptors:function(r){for(var e=zue(r),t=Hue.f,n=Lue(e),a={},o=0,s,u;n.length>o;)u=t(e,s=n[o++]),u!==void 0&&Vue(a,s,u);return a}});var Wue=oe,Uue=Wue.Object.getOwnPropertyDescriptors,Kue=Uue,Gue=Kue,que=Gue,gi=V(que),wT={exports:{}},Yue=q,Xue=Je,W1=jl.f;Yue({target:"Object",stat:!0,forced:Object.defineProperties!==W1,sham:!Xue},{defineProperties:W1});var Jue=oe,_T=Jue.Object,Zue=wT.exports=function(r,e){return _T.defineProperties(r,e)};_T.defineProperties.sham&&(Zue.sham=!0);var Que=wT.exports,ele=Que,tle=ele,rle=tle,th=V(rle),ile=TS,rh=V(ile);function ih(i,r,e){return r=aO(r),r in i?Vl(i,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[r]=e,i}var ET=Pe,nle=ae,ale=se,ole=Er,sle=yO.trim,ule=qv,lle=ale("".charAt),Ju=ET.parseFloat,U1=ET.Symbol,K1=U1&&U1.iterator,hle=1/Ju(ule+"-0")!==-1/0||K1&&!nle(function(){Ju(Object(K1))}),cle=hle?function(r){var e=sle(ole(r)),t=Ju(e);return t===0&&lle(e,0)==="-"?-0:t}:Ju,dle=q,G1=cle;dle({global:!0,forced:parseFloat!==G1},{parseFloat:G1});var fle=oe,vle=fle.parseFloat,ple=vle,gle=ple,yle=gle,ST=V(yle),mle=q,ble=ae,$le=Wl.f,wle=ble(function(){return!Object.getOwnPropertyNames(1)});mle({target:"Object",stat:!0,forced:wle},{getOwnPropertyNames:$le});var _le=oe,Ele=_le.Object,Sle=function(r){return Ele.getOwnPropertyNames(r)},Ole=Sle,Tle=Ole,Ile=Tle,kle=V(Ile);function dp(i,r){var e=["node","edge","label"],t=!0,n=Qr(r,"chosen");if(typeof n=="boolean")t=n;else if(de(n)==="object"){if(ne(e).call(e,i)===-1)throw new Error("choosify: subOption '"+i+"' should be one of '"+e.join("', '")+"'");var a=Qr(r,["chosen",i]);(typeof a=="boolean"||typeof a=="function")&&(t=a)}return t}function Af(i,r,e){if(i.width<=0||i.height<=0)return!1;if(e!==void 0){var t={x:r.x-e.x,y:r.y-e.y};if(e.angle!==0){var n=-e.angle,a={x:Math.cos(n)*t.x-Math.sin(n)*t.y,y:Math.sin(n)*t.x+Math.cos(n)*t.y};r=a}else r=t}var o=i.x+i.width,s=i.y+i.width;return i.leftr.x&&i.topr.y}function Zu(i){return typeof i=="string"&&i!==""}function OT(i,r,e,t){var n=t.x,a=t.y;if(typeof t.distanceToBorder=="function"){var o=t.distanceToBorder(i,r),s=Math.sin(r)*o,u=Math.cos(r)*o;u===o?(n+=o,a=t.y):s===o?(n=t.x,a-=o):(n+=u,a-=s)}else t.shape.width>t.shape.height?(n=t.x+t.shape.width*.5,a=t.y-e):(n=t.x+e,a=t.y-t.shape.height*.5);return{x:n,y:a}}var Ple=et,xle=Ple("Array").values,Cle=xle,Ale=Cle,Dle=un,Rle=Qe,Nle=Be,Mle=Ale,cd=Array.prototype,Ble={DOMTokenList:!0,NodeList:!0},Fle=function(i){var r=i.values;return i===cd||Nle(cd,i)&&r===cd.values||Rle(Ble,Dle(i))?Mle:r},jle=Fle,TT=V(jle),Lle=function(){function i(r){N(this,i),this.measureText=r,this.current=0,this.width=0,this.height=0,this.lines=[]}return M(i,[{key:"_add",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"normal";this.lines[e]===void 0&&(this.lines[e]={width:0,height:0,blocks:[]});var a=t;(t===void 0||t==="")&&(a=" ");var o=this.measureText(a,n),s=Le({},TT(o));s.text=t,s.width=o.width,s.mod=n,(t===void 0||t==="")&&(s.width=0),this.lines[e].blocks.push(s),this.lines[e].width+=s.width}},{key:"curWidth",value:function(){var e=this.lines[this.current];return e===void 0?0:e.width}},{key:"append",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t)}},{key:"newLine",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t),this.current++}},{key:"determineLineHeights",value:function(){for(var e=0;ee&&(e=a.width),t+=a.height}this.width=e,this.height=t}},{key:"removeEmptyBlocks",value:function(){for(var e=[],t=0;t"://,""://,""://,"":/<\/b>/,"":/<\/i>/,"":/<\/code>/,"*":/\*/,_:/_/,"`":/`/,afterBold:/[^*]/,afterItal:/[^_]/,afterMono:/[^`]/},q1=function(){function i(r){N(this,i),this.text=r,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer="",this.modStack=[],this.blocks=[]}return M(i,[{key:"mod",value:function(){return this.modStack.length===0?"normal":this.modStack[0]}},{key:"modName",value:function(){if(this.modStack.length===0)return"normal";if(this.modStack[0]==="mono")return"mono";if(this.bold&&this.ital)return"boldital";if(this.bold)return"bold";if(this.ital)return"ital"}},{key:"emitBlock",value:function(){this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(this.blocks.push({text:this.buffer,mod:this.modName()}),this.buffer="")}},{key:"add",value:function(e){e===" "&&(this.spacing=!0),this.spacing&&(this.buffer+=" ",this.spacing=!1),e!=" "&&(this.buffer+=e)}},{key:"parseWS",value:function(e){return/[ \t]/.test(e)?(this.mono?this.add(e):this.spacing=!0,!0):!1}},{key:"setTag",value:function(e){this.emitBlock(),this[e]=!0,this.modStack.unshift(e)}},{key:"unsetTag",value:function(e){this.emitBlock(),this[e]=!1,this.modStack.shift()}},{key:"parseStartTag",value:function(e,t){return!this.mono&&!this[e]&&this.match(t)?(this.setTag(e),!0):!1}},{key:"match",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this.prepareRegExp(e),a=Te(n,2),o=a[0],s=a[1],u=o.test(this.text.substr(this.position,s));return u&&t&&(this.position+=s-1),u}},{key:"parseEndTag",value:function(e,t,n){var a=this.mod()===e;return e==="mono"?a=a&&this.mono:a=a&&!this.mono,a&&this.match(t)?(n!==void 0?(this.position===this.text.length-1||this.match(n,!1))&&this.unsetTag(e):this.unsetTag(e),!0):!1}},{key:"replace",value:function(e,t){return this.match(e)?(this.add(t),this.position+=length-1,!0):!1}},{key:"prepareRegExp",value:function(e){var t,n;if(e instanceof RegExp)n=e,t=1;else{var a=zle[e];a!==void 0?n=a:n=new RegExp(e),t=e.length}return[n,t]}}]),i}(),Hle=function(){function i(r,e,t,n){var a=this;N(this,i),this.ctx=r,this.parent=e,this.selected=t,this.hover=n;var o=function(u,l){if(u===void 0)return 0;var h=a.parent.getFormattingValues(r,t,n,l),c=0;if(u!==""){var d=a.ctx.measureText(u);c=d.width}return{width:c,values:h}};this.lines=new Lle(o)}return M(i,[{key:"process",value:function(e){if(!Zu(e))return this.lines.finalize();var t=this.parent.fontOptions;e=e.replace(/\r\n/g,` `),e=e.replace(/\r/g,` `);var n=String(e).split(` -`),a=n.length;if(t.multi)for(var o=0;o0)for(var u=0;u0)for(var v=0;v")||t.parseStartTag("ital","")||t.parseStartTag("mono","")||t.parseEndTag("bold","")||t.parseEndTag("ital","")||t.parseEndTag("mono",""))||n(a);o||t.add(a),t.position++}return t.emitBlock(),t.blocks}},{key:"splitMarkdownBlocks",value:function(e){for(var t=this,n=new q1(e),a=!0,o=function(h){return/\\/.test(h)?(n.positionthis.parent.fontOptions.maxWdt}},{key:"getLongestFit",value:function(e){for(var t="",n=0;n1&&arguments[1]!==void 0?arguments[1]:"normal",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t),e=e.replace(/^( +)/g,"$1\r"),e=e.replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r");for(var a=e.split("\r");a.length>0;){var o=this.getLongestFit(a);if(o===0){var s=a[0],u=this.getLongestFitWord(s);this.lines.newLine(it(s).call(s,0,u),t),a[0]=it(s).call(s,u)}else{var l=o;a[o-1]===" "?o--:a[l]===" "&&l++;var h=it(a).call(a,0,o).join("");o==a.length&&n?this.lines.append(h,t):this.lines.newLine(h,t),a=it(a).call(a,l)}}}}]),i}(),Va=["bold","ital","boldital","mono"],IT=function(){function i(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;N(this,i),this.body=r,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(e),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=t}return M(i,[{key:"setOptions",value:function(e){if(this.elementOptions=e,this.initFontOptions(e.font),Zu(e.label)?this.labelDirty=!0:e.label=void 0,e.font!==void 0&&e.font!==null){if(typeof e.font=="string")this.baseSize=this.fontOptions.size;else if(de(e.font)==="object"){var t=e.font.size;t!==void 0&&(this.baseSize=t)}}}},{key:"initFontOptions",value:function(e){var t=this;if(te(Va,function(n){t.fontOptions[n]={}}),i.parseFontString(this.fontOptions,e)){this.fontOptions.vadjust=0;return}te(e,function(n,a){n!=null&&de(n)!=="object"&&(t.fontOptions[a]=n)})}},{key:"constrain",value:function(e){var t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},n=Qr(e,"widthConstraint");if(typeof n=="number")t.maxWdt=Number(n),t.minWdt=Number(n);else if(de(n)==="object"){var a=Qr(e,["widthConstraint","maximum"]);typeof a=="number"&&(t.maxWdt=Number(a));var o=Qr(e,["widthConstraint","minimum"]);typeof o=="number"&&(t.minWdt=Number(o))}var s=Qr(e,"heightConstraint");if(typeof s=="number")t.minHgt=Number(s);else if(de(s)==="object"){var u=Qr(e,["heightConstraint","minimum"]);typeof u=="number"&&(t.minHgt=Number(u));var l=Qr(e,["heightConstraint","valign"]);typeof l=="string"&&(l==="top"||l==="bottom")&&(t.valign=l)}return t}},{key:"update",value:function(e,t){this.setOptions(e,!0),this.propagateFonts(t),pe(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=dp("label",t)}},{key:"adjustSizes",value:function(e){var t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);var n=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=n)}},{key:"addFontOptionsToPile",value:function(e,t){for(var n=0;n5&&arguments[5]!==void 0?arguments[5]:"middle";if(this.elementOptions.label!==void 0){var u=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&u=this.elementOptions.scaling.label.maxVisible&&(u=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,a,o,t,n,s),this._drawBackground(e),this._drawText(e,t,this.size.yLine,s,u))}}},{key:"_drawBackground",value:function(e){if(this.fontOptions.background!==void 0&&this.fontOptions.background!=="none"){e.fillStyle=this.fontOptions.background;var t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}},{key:"_drawText",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"middle",o=arguments.length>4?arguments[4]:void 0,s=this._setAlignment(e,t,n,a),u=Te(s,2);t=u[0],n=u[1],e.textAlign="left",t=t-this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&(this.fontOptions.valign==="top"&&(n-=(this.size.height-this.size.labelHeight)/2),this.fontOptions.valign==="bottom"&&(n+=(this.size.height-this.size.labelHeight)/2));for(var l=0;l0&&(e.lineWidth=f.strokeWidth,e.strokeStyle=y,e.lineJoin="round"),e.fillStyle=g,f.strokeWidth>0&&e.strokeText(f.text,t+c,n+f.vadjust),e.fillText(f.text,t+c,n+f.vadjust),c+=f.width}n+=h.height}}}},{key:"_setAlignment",value:function(e,t,n,a){if(this.isEdgeLabel&&this.fontOptions.align!=="horizontal"&&this.pointToSelf===!1){t=0,n=0;var o=2;this.fontOptions.align==="top"?(e.textBaseline="alphabetic",n-=2*o):this.fontOptions.align==="bottom"?(e.textBaseline="hanging",n+=2*o):e.textBaseline="middle"}else e.textBaseline=a;return[t,n]}},{key:"_getColor",value:function(e,t,n){var a=e||"#000000",o=n||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){var s=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));a=Kt(a,s),o=Kt(o,s)}return[a,o]}},{key:"getTextSize",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this._processLabel(e,t,n),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}},{key:"getSize",value:function(){var e=2,t=this.size.left,n=this.size.top-.5*e;if(this.isEdgeLabel){var a=-this.size.width*.5;switch(this.fontOptions.align){case"middle":t=a,n=-this.size.height*.5;break;case"top":t=a,n=-(this.size.height+e);break;case"bottom":t=a,n=e;break}}var o={left:t,top:n,width:this.size.width,height:this.size.height};return o}},{key:"calculateLabelSize",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";this._processLabel(e,t,n),this.size.left=a-this.size.width*.5,this.size.top=o-this.size.height*.5,this.size.yLine=o+(1-this.lineCount)*.5*this.fontOptions.size,s==="hanging"&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}},{key:"getFormattingValues",value:function(e,t,n,a){var o=function(h,c,d){return c==="normal"?d==="mod"?"":h[d]:h[c][d]!==void 0?h[c][d]:h[d]},s={color:o(this.fontOptions,a,"color"),size:o(this.fontOptions,a,"size"),face:o(this.fontOptions,a,"face"),mod:o(this.fontOptions,a,"mod"),vadjust:o(this.fontOptions,a,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||n)&&(a==="normal"&&this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?s.mod="bold":typeof this.fontOptions.chooser=="function"&&this.fontOptions.chooser(s,this.elementOptions.id,t,n));var u="";return s.mod!==void 0&&s.mod!==""&&(u+=s.mod+" "),u+=s.size+"px "+s.face,e.font=u.replace(/"/g,""),s.font=e.font,s.height=s.size,s}},{key:"differentState",value:function(e,t){return e!==this.selectedState||t!==this.hoverState}},{key:"_processLabelText",value:function(e,t,n,a){var o=new Vle(e,this,t,n);return o.process(a)}},{key:"_processLabel",value:function(e,t,n){if(!(this.labelDirty===!1&&!this.differentState(t,n))){var a=this._processLabelText(e,t,n,this.elementOptions.label);this.fontOptions.minWdt>0&&a.width0&&a.height0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}},{key:"performFill",value:function(e,t){e.save(),e.fillStyle=t.color,this.enableShadow(e,t),hs(e).call(e),this.disableShadow(e,t),e.restore(),this.performStroke(e,t)}},{key:"_addBoundingBoxMargin",value:function(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}},{key:"_updateBoundingBox",value:function(e,t,n,a,o){n!==void 0&&this.resize(n,a,o),this.left=e-this.width/2,this.top=t-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}},{key:"updateBoundingBox",value:function(e,t,n,a,o){this._updateBoundingBox(e,t,n,a,o)}},{key:"getDimensionsFromLabel",value:function(e,t,n){this.textSize=this.labelModule.getTextSize(e,t,n);var a=this.textSize.width,o=this.textSize.height,s=14;return a===0&&(a=s,o=s),{width:a,height:o}}}]),i}();function Rhe(i){var r=Nhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Nhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Mhe=function(i){ue(e,i);var r=Rhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o);this.width=s.width+this.margin.right+this.margin.left,this.height=s.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.initContextForDraw(n,l),qE(n,this.left,this.top,this.width,this.height,l.borderRadius),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u)}},{key:"updateBoundingBox",value:function(n,a,o,s,u){this._updateBoundingBox(n,a,o,s,u);var l=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(l)}},{key:"distanceToBorder",value:function(n,a){n&&this.resize(n);var o=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(a)),Math.abs(this.height/2/Math.sin(a)))+o}}]),e}(vn);function Bhe(i){var r=Fhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Fhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var pp=function(i){ue(e,i);var r=Bhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o.labelOffset=0,o.selected=!1,o}return M(e,[{key:"setOptions",value:function(n,a,o){this.options=n,a===void 0&&o===void 0||this.setImages(a,o)}},{key:"setImages",value:function(n,a){a&&this.selected?(this.imageObj=a,this.imageObjAlt=n):(this.imageObj=n,this.imageObjAlt=a)}},{key:"switchImages",value:function(n){var a=n&&!this.selected||!n&&this.selected;if(this.selected=n,this.imageObjAlt!==void 0&&a){var o=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=o}}},{key:"_getImagePadding",value:function(){var n={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){var a=this.options.imagePadding;de(a)=="object"?(n.top=a.top,n.right=a.right,n.bottom=a.bottom,n.left=a.left):(n.top=a,n.right=a,n.bottom=a,n.left=a)}return n}},{key:"_resizeImage",value:function(){var n,a;if(this.options.shapeProperties.useImageSize===!1){var o=1,s=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?o=this.imageObj.width/this.imageObj.height:s=this.imageObj.height/this.imageObj.width),n=this.options.size*2*o,a=this.options.size*2*s}else{var u=this._getImagePadding();n=this.imageObj.width+u.left+u.right,a=this.imageObj.height+u.top+u.bottom}this.width=n,this.height=a,this.radius=.5*this.width}},{key:"_drawRawCircle",value:function(n,a,o,s){this.initContextForDraw(n,s),Av(n,a,o,s.size),this.performFill(n,s)}},{key:"_drawImageAtPosition",value:function(n,a){if(this.imageObj.width!=0){n.globalAlpha=a.opacity!==void 0?a.opacity:1,this.enableShadow(n,a);var o=1;this.options.shapeProperties.interpolation===!0&&(o=this.imageObj.width/this.width/this.body.view.scale);var s=this._getImagePadding(),u=this.left+s.left,l=this.top+s.top,h=this.width-s.left-s.right,c=this.height-s.top-s.bottom;this.imageObj.drawImageAtPosition(n,o,u,l,h,c),this.disableShadow(n,a)}}},{key:"_drawImageLabel",value:function(n,a,o,s,u){var l=0;if(this.height!==void 0){l=this.height*.5;var h=this.labelModule.getTextSize(n,s,u);h.lineCount>=1&&(l+=h.height/2)}var c=o+l;this.options.label&&(this.labelOffset=l),this.labelModule.draw(n,a,c,s,u,"hanging")}}]),e}(vn);function jhe(i){var r=Lhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Lhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var zhe=function(i){ue(e,i);var r=jhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o),u=Math.max(s.width+this.margin.right+this.margin.left,s.height+this.margin.top+this.margin.bottom);this.options.size=u/2,this.width=u,this.height=u,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this._drawRawCircle(n,a,o,l),this.updateBoundingBox(a,o),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,o,s,u)}},{key:"updateBoundingBox",value:function(n,a){this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.width*.5}}]),e}(pp);function Hhe(i){var r=Vhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Vhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Whe=function(i){ue(e,i);var r=Hhe(e);function e(t,n,a,o,s){var u;return N(this,e),u=r.call(this,t,n,a),u.setImages(o,s),u}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0;if(s){var u=this.options.size*2;this.width=u,this.height=u,this.radius=.5*this.width;return}this.needsRefresh(a,o)&&this._resizeImage()}},{key:"draw",value:function(n,a,o,s,u,l){this.switchImages(s),this.resize();var h=a,c=o;this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=a,this.top=o,h+=this.width/2,c+=this.height/2):(this.left=a-this.width/2,this.top=o-this.height/2),this._drawRawCircle(n,h,c,l),n.save(),n.clip(),this._drawImageAtPosition(n,l),n.restore(),this._drawImageLabel(n,h,c,s,u),this.updateBoundingBox(a,o)}},{key:"updateBoundingBox",value:function(n,a){this.options.shapeProperties.coordinateOrigin==="top-left"?(this.boundingBox.top=a,this.boundingBox.left=n,this.boundingBox.right=n+this.options.size*2,this.boundingBox.bottom=a+this.options.size*2):(this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size),this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.width*.5}}]),e}(pp);function Uhe(i){var r=Khe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Khe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Si=function(i){ue(e,i);var r=Uhe(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{size:this.options.size};if(this.needsRefresh(a,o)){var u,l;this.labelModule.getTextSize(n,a,o);var h=2*s.size;this.width=(u=this.customSizeWidth)!==null&&u!==void 0?u:h,this.height=(l=this.customSizeHeight)!==null&&l!==void 0?l:h,this.radius=.5*this.width}}},{key:"_drawShape",value:function(n,a,o,s,u,l,h,c){var d=this;return this.resize(n,l,h,c),this.left=s-this.width/2,this.top=u-this.height/2,this.initContextForDraw(n,c),IK(a)(n,s,u,c.size),this.performFill(n,c),this.options.icon!==void 0&&this.options.icon.code!==void 0&&(n.font=(l?"bold ":"")+this.height/2+"px "+(this.options.icon.face||"FontAwesome"),n.fillStyle=this.options.icon.color||"black",n.textAlign="center",n.textBaseline="middle",n.fillText(this.options.icon.code,s,u)),{drawExternalLabel:function(){if(d.options.label!==void 0){d.labelModule.calculateLabelSize(n,l,h,s,u,"hanging");var v=u+.5*d.height+.5*d.labelModule.size.height;d.labelModule.draw(n,s,v,l,h,"hanging")}d.updateBoundingBox(s,u)}}}},{key:"updateBoundingBox",value:function(n,a){this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}]),e}(vn);function Q1(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function Ghe(i){for(var r=1;r"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Xhe=function(i){ue(e,i);var r=qhe(e);function e(t,n,a,o){var s;return N(this,e),s=r.call(this,t,n,a,o),s.ctxRenderer=o,s}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u,l),this.left=a-this.width/2,this.top=o-this.height/2,n.save();var h=this.ctxRenderer({ctx:n,id:this.options.id,x:a,y:o,state:{selected:s,hover:u},style:Ghe({},l),label:this.options.label});if(h.drawNode!=null&&h.drawNode(),n.restore(),h.drawExternalLabel){var c=h.drawExternalLabel;h.drawExternalLabel=function(){n.save(),c(),n.restore()}}return h.nodeDimensions&&(this.customSizeWidth=h.nodeDimensions.width,this.customSizeHeight=h.nodeDimensions.height),h}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function Jhe(i){var r=Zhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Zhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Qhe=function(i){ue(e,i);var r=Jhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o),u=s.width+this.margin.right+this.margin.left;this.width=u,this.height=u,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.initContextForDraw(n,l),YE(n,a-this.width/2,o-this.height/2,this.width,this.height),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function ece(i){var r=tce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function tce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var rce=function(i){ue(e,i);var r=ece(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"diamond",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function ice(i){var r=nce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function nce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var ace=function(i){ue(e,i);var r=ice(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"circle",2,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.options.size}}]),e}(Si);function oce(i){var r=sce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function sce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var e$=function(i){ue(e,i);var r=oce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o);this.height=s.height*2,this.width=s.width+s.height,this.radius=.5*this.width}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width*.5,this.top=o-this.height*.5,this.initContextForDraw(n,l),sf(n,this.left,this.top,this.width,this.height),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,a,o,s,u)}},{key:"distanceToBorder",value:function(n,a){n&&this.resize(n);var o=this.width*.5,s=this.height*.5,u=Math.sin(a)*o,l=Math.cos(a)*s;return o*s/Math.sqrt(u*u+l*l)}}]),e}(vn);function uce(i){var r=lce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function lce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var hce=function(i){ue(e,i);var r=uce(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){this.needsRefresh(a,o)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(n,a,o,s,u,l){var h=this;return this.resize(n,s,u),this.options.icon.size=this.options.icon.size||50,this.left=a-this.width/2,this.top=o-this.height/2,this._icon(n,a,o,s,u,l),{drawExternalLabel:function(){if(h.options.label!==void 0){var d=5;h.labelModule.draw(n,h.left+h.iconSize.width/2+h.margin.left,o+h.height/2+d,s)}h.updateBoundingBox(a,o)}}}},{key:"updateBoundingBox",value:function(n,a){if(this.boundingBox.top=a-this.options.icon.size*.5,this.boundingBox.left=n-this.options.icon.size*.5,this.boundingBox.right=n+this.options.icon.size*.5,this.boundingBox.bottom=a+this.options.icon.size*.5,this.options.label!==void 0&&this.labelModule.size.width>0){var o=5;this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+o)}}},{key:"_icon",value:function(n,a,o,s,u,l){var h=Number(this.options.icon.size);this.options.icon.code!==void 0?(n.font=[this.options.icon.weight!=null?this.options.icon.weight:s?"bold":"",(this.options.icon.weight!=null&&s?5:0)+h+"px",this.options.icon.face].join(" "),n.fillStyle=this.options.icon.color||"black",n.textAlign="center",n.textBaseline="middle",this.enableShadow(n,l),n.fillText(this.options.icon.code,a,o),this.disableShadow(n,l)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function cce(i){var r=dce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function dce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var fce=function(i){ue(e,i);var r=cce(e);function e(t,n,a,o,s){var u;return N(this,e),u=r.call(this,t,n,a),u.setImages(o,s),u}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0;if(s){var u=this.options.size*2;this.width=u,this.height=u;return}this.needsRefresh(a,o)&&this._resizeImage()}},{key:"draw",value:function(n,a,o,s,u,l){n.save(),this.switchImages(s),this.resize();var h=a,c=o;if(this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=a,this.top=o,h+=this.width/2,c+=this.height/2):(this.left=a-this.width/2,this.top=o-this.height/2),this.options.shapeProperties.useBorderWithImage===!0){var d=this.options.borderWidth,f=this.options.borderWidthSelected||2*this.options.borderWidth,v=(s?f:d)/this.body.view.scale;n.lineWidth=Math.min(this.width,v),n.beginPath();var p=s?this.options.color.highlight.border:u?this.options.color.hover.border:this.options.color.border,g=s?this.options.color.highlight.background:u?this.options.color.hover.background:this.options.color.background;l.opacity!==void 0&&(p=Kt(p,l.opacity),g=Kt(g,l.opacity)),n.strokeStyle=p,n.fillStyle=g,n.rect(this.left-.5*n.lineWidth,this.top-.5*n.lineWidth,this.width+n.lineWidth,this.height+n.lineWidth),hs(n).call(n),this.performStroke(n,l),n.closePath()}this._drawImageAtPosition(n,l),this._drawImageLabel(n,h,c,s,u),this.updateBoundingBox(a,o),n.restore()}},{key:"updateBoundingBox",value:function(n,a){this.resize(),this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=n,this.top=a):(this.left=n-this.width/2,this.top=a-this.height/2),this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(pp);function vce(i){var r=pce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function pce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var gce=function(i){ue(e,i);var r=vce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"square",2,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function yce(i){var r=mce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function mce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var bce=function(i){ue(e,i);var r=yce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"hexagon",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function $ce(i){var r=wce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function wce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var _ce=function(i){ue(e,i);var r=$ce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"star",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function Ece(i){var r=Sce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Sce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Oce=function(i){ue(e,i);var r=Ece(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){this.needsRefresh(a,o)&&(this.textSize=this.labelModule.getTextSize(n,a,o),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.enableShadow(n,l),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u),this.disableShadow(n,l),this.updateBoundingBox(a,o,n,s,u)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function Tce(i){var r=Ice();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Ice(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var kce=function(i){ue(e,i);var r=Tce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"triangle",3,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function Pce(i){var r=xce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function xce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Cce=function(i){ue(e,i);var r=Pce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"triangleDown",3,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function t$(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function r$(i){for(var r=1;re.left&&this.shape.tope.top}},{key:"isBoundingBoxOverlappingWith",value:function(e){return this.shape.boundingBox.lefte.left&&this.shape.boundingBox.tope.top}}],[{key:"checkOpacity",value:function(e){return 0<=e&&e<=1}},{key:"checkCoordinateOrigin",value:function(e){return e===void 0||e==="center"||e==="top-left"}},{key:"updateGroupOptions",value:function(e,t,n){var a;if(n!==void 0){var o=e.group;if(t!==void 0&&t.group!==void 0&&o!==t.group)throw new Error("updateGroupOptions: group values in options don't match.");var s=typeof o=="number"||typeof o=="string"&&o!="";if(s){var u=n.get(o);u.opacity!==void 0&&t.opacity===void 0&&(i.checkOpacity(u.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+u.opacity),u.opacity=void 0));var l=Tt(a=Ple(t)).call(a,function(h){return t[h]!=null});l.push("font"),Yu(l,e,u),e.color=If(e.color)}}}},{key:"parseOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=arguments.length>4?arguments[4]:void 0,s=["color","fixed","shadow"];if(Yu(s,e,t,n),i.checkMass(t),e.opacity!==void 0&&(i.checkOpacity(e.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity),e.opacity=void 0)),t.opacity!==void 0&&(i.checkOpacity(t.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+t.opacity),t.opacity=void 0)),t.shapeProperties&&!i.checkCoordinateOrigin(t.shapeProperties.coordinateOrigin)&&console.error("Invalid option for node coordinateOrigin, found: "+t.shapeProperties.coordinateOrigin),Ut(e,t,"shadow",a),t.color!==void 0&&t.color!==null){var u=If(t.color);JO(e.color,u)}else n===!0&&t.color===null&&(e.color=di(a.color));t.fixed!==void 0&&t.fixed!==null&&(typeof t.fixed=="boolean"?(e.fixed.x=t.fixed,e.fixed.y=t.fixed):(t.fixed.x!==void 0&&typeof t.fixed.x=="boolean"&&(e.fixed.x=t.fixed.x),t.fixed.y!==void 0&&typeof t.fixed.y=="boolean"&&(e.fixed.y=t.fixed.y))),n===!0&&t.font===null&&(e.font=di(a.font)),i.updateGroupOptions(e,t,o),t.scaling!==void 0&&Ut(e.scaling,t.scaling,"label",a.scaling)}},{key:"checkMass",value:function(e,t){if(e.mass!==void 0&&e.mass<=0){var n="";t!==void 0&&(n=" in node id: "+t),console.error("%cNegative or zero mass disallowed"+n+", setting mass to 1.",tT),e.mass=1}}}]),i}();function Ace(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=Dce(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Dce(i,r){var e;if(i){if(typeof i=="string")return i$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i$(i,r)}}function i$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity):this.options.opacity=e.opacity),e.shape!==void 0)for(var t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].updateShape();if(typeof e.font<"u"||typeof e.widthConstraint<"u"||typeof e.heightConstraint<"u")for(var n=0,a=Oe(this.body.nodes);n1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.data.nodes;if(IE("id",e))this.body.data.nodes=e;else if(he(e))this.body.data.nodes=new Lu,this.body.data.nodes.add(e);else if(!e)this.body.data.nodes=new Lu;else throw new TypeError("Array or DataSet expected");if(n&&te(this.nodesListeners,function(s,u){n.off(u,s)}),this.body.nodes={},this.body.data.nodes){var a=this;te(this.nodesListeners,function(s,u){a.body.data.nodes.on(u,s)});var o=this.body.data.nodes.getIds();this.add(o,!0)}t===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n,a=[],o=0;o1&&arguments[1]!==void 0?arguments[1]:Nt;return new t(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}},{key:"refresh",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;te(this.body.nodes,function(n,a){var o=e.body.data.nodes.get(a);o!==void 0&&(t===!0&&n.setOptions({x:null,y:null}),n.setOptions({fixed:!1}),n.setOptions(o))})}},{key:"getPositions",value:function(e){var t={};if(e!==void 0){if(he(e)===!0){for(var n=0;n0?(u=s/o,t+=u*u):t+=s;return o===1/0?1/0:o*sde(t)}});var lde=oe,hde=lde.Math.hypot,cde=hde,dde=cde,fde=dde,vde=V(fde);function AT(i){var r=pde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function pde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Ne=function(){function i(){N(this,i)}return M(i,null,[{key:"transform",value:function(e,t){he(e)||(e=[e]);for(var n=t.point.x,a=t.point.y,o=t.angle,s=t.length,u=0;u4&&arguments[4]!==void 0?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,t),e.lineWidth=t.width,t.dashes!==!1?this._drawDashedLine(e,t,o):this._drawLine(e,t,o)}},{key:"_drawLine",value:function(e,t,n,a,o){if(this.from!=this.to)this._line(e,t,n,a,o);else{var s=this._getCircleData(e),u=Te(s,3),l=u[0],h=u[1],c=u[2];this._circle(e,t,l,h,c)}}},{key:"_drawDashedLine",value:function(e,t,n,a,o){e.lineCap="round";var s=he(t.dashes)?t.dashes:[5,5];if(e.setLineDash!==void 0){if(e.save(),e.setLineDash(s),e.lineDashOffset=0,this.from!=this.to)this._line(e,t,n);else{var u=this._getCircleData(e),l=Te(u,3),h=l[0],c=l[1],d=l[2];this._circle(e,t,h,c,d)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)XE(e,this.from.x,this.from.y,this.to.x,this.to.y,s);else{var f=this._getCircleData(e),v=Te(f,3),p=v[0],g=v[1],y=v[2];this._circle(e,t,p,g,y)}this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}}},{key:"findBorderPosition",value:function(e,t,n){return this.from!=this.to?this._findBorderPosition(e,t,n):this._findBorderPositionCircle(e,t,n)}},{key:"findBorderPositions",value:function(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};var t,n=it(t=this._getCircleData(e)).call(t,0,2),a=Te(n,2),o=a[0],s=a[1];return{from:this._findBorderPositionCircle(this.from,e,{x:o,y:s,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:o,y:s,low:.6,high:.8,direction:1})}}},{key:"_getCircleData",value:function(e){var t=this.options.selfReference.size;e!==void 0&&this.from.shape.width===void 0&&this.from.shape.resize(e);var n=OT(e,this.options.selfReference.angle,t,this.from);return[n.x,n.y,t]}},{key:"_pointOnCircle",value:function(e,t,n,a){var o=a*2*Math.PI;return{x:e+n*Math.cos(o),y:t-n*Math.sin(o)}}},{key:"_findBorderPositionCircle",value:function(e,t,n){var a=n.x,o=n.y,s=n.low,u=n.high,l=n.direction,h=10,c=this.options.selfReference.size,d=.05,f,v=(s+u)*.5,p=0;this.options.arrowStrikethrough===!0&&(l===-1?p=this.options.endPointOffset.from:l===1&&(p=this.options.endPointOffset.to));var g=0;do{v=(s+u)*.5,f=this._pointOnCircle(a,o,c,v);var y=Math.atan2(e.y-f.y,e.x-f.x),m=e.distanceToBorder(t,y)+p,$=Math.sqrt(Math.pow(f.x-e.x,2)+Math.pow(f.y-e.y,2)),b=m-$;if(Math.abs(b)0?l>0?s=v:u=v:l>0?u=v:s=v,++g}while(s<=u&&g1?c=1:c<0&&(c=0);var d=e+c*u,f=t+c*l,v=d-o,p=f-s;return Math.sqrt(v*v+p*p)}},{key:"getArrowData",value:function(e,t,n,a,o,s){var u,l,h,c,d,f,v,p=s.width;t==="from"?(h=this.from,c=this.to,d=s.fromArrowScale<0,f=Math.abs(s.fromArrowScale),v=s.fromArrowType):t==="to"?(h=this.to,c=this.from,d=s.toArrowScale<0,f=Math.abs(s.toArrowScale),v=s.toArrowType):(h=this.to,c=this.from,d=s.middleArrowScale<0,f=Math.abs(s.middleArrowScale),v=s.middleArrowType);var g=15*f+3*p;if(h!=c){var y=vde(h.x-c.x,h.y-c.y),m=g/y;if(t!=="middle")if(this.options.smooth.enabled===!0){var $=this._findBorderPosition(h,e,{via:n}),b=this.getPoint($.t+m*(t==="from"?1:-1),n);u=Math.atan2($.y-b.y,$.x-b.x),l=$}else u=Math.atan2(h.y-c.y,h.x-c.x),l=this._findBorderPosition(h,e);else{var O=(d?-m:m)/2,_=this.getPoint(.5+O,n),D=this.getPoint(.5-O,n);u=Math.atan2(_.y-D.y,_.x-D.x),l=this.getPoint(.5,n)}}else{var R=this._getCircleData(e),P=Te(R,3),B=P[0],j=P[1],J=P[2];if(t==="from"){var U=this.options.selfReference.angle,ie=this.options.selfReference.angle+Math.PI,_e=this._findBorderPositionCircle(this.from,e,{x:B,y:j,low:U,high:ie,direction:-1});u=_e.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI,l=_e}else if(t==="to"){var ye=this.options.selfReference.angle,Ae=this.options.selfReference.angle+Math.PI,ht=this._findBorderPositionCircle(this.from,e,{x:B,y:j,low:ye,high:Ae,direction:1});u=ht.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI,l=ht}else{var at=this.options.selfReference.angle/(2*Math.PI);l=this._pointOnCircle(B,j,J,at),u=at*-2*Math.PI+1.5*Math.PI+.1*Math.PI}}var Dt=l.x-g*.9*Math.cos(u),ot=l.y-g*.9*Math.sin(u),me={x:Dt,y:ot};return{point:l,core:me,angle:u,length:g,type:v}}},{key:"drawArrowHead",value:function(e,t,n,a,o){e.strokeStyle=this.getColor(e,t),e.fillStyle=e.strokeStyle,e.lineWidth=t.width;var s=DT.draw(e,o);s&&(this.enableShadow(e,t),hs(e).call(e),this.disableShadow(e,t))}},{key:"enableShadow",value:function(e,t){t.shadow===!0&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}},{key:"disableShadow",value:function(e,t){t.shadow===!0&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}},{key:"drawBackground",value:function(e,t){if(t.background!==!1){var n={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),e.strokeStyle=n.strokeStyle,e.lineWidth=n.lineWidth,e.dashes=n.dashes,this.setStrokeDashed(e,t.dashes)}}},{key:"setStrokeDashed",value:function(e,t){if(t!==!1)if(e.setLineDash!==void 0){var n=he(t)?t:[5,5];e.setLineDash(n)}else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");else e.setLineDash!==void 0?e.setLineDash([]):console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.")}}]),i}();function l$(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function h$(i){for(var r=1;r"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var gp=function(i){ue(e,i);var r=kde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_findBorderPositionBezier",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this._getViaCoordinates(),s=10,u=.2,l=!1,h=1,c=0,d=this.to,f,v,p=this.options.endPointOffset?this.options.endPointOffset.to:0;n.id===this.from.id&&(d=this.from,l=!0,p=this.options.endPointOffset?this.options.endPointOffset.from:0),this.options.arrowStrikethrough===!1&&(p=0);var g=0;do{v=(c+h)*.5,f=this.getPoint(v,o);var y=Math.atan2(d.y-f.y,d.x-f.x),m=d.distanceToBorder(a,y)+p,$=Math.sqrt(Math.pow(f.x-d.x,2)+Math.pow(f.y-d.y,2)),b=m-$;if(Math.abs(b)0&&(d=this._getDistanceToLine(y,m,p,g,u,l),c=d"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var c$=function(i){ue(e,i);var r=xde(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o.via=o.via,o._boundFunction=function(){o.positionBezierNode()},o._body.emitter.on("_repositionBezierNodes",o._boundFunction),o}return M(e,[{key:"setOptions",value:function(n){_u(L(e.prototype),"setOptions",this).call(this,n);var a=!1;this.options.physics!==n.physics&&(a=!0),this.options=n,this.id=this.options.id,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.setupSupportNode(),this.connect(),a===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}},{key:"connect",value:function(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.from===void 0||this.to===void 0||this.options.physics===!1?this.via.setOptions({physics:!1}):this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}},{key:"cleanup",value:function(){return this._body.emitter.off("_repositionBezierNodes",this._boundFunction),this.via!==void 0?(delete this._body.nodes[this.via.id],this.via=void 0,!0):!1}},{key:"setupSupportNode",value:function(){if(this.via===void 0){var n="edgeId:"+this.id,a=this._body.functions.createNode({id:n,shape:"circle",physics:!0,hidden:!0});this._body.nodes[n]=a,this.via=a,this.via.parentEdgeId=this.id,this.positionBezierNode()}}},{key:"positionBezierNode",value:function(){this.via!==void 0&&this.from!==void 0&&this.to!==void 0?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):this.via!==void 0&&(this.via.x=0,this.via.y=0)}},{key:"_line",value:function(n,a,o){this._bezierCurve(n,a,o)}},{key:"_getViaCoordinates",value:function(){return this.via}},{key:"getViaNode",value:function(){return this.via}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.via;if(this.from===this.to){var o=this._getCircleData(),s=Te(o,3),u=s[0],l=s[1],h=s[2],c=2*Math.PI*(1-n);return{x:u+h*Math.sin(c),y:l+h-h*(1-Math.cos(c))}}else return{x:Math.pow(1-n,2)*this.fromPoint.x+2*n*(1-n)*a.x+Math.pow(n,2)*this.toPoint.x,y:Math.pow(1-n,2)*this.fromPoint.y+2*n*(1-n)*a.y+Math.pow(n,2)*this.toPoint.y}}},{key:"_findBorderPosition",value:function(n,a){return this._findBorderPositionBezier(n,a,this.via)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){return this._getDistanceToBezierEdge(n,a,o,s,u,l,this.via)}}]),e}(gp);function Ade(i){var r=Dde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Dde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var d$=function(i){ue(e,i);var r=Ade(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a,o){this._bezierCurve(n,a,o)}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_getViaCoordinates",value:function(){var n=this.options.smooth.roundness,a=this.options.smooth.type,o=Math.abs(this.from.x-this.to.x),s=Math.abs(this.from.y-this.to.y);if(a==="discrete"||a==="diagonalCross"){var u,l;o<=s?u=l=n*s:u=l=n*o,this.from.x>this.to.x&&(u=-u),this.from.y>=this.to.y&&(l=-l);var h=this.from.x+u,c=this.from.y+l;return a==="discrete"&&(o<=s?h=othis.to.x&&(R=-R),this.from.y>=this.to.y&&(P=-P);var B=this.from.x+R,j=this.from.y+P;return o<=s?this.from.x<=this.to.x?B=this.to.xB?this.to.x:B:this.from.y>=this.to.y?j=this.to.y>j?this.to.y:j:j=this.to.y2&&arguments[2]!==void 0?arguments[2]:{};return this._findBorderPositionBezier(n,a,o.via)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){var h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(n,a,o,s,u,l,h)}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),o=n,s=Math.pow(1-o,2)*this.fromPoint.x+2*o*(1-o)*a.x+Math.pow(o,2)*this.toPoint.x,u=Math.pow(1-o,2)*this.fromPoint.y+2*o*(1-o)*a.y+Math.pow(o,2)*this.toPoint.y;return{x:s,y:u}}}]),e}(gp);function Rde(i){var r=Nde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Nde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Mde=function(i){ue(e,i);var r=Rde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_getDistanceToBezierEdge2",value:function(n,a,o,s,u,l,h,c){for(var d=1e9,f=n,v=a,p=[0,0,0,0],g=1;g<10;g++){var y=.1*g;p[0]=Math.pow(1-y,3),p[1]=3*y*Math.pow(1-y,2),p[2]=3*Math.pow(y,2)*(1-y),p[3]=Math.pow(y,3);var m=p[0]*n+p[1]*h.x+p[2]*c.x+p[3]*o,$=p[0]*a+p[1]*h.y+p[2]*c.y+p[3]*s;if(g>0){var b=this._getDistanceToLine(f,v,m,$,u,l);d=b"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var f$=function(i){ue(e,i);var r=Bde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a,o){var s=o[0],u=o[1];this._bezierCurve(n,a,s,u)}},{key:"_getViaCoordinates",value:function(){var n=this.from.x-this.to.x,a=this.from.y-this.to.y,o,s,u,l,h=this.options.smooth.roundness;return(Math.abs(n)>Math.abs(a)||this.options.smooth.forceDirection===!0||this.options.smooth.forceDirection==="horizontal")&&this.options.smooth.forceDirection!=="vertical"?(s=this.from.y,l=this.to.y,o=this.from.x-h*n,u=this.to.x+h*n):(s=this.from.y-h*a,l=this.to.y+h*a,o=this.from.x,u=this.to.x),[{x:o,y:s},{x:u,y:l}]}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_findBorderPosition",value:function(n,a){return this._findBorderPositionBezier(n,a)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){var h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates(),c=Te(h,2),d=c[0],f=c[1];return this._getDistanceToBezierEdge2(n,a,o,s,u,l,d,f)}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),o=Te(a,2),s=o[0],u=o[1],l=n,h=[Math.pow(1-l,3),3*l*Math.pow(1-l,2),3*Math.pow(l,2)*(1-l),Math.pow(l,3)],c=h[0]*this.fromPoint.x+h[1]*s.x+h[2]*u.x+h[3]*this.toPoint.x,d=h[0]*this.fromPoint.y+h[1]*s.y+h[2]*u.y+h[3]*this.toPoint.y;return{x:c,y:d}}}]),e}(Mde);function jde(i){var r=Lde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Lde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var v$=function(i){ue(e,i);var r=jde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a){n.beginPath(),n.moveTo(this.fromPoint.x,this.fromPoint.y),n.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(n,a),n.stroke(),this.disableShadow(n,a)}},{key:"getViaNode",value:function(){}},{key:"getPoint",value:function(n){return{x:(1-n)*this.fromPoint.x+n*this.toPoint.x,y:(1-n)*this.fromPoint.y+n*this.toPoint.y}}},{key:"_findBorderPosition",value:function(n,a){var o=this.to,s=this.from;n.id===this.from.id&&(o=this.from,s=this.to);var u=Math.atan2(o.y-s.y,o.x-s.x),l=o.x-s.x,h=o.y-s.y,c=Math.sqrt(l*l+h*h),d=n.distanceToBorder(a,u),f=(c-d)/c;return{x:(1-f)*s.x+f*o.x,y:(1-f)*s.y+f*o.y,t:0}}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){return this._getDistanceToLine(n,a,o,s,u,l)}}]),e}(RT),qn=function(){function i(r,e,t,n,a){if(N(this,i),e===void 0)throw new Error("No body provided");this.options=di(n),this.globalOptions=n,this.defaultOptions=a,this.body=e,this.imagelist=t,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new IT(this.body,this.options,!0),this.setOptions(r)}return M(i,[{key:"setOptions",value:function(e){if(e){var t=typeof e.physics<"u"&&this.options.physics!==e.physics||typeof e.hidden<"u"&&(this.options.hidden||!1)!==(e.hidden||!1)||typeof e.from<"u"&&this.options.from!==e.from||typeof e.to<"u"&&this.options.to!==e.to;i.parseOptions(this.options,e,!0,this.globalOptions),e.id!==void 0&&(this.id=e.id),e.from!==void 0&&(this.fromId=e.from),e.to!==void 0&&(this.toId=e.to),e.title!==void 0&&(this.title=e.title),e.value!==void 0&&(e.value=ST(e.value));var n=[e,this.options,this.defaultOptions];return this.chooser=dp("edge",n),this.updateLabelModule(e),t=this.updateEdgeType()||t,this._setInteractionWidths(),this.connect(),t}}},{key:"getFormattingValues",value:function(){var e=this.options.arrows.to===!0||this.options.arrows.to.enabled===!0,t=this.options.arrows.from===!0||this.options.arrows.from.enabled===!0,n=this.options.arrows.middle===!0||this.options.arrows.middle.enabled===!0,a=this.options.color.inherit,o={toArrow:e,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,toArrowSrc:this.options.arrows.to.src,toArrowImageWidth:this.options.arrows.to.imageWidth,toArrowImageHeight:this.options.arrows.to.imageHeight,middleArrow:n,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,middleArrowSrc:this.options.arrows.middle.src,middleArrowImageWidth:this.options.arrows.middle.imageWidth,middleArrowImageHeight:this.options.arrows.middle.imageHeight,fromArrow:t,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,fromArrowSrc:this.options.arrows.from.src,fromArrowImageWidth:this.options.arrows.from.imageWidth,fromArrowImageHeight:this.options.arrows.from.imageHeight,arrowStrikethrough:this.options.arrowStrikethrough,color:a?void 0:this.options.color.color,inheritsColor:a,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width,background:this.options.background.enabled,backgroundColor:this.options.background.color,backgroundSize:this.options.background.size,backgroundDashes:this.options.background.dashes};if(this.selected||this.hover)if(this.chooser===!0){if(this.selected){var s=this.options.selectionWidth;typeof s=="function"?o.width=s(o.width):typeof s=="number"&&(o.width+=s),o.width=Math.max(o.width,.3/this.body.view.scale),o.color=this.options.color.highlight,o.shadow=this.options.shadow.enabled}else if(this.hover){var u=this.options.hoverWidth;typeof u=="function"?o.width=u(o.width):typeof u=="number"&&(o.width+=u),o.width=Math.max(o.width,.3/this.body.view.scale),o.color=this.options.color.hover,o.shadow=this.options.shadow.enabled}}else typeof this.chooser=="function"&&(this.chooser(o,this.options.id,this.selected,this.hover),o.color!==void 0&&(o.inheritsColor=!1),o.shadow===!1&&(o.shadowColor!==this.options.shadow.color||o.shadowSize!==this.options.shadow.size||o.shadowX!==this.options.shadow.x||o.shadowY!==this.options.shadow.y)&&(o.shadow=!0));else o.shadow=this.options.shadow.enabled,o.width=Math.max(o.width,.3/this.body.view.scale);return o}},{key:"updateLabelModule",value:function(e){var t=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,t),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}},{key:"updateEdgeType",value:function(){var e=this.options.smooth,t=!1,n=!0;return this.edgeType!==void 0&&((this.edgeType instanceof c$&&e.enabled===!0&&e.type==="dynamic"||this.edgeType instanceof f$&&e.enabled===!0&&e.type==="cubicBezier"||this.edgeType instanceof d$&&e.enabled===!0&&e.type!=="dynamic"&&e.type!=="cubicBezier"||this.edgeType instanceof v$&&e.type.enabled===!1)&&(n=!1),n===!0&&(t=this.cleanup())),n===!0?e.enabled===!0?e.type==="dynamic"?(t=!0,this.edgeType=new c$(this.options,this.body,this.labelModule)):e.type==="cubicBezier"?this.edgeType=new f$(this.options,this.body,this.labelModule):this.edgeType=new d$(this.options,this.body,this.labelModule):this.edgeType=new v$(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),t}},{key:"connect",value:function(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=this.from!==void 0&&this.to!==void 0,this.connected===!0?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}},{key:"disconnect",value:function(){this.from&&(this.from.detachEdge(this),this.from=void 0),this.to&&(this.to.detachEdge(this),this.to=void 0),this.connected=!1}},{key:"getTitle",value:function(){return this.title}},{key:"isSelected",value:function(){return this.selected}},{key:"getValue",value:function(){return this.options.value}},{key:"setValueRange",value:function(e,t,n){if(this.options.value!==void 0){var a=this.options.scaling.customScalingFunction(e,t,n,this.options.value),o=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){var s=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+a*s}this.options.width=this.options.scaling.min+a*o}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}},{key:"_setInteractionWidths",value:function(){typeof this.options.hoverWidth=="function"?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,typeof this.options.selectionWidth=="function"?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}},{key:"draw",value:function(e){var t=this.getFormattingValues();if(!t.hidden){var n=this.edgeType.getViaNode();this.edgeType.drawLine(e,t,this.selected,this.hover,n),this.drawLabel(e,n)}}},{key:"drawArrows",value:function(e){var t=this.getFormattingValues();if(!t.hidden){var n=this.edgeType.getViaNode(),a={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,t.fromArrow&&(a.from=this.edgeType.getArrowData(e,"from",n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.fromPoint=a.from.core),t.fromArrowSrc&&(a.from.image=this.imagelist.load(t.fromArrowSrc)),t.fromArrowImageWidth&&(a.from.imageWidth=t.fromArrowImageWidth),t.fromArrowImageHeight&&(a.from.imageHeight=t.fromArrowImageHeight)),t.toArrow&&(a.to=this.edgeType.getArrowData(e,"to",n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.toPoint=a.to.core),t.toArrowSrc&&(a.to.image=this.imagelist.load(t.toArrowSrc)),t.toArrowImageWidth&&(a.to.imageWidth=t.toArrowImageWidth),t.toArrowImageHeight&&(a.to.imageHeight=t.toArrowImageHeight)),t.middleArrow&&(a.middle=this.edgeType.getArrowData(e,"middle",n,this.selected,this.hover,t),t.middleArrowSrc&&(a.middle.image=this.imagelist.load(t.middleArrowSrc)),t.middleArrowImageWidth&&(a.middle.imageWidth=t.middleArrowImageWidth),t.middleArrowImageHeight&&(a.middle.imageHeight=t.middleArrowImageHeight)),t.fromArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.from),t.middleArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.middle),t.toArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.to)}}},{key:"drawLabel",value:function(e,t){if(this.options.label!==void 0){var n=this.from,a=this.to;this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover);var o;if(n.id!=a.id){this.labelModule.pointToSelf=!1,o=this.edgeType.getPoint(.5,t),e.save();var s=this._getRotation(e);s.angle!=0&&(e.translate(s.x,s.y),e.rotate(s.angle)),this.labelModule.draw(e,o.x,o.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;var u=OT(e,this.options.selfReference.angle,this.options.selfReference.size,n);o=this._pointOnCircle(u.x,u.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(e,o.x,o.y,this.selected,this.hover)}}}},{key:"getItemsOnPoint",value:function(e){var t=[];if(this.labelModule.visible()){var n=this._getRotation();Af(this.labelModule.getSize(),e,n)&&t.push({edgeId:this.id,labelId:0})}var a={left:e.x,top:e.y};return this.isOverlappingWith(a)&&t.push({edgeId:this.id}),t}},{key:"isOverlappingWith",value:function(e){if(this.connected){var t=10,n=this.from.x,a=this.from.y,o=this.to.x,s=this.to.y,u=e.left,l=e.top,h=this.edgeType.getDistanceToEdge(n,a,o,s,u,l);return h0&&s<0)&&(u+=Math.PI),a.angle=u,a}},{key:"_pointOnCircle",value:function(e,t,n,a){return{x:e+n*Math.cos(a),y:t-n*Math.sin(a)}}},{key:"select",value:function(){this.selected=!0}},{key:"unselect",value:function(){this.selected=!1}},{key:"cleanup",value:function(){return this.edgeType.cleanup()}},{key:"remove",value:function(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}},{key:"endPointsValid",value:function(){return this.body.nodes[this.fromId]!==void 0&&this.body.nodes[this.toId]!==void 0}}],[{key:"parseOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,s=["endPointOffset","arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","selfReference","to","title","value","width","font","chosen","widthConstraint"];if(Ma(s,e,t,n),t.endPointOffset!==void 0&&t.endPointOffset.from!==void 0&&(Di(t.endPointOffset.from)?e.endPointOffset.from=t.endPointOffset.from:(e.endPointOffset.from=a.endPointOffset.from!==void 0?a.endPointOffset.from:0,console.error("endPointOffset.from is not a valid number"))),t.endPointOffset!==void 0&&t.endPointOffset.to!==void 0&&(Di(t.endPointOffset.to)?e.endPointOffset.to=t.endPointOffset.to:(e.endPointOffset.to=a.endPointOffset.to!==void 0?a.endPointOffset.to:0,console.error("endPointOffset.to is not a valid number"))),Zu(t.label)?e.label=t.label:Zu(e.label)||(e.label=void 0),Ut(e,t,"smooth",a),Ut(e,t,"shadow",a),Ut(e,t,"background",a),t.dashes!==void 0&&t.dashes!==null?e.dashes=t.dashes:n===!0&&t.dashes===null&&(e.dashes=zi(a.dashes)),t.scaling!==void 0&&t.scaling!==null?(t.scaling.min!==void 0&&(e.scaling.min=t.scaling.min),t.scaling.max!==void 0&&(e.scaling.max=t.scaling.max),Ut(e.scaling,t.scaling,"label",a.scaling)):n===!0&&t.scaling===null&&(e.scaling=zi(a.scaling)),t.arrows!==void 0&&t.arrows!==null)if(typeof t.arrows=="string"){var u=t.arrows.toLowerCase();e.arrows.to.enabled=ne(u).call(u,"to")!=-1,e.arrows.middle.enabled=ne(u).call(u,"middle")!=-1,e.arrows.from.enabled=ne(u).call(u,"from")!=-1}else if(de(t.arrows)==="object")Ut(e.arrows,t.arrows,"to",a.arrows),Ut(e.arrows,t.arrows,"middle",a.arrows),Ut(e.arrows,t.arrows,"from",a.arrows);else throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+ls(t.arrows));else n===!0&&t.arrows===null&&(e.arrows=zi(a.arrows));if(t.color!==void 0&&t.color!==null){var l=Kn(t.color)?{color:t.color,highlight:t.color,hover:t.color,inherit:!1,opacity:1}:t.color,h=e.color;if(o)pe(h,a.color,!1,n);else for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&delete h[c];if(Kn(h))h.color=h,h.highlight=h,h.hover=h,h.inherit=!1,l.opacity===void 0&&(h.opacity=1);else{var d=!1;l.color!==void 0&&(h.color=l.color,d=!0),l.highlight!==void 0&&(h.highlight=l.highlight,d=!0),l.hover!==void 0&&(h.hover=l.hover,d=!0),l.inherit!==void 0&&(h.inherit=l.inherit),l.opacity!==void 0&&(h.opacity=Math.min(1,Math.max(0,l.opacity))),d===!0?h.inherit=!1:h.inherit===void 0&&(h.inherit="from")}}else n===!0&&t.color===null&&(e.color=di(a.color));n===!0&&t.font===null&&(e.font=di(a.font)),Object.prototype.hasOwnProperty.call(t,"selfReferenceSize")&&(console.warn("The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}"),e.selfReference.size=t.selfReferenceSize)}}]),i}(),zde=function(){function i(r,e,t){var n,a=this;N(this,i),this.body=r,this.images=e,this.groups=t,this.body.functions.createEdge=k(n=this.create).call(n,this),this.edgesListeners={add:function(s,u){a.add(u.items)},update:function(s,u){a.update(u.items)},remove:function(s,u){a.remove(u.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},endPointOffset:{from:0,to:0},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(s,u,l,h){if(u===s)return .5;var c=1/(u-s);return Math.max(0,(h-s)*c)}},selectionWidth:1.5,selfReference:{size:20,angle:Math.PI/4,renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},background:{enabled:!1,color:"rgba(111,111,111,1)",size:10,dashes:!1},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},pe(this.options,this.defaultOptions),this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this,t,n;this.body.emitter.on("_forceDisableDynamicCurves",function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a==="dynamic"&&(a="continuous");var s=!1;for(var u in e.body.edges)if(Object.prototype.hasOwnProperty.call(e.body.edges,u)){var l=e.body.edges[u],h=e.body.data.edges.get(u);if(h!=null){var c=h.smooth;c!==void 0&&c.enabled===!0&&c.type==="dynamic"&&(a===void 0?l.setOptions({smooth:!1}):l.setOptions({smooth:{type:a}}),s=!0)}}o===!0&&s===!0&&e.body.emitter.emit("_dataChanged")}),this.body.emitter.on("_dataUpdated",function(){e.reconnectEdges()}),this.body.emitter.on("refreshEdges",k(t=this.refresh).call(t,this)),this.body.emitter.on("refresh",k(n=this.refresh).call(n,this)),this.body.emitter.on("destroy",function(){te(e.edgesListeners,function(a,o){e.body.data.edges&&e.body.data.edges.off(o,a)}),delete e.body.functions.createEdge,delete e.edgesListeners.add,delete e.edgesListeners.update,delete e.edgesListeners.remove,delete e.edgesListeners})}},{key:"setOptions",value:function(e){if(e!==void 0){qn.parseOptions(this.options,e,!0,this.defaultOptions,!0);var t=!1;if(e.smooth!==void 0)for(var n in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,n)&&(t=this.body.edges[n].updateEdgeType()||t);if(e.font!==void 0)for(var a in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,a)&&this.body.edges[a].updateLabelModule();(e.hidden!==void 0||e.physics!==void 0||t===!0)&&this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.body.data.edges;if(IE("id",e))this.body.data.edges=e;else if(he(e))this.body.data.edges=new Lu,this.body.data.edges.add(e);else if(!e)this.body.data.edges=new Lu;else throw new TypeError("Array or DataSet expected");if(a&&te(this.edgesListeners,function(s,u){a.off(u,s)}),this.body.edges={},this.body.data.edges){te(this.edgesListeners,function(s,u){t.body.data.edges.on(u,s)});var o=this.body.data.edges.getIds();this.add(o,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),n===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.edges,a=this.body.data.edges,o=0;o1&&arguments[1]!==void 0?arguments[1]:!0;if(e.length!==0){var n=this.body.edges;te(e,function(a){var o=n[a];o!==void 0&&o.remove()}),t&&this.body.emitter.emit("_dataChanged")}}},{key:"refresh",value:function(){var e=this;te(this.body.edges,function(t,n){var a=e.body.data.edges.get(n);a!==void 0&&t.setOptions(a)})}},{key:"create",value:function(e){return new qn(e,this.body,this.images,this.options,this.defaultOptions)}},{key:"reconnectEdges",value:function(){var e,t=this.body.nodes,n=this.body.edges;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e].edges=[]);for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)){var a=n[e];a.from=null,a.to=null,a.connect()}}},{key:"getConnectedNodes",value:function(e){var t=[];if(this.body.edges[e]!==void 0){var n=this.body.edges[e];n.fromId!==void 0&&t.push(n.fromId),n.toId!==void 0&&t.push(n.toId)}return t}},{key:"_updateState",value:function(){this._addMissingEdges(),this._removeInvalidEdges()}},{key:"_removeInvalidEdges",value:function(){var e=this,t=[];te(this.body.edges,function(n,a){var o=e.body.nodes[n.toId],s=e.body.nodes[n.fromId];o!==void 0&&o.isCluster===!0||s!==void 0&&s.isCluster===!0||(o===void 0||s===void 0)&&t.push(a)}),this.remove(t,!1)}},{key:"_addMissingEdges",value:function(){var e=this.body.data.edges;if(e!=null){var t=this.body.edges,n=[];fe(e).call(e,function(a,o){var s=t[o];s===void 0&&n.push(o)}),this.add(n,!0)}}}]),i}(),NT=function(){function i(r,e,t){N(this,i),this.body=r,this.physicsBody=e,this.barnesHutTree,this.setOptions(t),this._rng=Ql("BARNES HUT SOLVER")}return M(i,[{key:"setOptions",value:function(e){this.options=e,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}},{key:"solve",value:function(){if(this.options.gravitationalConstant!==0&&this.physicsBody.physicsNodeIndices.length>0){var e,t=this.body.nodes,n=this.physicsBody.physicsNodeIndices,a=n.length,o=this._formBarnesHutTree(t,n);this.barnesHutTree=o;for(var s=0;s0&&this._getForceContributions(o.root,e)}}},{key:"_getForceContributions",value:function(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}},{key:"_getForceContribution",value:function(e,t){if(e.childrenCount>0){var n=e.centerOfMass.x-t.x,a=e.centerOfMass.y-t.y,o=Math.sqrt(n*n+a*a);o*e.calcSize>this.thetaInversed?this._calculateForces(o,n,a,t,e):e.childrenCount===4?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(o,n,a,t,e)}}},{key:"_calculateForces",value:function(e,t,n,a,o){e===0&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&a.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*a.shape.radius,e-a.shape.radius));var s=this.options.gravitationalConstant*o.mass*a.options.mass/Math.pow(e,3),u=t*s,l=n*s;this.physicsBody.forces[a.id].x+=u,this.physicsBody.forces[a.id].y+=l}},{key:"_formBarnesHutTree",value:function(e,t){for(var n,a=t.length,o=e[t[0]].x,s=e[t[0]].y,u=e[t[0]].x,l=e[t[0]].y,h=1;h0&&(du&&(u=d),fl&&(l=f))}var v=Math.abs(u-o)-Math.abs(l-s);v>0?(s-=.5*v,l+=.5*v):(o+=.5*v,u-=.5*v);var p=1e-5,g=Math.max(p,Math.abs(u-o)),y=.5*g,m=.5*(o+u),$=.5*(s+l),b={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:m-y,maxX:m+y,minY:$-y,maxY:$+y},size:g,calcSize:1/g,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(b.root);for(var O=0;O0&&this._placeInTree(b.root,n);return b}},{key:"_updateBranchMass",value:function(e,t){var n=e.centerOfMass,a=e.mass+t.options.mass,o=1/a;n.x=n.x*e.mass+t.x*t.options.mass,n.x*=o,n.y=n.y*e.mass+t.y*t.options.mass,n.y*=o,e.mass=a;var s=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidtht.x?a.maxY>t.y?o="NW":o="SW":a.maxY>t.y?o="NE":o="SE",this._placeInRegion(e,t,o)}},{key:"_placeInRegion",value:function(e,t,n){var a=e.children[n];switch(a.childrenCount){case 0:a.children.data=t,a.childrenCount=1,this._updateBranchMass(a,t);break;case 1:a.children.data.x===t.x&&a.children.data.y===t.y?(t.x+=this._rng(),t.y+=this._rng()):(this._splitBranch(a),this._placeInTree(a,t));break;case 4:this._placeInTree(a,t);break}}},{key:"_splitBranch",value:function(e){var t=null;e.childrenCount===1&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),t!=null&&this._placeInTree(e,t)}},{key:"_insertRegion",value:function(e,t){var n,a,o,s,u=.5*e.size;switch(t){case"NW":n=e.range.minX,a=e.range.minX+u,o=e.range.minY,s=e.range.minY+u;break;case"NE":n=e.range.minX+u,a=e.range.maxX,o=e.range.minY,s=e.range.minY+u;break;case"SW":n=e.range.minX,a=e.range.minX+u,o=e.range.minY+u,s=e.range.maxY;break;case"SE":n=e.range.minX+u,a=e.range.maxX,o=e.range.minY+u,s=e.range.maxY;break}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:n,maxX:a,minY:o,maxY:s},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}},{key:"_debug",value:function(e,t){this.barnesHutTree!==void 0&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}},{key:"_drawBranch",value:function(e,t,n){n===void 0&&(n="#FF0000"),e.childrenCount===4&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=n,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}]),i}(),Hde=function(){function i(r,e,t){N(this,i),this._rng=Ql("REPULSION SOLVER"),this.body=r,this.physicsBody=e,this.setOptions(t)}return M(i,[{key:"setOptions",value:function(e){this.options=e}},{key:"solve",value:function(){for(var e,t,n,a,o,s,u,l,h=this.body.nodes,c=this.physicsBody.physicsNodeIndices,d=this.physicsBody.forces,f=this.options.nodeDistance,v=-2/3/f,p=4/3,g=0;g"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Gde=function(i){ue(e,i);var r=Ude(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._rng=Ql("FORCE ATLAS 2 BASED REPULSION SOLVER"),o}return M(e,[{key:"_calculateForces",value:function(n,a,o,s,u){n===0&&(n=.1*this._rng(),a=n),this.overlapAvoidanceFactor<1&&s.shape.radius&&(n=Math.max(.1+this.overlapAvoidanceFactor*s.shape.radius,n-s.shape.radius));var l=s.edges.length+1,h=this.options.gravitationalConstant*u.mass*s.options.mass*l/Math.pow(n,2),c=a*h,d=o*h;this.physicsBody.forces[s.id].x+=c,this.physicsBody.forces[s.id].y+=d}}]),e}(NT);function qde(i){var r=Yde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Yde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Xde=function(i){ue(e,i);var r=qde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_calculateForces",value:function(n,a,o,s,u){if(n>0){var l=u.edges.length+1,h=this.options.centralGravity*l*u.options.mass;s[u.id].x=a*h,s[u.id].y=o*h}}}]),e}(Eu),Jde=function(){function i(r){N(this,i),this.body=r,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},Le(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("initPhysics",function(){e.initPhysics()}),this.body.emitter.on("_layoutFailed",function(){e.layoutFailed=!0}),this.body.emitter.on("resetPhysics",function(){e.stopSimulation(),e.ready=!1}),this.body.emitter.on("disablePhysics",function(){e.physicsEnabled=!1,e.stopSimulation()}),this.body.emitter.on("restorePhysics",function(){e.setOptions(e.options),e.ready===!0&&e.startSimulation()}),this.body.emitter.on("startSimulation",function(){e.ready===!0&&e.startSimulation()}),this.body.emitter.on("stopSimulation",function(){e.stopSimulation()}),this.body.emitter.on("destroy",function(){e.stopSimulation(!1),e.body.emitter.off()}),this.body.emitter.on("_dataChanged",function(){e.updatePhysicsData()})}},{key:"setOptions",value:function(e){if(e!==void 0)if(e===!1)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(e===!0)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,Yu(["stabilization"],this.options,e),Ut(this.options,e,"stabilization"),e.enabled===void 0&&(this.options.enabled=!0),this.options.enabled===!1&&(this.physicsEnabled=!1,this.stopSimulation());var t=this.options.wind;t&&((typeof t.x!="number"||Cf(t.x))&&(t.x=0),(typeof t.y!="number"||Cf(t.y))&&(t.y=0)),this.timestep=this.options.timestep}this.init()}},{key:"init",value:function(){var e;this.options.solver==="forceAtlas2Based"?(e=this.options.forceAtlas2Based,this.nodesSolver=new Gde(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Xde(this.body,this.physicsBody,e)):this.options.solver==="repulsion"?(e=this.options.repulsion,this.nodesSolver=new Hde(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)):this.options.solver==="hierarchicalRepulsion"?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new Vde(this.body,this.physicsBody,e),this.edgesSolver=new Wde(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new NT(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)),this.modelOptions=e}},{key:"initPhysics",value:function(){this.physicsEnabled===!0&&this.options.enabled===!0?this.options.stabilization.enabled===!0?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}},{key:"startSimulation",value:function(){if(this.physicsEnabled===!0&&this.options.enabled===!0){if(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),this.viewFunction===void 0){var e;this.viewFunction=k(e=this.simulationStep).call(e,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}else this.body.emitter.emit("_redraw")}},{key:"stopSimulation",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.stabilized=!0,e===!0&&this._emitStabilized(),this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,e===!0&&this.body.emitter.emit("_stopRendering"))}},{key:"simulationStep",value:function(){var e=Uu();this.physicsTick();var t=Uu()-e;(t<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}},{key:"_emitStabilized",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&mr(function(){e.body.emitter.emit("stabilized",{iterations:t}),e.startedStabilization=!1,e.stabilizationIterations=0},0)}},{key:"physicsStep",value:function(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}},{key:"adjustTimeStep",value:function(){var e=1.2;this._evaluateStepQuality()===!0?this.timestep=e*this.timestep:this.timestep/es))return!1;return!0}},{key:"moveNodes",value:function(){for(var e=this.physicsBody.physicsNodeIndices,t=0,n=0,a=5,o=0;os&&(e=e>0?s:-s),e}},{key:"_performStep",value:function(e){var t=this.body.nodes[e],n=this.physicsBody.forces[e];this.options.wind&&(n.x+=this.options.wind.x,n.y+=this.options.wind.y);var a=this.physicsBody.velocities[e];this.previousStates[e]={x:t.x,y:t.y,vx:a.x,vy:a.y},t.options.fixed.x===!1?(a.x=this.calculateComponentVelocity(a.x,n.x,t.options.mass),t.x+=a.x*this.timestep):(n.x=0,a.x=0),t.options.fixed.y===!1?(a.y=this.calculateComponentVelocity(a.y,n.y,t.options.mass),t.y+=a.y*this.timestep):(n.y=0,a.y=0);var o=Math.sqrt(Math.pow(a.x,2)+Math.pow(a.y,2));return o}},{key:"_freezeNodes",value:function(){var e=this.body.nodes;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].x&&e[t].y){var n=e[t].options.fixed;this.freezeCache[t]={x:n.x,y:n.y},n.x=!0,n.y=!0}}},{key:"_restoreFrozenNodes",value:function(){var e=this.body.nodes;for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.freezeCache[t]!==void 0&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}},{key:"stabilize",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.stabilization.iterations;if(typeof t!="number"&&(t=this.options.stabilization.iterations,console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ",t)),this.physicsBody.physicsNodeIndices.length===0){this.ready=!0;return}this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=t,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,mr(function(){return e._stabilizationBatch()},0)}},{key:"_startStabilizing",value:function(){return this.startedStabilization===!0?!1:(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}},{key:"_stabilizationBatch",value:function(){var e=this,t=function(){return e.stabilized===!1&&e.stabilizationIterations1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,a=-1e9,o=1e9,s=-1e9,u;if(t.length>0)for(var l=0;lu.shape.boundingBox.left&&(o=u.shape.boundingBox.left),su.shape.boundingBox.top&&(n=u.shape.boundingBox.top),a1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,a=-1e9,o=1e9,s=-1e9,u;if(t.length>0)for(var l=0;lu.x&&(o=u.x),su.y&&(n=u.y),a"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var nfe=function(i){ue(e,i);var r=rfe(e);function e(t,n,a,o,s,u){var l;return N(this,e),l=r.call(this,t,n,a,o,s,u),l.isCluster=!0,l.containedNodes={},l.containedEdges={},l}return M(e,[{key:"_openChildCluster",value:function(n){var a=this,o=this.body.nodes[n];if(this.containedNodes[n]===void 0)throw new Error("node with id: "+n+" not in current cluster");if(!o.isCluster)throw new Error("node with id: "+n+" is not a cluster");delete this.containedNodes[n],te(o.edges,function(s){delete a.containedEdges[s.id]}),te(o.containedNodes,function(s,u){a.containedNodes[u]=s}),o.containedNodes={},te(o.containedEdges,function(s,u){a.containedEdges[u]=s}),o.containedEdges={},te(o.edges,function(s){te(a.edges,function(u){var l,h,c=ne(l=u.clusteringEdgeReplacingIds).call(l,s.id);c!==-1&&(te(s.clusteringEdgeReplacingIds,function(d){u.clusteringEdgeReplacingIds.push(d),a.body.edges[d].edgeReplacedById=u.id}),Ar(h=u.clusteringEdgeReplacingIds).call(h,c,1))})}),o.edges=[]}}]),e}(Nt),afe=function(){function i(r){var e=this;N(this,i),this.body=r,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},Le(this.options,this.defaultOptions),this.body.emitter.on("_resetData",function(){e.clusteredNodes={},e.clusteredEdges={}})}return M(i,[{key:"clusterByHubsize",value:function(e,t){e===void 0?e=this._getHubSize():de(e)==="object"&&(t=this._checkOptions(e),e=this._getHubSize());for(var n=[],a=0;a=e&&n.push(o.id)}for(var s=0;s0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.joinCondition===void 0)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");t=this._checkOptions(t);var a={},o={};te(this.body.nodes,function(s,u){s.options&&t.joinCondition(s.options)===!0&&(a[u]=s,te(s.edges,function(l){e.clusteredEdges[l.id]===void 0&&(o[l.id]=l)}))}),this._cluster(a,o,t,n)}},{key:"clusterByEdgeCount",value:function(e,t){var n=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;t=this._checkOptions(t);for(var o=[],s={},u,l,h,c=function(){var p={},g={},y=n.body.nodeIndices[d],m=n.body.nodes[y];if(s[y]===void 0){h=0,l=[];for(var $=0;$0&&Oe(g).length>0&&O===!0){var R=function(){for(var U=0;U1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(1,e,t)}},{key:"clusterBridges",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(2,e,t)}},{key:"clusterByConnection",value:function(e,t){var n,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No nodeId supplied to clusterByConnection!");if(this.body.nodes[e]===void 0)throw new Error("The nodeId given to clusterByConnection does not exist!");var o=this.body.nodes[e];t=this._checkOptions(t,o),t.clusterNodeProperties.x===void 0&&(t.clusterNodeProperties.x=o.x),t.clusterNodeProperties.y===void 0&&(t.clusterNodeProperties.y=o.y),t.clusterNodeProperties.fixed===void 0&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=o.options.fixed.x,t.clusterNodeProperties.fixed.y=o.options.fixed.y);var s={},u={},l=o.id,h=pt.cloneOptions(o);s[l]=o;for(var c=0;c-1&&(u[$.id]=$)}this._cluster(s,u,t,a)}},{key:"_createClusterEdges",value:function(e,t,n,a){for(var o,s,u,l,h,c,d=Oe(e),f=[],v=0;v0&&arguments[0]!==void 0?arguments[0]:{};return e.clusterEdgeProperties===void 0&&(e.clusterEdgeProperties={}),e.clusterNodeProperties===void 0&&(e.clusterNodeProperties={}),e}},{key:"_cluster",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&this.clusteredNodes[s]!==void 0&&o.push(s);for(var u=0;ua?u.x:a,o=u.ys?u.y:s;return{x:.5*(n+a),y:.5*(o+s)}}},{key:"openCluster",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No clusterNodeId supplied to openCluster.");var a=this.body.nodes[e];if(a===void 0)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(a.isCluster!==!0||a.containedNodes===void 0||a.containedEdges===void 0)throw new Error("The node:"+e+" is not a valid cluster.");var o=this.findNode(e),s=ne(o).call(o,e)-1;if(s>=0){var u=o[s],l=this.body.nodes[u];l._openChildCluster(e),delete this.body.nodes[e],n===!0&&this.body.emitter.emit("_dataChanged");return}var h=a.containedNodes,c=a.containedEdges;if(t!==void 0&&t.releaseFunction!==void 0&&typeof t.releaseFunction=="function"){var d={},f={x:a.x,y:a.y};for(var v in h)if(Object.prototype.hasOwnProperty.call(h,v)){var p=this.body.nodes[v];d[v]={x:p.x,y:p.y}}var g=t.releaseFunction(f,d);for(var y in h)if(Object.prototype.hasOwnProperty.call(h,y)){var m=this.body.nodes[y];g[y]!==void 0&&(m.x=g[y].x===void 0?a.x:g[y].x,m.y=g[y].y===void 0?a.y:g[y].y)}}else te(h,function(ht){ht.options.fixed.x===!1&&(ht.x=a.x),ht.options.fixed.y===!1&&(ht.y=a.y)});for(var $ in h)if(Object.prototype.hasOwnProperty.call(h,$)){var b=this.body.nodes[$];b.vx=a.vx,b.vy=a.vy,b.setOptions({physics:!0}),delete this.clusteredNodes[$]}for(var O=[],_=0;_0&&sa&&(a=s.edges.length),e+=s.edges.length,t+=Math.pow(s.edges.length,2),n+=1}e=e/n,t=t/n;var u=t-Math.pow(e,2),l=Math.sqrt(u),h=Math.floor(e+2*l);return h>a&&(h=a),h}},{key:"_createClusteredEdge",value:function(e,t,n,a,o){var s=pt.cloneOptions(n,"edge");pe(s,a),s.from=e,s.to=t,s.id="clusterEdge:"+no(),o!==void 0&&pe(s,o);var u=this.body.functions.createEdge(s);return u.clusteringEdgeReplacingIds=[n.id],u.connect(),this.body.edges[u.id]=u,u}},{key:"_clusterEdges",value:function(e,t,n,a){if(t instanceof qn){var o=t,s={};s[o.id]=o,t=s}if(e instanceof Nt){var u=e,l={};l[u.id]=u,e=l}if(n==null)throw new Error("_clusterEdges: parameter clusterNode required");a===void 0&&(a=n.clusterEdgeProperties),this._createClusterEdges(e,t,n,a);for(var h in t)if(Object.prototype.hasOwnProperty.call(t,h)&&this.body.edges[h]!==void 0){var c=this.body.edges[h];this._backupEdgeOptions(c),c.setOptions({physics:!1})}for(var d in e)Object.prototype.hasOwnProperty.call(e,d)&&(this.clusteredNodes[d]={clusterId:n.id,node:this.body.nodes[d]},this.body.nodes[d].setOptions({physics:!1}))}},{key:"_getClusterNodeForNode",value:function(e){if(e!==void 0){var t=this.clusteredNodes[e];if(t!==void 0){var n=t.clusterId;if(n!==void 0)return this.body.nodes[n]}}}},{key:"_filter",value:function(e,t){var n=[];return te(e,function(a){t(a)&&n.push(a)}),n}},{key:"_updateState",value:function(){var e=this,t,n=[],a={},o=function(v){te(e.body.nodes,function(p){p.isCluster===!0&&v(p)})};for(t in this.clusteredNodes)if(Object.prototype.hasOwnProperty.call(this.clusteredNodes,t)){var s=this.body.nodes[t];s===void 0&&n.push(t)}o(function(f){for(var v=0;v0}(!f.endPointsValid()||!p)&&(a[v]=v)}),o(function(f){te(a,function(v){delete f.containedEdges[v],te(f.edges,function(p,g){if(p.id===v){f.edges[g]=null;return}p.clusteringEdgeReplacingIds=e._filter(p.clusteringEdgeReplacingIds,function(y){return!a[y]})}),f.edges=e._filter(f.edges,function(p){return p!==null})})}),te(a,function(f){delete e.clusteredEdges[f]}),te(a,function(f){delete e.body.edges[f]});var l=Oe(this.body.edges);te(l,function(f){var v=e.body.edges[f],p=e._isClusteredNode(v.fromId)||e._isClusteredNode(v.toId);if(p!==e._isClusteredEdge(v.id))if(p){var g=e._getClusterNodeForNode(v.fromId);g!==void 0&&e._clusterEdges(e.body.nodes[v.fromId],v,g);var y=e._getClusterNodeForNode(v.toId);y!==void 0&&e._clusterEdges(e.body.nodes[v.toId],v,y)}else delete e._clusterEdges[f],e._restoreEdge(v)});for(var h=!1,c=!0,d=function(){var v=[];o(function(g){var y=Oe(g.containedNodes).length,m=g.options.allowSingleNodeCluster===!0;(m&&y<1||!m&&y<2)&&v.push(g.id)});for(var p=0;p0,h=h||c};c;)d();h&&this._updateState()}},{key:"_isClusteredNode",value:function(e){return this.clusteredNodes[e]!==void 0}},{key:"_isClusteredEdge",value:function(e){return this.clusteredEdges[e]!==void 0}}]),i}();function ofe(){var i;window!==void 0&&(i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame),i===void 0?window.requestAnimationFrame=function(r){r()}:window.requestAnimationFrame=i}var sfe=function(){function i(r,e){N(this,i),ofe(),this.body=r,this.canvas=e,this.redrawRequested=!1,this.renderTimer=void 0,this.requiresTimeout=!0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},Le(this.options,this.defaultOptions),this._determineBrowserMethod(),this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this,t;this.body.emitter.on("dragStart",function(){e.dragging=!0}),this.body.emitter.on("dragEnd",function(){e.dragging=!1}),this.body.emitter.on("zoom",function(){e.zooming=!0,window.clearTimeout(e.zoomTimeoutId),e.zoomTimeoutId=mr(function(){var n;e.zooming=!1,k(n=e._requestRedraw).call(n,e)()},250)}),this.body.emitter.on("_resizeNodes",function(){e._resizeNodes()}),this.body.emitter.on("_redraw",function(){e.renderingActive===!1&&e._redraw()}),this.body.emitter.on("_blockRedraw",function(){e.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",function(){e.allowRedraw=!0,e.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",k(t=this._requestRedraw).call(t,this)),this.body.emitter.on("_startRendering",function(){e.renderRequests+=1,e.renderingActive=!0,e._startRendering()}),this.body.emitter.on("_stopRendering",function(){e.renderRequests-=1,e.renderingActive=e.renderRequests>0,e.renderTimer=void 0}),this.body.emitter.on("destroy",function(){e.renderRequests=0,e.allowRedraw=!1,e.renderingActive=!1,e.requiresTimeout===!0?clearTimeout(e.renderTimer):window.cancelAnimationFrame(e.renderTimer),e.body.emitter.off()})}},{key:"setOptions",value:function(e){if(e!==void 0){var t=["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"];Ma(t,this.options,e)}}},{key:"_requestNextFrame",value:function(e,t){if(!(typeof window>"u")){var n,a=window;return this.requiresTimeout===!0?n=mr(e,t):a.requestAnimationFrame&&(n=a.requestAnimationFrame(e)),n}}},{key:"_startRendering",value:function(){if(this.renderingActive===!0&&this.renderTimer===void 0){var e;this.renderTimer=this._requestNextFrame(k(e=this._renderStep).call(e,this),this.simulationInterval)}}},{key:"_renderStep",value:function(){this.renderingActive===!0&&(this.renderTimer=void 0,this.requiresTimeout===!0&&this._startRendering(),this._redraw(),this.requiresTimeout===!1&&this._startRendering())}},{key:"redraw",value:function(){this.body.emitter.emit("setSize"),this._redraw()}},{key:"_requestRedraw",value:function(){var e=this;this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,this._requestNextFrame(function(){e._redraw(!1)},0))}},{key:"_redraw",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(this.allowRedraw===!0){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;var t={drawExternalLabels:null};(this.canvas.frame.canvas.width===0||this.canvas.frame.canvas.height===0)&&this.canvas.setSize(),this.canvas.setTransform();var n=this.canvas.getContext(),a=this.canvas.frame.canvas.clientWidth,o=this.canvas.frame.canvas.clientHeight;if(n.clearRect(0,0,a,o),this.canvas.frame.clientWidth===0)return;if(n.save(),n.translate(this.body.view.translation.x,this.body.view.translation.y),n.scale(this.body.view.scale,this.body.view.scale),n.beginPath(),this.body.emitter.emit("beforeDrawing",n),n.closePath(),e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawEdges(n),this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1){var s=this._drawNodes(n,e),u=s.drawExternalLabels;t.drawExternalLabels=u}e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawArrows(n),t.drawExternalLabels!=null&&t.drawExternalLabels(),e===!1&&this._drawSelectionBox(n),n.beginPath(),this.body.emitter.emit("afterDrawing",n),n.closePath(),n.restore(),e===!0&&n.clearRect(0,0,a,o)}}},{key:"_resizeNodes",value:function(){this.canvas.setTransform();var e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);var t=this.body.nodes,n;for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n=t[a],n.resize(e),n.updateBoundingBox(e,n.selected));e.restore()}},{key:"_drawNodes",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.nodes,a=this.body.nodeIndices,o,s=[],u=[],l=20,h=this.canvas.DOMtoCanvas({x:-20,y:-20}),c=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+l,y:this.canvas.frame.canvas.clientHeight+l}),d={top:h.y,left:h.x,bottom:c.y,right:c.x},f=[],v=0;v0&&arguments[0]!==void 0?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}},{key:"_setCameraState",value:function(){if(this.cameraState.scale!==void 0&&this.frame.canvas.clientWidth!==0&&this.frame.canvas.clientHeight!==0&&this.pixelRatio!==0&&this.cameraState.previousWidth>0&&this.cameraState.previousHeight>0){var e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight,n=this.cameraState.scale;e!=1&&t!=1?n=this.cameraState.scale*.5*(e+t):e!=1?n=this.cameraState.scale*e:t!=1&&(n=this.cameraState.scale*t),this.body.view.scale=n;var a=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),o={x:a.x-this.cameraState.position.x,y:a.y-this.cameraState.position.y};this.body.view.translation.x+=o.x*this.body.view.scale,this.body.view.translation.y+=o.y*this.body.view.scale}}},{key:"_prepareValue",value:function(e){if(typeof e=="number")return e+"px";if(typeof e=="string"){if(ne(e).call(e,"%")!==-1||ne(e).call(e,"px")!==-1)return e;if(ne(e).call(e,"%")===-1)return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}},{key:"_create",value:function(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=0,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{var e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerText="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}},{key:"_bindHammer",value:function(){var e=this;this.hammer!==void 0&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new Gn(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:Gn.DIRECTION_ALL}),Qu(this.hammer,function(t){e.body.eventListeners.onTouch(t)}),this.hammer.on("tap",function(t){e.body.eventListeners.onTap(t)}),this.hammer.on("doubletap",function(t){e.body.eventListeners.onDoubleTap(t)}),this.hammer.on("press",function(t){e.body.eventListeners.onHold(t)}),this.hammer.on("panstart",function(t){e.body.eventListeners.onDragStart(t)}),this.hammer.on("panmove",function(t){e.body.eventListeners.onDrag(t)}),this.hammer.on("panend",function(t){e.body.eventListeners.onDragEnd(t)}),this.hammer.on("pinch",function(t){e.body.eventListeners.onPinch(t)}),this.frame.canvas.addEventListener("wheel",function(t){e.body.eventListeners.onMouseWheel(t)}),this.frame.canvas.addEventListener("mousemove",function(t){e.body.eventListeners.onMouseMove(t)}),this.frame.canvas.addEventListener("contextmenu",function(t){e.body.eventListeners.onContext(t)}),this.hammerFrame=new Gn(this.frame),MT(this.hammerFrame,function(t){e.body.eventListeners.onRelease(t)})}},{key:"setSize",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.width,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);var n=!1,a=this.frame.canvas.width,o=this.frame.canvas.height,s=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(s),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},n=!0;else{var u=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),l=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);(this.frame.canvas.width!==u||this.frame.canvas.height!==l)&&this._getCameraState(s),this.frame.canvas.width!==u&&(this.frame.canvas.width=u,n=!0),this.frame.canvas.height!==l&&(this.frame.canvas.height=l,n=!0)}return n===!0&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(a/this.pixelRatio),oldHeight:Math.round(o/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,n}},{key:"getContext",value:function(){return this.frame.canvas.getContext("2d")}},{key:"_determinePixelRatio",value:function(){var e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");var t=1;typeof window<"u"&&(t=window.devicePixelRatio||1);var n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return t/n}},{key:"_setPixelRatio",value:function(){this.pixelRatio=this._determinePixelRatio()}},{key:"setTransform",value:function(){var e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}},{key:"_XconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.x)/this.body.view.scale}},{key:"_XconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.x}},{key:"_YconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.y)/this.body.view.scale}},{key:"_YconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.y}},{key:"canvasToDOM",value:function(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}},{key:"DOMtoCanvas",value:function(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}]),i}();function ffe(i,r){var e=Le({nodes:r,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},i??{});if(!he(e.nodes))throw new TypeError("Nodes has to be an array of ids.");if(e.nodes.length===0&&(e.nodes=r),!(typeof e.minZoomLevel=="number"&&e.minZoomLevel>0))throw new TypeError("Min zoom level has to be a number higher than zero.");if(!(typeof e.maxZoomLevel=="number"&&e.minZoomLevel<=e.maxZoomLevel))throw new TypeError("Max zoom level has to be a number higher than min zoom level.");return e}var vfe=function(){function i(r,e){var t,n=this,a;N(this,i),this.body=r,this.canvas=e,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",k(t=this.fit).call(t,this)),this.body.emitter.on("animationFinished",function(){n.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",k(a=this.releaseNode).call(a,this))}return M(i,[{key:"setOptions",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=e}},{key:"fit",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e=ffe(e,this.body.nodeIndices);var n=this.canvas.frame.canvas.clientWidth,a=this.canvas.frame.canvas.clientHeight,o,s;if(n===0||a===0)s=1,o=pt.getRange(this.body.nodes,e.nodes);else if(t===!0){var u=0;for(var l in this.body.nodes)if(Object.prototype.hasOwnProperty.call(this.body.nodes,l)){var h=this.body.nodes[l];h.predefinedPosition===!0&&(u+=1)}if(u>.5*this.body.nodeIndices.length){this.fit(e,!1);return}o=pt.getRange(this.body.nodes,e.nodes);var c=this.body.nodeIndices.length;s=12.662/(c+7.4147)+.0964822;var d=Math.min(n/600,a/600);s*=d}else{this.body.emitter.emit("_resizeNodes"),o=pt.getRange(this.body.nodes,e.nodes);var f=Math.abs(o.maxX-o.minX)*1.1,v=Math.abs(o.maxY-o.minY)*1.1,p=n/f,g=a/v;s=p<=g?p:g}s>e.maxZoomLevel?s=e.maxZoomLevel:s1&&arguments[1]!==void 0?arguments[1]:{};if(this.body.nodes[e]!==void 0){var n={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=n,t.lockedOnNode=e,this.moveTo(t)}else console.error("Node: "+e+" cannot be found.")}},{key:"moveTo",value:function(e){if(e===void 0){e={};return}if(e.offset!=null){if(e.offset.x!=null){if(e.offset.x=+e.offset.x,!Di(e.offset.x))throw new TypeError('The option "offset.x" has to be a finite number.')}else e.offset.x=0;if(e.offset.y!=null){if(e.offset.y=+e.offset.y,!Di(e.offset.y))throw new TypeError('The option "offset.y" has to be a finite number.')}else e.offset.x=0}else e.offset={x:0,y:0};if(e.position!=null){if(e.position.x!=null){if(e.position.x=+e.position.x,!Di(e.position.x))throw new TypeError('The option "position.x" has to be a finite number.')}else e.position.x=0;if(e.position.y!=null){if(e.position.y=+e.position.y,!Di(e.position.y))throw new TypeError('The option "position.y" has to be a finite number.')}else e.position.x=0}else e.position=this.getViewPosition();if(e.scale!=null){if(e.scale=+e.scale,!(e.scale>0))throw new TypeError('The option "scale" has to be a number greater than zero.')}else e.scale=this.body.view.scale;e.animation===void 0&&(e.animation={duration:0}),e.animation===!1&&(e.animation={duration:0}),e.animation===!0&&(e.animation={}),e.animation.duration===void 0&&(e.animation.duration=1e3),e.animation.easingFunction===void 0&&(e.animation.easingFunction="easeInOutQuad"),this.animateView(e)}},{key:"animateView",value:function(e){if(e!==void 0){this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),e.locked===!0&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),this.easingTime!=0&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;var t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.position.x,y:t.y-e.position.y};if(this.targetTranslation={x:this.sourceTranslation.x+n.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+n.y*this.targetScale+e.offset.y},e.animation.duration===0)if(this.lockedOnNodeId!=null){var a;this.viewFunction=k(a=this._lockedRedraw).call(a,this),this.body.emitter.on("initRedraw",this.viewFunction)}else this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw");else{var o;this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=k(o=this._transitionRedraw).call(o,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}}},{key:"_lockedRedraw",value:function(){var e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.x,y:t.y-e.y},a=this.body.view.translation,o={x:a.x+n.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:a.y+n.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=o}},{key:"releaseNode",value:function(){this.lockedOnNodeId!==void 0&&this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}},{key:"_transitionRedraw",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.easingTime+=this.animationSpeed,this.easingTime=e===!0?1:this.easingTime;var t=Jae[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1){if(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,this.lockedOnNodeId!=null){var n;this.viewFunction=k(n=this._lockedRedraw).call(n,this),this.body.emitter.on("initRedraw",this.viewFunction)}this.body.emitter.emit("animationFinished")}}},{key:"getScale",value:function(){return this.body.view.scale}},{key:"getViewPosition",value:function(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}]),i}();function g$(i){var r=i&&i.preventDefault||!1,e=i&&i.container||window,t={},n={keydown:{},keyup:{}},a={},o;for(o=97;o<=122;o++)a[String.fromCharCode(o)]={code:65+(o-97),shift:!1};for(o=65;o<=90;o++)a[String.fromCharCode(o)]={code:o,shift:!0};for(o=0;o<=9;o++)a[""+o]={code:48+o,shift:!1};for(o=1;o<=12;o++)a["F"+o]={code:111+o,shift:!1};for(o=0;o<=9;o++)a["num"+o]={code:96+o,shift:!1};a["num*"]={code:106,shift:!1},a["num+"]={code:107,shift:!1},a["num-"]={code:109,shift:!1},a["num/"]={code:111,shift:!1},a["num."]={code:110,shift:!1},a.left={code:37,shift:!1},a.up={code:38,shift:!1},a.right={code:39,shift:!1},a.down={code:40,shift:!1},a.space={code:32,shift:!1},a.enter={code:13,shift:!1},a.shift={code:16,shift:void 0},a.esc={code:27,shift:!1},a.backspace={code:8,shift:!1},a.tab={code:9,shift:!1},a.ctrl={code:17,shift:!1},a.alt={code:18,shift:!1},a.delete={code:46,shift:!1},a.pageup={code:33,shift:!1},a.pagedown={code:34,shift:!1},a["="]={code:187,shift:!1},a["-"]={code:189,shift:!1},a["]"]={code:221,shift:!1},a["["]={code:219,shift:!1};var s=function(h){l(h,"keydown")},u=function(h){l(h,"keyup")},l=function(h,c){if(n[c][h.keyCode]!==void 0){for(var d=n[c][h.keyCode],f=0;f700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=new Date().valueOf())}},{key:"_stopMovement",value:function(){for(var e in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}},{key:"_moveUp",value:function(){this.body.view.translation.y+=this.options.keyboard.speed.y}},{key:"_moveDown",value:function(){this.body.view.translation.y-=this.options.keyboard.speed.y}},{key:"_moveLeft",value:function(){this.body.view.translation.x+=this.options.keyboard.speed.x}},{key:"_moveRight",value:function(){this.body.view.translation.x-=this.options.keyboard.speed.x}},{key:"_zoomIn",value:function(){var e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,a=t/e,o=(1-a)*this.canvas.canvasViewCenter.x+n.x*a,s=(1-a)*this.canvas.canvasViewCenter.y+n.y*a;this.body.view.scale=t,this.body.view.translation={x:o,y:s},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}},{key:"_zoomOut",value:function(){var e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,a=t/e,o=(1-a)*this.canvas.canvasViewCenter.x+n.x*a,s=(1-a)*this.canvas.canvasViewCenter.y+n.y*a;this.body.view.scale=t,this.body.view.translation={x:o,y:s},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}},{key:"configureKeyboardBindings",value:function(){var e=this;if(this.keycharm!==void 0&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=g$({container:window,preventDefault:!0}):this.keycharm=g$({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0)){var t,n,a,o,s,u,l,h,c,d,f,v,p,g,y,m,$,b,O,_,D,R,P,B;k(t=this.keycharm).call(t,"up",function(){e.bindToRedraw("_moveUp")},"keydown"),k(n=this.keycharm).call(n,"down",function(){e.bindToRedraw("_moveDown")},"keydown"),k(a=this.keycharm).call(a,"left",function(){e.bindToRedraw("_moveLeft")},"keydown"),k(o=this.keycharm).call(o,"right",function(){e.bindToRedraw("_moveRight")},"keydown"),k(s=this.keycharm).call(s,"=",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(u=this.keycharm).call(u,"num+",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(l=this.keycharm).call(l,"num-",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(h=this.keycharm).call(h,"-",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(c=this.keycharm).call(c,"[",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(d=this.keycharm).call(d,"]",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(f=this.keycharm).call(f,"pageup",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(v=this.keycharm).call(v,"pagedown",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(p=this.keycharm).call(p,"up",function(){e.unbindFromRedraw("_moveUp")},"keyup"),k(g=this.keycharm).call(g,"down",function(){e.unbindFromRedraw("_moveDown")},"keyup"),k(y=this.keycharm).call(y,"left",function(){e.unbindFromRedraw("_moveLeft")},"keyup"),k(m=this.keycharm).call(m,"right",function(){e.unbindFromRedraw("_moveRight")},"keyup"),k($=this.keycharm).call($,"=",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(b=this.keycharm).call(b,"num+",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(O=this.keycharm).call(O,"num-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(_=this.keycharm).call(_,"-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(D=this.keycharm).call(D,"[",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(R=this.keycharm).call(R,"]",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(P=this.keycharm).call(P,"pageup",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(B=this.keycharm).call(B,"pagedown",function(){e.unbindFromRedraw("_zoomOut")},"keyup")}}}]),i}();function gfe(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=yfe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function yfe(i,r){var e;if(i){if(typeof i=="string")return y$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return y$(i,r)}}function y$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=new Date().valueOf())}},{key:"onTap",value:function(e){var t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t)}},{key:"onDoubleTap",value:function(e){var t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("doubleClick",e,t)}},{key:"onHold",value:function(e){var t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t),this.selectionHandler.generateClickEvent("hold",e,t)}},{key:"onRelease",value:function(e){if(new Date().valueOf()-this.touchTime>10){var t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("release",e,t),this.touchTime=new Date().valueOf()}}},{key:"onContext",value:function(e){var t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent("oncontext",e,t)}},{key:"checkSelectionChanges",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;t===!0?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}},{key:"_determineDifference",value:function(e,t){var n=function(o,s){for(var u=[],l=0;l=o.minX&&c.x<=o.maxX&&c.y>=o.minY&&c.y<=o.maxY});fe(s).call(s,function(h){return t.selectionHandler.selectObject(t.body.nodes[h])});var u=this.getPointer(e.center);this.selectionHandler.commitAndEmit(u,e),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw")}else{var l=this.drag.selection;l&&l.length?(fe(l).call(l,function(h){h.node.options.fixed.x=h.xFixed,h.node.options.fixed.y=h.yFixed}),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center)),this.body.emitter.emit("startSimulation")):(this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw"))}}},{key:"onPinch",value:function(e){var t=this.getPointer(e.center);this.drag.pinched=!0,this.pinch.scale===void 0&&(this.pinch.scale=1);var n=this.pinch.scale*e.scale;this.zoom(n,t)}},{key:"zoom",value:function(e,t){if(this.options.zoomView===!0){var n=this.body.view.scale;e<1e-5&&(e=1e-5),e>10&&(e=10);var a=void 0;this.drag!==void 0&&this.drag.dragging===!0&&(a=this.canvas.DOMtoCanvas(this.drag.pointer));var o=this.body.view.translation,s=e/n,u=(1-s)*t.x+o.x*s,l=(1-s)*t.y+o.y*s;if(this.body.view.scale=e,this.body.view.translation={x:u,y:l},a!=null){var h=this.canvas.canvasToDOM(a);this.drag.pointer.x=h.x,this.drag.pointer.y=h.y}this.body.emitter.emit("_requestRedraw"),n0&&(this.popupObj=h[d[d.length-1]],s=!0)}if(this.popupObj===void 0&&s===!1){for(var v=this.body.edgeIndices,p=this.body.edges,g,y=[],m=0;m0&&(this.popupObj=p[y[y.length-1]],u="edge")}this.popupObj!==void 0?this.popupObj.id!==o&&(this.popup===void 0&&(this.popup=new aoe(this.canvas.frame)),this.popup.popupTargetType=u,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):this.popup!==void 0&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}},{key:"_checkHidePopup",value:function(e){var t=this.selectionHandler._pointerToPositionObject(e),n=!1;if(this.popup.popupTargetType==="node"){if(this.body.nodes[this.popup.popupTargetId]!==void 0&&(n=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),n===!0)){var a=this.selectionHandler.getNodeAt(e);n=a===void 0?!1:a.id===this.popup.popupTargetId}}else this.selectionHandler.getNodeAt(e)===void 0&&this.body.edges[this.popup.popupTargetId]!==void 0&&(n=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));n===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}]),i}(),bfe=hp,$fe=vT;bfe("Set",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},$fe);var wfe=oe,_fe=wfe.Set,Efe=_fe,Sfe=Efe,Ofe=Sfe,xi=V(Ofe),Tfe=se,m$=cp,ru=eh.getWeakData,Ife=lp,kfe=Vt,Pfe=Oa,vd=Ze,xfe=up,BT=wi,b$=Qe,FT=ln,Cfe=FT.set,Afe=FT.getterFor,Dfe=BT.find,Rfe=BT.findIndex,Nfe=Tfe([].splice),Mfe=0,iu=function(i){return i.frozen||(i.frozen=new jT)},jT=function(){this.entries=[]},pd=function(i,r){return Dfe(i.entries,function(e){return e[0]===r})};jT.prototype={get:function(i){var r=pd(this,i);if(r)return r[1]},has:function(i){return!!pd(this,i)},set:function(i,r){var e=pd(this,i);e?e[1]=r:this.entries.push([i,r])},delete:function(i){var r=Rfe(this.entries,function(e){return e[0]===i});return~r&&Nfe(this.entries,r,1),!!~r}};var Bfe={getConstructor:function(i,r,e,t){var n=i(function(u,l){Ife(u,a),Cfe(u,{type:r,id:Mfe++,frozen:void 0}),Pfe(l)||xfe(l,u[t],{that:u,AS_ENTRIES:e})}),a=n.prototype,o=Afe(r),s=function(u,l,h){var c=o(u),d=ru(kfe(l),!0);return d===!0?iu(c).set(l,h):d[c.id]=h,u};return m$(a,{delete:function(u){var l=o(this);if(!vd(u))return!1;var h=ru(u);return h===!0?iu(l).delete(u):h&&b$(h,l.id)&&delete h[l.id]},has:function(l){var h=o(this);if(!vd(l))return!1;var c=ru(l);return c===!0?iu(h).has(l):c&&b$(c,h.id)}}),m$(a,e?{get:function(l){var h=o(this);if(vd(l)){var c=ru(l);return c===!0?iu(h).get(l):c?c[h.id]:void 0}},set:function(l,h){return s(this,l,h)}}:{add:function(l){return s(this,l,!0)}}),n}},Ffe=hT,$$=Pe,Su=se,w$=cp,jfe=eh,Lfe=hp,LT=Bfe,nu=Ze,au=ln.enforce,zfe=ae,Hfe=eS,gs=Object,Vfe=Array.isArray,ou=gs.isExtensible,zT=gs.isFrozen,Wfe=gs.isSealed,HT=gs.freeze,Ufe=gs.seal,_$={},E$={},Kfe=!$$.ActiveXObject&&"ActiveXObject"in $$,Wa,VT=function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},WT=Lfe("WeakMap",VT,LT),Cn=WT.prototype,Ou=Su(Cn.set),Gfe=function(){return Ffe&&zfe(function(){var i=HT([]);return Ou(new WT,i,1),!zT(i)})};if(Hfe)if(Kfe){Wa=LT.getConstructor(VT,"WeakMap",!0),jfe.enable();var S$=Su(Cn.delete),su=Su(Cn.has),O$=Su(Cn.get);w$(Cn,{delete:function(i){if(nu(i)&&!ou(i)){var r=au(this);return r.frozen||(r.frozen=new Wa),S$(this,i)||r.frozen.delete(i)}return S$(this,i)},has:function(r){if(nu(r)&&!ou(r)){var e=au(this);return e.frozen||(e.frozen=new Wa),su(this,r)||e.frozen.has(r)}return su(this,r)},get:function(r){if(nu(r)&&!ou(r)){var e=au(this);return e.frozen||(e.frozen=new Wa),su(this,r)?O$(this,r):e.frozen.get(r)}return O$(this,r)},set:function(r,e){if(nu(r)&&!ou(r)){var t=au(this);t.frozen||(t.frozen=new Wa),su(this,r)?Ou(this,r,e):t.frozen.set(r,e)}else Ou(this,r,e);return this}})}else Gfe()&&w$(Cn,{set:function(r,e){var t;return Vfe(r)&&(zT(r)?t=_$:Wfe(r)&&(t=E$)),Ou(this,r,e),t===_$&&HT(r),t===E$&&Ufe(r),this}});var qfe=oe,Yfe=qfe.WeakMap,Xfe=Yfe,Jfe=Xfe,Zfe=Jfe,ao=V(Zfe);function ve(i,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?i!==r||!t:!r.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(i):t?t.value:r.get(i)}function Nf(i,r,e,t,n){if(typeof r=="function"?i!==r||!0:!r.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r.set(i,e),e}function Mf(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=Qfe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Qfe(i,r){var e;if(i){if(typeof i=="string")return T$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return T$(i,r)}}function T$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e0&&arguments[0]!==void 0?arguments[0]:function(){};N(this,i),Yr.set(this,new k$),Xr.set(this,new k$),Tu.set(this,void 0),Nf(this,Tu,r)}return M(i,[{key:"sizeNodes",get:function(){return ve(this,Yr,"f").size}},{key:"sizeEdges",get:function(){return ve(this,Xr,"f").size}},{key:"getNodes",value:function(){return ve(this,Yr,"f").getSelection()}},{key:"getEdges",value:function(){return ve(this,Xr,"f").getSelection()}},{key:"addNodes",value:function(){var e;(e=ve(this,Yr,"f")).add.apply(e,arguments)}},{key:"addEdges",value:function(){var e;(e=ve(this,Xr,"f")).add.apply(e,arguments)}},{key:"deleteNodes",value:function(e){ve(this,Yr,"f").delete(e)}},{key:"deleteEdges",value:function(e){ve(this,Xr,"f").delete(e)}},{key:"clear",value:function(){ve(this,Yr,"f").clear(),ve(this,Xr,"f").clear()}},{key:"commit",value:function(){for(var e,t,n={nodes:ve(this,Yr,"f").commit(),edges:ve(this,Xr,"f").commit()},a=arguments.length,o=new Array(a),s=0;s=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function tve(i,r){var e;if(i){if(typeof i=="string")return x$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return x$(i,r)}}function x$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e4&&arguments[4]!==void 0?arguments[4]:!1,s=this._initBaseEvent(t,n);if(o===!0)s.nodes=[],s.edges=[];else{var u=this.getSelection();s.nodes=u.nodes,s.edges=u.edges}a!==void 0&&(s.previousSelection=a),e=="click"&&(s.items=this.getClickedItems(n)),t.controlEdge!==void 0&&(s.controlEdge=t.controlEdge),this.body.emitter.emit(e,s)}},{key:"selectObject",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.selectConnectedEdges;if(e!==void 0){if(e instanceof Nt){if(t===!0){var n;(n=this._selectionAccumulator).addEdges.apply(n,fr(e.edges))}this._selectionAccumulator.addNodes(e)}else this._selectionAccumulator.addEdges(e);return!0}return!1}},{key:"deselectObject",value:function(e){e.isSelected()===!0&&(e.selected=!1,this._removeFromSelection(e))}},{key:"_getAllNodesOverlappingWith",value:function(e){for(var t=[],n=this.body.nodes,a=0;a1&&arguments[1]!==void 0?arguments[1]:!0,n=this._pointerToPositionObject(e),a=this._getAllNodesOverlappingWith(n);if(a.length>0)return t===!0?this.body.nodes[a[a.length-1]]:a[a.length-1]}},{key:"_getEdgesOverlappingWith",value:function(e,t){for(var n=this.body.edges,a=0;a1&&arguments[1]!==void 0?arguments[1]:!0,n=this.canvas.DOMtoCanvas(e),a=10,o=null,s=this.body.edges,u=0;u0&&(this.generateClickEvent("deselectEdge",t,e,o),n=!0),a.nodes.deleted.length>0&&(this.generateClickEvent("deselectNode",t,e,o),n=!0),a.nodes.added.length>0&&(this.generateClickEvent("selectNode",t,e),n=!0),a.edges.added.length>0&&(this.generateClickEvent("selectEdge",t,e),n=!0),n===!0&&this.generateClickEvent("select",t,e)}},{key:"getSelection",value:function(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}},{key:"getSelectedNodes",value:function(){return this._selectionAccumulator.getNodes()}},{key:"getSelectedEdges",value:function(){return this._selectionAccumulator.getEdges()}},{key:"getSelectedNodeIds",value:function(){var e;return na(e=this._selectionAccumulator.getNodes()).call(e,function(t){return t.id})}},{key:"getSelectedEdgeIds",value:function(){var e;return na(e=this._selectionAccumulator.getEdges()).call(e,function(t){return t.id})}},{key:"setSelection",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||!e.nodes&&!e.edges)throw new TypeError("Selection must be an object with nodes and/or edges properties");if((t.unselectAll||t.unselectAll===void 0)&&this.unselectAll(),e.nodes){var n=P$(e.nodes),a;try{for(n.s();!(a=n.n()).done;){var o=a.value,s=this.body.nodes[o];if(!s)throw new RangeError('Node with id "'+o+'" not found');this.selectObject(s,t.highlightEdges)}}catch(d){n.e(d)}finally{n.f()}}if(e.edges){var u=P$(e.edges),l;try{for(u.s();!(l=u.n()).done;){var h=l.value,c=this.body.edges[h];if(!c)throw new RangeError('Edge with id "'+h+'" not found');this.selectObject(c)}}catch(d){u.e(d)}finally{u.f()}}this.body.emitter.emit("_requestRedraw"),this._selectionAccumulator.commit()}},{key:"selectNodes",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:t})}},{key:"selectEdges",value:function(e){if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({edges:e})}},{key:"updateSelection",value:function(){for(var e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(var t in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,t.id)||this._selectionAccumulator.deleteEdges(t)}},{key:"getClickedItems",value:function(e){for(var t=this.canvas.DOMtoCanvas(e),n=[],a=this.body.nodeIndices,o=this.body.nodes,s=a.length-1;s>=0;s--){var u=o[a[s]],l=u.getItemsOnPoint(t);n.push.apply(n,l)}for(var h=this.body.edgeIndices,c=this.body.edges,d=h.length-1;d>=0;d--){var f=c[h[d]],v=f.getItemsOnPoint(t);n.push.apply(n,v)}return n}}]),i}(),C$=kS,ive=Math.floor,Bf=function(i,r){var e=i.length,t=ive(e/2);return e<8?nve(i,r):ave(i,Bf(C$(i,0,t),r),Bf(C$(i,t),r),r)},nve=function(i,r){for(var e=i.length,t=1,n,a;t0;)i[a]=i[--a];a!==t++&&(i[a]=n)}return i},ave=function(i,r,e,t){for(var n=r.length,a=e.length,o=0,s=0;o3)){if(bve)return!0;if(F$)return F$<603;var i="",r,e,t,n;for(r=65;r<76;r++){switch(e=String.fromCharCode(r),r){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(n=0;n<47;n++)ii.push({k:e+n,v:t})}for(ii.sort(function(a,o){return o.v-a.v}),n=0;nN$(e)?1:-1}};fve({target:"Array",proto:!0,forced:Sve},{sort:function(r){r!==void 0&&vve(r);var e=pve(this);if(KT)return r===void 0?j$(e):j$(e,r);var t=[],n=R$(e),a,o;for(o=0;o=0:s>u;u+=l)u in o&&(n=e(n,o[u],u,a));return n}},jve={left:L$(!1),right:L$(!0)},Lve=Pe,zve=Hr,Hve=zve(Lve.process)==="process",Vve=q,Wve=jve.left,Uve=Ra,z$=Xo,Kve=Hve,Gve=!Kve&&z$>79&&z$<83,qve=Gve||!Uve("reduce");Vve({target:"Array",proto:!0,forced:qve},{reduce:function(r){var e=arguments.length;return Wve(this,r,e,e>1?arguments[1]:void 0)}});var Yve=et,Xve=Yve("Array").reduce,Jve=Be,Zve=Xve,yd=Array.prototype,Qve=function(i){var r=i.reduce;return i===yd||Jve(yd,i)&&r===yd.reduce?Zve:r},epe=Qve,tpe=epe,rpe=tpe,GT=V(rpe);function qT(i){var r=ipe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function ipe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var YT=function(){function i(){N(this,i)}return M(i,[{key:"abstract",value:function(){throw new Error("Can't instantiate abstract class!")}},{key:"fake_use",value:function(){}},{key:"curveType",value:function(){return this.abstract()}},{key:"getPosition",value:function(e){return this.fake_use(e),this.abstract()}},{key:"setPosition",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;this.fake_use(e,t,n),this.abstract()}},{key:"getTreeSize",value:function(e){return this.fake_use(e),this.abstract()}},{key:"sort",value:function(e){this.fake_use(e),this.abstract()}},{key:"fix",value:function(e,t){this.fake_use(e,t),this.abstract()}},{key:"shift",value:function(e,t){this.fake_use(e,t),this.abstract()}}]),i}(),npe=function(i){ue(e,i);var r=qT(e);function e(t){var n;return N(this,e),n=r.call(this),n.layout=t,n}return M(e,[{key:"curveType",value:function(){return"horizontal"}},{key:"getPosition",value:function(n){return n.x}},{key:"setPosition",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;o!==void 0&&this.layout.hierarchical.addToOrdering(n,o),n.x=a}},{key:"getTreeSize",value:function(n){var a=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,n);return{min:a.min_x,max:a.max_x}}},{key:"sort",value:function(n){oo(n).call(n,function(a,o){return a.x-o.x})}},{key:"fix",value:function(n,a){n.y=this.layout.options.hierarchical.levelSeparation*a,n.options.fixed.y=!0}},{key:"shift",value:function(n,a){this.layout.body.nodes[n].x+=a}}]),e}(YT),ape=function(i){ue(e,i);var r=qT(e);function e(t){var n;return N(this,e),n=r.call(this),n.layout=t,n}return M(e,[{key:"curveType",value:function(){return"vertical"}},{key:"getPosition",value:function(n){return n.y}},{key:"setPosition",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;o!==void 0&&this.layout.hierarchical.addToOrdering(n,o),n.y=a}},{key:"getTreeSize",value:function(n){var a=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,n);return{min:a.min_y,max:a.max_y}}},{key:"sort",value:function(n){oo(n).call(n,function(a,o){return a.y-o.y})}},{key:"fix",value:function(n,a){n.x=this.layout.options.hierarchical.levelSeparation*a,n.options.fixed.x=!0}},{key:"shift",value:function(n,a){this.layout.body.nodes[n].y+=a}}]),e}(YT),ope=q,spe=wi.every,upe=Ra,lpe=upe("every");ope({target:"Array",proto:!0,forced:!lpe},{every:function(r){return spe(this,r,arguments.length>1?arguments[1]:void 0)}});var hpe=et,cpe=hpe("Array").every,dpe=Be,fpe=cpe,md=Array.prototype,vpe=function(i){var r=i.every;return i===md||dpe(md,i)&&r===md.every?fpe:r},ppe=vpe,gpe=ppe,ype=gpe,XT=V(ype);function mpe(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=bpe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function bpe(i,r){var e;if(i){if(typeof i=="string")return H$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return H$(i,r)}}function H$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e=r[a])&&(r[a]=r[n]+1)}),r}function wpe(i){return JT(function(r){var e,t;return XT(e=Tt(t=r.edges).call(t,function(n){return i.has(n.toId)})).call(e,function(n){return n.to===r})},function(r,e){return e>r},"from",i)}function _pe(i){return JT(function(r){var e,t;return XT(e=Tt(t=r.edges).call(t,function(n){return i.has(n.toId)})).call(e,function(n){return n.from===r})},function(r,e){return eo)return{v:{v:$pe(t,a)}};++m},O;$=y.pop();)if(O=b(),O!==0&&O)return O.v},d;for(l.s();!(h=l.n()).done;)if(d=c(),d!==0&&d)return d.v}catch(f){l.e(f)}finally{l.f()}return a}var Epe=function(){function i(){N(this,i),this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}return M(i,[{key:"addRelation",value:function(e,t){this.childrenReference[e]===void 0&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),this.parentReference[t]===void 0&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}},{key:"checkIfTree",value:function(){for(var e in this.parentReference)if(this.parentReference[e].length>1){this.isTree=!1;return}this.isTree=!0}},{key:"numTrees",value:function(){return this.treeIndex+1}},{key:"setTreeIndex",value:function(e,t){t!==void 0&&this.trees[e.id]===void 0&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}},{key:"ensureLevel",value:function(e){this.levels[e]===void 0&&(this.levels[e]=0)}},{key:"getMaxLevel",value:function(e){var t=this,n={},a=function o(s){if(n[s]!==void 0)return n[s];var u=t.levels[s];if(t.childrenReference[s]){var l=t.childrenReference[s];if(l.length>0)for(var h=0;h0&&(n.levelSeparation*=-1):n.levelSeparation<0&&(n.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(a===!0)return this.body.emitter.emit("refresh"),pe(t,this.optionsBackup)}return t}},{key:"_resetRNG",value:function(e){this.initialRandomSeed=e,this._rng=Ql(this.initialRandomSeed)}},{key:"adaptAllOptionsForHierarchicalLayout",value:function(e){if(this.options.hierarchical.enabled===!0){var t=this.optionsBackup.physics;e.physics===void 0||e.physics===!0?(e.physics={enabled:t.enabled===void 0?!0:t.enabled,solver:"hierarchicalRepulsion"},t.enabled=t.enabled===void 0?!0:t.enabled,t.solver=t.solver||"barnesHut"):de(e.physics)==="object"?(t.enabled=e.physics.enabled===void 0?!0:e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):e.physics!==!1&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});var n=this.direction.curveType();if(e.edges===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(e.edges.smooth===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if(typeof e.edges.smooth=="boolean")this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:n};else{var a=e.edges.smooth;a.type!==void 0&&a.type!=="dynamic"&&(n=a.type),this.optionsBackup.edges={smooth:{enabled:a.enabled===void 0?!0:a.enabled,type:a.type===void 0?"dynamic":a.type,roundness:a.roundness===void 0?.5:a.roundness,forceDirection:a.forceDirection===void 0?!1:a.forceDirection}},e.edges.smooth={enabled:a.enabled===void 0?!0:a.enabled,type:n,roundness:a.roundness===void 0?.5:a.roundness,forceDirection:a.forceDirection===void 0?!1:a.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",n)}return e}},{key:"positionInitially",value:function(e){if(this.options.hierarchical.enabled!==!0){this._resetRNG(this.initialRandomSeed);for(var t=e.length+50,n=0;nu){for(var h=e.length;e.length>u&&s<=o;){s+=1;var c=e.length;s%3===0?this.body.modules.clustering.clusterBridges(l):this.body.modules.clustering.clusterOutliers(l);var d=e.length;if(c==d&&s%3!==0){this._declusterAll(),this.body.emitter.emit("_layoutFailed"),console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.");return}}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*h)})}s>o&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();for(var f=70,v=0;v0){var e,t,n=!1,a=!1;this.lastNodeOnLevel={},this.hierarchical=new Epe;for(t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&(e=this.body.nodes[t],e.options.level!==void 0?(n=!0,this.hierarchical.levels[t]=e.options.level):a=!0);if(a===!0&&n===!0)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");if(a===!0){var o=this.options.hierarchical.sortMethod;o==="hubsize"?this._determineLevelsByHubsize():o==="directed"?this._determineLevelsDirected():o==="custom"&&this._determineLevelsCustomCallback()}for(var s in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,s)&&this.hierarchical.ensureLevel(s);var u=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(u),this._condenseHierarchy(),this._shiftToCenter()}}},{key:"_condenseHierarchy",value:function(){var e=this,t=!1,n={},a=function(){for(var $=s(),b=0,O=0;O<$.length-1;O++){var _=$[O].max-$[O+1].min;b+=_+e.options.hierarchical.treeSpacing,o(O+1,b)}},o=function($,b){var O=e.hierarchical.trees;for(var _ in O)Object.prototype.hasOwnProperty.call(O,_)&&O[_]===$&&e.direction.shift(_,b)},s=function(){for(var $=[],b=0;b0)for(var _=0;_1&&arguments[1]!==void 0?arguments[1]:1e9,O=1e9,_=1e9,D=1e9,R=-1e9;for(var P in $)if(Object.prototype.hasOwnProperty.call($,P)){var B=e.body.nodes[P],j=e.hierarchical.levels[B.id],J=e.direction.getPosition(B),U=e._getSpaceAroundNode(B,$),ie=Te(U,2),_e=ie[0],ye=ie[1];O=Math.min(_e,O),_=Math.min(ye,_),j<=b&&(D=Math.min(J,D),R=Math.max(J,R))}return[D,R,O,_]},h=function($,b){var O=e.hierarchical.getMaxLevel($.id),_=e.hierarchical.getMaxLevel(b.id);return Math.min(O,_)},c=function($,b,O){for(var _=e.hierarchical,D=0;D1)for(var B=0;B2&&arguments[2]!==void 0?arguments[2]:!1,_=e.direction.getPosition($),D=e.direction.getPosition(b),R=Math.abs(D-_),P=e.options.hierarchical.nodeSpacing;if(R>P){var B={},j={};u($,B),u(b,j);var J=h($,b),U=l(B,J),ie=l(j,J),_e=U[1],ye=ie[0],Ae=ie[2],ht=Math.abs(_e-ye);if(ht>P){var at=_e-ye+P;at<-Ae+P&&(at=-Ae+P),at<0&&(e._shiftBlock(b.id,at),t=!0,O===!0&&e._centerParent(b))}}},f=function($,b){for(var O=b.id,_=b.edges,D=e.hierarchical.levels[b.id],R=e.options.hierarchical.levelSeparation*e.options.hierarchical.levelSeparation,P={},B=[],j=0;j<_.length;j++){var J=_[j];if(J.toId!=J.fromId){var U=J.toId==O?J.from:J.to;P[_[j].id]=U,e.hierarchical.levels[U.id]0?ut=Math.min(Rt,Sr-e.options.hierarchical.nodeSpacing):Rt<0&&(ut=-Math.min(-Rt,st-e.options.hierarchical.nodeSpacing)),ut!=0&&(e._shiftBlock(b.id,ut),t=!0)},ht=function(ot){var me=e.direction.getPosition(b),Fe=e._getSpaceAroundNode(b),De=Te(Fe,2),st=De[0],Sr=De[1],Rt=ot-me,ut=me;Rt>0?ut=Math.min(me+(Sr-e.options.hierarchical.nodeSpacing),ot):Rt<0&&(ut=Math.max(me-(st-e.options.hierarchical.nodeSpacing),ot)),ut!==me&&(e.direction.setPosition(b,ut),t=!0)},at=ye($,B);Ae(at),at=ye($,_),ht(at)},v=function($){var b=e.hierarchical.getLevels();b=Li(b).call(b);for(var O=0;O<$;O++){t=!1;for(var _=0;_0&&Math.abs(v)0&&(h=this.direction.getPosition(a[s-1])+l),this.direction.setPosition(u,h,t),this._validatePositionAndContinue(u,t,h),o++}}}}},{key:"_placeBranchNodes",value:function(e,t){var n,a=this.hierarchical.childrenReference[e];if(a!==void 0){for(var o=[],s=0;st&&this.positionedNodes[l.id]===void 0){var c=this.options.hierarchical.nodeSpacing,d=void 0;u===0?d=this.direction.getPosition(this.body.nodes[e]):d=this.direction.getPosition(o[u-1])+c,this.direction.setPosition(l,d,h),this._validatePositionAndContinue(l,h,d)}else return}var f=this._getCenterPosition(o);this.direction.setPosition(this.body.nodes[e],f,t)}}},{key:"_validatePositionAndContinue",value:function(e,t,n){if(this.hierarchical.isTree){if(this.lastNodeOnLevel[t]!==void 0){var a=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(n-ae.hierarchical.levels[a.id]&&e.hierarchical.addRelation(a.id,o.id)};this._crawlNetwork(t),this.hierarchical.checkIfTree()}},{key:"_crawlNetwork",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){},n=arguments.length>1?arguments[1]:void 0,a={},o=function d(f,v){if(a[f.id]===void 0){e.hierarchical.setTreeIndex(f,v),a[f.id]=!0;for(var p,g=e._getActiveEdges(f),y=0;y=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Tpe(i,r){var e;if(i){if(typeof i=="string")return V$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return V$(i,r)}}function V$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e0&&this.options.deleteNode!==!1?(u===!0&&this._createSeperator(4),this._createDeleteButton(s)):n===0&&this.options.deleteEdge!==!1&&(u===!0&&this._createSeperator(4),this._createDeleteButton(s))),this._bindElementEvents(this.closeDiv,k(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent("select",k(t=this.showManipulatorToolbar).call(t,this))}this.body.emitter.emit("_redraw")}},{key:"addNodeMode",value:function(){var e;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addNode",this.guiEnabled===!0){var t,n=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(n),this._createSeperator(),this._createDescription(n.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,k(t=this.toggleEditMode).call(t,this))}this._temporaryBindEvent("click",k(e=this._performAddNode).call(e,this))}},{key:"editNode",value:function(){var e=this;this.editMode!==!0&&this.enableEditMode(),this._clean();var t=this.selectionHandler.getSelectedNodes()[0];if(t!==void 0)if(this.inMode="editNode",typeof this.options.editNode=="function")if(t.isCluster!==!0){var n=pe({},t.options,!1);if(n.x=t.x,n.y=t.y,this.options.editNode.length===2)this.options.editNode(n,function(a){a!=null&&e.inMode==="editNode"&&e.body.data.nodes.getDataSet().update(a),e.showManipulatorToolbar()});else throw new Error("The function for edit does not support two arguments (data, callback)")}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError);else throw new Error("No function has been configured to handle the editing of nodes.");else this.showManipulatorToolbar()}},{key:"addEdgeMode",value:function(){var e,t,n,a,o;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addEdge",this.guiEnabled===!0){var s,u=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(u),this._createSeperator(),this._createDescription(u.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,k(s=this.toggleEditMode).call(s,this))}this._temporaryBindUI("onTouch",k(e=this._handleConnect).call(e,this)),this._temporaryBindUI("onDragEnd",k(t=this._finishConnect).call(t,this)),this._temporaryBindUI("onDrag",k(n=this._dragControlNode).call(n,this)),this._temporaryBindUI("onRelease",k(a=this._finishConnect).call(a,this)),this._temporaryBindUI("onDragStart",k(o=this._dragStartEdge).call(o,this)),this._temporaryBindUI("onHold",function(){})}},{key:"editEdgeMode",value:function(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="editEdge",de(this.options.editEdge)==="object"&&typeof this.options.editEdge.editWithoutDrag=="function"&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0)){var e=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(e.from.id,e.to.id);return}if(this.guiEnabled===!0){var t,n=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(n),this._createSeperator(),this._createDescription(n.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,k(t=this.toggleEditMode).call(t,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0){var a,o,s,u,l=this.body.edges[this.edgeBeingEditedId],h=this._getNewTargetNode(l.from.x,l.from.y),c=this._getNewTargetNode(l.to.x,l.to.y);this.temporaryIds.nodes.push(h.id),this.temporaryIds.nodes.push(c.id),this.body.nodes[h.id]=h,this.body.nodeIndices.push(h.id),this.body.nodes[c.id]=c,this.body.nodeIndices.push(c.id),this._temporaryBindUI("onTouch",k(a=this._controlNodeTouch).call(a,this)),this._temporaryBindUI("onTap",function(){}),this._temporaryBindUI("onHold",function(){}),this._temporaryBindUI("onDragStart",k(o=this._controlNodeDragStart).call(o,this)),this._temporaryBindUI("onDrag",k(s=this._controlNodeDrag).call(s,this)),this._temporaryBindUI("onDragEnd",k(u=this._controlNodeDragEnd).call(u,this)),this._temporaryBindUI("onMouseMove",function(){}),this._temporaryBindEvent("beforeDrawing",function(d){var f=l.edgeType.findBorderPositions(d);h.selected===!1&&(h.x=f.from.x,h.y=f.from.y),c.selected===!1&&(c.x=f.to.x,c.y=f.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}},{key:"deleteSelected",value:function(){var e=this;this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="delete";var t=this.selectionHandler.getSelectedNodeIds(),n=this.selectionHandler.getSelectedEdgeIds(),a=void 0;if(t.length>0){for(var o=0;o0&&typeof this.options.deleteEdge=="function"&&(a=this.options.deleteEdge);if(typeof a=="function"){var s={nodes:t,edges:n};if(a.length===2)a(s,function(u){u!=null&&e.inMode==="delete"?(e.body.data.edges.getDataSet().remove(u.edges),e.body.data.nodes.getDataSet().remove(u.nodes),e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar()):(e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar())});else throw new Error("The function for delete does not support two arguments (data, callback)")}else this.body.data.edges.getDataSet().remove(n),this.body.data.nodes.getDataSet().remove(t),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}},{key:"_setup",value:function(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}},{key:"_createWrappers",value:function(){if(this.manipulationDiv===void 0&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",this.editMode===!0?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),this.editModeDiv===void 0&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",this.editMode===!0?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),this.closeDiv===void 0){var e,t;this.closeDiv=document.createElement("button"),this.closeDiv.className="vis-close",this.closeDiv.setAttribute("aria-label",(e=(t=this.options.locales[this.options.locale])===null||t===void 0?void 0:t.close)!==null&&e!==void 0?e:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv)}}},{key:"_getNewTargetNode",value:function(e,t){var n=pe({},this.options.controlNodeStyle);n.id="targetNode"+no(),n.hidden=!1,n.physics=!1,n.x=e,n.y=t;var a=this.body.functions.createNode(n);return a.shape.boundingBox={left:e,right:e,top:t,bottom:t},a}},{key:"_createEditButton",value:function(){var e;this._clean(),this.manipulationDOM={},Zr(this.editModeDiv);var t=this.options.locales[this.options.locale],n=this._createButton("editMode","vis-edit vis-edit-mode",t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(n),this._bindElementEvents(n,k(e=this.toggleEditMode).call(e,this))}},{key:"_clean",value:function(){this.inMode=!1,this.guiEnabled===!0&&(Zr(this.editModeDiv),Zr(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}},{key:"_cleanupDOMEventListeners",value:function(){var e,t=Ope(Ar(e=this._domEventListenerCleanupQueue).call(e,0)),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;a()}}catch(o){t.e(o)}finally{t.f()}}},{key:"_removeManipulationDOM",value:function(){this._clean(),Zr(this.manipulationDiv),Zr(this.editModeDiv),Zr(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}},{key:"_createSeperator",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}},{key:"_createAddNodeButton",value:function(e){var t,n=this._createButton("addNode","vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.addNodeMode).call(t,this))}},{key:"_createAddEdgeButton",value:function(e){var t,n=this._createButton("addEdge","vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.addEdgeMode).call(t,this))}},{key:"_createEditNodeButton",value:function(e){var t,n=this._createButton("editNode","vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.editNode).call(t,this))}},{key:"_createEditEdgeButton",value:function(e){var t,n=this._createButton("editEdge","vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.editEdgeMode).call(t,this))}},{key:"_createDeleteButton",value:function(e){var t,n;this.options.rtl?n="vis-delete-rtl":n="vis-delete";var a=this._createButton("delete",n,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(a),this._bindElementEvents(a,k(t=this.deleteSelected).call(t,this))}},{key:"_createBackButton",value:function(e){var t,n=this._createButton("back","vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.showManipulatorToolbar).call(t,this))}},{key:"_createButton",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("button"),this.manipulationDOM[e+"Div"].className="vis-button "+t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=a,this.manipulationDOM[e+"Label"].innerText=n,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}},{key:"_createDescription",value:function(e){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}},{key:"_temporaryBindEvent",value:function(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}},{key:"_temporaryBindUI",value:function(e,t){if(this.body.eventListeners[e]!==void 0)this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t;else throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+ls(Oe(this.body.eventListeners)))}},{key:"_unbindTemporaryUIs",value:function(){for(var e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}},{key:"_unbindTemporaryEvents",value:function(){for(var e=0;e=0;u--)if(o[u]!==this.selectedControlNode.id){s=this.body.nodes[o[u]];break}if(s!==void 0&&this.selectedControlNode!==void 0)if(s.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var l=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===l.id?this._performEditEdge(s.id,a.to.id):this._performEditEdge(a.from.id,s.id)}else a.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}}},{key:"_handleConnect",value:function(e){if(new Date().valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=Le({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;var t=this.lastTouch,n=this.selectionHandler.getNodeAt(t);if(n!==void 0)if(n.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var a=this._getNewTargetNode(n.x,n.y);this.body.nodes[a.id]=a,this.body.nodeIndices.push(a.id);var o=this.body.functions.createEdge({id:"connectionEdge"+no(),from:n.id,to:a.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[o.id]=o,this.body.edgeIndices.push(o.id),this.temporaryIds.nodes.push(a.id),this.temporaryIds.edges.push(o.id)}this.touchTime=new Date().valueOf()}}},{key:"_dragControlNode",value:function(e){var t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),a=void 0;this.temporaryIds.edges[0]!==void 0&&(a=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var o=this.selectionHandler._getAllNodesOverlappingWith(n),s=void 0,u=o.length-1;u>=0;u--){var l;if(ne(l=this.temporaryIds.nodes).call(l,o[u])===-1){s=this.body.nodes[o[u]];break}}if(e.controlEdge={from:a,to:s?s.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",e,t),this.temporaryIds.nodes[0]!==void 0){var h=this.body.nodes[this.temporaryIds.nodes[0]];h.x=this.canvas._XconvertDOMtoCanvas(t.x),h.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(e)}},{key:"_finishConnect",value:function(e){var t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),a=void 0;this.temporaryIds.edges[0]!==void 0&&(a=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var o=this.selectionHandler._getAllNodesOverlappingWith(n),s=void 0,u=o.length-1;u>=0;u--){var l;if(ne(l=this.temporaryIds.nodes).call(l,o[u])===-1){s=this.body.nodes[o[u]];break}}this._cleanupTemporaryNodesAndEdges(),s!==void 0&&(s.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):this.body.nodes[a]!==void 0&&this.body.nodes[s.id]!==void 0&&this._performAddEdge(a,s.id)),e.controlEdge={from:a,to:s?s.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",e,t),this.body.emitter.emit("_redraw")}},{key:"_dragStartEdge",value:function(e){var t=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",e,t,void 0,!0)}},{key:"_performAddNode",value:function(e){var t=this,n={id:no(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if(typeof this.options.addNode=="function")if(this.options.addNode.length===2)this.options.addNode(n,function(a){a!=null&&t.inMode==="addNode"&&t.body.data.nodes.getDataSet().add(a),t.showManipulatorToolbar()});else throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");else this.body.data.nodes.getDataSet().add(n),this.showManipulatorToolbar()}},{key:"_performAddEdge",value:function(e,t){var n=this,a={from:e,to:t};if(typeof this.options.addEdge=="function")if(this.options.addEdge.length===2)this.options.addEdge(a,function(o){o!=null&&n.inMode==="addEdge"&&(n.body.data.edges.getDataSet().add(o),n.selectionHandler.unselectAll(),n.showManipulatorToolbar())});else throw new Error("The function for connect does not support two arguments (data,callback)");else this.body.data.edges.getDataSet().add(a),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}},{key:"_performEditEdge",value:function(e,t){var n=this,a={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges.get(this.edgeBeingEditedId).label},o=this.options.editEdge;if(de(o)==="object"&&(o=o.editWithoutDrag),typeof o=="function")if(o.length===2)o(a,function(s){s==null||n.inMode!=="editEdge"?(n.body.edges[a.id].updateEdgeType(),n.body.emitter.emit("_redraw"),n.showManipulatorToolbar()):(n.body.data.edges.getDataSet().update(s),n.selectionHandler.unselectAll(),n.showManipulatorToolbar())});else throw new Error("The function for edit does not support two arguments (data, callback)");else this.body.data.edges.getDataSet().update(a),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}]),i}(),A="string",I="boolean",w="number",Ya="array",H="object",ZT="dom",kpe="any",bd=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],$d={borderWidth:{number:w},borderWidthSelected:{number:w,undefined:"undefined"},brokenImage:{string:A,undefined:"undefined"},chosen:{label:{boolean:I,function:"function"},node:{boolean:I,function:"function"},__type__:{object:H,boolean:I}},color:{border:{string:A},background:{string:A},highlight:{border:{string:A},background:{string:A},__type__:{object:H,string:A}},hover:{border:{string:A},background:{string:A},__type__:{object:H,string:A}},__type__:{object:H,string:A}},opacity:{number:w,undefined:"undefined"},fixed:{x:{boolean:I},y:{boolean:I},__type__:{object:H,boolean:I}},font:{align:{string:A},color:{string:A},size:{number:w},face:{string:A},background:{string:A},strokeWidth:{number:w},strokeColor:{string:A},vadjust:{number:w},multi:{boolean:I,string:A},bold:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},boldital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},ital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},mono:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},__type__:{object:H,string:A}},group:{string:A,number:w,undefined:"undefined"},heightConstraint:{minimum:{number:w},valign:{string:A},__type__:{object:H,boolean:I,number:w}},hidden:{boolean:I},icon:{face:{string:A},code:{string:A},size:{number:w},color:{string:A},weight:{string:A,number:w},__type__:{object:H}},id:{string:A,number:w},image:{selected:{string:A,undefined:"undefined"},unselected:{string:A,undefined:"undefined"},__type__:{object:H,string:A}},imagePadding:{top:{number:w},right:{number:w},bottom:{number:w},left:{number:w},__type__:{object:H,number:w}},label:{string:A,undefined:"undefined"},labelHighlightBold:{boolean:I},level:{number:w,undefined:"undefined"},margin:{top:{number:w},right:{number:w},bottom:{number:w},left:{number:w},__type__:{object:H,number:w}},mass:{number:w},physics:{boolean:I},scaling:{min:{number:w},max:{number:w},label:{enabled:{boolean:I},min:{number:w},max:{number:w},maxVisible:{number:w},drawThreshold:{number:w},__type__:{object:H,boolean:I}},customScalingFunction:{function:"function"},__type__:{object:H}},shadow:{enabled:{boolean:I},color:{string:A},size:{number:w},x:{number:w},y:{number:w},__type__:{object:H,boolean:I}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:I,array:Ya},borderRadius:{number:w},interpolation:{boolean:I},useImageSize:{boolean:I},useBorderWithImage:{boolean:I},coordinateOrigin:{string:["center","top-left"]},__type__:{object:H}},size:{number:w},title:{string:A,dom:ZT,undefined:"undefined"},value:{number:w,undefined:"undefined"},widthConstraint:{minimum:{number:w},maximum:{number:w},__type__:{object:H,boolean:I,number:w}},x:{number:w},y:{number:w},__type__:{object:H}},Ppe={configure:{enabled:{boolean:I},filter:{boolean:I,string:A,array:Ya,function:"function"},container:{dom:ZT},showButton:{boolean:I},__type__:{object:H,boolean:I,string:A,array:Ya,function:"function"}},edges:{arrows:{to:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageHeight:{number:w},imageWidth:{number:w},src:{string:A},__type__:{object:H,boolean:I}},middle:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageWidth:{number:w},imageHeight:{number:w},src:{string:A},__type__:{object:H,boolean:I}},from:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageWidth:{number:w},imageHeight:{number:w},src:{string:A},__type__:{object:H,boolean:I}},__type__:{string:["from","to","middle"],object:H}},endPointOffset:{from:{number:w},to:{number:w},__type__:{object:H,number:w}},arrowStrikethrough:{boolean:I},background:{enabled:{boolean:I},color:{string:A},size:{number:w},dashes:{boolean:I,array:Ya},__type__:{object:H,boolean:I}},chosen:{label:{boolean:I,function:"function"},edge:{boolean:I,function:"function"},__type__:{object:H,boolean:I}},color:{color:{string:A},highlight:{string:A},hover:{string:A},inherit:{string:["from","to","both"],boolean:I},opacity:{number:w},__type__:{object:H,string:A}},dashes:{boolean:I,array:Ya},font:{color:{string:A},size:{number:w},face:{string:A},background:{string:A},strokeWidth:{number:w},strokeColor:{string:A},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:w},multi:{boolean:I,string:A},bold:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},boldital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},ital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},mono:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},__type__:{object:H,string:A}},hidden:{boolean:I},hoverWidth:{function:"function",number:w},label:{string:A,undefined:"undefined"},labelHighlightBold:{boolean:I},length:{number:w,undefined:"undefined"},physics:{boolean:I},scaling:{min:{number:w},max:{number:w},label:{enabled:{boolean:I},min:{number:w},max:{number:w},maxVisible:{number:w},drawThreshold:{number:w},__type__:{object:H,boolean:I}},customScalingFunction:{function:"function"},__type__:{object:H}},selectionWidth:{function:"function",number:w},selfReferenceSize:{number:w},selfReference:{size:{number:w},angle:{number:w},renderBehindTheNode:{boolean:I},__type__:{object:H}},shadow:{enabled:{boolean:I},color:{string:A},size:{number:w},x:{number:w},y:{number:w},__type__:{object:H,boolean:I}},smooth:{enabled:{boolean:I},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:w},forceDirection:{string:["horizontal","vertical","none"],boolean:I},__type__:{object:H,boolean:I}},title:{string:A,undefined:"undefined"},width:{number:w},widthConstraint:{maximum:{number:w},__type__:{object:H,boolean:I,number:w}},value:{number:w,undefined:"undefined"},__type__:{object:H}},groups:{useDefaultGroups:{boolean:I},__any__:$d,__type__:{object:H}},interaction:{dragNodes:{boolean:I},dragView:{boolean:I},hideEdgesOnDrag:{boolean:I},hideEdgesOnZoom:{boolean:I},hideNodesOnDrag:{boolean:I},hover:{boolean:I},keyboard:{enabled:{boolean:I},speed:{x:{number:w},y:{number:w},zoom:{number:w},__type__:{object:H}},bindToWindow:{boolean:I},autoFocus:{boolean:I},__type__:{object:H,boolean:I}},multiselect:{boolean:I},navigationButtons:{boolean:I},selectable:{boolean:I},selectConnectedEdges:{boolean:I},hoverConnectedEdges:{boolean:I},tooltipDelay:{number:w},zoomView:{boolean:I},zoomSpeed:{number:w},__type__:{object:H}},layout:{randomSeed:{undefined:"undefined",number:w,string:A},improvedLayout:{boolean:I},clusterThreshold:{number:w},hierarchical:{enabled:{boolean:I},levelSeparation:{number:w},nodeSpacing:{number:w},treeSpacing:{number:w},blockShifting:{boolean:I},edgeMinimization:{boolean:I},parentCentralization:{boolean:I},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:H,boolean:I}},__type__:{object:H}},manipulation:{enabled:{boolean:I},initiallyActive:{boolean:I},addNode:{boolean:I,function:"function"},addEdge:{boolean:I,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:H,boolean:I,function:"function"}},deleteNode:{boolean:I,function:"function"},deleteEdge:{boolean:I,function:"function"},controlNodeStyle:$d,__type__:{object:H,boolean:I}},nodes:$d,physics:{enabled:{boolean:I},barnesHut:{theta:{number:w},gravitationalConstant:{number:w},centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},forceAtlas2Based:{theta:{number:w},gravitationalConstant:{number:w},centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},repulsion:{centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},nodeDistance:{number:w},damping:{number:w},__type__:{object:H}},hierarchicalRepulsion:{centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},nodeDistance:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},maxVelocity:{number:w},minVelocity:{number:w},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:I},iterations:{number:w},updateInterval:{number:w},onlyDynamicEdges:{boolean:I},fit:{boolean:I},__type__:{object:H,boolean:I}},timestep:{number:w},adaptiveTimestep:{boolean:I},wind:{x:{number:w},y:{number:w},__type__:{object:H}},__type__:{object:H,boolean:I}},autoResize:{boolean:I},clickToUse:{boolean:I},locale:{string:A},locales:{__any__:{any:kpe},__type__:{object:H}},height:{string:A},width:{string:A},__type__:{object:H}},QT={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:["color","#2B7CE9"],background:["color","#97C2FC"],highlight:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]},hover:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[0,0,50,1],strokeColor:["color","#ffffff"]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:["ellipse","box","circle","database","diamond","dot","square","star","text","triangle","triangleDown","hexagon"],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:["color","#848484"],highlight:["color","#848484"],hover:["color","#848484"],inherit:["from","to","both",!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[2,0,50,1],strokeColor:["color","#ffffff"],align:["horizontal","top","middle","bottom"]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"],forceDirection:["horizontal","vertical","none"],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:["UD","DU","LR","RL"],sortMethod:["hubsize","directed"],shakeTowards:["leaves","roots"]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0,autoFocus:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:["barnesHut","forceAtlas2Based","repulsion","hierarchicalRepulsion"],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},xpe=function(r,e,t){var n;return!!(hi(r).call(r,"physics")&&hi(n=QT.physics.solver).call(n,e)&&t.physics.solver!==e&&e!=="wind")},Cpe=function(){function i(){N(this,i)}return M(i,[{key:"getDistances",value:function(e,t,n){for(var a={},o=e.edges,s=0;s2&&arguments[2]!==void 0?arguments[2]:!1,a=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(a),this._createK_matrix(a),this._createE_matrix();for(var o=.01,s=1,u=0,l=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),h=5,c=1e9,d=0,f=0,v=0,p=0,g=0;c>o&&us&&gy.type==="downstream_subgraph_search")?.data||[],f=y=>{const m=y.json.nodes.map(b=>({id:b.id,label:b.type,color:{background:"#2B7CE9",border:"#1B5BB1"},font:{size:16,color:"#FFFFFF",face:"arial",bold:!0},margin:12,padding:10,shape:"box",widthConstraint:{minimum:100,maximum:200}})),$=y.json.links.map(b=>({from:b.origin_id,to:b.target_id,arrows:{to:{enabled:!0,scaleFactor:1.2}},color:"#000000",width:2}));return{nodes:m,edges:$}};We.useEffect(()=>()=>{c.current&&(c.current.destroy(),c.current=null)},[]);const v=We.useCallback((y,m)=>{c.current&&c.current.destroy();const $=f(m),b=new z(y,$,{nodes:{shape:"box",margin:12,padding:10,font:{size:16,color:"#FFFFFF",face:"arial",bold:!0},borderWidth:2,shadow:{enabled:!0,color:"rgba(0,0,0,0.2)",size:5}},edges:{arrows:"to",color:"#000000",width:2,smooth:{enabled:!0,type:"straightCross"}},physics:{enabled:!0,solver:"hierarchicalRepulsion",hierarchicalRepulsion:{nodeDistance:200,springLength:200}},layout:{hierarchical:{enabled:!0,direction:"UD",sortMethod:"directed",nodeSpacing:200,levelSeparation:150}},interaction:{dragNodes:!1,zoomView:!1,dragView:!1}});c.current=b},[]),p=async y=>{console.log("[DownstreamSubgraphs] Starting checkAndLoadSubgraph with node:",y),ai.trackEvent({event_type:"subgraph_accept",message_type:"subgraph",message_id:u.message_id,data:{subgraph_name:y.name,subgraph_tags:y.tags}});const m=y.json.nodes,$=Object.values(Mt.canvas.selected_nodes)[0];if(!$){console.warn("[DownstreamSubgraphs] No node selected"),alert("Please select a upstream node first before adding a subgraph.");return}const b=m.map(D=>D.type),O=s;console.log("[DownstreamSubgraphs] Required node types:",b),console.log("[DownstreamSubgraphs] Installed node types:",O);const _=b.filter(D=>!O.includes(D));if(console.log("[DownstreamSubgraphs] Missing node types:",_),_.length>0)try{console.log("[DownstreamSubgraphs] Fetching info for missing nodes");const D=await ai.batchGetNodeInfo(_);console.log("[DownstreamSubgraphs] Received node infos:",D);const R={text:"",ext:[{type:"node_install_guide",data:D.map(B=>({name:B.name,repository_url:B.github_url}))}]};console.log("[DownstreamSubgraphs] Created message content:",R);const P={id:dr(),role:"ai",content:JSON.stringify(R),format:"markdown",name:"Assistant",metadata:{pendingSubgraph:y}};console.log("[DownstreamSubgraphs] Created AI message:",P),t?.(P);return}catch(D){console.error("[DownstreamSubgraphs] Error fetching node info:",D),alert("Error checking required nodes. Please try again.");return}console.log("[DownstreamSubgraphs] All required nodes are installed, proceeding to load subgraph"),g(y,$)},g=(y,m)=>{const $=y.json.nodes,b=y.json.links,O=$.find(R=>R.id===0),_=O?.id;console.log("[DownstreamSubgraphs] Entry node ID:",_);const D={};_!==null&&(D[_]=m),Mt.canvas.emitBeforeChange();try{for(const R of $)if(R.id!==_){const P=O?.pos,B=[m._pos[0],m._pos[1]],j=[R.pos[0]+B[0]-P[0],R.pos[1]+B[1]-P[1]];D[R.id]=X$(R.type,{pos:j})}for(const R of b){const P=D[R.origin_id],B=D[R.target_id];P&&B&&P.connect(R.origin_slot,B,R.target_slot)}}finally{Mt.canvas.emitAfterChange()}};return We.useEffect(()=>{const y=()=>{const m=Mt.canvas.selected_nodes;Object.keys(m??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values(m)}):a({type:"SET_SELECTED_NODE",payload:null})};return document.addEventListener("click",y),()=>{document.removeEventListener("click",y)}},[]),S.jsx("div",{className:"rounded-lg bg-gray-500 p-3 text-gray-700 text-xs break-words overflow-visible",children:d.length>0&&S.jsx("div",{className:"space-y-3",children:S.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(y=>S.jsxs("div",{className:"relative group",children:[S.jsx("button",{className:`px-3 py-1.5 bg-blue-500 text-white rounded-md +`),a=n.length;if(t.multi)for(var o=0;o0)for(var u=0;u0)for(var v=0;v")||t.parseStartTag("ital","")||t.parseStartTag("mono","")||t.parseEndTag("bold","")||t.parseEndTag("ital","")||t.parseEndTag("mono",""))||n(a);o||t.add(a),t.position++}return t.emitBlock(),t.blocks}},{key:"splitMarkdownBlocks",value:function(e){for(var t=this,n=new q1(e),a=!0,o=function(h){return/\\/.test(h)?(n.positionthis.parent.fontOptions.maxWdt}},{key:"getLongestFit",value:function(e){for(var t="",n=0;n1&&arguments[1]!==void 0?arguments[1]:"normal",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t),e=e.replace(/^( +)/g,"$1\r"),e=e.replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r");for(var a=e.split("\r");a.length>0;){var o=this.getLongestFit(a);if(o===0){var s=a[0],u=this.getLongestFitWord(s);this.lines.newLine(it(s).call(s,0,u),t),a[0]=it(s).call(s,u)}else{var l=o;a[o-1]===" "?o--:a[l]===" "&&l++;var h=it(a).call(a,0,o).join("");o==a.length&&n?this.lines.append(h,t):this.lines.newLine(h,t),a=it(a).call(a,l)}}}}]),i}(),Va=["bold","ital","boldital","mono"],IT=function(){function i(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;N(this,i),this.body=r,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(e),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=t}return M(i,[{key:"setOptions",value:function(e){if(this.elementOptions=e,this.initFontOptions(e.font),Zu(e.label)?this.labelDirty=!0:e.label=void 0,e.font!==void 0&&e.font!==null){if(typeof e.font=="string")this.baseSize=this.fontOptions.size;else if(de(e.font)==="object"){var t=e.font.size;t!==void 0&&(this.baseSize=t)}}}},{key:"initFontOptions",value:function(e){var t=this;if(te(Va,function(n){t.fontOptions[n]={}}),i.parseFontString(this.fontOptions,e)){this.fontOptions.vadjust=0;return}te(e,function(n,a){n!=null&&de(n)!=="object"&&(t.fontOptions[a]=n)})}},{key:"constrain",value:function(e){var t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},n=Qr(e,"widthConstraint");if(typeof n=="number")t.maxWdt=Number(n),t.minWdt=Number(n);else if(de(n)==="object"){var a=Qr(e,["widthConstraint","maximum"]);typeof a=="number"&&(t.maxWdt=Number(a));var o=Qr(e,["widthConstraint","minimum"]);typeof o=="number"&&(t.minWdt=Number(o))}var s=Qr(e,"heightConstraint");if(typeof s=="number")t.minHgt=Number(s);else if(de(s)==="object"){var u=Qr(e,["heightConstraint","minimum"]);typeof u=="number"&&(t.minHgt=Number(u));var l=Qr(e,["heightConstraint","valign"]);typeof l=="string"&&(l==="top"||l==="bottom")&&(t.valign=l)}return t}},{key:"update",value:function(e,t){this.setOptions(e,!0),this.propagateFonts(t),pe(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=dp("label",t)}},{key:"adjustSizes",value:function(e){var t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);var n=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=n)}},{key:"addFontOptionsToPile",value:function(e,t){for(var n=0;n5&&arguments[5]!==void 0?arguments[5]:"middle";if(this.elementOptions.label!==void 0){var u=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&u=this.elementOptions.scaling.label.maxVisible&&(u=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,a,o,t,n,s),this._drawBackground(e),this._drawText(e,t,this.size.yLine,s,u))}}},{key:"_drawBackground",value:function(e){if(this.fontOptions.background!==void 0&&this.fontOptions.background!=="none"){e.fillStyle=this.fontOptions.background;var t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}},{key:"_drawText",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"middle",o=arguments.length>4?arguments[4]:void 0,s=this._setAlignment(e,t,n,a),u=Te(s,2);t=u[0],n=u[1],e.textAlign="left",t=t-this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&(this.fontOptions.valign==="top"&&(n-=(this.size.height-this.size.labelHeight)/2),this.fontOptions.valign==="bottom"&&(n+=(this.size.height-this.size.labelHeight)/2));for(var l=0;l0&&(e.lineWidth=f.strokeWidth,e.strokeStyle=y,e.lineJoin="round"),e.fillStyle=g,f.strokeWidth>0&&e.strokeText(f.text,t+c,n+f.vadjust),e.fillText(f.text,t+c,n+f.vadjust),c+=f.width}n+=h.height}}}},{key:"_setAlignment",value:function(e,t,n,a){if(this.isEdgeLabel&&this.fontOptions.align!=="horizontal"&&this.pointToSelf===!1){t=0,n=0;var o=2;this.fontOptions.align==="top"?(e.textBaseline="alphabetic",n-=2*o):this.fontOptions.align==="bottom"?(e.textBaseline="hanging",n+=2*o):e.textBaseline="middle"}else e.textBaseline=a;return[t,n]}},{key:"_getColor",value:function(e,t,n){var a=e||"#000000",o=n||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){var s=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));a=Kt(a,s),o=Kt(o,s)}return[a,o]}},{key:"getTextSize",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this._processLabel(e,t,n),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}},{key:"getSize",value:function(){var e=2,t=this.size.left,n=this.size.top-.5*e;if(this.isEdgeLabel){var a=-this.size.width*.5;switch(this.fontOptions.align){case"middle":t=a,n=-this.size.height*.5;break;case"top":t=a,n=-(this.size.height+e);break;case"bottom":t=a,n=e;break}}var o={left:t,top:n,width:this.size.width,height:this.size.height};return o}},{key:"calculateLabelSize",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";this._processLabel(e,t,n),this.size.left=a-this.size.width*.5,this.size.top=o-this.size.height*.5,this.size.yLine=o+(1-this.lineCount)*.5*this.fontOptions.size,s==="hanging"&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}},{key:"getFormattingValues",value:function(e,t,n,a){var o=function(h,c,d){return c==="normal"?d==="mod"?"":h[d]:h[c][d]!==void 0?h[c][d]:h[d]},s={color:o(this.fontOptions,a,"color"),size:o(this.fontOptions,a,"size"),face:o(this.fontOptions,a,"face"),mod:o(this.fontOptions,a,"mod"),vadjust:o(this.fontOptions,a,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||n)&&(a==="normal"&&this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?s.mod="bold":typeof this.fontOptions.chooser=="function"&&this.fontOptions.chooser(s,this.elementOptions.id,t,n));var u="";return s.mod!==void 0&&s.mod!==""&&(u+=s.mod+" "),u+=s.size+"px "+s.face,e.font=u.replace(/"/g,""),s.font=e.font,s.height=s.size,s}},{key:"differentState",value:function(e,t){return e!==this.selectedState||t!==this.hoverState}},{key:"_processLabelText",value:function(e,t,n,a){var o=new Hle(e,this,t,n);return o.process(a)}},{key:"_processLabel",value:function(e,t,n){if(!(this.labelDirty===!1&&!this.differentState(t,n))){var a=this._processLabelText(e,t,n,this.elementOptions.label);this.fontOptions.minWdt>0&&a.width0&&a.height0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}},{key:"performFill",value:function(e,t){e.save(),e.fillStyle=t.color,this.enableShadow(e,t),hs(e).call(e),this.disableShadow(e,t),e.restore(),this.performStroke(e,t)}},{key:"_addBoundingBoxMargin",value:function(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}},{key:"_updateBoundingBox",value:function(e,t,n,a,o){n!==void 0&&this.resize(n,a,o),this.left=e-this.width/2,this.top=t-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}},{key:"updateBoundingBox",value:function(e,t,n,a,o){this._updateBoundingBox(e,t,n,a,o)}},{key:"getDimensionsFromLabel",value:function(e,t,n){this.textSize=this.labelModule.getTextSize(e,t,n);var a=this.textSize.width,o=this.textSize.height,s=14;return a===0&&(a=s,o=s),{width:a,height:o}}}]),i}();function Dhe(i){var r=Rhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Rhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Nhe=function(i){ue(e,i);var r=Dhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o);this.width=s.width+this.margin.right+this.margin.left,this.height=s.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.initContextForDraw(n,l),qE(n,this.left,this.top,this.width,this.height,l.borderRadius),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u)}},{key:"updateBoundingBox",value:function(n,a,o,s,u){this._updateBoundingBox(n,a,o,s,u);var l=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(l)}},{key:"distanceToBorder",value:function(n,a){n&&this.resize(n);var o=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(a)),Math.abs(this.height/2/Math.sin(a)))+o}}]),e}(vn);function Mhe(i){var r=Bhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Bhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var pp=function(i){ue(e,i);var r=Mhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o.labelOffset=0,o.selected=!1,o}return M(e,[{key:"setOptions",value:function(n,a,o){this.options=n,a===void 0&&o===void 0||this.setImages(a,o)}},{key:"setImages",value:function(n,a){a&&this.selected?(this.imageObj=a,this.imageObjAlt=n):(this.imageObj=n,this.imageObjAlt=a)}},{key:"switchImages",value:function(n){var a=n&&!this.selected||!n&&this.selected;if(this.selected=n,this.imageObjAlt!==void 0&&a){var o=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=o}}},{key:"_getImagePadding",value:function(){var n={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){var a=this.options.imagePadding;de(a)=="object"?(n.top=a.top,n.right=a.right,n.bottom=a.bottom,n.left=a.left):(n.top=a,n.right=a,n.bottom=a,n.left=a)}return n}},{key:"_resizeImage",value:function(){var n,a;if(this.options.shapeProperties.useImageSize===!1){var o=1,s=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?o=this.imageObj.width/this.imageObj.height:s=this.imageObj.height/this.imageObj.width),n=this.options.size*2*o,a=this.options.size*2*s}else{var u=this._getImagePadding();n=this.imageObj.width+u.left+u.right,a=this.imageObj.height+u.top+u.bottom}this.width=n,this.height=a,this.radius=.5*this.width}},{key:"_drawRawCircle",value:function(n,a,o,s){this.initContextForDraw(n,s),Av(n,a,o,s.size),this.performFill(n,s)}},{key:"_drawImageAtPosition",value:function(n,a){if(this.imageObj.width!=0){n.globalAlpha=a.opacity!==void 0?a.opacity:1,this.enableShadow(n,a);var o=1;this.options.shapeProperties.interpolation===!0&&(o=this.imageObj.width/this.width/this.body.view.scale);var s=this._getImagePadding(),u=this.left+s.left,l=this.top+s.top,h=this.width-s.left-s.right,c=this.height-s.top-s.bottom;this.imageObj.drawImageAtPosition(n,o,u,l,h,c),this.disableShadow(n,a)}}},{key:"_drawImageLabel",value:function(n,a,o,s,u){var l=0;if(this.height!==void 0){l=this.height*.5;var h=this.labelModule.getTextSize(n,s,u);h.lineCount>=1&&(l+=h.height/2)}var c=o+l;this.options.label&&(this.labelOffset=l),this.labelModule.draw(n,a,c,s,u,"hanging")}}]),e}(vn);function Fhe(i){var r=jhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function jhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Lhe=function(i){ue(e,i);var r=Fhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o),u=Math.max(s.width+this.margin.right+this.margin.left,s.height+this.margin.top+this.margin.bottom);this.options.size=u/2,this.width=u,this.height=u,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this._drawRawCircle(n,a,o,l),this.updateBoundingBox(a,o),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,o,s,u)}},{key:"updateBoundingBox",value:function(n,a){this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.width*.5}}]),e}(pp);function zhe(i){var r=Hhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Hhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Vhe=function(i){ue(e,i);var r=zhe(e);function e(t,n,a,o,s){var u;return N(this,e),u=r.call(this,t,n,a),u.setImages(o,s),u}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0;if(s){var u=this.options.size*2;this.width=u,this.height=u,this.radius=.5*this.width;return}this.needsRefresh(a,o)&&this._resizeImage()}},{key:"draw",value:function(n,a,o,s,u,l){this.switchImages(s),this.resize();var h=a,c=o;this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=a,this.top=o,h+=this.width/2,c+=this.height/2):(this.left=a-this.width/2,this.top=o-this.height/2),this._drawRawCircle(n,h,c,l),n.save(),n.clip(),this._drawImageAtPosition(n,l),n.restore(),this._drawImageLabel(n,h,c,s,u),this.updateBoundingBox(a,o)}},{key:"updateBoundingBox",value:function(n,a){this.options.shapeProperties.coordinateOrigin==="top-left"?(this.boundingBox.top=a,this.boundingBox.left=n,this.boundingBox.right=n+this.options.size*2,this.boundingBox.bottom=a+this.options.size*2):(this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size),this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.width*.5}}]),e}(pp);function Whe(i){var r=Uhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Uhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Si=function(i){ue(e,i);var r=Whe(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{size:this.options.size};if(this.needsRefresh(a,o)){var u,l;this.labelModule.getTextSize(n,a,o);var h=2*s.size;this.width=(u=this.customSizeWidth)!==null&&u!==void 0?u:h,this.height=(l=this.customSizeHeight)!==null&&l!==void 0?l:h,this.radius=.5*this.width}}},{key:"_drawShape",value:function(n,a,o,s,u,l,h,c){var d=this;return this.resize(n,l,h,c),this.left=s-this.width/2,this.top=u-this.height/2,this.initContextForDraw(n,c),TK(a)(n,s,u,c.size),this.performFill(n,c),this.options.icon!==void 0&&this.options.icon.code!==void 0&&(n.font=(l?"bold ":"")+this.height/2+"px "+(this.options.icon.face||"FontAwesome"),n.fillStyle=this.options.icon.color||"black",n.textAlign="center",n.textBaseline="middle",n.fillText(this.options.icon.code,s,u)),{drawExternalLabel:function(){if(d.options.label!==void 0){d.labelModule.calculateLabelSize(n,l,h,s,u,"hanging");var v=u+.5*d.height+.5*d.labelModule.size.height;d.labelModule.draw(n,s,v,l,h,"hanging")}d.updateBoundingBox(s,u)}}}},{key:"updateBoundingBox",value:function(n,a){this.boundingBox.top=a-this.options.size,this.boundingBox.left=n-this.options.size,this.boundingBox.right=n+this.options.size,this.boundingBox.bottom=a+this.options.size,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}]),e}(vn);function Q1(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function Khe(i){for(var r=1;r"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Yhe=function(i){ue(e,i);var r=Ghe(e);function e(t,n,a,o){var s;return N(this,e),s=r.call(this,t,n,a,o),s.ctxRenderer=o,s}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u,l),this.left=a-this.width/2,this.top=o-this.height/2,n.save();var h=this.ctxRenderer({ctx:n,id:this.options.id,x:a,y:o,state:{selected:s,hover:u},style:Khe({},l),label:this.options.label});if(h.drawNode!=null&&h.drawNode(),n.restore(),h.drawExternalLabel){var c=h.drawExternalLabel;h.drawExternalLabel=function(){n.save(),c(),n.restore()}}return h.nodeDimensions&&(this.customSizeWidth=h.nodeDimensions.width,this.customSizeHeight=h.nodeDimensions.height),h}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function Xhe(i){var r=Jhe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Jhe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Zhe=function(i){ue(e,i);var r=Xhe(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o),u=s.width+this.margin.right+this.margin.left;this.width=u,this.height=u,this.radius=this.width/2}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.initContextForDraw(n,l),YE(n,a-this.width/2,o-this.height/2,this.width,this.height),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function Qhe(i){var r=ece();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function ece(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var tce=function(i){ue(e,i);var r=Qhe(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"diamond",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function rce(i){var r=ice();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function ice(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var nce=function(i){ue(e,i);var r=rce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"circle",2,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n){return n&&this.resize(n),this.options.size}}]),e}(Si);function ace(i){var r=oce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function oce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var e$=function(i){ue(e,i);var r=ace(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(a,o)){var s=this.getDimensionsFromLabel(n,a,o);this.height=s.height*2,this.width=s.width+s.height,this.radius=.5*this.width}}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width*.5,this.top=o-this.height*.5,this.initContextForDraw(n,l),sf(n,this.left,this.top,this.width,this.height),this.performFill(n,l),this.updateBoundingBox(a,o,n,s,u),this.labelModule.draw(n,a,o,s,u)}},{key:"distanceToBorder",value:function(n,a){n&&this.resize(n);var o=this.width*.5,s=this.height*.5,u=Math.sin(a)*o,l=Math.cos(a)*s;return o*s/Math.sqrt(u*u+l*l)}}]),e}(vn);function sce(i){var r=uce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function uce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var lce=function(i){ue(e,i);var r=sce(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){this.needsRefresh(a,o)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(n,a,o,s,u,l){var h=this;return this.resize(n,s,u),this.options.icon.size=this.options.icon.size||50,this.left=a-this.width/2,this.top=o-this.height/2,this._icon(n,a,o,s,u,l),{drawExternalLabel:function(){if(h.options.label!==void 0){var d=5;h.labelModule.draw(n,h.left+h.iconSize.width/2+h.margin.left,o+h.height/2+d,s)}h.updateBoundingBox(a,o)}}}},{key:"updateBoundingBox",value:function(n,a){if(this.boundingBox.top=a-this.options.icon.size*.5,this.boundingBox.left=n-this.options.icon.size*.5,this.boundingBox.right=n+this.options.icon.size*.5,this.boundingBox.bottom=a+this.options.icon.size*.5,this.options.label!==void 0&&this.labelModule.size.width>0){var o=5;this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+o)}}},{key:"_icon",value:function(n,a,o,s,u,l){var h=Number(this.options.icon.size);this.options.icon.code!==void 0?(n.font=[this.options.icon.weight!=null?this.options.icon.weight:s?"bold":"",(this.options.icon.weight!=null&&s?5:0)+h+"px",this.options.icon.face].join(" "),n.fillStyle=this.options.icon.color||"black",n.textAlign="center",n.textBaseline="middle",this.enableShadow(n,l),n.fillText(this.options.icon.code,a,o),this.disableShadow(n,l)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function hce(i){var r=cce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function cce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var dce=function(i){ue(e,i);var r=hce(e);function e(t,n,a,o,s){var u;return N(this,e),u=r.call(this,t,n,a),u.setImages(o,s),u}return M(e,[{key:"resize",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,s=this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0;if(s){var u=this.options.size*2;this.width=u,this.height=u;return}this.needsRefresh(a,o)&&this._resizeImage()}},{key:"draw",value:function(n,a,o,s,u,l){n.save(),this.switchImages(s),this.resize();var h=a,c=o;if(this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=a,this.top=o,h+=this.width/2,c+=this.height/2):(this.left=a-this.width/2,this.top=o-this.height/2),this.options.shapeProperties.useBorderWithImage===!0){var d=this.options.borderWidth,f=this.options.borderWidthSelected||2*this.options.borderWidth,v=(s?f:d)/this.body.view.scale;n.lineWidth=Math.min(this.width,v),n.beginPath();var p=s?this.options.color.highlight.border:u?this.options.color.hover.border:this.options.color.border,g=s?this.options.color.highlight.background:u?this.options.color.hover.background:this.options.color.background;l.opacity!==void 0&&(p=Kt(p,l.opacity),g=Kt(g,l.opacity)),n.strokeStyle=p,n.fillStyle=g,n.rect(this.left-.5*n.lineWidth,this.top-.5*n.lineWidth,this.width+n.lineWidth,this.height+n.lineWidth),hs(n).call(n),this.performStroke(n,l),n.closePath()}this._drawImageAtPosition(n,l),this._drawImageLabel(n,h,c,s,u),this.updateBoundingBox(a,o),n.restore()}},{key:"updateBoundingBox",value:function(n,a){this.resize(),this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=n,this.top=a):(this.left=n-this.width/2,this.top=a-this.height/2),this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(pp);function fce(i){var r=vce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function vce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var pce=function(i){ue(e,i);var r=fce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"square",2,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function gce(i){var r=yce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function yce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var mce=function(i){ue(e,i);var r=gce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"hexagon",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function bce(i){var r=$ce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function $ce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var wce=function(i){ue(e,i);var r=bce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"star",4,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function _ce(i){var r=Ece();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Ece(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Sce=function(i){ue(e,i);var r=_ce(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._setMargins(a),o}return M(e,[{key:"resize",value:function(n,a,o){this.needsRefresh(a,o)&&(this.textSize=this.labelModule.getTextSize(n,a,o),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(n,a,o,s,u,l){this.resize(n,s,u),this.left=a-this.width/2,this.top=o-this.height/2,this.enableShadow(n,l),this.labelModule.draw(n,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,s,u),this.disableShadow(n,l),this.updateBoundingBox(a,o,n,s,u)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(vn);function Oce(i){var r=Tce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Tce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Ice=function(i){ue(e,i);var r=Oce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"triangle",3,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function kce(i){var r=Pce();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Pce(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var xce=function(i){ue(e,i);var r=kce(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"draw",value:function(n,a,o,s,u,l){return this._drawShape(n,"triangleDown",3,a,o,s,u,l)}},{key:"distanceToBorder",value:function(n,a){return this._distanceToBorder(n,a)}}]),e}(Si);function t$(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function r$(i){for(var r=1;re.left&&this.shape.tope.top}},{key:"isBoundingBoxOverlappingWith",value:function(e){return this.shape.boundingBox.lefte.left&&this.shape.boundingBox.tope.top}}],[{key:"checkOpacity",value:function(e){return 0<=e&&e<=1}},{key:"checkCoordinateOrigin",value:function(e){return e===void 0||e==="center"||e==="top-left"}},{key:"updateGroupOptions",value:function(e,t,n){var a;if(n!==void 0){var o=e.group;if(t!==void 0&&t.group!==void 0&&o!==t.group)throw new Error("updateGroupOptions: group values in options don't match.");var s=typeof o=="number"||typeof o=="string"&&o!="";if(s){var u=n.get(o);u.opacity!==void 0&&t.opacity===void 0&&(i.checkOpacity(u.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+u.opacity),u.opacity=void 0));var l=Tt(a=kle(t)).call(a,function(h){return t[h]!=null});l.push("font"),Yu(l,e,u),e.color=If(e.color)}}}},{key:"parseOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=arguments.length>4?arguments[4]:void 0,s=["color","fixed","shadow"];if(Yu(s,e,t,n),i.checkMass(t),e.opacity!==void 0&&(i.checkOpacity(e.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity),e.opacity=void 0)),t.opacity!==void 0&&(i.checkOpacity(t.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+t.opacity),t.opacity=void 0)),t.shapeProperties&&!i.checkCoordinateOrigin(t.shapeProperties.coordinateOrigin)&&console.error("Invalid option for node coordinateOrigin, found: "+t.shapeProperties.coordinateOrigin),Ut(e,t,"shadow",a),t.color!==void 0&&t.color!==null){var u=If(t.color);JO(e.color,u)}else n===!0&&t.color===null&&(e.color=di(a.color));t.fixed!==void 0&&t.fixed!==null&&(typeof t.fixed=="boolean"?(e.fixed.x=t.fixed,e.fixed.y=t.fixed):(t.fixed.x!==void 0&&typeof t.fixed.x=="boolean"&&(e.fixed.x=t.fixed.x),t.fixed.y!==void 0&&typeof t.fixed.y=="boolean"&&(e.fixed.y=t.fixed.y))),n===!0&&t.font===null&&(e.font=di(a.font)),i.updateGroupOptions(e,t,o),t.scaling!==void 0&&Ut(e.scaling,t.scaling,"label",a.scaling)}},{key:"checkMass",value:function(e,t){if(e.mass!==void 0&&e.mass<=0){var n="";t!==void 0&&(n=" in node id: "+t),console.error("%cNegative or zero mass disallowed"+n+", setting mass to 1.",tT),e.mass=1}}}]),i}();function Cce(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=Ace(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Ace(i,r){var e;if(i){if(typeof i=="string")return i$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i$(i,r)}}function i$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e1?console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity):this.options.opacity=e.opacity),e.shape!==void 0)for(var t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].updateShape();if(typeof e.font<"u"||typeof e.widthConstraint<"u"||typeof e.heightConstraint<"u")for(var n=0,a=Oe(this.body.nodes);n1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.data.nodes;if(IE("id",e))this.body.data.nodes=e;else if(he(e))this.body.data.nodes=new Lu,this.body.data.nodes.add(e);else if(!e)this.body.data.nodes=new Lu;else throw new TypeError("Array or DataSet expected");if(n&&te(this.nodesListeners,function(s,u){n.off(u,s)}),this.body.nodes={},this.body.data.nodes){var a=this;te(this.nodesListeners,function(s,u){a.body.data.nodes.on(u,s)});var o=this.body.data.nodes.getIds();this.add(o,!0)}t===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n,a=[],o=0;o1&&arguments[1]!==void 0?arguments[1]:Nt;return new t(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}},{key:"refresh",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;te(this.body.nodes,function(n,a){var o=e.body.data.nodes.get(a);o!==void 0&&(t===!0&&n.setOptions({x:null,y:null}),n.setOptions({fixed:!1}),n.setOptions(o))})}},{key:"getPositions",value:function(e){var t={};if(e!==void 0){if(he(e)===!0){for(var n=0;n0?(u=s/o,t+=u*u):t+=s;return o===1/0?1/0:o*ode(t)}});var ude=oe,lde=ude.Math.hypot,hde=lde,cde=hde,dde=cde,fde=V(dde);function AT(i){var r=vde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function vde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Ne=function(){function i(){N(this,i)}return M(i,null,[{key:"transform",value:function(e,t){he(e)||(e=[e]);for(var n=t.point.x,a=t.point.y,o=t.angle,s=t.length,u=0;u4&&arguments[4]!==void 0?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,t),e.lineWidth=t.width,t.dashes!==!1?this._drawDashedLine(e,t,o):this._drawLine(e,t,o)}},{key:"_drawLine",value:function(e,t,n,a,o){if(this.from!=this.to)this._line(e,t,n,a,o);else{var s=this._getCircleData(e),u=Te(s,3),l=u[0],h=u[1],c=u[2];this._circle(e,t,l,h,c)}}},{key:"_drawDashedLine",value:function(e,t,n,a,o){e.lineCap="round";var s=he(t.dashes)?t.dashes:[5,5];if(e.setLineDash!==void 0){if(e.save(),e.setLineDash(s),e.lineDashOffset=0,this.from!=this.to)this._line(e,t,n);else{var u=this._getCircleData(e),l=Te(u,3),h=l[0],c=l[1],d=l[2];this._circle(e,t,h,c,d)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)XE(e,this.from.x,this.from.y,this.to.x,this.to.y,s);else{var f=this._getCircleData(e),v=Te(f,3),p=v[0],g=v[1],y=v[2];this._circle(e,t,p,g,y)}this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}}},{key:"findBorderPosition",value:function(e,t,n){return this.from!=this.to?this._findBorderPosition(e,t,n):this._findBorderPositionCircle(e,t,n)}},{key:"findBorderPositions",value:function(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};var t,n=it(t=this._getCircleData(e)).call(t,0,2),a=Te(n,2),o=a[0],s=a[1];return{from:this._findBorderPositionCircle(this.from,e,{x:o,y:s,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:o,y:s,low:.6,high:.8,direction:1})}}},{key:"_getCircleData",value:function(e){var t=this.options.selfReference.size;e!==void 0&&this.from.shape.width===void 0&&this.from.shape.resize(e);var n=OT(e,this.options.selfReference.angle,t,this.from);return[n.x,n.y,t]}},{key:"_pointOnCircle",value:function(e,t,n,a){var o=a*2*Math.PI;return{x:e+n*Math.cos(o),y:t-n*Math.sin(o)}}},{key:"_findBorderPositionCircle",value:function(e,t,n){var a=n.x,o=n.y,s=n.low,u=n.high,l=n.direction,h=10,c=this.options.selfReference.size,d=.05,f,v=(s+u)*.5,p=0;this.options.arrowStrikethrough===!0&&(l===-1?p=this.options.endPointOffset.from:l===1&&(p=this.options.endPointOffset.to));var g=0;do{v=(s+u)*.5,f=this._pointOnCircle(a,o,c,v);var y=Math.atan2(e.y-f.y,e.x-f.x),m=e.distanceToBorder(t,y)+p,$=Math.sqrt(Math.pow(f.x-e.x,2)+Math.pow(f.y-e.y,2)),b=m-$;if(Math.abs(b)0?l>0?s=v:u=v:l>0?u=v:s=v,++g}while(s<=u&&g1?c=1:c<0&&(c=0);var d=e+c*u,f=t+c*l,v=d-o,p=f-s;return Math.sqrt(v*v+p*p)}},{key:"getArrowData",value:function(e,t,n,a,o,s){var u,l,h,c,d,f,v,p=s.width;t==="from"?(h=this.from,c=this.to,d=s.fromArrowScale<0,f=Math.abs(s.fromArrowScale),v=s.fromArrowType):t==="to"?(h=this.to,c=this.from,d=s.toArrowScale<0,f=Math.abs(s.toArrowScale),v=s.toArrowType):(h=this.to,c=this.from,d=s.middleArrowScale<0,f=Math.abs(s.middleArrowScale),v=s.middleArrowType);var g=15*f+3*p;if(h!=c){var y=fde(h.x-c.x,h.y-c.y),m=g/y;if(t!=="middle")if(this.options.smooth.enabled===!0){var $=this._findBorderPosition(h,e,{via:n}),b=this.getPoint($.t+m*(t==="from"?1:-1),n);u=Math.atan2($.y-b.y,$.x-b.x),l=$}else u=Math.atan2(h.y-c.y,h.x-c.x),l=this._findBorderPosition(h,e);else{var O=(d?-m:m)/2,_=this.getPoint(.5+O,n),D=this.getPoint(.5-O,n);u=Math.atan2(_.y-D.y,_.x-D.x),l=this.getPoint(.5,n)}}else{var R=this._getCircleData(e),P=Te(R,3),B=P[0],j=P[1],J=P[2];if(t==="from"){var U=this.options.selfReference.angle,ie=this.options.selfReference.angle+Math.PI,_e=this._findBorderPositionCircle(this.from,e,{x:B,y:j,low:U,high:ie,direction:-1});u=_e.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI,l=_e}else if(t==="to"){var ye=this.options.selfReference.angle,Ae=this.options.selfReference.angle+Math.PI,ht=this._findBorderPositionCircle(this.from,e,{x:B,y:j,low:ye,high:Ae,direction:1});u=ht.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI,l=ht}else{var at=this.options.selfReference.angle/(2*Math.PI);l=this._pointOnCircle(B,j,J,at),u=at*-2*Math.PI+1.5*Math.PI+.1*Math.PI}}var Dt=l.x-g*.9*Math.cos(u),ot=l.y-g*.9*Math.sin(u),me={x:Dt,y:ot};return{point:l,core:me,angle:u,length:g,type:v}}},{key:"drawArrowHead",value:function(e,t,n,a,o){e.strokeStyle=this.getColor(e,t),e.fillStyle=e.strokeStyle,e.lineWidth=t.width;var s=DT.draw(e,o);s&&(this.enableShadow(e,t),hs(e).call(e),this.disableShadow(e,t))}},{key:"enableShadow",value:function(e,t){t.shadow===!0&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}},{key:"disableShadow",value:function(e,t){t.shadow===!0&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}},{key:"drawBackground",value:function(e,t){if(t.background!==!1){var n={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),e.strokeStyle=n.strokeStyle,e.lineWidth=n.lineWidth,e.dashes=n.dashes,this.setStrokeDashed(e,t.dashes)}}},{key:"setStrokeDashed",value:function(e,t){if(t!==!1)if(e.setLineDash!==void 0){var n=he(t)?t:[5,5];e.setLineDash(n)}else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");else e.setLineDash!==void 0?e.setLineDash([]):console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.")}}]),i}();function l$(i,r){var e=Oe(i);if(pi){var t=pi(i);r&&(t=Tt(t).call(t,function(n){return Ei(i,n).enumerable})),e.push.apply(e,t)}return e}function h$(i){for(var r=1;r"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var gp=function(i){ue(e,i);var r=Ide(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_findBorderPositionBezier",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this._getViaCoordinates(),s=10,u=.2,l=!1,h=1,c=0,d=this.to,f,v,p=this.options.endPointOffset?this.options.endPointOffset.to:0;n.id===this.from.id&&(d=this.from,l=!0,p=this.options.endPointOffset?this.options.endPointOffset.from:0),this.options.arrowStrikethrough===!1&&(p=0);var g=0;do{v=(c+h)*.5,f=this.getPoint(v,o);var y=Math.atan2(d.y-f.y,d.x-f.x),m=d.distanceToBorder(a,y)+p,$=Math.sqrt(Math.pow(f.x-d.x,2)+Math.pow(f.y-d.y,2)),b=m-$;if(Math.abs(b)0&&(d=this._getDistanceToLine(y,m,p,g,u,l),c=d"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var c$=function(i){ue(e,i);var r=Pde(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o.via=o.via,o._boundFunction=function(){o.positionBezierNode()},o._body.emitter.on("_repositionBezierNodes",o._boundFunction),o}return M(e,[{key:"setOptions",value:function(n){_u(L(e.prototype),"setOptions",this).call(this,n);var a=!1;this.options.physics!==n.physics&&(a=!0),this.options=n,this.id=this.options.id,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.setupSupportNode(),this.connect(),a===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}},{key:"connect",value:function(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.from===void 0||this.to===void 0||this.options.physics===!1?this.via.setOptions({physics:!1}):this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}},{key:"cleanup",value:function(){return this._body.emitter.off("_repositionBezierNodes",this._boundFunction),this.via!==void 0?(delete this._body.nodes[this.via.id],this.via=void 0,!0):!1}},{key:"setupSupportNode",value:function(){if(this.via===void 0){var n="edgeId:"+this.id,a=this._body.functions.createNode({id:n,shape:"circle",physics:!0,hidden:!0});this._body.nodes[n]=a,this.via=a,this.via.parentEdgeId=this.id,this.positionBezierNode()}}},{key:"positionBezierNode",value:function(){this.via!==void 0&&this.from!==void 0&&this.to!==void 0?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):this.via!==void 0&&(this.via.x=0,this.via.y=0)}},{key:"_line",value:function(n,a,o){this._bezierCurve(n,a,o)}},{key:"_getViaCoordinates",value:function(){return this.via}},{key:"getViaNode",value:function(){return this.via}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.via;if(this.from===this.to){var o=this._getCircleData(),s=Te(o,3),u=s[0],l=s[1],h=s[2],c=2*Math.PI*(1-n);return{x:u+h*Math.sin(c),y:l+h-h*(1-Math.cos(c))}}else return{x:Math.pow(1-n,2)*this.fromPoint.x+2*n*(1-n)*a.x+Math.pow(n,2)*this.toPoint.x,y:Math.pow(1-n,2)*this.fromPoint.y+2*n*(1-n)*a.y+Math.pow(n,2)*this.toPoint.y}}},{key:"_findBorderPosition",value:function(n,a){return this._findBorderPositionBezier(n,a,this.via)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){return this._getDistanceToBezierEdge(n,a,o,s,u,l,this.via)}}]),e}(gp);function Cde(i){var r=Ade();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Ade(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var d$=function(i){ue(e,i);var r=Cde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a,o){this._bezierCurve(n,a,o)}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_getViaCoordinates",value:function(){var n=this.options.smooth.roundness,a=this.options.smooth.type,o=Math.abs(this.from.x-this.to.x),s=Math.abs(this.from.y-this.to.y);if(a==="discrete"||a==="diagonalCross"){var u,l;o<=s?u=l=n*s:u=l=n*o,this.from.x>this.to.x&&(u=-u),this.from.y>=this.to.y&&(l=-l);var h=this.from.x+u,c=this.from.y+l;return a==="discrete"&&(o<=s?h=othis.to.x&&(R=-R),this.from.y>=this.to.y&&(P=-P);var B=this.from.x+R,j=this.from.y+P;return o<=s?this.from.x<=this.to.x?B=this.to.xB?this.to.x:B:this.from.y>=this.to.y?j=this.to.y>j?this.to.y:j:j=this.to.y2&&arguments[2]!==void 0?arguments[2]:{};return this._findBorderPositionBezier(n,a,o.via)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){var h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(n,a,o,s,u,l,h)}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),o=n,s=Math.pow(1-o,2)*this.fromPoint.x+2*o*(1-o)*a.x+Math.pow(o,2)*this.toPoint.x,u=Math.pow(1-o,2)*this.fromPoint.y+2*o*(1-o)*a.y+Math.pow(o,2)*this.toPoint.y;return{x:s,y:u}}}]),e}(gp);function Dde(i){var r=Rde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function Rde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Nde=function(i){ue(e,i);var r=Dde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_getDistanceToBezierEdge2",value:function(n,a,o,s,u,l,h,c){for(var d=1e9,f=n,v=a,p=[0,0,0,0],g=1;g<10;g++){var y=.1*g;p[0]=Math.pow(1-y,3),p[1]=3*y*Math.pow(1-y,2),p[2]=3*Math.pow(y,2)*(1-y),p[3]=Math.pow(y,3);var m=p[0]*n+p[1]*h.x+p[2]*c.x+p[3]*o,$=p[0]*a+p[1]*h.y+p[2]*c.y+p[3]*s;if(g>0){var b=this._getDistanceToLine(f,v,m,$,u,l);d=b"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var f$=function(i){ue(e,i);var r=Mde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a,o){var s=o[0],u=o[1];this._bezierCurve(n,a,s,u)}},{key:"_getViaCoordinates",value:function(){var n=this.from.x-this.to.x,a=this.from.y-this.to.y,o,s,u,l,h=this.options.smooth.roundness;return(Math.abs(n)>Math.abs(a)||this.options.smooth.forceDirection===!0||this.options.smooth.forceDirection==="horizontal")&&this.options.smooth.forceDirection!=="vertical"?(s=this.from.y,l=this.to.y,o=this.from.x-h*n,u=this.to.x+h*n):(s=this.from.y-h*a,l=this.to.y+h*a,o=this.from.x,u=this.to.x),[{x:o,y:s},{x:u,y:l}]}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_findBorderPosition",value:function(n,a){return this._findBorderPositionBezier(n,a)}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){var h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates(),c=Te(h,2),d=c[0],f=c[1];return this._getDistanceToBezierEdge2(n,a,o,s,u,l,d,f)}},{key:"getPoint",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),o=Te(a,2),s=o[0],u=o[1],l=n,h=[Math.pow(1-l,3),3*l*Math.pow(1-l,2),3*Math.pow(l,2)*(1-l),Math.pow(l,3)],c=h[0]*this.fromPoint.x+h[1]*s.x+h[2]*u.x+h[3]*this.toPoint.x,d=h[0]*this.fromPoint.y+h[1]*s.y+h[2]*u.y+h[3]*this.toPoint.y;return{x:c,y:d}}}]),e}(Nde);function Fde(i){var r=jde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function jde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var v$=function(i){ue(e,i);var r=Fde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_line",value:function(n,a){n.beginPath(),n.moveTo(this.fromPoint.x,this.fromPoint.y),n.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(n,a),n.stroke(),this.disableShadow(n,a)}},{key:"getViaNode",value:function(){}},{key:"getPoint",value:function(n){return{x:(1-n)*this.fromPoint.x+n*this.toPoint.x,y:(1-n)*this.fromPoint.y+n*this.toPoint.y}}},{key:"_findBorderPosition",value:function(n,a){var o=this.to,s=this.from;n.id===this.from.id&&(o=this.from,s=this.to);var u=Math.atan2(o.y-s.y,o.x-s.x),l=o.x-s.x,h=o.y-s.y,c=Math.sqrt(l*l+h*h),d=n.distanceToBorder(a,u),f=(c-d)/c;return{x:(1-f)*s.x+f*o.x,y:(1-f)*s.y+f*o.y,t:0}}},{key:"_getDistanceToEdge",value:function(n,a,o,s,u,l){return this._getDistanceToLine(n,a,o,s,u,l)}}]),e}(RT),qn=function(){function i(r,e,t,n,a){if(N(this,i),e===void 0)throw new Error("No body provided");this.options=di(n),this.globalOptions=n,this.defaultOptions=a,this.body=e,this.imagelist=t,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new IT(this.body,this.options,!0),this.setOptions(r)}return M(i,[{key:"setOptions",value:function(e){if(e){var t=typeof e.physics<"u"&&this.options.physics!==e.physics||typeof e.hidden<"u"&&(this.options.hidden||!1)!==(e.hidden||!1)||typeof e.from<"u"&&this.options.from!==e.from||typeof e.to<"u"&&this.options.to!==e.to;i.parseOptions(this.options,e,!0,this.globalOptions),e.id!==void 0&&(this.id=e.id),e.from!==void 0&&(this.fromId=e.from),e.to!==void 0&&(this.toId=e.to),e.title!==void 0&&(this.title=e.title),e.value!==void 0&&(e.value=ST(e.value));var n=[e,this.options,this.defaultOptions];return this.chooser=dp("edge",n),this.updateLabelModule(e),t=this.updateEdgeType()||t,this._setInteractionWidths(),this.connect(),t}}},{key:"getFormattingValues",value:function(){var e=this.options.arrows.to===!0||this.options.arrows.to.enabled===!0,t=this.options.arrows.from===!0||this.options.arrows.from.enabled===!0,n=this.options.arrows.middle===!0||this.options.arrows.middle.enabled===!0,a=this.options.color.inherit,o={toArrow:e,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,toArrowSrc:this.options.arrows.to.src,toArrowImageWidth:this.options.arrows.to.imageWidth,toArrowImageHeight:this.options.arrows.to.imageHeight,middleArrow:n,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,middleArrowSrc:this.options.arrows.middle.src,middleArrowImageWidth:this.options.arrows.middle.imageWidth,middleArrowImageHeight:this.options.arrows.middle.imageHeight,fromArrow:t,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,fromArrowSrc:this.options.arrows.from.src,fromArrowImageWidth:this.options.arrows.from.imageWidth,fromArrowImageHeight:this.options.arrows.from.imageHeight,arrowStrikethrough:this.options.arrowStrikethrough,color:a?void 0:this.options.color.color,inheritsColor:a,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width,background:this.options.background.enabled,backgroundColor:this.options.background.color,backgroundSize:this.options.background.size,backgroundDashes:this.options.background.dashes};if(this.selected||this.hover)if(this.chooser===!0){if(this.selected){var s=this.options.selectionWidth;typeof s=="function"?o.width=s(o.width):typeof s=="number"&&(o.width+=s),o.width=Math.max(o.width,.3/this.body.view.scale),o.color=this.options.color.highlight,o.shadow=this.options.shadow.enabled}else if(this.hover){var u=this.options.hoverWidth;typeof u=="function"?o.width=u(o.width):typeof u=="number"&&(o.width+=u),o.width=Math.max(o.width,.3/this.body.view.scale),o.color=this.options.color.hover,o.shadow=this.options.shadow.enabled}}else typeof this.chooser=="function"&&(this.chooser(o,this.options.id,this.selected,this.hover),o.color!==void 0&&(o.inheritsColor=!1),o.shadow===!1&&(o.shadowColor!==this.options.shadow.color||o.shadowSize!==this.options.shadow.size||o.shadowX!==this.options.shadow.x||o.shadowY!==this.options.shadow.y)&&(o.shadow=!0));else o.shadow=this.options.shadow.enabled,o.width=Math.max(o.width,.3/this.body.view.scale);return o}},{key:"updateLabelModule",value:function(e){var t=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,t),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}},{key:"updateEdgeType",value:function(){var e=this.options.smooth,t=!1,n=!0;return this.edgeType!==void 0&&((this.edgeType instanceof c$&&e.enabled===!0&&e.type==="dynamic"||this.edgeType instanceof f$&&e.enabled===!0&&e.type==="cubicBezier"||this.edgeType instanceof d$&&e.enabled===!0&&e.type!=="dynamic"&&e.type!=="cubicBezier"||this.edgeType instanceof v$&&e.type.enabled===!1)&&(n=!1),n===!0&&(t=this.cleanup())),n===!0?e.enabled===!0?e.type==="dynamic"?(t=!0,this.edgeType=new c$(this.options,this.body,this.labelModule)):e.type==="cubicBezier"?this.edgeType=new f$(this.options,this.body,this.labelModule):this.edgeType=new d$(this.options,this.body,this.labelModule):this.edgeType=new v$(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),t}},{key:"connect",value:function(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=this.from!==void 0&&this.to!==void 0,this.connected===!0?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}},{key:"disconnect",value:function(){this.from&&(this.from.detachEdge(this),this.from=void 0),this.to&&(this.to.detachEdge(this),this.to=void 0),this.connected=!1}},{key:"getTitle",value:function(){return this.title}},{key:"isSelected",value:function(){return this.selected}},{key:"getValue",value:function(){return this.options.value}},{key:"setValueRange",value:function(e,t,n){if(this.options.value!==void 0){var a=this.options.scaling.customScalingFunction(e,t,n,this.options.value),o=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){var s=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+a*s}this.options.width=this.options.scaling.min+a*o}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}},{key:"_setInteractionWidths",value:function(){typeof this.options.hoverWidth=="function"?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,typeof this.options.selectionWidth=="function"?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}},{key:"draw",value:function(e){var t=this.getFormattingValues();if(!t.hidden){var n=this.edgeType.getViaNode();this.edgeType.drawLine(e,t,this.selected,this.hover,n),this.drawLabel(e,n)}}},{key:"drawArrows",value:function(e){var t=this.getFormattingValues();if(!t.hidden){var n=this.edgeType.getViaNode(),a={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,t.fromArrow&&(a.from=this.edgeType.getArrowData(e,"from",n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.fromPoint=a.from.core),t.fromArrowSrc&&(a.from.image=this.imagelist.load(t.fromArrowSrc)),t.fromArrowImageWidth&&(a.from.imageWidth=t.fromArrowImageWidth),t.fromArrowImageHeight&&(a.from.imageHeight=t.fromArrowImageHeight)),t.toArrow&&(a.to=this.edgeType.getArrowData(e,"to",n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.toPoint=a.to.core),t.toArrowSrc&&(a.to.image=this.imagelist.load(t.toArrowSrc)),t.toArrowImageWidth&&(a.to.imageWidth=t.toArrowImageWidth),t.toArrowImageHeight&&(a.to.imageHeight=t.toArrowImageHeight)),t.middleArrow&&(a.middle=this.edgeType.getArrowData(e,"middle",n,this.selected,this.hover,t),t.middleArrowSrc&&(a.middle.image=this.imagelist.load(t.middleArrowSrc)),t.middleArrowImageWidth&&(a.middle.imageWidth=t.middleArrowImageWidth),t.middleArrowImageHeight&&(a.middle.imageHeight=t.middleArrowImageHeight)),t.fromArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.from),t.middleArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.middle),t.toArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,a.to)}}},{key:"drawLabel",value:function(e,t){if(this.options.label!==void 0){var n=this.from,a=this.to;this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover);var o;if(n.id!=a.id){this.labelModule.pointToSelf=!1,o=this.edgeType.getPoint(.5,t),e.save();var s=this._getRotation(e);s.angle!=0&&(e.translate(s.x,s.y),e.rotate(s.angle)),this.labelModule.draw(e,o.x,o.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;var u=OT(e,this.options.selfReference.angle,this.options.selfReference.size,n);o=this._pointOnCircle(u.x,u.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(e,o.x,o.y,this.selected,this.hover)}}}},{key:"getItemsOnPoint",value:function(e){var t=[];if(this.labelModule.visible()){var n=this._getRotation();Af(this.labelModule.getSize(),e,n)&&t.push({edgeId:this.id,labelId:0})}var a={left:e.x,top:e.y};return this.isOverlappingWith(a)&&t.push({edgeId:this.id}),t}},{key:"isOverlappingWith",value:function(e){if(this.connected){var t=10,n=this.from.x,a=this.from.y,o=this.to.x,s=this.to.y,u=e.left,l=e.top,h=this.edgeType.getDistanceToEdge(n,a,o,s,u,l);return h0&&s<0)&&(u+=Math.PI),a.angle=u,a}},{key:"_pointOnCircle",value:function(e,t,n,a){return{x:e+n*Math.cos(a),y:t-n*Math.sin(a)}}},{key:"select",value:function(){this.selected=!0}},{key:"unselect",value:function(){this.selected=!1}},{key:"cleanup",value:function(){return this.edgeType.cleanup()}},{key:"remove",value:function(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}},{key:"endPointsValid",value:function(){return this.body.nodes[this.fromId]!==void 0&&this.body.nodes[this.toId]!==void 0}}],[{key:"parseOptions",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,s=["endPointOffset","arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","selfReference","to","title","value","width","font","chosen","widthConstraint"];if(Ma(s,e,t,n),t.endPointOffset!==void 0&&t.endPointOffset.from!==void 0&&(Di(t.endPointOffset.from)?e.endPointOffset.from=t.endPointOffset.from:(e.endPointOffset.from=a.endPointOffset.from!==void 0?a.endPointOffset.from:0,console.error("endPointOffset.from is not a valid number"))),t.endPointOffset!==void 0&&t.endPointOffset.to!==void 0&&(Di(t.endPointOffset.to)?e.endPointOffset.to=t.endPointOffset.to:(e.endPointOffset.to=a.endPointOffset.to!==void 0?a.endPointOffset.to:0,console.error("endPointOffset.to is not a valid number"))),Zu(t.label)?e.label=t.label:Zu(e.label)||(e.label=void 0),Ut(e,t,"smooth",a),Ut(e,t,"shadow",a),Ut(e,t,"background",a),t.dashes!==void 0&&t.dashes!==null?e.dashes=t.dashes:n===!0&&t.dashes===null&&(e.dashes=zi(a.dashes)),t.scaling!==void 0&&t.scaling!==null?(t.scaling.min!==void 0&&(e.scaling.min=t.scaling.min),t.scaling.max!==void 0&&(e.scaling.max=t.scaling.max),Ut(e.scaling,t.scaling,"label",a.scaling)):n===!0&&t.scaling===null&&(e.scaling=zi(a.scaling)),t.arrows!==void 0&&t.arrows!==null)if(typeof t.arrows=="string"){var u=t.arrows.toLowerCase();e.arrows.to.enabled=ne(u).call(u,"to")!=-1,e.arrows.middle.enabled=ne(u).call(u,"middle")!=-1,e.arrows.from.enabled=ne(u).call(u,"from")!=-1}else if(de(t.arrows)==="object")Ut(e.arrows,t.arrows,"to",a.arrows),Ut(e.arrows,t.arrows,"middle",a.arrows),Ut(e.arrows,t.arrows,"from",a.arrows);else throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+ls(t.arrows));else n===!0&&t.arrows===null&&(e.arrows=zi(a.arrows));if(t.color!==void 0&&t.color!==null){var l=Kn(t.color)?{color:t.color,highlight:t.color,hover:t.color,inherit:!1,opacity:1}:t.color,h=e.color;if(o)pe(h,a.color,!1,n);else for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&delete h[c];if(Kn(h))h.color=h,h.highlight=h,h.hover=h,h.inherit=!1,l.opacity===void 0&&(h.opacity=1);else{var d=!1;l.color!==void 0&&(h.color=l.color,d=!0),l.highlight!==void 0&&(h.highlight=l.highlight,d=!0),l.hover!==void 0&&(h.hover=l.hover,d=!0),l.inherit!==void 0&&(h.inherit=l.inherit),l.opacity!==void 0&&(h.opacity=Math.min(1,Math.max(0,l.opacity))),d===!0?h.inherit=!1:h.inherit===void 0&&(h.inherit="from")}}else n===!0&&t.color===null&&(e.color=di(a.color));n===!0&&t.font===null&&(e.font=di(a.font)),Object.prototype.hasOwnProperty.call(t,"selfReferenceSize")&&(console.warn("The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}"),e.selfReference.size=t.selfReferenceSize)}}]),i}(),Lde=function(){function i(r,e,t){var n,a=this;N(this,i),this.body=r,this.images=e,this.groups=t,this.body.functions.createEdge=k(n=this.create).call(n,this),this.edgesListeners={add:function(s,u){a.add(u.items)},update:function(s,u){a.update(u.items)},remove:function(s,u){a.remove(u.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},endPointOffset:{from:0,to:0},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(s,u,l,h){if(u===s)return .5;var c=1/(u-s);return Math.max(0,(h-s)*c)}},selectionWidth:1.5,selfReference:{size:20,angle:Math.PI/4,renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},background:{enabled:!1,color:"rgba(111,111,111,1)",size:10,dashes:!1},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},pe(this.options,this.defaultOptions),this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this,t,n;this.body.emitter.on("_forceDisableDynamicCurves",function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a==="dynamic"&&(a="continuous");var s=!1;for(var u in e.body.edges)if(Object.prototype.hasOwnProperty.call(e.body.edges,u)){var l=e.body.edges[u],h=e.body.data.edges.get(u);if(h!=null){var c=h.smooth;c!==void 0&&c.enabled===!0&&c.type==="dynamic"&&(a===void 0?l.setOptions({smooth:!1}):l.setOptions({smooth:{type:a}}),s=!0)}}o===!0&&s===!0&&e.body.emitter.emit("_dataChanged")}),this.body.emitter.on("_dataUpdated",function(){e.reconnectEdges()}),this.body.emitter.on("refreshEdges",k(t=this.refresh).call(t,this)),this.body.emitter.on("refresh",k(n=this.refresh).call(n,this)),this.body.emitter.on("destroy",function(){te(e.edgesListeners,function(a,o){e.body.data.edges&&e.body.data.edges.off(o,a)}),delete e.body.functions.createEdge,delete e.edgesListeners.add,delete e.edgesListeners.update,delete e.edgesListeners.remove,delete e.edgesListeners})}},{key:"setOptions",value:function(e){if(e!==void 0){qn.parseOptions(this.options,e,!0,this.defaultOptions,!0);var t=!1;if(e.smooth!==void 0)for(var n in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,n)&&(t=this.body.edges[n].updateEdgeType()||t);if(e.font!==void 0)for(var a in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,a)&&this.body.edges[a].updateLabelModule();(e.hidden!==void 0||e.physics!==void 0||t===!0)&&this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.body.data.edges;if(IE("id",e))this.body.data.edges=e;else if(he(e))this.body.data.edges=new Lu,this.body.data.edges.add(e);else if(!e)this.body.data.edges=new Lu;else throw new TypeError("Array or DataSet expected");if(a&&te(this.edgesListeners,function(s,u){a.off(u,s)}),this.body.edges={},this.body.data.edges){te(this.edgesListeners,function(s,u){t.body.data.edges.on(u,s)});var o=this.body.data.edges.getIds();this.add(o,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),n===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.edges,a=this.body.data.edges,o=0;o1&&arguments[1]!==void 0?arguments[1]:!0;if(e.length!==0){var n=this.body.edges;te(e,function(a){var o=n[a];o!==void 0&&o.remove()}),t&&this.body.emitter.emit("_dataChanged")}}},{key:"refresh",value:function(){var e=this;te(this.body.edges,function(t,n){var a=e.body.data.edges.get(n);a!==void 0&&t.setOptions(a)})}},{key:"create",value:function(e){return new qn(e,this.body,this.images,this.options,this.defaultOptions)}},{key:"reconnectEdges",value:function(){var e,t=this.body.nodes,n=this.body.edges;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e].edges=[]);for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)){var a=n[e];a.from=null,a.to=null,a.connect()}}},{key:"getConnectedNodes",value:function(e){var t=[];if(this.body.edges[e]!==void 0){var n=this.body.edges[e];n.fromId!==void 0&&t.push(n.fromId),n.toId!==void 0&&t.push(n.toId)}return t}},{key:"_updateState",value:function(){this._addMissingEdges(),this._removeInvalidEdges()}},{key:"_removeInvalidEdges",value:function(){var e=this,t=[];te(this.body.edges,function(n,a){var o=e.body.nodes[n.toId],s=e.body.nodes[n.fromId];o!==void 0&&o.isCluster===!0||s!==void 0&&s.isCluster===!0||(o===void 0||s===void 0)&&t.push(a)}),this.remove(t,!1)}},{key:"_addMissingEdges",value:function(){var e=this.body.data.edges;if(e!=null){var t=this.body.edges,n=[];fe(e).call(e,function(a,o){var s=t[o];s===void 0&&n.push(o)}),this.add(n,!0)}}}]),i}(),NT=function(){function i(r,e,t){N(this,i),this.body=r,this.physicsBody=e,this.barnesHutTree,this.setOptions(t),this._rng=Ql("BARNES HUT SOLVER")}return M(i,[{key:"setOptions",value:function(e){this.options=e,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}},{key:"solve",value:function(){if(this.options.gravitationalConstant!==0&&this.physicsBody.physicsNodeIndices.length>0){var e,t=this.body.nodes,n=this.physicsBody.physicsNodeIndices,a=n.length,o=this._formBarnesHutTree(t,n);this.barnesHutTree=o;for(var s=0;s0&&this._getForceContributions(o.root,e)}}},{key:"_getForceContributions",value:function(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}},{key:"_getForceContribution",value:function(e,t){if(e.childrenCount>0){var n=e.centerOfMass.x-t.x,a=e.centerOfMass.y-t.y,o=Math.sqrt(n*n+a*a);o*e.calcSize>this.thetaInversed?this._calculateForces(o,n,a,t,e):e.childrenCount===4?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(o,n,a,t,e)}}},{key:"_calculateForces",value:function(e,t,n,a,o){e===0&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&a.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*a.shape.radius,e-a.shape.radius));var s=this.options.gravitationalConstant*o.mass*a.options.mass/Math.pow(e,3),u=t*s,l=n*s;this.physicsBody.forces[a.id].x+=u,this.physicsBody.forces[a.id].y+=l}},{key:"_formBarnesHutTree",value:function(e,t){for(var n,a=t.length,o=e[t[0]].x,s=e[t[0]].y,u=e[t[0]].x,l=e[t[0]].y,h=1;h0&&(du&&(u=d),fl&&(l=f))}var v=Math.abs(u-o)-Math.abs(l-s);v>0?(s-=.5*v,l+=.5*v):(o+=.5*v,u-=.5*v);var p=1e-5,g=Math.max(p,Math.abs(u-o)),y=.5*g,m=.5*(o+u),$=.5*(s+l),b={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:m-y,maxX:m+y,minY:$-y,maxY:$+y},size:g,calcSize:1/g,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(b.root);for(var O=0;O0&&this._placeInTree(b.root,n);return b}},{key:"_updateBranchMass",value:function(e,t){var n=e.centerOfMass,a=e.mass+t.options.mass,o=1/a;n.x=n.x*e.mass+t.x*t.options.mass,n.x*=o,n.y=n.y*e.mass+t.y*t.options.mass,n.y*=o,e.mass=a;var s=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidtht.x?a.maxY>t.y?o="NW":o="SW":a.maxY>t.y?o="NE":o="SE",this._placeInRegion(e,t,o)}},{key:"_placeInRegion",value:function(e,t,n){var a=e.children[n];switch(a.childrenCount){case 0:a.children.data=t,a.childrenCount=1,this._updateBranchMass(a,t);break;case 1:a.children.data.x===t.x&&a.children.data.y===t.y?(t.x+=this._rng(),t.y+=this._rng()):(this._splitBranch(a),this._placeInTree(a,t));break;case 4:this._placeInTree(a,t);break}}},{key:"_splitBranch",value:function(e){var t=null;e.childrenCount===1&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),t!=null&&this._placeInTree(e,t)}},{key:"_insertRegion",value:function(e,t){var n,a,o,s,u=.5*e.size;switch(t){case"NW":n=e.range.minX,a=e.range.minX+u,o=e.range.minY,s=e.range.minY+u;break;case"NE":n=e.range.minX+u,a=e.range.maxX,o=e.range.minY,s=e.range.minY+u;break;case"SW":n=e.range.minX,a=e.range.minX+u,o=e.range.minY+u,s=e.range.maxY;break;case"SE":n=e.range.minX+u,a=e.range.maxX,o=e.range.minY+u,s=e.range.maxY;break}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:n,maxX:a,minY:o,maxY:s},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}},{key:"_debug",value:function(e,t){this.barnesHutTree!==void 0&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}},{key:"_drawBranch",value:function(e,t,n){n===void 0&&(n="#FF0000"),e.childrenCount===4&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=n,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}]),i}(),zde=function(){function i(r,e,t){N(this,i),this._rng=Ql("REPULSION SOLVER"),this.body=r,this.physicsBody=e,this.setOptions(t)}return M(i,[{key:"setOptions",value:function(e){this.options=e}},{key:"solve",value:function(){for(var e,t,n,a,o,s,u,l,h=this.body.nodes,c=this.physicsBody.physicsNodeIndices,d=this.physicsBody.forces,f=this.options.nodeDistance,v=-2/3/f,p=4/3,g=0;g"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Kde=function(i){ue(e,i);var r=Wde(e);function e(t,n,a){var o;return N(this,e),o=r.call(this,t,n,a),o._rng=Ql("FORCE ATLAS 2 BASED REPULSION SOLVER"),o}return M(e,[{key:"_calculateForces",value:function(n,a,o,s,u){n===0&&(n=.1*this._rng(),a=n),this.overlapAvoidanceFactor<1&&s.shape.radius&&(n=Math.max(.1+this.overlapAvoidanceFactor*s.shape.radius,n-s.shape.radius));var l=s.edges.length+1,h=this.options.gravitationalConstant*u.mass*s.options.mass*l/Math.pow(n,2),c=a*h,d=o*h;this.physicsBody.forces[s.id].x+=c,this.physicsBody.forces[s.id].y+=d}}]),e}(NT);function Gde(i){var r=qde();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function qde(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var Yde=function(i){ue(e,i);var r=Gde(e);function e(t,n,a){return N(this,e),r.call(this,t,n,a)}return M(e,[{key:"_calculateForces",value:function(n,a,o,s,u){if(n>0){var l=u.edges.length+1,h=this.options.centralGravity*l*u.options.mass;s[u.id].x=a*h,s[u.id].y=o*h}}}]),e}(Eu),Xde=function(){function i(r){N(this,i),this.body=r,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},Le(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("initPhysics",function(){e.initPhysics()}),this.body.emitter.on("_layoutFailed",function(){e.layoutFailed=!0}),this.body.emitter.on("resetPhysics",function(){e.stopSimulation(),e.ready=!1}),this.body.emitter.on("disablePhysics",function(){e.physicsEnabled=!1,e.stopSimulation()}),this.body.emitter.on("restorePhysics",function(){e.setOptions(e.options),e.ready===!0&&e.startSimulation()}),this.body.emitter.on("startSimulation",function(){e.ready===!0&&e.startSimulation()}),this.body.emitter.on("stopSimulation",function(){e.stopSimulation()}),this.body.emitter.on("destroy",function(){e.stopSimulation(!1),e.body.emitter.off()}),this.body.emitter.on("_dataChanged",function(){e.updatePhysicsData()})}},{key:"setOptions",value:function(e){if(e!==void 0)if(e===!1)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(e===!0)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,Yu(["stabilization"],this.options,e),Ut(this.options,e,"stabilization"),e.enabled===void 0&&(this.options.enabled=!0),this.options.enabled===!1&&(this.physicsEnabled=!1,this.stopSimulation());var t=this.options.wind;t&&((typeof t.x!="number"||Cf(t.x))&&(t.x=0),(typeof t.y!="number"||Cf(t.y))&&(t.y=0)),this.timestep=this.options.timestep}this.init()}},{key:"init",value:function(){var e;this.options.solver==="forceAtlas2Based"?(e=this.options.forceAtlas2Based,this.nodesSolver=new Kde(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Yde(this.body,this.physicsBody,e)):this.options.solver==="repulsion"?(e=this.options.repulsion,this.nodesSolver=new zde(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)):this.options.solver==="hierarchicalRepulsion"?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new Hde(this.body,this.physicsBody,e),this.edgesSolver=new Vde(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new NT(this.body,this.physicsBody,e),this.edgesSolver=new fd(this.body,this.physicsBody,e),this.gravitySolver=new Eu(this.body,this.physicsBody,e)),this.modelOptions=e}},{key:"initPhysics",value:function(){this.physicsEnabled===!0&&this.options.enabled===!0?this.options.stabilization.enabled===!0?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}},{key:"startSimulation",value:function(){if(this.physicsEnabled===!0&&this.options.enabled===!0){if(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),this.viewFunction===void 0){var e;this.viewFunction=k(e=this.simulationStep).call(e,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}else this.body.emitter.emit("_redraw")}},{key:"stopSimulation",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.stabilized=!0,e===!0&&this._emitStabilized(),this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,e===!0&&this.body.emitter.emit("_stopRendering"))}},{key:"simulationStep",value:function(){var e=Uu();this.physicsTick();var t=Uu()-e;(t<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}},{key:"_emitStabilized",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&mr(function(){e.body.emitter.emit("stabilized",{iterations:t}),e.startedStabilization=!1,e.stabilizationIterations=0},0)}},{key:"physicsStep",value:function(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}},{key:"adjustTimeStep",value:function(){var e=1.2;this._evaluateStepQuality()===!0?this.timestep=e*this.timestep:this.timestep/es))return!1;return!0}},{key:"moveNodes",value:function(){for(var e=this.physicsBody.physicsNodeIndices,t=0,n=0,a=5,o=0;os&&(e=e>0?s:-s),e}},{key:"_performStep",value:function(e){var t=this.body.nodes[e],n=this.physicsBody.forces[e];this.options.wind&&(n.x+=this.options.wind.x,n.y+=this.options.wind.y);var a=this.physicsBody.velocities[e];this.previousStates[e]={x:t.x,y:t.y,vx:a.x,vy:a.y},t.options.fixed.x===!1?(a.x=this.calculateComponentVelocity(a.x,n.x,t.options.mass),t.x+=a.x*this.timestep):(n.x=0,a.x=0),t.options.fixed.y===!1?(a.y=this.calculateComponentVelocity(a.y,n.y,t.options.mass),t.y+=a.y*this.timestep):(n.y=0,a.y=0);var o=Math.sqrt(Math.pow(a.x,2)+Math.pow(a.y,2));return o}},{key:"_freezeNodes",value:function(){var e=this.body.nodes;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].x&&e[t].y){var n=e[t].options.fixed;this.freezeCache[t]={x:n.x,y:n.y},n.x=!0,n.y=!0}}},{key:"_restoreFrozenNodes",value:function(){var e=this.body.nodes;for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.freezeCache[t]!==void 0&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}},{key:"stabilize",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.stabilization.iterations;if(typeof t!="number"&&(t=this.options.stabilization.iterations,console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ",t)),this.physicsBody.physicsNodeIndices.length===0){this.ready=!0;return}this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=t,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,mr(function(){return e._stabilizationBatch()},0)}},{key:"_startStabilizing",value:function(){return this.startedStabilization===!0?!1:(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}},{key:"_stabilizationBatch",value:function(){var e=this,t=function(){return e.stabilized===!1&&e.stabilizationIterations1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,a=-1e9,o=1e9,s=-1e9,u;if(t.length>0)for(var l=0;lu.shape.boundingBox.left&&(o=u.shape.boundingBox.left),su.shape.boundingBox.top&&(n=u.shape.boundingBox.top),a1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,a=-1e9,o=1e9,s=-1e9,u;if(t.length>0)for(var l=0;lu.x&&(o=u.x),su.y&&(n=u.y),a"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var ife=function(i){ue(e,i);var r=tfe(e);function e(t,n,a,o,s,u){var l;return N(this,e),l=r.call(this,t,n,a,o,s,u),l.isCluster=!0,l.containedNodes={},l.containedEdges={},l}return M(e,[{key:"_openChildCluster",value:function(n){var a=this,o=this.body.nodes[n];if(this.containedNodes[n]===void 0)throw new Error("node with id: "+n+" not in current cluster");if(!o.isCluster)throw new Error("node with id: "+n+" is not a cluster");delete this.containedNodes[n],te(o.edges,function(s){delete a.containedEdges[s.id]}),te(o.containedNodes,function(s,u){a.containedNodes[u]=s}),o.containedNodes={},te(o.containedEdges,function(s,u){a.containedEdges[u]=s}),o.containedEdges={},te(o.edges,function(s){te(a.edges,function(u){var l,h,c=ne(l=u.clusteringEdgeReplacingIds).call(l,s.id);c!==-1&&(te(s.clusteringEdgeReplacingIds,function(d){u.clusteringEdgeReplacingIds.push(d),a.body.edges[d].edgeReplacedById=u.id}),Ar(h=u.clusteringEdgeReplacingIds).call(h,c,1))})}),o.edges=[]}}]),e}(Nt),nfe=function(){function i(r){var e=this;N(this,i),this.body=r,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},Le(this.options,this.defaultOptions),this.body.emitter.on("_resetData",function(){e.clusteredNodes={},e.clusteredEdges={}})}return M(i,[{key:"clusterByHubsize",value:function(e,t){e===void 0?e=this._getHubSize():de(e)==="object"&&(t=this._checkOptions(e),e=this._getHubSize());for(var n=[],a=0;a=e&&n.push(o.id)}for(var s=0;s0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.joinCondition===void 0)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");t=this._checkOptions(t);var a={},o={};te(this.body.nodes,function(s,u){s.options&&t.joinCondition(s.options)===!0&&(a[u]=s,te(s.edges,function(l){e.clusteredEdges[l.id]===void 0&&(o[l.id]=l)}))}),this._cluster(a,o,t,n)}},{key:"clusterByEdgeCount",value:function(e,t){var n=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;t=this._checkOptions(t);for(var o=[],s={},u,l,h,c=function(){var p={},g={},y=n.body.nodeIndices[d],m=n.body.nodes[y];if(s[y]===void 0){h=0,l=[];for(var $=0;$0&&Oe(g).length>0&&O===!0){var R=function(){for(var U=0;U1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(1,e,t)}},{key:"clusterBridges",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(2,e,t)}},{key:"clusterByConnection",value:function(e,t){var n,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No nodeId supplied to clusterByConnection!");if(this.body.nodes[e]===void 0)throw new Error("The nodeId given to clusterByConnection does not exist!");var o=this.body.nodes[e];t=this._checkOptions(t,o),t.clusterNodeProperties.x===void 0&&(t.clusterNodeProperties.x=o.x),t.clusterNodeProperties.y===void 0&&(t.clusterNodeProperties.y=o.y),t.clusterNodeProperties.fixed===void 0&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=o.options.fixed.x,t.clusterNodeProperties.fixed.y=o.options.fixed.y);var s={},u={},l=o.id,h=pt.cloneOptions(o);s[l]=o;for(var c=0;c-1&&(u[$.id]=$)}this._cluster(s,u,t,a)}},{key:"_createClusterEdges",value:function(e,t,n,a){for(var o,s,u,l,h,c,d=Oe(e),f=[],v=0;v0&&arguments[0]!==void 0?arguments[0]:{};return e.clusterEdgeProperties===void 0&&(e.clusterEdgeProperties={}),e.clusterNodeProperties===void 0&&(e.clusterNodeProperties={}),e}},{key:"_cluster",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&this.clusteredNodes[s]!==void 0&&o.push(s);for(var u=0;ua?u.x:a,o=u.ys?u.y:s;return{x:.5*(n+a),y:.5*(o+s)}}},{key:"openCluster",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No clusterNodeId supplied to openCluster.");var a=this.body.nodes[e];if(a===void 0)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(a.isCluster!==!0||a.containedNodes===void 0||a.containedEdges===void 0)throw new Error("The node:"+e+" is not a valid cluster.");var o=this.findNode(e),s=ne(o).call(o,e)-1;if(s>=0){var u=o[s],l=this.body.nodes[u];l._openChildCluster(e),delete this.body.nodes[e],n===!0&&this.body.emitter.emit("_dataChanged");return}var h=a.containedNodes,c=a.containedEdges;if(t!==void 0&&t.releaseFunction!==void 0&&typeof t.releaseFunction=="function"){var d={},f={x:a.x,y:a.y};for(var v in h)if(Object.prototype.hasOwnProperty.call(h,v)){var p=this.body.nodes[v];d[v]={x:p.x,y:p.y}}var g=t.releaseFunction(f,d);for(var y in h)if(Object.prototype.hasOwnProperty.call(h,y)){var m=this.body.nodes[y];g[y]!==void 0&&(m.x=g[y].x===void 0?a.x:g[y].x,m.y=g[y].y===void 0?a.y:g[y].y)}}else te(h,function(ht){ht.options.fixed.x===!1&&(ht.x=a.x),ht.options.fixed.y===!1&&(ht.y=a.y)});for(var $ in h)if(Object.prototype.hasOwnProperty.call(h,$)){var b=this.body.nodes[$];b.vx=a.vx,b.vy=a.vy,b.setOptions({physics:!0}),delete this.clusteredNodes[$]}for(var O=[],_=0;_0&&sa&&(a=s.edges.length),e+=s.edges.length,t+=Math.pow(s.edges.length,2),n+=1}e=e/n,t=t/n;var u=t-Math.pow(e,2),l=Math.sqrt(u),h=Math.floor(e+2*l);return h>a&&(h=a),h}},{key:"_createClusteredEdge",value:function(e,t,n,a,o){var s=pt.cloneOptions(n,"edge");pe(s,a),s.from=e,s.to=t,s.id="clusterEdge:"+no(),o!==void 0&&pe(s,o);var u=this.body.functions.createEdge(s);return u.clusteringEdgeReplacingIds=[n.id],u.connect(),this.body.edges[u.id]=u,u}},{key:"_clusterEdges",value:function(e,t,n,a){if(t instanceof qn){var o=t,s={};s[o.id]=o,t=s}if(e instanceof Nt){var u=e,l={};l[u.id]=u,e=l}if(n==null)throw new Error("_clusterEdges: parameter clusterNode required");a===void 0&&(a=n.clusterEdgeProperties),this._createClusterEdges(e,t,n,a);for(var h in t)if(Object.prototype.hasOwnProperty.call(t,h)&&this.body.edges[h]!==void 0){var c=this.body.edges[h];this._backupEdgeOptions(c),c.setOptions({physics:!1})}for(var d in e)Object.prototype.hasOwnProperty.call(e,d)&&(this.clusteredNodes[d]={clusterId:n.id,node:this.body.nodes[d]},this.body.nodes[d].setOptions({physics:!1}))}},{key:"_getClusterNodeForNode",value:function(e){if(e!==void 0){var t=this.clusteredNodes[e];if(t!==void 0){var n=t.clusterId;if(n!==void 0)return this.body.nodes[n]}}}},{key:"_filter",value:function(e,t){var n=[];return te(e,function(a){t(a)&&n.push(a)}),n}},{key:"_updateState",value:function(){var e=this,t,n=[],a={},o=function(v){te(e.body.nodes,function(p){p.isCluster===!0&&v(p)})};for(t in this.clusteredNodes)if(Object.prototype.hasOwnProperty.call(this.clusteredNodes,t)){var s=this.body.nodes[t];s===void 0&&n.push(t)}o(function(f){for(var v=0;v0}(!f.endPointsValid()||!p)&&(a[v]=v)}),o(function(f){te(a,function(v){delete f.containedEdges[v],te(f.edges,function(p,g){if(p.id===v){f.edges[g]=null;return}p.clusteringEdgeReplacingIds=e._filter(p.clusteringEdgeReplacingIds,function(y){return!a[y]})}),f.edges=e._filter(f.edges,function(p){return p!==null})})}),te(a,function(f){delete e.clusteredEdges[f]}),te(a,function(f){delete e.body.edges[f]});var l=Oe(this.body.edges);te(l,function(f){var v=e.body.edges[f],p=e._isClusteredNode(v.fromId)||e._isClusteredNode(v.toId);if(p!==e._isClusteredEdge(v.id))if(p){var g=e._getClusterNodeForNode(v.fromId);g!==void 0&&e._clusterEdges(e.body.nodes[v.fromId],v,g);var y=e._getClusterNodeForNode(v.toId);y!==void 0&&e._clusterEdges(e.body.nodes[v.toId],v,y)}else delete e._clusterEdges[f],e._restoreEdge(v)});for(var h=!1,c=!0,d=function(){var v=[];o(function(g){var y=Oe(g.containedNodes).length,m=g.options.allowSingleNodeCluster===!0;(m&&y<1||!m&&y<2)&&v.push(g.id)});for(var p=0;p0,h=h||c};c;)d();h&&this._updateState()}},{key:"_isClusteredNode",value:function(e){return this.clusteredNodes[e]!==void 0}},{key:"_isClusteredEdge",value:function(e){return this.clusteredEdges[e]!==void 0}}]),i}();function afe(){var i;window!==void 0&&(i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame),i===void 0?window.requestAnimationFrame=function(r){r()}:window.requestAnimationFrame=i}var ofe=function(){function i(r,e){N(this,i),afe(),this.body=r,this.canvas=e,this.redrawRequested=!1,this.renderTimer=void 0,this.requiresTimeout=!0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},Le(this.options,this.defaultOptions),this._determineBrowserMethod(),this.bindEventListeners()}return M(i,[{key:"bindEventListeners",value:function(){var e=this,t;this.body.emitter.on("dragStart",function(){e.dragging=!0}),this.body.emitter.on("dragEnd",function(){e.dragging=!1}),this.body.emitter.on("zoom",function(){e.zooming=!0,window.clearTimeout(e.zoomTimeoutId),e.zoomTimeoutId=mr(function(){var n;e.zooming=!1,k(n=e._requestRedraw).call(n,e)()},250)}),this.body.emitter.on("_resizeNodes",function(){e._resizeNodes()}),this.body.emitter.on("_redraw",function(){e.renderingActive===!1&&e._redraw()}),this.body.emitter.on("_blockRedraw",function(){e.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",function(){e.allowRedraw=!0,e.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",k(t=this._requestRedraw).call(t,this)),this.body.emitter.on("_startRendering",function(){e.renderRequests+=1,e.renderingActive=!0,e._startRendering()}),this.body.emitter.on("_stopRendering",function(){e.renderRequests-=1,e.renderingActive=e.renderRequests>0,e.renderTimer=void 0}),this.body.emitter.on("destroy",function(){e.renderRequests=0,e.allowRedraw=!1,e.renderingActive=!1,e.requiresTimeout===!0?clearTimeout(e.renderTimer):window.cancelAnimationFrame(e.renderTimer),e.body.emitter.off()})}},{key:"setOptions",value:function(e){if(e!==void 0){var t=["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"];Ma(t,this.options,e)}}},{key:"_requestNextFrame",value:function(e,t){if(!(typeof window>"u")){var n,a=window;return this.requiresTimeout===!0?n=mr(e,t):a.requestAnimationFrame&&(n=a.requestAnimationFrame(e)),n}}},{key:"_startRendering",value:function(){if(this.renderingActive===!0&&this.renderTimer===void 0){var e;this.renderTimer=this._requestNextFrame(k(e=this._renderStep).call(e,this),this.simulationInterval)}}},{key:"_renderStep",value:function(){this.renderingActive===!0&&(this.renderTimer=void 0,this.requiresTimeout===!0&&this._startRendering(),this._redraw(),this.requiresTimeout===!1&&this._startRendering())}},{key:"redraw",value:function(){this.body.emitter.emit("setSize"),this._redraw()}},{key:"_requestRedraw",value:function(){var e=this;this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,this._requestNextFrame(function(){e._redraw(!1)},0))}},{key:"_redraw",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(this.allowRedraw===!0){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;var t={drawExternalLabels:null};(this.canvas.frame.canvas.width===0||this.canvas.frame.canvas.height===0)&&this.canvas.setSize(),this.canvas.setTransform();var n=this.canvas.getContext(),a=this.canvas.frame.canvas.clientWidth,o=this.canvas.frame.canvas.clientHeight;if(n.clearRect(0,0,a,o),this.canvas.frame.clientWidth===0)return;if(n.save(),n.translate(this.body.view.translation.x,this.body.view.translation.y),n.scale(this.body.view.scale,this.body.view.scale),n.beginPath(),this.body.emitter.emit("beforeDrawing",n),n.closePath(),e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawEdges(n),this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1){var s=this._drawNodes(n,e),u=s.drawExternalLabels;t.drawExternalLabels=u}e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawArrows(n),t.drawExternalLabels!=null&&t.drawExternalLabels(),e===!1&&this._drawSelectionBox(n),n.beginPath(),this.body.emitter.emit("afterDrawing",n),n.closePath(),n.restore(),e===!0&&n.clearRect(0,0,a,o)}}},{key:"_resizeNodes",value:function(){this.canvas.setTransform();var e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);var t=this.body.nodes,n;for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n=t[a],n.resize(e),n.updateBoundingBox(e,n.selected));e.restore()}},{key:"_drawNodes",value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.nodes,a=this.body.nodeIndices,o,s=[],u=[],l=20,h=this.canvas.DOMtoCanvas({x:-20,y:-20}),c=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+l,y:this.canvas.frame.canvas.clientHeight+l}),d={top:h.y,left:h.x,bottom:c.y,right:c.x},f=[],v=0;v0&&arguments[0]!==void 0?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}},{key:"_setCameraState",value:function(){if(this.cameraState.scale!==void 0&&this.frame.canvas.clientWidth!==0&&this.frame.canvas.clientHeight!==0&&this.pixelRatio!==0&&this.cameraState.previousWidth>0&&this.cameraState.previousHeight>0){var e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight,n=this.cameraState.scale;e!=1&&t!=1?n=this.cameraState.scale*.5*(e+t):e!=1?n=this.cameraState.scale*e:t!=1&&(n=this.cameraState.scale*t),this.body.view.scale=n;var a=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),o={x:a.x-this.cameraState.position.x,y:a.y-this.cameraState.position.y};this.body.view.translation.x+=o.x*this.body.view.scale,this.body.view.translation.y+=o.y*this.body.view.scale}}},{key:"_prepareValue",value:function(e){if(typeof e=="number")return e+"px";if(typeof e=="string"){if(ne(e).call(e,"%")!==-1||ne(e).call(e,"px")!==-1)return e;if(ne(e).call(e,"%")===-1)return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}},{key:"_create",value:function(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=0,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{var e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerText="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}},{key:"_bindHammer",value:function(){var e=this;this.hammer!==void 0&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new Gn(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:Gn.DIRECTION_ALL}),Qu(this.hammer,function(t){e.body.eventListeners.onTouch(t)}),this.hammer.on("tap",function(t){e.body.eventListeners.onTap(t)}),this.hammer.on("doubletap",function(t){e.body.eventListeners.onDoubleTap(t)}),this.hammer.on("press",function(t){e.body.eventListeners.onHold(t)}),this.hammer.on("panstart",function(t){e.body.eventListeners.onDragStart(t)}),this.hammer.on("panmove",function(t){e.body.eventListeners.onDrag(t)}),this.hammer.on("panend",function(t){e.body.eventListeners.onDragEnd(t)}),this.hammer.on("pinch",function(t){e.body.eventListeners.onPinch(t)}),this.frame.canvas.addEventListener("wheel",function(t){e.body.eventListeners.onMouseWheel(t)}),this.frame.canvas.addEventListener("mousemove",function(t){e.body.eventListeners.onMouseMove(t)}),this.frame.canvas.addEventListener("contextmenu",function(t){e.body.eventListeners.onContext(t)}),this.hammerFrame=new Gn(this.frame),MT(this.hammerFrame,function(t){e.body.eventListeners.onRelease(t)})}},{key:"setSize",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.width,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);var n=!1,a=this.frame.canvas.width,o=this.frame.canvas.height,s=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(s),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},n=!0;else{var u=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),l=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);(this.frame.canvas.width!==u||this.frame.canvas.height!==l)&&this._getCameraState(s),this.frame.canvas.width!==u&&(this.frame.canvas.width=u,n=!0),this.frame.canvas.height!==l&&(this.frame.canvas.height=l,n=!0)}return n===!0&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(a/this.pixelRatio),oldHeight:Math.round(o/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,n}},{key:"getContext",value:function(){return this.frame.canvas.getContext("2d")}},{key:"_determinePixelRatio",value:function(){var e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");var t=1;typeof window<"u"&&(t=window.devicePixelRatio||1);var n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return t/n}},{key:"_setPixelRatio",value:function(){this.pixelRatio=this._determinePixelRatio()}},{key:"setTransform",value:function(){var e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}},{key:"_XconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.x)/this.body.view.scale}},{key:"_XconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.x}},{key:"_YconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.y)/this.body.view.scale}},{key:"_YconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.y}},{key:"canvasToDOM",value:function(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}},{key:"DOMtoCanvas",value:function(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}]),i}();function dfe(i,r){var e=Le({nodes:r,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},i??{});if(!he(e.nodes))throw new TypeError("Nodes has to be an array of ids.");if(e.nodes.length===0&&(e.nodes=r),!(typeof e.minZoomLevel=="number"&&e.minZoomLevel>0))throw new TypeError("Min zoom level has to be a number higher than zero.");if(!(typeof e.maxZoomLevel=="number"&&e.minZoomLevel<=e.maxZoomLevel))throw new TypeError("Max zoom level has to be a number higher than min zoom level.");return e}var ffe=function(){function i(r,e){var t,n=this,a;N(this,i),this.body=r,this.canvas=e,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",k(t=this.fit).call(t,this)),this.body.emitter.on("animationFinished",function(){n.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",k(a=this.releaseNode).call(a,this))}return M(i,[{key:"setOptions",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=e}},{key:"fit",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e=dfe(e,this.body.nodeIndices);var n=this.canvas.frame.canvas.clientWidth,a=this.canvas.frame.canvas.clientHeight,o,s;if(n===0||a===0)s=1,o=pt.getRange(this.body.nodes,e.nodes);else if(t===!0){var u=0;for(var l in this.body.nodes)if(Object.prototype.hasOwnProperty.call(this.body.nodes,l)){var h=this.body.nodes[l];h.predefinedPosition===!0&&(u+=1)}if(u>.5*this.body.nodeIndices.length){this.fit(e,!1);return}o=pt.getRange(this.body.nodes,e.nodes);var c=this.body.nodeIndices.length;s=12.662/(c+7.4147)+.0964822;var d=Math.min(n/600,a/600);s*=d}else{this.body.emitter.emit("_resizeNodes"),o=pt.getRange(this.body.nodes,e.nodes);var f=Math.abs(o.maxX-o.minX)*1.1,v=Math.abs(o.maxY-o.minY)*1.1,p=n/f,g=a/v;s=p<=g?p:g}s>e.maxZoomLevel?s=e.maxZoomLevel:s1&&arguments[1]!==void 0?arguments[1]:{};if(this.body.nodes[e]!==void 0){var n={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=n,t.lockedOnNode=e,this.moveTo(t)}else console.error("Node: "+e+" cannot be found.")}},{key:"moveTo",value:function(e){if(e===void 0){e={};return}if(e.offset!=null){if(e.offset.x!=null){if(e.offset.x=+e.offset.x,!Di(e.offset.x))throw new TypeError('The option "offset.x" has to be a finite number.')}else e.offset.x=0;if(e.offset.y!=null){if(e.offset.y=+e.offset.y,!Di(e.offset.y))throw new TypeError('The option "offset.y" has to be a finite number.')}else e.offset.x=0}else e.offset={x:0,y:0};if(e.position!=null){if(e.position.x!=null){if(e.position.x=+e.position.x,!Di(e.position.x))throw new TypeError('The option "position.x" has to be a finite number.')}else e.position.x=0;if(e.position.y!=null){if(e.position.y=+e.position.y,!Di(e.position.y))throw new TypeError('The option "position.y" has to be a finite number.')}else e.position.x=0}else e.position=this.getViewPosition();if(e.scale!=null){if(e.scale=+e.scale,!(e.scale>0))throw new TypeError('The option "scale" has to be a number greater than zero.')}else e.scale=this.body.view.scale;e.animation===void 0&&(e.animation={duration:0}),e.animation===!1&&(e.animation={duration:0}),e.animation===!0&&(e.animation={}),e.animation.duration===void 0&&(e.animation.duration=1e3),e.animation.easingFunction===void 0&&(e.animation.easingFunction="easeInOutQuad"),this.animateView(e)}},{key:"animateView",value:function(e){if(e!==void 0){this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),e.locked===!0&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),this.easingTime!=0&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;var t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.position.x,y:t.y-e.position.y};if(this.targetTranslation={x:this.sourceTranslation.x+n.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+n.y*this.targetScale+e.offset.y},e.animation.duration===0)if(this.lockedOnNodeId!=null){var a;this.viewFunction=k(a=this._lockedRedraw).call(a,this),this.body.emitter.on("initRedraw",this.viewFunction)}else this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw");else{var o;this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=k(o=this._transitionRedraw).call(o,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}}},{key:"_lockedRedraw",value:function(){var e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.x,y:t.y-e.y},a=this.body.view.translation,o={x:a.x+n.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:a.y+n.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=o}},{key:"releaseNode",value:function(){this.lockedOnNodeId!==void 0&&this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}},{key:"_transitionRedraw",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.easingTime+=this.animationSpeed,this.easingTime=e===!0?1:this.easingTime;var t=Xae[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1){if(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,this.lockedOnNodeId!=null){var n;this.viewFunction=k(n=this._lockedRedraw).call(n,this),this.body.emitter.on("initRedraw",this.viewFunction)}this.body.emitter.emit("animationFinished")}}},{key:"getScale",value:function(){return this.body.view.scale}},{key:"getViewPosition",value:function(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}]),i}();function g$(i){var r=i&&i.preventDefault||!1,e=i&&i.container||window,t={},n={keydown:{},keyup:{}},a={},o;for(o=97;o<=122;o++)a[String.fromCharCode(o)]={code:65+(o-97),shift:!1};for(o=65;o<=90;o++)a[String.fromCharCode(o)]={code:o,shift:!0};for(o=0;o<=9;o++)a[""+o]={code:48+o,shift:!1};for(o=1;o<=12;o++)a["F"+o]={code:111+o,shift:!1};for(o=0;o<=9;o++)a["num"+o]={code:96+o,shift:!1};a["num*"]={code:106,shift:!1},a["num+"]={code:107,shift:!1},a["num-"]={code:109,shift:!1},a["num/"]={code:111,shift:!1},a["num."]={code:110,shift:!1},a.left={code:37,shift:!1},a.up={code:38,shift:!1},a.right={code:39,shift:!1},a.down={code:40,shift:!1},a.space={code:32,shift:!1},a.enter={code:13,shift:!1},a.shift={code:16,shift:void 0},a.esc={code:27,shift:!1},a.backspace={code:8,shift:!1},a.tab={code:9,shift:!1},a.ctrl={code:17,shift:!1},a.alt={code:18,shift:!1},a.delete={code:46,shift:!1},a.pageup={code:33,shift:!1},a.pagedown={code:34,shift:!1},a["="]={code:187,shift:!1},a["-"]={code:189,shift:!1},a["]"]={code:221,shift:!1},a["["]={code:219,shift:!1};var s=function(h){l(h,"keydown")},u=function(h){l(h,"keyup")},l=function(h,c){if(n[c][h.keyCode]!==void 0){for(var d=n[c][h.keyCode],f=0;f700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=new Date().valueOf())}},{key:"_stopMovement",value:function(){for(var e in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}},{key:"_moveUp",value:function(){this.body.view.translation.y+=this.options.keyboard.speed.y}},{key:"_moveDown",value:function(){this.body.view.translation.y-=this.options.keyboard.speed.y}},{key:"_moveLeft",value:function(){this.body.view.translation.x+=this.options.keyboard.speed.x}},{key:"_moveRight",value:function(){this.body.view.translation.x-=this.options.keyboard.speed.x}},{key:"_zoomIn",value:function(){var e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,a=t/e,o=(1-a)*this.canvas.canvasViewCenter.x+n.x*a,s=(1-a)*this.canvas.canvasViewCenter.y+n.y*a;this.body.view.scale=t,this.body.view.translation={x:o,y:s},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}},{key:"_zoomOut",value:function(){var e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,a=t/e,o=(1-a)*this.canvas.canvasViewCenter.x+n.x*a,s=(1-a)*this.canvas.canvasViewCenter.y+n.y*a;this.body.view.scale=t,this.body.view.translation={x:o,y:s},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}},{key:"configureKeyboardBindings",value:function(){var e=this;if(this.keycharm!==void 0&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=g$({container:window,preventDefault:!0}):this.keycharm=g$({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0)){var t,n,a,o,s,u,l,h,c,d,f,v,p,g,y,m,$,b,O,_,D,R,P,B;k(t=this.keycharm).call(t,"up",function(){e.bindToRedraw("_moveUp")},"keydown"),k(n=this.keycharm).call(n,"down",function(){e.bindToRedraw("_moveDown")},"keydown"),k(a=this.keycharm).call(a,"left",function(){e.bindToRedraw("_moveLeft")},"keydown"),k(o=this.keycharm).call(o,"right",function(){e.bindToRedraw("_moveRight")},"keydown"),k(s=this.keycharm).call(s,"=",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(u=this.keycharm).call(u,"num+",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(l=this.keycharm).call(l,"num-",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(h=this.keycharm).call(h,"-",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(c=this.keycharm).call(c,"[",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(d=this.keycharm).call(d,"]",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(f=this.keycharm).call(f,"pageup",function(){e.bindToRedraw("_zoomIn")},"keydown"),k(v=this.keycharm).call(v,"pagedown",function(){e.bindToRedraw("_zoomOut")},"keydown"),k(p=this.keycharm).call(p,"up",function(){e.unbindFromRedraw("_moveUp")},"keyup"),k(g=this.keycharm).call(g,"down",function(){e.unbindFromRedraw("_moveDown")},"keyup"),k(y=this.keycharm).call(y,"left",function(){e.unbindFromRedraw("_moveLeft")},"keyup"),k(m=this.keycharm).call(m,"right",function(){e.unbindFromRedraw("_moveRight")},"keyup"),k($=this.keycharm).call($,"=",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(b=this.keycharm).call(b,"num+",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(O=this.keycharm).call(O,"num-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(_=this.keycharm).call(_,"-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(D=this.keycharm).call(D,"[",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),k(R=this.keycharm).call(R,"]",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(P=this.keycharm).call(P,"pageup",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),k(B=this.keycharm).call(B,"pagedown",function(){e.unbindFromRedraw("_zoomOut")},"keyup")}}}]),i}();function pfe(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=gfe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function gfe(i,r){var e;if(i){if(typeof i=="string")return y$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return y$(i,r)}}function y$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=new Date().valueOf())}},{key:"onTap",value:function(e){var t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t)}},{key:"onDoubleTap",value:function(e){var t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("doubleClick",e,t)}},{key:"onHold",value:function(e){var t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t),this.selectionHandler.generateClickEvent("hold",e,t)}},{key:"onRelease",value:function(e){if(new Date().valueOf()-this.touchTime>10){var t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("release",e,t),this.touchTime=new Date().valueOf()}}},{key:"onContext",value:function(e){var t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent("oncontext",e,t)}},{key:"checkSelectionChanges",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;t===!0?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}},{key:"_determineDifference",value:function(e,t){var n=function(o,s){for(var u=[],l=0;l=o.minX&&c.x<=o.maxX&&c.y>=o.minY&&c.y<=o.maxY});fe(s).call(s,function(h){return t.selectionHandler.selectObject(t.body.nodes[h])});var u=this.getPointer(e.center);this.selectionHandler.commitAndEmit(u,e),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw")}else{var l=this.drag.selection;l&&l.length?(fe(l).call(l,function(h){h.node.options.fixed.x=h.xFixed,h.node.options.fixed.y=h.yFixed}),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center)),this.body.emitter.emit("startSimulation")):(this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw"))}}},{key:"onPinch",value:function(e){var t=this.getPointer(e.center);this.drag.pinched=!0,this.pinch.scale===void 0&&(this.pinch.scale=1);var n=this.pinch.scale*e.scale;this.zoom(n,t)}},{key:"zoom",value:function(e,t){if(this.options.zoomView===!0){var n=this.body.view.scale;e<1e-5&&(e=1e-5),e>10&&(e=10);var a=void 0;this.drag!==void 0&&this.drag.dragging===!0&&(a=this.canvas.DOMtoCanvas(this.drag.pointer));var o=this.body.view.translation,s=e/n,u=(1-s)*t.x+o.x*s,l=(1-s)*t.y+o.y*s;if(this.body.view.scale=e,this.body.view.translation={x:u,y:l},a!=null){var h=this.canvas.canvasToDOM(a);this.drag.pointer.x=h.x,this.drag.pointer.y=h.y}this.body.emitter.emit("_requestRedraw"),n0&&(this.popupObj=h[d[d.length-1]],s=!0)}if(this.popupObj===void 0&&s===!1){for(var v=this.body.edgeIndices,p=this.body.edges,g,y=[],m=0;m0&&(this.popupObj=p[y[y.length-1]],u="edge")}this.popupObj!==void 0?this.popupObj.id!==o&&(this.popup===void 0&&(this.popup=new noe(this.canvas.frame)),this.popup.popupTargetType=u,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):this.popup!==void 0&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}},{key:"_checkHidePopup",value:function(e){var t=this.selectionHandler._pointerToPositionObject(e),n=!1;if(this.popup.popupTargetType==="node"){if(this.body.nodes[this.popup.popupTargetId]!==void 0&&(n=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),n===!0)){var a=this.selectionHandler.getNodeAt(e);n=a===void 0?!1:a.id===this.popup.popupTargetId}}else this.selectionHandler.getNodeAt(e)===void 0&&this.body.edges[this.popup.popupTargetId]!==void 0&&(n=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));n===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}]),i}(),mfe=hp,bfe=vT;mfe("Set",function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},bfe);var $fe=oe,wfe=$fe.Set,_fe=wfe,Efe=_fe,Sfe=Efe,xi=V(Sfe),Ofe=se,m$=cp,ru=eh.getWeakData,Tfe=lp,Ife=Vt,kfe=Oa,vd=Ze,Pfe=up,BT=wi,b$=Qe,FT=ln,xfe=FT.set,Cfe=FT.getterFor,Afe=BT.find,Dfe=BT.findIndex,Rfe=Ofe([].splice),Nfe=0,iu=function(i){return i.frozen||(i.frozen=new jT)},jT=function(){this.entries=[]},pd=function(i,r){return Afe(i.entries,function(e){return e[0]===r})};jT.prototype={get:function(i){var r=pd(this,i);if(r)return r[1]},has:function(i){return!!pd(this,i)},set:function(i,r){var e=pd(this,i);e?e[1]=r:this.entries.push([i,r])},delete:function(i){var r=Dfe(this.entries,function(e){return e[0]===i});return~r&&Rfe(this.entries,r,1),!!~r}};var Mfe={getConstructor:function(i,r,e,t){var n=i(function(u,l){Tfe(u,a),xfe(u,{type:r,id:Nfe++,frozen:void 0}),kfe(l)||Pfe(l,u[t],{that:u,AS_ENTRIES:e})}),a=n.prototype,o=Cfe(r),s=function(u,l,h){var c=o(u),d=ru(Ife(l),!0);return d===!0?iu(c).set(l,h):d[c.id]=h,u};return m$(a,{delete:function(u){var l=o(this);if(!vd(u))return!1;var h=ru(u);return h===!0?iu(l).delete(u):h&&b$(h,l.id)&&delete h[l.id]},has:function(l){var h=o(this);if(!vd(l))return!1;var c=ru(l);return c===!0?iu(h).has(l):c&&b$(c,h.id)}}),m$(a,e?{get:function(l){var h=o(this);if(vd(l)){var c=ru(l);return c===!0?iu(h).get(l):c?c[h.id]:void 0}},set:function(l,h){return s(this,l,h)}}:{add:function(l){return s(this,l,!0)}}),n}},Bfe=hT,$$=Pe,Su=se,w$=cp,Ffe=eh,jfe=hp,LT=Mfe,nu=Ze,au=ln.enforce,Lfe=ae,zfe=eS,gs=Object,Hfe=Array.isArray,ou=gs.isExtensible,zT=gs.isFrozen,Vfe=gs.isSealed,HT=gs.freeze,Wfe=gs.seal,_$={},E$={},Ufe=!$$.ActiveXObject&&"ActiveXObject"in $$,Wa,VT=function(i){return function(){return i(this,arguments.length?arguments[0]:void 0)}},WT=jfe("WeakMap",VT,LT),Cn=WT.prototype,Ou=Su(Cn.set),Kfe=function(){return Bfe&&Lfe(function(){var i=HT([]);return Ou(new WT,i,1),!zT(i)})};if(zfe)if(Ufe){Wa=LT.getConstructor(VT,"WeakMap",!0),Ffe.enable();var S$=Su(Cn.delete),su=Su(Cn.has),O$=Su(Cn.get);w$(Cn,{delete:function(i){if(nu(i)&&!ou(i)){var r=au(this);return r.frozen||(r.frozen=new Wa),S$(this,i)||r.frozen.delete(i)}return S$(this,i)},has:function(r){if(nu(r)&&!ou(r)){var e=au(this);return e.frozen||(e.frozen=new Wa),su(this,r)||e.frozen.has(r)}return su(this,r)},get:function(r){if(nu(r)&&!ou(r)){var e=au(this);return e.frozen||(e.frozen=new Wa),su(this,r)?O$(this,r):e.frozen.get(r)}return O$(this,r)},set:function(r,e){if(nu(r)&&!ou(r)){var t=au(this);t.frozen||(t.frozen=new Wa),su(this,r)?Ou(this,r,e):t.frozen.set(r,e)}else Ou(this,r,e);return this}})}else Kfe()&&w$(Cn,{set:function(r,e){var t;return Hfe(r)&&(zT(r)?t=_$:Vfe(r)&&(t=E$)),Ou(this,r,e),t===_$&&HT(r),t===E$&&Wfe(r),this}});var Gfe=oe,qfe=Gfe.WeakMap,Yfe=qfe,Xfe=Yfe,Jfe=Xfe,ao=V(Jfe);function ve(i,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?i!==r||!t:!r.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(i):t?t.value:r.get(i)}function Nf(i,r,e,t,n){if(typeof r=="function"?i!==r||!0:!r.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r.set(i,e),e}function Mf(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=Zfe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Zfe(i,r){var e;if(i){if(typeof i=="string")return T$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return T$(i,r)}}function T$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e0&&arguments[0]!==void 0?arguments[0]:function(){};N(this,i),Yr.set(this,new k$),Xr.set(this,new k$),Tu.set(this,void 0),Nf(this,Tu,r)}return M(i,[{key:"sizeNodes",get:function(){return ve(this,Yr,"f").size}},{key:"sizeEdges",get:function(){return ve(this,Xr,"f").size}},{key:"getNodes",value:function(){return ve(this,Yr,"f").getSelection()}},{key:"getEdges",value:function(){return ve(this,Xr,"f").getSelection()}},{key:"addNodes",value:function(){var e;(e=ve(this,Yr,"f")).add.apply(e,arguments)}},{key:"addEdges",value:function(){var e;(e=ve(this,Xr,"f")).add.apply(e,arguments)}},{key:"deleteNodes",value:function(e){ve(this,Yr,"f").delete(e)}},{key:"deleteEdges",value:function(e){ve(this,Xr,"f").delete(e)}},{key:"clear",value:function(){ve(this,Yr,"f").clear(),ve(this,Xr,"f").clear()}},{key:"commit",value:function(){for(var e,t,n={nodes:ve(this,Yr,"f").commit(),edges:ve(this,Xr,"f").commit()},a=arguments.length,o=new Array(a),s=0;s=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function eve(i,r){var e;if(i){if(typeof i=="string")return x$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return x$(i,r)}}function x$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e4&&arguments[4]!==void 0?arguments[4]:!1,s=this._initBaseEvent(t,n);if(o===!0)s.nodes=[],s.edges=[];else{var u=this.getSelection();s.nodes=u.nodes,s.edges=u.edges}a!==void 0&&(s.previousSelection=a),e=="click"&&(s.items=this.getClickedItems(n)),t.controlEdge!==void 0&&(s.controlEdge=t.controlEdge),this.body.emitter.emit(e,s)}},{key:"selectObject",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.selectConnectedEdges;if(e!==void 0){if(e instanceof Nt){if(t===!0){var n;(n=this._selectionAccumulator).addEdges.apply(n,fr(e.edges))}this._selectionAccumulator.addNodes(e)}else this._selectionAccumulator.addEdges(e);return!0}return!1}},{key:"deselectObject",value:function(e){e.isSelected()===!0&&(e.selected=!1,this._removeFromSelection(e))}},{key:"_getAllNodesOverlappingWith",value:function(e){for(var t=[],n=this.body.nodes,a=0;a1&&arguments[1]!==void 0?arguments[1]:!0,n=this._pointerToPositionObject(e),a=this._getAllNodesOverlappingWith(n);if(a.length>0)return t===!0?this.body.nodes[a[a.length-1]]:a[a.length-1]}},{key:"_getEdgesOverlappingWith",value:function(e,t){for(var n=this.body.edges,a=0;a1&&arguments[1]!==void 0?arguments[1]:!0,n=this.canvas.DOMtoCanvas(e),a=10,o=null,s=this.body.edges,u=0;u0&&(this.generateClickEvent("deselectEdge",t,e,o),n=!0),a.nodes.deleted.length>0&&(this.generateClickEvent("deselectNode",t,e,o),n=!0),a.nodes.added.length>0&&(this.generateClickEvent("selectNode",t,e),n=!0),a.edges.added.length>0&&(this.generateClickEvent("selectEdge",t,e),n=!0),n===!0&&this.generateClickEvent("select",t,e)}},{key:"getSelection",value:function(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}},{key:"getSelectedNodes",value:function(){return this._selectionAccumulator.getNodes()}},{key:"getSelectedEdges",value:function(){return this._selectionAccumulator.getEdges()}},{key:"getSelectedNodeIds",value:function(){var e;return na(e=this._selectionAccumulator.getNodes()).call(e,function(t){return t.id})}},{key:"getSelectedEdgeIds",value:function(){var e;return na(e=this._selectionAccumulator.getEdges()).call(e,function(t){return t.id})}},{key:"setSelection",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||!e.nodes&&!e.edges)throw new TypeError("Selection must be an object with nodes and/or edges properties");if((t.unselectAll||t.unselectAll===void 0)&&this.unselectAll(),e.nodes){var n=P$(e.nodes),a;try{for(n.s();!(a=n.n()).done;){var o=a.value,s=this.body.nodes[o];if(!s)throw new RangeError('Node with id "'+o+'" not found');this.selectObject(s,t.highlightEdges)}}catch(d){n.e(d)}finally{n.f()}}if(e.edges){var u=P$(e.edges),l;try{for(u.s();!(l=u.n()).done;){var h=l.value,c=this.body.edges[h];if(!c)throw new RangeError('Edge with id "'+h+'" not found');this.selectObject(c)}}catch(d){u.e(d)}finally{u.f()}}this.body.emitter.emit("_requestRedraw"),this._selectionAccumulator.commit()}},{key:"selectNodes",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:t})}},{key:"selectEdges",value:function(e){if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({edges:e})}},{key:"updateSelection",value:function(){for(var e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(var t in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,t.id)||this._selectionAccumulator.deleteEdges(t)}},{key:"getClickedItems",value:function(e){for(var t=this.canvas.DOMtoCanvas(e),n=[],a=this.body.nodeIndices,o=this.body.nodes,s=a.length-1;s>=0;s--){var u=o[a[s]],l=u.getItemsOnPoint(t);n.push.apply(n,l)}for(var h=this.body.edgeIndices,c=this.body.edges,d=h.length-1;d>=0;d--){var f=c[h[d]],v=f.getItemsOnPoint(t);n.push.apply(n,v)}return n}}]),i}(),C$=kS,rve=Math.floor,Bf=function(i,r){var e=i.length,t=rve(e/2);return e<8?ive(i,r):nve(i,Bf(C$(i,0,t),r),Bf(C$(i,t),r),r)},ive=function(i,r){for(var e=i.length,t=1,n,a;t0;)i[a]=i[--a];a!==t++&&(i[a]=n)}return i},nve=function(i,r,e,t){for(var n=r.length,a=e.length,o=0,s=0;o3)){if(mve)return!0;if(F$)return F$<603;var i="",r,e,t,n;for(r=65;r<76;r++){switch(e=String.fromCharCode(r),r){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(n=0;n<47;n++)ii.push({k:e+n,v:t})}for(ii.sort(function(a,o){return o.v-a.v}),n=0;nN$(e)?1:-1}};dve({target:"Array",proto:!0,forced:Eve},{sort:function(r){r!==void 0&&fve(r);var e=vve(this);if(KT)return r===void 0?j$(e):j$(e,r);var t=[],n=R$(e),a,o;for(o=0;o=0:s>u;u+=l)u in o&&(n=e(n,o[u],u,a));return n}},Fve={left:L$(!1),right:L$(!0)},jve=Pe,Lve=Hr,zve=Lve(jve.process)==="process",Hve=q,Vve=Fve.left,Wve=Ra,z$=Xo,Uve=zve,Kve=!Uve&&z$>79&&z$<83,Gve=Kve||!Wve("reduce");Hve({target:"Array",proto:!0,forced:Gve},{reduce:function(r){var e=arguments.length;return Vve(this,r,e,e>1?arguments[1]:void 0)}});var qve=et,Yve=qve("Array").reduce,Xve=Be,Jve=Yve,yd=Array.prototype,Zve=function(i){var r=i.reduce;return i===yd||Xve(yd,i)&&r===yd.reduce?Jve:r},Qve=Zve,epe=Qve,tpe=epe,GT=V(tpe);function qT(i){var r=rpe();return function(){var t=L(i),n;if(r){var a=L(this).constructor;n=E(t,arguments,a)}else n=t.apply(this,arguments);return ce(this,n)}}function rpe(){if(typeof Reflect>"u"||!E||E.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(E(Boolean,[],function(){})),!0}catch{return!1}}var YT=function(){function i(){N(this,i)}return M(i,[{key:"abstract",value:function(){throw new Error("Can't instantiate abstract class!")}},{key:"fake_use",value:function(){}},{key:"curveType",value:function(){return this.abstract()}},{key:"getPosition",value:function(e){return this.fake_use(e),this.abstract()}},{key:"setPosition",value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;this.fake_use(e,t,n),this.abstract()}},{key:"getTreeSize",value:function(e){return this.fake_use(e),this.abstract()}},{key:"sort",value:function(e){this.fake_use(e),this.abstract()}},{key:"fix",value:function(e,t){this.fake_use(e,t),this.abstract()}},{key:"shift",value:function(e,t){this.fake_use(e,t),this.abstract()}}]),i}(),ipe=function(i){ue(e,i);var r=qT(e);function e(t){var n;return N(this,e),n=r.call(this),n.layout=t,n}return M(e,[{key:"curveType",value:function(){return"horizontal"}},{key:"getPosition",value:function(n){return n.x}},{key:"setPosition",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;o!==void 0&&this.layout.hierarchical.addToOrdering(n,o),n.x=a}},{key:"getTreeSize",value:function(n){var a=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,n);return{min:a.min_x,max:a.max_x}}},{key:"sort",value:function(n){oo(n).call(n,function(a,o){return a.x-o.x})}},{key:"fix",value:function(n,a){n.y=this.layout.options.hierarchical.levelSeparation*a,n.options.fixed.y=!0}},{key:"shift",value:function(n,a){this.layout.body.nodes[n].x+=a}}]),e}(YT),npe=function(i){ue(e,i);var r=qT(e);function e(t){var n;return N(this,e),n=r.call(this),n.layout=t,n}return M(e,[{key:"curveType",value:function(){return"vertical"}},{key:"getPosition",value:function(n){return n.y}},{key:"setPosition",value:function(n,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;o!==void 0&&this.layout.hierarchical.addToOrdering(n,o),n.y=a}},{key:"getTreeSize",value:function(n){var a=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,n);return{min:a.min_y,max:a.max_y}}},{key:"sort",value:function(n){oo(n).call(n,function(a,o){return a.y-o.y})}},{key:"fix",value:function(n,a){n.x=this.layout.options.hierarchical.levelSeparation*a,n.options.fixed.x=!0}},{key:"shift",value:function(n,a){this.layout.body.nodes[n].y+=a}}]),e}(YT),ape=q,ope=wi.every,spe=Ra,upe=spe("every");ape({target:"Array",proto:!0,forced:!upe},{every:function(r){return ope(this,r,arguments.length>1?arguments[1]:void 0)}});var lpe=et,hpe=lpe("Array").every,cpe=Be,dpe=hpe,md=Array.prototype,fpe=function(i){var r=i.every;return i===md||cpe(md,i)&&r===md.every?dpe:r},vpe=fpe,ppe=vpe,gpe=ppe,XT=V(gpe);function ype(i,r){var e=typeof _i<"u"&&cn(i)||i["@@iterator"];if(!e){if(he(i)||(e=mpe(i))||r){e&&(i=e);var t=0,n=function(){};return{s:n,n:function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function mpe(i,r){var e;if(i){if(typeof i=="string")return H$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return H$(i,r)}}function H$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e=r[a])&&(r[a]=r[n]+1)}),r}function $pe(i){return JT(function(r){var e,t;return XT(e=Tt(t=r.edges).call(t,function(n){return i.has(n.toId)})).call(e,function(n){return n.to===r})},function(r,e){return e>r},"from",i)}function wpe(i){return JT(function(r){var e,t;return XT(e=Tt(t=r.edges).call(t,function(n){return i.has(n.toId)})).call(e,function(n){return n.from===r})},function(r,e){return eo)return{v:{v:bpe(t,a)}};++m},O;$=y.pop();)if(O=b(),O!==0&&O)return O.v},d;for(l.s();!(h=l.n()).done;)if(d=c(),d!==0&&d)return d.v}catch(f){l.e(f)}finally{l.f()}return a}var _pe=function(){function i(){N(this,i),this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}return M(i,[{key:"addRelation",value:function(e,t){this.childrenReference[e]===void 0&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),this.parentReference[t]===void 0&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}},{key:"checkIfTree",value:function(){for(var e in this.parentReference)if(this.parentReference[e].length>1){this.isTree=!1;return}this.isTree=!0}},{key:"numTrees",value:function(){return this.treeIndex+1}},{key:"setTreeIndex",value:function(e,t){t!==void 0&&this.trees[e.id]===void 0&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}},{key:"ensureLevel",value:function(e){this.levels[e]===void 0&&(this.levels[e]=0)}},{key:"getMaxLevel",value:function(e){var t=this,n={},a=function o(s){if(n[s]!==void 0)return n[s];var u=t.levels[s];if(t.childrenReference[s]){var l=t.childrenReference[s];if(l.length>0)for(var h=0;h0&&(n.levelSeparation*=-1):n.levelSeparation<0&&(n.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(a===!0)return this.body.emitter.emit("refresh"),pe(t,this.optionsBackup)}return t}},{key:"_resetRNG",value:function(e){this.initialRandomSeed=e,this._rng=Ql(this.initialRandomSeed)}},{key:"adaptAllOptionsForHierarchicalLayout",value:function(e){if(this.options.hierarchical.enabled===!0){var t=this.optionsBackup.physics;e.physics===void 0||e.physics===!0?(e.physics={enabled:t.enabled===void 0?!0:t.enabled,solver:"hierarchicalRepulsion"},t.enabled=t.enabled===void 0?!0:t.enabled,t.solver=t.solver||"barnesHut"):de(e.physics)==="object"?(t.enabled=e.physics.enabled===void 0?!0:e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):e.physics!==!1&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});var n=this.direction.curveType();if(e.edges===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(e.edges.smooth===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if(typeof e.edges.smooth=="boolean")this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:n};else{var a=e.edges.smooth;a.type!==void 0&&a.type!=="dynamic"&&(n=a.type),this.optionsBackup.edges={smooth:{enabled:a.enabled===void 0?!0:a.enabled,type:a.type===void 0?"dynamic":a.type,roundness:a.roundness===void 0?.5:a.roundness,forceDirection:a.forceDirection===void 0?!1:a.forceDirection}},e.edges.smooth={enabled:a.enabled===void 0?!0:a.enabled,type:n,roundness:a.roundness===void 0?.5:a.roundness,forceDirection:a.forceDirection===void 0?!1:a.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",n)}return e}},{key:"positionInitially",value:function(e){if(this.options.hierarchical.enabled!==!0){this._resetRNG(this.initialRandomSeed);for(var t=e.length+50,n=0;nu){for(var h=e.length;e.length>u&&s<=o;){s+=1;var c=e.length;s%3===0?this.body.modules.clustering.clusterBridges(l):this.body.modules.clustering.clusterOutliers(l);var d=e.length;if(c==d&&s%3!==0){this._declusterAll(),this.body.emitter.emit("_layoutFailed"),console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.");return}}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*h)})}s>o&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();for(var f=70,v=0;v0){var e,t,n=!1,a=!1;this.lastNodeOnLevel={},this.hierarchical=new _pe;for(t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&(e=this.body.nodes[t],e.options.level!==void 0?(n=!0,this.hierarchical.levels[t]=e.options.level):a=!0);if(a===!0&&n===!0)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");if(a===!0){var o=this.options.hierarchical.sortMethod;o==="hubsize"?this._determineLevelsByHubsize():o==="directed"?this._determineLevelsDirected():o==="custom"&&this._determineLevelsCustomCallback()}for(var s in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,s)&&this.hierarchical.ensureLevel(s);var u=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(u),this._condenseHierarchy(),this._shiftToCenter()}}},{key:"_condenseHierarchy",value:function(){var e=this,t=!1,n={},a=function(){for(var $=s(),b=0,O=0;O<$.length-1;O++){var _=$[O].max-$[O+1].min;b+=_+e.options.hierarchical.treeSpacing,o(O+1,b)}},o=function($,b){var O=e.hierarchical.trees;for(var _ in O)Object.prototype.hasOwnProperty.call(O,_)&&O[_]===$&&e.direction.shift(_,b)},s=function(){for(var $=[],b=0;b0)for(var _=0;_1&&arguments[1]!==void 0?arguments[1]:1e9,O=1e9,_=1e9,D=1e9,R=-1e9;for(var P in $)if(Object.prototype.hasOwnProperty.call($,P)){var B=e.body.nodes[P],j=e.hierarchical.levels[B.id],J=e.direction.getPosition(B),U=e._getSpaceAroundNode(B,$),ie=Te(U,2),_e=ie[0],ye=ie[1];O=Math.min(_e,O),_=Math.min(ye,_),j<=b&&(D=Math.min(J,D),R=Math.max(J,R))}return[D,R,O,_]},h=function($,b){var O=e.hierarchical.getMaxLevel($.id),_=e.hierarchical.getMaxLevel(b.id);return Math.min(O,_)},c=function($,b,O){for(var _=e.hierarchical,D=0;D1)for(var B=0;B2&&arguments[2]!==void 0?arguments[2]:!1,_=e.direction.getPosition($),D=e.direction.getPosition(b),R=Math.abs(D-_),P=e.options.hierarchical.nodeSpacing;if(R>P){var B={},j={};u($,B),u(b,j);var J=h($,b),U=l(B,J),ie=l(j,J),_e=U[1],ye=ie[0],Ae=ie[2],ht=Math.abs(_e-ye);if(ht>P){var at=_e-ye+P;at<-Ae+P&&(at=-Ae+P),at<0&&(e._shiftBlock(b.id,at),t=!0,O===!0&&e._centerParent(b))}}},f=function($,b){for(var O=b.id,_=b.edges,D=e.hierarchical.levels[b.id],R=e.options.hierarchical.levelSeparation*e.options.hierarchical.levelSeparation,P={},B=[],j=0;j<_.length;j++){var J=_[j];if(J.toId!=J.fromId){var U=J.toId==O?J.from:J.to;P[_[j].id]=U,e.hierarchical.levels[U.id]0?ut=Math.min(Rt,Sr-e.options.hierarchical.nodeSpacing):Rt<0&&(ut=-Math.min(-Rt,st-e.options.hierarchical.nodeSpacing)),ut!=0&&(e._shiftBlock(b.id,ut),t=!0)},ht=function(ot){var me=e.direction.getPosition(b),Fe=e._getSpaceAroundNode(b),De=Te(Fe,2),st=De[0],Sr=De[1],Rt=ot-me,ut=me;Rt>0?ut=Math.min(me+(Sr-e.options.hierarchical.nodeSpacing),ot):Rt<0&&(ut=Math.max(me-(st-e.options.hierarchical.nodeSpacing),ot)),ut!==me&&(e.direction.setPosition(b,ut),t=!0)},at=ye($,B);Ae(at),at=ye($,_),ht(at)},v=function($){var b=e.hierarchical.getLevels();b=Li(b).call(b);for(var O=0;O<$;O++){t=!1;for(var _=0;_0&&Math.abs(v)0&&(h=this.direction.getPosition(a[s-1])+l),this.direction.setPosition(u,h,t),this._validatePositionAndContinue(u,t,h),o++}}}}},{key:"_placeBranchNodes",value:function(e,t){var n,a=this.hierarchical.childrenReference[e];if(a!==void 0){for(var o=[],s=0;st&&this.positionedNodes[l.id]===void 0){var c=this.options.hierarchical.nodeSpacing,d=void 0;u===0?d=this.direction.getPosition(this.body.nodes[e]):d=this.direction.getPosition(o[u-1])+c,this.direction.setPosition(l,d,h),this._validatePositionAndContinue(l,h,d)}else return}var f=this._getCenterPosition(o);this.direction.setPosition(this.body.nodes[e],f,t)}}},{key:"_validatePositionAndContinue",value:function(e,t,n){if(this.hierarchical.isTree){if(this.lastNodeOnLevel[t]!==void 0){var a=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(n-ae.hierarchical.levels[a.id]&&e.hierarchical.addRelation(a.id,o.id)};this._crawlNetwork(t),this.hierarchical.checkIfTree()}},{key:"_crawlNetwork",value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){},n=arguments.length>1?arguments[1]:void 0,a={},o=function d(f,v){if(a[f.id]===void 0){e.hierarchical.setTreeIndex(f,v),a[f.id]=!0;for(var p,g=e._getActiveEdges(f),y=0;y=i.length?{done:!0}:{done:!1,value:i[t++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){e=e.call(i)},n:function(){var l=e.next();return a=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!a&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Ope(i,r){var e;if(i){if(typeof i=="string")return V$(i,r);var t=it(e=Object.prototype.toString.call(i)).call(e,8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return hn(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return V$(i,r)}}function V$(i,r){(r==null||r>i.length)&&(r=i.length);for(var e=0,t=new Array(r);e0&&this.options.deleteNode!==!1?(u===!0&&this._createSeperator(4),this._createDeleteButton(s)):n===0&&this.options.deleteEdge!==!1&&(u===!0&&this._createSeperator(4),this._createDeleteButton(s))),this._bindElementEvents(this.closeDiv,k(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent("select",k(t=this.showManipulatorToolbar).call(t,this))}this.body.emitter.emit("_redraw")}},{key:"addNodeMode",value:function(){var e;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addNode",this.guiEnabled===!0){var t,n=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(n),this._createSeperator(),this._createDescription(n.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,k(t=this.toggleEditMode).call(t,this))}this._temporaryBindEvent("click",k(e=this._performAddNode).call(e,this))}},{key:"editNode",value:function(){var e=this;this.editMode!==!0&&this.enableEditMode(),this._clean();var t=this.selectionHandler.getSelectedNodes()[0];if(t!==void 0)if(this.inMode="editNode",typeof this.options.editNode=="function")if(t.isCluster!==!0){var n=pe({},t.options,!1);if(n.x=t.x,n.y=t.y,this.options.editNode.length===2)this.options.editNode(n,function(a){a!=null&&e.inMode==="editNode"&&e.body.data.nodes.getDataSet().update(a),e.showManipulatorToolbar()});else throw new Error("The function for edit does not support two arguments (data, callback)")}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError);else throw new Error("No function has been configured to handle the editing of nodes.");else this.showManipulatorToolbar()}},{key:"addEdgeMode",value:function(){var e,t,n,a,o;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addEdge",this.guiEnabled===!0){var s,u=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(u),this._createSeperator(),this._createDescription(u.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,k(s=this.toggleEditMode).call(s,this))}this._temporaryBindUI("onTouch",k(e=this._handleConnect).call(e,this)),this._temporaryBindUI("onDragEnd",k(t=this._finishConnect).call(t,this)),this._temporaryBindUI("onDrag",k(n=this._dragControlNode).call(n,this)),this._temporaryBindUI("onRelease",k(a=this._finishConnect).call(a,this)),this._temporaryBindUI("onDragStart",k(o=this._dragStartEdge).call(o,this)),this._temporaryBindUI("onHold",function(){})}},{key:"editEdgeMode",value:function(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="editEdge",de(this.options.editEdge)==="object"&&typeof this.options.editEdge.editWithoutDrag=="function"&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0)){var e=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(e.from.id,e.to.id);return}if(this.guiEnabled===!0){var t,n=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(n),this._createSeperator(),this._createDescription(n.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,k(t=this.toggleEditMode).call(t,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0){var a,o,s,u,l=this.body.edges[this.edgeBeingEditedId],h=this._getNewTargetNode(l.from.x,l.from.y),c=this._getNewTargetNode(l.to.x,l.to.y);this.temporaryIds.nodes.push(h.id),this.temporaryIds.nodes.push(c.id),this.body.nodes[h.id]=h,this.body.nodeIndices.push(h.id),this.body.nodes[c.id]=c,this.body.nodeIndices.push(c.id),this._temporaryBindUI("onTouch",k(a=this._controlNodeTouch).call(a,this)),this._temporaryBindUI("onTap",function(){}),this._temporaryBindUI("onHold",function(){}),this._temporaryBindUI("onDragStart",k(o=this._controlNodeDragStart).call(o,this)),this._temporaryBindUI("onDrag",k(s=this._controlNodeDrag).call(s,this)),this._temporaryBindUI("onDragEnd",k(u=this._controlNodeDragEnd).call(u,this)),this._temporaryBindUI("onMouseMove",function(){}),this._temporaryBindEvent("beforeDrawing",function(d){var f=l.edgeType.findBorderPositions(d);h.selected===!1&&(h.x=f.from.x,h.y=f.from.y),c.selected===!1&&(c.x=f.to.x,c.y=f.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}},{key:"deleteSelected",value:function(){var e=this;this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="delete";var t=this.selectionHandler.getSelectedNodeIds(),n=this.selectionHandler.getSelectedEdgeIds(),a=void 0;if(t.length>0){for(var o=0;o0&&typeof this.options.deleteEdge=="function"&&(a=this.options.deleteEdge);if(typeof a=="function"){var s={nodes:t,edges:n};if(a.length===2)a(s,function(u){u!=null&&e.inMode==="delete"?(e.body.data.edges.getDataSet().remove(u.edges),e.body.data.nodes.getDataSet().remove(u.nodes),e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar()):(e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar())});else throw new Error("The function for delete does not support two arguments (data, callback)")}else this.body.data.edges.getDataSet().remove(n),this.body.data.nodes.getDataSet().remove(t),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}},{key:"_setup",value:function(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}},{key:"_createWrappers",value:function(){if(this.manipulationDiv===void 0&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",this.editMode===!0?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),this.editModeDiv===void 0&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",this.editMode===!0?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),this.closeDiv===void 0){var e,t;this.closeDiv=document.createElement("button"),this.closeDiv.className="vis-close",this.closeDiv.setAttribute("aria-label",(e=(t=this.options.locales[this.options.locale])===null||t===void 0?void 0:t.close)!==null&&e!==void 0?e:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv)}}},{key:"_getNewTargetNode",value:function(e,t){var n=pe({},this.options.controlNodeStyle);n.id="targetNode"+no(),n.hidden=!1,n.physics=!1,n.x=e,n.y=t;var a=this.body.functions.createNode(n);return a.shape.boundingBox={left:e,right:e,top:t,bottom:t},a}},{key:"_createEditButton",value:function(){var e;this._clean(),this.manipulationDOM={},Zr(this.editModeDiv);var t=this.options.locales[this.options.locale],n=this._createButton("editMode","vis-edit vis-edit-mode",t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(n),this._bindElementEvents(n,k(e=this.toggleEditMode).call(e,this))}},{key:"_clean",value:function(){this.inMode=!1,this.guiEnabled===!0&&(Zr(this.editModeDiv),Zr(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}},{key:"_cleanupDOMEventListeners",value:function(){var e,t=Spe(Ar(e=this._domEventListenerCleanupQueue).call(e,0)),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;a()}}catch(o){t.e(o)}finally{t.f()}}},{key:"_removeManipulationDOM",value:function(){this._clean(),Zr(this.manipulationDiv),Zr(this.editModeDiv),Zr(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}},{key:"_createSeperator",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}},{key:"_createAddNodeButton",value:function(e){var t,n=this._createButton("addNode","vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.addNodeMode).call(t,this))}},{key:"_createAddEdgeButton",value:function(e){var t,n=this._createButton("addEdge","vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.addEdgeMode).call(t,this))}},{key:"_createEditNodeButton",value:function(e){var t,n=this._createButton("editNode","vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.editNode).call(t,this))}},{key:"_createEditEdgeButton",value:function(e){var t,n=this._createButton("editEdge","vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.editEdgeMode).call(t,this))}},{key:"_createDeleteButton",value:function(e){var t,n;this.options.rtl?n="vis-delete-rtl":n="vis-delete";var a=this._createButton("delete",n,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(a),this._bindElementEvents(a,k(t=this.deleteSelected).call(t,this))}},{key:"_createBackButton",value:function(e){var t,n=this._createButton("back","vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,k(t=this.showManipulatorToolbar).call(t,this))}},{key:"_createButton",value:function(e,t,n){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("button"),this.manipulationDOM[e+"Div"].className="vis-button "+t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=a,this.manipulationDOM[e+"Label"].innerText=n,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}},{key:"_createDescription",value:function(e){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}},{key:"_temporaryBindEvent",value:function(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}},{key:"_temporaryBindUI",value:function(e,t){if(this.body.eventListeners[e]!==void 0)this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t;else throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+ls(Oe(this.body.eventListeners)))}},{key:"_unbindTemporaryUIs",value:function(){for(var e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}},{key:"_unbindTemporaryEvents",value:function(){for(var e=0;e=0;u--)if(o[u]!==this.selectedControlNode.id){s=this.body.nodes[o[u]];break}if(s!==void 0&&this.selectedControlNode!==void 0)if(s.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var l=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===l.id?this._performEditEdge(s.id,a.to.id):this._performEditEdge(a.from.id,s.id)}else a.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}}},{key:"_handleConnect",value:function(e){if(new Date().valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=Le({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;var t=this.lastTouch,n=this.selectionHandler.getNodeAt(t);if(n!==void 0)if(n.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var a=this._getNewTargetNode(n.x,n.y);this.body.nodes[a.id]=a,this.body.nodeIndices.push(a.id);var o=this.body.functions.createEdge({id:"connectionEdge"+no(),from:n.id,to:a.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[o.id]=o,this.body.edgeIndices.push(o.id),this.temporaryIds.nodes.push(a.id),this.temporaryIds.edges.push(o.id)}this.touchTime=new Date().valueOf()}}},{key:"_dragControlNode",value:function(e){var t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),a=void 0;this.temporaryIds.edges[0]!==void 0&&(a=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var o=this.selectionHandler._getAllNodesOverlappingWith(n),s=void 0,u=o.length-1;u>=0;u--){var l;if(ne(l=this.temporaryIds.nodes).call(l,o[u])===-1){s=this.body.nodes[o[u]];break}}if(e.controlEdge={from:a,to:s?s.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",e,t),this.temporaryIds.nodes[0]!==void 0){var h=this.body.nodes[this.temporaryIds.nodes[0]];h.x=this.canvas._XconvertDOMtoCanvas(t.x),h.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(e)}},{key:"_finishConnect",value:function(e){var t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),a=void 0;this.temporaryIds.edges[0]!==void 0&&(a=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var o=this.selectionHandler._getAllNodesOverlappingWith(n),s=void 0,u=o.length-1;u>=0;u--){var l;if(ne(l=this.temporaryIds.nodes).call(l,o[u])===-1){s=this.body.nodes[o[u]];break}}this._cleanupTemporaryNodesAndEdges(),s!==void 0&&(s.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):this.body.nodes[a]!==void 0&&this.body.nodes[s.id]!==void 0&&this._performAddEdge(a,s.id)),e.controlEdge={from:a,to:s?s.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",e,t),this.body.emitter.emit("_redraw")}},{key:"_dragStartEdge",value:function(e){var t=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",e,t,void 0,!0)}},{key:"_performAddNode",value:function(e){var t=this,n={id:no(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if(typeof this.options.addNode=="function")if(this.options.addNode.length===2)this.options.addNode(n,function(a){a!=null&&t.inMode==="addNode"&&t.body.data.nodes.getDataSet().add(a),t.showManipulatorToolbar()});else throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");else this.body.data.nodes.getDataSet().add(n),this.showManipulatorToolbar()}},{key:"_performAddEdge",value:function(e,t){var n=this,a={from:e,to:t};if(typeof this.options.addEdge=="function")if(this.options.addEdge.length===2)this.options.addEdge(a,function(o){o!=null&&n.inMode==="addEdge"&&(n.body.data.edges.getDataSet().add(o),n.selectionHandler.unselectAll(),n.showManipulatorToolbar())});else throw new Error("The function for connect does not support two arguments (data,callback)");else this.body.data.edges.getDataSet().add(a),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}},{key:"_performEditEdge",value:function(e,t){var n=this,a={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges.get(this.edgeBeingEditedId).label},o=this.options.editEdge;if(de(o)==="object"&&(o=o.editWithoutDrag),typeof o=="function")if(o.length===2)o(a,function(s){s==null||n.inMode!=="editEdge"?(n.body.edges[a.id].updateEdgeType(),n.body.emitter.emit("_redraw"),n.showManipulatorToolbar()):(n.body.data.edges.getDataSet().update(s),n.selectionHandler.unselectAll(),n.showManipulatorToolbar())});else throw new Error("The function for edit does not support two arguments (data, callback)");else this.body.data.edges.getDataSet().update(a),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}]),i}(),A="string",I="boolean",w="number",Ya="array",H="object",ZT="dom",Ipe="any",bd=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],$d={borderWidth:{number:w},borderWidthSelected:{number:w,undefined:"undefined"},brokenImage:{string:A,undefined:"undefined"},chosen:{label:{boolean:I,function:"function"},node:{boolean:I,function:"function"},__type__:{object:H,boolean:I}},color:{border:{string:A},background:{string:A},highlight:{border:{string:A},background:{string:A},__type__:{object:H,string:A}},hover:{border:{string:A},background:{string:A},__type__:{object:H,string:A}},__type__:{object:H,string:A}},opacity:{number:w,undefined:"undefined"},fixed:{x:{boolean:I},y:{boolean:I},__type__:{object:H,boolean:I}},font:{align:{string:A},color:{string:A},size:{number:w},face:{string:A},background:{string:A},strokeWidth:{number:w},strokeColor:{string:A},vadjust:{number:w},multi:{boolean:I,string:A},bold:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},boldital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},ital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},mono:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},__type__:{object:H,string:A}},group:{string:A,number:w,undefined:"undefined"},heightConstraint:{minimum:{number:w},valign:{string:A},__type__:{object:H,boolean:I,number:w}},hidden:{boolean:I},icon:{face:{string:A},code:{string:A},size:{number:w},color:{string:A},weight:{string:A,number:w},__type__:{object:H}},id:{string:A,number:w},image:{selected:{string:A,undefined:"undefined"},unselected:{string:A,undefined:"undefined"},__type__:{object:H,string:A}},imagePadding:{top:{number:w},right:{number:w},bottom:{number:w},left:{number:w},__type__:{object:H,number:w}},label:{string:A,undefined:"undefined"},labelHighlightBold:{boolean:I},level:{number:w,undefined:"undefined"},margin:{top:{number:w},right:{number:w},bottom:{number:w},left:{number:w},__type__:{object:H,number:w}},mass:{number:w},physics:{boolean:I},scaling:{min:{number:w},max:{number:w},label:{enabled:{boolean:I},min:{number:w},max:{number:w},maxVisible:{number:w},drawThreshold:{number:w},__type__:{object:H,boolean:I}},customScalingFunction:{function:"function"},__type__:{object:H}},shadow:{enabled:{boolean:I},color:{string:A},size:{number:w},x:{number:w},y:{number:w},__type__:{object:H,boolean:I}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:I,array:Ya},borderRadius:{number:w},interpolation:{boolean:I},useImageSize:{boolean:I},useBorderWithImage:{boolean:I},coordinateOrigin:{string:["center","top-left"]},__type__:{object:H}},size:{number:w},title:{string:A,dom:ZT,undefined:"undefined"},value:{number:w,undefined:"undefined"},widthConstraint:{minimum:{number:w},maximum:{number:w},__type__:{object:H,boolean:I,number:w}},x:{number:w},y:{number:w},__type__:{object:H}},kpe={configure:{enabled:{boolean:I},filter:{boolean:I,string:A,array:Ya,function:"function"},container:{dom:ZT},showButton:{boolean:I},__type__:{object:H,boolean:I,string:A,array:Ya,function:"function"}},edges:{arrows:{to:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageHeight:{number:w},imageWidth:{number:w},src:{string:A},__type__:{object:H,boolean:I}},middle:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageWidth:{number:w},imageHeight:{number:w},src:{string:A},__type__:{object:H,boolean:I}},from:{enabled:{boolean:I},scaleFactor:{number:w},type:{string:bd},imageWidth:{number:w},imageHeight:{number:w},src:{string:A},__type__:{object:H,boolean:I}},__type__:{string:["from","to","middle"],object:H}},endPointOffset:{from:{number:w},to:{number:w},__type__:{object:H,number:w}},arrowStrikethrough:{boolean:I},background:{enabled:{boolean:I},color:{string:A},size:{number:w},dashes:{boolean:I,array:Ya},__type__:{object:H,boolean:I}},chosen:{label:{boolean:I,function:"function"},edge:{boolean:I,function:"function"},__type__:{object:H,boolean:I}},color:{color:{string:A},highlight:{string:A},hover:{string:A},inherit:{string:["from","to","both"],boolean:I},opacity:{number:w},__type__:{object:H,string:A}},dashes:{boolean:I,array:Ya},font:{color:{string:A},size:{number:w},face:{string:A},background:{string:A},strokeWidth:{number:w},strokeColor:{string:A},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:w},multi:{boolean:I,string:A},bold:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},boldital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},ital:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},mono:{color:{string:A},size:{number:w},face:{string:A},mod:{string:A},vadjust:{number:w},__type__:{object:H,string:A}},__type__:{object:H,string:A}},hidden:{boolean:I},hoverWidth:{function:"function",number:w},label:{string:A,undefined:"undefined"},labelHighlightBold:{boolean:I},length:{number:w,undefined:"undefined"},physics:{boolean:I},scaling:{min:{number:w},max:{number:w},label:{enabled:{boolean:I},min:{number:w},max:{number:w},maxVisible:{number:w},drawThreshold:{number:w},__type__:{object:H,boolean:I}},customScalingFunction:{function:"function"},__type__:{object:H}},selectionWidth:{function:"function",number:w},selfReferenceSize:{number:w},selfReference:{size:{number:w},angle:{number:w},renderBehindTheNode:{boolean:I},__type__:{object:H}},shadow:{enabled:{boolean:I},color:{string:A},size:{number:w},x:{number:w},y:{number:w},__type__:{object:H,boolean:I}},smooth:{enabled:{boolean:I},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:w},forceDirection:{string:["horizontal","vertical","none"],boolean:I},__type__:{object:H,boolean:I}},title:{string:A,undefined:"undefined"},width:{number:w},widthConstraint:{maximum:{number:w},__type__:{object:H,boolean:I,number:w}},value:{number:w,undefined:"undefined"},__type__:{object:H}},groups:{useDefaultGroups:{boolean:I},__any__:$d,__type__:{object:H}},interaction:{dragNodes:{boolean:I},dragView:{boolean:I},hideEdgesOnDrag:{boolean:I},hideEdgesOnZoom:{boolean:I},hideNodesOnDrag:{boolean:I},hover:{boolean:I},keyboard:{enabled:{boolean:I},speed:{x:{number:w},y:{number:w},zoom:{number:w},__type__:{object:H}},bindToWindow:{boolean:I},autoFocus:{boolean:I},__type__:{object:H,boolean:I}},multiselect:{boolean:I},navigationButtons:{boolean:I},selectable:{boolean:I},selectConnectedEdges:{boolean:I},hoverConnectedEdges:{boolean:I},tooltipDelay:{number:w},zoomView:{boolean:I},zoomSpeed:{number:w},__type__:{object:H}},layout:{randomSeed:{undefined:"undefined",number:w,string:A},improvedLayout:{boolean:I},clusterThreshold:{number:w},hierarchical:{enabled:{boolean:I},levelSeparation:{number:w},nodeSpacing:{number:w},treeSpacing:{number:w},blockShifting:{boolean:I},edgeMinimization:{boolean:I},parentCentralization:{boolean:I},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:H,boolean:I}},__type__:{object:H}},manipulation:{enabled:{boolean:I},initiallyActive:{boolean:I},addNode:{boolean:I,function:"function"},addEdge:{boolean:I,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:H,boolean:I,function:"function"}},deleteNode:{boolean:I,function:"function"},deleteEdge:{boolean:I,function:"function"},controlNodeStyle:$d,__type__:{object:H,boolean:I}},nodes:$d,physics:{enabled:{boolean:I},barnesHut:{theta:{number:w},gravitationalConstant:{number:w},centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},forceAtlas2Based:{theta:{number:w},gravitationalConstant:{number:w},centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},repulsion:{centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},nodeDistance:{number:w},damping:{number:w},__type__:{object:H}},hierarchicalRepulsion:{centralGravity:{number:w},springLength:{number:w},springConstant:{number:w},nodeDistance:{number:w},damping:{number:w},avoidOverlap:{number:w},__type__:{object:H}},maxVelocity:{number:w},minVelocity:{number:w},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:I},iterations:{number:w},updateInterval:{number:w},onlyDynamicEdges:{boolean:I},fit:{boolean:I},__type__:{object:H,boolean:I}},timestep:{number:w},adaptiveTimestep:{boolean:I},wind:{x:{number:w},y:{number:w},__type__:{object:H}},__type__:{object:H,boolean:I}},autoResize:{boolean:I},clickToUse:{boolean:I},locale:{string:A},locales:{__any__:{any:Ipe},__type__:{object:H}},height:{string:A},width:{string:A},__type__:{object:H}},QT={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:["color","#2B7CE9"],background:["color","#97C2FC"],highlight:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]},hover:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[0,0,50,1],strokeColor:["color","#ffffff"]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:["ellipse","box","circle","database","diamond","dot","square","star","text","triangle","triangleDown","hexagon"],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:["color","#848484"],highlight:["color","#848484"],hover:["color","#848484"],inherit:["from","to","both",!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[2,0,50,1],strokeColor:["color","#ffffff"],align:["horizontal","top","middle","bottom"]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"],forceDirection:["horizontal","vertical","none"],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:["UD","DU","LR","RL"],sortMethod:["hubsize","directed"],shakeTowards:["leaves","roots"]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0,autoFocus:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:["barnesHut","forceAtlas2Based","repulsion","hierarchicalRepulsion"],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},Ppe=function(r,e,t){var n;return!!(hi(r).call(r,"physics")&&hi(n=QT.physics.solver).call(n,e)&&t.physics.solver!==e&&e!=="wind")},xpe=function(){function i(){N(this,i)}return M(i,[{key:"getDistances",value:function(e,t,n){for(var a={},o=e.edges,s=0;s2&&arguments[2]!==void 0?arguments[2]:!1,a=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(a),this._createK_matrix(a),this._createE_matrix();for(var o=.01,s=1,u=0,l=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),h=5,c=1e9,d=0,f=0,v=0,p=0,g=0;c>o&&us&&gy.type==="downstream_subgraph_search")?.data||[],f=y=>{const m=y.json.nodes.map(b=>({id:b.id,label:b.type,color:{background:"#2B7CE9",border:"#1B5BB1"},font:{size:16,color:"#FFFFFF",face:"arial",bold:!0},margin:12,padding:10,shape:"box",widthConstraint:{minimum:100,maximum:200}})),$=y.json.links.map(b=>({from:b.origin_id,to:b.target_id,arrows:{to:{enabled:!0,scaleFactor:1.2}},color:"#000000",width:2}));return{nodes:m,edges:$}};We.useEffect(()=>()=>{c.current&&(c.current.destroy(),c.current=null)},[]);const v=We.useCallback((y,m)=>{c.current&&c.current.destroy();const $=f(m),b=new z(y,$,{nodes:{shape:"box",margin:12,padding:10,font:{size:16,color:"#FFFFFF",face:"arial",bold:!0},borderWidth:2,shadow:{enabled:!0,color:"rgba(0,0,0,0.2)",size:5}},edges:{arrows:"to",color:"#000000",width:2,smooth:{enabled:!0,type:"straightCross"}},physics:{enabled:!0,solver:"hierarchicalRepulsion",hierarchicalRepulsion:{nodeDistance:200,springLength:200}},layout:{hierarchical:{enabled:!0,direction:"UD",sortMethod:"directed",nodeSpacing:200,levelSeparation:150}},interaction:{dragNodes:!1,zoomView:!1,dragView:!1}});c.current=b},[]),p=async y=>{console.log("[DownstreamSubgraphs] Starting checkAndLoadSubgraph with node:",y),ai.trackEvent({event_type:"subgraph_accept",message_type:"subgraph",message_id:u.message_id,data:{subgraph_name:y.name,subgraph_tags:y.tags}});const m=y.json.nodes,$=Object.values(Mt.canvas.selected_nodes)[0];if(!$){console.warn("[DownstreamSubgraphs] No node selected"),alert("Please select a upstream node first before adding a subgraph.");return}const b=m.map(D=>D.type),O=s;console.log("[DownstreamSubgraphs] Required node types:",b),console.log("[DownstreamSubgraphs] Installed node types:",O);const _=b.filter(D=>!O.includes(D));if(console.log("[DownstreamSubgraphs] Missing node types:",_),_.length>0)try{console.log("[DownstreamSubgraphs] Fetching info for missing nodes");const D=await ai.batchGetNodeInfo(_);console.log("[DownstreamSubgraphs] Received node infos:",D);const R={text:"",ext:[{type:"node_install_guide",data:D.map(B=>({name:B.name,repository_url:B.github_url}))}]};console.log("[DownstreamSubgraphs] Created message content:",R);const P={id:dr(),role:"ai",content:JSON.stringify(R),format:"markdown",name:"Assistant",metadata:{pendingSubgraph:y}};console.log("[DownstreamSubgraphs] Created AI message:",P),t?.(P);return}catch(D){console.error("[DownstreamSubgraphs] Error fetching node info:",D),alert("Error checking required nodes. Please try again.");return}console.log("[DownstreamSubgraphs] All required nodes are installed, proceeding to load subgraph"),g(y,$)},g=(y,m)=>{const $=y.json.nodes,b=y.json.links,O=$.find(R=>R.id===0),_=O?.id;console.log("[DownstreamSubgraphs] Entry node ID:",_);const D={};_!==null&&(D[_]=m),Mt.canvas.emitBeforeChange();try{for(const R of $)if(R.id!==_){const P=O?.pos,B=[m._pos[0],m._pos[1]],j=[R.pos[0]+B[0]-P[0],R.pos[1]+B[1]-P[1]];D[R.id]=X$(R.type,{pos:j})}for(const R of b){const P=D[R.origin_id],B=D[R.target_id];P&&B&&P.connect(R.origin_slot,B,R.target_slot)}}finally{Mt.canvas.emitAfterChange()}};return We.useEffect(()=>{const y=()=>{const m=Mt.canvas.selected_nodes;Object.keys(m??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values(m)}):a({type:"SET_SELECTED_NODE",payload:null})};return document.addEventListener("click",y),()=>{document.removeEventListener("click",y)}},[]),S.jsx("div",{className:"rounded-lg bg-gray-500 p-3 text-gray-700 text-xs break-words overflow-visible",children:d.length>0&&S.jsx("div",{className:"space-y-3",children:S.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(y=>S.jsxs("div",{className:"relative group",children:[S.jsx("button",{className:`px-3 py-1.5 bg-blue-500 text-white rounded-md hover:bg-blue-600 transition-colors text-xs`,onClick:()=>p(y),onMouseEnter:()=>h(y.name),onMouseLeave:()=>h(null),children:y.name}),S.jsxs("p",{className:"text-xs ml-3 text-white",children:["[",y.tags.join(", "),"]"]}),l===y.name&&S.jsx("div",{className:`fixed -translate-y-full z-[9999] w-[500px] p-4 bg-gray-800 text-white text-xs - rounded-md shadow-lg mb-2 border border-gray-700`,style:{left:"calc(var(--mouse-x, 0) + 16px)",top:"calc(var(--mouse-y, 0) - 8px)"},children:S.jsx("div",{style:{width:"100%",height:"300px"},ref:m=>{m&&v(m,y)}})})]},y.name))})})})}const Wpe=Object.freeze(Object.defineProperty({__proto__:null,DownstreamSubgraphs:Dpe},Symbol.toStringTag,{value:"Module"}));function Rpe({content:i,onLoadSubgraph:r}){const n=(JSON.parse(i).ext?.find(a=>a.type==="node_install_guide")?.data||[]).reduce((a,o)=>(a.some(s=>s.name===o.name)||a.push(o),a),[]);return S.jsxs("div",{children:[S.jsx("p",{children:"Before loading the graph to canvas, the following nodes need to be installed. Please visit the corresponding GitHub repositories to install them:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:n.map((a,o)=>S.jsx("div",{className:`w-full p-3 rounded-lg border border-gray-200 + rounded-md shadow-lg mb-2 border border-gray-700`,style:{left:"calc(var(--mouse-x, 0) + 16px)",top:"calc(var(--mouse-y, 0) - 8px)"},children:S.jsx("div",{style:{width:"100%",height:"300px"},ref:m=>{m&&v(m,y)}})})]},y.name))})})})}const Vpe=Object.freeze(Object.defineProperty({__proto__:null,DownstreamSubgraphs:Ape},Symbol.toStringTag,{value:"Module"}));function Dpe({content:i,onLoadSubgraph:r}){const n=(JSON.parse(i).ext?.find(a=>a.type==="node_install_guide")?.data||[]).reduce((a,o)=>(a.some(s=>s.name===o.name)||a.push(o),a),[]);return S.jsxs("div",{children:[S.jsx("p",{children:"Before loading the graph to canvas, the following nodes need to be installed. Please visit the corresponding GitHub repositories to install them:"}),S.jsx("div",{className:"grid grid-cols-2 gap-3",children:n.map((a,o)=>S.jsx("div",{className:`w-full p-3 rounded-lg border border-gray-200 hover:shadow-sm transition-all duration-200`,children:S.jsxs("div",{className:"flex flex-col",children:[S.jsx("h3",{className:"text-[12px] font-medium text-gray-800 mb-4",children:a.name}),S.jsx("div",{className:"flex justify-end",children:a.repository_url?S.jsxs("a",{href:a.repository_url,target:"_blank",rel:"noopener noreferrer",className:`px-2 py-1 text-gray-900 rounded-md border border-gray-900 hover:bg-gray-100 transition-colors text-[10px] flex items-center gap-1`,children:[S.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download"]}):S.jsxs("a",{href:`https://www.google.com/search?q=${encodeURIComponent(a.name+" comfyui custom node")}`,target:"_blank",rel:"noopener noreferrer",className:`px-2 py-1 bg-gray-100 text-gray-500 rounded-md border border-gray-300 text-[10px] flex items-center gap-1`,children:[S.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 21h7a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v11m0 5l4.879-4.879m0 0a3 3 0 104.243-4.242 3 3 0 00-4.243 4.242z"})}),"Search on Google"]})})]})},o))}),S.jsx("p",{className:"mt-4"}),S.jsx("p",{children:"After installation, please click the continue loading graph button to load the graph to the canvas:"}),S.jsx("div",{className:"mt-4",children:S.jsx("button",{className:`px-3 py-2 bg-blue-500 text-white rounded-md - hover:bg-blue-600 transition-colors text-xs block mx-auto`,onClick:r,children:"Loading graph directly"})})]})}const Upe=Object.freeze(Object.defineProperty({__proto__:null,NodeInstallGuide:Rpe},Symbol.toStringTag,{value:"Module"}));export{Hpe as A,Y$ as B,Fpe as C,Wpe as D,FI as M,Vpe as N,zpe as U,ai as W,Mt as a,X$ as b,oI as c,Upe as d,jpe as f,dr as g,uI as u,Lpe as v,Bpe as w}; + hover:bg-blue-600 transition-colors text-xs block mx-auto`,onClick:r,children:"Loading graph directly"})})]})}const Wpe=Object.freeze(Object.defineProperty({__proto__:null,NodeInstallGuide:Dpe},Symbol.toStringTag,{value:"Module"}));export{zpe as A,Y$ as B,Bpe as C,Vpe as D,BI as M,Hpe as N,Lpe as U,ai as W,Mt as a,X$ as b,oI as c,Wpe as d,Fpe as f,dr as g,uI as u,jpe as v,Mpe as w}; diff --git a/dist/copilot_web/vendor-markdown-Dek94WS0.js b/dist/copilot_web/vendor-markdown-Dek94WS0.js index e939edf..fa51a6a 100644 --- a/dist/copilot_web/vendor-markdown-Dek94WS0.js +++ b/dist/copilot_web/vendor-markdown-Dek94WS0.js @@ -1,3 +1,13 @@ +function getImportPath(filename) { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return `${apiBase.substring(1)}/copilot_web/${filename}`; + } else { + // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) + return `./${filename}`; + } +} import{r as so,c as ri,g as oo}from"./vendor-react-V04_Axys.js";var $a={exports:{}},tn={};/** * @license React * react-jsx-runtime.production.min.js diff --git a/dist/copilot_web/vendor-react-V04_Axys.js b/dist/copilot_web/vendor-react-V04_Axys.js index 8327c86..9bf591a 100644 --- a/dist/copilot_web/vendor-react-V04_Axys.js +++ b/dist/copilot_web/vendor-react-V04_Axys.js @@ -1,3 +1,13 @@ +function getImportPath(filename) { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return `${apiBase.substring(1)}/copilot_web/${filename}`; + } else { + // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) + return `./${filename}`; + } +} var vd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ja(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Uo={exports:{}},T={};/** * @license React * react.production.min.js diff --git a/dist/copilot_web/vendor-ui-Dzvx2fKw.js b/dist/copilot_web/vendor-ui-Dzvx2fKw.js index e7af5f5..0b12335 100644 --- a/dist/copilot_web/vendor-ui-Dzvx2fKw.js +++ b/dist/copilot_web/vendor-ui-Dzvx2fKw.js @@ -1 +1,11 @@ +function getImportPath(filename) { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return `${apiBase.substring(1)}/copilot_web/${filename}`; + } else { + // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) + return `./${filename}`; + } +} import"./vendor-react-V04_Axys.js"; diff --git a/dist/copilot_web/workflowChat-CIPsWdia.js b/dist/copilot_web/workflowChat-DztaEqXX.js similarity index 87% rename from dist/copilot_web/workflowChat-CIPsWdia.js rename to dist/copilot_web/workflowChat-DztaEqXX.js index 384676f..92d7cb0 100644 --- a/dist/copilot_web/workflowChat-CIPsWdia.js +++ b/dist/copilot_web/workflowChat-DztaEqXX.js @@ -1,5 +1,24 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-WINGBPvy.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DHp7C_am.js","copilot_web/ParameterDebugInterfaceV2-DfZJN3da.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"])))=>i.map(i=>d[i]); -import{_ as Ot}from"./input.js";import{j as h,r as xg,b as yg}from"./vendor-markdown-Dek94WS0.js";import{r as I,R as wn,c as Rt}from"./vendor-react-V04_Axys.js";import{f as wg,v as bg,W as ft,a as fn,B as Sg,U as Ag,A as Er,b as Eg,g as en,c as Mt,u as ts,M as Ig}from"./message-components-DHp7C_am.js";/** +function getImportPath(filename) { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return `${apiBase.substring(1)}/copilot_web/${filename}`; + } else { + // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) + return `./${filename}`; + } +} +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-Ci2jcBGf.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return `${apiBase.substring(1)}/${path}`; + } else { + // 没有 API base 时,使用相对路径 + return `./${path}`; + } + }))))=>i.map(i=>d[i]); +import{_ as Ot}from"./input.js";import{j as h,r as xg,b as yg}from"./vendor-markdown-Dek94WS0.js";import{r as I,R as wn,c as Rt}from"./vendor-react-V04_Axys.js";import{f as wg,v as bg,W as ft,a as fn,B as Sg,U as Ag,A as Er,b as Eg,g as en,c as Mt,u as ts,M as Ig}from"./message-components-BQDbTDiL.js";/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. @@ -100,7 +119,7 @@ ${de.join(` hover:bg-gray-50`,children:"Close"})})]})})]})}function Hg(m){const b=m[0],a=new Set;function U(M,E){if(!(!M||E>=1)&&M.inputs)for(const W of Object.values(M.inputs)){const re=W.link;if(re&&fn.graph.links[re]){const y=fn.graph.links[re].origin_id,q=fn.graph._nodes_by_id[y];q&&(a.add(q.type),U(q,E+1))}}}return b?(U(b,0),[{type:"upstream_node_types",data:Array.from(a)}]):null}function qg({nodeInfo:m,onSendWithIntent:b,loading:a,onSendWithContent:U}){return console.log("SelectedNodeInfo nodeInfo:",m[0]),h.jsx("div",{className:"mb-3 p-3 rounded-md bg-gray-50 border border-gray-200",children:h.jsxs("div",{className:"text-sm text-gray-700",children:[h.jsxs("p",{children:["Selected node: ",m[0].type]}),h.jsxs("div",{className:"flex gap-2 mt-2",children:[h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-blue-50 text-blue-700 hover:bg-blue-100`,onClick:()=>U(`Reply in ${navigator.language} language: How does the ${m[0].type} node work? I need its official usage guide.`),disabled:a,children:"Usage"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-green-100 text-green-700 hover:bg-green-200`,onClick:()=>U(`Reply in ${navigator.language} language: Show me the technical specifications for the ${m[0].type} node's inputs and outputs.`),disabled:a,children:"Parameters"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-purple-100 - text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import("./WorkflowOption-WINGBPvy.js"),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import("./message-components-DHp7C_am.js").then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import("./message-components-DHp7C_am.js").then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import("./message-components-DHp7C_am.js").then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** + text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import(getImportPath("WorkflowOption-Ci2jcBGf.js")),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors @@ -126,4 +145,4 @@ __p += '`),z&&(v+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+v+`return __p -}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import("./ParameterDebugInterfaceV2-DfZJN3da.js"),__vite__mapDeps([4,1,2,3,5,6,7])).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w}; +}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import(getImportPath("ParameterDebugInterfaceV2-xZYi4DyT.js")),__vite__mapDeps([4,1,2,3,5,6,7])).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w}; diff --git a/ui/scripts/post-build.js b/ui/scripts/post-build.js index 919fd72..2594668 100644 --- a/ui/scripts/post-build.js +++ b/ui/scripts/post-build.js @@ -2,7 +2,7 @@ * @Author: ai-business-hql qingli.hql@alibaba-inc.com * @Date: 2025-02-17 20:53:45 * @LastEditors: ai-business-hql qingli.hql@alibaba-inc.com - * @LastEditTime: 2025-06-04 19:22:30 + * @LastEditTime: 2025-06-04 20:11:49 * @FilePath: /comfyui_copilot/ui/scripts/post-build.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -16,72 +16,81 @@ import { dirname } from 'path'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); -// 在 dist/copilot_web 目录下查找包含 __vite__mapDeps 的 JS 文件 +// 在 dist/copilot_web 目录下查找所有 JS 文件 const distDir = path.resolve(__dirname, '../../dist/copilot_web'); -const files = glob.sync(`${distDir}/**/App-*.js`); +const files = glob.sync(`${distDir}/**/*.js`); files.forEach(file => { console.log('start modify', file) let content = fs.readFileSync(file, 'utf-8'); + // 检查是否已经有 getImportPath 函数(function 或 const 形式) + if (!content.includes('getImportPath')) { + content = `function getImportPath(filename) { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return \`\${apiBase.substring(1)}/copilot_web/\${filename}\`; + } else { + // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) + return \`./\${filename}\`; + } +} +` + content; + } + if (content.includes('__vite__mapDeps')) { - // 提取新格式的依赖数组,使用非贪婪匹配 - const depsMatch = content.match(/const __vite__mapDeps=\(.*?m\.f=\[(.*?)\]/); + // 尝试两种不同的格式 + let depsMatch = content.match(/const __vite__mapDeps=\(.*?m\.f=\[(.*?)\]/); + + // 如果第一种格式不匹配,尝试第二种格式(用于 input.js) + if (!depsMatch) { + depsMatch = content.match(/const __vite__mapDeps=\(.*?m\.f\|\|\(m\.f=\[(.*?)\]\)\)\)/); + } + if (depsMatch && depsMatch[1]) { const originalDeps = depsMatch[1]; // 如果文件中还没有路径转换逻辑,则添加 - if (!content.includes('window.comfyAPI?.api?.api?.api_base')) { + if (!content.includes('.map(path =>')) { + // 替换整个 __vite__mapDeps 函数,处理两种可能的格式 content = content.replace( - /const __vite__mapDeps=.*?\)=>i\.map\(i=>d\[i\]\);/, + /const __vite__mapDeps=\([^;]+\);/, `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[${originalDeps}].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; - const prefix = apiBase ? \`\${apiBase.substring(1)}/\` : ''; - return \`\${prefix}\${path}\`; + if (apiBase) { + // 有 API base 时,使用完整路径 + return \`\${apiBase.substring(1)}/\${path}\`; + } else { + // 没有 API base 时,使用相对路径 + return \`./\${path}\`; + } }))))=>i.map(i=>d[i]);` ); - } else { - // 如果已经有路径转换逻辑,只替换依赖数组部分 - content = content.replace( - /const __vite__mapDeps=\(.*?\)=>i\.map\(i=>d\[i\]\);/, - `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[${originalDeps}])))=>i.map(i=>d[i]);` - ); } - - fs.writeFileSync(file, content, 'utf-8'); - console.log(`Modified ${path.basename(file)}`); + console.log(`Modified ${path.basename(file)} - __vite__mapDeps`); } else { console.log(`No deps pattern found in ${path.basename(file)}`); } - } - - // 处理直接的 import() 调用 - if (content.includes('import("./')) { - // 添加路径转换函数(如果还没有) - if (!content.includes('function getImportPath')) { - const pathTransformFunction = ` -const getImportPath = (relativePath) => { - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase) { - // 有 API base 时,使用绝对路径 - const prefix = apiBase.substring(1); // 移除开头的 / - return \`/\${prefix}/copilot_web/\${relativePath}\`; } else { - // 没有 API base 时,使用相对路径 - return \`./\${relativePath}\`; + console.log(`No __vite__mapDeps found in ${path.basename(file)}`); } -};`; - content = pathTransformFunction + content; - } - - // 替换所有直接的 import() 调用,保留相对路径前缀 - content = content.replace(/import\("\.\/([^"]+)"\)/g, 'import(getImportPath("$1"))'); - - fs.writeFileSync(file, content, 'utf-8'); - console.log(`Modified direct import() calls in ${path.basename(file)}`); + + // 处理 import("filename") 形式的动态导入 + const dynamicImportPattern = /import\("([^"]+\.js)"\)/g; + if (dynamicImportPattern.test(content)) { + content = content.replace(dynamicImportPattern, (match, filename) => { + // 只处理相对路径的导入 + if (filename.startsWith('./') || !filename.includes('/')) { + const cleanFilename = filename.startsWith('./') ? filename.substring(2) : filename; + return `import(getImportPath("${cleanFilename}"))`; + } + return match; + }); } - - if (!content.includes('__vite__mapDeps') && !content.includes('import("./')) { - console.log(`No __vite__mapDeps or direct imports found in ${path.basename(file)}`); - } -}); \ No newline at end of file + + fs.writeFileSync(file, content, 'utf-8'); + console.log(`Modified ${path.basename(file)}`); +}); + +// 不需要单独处理 input.js,因为它已经在上面的循环中被处理了 \ No newline at end of file From 864fd4c4c7e747b8593e4050a7844164778601c4 Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Thu, 5 Jun 2025 11:19:27 +0800 Subject: [PATCH 09/14] importPath change --- dist/copilot_web/App-Bjq6Zxw-.js | 13 ++------- .../ParameterDebugInterfaceV2-xZYi4DyT.js | 13 ++------- dist/copilot_web/WorkflowOption-Ci2jcBGf.js | 13 ++------- dist/copilot_web/input.js | 13 ++------- .../message-components-BQDbTDiL.js | 13 ++------- dist/copilot_web/vendor-markdown-Dek94WS0.js | 13 ++------- dist/copilot_web/vendor-react-V04_Axys.js | 13 ++------- dist/copilot_web/vendor-ui-Dzvx2fKw.js | 13 ++------- dist/copilot_web/workflowChat-DztaEqXX.js | 13 ++------- ui/scripts/post-build.js | 28 +++++++++++-------- 10 files changed, 44 insertions(+), 101 deletions(-) diff --git a/dist/copilot_web/App-Bjq6Zxw-.js b/dist/copilot_web/App-Bjq6Zxw-.js index cceb5c1..ef46665 100644 --- a/dist/copilot_web/App-Bjq6Zxw-.js +++ b/dist/copilot_web/App-Bjq6Zxw-.js @@ -1,14 +1,7 @@ function getImportPath(filename) { - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase) { - // 有 API base 时,使用完整路径 - return `${apiBase.substring(1)}/copilot_web/${filename}`; - } else { - // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) - return `./${filename}`; - } -} -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-DztaEqXX.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { + return `./${filename}`; + } + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-DztaEqXX.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 diff --git a/dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js b/dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js index 0820ff3..a404c07 100644 --- a/dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js +++ b/dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js @@ -1,14 +1,7 @@ function getImportPath(filename) { - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase) { - // 有 API base 时,使用完整路径 - return `${apiBase.substring(1)}/copilot_web/${filename}`; - } else { - // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) - return `./${filename}`; - } -} -import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-BQDbTDiL.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-DztaEqXX.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white + return `./${filename}`; + } + import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-BQDbTDiL.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-DztaEqXX.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white bg-gray-50 dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-400 diff --git a/dist/copilot_web/WorkflowOption-Ci2jcBGf.js b/dist/copilot_web/WorkflowOption-Ci2jcBGf.js index aa78132..14c0031 100644 --- a/dist/copilot_web/WorkflowOption-Ci2jcBGf.js +++ b/dist/copilot_web/WorkflowOption-Ci2jcBGf.js @@ -1,11 +1,4 @@ function getImportPath(filename) { - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase) { - // 有 API base 时,使用完整路径 - return `${apiBase.substring(1)}/copilot_web/${filename}`; - } else { - // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) - return `./${filename}`; - } -} -import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-BQDbTDiL.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; + return `./${filename}`; + } + import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-BQDbTDiL.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; diff --git a/dist/copilot_web/input.js b/dist/copilot_web/input.js index c219db7..6d0552c 100644 --- a/dist/copilot_web/input.js +++ b/dist/copilot_web/input.js @@ -1,14 +1,7 @@ function getImportPath(filename) { - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase) { - // 有 API base 时,使用完整路径 - return `${apiBase.substring(1)}/copilot_web/${filename}`; - } else { - // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) - return `./${filename}`; - } -} -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-Bjq6Zxw-.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/fonts.css"].map(path => { + return `./${filename}`; + } + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-Bjq6Zxw-.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 diff --git a/dist/copilot_web/message-components-BQDbTDiL.js b/dist/copilot_web/message-components-BQDbTDiL.js index 880ba81..9cfbfeb 100644 --- a/dist/copilot_web/message-components-BQDbTDiL.js +++ b/dist/copilot_web/message-components-BQDbTDiL.js @@ -1,14 +1,7 @@ function getImportPath(filename) { - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase) { - // 有 API base 时,使用完整路径 - return `${apiBase.substring(1)}/copilot_web/${filename}`; - } else { - // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) - return `./${filename}`; - } -} -import{r as We,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Mpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=We.createContext({state:W$,dispatch:()=>null});function Bpe({children:i}){const[r,e]=We.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=We.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const Ff={apiBaseUrl:"https://comfyui-copilot-server-pre.onrender.com"};function dr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var lI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return lI.charAt(i)}function hI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function cI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function dI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,fI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f + return `./${filename}`; + } + import{r as We,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Mpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=We.createContext({state:W$,dispatch:()=>null});function Bpe({children:i}){const[r,e]=We.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=We.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const Ff={apiBaseUrl:"https://comfyui-copilot-server-pre.onrender.com"};function dr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var lI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return lI.charAt(i)}function hI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function cI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function dI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,fI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f \r  \u2028\u2029`;for(pn={},r=0;r<16;++r)pn[e.charAt(r)]=r;for(e=e.toLowerCase(),r=10;r<16;++r)pn[e.charAt(r)]=r;for(r=0;r=2?(n[n.length]=a,a=0,o=0):a<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},Ii,wd={decode:function(i){var r;if(Ii===void 0){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=`= \f \r  \u2028\u2029`;for(Ii=Object.create(null),r=0;r<64;++r)Ii[e.charAt(r)]=r;for(Ii["-"]=62,Ii._=63,r=0;r=4?(n[n.length]=a>>16,n[n.length]=a>>8&255,n[n.length]=a&255,a=0,o=0):a<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=a>>10;break;case 3:n[n.length]=a>>16,n[n.length]=a>>8&255;break}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(i){var r=wd.re.exec(i);if(r)if(r[1])i=r[1];else if(r[2])i=r[2];else throw new Error("RegExp out of sync");return wd.decode(i)}},gn=1e13,Ua=function(){function i(r){this.buf=[+r||0]}return i.prototype.mulAdd=function(r,e){var t=this.buf,n=t.length,a,o;for(a=0;a0&&(t[a]=e)},i.prototype.sub=function(r){var e=this.buf,t=e.length,n,a;for(n=0;n=0;--n)t+=(gn+e[n]).toString().substring(1);return t},i.prototype.valueOf=function(){for(var r=this.buf,e=0,t=r.length-1;t>=0;--t)e=e*gn+r[t];return e},i.prototype.simplify=function(){var r=this.buf;return r.length==1?r[0]:this},i}(),G$="…",vI=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,pI=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Wn(i,r){return i.length>r&&(i=i.substring(0,r)+G$),i}var nh=function(){function i(r,e){this.hexDigits="0123456789ABCDEF",r instanceof i?(this.enc=r.enc,this.pos=r.pos):(this.enc=r,this.pos=e)}return i.prototype.get=function(r){if(r===void 0&&(r=this.pos++),r>=this.enc.length)throw new Error("Requesting byte offset ".concat(r," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(r):this.enc[r]},i.prototype.hexByte=function(r){return this.hexDigits.charAt(r>>4&15)+this.hexDigits.charAt(r&15)},i.prototype.hexDump=function(r,e,t){for(var n="",a=r;a176)return!1}return!0},i.prototype.parseStringISO=function(r,e){for(var t="",n=r;n191&&a<224?t+=String.fromCharCode((a&31)<<6|this.get(n++)&63):t+=String.fromCharCode((a&15)<<12|(this.get(n++)&63)<<6|this.get(n++)&63)}return t},i.prototype.parseStringBMP=function(r,e){for(var t="",n,a,o=r;o127,a=n?255:0,o,s="";t==a&&++r4){for(s=t,o<<=3;!((+s^a)&128);)s=+s<<1,--o;s="("+o+` bit) diff --git a/dist/copilot_web/vendor-markdown-Dek94WS0.js b/dist/copilot_web/vendor-markdown-Dek94WS0.js index fa51a6a..567fb81 100644 --- a/dist/copilot_web/vendor-markdown-Dek94WS0.js +++ b/dist/copilot_web/vendor-markdown-Dek94WS0.js @@ -1,14 +1,7 @@ function getImportPath(filename) { - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase) { - // 有 API base 时,使用完整路径 - return `${apiBase.substring(1)}/copilot_web/${filename}`; - } else { - // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) - return `./${filename}`; - } -} -import{r as so,c as ri,g as oo}from"./vendor-react-V04_Axys.js";var $a={exports:{}},tn={};/** + return `./${filename}`; + } + import{r as so,c as ri,g as oo}from"./vendor-react-V04_Axys.js";var $a={exports:{}},tn={};/** * @license React * react-jsx-runtime.production.min.js * diff --git a/dist/copilot_web/vendor-react-V04_Axys.js b/dist/copilot_web/vendor-react-V04_Axys.js index 9bf591a..d830ba9 100644 --- a/dist/copilot_web/vendor-react-V04_Axys.js +++ b/dist/copilot_web/vendor-react-V04_Axys.js @@ -1,14 +1,7 @@ function getImportPath(filename) { - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase) { - // 有 API base 时,使用完整路径 - return `${apiBase.substring(1)}/copilot_web/${filename}`; - } else { - // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) - return `./${filename}`; - } -} -var vd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ja(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Uo={exports:{}},T={};/** + return `./${filename}`; + } + var vd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ja(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Uo={exports:{}},T={};/** * @license React * react.production.min.js * diff --git a/dist/copilot_web/vendor-ui-Dzvx2fKw.js b/dist/copilot_web/vendor-ui-Dzvx2fKw.js index 0b12335..189e498 100644 --- a/dist/copilot_web/vendor-ui-Dzvx2fKw.js +++ b/dist/copilot_web/vendor-ui-Dzvx2fKw.js @@ -1,11 +1,4 @@ function getImportPath(filename) { - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase) { - // 有 API base 时,使用完整路径 - return `${apiBase.substring(1)}/copilot_web/${filename}`; - } else { - // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) - return `./${filename}`; - } -} -import"./vendor-react-V04_Axys.js"; + return `./${filename}`; + } + import"./vendor-react-V04_Axys.js"; diff --git a/dist/copilot_web/workflowChat-DztaEqXX.js b/dist/copilot_web/workflowChat-DztaEqXX.js index 92d7cb0..8246a7b 100644 --- a/dist/copilot_web/workflowChat-DztaEqXX.js +++ b/dist/copilot_web/workflowChat-DztaEqXX.js @@ -1,14 +1,7 @@ function getImportPath(filename) { - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase) { - // 有 API base 时,使用完整路径 - return `${apiBase.substring(1)}/copilot_web/${filename}`; - } else { - // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) - return `./${filename}`; - } -} -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-Ci2jcBGf.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { + return `./${filename}`; + } + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-Ci2jcBGf.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 diff --git a/ui/scripts/post-build.js b/ui/scripts/post-build.js index 2594668..58fab15 100644 --- a/ui/scripts/post-build.js +++ b/ui/scripts/post-build.js @@ -2,7 +2,7 @@ * @Author: ai-business-hql qingli.hql@alibaba-inc.com * @Date: 2025-02-17 20:53:45 * @LastEditors: ai-business-hql qingli.hql@alibaba-inc.com - * @LastEditTime: 2025-06-04 20:11:49 + * @LastEditTime: 2025-06-05 11:18:48 * @FilePath: /comfyui_copilot/ui/scripts/post-build.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -25,18 +25,24 @@ files.forEach(file => { let content = fs.readFileSync(file, 'utf-8'); // 检查是否已经有 getImportPath 函数(function 或 const 形式) +// if (!content.includes('getImportPath')) { +// content = `function getImportPath(filename) { +// const apiBase = window.comfyAPI?.api?.api?.api_base; +// if (apiBase) { +// // 有 API base 时,使用完整路径 +// return \`\${apiBase.substring(1)}/copilot_web/\${filename}\`; +// } else { +// // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) +// return \`./\${filename}\`; +// } +// } +// ` + content; +// } if (!content.includes('getImportPath')) { content = `function getImportPath(filename) { - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase) { - // 有 API base 时,使用完整路径 - return \`\${apiBase.substring(1)}/copilot_web/\${filename}\`; - } else { - // 没有 API base 时,使用相对路径(因为所有文件都在同一目录) - return \`./\${filename}\`; - } -} -` + content; + return \`./\${filename}\`; + } + ` + content; } if (content.includes('__vite__mapDeps')) { From 7cdd9a730867caf4affd8c841643dbdf9ff7ab16 Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Thu, 5 Jun 2025 14:57:44 +0800 Subject: [PATCH 10/14] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96logo=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/copilot_web/App-Bjq6Zxw-.js | 14 -------------- dist/copilot_web/App-D16G0Qdi.js | 14 ++++++++++++++ ...yT.js => ParameterDebugInterfaceV2-CR1pPN4r.js} | 2 +- dist/copilot_web/fonts.css | 2 +- dist/copilot_web/input.js | 4 ++-- ...owChat-DztaEqXX.js => workflowChat-DBna2vE_.js} | 8 ++++---- ui/src/components/chat/ChatHeader.tsx | 4 ++-- ui/vite.config.ts | 2 ++ 8 files changed, 26 insertions(+), 24 deletions(-) delete mode 100644 dist/copilot_web/App-Bjq6Zxw-.js create mode 100644 dist/copilot_web/App-D16G0Qdi.js rename dist/copilot_web/{ParameterDebugInterfaceV2-xZYi4DyT.js => ParameterDebugInterfaceV2-CR1pPN4r.js} (99%) rename dist/copilot_web/{workflowChat-DztaEqXX.js => workflowChat-DBna2vE_.js} (91%) diff --git a/dist/copilot_web/App-Bjq6Zxw-.js b/dist/copilot_web/App-Bjq6Zxw-.js deleted file mode 100644 index ef46665..0000000 --- a/dist/copilot_web/App-Bjq6Zxw-.js +++ /dev/null @@ -1,14 +0,0 @@ -function getImportPath(filename) { - return `./${filename}`; - } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-DztaEqXX.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase) { - // 有 API base 时,使用完整路径 - return `${apiBase.substring(1)}/${path}`; - } else { - // 没有 API base 时,使用相对路径 - return `./${path}`; - } - }))))=>i.map(i=>d[i]); -import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-BQDbTDiL.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-DztaEqXX.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/dist/copilot_web/App-D16G0Qdi.js b/dist/copilot_web/App-D16G0Qdi.js new file mode 100644 index 0000000..afcd811 --- /dev/null +++ b/dist/copilot_web/App-D16G0Qdi.js @@ -0,0 +1,14 @@ +function getImportPath(filename) { + return `./${filename}`; + } + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./workflowChat-DBna2vE_.js","./input.js","./vendor-markdown-Dek94WS0.js","./vendor-react-V04_Axys.js","./message-components-BQDbTDiL.js","./assets/input-BFxtFr8c.css","./fonts.css"].map(path => { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return `${apiBase.substring(1)}/${path}`; + } else { + // 没有 API base 时,使用相对路径 + return `./${path}`; + } + }))))=>i.map(i=>d[i]); +import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-BQDbTDiL.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-DBna2vE_.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url).then(e=>({default:e.default})));function E(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{E as default}; diff --git a/dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js b/dist/copilot_web/ParameterDebugInterfaceV2-CR1pPN4r.js similarity index 99% rename from dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js rename to dist/copilot_web/ParameterDebugInterfaceV2-CR1pPN4r.js index a404c07..ae953d7 100644 --- a/dist/copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js +++ b/dist/copilot_web/ParameterDebugInterfaceV2-CR1pPN4r.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-BQDbTDiL.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-DztaEqXX.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white + import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-BQDbTDiL.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-DBna2vE_.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white bg-gray-50 dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-400 diff --git a/dist/copilot_web/fonts.css b/dist/copilot_web/fonts.css index aa84cae..6cda076 100644 --- a/dist/copilot_web/fonts.css +++ b/dist/copilot_web/fonts.css @@ -1 +1 @@ -@font-face{font-family:cc-font;src:url(data:application/vnd.ms-fontobject;base64,UAYAAKwFAAABAAIAAAAAAAAAAAAAAAAAAAABAJABAAAAAExQAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAK+mfMgAAAAAAAAAAAAAAAAAAAAAAAA4AaQBjAG8AbQBvAG8AbgAAAA4AUgBlAGcAdQBsAGEAcgAAABYAVgBlAHIAcwBpAG8AbgAgADEALgAwAAAADgBpAGMAbwBtAG8AbwBuAAAAAAAAAQAAAAsAgAADADBPUy8yDxIGbwAAALwAAABgY21hcBdW0ocAAAEcAAAAVGdhc3AAAAAQAAABcAAAAAhnbHlmgQuiVgAAAXgAAAHwaGVhZC4IiB0AAANoAAAANmhoZWEKSQZPAAADoAAAACRobXR4DIkAAAAAA8QAAAAUbG9jYQAoAQwAAAPYAAAADG1heHAABwCPAAAD5AAAACBuYW1lmUoJ+wAABAQAAAGGcG9zdAADAAAAAAWMAAAAIAADBEUBkAAFAAACmQLMAAAAjwKZAswAAAHrADMBCQAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAAAAAAAEAAAOkAA8D/wABAA8AAQAAAAAEAAAAAAAAAAAAAACAAAAAAAAMAAAADAAAAHAABAAMAAAAcAAMAAQAAABwABAA4AAAACgAIAAIAAgABACDpAP/9//8AAAAAACDpAP/9//8AAf/jFwQAAwABAAAAAAAAAAAAAAABAAH//wAPAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/ABocDwACMAAAlHgEXHgEXFhceATcyNz4BNz4BJy4BJy4BIyYGBw4BBwYnLgEnJicmNz4BNzYXHgEXHgEzPgE/AT4BJy4BJyYnJgYHBgcGBw4BBwYHBgcOAQcGJy4BJyYnLgE3Njc+ARceARceATM+ATc+ATc+AScuAScuAScmBw4BBwYHBhceARcWFxYXFjY3Njc+ATcDigwSChAlFCsyMWs3NzU3ZikKKQkOORUGEwoMGwgVMRpBPz5nJSQODxMSVT8+SyVDIA0mDwsSBkkKDwsXPx9ZX1+vSkouGg0NFg8QIBYeHkYnJyoeOhtPKisMHh9EOZJDEiEPBxIIChEGEiMSBhYEBigNMnY9YVlaji8uCwgNDUU3Nko/RUWJQUE3HUQNpwobDBUlESMXGBgBDQ02JwkkEBotFAcVAR4HExoJFAoKQzQ1QURGR28hIAcEFRMHJAEVB0gKEw4cKhAvBwY5PT1XMzc3bzY2MCIcGyUJCQMCDg0nRkefTU40LBQaBxMLBA8BEwYSJRIGFQsQHAkkKQQGHx92U1NiUU9OjTk6JiEMDA8aGysXQiQAAAABAAAAAAAAMp/pK18PPPUACwQAAAAAAOQxodAAAAAA5DGh0AAA/8AGhwPAAAAACAACAAAAAAAAAAEAAAPA/8AAAAaJAAAAAAaHAAEAAAAAAAAAAAAAAAAAAAAFBAAAAAAAAAAAAAAAAgAAAAaJAAAAAAAAAAoAFAAeAPgAAQAAAAUAjQABAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGljb21vb24AaQBjAG8AbQBvAG8AblZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGljb21vb24AaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AblJlZ3VsYXIAUgBlAGcAdQBsAGEAcmljb21vb24AaQBjAG8AbQBvAG8AbkZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=);src:url(data:application/vnd.ms-fontobject;base64,UAYAAKwFAAABAAIAAAAAAAAAAAAAAAAAAAABAJABAAAAAExQAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAK+mfMgAAAAAAAAAAAAAAAAAAAAAAAA4AaQBjAG8AbQBvAG8AbgAAAA4AUgBlAGcAdQBsAGEAcgAAABYAVgBlAHIAcwBpAG8AbgAgADEALgAwAAAADgBpAGMAbwBtAG8AbwBuAAAAAAAAAQAAAAsAgAADADBPUy8yDxIGbwAAALwAAABgY21hcBdW0ocAAAEcAAAAVGdhc3AAAAAQAAABcAAAAAhnbHlmgQuiVgAAAXgAAAHwaGVhZC4IiB0AAANoAAAANmhoZWEKSQZPAAADoAAAACRobXR4DIkAAAAAA8QAAAAUbG9jYQAoAQwAAAPYAAAADG1heHAABwCPAAAD5AAAACBuYW1lmUoJ+wAABAQAAAGGcG9zdAADAAAAAAWMAAAAIAADBEUBkAAFAAACmQLMAAAAjwKZAswAAAHrADMBCQAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAAAAAAAEAAAOkAA8D/wABAA8AAQAAAAAEAAAAAAAAAAAAAACAAAAAAAAMAAAADAAAAHAABAAMAAAAcAAMAAQAAABwABAA4AAAACgAIAAIAAgABACDpAP/9//8AAAAAACDpAP/9//8AAf/jFwQAAwABAAAAAAAAAAAAAAABAAH//wAPAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/ABocDwACMAAAlHgEXHgEXFhceATcyNz4BNz4BJy4BJy4BIyYGBw4BBwYnLgEnJicmNz4BNzYXHgEXHgEzPgE/AT4BJy4BJyYnJgYHBgcGBw4BBwYHBgcOAQcGJy4BJyYnLgE3Njc+ARceARceATM+ATc+ATc+AScuAScuAScmBw4BBwYHBhceARcWFxYXFjY3Njc+ATcDigwSChAlFCsyMWs3NzU3ZikKKQkOORUGEwoMGwgVMRpBPz5nJSQODxMSVT8+SyVDIA0mDwsSBkkKDwsXPx9ZX1+vSkouGg0NFg8QIBYeHkYnJyoeOhtPKisMHh9EOZJDEiEPBxIIChEGEiMSBhYEBigNMnY9YVlaji8uCwgNDUU3Nko/RUWJQUE3HUQNpwobDBUlESMXGBgBDQ02JwkkEBotFAcVAR4HExoJFAoKQzQ1QURGR28hIAcEFRMHJAEVB0gKEw4cKhAvBwY5PT1XMzc3bzY2MCIcGyUJCQMCDg0nRkefTU40LBQaBxMLBA8BEwYSJRIGFQsQHAkkKQQGHx92U1NiUU9OjTk6JiEMDA8aGysXQiQAAAABAAAAAAAAMp/pK18PPPUACwQAAAAAAOQxodAAAAAA5DGh0AAA/8AGhwPAAAAACAACAAAAAAAAAAEAAAPA/8AAAAaJAAAAAAaHAAEAAAAAAAAAAAAAAAAAAAAFBAAAAAAAAAAAAAAAAgAAAAaJAAAAAAAAAAoAFAAeAPgAAQAAAAUAjQABAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGljb21vb24AaQBjAG8AbQBvAG8AblZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGljb21vb24AaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AblJlZ3VsYXIAUgBlAGcAdQBsAGEAcmljb21vb24AaQBjAG8AbQBvAG8AbkZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format("embedded-opentype"),url(data:font/ttf;base64,AAEAAAALAIAAAwAwT1MvMg8SBm8AAAC8AAAAYGNtYXAXVtKHAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZoELolYAAAF4AAAB8GhlYWQuCIgdAAADaAAAADZoaGVhCkkGTwAAA6AAAAAkaG10eAyJAAAAAAPEAAAAFGxvY2EAKAEMAAAD2AAAAAxtYXhwAAcAjwAAA+QAAAAgbmFtZZlKCfsAAAQEAAABhnBvc3QAAwAAAAAFjAAAACAAAwRFAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpAAPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6QD//f//AAAAAAAg6QD//f//AAH/4xcEAAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAaHA8AAjAAAJR4BFx4BFxYXHgE3Mjc+ATc+AScuAScuASMmBgcOAQcGJy4BJyYnJjc+ATc2Fx4BFx4BMz4BPwE+AScuAScmJyYGBwYHBgcOAQcGBwYHDgEHBicuAScmJy4BNzY3PgEXHgEXHgEzPgE3PgE3PgEnLgEnLgEnJgcOAQcGBwYXHgEXFhcWFxY2NzY3PgE3A4oMEgoQJRQrMjFrNzc1N2YpCikJDjkVBhMKDBsIFTEaQT8+ZyUkDg8TElU/PkslQyANJg8LEgZJCg8LFz8fWV9fr0pKLhoNDRYPECAWHh5GJycqHjobTyorDB4fRDmSQxIhDwcSCAoRBhIjEgYWBAYoDTJ2PWFZWo4vLgsIDQ1FNzZKP0VFiUFBNx1EDacKGwwVJREjFxgYAQ0NNicJJBAaLRQHFQEeBxMaCRQKCkM0NUFERkdvISAHBBUTByQBFQdIChMOHCoQLwcGOT09VzM3N282NjAiHBslCQkDAg4NJ0ZHn01ONCwUGgcTCwQPARMGEiUSBhULEBwJJCkEBh8fdlNTYlFPTo05OiYhDAwPGhsrF0IkAAAAAQAAAAAAADKf6StfDzz1AAsEAAAAAADkMaHQAAAAAOQxodAAAP/ABocDwAAAAAgAAgAAAAAAAAABAAADwP/AAAAGiQAAAAAGhwABAAAAAAAAAAAAAAAAAAAABQQAAAAAAAAAAAAAAAIAAAAGiQAAAAAAAAAKABQAHgD4AAEAAAAFAI0AAQAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAOAK4AAQAAAAAAAQAHAAAAAQAAAAAAAgAHAGAAAQAAAAAAAwAHADYAAQAAAAAABAAHAHUAAQAAAAAABQALABUAAQAAAAAABgAHAEsAAQAAAAAACgAaAIoAAwABBAkAAQAOAAcAAwABBAkAAgAOAGcAAwABBAkAAwAOAD0AAwABBAkABAAOAHwAAwABBAkABQAWACAAAwABBAkABgAOAFIAAwABBAkACgA0AKRpY29tb29uAGkAYwBvAG0AbwBvAG5WZXJzaW9uIDEuMABWAGUAcgBzAGkAbwBuACAAMQAuADBpY29tb29uAGkAYwBvAG0AbwBvAG5pY29tb29uAGkAYwBvAG0AbwBvAG5SZWd1bGFyAFIAZQBnAHUAbABhAHJpY29tb29uAGkAYwBvAG0AbwBvAG5Gb250IGdlbmVyYXRlZCBieSBJY29Nb29uLgBGAG8AbgB0ACAAZwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABJAGMAbwBNAG8AbwBuAC4AAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) format("truetype"),url(data:font/woff;base64,d09GRgABAAAAAAX4AAsAAAAABawAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIGb2NtYXAAAAFoAAAAVAAAAFQXVtKHZ2FzcAAAAbwAAAAIAAAACAAAABBnbHlmAAABxAAAAfAAAAHwgQuiVmhlYWQAAAO0AAAANgAAADYuCIgdaGhlYQAAA+wAAAAkAAAAJApJBk9obXR4AAAEEAAAABQAAAAUDIkAAGxvY2EAAAQkAAAADAAAAAwAKAEMbWF4cAAABDAAAAAgAAAAIAAHAI9uYW1lAAAEUAAAAYYAAAGGmUoJ+3Bvc3QAAAXYAAAAIAAAACAAAwAAAAMERQGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA6QADwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADgAAAAKAAgAAgACAAEAIOkA//3//wAAAAAAIOkA//3//wAB/+MXBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AGhwPAAIwAACUeARceARcWFx4BNzI3PgE3PgEnLgEnLgEjJgYHDgEHBicuAScmJyY3PgE3NhceARceATM+AT8BPgEnLgEnJicmBgcGBwYHDgEHBgcGBw4BBwYnLgEnJicuATc2Nz4BFx4BFx4BMz4BNz4BNz4BJy4BJy4BJyYHDgEHBgcGFx4BFxYXFhcWNjc2Nz4BNwOKDBIKECUUKzIxazc3NTdmKQopCQ45FQYTCgwbCBUxGkE/PmclJA4PExJVPz5LJUMgDSYPCxIGSQoPCxc/H1lfX69KSi4aDQ0WDxAgFh4eRicnKh46G08qKwweH0Q5kkMSIQ8HEggKEQYSIxIGFgQGKA0ydj1hWVqOLy4LCA0NRTc2Sj9FRYlBQTcdRA2nChsMFSURIxcYGAENDTYnCSQQGi0UBxUBHgcTGgkUCgpDNDVBREZHbyEgBwQVEwckARUHSAoTDhwqEC8HBjk9PVczNzdvNjYwIhwbJQkJAwIODSdGR59NTjQsFBoHEwsEDwETBhIlEgYVCxAcCSQpBAYfH3ZTU2JRT06NOTomIQwMDxobKxdCJAAAAAEAAAAAAAAyn+krXw889QALBAAAAAAA5DGh0AAAAADkMaHQAAD/wAaHA8AAAAAIAAIAAAAAAAAAAQAAA8D/wAAABokAAAAABocAAQAAAAAAAAAAAAAAAAAAAAUEAAAAAAAAAAAAAAACAAAABokAAAAAAAAACgAUAB4A+AABAAAABQCNAAEAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEABwAAAAEAAAAAAAIABwBgAAEAAAAAAAMABwA2AAEAAAAAAAQABwB1AAEAAAAAAAUACwAVAAEAAAAAAAYABwBLAAEAAAAAAAoAGgCKAAMAAQQJAAEADgAHAAMAAQQJAAIADgBnAAMAAQQJAAMADgA9AAMAAQQJAAQADgB8AAMAAQQJAAUAFgAgAAMAAQQJAAYADgBSAAMAAQQJAAoANACkaWNvbW9vbgBpAGMAbwBtAG8AbwBuVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwaWNvbW9vbgBpAGMAbwBtAG8AbwBuaWNvbW9vbgBpAGMAbwBtAG8AbwBuUmVndWxhcgBSAGUAZwB1AGwAYQByaWNvbW9vbgBpAGMAbwBtAG8AbwBuRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format("woff"),url(/copilot_web/assets/cc-icon-DfxqqsZi.svg?jbqswq#icomoon) format("svg");font-weight:400;font-style:normal;font-display:block;font-size:16px}[class^=cc-icon-],[class*=" cc-icon-"]{font-family:cc-font!important;speak:never;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.cc-icon-logo:before{content:"";color:#9b9d9f;font-size:18px!important} +@font-face{font-family:cc-font;src:url(data:application/vnd.ms-fontobject;base64,UAYAAKwFAAABAAIAAAAAAAAAAAAAAAAAAAABAJABAAAAAExQAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAK+mfMgAAAAAAAAAAAAAAAAAAAAAAAA4AaQBjAG8AbQBvAG8AbgAAAA4AUgBlAGcAdQBsAGEAcgAAABYAVgBlAHIAcwBpAG8AbgAgADEALgAwAAAADgBpAGMAbwBtAG8AbwBuAAAAAAAAAQAAAAsAgAADADBPUy8yDxIGbwAAALwAAABgY21hcBdW0ocAAAEcAAAAVGdhc3AAAAAQAAABcAAAAAhnbHlmgQuiVgAAAXgAAAHwaGVhZC4IiB0AAANoAAAANmhoZWEKSQZPAAADoAAAACRobXR4DIkAAAAAA8QAAAAUbG9jYQAoAQwAAAPYAAAADG1heHAABwCPAAAD5AAAACBuYW1lmUoJ+wAABAQAAAGGcG9zdAADAAAAAAWMAAAAIAADBEUBkAAFAAACmQLMAAAAjwKZAswAAAHrADMBCQAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAAAAAAAEAAAOkAA8D/wABAA8AAQAAAAAEAAAAAAAAAAAAAACAAAAAAAAMAAAADAAAAHAABAAMAAAAcAAMAAQAAABwABAA4AAAACgAIAAIAAgABACDpAP/9//8AAAAAACDpAP/9//8AAf/jFwQAAwABAAAAAAAAAAAAAAABAAH//wAPAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/ABocDwACMAAAlHgEXHgEXFhceATcyNz4BNz4BJy4BJy4BIyYGBw4BBwYnLgEnJicmNz4BNzYXHgEXHgEzPgE/AT4BJy4BJyYnJgYHBgcGBw4BBwYHBgcOAQcGJy4BJyYnLgE3Njc+ARceARceATM+ATc+ATc+AScuAScuAScmBw4BBwYHBhceARcWFxYXFjY3Njc+ATcDigwSChAlFCsyMWs3NzU3ZikKKQkOORUGEwoMGwgVMRpBPz5nJSQODxMSVT8+SyVDIA0mDwsSBkkKDwsXPx9ZX1+vSkouGg0NFg8QIBYeHkYnJyoeOhtPKisMHh9EOZJDEiEPBxIIChEGEiMSBhYEBigNMnY9YVlaji8uCwgNDUU3Nko/RUWJQUE3HUQNpwobDBUlESMXGBgBDQ02JwkkEBotFAcVAR4HExoJFAoKQzQ1QURGR28hIAcEFRMHJAEVB0gKEw4cKhAvBwY5PT1XMzc3bzY2MCIcGyUJCQMCDg0nRkefTU40LBQaBxMLBA8BEwYSJRIGFQsQHAkkKQQGHx92U1NiUU9OjTk6JiEMDA8aGysXQiQAAAABAAAAAAAAMp/pK18PPPUACwQAAAAAAOQxodAAAAAA5DGh0AAA/8AGhwPAAAAACAACAAAAAAAAAAEAAAPA/8AAAAaJAAAAAAaHAAEAAAAAAAAAAAAAAAAAAAAFBAAAAAAAAAAAAAAAAgAAAAaJAAAAAAAAAAoAFAAeAPgAAQAAAAUAjQABAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGljb21vb24AaQBjAG8AbQBvAG8AblZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGljb21vb24AaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AblJlZ3VsYXIAUgBlAGcAdQBsAGEAcmljb21vb24AaQBjAG8AbQBvAG8AbkZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=);src:url(data:application/vnd.ms-fontobject;base64,UAYAAKwFAAABAAIAAAAAAAAAAAAAAAAAAAABAJABAAAAAExQAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAK+mfMgAAAAAAAAAAAAAAAAAAAAAAAA4AaQBjAG8AbQBvAG8AbgAAAA4AUgBlAGcAdQBsAGEAcgAAABYAVgBlAHIAcwBpAG8AbgAgADEALgAwAAAADgBpAGMAbwBtAG8AbwBuAAAAAAAAAQAAAAsAgAADADBPUy8yDxIGbwAAALwAAABgY21hcBdW0ocAAAEcAAAAVGdhc3AAAAAQAAABcAAAAAhnbHlmgQuiVgAAAXgAAAHwaGVhZC4IiB0AAANoAAAANmhoZWEKSQZPAAADoAAAACRobXR4DIkAAAAAA8QAAAAUbG9jYQAoAQwAAAPYAAAADG1heHAABwCPAAAD5AAAACBuYW1lmUoJ+wAABAQAAAGGcG9zdAADAAAAAAWMAAAAIAADBEUBkAAFAAACmQLMAAAAjwKZAswAAAHrADMBCQAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAAAAAAAEAAAOkAA8D/wABAA8AAQAAAAAEAAAAAAAAAAAAAACAAAAAAAAMAAAADAAAAHAABAAMAAAAcAAMAAQAAABwABAA4AAAACgAIAAIAAgABACDpAP/9//8AAAAAACDpAP/9//8AAf/jFwQAAwABAAAAAAAAAAAAAAABAAH//wAPAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/ABocDwACMAAAlHgEXHgEXFhceATcyNz4BNz4BJy4BJy4BIyYGBw4BBwYnLgEnJicmNz4BNzYXHgEXHgEzPgE/AT4BJy4BJyYnJgYHBgcGBw4BBwYHBgcOAQcGJy4BJyYnLgE3Njc+ARceARceATM+ATc+ATc+AScuAScuAScmBw4BBwYHBhceARcWFxYXFjY3Njc+ATcDigwSChAlFCsyMWs3NzU3ZikKKQkOORUGEwoMGwgVMRpBPz5nJSQODxMSVT8+SyVDIA0mDwsSBkkKDwsXPx9ZX1+vSkouGg0NFg8QIBYeHkYnJyoeOhtPKisMHh9EOZJDEiEPBxIIChEGEiMSBhYEBigNMnY9YVlaji8uCwgNDUU3Nko/RUWJQUE3HUQNpwobDBUlESMXGBgBDQ02JwkkEBotFAcVAR4HExoJFAoKQzQ1QURGR28hIAcEFRMHJAEVB0gKEw4cKhAvBwY5PT1XMzc3bzY2MCIcGyUJCQMCDg0nRkefTU40LBQaBxMLBA8BEwYSJRIGFQsQHAkkKQQGHx92U1NiUU9OjTk6JiEMDA8aGysXQiQAAAABAAAAAAAAMp/pK18PPPUACwQAAAAAAOQxodAAAAAA5DGh0AAA/8AGhwPAAAAACAACAAAAAAAAAAEAAAPA/8AAAAaJAAAAAAaHAAEAAAAAAAAAAAAAAAAAAAAFBAAAAAAAAAAAAAAAAgAAAAaJAAAAAAAAAAoAFAAeAPgAAQAAAAUAjQABAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGljb21vb24AaQBjAG8AbQBvAG8AblZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGljb21vb24AaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AblJlZ3VsYXIAUgBlAGcAdQBsAGEAcmljb21vb24AaQBjAG8AbQBvAG8AbkZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format("embedded-opentype"),url(data:font/ttf;base64,AAEAAAALAIAAAwAwT1MvMg8SBm8AAAC8AAAAYGNtYXAXVtKHAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZoELolYAAAF4AAAB8GhlYWQuCIgdAAADaAAAADZoaGVhCkkGTwAAA6AAAAAkaG10eAyJAAAAAAPEAAAAFGxvY2EAKAEMAAAD2AAAAAxtYXhwAAcAjwAAA+QAAAAgbmFtZZlKCfsAAAQEAAABhnBvc3QAAwAAAAAFjAAAACAAAwRFAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpAAPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6QD//f//AAAAAAAg6QD//f//AAH/4xcEAAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAaHA8AAjAAAJR4BFx4BFxYXHgE3Mjc+ATc+AScuAScuASMmBgcOAQcGJy4BJyYnJjc+ATc2Fx4BFx4BMz4BPwE+AScuAScmJyYGBwYHBgcOAQcGBwYHDgEHBicuAScmJy4BNzY3PgEXHgEXHgEzPgE3PgE3PgEnLgEnLgEnJgcOAQcGBwYXHgEXFhcWFxY2NzY3PgE3A4oMEgoQJRQrMjFrNzc1N2YpCikJDjkVBhMKDBsIFTEaQT8+ZyUkDg8TElU/PkslQyANJg8LEgZJCg8LFz8fWV9fr0pKLhoNDRYPECAWHh5GJycqHjobTyorDB4fRDmSQxIhDwcSCAoRBhIjEgYWBAYoDTJ2PWFZWo4vLgsIDQ1FNzZKP0VFiUFBNx1EDacKGwwVJREjFxgYAQ0NNicJJBAaLRQHFQEeBxMaCRQKCkM0NUFERkdvISAHBBUTByQBFQdIChMOHCoQLwcGOT09VzM3N282NjAiHBslCQkDAg4NJ0ZHn01ONCwUGgcTCwQPARMGEiUSBhULEBwJJCkEBh8fdlNTYlFPTo05OiYhDAwPGhsrF0IkAAAAAQAAAAAAADKf6StfDzz1AAsEAAAAAADkMaHQAAAAAOQxodAAAP/ABocDwAAAAAgAAgAAAAAAAAABAAADwP/AAAAGiQAAAAAGhwABAAAAAAAAAAAAAAAAAAAABQQAAAAAAAAAAAAAAAIAAAAGiQAAAAAAAAAKABQAHgD4AAEAAAAFAI0AAQAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAOAK4AAQAAAAAAAQAHAAAAAQAAAAAAAgAHAGAAAQAAAAAAAwAHADYAAQAAAAAABAAHAHUAAQAAAAAABQALABUAAQAAAAAABgAHAEsAAQAAAAAACgAaAIoAAwABBAkAAQAOAAcAAwABBAkAAgAOAGcAAwABBAkAAwAOAD0AAwABBAkABAAOAHwAAwABBAkABQAWACAAAwABBAkABgAOAFIAAwABBAkACgA0AKRpY29tb29uAGkAYwBvAG0AbwBvAG5WZXJzaW9uIDEuMABWAGUAcgBzAGkAbwBuACAAMQAuADBpY29tb29uAGkAYwBvAG0AbwBvAG5pY29tb29uAGkAYwBvAG0AbwBvAG5SZWd1bGFyAFIAZQBnAHUAbABhAHJpY29tb29uAGkAYwBvAG0AbwBvAG5Gb250IGdlbmVyYXRlZCBieSBJY29Nb29uLgBGAG8AbgB0ACAAZwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABJAGMAbwBNAG8AbwBuAC4AAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) format("truetype"),url(data:font/woff;base64,d09GRgABAAAAAAX4AAsAAAAABawAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIGb2NtYXAAAAFoAAAAVAAAAFQXVtKHZ2FzcAAAAbwAAAAIAAAACAAAABBnbHlmAAABxAAAAfAAAAHwgQuiVmhlYWQAAAO0AAAANgAAADYuCIgdaGhlYQAAA+wAAAAkAAAAJApJBk9obXR4AAAEEAAAABQAAAAUDIkAAGxvY2EAAAQkAAAADAAAAAwAKAEMbWF4cAAABDAAAAAgAAAAIAAHAI9uYW1lAAAEUAAAAYYAAAGGmUoJ+3Bvc3QAAAXYAAAAIAAAACAAAwAAAAMERQGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA6QADwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADgAAAAKAAgAAgACAAEAIOkA//3//wAAAAAAIOkA//3//wAB/+MXBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AGhwPAAIwAACUeARceARcWFx4BNzI3PgE3PgEnLgEnLgEjJgYHDgEHBicuAScmJyY3PgE3NhceARceATM+AT8BPgEnLgEnJicmBgcGBwYHDgEHBgcGBw4BBwYnLgEnJicuATc2Nz4BFx4BFx4BMz4BNz4BNz4BJy4BJy4BJyYHDgEHBgcGFx4BFxYXFhcWNjc2Nz4BNwOKDBIKECUUKzIxazc3NTdmKQopCQ45FQYTCgwbCBUxGkE/PmclJA4PExJVPz5LJUMgDSYPCxIGSQoPCxc/H1lfX69KSi4aDQ0WDxAgFh4eRicnKh46G08qKwweH0Q5kkMSIQ8HEggKEQYSIxIGFgQGKA0ydj1hWVqOLy4LCA0NRTc2Sj9FRYlBQTcdRA2nChsMFSURIxcYGAENDTYnCSQQGi0UBxUBHgcTGgkUCgpDNDVBREZHbyEgBwQVEwckARUHSAoTDhwqEC8HBjk9PVczNzdvNjYwIhwbJQkJAwIODSdGR59NTjQsFBoHEwsEDwETBhIlEgYVCxAcCSQpBAYfH3ZTU2JRT06NOTomIQwMDxobKxdCJAAAAAEAAAAAAAAyn+krXw889QALBAAAAAAA5DGh0AAAAADkMaHQAAD/wAaHA8AAAAAIAAIAAAAAAAAAAQAAA8D/wAAABokAAAAABocAAQAAAAAAAAAAAAAAAAAAAAUEAAAAAAAAAAAAAAACAAAABokAAAAAAAAACgAUAB4A+AABAAAABQCNAAEAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEABwAAAAEAAAAAAAIABwBgAAEAAAAAAAMABwA2AAEAAAAAAAQABwB1AAEAAAAAAAUACwAVAAEAAAAAAAYABwBLAAEAAAAAAAoAGgCKAAMAAQQJAAEADgAHAAMAAQQJAAIADgBnAAMAAQQJAAMADgA9AAMAAQQJAAQADgB8AAMAAQQJAAUAFgAgAAMAAQQJAAYADgBSAAMAAQQJAAoANACkaWNvbW9vbgBpAGMAbwBtAG8AbwBuVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwaWNvbW9vbgBpAGMAbwBtAG8AbwBuaWNvbW9vbgBpAGMAbwBtAG8AbwBuUmVndWxhcgBSAGUAZwB1AGwAYQByaWNvbW9vbgBpAGMAbwBtAG8AbwBuRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format("woff"),url(./assets/cc-icon-DfxqqsZi.svg?jbqswq#icomoon) format("svg");font-weight:400;font-style:normal;font-display:block;font-size:16px}[class^=cc-icon-],[class*=" cc-icon-"]{font-family:cc-font!important;speak:never;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.cc-icon-logo:before{content:"";color:#9b9d9f;font-size:18px!important} diff --git a/dist/copilot_web/input.js b/dist/copilot_web/input.js index 6d0552c..45c889e 100644 --- a/dist/copilot_web/input.js +++ b/dist/copilot_web/input.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-Bjq6Zxw-.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/fonts.css"].map(path => { + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-D16G0Qdi.js","./vendor-markdown-Dek94WS0.js","./vendor-react-V04_Axys.js","./message-components-BQDbTDiL.js","./fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 @@ -11,4 +11,4 @@ function getImportPath(filename) { return `./${path}`; } }))))=>i.map(i=>d[i]); -import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-BQDbTDiL.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import(getImportPath("App-Bjq6Zxw-.js"));return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; +import{j as l}from"./vendor-markdown-Dek94WS0.js";import{a as R,R as v,r as x}from"./vendor-react-V04_Axys.js";import{w as g,a as b}from"./message-components-BQDbTDiL.js";/* empty css */const C="modulepreload",S=function(e,n){return new URL(e,n).href},y={},j=function(n,d,f){let m=Promise.resolve();if(d&&d.length>0){const i=document.getElementsByTagName("link"),t=document.querySelector("meta[property=csp-nonce]"),h=t?.nonce||t?.getAttribute("nonce");m=Promise.allSettled(d.map(o=>{if(o=S(o,f),o in y)return;y[o]=!0;const s=o.endsWith(".css"),w=s?'[rel="stylesheet"]':"";if(!!f)for(let c=i.length-1;c>=0;c--){const a=i[c];if(a.href===o&&(!s||a.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${w}`))return;const r=document.createElement("link");if(r.rel=s?"stylesheet":C,s||(r.as="script"),r.crossOrigin="",r.href=o,h&&r.setAttribute("nonce",h),document.head.appendChild(r),s)return new Promise((c,a)=>{r.addEventListener("load",c),r.addEventListener("error",()=>a(new Error(`Unable to preload CSS for ${o}`)))})}))}function p(i){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=i,window.dispatchEvent(t),!t.defaultPrevented)throw i}return m.then(i=>{for(const t of i||[])t.status==="rejected"&&p(t.reason);return n().catch(p)})};var u={},E=R;u.createRoot=E.createRoot,u.hydrateRoot=E.hydrateRoot;const L=v.lazy(()=>j(async()=>{const{default:e}=await import(getImportPath("App-D16G0Qdi.js"));return{default:e}},__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(({default:e})=>({default:e})));function P(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}P().then(()=>g()).then(()=>{b.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const n=document.createElement("div");n.id="comfyui-copilot-plugin",n.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(n),u.createRoot(n).render(l.jsx(v.StrictMode,{children:l.jsx(x.Suspense,{fallback:l.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:l.jsx(L,{})})}))}})});export{j as _}; diff --git a/dist/copilot_web/workflowChat-DztaEqXX.js b/dist/copilot_web/workflowChat-DBna2vE_.js similarity index 91% rename from dist/copilot_web/workflowChat-DztaEqXX.js rename to dist/copilot_web/workflowChat-DBna2vE_.js index 8246a7b..e1717d5 100644 --- a/dist/copilot_web/workflowChat-DztaEqXX.js +++ b/dist/copilot_web/workflowChat-DBna2vE_.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-Ci2jcBGf.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/ParameterDebugInterfaceV2-xZYi4DyT.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./WorkflowOption-Ci2jcBGf.js","./vendor-markdown-Dek94WS0.js","./vendor-react-V04_Axys.js","./message-components-BQDbTDiL.js","./ParameterDebugInterfaceV2-CR1pPN4r.js","./input.js","./assets/input-BFxtFr8c.css","./fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 @@ -83,7 +83,7 @@ import{_ as Ot}from"./input.js";import{j as h,r as xg,b as yg}from"./vendor-mark focus:ring-2 focus:ring-blue-500/20 dark:focus:ring-blue-400/20 focus:outline-none`})]}),h.jsx("div",{className:"flex items-center mb-2",children:h.jsx("button",{onClick:le,disabled:he||!y.trim(),className:`px-4 py-2 rounded-lg font-medium text-xs transition-colors ${he||!y.trim()?"bg-gray-300 dark:bg-gray-600 text-gray-500 dark:text-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white"}`,children:he?h.jsxs("span",{className:"flex items-center",children:[h.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Verifying..."]}):"Verify"})}),F&&h.jsx("div",{className:`text-xs p-2 rounded-md ${F.success?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400"}`,children:F.message})]}),h.jsxs("div",{className:"flex justify-end gap-3",children:[h.jsx("button",{onClick:b,className:`px-5 py-2.5 text-gray-700 bg-white dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg font-medium transition-colors`,children:"Cancel"}),h.jsx("button",{onClick:se,className:`px-5 py-2.5 bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 - text-white rounded-lg font-medium transition-colors`,children:"Save"})]})]})}):null}const Gg="/copilot_web/assets/logo-BTZhX0BN.png";function Kg({onClose:m,onClear:b,hasMessages:a,onHeightResize:U,title:M="ComfyUI-Copilot"}){const[E,W]=I.useState(!1),[re,y]=I.useState(!1),q=()=>{W(!0)},$=P=>{localStorage.setItem("chatApiKey",P)};return I.useEffect(()=>{const P=ce=>{if(!re)return;const he=ce.movementY;U?.(he)},_e=()=>{y(!1)};return re&&(document.addEventListener("mousemove",P),document.addEventListener("mouseup",_e)),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",_e)}},[re,U]),h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:`flex items-center justify-between border-b px-3 py-2 + text-white rounded-lg font-medium transition-colors`,children:"Save"})]})]})}):null}const Gg=""+new URL("assets/logo-BTZhX0BN.png",import.meta.url).href;function Kg({onClose:m,onClear:b,hasMessages:a,onHeightResize:U,title:M="ComfyUI-Copilot"}){const[E,W]=I.useState(!1),[re,y]=I.useState(!1),q=()=>{W(!0)},$=P=>{localStorage.setItem("chatApiKey",P)};return I.useEffect(()=>{const P=ce=>{if(!re)return;const he=ce.movementY;U?.(he)},_e=()=>{y(!1)};return re&&(document.addEventListener("mousemove",P),document.addEventListener("mouseup",_e)),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",_e)}},[re,U]),h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:`flex items-center justify-between border-b px-3 py-2 bg-white border-gray-200 sticky top-2 z-10`,children:[h.jsxs("div",{className:"flex items-center space-x-1",children:[h.jsx("img",{src:Gg,alt:"ComfyUI-Copilot Logo",className:"h-7 w-7 -ml-1"}),h.jsx("h3",{className:"text-[14px] font-medium text-gray-800",children:M}),h.jsx("button",{onClick:q,className:"p-1 bg-white border-none hover:bg-gray-100 rounded text-gray-500",children:h.jsx(Wg,{className:"h-4 w-4"})})]}),h.jsx("div",{className:"flex items-center gap-1",children:h.jsx("button",{className:`inline-flex bg-white border-none items-center justify-center rounded-md p-1.5 ${a?"text-gray-500 hover:bg-gray-100":"text-gray-300 cursor-not-allowed"}`,disabled:!a,onClick:b,children:h.jsx(Ug,{className:"h-4 w-4"})})})]}),h.jsx(jg,{isOpen:E,onClose:()=>W(!1),onSave:$,initialApiKey:localStorage.getItem("chatApiKey")||""})]})}const zg=5*1024*1024,Oa=["image/jpeg","image/png","image/gif","image/webp"];function $g({input:m,loading:b,onChange:a,onSend:U,onKeyPress:M,onUploadImages:E,uploadedImages:W,onRemoveImage:re,selectedModel:y,onModelChange:q}){const[$,P]=I.useState(!1),[_e,ce]=I.useState([]),he=wn.useRef(null),ie=I.useRef(null);I.useEffect(()=>{ie.current&&(ie.current.style.height="auto",ie.current.style.height=`${Math.min(ie.current.scrollHeight,400)}px`)},[m]),I.useEffect(()=>{(async()=>{try{const de=await ft.listModels();ce(de.models)}catch(de){console.error("Failed to load models:",de),ce([{name:"gpt-4o",image_enable:!0},{name:"gpt-4o-mini",image_enable:!0},{name:"qwen-plus",image_enable:!1},{name:"DeepSeek-V3",image_enable:!1}])}})()},[]);const F=T=>{if(T.target.files){const de=[],ne=[];if(Array.from(T.target.files).forEach(le=>{Oa.includes(le.type)?le.size>zg?de.push(`${le.name} (exceeds 5MB)`):ne.push(le):de.push(`${le.name} (unsupported format)`)}),de.length>0&&alert(`The following files couldn't be uploaded: ${de.join(` @@ -112,7 +112,7 @@ ${de.join(` hover:bg-gray-50`,children:"Close"})})]})})]})}function Hg(m){const b=m[0],a=new Set;function U(M,E){if(!(!M||E>=1)&&M.inputs)for(const W of Object.values(M.inputs)){const re=W.link;if(re&&fn.graph.links[re]){const y=fn.graph.links[re].origin_id,q=fn.graph._nodes_by_id[y];q&&(a.add(q.type),U(q,E+1))}}}return b?(U(b,0),[{type:"upstream_node_types",data:Array.from(a)}]):null}function qg({nodeInfo:m,onSendWithIntent:b,loading:a,onSendWithContent:U}){return console.log("SelectedNodeInfo nodeInfo:",m[0]),h.jsx("div",{className:"mb-3 p-3 rounded-md bg-gray-50 border border-gray-200",children:h.jsxs("div",{className:"text-sm text-gray-700",children:[h.jsxs("p",{children:["Selected node: ",m[0].type]}),h.jsxs("div",{className:"flex gap-2 mt-2",children:[h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-blue-50 text-blue-700 hover:bg-blue-100`,onClick:()=>U(`Reply in ${navigator.language} language: How does the ${m[0].type} node work? I need its official usage guide.`),disabled:a,children:"Usage"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-green-100 text-green-700 hover:bg-green-200`,onClick:()=>U(`Reply in ${navigator.language} language: Show me the technical specifications for the ${m[0].type} node's inputs and outputs.`),disabled:a,children:"Parameters"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-purple-100 - text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import(getImportPath("WorkflowOption-Ci2jcBGf.js")),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** + text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import(getImportPath("WorkflowOption-Ci2jcBGf.js")),__vite__mapDeps([0,1,2,3]),import.meta.url).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.N),__vite__mapDeps([3,2,1]),import.meta.url).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.D),__vite__mapDeps([3,2,1]),import.meta.url).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.d),__vite__mapDeps([3,2,1]),import.meta.url).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors @@ -138,4 +138,4 @@ __p += '`),z&&(v+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+v+`return __p -}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import(getImportPath("ParameterDebugInterfaceV2-xZYi4DyT.js")),__vite__mapDeps([4,1,2,3,5,6,7])).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w}; +}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import(getImportPath("ParameterDebugInterfaceV2-CR1pPN4r.js")),__vite__mapDeps([4,1,2,3,5,6,7]),import.meta.url).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w}; diff --git a/ui/src/components/chat/ChatHeader.tsx b/ui/src/components/chat/ChatHeader.tsx index b9ae484..23c5664 100644 --- a/ui/src/components/chat/ChatHeader.tsx +++ b/ui/src/components/chat/ChatHeader.tsx @@ -1,8 +1,8 @@ /* * @Author: 晴知 qingli.hql@alibaba-inc.com * @Date: 2024-11-28 10:19:07 - * @LastEditors: ai-business-hql ai.bussiness.hql@gmail.com - * @LastEditTime: 2025-04-22 17:52:22 + * @LastEditors: ai-business-hql qingli.hql@alibaba-inc.com + * @LastEditTime: 2025-06-05 14:55:51 * @FilePath: /comfyui_copilot/ui/src/components/chat/ChatHeader.tsx * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ diff --git a/ui/vite.config.ts b/ui/vite.config.ts index fd0ba9f..1f221f0 100644 --- a/ui/vite.config.ts +++ b/ui/vite.config.ts @@ -36,6 +36,8 @@ const rewriteImportPlugin = ({ isDev }) => { // https://vitejs.dev/config/ export default defineConfig(({ mode }) => ({ envDir: ".", + // 使用相对路径,确保在代理环境下也能正确加载资源 + base: "./", css: { postcss: { plugins: [ From 7bf3b5473a797843f1316ae3aa7e10068f9faadf Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Thu, 5 Jun 2025 15:02:34 +0800 Subject: [PATCH 11/14] =?UTF-8?q?feat:=20logo=E6=B7=BB=E5=8A=A0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/copilot_web/App-BWNFcFnM.js | 14 ++++++++++++++ dist/copilot_web/App-D16G0Qdi.js | 14 -------------- ...4r.js => ParameterDebugInterfaceV2-BpdDX6z-.js} | 2 +- dist/copilot_web/fonts.css | 2 +- dist/copilot_web/input.js | 4 ++-- ...owChat-DBna2vE_.js => workflowChat-82amaGF7.js} | 10 +++++----- ui/src/components/chat/ChatHeader.tsx | 4 ++-- ui/vite.config.ts | 2 -- 8 files changed, 25 insertions(+), 27 deletions(-) create mode 100644 dist/copilot_web/App-BWNFcFnM.js delete mode 100644 dist/copilot_web/App-D16G0Qdi.js rename dist/copilot_web/{ParameterDebugInterfaceV2-CR1pPN4r.js => ParameterDebugInterfaceV2-BpdDX6z-.js} (99%) rename dist/copilot_web/{workflowChat-DBna2vE_.js => workflowChat-82amaGF7.js} (91%) diff --git a/dist/copilot_web/App-BWNFcFnM.js b/dist/copilot_web/App-BWNFcFnM.js new file mode 100644 index 0000000..0a3fb2e --- /dev/null +++ b/dist/copilot_web/App-BWNFcFnM.js @@ -0,0 +1,14 @@ +function getImportPath(filename) { + return `./${filename}`; + } + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-82amaGF7.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { + const apiBase = window.comfyAPI?.api?.api?.api_base; + if (apiBase) { + // 有 API base 时,使用完整路径 + return `${apiBase.substring(1)}/${path}`; + } else { + // 没有 API base 时,使用相对路径 + return `./${path}`; + } + }))))=>i.map(i=>d[i]); +import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-BQDbTDiL.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-82amaGF7.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/dist/copilot_web/App-D16G0Qdi.js b/dist/copilot_web/App-D16G0Qdi.js deleted file mode 100644 index afcd811..0000000 --- a/dist/copilot_web/App-D16G0Qdi.js +++ /dev/null @@ -1,14 +0,0 @@ -function getImportPath(filename) { - return `./${filename}`; - } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./workflowChat-DBna2vE_.js","./input.js","./vendor-markdown-Dek94WS0.js","./vendor-react-V04_Axys.js","./message-components-BQDbTDiL.js","./assets/input-BFxtFr8c.css","./fonts.css"].map(path => { - const apiBase = window.comfyAPI?.api?.api?.api_base; - if (apiBase) { - // 有 API base 时,使用完整路径 - return `${apiBase.substring(1)}/${path}`; - } else { - // 没有 API base 时,使用相对路径 - return `./${path}`; - } - }))))=>i.map(i=>d[i]); -import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-BQDbTDiL.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-DBna2vE_.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url).then(e=>({default:e.default})));function E(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{E as default}; diff --git a/dist/copilot_web/ParameterDebugInterfaceV2-CR1pPN4r.js b/dist/copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js similarity index 99% rename from dist/copilot_web/ParameterDebugInterfaceV2-CR1pPN4r.js rename to dist/copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js index ae953d7..67d932c 100644 --- a/dist/copilot_web/ParameterDebugInterfaceV2-CR1pPN4r.js +++ b/dist/copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-BQDbTDiL.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-DBna2vE_.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white + import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-BQDbTDiL.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-82amaGF7.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white bg-gray-50 dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-400 diff --git a/dist/copilot_web/fonts.css b/dist/copilot_web/fonts.css index 6cda076..aa84cae 100644 --- a/dist/copilot_web/fonts.css +++ b/dist/copilot_web/fonts.css @@ -1 +1 @@ -@font-face{font-family:cc-font;src:url(data:application/vnd.ms-fontobject;base64,UAYAAKwFAAABAAIAAAAAAAAAAAAAAAAAAAABAJABAAAAAExQAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAK+mfMgAAAAAAAAAAAAAAAAAAAAAAAA4AaQBjAG8AbQBvAG8AbgAAAA4AUgBlAGcAdQBsAGEAcgAAABYAVgBlAHIAcwBpAG8AbgAgADEALgAwAAAADgBpAGMAbwBtAG8AbwBuAAAAAAAAAQAAAAsAgAADADBPUy8yDxIGbwAAALwAAABgY21hcBdW0ocAAAEcAAAAVGdhc3AAAAAQAAABcAAAAAhnbHlmgQuiVgAAAXgAAAHwaGVhZC4IiB0AAANoAAAANmhoZWEKSQZPAAADoAAAACRobXR4DIkAAAAAA8QAAAAUbG9jYQAoAQwAAAPYAAAADG1heHAABwCPAAAD5AAAACBuYW1lmUoJ+wAABAQAAAGGcG9zdAADAAAAAAWMAAAAIAADBEUBkAAFAAACmQLMAAAAjwKZAswAAAHrADMBCQAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAAAAAAAEAAAOkAA8D/wABAA8AAQAAAAAEAAAAAAAAAAAAAACAAAAAAAAMAAAADAAAAHAABAAMAAAAcAAMAAQAAABwABAA4AAAACgAIAAIAAgABACDpAP/9//8AAAAAACDpAP/9//8AAf/jFwQAAwABAAAAAAAAAAAAAAABAAH//wAPAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/ABocDwACMAAAlHgEXHgEXFhceATcyNz4BNz4BJy4BJy4BIyYGBw4BBwYnLgEnJicmNz4BNzYXHgEXHgEzPgE/AT4BJy4BJyYnJgYHBgcGBw4BBwYHBgcOAQcGJy4BJyYnLgE3Njc+ARceARceATM+ATc+ATc+AScuAScuAScmBw4BBwYHBhceARcWFxYXFjY3Njc+ATcDigwSChAlFCsyMWs3NzU3ZikKKQkOORUGEwoMGwgVMRpBPz5nJSQODxMSVT8+SyVDIA0mDwsSBkkKDwsXPx9ZX1+vSkouGg0NFg8QIBYeHkYnJyoeOhtPKisMHh9EOZJDEiEPBxIIChEGEiMSBhYEBigNMnY9YVlaji8uCwgNDUU3Nko/RUWJQUE3HUQNpwobDBUlESMXGBgBDQ02JwkkEBotFAcVAR4HExoJFAoKQzQ1QURGR28hIAcEFRMHJAEVB0gKEw4cKhAvBwY5PT1XMzc3bzY2MCIcGyUJCQMCDg0nRkefTU40LBQaBxMLBA8BEwYSJRIGFQsQHAkkKQQGHx92U1NiUU9OjTk6JiEMDA8aGysXQiQAAAABAAAAAAAAMp/pK18PPPUACwQAAAAAAOQxodAAAAAA5DGh0AAA/8AGhwPAAAAACAACAAAAAAAAAAEAAAPA/8AAAAaJAAAAAAaHAAEAAAAAAAAAAAAAAAAAAAAFBAAAAAAAAAAAAAAAAgAAAAaJAAAAAAAAAAoAFAAeAPgAAQAAAAUAjQABAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGljb21vb24AaQBjAG8AbQBvAG8AblZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGljb21vb24AaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AblJlZ3VsYXIAUgBlAGcAdQBsAGEAcmljb21vb24AaQBjAG8AbQBvAG8AbkZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=);src:url(data:application/vnd.ms-fontobject;base64,UAYAAKwFAAABAAIAAAAAAAAAAAAAAAAAAAABAJABAAAAAExQAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAK+mfMgAAAAAAAAAAAAAAAAAAAAAAAA4AaQBjAG8AbQBvAG8AbgAAAA4AUgBlAGcAdQBsAGEAcgAAABYAVgBlAHIAcwBpAG8AbgAgADEALgAwAAAADgBpAGMAbwBtAG8AbwBuAAAAAAAAAQAAAAsAgAADADBPUy8yDxIGbwAAALwAAABgY21hcBdW0ocAAAEcAAAAVGdhc3AAAAAQAAABcAAAAAhnbHlmgQuiVgAAAXgAAAHwaGVhZC4IiB0AAANoAAAANmhoZWEKSQZPAAADoAAAACRobXR4DIkAAAAAA8QAAAAUbG9jYQAoAQwAAAPYAAAADG1heHAABwCPAAAD5AAAACBuYW1lmUoJ+wAABAQAAAGGcG9zdAADAAAAAAWMAAAAIAADBEUBkAAFAAACmQLMAAAAjwKZAswAAAHrADMBCQAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAAAAAAAEAAAOkAA8D/wABAA8AAQAAAAAEAAAAAAAAAAAAAACAAAAAAAAMAAAADAAAAHAABAAMAAAAcAAMAAQAAABwABAA4AAAACgAIAAIAAgABACDpAP/9//8AAAAAACDpAP/9//8AAf/jFwQAAwABAAAAAAAAAAAAAAABAAH//wAPAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/ABocDwACMAAAlHgEXHgEXFhceATcyNz4BNz4BJy4BJy4BIyYGBw4BBwYnLgEnJicmNz4BNzYXHgEXHgEzPgE/AT4BJy4BJyYnJgYHBgcGBw4BBwYHBgcOAQcGJy4BJyYnLgE3Njc+ARceARceATM+ATc+ATc+AScuAScuAScmBw4BBwYHBhceARcWFxYXFjY3Njc+ATcDigwSChAlFCsyMWs3NzU3ZikKKQkOORUGEwoMGwgVMRpBPz5nJSQODxMSVT8+SyVDIA0mDwsSBkkKDwsXPx9ZX1+vSkouGg0NFg8QIBYeHkYnJyoeOhtPKisMHh9EOZJDEiEPBxIIChEGEiMSBhYEBigNMnY9YVlaji8uCwgNDUU3Nko/RUWJQUE3HUQNpwobDBUlESMXGBgBDQ02JwkkEBotFAcVAR4HExoJFAoKQzQ1QURGR28hIAcEFRMHJAEVB0gKEw4cKhAvBwY5PT1XMzc3bzY2MCIcGyUJCQMCDg0nRkefTU40LBQaBxMLBA8BEwYSJRIGFQsQHAkkKQQGHx92U1NiUU9OjTk6JiEMDA8aGysXQiQAAAABAAAAAAAAMp/pK18PPPUACwQAAAAAAOQxodAAAAAA5DGh0AAA/8AGhwPAAAAACAACAAAAAAAAAAEAAAPA/8AAAAaJAAAAAAaHAAEAAAAAAAAAAAAAAAAAAAAFBAAAAAAAAAAAAAAAAgAAAAaJAAAAAAAAAAoAFAAeAPgAAQAAAAUAjQABAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGljb21vb24AaQBjAG8AbQBvAG8AblZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGljb21vb24AaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AblJlZ3VsYXIAUgBlAGcAdQBsAGEAcmljb21vb24AaQBjAG8AbQBvAG8AbkZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format("embedded-opentype"),url(data:font/ttf;base64,AAEAAAALAIAAAwAwT1MvMg8SBm8AAAC8AAAAYGNtYXAXVtKHAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZoELolYAAAF4AAAB8GhlYWQuCIgdAAADaAAAADZoaGVhCkkGTwAAA6AAAAAkaG10eAyJAAAAAAPEAAAAFGxvY2EAKAEMAAAD2AAAAAxtYXhwAAcAjwAAA+QAAAAgbmFtZZlKCfsAAAQEAAABhnBvc3QAAwAAAAAFjAAAACAAAwRFAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpAAPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6QD//f//AAAAAAAg6QD//f//AAH/4xcEAAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAaHA8AAjAAAJR4BFx4BFxYXHgE3Mjc+ATc+AScuAScuASMmBgcOAQcGJy4BJyYnJjc+ATc2Fx4BFx4BMz4BPwE+AScuAScmJyYGBwYHBgcOAQcGBwYHDgEHBicuAScmJy4BNzY3PgEXHgEXHgEzPgE3PgE3PgEnLgEnLgEnJgcOAQcGBwYXHgEXFhcWFxY2NzY3PgE3A4oMEgoQJRQrMjFrNzc1N2YpCikJDjkVBhMKDBsIFTEaQT8+ZyUkDg8TElU/PkslQyANJg8LEgZJCg8LFz8fWV9fr0pKLhoNDRYPECAWHh5GJycqHjobTyorDB4fRDmSQxIhDwcSCAoRBhIjEgYWBAYoDTJ2PWFZWo4vLgsIDQ1FNzZKP0VFiUFBNx1EDacKGwwVJREjFxgYAQ0NNicJJBAaLRQHFQEeBxMaCRQKCkM0NUFERkdvISAHBBUTByQBFQdIChMOHCoQLwcGOT09VzM3N282NjAiHBslCQkDAg4NJ0ZHn01ONCwUGgcTCwQPARMGEiUSBhULEBwJJCkEBh8fdlNTYlFPTo05OiYhDAwPGhsrF0IkAAAAAQAAAAAAADKf6StfDzz1AAsEAAAAAADkMaHQAAAAAOQxodAAAP/ABocDwAAAAAgAAgAAAAAAAAABAAADwP/AAAAGiQAAAAAGhwABAAAAAAAAAAAAAAAAAAAABQQAAAAAAAAAAAAAAAIAAAAGiQAAAAAAAAAKABQAHgD4AAEAAAAFAI0AAQAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAOAK4AAQAAAAAAAQAHAAAAAQAAAAAAAgAHAGAAAQAAAAAAAwAHADYAAQAAAAAABAAHAHUAAQAAAAAABQALABUAAQAAAAAABgAHAEsAAQAAAAAACgAaAIoAAwABBAkAAQAOAAcAAwABBAkAAgAOAGcAAwABBAkAAwAOAD0AAwABBAkABAAOAHwAAwABBAkABQAWACAAAwABBAkABgAOAFIAAwABBAkACgA0AKRpY29tb29uAGkAYwBvAG0AbwBvAG5WZXJzaW9uIDEuMABWAGUAcgBzAGkAbwBuACAAMQAuADBpY29tb29uAGkAYwBvAG0AbwBvAG5pY29tb29uAGkAYwBvAG0AbwBvAG5SZWd1bGFyAFIAZQBnAHUAbABhAHJpY29tb29uAGkAYwBvAG0AbwBvAG5Gb250IGdlbmVyYXRlZCBieSBJY29Nb29uLgBGAG8AbgB0ACAAZwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABJAGMAbwBNAG8AbwBuAC4AAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) format("truetype"),url(data:font/woff;base64,d09GRgABAAAAAAX4AAsAAAAABawAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIGb2NtYXAAAAFoAAAAVAAAAFQXVtKHZ2FzcAAAAbwAAAAIAAAACAAAABBnbHlmAAABxAAAAfAAAAHwgQuiVmhlYWQAAAO0AAAANgAAADYuCIgdaGhlYQAAA+wAAAAkAAAAJApJBk9obXR4AAAEEAAAABQAAAAUDIkAAGxvY2EAAAQkAAAADAAAAAwAKAEMbWF4cAAABDAAAAAgAAAAIAAHAI9uYW1lAAAEUAAAAYYAAAGGmUoJ+3Bvc3QAAAXYAAAAIAAAACAAAwAAAAMERQGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA6QADwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADgAAAAKAAgAAgACAAEAIOkA//3//wAAAAAAIOkA//3//wAB/+MXBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AGhwPAAIwAACUeARceARcWFx4BNzI3PgE3PgEnLgEnLgEjJgYHDgEHBicuAScmJyY3PgE3NhceARceATM+AT8BPgEnLgEnJicmBgcGBwYHDgEHBgcGBw4BBwYnLgEnJicuATc2Nz4BFx4BFx4BMz4BNz4BNz4BJy4BJy4BJyYHDgEHBgcGFx4BFxYXFhcWNjc2Nz4BNwOKDBIKECUUKzIxazc3NTdmKQopCQ45FQYTCgwbCBUxGkE/PmclJA4PExJVPz5LJUMgDSYPCxIGSQoPCxc/H1lfX69KSi4aDQ0WDxAgFh4eRicnKh46G08qKwweH0Q5kkMSIQ8HEggKEQYSIxIGFgQGKA0ydj1hWVqOLy4LCA0NRTc2Sj9FRYlBQTcdRA2nChsMFSURIxcYGAENDTYnCSQQGi0UBxUBHgcTGgkUCgpDNDVBREZHbyEgBwQVEwckARUHSAoTDhwqEC8HBjk9PVczNzdvNjYwIhwbJQkJAwIODSdGR59NTjQsFBoHEwsEDwETBhIlEgYVCxAcCSQpBAYfH3ZTU2JRT06NOTomIQwMDxobKxdCJAAAAAEAAAAAAAAyn+krXw889QALBAAAAAAA5DGh0AAAAADkMaHQAAD/wAaHA8AAAAAIAAIAAAAAAAAAAQAAA8D/wAAABokAAAAABocAAQAAAAAAAAAAAAAAAAAAAAUEAAAAAAAAAAAAAAACAAAABokAAAAAAAAACgAUAB4A+AABAAAABQCNAAEAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEABwAAAAEAAAAAAAIABwBgAAEAAAAAAAMABwA2AAEAAAAAAAQABwB1AAEAAAAAAAUACwAVAAEAAAAAAAYABwBLAAEAAAAAAAoAGgCKAAMAAQQJAAEADgAHAAMAAQQJAAIADgBnAAMAAQQJAAMADgA9AAMAAQQJAAQADgB8AAMAAQQJAAUAFgAgAAMAAQQJAAYADgBSAAMAAQQJAAoANACkaWNvbW9vbgBpAGMAbwBtAG8AbwBuVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwaWNvbW9vbgBpAGMAbwBtAG8AbwBuaWNvbW9vbgBpAGMAbwBtAG8AbwBuUmVndWxhcgBSAGUAZwB1AGwAYQByaWNvbW9vbgBpAGMAbwBtAG8AbwBuRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format("woff"),url(./assets/cc-icon-DfxqqsZi.svg?jbqswq#icomoon) format("svg");font-weight:400;font-style:normal;font-display:block;font-size:16px}[class^=cc-icon-],[class*=" cc-icon-"]{font-family:cc-font!important;speak:never;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.cc-icon-logo:before{content:"";color:#9b9d9f;font-size:18px!important} +@font-face{font-family:cc-font;src:url(data:application/vnd.ms-fontobject;base64,UAYAAKwFAAABAAIAAAAAAAAAAAAAAAAAAAABAJABAAAAAExQAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAK+mfMgAAAAAAAAAAAAAAAAAAAAAAAA4AaQBjAG8AbQBvAG8AbgAAAA4AUgBlAGcAdQBsAGEAcgAAABYAVgBlAHIAcwBpAG8AbgAgADEALgAwAAAADgBpAGMAbwBtAG8AbwBuAAAAAAAAAQAAAAsAgAADADBPUy8yDxIGbwAAALwAAABgY21hcBdW0ocAAAEcAAAAVGdhc3AAAAAQAAABcAAAAAhnbHlmgQuiVgAAAXgAAAHwaGVhZC4IiB0AAANoAAAANmhoZWEKSQZPAAADoAAAACRobXR4DIkAAAAAA8QAAAAUbG9jYQAoAQwAAAPYAAAADG1heHAABwCPAAAD5AAAACBuYW1lmUoJ+wAABAQAAAGGcG9zdAADAAAAAAWMAAAAIAADBEUBkAAFAAACmQLMAAAAjwKZAswAAAHrADMBCQAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAAAAAAAEAAAOkAA8D/wABAA8AAQAAAAAEAAAAAAAAAAAAAACAAAAAAAAMAAAADAAAAHAABAAMAAAAcAAMAAQAAABwABAA4AAAACgAIAAIAAgABACDpAP/9//8AAAAAACDpAP/9//8AAf/jFwQAAwABAAAAAAAAAAAAAAABAAH//wAPAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/ABocDwACMAAAlHgEXHgEXFhceATcyNz4BNz4BJy4BJy4BIyYGBw4BBwYnLgEnJicmNz4BNzYXHgEXHgEzPgE/AT4BJy4BJyYnJgYHBgcGBw4BBwYHBgcOAQcGJy4BJyYnLgE3Njc+ARceARceATM+ATc+ATc+AScuAScuAScmBw4BBwYHBhceARcWFxYXFjY3Njc+ATcDigwSChAlFCsyMWs3NzU3ZikKKQkOORUGEwoMGwgVMRpBPz5nJSQODxMSVT8+SyVDIA0mDwsSBkkKDwsXPx9ZX1+vSkouGg0NFg8QIBYeHkYnJyoeOhtPKisMHh9EOZJDEiEPBxIIChEGEiMSBhYEBigNMnY9YVlaji8uCwgNDUU3Nko/RUWJQUE3HUQNpwobDBUlESMXGBgBDQ02JwkkEBotFAcVAR4HExoJFAoKQzQ1QURGR28hIAcEFRMHJAEVB0gKEw4cKhAvBwY5PT1XMzc3bzY2MCIcGyUJCQMCDg0nRkefTU40LBQaBxMLBA8BEwYSJRIGFQsQHAkkKQQGHx92U1NiUU9OjTk6JiEMDA8aGysXQiQAAAABAAAAAAAAMp/pK18PPPUACwQAAAAAAOQxodAAAAAA5DGh0AAA/8AGhwPAAAAACAACAAAAAAAAAAEAAAPA/8AAAAaJAAAAAAaHAAEAAAAAAAAAAAAAAAAAAAAFBAAAAAAAAAAAAAAAAgAAAAaJAAAAAAAAAAoAFAAeAPgAAQAAAAUAjQABAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGljb21vb24AaQBjAG8AbQBvAG8AblZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGljb21vb24AaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AblJlZ3VsYXIAUgBlAGcAdQBsAGEAcmljb21vb24AaQBjAG8AbQBvAG8AbkZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=);src:url(data:application/vnd.ms-fontobject;base64,UAYAAKwFAAABAAIAAAAAAAAAAAAAAAAAAAABAJABAAAAAExQAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAK+mfMgAAAAAAAAAAAAAAAAAAAAAAAA4AaQBjAG8AbQBvAG8AbgAAAA4AUgBlAGcAdQBsAGEAcgAAABYAVgBlAHIAcwBpAG8AbgAgADEALgAwAAAADgBpAGMAbwBtAG8AbwBuAAAAAAAAAQAAAAsAgAADADBPUy8yDxIGbwAAALwAAABgY21hcBdW0ocAAAEcAAAAVGdhc3AAAAAQAAABcAAAAAhnbHlmgQuiVgAAAXgAAAHwaGVhZC4IiB0AAANoAAAANmhoZWEKSQZPAAADoAAAACRobXR4DIkAAAAAA8QAAAAUbG9jYQAoAQwAAAPYAAAADG1heHAABwCPAAAD5AAAACBuYW1lmUoJ+wAABAQAAAGGcG9zdAADAAAAAAWMAAAAIAADBEUBkAAFAAACmQLMAAAAjwKZAswAAAHrADMBCQAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAAAAAAAEAAAOkAA8D/wABAA8AAQAAAAAEAAAAAAAAAAAAAACAAAAAAAAMAAAADAAAAHAABAAMAAAAcAAMAAQAAABwABAA4AAAACgAIAAIAAgABACDpAP/9//8AAAAAACDpAP/9//8AAf/jFwQAAwABAAAAAAAAAAAAAAABAAH//wAPAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/ABocDwACMAAAlHgEXHgEXFhceATcyNz4BNz4BJy4BJy4BIyYGBw4BBwYnLgEnJicmNz4BNzYXHgEXHgEzPgE/AT4BJy4BJyYnJgYHBgcGBw4BBwYHBgcOAQcGJy4BJyYnLgE3Njc+ARceARceATM+ATc+ATc+AScuAScuAScmBw4BBwYHBhceARcWFxYXFjY3Njc+ATcDigwSChAlFCsyMWs3NzU3ZikKKQkOORUGEwoMGwgVMRpBPz5nJSQODxMSVT8+SyVDIA0mDwsSBkkKDwsXPx9ZX1+vSkouGg0NFg8QIBYeHkYnJyoeOhtPKisMHh9EOZJDEiEPBxIIChEGEiMSBhYEBigNMnY9YVlaji8uCwgNDUU3Nko/RUWJQUE3HUQNpwobDBUlESMXGBgBDQ02JwkkEBotFAcVAR4HExoJFAoKQzQ1QURGR28hIAcEFRMHJAEVB0gKEw4cKhAvBwY5PT1XMzc3bzY2MCIcGyUJCQMCDg0nRkefTU40LBQaBxMLBA8BEwYSJRIGFQsQHAkkKQQGHx92U1NiUU9OjTk6JiEMDA8aGysXQiQAAAABAAAAAAAAMp/pK18PPPUACwQAAAAAAOQxodAAAAAA5DGh0AAA/8AGhwPAAAAACAACAAAAAAAAAAEAAAPA/8AAAAaJAAAAAAaHAAEAAAAAAAAAAAAAAAAAAAAFBAAAAAAAAAAAAAAAAgAAAAaJAAAAAAAAAAoAFAAeAPgAAQAAAAUAjQABAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGljb21vb24AaQBjAG8AbQBvAG8AblZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGljb21vb24AaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AblJlZ3VsYXIAUgBlAGcAdQBsAGEAcmljb21vb24AaQBjAG8AbQBvAG8AbkZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format("embedded-opentype"),url(data:font/ttf;base64,AAEAAAALAIAAAwAwT1MvMg8SBm8AAAC8AAAAYGNtYXAXVtKHAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZoELolYAAAF4AAAB8GhlYWQuCIgdAAADaAAAADZoaGVhCkkGTwAAA6AAAAAkaG10eAyJAAAAAAPEAAAAFGxvY2EAKAEMAAAD2AAAAAxtYXhwAAcAjwAAA+QAAAAgbmFtZZlKCfsAAAQEAAABhnBvc3QAAwAAAAAFjAAAACAAAwRFAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpAAPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6QD//f//AAAAAAAg6QD//f//AAH/4xcEAAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAaHA8AAjAAAJR4BFx4BFxYXHgE3Mjc+ATc+AScuAScuASMmBgcOAQcGJy4BJyYnJjc+ATc2Fx4BFx4BMz4BPwE+AScuAScmJyYGBwYHBgcOAQcGBwYHDgEHBicuAScmJy4BNzY3PgEXHgEXHgEzPgE3PgE3PgEnLgEnLgEnJgcOAQcGBwYXHgEXFhcWFxY2NzY3PgE3A4oMEgoQJRQrMjFrNzc1N2YpCikJDjkVBhMKDBsIFTEaQT8+ZyUkDg8TElU/PkslQyANJg8LEgZJCg8LFz8fWV9fr0pKLhoNDRYPECAWHh5GJycqHjobTyorDB4fRDmSQxIhDwcSCAoRBhIjEgYWBAYoDTJ2PWFZWo4vLgsIDQ1FNzZKP0VFiUFBNx1EDacKGwwVJREjFxgYAQ0NNicJJBAaLRQHFQEeBxMaCRQKCkM0NUFERkdvISAHBBUTByQBFQdIChMOHCoQLwcGOT09VzM3N282NjAiHBslCQkDAg4NJ0ZHn01ONCwUGgcTCwQPARMGEiUSBhULEBwJJCkEBh8fdlNTYlFPTo05OiYhDAwPGhsrF0IkAAAAAQAAAAAAADKf6StfDzz1AAsEAAAAAADkMaHQAAAAAOQxodAAAP/ABocDwAAAAAgAAgAAAAAAAAABAAADwP/AAAAGiQAAAAAGhwABAAAAAAAAAAAAAAAAAAAABQQAAAAAAAAAAAAAAAIAAAAGiQAAAAAAAAAKABQAHgD4AAEAAAAFAI0AAQAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAOAK4AAQAAAAAAAQAHAAAAAQAAAAAAAgAHAGAAAQAAAAAAAwAHADYAAQAAAAAABAAHAHUAAQAAAAAABQALABUAAQAAAAAABgAHAEsAAQAAAAAACgAaAIoAAwABBAkAAQAOAAcAAwABBAkAAgAOAGcAAwABBAkAAwAOAD0AAwABBAkABAAOAHwAAwABBAkABQAWACAAAwABBAkABgAOAFIAAwABBAkACgA0AKRpY29tb29uAGkAYwBvAG0AbwBvAG5WZXJzaW9uIDEuMABWAGUAcgBzAGkAbwBuACAAMQAuADBpY29tb29uAGkAYwBvAG0AbwBvAG5pY29tb29uAGkAYwBvAG0AbwBvAG5SZWd1bGFyAFIAZQBnAHUAbABhAHJpY29tb29uAGkAYwBvAG0AbwBvAG5Gb250IGdlbmVyYXRlZCBieSBJY29Nb29uLgBGAG8AbgB0ACAAZwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABJAGMAbwBNAG8AbwBuAC4AAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) format("truetype"),url(data:font/woff;base64,d09GRgABAAAAAAX4AAsAAAAABawAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIGb2NtYXAAAAFoAAAAVAAAAFQXVtKHZ2FzcAAAAbwAAAAIAAAACAAAABBnbHlmAAABxAAAAfAAAAHwgQuiVmhlYWQAAAO0AAAANgAAADYuCIgdaGhlYQAAA+wAAAAkAAAAJApJBk9obXR4AAAEEAAAABQAAAAUDIkAAGxvY2EAAAQkAAAADAAAAAwAKAEMbWF4cAAABDAAAAAgAAAAIAAHAI9uYW1lAAAEUAAAAYYAAAGGmUoJ+3Bvc3QAAAXYAAAAIAAAACAAAwAAAAMERQGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA6QADwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADgAAAAKAAgAAgACAAEAIOkA//3//wAAAAAAIOkA//3//wAB/+MXBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAA/8AAAAPAAAIAADc5AQAAAAABAAD/wAAAA8AAAgAANzkBAAAAAAEAAP/AAAADwAACAAA3OQEAAAAAAQAA/8AGhwPAAIwAACUeARceARcWFx4BNzI3PgE3PgEnLgEnLgEjJgYHDgEHBicuAScmJyY3PgE3NhceARceATM+AT8BPgEnLgEnJicmBgcGBwYHDgEHBgcGBw4BBwYnLgEnJicuATc2Nz4BFx4BFx4BMz4BNz4BNz4BJy4BJy4BJyYHDgEHBgcGFx4BFxYXFhcWNjc2Nz4BNwOKDBIKECUUKzIxazc3NTdmKQopCQ45FQYTCgwbCBUxGkE/PmclJA4PExJVPz5LJUMgDSYPCxIGSQoPCxc/H1lfX69KSi4aDQ0WDxAgFh4eRicnKh46G08qKwweH0Q5kkMSIQ8HEggKEQYSIxIGFgQGKA0ydj1hWVqOLy4LCA0NRTc2Sj9FRYlBQTcdRA2nChsMFSURIxcYGAENDTYnCSQQGi0UBxUBHgcTGgkUCgpDNDVBREZHbyEgBwQVEwckARUHSAoTDhwqEC8HBjk9PVczNzdvNjYwIhwbJQkJAwIODSdGR59NTjQsFBoHEwsEDwETBhIlEgYVCxAcCSQpBAYfH3ZTU2JRT06NOTomIQwMDxobKxdCJAAAAAEAAAAAAAAyn+krXw889QALBAAAAAAA5DGh0AAAAADkMaHQAAD/wAaHA8AAAAAIAAIAAAAAAAAAAQAAA8D/wAAABokAAAAABocAAQAAAAAAAAAAAAAAAAAAAAUEAAAAAAAAAAAAAAACAAAABokAAAAAAAAACgAUAB4A+AABAAAABQCNAAEAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEABwAAAAEAAAAAAAIABwBgAAEAAAAAAAMABwA2AAEAAAAAAAQABwB1AAEAAAAAAAUACwAVAAEAAAAAAAYABwBLAAEAAAAAAAoAGgCKAAMAAQQJAAEADgAHAAMAAQQJAAIADgBnAAMAAQQJAAMADgA9AAMAAQQJAAQADgB8AAMAAQQJAAUAFgAgAAMAAQQJAAYADgBSAAMAAQQJAAoANACkaWNvbW9vbgBpAGMAbwBtAG8AbwBuVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwaWNvbW9vbgBpAGMAbwBtAG8AbwBuaWNvbW9vbgBpAGMAbwBtAG8AbwBuUmVndWxhcgBSAGUAZwB1AGwAYQByaWNvbW9vbgBpAGMAbwBtAG8AbwBuRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format("woff"),url(/copilot_web/assets/cc-icon-DfxqqsZi.svg?jbqswq#icomoon) format("svg");font-weight:400;font-style:normal;font-display:block;font-size:16px}[class^=cc-icon-],[class*=" cc-icon-"]{font-family:cc-font!important;speak:never;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.cc-icon-logo:before{content:"";color:#9b9d9f;font-size:18px!important} diff --git a/dist/copilot_web/input.js b/dist/copilot_web/input.js index 45c889e..e8bba70 100644 --- a/dist/copilot_web/input.js +++ b/dist/copilot_web/input.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-D16G0Qdi.js","./vendor-markdown-Dek94WS0.js","./vendor-react-V04_Axys.js","./message-components-BQDbTDiL.js","./fonts.css"].map(path => { + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-BWNFcFnM.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 @@ -11,4 +11,4 @@ function getImportPath(filename) { return `./${path}`; } }))))=>i.map(i=>d[i]); -import{j as l}from"./vendor-markdown-Dek94WS0.js";import{a as R,R as v,r as x}from"./vendor-react-V04_Axys.js";import{w as g,a as b}from"./message-components-BQDbTDiL.js";/* empty css */const C="modulepreload",S=function(e,n){return new URL(e,n).href},y={},j=function(n,d,f){let m=Promise.resolve();if(d&&d.length>0){const i=document.getElementsByTagName("link"),t=document.querySelector("meta[property=csp-nonce]"),h=t?.nonce||t?.getAttribute("nonce");m=Promise.allSettled(d.map(o=>{if(o=S(o,f),o in y)return;y[o]=!0;const s=o.endsWith(".css"),w=s?'[rel="stylesheet"]':"";if(!!f)for(let c=i.length-1;c>=0;c--){const a=i[c];if(a.href===o&&(!s||a.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${w}`))return;const r=document.createElement("link");if(r.rel=s?"stylesheet":C,s||(r.as="script"),r.crossOrigin="",r.href=o,h&&r.setAttribute("nonce",h),document.head.appendChild(r),s)return new Promise((c,a)=>{r.addEventListener("load",c),r.addEventListener("error",()=>a(new Error(`Unable to preload CSS for ${o}`)))})}))}function p(i){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=i,window.dispatchEvent(t),!t.defaultPrevented)throw i}return m.then(i=>{for(const t of i||[])t.status==="rejected"&&p(t.reason);return n().catch(p)})};var u={},E=R;u.createRoot=E.createRoot,u.hydrateRoot=E.hydrateRoot;const L=v.lazy(()=>j(async()=>{const{default:e}=await import(getImportPath("App-D16G0Qdi.js"));return{default:e}},__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(({default:e})=>({default:e})));function P(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}P().then(()=>g()).then(()=>{b.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const n=document.createElement("div");n.id="comfyui-copilot-plugin",n.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(n),u.createRoot(n).render(l.jsx(v.StrictMode,{children:l.jsx(x.Suspense,{fallback:l.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:l.jsx(L,{})})}))}})});export{j as _}; +import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-BQDbTDiL.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import(getImportPath("App-BWNFcFnM.js"));return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; diff --git a/dist/copilot_web/workflowChat-DBna2vE_.js b/dist/copilot_web/workflowChat-82amaGF7.js similarity index 91% rename from dist/copilot_web/workflowChat-DBna2vE_.js rename to dist/copilot_web/workflowChat-82amaGF7.js index e1717d5..a486922 100644 --- a/dist/copilot_web/workflowChat-DBna2vE_.js +++ b/dist/copilot_web/workflowChat-82amaGF7.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./WorkflowOption-Ci2jcBGf.js","./vendor-markdown-Dek94WS0.js","./vendor-react-V04_Axys.js","./message-components-BQDbTDiL.js","./ParameterDebugInterfaceV2-CR1pPN4r.js","./input.js","./assets/input-BFxtFr8c.css","./fonts.css"].map(path => { + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-Ci2jcBGf.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 @@ -83,8 +83,8 @@ import{_ as Ot}from"./input.js";import{j as h,r as xg,b as yg}from"./vendor-mark focus:ring-2 focus:ring-blue-500/20 dark:focus:ring-blue-400/20 focus:outline-none`})]}),h.jsx("div",{className:"flex items-center mb-2",children:h.jsx("button",{onClick:le,disabled:he||!y.trim(),className:`px-4 py-2 rounded-lg font-medium text-xs transition-colors ${he||!y.trim()?"bg-gray-300 dark:bg-gray-600 text-gray-500 dark:text-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white"}`,children:he?h.jsxs("span",{className:"flex items-center",children:[h.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Verifying..."]}):"Verify"})}),F&&h.jsx("div",{className:`text-xs p-2 rounded-md ${F.success?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400"}`,children:F.message})]}),h.jsxs("div",{className:"flex justify-end gap-3",children:[h.jsx("button",{onClick:b,className:`px-5 py-2.5 text-gray-700 bg-white dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg font-medium transition-colors`,children:"Cancel"}),h.jsx("button",{onClick:se,className:`px-5 py-2.5 bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 - text-white rounded-lg font-medium transition-colors`,children:"Save"})]})]})}):null}const Gg=""+new URL("assets/logo-BTZhX0BN.png",import.meta.url).href;function Kg({onClose:m,onClear:b,hasMessages:a,onHeightResize:U,title:M="ComfyUI-Copilot"}){const[E,W]=I.useState(!1),[re,y]=I.useState(!1),q=()=>{W(!0)},$=P=>{localStorage.setItem("chatApiKey",P)};return I.useEffect(()=>{const P=ce=>{if(!re)return;const he=ce.movementY;U?.(he)},_e=()=>{y(!1)};return re&&(document.addEventListener("mousemove",P),document.addEventListener("mouseup",_e)),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",_e)}},[re,U]),h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:`flex items-center justify-between border-b px-3 py-2 - bg-white border-gray-200 sticky top-2 z-10`,children:[h.jsxs("div",{className:"flex items-center space-x-1",children:[h.jsx("img",{src:Gg,alt:"ComfyUI-Copilot Logo",className:"h-7 w-7 -ml-1"}),h.jsx("h3",{className:"text-[14px] font-medium text-gray-800",children:M}),h.jsx("button",{onClick:q,className:"p-1 bg-white border-none hover:bg-gray-100 rounded text-gray-500",children:h.jsx(Wg,{className:"h-4 w-4"})})]}),h.jsx("div",{className:"flex items-center gap-1",children:h.jsx("button",{className:`inline-flex bg-white border-none items-center justify-center rounded-md p-1.5 + text-white rounded-lg font-medium transition-colors`,children:"Save"})]})]})}):null}const Gg="/copilot_web/assets/logo-BTZhX0BN.png";function Kg({onClose:m,onClear:b,hasMessages:a,onHeightResize:U,title:M="ComfyUI-Copilot"}){const[E,W]=I.useState(!1),[re,y]=I.useState(!1),q=()=>{W(!0)},$=P=>{localStorage.setItem("chatApiKey",P)};return I.useEffect(()=>{const P=ce=>{if(!re)return;const he=ce.movementY;U?.(he)},_e=()=>{y(!1)};return re&&(document.addEventListener("mousemove",P),document.addEventListener("mouseup",_e)),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",_e)}},[re,U]),h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:`flex items-center justify-between border-b px-3 py-2 + bg-white border-gray-200 sticky top-2 z-10`,children:[h.jsxs("div",{className:"flex items-center space-x-1",children:[h.jsx("img",{src:`.${Gg}`,alt:"ComfyUI-Copilot Logo",className:"h-7 w-7 -ml-1"}),h.jsx("h3",{className:"text-[14px] font-medium text-gray-800",children:M}),h.jsx("button",{onClick:q,className:"p-1 bg-white border-none hover:bg-gray-100 rounded text-gray-500",children:h.jsx(Wg,{className:"h-4 w-4"})})]}),h.jsx("div",{className:"flex items-center gap-1",children:h.jsx("button",{className:`inline-flex bg-white border-none items-center justify-center rounded-md p-1.5 ${a?"text-gray-500 hover:bg-gray-100":"text-gray-300 cursor-not-allowed"}`,disabled:!a,onClick:b,children:h.jsx(Ug,{className:"h-4 w-4"})})})]}),h.jsx(jg,{isOpen:E,onClose:()=>W(!1),onSave:$,initialApiKey:localStorage.getItem("chatApiKey")||""})]})}const zg=5*1024*1024,Oa=["image/jpeg","image/png","image/gif","image/webp"];function $g({input:m,loading:b,onChange:a,onSend:U,onKeyPress:M,onUploadImages:E,uploadedImages:W,onRemoveImage:re,selectedModel:y,onModelChange:q}){const[$,P]=I.useState(!1),[_e,ce]=I.useState([]),he=wn.useRef(null),ie=I.useRef(null);I.useEffect(()=>{ie.current&&(ie.current.style.height="auto",ie.current.style.height=`${Math.min(ie.current.scrollHeight,400)}px`)},[m]),I.useEffect(()=>{(async()=>{try{const de=await ft.listModels();ce(de.models)}catch(de){console.error("Failed to load models:",de),ce([{name:"gpt-4o",image_enable:!0},{name:"gpt-4o-mini",image_enable:!0},{name:"qwen-plus",image_enable:!1},{name:"DeepSeek-V3",image_enable:!1}])}})()},[]);const F=T=>{if(T.target.files){const de=[],ne=[];if(Array.from(T.target.files).forEach(le=>{Oa.includes(le.type)?le.size>zg?de.push(`${le.name} (exceeds 5MB)`):ne.push(le):de.push(`${le.name} (unsupported format)`)}),de.length>0&&alert(`The following files couldn't be uploaded: ${de.join(` `)}`),ne.length>0){const le=new DataTransfer;ne.forEach(se=>le.items.add(se)),E(le.files)}}};return h.jsxs("div",{className:`relative ${W.length>0?"mt-12":""}`,children:[W.length>0&&h.jsx("div",{className:"absolute -top-10 left-0 flex gap-2",children:W.map(T=>h.jsxs("div",{className:"relative group",children:[h.jsx("img",{src:T.preview,alt:"uploaded",className:"w-8 h-8 rounded object-cover"}),h.jsx("button",{onClick:()=>re(T.id),className:`absolute -top-1 -right-1 bg-white border-none text-gray-500 rounded-full p-0.5 @@ -112,7 +112,7 @@ ${de.join(` hover:bg-gray-50`,children:"Close"})})]})})]})}function Hg(m){const b=m[0],a=new Set;function U(M,E){if(!(!M||E>=1)&&M.inputs)for(const W of Object.values(M.inputs)){const re=W.link;if(re&&fn.graph.links[re]){const y=fn.graph.links[re].origin_id,q=fn.graph._nodes_by_id[y];q&&(a.add(q.type),U(q,E+1))}}}return b?(U(b,0),[{type:"upstream_node_types",data:Array.from(a)}]):null}function qg({nodeInfo:m,onSendWithIntent:b,loading:a,onSendWithContent:U}){return console.log("SelectedNodeInfo nodeInfo:",m[0]),h.jsx("div",{className:"mb-3 p-3 rounded-md bg-gray-50 border border-gray-200",children:h.jsxs("div",{className:"text-sm text-gray-700",children:[h.jsxs("p",{children:["Selected node: ",m[0].type]}),h.jsxs("div",{className:"flex gap-2 mt-2",children:[h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-blue-50 text-blue-700 hover:bg-blue-100`,onClick:()=>U(`Reply in ${navigator.language} language: How does the ${m[0].type} node work? I need its official usage guide.`),disabled:a,children:"Usage"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-green-100 text-green-700 hover:bg-green-200`,onClick:()=>U(`Reply in ${navigator.language} language: Show me the technical specifications for the ${m[0].type} node's inputs and outputs.`),disabled:a,children:"Parameters"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-purple-100 - text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import(getImportPath("WorkflowOption-Ci2jcBGf.js")),__vite__mapDeps([0,1,2,3]),import.meta.url).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.N),__vite__mapDeps([3,2,1]),import.meta.url).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.D),__vite__mapDeps([3,2,1]),import.meta.url).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.d),__vite__mapDeps([3,2,1]),import.meta.url).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** + text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import(getImportPath("WorkflowOption-Ci2jcBGf.js")),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors @@ -138,4 +138,4 @@ __p += '`),z&&(v+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+v+`return __p -}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import(getImportPath("ParameterDebugInterfaceV2-CR1pPN4r.js")),__vite__mapDeps([4,1,2,3,5,6,7]),import.meta.url).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w}; +}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import(getImportPath("ParameterDebugInterfaceV2-BpdDX6z-.js")),__vite__mapDeps([4,1,2,3,5,6,7])).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w}; diff --git a/ui/src/components/chat/ChatHeader.tsx b/ui/src/components/chat/ChatHeader.tsx index 23c5664..233e97e 100644 --- a/ui/src/components/chat/ChatHeader.tsx +++ b/ui/src/components/chat/ChatHeader.tsx @@ -2,7 +2,7 @@ * @Author: 晴知 qingli.hql@alibaba-inc.com * @Date: 2024-11-28 10:19:07 * @LastEditors: ai-business-hql qingli.hql@alibaba-inc.com - * @LastEditTime: 2025-06-05 14:55:51 + * @LastEditTime: 2025-06-05 15:01:55 * @FilePath: /comfyui_copilot/ui/src/components/chat/ChatHeader.tsx * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -73,7 +73,7 @@ export function ChatHeader({ bg-white border-gray-200 sticky top-2 z-10">
ComfyUI-Copilot Logo diff --git a/ui/vite.config.ts b/ui/vite.config.ts index 1f221f0..fd0ba9f 100644 --- a/ui/vite.config.ts +++ b/ui/vite.config.ts @@ -36,8 +36,6 @@ const rewriteImportPlugin = ({ isDev }) => { // https://vitejs.dev/config/ export default defineConfig(({ mode }) => ({ envDir: ".", - // 使用相对路径,确保在代理环境下也能正确加载资源 - base: "./", css: { postcss: { plugins: [ From 4a97f8770b58c12b131221f58585c6f823a8f467 Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Thu, 5 Jun 2025 16:33:39 +0800 Subject: [PATCH 12/14] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BA=91?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E7=9A=84=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/copilot_web/{App-BWNFcFnM.js => App-C63C0sLF.js} | 4 ++-- ...-BpdDX6z-.js => ParameterDebugInterfaceV2-QYVwPrST.js} | 2 +- ...kflowOption-Ci2jcBGf.js => WorkflowOption-DF-pdh_V.js} | 2 +- dist/copilot_web/input.js | 4 ++-- ...ponents-BQDbTDiL.js => message-components-C_KwPGE8.js} | 2 +- ...{workflowChat-82amaGF7.js => workflowChat-C3ZWZR1l.js} | 8 ++++---- 6 files changed, 11 insertions(+), 11 deletions(-) rename dist/copilot_web/{App-BWNFcFnM.js => App-C63C0sLF.js} (85%) rename dist/copilot_web/{ParameterDebugInterfaceV2-BpdDX6z-.js => ParameterDebugInterfaceV2-QYVwPrST.js} (99%) rename dist/copilot_web/{WorkflowOption-Ci2jcBGf.js => WorkflowOption-DF-pdh_V.js} (98%) rename dist/copilot_web/{message-components-BQDbTDiL.js => message-components-C_KwPGE8.js} (99%) rename dist/copilot_web/{workflowChat-82amaGF7.js => workflowChat-C3ZWZR1l.js} (99%) diff --git a/dist/copilot_web/App-BWNFcFnM.js b/dist/copilot_web/App-C63C0sLF.js similarity index 85% rename from dist/copilot_web/App-BWNFcFnM.js rename to dist/copilot_web/App-C63C0sLF.js index 0a3fb2e..7b8f899 100644 --- a/dist/copilot_web/App-BWNFcFnM.js +++ b/dist/copilot_web/App-C63C0sLF.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-82amaGF7.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-C3ZWZR1l.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-C_KwPGE8.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 @@ -11,4 +11,4 @@ function getImportPath(filename) { return `./${path}`; } }))))=>i.map(i=>d[i]); -import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-BQDbTDiL.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-82amaGF7.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; +import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-C_KwPGE8.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-C3ZWZR1l.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/dist/copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js b/dist/copilot_web/ParameterDebugInterfaceV2-QYVwPrST.js similarity index 99% rename from dist/copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js rename to dist/copilot_web/ParameterDebugInterfaceV2-QYVwPrST.js index 67d932c..7c2d773 100644 --- a/dist/copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js +++ b/dist/copilot_web/ParameterDebugInterfaceV2-QYVwPrST.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-BQDbTDiL.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-82amaGF7.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white + import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-C_KwPGE8.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-C3ZWZR1l.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white bg-gray-50 dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-400 diff --git a/dist/copilot_web/WorkflowOption-Ci2jcBGf.js b/dist/copilot_web/WorkflowOption-DF-pdh_V.js similarity index 98% rename from dist/copilot_web/WorkflowOption-Ci2jcBGf.js rename to dist/copilot_web/WorkflowOption-DF-pdh_V.js index 14c0031..c36af2a 100644 --- a/dist/copilot_web/WorkflowOption-Ci2jcBGf.js +++ b/dist/copilot_web/WorkflowOption-DF-pdh_V.js @@ -1,4 +1,4 @@ function getImportPath(filename) { return `./${filename}`; } - import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-BQDbTDiL.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; + import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-C_KwPGE8.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; diff --git a/dist/copilot_web/input.js b/dist/copilot_web/input.js index e8bba70..46f0337 100644 --- a/dist/copilot_web/input.js +++ b/dist/copilot_web/input.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-BWNFcFnM.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/fonts.css"].map(path => { + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-C63C0sLF.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-C_KwPGE8.js","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 @@ -11,4 +11,4 @@ function getImportPath(filename) { return `./${path}`; } }))))=>i.map(i=>d[i]); -import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-BQDbTDiL.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import(getImportPath("App-BWNFcFnM.js"));return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; +import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-C_KwPGE8.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import(getImportPath("App-C63C0sLF.js"));return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; diff --git a/dist/copilot_web/message-components-BQDbTDiL.js b/dist/copilot_web/message-components-C_KwPGE8.js similarity index 99% rename from dist/copilot_web/message-components-BQDbTDiL.js rename to dist/copilot_web/message-components-C_KwPGE8.js index 9cfbfeb..fb1a20c 100644 --- a/dist/copilot_web/message-components-BQDbTDiL.js +++ b/dist/copilot_web/message-components-C_KwPGE8.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - import{r as We,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Mpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=We.createContext({state:W$,dispatch:()=>null});function Bpe({children:i}){const[r,e]=We.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=We.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const Ff={apiBaseUrl:"https://comfyui-copilot-server-pre.onrender.com"};function dr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var lI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return lI.charAt(i)}function hI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function cI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function dI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,fI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f + import{r as We,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Mpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=We.createContext({state:W$,dispatch:()=>null});function Bpe({children:i}){const[r,e]=We.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=We.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const Ff={apiBaseUrl:"https://comfyui-copilot-server.onrender.com"};function dr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var lI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return lI.charAt(i)}function hI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function cI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function dI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,fI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f \r  \u2028\u2029`;for(pn={},r=0;r<16;++r)pn[e.charAt(r)]=r;for(e=e.toLowerCase(),r=10;r<16;++r)pn[e.charAt(r)]=r;for(r=0;r=2?(n[n.length]=a,a=0,o=0):a<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},Ii,wd={decode:function(i){var r;if(Ii===void 0){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=`= \f \r  \u2028\u2029`;for(Ii=Object.create(null),r=0;r<64;++r)Ii[e.charAt(r)]=r;for(Ii["-"]=62,Ii._=63,r=0;r=4?(n[n.length]=a>>16,n[n.length]=a>>8&255,n[n.length]=a&255,a=0,o=0):a<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=a>>10;break;case 3:n[n.length]=a>>16,n[n.length]=a>>8&255;break}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(i){var r=wd.re.exec(i);if(r)if(r[1])i=r[1];else if(r[2])i=r[2];else throw new Error("RegExp out of sync");return wd.decode(i)}},gn=1e13,Ua=function(){function i(r){this.buf=[+r||0]}return i.prototype.mulAdd=function(r,e){var t=this.buf,n=t.length,a,o;for(a=0;a0&&(t[a]=e)},i.prototype.sub=function(r){var e=this.buf,t=e.length,n,a;for(n=0;n=0;--n)t+=(gn+e[n]).toString().substring(1);return t},i.prototype.valueOf=function(){for(var r=this.buf,e=0,t=r.length-1;t>=0;--t)e=e*gn+r[t];return e},i.prototype.simplify=function(){var r=this.buf;return r.length==1?r[0]:this},i}(),G$="…",vI=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,pI=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Wn(i,r){return i.length>r&&(i=i.substring(0,r)+G$),i}var nh=function(){function i(r,e){this.hexDigits="0123456789ABCDEF",r instanceof i?(this.enc=r.enc,this.pos=r.pos):(this.enc=r,this.pos=e)}return i.prototype.get=function(r){if(r===void 0&&(r=this.pos++),r>=this.enc.length)throw new Error("Requesting byte offset ".concat(r," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(r):this.enc[r]},i.prototype.hexByte=function(r){return this.hexDigits.charAt(r>>4&15)+this.hexDigits.charAt(r&15)},i.prototype.hexDump=function(r,e,t){for(var n="",a=r;a176)return!1}return!0},i.prototype.parseStringISO=function(r,e){for(var t="",n=r;n191&&a<224?t+=String.fromCharCode((a&31)<<6|this.get(n++)&63):t+=String.fromCharCode((a&15)<<12|(this.get(n++)&63)<<6|this.get(n++)&63)}return t},i.prototype.parseStringBMP=function(r,e){for(var t="",n,a,o=r;o127,a=n?255:0,o,s="";t==a&&++r4){for(s=t,o<<=3;!((+s^a)&128);)s=+s<<1,--o;s="("+o+` bit) diff --git a/dist/copilot_web/workflowChat-82amaGF7.js b/dist/copilot_web/workflowChat-C3ZWZR1l.js similarity index 99% rename from dist/copilot_web/workflowChat-82amaGF7.js rename to dist/copilot_web/workflowChat-C3ZWZR1l.js index a486922..f787362 100644 --- a/dist/copilot_web/workflowChat-82amaGF7.js +++ b/dist/copilot_web/workflowChat-C3ZWZR1l.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-Ci2jcBGf.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-DF-pdh_V.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-C_KwPGE8.js","copilot_web/ParameterDebugInterfaceV2-QYVwPrST.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 @@ -11,7 +11,7 @@ function getImportPath(filename) { return `./${path}`; } }))))=>i.map(i=>d[i]); -import{_ as Ot}from"./input.js";import{j as h,r as xg,b as yg}from"./vendor-markdown-Dek94WS0.js";import{r as I,R as wn,c as Rt}from"./vendor-react-V04_Axys.js";import{f as wg,v as bg,W as ft,a as fn,B as Sg,U as Ag,A as Er,b as Eg,g as en,c as Mt,u as ts,M as Ig}from"./message-components-BQDbTDiL.js";/** +import{_ as Ot}from"./input.js";import{j as h,r as xg,b as yg}from"./vendor-markdown-Dek94WS0.js";import{r as I,R as wn,c as Rt}from"./vendor-react-V04_Axys.js";import{f as wg,v as bg,W as ft,a as fn,B as Sg,U as Ag,A as Er,b as Eg,g as en,c as Mt,u as ts,M as Ig}from"./message-components-C_KwPGE8.js";/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. @@ -112,7 +112,7 @@ ${de.join(` hover:bg-gray-50`,children:"Close"})})]})})]})}function Hg(m){const b=m[0],a=new Set;function U(M,E){if(!(!M||E>=1)&&M.inputs)for(const W of Object.values(M.inputs)){const re=W.link;if(re&&fn.graph.links[re]){const y=fn.graph.links[re].origin_id,q=fn.graph._nodes_by_id[y];q&&(a.add(q.type),U(q,E+1))}}}return b?(U(b,0),[{type:"upstream_node_types",data:Array.from(a)}]):null}function qg({nodeInfo:m,onSendWithIntent:b,loading:a,onSendWithContent:U}){return console.log("SelectedNodeInfo nodeInfo:",m[0]),h.jsx("div",{className:"mb-3 p-3 rounded-md bg-gray-50 border border-gray-200",children:h.jsxs("div",{className:"text-sm text-gray-700",children:[h.jsxs("p",{children:["Selected node: ",m[0].type]}),h.jsxs("div",{className:"flex gap-2 mt-2",children:[h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-blue-50 text-blue-700 hover:bg-blue-100`,onClick:()=>U(`Reply in ${navigator.language} language: How does the ${m[0].type} node work? I need its official usage guide.`),disabled:a,children:"Usage"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-green-100 text-green-700 hover:bg-green-200`,onClick:()=>U(`Reply in ${navigator.language} language: Show me the technical specifications for the ${m[0].type} node's inputs and outputs.`),disabled:a,children:"Parameters"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-purple-100 - text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import(getImportPath("WorkflowOption-Ci2jcBGf.js")),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** + text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import(getImportPath("WorkflowOption-DF-pdh_V.js")),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-C_KwPGE8.js")).then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-C_KwPGE8.js")).then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-C_KwPGE8.js")).then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors @@ -138,4 +138,4 @@ __p += '`),z&&(v+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+v+`return __p -}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import(getImportPath("ParameterDebugInterfaceV2-BpdDX6z-.js")),__vite__mapDeps([4,1,2,3,5,6,7])).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w}; +}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import(getImportPath("ParameterDebugInterfaceV2-QYVwPrST.js")),__vite__mapDeps([4,1,2,3,5,6,7])).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w}; From 72cc3827c20af17d7b8dcd45371eea7a10aab2ec Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Thu, 5 Jun 2025 16:54:10 +0800 Subject: [PATCH 13/14] =?UTF-8?q?feat:=20pre=20=E7=89=88=E6=9C=AC+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/copilot_web/{App-C63C0sLF.js => App-BWNFcFnM.js} | 4 ++-- ...-QYVwPrST.js => ParameterDebugInterfaceV2-BpdDX6z-.js} | 2 +- ...kflowOption-DF-pdh_V.js => WorkflowOption-Ci2jcBGf.js} | 2 +- dist/copilot_web/input.js | 4 ++-- ...ponents-C_KwPGE8.js => message-components-BQDbTDiL.js} | 2 +- ...{workflowChat-C3ZWZR1l.js => workflowChat-82amaGF7.js} | 8 ++++---- pyproject.toml | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) rename dist/copilot_web/{App-C63C0sLF.js => App-BWNFcFnM.js} (85%) rename dist/copilot_web/{ParameterDebugInterfaceV2-QYVwPrST.js => ParameterDebugInterfaceV2-BpdDX6z-.js} (99%) rename dist/copilot_web/{WorkflowOption-DF-pdh_V.js => WorkflowOption-Ci2jcBGf.js} (98%) rename dist/copilot_web/{message-components-C_KwPGE8.js => message-components-BQDbTDiL.js} (99%) rename dist/copilot_web/{workflowChat-C3ZWZR1l.js => workflowChat-82amaGF7.js} (99%) diff --git a/dist/copilot_web/App-C63C0sLF.js b/dist/copilot_web/App-BWNFcFnM.js similarity index 85% rename from dist/copilot_web/App-C63C0sLF.js rename to dist/copilot_web/App-BWNFcFnM.js index 7b8f899..0a3fb2e 100644 --- a/dist/copilot_web/App-C63C0sLF.js +++ b/dist/copilot_web/App-BWNFcFnM.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-C3ZWZR1l.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-C_KwPGE8.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-82amaGF7.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 @@ -11,4 +11,4 @@ function getImportPath(filename) { return `./${path}`; } }))))=>i.map(i=>d[i]); -import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-C_KwPGE8.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-C3ZWZR1l.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; +import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-BQDbTDiL.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-82amaGF7.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/dist/copilot_web/ParameterDebugInterfaceV2-QYVwPrST.js b/dist/copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js similarity index 99% rename from dist/copilot_web/ParameterDebugInterfaceV2-QYVwPrST.js rename to dist/copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js index 7c2d773..67d932c 100644 --- a/dist/copilot_web/ParameterDebugInterfaceV2-QYVwPrST.js +++ b/dist/copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-C_KwPGE8.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-C3ZWZR1l.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white + import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-BQDbTDiL.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-82amaGF7.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white bg-gray-50 dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-400 diff --git a/dist/copilot_web/WorkflowOption-DF-pdh_V.js b/dist/copilot_web/WorkflowOption-Ci2jcBGf.js similarity index 98% rename from dist/copilot_web/WorkflowOption-DF-pdh_V.js rename to dist/copilot_web/WorkflowOption-Ci2jcBGf.js index c36af2a..14c0031 100644 --- a/dist/copilot_web/WorkflowOption-DF-pdh_V.js +++ b/dist/copilot_web/WorkflowOption-Ci2jcBGf.js @@ -1,4 +1,4 @@ function getImportPath(filename) { return `./${filename}`; } - import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-C_KwPGE8.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; + import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-BQDbTDiL.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; diff --git a/dist/copilot_web/input.js b/dist/copilot_web/input.js index 46f0337..e8bba70 100644 --- a/dist/copilot_web/input.js +++ b/dist/copilot_web/input.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-C63C0sLF.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-C_KwPGE8.js","copilot_web/fonts.css"].map(path => { + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-BWNFcFnM.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 @@ -11,4 +11,4 @@ function getImportPath(filename) { return `./${path}`; } }))))=>i.map(i=>d[i]); -import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-C_KwPGE8.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import(getImportPath("App-C63C0sLF.js"));return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; +import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-BQDbTDiL.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import(getImportPath("App-BWNFcFnM.js"));return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; diff --git a/dist/copilot_web/message-components-C_KwPGE8.js b/dist/copilot_web/message-components-BQDbTDiL.js similarity index 99% rename from dist/copilot_web/message-components-C_KwPGE8.js rename to dist/copilot_web/message-components-BQDbTDiL.js index fb1a20c..9cfbfeb 100644 --- a/dist/copilot_web/message-components-C_KwPGE8.js +++ b/dist/copilot_web/message-components-BQDbTDiL.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - import{r as We,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Mpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=We.createContext({state:W$,dispatch:()=>null});function Bpe({children:i}){const[r,e]=We.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=We.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const Ff={apiBaseUrl:"https://comfyui-copilot-server.onrender.com"};function dr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var lI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return lI.charAt(i)}function hI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function cI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function dI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,fI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f + import{r as We,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Mpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=We.createContext({state:W$,dispatch:()=>null});function Bpe({children:i}){const[r,e]=We.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=We.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const Ff={apiBaseUrl:"https://comfyui-copilot-server-pre.onrender.com"};function dr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var lI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return lI.charAt(i)}function hI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function cI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function dI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,fI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f \r  \u2028\u2029`;for(pn={},r=0;r<16;++r)pn[e.charAt(r)]=r;for(e=e.toLowerCase(),r=10;r<16;++r)pn[e.charAt(r)]=r;for(r=0;r=2?(n[n.length]=a,a=0,o=0):a<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},Ii,wd={decode:function(i){var r;if(Ii===void 0){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=`= \f \r  \u2028\u2029`;for(Ii=Object.create(null),r=0;r<64;++r)Ii[e.charAt(r)]=r;for(Ii["-"]=62,Ii._=63,r=0;r=4?(n[n.length]=a>>16,n[n.length]=a>>8&255,n[n.length]=a&255,a=0,o=0):a<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=a>>10;break;case 3:n[n.length]=a>>16,n[n.length]=a>>8&255;break}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(i){var r=wd.re.exec(i);if(r)if(r[1])i=r[1];else if(r[2])i=r[2];else throw new Error("RegExp out of sync");return wd.decode(i)}},gn=1e13,Ua=function(){function i(r){this.buf=[+r||0]}return i.prototype.mulAdd=function(r,e){var t=this.buf,n=t.length,a,o;for(a=0;a0&&(t[a]=e)},i.prototype.sub=function(r){var e=this.buf,t=e.length,n,a;for(n=0;n=0;--n)t+=(gn+e[n]).toString().substring(1);return t},i.prototype.valueOf=function(){for(var r=this.buf,e=0,t=r.length-1;t>=0;--t)e=e*gn+r[t];return e},i.prototype.simplify=function(){var r=this.buf;return r.length==1?r[0]:this},i}(),G$="…",vI=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,pI=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Wn(i,r){return i.length>r&&(i=i.substring(0,r)+G$),i}var nh=function(){function i(r,e){this.hexDigits="0123456789ABCDEF",r instanceof i?(this.enc=r.enc,this.pos=r.pos):(this.enc=r,this.pos=e)}return i.prototype.get=function(r){if(r===void 0&&(r=this.pos++),r>=this.enc.length)throw new Error("Requesting byte offset ".concat(r," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(r):this.enc[r]},i.prototype.hexByte=function(r){return this.hexDigits.charAt(r>>4&15)+this.hexDigits.charAt(r&15)},i.prototype.hexDump=function(r,e,t){for(var n="",a=r;a176)return!1}return!0},i.prototype.parseStringISO=function(r,e){for(var t="",n=r;n191&&a<224?t+=String.fromCharCode((a&31)<<6|this.get(n++)&63):t+=String.fromCharCode((a&15)<<12|(this.get(n++)&63)<<6|this.get(n++)&63)}return t},i.prototype.parseStringBMP=function(r,e){for(var t="",n,a,o=r;o127,a=n?255:0,o,s="";t==a&&++r4){for(s=t,o<<=3;!((+s^a)&128);)s=+s<<1,--o;s="("+o+` bit) diff --git a/dist/copilot_web/workflowChat-C3ZWZR1l.js b/dist/copilot_web/workflowChat-82amaGF7.js similarity index 99% rename from dist/copilot_web/workflowChat-C3ZWZR1l.js rename to dist/copilot_web/workflowChat-82amaGF7.js index f787362..a486922 100644 --- a/dist/copilot_web/workflowChat-C3ZWZR1l.js +++ b/dist/copilot_web/workflowChat-82amaGF7.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-DF-pdh_V.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-C_KwPGE8.js","copilot_web/ParameterDebugInterfaceV2-QYVwPrST.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-Ci2jcBGf.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 @@ -11,7 +11,7 @@ function getImportPath(filename) { return `./${path}`; } }))))=>i.map(i=>d[i]); -import{_ as Ot}from"./input.js";import{j as h,r as xg,b as yg}from"./vendor-markdown-Dek94WS0.js";import{r as I,R as wn,c as Rt}from"./vendor-react-V04_Axys.js";import{f as wg,v as bg,W as ft,a as fn,B as Sg,U as Ag,A as Er,b as Eg,g as en,c as Mt,u as ts,M as Ig}from"./message-components-C_KwPGE8.js";/** +import{_ as Ot}from"./input.js";import{j as h,r as xg,b as yg}from"./vendor-markdown-Dek94WS0.js";import{r as I,R as wn,c as Rt}from"./vendor-react-V04_Axys.js";import{f as wg,v as bg,W as ft,a as fn,B as Sg,U as Ag,A as Er,b as Eg,g as en,c as Mt,u as ts,M as Ig}from"./message-components-BQDbTDiL.js";/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. @@ -112,7 +112,7 @@ ${de.join(` hover:bg-gray-50`,children:"Close"})})]})})]})}function Hg(m){const b=m[0],a=new Set;function U(M,E){if(!(!M||E>=1)&&M.inputs)for(const W of Object.values(M.inputs)){const re=W.link;if(re&&fn.graph.links[re]){const y=fn.graph.links[re].origin_id,q=fn.graph._nodes_by_id[y];q&&(a.add(q.type),U(q,E+1))}}}return b?(U(b,0),[{type:"upstream_node_types",data:Array.from(a)}]):null}function qg({nodeInfo:m,onSendWithIntent:b,loading:a,onSendWithContent:U}){return console.log("SelectedNodeInfo nodeInfo:",m[0]),h.jsx("div",{className:"mb-3 p-3 rounded-md bg-gray-50 border border-gray-200",children:h.jsxs("div",{className:"text-sm text-gray-700",children:[h.jsxs("p",{children:["Selected node: ",m[0].type]}),h.jsxs("div",{className:"flex gap-2 mt-2",children:[h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-blue-50 text-blue-700 hover:bg-blue-100`,onClick:()=>U(`Reply in ${navigator.language} language: How does the ${m[0].type} node work? I need its official usage guide.`),disabled:a,children:"Usage"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-green-100 text-green-700 hover:bg-green-200`,onClick:()=>U(`Reply in ${navigator.language} language: Show me the technical specifications for the ${m[0].type} node's inputs and outputs.`),disabled:a,children:"Parameters"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-purple-100 - text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import(getImportPath("WorkflowOption-DF-pdh_V.js")),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-C_KwPGE8.js")).then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-C_KwPGE8.js")).then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-C_KwPGE8.js")).then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** + text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import(getImportPath("WorkflowOption-Ci2jcBGf.js")),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors @@ -138,4 +138,4 @@ __p += '`),z&&(v+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+v+`return __p -}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import(getImportPath("ParameterDebugInterfaceV2-QYVwPrST.js")),__vite__mapDeps([4,1,2,3,5,6,7])).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w}; +}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import(getImportPath("ParameterDebugInterfaceV2-BpdDX6z-.js")),__vite__mapDeps([4,1,2,3,5,6,7])).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w}; diff --git a/pyproject.toml b/pyproject.toml index daaea80..8af3016 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "ComfyUI-Copilot" description = "Your Intelligent Assistant for Comfy-UI." -version = "1.3.2" +version = "1.3.3" license = {file = "LICENSE"} [project.urls] From e61623abcb9803718ddc023934f185d58076a955 Mon Sep 17 00:00:00 2001 From: ai-business-hql Date: Thu, 5 Jun 2025 17:06:29 +0800 Subject: [PATCH 14/14] feat: prod --- dist/copilot_web/{App-BWNFcFnM.js => App-C63C0sLF.js} | 4 ++-- ...-BpdDX6z-.js => ParameterDebugInterfaceV2-QYVwPrST.js} | 2 +- ...kflowOption-Ci2jcBGf.js => WorkflowOption-DF-pdh_V.js} | 2 +- dist/copilot_web/input.js | 4 ++-- ...ponents-BQDbTDiL.js => message-components-C_KwPGE8.js} | 2 +- ...{workflowChat-82amaGF7.js => workflowChat-C3ZWZR1l.js} | 8 ++++---- 6 files changed, 11 insertions(+), 11 deletions(-) rename dist/copilot_web/{App-BWNFcFnM.js => App-C63C0sLF.js} (85%) rename dist/copilot_web/{ParameterDebugInterfaceV2-BpdDX6z-.js => ParameterDebugInterfaceV2-QYVwPrST.js} (99%) rename dist/copilot_web/{WorkflowOption-Ci2jcBGf.js => WorkflowOption-DF-pdh_V.js} (98%) rename dist/copilot_web/{message-components-BQDbTDiL.js => message-components-C_KwPGE8.js} (99%) rename dist/copilot_web/{workflowChat-82amaGF7.js => workflowChat-C3ZWZR1l.js} (99%) diff --git a/dist/copilot_web/App-BWNFcFnM.js b/dist/copilot_web/App-C63C0sLF.js similarity index 85% rename from dist/copilot_web/App-BWNFcFnM.js rename to dist/copilot_web/App-C63C0sLF.js index 0a3fb2e..7b8f899 100644 --- a/dist/copilot_web/App-BWNFcFnM.js +++ b/dist/copilot_web/App-C63C0sLF.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-82amaGF7.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-C3ZWZR1l.js","copilot_web/input.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-C_KwPGE8.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 @@ -11,4 +11,4 @@ function getImportPath(filename) { return `./${path}`; } }))))=>i.map(i=>d[i]); -import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-BQDbTDiL.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-82amaGF7.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; +import{_ as a}from"./input.js";import{j as t}from"./vendor-markdown-Dek94WS0.js";import{r,R as i}from"./vendor-react-V04_Axys.js";import{C as n}from"./message-components-C_KwPGE8.js";/* empty css */const o={EXPLAIN_NODE:"copilot:explain-node"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-C3ZWZR1l.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function p(){const[e,s]=r.useState(!1);return r.useEffect(()=>{const l=()=>{s(!0)};return window.addEventListener(o.EXPLAIN_NODE,l),()=>window.removeEventListener(o.EXPLAIN_NODE,l)},[]),t.jsx(n,{children:t.jsx("div",{className:"h-full w-full flex flex-col",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:t.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>s(!1)})})})})}export{p as default}; diff --git a/dist/copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js b/dist/copilot_web/ParameterDebugInterfaceV2-QYVwPrST.js similarity index 99% rename from dist/copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js rename to dist/copilot_web/ParameterDebugInterfaceV2-QYVwPrST.js index 67d932c..7c2d773 100644 --- a/dist/copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js +++ b/dist/copilot_web/ParameterDebugInterfaceV2-QYVwPrST.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-BQDbTDiL.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-82amaGF7.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white + import{j as e}from"./vendor-markdown-Dek94WS0.js";import{r as w}from"./vendor-react-V04_Axys.js";import{u as ve,a as V,g as ie,W as se}from"./message-components-C_KwPGE8.js";import{m as gt,i as pt,r as ft,g as bt}from"./workflowChat-C3ZWZR1l.js";import"./input.js";/* empty css */const yt=({selectedNodes:t,handleParamSelect:r,selectedParams:s,handleNext:l,handleClose:a})=>{const n=t.flatMap(i=>(i.widgets||[]).map(d=>d.name)).some(i=>s[i]===!0);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Select parameters"}),e.jsx("p",{className:"text-xs text-gray-500",children:"multiple selections supported"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:a,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.map((i,d)=>{const m=i.title||"Unknown Node",u=i.widgets||[];return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 px-3 py-2 text-sm font-medium text-gray-700 border-b",children:m}),e.jsx("div",{className:"p-4 space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:u.map((x,g)=>{const f=x.name;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s[f]?"border-red-500 bg-red-100":"border-gray-300"}`,onClick:b=>r(f,b),children:s[f]&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"})}),e.jsx("span",{className:"ml-2 text-gray-700 text-xs",children:f})]},`widget-${g}`)})})})]},`node-${d}`)}),e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx("button",{onClick:i=>l(i),disabled:!n,className:`px-3 py-1.5 text-xs ${n?"bg-pink-200 text-pink-700 hover:bg-pink-300":"bg-gray-200 text-gray-500 cursor-not-allowed"} rounded-md transition-colors`,children:"Next"})})]})},jt=({selectedNodes:t,paramTestValues:r,selectedParams:s,updateParamTestValues:l,toggleDropdown:a,openDropdowns:o,handleTestValueSelect:n,searchTerms:i,handleSearch:d,handleSelectAll:m,handleNext:u,handlePrevious:x,handleClose:g,inputValues:f,setInputValues:b,textInputs:$,handleTextInputChange:k,handleAddTextInput:L,handleRemoveTextInput:P,openAiWritingModal:y})=>{const N=(p,S,O,G=0)=>{if(p=isNaN(p)?0:p,S=isNaN(S)?100:S,O=isNaN(O)||O<=0?1:O,S{!t||t.length===0||t.forEach(p=>{const S=p.id.toString(),O=p.widgets||{};Object.values(O).forEach(j=>{const E=j.name;if(!s[E])return;if(!(r[S]?.[E]?.length>0)&&j.type==="number"){const v=j.options?.min||0,T=j.options?.max||100;let I=(j.options?.step||10)/10;I<.1&&(I=.1);const _=j.options?.precision||0,B=N(v,T,I,_);if(B.length>0){l(S,E,B);const z=`${S}_${E}`;b(C=>({...C,[z]:{min:v.toString(),max:T.toString(),step:I.toString()}}))}}if(j.type==="customtext"||j.type.toLowerCase().includes("text")){const v=`${S}_${E}`,T=$[v]||[""];JSON.stringify(T)!==JSON.stringify(r[S]?.[E]||[""])&&l(S,E,T)}})})},[t,s,r,$,l,b,N]),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Set test values"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Configure the test values for each parameter"})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:g,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.length>0?t.map((p,S)=>{const O=p.widgets||{},G=Object.values(O),j=p.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b flex justify-between items-center",children:[e.jsxs("span",{children:[p.type," (ID: ",j,")"]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:E=>g(E,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"p-4 space-y-4",children:G.map((E,R)=>{const v=E.name;if(!s[v])return null;const T=`${j}_${v}`;if(E.type==="customtext"||E.type.toLowerCase().includes("text")){const I=$[T]||[""];return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsxs("button",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs flex items-center hover:bg-blue-200 transition-colors",onClick:()=>y(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),"AI Writing"]})]}),e.jsx("div",{className:"space-y-2",children:I.map((_,B)=>e.jsxs("div",{className:"flex items-start",children:[e.jsx("textarea",{className:`flex-1 border ${_?"border-gray-300":"border-red-500"} rounded p-2 text-xs resize-y`,rows:2,placeholder:"Enter text...",value:_,onChange:z=>k(j,v,B,z.target.value),required:!0}),e.jsx("button",{className:"ml-2 text-red-500 hover:text-red-700",onClick:()=>P(j,v,B),title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},B))}),e.jsxs("button",{className:"mt-2 px-2 py-1 border border-dashed border-gray-300 rounded text-xs text-gray-600 hover:bg-gray-50 flex items-center",onClick:()=>L(j,v),children:[e.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),"Add Text"]})]},R)}if(E.type==="number"){const I=E.options?.min||0,_=E.options?.max||100,B=(E.options?.step||10)/10,z=E.options?.precision||0,C=N(I,_,B,z),F=f[T]||{min:I.toString(),max:_.toString(),step:B.toString()};return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-700",children:[v,":"]}),e.jsx("div",{className:"w-4"})]}),e.jsxs("div",{className:"flex space-x-2 items-center",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Min"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.min,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],min:D}})),D===""||!isNaN(parseFloat(D))){const A=D===""?0:parseFloat(D),H=parseFloat(F.max||_.toString()),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Max"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.max,onClick:M=>{M.preventDefault(),M.stopPropagation()},required:!0,onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],max:D}})),D===""||!isNaN(parseFloat(D))){const A=parseFloat(F.min||I.toString()),H=D===""?A:parseFloat(D),U=parseFloat(F.step||B.toString()),J=N(A,H,U,z);l(j,v,J)}}}),e.jsx("label",{className:"text-xs text-gray-600",children:"Step"}),e.jsx("input",{type:"text",className:"w-12 h-6 border border-gray-300 rounded text-xs px-2",value:F.step,required:!0,onClick:M=>{M.preventDefault(),M.stopPropagation()},onChange:M=>{M.preventDefault(),M.stopPropagation();const D=M.target.value;if(b(A=>({...A,[T]:{...A[T],step:D}})),D===""||!isNaN(parseFloat(D))&&parseFloat(D)>0){const A=parseFloat(F.min||I.toString()),H=parseFloat(F.max||_.toString());let U=D===""?1:parseFloat(D);U<.1&&(U=.1);const J=N(A,H,U,z);l(j,v,J)}}})]}),e.jsxs("div",{className:"mt-1",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(()=>{const M=r[j]?.[v]||C;if(M.length<=10)return M.map((D,A)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:H=>{H.stopPropagation(),n(j,v,D,H)},children:[e.jsx("span",{children:D}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},A));{const D=M.slice(0,5),A=M.slice(M.length-5);return e.jsxs(e.Fragment,{children:[D.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`first-${U}`)),e.jsx("div",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md flex items-center text-xs",children:"..."}),A.map((H,U)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs cursor-pointer hover:bg-blue-200",onClick:J=>{J.stopPropagation(),n(j,v,H,J)},children:[e.jsx("span",{children:H}),e.jsx("svg",{className:"w-4 h-4 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},`last-${U}`))]})}})()})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-xs text-gray-500",children:"Values are distributed evenly between Min and Max"})})]},R)}else if(E.type==="combo"){const I=E.options?.values||[],_=`${j}_${v}`,B=C=>typeof C=="string"?C:C&&typeof C=="object"&&"name"in C?C.name:String(C),z=C=>typeof C=="object"&&C!==null&&"name"in C?C.name:C;return e.jsxs("div",{className:"border-b pb-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v}),e.jsxs("div",{className:"relative dropdown-container",children:[e.jsxs("button",{className:`appearance-none border ${(r[j]?.[v]||[]).length===0?"border-red-500":"border-gray-300"} rounded px-2 py-0.5 pr-6 text-xs flex items-center bg-white text-gray-700`,onClick:C=>{C.preventDefault(),C.stopPropagation(),a(j,v,C)},"data-dropdown":_,children:[e.jsx("span",{children:(r[j]?.[v]||[]).length>0?`${v}: ${(r[j]?.[v]||[]).length} selected`:`Select ${v}`}),e.jsx("div",{className:"ml-2",children:e.jsx("svg",{className:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})})})]}),o[_]&&e.jsxs("div",{className:"absolute z-[9999] mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg dropdown-menu",style:{position:"fixed",top:typeof o[_]=="object"?`${o[_].y}px`:"0px",left:typeof o[_]=="object"?`${o[_].x}px`:"0px",maxHeight:"300px",overflowY:"auto"},children:[e.jsx("div",{className:"p-2 border-b sticky top-0 bg-white",children:e.jsx("input",{type:"text",className:"w-full px-2 py-0.5 text-xs border border-gray-300 rounded",placeholder:"Search...",value:i[_]||"",onChange:C=>{C.preventDefault(),C.stopPropagation(),d(j,v,C.target.value)},onClick:C=>{C.preventDefault(),C.stopPropagation()},autoFocus:!0})}),e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 border-b cursor-pointer text-xs flex items-center text-gray-700 hover:bg-gray-100",onClick:C=>{C.preventDefault(),C.stopPropagation();const M=I.filter(D=>!i[_]||B(D).toLowerCase().includes((i[_]||"").toLowerCase())).map(z);m(j,v,M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${I.length>0&&(r[j]?.[v]||[]).length===I.length?"bg-blue-500 border-blue-500":(r[j]?.[v]||[]).length>0?"bg-blue-500 border-blue-500 opacity-50":"border-gray-300"}`,children:(r[j]?.[v]||[]).length>0&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"font-medium",children:I.length>0&&(r[j]?.[v]||[]).length===I.length?"Deselect All":"Select All"})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).map((C,F)=>e.jsxs("div",{className:"px-3 py-1.5 hover:bg-gray-100 cursor-pointer text-xs flex items-center text-gray-700",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,z(C),M)},children:[e.jsx("div",{className:`w-4 h-4 mr-2 border rounded-sm flex items-center justify-center ${(r[j]?.[v]||[]).includes(z(C))?"bg-blue-500 border-blue-500":"border-gray-300"}`,children:(r[j]?.[v]||[]).includes(z(C))&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("span",{className:"whitespace-normal overflow-hidden text-ellipsis",children:B(C)})]},F)),I.filter(C=>!i[_]||B(C).toLowerCase().includes((i[_]||"").toLowerCase())).length===0&&e.jsx("div",{className:"px-3 py-4 text-sm text-gray-500 text-center",children:"No matching options"})]})]})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),(r[j]?.[v]||[]).length===0&&e.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Please select at least one value"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:(r[j]?.[v]||[]).map((C,F)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:C}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:M=>{M.preventDefault(),M.stopPropagation(),n(j,v,C,M)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},F))})]})]},R)}else return e.jsxs("div",{className:"border-b pb-3",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("label",{className:"text-xs font-medium text-gray-700",children:v})}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"text-xs text-gray-600",children:"Test values"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[(r[j]?.[v]||[]).map((I,_)=>e.jsxs("div",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded-md flex items-center text-xs",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:"w-4 h-4 ml-1 cursor-pointer hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",onClick:B=>{B.preventDefault(),B.stopPropagation(),n(j,v,I,B)},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]},_)),e.jsxs("button",{className:"px-2 py-0.5 border border-dashed border-blue-300 text-blue-600 rounded-md text-xs flex items-center hover:bg-blue-50",onClick:I=>{I.preventDefault(),I.stopPropagation();const _=`${v}${(r[j]?.[v]||[]).length+1}`;l(j,v,[...r[j]?.[v]||[],_])},children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),e.jsx("span",{children:"Add"})]})]})]})]},R)})})]},S)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:p=>x(p),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:p=>u(p),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",children:"Next"})]})]})},vt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,errorMessage:a,handlePrevious:o,handleStartGeneration:n,handleClose:i})=>{const[d,m]=w.useState([]),[u,x]=w.useState(null),[g,f]=w.useState(!1);ve();const b=()=>{const k=Object.values(V.graph._nodes_by_id),L=[],P=[];for(const N of k)N.type==="SaveImage"?L.push(N.id):N.type==="PreviewImage"&&P.push(N.id);const y=[...L,...P];m(y),y.length===1?x(y[0]):y.length>1&&(f(!0),x(null))};w.useEffect(()=>{b()},[]),w.useEffect(()=>{const k=()=>{if(!V.canvas.selected_nodes)return;const L=Object.values(V.canvas.selected_nodes);if(L.length===0)return;const P=L[0];P&&(P.type==="SaveImage"||P.type==="PreviewImage")&&(console.log("Selected image node:",P.id),x(P.id))};return document.addEventListener("click",k),()=>{document.removeEventListener("click",k)}},[]);const $=k=>{if(k&&(k.preventDefault(),k.stopPropagation()),d.length>1&&!u){f(!0);return}n(k,u||void 0)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Conform combinations"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:i,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g&&d.length>1&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md text-amber-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:u===null?`Multiple SaveImage and PreviewImage nodes detected with IDs ${d.join(",")}. Please click the node on canvas.`:`Current node ID is ${u}, please click Start Generation again`})]})}),a&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:a})]})}),t.length>0?t.map((k,L)=>{const P=k.type||"Unknown Node",y=k.widgets||[],N=k.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[P," (ID: ",N,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:y.map((p,S)=>{const O=p.name;if(!s[O])return null;const G=r[N]?.[O]||[],j=Array.isArray(G)?`[${G.join(", ")}]`:JSON.stringify(G);return e.jsxs("div",{className:SE.preventDefault()})})]},S)})})]},L)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500 text-xs",children:"No nodes selected. Please select a node in the workflow to configure parameters."}),e.jsxs("div",{className:"mt-6 flex justify-between",children:[e.jsx("button",{onClick:k=>o(k),className:"px-3 py-1.5 text-xs bg-gray-100 text-gray-800 rounded-md hover:bg-gray-200 transition-colors",children:"Previous"}),e.jsx("button",{onClick:k=>$(k),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${d.length>1&&!u?"bg-gray-200 text-gray-500 cursor-not-allowed":"bg-pink-200 text-pink-700 hover:bg-pink-300"}`,disabled:d.length>1&&!u,children:"Generate & Compare"})]})]})},Nt=({selectedNodes:t,paramTestValues:r,selectedParams:s,totalCount:l,completedCount:a,errorMessage:o,handleClose:n,setIsProcessing:i,setCurrentScreen:d,cleanupPolling:m})=>{const u=x=>{x.preventDefault(),x.stopPropagation(),gt({clear:!0}),pt(),m&&m(),i(!1),d(2)};return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-500 bg-opacity-30 flex flex-col items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-gray-800 bg-white p-4 rounded-lg shadow-lg",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Processing..."}),e.jsxs("div",{className:"text-xs mb-3",children:["Completed ",a," of ",l," runs"]}),e.jsx("div",{className:"w-48 h-2 bg-gray-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-pink-500 transition-all duration-200",style:{width:`${a/l*100}%`}})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:["Already generated ",a," images"]}),e.jsx("button",{onClick:u,className:"mt-4 px-3 py-1.5 text-xs bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Cancel"})]})}),e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Confirm Test Configuration"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In the selected parameter combinations, there are ",l," total runs. Each run will generate a separate image."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:n,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md text-red-600 text-xs",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("div",{className:"ml-2",children:o})]})}),t.length>0?t.map((x,g)=>{const f=x.type||"Unknown Node",b=x.widgets||[],$=x.id;return e.jsxs("div",{className:"border rounded-md mb-4 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs font-medium text-gray-700 border-b",children:[f," (ID: ",$,")"]}),e.jsx("div",{className:"p-4 space-y-3",children:b.map((k,L)=>{const P=k.name;if(!s[P])return null;const y=r[$]?.[P]||[],N=Array.isArray(y)?`[${y.join(", ")}]`:JSON.stringify(y);return e.jsxs("div",{className:Lp.preventDefault()})})]},L)})})]},g)}):e.jsx("div",{className:"border rounded-md mb-4 p-4 text-center text-gray-500",children:"No nodes selected. Please select a node in the workflow to configure parameters."})]})},te=({visible:t,imageUrl:r,params:s,onClose:l})=>{if(!t)return null;const a=()=>{if(!s||!s.nodeParams)return null;const o=Object.entries(s.nodeParams).map(([n,i])=>{const d=s.nodeNames?.[n]||s.selectedNodeInfoMap&&s.selectedNodeInfoMap[n]||(n.includes("text")?"Text Node":`Node ${n}`),m=Object.entries(i).filter(([u,x])=>typeof x!="object"||x===null).map(([u,x])=>e.jsxs("div",{className:"pl-4 text-sm py-1 flex",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400 mr-2",children:"-"}),e.jsxs("span",{className:"font-medium mr-1",children:[u,":"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 break-all",children:String(x)})]},u));return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-semibold text-pink-600 dark:text-pink-400 text-base py-1 border-b border-gray-200 dark:border-gray-700 mb-2",children:d}),m.length>0?m:e.jsx("div",{className:"pl-4 text-sm text-gray-500 italic",children:"nodeParams is null"})]},n)});return e.jsx("div",{className:"overflow-y-auto max-h-full",children:o.length>0?o:e.jsx("div",{className:"text-sm text-gray-500 italic",children:"nodeParams is null"})})};return e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50",onClick:l,children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl flex flex-row w-[90%] max-w-6xl max-h-[90vh] relative m-4 overflow-hidden",onClick:o=>o.stopPropagation(),style:{display:"flex",flexDirection:"row"},children:[e.jsx("button",{className:"absolute top-2 right-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 p-1 z-10",onClick:l,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"w-[65%] border-r border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"p-4 h-full flex items-center justify-center",children:e.jsx("img",{src:r,alt:"Enlarged image",className:"max-w-full max-h-[calc(90vh-2rem)] object-contain"})})}),e.jsx("div",{className:"w-[35%] h-full overflow-hidden flex flex-col",children:e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4",children:"Parameters"}),s&&!s.nodeParams&&Object.entries(s).filter(([o,n])=>o!=="nodeParams"&&typeof n!="object").map(([o,n])=>e.jsxs("div",{className:"py-1 text-sm text-gray-600 dark:text-gray-300",children:[e.jsxs("span",{className:"font-medium",children:[o,":"]})," ",String(n)]},o)),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a()})]})})]})})},wt=({generatedImages:t,selectedImageIndex:r,handleSelectImage:s,handleApplySelected:l,handlePrevious:a,handleClose:o,currentPage:n,handlePageChange:i,imagesPerPage:d,notificationVisible:m,modalVisible:u,modalImageUrl:x,modalImageParams:g,openImageModal:f,closeImageModal:b})=>{const $=Math.ceil(t.length/d),k=(n-1)*d,L=Math.min(k+d,t.length),P=t.slice(k,L);return e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[e.jsxs("div",{className:"mb-4 border-b pb-2 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium text-gray-800",children:"Generation Complete"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["All ",t.length," images have been generated."]})]}),e.jsx("button",{className:"text-gray-400 hover:text-gray-600",onClick:o,children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),m&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-100 border-l-4 border-green-500 text-green-700 p-3 shadow-md rounded animate-fade-in-out z-50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"py-1",children:e.jsx("svg",{className:"h-4 w-4 text-green-500 mr-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-xs",children:"Parameters has been applied."})]})}),e.jsx(te,{visible:u,imageUrl:x,params:g||{},onClose:b}),e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:P.map((y,N)=>{const p=k+N;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden border ${r===p?"border-pink-500 ring-2 ring-pink-300":"border-gray-200"}`,onClick:S=>s(p,S),children:[e.jsx("button",{className:"absolute top-2 right-2 bg-white bg-opacity-75 rounded-full p-0.5 text-gray-600 hover:text-gray-900 shadow-sm z-10",onClick:S=>f(y.url,y.params,S),children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}),e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:y.url,alt:`Generated image ${p+1}`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"p-2 text-xs text-gray-600 bg-white max-h-16 overflow-y-auto",children:Object.entries(y.params).filter(([S,O])=>S!=="nodeParams"&&typeof O!="object").map(([S,O])=>e.jsxs("div",{children:[S,": ",String(O)]},S))})]},p)})}),$>1&&e.jsxs("div",{className:"flex justify-center items-center space-x-2 mt-4 mb-4",children:[e.jsx("button",{onClick:y=>i(1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M15.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M8.707 15.707a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414l5-5a1 1 0 111.414 1.414L4.414 10l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})]})}),e.jsx("button",{onClick:y=>i(n-1,y),disabled:n===1,className:`px-2 py-1 rounded ${n===1?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"px-2 py-1 text-xs text-gray-800",children:["Page ",n," of ",$]}),e.jsx("button",{onClick:y=>i(n+1,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})}),e.jsx("button",{onClick:y=>i($,y),disabled:n===$,className:`px-2 py-1 rounded ${n===$?"text-gray-400 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[e.jsx("path",{fillRule:"evenodd",d:"M4.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L8.586 10 4.293 14.293a1 1 0 000 1.414z",clipRule:"evenodd"}),e.jsx("path",{fillRule:"evenodd",d:"M11.293 15.707a1 1 0 001.414 0l5-5a1 1 0 000-1.414l-5-5a1 1 0 00-1.414 1.414L15.586 10l-4.293 4.293a1 1 0 000 1.414z",clipRule:"evenodd"})]})})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:y=>l(y),className:"px-3 py-1.5 text-xs bg-pink-200 text-pink-700 rounded-md hover:bg-pink-300 transition-colors",disabled:r===null,children:"Apply Selected"})})]})},kt=({visible:t,aiWritingModalText:r,setAiWritingModalText:s,aiGeneratedTexts:l,aiSelectedTexts:a,aiWritingLoading:o,aiWritingError:n,handleAiWriting:i,toggleTextSelection:d,addSelectedTexts:m,onClose:u})=>t?e.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"AI Writing Assistant"}),e.jsx("button",{className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:u,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:"Enter text and AI will generate variations"}),e.jsx("textarea",{className:`w-full px-4 py-3 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white bg-gray-50 dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-400 diff --git a/dist/copilot_web/WorkflowOption-Ci2jcBGf.js b/dist/copilot_web/WorkflowOption-DF-pdh_V.js similarity index 98% rename from dist/copilot_web/WorkflowOption-Ci2jcBGf.js rename to dist/copilot_web/WorkflowOption-DF-pdh_V.js index 14c0031..c36af2a 100644 --- a/dist/copilot_web/WorkflowOption-Ci2jcBGf.js +++ b/dist/copilot_web/WorkflowOption-DF-pdh_V.js @@ -1,4 +1,4 @@ function getImportPath(filename) { return `./${filename}`; } - import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-BQDbTDiL.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; + import{j as t}from"./vendor-markdown-Dek94WS0.js";import{W as p,g as u,a as d}from"./message-components-C_KwPGE8.js";import{r as N}from"./vendor-react-V04_Axys.js";function O({content:v,name:C="Assistant",avatar:_,latestInput:y,installedNodes:k,onAddMessage:g}){const h=JSON.parse(v),w=h.ext?.find(e=>e.type==="workflow")?.data||[],[i,c]=N.useState({}),b=async e=>{if(!e.id){console.error("No workflow id provided");return}const r=String(e.id);if(!i[r]){c(o=>({...o,[r]:!0})),p.trackEvent({event_type:"workflow_accept",message_type:"workflow",message_id:h.message_id,data:{workflow_id:e.id,workflow_name:e.name}});try{const o=await p.getOptimizedWorkflow(e.id,y);if(o.workflow){const a=new Set;if(o.workflow.nodes)for(const s of o.workflow.nodes)a.add(s.type);else for(const s of Object.values(o.workflow))a.add(s.class_type);const n=Array.from(a).filter(s=>!k.includes(s));if(console.log("[WorkflowOption] Missing node types:",n),n.length>0){try{console.log("[WorkflowOption] Fetching info for missing nodes");const s=await p.batchGetNodeInfo(n);console.log("[WorkflowOption] Received node infos:",s);const m={text:"",ext:[{type:"node_install_guide",data:s.map(l=>({name:l.name,repository_url:l.github_url}))}]},f={id:u(),role:"ai",content:JSON.stringify(m),format:"markdown",name:"Assistant",metadata:{pendingWorkflow:o.workflow,optimizedParams:o.optimized_params}};g?.(f)}catch(s){console.error("[WorkflowOption] Error fetching node info:",s),alert("Error checking required nodes. Please try again.")}finally{c(s=>({...s,[r]:!1}))}return}j(o.workflow,o.optimized_params)}}catch(o){console.error("Failed to optimize workflow:",o),alert("Failed to optimize workflow. Please try again.")}finally{c(o=>({...o,[r]:!1}))}}},j=(e,r)=>{e.nodes?d.loadGraphData(e):d.loadApiJson(e);for(const[a,n,s,m,f]of r){const l=d.graph._nodes_by_id[a].widgets;for(const x of l)x.name===m&&(x.value=f)}d.graph.setDirtyCanvas(!1,!0);const o={id:u(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};g?.(o)};return t.jsx("div",{className:"space-y-3",children:w.length>0&&t.jsx("div",{className:"flex flex-col space-y-4",children:w.map((e,r)=>{const o=e.id?String(e.id):"";return t.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 hover:bg-gray-50",children:[e.image&&t.jsx("img",{src:e.image,alt:e.name,className:"w-14 h-14 object-cover rounded-lg",onError:a=>{const n=a.target;n.onerror=null,n.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none'%3E%3Crect width='56' height='56' fill='%23F3F4F6'/%3E%3Cpath d='M28 28C30.2091 28 32 26.2091 32 24C32 21.7909 30.2091 20 28 20C25.7909 20 24 21.7909 24 24C24 26.2091 25.7909 28 28 28Z' fill='%239CA3AF'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.7253 37.6307C19.8278 35.1533 22.6897 33.6 26 33.6H30C33.3103 33.6 36.1722 35.1533 37.2747 37.6307C37.6419 38.4561 37.0611 39.2 36.1694 39.2H19.8306C18.9389 39.2 18.3581 38.4561 18.7253 37.6307Z' fill='%239CA3AF'/%3E%3C/svg%3E"}}),t.jsxs("div",{className:"flex-1 break-words flex flex-col h-[4.5rem] justify-between",children:[t.jsx("div",{children:t.jsx("h3",{className:"font-medium text-sm line-clamp-2 h-10 overflow-hidden",children:e.name})}),t.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.description&&t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-500 cursor-help",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})}),t.jsx("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block",children:t.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-md py-2 px-3 min-w-[400px] whitespace-normal break-words",children:e.description})})]}),t.jsx("button",{onClick:()=>b(e),disabled:i[o],className:`px-3 py-1.5 ${i[o]?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"} text-white rounded-md transition-colors text-xs`,children:i[o]?"Loading...":"Accept"})]})]})]},r)})})})}export{O as WorkflowOption}; diff --git a/dist/copilot_web/input.js b/dist/copilot_web/input.js index e8bba70..46f0337 100644 --- a/dist/copilot_web/input.js +++ b/dist/copilot_web/input.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-BWNFcFnM.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/fonts.css"].map(path => { + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-C63C0sLF.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-C_KwPGE8.js","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 @@ -11,4 +11,4 @@ function getImportPath(filename) { return `./${path}`; } }))))=>i.map(i=>d[i]); -import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-BQDbTDiL.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import(getImportPath("App-BWNFcFnM.js"));return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; +import{j as s}from"./vendor-markdown-Dek94WS0.js";import{a as w,R as p,r as x}from"./vendor-react-V04_Axys.js";import{w as v,a as g}from"./message-components-C_KwPGE8.js";/* empty css */const R="modulepreload",b=function(e){return"/"+e},m={},C=function(c,a,P){let d=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(a.map(o=>{if(o=b(o),o in m)return;m[o]=!0;const i=o.endsWith(".css"),h=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=i?"stylesheet":R,i||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),i)return new Promise((y,E)=>{n.addEventListener("load",y),n.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${o}`)))})}))}function u(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&u(t.reason);return c().catch(u)})};var l={},f=w;l.createRoot=f.createRoot,l.hydrateRoot=f.hydrateRoot;const S=p.lazy(()=>C(async()=>{const{default:e}=await import(getImportPath("App-C63C0sLF.js"));return{default:e}},__vite__mapDeps([0,1,2,3,4])).then(({default:e})=>({default:e})));function j(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}j().then(()=>v()).then(()=>{g.extensionManager.registerSidebarTab({id:"comfyui-copilot",icon:"cc-icon-logo",title:"ComfyUI Copilot",tooltip:"ComfyUI Copilot",type:"custom",render:e=>{const c=document.createElement("div");c.id="comfyui-copilot-plugin",c.className="h-full w-full flex flex-col",e.style.height="100%",e.appendChild(c),l.createRoot(c).render(s.jsx(p.StrictMode,{children:s.jsx(x.Suspense,{fallback:s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:s.jsx(S,{})})}))}})});export{C as _}; diff --git a/dist/copilot_web/message-components-BQDbTDiL.js b/dist/copilot_web/message-components-C_KwPGE8.js similarity index 99% rename from dist/copilot_web/message-components-BQDbTDiL.js rename to dist/copilot_web/message-components-C_KwPGE8.js index 9cfbfeb..fb1a20c 100644 --- a/dist/copilot_web/message-components-BQDbTDiL.js +++ b/dist/copilot_web/message-components-C_KwPGE8.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - import{r as We,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Mpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=We.createContext({state:W$,dispatch:()=>null});function Bpe({children:i}){const[r,e]=We.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=We.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const Ff={apiBaseUrl:"https://comfyui-copilot-server-pre.onrender.com"};function dr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var lI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return lI.charAt(i)}function hI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function cI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function dI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,fI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f + import{r as We,R as eI}from"./vendor-react-V04_Axys.js";import{j as S,M as tI,r as rI,a as iI,b as nI,c as aI}from"./vendor-markdown-Dek94WS0.js";let Mt=null;const mp=location.pathname.split("/").slice(0,-1).join("/");let oI=null;async function Mpe(){try{await Promise.all([import(mp+"/scripts/api.js").then(i=>{oI=i?.api}),import(mp+"/scripts/app.js").then(i=>{Mt=i?.app})])}catch(i){console.error("waitForApp error",i)}}const W$={messages:[],selectedNode:null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function sI(i,r){switch(r.type){case"SET_MESSAGES":return{...i,messages:r.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,r.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(e=>e.id===r.payload.id&&!e.finished?r.payload:e)};case"SET_SELECTED_NODE":return{...i,selectedNode:r.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:r.payload};case"SET_LOADING":return{...i,loading:r.payload};case"SET_SESSION_ID":return{...i,sessionId:r.payload};case"SET_SHOW_CHAT":return{...i,showChat:r.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:r.payload};case"SET_SCREEN_STATE":return{...i,screenState:r.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const U$=We.createContext({state:W$,dispatch:()=>null});function Bpe({children:i}){const[r,e]=We.useReducer(sI,W$);return eI.useEffect(()=>{r.sessionId&&r.messages.length>0&&localStorage.setItem(`messages_${r.sessionId}`,JSON.stringify(r.messages))},[r.messages,r.sessionId]),S.jsx(U$.Provider,{value:{state:r,dispatch:e},children:i})}function uI(){const i=We.useContext(U$);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const Ff={apiBaseUrl:"https://comfyui-copilot-server.onrender.com"};function dr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}var lI="0123456789abcdefghijklmnopqrstuvwxyz";function Or(i){return lI.charAt(i)}function hI(i,r){return i&r}function ys(i,r){return i|r}function bp(i,r){return i^r}function $p(i,r){return i&~r}function cI(i){if(i==0)return-1;var r=0;return i&65535||(i>>=16,r+=16),i&255||(i>>=8,r+=8),i&15||(i>>=4,r+=4),i&3||(i>>=2,r+=2),i&1||++r,r}function dI(i){for(var r=0;i!=0;)i&=i-1,++r;return r}var Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K$="=";function Iu(i){var r,e,t="";for(r=0;r+3<=i.length;r+=3)e=parseInt(i.substring(r,r+3),16),t+=Pn.charAt(e>>6)+Pn.charAt(e&63);for(r+1==i.length?(e=parseInt(i.substring(r,r+1),16),t+=Pn.charAt(e<<2)):r+2==i.length&&(e=parseInt(i.substring(r,r+2),16),t+=Pn.charAt(e>>2)+Pn.charAt((e&3)<<4));(t.length&3)>0;)t+=K$;return t}function wp(i){var r="",e,t=0,n=0;for(e=0;e>2),n=a&3,t=1):t==1?(r+=Or(n<<2|a>>4),n=a&15,t=2):t==2?(r+=Or(n),r+=Or(a>>2),n=a&3,t=3):(r+=Or(n<<2|a>>4),r+=Or(a&15),t=0))}return t==1&&(r+=Or(n<<2)),r}var pn,fI={decode:function(i){var r;if(pn===void 0){var e="0123456789ABCDEF",t=` \f \r  \u2028\u2029`;for(pn={},r=0;r<16;++r)pn[e.charAt(r)]=r;for(e=e.toLowerCase(),r=10;r<16;++r)pn[e.charAt(r)]=r;for(r=0;r=2?(n[n.length]=a,a=0,o=0):a<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},Ii,wd={decode:function(i){var r;if(Ii===void 0){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=`= \f \r  \u2028\u2029`;for(Ii=Object.create(null),r=0;r<64;++r)Ii[e.charAt(r)]=r;for(Ii["-"]=62,Ii._=63,r=0;r=4?(n[n.length]=a>>16,n[n.length]=a>>8&255,n[n.length]=a&255,a=0,o=0):a<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=a>>10;break;case 3:n[n.length]=a>>16,n[n.length]=a>>8&255;break}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(i){var r=wd.re.exec(i);if(r)if(r[1])i=r[1];else if(r[2])i=r[2];else throw new Error("RegExp out of sync");return wd.decode(i)}},gn=1e13,Ua=function(){function i(r){this.buf=[+r||0]}return i.prototype.mulAdd=function(r,e){var t=this.buf,n=t.length,a,o;for(a=0;a0&&(t[a]=e)},i.prototype.sub=function(r){var e=this.buf,t=e.length,n,a;for(n=0;n=0;--n)t+=(gn+e[n]).toString().substring(1);return t},i.prototype.valueOf=function(){for(var r=this.buf,e=0,t=r.length-1;t>=0;--t)e=e*gn+r[t];return e},i.prototype.simplify=function(){var r=this.buf;return r.length==1?r[0]:this},i}(),G$="…",vI=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,pI=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Wn(i,r){return i.length>r&&(i=i.substring(0,r)+G$),i}var nh=function(){function i(r,e){this.hexDigits="0123456789ABCDEF",r instanceof i?(this.enc=r.enc,this.pos=r.pos):(this.enc=r,this.pos=e)}return i.prototype.get=function(r){if(r===void 0&&(r=this.pos++),r>=this.enc.length)throw new Error("Requesting byte offset ".concat(r," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(r):this.enc[r]},i.prototype.hexByte=function(r){return this.hexDigits.charAt(r>>4&15)+this.hexDigits.charAt(r&15)},i.prototype.hexDump=function(r,e,t){for(var n="",a=r;a176)return!1}return!0},i.prototype.parseStringISO=function(r,e){for(var t="",n=r;n191&&a<224?t+=String.fromCharCode((a&31)<<6|this.get(n++)&63):t+=String.fromCharCode((a&15)<<12|(this.get(n++)&63)<<6|this.get(n++)&63)}return t},i.prototype.parseStringBMP=function(r,e){for(var t="",n,a,o=r;o127,a=n?255:0,o,s="";t==a&&++r4){for(s=t,o<<=3;!((+s^a)&128);)s=+s<<1,--o;s="("+o+` bit) diff --git a/dist/copilot_web/workflowChat-82amaGF7.js b/dist/copilot_web/workflowChat-C3ZWZR1l.js similarity index 99% rename from dist/copilot_web/workflowChat-82amaGF7.js rename to dist/copilot_web/workflowChat-C3ZWZR1l.js index a486922..f787362 100644 --- a/dist/copilot_web/workflowChat-82amaGF7.js +++ b/dist/copilot_web/workflowChat-C3ZWZR1l.js @@ -1,7 +1,7 @@ function getImportPath(filename) { return `./${filename}`; } - const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-Ci2jcBGf.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-BQDbTDiL.js","copilot_web/ParameterDebugInterfaceV2-BpdDX6z-.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-DF-pdh_V.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-C_KwPGE8.js","copilot_web/ParameterDebugInterfaceV2-QYVwPrST.js","copilot_web/input.js","copilot_web/assets/input-BFxtFr8c.css","copilot_web/fonts.css"].map(path => { const apiBase = window.comfyAPI?.api?.api?.api_base; if (apiBase) { // 有 API base 时,使用完整路径 @@ -11,7 +11,7 @@ function getImportPath(filename) { return `./${path}`; } }))))=>i.map(i=>d[i]); -import{_ as Ot}from"./input.js";import{j as h,r as xg,b as yg}from"./vendor-markdown-Dek94WS0.js";import{r as I,R as wn,c as Rt}from"./vendor-react-V04_Axys.js";import{f as wg,v as bg,W as ft,a as fn,B as Sg,U as Ag,A as Er,b as Eg,g as en,c as Mt,u as ts,M as Ig}from"./message-components-BQDbTDiL.js";/** +import{_ as Ot}from"./input.js";import{j as h,r as xg,b as yg}from"./vendor-markdown-Dek94WS0.js";import{r as I,R as wn,c as Rt}from"./vendor-react-V04_Axys.js";import{f as wg,v as bg,W as ft,a as fn,B as Sg,U as Ag,A as Er,b as Eg,g as en,c as Mt,u as ts,M as Ig}from"./message-components-C_KwPGE8.js";/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. @@ -112,7 +112,7 @@ ${de.join(` hover:bg-gray-50`,children:"Close"})})]})})]})}function Hg(m){const b=m[0],a=new Set;function U(M,E){if(!(!M||E>=1)&&M.inputs)for(const W of Object.values(M.inputs)){const re=W.link;if(re&&fn.graph.links[re]){const y=fn.graph.links[re].origin_id,q=fn.graph._nodes_by_id[y];q&&(a.add(q.type),U(q,E+1))}}}return b?(U(b,0),[{type:"upstream_node_types",data:Array.from(a)}]):null}function qg({nodeInfo:m,onSendWithIntent:b,loading:a,onSendWithContent:U}){return console.log("SelectedNodeInfo nodeInfo:",m[0]),h.jsx("div",{className:"mb-3 p-3 rounded-md bg-gray-50 border border-gray-200",children:h.jsxs("div",{className:"text-sm text-gray-700",children:[h.jsxs("p",{children:["Selected node: ",m[0].type]}),h.jsxs("div",{className:"flex gap-2 mt-2",children:[h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-blue-50 text-blue-700 hover:bg-blue-100`,onClick:()=>U(`Reply in ${navigator.language} language: How does the ${m[0].type} node work? I need its official usage guide.`),disabled:a,children:"Usage"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-green-100 text-green-700 hover:bg-green-200`,onClick:()=>U(`Reply in ${navigator.language} language: Show me the technical specifications for the ${m[0].type} node's inputs and outputs.`),disabled:a,children:"Parameters"}),h.jsx("button",{className:`px-3 py-1 text-xs rounded-md bg-purple-100 - text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import(getImportPath("WorkflowOption-Ci2jcBGf.js")),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-BQDbTDiL.js")).then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** + text-purple-700 hover:bg-purple-200`,onClick:()=>b("downstream_subgraph_search",Hg(m)),disabled:a,children:"Downstream Nodes"})]})]})})}function Zg(){return h.jsx(Sg,{name:"Assistant",children:h.jsxs("div",{className:"flex items-center space-x-2 p-4 bg-gray-50 rounded-lg",children:[h.jsxs("div",{className:"flex space-x-1",children:[h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{className:"text-sm text-gray-500",children:"AI is thinking..."})]})})}const Yg=m=>`https://ui-avatars.com/api/?name=${m||"User"}&background=random`,Jg=I.lazy(()=>Ot(()=>import(getImportPath("WorkflowOption-DF-pdh_V.js")),__vite__mapDeps([0,1,2,3])).then(m=>({default:m.WorkflowOption}))),Xg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-C_KwPGE8.js")).then(m=>m.N),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeSearch}))),Qg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-C_KwPGE8.js")).then(m=>m.D),__vite__mapDeps([3,2,1])).then(m=>({default:m.DownstreamSubgraphs}))),Vg=I.lazy(()=>Ot(()=>import(getImportPath("message-components-C_KwPGE8.js")).then(m=>m.d),__vite__mapDeps([3,2,1])).then(m=>({default:m.NodeInstallGuide})));function ep({messages:m,latestInput:b,onOptionClick:a,installedNodes:U,onAddMessage:M,loading:E}){const W=wn.useMemo(()=>y=>{if(y.role==="user")return h.jsx(Ag,{content:y.content,trace_id:y.trace_id},y.id);if(y.role==="ai"||y.role==="tool"){const q=Yg(y.role);try{const $=JSON.parse(y.content),P=$.ext?.find(F=>F.type==="workflow"),_e=$.ext?.find(F=>F.type==="node"),ce=$.ext?.find(F=>F.type==="downstream_subgraph_search"),he=$.ext?.find(F=>F.type==="node_install_guide");let ie=null;if(P)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Jg,{content:y.content,name:y.name,avatar:q,latestInput:b,installedNodes:U,onAddMessage:M})});else if(_e)ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Xg,{content:y.content,name:y.name,avatar:q,installedNodes:U})});else if(ce){const F=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Qg,{content:y.content,name:y.name,avatar:q,onAddMessage:M})});if(y.metadata?.intent==="downstream_subgraph_search")return h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:F,metadata:y.metadata},y.id);ie=F}else he&&(ie=h.jsx(I.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(Vg,{content:y.content,onLoadSubgraph:()=>{if(y.metadata?.pendingSubgraph){const F=Object.values(fn.canvas.selected_nodes)[0];if(F){const T=y.metadata.pendingSubgraph,de=T.json.nodes,ne=T.json.links,le=de.find(Z=>Z.id===0),se=le?.id,H={};se&&(H[se]=F),fn.canvas.emitBeforeChange();try{for(const Z of de)if(Z.id!==se){const Ae=le?.pos||[0,0],ve=F._pos||[0,0],bn=[Z.pos[0]+ve[0]-Ae[0],Z.pos[1]+ve[1]-Ae[1]];H[Z.id]=Eg(Z.type,{pos:bn})}}finally{fn.canvas.emitAfterChange()}for(const Z of ne){const Ae=H[Z.origin_id],ve=H[Z.target_id];Ae&&ve&&Ae.connect(Z.origin_slot,ve,Z.target_slot)}}else alert("Please select a upstream node first before adding a subgraph.")}else if(y.metadata?.pendingWorkflow){const F=y.metadata.pendingWorkflow,T=y.metadata.optimizedParams;fn.loadGraphData(F);for(const[ne,le,se,H,Z]of T){const Ae=fn.graph._nodes_by_id[ne].widgets;for(const ve of Ae)ve.name===H&&(ve.value=Z)}fn.graph.setDirtyCanvas(!1,!0);const de={id:en(),role:"tool",content:JSON.stringify({text:"The workflow has been successfully loaded to the canvas",ext:[]}),format:"markdown",name:"Assistant"};M?.(de)}}})}));return $.text||ie?h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,extComponent:ie,metadata:y.metadata},y.id):ie||h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}catch($){return console.error("[MessageList] Error parsing message content:",$),console.error("解析JSON失败",y.content),h.jsx(Er,{content:y.content,name:y.name,avatar:q,format:y.format,onOptionClick:a,metadata:y.metadata},y.id)}}return null},[U,a,M,b]),re=wn.useMemo(()=>m?.map(W),[m,W]);return h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[re,E&&h.jsx(Zg,{})]})}async function np(){try{return await(await Mt.fetchApi("/object_info",{method:"GET"})).json()}catch(m){throw console.error("Error fetching object info:",m),m}}async function tp(){const m=await np();return Object.keys(m)}async function hp(m){return await(await Mt.fetchApi("/prompt",{method:"POST",body:JSON.stringify(m)})).json()}async function dp(m){try{const b=await Mt.fetchApi("/queue",{method:"POST",body:JSON.stringify(m)});if(!b.ok)throw new Error(`Failed to manage queue: ${b.status} ${b.statusText}`);return b}catch(b){throw console.error("Error managing queue:",b),b}}async function gp(){try{const m=await Mt.fetchApi("/interrupt",{method:"POST"});if(!m.ok)throw new Error(`Failed to interrupt processing: ${m.status} ${m.statusText}`);return m}catch(m){throw console.error("Error interrupting processing:",m),m}}async function pp(m){try{const b=await Mt.fetchApi(`/history/${m}`,{method:"GET"});if(!b.ok)throw new Error(`Failed to fetch history: ${b.status} ${b.statusText}`);return await b.json()}catch(b){throw console.error("Error fetching history:",b),b}}var Ir={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors @@ -138,4 +138,4 @@ __p += '`),z&&(v+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+v+`return __p -}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import(getImportPath("ParameterDebugInterfaceV2-BpdDX6z-.js")),__vite__mapDeps([4,1,2,3,5,6,7])).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w}; +}`;var k=La(function(){return Y(u,S+"return "+v).apply(a,o)});if(k.source=v,zi(k))throw k;return k}function I0(e){return J(e).toLowerCase()}function C0(e){return J(e).toUpperCase()}function N0(e,n,t){if(e=J(e),e&&(t||n===a))return Bs(e);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=tn(n),u=Us(r,i),o=Fs(r,i)+1;return On(r,u,o).join("")}function L0(e,n,t){if(e=J(e),e&&(t||n===a))return e.slice(0,Gs(e)+1);if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Fs(r,tn(n))+1;return On(r,0,i).join("")}function T0(e,n,t){if(e=J(e),e&&(t||n===a))return e.replace(zr,"");if(!e||!(n=Fe(n)))return e;var r=tn(e),i=Us(r,tn(n));return On(r,i).join("")}function R0(e,n){var t=bn,r=Cr;if(oe(n)){var i="separator"in n?n.separator:i;t="length"in n?D(n.length):t,r="omission"in n?Fe(n.omission):r}e=J(e);var u=e.length;if(Qn(e)){var o=tn(e);u=o.length}if(t>=u)return e;var l=t-Vn(r);if(l<1)return r;var c=o?On(o,0,l).join(""):e.slice(0,l);if(i===a)return c+r;if(o&&(l+=c.length-l),$i(i)){if(e.slice(l).search(i)){var p,_=c;for(i.global||(i=ai(i.source,J(us.exec(i))+"g")),i.lastIndex=0;p=i.exec(_);)var v=p.index;c=c.slice(0,v===a?l:v)}}else if(e.indexOf(Fe(i),l)!=l){var x=c.lastIndexOf(i);x>-1&&(c=c.slice(0,x))}return c+r}function O0(e){return e=J(e),e&&ja.test(e)?e.replace(rs,ul):e}var M0=ut(function(e,n,t){return e+(t?" ":"")+n.toUpperCase()}),Zi=Tu("toUpperCase");function Na(e,n,t){return e=J(e),n=t?a:n,n===a?nl(e)?ll(e):Ho(e):e.match(n)||[]}var La=B(function(e,n){try{return Be(e,a,n)}catch(t){return zi(t)?t:new R(t)}}),D0=_n(function(e,n){return qe(n,function(t){t=ln(t),gn(e,t,Gi(e[t],e))}),e});function P0(e){var n=e==null?0:e.length,t=C();return e=n?ae(e,function(r){if(typeof r[1]!="function")throw new Ze(W);return[t(r[0]),r[1]]}):[],B(function(r){for(var i=-1;++iSn)return[];var t=ze,r=Ie(e,ze);n=C(n),e-=ze;for(var i=ii(r,n);++t0||n<0)?new K(t):(e<0?t=t.takeRight(-e):e&&(t=t.drop(e)),n!==a&&(n=D(n),t=n<0?t.dropRight(-n):t.take(n-e)),t)},K.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},K.prototype.toArray=function(){return this.take(ze)},an(K.prototype,function(e,n){var t=/^(?:filter|find|map|reject)|While$/.test(n),r=/^(?:head|last)$/.test(n),i=s[r?"take"+(n=="last"?"Right":""):n],u=r||/^find/.test(n);i&&(s.prototype[n]=function(){var o=this.__wrapped__,l=r?[1]:arguments,c=o instanceof K,p=l[0],_=c||O(o),v=function(G){var z=i.apply(s,In([G],l));return r&&x?z[0]:z};_&&t&&typeof p=="function"&&p.length!=1&&(c=_=!1);var x=this.__chain__,S=!!this.__actions__.length,N=u&&!x,k=c&&!S;if(!u&&_){o=k?o:new K(this);var L=e.apply(o,l);return L.__actions__.push({func:vr,args:[v],thisArg:a}),new Ye(L,x)}return N&&k?e.apply(this,l):(L=this.thru(v),N?r?L.value()[0]:L.value():L)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var n=Kt[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);s.prototype[e]=function(){var i=arguments;if(r&&!this.__chain__){var u=this.value();return n.apply(O(u)?u:[],i)}return this[t](function(o){return n.apply(O(o)?o:[],i)})}}),an(K.prototype,function(e,n){var t=s[n];if(t){var r=t.name+"";X.call(rt,r)||(rt[r]=[]),rt[r].push({name:n,func:t})}}),rt[fr(a,T).name]=[{name:"wrapper",func:a}],K.prototype.clone=Rl,K.prototype.reverse=Ol,K.prototype.value=Ml,s.prototype.at=lh,s.prototype.chain=fh,s.prototype.commit=ch,s.prototype.next=hh,s.prototype.plant=gh,s.prototype.reverse=ph,s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=_h,s.prototype.first=s.prototype.head,vt&&(s.prototype[vt]=dh),s},et=fl();kn?((kn.exports=et)._=et,Jr._=et):be._=et}).call(Rt)})(Ir,Ir.exports);var Pa=Ir.exports;function rp(m=!0){I.useEffect(()=>{if(!m)return;const b=Pa.debounce(a=>{document.documentElement.style.setProperty("--mouse-x",`${a.clientX}px`),document.documentElement.style.setProperty("--mouse-y",`${a.clientY}px`)},16);return document.addEventListener("mousemove",b),()=>{b.cancel(),document.removeEventListener("mousemove",b)}},[m])}function ip(m=!0){const{state:b,dispatch:a}=ts(),{activeTab:U,screenState:M}=b;I.useEffect(()=>{if(!m)return;const E=W=>{const re=U==="parameter-debug",y=U==="chat",q=!M||M.currentScreen===0;if(y||q&&re){const $=fn.canvas.selected_nodes;Object.keys($??{}).length?a({type:"SET_SELECTED_NODE",payload:Object.values($)}):a({type:"SET_SELECTED_NODE",payload:null})}};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}},[a,m,U,M])}const sp=({message:m,onClose:b})=>m?h.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-amber-100 border-b border-amber-200 px-5 py-2 mt-2 relative shadow-sm",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex-shrink-0 mr-2",children:h.jsx("svg",{className:"w-3.5 h-3.5 text-amber-600",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),h.jsx("div",{className:"text-amber-800 font-medium leading-relaxed pr-6 markdown-content",style:{fontSize:"11px"},children:h.jsx(Ig,{rehypePlugins:[[xg,{target:"_blank",rel:["noopener","noreferrer"]}]],remarkPlugins:[yg],className:"prose !text-[11px] prose-a:text-amber-700 prose-a:underline prose-a:font-medium hover:prose-a:text-amber-800",components:{a:({node:a,...U})=>h.jsx("a",{...U,className:"text-amber-700 underline hover:text-amber-800 transition-colors",style:{fontSize:"11px"}}),p:({children:a})=>h.jsx("span",{className:"inline",style:{fontSize:"11px"},children:a}),span:({children:a})=>h.jsx("span",{style:{fontSize:"11px"},children:a}),li:({children:a})=>h.jsx("li",{style:{fontSize:"11px"},children:a}),ul:({children:a})=>h.jsx("ul",{style:{fontSize:"11px"},children:a}),ol:({children:a})=>h.jsx("ol",{style:{fontSize:"11px"},children:a})},children:m})})]}),h.jsx("button",{onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 text-amber-500 hover:text-amber-700 transition-colors p-1 rounded-full hover:bg-amber-200/50","aria-label":"Close announcement",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):null,up=()=>{const{state:m,dispatch:b}=ts(),{selectedNode:a,screenState:U}=m,M=a||[],E=wn.lazy(()=>Ot(()=>import(getImportPath("ParameterDebugInterfaceV2-QYVwPrST.js")),__vite__mapDeps([4,1,2,3,5,6,7])).then(re=>({default:re.ParameterDebugInterface}))),W=()=>{b({type:"SET_SELECTED_NODE",payload:null}),b({type:"SET_SCREEN_STATE",payload:null}),localStorage.removeItem("screenState")};return h.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:h.jsx(wn.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(E,{selectedNodes:M,visible:!0,onClose:W})})})},Ma=({active:m,onClick:b,children:a})=>h.jsx("button",{onClick:b,className:`px-4 py-2 font-medium text-xs transition-colors duration-200 ${m?"text-blue-600 border-b-2 border-blue-600":"text-gray-600 hover:text-blue-500 hover:border-b-2 hover:border-blue-300"}`,children:a});function ap({onClose:m,visible:b=!0,triggerUsage:a=!1,onUsageTriggered:U}){const{state:M,dispatch:E}=ts(),{messages:W,installedNodes:re,loading:y,sessionId:q,selectedNode:$,activeTab:P}=M,_e=I.useRef(null),[ce,he]=I.useState(""),[ie,F]=I.useState(""),[T,de]=I.useState(window.innerWidth/3),[ne,le]=I.useState(!1),[se,H]=I.useState([]),[Z,Ae]=I.useState("gpt-4o-mini");I.useState(window.innerHeight),I.useState(0);const[ve,bn]=I.useState(""),[Cr,Dt]=I.useState(!1);rp(b&&P==="chat"),ip(b),I.useEffect(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight)},[W]),I.useEffect(()=>{if(P!=="chat")return;(async()=>{const j=await tp();console.log("[WorkflowChat] Received installed nodes:",j.length),E({type:"SET_INSTALLED_NODES",payload:j})})()},[P]);const Nr=async A=>{try{const j=await ft.fetchMessages(A);E({type:"SET_MESSAGES",payload:j})}catch(j){console.error("Error fetching messages:",j)}};I.useEffect(()=>{if(P!=="chat")return;let A=localStorage.getItem("sessionId");A?(E({type:"SET_SESSION_ID",payload:A}),Nr(A)):(A=en(),E({type:"SET_SESSION_ID",payload:A}),localStorage.setItem("sessionId",A))},[P]),I.useEffect(()=>{const A=localStorage.getItem("activeTab");A&&E({type:"SET_ACTIVE_TAB",payload:A});const j=localStorage.getItem("screenState");j&&E({type:"SET_SCREEN_STATE",payload:JSON.parse(j)})},[]),I.useEffect(()=>{localStorage.setItem("activeTab",P)},[P]),I.useEffect(()=>{M.screenState&&localStorage.setItem("screenState",JSON.stringify(M.screenState))},[M.screenState]);const ht=wn.useCallback(A=>{if(!ne)return;const j=window.innerWidth-A.clientX,me=Math.min(Math.max(300,j),window.innerWidth*.8);de(me)},[ne]),$n=wn.useMemo(()=>Pa.debounce(ht,16),[ht]);I.useEffect(()=>(ne&&(document.addEventListener("mousemove",$n),document.addEventListener("mouseup",cn)),()=>{document.removeEventListener("mousemove",$n),document.removeEventListener("mouseup",cn),$n.cancel()}),[ne,$n]);const Lr=A=>{he(A.target.value)},Dn=async()=>{if(E({type:"SET_LOADING",payload:!0}),ce.trim()===""&&!$||!q)return;F(ce);const A=en(),j={id:en(),role:"user",content:ce,trace_id:A};E({type:"ADD_MESSAGE",payload:j}),he("");try{const me={type:"model_select",data:[Z]};let V=en(),$e=!0;for await(const ke of ft.streamInvokeServer(q,ce,se.map(ue=>ue.file),null,me,A)){const ue={id:V,role:"ai",content:JSON.stringify(ke),format:ke.format,finished:ke.finished,name:"Assistant"};if($e)E({type:"ADD_MESSAGE",payload:ue}),$e=!1;else{E({type:"UPDATE_MESSAGE",payload:ue});const Ee=M.messages.map(We=>We.id===ue.id&&!We.finished?ue:We);qn(Ee)}ke.finished&&E({type:"SET_LOADING",payload:!1})}}catch(me){console.error("Error sending message:",me),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Sn=async A=>{if(!q)return;E({type:"SET_LOADING",payload:!0}),F(A);const j=en(),me={id:en(),role:"user",content:A,trace_id:j};E({type:"ADD_MESSAGE",payload:me});try{const V={type:"model_select",data:[Z]};let $e=en(),ke=!0;for await(const ue of ft.streamInvokeServer(q,A,se.map(Ee=>Ee.file),null,V,j)){const Ee={id:$e,role:"ai",content:JSON.stringify(ue),format:ue.format,finished:ue.finished,name:"Assistant"};if(ke)E({type:"ADD_MESSAGE",payload:Ee}),ke=!1;else{E({type:"UPDATE_MESSAGE",payload:Ee});const We=M.messages.map(nn=>nn.id===Ee.id&&!nn.finished?Ee:nn);qn(We)}ue.finished&&E({type:"SET_LOADING",payload:!1})}}catch(V){console.error("Error sending message:",V),E({type:"SET_LOADING",payload:!1})}finally{H([])}},Tr=A=>{A.metaKey&&A.key==="Enter"&&Dn()},Hn=()=>{E({type:"CLEAR_MESSAGES"});const A=M.sessionId;A&&localStorage.removeItem(`messages_${A}`),localStorage.removeItem("sessionId");const j=en();E({type:"SET_SESSION_ID",payload:j}),localStorage.setItem("sessionId",j)},ze=A=>{he(A)},Pt=async(A,j)=>{if(!q||!$)return;E({type:"SET_LOADING",payload:!0});const me=$[0].comfyClass||$[0].type,V=en(),$e={id:en(),role:"user",content:me,trace_id:V};E({type:"ADD_MESSAGE",payload:$e});try{let ke=en(),ue=!0;for await(const Ee of ft.streamInvokeServer(q,me,[],A,j,V)){const We={id:ke,role:"ai",content:JSON.stringify(Ee),format:Ee.format,finished:Ee.finished,name:"Assistant"};if(A&&A!==""&&(We.metadata={intent:A}),ue)E({type:"ADD_MESSAGE",payload:We}),ue=!1;else{E({type:"UPDATE_MESSAGE",payload:We});const nn=M.messages.map(Ne=>Ne.id===We.id&&!Ne.finished?We:Ne);qn(nn)}Ee.finished&&E({type:"SET_LOADING",payload:!1})}}catch(ke){console.error("Error sending message:",ke),E({type:"SET_LOADING",payload:!1})}},qn=A=>{M.sessionId&&localStorage.setItem(`messages_${M.sessionId}`,JSON.stringify(A))},Rr=A=>{console.log("[WorkflowChat] Adding new message:",A);const j=[...M.messages,A];E({type:"ADD_MESSAGE",payload:A}),qn(j)},cn=()=>{le(!1)},Zn=A=>{const j=Array.from(A).map(me=>({id:Math.random().toString(36).substr(2,9),file:me,preview:URL.createObjectURL(me)}));H(me=>[...me,...j])},Or=A=>{H(j=>j.filter(V=>V.id!==A))};wn.useEffect(()=>()=>{se.forEach(A=>URL.revokeObjectURL(A.preview))},[se]),I.useEffect(()=>{a&&U&&P==="chat"&&(Pt("node_explain"),U())},[a,P]),I.useEffect(()=>{if(!b||P!=="chat")return;(async()=>{try{const j=new Date().toDateString();if(localStorage.getItem("announcementLastShownDate")!==j){const V=await ft.fetchAnnouncement();V&&V.trim()!==""&&(bn(V),Dt(!0),localStorage.setItem("announcementLastShownDate",j))}}catch(j){console.error("Error fetching announcement:",j)}})()},[b,P]);const Pn=()=>{Dt(!1)},An=A=>{E({type:"SET_ACTIVE_TAB",payload:A})},Mr=wn.useMemo(()=>h.jsx(up,{}),[]);return b?h.jsxs("div",{className:"flex flex-col h-full w-full bg-white",style:{display:b?"flex":"none",height:"100%"},children:[h.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-gray-300"}),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(Kg,{onClose:m,onClear:Hn,hasMessages:W.length>0,title:"ComfyUI-Copilot"}),h.jsxs("div",{className:"flex border-b border-gray-200 mt-2",children:[h.jsx(Ma,{active:P==="chat",onClick:()=>An("chat"),children:"Chat"}),h.jsx(Ma,{active:P==="parameter-debug",onClick:()=>An("parameter-debug"),children:"GenLab"})]}),Cr&&ve&&P==="chat"&&h.jsx(sp,{message:ve,onClose:Pn}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4 scroll-smooth h-0",style:{display:P==="chat"?"block":"none"},ref:_e,children:h.jsx(ep,{messages:W,latestInput:ie,onOptionClick:ze,installedNodes:re,onAddMessage:Rr,loading:y})}),h.jsxs("div",{className:"border-t px-4 py-3 border-gray-200 bg-white sticky bottom-0",style:{display:P==="chat"?"block":"none"},children:[$&&h.jsx(qg,{nodeInfo:$,onSendWithIntent:Pt,loading:y,onSendWithContent:Sn}),h.jsx($g,{input:ce,loading:y,onChange:Lr,onSend:Dn,onKeyPress:Tr,onUploadImages:Zn,uploadedImages:se,onRemoveImage:Or,selectedModel:Z,onModelChange:Ae})]}),h.jsx("div",{className:"flex-1 flex flex-col h-0",style:{display:P==="parameter-debug"?"flex":"none"},children:Mr})]})]}):null}const _p=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));export{pp as g,gp as i,dp as m,hp as r,_p as w};