File size: 142,594 Bytes
82ea528 |
1 2 |
var e,t,s,o,n,i,a,l,r,d,u,c,p,h,m=Object.defineProperty,g=(e,t,s)=>((e,t,s)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);import{d as f,h as y}from"./vendor-DT1J-jWa.js";import{c as _}from"./lodash-CZi7izHi.js";let v=(null==(t=null==(e=window.comfyAPI)?void 0:e.app)?void 0:t.app)||null,b=(null==(o=null==(s=window.comfyAPI)?void 0:s.api)?void 0:o.api)||null,w=(null==(i=null==(n=window.comfyAPI)?void 0:n.ui)?void 0:i.$el)||null,L=(null==(l=null==(a=window.comfyAPI)?void 0:a.dialog)?void 0:l.ComfyDialog)||null,E=(null==(d=null==(r=window.comfyAPI)?void 0:r.widgets)?void 0:d.ComfyWidgets)||null,S=(null==(c=null==(u=window.comfyAPI)?void 0:u.utils)?void 0:c.applyTextReplacements)||null,C=(null==(h=null==(p=window.comfyAPI)?void 0:p.groupNode)?void 0:h.GroupNodeConfig)||null;const A=(e,t=void 0)=>{var s,o;return e?null==(o=null==(s=null==v?void 0:v.ui)?void 0:s.settings)?void 0:o.getSettingValue(e,t):null};function k(e,t=null,s=void 0){try{let o=e?A(e,s):null;return null==o&&(o=t?localStorage[t]:localStorage[e]||null),o}catch(o){return null}}function x(e,t=e=>{}){var s;const o=null==(s=v.ui.settings.settingsLookup)?void 0:s[e];o&&(o.onChange=e=>t(e))}async function I(e,t,s=null){var o,n;try{(null==(n=null==(o=null==v?void 0:v.ui)?void 0:o.settings)?void 0:n.setSettingValue)?v.ui.settings.setSettingValue(e,t):await b.storeSetting(e,t),s&&(localStorage[s]="object"==typeof t?JSON.stringify(t):t)}catch(i){}}const N="comfyui-easyuse-",T="dark-theme",O="#236692",D={PIPE_LINE:"#7737AA",PIPE_LINE_SDXL:"#7737AA",INT:"#29699C",X_Y:"#38291f",XYPLOT:"#74DA5D",LORA_STACK:"#94dccd",CONTROL_NET_STACK:"#94dccd",FLOW_CONTROL:"#373780"},R=0x4000000000000,M=["loaders","latent","image","mask","sampling","_for_testing","advanced","utils","api"],G={ALWAYS:0,NEVER:2,BYPASS:4},P="easyuse_nodes_map",F=LGraphCanvas.node_colors.bgcolor,U={ColorPalette:{version:105,id:"obsidian",name:"Obsidian",colors:{node_slot:{CLIP:"#FFD500",CLIP_VISION:"#A8DADC",CLIP_VISION_OUTPUT:"#ad7452",CONDITIONING:"#FFA931",CONTROL_NET:"#6EE7B7",IMAGE:"#64B5F6",LATENT:"#FF9CF9",MASK:"#81C784",MODEL:"#B39DDB",STYLE_MODEL:"#C2FFAE",VAE:"#FF6E6E",TAESD:"#DCC274",PIPE_LINE:"#7737AA",PIPE_LINE_SDXL:"#7737AA",INT:"#29699C",X_Y:"#38291f",XYPLOT:"#74DA5D",LORA_STACK:"#94dccd",CONTROL_NET_STACK:"#94dccd"},litegraph_base:{BACKGROUND_IMAGE:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQBJREFUeNrs1rEKwjAUhlETUkj3vP9rdmr1Ysammk2w5wdxuLgcMHyptfawuZX4pJSWZTnfnu/lnIe/jNNxHHGNn//HNbbv+4dr6V+11uF527arU7+u63qfa/bnmh8sWLBgwYJlqRf8MEptXPBXJXa37BSl3ixYsGDBMliwFLyCV/DeLIMFCxYsWLBMwSt4Be/NggXLYMGCBUvBK3iNruC9WbBgwYJlsGApeAWv4L1ZBgsWLFiwYJmCV/AK3psFC5bBggULloJX8BpdwXuzYMGCBctgwVLwCl7Be7MMFixYsGDBsu8FH1FaSmExVfAxBa/gvVmwYMGCZbBg/W4vAQYA5tRF9QYlv/QAAAAASUVORK5CYII=",CLEAR_BACKGROUND_COLOR:"#222222",NODE_TITLE_COLOR:"#d4d4d8",NODE_SELECTED_TITLE_COLOR:"#ffffff",NODE_TEXT_SIZE:14,NODE_TEXT_COLOR:"#ffffff",NODE_SUBTEXT_SIZE:12,NODE_DEFAULT_COLOR:"#09090b",NODE_DEFAULT_BGCOLOR:"rgba(24,24,27,.9)",NODE_DEFAULT_BOXCOLOR:"rgba(255,255,255,.75)",NODE_DEFAULT_SHAPE:"box",NODE_BOX_OUTLINE_COLOR:O,DEFAULT_SHADOW_COLOR:"rgba(0,0,0,0)",DEFAULT_GROUP_FONT:24,WIDGET_BGCOLOR:"#242427",WIDGET_OUTLINE_COLOR:"#3f3f46",WIDGET_TEXT_COLOR:"#d4d4d8",WIDGET_SECONDARY_TEXT_COLOR:"#d4d4d8",LINK_COLOR:"#9A9",EVENT_LINK_COLOR:"#A86",CONNECTING_LINK_COLOR:"#AFA"},comfy_base:{"fg-color":"#fff","bg-color":"#09090b","comfy-menu-bg":"rgba(24,24,24,.9)","comfy-input-bg":"#262626","input-text":"#ddd","descrip-text":"#999","drag-text":"#ccc","error-text":"#ff4444","border-color":"#29292c","tr-even-bg-color":"rgba(28,28,28,.9)","tr-odd-bg-color":"rgba(19,19,19,.9)"}}},NODE_COLORS:{red:{color:"#af3535",bgcolor:F,groupcolor:"#A88"},brown:{color:"#38291f",bgcolor:F,groupcolor:"#b06634"},green:{color:"#346434",bgcolor:F,groupcolor:"#8A8"},blue:{color:"#1f1f48",bgcolor:F,groupcolor:"#88A"},pale_blue:{color:"#006691",bgcolor:F,groupcolor:"#3f789e"},cyan:{color:"#008181",bgcolor:F,groupcolor:"#8AA"},purple:{color:"#422342",bgcolor:F,groupcolor:"#a1309b"},yellow:{color:"#c09430",bgcolor:F,groupcolor:"#b58b2a"},black:{color:"rgba(0,0,0,.8)",bgcolor:F,groupcolor:"#444"}}};let B=JSON.parse(JSON.stringify(U));delete B.NODE_COLORS,B.ColorPalette.id="obsidian_dark",B.ColorPalette.name="Obsidian Dark",B.ColorPalette.colors.litegraph_base.BACKGROUND_IMAGE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGlmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyMy0xMS0xM1QwMDoxODowMiswMTowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjMtMTEtMTVUMDI6MDQ6NTkrMDE6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjMtMTEtMTVUMDI6MDQ6NTkrMDE6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmIyYzRhNjA5LWJmYTctYTg0MC1iOGFlLTk3MzE2ZjM1ZGIyNyIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjk0ZmNlZGU4LTE1MTctZmQ0MC04ZGU3LWYzOTgxM2E3ODk5ZiIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjIzMWIxMGIwLWI0ZmItMDI0ZS1iMTJlLTMwNTMwM2NkMDdjOCI+IDx4bXBNTTpIaXN0b3J5PiA8cmRmOlNlcT4gPHJkZjpsaSBzdEV2dDphY3Rpb249ImNyZWF0ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MjMxYjEwYjAtYjRmYi0wMjRlLWIxMmUtMzA1MzAzY2QwN2M4IiBzdEV2dDp3aGVuPSIyMDIzLTExLTEzVDAwOjE4OjAyKzAxOjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjQ4OWY1NzlmLTJkNjUtZWQ0Zi04OTg0LTA4NGE2MGE1ZTMzNSIgc3RFdnQ6d2hlbj0iMjAyMy0xMS0xNVQwMjowNDo1OSswMTowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiBzdEV2dDpjaGFuZ2VkPSIvIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpiMmM0YTYwOS1iZmE3LWE4NDAtYjhhZS05NzMxNmYzNWRiMjciIHN0RXZ0OndoZW49IjIwMjMtMTEtMTVUMDI6MDQ6NTkrMDE6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4OTe6GAAAAx0lEQVR42u3WMQoAIQxFwRzJys77X8vSLiRgITif7bYbgrwYc/mKXyBoY4VVBgsWLFiwYFmOlTv+9jfDOjHmr8u6eVkGCxYsWLBgmc5S8ApewXvgYRksWLBgKXidpeBdloL3wMOCBctgwVLwCl7BuyyDBQsWLFiwTGcpeAWv4D3wsAwWLFiwFLzOUvAuS8F74GHBgmWwYCl4Ba/gXZbBggULFixYprMUvIJX8B54WAYLFixYCl5nKXiXpeA98LBgwTJYsGC9tg1o8f4TTtqzNQAAAABJRU5ErkJggg==",B.ColorPalette.colors.litegraph_base.CLEAR_BACKGROUND_COLOR="#09090b";const z=LGraphCanvas.node_colors.bgcolor,W={ColorPalette:{id:"milk_white",name:"Milk White",colors:{node_slot:{CLIP:"#FFA726",CLIP_VISION:"#5C6BC0",CLIP_VISION_OUTPUT:"#8D6E63",CONDITIONING:"#EF5350",CONTROL_NET:"#66BB6A",IMAGE:"#42A5F5",LATENT:"#AB47BC",MASK:"#9CCC65",MODEL:"#7E57C2",STYLE_MODEL:"#D4E157",VAE:"#FF7043",PIPE_LINE:"#7737AA",PIPE_LINE_SDXL:"#7737AA",INT:"#29699C",X_Y:"#38291f",XYPLOT:"#74DA5D",LORA_STACK:"#94dccd",CONTROL_NET_STACK:"#94dccd"},litegraph_base:{BACKGROUND_IMAGE:"data:image/gif;base64,R0lGODlhZABkALMAAAAAAP///+vr6+rq6ujo6Ofn5+bm5uXl5d3d3f///wAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAkALAAAAABkAGQAAAT/UMhJq7046827HkcoHkYxjgZhnGG6si5LqnIM0/fL4qwwIMAg0CAsEovBIxKhRDaNy2GUOX0KfVFrssrNdpdaqTeKBX+dZ+jYvEaTf+y4W66mC8PUdrE879f9d2mBeoNLfH+IhYBbhIx2jkiHiomQlGKPl4uZe3CaeZifnnijgkESBqipqqusra6vsLGys62SlZO4t7qbuby7CLa+wqGWxL3Gv3jByMOkjc2lw8vOoNSi0czAncXW3Njdx9Pf48/Z4Kbbx+fQ5evZ4u3k1fKR6cn03vHlp7T9/v8A/8Gbp4+gwXoFryXMB2qgwoMMHyKEqA5fxX322FG8tzBcRnMW/zlulPbRncmQGidKjMjyYsOSKEF2FBlJQMCbOHP6c9iSZs+UnGYCdbnSo1CZI5F64kn0p1KnTH02nSoV3dGTV7FFHVqVq1dtWcMmVQZTbNGu72zqXMuW7danVL+6e4t1bEy6MeueBYLXrNO5Ze36jQtWsOG97wIj1vt3St/DjTEORss4nNq2mDP3e7w4r1bFkSET5hy6s2TRlD2/mSxXtSHQhCunXo26NevCpmvD/UU6tuullzULH76q92zdZG/Ltv1a+W+osI/nRmyc+fRi1Xdbh+68+0vv10dH3+77KD/i6IdnX669/frn5Zsjh4/2PXju8+8bzc9/6fj27LFnX11/+IUnXWl7BJfegm79FyB9JOl3oHgSklefgxAC+FmFGpqHIYcCfkhgfCohSKKJVo044YUMttggiBkmp6KFXw1oII24oYhjiDByaKOOHcp3Y5BD/njikSkO+eBREQAAOw==",CLEAR_BACKGROUND_COLOR:"lightgray",NODE_TITLE_COLOR:"#222",NODE_SELECTED_TITLE_COLOR:"#000",NODE_TEXT_SIZE:14,NODE_TEXT_COLOR:"#444",NODE_SUBTEXT_SIZE:12,NODE_DEFAULT_COLOR:"#F7F7F7",NODE_DEFAULT_BGCOLOR:"#F5F5F5",NODE_DEFAULT_BOXCOLOR:"#555",NODE_DEFAULT_SHAPE:"box",NODE_BOX_OUTLINE_COLOR:"#000",DEFAULT_SHADOW_COLOR:"rgba(0,0,0,0.1)",DEFAULT_GROUP_FONT:24,WIDGET_BGCOLOR:"#D4D4D4",WIDGET_OUTLINE_COLOR:"#999",WIDGET_TEXT_COLOR:"#222",WIDGET_SECONDARY_TEXT_COLOR:"#555",LINK_COLOR:"#9A9",EVENT_LINK_COLOR:"#FF9800",CONNECTING_LINK_COLOR:"#222"},comfy_base:{"fg-color":"#222","bg-color":"#DDD","comfy-menu-bg":"#F5F5F5","comfy-input-bg":"#C9C9C9","input-text":"#222","descrip-text":"#444","drag-text":"#555","error-text":"#F44336","border-color":"#bbb","tr-even-bg-color":"#f9f9f9","tr-odd-bg-color":"#fff","content-bg":"#e0e0e0","content-fg":"#222","content-hover-bg":"#adadad","content-hover-fg":"#222"}}},NODE_COLORS:{red:{color:"#af3535",bgcolor:z,groupcolor:"#A88"},brown:{color:"#38291f",bgcolor:z,groupcolor:"#b06634"},green:{color:"#346434",bgcolor:z,groupcolor:"#8A8"},blue:{color:"#1f1f48",bgcolor:z,groupcolor:"#88A"},pale_blue:{color:"#006691",bgcolor:z,groupcolor:"#3f789e"},cyan:{color:"#008181",bgcolor:z,groupcolor:"#8AA"},purple:{color:"#422342",bgcolor:z,groupcolor:"#a1309b"},yellow:{color:"#c09430",bgcolor:z,groupcolor:"#b58b2a"},black:{color:"rgba(0,0,0,.8)",bgcolor:z,groupcolor:"#444"}}},j={"Workflow created by":"工作流创建者","Watch more video content":"观看更多视频内容","Workflow Guide":"工作流指南","💎 View Checkpoint Info...":"💎 查看 Checkpoint 信息...","💎 View Lora Info...":"💎 查看 Lora 信息...","🔃 Reload Node":"🔃 刷新节点","Updated At:":"最近更新:","Created At:":"首次发布:","✏️ Edit":"✏️ 编辑","💾 Save":"💾 保存","No notes":"当前还没有备注内容","Saving Notes...":"正在保存备注...","Type your notes here":"在这里输入备注内容",ModelName:"模型名称","Models Required":"所需模型","Download Model":"下载模型","Source Url":"模型源地址",Notes:"备注",Type:"类型","Trained Words":"训练词",BaseModel:"基础算法",Details:"详情",Description:"描述",Download:"下载量",Source:"来源","Saving Preview...":"正在保存预览图...","Saving Succeed":"保存成功","Clean SuccessFully":"清理成功","Clean Failed":"清理失败","Saving Failed":"保存失败","No COMBO link":"沒有找到COMBO连接","Reboot ComfyUI":"重启ComfyUI","Are you sure you'd like to reboot the server?":"是否要重启ComfyUI?","Nodes Map":"管理节点组","Nodes map sorting mode":"管理节点组排序模式","No Nodes":"未找到节点","No nodes found in the map":"在工作流程中没有找到节点","Expand All":"展开所有组","Collapse All":"折叠所有组",Close:"关闭","Default automatic sorting, if set to manual, groups can be dragged and dropped and the sorting results saved.":"默认自动排序,如果设置为手动,组可以拖放并保存排序结果。","For drag and drop sorting, please find Nodes map sorting mode in Settings->EasyUse and change it to manual":"如需拖拽排序请在设置->EasyUse节点中找到管理节点组排序模式并修改成 manual",Queue:"队列","Cleanup Of VRAM Usage":"清理显存占用","Please stop all running tasks before cleaning GPU":"请在清理GPU之前停止所有运行中的任务",Always:"启用中",Bypass:"已忽略",Never:"已停用","Auto Sorting":"自动排序","Toggle `Show/Hide` can set mode of group, LongPress can set group nodes to never":"点击`启用中/已忽略`可设置组模式, 长按可停用该组节点","Enable Shift+Up/Down/Left/Right key and Shift+Ctrl+Alt+Left/Right to align selected nodes":"启用 Shift+上/下/左/右 和 Shift+Ctrl+Alt+左/右 键对齐选中的节点","Enable Shift+Ctrl+Left/Right key to normalize selected nodes":"启用 Shift+Ctrl+左/右 键规范化选中的节点","Enable Shift+g to add selected nodes to a group":"启用 Shift+g 键将选中的节点添加一个组","Enable Shift+r to unload models and node cache":"启用 Shift+r 键卸载模型和节点缓存","Enable Shift+m to toggle nodes map":"启用 Shift+m 键显隐管理节点组","Enable Up/Down/Left/Right key to jump nearest nodes":"启用 上/下/左/右 键跳转到最近的前后节点","Enable Alt+1~9 to paste nodes from nodes template":"启用 Alt+1~9 从节点模板粘贴到工作流中","Enable contextMenu auto nest subdirectories":"启用上下文菜单自动嵌套子目录","Enable right-click menu to add node A~Z sorting":"启用右键菜单中新建节点A~Z排序","Enable model thumbnails display":"启动模型预览图显示","Enable nodes runtime display":"启动节点运行时间显示","Enable chain get node and set node with parent nodes":"启用将获取点和设置点与父节点链在一起","Maximum number of model thumbnails displayed":"显示的模型缩略图的最大数量","Too many thumbnails will affect the first loading time, set the maximum value to not load the thumbnail function when there are too many models's thumbnail":"太多的缩略图会影响首次加载时间,当模型缩略图太多时,设置最大值以不加载缩略图功能","Too many thumbnails, have closed the display":"模型缩略图太多啦,为您关闭了显示","Shift+Up/Down/Left/Right can align selected nodes, Shift+Ctrl+Alt+Left/Right can distribute horizontal/vertical nodes":"Shift+上/下/左/右 可以对齐选中的节点, Shift+Ctrl+Alt+左/右 可以水平/垂直分布节点","Enable Shift+Ctrl+Left key to normalize width and Shift+Ctrl+Right key to normalize height":"启用 Shift+Ctrl+左 键规范化宽度和 Shift+Ctrl+右 键规范化高度","After v1.2.39, Ctrl+g can be used instead of it":"从v1.2.39开始,可以使用Ctrl+g代替","Use three shortcut buttons in the right-click menu":"在右键菜单中使用三个快捷按钮","Enable Nodes Map":"启用节点组管理","You need to refresh the page to update successfully":"您需要刷新页面以成功更新","Get styles list Failed":"获取样式列表失败","Get style image Failed":"获取样式图片失败","Empty All":"清空所有","Type here to search styles ...":"在此处输入以搜索样式 ...","Loading UserInfo...":"正在获取用户信息...","Please set the APIKEY first":"请先设置APIKEY","Setting APIKEY":"设置APIKEY","Save Account Info":"保存账号信息",Choose:"选择",Delete:"删除",Edit:"编辑","At least one account is required":"删除失败: 至少需要一个账户","APIKEY is not Empty":"APIKEY 不能为空","Add Account":"添加账号","Getting Your APIKEY":"获取您的APIKEY","Choose Selected Images":"选择选中的图片","Choose images to continue":"选择图片以继续",Background:"背景",Hat:"帽子",Hair:"头发",Body:"身体",Face:"脸部",Clothes:"衣服",Others:"其他",Glove:"手套",Glasses:"眼镜",Sunglasses:"太阳镜","Upper-clothes":"上衣","Top-clothes":"上衣","Bottom-clothes":"下身装","Torso-skin":"皮肤",Dress:"连衣裙",Coat:"外套",Socks:"袜子",Pants:"裤子",Jumpsuits:"连体衣",Scarf:"围巾",Skirt:"裙子","Left-arm":"左臂","Right-arm":"右臂","Left-leg":"左腿","Right-leg":"右腿","Left-foot":"左脚","Right-foot":"右脚","Left-shoe":"左鞋","Right-shoe":"右鞋",s:"秒","No Node Templates Found":"未找到节点模板预设","Get Node Templates File Failed":"获取节点模板文件失败","Node template with {key} not set":"未设置快捷键为{key}的节点预设","ComfyUI Basic":"ComfyUI 基础节点","Recommend Nodes":"推荐节点","Others A~Z":"其他节点 A~Z"},V=k("AGL.Locale"),Y=(e,t=!1)=>"zh-CN"===(t?navigator.language:V)&&j[e]||e,H={addGroup:{id:"EasyUse.Hotkeys.AddGroup",name:Y("Enable Shift+g to add selected nodes to a group"),tooltip:Y("After v1.2.39, Ctrl+g can be used instead of it"),type:"boolean",defaultValue:!0},cleanVRAMUsed:{id:"EasyUse.Hotkeys.cleanVRAMUsed",name:Y("Enable Shift+r to unload models and node cache"),type:"boolean",defaultValue:!0},toggleSiteMap:{id:"EasyUse.Hotkeys.toggleNodesMap",name:Y("Enable Shift+m to toggle nodes map"),type:"boolean",defaultValue:!0},alignSelectedNodes:{id:"EasyUse.Hotkeys.AlignSelectedNodes",name:Y("Enable Shift+Up/Down/Left/Right key and Shift+Ctrl+Alt+Left/Right to align selected nodes"),tooltip:Y("Shift+Up/Down/Left/Right can align selected nodes, Shift+Ctrl+Alt+Left/Right can distribute horizontal/vertical nodes"),type:"boolean",defaultValue:!0},NormalizeSelectedNodes:{id:"EasyUse.Hotkeys.NormalizeSelectedNodes",name:Y("Enable Shift+Ctrl+Left/Right key to normalize selected nodes"),tooltip:Y("Enable Shift+Ctrl+Left key to normalize width and Shift+Ctrl+Right key to normalize height"),type:"boolean",defaultValue:!0},nodesTemplate:{id:"EasyUse.Hotkeys.NodesTemplate",name:Y("Enable Alt+1~9 to paste nodes from nodes template"),type:"boolean",defaultValue:!0},jumpNearestNodes:{id:"EasyUse.Hotkeys.JumpNearestNodes",name:Y("Enable Up/Down/Left/Right key to jump nearest nodes"),type:"boolean",defaultValue:!0},subDirectories:{id:"EasyUse.ContextMenu.SubDirectories",name:Y("Enable contextMenu auto nest subdirectories"),type:"boolean",defaultValue:!1},modelsThumbnails:{id:"EasyUse.ContextMenu.ModelsThumbnails",name:Y("Enable model thumbnails display"),type:"boolean",defaultValue:!1},modelsThumbnailsLimit:{id:"EasyUse.ContextMenu.ModelsThumbnailsLimit",name:Y("Maximum number of model thumbnails displayed"),tooltip:Y("Too many thumbnails will affect the first loading time, set the maximum value to not load the thumbnail function when there are too many models's thumbnail"),type:"slider",attrs:{min:0,max:5e3,step:100},defaultValue:500},rightMenuNodesSort:{id:"EasyUse.ContextMenu.NodesSort",name:Y("Enable right-click menu to add node A~Z sorting"),type:"boolean",defaultValue:!0},quickOptions:{id:"EasyUse.ContextMenu.QuickOptions",name:Y("Use three shortcut buttons in the right-click menu"),type:"combo",options:["At the forefront","At the end","Disable"],defaultValue:"At the forefront"},nodesRuntime:{id:"EasyUse.Nodes.Runtime",name:Y("Enable nodes runtime display"),type:"boolean",defaultValue:!0},chainGetSet:{id:"EasyUse.Nodes.ChainGetSet",name:Y("Enable chain get node and set node with parent nodes"),type:"boolean",defaultValue:!0},nodesMap:{id:"EasyUse.NodesMap.Sorting",name:Y("Nodes map sorting mode"),tooltip:Y("Default automatic sorting, if set to manual, groups can be dragged and dropped and the sorting results saved."),type:"combo",options:["Auto sorting","Manual drag&drop sorting"],defaultValue:"Auto sorting"},enableNodesMap:{id:"EasyUse.NodesMap.Enable",name:Y("Enable Nodes Map"),tooltip:Y("You need to refresh the page to update successfully"),type:"boolean",defaultValue:!0}};function X(e=100,t){return new Promise((s=>{setTimeout((()=>{s(t)}),e)}))}function Z(e,t){if(e="number"==typeof e?e:e instanceof Date?e.getTime():parseInt(e),isNaN(e))return null;let s=new Date(e);(e=s.toString().split(/[\s\:]/g).slice(0,-2))[1]=["01","02","03","04","05","06","07","08","09","10","11","12"][s.getMonth()];let o={MM:1,dd:2,yyyy:3,hh:4,mm:5,ss:6};return t.replace(/([Mmdhs]|y{2})\1/g,(t=>e[o[t]]))}const K=/Mac|iPod|iPhone|iPad/.test(navigator.platform),J=e=>K?e.replace(/Ctrl/g,"⌘").replace(/Alt/g,"⌥").replace(/Shift/g,"⇧"):e,$=f("groups",{state:e=>({groups:[],nodes:[],isWatching:!1}),getters:{groups_nodes(){var e;let t=[],s=[];if((null==(e=this.nodes)?void 0:e.length)>0){this.nodes.map((e=>{let o=e.pos,n=!1;for(let s=0;s<this.groups.length;s++){let i=this.groups[s];if(o[0]>i.pos[0]&&o[0]<i.pos[0]+i.size[0]&&o[1]>i.pos[1]&&o[1]<i.pos[1]+i.size[1]){t[s]||(t[s]={info:i,children:[]}),t[s].children.push(e),n=!0;break}}n||s.push({info:e})}));for(let e=0;e<this.groups.length;e++)t[e]||(t[e]={info:this.groups[e],children:[]})}return[...t,...s]}},actions:{setGroups(e){this.groups="Manual drag&drop sorting"==k("EasyUse.NodesMap.Sorting")?_(e):_(e.sort(((e,t)=>e.pos[0]-t.pos[0])).sort(((e,t)=>e.pos[1]-t.pos[1])))},setNodes(e){this.nodes=_(e)},update(){var e,t,s;(((null==(e=v.extensionManager)?void 0:e.activeSidebarTab)||(null==(s=null==(t=v.extensionManager.sidebarTab)?void 0:t.activeSidebarTab)?void 0:s.id))===P||this.isWatching)&&setTimeout((e=>{this.setGroups(v.canvas.graph._groups),this.setNodes(v.canvas.graph._nodes)}),1)},watchGraph(e=!1){e&&(this.isWatching=!0);let t=this;this.update();const s=v.graph.onNodeAdded;v.graph.onNodeAdded=function(e){t.update();const o=e.onRemoved;return e.onRemoved=function(){return t.update(),null==o?void 0:o.apply(this,arguments)},null==s?void 0:s.apply(this,arguments)},v.canvas.onNodeMoved=function(e){t.update()};const o=LGraphCanvas.onNodeAlign;LGraphCanvas.onNodeAlign=function(e){return t.update(),null==o?void 0:o.apply(this,arguments)};const n=LGraphCanvas.onGroupAdd;LGraphCanvas.onGroupAdd=function(){return t.update(),null==n?void 0:n.apply(this,arguments)};const i=LGraphCanvas.onGroupAlign;LGraphCanvas.onGroupAlign=function(e){return t.update(),null==i?void 0:i.apply(this,arguments)};const a=LGraphCanvas.onMenuNodeRemove;LGraphCanvas.onMenuNodeRemove=function(e){return t.update(),null==a?void 0:a.apply(this,arguments)}},unwatchGraph(){this.isWatching=!1}}});let q=null;const Q=["custom_obsidian","custom_obsidian_dark","custom_milk_white"],ee={"easy positive":"green","easy negative":"red","easy promptList":"cyan","easy promptLine":"cyan","easy promptConcat":"cyan","easy promptReplace":"cyan","easy forLoopStart":"blue","easy forLoopEnd":"blue","easy loadImagesForLoop":"blue"};let te=LGraphCanvas.node_colors,se=null,oe=null,ne=null,ie=null;for(let hs in H){const e="Disabled"==k("Comfy.UseNewMenu")?"👽 "+J(H[hs].name):J(H[hs].name),t=H[hs].tooltip?J(H[hs].tooltip):"";ae={...H[hs],name:e,tooltip:t},v.ui.settings.addSetting(ae)}var ae;function le(e,t=!1){let s="after",o="before";t&&([o,s]=[s,o]),e.label=(e.label??e.name).replace(o,s),e.name=e.label}function re(e,t,s,o,n,i,a){t.strokeStyle=o,t.fillStyle=n;let l=LiteGraph.NODE_TITLE_HEIGHT,r=this.ds.scale<.5,d=e._shape||e.constructor.shape||LiteGraph.ROUND_SHAPE,u=e.constructor.title_mode,c=!0;u==LiteGraph.TRANSPARENT_TITLE||u==LiteGraph.NO_TITLE?c=!1:u==LiteGraph.AUTOHIDE_TITLE&&mouse_over&&(c=!0);let p=new Float32Array(4);p=[0,c?-l:0,s[0]+1,c?s[1]+l:s[1]];let h=t.globalAlpha;if(t.lineWidth=1,t.beginPath(),d==LiteGraph.BOX_SHAPE||r?t.fillRect(p[0],p[1],p[2],p[3]):d==LiteGraph.ROUND_SHAPE||d==LiteGraph.CARD_SHAPE?t.roundRect(p[0],p[1],p[2],p[3],d==LiteGraph.CARD_SHAPE?[this.round_radius,this.round_radius,0,0]:[this.round_radius]):d==LiteGraph.CIRCLE_SHAPE&&t.arc(.5*s[0],.5*s[1],.5*s[0],0,2*Math.PI),t.strokeStyle=LiteGraph.WIDGET_OUTLINE_COLOR,t.stroke(),t.strokeStyle=o,t.fill(),!e.flags.collapsed&&c&&(t.shadowColor="transparent",t.fillStyle="rgba(0,0,0,0.2)",t.fillRect(0,-1,p[2],2)),t.shadowColor="transparent",e.onDrawBackground&&e.onDrawBackground(t,this,this.canvas,this.graph_mouse),c||u==LiteGraph.TRANSPARENT_TITLE){const n="dark"==function(e){let t=e.replace("#","");return s=parseInt(t.substring(0,2),16),o=parseInt(t.substring(2,4),16),n=parseInt(t.substring(4,6),16),.299*s+.587*o+.114*n>127.5?"light":"dark";var s,o,n}((null==e?void 0:e.color)||"#ffffff");if(e.onDrawTitleBar)e.onDrawTitleBar(t,l,s,this.ds.scale,o);else if(u!=LiteGraph.TRANSPARENT_TITLE&&(e.constructor.title_color||this.render_title_colored)){let n=e.constructor.title_color||o;if(e.flags.collapsed&&(t.shadowColor=LiteGraph.DEFAULT_SHADOW_COLOR),this.use_gradients){let e=LGraphCanvas.gradients[n];e||(e=LGraphCanvas.gradients[n]=t.createLinearGradient(0,0,400,0),e.addColorStop(0,n),e.addColorStop(1,"#000")),t.fillStyle=e}else t.fillStyle=n;t.beginPath(),d==LiteGraph.BOX_SHAPE||r?t.rect(0,-l,s[0]+1,l):d!=LiteGraph.ROUND_SHAPE&&d!=LiteGraph.CARD_SHAPE||t.roundRect(0,-l,s[0]+1,l,e.flags.collapsed?[this.round_radius]:[this.round_radius,this.round_radius,0,0]),t.fill(),t.shadowColor="transparent"}let a=!1;LiteGraph.node_box_coloured_by_mode&&LiteGraph.NODE_MODES_COLORS[e.mode]&&(a=LiteGraph.NODE_MODES_COLORS[e.mode]),LiteGraph.node_box_coloured_when_on&&(a=e.action_triggered?"#FFF":e.execute_triggered?"#AAA":a);let c=10;if(e.onDrawTitleBox)e.onDrawTitleBox(t,l,s,this.ds.scale);else if(d==LiteGraph.ROUND_SHAPE||d==LiteGraph.CIRCLE_SHAPE||d==LiteGraph.CARD_SHAPE){const s=n?"#ffffff":LiteGraph.NODE_SELECTED_TITLE_COLOR,o=n?"#eeeeee":e.boxcolor||a||LiteGraph.NODE_DEFAULT_BOXCOLOR;t.fillStyle=i?s:o,t.beginPath(),t.fillRect(10,0-1.05*c-1,1.1*c,.125*c),t.fillRect(10,0-1.45*c-1,1.1*c,.125*c),t.fillRect(10,0-1.85*c-1,1.1*c,.125*c)}else t.fillStyle=e.boxcolor||a||LiteGraph.NODE_DEFAULT_BOXCOLOR,t.fillRect(.5*(l-c),-.5*(l+c),c,c);if(t.globalAlpha=h,e.onDrawTitleText&&e.onDrawTitleText(t,l,s,this.ds.scale,this.title_text_font,i),!r){t.font=this.title_text_font;let s=String(e.getTitle());s&&(t.fillStyle=i?n?"#ffffff":LiteGraph.NODE_SELECTED_TITLE_COLOR:n?"#ffffff":e.constructor.title_text_color||this.node_title_color,e.flags.collapsed?(t.textAlign="left",t.measureText(s),t.fillText(s.substr(0,20),l,LiteGraph.NODE_TITLE_TEXT_Y-l),t.textAlign="left"):(t.textAlign="left",t.fillText(s,l,LiteGraph.NODE_TITLE_TEXT_Y-l)))}if(!e.flags.collapsed&&e.subgraph&&!e.skip_subgraph_button){let s=LiteGraph.NODE_TITLE_HEIGHT,o=e.size[0]-s,n=LiteGraph.isInsideRectangle(this.graph_mouse[0]-e.pos[0],this.graph_mouse[1]-e.pos[1],o+2,2-s,s-4,s-4);t.fillStyle=n?"#888":"#555",d==LiteGraph.BOX_SHAPE||r?t.fillRect(o+2,2-s,s-4,s-4):(t.beginPath(),t.roundRect(o+2,2-s,s-4,s-4,[4]),t.fill()),t.fillStyle="#333",t.beginPath(),t.moveTo(o+.2*s,.6*-s),t.lineTo(o+.8*s,.6*-s),t.lineTo(o+.5*s,.3*-s),t.fill()}e.onDrawTitle&&e.onDrawTitle(t)}if(i){e.onBounding&&e.onBounding(p),u==LiteGraph.TRANSPARENT_TITLE&&(p[1]-=l,p[3]+=l),t.lineWidth=2,t.globalAlpha=.8,t.beginPath();let n=0,i=0,a=1;d==LiteGraph.BOX_SHAPE?t.rect(n+p[0],n+p[1],i+p[2],i+p[3]):d==LiteGraph.ROUND_SHAPE||d==LiteGraph.CARD_SHAPE&&e.flags.collapsed?t.roundRect(n+p[0],n+p[1],i+p[2],i+p[3],[this.round_radius*a]):d==LiteGraph.CARD_SHAPE?t.roundRect(n+p[0],n+p[1],i+p[2],i+p[3],[this.round_radius*a,a,this.round_radius*a,a]):d==LiteGraph.CIRCLE_SHAPE&&t.arc(.5*s[0],.5*s[1],.5*s[0]+6,0,2*Math.PI),t.strokeStyle=LiteGraph.NODE_BOX_OUTLINE_COLOR,t.stroke(),t.strokeStyle=o,t.globalAlpha=1}e.execute_triggered>0&&e.execute_triggered--,e.action_triggered>0&&e.action_triggered--}function de(e,t,s,o){var n,i;if(!e.widgets||!e.widgets.length)return 0;let a=e.size[0],l=(e.size[1],e.widgets);t+=2;let r=LiteGraph.NODE_WIDGET_HEIGHT,d=this.ds.scale>.5;s.save(),s.globalAlpha=this.editor_alpha;let u=LiteGraph.WIDGET_OUTLINE_COLOR,c=LiteGraph.WIDGET_BGCOLOR,p=LiteGraph.WIDGET_TEXT_COLOR,h=LiteGraph.WIDGET_SECONDARY_TEXT_COLOR,m=12;for(let f=0;f<l.length;++f){let y=l[f],_=t;y.y&&(_=y.y),y.last_y=_,s.strokeStyle=u,s.fillStyle=c,s.textAlign="left",s.lineWidth=1,y.disabled&&(s.globalAlpha*=.5);let v=y.width||a;switch(y.height,y.type){case"button":var g=y.options.size||10;s.font=g+"px Inter",s.fillStyle=(null==(n=y.options)?void 0:n.transparent)?"transparent":c,y.clicked&&(s.fillStyle="#AAA",y.clicked=!1,this.dirty_canvas=!0),s.beginPath(),s.roundRect(m,_,v-24,r,[.25*r]),s.fill(),!d||y.disabled||(null==(i=y.options)?void 0:i.transparent)||s.stroke(),d&&(s.textAlign="center",s.fillStyle=p,s.fillText(y.label||y.name,.5*v,_+.7*r));break;case"toggle":if(s.font="10px Inter",s.textAlign="left",s.strokeStyle=u,s.fillStyle=c,s.beginPath(),d?s.roundRect(m,_,v-24,r,[.25*r]):s.rect(m,_,v-24,r),s.fill(),d&&!y.disabled&&s.stroke(),s.fillStyle=y.value?O:u,s.beginPath(),s.arc(v-24,_+.5*r,.25*r,0,2*Math.PI),s.fill(),d){s.fillStyle=h;const e=y.label||y.name;null!=e&&s.fillText(e,1.6*m,_+.7*r),s.font="10px Inter",s.fillStyle=y.value?p:h,s.textAlign="right",s.fillText(y.value?y.options.on||"true":y.options.off||"false",v-35,_+.7*r)}break;case"slider":s.font="10px Inter",s.fillStyle=c,s.strokeStyle=u,s.beginPath(),s.roundRect(m,_,v-24,r,[.25*r]),s.fill(),s.stroke();let t=y.options.max-y.options.min,a=(y.value-y.options.min)/t;if(a<0&&(a=0),a>1&&(a=1),s.fillStyle=y.options.hasOwnProperty("slider_color")?y.options.slider_color:o==y?u:O,s.beginPath(),s.roundRect(m,_,a*(v-24),r,[.25*r]),s.fill(),y.marker){let e=(y.marker-y.options.min)/t;e<0&&(e=0),e>1&&(e=1),s.fillStyle=y.options.hasOwnProperty("marker_color")?y.options.marker_color:"#AA9",s.roundRect(m+e*(v-24),_,2,r,[.25*r])}if(d){s.textAlign="center",s.fillStyle=p;let e=(y.label||y.name)+" : "+Number(y.value).toFixed(null!=y.options.precision?y.options.precision:3);s.fillText(e,.5*v,_+.7*r)}break;case"number":case"combo":if(s.textAlign="left",s.strokeStyle=u,s.fillStyle=c,s.beginPath(),d?s.roundRect(m,_,v-24,r,[.25*r]):s.rect(m,_,v-24,r),s.fill(),d){y.disabled||s.stroke(),s.fillStyle=p,y.disabled||(s.beginPath(),s.moveTo(24,_+6.5),s.lineTo(18,_+.5*r),s.lineTo(24,_+r-6.5),s.fill(),s.beginPath(),s.moveTo(v-m-12,_+6.5),s.lineTo(v-m-6,_+.5*r),s.lineTo(v-m-12,_+r-6.5),s.fill()),s.fillStyle=h,s.font="10px Inter",s.fillText(y.label||y.name,29,_+.7*r),s.fillStyle=p,s.textAlign="right";let e=6;if("number"==y.type)s.font="10px Inter",s.fillText(Number(y.value).toFixed(void 0!==y.options.precision?y.options.precision:3),v-24-e,_+.7*r);else{let t=y.value;if(y.options.values){let e=y.options.values;e.constructor===Function&&(e=e()),e&&e.constructor!==Array&&(t=e[y.value])}const o=v-48-(s.measureText(y.label||y.name).width+24),n=s.measureText(t).width;if(n>o){const e="…",i=s.measureText(e).width,a=s.measureText("a").width;if(o<=i)t="․";else{t=`${t}`;if(n+i-o+3*a>o){const e=o+3*a,s=Math.floor((e-i)/a);t=t.substr(0,s)}for(;s.measureText(t).width+i>o;)t=t.substr(0,t.length-1);t+=e}}s.fillText(t,v-24-e,_+.7*r)}}break;case"string":case"text":if(s.textAlign="left",s.strokeStyle=u,s.fillStyle=c,s.beginPath(),d?s.roundRect(m,_,v-24,r,[.25*r]):s.rect(m,_,v-24,r),s.fill(),d){y.disabled||s.stroke(),s.save(),s.beginPath(),s.rect(m,_,v-24,r),s.clip(),s.fillStyle=h;const e=y.label||y.name;s.font="10px Inter",null!=e&&s.fillText(e,24,_+.7*r),s.fillStyle=p,s.textAlign="right",s.fillText(String(y.value).substr(0,30),v-24,_+.7*r),s.restore()}break;default:y.draw&&y.draw(s,e,v,_,r)}t+=(y.computeSize?y.computeSize(v)[1]:r)+4,s.globalAlpha=this.editor_alpha}s.restore(),s.textAlign="left"}function ue(e,t,s,o,n){return new LiteGraph.ContextMenu(LiteGraph.NODE_MODES,{event:s,callback:function(e){if(!n)return;var t=Object.values(LiteGraph.NODE_MODES).indexOf(e),s=function(e){t>=0&&LiteGraph.NODE_MODES[t]?e.changeMode(t):e.changeMode(LiteGraph.ALWAYS),q||(q=$()),q.update()},o=LGraphCanvas.active_canvas;if(!o.selected_nodes||Object.keys(o.selected_nodes).length<=1)s(n);else for(var i in o.selected_nodes)s(o.selected_nodes[i])},parentMenu:o,node:n}),!1}function ce(e,t,s,o,n){if(!n)throw"no node for color";var i=[];for(var a in i.push({value:null,content:"<span style='display: block; padding-left: 4px;'>No color</span>"}),LGraphCanvas.node_colors){var l=LGraphCanvas.node_colors[a];e={value:a,content:"<span style='display: block; color: #999; padding-left: 4px; border-left: 8px solid "+l.color+"; background-color:"+l.bgcolor+"'>"+a+"</span>"};i.push(e)}return new LiteGraph.ContextMenu(i,{event:s,callback:function(e){if(!n)return;var t=e.value?LGraphCanvas.node_colors[e.value]:null,s=function(e){t?e.constructor===LiteGraph.LGraphGroup?e.color=t.groupcolor:(e.color=t.color,e.bgcolor=t.bgcolor):(delete e.color,delete e.bgcolor),q||(q=$()),q.update()},o=LGraphCanvas.active_canvas;if(!o.selected_nodes||Object.keys(o.selected_nodes).length<=1)s(n);else for(var i in o.selected_nodes)s(o.selected_nodes[i]);n.setDirtyCanvas(!0,!0)},parentMenu:o,node:n}),!1}function pe(e,t,s,o,n){var i=e.property||"title",a=n[i],l=document.createElement("div");l.is_modified=!1,l.className="graphdialog",l.innerHTML="<span class='name'></span><input autofocus type='text' class='value'/><button>OK</button>",l.close=function(){l.parentNode&&l.parentNode.removeChild(l)},l.querySelector(".name").innerText=i;var r=l.querySelector(".value");r&&(r.value=a,r.addEventListener("blur",(function(e){this.focus()})),r.addEventListener("keydown",(function(e){if(l.is_modified=!0,27==e.keyCode)l.close();else if(13==e.keyCode)m();else if(13!=e.keyCode&&"textarea"!=e.target.localName)return;e.preventDefault(),e.stopPropagation()})));var d=LGraphCanvas.active_canvas.canvas,u=d.getBoundingClientRect(),c=-20,p=-20;u&&(c-=u.left,p-=u.top),event?(l.style.left=event.clientX+c+"px",l.style.top=event.clientY+p+"px"):(l.style.left=.5*d.width+c+"px",l.style.top=.5*d.height+p+"px"),l.querySelector("button").addEventListener("click",m),d.parentNode.appendChild(l),r&&r.focus();var h=null;function m(){r&&function(t){"Number"==e.type?t=Number(t):"Boolean"==e.type&&(t=Boolean(t));n[i]=t,l.parentNode&&l.parentNode.removeChild(l);n.setDirtyCanvas(!0,!0),q||(q=$());q.update()}(r.value)}l.addEventListener("mouseleave",(function(e){LiteGraph.dialog_close_on_mouse_leave&&!l.is_modified&&LiteGraph.dialog_close_on_mouse_leave&&(h=setTimeout(l.close,LiteGraph.dialog_close_on_mouse_leave_delay))})),l.addEventListener("mouseenter",(function(e){LiteGraph.dialog_close_on_mouse_leave&&h&&clearTimeout(h)}))}v.registerExtension({name:"Comfy.EasyUse.UI",init(){var e,t;const s="Comfy.CustomColorPalettes",o="Comfy.Settings.Comfy.CustomColorPalettes";if(oe||(oe=k(s,o,{})),ne||(ne=k("Comfy.ColorPalette","Comfy.Settings.Comfy.ColorPalette")||"dark"),(!(null==(e=null==oe?void 0:oe.obsidian)?void 0:e.version)||oe.obsidian.version<U.ColorPalette.version)&&(oe.obsidian=U.ColorPalette,oe.obsidian_dark=B.ColorPalette,I(s,oe,o)),(!oe||!(null==(t=null==oe?void 0:oe.milk_white)?void 0:t.version)||oe.milk_white.version<W.ColorPalette.version)&&(oe.milk_white=W.ColorPalette,I(s,oe,o)),Q.includes(ne)){switch(document.body.classList+=" comfyui-easyuse",function(e,t=!1){const s=document.createElement("link");s.rel="preconnect",s.href=e,t&&(s.crossorigin=""),document.head.appendChild(s)}("https://fonts.googleapis.com",!0),function(e,t=!0,s="ComfyUI-Easy-Use"){const o=document.createElement("link");o.rel="stylesheet",o.type="text/css",o.href=t?`extensions/${s}/${e}`:e,document.head.appendChild(o)}("https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700&family=JetBrains+Mono&display=swap",!1),ne){case"custom_obsidian":case"custom_obsidian_dark":case"dark":LGraphCanvas.node_colors=U.NODE_COLORS;break;case"custom_milk_white":case"light":LGraphCanvas.node_colors=W.NODE_COLORS}te=LGraphCanvas.node_colors,LiteGraph.NODE_TEXT_SIZE=13,LGraphCanvas.prototype.drawNodeShape=re,LGraphCanvas.prototype.drawNodeWidgets=de}else document.body.classList.remove("comfyui-easyuse");LGraphCanvas.onMenuNodeMode=ue,LGraphCanvas.onMenuNodeColors=ce,LGraphCanvas.onShowPropertyEditor=pe},async setup(){var e;Object.assign(v.canvas.default_connection_color_byType,D),Object.assign(LGraphCanvas.link_type_colors,D),"custom_milk_white"==ne&&document.body.classList.remove(T),v.ui.settings.addEventListener("Comfy.ColorPalette.change",(async({detail:e})=>{(null==e?void 0:e.value)&&(null==e?void 0:e.oldValue)&&(await X(1),Object.assign(v.canvas.default_connection_color_byType,D),Object.assign(LGraphCanvas.link_type_colors,D)),"custom_milk_white"==e.value&&document.body.classList.remove(T)})),setTimeout((e=>he(k("Comfy.UseNewMenu")||"Disabled")),1);const t=null==(e=v.ui.settings.settingsLookup)?void 0:e["Comfy.UseNewMenu"];t&&(t.onChange=e=>he(e))},async nodeCreated(e){var t;if(ee.hasOwnProperty(e.comfyClass)){const t=ee[e.comfyClass],s=te[t];if(!s)return;s.color&&(e.color=s.color),s.bgcolor&&(e.bgcolor=s.bgcolor)}if(se||(se=k("Comfy.WidgetControlMode")),"before"==se){const s="before"==se;if((null==(t=e.widgets)?void 0:t.length)>0)for(const t of e.widgets)if(["control_before_generate","control_after_generate"].includes(t.name)&&(await le(t,s),t.linkedWidgets))for(const e of t.linkedWidgets)await le(e,s)}}});const he=e=>{var t;const s=(null==(t=document.getElementById("crystools-root"))?void 0:t.children)||null,o=k("Comfy.Workflow.WorkflowTabsPosition",null,"");if((null==s?void 0:s.length)>0&&o)if(ie||(ie=document.getElementById("MonitorUI")),"Disabled"==e){document.getElementById("crystools-root").appendChild(ie)}else{let e=document.getElementById("crystools-root-easyuse");if(e)e.appendChild(ie);else{const e=document.getElementsByClassName("comfyui-menu-right");e.length>0&&e[0].before(w("div",{id:"crystools-root-easyuse"},ie))}}};let me={};const ge=(e,t)=>e.widgets.find((e=>e.name===t)),fe=(e,t,s=!1,o="")=>{var n;if(!t||((e,t)=>!!e.inputs&&e.inputs.some((e=>e.name===t)))(e,t.name))return;me[t.name]||(me[t.name]={origType:t.type,origComputeSize:t.computeSize});const i=e.size;t.type=s?me[t.name].origType:"easyHidden"+o,t.computeSize=s?me[t.name].origComputeSize:()=>[0,-4],null==(n=t.linkedWidgets)||n.forEach((o=>fe(e,o,":"+t.name,s)));const a=s?Math.max(e.computeSize()[1],i[1]):e.size[1];e.setSize([e.size[0],a])},ye=(e,t=0)=>{var s,o;if(e)return(null==(s=e.widgets)?void 0:s[t])?e.widgets[t].value:e.widgets_values?null==(o=e.widgets_values)?void 0:o[t]:void 0},_e=e=>e.setSize([e.size[0],e.computeSize()[1]]),ve=(e,t)=>graph.getNodeById(e),be=e=>{var t;try{return Object.values(null==(t=null==graph?void 0:graph.list_of_graphcanvas[0])?void 0:t.selected_nodes)}catch(s){return[]}};function we(e,t,s){return e+(o=s,(.5-.5*Math.cos(Math.PI*o))*(t-e));var o}const Le=(e,t=!0)=>{var s,o;const n=(null==(o=null==(s=e.graph)?void 0:s.list_of_graphcanvas)?void 0:o[0])||null;if(!n)return;const[i,a]=e.pos,[l,r]=e.size;(([e,t],s)=>{const o=s.ds,n=document.body.clientWidth,i=document.body.clientHeight,a=o.scale,l=.5*n/a-e,r=.5*i/a-t,d=Date.now()+250,u=o.offset[0],c=o.offset[1],p=()=>{const e=d-Date.now();if(!(Date.now()<d))return o.offset[0]=l,o.offset[1]=r,void s.setDirty(!0,!0);requestAnimationFrame(p);const t=1-e/250;o.offset[0]=we(u,l,t),o.offset[1]=we(c,r,t),s.setDirty(!0,!0)};requestAnimationFrame(p)})([i+l/2,a+r/2],n),t&&n.selectNode(e)},Ee=e=>{const t=ve(e);t&&Le(t)},Se=(e,t=(()=>graph.links??[])())=>t[e],Ce=e=>e.toLowerCase().replace(/_./g,(e=>e.replace("_","").toUpperCase())),Ae=e=>"easy getNode"===e.type,ke=e=>"easy setNode"===e.type,xe=e=>Ae(e)||ke(e),Ie=(e=(()=>graph._nodes??[])())=>e.filter((e=>xe(e)));let Ne={},Te={};const Oe=(e,t,s=0)=>{e.widgets_values||(e.widgets_values=[]),e.widgets_values[s]=t,e.widgets[s].value=t},De=e=>graph.add(e),Re=e=>graph.remove(e),Me=(e,t=0)=>{var s,o;if("Reroute"!==e.type)return[e,t];const n=e,i=null==(o=null==(s=n.inputs)?void 0:s[0])?void 0:o.link;if(!i)return[n,t];const a=Se(i);if(!a)return[n,t];const l=ve(a.origin_id);return l?(setTimeout((()=>{Re(n)})),Me(l,a.origin_slot)):[n,t]},Ge=e=>{var t,s,o;if("Reroute"!==e.type)return e;const n=e,i=null==(s=null==(t=n.outputs)?void 0:t[0])?void 0:s.links;if(!i)return n;const a=i[0];if(!a)return n;const l=Se(a);if(!l)return n;const r=ve(l.target_id);return r?(1===(null==(o=n.outputs[0].links)?void 0:o.length)&&setTimeout((()=>{Re(n)})),Ge(r)):n},Pe=(e,t="width")=>{var s;const o=e[0],n="width"==t?0:1,i=null==(s=o.size)?void 0:s[n];i&&(e.forEach((e=>{e.size[n]=i})),LGraphCanvas.active_canvas.setDirty(!0,!0))},Fe=(e,t="horizontal")=>{if(e.length<3)return;const s="horizontal"===t?0:1;e.sort(((e,t)=>e.pos[s]-t.pos[s]));const o=Math.min(...e.map((e=>e.pos[s]))),n=(Math.max(...e.map((e=>e.pos[s]+e.size[s])))-o-e.reduce(((e,t)=>e+t.size[s]),0))/(e.length-1);let i=o;e.forEach((e=>{e.pos[s]=i,i+=e.size[s]+n})),LGraphCanvas.active_canvas.setDirty(!0,!0)};const Ue=new class{constructor(){g(this,"element",w(`div.${N}toast`)),g(this,"children",HTMLElement),g(this,"container",document.body),this.container.appendChild(this.element)}async show(e){let t=w(`div.${N}toast-container`,[w("div",[w("span",[...e.icon?[w("i",{className:e.icon})]:[],w("span",e.content)])])]);t.setAttribute("toast-id",e.id),this.element.replaceChildren(t),this.container.appendChild(this.element),await X(64),t.style.marginTop=`-${t.offsetHeight}px`,await X(64),t.classList.add("show"),e.duration&&(await X(e.duration),this.hide(e.id))}async hide(e){const t=document.querySelector(`.${N}toast > [toast-id="${e}"]`);(null==t?void 0:t.classList.contains("show"))&&(t.classList.remove("show"),await X(750)),t&&t.remove()}async clearAllMessages(){let e=document.querySelector(`.${N}container`);e&&(e.innerHTML="")}async info(e,t=3e3,s=[]){this.show({id:"toast-info",icon:`mdi mdi-information ${N}theme`,content:e,duration:t})}async success(e,t=3e3){this.show({id:"toast-success",icon:`mdi mdi-check-circle ${N}success`,content:e,duration:t})}async error(e,t=3e3){this.show({id:"toast-error",icon:`mdi mdi-close-circle ${N}error`,content:e,duration:t})}async warn(e,t=3e3){this.show({id:"toast-warn",icon:`mdi mdi-alert-circle ${N}warning`,content:e,duration:t})}async showLoading(e,t=0){this.show({id:"toast-loading",icon:"mdi mdi-rotate-right loading",content:e,duration:t})}async hideLoading(){this.hide("toast-loading")}},Be=["rescale_after_model","rescale","lora_name","upscale_method","image_output","add_noise","info","sampler_name","ckpt_B_name","ckpt_C_name","save_model","refiner_ckpt_name","num_loras","num_controlnet","mode","toggle","resolution","ratio","target_parameter","input_count","replace_count","downscale_mode","range_mode","text_combine_mode","input_mode","lora_count","ckpt_count","conditioning_mode","preset","use_tiled","use_batch","num_embeds","easing_mode","guider","scheduler","inpaint_mode","t5_type","rem_mode"],ze=["LIGHT - SD1.5 only (low strength)","STANDARD (medium strength)","VIT-G (medium strength)","PLUS (high strength)","PLUS FACE (portraits)","FULL FACE - SD1.5 only (portraits stronger)"],We=["FACEID","FACEID PLUS - SD1.5 only","FACEID PLUS V2","FACEID PLUS KOLORS","FACEID PORTRAIT (style transfer)","FACEID PORTRAIT UNNORM - SDXL only (strong)"],je=["easy seed","easy latentNoisy","easy wildcards","easy preSampling","easy preSamplingAdvanced","easy preSamplingNoiseIn","easy preSamplingSdTurbo","easy preSamplingCascade","easy preSamplingDynamicCFG","easy preSamplingLayerDiffusion","easy fullkSampler","easy fullCascadeKSampler"],Ve=["easy fullLoader","easy a1111Loader","easy comfyLoader","easy hyditLoader","easy pixArtLoader"],Ye=["easy imageSize","easy imageSizeBySide","easy imageSizeByLongerSide","easy imageSizeShow","easy imageRatio","easy imagePixelPerfect"],He=["easy forLoopStart","easy forLoopEnd","easy whileLoopStart","easy whileLoopEnd"],Xe=["easy anythingIndexSwitch","easy imageIndexSwitch","easy textIndexSwitch","easy conditioningIndexSwitch"],Ze=["easy anythingInversedSwitch"],Ke=["easy loadImagesForLoop",...He,...Xe,...Ze],Je={"easy anythingInversedSwitch":"out","easy anythingIndexSwitch":"value","easy imageIndexSwitch":"image","easy textIndexSwitch":"text","easy conditioningIndexSwitch":"cond"};function $e(e,t){const s=e.comfyClass,o=t.value;switch(t.name){case"range_mode":fe(e,ge(e,"step"),"step"==o),fe(e,ge(e,"num_steps"),"num_steps"==o),_e(e);break;case"text_combine_mode":fe(e,ge(e,"replace_text"),"replace"==o);break;case"lora_name":["lora_model_strength","lora_clip_strength"].map((t=>fe(e,ge(e,t),"None"!==o)));break;case"resolution":"自定义 x 自定义"===o&&(t.value="width x height (custom)"),["empty_latent_width","empty_latent_height","width","height"].map((t=>fe(e,ge(e,t),"width x height (custom)"===o)));break;case"ratio":["empty_latent_width","empty_latent_height"].map((t=>fe(e,ge(e,t),"custom"===o)));break;case"num_loras":var n=o+1,i=ge(e,"mode").value;for(let t=0;t<n;t++)fe(e,ge(e,"lora_"+t+"_name"),!0),fe(e,ge(e,"lora_"+t+"_strength"),"simple"===i),["lora_"+t+"_model_strength","lora_"+t+"_clip_strength"].map((t=>fe(e,ge(e,t),"simple"!==i)));for(let t=n;t<21;t++)["lora_"+t+"_name","lora_"+t+"_strength","lora_"+t+"_model_strength","lora_"+t+"_clip_strength"].map((t=>fe(e,ge(e,t),!1)));_e(e);break;case"num_controlnet":n=o+1,i=ge(e,"mode").value;for(let t=0;t<n;t++)["controlnet_"+t,"controlnet_"+t+"_strength","scale_soft_weight_"+t].map((t=>fe(e,ge(e,t),!0))),["start_percent_"+t,"end_percent_"+t].map((t=>fe(e,ge(e,t),"simple"!==i)));for(let t=n;t<21;t++)["controlnet_"+t,"controlnet_"+t+"_strength","scale_soft_weight_"+t,"start_percent_"+t,"end_percent_"+t].map((t=>fe(e,ge(e,t),!1)));_e(e);break;case"mode":switch(null==e?void 0:e.comfyClass){case"easy loraStack":n=ge(e,"num_loras").value+1,i=o;for(let t=0;t<n;t++)fe(e,ge(e,"lora_"+t+"_strength"),"simple"===i),["lora_"+t+"_model_strength","lora_"+t+"_clip_strength"].map((t=>fe(e,ge(e,t),"simple"!==i)));_e(e);break;case"easy controlnetStack":n=ge(e,"num_controlnet").value+1,i=o;for(let t=0;t<n;t++)["start_percent_"+t,"end_percent_"+t].map((t=>fe(e,ge(e,t),"simple"!==i)));_e(e);break;case"easy icLightApply":i=o;["lighting","remove_bg"].map((t=>fe(e,ge(e,t),"Foreground"===i))),fe(e,ge(e,"source"),"Foreground"!==i),_e(e)}break;case"toggle":t.type="toggle",t.options={on:"Enabled",off:"Disabled"};break;case"t5_type":["clip_name","padding"].map((t=>fe(e,ge(e,t),"sd3"==o))),["t5_name","device","dtype"].map((t=>fe(e,ge(e,t),"t5v11"==o))),_e(e);break;case"preset":if(ze.includes(o)){let t=ge(e,"use_tiled");fe(e,ge(e,"lora_strength")),fe(e,ge(e,"provider")),fe(e,ge(e,"weight_faceidv2")),fe(e,ge(e,"weight_kolors")),fe(e,ge(e,"use_tiled"),!0),fe(e,ge(e,"sharpening"),t&&t.value)}else We.includes(o)&&(fe(e,ge(e,"weight_faceidv2"),!!["FACEID PLUS V2","FACEID PLUS KOLORS"].includes(o)),fe(e,ge(e,"weight_kolors"),!!["FACEID PLUS KOLORS"].includes(t.value)),["FACEID PLUS KOLORS","FACEID PORTRAIT (style transfer)","FACEID PORTRAIT UNNORM - SDXL only (strong)"].includes(o)?fe(e,ge(e,"lora_strength"),!1):fe(e,ge(e,"lora_strength"),!0),fe(e,ge(e,"provider"),!0),fe(e,ge(e,"use_tiled")),fe(e,ge(e,"sharpening")));_e(e);break;case"use_tiled":fe(e,ge(e,"sharpening"),!!o),_e(e);break;case"num_embeds":n=o+1;for(let t=0;t<n;t++)fe(e,ge(e,"weight"+t),!0);for(let t=n;t<6;t++)fe(e,ge(e,"weight"+t));_e(e);break;case"inpaint_mode":switch(o){case"normal":case"fooocus_inpaint":["dtype","fitting","function","scale","start_at","end_at"].map((t=>fe(e,ge(e,t),!1)));break;case"brushnet_random":case"brushnet_segmentation":["dtype","scale","start_at","end_at"].map((t=>fe(e,ge(e,t),!0))),["fitting","function"].map((t=>fe(e,ge(e,t),!1)));break;case"powerpaint":["dtype","fitting","function","scale","start_at","end_at"].map((t=>fe(e,ge(e,t),!0)))}_e(e);break;case"image_output":fe(e,ge(e,"link_id"),!!["Sender","Sender&Save"].includes(o)),fe(e,ge(e,"decode_vae_name"),!!["Hide","Hide&Save"].includes(o)),["save_prefix","output_path","embed_workflow","number_padding","overwrite_existing"].map((t=>fe(e,ge(e,t),!!["Save","Hide&Save","Sender&Save"].includes(o))));break;case"add_noise":var a=ge(e,"control_before_generate"),l=ge(e,"control_after_generate")||a;"disable"===o?(fe(e,ge(e,"seed")),l&&(l.last_value=l.value,l.value="fixed",fe(e,l))):(fe(e,ge(e,"seed"),!0),l&&((null==l?void 0:l.last_value)&&(l.value=l.last_value),fe(e,l,!0))),_e(e);break;case"guider":switch(o){case"Basic":["cfg_negative"].map((t=>fe(e,ge(e,t))));break;case"CFG":fe(e,ge(e,"cfg"),!0),fe(e,ge(e,"cfg_negative"));break;case"IP2P+DualCFG":case"DualCFG":["cfg","cfg_negative"].map((t=>fe(e,ge(e,t),!0)))}_e(e);break;case"scheduler":["karrasADV","exponentialADV","polyExponential"].includes(o)?(["sigma_max","sigma_min"].map((t=>fe(e,ge(e,t),!0))),["denoise","beta_d","beta_min","eps_s","coeff"].map((t=>fe(e,ge(e,t))),!1),fe(e,ge(e,"rho"),"exponentialADV"!=o)):"vp"==o?(["sigma_max","sigma_min","denoise","rho","coeff"].map((t=>fe(e,ge(e,t)))),["beta_d","beta_min","eps_s"].map((t=>fe(e,ge(e,t),!0)))):(["sigma_max","sigma_min","beta_d","beta_min","eps_s","rho"].map((t=>fe(e,ge(e,t)))),fe(e,ge(e,"coeff"),"gits"==o),fe(e,ge(e,"denoise"),!0)),_e(e);break;case"conditioning_mode":["replace","concat","combine"].includes(o)?["average_strength","old_cond_start","old_cond_end","new_cond_start","new_cond_end"].map((t=>fe(e,ge(e,t)))):"average"==o?(fe(e,ge(e,"average_strength"),!0),["old_cond_start","old_cond_end","new_cond_start","new_cond_end"].map((t=>fe(e,ge(e,t),!1)))):"timestep"==o&&(["average_strength"].map((t=>fe(e,ge(e,t),!1))),["old_cond_start","old_cond_end","new_cond_start","new_cond_end"].map((t=>fe(e,ge(e,t)))));break;case"rescale":ge(e,"rescale_after_model").value,fe(e,ge(e,"width"),"to Width/Height"===o),fe(e,ge(e,"height"),"to Width/Height"===o),fe(e,ge(e,"percent"),"by percentage"===o),fe(e,ge(e,"longer_side"),"to longer side - maintain aspect"===o),_e(e);break;case"upscale_method":["factor","crop"].map((t=>fe(e,ge(e,t),"None"!==o)));break;case"target_parameter":switch(s){case"easy XYInputs: Steps":["first_step","last_step"].map((t=>fe(e,ge(e,t),"steps"==o))),["first_start_step","last_start_step"].map((t=>fe(e,ge(e,t),"start_at_step"==o))),["first_end_step","last_end_step"].map((t=>fe(e,ge(e,t),"end_at_step"==o)));break;case"easy XYInputs: Sampler/Scheduler":let t=ge(e,"input_count").value+1;for(let s=0;s<t;s++)fe(e,ge(e,"sampler_"+s),"scheduler"!==o),fe(e,ge(e,"scheduler_"+s),"sampler"!==o);_e(e);break;case"easy XYInputs: ControlNet":["first_strength","last_strength"].map((t=>fe(e,ge(e,t),"strength"==o))),["first_start_percent","last_start_percent"].map((t=>fe(e,ge(e,t),"start_percent"==o))),["first_end_percent","last_end_percent"].map((t=>fe(e,ge(e,t),"end_percent"==o))),["strength","start_percent","end_percent"].map((t=>fe(e,ge(e,t),o!=t))),_e(e)}case"replace_count":n=o+1;for(let t=0;t<n;t++)fe(e,ge(e,"replace_"+t),!0);for(let t=n;t<31;t++)fe(e,ge(e,"replace_"+t));_e(e);break;case"lora_count":n=o+1;var r=-1==ge(e,"input_mode").value.indexOf("Weights");for(let t=0;t<n;t++)fe(e,ge(e,"lora_name_"+t),!0),["model_str_"+t,"clip_str_"+t].map((t=>fe(e,ge(e,t),!r)));for(let t=n;t<11;t++)["lora_name_"+t,"model_str_"+t,"clip_str_"+t].map((t=>fe(e,ge(e,t),!1)));_e(e);break;case"ckpt_count":n=o+1;var d=-1!=ge(e,"input_mode").value.indexOf("ClipSkip"),u=-1!=ge(e,"input_mode").value.indexOf("VAE");for(let t=0;t<n;t++)fe(e,ge(e,"ckpt_name_"+t),!0),fe(e,ge(e,"clip_skip_"+t),!!d),fe(e,ge(e,"vae_name_"+t),!!u);for(let t=n;t<11;t++)["ckpt_name_"+t,"clip_skip_"+t,"vae_name_"+t].map((t=>fe(e,ge(e,t),!1)));_e(e);break;case"input_count":n=o+1;var c=ge(e,"target_parameter").value;for(let t=0;t<n;t++)fe(e,ge(e,"sampler_"+t),"scheduler"!==c),fe(e,ge(e,"scheduler_"+t),"sampler"!==c);for(let t=n;t<31;t++)fe(e,ge(e,"sampler_"+t)),fe(e,ge(e,"scheduler_"+t));_e(e);break;case"input_mode":switch(s){case"easy XYInputs: Lora":n=ge(e,"lora_count").value+1;const t=-1!=o.indexOf("Weights");for(let s=0;s<n;s++)fe(e,ge(e,"lora_name_"+s),!0),["model_str_"+s,"clip_str_"+s].map((s=>fe(e,ge(e,s),!!t)));["model_strength","clip_strength"].map((s=>fe(e,ge(e,s),!t)));break;case"easy XYInputs: Checkpoint":n=ge(e,"ckpt_count").value+1,d=-1!=ge(e,"input_mode").value.indexOf("ClipSkip"),u=-1!=ge(e,"input_mode").value.indexOf("VAE");for(let s=0;s<n;s++)fe(e,ge(e,"ckpt_name_"+s),!0),fe(e,ge(e,"clip_skip_"+s),!!d),fe(e,ge(e,"vae_name_"+s),!!u)}_e(e);break;case"rem_mode":fe(e,ge(e,"torchscript_jit"),"Inspyrenet"===o),_e(e)}}v.registerExtension({name:"Comfy.EasyUse.Widget",async beforeRegisterNodeDef(e,t,s){const o=t.name,n=e.prototype.onAdded,i=e.prototype.onNodeCreated,a=e.prototype.onConfigure,l=e.prototype.onExecuted;if(e.prototype.onConnectionsChange,["easy showAnything","easy showAnythingLazy","easy showTensorShape","easy showSpentTime","easy imageInterrogator","easy showLoaderSettingsNames"].includes(o)){let n=function(e,t="text"){var o,n;if(this.widgets){const e=this.widgets.findIndex((e=>e.name===t));if(-1!==e){for(let t=e;t<this.widgets.length;t++)null==(n=(o=this.widgets[t]).onRemove)||n.call(o);this.widgets.length=e}}for(const i of e){const e=E.STRING(this,"text",["STRING",{multiline:!0}],s).widget;e.inputEl.readOnly=!0,e.inputEl.style.opacity=.6,e.value=i}requestAnimationFrame((()=>{var e;const t=this.computeSize();t[0]<this.size[0]&&(t[0]=this.size[0]),t[1]<this.size[1]&&(t[1]=this.size[1]),null==(e=this.onResize)||e.call(this,t),s.graph.setDirtyCanvas(!0,!1)}))};e.prototype.onExecuted=function(e){null==l||l.apply(this,arguments),n.call(this,e.text,"text")},["easy imageInterrogator"].includes(t.name)||(e.prototype.onConfigure=function(){var e;null==a||a.apply(this,arguments);let t="text";switch(o){case"easy showLoaderSettingsNames":t="names";break;case"easy showSpentTime":t="spent_time";break;default:t="text"}(null==(e=this.widgets_values)?void 0:e.length)&&n.call(this,this.widgets_values,t)})}if(Ye.includes(o)){let t=function(e){var t="";for(let s=0;s<e.length;s++)t+=e[s];if(this.widgets){const e=this.widgets.findIndex((e=>"info"===e.name));if(-1!==e&&this.widgets[e]){this.widgets[e].value=t}}requestAnimationFrame((()=>{var e;const t=this.computeSize();t[0]<this.size[0]&&(t[0]=this.size[0]),t[1]<this.size[1]&&(t[1]=this.size[1]),null==(e=this.onResize)||e.call(this,t),s.graph.setDirtyCanvas(!0,!1)}))};e.prototype.onExecuted=function(e){null==l||l.apply(this,arguments),t.call(this,e.text)}}if("easy promptLine"==o&&(e.prototype.onAdded=async function(){n&&n.apply(this,[]);let e=this.widgets.find((e=>"prompt"==e.name));this.addWidget("button","get values from COMBO link","",(()=>{var t,o;const n=(null==(o=null==(t=this.outputs[1])?void 0:t.links)?void 0:o.length)>0?this.outputs[1].links[0]:null,i=s.graph._nodes.find((e=>{var t;return null==(t=e.inputs)?void 0:t.find((e=>e.link==n))}));if(n&&i){const t=i.inputs.find((e=>e.link==n)).widget.name,s=i.widgets.find((e=>e.name==t));let o=(null==s?void 0:s.options.values)||null;o&&(o=o.join("\n"),e.value=o)}else Ue.error(Y("No COMBO link"),3e3)}),{serialize:!1})}),Ve.includes(t.name)){let t=function(e){var t="";for(let s=0;s<e.length;s++)t+=e[s];return t},s=function(e,t="positive"){if(this.widgets){const s=this.widgets.findIndex((e=>e.name===t+"_prompt")),o="comfy-multiline-input wildcard_"+t+"_"+this.id.toString();if(-1==s&&e){const s=document.createElement("textarea");s.className=o,s.placeholder="Wildcard Prompt ("+t+")";const n=this.addDOMWidget(t+"_prompt","customtext",s,{getValue:e=>s.value,setValue(e){s.value=e},serialize:!1});n.inputEl=s,n.inputEl.readOnly=!0,s.addEventListener("input",(()=>{var e;null==(e=n.callback)||e.call(n,n.value)})),n.value=e}else if(this.widgets[s])if(e){this.widgets[s].value=e}else{this.widgets.splice(s,1);const e=document.getElementsByClassName(o);e&&e[0]&&e[0].remove()}}};e.prototype.onExecuted=function(e){null==l||l.apply(this,arguments);const o=t(e.positive),n=t(e.negative);s.call(this,o,"positive"),s.call(this,n,"negative")}}if(["easy sv3dLoader"].includes(t.name)){let t=function(e,t,s){switch(e){case"azimuth":return s.readOnly=!0,s.style.opacity=.6,"0:(0.0,0.0)"+(t>1?`\n${t-1}:(360.0,0.0)`:"");case"elevation":return s.readOnly=!0,s.style.opacity=.6,"0:(-90.0,0.0)"+(t>1?`\n${t-1}:(90.0,0.0)`:"");case"custom":return s.readOnly=!1,s.style.opacity=1,"0:(0.0,0.0)\n9:(180.0,0.0)\n20:(360.0,0.0)"}};e.prototype.onNodeCreated=async function(){i&&i.apply(this,[]);const e=this.widgets.find((e=>"easing_mode"==e.name)),s=this.widgets.find((e=>"batch_size"==e.name)),o=this.widgets.find((e=>"scheduler"==e.name));setTimeout((n=>{o.value||(o.value=t(e.value,s.value,o.inputEl))}),1),e.callback=e=>{o.value=t(e,s.value,o.inputEl)},s.callback=s=>{o.value=t(e.value,s,o.inputEl)}}}if(je.includes(o)&&(e.prototype.onNodeCreated=async function(){i&&i.apply(this,[]);const e=this.widgets.find((e=>["seed_num","seed"].includes(e.name))),o=this.widgets.find((e=>["control_before_generate","control_after_generate"].includes(e.name)));if("easy seed"==t.name){const t=this.addWidget("button","🎲 Manual Random Seed",null,(t=>{"fixed"!=o.value&&(o.value="fixed"),e.value=Math.floor(Math.random()*R),s.queuePrompt(0,1)}),{serialize:!1});e.linkedWidgets=[t,o]}},e.prototype.onAdded=async function(){n&&n.apply(this,[]);const e=this.widgets.find((e=>["seed_num","seed"].includes(e.name))),t=this.widgets.find((e=>["control_before_generate","control_after_generate"].includes(e.name)));setTimeout((s=>{"control_before_generate"==t.name&&0===e.value&&(e.value=Math.floor(Math.random()*R))}),1)}),"easy convertAnything"==o&&(e.prototype.onNodeCreated=async function(){i&&i.apply(this,[]);const e=this.widgets.find((e=>"output_type"==e.name)),t=t=>{this.outputs[0].type=e.value.toUpperCase(),this.outputs[0].name=e.value,this.outputs[0].label=e.value};setTimeout((e=>t()),10),e.callback=e=>t()}),"easy imageInsetCrop"==o){let t=function(e){const t=e.widgets[0];for(let s=1;s<=4;s++)"Pixels"===t.value?(e.widgets[s].options.step=80,e.widgets[s].options.max=8192):(e.widgets[s].options.step=10,e.widgets[s].options.max=99)};e.prototype.onAdded=async function(e){const s=this.widgets[0];let o=s.callback;s.callback=(...e)=>{t(this),o&&o.apply(s,[...e])},setTimeout((e=>{t(this)}),1)}}if(Ke.includes(o)){const t=e=>{switch(o){case"easy forLoopStart":return 0;case"easy forLoopEnd":return 1}},s=e=>{switch(o){case"easy forLoopStart":return 2;case"easy forLoopEnd":return 0}};e.prototype.onNodeCreated=async function(){if("easy loadImagesForLoop"==o&&(this.outputs[0].shape=5),He.includes(o)){const e=this.inputs.findIndex((e=>"flow"===e.name)),n=this.outputs.findIndex((e=>"flow"===e.name));if(-1!==e&&(this.inputs[e].shape=5),-1!==n&&(this.outputs[n].shape=5),"easy whileLoopStart"==o||"easy whileLoopEnd"==o)return;this.inputs=this.inputs.filter(((e,s)=>s<=t())),this.outputs=this.outputs.filter(((e,t)=>t<=s())),_e(this)}return Xe.includes(o)&&("easy textIndexSwitch"==o&&(this.widgets=this.widgets.filter(((e,t)=>t<=2))),this.inputs=this.inputs.filter(((e,t)=>t<=1)),_e(this)),null==i?void 0:i.apply(this,arguments)},e.prototype.onConnectionsChange=function(e,n,i,a){var l,r;if("easy whileLoopStart"!=o&&"easy whileLoopEnd"!=o&&a)if(1==e){let e=this.inputs.every((e=>null!==e.link)),s=this.inputs.filter((e=>!["condition","index","total"].includes(e.name)));if(He.includes(o)){if(e){if(s.length>=10)return void Ue.warn(Y("The maximum number of inputs is 10"));let e=s[s.length-1],t=parseInt(e.name.split("initial_value")[1])+1;if(this.inputs.find((e=>e.name==="initial_value"+t)))return;let o="initial_value"+t,n="value"+t;this.addInput(o,"*"),this.addOutput(n,"*")}else if(!i){const e=t();let s=this.inputs.findLastIndex((e=>e.link));if(n>=e&&(-1===s||n>=s)){let e=this.inputs[n];if(!e.name||["condition","total"].includes(e.name))return;let t=parseInt(e.name.split("initial_value")[1])+1,s=this.inputs.findIndex((e=>e.name==="initial_value"+t)),o=this.outputs.findIndex((e=>e.name==="value"+t));-1!==s&&this.removeInput(s),-1!==o&&this.removeOutput(o)}}}else if(Xe.includes(o))if(e){if(s.length>=10)return void Ue.warn(Y("The maximum number of inputs is 10"));let e=Je[o]+s.length;this.addInput(e,"*")}else i||n==this.inputs.length-2&&this.removeInput(n+1)}else if(2==e){let e=this.outputs.filter((e=>!["flow","index"].includes(e.name))),t=e.every((e=>{var t;return(null==(t=e.links)?void 0:t.length)>0}));if(He.includes(o)){if(t){if(e.length>=10)return void Ue.warn(Y("The maximum number of inputs is 10"));let t=e[e.length-1],s=parseInt(t.name.split("value")[1])+1;if(this.inputs.find((e=>e.name==="initial_value"+s)))return;if(this.outputs.find((e=>e.name==="value"+s)))return;let o="initial_value"+s,n="value"+s;this.addInput(o,"*"),this.addOutput(n,"*")}else if(!i){const e=s();let t=a.origin_slot,o=this.outputs.findLastIndex((e=>{var t;return(null==(t=e.links)?void 0:t.length)>0}));if(t>=e&&(-1===o||t>=o)){let e=this.outputs[t];if(!e.name||["flow","index"].includes(e.name))return;let s=parseInt(e.name.split("value")[1])+1,o=this.inputs.findIndex((e=>e.name==="initial_value"+s)),n=this.outputs.findIndex((e=>e.name==="value"+s));if(-1!==o&&(null==(l=this.inputs[o])?void 0:l.link))return;-1!==o&&this.removeInput(o),-1!==n&&this.removeOutput(n)}}}else if(Ze.includes(o))if(t){if(e.length>=10)return void Ue.warn(Y("The maximum number of inputs is 10"));let t=Je[o]+e.length;this.addOutput(t,"*")}else if(!i){let t=a.origin_slot;t==this.outputs.length-2&&0==(null==(r=e[t].links)?void 0:r.length)&&this.removeOutput(t+1)}}}}},nodeCreated(e){if(e.comfyClass.startsWith("easy ")){if(e.widgets)for(const s of e.widgets){if(!Be.includes(s.name))continue;let t=s.value;$e(e,s),Object.defineProperty(s,"value",{get:e=>t,set(o){o!==t&&(t=o,$e(e,s))}})}const t=e.comfyClass;if("easy preDetailerFix"==t){const t=e.widgets.find((e=>"customtext"===e.type));if(!t)return;t.dynamicPrompts=!1,t.inputEl.placeholder="wildcard spec: if kept empty, this option will be ignored",t.serializeValue=()=>t.value}if("easy wildcards"==t){const t=e.widgets.find((e=>"text"==e.name));let s=1;Object.defineProperty(e.widgets[s],"value",{set:e=>{if((new Error).stack.includes("inner_value_change")&&"Select the LoRA to add to the text"!=e){let s=e;s.endsWith(".safetensors")&&(s=s.slice(0,-12)),t.value+=`<lora:${s}>`}},get:e=>"Select the LoRA to add to the text"}),Object.defineProperty(e.widgets[s+1],"value",{set:e=>{(new Error).stack.includes("inner_value_change")&&"Select the Wildcard to add to the text"!=e&&(""!=t.value&&(t.value+=", "),t.value+=e)},get:e=>"Select the Wildcard to add to the text"}),e.widgets[s].serializeValue=e=>"Select the LoRA to add to the text",e.widgets[s+1].serializeValue=e=>"Select the Wildcard to add to the text"}if(Ye.includes(t)){const t=document.createElement("textarea");t.className="comfy-multiline-input",t.readOnly=!0;const s=e.addDOMWidget("info","customtext",t,{getValue:e=>t.value,setValue:e=>t.value=e,serialize:!1});s.inputEl=t,t.addEventListener("input",(()=>{var e;null==(e=s.callback)||e.call(s,s.value)}))}}}});const qe=LiteGraph.LGraphNode;v.registerExtension({name:"easy bookmark",registerCustomNodes(){class e extends qe{constructor(){super("🔖"),g(this,"type","easy bookmark"),g(this,"title","🔖"),g(this,"slot_start_y",-20),g(this,"___collapsed_width",0),g(this,"isVirtualNode",!0),g(this,"serialize_widgets",!0),g(this,"keypressBound",null),this.addWidget("text","shortcut_key","1",(e=>{""!==(e=e.trim()[0]||"1")&&(this.title="🔖 "+e)}),{y:8}),this.addWidget("number","zoom",1,(e=>{}),{y:8+LiteGraph.NODE_WIDGET_HEIGHT+4,max:2,min:.5,precision:2}),this.keypressBound=this.onKeypress.bind(this)}get _collapsed_width(){return this.___collapsed_width}set _collapsed_width(e){const t=v.canvas,s=t.canvas.getContext("2d");if(s){const e=s.font;s.font=t.title_text_font,this.___collapsed_width=40+s.measureText(this.title).width,s.font=e}}onAdded(){setTimeout((e=>{const t=this.widgets[0].value;t&&(this.title="🔖 "+t)}),1),window.addEventListener("keydown",this.keypressBound)}onRemoved(){window.removeEventListener("keydown",this.keypressBound)}onKeypress(e){const t=e.target;["input","textarea"].includes(t.localName)||this.widgets[0]&&e.key.toLocaleLowerCase()===this.widgets[0].value.toLocaleLowerCase()&&this.canvasToBookmark()}canvasToBookmark(){var e,t;const s=v.canvas;(null==(e=null==s?void 0:s.ds)?void 0:e.offset)&&(s.ds.offset[0]=16-this.pos[0],s.ds.offset[1]=40-this.pos[1]),null!=(null==(t=null==s?void 0:s.ds)?void 0:t.scale)&&(s.ds.scale=Number(this.widgets[1].value||1)),s.setDirty(!0,!0)}}LiteGraph.registerNodeType("easy bookmark",Object.assign(e,{title:"Bookmark 🔖"})),e.category="EasyUse/Util"}}),v.registerExtension({name:"Comfy.EasyUse.ChainNode",init(){v.canvas._mousemove_callback=e=>{k("EasyUse.Nodes.ChainGetSet",null,!0)&&((e=!1,t={})=>{var s,o,n,i,a;const l=Ie();if(!l||l.length<1)return;const r=be();if(0===r.length)return;let d=t.inputX||160,u=t.ouputX||60;if(r.filter((e=>xe(e))).length>1)return;for(const p of r){let i=t.inputY||10,a=t.outputY||30;const l=[],c=p.id;if(p.graph){Ne[c]||(Ne[c]=[]);for(const e of p.inputs??[]){const t=e.link;if(!t)continue;const{origin_id:s,target_slot:o}=Se(t),n=ve(s);if(!n)continue;if(!xe(n))continue;let a=p.getConnectionPos(!0,o);Ne[c][o]||(Ne[c][o]=a),!Ne[c]||Ne[c][o][1]===a[1]&&Ne[c][o][0]===a[0]||(d=a[0]-Ne[c][o][0],i=a[1]-Ne[c][o][1],n.pos=[n.pos[0]+d,n.pos[1]+i]),Ne[c][o]=a,l.push(n)}Te[c]||(Te[c]=[]);for(const e of p.outputs??[])if(e.links&&p.graph)for(const t of e.links){const{target_id:e,target_slot:o,origin_slot:n}=Se(t),i=ve(e);if(!i)continue;if(!xe(i))continue;const r=null==(s=i.outputs)?void 0:s.links;if((null==r?void 0:r.length)>1)return;const d=p.getConnectionPos(!1,n);Te[c][n]||(Te[c][n]=d),!Te[c]||Te[c][n][0]===d[0]&&Te[c][n][1]===d[1]||(u=d[0]-Te[c][n][0],a=d[1]-Te[c][n][1],i.pos=[i.pos[0]+u,i.pos[1]+a]),Te[c][n]=d,l.push(i)}if(e&&1===r.length){const e=[p,...l];(null==(n=null==(o=p.graph)?void 0:o.list_of_graphcanvas)?void 0:n[0]).selectNodes(e)}}}const c=r[0];if(!c)return;(null==(a=null==(i=c.graph)?void 0:i.list_of_graphcanvas)?void 0:a[0]).setDirty(!0,!0)})()};const e=LGraphCanvas.prototype.showLinkMenu;LGraphCanvas.prototype.showLinkMenu=function(t,s){return s.shiftKey?(((e,t=!1)=>{var s,o,n,i,a,l,r,d,u,c;const{type:p}=e;if("*"===p)return;let{origin_id:h,target_id:m,origin_slot:g,target_slot:f}=e,y=ve(h),_=ve(m);if(!y||!_)return!1;if("Reroute"===y.type){let e=0;[y,e]=Me(y),h=null==y?void 0:y.id,g=e,void 0!==g&&-1!==g||(g=0)}if("Reroute"===_.type&&(_=Ge(_),m=null==_?void 0:_.id,f=null==_?void 0:_.inputs.findIndex((e=>e.type===p)),void 0!==f&&-1!==f||(f=0)),void 0===h||void 0===m||!y||!_)return!1;if(t&&(xe(y)||xe(_)))return!1;let v=Ce((null==(s=_.getInputInfo(f))?void 0:s.name)??p.toLowerCase());v||(v=Ce((null==(n=null==(o=null==y?void 0:y.outputs)?void 0:o[g])?void 0:n.name)??(null==(a=null==(i=null==y?void 0:y.outputs)?void 0:i[g])?void 0:a.type.toString())??v+`_from_${h}_to_${m}`));let b,w=!1,L=!1;if(xe(y))v=ye(y),L=!0;else{const e=null==(r=null==(l=y.outputs)?void 0:l[g])?void 0:r.links;if(e)for(const t of e){const e=ve((null==(d=Se(t))?void 0:d.target_id)??-1);e&&xe(e)&&ke(e)&&(v=ye(e),L=!0)}if(!L){for(const e of Ie()){if(v!==ye(e)||!ke(e))continue;const t=null==(u=e.inputs[0])?void 0:u.link;(null==(c=Se(t))?void 0:c.origin_id)===y.id?L=!0:w=!0}w&&(v+=`_from_${h}_to_${m}`)}}if(!L){b=LiteGraph.createNode("easy setNode"),b.is_auto_link=!0;const e=y.getConnectionPos(!1,g);b.pos=[e[0]+20,e[1]],b.inputs[0].name=v,b.inputs[0].type=p,b.inputs[0].widget=_.inputs[f].widget,Oe(b,v),De(b),b.flags.collapsed=!0;let t=[];y.widgets?t=Object.values(y.widgets).map((e=>e.value)):y.widgets_values&&(t=JSON.parse(JSON.stringify(y.widgets_values))),y.connect(g,b,0),y.widgets_values=t,"PrimitiveNode"===y.type&&setTimeout((()=>{if(y){y.connect(g,b,0);for(const[e,s]of t.entries())Oe(y,s,e);null!==b&&b.setSize(b.computeSize())}}))}const E=LiteGraph.createNode("easy getNode"),S=_.getConnectionPos(!0,f);E.pos=[S[0]-150,S[1]],E.outputs[0].name=v,E.outputs[0].type=p,E.outputs[0].widget=_.inputs[f].widget,De(E),Oe(E,v),null===E||(E.flags.collapsed=!0,E.setSize(E.computeSize()),E.connect(0,_,f))})(t),!1):(e.apply(this,[t,s]),!1)}}});const Qe=async()=>{try{const{Running:e,Pending:t}=await b.getQueue();if(e.length>0||t.length>0)return void Ue.error(Y("Clean Failed")+":"+Y("Please stop all running tasks before cleaning GPU"));200==(await b.fetchApi("/easyuse/cleangpu",{method:"POST"})).status?Ue.success(Y("Clean SuccessFully")):Ue.error(Y("Clean Failed"))}catch(e){}};let et=[];function tt(e,t,s,o,n){var i=LGraphCanvas.active_canvas,a=i.getCanvasWindow(),l=i.graph;if(l)return function e(t,o){var r=LiteGraph.getNodeTypesCategories(i.filter||l.filter).filter((function(e){return e.startsWith(t)})),d=[];r.map((function(s){if(s){var o=new RegExp("^("+t+")"),n=s.replace(o,"").split("/")[0],i=""===t?n+"/":t+n+"/",a=n;-1!=a.indexOf("::")&&(a=a.split("::")[1]),-1===d.findIndex((function(e){return e.value===i}))&&d.push({value:i,content:a,has_submenu:!0,callback:function(t,s,o,n){e(t.value,n)}})}})),LiteGraph.getNodeTypesInCategory(t.slice(0,-1),i.filter||l.filter).map((function(e){if(!e.skip_list){var t={value:e.type,content:e.title,has_submenu:!1,callback:function(e,t,s,o){var a=o.getFirstEvent();i.graph.beforeChange();var l=LiteGraph.createNode(e.value);l&&(l.pos=i.convertEventToCanvasOffset(a),i.graph.add(l)),n&&n(l),i.graph.afterChange()}};d.push(t)}}));const u=k("EasyUse.ContextMenu.NodesSort",null,!0);""===t&&u&&(d=function(e){let t=[],s=[];return e.forEach((e=>{(null==e?void 0:e.value)&&M.includes(e.value.split("/")[0])?t.push(e):s.push(e)})),[{title:Y("ComfyUI Basic"),is_category_title:!0},...t,{title:Y("Others A~Z"),is_category_title:!0},...s.sort(((e,t)=>e.content.localeCompare(t.content)))]}(d)),new LiteGraph.ContextMenu(d,{event:s,parentMenu:o},a)}("",o),!1}v.registerExtension({name:"Comfy.EasyUse.ContextMenu",async setup(){LGraphCanvas.onMenuAdd=tt;const e=k("EasyUse.ContextMenu.ModelsThumbnails",null,!1),t=k("EasyUse.ContextMenu.ModelsThumbnailsLimit",null,500);if(e&&t>0){const e=await b.fetchApi(`/easyuse/models/thumbnail?limit=${t}`);if(200===e.status){let t=await e.json();et=t}else Ue.error(Y("Too many thumbnails, have closed the display"))}const s=LiteGraph.ContextMenu;LiteGraph.ContextMenu=function(e,t){if(k("EasyUse.ContextMenu.SubDirectories",null,!1)&&(null==t?void 0:t.callback)&&!e.some((e=>"string"!=typeof e))){const o=function(e,t){const s=e,o=[...s],n={},i=[],a=[],l=["ckpt","pt","bin","pth","safetensors"];if((null==e?void 0:e.length)>0){const t=it(e[e.length-1]);if(!l.includes(t))return null}for(const r of s){const e=r.indexOf("/")>-1?"/":"\\",t=r.split(e);if(t.length>1){const s=t.shift();n[s]=n[s]||[],n[s].push(t.join(e))}else"CHOOSE"===r||r.startsWith("DISABLE ")?i.push(r):a.push(r)}if(Object.values(n).length>0){const e=t.callback;t.callback=null;const s=(t,s)=>{["None","无","無","なし"].includes(t.content)?e("None",s):e(o.find((e=>e.endsWith(t.content)),s))},r=(e,t="")=>{const o=t?t+"\\"+nt(e):nt(e),n=it(e),i=(new Date).getTime();let a,r="";if(l.includes(n))for(let s=0;s<et.length;s++){let e=et[s];if(o&&e&&-1!=e.indexOf(o)){r=et[s];break}}const d=k("EasyUse.ContextMenu.ModelsThumbnails",null,!1);if(r&&d){const t=`${window.location.protocol}//${window.location.host}`;let s=r.replace(":","%3A").replace(/\\/g,"/");s=s.startsWith("/")?s.substring(1):s;let o=`${t}/${s}?time=${i}`;a=w("div.comfyui-easyuse-contextmenu-model",{},[w("span",{},e+" *"),w("img",{src:o})])}else a=w("div.comfyui-easyuse-contextmenu-model",{},[w("span",{},e)]);return{content:e,title:a.outerHTML,callback:s}},d=[],u=(e,t)=>{let s=[],o=[];const i=e.map((e=>{const i={},a=e.indexOf("/")>-1?"/":"\\",l=e.split(a);if(l.length>1){const e=l.shift();i[e]=i[e]||[],i[e].push(l.join(a))}if(Object.values(n).length>0){let t=Object.keys(i)[0];t&&i[t]?s.push({key:t,value:i[t][0]}):o.push(r(e,t))}return r(e,t)}));if(s.length>0){let e={};return s.forEach((t=>{e[t.key]=e[t.key]||[],e[t.key].push(t.value)})),[...Object.entries(e).map((e=>({content:e[0],has_submenu:!0,callback:()=>{},submenu:{options:u(e[1],e[0])}}))),...o]}return i};for(const[t,o]of Object.entries(n))d.push({content:t,has_submenu:!0,callback:()=>{},submenu:{options:u(o,t)}});return d.push(...a.map((e=>r(e,"")))),i.length>0&&d.push(...i.map((e=>r(e,"")))),d}return null}(e,t);return o?s.call(this,o,t):s.apply(this,[...arguments])}if(t.parentMenu);else if(t.extra);else if(t.scale);else{const s=k("EasyUse.ContextMenu.QuickOptions",null,"At the forefront");if(t.hasOwnProperty("extra")&&"Disable"!==s){if("At the forefront"==s?e.unshift(null):e.push(null),o=window.location.host,["192.168.","10.","127.",/^172\.((1[6-9]|2[0-9]|3[0-1])\.)/].some((e=>"string"==typeof e?o.startsWith(e):e.test(o)))){const t={content:`<i class="mdi mdi-refresh-circle comfyui-easyuse-error" style="margin-right:2px;font-size:16px"></i>${Y("Reboot ComfyUI")}`,callback:e=>(async()=>{if(confirm(Y("Are you sure you'd like to reboot the server?")))try{b.fetchApi("/easyuse/reboot")}catch(e){}})()};"At the forefront"==s?e.unshift(t):e.push(t)}const t=k("EasyUse.Hotkeys.cleanVRAMUsed",null,!0)?"("+J("Shift+r")+")":"",n={content:`<i class="mdi mdi-rocket comfyui-easyuse-theme" style="margin-right:2px;font-size:16px"></i>${Y("Cleanup Of VRAM Usage")} ${t}`,callback:e=>Qe()};"At the forefront"==s?e.unshift(n):e.push(n);const i=k("EasyUse.Hotkeys.toggleNodesMap",null,!0)?"("+J("Shift+m")+")":"",a={content:`<i class="mdi mdi-sitemap comfyui-easyuse-warning" style="margin-right:2px;font-size:14px"></i>${Y("Nodes Map")} ${i}`,callback:e=>{var t,s,o;const n=(null==(t=v.extensionManager)?void 0:t.sidebarTab)||v.extensionManager,i=(null==(s=v.extensionManager.sidebarTab)?void 0:s.activeSidebarTabId)||(null==(o=v.extensionManager)?void 0:o.activeSidebarTab);n.activeSidebarTabId=i==P?null:P}};"At the forefront"==s?e.unshift(a):e.push(a)}}return s.apply(this,[...arguments]);var o},LiteGraph.ContextMenu.prototype=s.prototype,k("EasyUse.ContextMenu.NodesSort",null,!0)&&(LiteGraph.ContextMenu.prototype.addItem=ot)}});const st=e=>e&&"object"==typeof e&&"image"in e&&e.content;function ot(e,t,s){var o=this;s=s||{};var n=document.createElement("div");n.className="litemenu-entry submenu";var i,a=!1;function l(e){var t=this.value,n=!0;(o.current_submenu&&o.current_submenu.close(e),s.callback)&&(!0===s.callback.call(this,t,s,e,o,s.node)&&(n=!1));if(t){if(t.callback&&!s.ignore_item_callbacks&&!0!==t.disabled)!0===t.callback.call(this,t,s,e,o,s.extra)&&(n=!1);if(t.submenu){if(!t.submenu.options)throw"ContextMenu submenu needs options";new o.constructor(t.submenu.options,{callback:t.submenu.callback,event:e,parentMenu:o,ignore_item_callbacks:t.submenu.ignore_item_callbacks,title:t.submenu.title,extra:t.submenu.extra,autoopen:s.autoopen}),n=!1}}n&&!o.lock&&o.close()}return null===t?n.classList.add("separator"):t.is_category_title?(n.classList.remove("litemenu-entry"),n.classList.remove("submenu"),n.classList.add("litemenu-title"),n.innerHTML=t.title):(n.innerHTML=t&&t.title?t.title:e,n.value=t,t&&(t.disabled&&(a=!0,n.classList.add("disabled")),(t.submenu||t.has_submenu)&&n.classList.add("has_submenu")),"function"==typeof t?(n.dataset.value=e,n.onclick_callback=t):n.dataset.value=t,t.className&&(n.className+=" "+t.className)),n&&st(t)&&(null==t?void 0:t.image)&&!t.submenu&&(n.textContent+=" *",w("div.pysssss-combo-image",{parent:n,style:{backgroundImage:`url(/pysssss/view/${i=t.image,encodeURIComponent(i).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`))})`}})),this.root.appendChild(n),a||n.addEventListener("click",l),!a&&s.autoopen&&LiteGraph.pointerListenerAdd(n,"enter",(function(e){var t=this.value;if(!t||!t.has_submenu)return;l.call(this,e)})),n}function nt(e){return null==e?void 0:e.substring(0,e.lastIndexOf("."))}function it(e){return null==e?void 0:e.substring(e.lastIndexOf(".")+1)}class at extends L{constructor(){super(),this.element.classList.add("easyuse-model-metadata")}show(e){super.show(w("div",Object.keys(e).map((t=>w("div",[w("label",{textContent:t}),w("span",{textContent:e[t]})])))))}}class lt extends L{constructor(e){super(),this.name=e,this.element.classList.add("easyuse-model-info")}get customNotes(){return this.metadata["easyuse.notes"]}set customNotes(e){this.metadata["easyuse.notes"]=e}get hash(){return this.metadata["easyuse.sha256"]}async show(e,t){this.type=e;const s=b.fetchApi("/easyuse/metadata/"+encodeURIComponent(`${e}/${t}`));this.info=w("div",{style:{flex:"auto"}}),this.imgCurrent=0,this.imgList=w("div.easyuse-preview-list",{style:{display:"none"}}),this.imgWrapper=w("div.easyuse-preview",[w("div.easyuse-preview-group",[this.imgList])]),this.main=w("main",{style:{display:"flex"}},[this.imgWrapper,this.info]),this.content=w("div.easyuse-model-content",[w("div.easyuse-model-header",[w("h2",{textContent:this.name})]),this.main]);const o=w("div",{textContent:"ℹ️ Loading...",parent:this.content});super.show(this.content),this.metadata=await(await s).json(),this.viewMetadata.style.cursor=this.viewMetadata.style.opacity="",this.viewMetadata.removeAttribute("disabled"),o.remove(),this.addInfo()}createButtons(){const e=super.createButtons();return this.viewMetadata=w("button",{type:"button",textContent:"View raw metadata",disabled:"disabled",style:{opacity:.5,cursor:"not-allowed"},onclick:e=>{this.metadata&&(new at).show(this.metadata)}}),e.unshift(this.viewMetadata),e}parseNote(){if(!this.customNotes)return[];let e=[];const t=new RegExp("(\\bhttps?:\\/\\/[^\\s]+)","g");let s,o=0;do{let n;s=t.exec(this.customNotes);let i=0;s?(n=s.index,i=s.index+s[0].length):n=this.customNotes.length;let a=this.customNotes.substring(o,n);a&&(a=a.replaceAll("\n","<br>"),e.push(w("span",{innerHTML:a}))),s&&e.push(w("a",{href:s[0],textContent:s[0],target:"_blank"})),o=i}while(s);return e}addInfoEntry(e,t){return w("p",{parent:this.info},["string"==typeof e?w("label",{textContent:e+": "}):e,"string"==typeof t?w("span",{textContent:t}):t])}async getCivitaiDetails(){const e=await fetch("https://civitai.com/api/v1/model-versions/by-hash/"+this.hash);if(200===e.status)return await e.json();throw 404===e.status?new Error("Model not found"):new Error(`Error loading info (${e.status}) ${e.statusText}`)}addCivitaiInfo(){const e=this.getCivitaiDetails(),t=w("span",{textContent:"ℹ️ Loading..."});return this.addInfoEntry(w("label",[w("img",{style:{width:"18px",position:"relative",top:"3px",margin:"0 5px 0 0"},src:"https://civitai.com/favicon.ico"}),w("span",{textContent:"Civitai: "})]),t),e.then((e=>{var t,s;this.imgWrapper.style.display="block";let o=this.element.querySelector(".easyuse-model-header");o&&o.replaceChildren(w("h2",{textContent:this.name}),w("div.easyuse-model-header-remark",[w("h5",{textContent:Y("Updated At:")+Z(new Date(e.updatedAt),"yyyy/MM/dd")}),w("h5",{textContent:Y("Created At:")+Z(new Date(e.updatedAt),"yyyy/MM/dd")})]));let n=null,i=this.parseNote.call(this),a=Y("✏️ Edit"),l=w("div.easyuse-model-detail-textarea",[w("p",(null==i?void 0:i.length)>0?i:{textContent:Y("No notes")})]);if(i&&0!=i.length?l.classList.remove("empty"):l.classList.add("empty"),this.info.replaceChildren(w("div.easyuse-model-detail",[w("div.easyuse-model-detail-head.flex-b",[w("span",Y("Notes")),w("a",{textContent:a,href:"#",style:{fontSize:"12px",float:"right",color:"var(--warning-color)",textDecoration:"none"},onclick:async e=>{if(e.preventDefault(),n){if(n.value!=this.customNotes){Ue.showLoading(Y("Saving Notes...")),this.customNotes=n.value;const e=await b.fetchApi("/easyuse/metadata/notes/"+encodeURIComponent(`${this.type}/${this.name}`),{method:"POST",body:this.customNotes});if(Ue.hideLoading(),200!==e.status)return Ue.error(Y("Saving Failed")),void alert(`Error saving notes (${e.status}) ${e.statusText}`);Ue.success(Y("Saving Succeed")),i=this.parseNote.call(this),l.replaceChildren(w("p",(null==i?void 0:i.length)>0?i:{textContent:Y("No notes")})),n.value?l.classList.remove("empty"):l.classList.add("empty")}else l.replaceChildren(w("p",{textContent:Y("No notes")})),l.classList.add("empty");e.target.textContent=a,n.remove(),n=null}else e.target.textContent="💾 Save",n=w("textarea",{placeholder:Y("Type your notes here"),style:{width:"100%",minWidth:"200px",minHeight:"50px",height:"100px"},textContent:this.customNotes}),l.replaceChildren(n),n.focus()}})]),l]),w("div.easyuse-model-detail",[w("div.easyuse-model-detail-head",{textContent:Y("Details")}),w("div.easyuse-model-detail-body",[w("div.easyuse-model-detail-item",[w("div.easyuse-model-detail-item-label",{textContent:Y("Type")}),w("div.easyuse-model-detail-item-value",{textContent:e.model.type})]),w("div.easyuse-model-detail-item",[w("div.easyuse-model-detail-item-label",{textContent:Y("BaseModel")}),w("div.easyuse-model-detail-item-value",{textContent:e.baseModel})]),w("div.easyuse-model-detail-item",[w("div.easyuse-model-detail-item-label",{textContent:Y("Download")}),w("div.easyuse-model-detail-item-value",{textContent:(null==(t=e.stats)?void 0:t.downloadCount)||0})]),w("div.easyuse-model-detail-item",[w("div.easyuse-model-detail-item-label",{textContent:Y("Trained Words")}),w("div.easyuse-model-detail-item-value",{textContent:(null==e?void 0:e.trainedWords.join(","))||"-"})]),w("div.easyuse-model-detail-item",[w("div.easyuse-model-detail-item-label",{textContent:Y("Source")}),w("div.easyuse-model-detail-item-value",[w("label",[w("img",{style:{width:"14px",position:"relative",top:"3px",margin:"0 5px 0 0"},src:"https://civitai.com/favicon.ico"}),w("a",{href:"https://civitai.com/models/"+e.modelId,textContent:"View "+e.model.name,target:"_blank"})])])])])])),null==(s=e.images)?void 0:s.length){this.imgCurrent=0,this.isSaving=!1,e.images.map((e=>e.url&&this.imgList.appendChild(w("div.easyuse-preview-slide",[w("div.easyuse-preview-slide-content",[w("img",{src:e.url}),w("div.save",{textContent:"Save as preview",onclick:async()=>{if(this.isSaving)return;this.isSaving=!0,Ue.showLoading(Y("Saving Preview..."));const t=await(await fetch(e.url)).blob(),s="temp_preview."+new URL(e.url).pathname.split(".")[1],o=new FormData;o.append("image",new File([t],s)),o.append("overwrite","true"),o.append("type","temp");if(200!==(await b.fetchApi("/upload/image",{method:"POST",body:o})).status)return this.isSaving=!1,Ue.error(Y("Saving Failed")),Ue.hideLoading(),void alert(`Error saving preview (${req.status}) ${req.statusText}`);await b.fetchApi("/easyuse/save/"+encodeURIComponent(`${this.type}/${this.name}`),{method:"POST",body:JSON.stringify({filename:s,type:"temp"}),headers:{"content-type":"application/json"}}).then((e=>{Ue.success(Y("Saving Succeed")),Ue.hideLoading()})),this.isSaving=!1,app.refreshComboInNodes()}})])]))));let t=this;this.imgDistance=(-660*this.imgCurrent).toString(),this.imgList.style.display="",this.imgList.style.transform="translate3d("+this.imgDistance+"px, 0px, 0px)",this.slides=this.imgList.querySelectorAll(".easyuse-preview-slide"),this.slideLeftButton=w("button.left",{parent:this.imgWrapper,style:{display:e.images.length<=2?"none":"block"},innerHTML:'<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" width="16" height="16" style="transform: rotate(90deg);"><path d="M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg>',onclick:()=>{e.images.length<=2||(t.imgList.classList.remove("no-transition"),0==t.imgCurrent?(t.imgCurrent=e.images.length/2-1,this.slides[this.slides.length-1].style.transform="translate3d("+(-660*(this.imgCurrent+1)).toString()+"px, 0px, 0px)",this.slides[this.slides.length-2].style.transform="translate3d("+(-660*(this.imgCurrent+1)).toString()+"px, 0px, 0px)",t.imgList.style.transform="translate3d(660px, 0px, 0px)",setTimeout((e=>{this.slides[this.slides.length-1].style.transform="translate3d(0px, 0px, 0px)",this.slides[this.slides.length-2].style.transform="translate3d(0px, 0px, 0px)",t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)",t.imgList.classList.add("no-transition")}),500)):(t.imgCurrent=t.imgCurrent-1,t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)"))}}),this.slideRightButton=w("button.right",{parent:this.imgWrapper,style:{display:e.images.length<=2?"none":"block"},innerHTML:'<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" width="16" height="16" style="transform: rotate(-90deg);"><path d="M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg>',onclick:()=>{if(!(e.images.length<=2))if(t.imgList.classList.remove("no-transition"),t.imgCurrent>=e.images.length/2-1){t.imgCurrent=0;const s=e.images.length/2;this.slides[0].style.transform="translate3d("+(660*s).toString()+"px, 0px, 0px)",this.slides[1].style.transform="translate3d("+(660*s).toString()+"px, 0px, 0px)",t.imgList.style.transform="translate3d("+(-660*s).toString()+"px, 0px, 0px)",setTimeout((e=>{this.slides[0].style.transform="translate3d(0px, 0px, 0px)",this.slides[1].style.transform="translate3d(0px, 0px, 0px)",t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)",t.imgList.classList.add("no-transition")}),500)}else t.imgCurrent=t.imgCurrent+1,t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)"}})}return e.description&&w("div",{parent:this.content,innerHTML:e.description,style:{marginTop:"10px"}}),e})).catch((e=>{this.imgWrapper.style.display="none",t.textContent="⚠️ "+e.message})).finally((e=>{}))}}class rt extends lt{async addInfo(){await this.addCivitaiInfo()}}class dt extends lt{getTagFrequency(){if(!this.metadata.ss_tag_frequency)return[];const e=JSON.parse(this.metadata.ss_tag_frequency),t={};for(const s in e){const o=e[s];for(const e in o)e in t?t[e]+=o[e]:t[e]=o[e]}return Object.entries(t).sort(((e,t)=>t[1]-e[1]))}getResolutions(){let e=[];if(this.metadata.ss_bucket_info){const t=JSON.parse(this.metadata.ss_bucket_info);if(null==t?void 0:t.buckets)for(const{resolution:s,count:o}of Object.values(t.buckets))e.push([o,`${s.join("x")} * ${o}`])}e=e.sort(((e,t)=>t[0]-e[0])).map((e=>e[1]));let t=this.metadata.ss_resolution;if(t){const s=t.split(","),o=s[0].replace("(",""),n=s[1].replace(")","");e.push(`${o.trim()}x${n.trim()} (Base res)`)}else(t=this.metadata["modelspec.resolution"])&&e.push(t+" (Base res");return e.length||e.push("⚠️ Unknown"),e}getTagList(e){return e.map((e=>w("li.easyuse-model-tag",{dataset:{tag:e[0]},$:e=>{e.onclick=()=>{e.classList.toggle("easyuse-model-tag--selected")}}},[w("p",{textContent:e[0]}),w("span",{textContent:e[1]})])))}addTags(){let e,t=this.getTagFrequency();if(null==t?void 0:t.length){const s=t.length;let o;s>500&&(t=t.slice(0,500),e=w("p",[w("span",{textContent:"⚠️ Only showing first 500 tags "}),w("a",{href:"#",textContent:`Show all ${s}`,onclick:()=>{o.replaceChildren(...this.getTagList(this.getTagFrequency())),e.remove()}})])),o=w("ol.easyuse-model-tags-list",this.getTagList(t)),this.tags=w("div",[o])}else this.tags=w("p",{textContent:"⚠️ No tag frequency metadata found"});this.content.append(this.tags),e&&this.content.append(e)}async addInfo(){const e=this.addCivitaiInfo();this.addTags();const t=await e;t&&w("div",{parent:this.content,innerHTML:t.description,style:{maxHeight:"250px",overflow:"auto"}})}createButtons(){const e=super.createButtons();function t(e,t){const s=w("textarea",{parent:document.body,style:{position:"fixed"},textContent:t.map((e=>e.dataset.tag)).join(", ")});s.select();try{document.execCommand("copy"),e.target.dataset.text||(e.target.dataset.text=e.target.textContent),e.target.textContent="Copied "+t.length+" tags",setTimeout((()=>{e.target.textContent=e.target.dataset.text}),1e3)}catch(o){prompt("Copy to clipboard: Ctrl+C, Enter",text)}finally{document.body.removeChild(s)}}return e.unshift(w("button",{type:"button",textContent:"Copy Selected",onclick:e=>{t(e,[...this.tags.querySelectorAll(".easyuse-model-tag--selected")])}}),w("button",{type:"button",textContent:"Copy All",onclick:e=>{t(e,[...this.tags.querySelectorAll(".easyuse-model-tag")])}})),e}}const ut={pipe:{category:"Easy Pipe",nodes:["easy pipeIn","easy pipeOut","easy pipeEdit","easy pipeEditPrompt","easy pipeBatchIndex"],input:{pipe:"pipe"},output:{pipe:"pipe"},widget:{optional_positive:"optional_positive",optional_negative:"optional_negative"}},loaders:{category:"Easy Loaders",nodes:["easy fullLoader","easy a1111Loader","easy comfyLoader","easy kolorsLoader","easy hunyuanDiTLoader","easy pixArtLoader","easy fluxLoader"],input:{optional_lora_stack:"optional_lora_stack",optional_controlnet_stack:"optional_controlnet_stack",positive:"positive",negative:"negative"},output:{pipe:"pipe",model:"model",vae:"vae",clip:null,positive:null,negative:null,latent:null},widget:{ckpt_name:"ckpt_name",vae_name:"vae_name",clip_skip:"clip_skip",lora_name:"lora_name",resolution:"resolution",empty_latent_width:"empty_latent_width",empty_latent_height:"empty_latent_height",positive:"positive",negative:"negative",batch_size:"batch_size",a1111_prompt_style:"a1111_prompt_style"}},preSampling:{category:"Easy PreSampling",nodes:["easy preSampling","easy preSamplingAdvanced","easy preSamplingDynamicCFG","easy preSamplingNoiseIn","easy preSamplingCustom","easy preSamplingLayerDiffusion","easy fullkSampler"],input:{pipe:"pipe",image_to_latent:"image_to_latent",latent:"latent"},output:{pipe:"pipe"},widget:{steps:"steps",cfg:"cfg",cfg_scale_min:"cfg",sampler_name:"sampler_name",scheduler:"scheduler",denoise:"denoise",seed_num:"seed_num",seed:"seed"}},samplers:{category:"Custom Sampler",nodes:["KSamplerSelect","SamplerEulerAncestral","SamplerEulerAncestralCFG++","SamplerLMS","SamplerDPMPP_3M_SDE","SamplerDPMPP_2M_SDE","SamplerDPMPP_SDE","SamplerDPMAdaptative","SamplerLCMUpscale","SamplerTCD","SamplerTCD EulerA"],output:{SAMPLER:"SAMPLER"}},sigmas:{category:"Custom Sigmas",nodes:["BasicScheduler","KarrasScheduler","ExponentialScheduler","PolyexponentialScheduler","VPScheduler","BetaSamplingScheduler","SDTurboScheduler","SplitSigmas","SplitSigmasDenoise","FlipSigmas","AlignYourStepsScheduler","GITSScheduler"],output:{SIGMAS:"SIGMAS"}},kSampler:{category:"Easy kSampler",nodes:["easy kSampler","easy kSamplerTiled","easy kSamplerCustom","easy kSamplerInpainting","easy kSamplerDownscaleUnet","easy kSamplerLayerDiffusion"],input:{pipe:"pipe",model:"model"},output:{pipe:"pipe",image:"image"},widget:{image_output:"image_output",save_prefix:"save_prefix",link_id:"link_id"}},controlNet:{category:"Easy ControlNet",nodes:["easy controlnetLoader","easy controlnetLoaderADV","easy controlnetLoader++","easy instantIDApply","easy instantIDApplyADV"],input:{pipe:"pipe",image:"image",image_kps:"image_kps",control_net:"control_net",positive:"positive",negative:"negative",mask:"mask"},output:{pipe:"pipe",positive:"positive",negative:"negative"},widget:{control_net_name:"control_net_name",strength:["strength","cn_strength"],scale_soft_weights:["scale_soft_weights","cn_soft_weights"],cn_strength:["strength","cn_strength"],cn_soft_weights:["scale_soft_weights","cn_soft_weights"]}},adapter:{category:"Easy Adapter",nodes:["easy ipadapterApply","easy ipadapterApplyADV","easy ipadapterApplyFaceIDKolors","easy ipadapterStyleComposition","easy ipadapterApplyFromParams","easy pulIDApply","easy pulIDApplyADV"],input:{model:"model",image:"image",image_style:"image",attn_mask:"attn_mask",optional_ipadapter:"optional_ipadapter"},output:{model:"model",tiles:"tiles",masks:"masks",ipadapter:"ipadapter"},widget:{preset:"preset",lora_strength:"lora_strength",provider:"provider",weight:"weight",weight_faceidv2:"weight_faceidv2",start_at:"start_at",end_at:"end_at",cache_mode:"cache_mode",use_tiled:"use_tiled",insightface:"insightface",pulid_file:"pulid_file"}},positive:{category:"Easy Positive",nodes:["easy positive","easy wildcards"],input:{},output:{text:"positive",positive:"text"},widget:{text:"positive",positive:"text"}},loadImage:{category:"Easy LoadImage",nodes:["easy loadImageBase64","LoadImage","LoadImageMask"],input:{pipe:"pipe",image:"image",mask:"mask"},output:{IMAGE:"IMAGE",MASK:"MASK"},widget:{image:"image",base64_data:"base64_data",channel:"channel"}},saveImage:{category:"Save/Preview Image",nodes:["SaveImage","PreviewImage"]},inPaint:{category:"Easy Inpaint",nodes:["easy applyBrushNet","easy applyPowerPaint","easy applyInpaint"],input:{},output:{pipe:"pipe"},widget:{dtype:"dtype",fitting:"fitting",function:"function",scale:"scale",start_at:"start_at",end_at:"end_at"}},showAny:{category:"Show Anything",nodes:["easy showAnything","easy showAnythingLazy"],input:{anything:"anything"},output:{output:"output"}},saveText:{category:"Save Text",nodes:["easy saveText","easy saveTextLazy"],input:{image:"image",text:"text",output_file_path:"output_file_path",file_name:"file_name",file_extension:"file_extension",overwrite:"overwrite"},output:{text:"text",image:"image"},widget:{image:"image",text:"text",output_file_path:"output_file_path",file_name:"file_name",file_extension:"file_extension",overwrite:"overwrite"}},persona:{category:"LLM Party Persona",nodes:["load_persona","classify_persona","classify_persona_plus","custom_persona","translate_persona","flux_persona"],input:{file_content:"file_content"},output:{system_prompt:"system_prompt"},widget:{is_enable:"is_enable"}},llmModelLoader:{category:"LLM Model Loader",nodes:["LLM_api_loader","genai_api_loader","LLM_local_loader"],output:{model:"model"}},llmModelChain:{category:"LLM Model Chain",nodes:["LLM","LLM_local"],input:{model:"model",image:"images",images:"image",extra_parameters:"extra_parameters",system_prompt_input:"system_prompt_input",user_prompt_input:"user_prompt_input",tools:"tools",file_content:"file_content"},output:{assistant_response:"assistant_response",history:"history",tool:"tool",image:"image"},widget:{system_prompt:"system_prompt",user_prompt:"user_prompt",temperature:"temperature",is_memory:"is_memory",is_tools_in_sys_prompt:"is_tools_in_sys_prompt",max_length:"max_length",main_brain:"main_brain",conversation_rounds:"conversation_rounds",history_record:"history_record",is_enable:"is_enable"}},maskModify:{category:"Mask Modify",nodes:["CropMask","ThresholdMask","GrowMask","FeatherMask","LayerMask: MaskGrain","LayerMask: MaskEdgeUltraDetail","LayerMask: MaskEdgeUltraDetail V2"],input:{mask:"mask"},output:{MASK:"MASK",mask:"mask",image:"image"}},maskModifyWAS:{category:"Mask Modify (WAS)",nodes:["Mask Dilate Region","Mask Gaussian Region"],input:{masks:"masks"},output:{MASKS:"MASKS"}}};function ct(e,t,s){return function(){!function(e,t,s){var o;const n=LiteGraph.createNode(t);if(n){if(v.graph.add(n),n.pos=e.pos.slice(),n.size=e.size.slice(),(null==(o=e.widgets)?void 0:o.length)>0&&e.widgets.forEach((e=>{var t,o,i;if(null==(o=null==(t=ut[s])?void 0:t.widget)?void 0:o[e.name]){const t=ut[s].widget[e.name];if(t&&n.widgets){const s=(i=t,n.widgets.find((e=>"object"==typeof i?i.includes(e.name):e.name===i)));s&&(s.value=e.value,"seed_num"==e.name&&(s.linkedWidgets[0].value=e.linkedWidgets[0].value),"converted-widget"==e.type&&_t(n,s,e))}}})),e.inputs&&e.inputs.forEach(((t,o)=>{var i,a,l;if(t&&t.link&&(null==(a=null==(i=ut[s])?void 0:i.input)?void 0:a[t.name])){const o=null==(l=ut[s])?void 0:l.input[t.name];if(null===o)return;const i=n.findInputSlot(o);if(-1!==i){const s=e.graph.links[t.link];if(s){const t=e.graph.getNodeById(s.origin_id);t&&t.connect(s.origin_slot,n,i)}}}})),e.outputs&&e.outputs.forEach(((t,o)=>{var i,a;if(t&&t.links&&(null==(a=null==(i=ut[s])?void 0:i.output)?void 0:a[t.name])){const o=ut[s].output[t.name];if(null===o)return;const i=n.findOutputSlot(o);-1!==i&&t.links.forEach((t=>{const s=e.graph.links[t];if(s){const t=e.graph.getNodeById(s.target_id);t&&n.connect(i,t,s.target_slot)}}))}})),v.graph.remove(e),"easy fullkSampler"==n.type){const e=n.outputs[0].links;if(e&&e[0]){const t=v.graph._nodes.find((t=>t.inputs&&t.inputs[0]&&t.inputs[0].link==e[0]));t&&v.graph.remove(t)}}else if(ut.preSampling.nodes.includes(n.type)){const e=n.outputs[0].links;if(!e||!e[0]){const e=LiteGraph.createNode("easy kSampler");v.graph.add(e),e.pos=n.pos.slice(),e.pos[0]=e.pos[0]+n.size[0]+20;const t=n.findInputSlot("pipe");-1!==t&&n&&n.connect(0,e,t)}}n.setSize([n.size[0],n.computeSize()[1]])}}(e,t,s)}}const pt=(e,t)=>{const s=e.prototype.getExtraMenuOptions;e.prototype.getExtraMenuOptions=function(){const e=s.apply(this,arguments);return t.apply(this,arguments),e}},ht=(e,t,s,o,n=!0)=>{pt(o,(function(o,i){i.unshift({content:e,has_submenu:n,callback:(e,o,n,i,a)=>mt(e,o,n,i,a,t,s)}),"loaders"==t&&(i.unshift({content:Y("💎 View Lora Info..."),callback:(e,t,s,o,n)=>{let i=n.widgets.find((e=>"lora_name"==e.name)).value;i&&"None"!=i&&new dt(i).show("loras",i)}}),i.unshift({content:Y("💎 View Checkpoint Info..."),callback:(e,t,s,o,n)=>{let i=n.widgets[0].value;i&&"None"!=i&&new rt(i).show("checkpoints",i)}}))}))},mt=(e,t,s,o,n,i,a)=>{const l=[];return a.map((e=>{n.type!==e&&l.push({content:`${e}`,callback:ct(n,e,i)})})),new LiteGraph.ContextMenu(l,{event:s,callback:null,parentMenu:o,node:n}),!1},gt="converted-widget",ft=Symbol();function yt(e,t,s=""){if(t.origType=t.type,t.origComputeSize=t.computeSize,t.origSerializeValue=t.serializeValue,t.computeSize=()=>[0,-4],t.type=gt+s,t.serializeValue=()=>{if(!e.inputs)return;let s=e.inputs.find((e=>{var s;return(null==(s=e.widget)?void 0:s.name)===t.name}));return s&&s.link?t.origSerializeValue?t.origSerializeValue():t.value:void 0},t.linkedWidgets)for(const o of t.linkedWidgets)yt(e,o,":"+t.name)}function _t(e,t,s){yt(e,t);const{type:o}=function(e){let t=e[0];t instanceof Array&&(t="COMBO");return{type:t}}(s),n=e.size;t.options&&t.options.forceInput||e.addInput(t.name,o,{widget:{name:t.name,[ft]:()=>s}});for(const i of e.widgets)i.last_y+=LiteGraph.NODE_SLOT_HEIGHT;e.setSize([Math.max(n[0],e.size[0]),Math.max(n[1],e.size[1])])}const vt=function(e){var t,s,o,n;const i=e.constructor.type,a=e.properties.origVals||{},l=a.title||e.title,r=a.color||e.color,d=a.bgcolor||e.bgcolor,u=e,c={size:[...e.size],color:r,bgcolor:d,pos:[...e.pos]};let p=[],h=[];if(e.inputs)for(const y of e.inputs)if(y.link){const t=y.name,s=e.findInputSlot(t),o=e.getInputNode(s),n=e.getInputLink(s);p.push([n.origin_slot,o,t])}if(e.outputs)for(const y of e.outputs)if(y.links){const e=y.name;for(const t of y.links){const s=graph.links[t],o=graph._nodes_by_id[s.target_id];h.push([e,o,s.target_slot])}}v.graph.remove(e);let m=v.graph.add(LiteGraph.createNode(i,l,c));function g(){if(u.widgets)for(let e of u.widgets)if("converted-widget"===e.type){const t=m.widgets.find((t=>t.name===e.name));for(let s of u.inputs)s.name===e.name&&_t(m,t,s.widget)}for(let e of p){const[t,s,o]=e;s.connect(t,m.id,o)}for(let e of h){const[t,s,o]=e;m.connect(t,s,o)}}m.inputs.map(((t,s)=>{m.inputs[s].label=e.inputs[s].label})),m.outputs.map(((t,s)=>{m.outputs[s].label=e.outputs[s].label}));let f=u.widgets_values;if(!f&&(null==(t=m.widgets)?void 0:t.length)>0)return m.widgets.forEach(((e,t)=>{const s=u.widgets[t];e.name===s.name&&e.type===s.type&&(e.value=s.value)})),void g();if(f){let e=function(e,t){var s,o,n,i,a,l;if(!0===e||!1===e){if((null==(s=t.options)?void 0:s.on)&&(null==(o=t.options)?void 0:o.off))return{value:e,pass:!0}}else if("number"==typeof e){if((null==(n=t.options)?void 0:n.min)<=e&&e<=(null==(i=t.options)?void 0:i.max))return{value:e,pass:!0}}else{if(null==(l=null==(a=t.options)?void 0:a.values)?void 0:l.includes(e))return{value:e,pass:!0};if(t.inputEl&&"string"==typeof e)return{value:e,pass:!0}}return{value:t.value,pass:!1}},t=!1;const i=(null==f?void 0:f.length)<=(null==(s=m.widgets)?void 0:s.length);let a=i?0:f.length-1;const l=s=>{var o;const n=u.widgets[s];let l=m.widgets[s];if(l.name===n.name&&l.type===n.type){for(;(i?a<f.length:a>=0)&&!t;){let{value:t,pass:s}=e(f[a],l);if(s&&null!==t){l.value=t;break}a+=i?1:-1}a++,i||(a=f.length-((null==(o=m.widgets)?void 0:o.length)-1-s))}};if(i&&(null==(o=m.widgets)?void 0:o.length)>0)for(let s=0;s<m.widgets.length;s++)l(s);else if((null==(n=m.widgets)?void 0:n.length)>0)for(let s=m.widgets.length-1;s>=0;s--)l(s)}g()};v.registerExtension({name:"Comfy.EasyUse.ExtraMenu",async beforeRegisterNodeDef(e,t,s){pt(e,(function(e,s){s.unshift({content:Y("🔃 Reload Node"),callback:(e,t,s,o,n)=>{let i=LGraphCanvas.active_canvas;if(!i.selected_nodes||Object.keys(i.selected_nodes).length<=1)vt(n);else for(let a in i.selected_nodes)vt(i.selected_nodes[a])}}),"easy ckptNames"==t.name&&s.unshift({content:Y("💎 View Checkpoint Info..."),callback:(e,t,s,o,n)=>{n.widgets[0].value}})}));for(const o in ut)ut[o].nodes.includes(t.name)&&ht(`↪️ Swap ${ut[o].category}`,o,ut[o].nodes,e)}});const bt=LiteGraph.LGraphNode,wt="➡️";v.registerExtension({name:"easy setNode",registerCustomNodes(){class e extends bt{constructor(t){super("Set"),g(this,"defaultVisibility",!0),g(this,"serialize_widgets",!0),this.properties||(this.properties={previousName:""}),this.properties.showOutputText=e.defaultVisibility;const s=this;s.color=LGraphCanvas.node_colors.blue.color,this.addWidget("text","Constant","",((e,t,o,n,i)=>{s.validateName(s.graph),""!==this.widgets[0].value&&(this.title=wt+this.widgets[0].value),this.properties.previousName=this.widgets[0].value,this.update()}),{}),this.addInput("*","*"),this.onConnectionsChange=function(e,t,o,n,i){if(1!=e||o||(this.inputs[t].type="*",this.inputs[t].name="*",this.title="Set"),n&&s.graph&&1==e&&o){const e=s.graph._nodes.find((e=>e.id==n.origin_id)).outputs[n.origin_slot],t=e.type,o=s.is_auto_link?this.widgets[0].value:e.name;"Set"===this.title&&(this.title=wt+o,this.widgets[0].value=o),"*"===this.widgets[0].value&&(this.widgets[0].value=o),this.validateName(s.graph),this.inputs[0].type=t,this.inputs[0].name=o,setTimeout((e=>{this.title=wt+this.widgets[0].value,this.properties.previousName=this.widgets[0].value}),1)}this.update()},this.validateName=function(e){let t=s.widgets[0].value;if(""!=t){let o=0,n=[];do{n=e._nodes.filter((e=>e!=this&&("easy setNode"==e.type&&e.widgets[0].value===t))),n.length>0&&(t=s.widgets[0].value+o),o++}while(n.length>0);s.widgets[0].value=t,this.update()}},this.clone=function(){const t=e.prototype.clone.apply(this);return t.inputs[0].name="*",t.inputs[0].type="*",t.properties.previousName="",t.size=t.computeSize(),t},this.onAdded=function(e){this.validateName(e)},this.update=function(){if(s.graph){this.findGetters(s.graph).forEach((e=>{e.setType(this.inputs[0].type)})),this.widgets[0].value&&this.findGetters(s.graph,!0).forEach((e=>{e.setName(this.widgets[0].value)}));s.graph._nodes.filter((e=>"easy getNode"==e.type)).forEach((e=>{e.setComboValues&&e.setComboValues()}))}},this.findGetters=function(e,t){const s=t?this.properties.previousName:this.widgets[0].value;return e._nodes.filter((e=>"easy getNode"==e.type&&e.widgets[0].value===s&&""!=s))},this.isVirtualNode=!0}onRemoved(){this.graph._nodes.filter((e=>"easy getNode"==e.type)).forEach((e=>{e.setComboValues&&e.setComboValues([this])}))}}LiteGraph.registerNodeType("easy setNode",Object.assign(e,{title:"Set"})),e.category="EasyUse/Util"}}),v.registerExtension({name:"easy getNode",registerCustomNodes(){class e extends bt{constructor(t){super("Get"),g(this,"defaultVisibility",!0),g(this,"serialize_widgets",!0),this.properties||(this.properties={}),this.properties.showOutputText=e.defaultVisibility;const s=this;s.color=LGraphCanvas.node_colors.blue.color,this.addWidget("combo","Constant","",(e=>{this.onRename()}),{values:()=>s.graph._nodes.filter((e=>"easy setNode"==e.type)).map((e=>e.widgets[0].value)).sort()}),this.addOutput("*","*"),this.onConnectionsChange=function(e,t,s,o,n){this.validateLinks(),2!=e||s?(this.onRename(),setTimeout((e=>{this.title="⬅️"+this.widgets[0].value}),1)):(this.outputs[t].type="*",this.outputs[t].name="*",this.title="Get")},this.setName=function(e){s.widgets[0].value=e,s.onRename(),s.serialize()},this.onRename=function(e=0){const t=this.findSetter(s.graph);if(t){const s=t.inputs[0].type,o=t.inputs[0].name;this.setType(s,o),this.outputs[e].type=s,this.outputs[e].name=o,this.title="⬅️"+t.widgets[0].value}else this.setType("*","*"),this.outputs[e].type="*",this.outputs[e].name="*"},this.clone=function(){const t=e.prototype.clone.apply(this);return t.size=t.computeSize(),t},this.validateLinks=function(){"*"!=this.outputs[0].type&&this.outputs[0].links&&this.outputs[0].links.forEach((e=>{const t=s.graph.links[e];t&&t.type!=this.outputs[0].type&&"*"!=t.type&&s.graph.removeLink(e)}))},this.setType=function(e,t){this.outputs[0].name=t,this.outputs[0].type=e,this.validateLinks()},this.findSetter=function(e){const t=this.widgets[0].value;return e._nodes.find((e=>"easy setNode"==e.type&&e.widgets[0].value===t&&""!=t))},this.isVirtualNode=!0}getInputLink(e){const t=this.findSetter(this.graph);if(t){const s=t.inputs[e];return this.graph.links[s.link]}throw new Error("No setter found for "+this.widgets[0].value+"("+this.type+")")}onAdded(e){}}LiteGraph.registerNodeType("easy getNode",Object.assign(e,{title:"Get"})),e.category="EasyUse/Util"}}),b.addEventListener("easyuse-global-seed",(function(e){let t=app.graph._nodes_by_id;for(let s in t){let o=t[s];if("easy globalSeed"==o.type){if(o.widgets){const t=o.widgets.find((e=>"value"==e.name));o.widgets.find((e=>"last_seed"==e.name)).value=t.value,t.value=e.detail.value}}else if(o.widgets){const t=o.widgets.find((e=>"seed_num"==e.name||"seed"==e.name||"noise_seed"==e.name));t&&null!=e.detail.seed_map[o.id]&&(t.value=e.detail.seed_map[o.id])}}}));const Lt=b.queuePrompt;b.queuePrompt=async function(e,{output:t,workflow:s}){s.seed_widgets={};for(let o in app.graph._nodes_by_id){let e=app.graph._nodes_by_id[o].widgets;if(e)for(let t in e)"seed_num"!=e[t].name&&"seed"!=e[t].name&&"noise_seed"!=e[t].name||"converted-widget"==e[t].type||(s.seed_widgets[o]=parseInt(t))}return await Lt.call(b,e,{output:t,workflow:s})};const Et=["easy imageSave","easy fullkSampler","easy kSampler","easy kSamplerTiled","easy kSamplerInpainting","easy kSamplerDownscaleUnet","easy kSamplerSDTurbo","easy detailerFix"];v.registerExtension({name:"Comfy.EasyUse.SaveImageExtraOutput",async beforeRegisterNodeDef(e,t,s){if(Et.includes(t.name)){const t=e.prototype.onNodeCreated;e.prototype.onNodeCreated=function(){const e=t?t.apply(this,arguments):void 0,o=this.widgets.find((e=>"filename_prefix"===e.name||"save_prefix"===e.name));return o.serializeValue=()=>S(s,o.value),e}}else{const t=e.prototype.onNodeCreated;e.prototype.onNodeCreated=function(){const e=t?t.apply(this,arguments):void 0;return this.properties&&"Node name for S&R"in this.properties||this.addProperty("Node name for S&R",this.constructor.type,"string"),e}}}});const St=["easy wildcards","easy positive","easy negative","easy stylesSelector","easy promptConcat","easy promptReplace"],Ct=["easy preSampling","easy preSamplingAdvanced","easy preSamplingNoiseIn","easy preSamplingCustom","easy preSamplingDynamicCFG","easy preSamplingSdTurbo","easy preSamplingLayerDiffusion"],At=["easy kSampler","easy kSamplerTiled","easy kSamplerInpainting","easy kSamplerDownscaleUnet","easy kSamplerSDTurbo"],kt=["easy controlnetLoader","easy controlnetLoaderADV"],xt=["easy instantIDApply","easy instantIDApplyADV"],It=["easy ipadapterApply","easy ipadapterApplyADV","easy ipadapterApplyFaceIDKolors","easy ipadapterStyleComposition"],Nt=["easy pipeIn","easy pipeOut","easy pipeEdit","easy pipeEditPrompt"],Tt=["easy XYPlot","easy XYPlotAdvanced"],Ot=["easy setNode"],Dt=["Reroute","RescaleCFG","LoraLoaderModelOnly","LoraLoader","FreeU","FreeU_v2",...It,...Ot],Rt={"easy seed":{from:{INT:["Reroute",...Ct,"easy fullkSampler"]}},"easy positive":{from:{STRING:["Reroute",...St]}},"easy negative":{from:{STRING:["Reroute",...St]}},"easy wildcards":{from:{STRING:["Reroute","easy showAnything",...St]}},"easy stylesSelector":{from:{STRING:["Reroute","easy showAnything",...St]}},"easy promptConcat":{from:{STRING:["Reroute","easy showAnything",...St]}},"easy promptReplace":{from:{STRING:["Reroute","easy showAnything",...St]}},"easy fullLoader":{from:{PIPE_LINE:["Reroute",...Ct,"easy fullkSampler",...Nt,...Ot],MODEL:Dt},to:{STRING:["Reroute",...St]}},"easy a1111Loader":{from:{PIPE_LINE:["Reroute",...Ct,...kt,...xt,...Nt,...Ot],MODEL:Dt},to:{STRING:["Reroute",...St]}},"easy comfyLoader":{from:{PIPE_LINE:["Reroute",...Ct,...kt,...xt,...Nt,...Ot],MODEL:Dt},to:{STRING:["Reroute",...St]}},"easy hunyuanDiTLoader":{from:{PIPE_LINE:["Reroute",...Ct,...kt,...xt,...Nt,...Ot],MODEL:Dt},to:{STRING:["Reroute",...St]}},"easy kolorsLoader":{from:{PIPE_LINE:["Reroute",...Ct,...kt,...xt,...Nt,...Ot],MODEL:Dt},to:{STRING:["Reroute",...St]}},"easy pixArtLoader":{from:{PIPE_LINE:["Reroute",...Ct,...kt,...xt,...Nt,...Ot],MODEL:Dt},to:{STRING:["Reroute",...St]}},"easy fluxLoader":{from:{PIPE_LINE:["Reroute",...Ct,...kt,...xt,...Nt,...Ot],MODEL:Dt},to:{STRING:["Reroute",...St]}},"easy svdLoader":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced","easy preSamplingDynamicCFG",...Nt,...Ot],MODEL:Dt},to:{STRING:["Reroute",...St]}},"easy zero123Loader":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced","easy preSamplingDynamicCFG",...Nt,...Ot],MODEL:Dt},to:{STRING:["Reroute",...St]}},"easy sv3dLoader":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced","easy preSamplingDynamicCFG",...Nt,...Ot],MODEL:Dt},to:{STRING:["Reroute",...St]}},"easy preSampling":{from:{PIPE_LINE:["Reroute",...At,...Nt,...kt,...Tt,...Ot]}},"easy preSamplingAdvanced":{from:{PIPE_LINE:["Reroute",...At,...Nt,...kt,...Tt,...Ot]}},"easy preSamplingDynamicCFG":{from:{PIPE_LINE:["Reroute",...At,...Nt,...kt,...Tt,...Ot]}},"easy preSamplingCustom":{from:{PIPE_LINE:["Reroute",...At,...Nt,...kt,...Tt,...Ot]}},"easy preSamplingLayerDiffusion":{from:{PIPE_LINE:["Reroute","easy kSamplerLayerDiffusion",...At,...Nt,...kt,...Tt,...Ot]}},"easy preSamplingNoiseIn":{from:{PIPE_LINE:["Reroute",...At,...Nt,...kt,...Tt,...Ot]}},"easy fullkSampler":{from:{PIPE_LINE:["Reroute",...Nt.reverse(),"easy preDetailerFix","easy preMaskDetailerFix",...Ct,...Ot]}},"easy kSampler":{from:{PIPE_LINE:["Reroute",...Nt.reverse(),"easy preDetailerFix","easy preMaskDetailerFix","easy hiresFix",...Ct,...Ot]}},"easy controlnetLoader":{from:{PIPE_LINE:["Reroute",...Ct,...kt,...xt,...Nt,...Ot]}},"easy controlnetLoaderADV":{from:{PIPE_LINE:["Reroute",...Ct,...kt,...xt,...Nt,...Ot]}},"easy instantIDApply":{from:{PIPE_LINE:["Reroute",...Ct,...kt,...xt,...Nt,...Ot],MODEL:Dt},to:{COMBO:["Reroute","easy promptLine"]}},"easy instantIDApplyADV":{from:{PIPE_LINE:["Reroute",...Ct,...kt,...xt,...Nt,...Ot],MODEL:Dt},to:{COMBO:["Reroute","easy promptLine"]}},"easy ipadapterApply":{to:{COMBO:["Reroute","easy promptLine"]}},"easy ipadapterApplyADV":{to:{STRING:["Reroute","easy sliderControl",...St],COMBO:["Reroute","easy promptLine"]}},"easy ipadapterStyleComposition":{to:{COMBO:["Reroute","easy promptLine"]}},"easy preDetailerFix":{from:{PIPE_LINE:["Reroute","easy detailerFix",...Nt,...Ot]},to:{PIPE_LINE:["Reroute","easy ultralyticsDetectorPipe","easy samLoaderPipe","easy kSampler","easy fullkSampler"]}},"easy preMaskDetailerFix":{from:{PIPE_LINE:["Reroute","easy detailerFix",...Nt,...Ot]}},"easy samLoaderPipe":{from:{PIPE_LINE:["Reroute","easy preDetailerFix",...Nt,...Ot]}},"easy ultralyticsDetectorPipe":{from:{PIPE_LINE:["Reroute","easy preDetailerFix",...Nt,...Ot]}},"easy cascadeLoader":{from:{PIPE_LINE:["Reroute","easy fullCascadeKSampler","easy preSamplingCascade",...kt,...Nt,...Ot],MODEL:Dt.filter((e=>!It.includes(e)))}},"easy fullCascadeKSampler":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced",...Nt,...Ot]}},"easy preSamplingCascade":{from:{PIPE_LINE:["Reroute","easy cascadeKSampler",...Nt,...Ot]}},"easy cascadeKSampler":{from:{PIPE_LINE:["Reroute","easy preSampling","easy preSamplingAdvanced",...Nt,...Ot]}},"easy pipeEdit":{from:{PIPE_LINE:["Reroute",...Ct,...kt,...xt,...Ot]},to:{PIPE_LINE:["Reroute",...Ct,...kt,...xt,...Nt,...Ot]}},"easy pipeEditPrompt":{from:{PIPE_LINE:["Reroute",...Ct,...kt,...xt,...Ot]},to:{PIPE_LINE:["Reroute",...Ct,...kt,...xt,...Nt,...Ot]}}};v.registerExtension({name:"Comfy.EasyUse.Suggestions",async setup(e){LGraphCanvas.prototype.createDefaultNodeForSlot=function(e){e=e||{};var t,s=Object.assign({nodeFrom:null,slotFrom:null,nodeTo:null,slotTo:null,position:[],nodeType:null,posAdd:[0,0],posSizeFix:[0,0]},e),o=s.nodeFrom&&null!==s.slotFrom,n=!o&&s.nodeTo&&null!==s.slotTo;if(!o&&!n)return!1;if(!s.nodeType)return!1;var i=o?s.nodeFrom:s.nodeTo,a=o?s.slotFrom:s.slotTo,l=i.type,r=!1;switch(typeof a){case"string":r=o?i.findOutputSlot(a,!1):i.findInputSlot(a,!1),a=o?i.outputs[a]:i.inputs[a];break;case"object":r=o?i.findOutputSlot(a.name):i.findInputSlot(a.name);break;case"number":r=a,a=o?i.outputs[a]:i.inputs[a];break;default:return!1}var d=a.type==LiteGraph.EVENT?"_event_":a.type,u=o?LiteGraph.slot_types_default_out:LiteGraph.slot_types_default_in;if(u&&u[d]){a.link;let e=!1;const n=o?"from":"to";if(Rt[l]&&Rt[l][n]&&(null==(t=Rt[l][n][d])?void 0:t.length)>0){for(var c in Rt[l][n][d])if(s.nodeType==Rt[l][n][d][c]||"AUTO"==s.nodeType){e=Rt[l][n][d][c];break}}else if("object"==typeof u[d]||"array"==typeof u[d]){for(var c in u[d])if(s.nodeType==u[d][c]||"AUTO"==s.nodeType){e=u[d][c];break}}else s.nodeType!=u[d]&&"AUTO"!=s.nodeType||(e=u[d]);if(e){var p=!1;"object"==typeof e&&e.node&&(p=e,e=e.node);var h=LiteGraph.createNode(e);if(h){if(p){if(p.properties)for(var m in p.properties)h.addProperty(m,p.properties[m]);if(p.inputs)for(var m in h.inputs=[],p.inputs)h.addOutput(p.inputs[m][0],p.inputs[m][1]);if(p.outputs)for(var m in h.outputs=[],p.outputs)h.addOutput(p.outputs[m][0],p.outputs[m][1]);p.title&&(h.title=p.title),p.json&&h.configure(p.json)}return this.graph.add(h),h.pos=[s.position[0]+s.posAdd[0]+(s.posSizeFix[0]?s.posSizeFix[0]*h.size[0]:0),s.position[1]+s.posAdd[1]+(s.posSizeFix[1]?s.posSizeFix[1]*h.size[1]:0)],o?s.nodeFrom.connectByType(r,h,d):s.nodeTo.connectByTypeOutput(r,h,d),!0}}}return!1},LGraphCanvas.prototype.showConnectionMenu=function(e){e=e||{};var t,s=Object.assign({nodeFrom:null,slotFrom:null,nodeTo:null,slotTo:null,e:null,allow_searchbox:this.allow_searchbox,showSearchBox:this.showSearchBox},e),o=this,n=s.nodeFrom&&s.slotFrom,i=!n&&s.nodeTo&&s.slotTo;if(!n&&!i)return!1;var a=n?s.nodeFrom:s.nodeTo,l=n?s.slotFrom:s.slotTo,r=!1;switch(typeof l){case"string":r=n?a.findOutputSlot(l,!1):a.findInputSlot(l,!1),l=n?a.outputs[l]:a.inputs[l];break;case"object":r=n?a.findOutputSlot(l.name):a.findInputSlot(l.name);break;case"number":r=l,l=n?a.outputs[l]:a.inputs[l];break;default:return!1}var d=["Add Node",null];s.allow_searchbox&&(d.push("Search"),d.push(null));var u=l.type==LiteGraph.EVENT?"_event_":l.type,c=n?LiteGraph.slot_types_default_out:LiteGraph.slot_types_default_in,p=a.type;if(c&&c[u]){const e=n?"from":"to";if(Rt[p]&&Rt[p][e]&&(null==(t=Rt[p][e][u])?void 0:t.length)>0)for(var h in Rt[p][e][u])d.push(Rt[p][e][u][h]);else if("object"==typeof c[u]||"array"==typeof c[u])for(var h in c[u])d.push(c[u][h]);else d.push(c[u])}var m=new LiteGraph.ContextMenu(d,{event:s.e,title:(l&&""!=l.name?l.name+(u?" | ":""):"")+(l&&u?u:""),callback:function(e,t,i){switch(e){case"Add Node":LGraphCanvas.onMenuAdd(null,null,i,m,(function(e){n?s.nodeFrom.connectByType(r,e,u):s.nodeTo.connectByTypeOutput(r,e,u)}));break;case"Search":n?s.showSearchBox(i,{node_from:s.nodeFrom,slot_from:l,type_filter_in:u}):s.showSearchBox(i,{node_to:s.nodeTo,slot_from:l,type_filter_out:u});break;default:o.createDefaultNodeForSlot(Object.assign(s,{position:[s.e.canvasX,s.e.canvasY],nodeType:e}))}}});return!1}}}),v.registerExtension({name:"Comfy.EasyUse.TimeTaken",setup(){let e=new Map,t=0;b.addEventListener("execution_start",(e=>{graph&&graph._nodes.forEach((e=>{e.executionDuration&&delete e.executionDuration}))})),b.addEventListener("executing",(s=>{if(!k("EasyUse.Nodes.Runtime",null,!0))return;const o=(null==s?void 0:s.node)||(null==s?void 0:s.detail)||null,n=e.get(t);if(e.delete(t),t&&n){const e=Date.now()-n,s=ve(t);s&&(s.executionDuration||(s.executionDuration=0),s.executionDuration=s.executionDuration+e/1e3)}t=o,e.set(o,Date.now())}))},beforeRegisterNodeDef(e,t){const s=e.prototype.onDrawForeground;e.prototype.onDrawForeground=function(...e){const[t]=e;return function(e,t){if(!t)return;t=parseFloat(t).toFixed(3)+Y("s"),e.save(),e.fillStyle=LiteGraph.NODE_DEFAULT_BGCOLOR,function(e,t,s,o,n,i){e.beginPath(),e.moveTo(t+i,s),e.lineTo(t+o-i,s),e.arcTo(t+o,s,t+o,s+i,i),e.lineTo(t+o,s+n-i),e.arcTo(t+o,s+n,t+o-i,s+n,i),e.lineTo(t+i,s+n),e.arcTo(t,s+n,t,s+n-i,i),e.lineTo(t,s+i),e.arcTo(t,s,t+i,s,i),e.closePath()}(e,0,-LiteGraph.NODE_TITLE_HEIGHT-20,e.measureText(t).width+10,LiteGraph.NODE_TITLE_HEIGHT-10,4),e.fill(),function(e,t,s,o,n="#000",i=12,a="Inter"){e.font=`${i}px ${a}`,e.fillStyle=n,e.fillText(t,s,o)}(e,t,8,-LiteGraph.NODE_TITLE_HEIGHT-6,LiteGraph.NODE_TITLE_COLOR),e.restore()}(t,this.executionDuration),null==s?void 0:s.apply(this,e)}}});let Mt=null;v.registerExtension({name:"Comfy.EasyUse.HotKeys",setup(){if(void 0!==y){y("up,down,left,right",(function(e,t){var s,o,n,i,a,l,r,d,u,c,p,h,m,g,f;e.preventDefault();if(!k("EasyUse.Hotkeys.JumpNearestNodes",null,!0))return;const y=be();if(0===y.length)return;const _=y[0];switch(t.key){case"up":case"left":let e=null;if(Ae(_)){const e=null==(s=_.widgets_values)?void 0:s[0],t=null==(o=_.graph)?void 0:o._nodes,n=null==t?void 0:t.find((t=>{var s;if(ke(t)){if((null==(s=t.widgets_values)?void 0:s[0])===e)return t}return null}));n&&Le(n)}else if((null==(n=_.inputs)?void 0:n.length)>0){for(let t=0;t<_.inputs.length;t++)if(_.inputs[t].link){e=_.inputs[t].link;break}if(e){const t=null==(i=_.graph)?void 0:i.links;if(t[e]){const s=null==(a=t[e])?void 0:a.origin_id,o=null==(r=null==(l=_.graph)?void 0:l._nodes_by_id)?void 0:r[s];o&&Le(o)}}}break;case"down":case"right":let t=null;if(ke(_)){const e=null==(d=_.widgets_values)?void 0:d[0],t=null==(u=_.graph)?void 0:u._nodes,s=null==t?void 0:t.find((t=>{var s;if(Ae(t)){if((null==(s=t.widgets_values)?void 0:s[0])===e)return t}return null}));s&&Le(s)}else if((null==(c=_.outputs)?void 0:c.length)>0){for(let e=0;e<_.outputs.length;e++)if((null==(p=_.outputs[e].links)?void 0:p.length)>0&&_.outputs[e].links[0]){t=_.outputs[e].links[0];break}if(t){const e=null==(h=_.graph)?void 0:h.links;if(e[t]){const s=null==(m=e[t])?void 0:m.target_id,o=null==(f=null==(g=_.graph)?void 0:g._nodes_by_id)?void 0:f[s];o&&Le(o)}}}}})),y("shift+up,shift+down,shift+left,shift+right,shift+alt+⌘+left,shift+alt+⌘+right,shift+alt+ctrl+left,shift+alt+ctrl+right",(function(e,t){e.preventDefault();if(!k("EasyUse.Hotkeys.AlignSelectedNodes",null,!0))return;const s=be();if(s.length<=1)return;const o=s;switch(t.key){case"shift+up":LGraphCanvas.alignNodes(o,"top",o[0]);break;case"shift+down":LGraphCanvas.alignNodes(o,"bottom",o[0]);break;case"shift+left":LGraphCanvas.alignNodes(o,"left",o[0]);break;case"shift+right":LGraphCanvas.alignNodes(o,"right",o[0]);break;case"shift+alt+ctrl+left":case"shift+alt+⌘+left":Fe(o,"horizontal");break;case"shift+alt+ctrl+right":case"shift+alt+⌘+right":Fe(o,"vertical")}Mt||(Mt=$()),Mt&&Mt.update()})),y("shift+⌘+left,shift+⌘+right,shift+ctrl+left,shift+ctrl+right",(function(e,t){e.preventDefault();if(!k("EasyUse.Hotkeys.NormalizeSelectedNodes",null,!0))return;const s=be();if(s.length<=1)return;const o=s;switch(t.key){case"shift+ctrl+left":case"shift+⌘+left":Pe(o,"width");break;case"shift+ctrl+right":case"shift+⌘+right":Pe(o,"height")}Mt||(Mt=$()),Mt&&Mt.update()})),y("shift+g",(function(e,t){e.preventDefault();k("EasyUse.Hotkeys.AddGroup",null,!0)&&(Pt(),Mt||(Mt=$()),Mt&&Mt.update())})),y("shift+r",(function(e,t){e.preventDefault();k("EasyUse.Hotkeys.cleanVRAMused",null,!0)&&Qe()})),y("shift+m",(function(e,t){var s,o,n;if(!k("EasyUse.Hotkeys.toggleNodesMap",null,!0))return;let i=(null==(s=v.extensionManager)?void 0:s.sidebarTab)||v.extensionManager,a=(null==(o=v.extensionManager.sidebarTab)?void 0:o.activeSidebarTabId)||(null==(n=v.extensionManager)?void 0:n.activeSidebarTab);i.activeSidebarTabId=a==P?null:P}));const e=[];Array.from(Array(10).keys()).forEach((t=>e.push(`alt+${t}`))),y(e.join(","),(async function(e,t){e.preventDefault();if(!k("EasyUse.Hotkeys.NodesTemplate",null,!0))return;const s=t.key;let o=parseInt(s.split("+")[1]);const n=await b.getUserData("comfy.templates.json");let i=null;if(200==n.status)try{i=await n.json()}catch(l){Ue.error(Y("Get Node Templates File Failed"))}else localStorage["Comfy.NodeTemplates"]?i=JSON.parse(localStorage["Comfy.NodeTemplates"]):Ue.warn(Y("No Node Templates Found"));if(!i)return void Ue.warn(Y("No Node Templates Found"));o=0===o?9:o-1;const a=i[o];if(a)try{const e=(null==a?void 0:a.name)||"Group",t=(null==a?void 0:a.data)?JSON.parse(a.data):[];Gt((async()=>{await C.registerFromWorkflow(t.groupNodes,{}),localStorage.litegrapheditor_clipboard=a.data,v.canvas.pasteFromClipboard(),t.groupNodes||Pt(e)}))}catch(l){Ue.error(l)}else Ue.warn(Y("Node template with {key} not set").replace("{key}",s))}));const t=async function(e){if(("b"===e.key||"m"==e.key)&&(e.metaKey||e.ctrlKey)){if(0===be().length)return;Mt||(Mt=$()),Mt&&Mt.update()}};window.addEventListener("keydown",t,!0)}}});const Gt=async e=>{const t=localStorage.litegrapheditor_clipboard;await e(),localStorage.litegrapheditor_clipboard=t},Pt=e=>{const t=be();if(0===t.length)return;const s=t;let o=new LiteGraph.LGraphGroup;o.title=e||"Group",((e,t=[],s=20)=>{var o,n,i,a,l,r,d,u,c,p;for(var h of(n=i=a=l=-1,r=d=u=c=-1,[e._nodes,t]))for(var m in h)r=(p=h[m]).pos[0],d=p.pos[1],u=p.pos[0]+p.size[0],c=p.pos[1]+p.size[1],"Reroute"!=p.type&&(d-=LiteGraph.NODE_TITLE_HEIGHT),(null==(o=p.flags)?void 0:o.collapsed)&&(c=d+LiteGraph.NODE_TITLE_HEIGHT,(null==p?void 0:p._collapsed_width)&&(u=r+Math.round(p._collapsed_width))),(-1==n||r<n)&&(n=r),(-1==i||d<i)&&(i=d),(-1==a||u>a)&&(a=u),(-1==l||c>l)&&(l=c);i-=Math.round(1.4*e.font_size),e.pos=[n-s,i-s],e.size=[a-n+2*s,l-i+2*s]})(o,s),v.canvas.graph.add(o)};function Ft(e,t,s,o){const n=[];return e.workflow.links.forEach((e=>{s&&e[1]===t&&!n.includes(e[3])&&n.push(e[3]),o&&e[3]===t&&!n.includes(e[1])&&n.push(e[1])})),n}async function Ut(e,t=!1){const s=structuredClone(await v.graphToPrompt()),o=[];if(s.workflow.nodes.forEach((e=>{o.push(e.id)})),s.workflow.links=s.workflow.links.filter((e=>o.includes(e[1])&&o.includes(e[3]))),t)for(;!v.graph._nodes_by_id[e].isChooser;)e=Ft(s,e,!0,!1)[0];const n=function(e,t){const s=[],o=[t];for(;o.length>0;){const t=o.pop();s.push(t),o.push(...Ft(e,t,!0,!1).filter((e=>!(s.includes(e)||o.includes(e)))))}o.push(...s.filter((e=>e!=t)));const n=[t];for(;o.length>0;){const t=o.pop();n.push(t),o.push(...Ft(e,t,!1,!0).filter((e=>!(n.includes(e)||o.includes(e)))))}const i=[];return i.push(...s),i.push(...n.filter((e=>!i.includes(e)))),i}(s,e);s.workflow.nodes=s.workflow.nodes.filter((t=>(t.id===e&&t.inputs.forEach((e=>{e.link=null})),n.includes(t.id)))),s.workflow.links=s.workflow.links.filter((e=>n.includes(e[1])&&n.includes(e[3])));const i={};for(const[r,d]of Object.entries(s.output))n.includes(parseInt(r))&&(i[r]=d);const a={};for(const[r,d]of Object.entries(i[e.toString()].inputs))Array.isArray(d)||(a[r]=d);i[e.toString()].inputs=a,s.output=i;const l=v.graphToPrompt;v.graphToPrompt=()=>(v.graphToPrompt=l,s),v.queuePrompt(0)}const Bt=new class{constructor(){this.current_node_id=void 0,this.class_of_current_node=null,this.current_node_is_chooser=!1}update(){var e,t;return v.runningNodeId!=this.current_node_id&&(this.current_node_id=v.runningNodeId,this.current_node_id?(this.class_of_current_node=null==(t=null==(e=v.graph)?void 0:e._nodes_by_id[v.runningNodeId.toString()])?void 0:t.comfyClass,this.current_node_is_chooser="easy imageChooser"===this.class_of_current_node):(this.class_of_current_node=void 0,this.current_node_is_chooser=!1),!0)}},zt=class e{constructor(){}static idle(){return!v.runningNodeId}static paused(){return!0}static paused_here(t){return e.here(t)}static running(){return!e.idle()}static here(e){return v.runningNodeId==e}static state(){return"Paused"}};g(zt,"cancelling",!1);let Wt=zt;function jt(e,t){const s=new FormData;s.append("message",t),s.append("id",e),b.fetchApi("/easyuse/image_chooser_message",{method:"POST",body:s})}function Vt(){jt(-1,"__cancel__"),Wt.cancelling=!0,b.interrupt(),Wt.cancelling=!1}var Yt=0;function Ht(){Yt+=1}const Xt=["easy kSampler","easy kSamplerTiled","easy fullkSampler"];function Zt(e){const t=v.graph._nodes_by_id[e.detail.id];if(t){t.selected_images=new Set,t.anti_selected=new Set;const s=function(e,t){var s;return e.imgs=[],t.forEach((t=>{const s=new Image;e.imgs.push(s),s.onload=()=>{v.graph.setDirtyCanvas(!0)},s.src=`/view?filename=${encodeURIComponent(t.filename)}&type=temp&subfolder=${v.getPreviewFormatParam()}`})),null==(s=e.setSizeForImage)||s.call(e),e.imgs}(t,e.detail.urls);return{node:t,image:s,isKSampler:Xt.includes(t.type)}}}function Kt(e,t,s){var o;if(e.imageRects)o=e.imageRects[t];else{const t=e.imagey;o=[1,t+1,e.size[0]-2,e.size[1]-t-2]}s.strokeRect(o[0]+1,o[1]+1,o[2]-2,o[3]-2)}class Jt extends L{constructor(){super(),this.node=null,this.select_index=[],this.dialog_div=null}show(e,t){this.select_index=[],this.node=t;const s=e.map(((e,s)=>{const o=w("img",{src:e.src,onclick:e=>{this.select_index.includes(s)?(this.select_index=this.select_index.filter((e=>e!==s)),o.classList.remove("selected")):(this.select_index.push(s),o.classList.add("selected")),t.selected_images.has(s)?t.selected_images.delete(s):t.selected_images.add(s)}});return o}));super.show(w("div.comfyui-easyuse-chooser-dialog",[w("h5.comfyui-easyuse-chooser-dialog-title",Y("Choose images to continue")),w("div.comfyui-easyuse-chooser-dialog-images",s)]))}createButtons(){const e=super.createButtons();return e[0].onclick=e=>{Wt.running()&&Vt(),super.close()},e.unshift(w("button",{type:"button",textContent:Y("Choose Selected Images"),onclick:e=>{jt(this.node.id,[...this.node.selected_images,-1,...this.node.anti_selected]),Wt.idle()&&(Ht(),Ut(this.node.id).then((()=>{jt(this.node.id,[...this.node.selected_images,-1,...this.node.anti_selected])}))),super.close()}})),e}}function $t(){const e=v.graph._nodes_by_id[this.node_id];if(e){const t=[...e.selected_images];(null==t?void 0:t.length)>0&&e.setProperty("values",t),jt(e.id,[...e.selected_images,-1,...e.anti_selected]),Wt.idle()&&(Ht(),Ut(e.id).then((()=>{jt(e.id,[...e.selected_images,-1,...e.anti_selected])})))}}function qt(){Wt.running()&&Vt()}function Qt(e){Object.defineProperty(e,"clicked",{get:function(){return this._clicked},set:function(e){this._clicked=e&&""!=this.name}})}function es(e){e.options||(e.options={}),e.options.serialize=!1}v.registerExtension({name:"Comfy.EasyUse.imageChooser",init(){window.addEventListener("beforeunload",Vt,!0)},setup(e){const t=LGraphCanvas.prototype.draw;LGraphCanvas.prototype.draw=function(){Bt.update()&&e.graph._nodes.forEach((e=>{e.update&&e.update()})),t.apply(this,arguments)},b.addEventListener("easyuse-image-choose",(function(e){const{node:t,image:s,isKSampler:o}=Zt(e);if(o){(new Jt).show(s,t)}}));const s=b.interrupt;b.interrupt=function(){Wt.cancelling||Vt(),s.apply(this,arguments)},b.addEventListener("execution_start",(function(){(Yt>0?(Yt-=1,0):(jt(-1,"__start__"),1))&&e.graph._nodes.forEach((e=>{(e.selected_images||e.anti_selected)&&(e.selected_images.clear(),e.anti_selected.clear(),e.update())}))}))},async nodeCreated(e,t){if("easy imageChooser"==e.comfyClass){e.setProperty("values",[]),void 0===(null==e?void 0:e.imageIndex)&&Object.defineProperty(e,"imageIndex",{get:function(){return null},set:function(t){e.overIndex=t}}),void 0===(null==e?void 0:e.imagey)&&Object.defineProperty(e,"imagey",{get:function(){return null},set:function(t){return e.widgets[e.widgets.length-1].last_y+LiteGraph.NODE_WIDGET_HEIGHT}});const t=e.onMouseDown;e.onMouseDown=function(s,o,n){if(s.isPrimary){const t=function(e,t){var s,o;if((null==(s=e.imgs)?void 0:s.length)>1)for(var n=0;n<e.imageRects.length;n++){const s=t[0]-e.imageRects[n][0],o=t[1]-e.imageRects[n][1];if(s>0&&s<e.imageRects[n][2]&&o>0&&o<e.imageRects[n][3])return n}else if(1==(null==(o=e.imgs)?void 0:o.length)&&t[1]>e.imagey)return 0;return-1}(e,o);t>=0&&this.imageClicked(t)}return t&&t.apply(this,arguments)},e.send_button_widget=e.addWidget("button","","",$t),e.cancel_button_widget=e.addWidget("button","","",qt),Qt(e.cancel_button_widget),Qt(e.send_button_widget),es(e.cancel_button_widget),es(e.send_button_widget)}},beforeRegisterNodeDef(e,t,s){if("easy imageChooser"==(null==t?void 0:t.name)){const t=e.prototype.onDrawBackground;e.prototype.onDrawBackground=function(e){t.apply(this,arguments),function(e,t){var s;if(e.imgs){if(e.imageRects)for(let s=0;s<e.imgs.length;s++){t.fillStyle="#000",t.fillRect(...e.imageRects[s]);const n=e.imgs[s],i=e.imageRects[s][2],a=e.imageRects[s][3];let l=i/n.width,r=a/n.height;var o=Math.min(l,r);let d=o*n.height,u=o*n.width;const c=e.imageRects[s][0]+(i-u)/2,p=e.imageRects[s][1]+(a-d)/2,h=2;t.drawImage(n,c+h,p+h,u-2*h,d-2*h)}t.lineWidth=2,t.strokeStyle="green",e&&e.selected_images&&e.selected_images.forEach((s=>{Kt(e,s,t)})),t.strokeStyle="#F88",null==(s=null==e?void 0:e.anti_selected)||s.forEach((s=>{Kt(e,s,t)}))}}(this,e)},e.prototype.imageClicked=function(t){"easy imageChooser"===(null==e?void 0:e.comfyClass)&&(this.selected_images.has(t)?this.selected_images.delete(t):this.selected_images.add(t),this.update())};const s=e.prototype.update;e.prototype.update=function(){var e;if(s&&s.apply(this,arguments),this.send_button_widget){this.send_button_widget.node_id=this.id;const t=(this.selected?this.selected_images.size:0)+(this.anti_selected?this.anti_selected.size:0),s=(null==(e=this.imgs)?void 0:e.length)||0;Wt.paused_here(this.id)&&t>0?this.send_button_widget.name=t>1?"Progress selected ("+t+"/"+s+")":"Progress selected image":this.send_button_widget.name=t>0?t>1?"Progress selected ("+t+"/"+s+")":"Progress selected image as restart":""}if(this.cancel_button_widget){const e=Wt.running();this.cancel_button_widget.name=e?"Cancel current run":""}this.setDirtyCanvas(!0,!0)}}}}),Number.prototype.div=function(e){return function(e,t){let s,o,n=0,i=0,a="string"==typeof e?e:e.toString(),l="string"==typeof t?t:t.toString();try{n=a.toString().split(".")[1].length}catch(r){}try{i=l.toString().split(".")[1].length}catch(r){}return s=Number(a.toString().replace(".","")),o=Number(l.toString().replace(".","")),s/o*Math.pow(10,i-n)}(this,e)};let ts=[],ss=0;const os={sd3:6.5,"sd3-turbo":4};class ns extends L{constructor(){super(),this.lists=[],this.dialog_div=null,this.user_div=null}addItem(e,t){return w("div.easyuse-account-dialog-item",[w("input",{type:"text",placeholder:"Enter name",oninput:e=>{const t=Array.prototype.indexOf.call(this.dialog_div.querySelectorAll(".easyuse-account-dialog-item"),e.target.parentNode);ts[t].name=e.target.value},value:ts[e].name}),w("input.key",{type:"text",oninput:e=>{const t=Array.prototype.indexOf.call(this.dialog_div.querySelectorAll(".easyuse-account-dialog-item"),e.target.parentNode);ts[t].key=e.target.value},placeholder:"Enter APIKEY",value:ts[e].key}),w("button.choose",{textContent:Y("Choose"),onclick:async e=>{var s,o,n;const i=Array.prototype.indexOf.call(this.dialog_div.querySelectorAll(".easyuse-account-dialog-item"),e.target.parentNode);let a=ts[i].name,l=ts[i].key;if(!a)return void Ue.error(Y("Please enter the account name"));if(!l)return void Ue.error(Y("Please enter the APIKEY"));let r=!0;for(let t=0;t<ts.length;t++)if(!ts[t].key){r=!1;break}if(!r)return void Ue.error(Y("APIKEY is not Empty"));ss=i;const d=new FormData;d.append("api_keys",JSON.stringify(ts)),d.append("current",ss);const u=await b.fetchApi("/easyuse/stability/set_api_keys",{method:"POST",body:d});if(200==u.status){const e=await u.json();if((null==e?void 0:e.account)&&(null==e?void 0:e.balance)){const i=(null==(s=e.account)?void 0:s.profile_picture)||null,a=(null==(o=e.account)?void 0:o.email)||null,l=(null==(n=e.balance)?void 0:n.credits)||0;t.replaceChildren(w("div.easyuse-account-user-info",{onclick:e=>{(new ns).show(t)}},[w("div.user",[w("div.avatar",i?[w("img",{src:i})]:"😀"),w("div.info",[w("h5.name",a),w("h6.remark","Credits: "+l)])]),w("div.edit",{textContent:Y("Edit")})])),Ue.success(Y("Save Succeed"))}else Ue.success(Y("Save Succeed"));this.close()}else Ue.error(Y("Save Failed"))}}),w("button.delete",{textContent:Y("Delete"),onclick:e=>{const t=Array.prototype.indexOf.call(this.dialog_div.querySelectorAll(".easyuse-account-dialog-item"),e.target.parentNode);ts.length<=1?Ue.error(Y("At least one account is required")):(ts.splice(t,1),this.dialog_div.removeChild(e.target.parentNode))}})])}show(e){ts.forEach(((t,s)=>{this.lists.push(this.addItem(s,e))})),this.dialog_div=w("div.easyuse-account-dialog",this.lists),super.show(w("div.easyuse-account-dialog-main",[w("div",[w("a",{href:"https://platform.stability.ai/account/keys",target:"_blank",textContent:Y("Getting Your APIKEY")})]),this.dialog_div]))}createButtons(){const e=super.createButtons();return e.unshift(w("button",{type:"button",textContent:Y("Save Account Info"),onclick:e=>{let t=!0;for(let s=0;s<ts.length;s++)if(!ts[s].key){t=!1;break}if(t){const e=new FormData;e.append("api_keys",JSON.stringify(ts)),b.fetchApi("/easyuse/stability/set_api_keys",{method:"POST",body:e}).then((e=>{200==e.status?Ue.success(Y("Save Succeed")):Ue.error(Y("Save Failed"))}))}else Ue.error(Y("APIKEY is not Empty"))}})),e.unshift(w("button",{type:"button",textContent:Y("Add Account"),onclick:e=>{const t="Account "+ts.length.toString();ts.push({name:t,key:""});const s=this.addItem(ts.length-1);this.lists.push(s),this.dialog_div.appendChild(s)}})),e}}v.registerExtension({name:"Comfy.EasyUse.API.SD3",async beforeRegisterNodeDef(e,t,s){if("easy stableDiffusion3API"==t.name){const t=e.prototype.onNodeCreated;e.prototype.onNodeCreated=async function(){var e,s,o;t&&(null==t||t.apply(this,arguments));const n=this.widgets.find((e=>["seed_num","seed"].includes(e.name))),i=this.widgets.find((e=>["control_before_generate","control_after_generate"].includes(e.name)));let a=this.widgets.find((e=>"model"==e.name));a.callback=e=>{l.value="-"+os[e]};const l=this.addWidget("text","cost_credit","0",(e=>{}),{serialize:!1});l.disabled=!0,setTimeout((e=>{"control_before_generate"==i.name&&0===n.value&&(n.value=Math.floor(4294967294*Math.random())),l.value="-"+os[a.value]}),100);let r=w("div.easyuse-account-user",[Y("Loading UserInfo...")]);this.addDOMWidget("account","btn",w("div.easyuse-account",r)),b.addEventListener("stable-diffusion-api-generate-succeed",(async({detail:e})=>{var t;let s=r.querySelectorAll(".remark");if(s&&s[0]){const t=(null==e?void 0:e.model)?os[e.model]:0;if(t){let e=function(e,t){let s,o,n,i,a,l;a="string"==typeof e?e:e.toString(),l="string"==typeof t?t:t.toString();try{s=a.split(".")[1].length}catch(r){s=0}try{o=l.split(".")[1].length}catch(r){o=0}return n=Math.pow(10,Math.max(s,o)),i=s>=o?s:o,((e*n-t*n)/n).toFixed(i)}(parseFloat(s[0].innerText.replace(/Credits: /g,"")),t);e>0&&(s[0].innerText="Credits: "+e.toString())}}await X(1e4);const o=await b.fetchApi("/easyuse/stability/balance");if(200==o.status){const e=await o.json();if(null==e?void 0:e.balance){const o=(null==(t=e.balance)?void 0:t.credits)||0;s&&s[0]&&(s[0].innerText="Credits: "+o)}}}));const d=await b.fetchApi("/easyuse/stability/api_keys");if(200==d.status){let t=await d.json();if(ts=t.keys,ss=t.current,ts.length>0&&void 0!==ss){const t=ts[ss].key,n=ts[ss].name;if(t){const t=await b.fetchApi("/easyuse/stability/user_info");if(200==t.status){const n=await t.json();if((null==n?void 0:n.account)&&(null==n?void 0:n.balance)){const t=(null==(e=n.account)?void 0:e.profile_picture)||null,i=(null==(s=n.account)?void 0:s.email)||null,a=(null==(o=n.balance)?void 0:o.credits)||0;r.replaceChildren(w("div.easyuse-account-user-info",{onclick:e=>{(new ns).show(r)}},[w("div.user",[w("div.avatar",t?[w("img",{src:t})]:"😀"),w("div.info",[w("h5.name",i),w("h6.remark","Credits: "+a)])]),w("div.edit",{textContent:Y("Edit")})]))}}}else r.replaceChildren(w("div.easyuse-account-user-info",{onclick:e=>{(new ns).show(r)}},[w("div.user",[w("div.avatar","😀"),w("div.info",[w("h5.name",n),w("h6.remark",Y("Click to set the APIKEY first"))])]),w("div.edit",{textContent:Y("Edit")})]))}}}}}});let is=null;function as(){is&&(is.removeEventListeners(),is.dropdown.remove(),is=null)}function ls(e,t,s,o=!1){as(),new rs(e,t,s,o)}class rs{constructor(e,t,s,o=!1){this.dropdown=document.createElement("ul"),this.dropdown.setAttribute("role","listbox"),this.dropdown.classList.add("easy-dropdown"),this.selectedIndex=-1,this.inputEl=e,this.suggestions=t,this.onSelect=s,this.isDict=o,this.focusedDropdown=this.dropdown,this.buildDropdown(),this.onKeyDownBound=this.onKeyDown.bind(this),this.onWheelBound=this.onWheel.bind(this),this.onClickBound=this.onClick.bind(this),this.addEventListeners()}buildDropdown(){this.isDict?this.buildNestedDropdown(this.suggestions,this.dropdown):this.suggestions.forEach(((e,t)=>{this.addListItem(e,t,this.dropdown)}));const e=this.inputEl.getBoundingClientRect();this.dropdown.style.top=e.top+e.height-10+"px",this.dropdown.style.left=e.left+"px",document.body.appendChild(this.dropdown),is=this}buildNestedDropdown(e,t){let s=0;Object.keys(e).forEach((o=>{const n=e[o];if("object"==typeof n&&null!==n){const e=document.createElement("ul");e.setAttribute("role","listbox"),e.classList.add("easy-nested-dropdown");const i=document.createElement("li");i.classList.add("folder"),i.textContent=o,i.appendChild(e),i.addEventListener("mouseover",this.onMouseOver.bind(this,s,t)),t.appendChild(i),this.buildNestedDropdown(n,e),s+=1}else{const e=document.createElement("li");e.classList.add("item"),e.setAttribute("role","option"),e.textContent=o,e.addEventListener("mouseover",this.onMouseOver.bind(this,s,t)),e.addEventListener("mousedown",this.onMouseDown.bind(this,o)),t.appendChild(e),s+=1}}))}addListItem(e,t,s){const o=document.createElement("li");o.setAttribute("role","option"),o.textContent=e,o.addEventListener("mouseover",this.onMouseOver.bind(this,t)),o.addEventListener("mousedown",this.onMouseDown.bind(this,e)),s.appendChild(o)}addEventListeners(){document.addEventListener("keydown",this.onKeyDownBound),this.dropdown.addEventListener("wheel",this.onWheelBound),document.addEventListener("click",this.onClickBound)}removeEventListeners(){document.removeEventListener("keydown",this.onKeyDownBound),this.dropdown.removeEventListener("wheel",this.onWheelBound),document.removeEventListener("click",this.onClickBound)}onMouseOver(e,t){t&&(this.focusedDropdown=t),this.selectedIndex=e,this.updateSelection()}onMouseOut(){this.selectedIndex=-1,this.updateSelection()}onMouseDown(e,t){t.preventDefault(),this.onSelect(e),this.dropdown.remove(),this.removeEventListeners()}onKeyDown(e){const t=Array.from(this.focusedDropdown.children),s=t[this.selectedIndex];if(is)if(38===e.keyCode)e.preventDefault(),this.selectedIndex=Math.max(0,this.selectedIndex-1),this.updateSelection();else if(40===e.keyCode)e.preventDefault(),this.selectedIndex=Math.min(t.length-1,this.selectedIndex+1),this.updateSelection();else if(39===e.keyCode){if(e.preventDefault(),s&&s.classList.contains("folder")){const e=s.querySelector(".easy-nested-dropdown");e&&(this.focusedDropdown=e,this.selectedIndex=0,this.updateSelection())}}else if(37===e.keyCode&&this.focusedDropdown!==this.dropdown){const e=this.focusedDropdown.closest(".easy-dropdown, .easy-nested-dropdown").parentNode.closest(".easy-dropdown, .easy-nested-dropdown");e&&(this.focusedDropdown=e,this.selectedIndex=Array.from(e.children).indexOf(this.focusedDropdown.parentNode),this.updateSelection())}else if((13===e.keyCode||9===e.keyCode)&&this.selectedIndex>=0){e.preventDefault(),s.classList.contains("item")&&(this.onSelect(t[this.selectedIndex].textContent),this.dropdown.remove(),this.removeEventListeners());const o=s.querySelector(".easy-nested-dropdown");o&&(this.focusedDropdown=o,this.selectedIndex=0,this.updateSelection())}else 27===e.keyCode&&(this.dropdown.remove(),this.removeEventListeners())}onWheel(e){const t=parseInt(this.dropdown.style.top);localStorage.getItem("Comfy.Settings.Comfy.InvertMenuScrolling")?this.dropdown.style.top=t+(e.deltaY<0?10:-10)+"px":this.dropdown.style.top=t+(e.deltaY<0?-10:10)+"px"}onClick(e){this.dropdown.contains(e.target)||e.target===this.inputEl||(this.dropdown.remove(),this.removeEventListeners())}updateSelection(){Array.from(this.focusedDropdown.children).forEach(((e,t)=>{t===this.selectedIndex?e.classList.add("selected"):e.classList.remove("selected")}))}}function ds(e){const t=e.min||0,s=e.max||0,o=e.step||1;if(0===o)return[];const n=[];let i=t;for(;i<=s;){if(Number.isInteger(o))n.push(Math.round(i)+"; ");else{let e=i.toFixed(3);-0==e&&(e="0.000"),/\.\d{3}$/.test(e)||(e+="0"),n.push(e+"; ")}i+=o}return s>=0&&t>=0?n:n.reverse()}let us={},cs={};function ps(e,t){String(e.id);const s=t.name,o=t.value.replace(/^(loader|preSampling):\s/,"");cs[s]?cs[s]!=us[o]&&(cs[s]=us[o]):cs={...cs,[s]:us[o]}}v.registerExtension({name:"Comfy.EasyUse.XYPlot",async beforeRegisterNodeDef(e,t,s){if("easy XYPlot"===t.name){us=t.input.hidden.plot_dict[0];for(const e in us){const t=us[e];if(Array.isArray(t)){let s=[];for(const e of t)s.push(e+"; ");us[e]=s}else us[e]="object"==typeof t?"seed"==e?t+"; ":ds(t):t+"; "}us.None=[],us["---------------------"]=[]}},nodeCreated(e){"easy XYPlot"===e.comfyClass&&(function(e){if(e.widgets)for(const t of e.widgets)if("x_axis"===t.name||"y_axis"===t.name){let s=t.value;Object.defineProperty(t,"value",{get:()=>s,set(o){o!==s&&(s=o,ps(e,t))}})}}(e),function(e){if(e.widgets){const t=e.widgets.filter((e=>"customtext"===e.type&&!1!==e.dynamicPrompts||e.dynamicPrompts));for(const e of t){let t=function(e,t,o,n){return e&&(t[o]=e),t.map((e=>s(e,n))).filter((e=>""!==e)).join("")},s=function(e,t){if(e=o(e),n(e,t))return e+"; ";let s=i(e,t);return 1===s.length||2===s.length?s[0]:n(a(e),t)?a(e)+"; ":""},o=function(e){return e.replace(/(\n|;| )/g,"")},n=function(e,t){return t.includes(e+"; ")},i=function(e,t){return t.filter((t=>t.toLowerCase().includes(e.toLowerCase())))},a=function(e){return Number(e)?Number(e).toFixed(3):["0","0.","0.0","0.00","00"].includes(e)?"0.000":e};const l=function(){const s=e.name[0]+"_axis";let o=(null==cs?void 0:cs[s])||[];if(0===o.length)return;const n=e.inputEl.value,i=e.inputEl.selectionStart;let a=n.split("; ");const l=n.substring(0,i).split("; ").length-1,r=a[l].replace(/\n/g,"").toLowerCase(),d=o.filter((e=>e.toLowerCase().includes(r))).map((e=>e.replace(/; /g,"")));if(d.length>0)ls(e.inputEl,d,(s=>{const n=t(s,a,l,o);e.inputEl.value=n}));else{as();const s=t(null,a,l,o);e.inputEl.value=s}};e.inputEl.removeEventListener("input",l),e.inputEl.addEventListener("input",l),e.inputEl.removeEventListener("mouseup",l),e.inputEl.addEventListener("mouseup",l)}}}(e))}});export{Y as $,G as N,b as a,v as b,fe as c,k as d,Qe as e,P as f,ge as g,x as h,Ee as j,V as l,X as s,Ue as t,$ as u};
|