diff --git a/extensions-builtin/sd-webui-ux/javascript/dist/index.js b/extensions-builtin/sd-webui-ux/javascript/dist/index.js
index 22600d28..819edf50 100644
--- a/extensions-builtin/sd-webui-ux/javascript/dist/index.js
+++ b/extensions-builtin/sd-webui-ux/javascript/dist/index.js
@@ -6,25 +6,25 @@ async function dt(t,e,o){const n=document.querySelector(o),s=`
class="xtabs-tab">
${e.slice(0,2)}
${e}
- `,i=document.createElement("div");i.innerHTML=s;const c=i.firstElementChild;n.append(c)}async function mt(t){const e=document.querySelector("#split-left"),o=`
+ `,i=document.createElement("div");i.innerHTML=s;const a=i.firstElementChild;n.append(a)}async function mt(t){const e=document.querySelector("#split-left"),o=`
`,n=document.createElement("div");n.innerHTML=o;const s=n.firstElementChild;e.append(s)}async function pt(){let t=["tab_txt2img","tab_img2img","tab_extras","tab_pnginfo","tab_train","tab_modelmerger","tab_settings","tab_extensions","tab_deforum_interface","tab_infinite-image-browsing","tab_anapnoe_dock","tab_anapnoe_sd_uiux_core","tab_space"];const e=document.querySelectorAll("#tabs > .tabitem");for(const o of e){const n=o.id,s=n.split("tab_")[1];!t.includes(n)&&!n.startsWith("tab_ui_theme")&&await Promise.all([dt(n,s,"#other_extensions"),mt(n)])}}function ft(t,e){const o=document.querySelector(t);if(o){const n=s=>{e.forEach(i=>{const c=document.querySelector(`link[rel="stylesheet"][href*="${i}"]`);if(c){const a=c.cloneNode();s.appendChild(a)}})};o.contentDocument.readyState==="complete"?n(o.contentDocument.head):o.addEventListener("load",s=>{n(s.target.contentDocument.head)},{once:!0})}}function Ae(t,e,o){for(const n of t)if(!e.querySelector(`link[rel="stylesheet"][href*="${Ne}${n}"]`)){const i=document.createElement("link");i.rel="stylesheet",i.href=`${Ne}${n}`,i.onload=()=>{console.log(`Stylesheet ${n} loaded successfully.`)},i.onerror=()=>{console.error(`Error loading stylesheet ${n}.`)},o?e.insertBefore(i,o.nextSibling):e.appendChild(i)}}function gt(t){const e=document.body,o=e.querySelector('link[rel="stylesheet"][href*="sd-webui-ux"]');o?Ae(t,e,o):(Ae(t,e),console.warn("The sd-webui-ux/style.css is not found in the body."))}function ht(t,e,o){const s=Array.from(o.querySelectorAll(`link[rel="stylesheet"][href*="${t}"]`)).find(i=>i.href.includes("sd-webui-ux")&&i.href.includes(t));s?(Ae([e],o,s),s.parentNode.removeChild(s),console.log(`Removed existing stylesheet: ${t}`)):console.warn(`No existing stylesheet found: ${t}`)}const Z=window.basePath.includes("builtin"),ke="anapnoe/stable-diffusion-webui-ux",yt="AUTOMATIC1111/stable-diffusion-webui",_t="#anapnoe_app",bt="0.1.0",Be=window.basePath,fe=`${Be}assets/`,Ne=`${fe}css/`,Ge=`${fe}templates/`,vt=`${Ge}uiux-gradio-3/`,St=`${Ge}forge-gradio-4/`,We={"template-deforum-params.html":"deforum","template-deforum-results.html":"deforum","template-stylez.html":"enable_Stylez"},xt=["uiux-icons.css","uiux-theme-editor.css","uiux-deforum.css","uiux-iibrowser.css","uiux-physton.css"];let he=null;const G=()=>(he||(he=document.querySelector(_t)),he);let ye=null;const Ve=()=>(ye||(ye=document.getElementById("tab_anapnoe_sd_uiux_core")),ye);let _e=null;const j=()=>(_e||(_e=document.querySelector("gradio-app")),_e);let be=null;const Xe=()=>(be||(be=document.getElementById("loggerUiUx")),be),D={};let se=null;const wt=()=>{if(!se){const t=j().querySelector(".versions");if(!t){console.error("Versions element not found");return}se=t.innerHTML.replace(yt,ke).replace(/\n/g,"").split("• "),se.forEach(s=>{const[i,c]=s.split(":").map(a=>a.trim());i&&c&&(D[i]=c)});const o=D.version.split(".")[0].includes("f")?"forge":"AUTOMATIC1111",n=parseInt(D.gradio,10);D.variant=o,D.gradio_major=n}return se};let ie=null;const Je=()=>(ie||(ie=vt,D.gradio_major>3&&D.variant==="forge"&&(ie=St)),ie);let J;async function At(){(function(o){console.oldLog=console.log,console.oldWarn=console.warn,J=function(n,s){return function(...i){const a=i.slice(0,10);let r="",d,m;for(r+=`
- ${new Date().toLocaleString().replace(",","")}`,m=0;m
"),r+=`
-
`,typeof d=="object"&&typeof JSON=="object"&&typeof JSON.stringify=="function"?r+=JSON.stringify(d):r+=d,r+=" "}o.innerHTML+=r+"
",s.apply(void 0,a)}},console.log=J("log",console.oldLog),console.warn=J("warn",console.oldWarn)})(Xe()),console.log(`
+ `,n=document.createElement("div");n.innerHTML=o;const s=n.firstElementChild;e.append(s)}async function pt(){let t=["tab_txt2img","tab_img2img","tab_extras","tab_pnginfo","tab_train","tab_modelmerger","tab_settings","tab_extensions","tab_deforum_interface","tab_infinite-image-browsing","tab_anapnoe_dock","tab_anapnoe_sd_uiux_core","tab_space"];const e=document.querySelectorAll("#tabs > .tabitem");for(const o of e){const n=o.id,s=n.split("tab_")[1];!t.includes(n)&&!n.startsWith("tab_ui_theme")&&await Promise.all([dt(n,s,"#other_extensions"),mt(n)])}}function ft(t,e){const o=document.querySelector(t);if(o){const n=s=>{e.forEach(i=>{const a=document.querySelector(`link[rel="stylesheet"][href*="${i}"]`);if(a){const r=a.cloneNode();s.appendChild(r)}})};o.contentDocument.readyState==="complete"?n(o.contentDocument.head):o.addEventListener("load",s=>{n(s.target.contentDocument.head)},{once:!0})}}function Ae(t,e,o){for(const n of t)if(!e.querySelector(`link[rel="stylesheet"][href*="${Ne}${n}"]`)){const i=document.createElement("link");i.rel="stylesheet",i.href=`${Ne}${n}`,i.onload=()=>{console.log(`Stylesheet ${n} loaded successfully.`)},i.onerror=()=>{console.error(`Error loading stylesheet ${n}.`)},o?e.insertBefore(i,o.nextSibling):e.appendChild(i)}}function gt(t){const e=document.body,o=e.querySelector('link[rel="stylesheet"][href*="sd-webui-ux"]');o?Ae(t,e,o):(Ae(t,e),console.warn("The sd-webui-ux/style.css is not found in the body."))}function ht(t,e,o){const s=Array.from(o.querySelectorAll(`link[rel="stylesheet"][href*="${t}"]`)).find(i=>i.href.includes("sd-webui-ux")&&i.href.includes(t));s?(Ae([e],o,s),s.parentNode.removeChild(s),console.log(`Removed existing stylesheet: ${t}`)):console.warn(`No existing stylesheet found: ${t}`)}const Z=window.basePath.includes("builtin"),ke="anapnoe/stable-diffusion-webui-ux",yt="AUTOMATIC1111/stable-diffusion-webui",_t="#anapnoe_app",bt="0.1.0",Be=window.basePath,fe=`${Be}assets/`,Ne=`${fe}css/`,Ge=`${fe}templates/`,vt=`${Ge}uiux-gradio-3/`,St=`${Ge}forge-gradio-4/`,We={"template-deforum-params.html":"deforum","template-deforum-results.html":"deforum","template-stylez.html":"enable_Stylez"},xt=["uiux-icons.css","uiux-theme-editor.css","uiux-deforum.css","uiux-iibrowser.css","uiux-physton.css"];let he=null;const G=()=>(he||(he=document.querySelector(_t)),he);let ye=null;const Ve=()=>(ye||(ye=document.getElementById("tab_anapnoe_sd_uiux_core")),ye);let _e=null;const j=()=>(_e||(_e=document.querySelector("gradio-app")),_e);let be=null;const Xe=()=>(be||(be=document.getElementById("loggerUiUx")),be),D={};let se=null;const wt=()=>{if(!se){const t=j().querySelector(".versions");if(!t){console.error("Versions element not found");return}se=t.innerHTML.replace(yt,ke).replace(/\n/g,"").split("• "),se.forEach(s=>{const[i,a]=s.split(":").map(r=>r.trim());i&&a&&(D[i]=a)});const o=D.version.split(".")[0].includes("f")?"forge":"AUTOMATIC1111",n=parseInt(D.gradio,10);D.variant=o,D.gradio_major=n}return se};let ie=null;const Je=()=>(ie||(ie=vt,D.gradio_major>3&&D.variant==="forge"&&(ie=St)),ie);let J;async function At(){(function(o){console.oldLog=console.log,console.oldWarn=console.warn,J=function(n,s){return function(...i){const r=i.slice(0,10);let c="",d,p;for(c+=`
+ ${new Date().toLocaleString().replace(",","")}`,p=0;p"),c+=`
+ `,typeof d=="object"&&typeof JSON=="object"&&typeof JSON.stringify=="function"?c+=JSON.stringify(d):c+=d,c+=" "}o.innerHTML+=c+"
",s.apply(void 0,r)}},console.log=J("log",console.oldLog),console.warn=J("warn",console.oldWarn)})(Xe()),console.log(`
`,"╔═╗╔═╦╦═╗╔═╦═╦╦═╦═╗",`
`,"║╬╚╣║║║╬╚╣╬║║║║╬║╩╣",`
`,"╚══╩╩═╩══╣╔╩╩═╩═╩═╝",`
-`,"─────────╚╝"),console.log(`Initialize Anapnoe UI/UX runtime engine version ${bt}`),console.log("UI/UX Backend Optimizations:",Z),console.log(navigator.userAgent),console.log(wt()),console.log("Console log enabled: ",window.opts.uiux_enable_console_log),console.log("Dev Mode enabled: ",window.opts.uiux_enable_dev_mode),console.log("Theme editor enabled: ",window.opts.uiux_enable_theme_editor),console.log("Maximum resolution output: ",window.opts.uiux_max_resolution_output),console.log("Ignore overrides: ",window.opts.uiux_ignore_overrides),console.log("Show ticks for input range slider: ",window.opts.uiux_show_input_range_ticks),console.log("Default layout: ",window.opts.uiux_default_layout),console.log("Disable transitions: ",window.opts.uiux_disable_transitions),console.log("Aside labels: ",window.opts.uiux_show_labels_aside),console.log("Main labels: ",window.opts.uiux_show_labels_main),console.log("Tabs labels: ",window.opts.uiux_show_labels_tabs),console.log("Hide extra info for labels, checkboxes: ",window.opts.uiux_hide_extra_info),navigator.userAgent.toLowerCase().includes("firefox")&&console.log("Go to the Firefox about:config page, then search and toggle layout. css.has-selector. enabled"),window.opts.uiux_enable_console_log||(console.log=function(){});let e=document.querySelector("link[rel~='icon']");e||(e=document.createElement("link"),e.rel="icon",document.head.appendChild(e)),e.href=`${fe}favicon.svg/`}function Et(t){t?(console.log=J("log",console.oldLog),console.warn=J("warn",console.oldWarn)):console.log=function(){}}async function Lt(t){const e=[];return t.querySelectorAll(".template:not([status])").forEach(o=>{const n={},s=o.getAttribute("url");n.url=s||Je();const i=o.getAttribute("key");n.key=i||void 0;const c=o.getAttribute("template")||o.id;if(c)!Z&&c.includes("about")?n.template=`${c}-extension.html`:n.template=`${c}.html`;else{console.warn("Template not found on element:",o);return}n.id=o.id,n.extensionEnabled=kt(n.template),e.push(n)}),e}function kt(t){const e=We[t];return e?!!document.head.querySelector(`script[type="text/javascript"][src*="${e}"]`):!1}async function B(t,e){const o=t[e],n=e0&&(t=t.concat(m)),console.log("Template loaded",c),s.setAttribute("status","true"),s.append(d.firstElementChild),await B(t,e+1)}else a.status===404&&(console.error("404 template:",c),s.setAttribute("status","error"),await B(t,e+1))}catch(a){console.error("Error loading template:",a),s.setAttribute("status","error"),await B(t,e+1)}}}else console.log("Template files merged successfully")}async function qt(){console.log("Loading Templates",D.gradio);const t=[{url:Je(),template:"template-app-root.html",parent:Ve()}];await B(t,0)}function Ee(t){if(t){const e=new Event("input",{bubbles:!0});t.dispatchEvent(e)}}function $t(){const t=G();t.addEventListener("animationend",e=>{e.animationName==="fade-out"&&e.target.classList.add("hidden")}),t.addEventListener("animationstart",e=>{const o=t.classList.contains("notransition");e.animationName==="fade-out"?o&&e.target.classList.add("hidden"):e.animationName==="fade-in"&&e.target.classList.remove("hidden")})}function Tt(t){let e=0;const o=s=>{const i=Object.getOwnPropertyDescriptors(s);i&&i.onclick&&e++;for(const c of["onblur","onchange","onclick","oncontextmenu","ondblclick","onerror","onfocus","oninput","onkeydown","onkeypress","onkeyup","onload","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onresize","onscroll","onselect","onsubmit"])s[c]&&e++},n=s=>{o(s);for(let i=s.firstElementChild;i;i=i.nextElementSibling)n(i)};return n(t),e}const ue=new WeakMap;function Ke(t){if(!(t instanceof Element))return 0;let e=0;const o=ue.get(t);if(o)for(const n in o)e+=o[n].size;for(const n of t.children)e+=Ke(n);return e}(function(){const t=EventTarget.prototype.addEventListener,e=EventTarget.prototype.removeEventListener;EventTarget.prototype.addEventListener=function(o,n,s){typeof s>"u"&&(s=!1);const i=ue.get(this)||{};i[o]||(i[o]=new Set),i[o].add(n),ue.set(this,i),t.call(this,o,n,s)},EventTarget.prototype.removeEventListener=function(o,n,s){const i=ue.get(this);i&&i[o]&&(i[o].delete(n),i[o].size===0&&delete i[o]),e.call(this,o,n,s)},window.countEventListeners=Ke})();const O=typeof window<"u"?window:null,qe=O===null,Y=qe?void 0:O.document,I="addEventListener",M="removeEventListener",ve="getBoundingClientRect",V="_a",N="_b",R="_c",re="horizontal",U=()=>!1,zt=qe?"calc":`${["","-webkit-","-moz-","-o-"].filter(t=>{const e=Y.createElement("div");return e.style.cssText=`width:${t}calc(9px)`,!!e.style.length}).shift()}calc`,Ze=t=>typeof t=="string"||t instanceof String,Ue=t=>{if(Ze(t)){const e=Y.querySelector(t);if(!e)throw new Error(`Selector ${t} did not match a DOM element`);return e}return t},L=(t,e,o)=>{const n=t[e];return n!==void 0?n:o},ae=(t,e,o,n)=>{if(e){if(n==="end")return 0;if(n==="center")return t/2}else if(o){if(n==="start")return 0;if(n==="center")return t/2}return t},Ct=(t,e)=>{const o=Y.createElement("div");return o.className=`gutter gutter-${e}`,o},Ot=(t,e,o)=>{const n={};return Ze(e)?n[t]=e:n[t]=`${zt}(${e}% - ${o}px)`,n},It=(t,e)=>({[t]:`${e}px`}),Mt=(t,e={})=>{if(qe)return{};let o=t,n,s,i,c,a,r;Array.from&&(o=Array.from(o));const m=Ue(o[0]).parentNode,y=getComputedStyle?getComputedStyle(m):null,g=y?y.flexDirection:null;let v=L(e,"sizes")||o.map(()=>100/o.length);const E=L(e,"minSize",100),$=Array.isArray(E)?E:o.map(()=>E),b=L(e,"maxSize",1/0),A=Array.isArray(b)?b:o.map(()=>b),f=L(e,"expandToMin",!1),_=L(e,"gutterSize",10),x=L(e,"gutterAlign","center"),w=L(e,"snapOffset",30),k=Array.isArray(w)?w:o.map(()=>w),C=L(e,"dragInterval",1),P=L(e,"direction",re),ge=L(e,"cursor",P===re?"col-resize":"row-resize"),nt=L(e,"gutter",Ct),Te=L(e,"elementStyle",Ot),ot=L(e,"gutterStyle",It);P===re?(n="width",s="clientX",i="left",c="right",a="clientWidth"):P==="vertical"&&(n="height",s="clientY",i="top",c="bottom",a="clientHeight");function W(p,l,u,h){const S=Te(n,l,u,h);Object.keys(S).forEach(q=>{p.style[q]=S[q]})}function st(p,l,u){const h=ot(n,l,u);Object.keys(h).forEach(S=>{p.style[S]=h[S]})}function te(){return r.map(p=>p.size)}function ze(p){return"touches"in p?p.touches[0][s]:p[s]}function Ce(p){const l=r[this.a],u=r[this.b],h=l.size+u.size;l.size=p/this.size*h,u.size=h-p/this.size*h,W(l.element,l.size,this[N],l.i),W(u.element,u.size,this[R],u.i)}function it(p){let l;const u=r[this.a],h=r[this.b];this.dragging&&(l=ze(p)-this.start+(this[N]-this.dragOffset),C>1&&(l=Math.round(l/C)*C),l<=u.minSize+u.snapOffset+this[N]?l=u.minSize+this[N]:l>=this.size-(h.minSize+h.snapOffset+this[R])&&(l=this.size-(h.minSize+this[R])),l>=u.maxSize-u.snapOffset+this[N]?l=u.maxSize+this[N]:l<=this.size-(h.maxSize-h.snapOffset+this[R])&&(l=this.size-(h.maxSize+this[R])),Ce.call(this,l),L(e,"onDrag",U)(te()))}function Oe(){const p=r[this.a].element,l=r[this.b].element,u=p[ve](),h=l[ve]();this.size=u[n]+h[n]+this[N]+this[R],this.start=u[i],this.end=u[c]}function rt(p){if(!getComputedStyle)return null;const l=getComputedStyle(p);if(!l)return null;let u=p[a];return u===0?null:(P===re?u-=parseFloat(l.paddingLeft)+parseFloat(l.paddingRight):u-=parseFloat(l.paddingTop)+parseFloat(l.paddingBottom),u)}function Ie(p){const l=rt(m);if(l===null||$.reduce((q,T)=>q+T,0)>l)return p;let u=0;const h=[],S=p.map((q,T)=>{const F=l*q/100,ne=ae(_,T===0,T===p.length-1,x),oe=$[T]+ne;return F{let F=q;if(u>0&&h[T]-u>0){const ne=Math.min(u,h[T]-u);u-=ne,F=q-ne}return F/l*100})}function at(){const p=this,l=r[p.a].element,u=r[p.b].element;p.dragging&&L(e,"onDragEnd",U)(te()),p.dragging=!1,O[M]("mouseup",p.stop),O[M]("touchend",p.stop),O[M]("touchcancel",p.stop),O[M]("mousemove",p.move),O[M]("touchmove",p.move),p.stop=null,p.move=null,l[M]("selectstart",U),l[M]("dragstart",U),u[M]("selectstart",U),u[M]("dragstart",U),l.style.userSelect="",l.style.webkitUserSelect="",l.style.MozUserSelect="",l.style.pointerEvents="",u.style.userSelect="",u.style.webkitUserSelect="",u.style.MozUserSelect="",u.style.pointerEvents="",p.gutter.style.cursor="",p.parent.style.cursor="",Y.body.style.cursor=""}function ct(p){if("button"in p&&p.button!==0)return;const l=this,u=r[l.a].element,h=r[l.b].element;l.dragging||L(e,"onDragStart",U)(te()),p.preventDefault(),l.dragging=!0,l.move=it.bind(l),l.stop=at.bind(l),O[I]("mouseup",l.stop),O[I]("touchend",l.stop),O[I]("touchcancel",l.stop),O[I]("mousemove",l.move),O[I]("touchmove",l.move),u[I]("selectstart",U),u[I]("dragstart",U),h[I]("selectstart",U),h[I]("dragstart",U),u.style.userSelect="none",u.style.webkitUserSelect="none",u.style.MozUserSelect="none",u.style.pointerEvents="none",h.style.userSelect="none",h.style.webkitUserSelect="none",h.style.MozUserSelect="none",h.style.pointerEvents="none",l.gutter.style.cursor=ge,l.parent.style.cursor=ge,Y.body.style.cursor=ge,Oe.call(l),l.dragOffset=ze(p)-l.end}v=Ie(v);const H=[];r=o.map((p,l)=>{const u={element:Ue(p),size:v[l],minSize:$[l],maxSize:A[l],snapOffset:k[l],i:l};let h;if(l>0&&(h={a:l-1,b:l,dragging:!1,direction:P,parent:m},h[N]=ae(_,l-1===0,!1,x),h[R]=ae(_,!1,l===o.length-1,x),g==="row-reverse"||g==="column-reverse")){const S=h.a;h.a=h.b,h.b=S}if(l>0){const S=nt(l,P,u.element);st(S,_,l),h[V]=ct.bind(h),S[I]("mousedown",h[V]),S[I]("touchstart",h[V]),m.insertBefore(S,u.element),h.gutter=S}return W(u.element,u.size,ae(_,l===0,l===o.length-1,x),l),l>0&&H.push(h),u});function Me(p){const l=p.i===H.length,u=l?H[p.i-1]:H[p.i];Oe.call(u);const h=l?u.size-p.minSize-u[R]:p.minSize+u[N];Ce.call(u,h)}r.forEach(p=>{const l=p.element[ve]()[n];l{if(h>0){const S=H[h-1],q=r[S.a],T=r[S.b];q.size=l[h-1],T.size=u,W(q.element,q.size,S[N],q.i),W(T.element,T.size,S[R],T.i)}})}function ut(p,l){H.forEach(u=>{if(l!==!0?u.parent.removeChild(u.gutter):(u.gutter[M]("mousedown",u[V]),u.gutter[M]("touchstart",u[V])),p!==!0){const h=Te(n,u.a.size,u[N]);Object.keys(h).forEach(S=>{r[u.a].element.style[S]="",r[u.b].element.style[S]=""})}})}return{setSizes:lt,getSizes:te,collapse(p){Me(r[p])},destroy:ut,parent:m,pairs:H}};class K{constructor(){return K.instance||(this.splitInstances={},K.instance=this),K.instance}set(e){Object.assign(this.splitInstances,e)}get(){return this.splitInstances}}const $e=new K;Object.freeze($e);function Nt(t){$e.set(t)}function Ut(){return $e.get()}async function Pt(t){const e=[];await Promise.all(Array.from(t.querySelectorAll("div.split")).map(async o=>{const n=o.id,s=t.querySelector(`#${n}`),i=(s==null?void 0:s.getAttribute("direction"))==="vertical"?"vertical":"horizontal",c=(s==null?void 0:s.getAttribute("gutterSize"))||"8",a=t.querySelectorAll(`#${n} > div.split-container`),r=Array.from(a).map(g=>{const v=g.getAttribute("data-initSize")?parseInt(g.getAttribute("data-initSize")):100/a.length,E=g.getAttribute("data-minSize")?parseInt(g.getAttribute("data-minSize")):1/0;return{id:`#${g.id}`,initSize:v,minSize:E}}),d=r.map(g=>g.id),m=r.map(g=>g.initSize),y=r.map(g=>g.minSize);console.log("Split component",d,m,y,i,c),e[n]=Mt(d,{sizes:m,minSize:y,direction:i,gutterSize:parseInt(c),snapOffset:0,dragInterval:1,elementStyle:(g,v,E)=>({"flex-basis":`calc(${v}% - ${E}px)`}),gutterStyle:(g,v)=>({"flex-basis":`${v}px`,"min-width":`${v}px`,"min-height":`${v}px`})})})),Nt(e)}const me={setItem:function(t,e){localStorage.setItem(t,e),this.notifyChange(t,e)},getItem:function(t){return localStorage.getItem(t)},removeItem:function(t){localStorage.removeItem(t),this.notifyChange(t,null)},notifyChange:function(t,e){const o=new CustomEvent("localStorageChange",{detail:{key:t,value:e}});window.dispatchEvent(o)}};function Rt(t,e){const o=me.getItem(e);t(e,o);const n=s=>{t(s.detail.key,s.detail.value)};return window.addEventListener("localStorageChange",n),()=>{window.removeEventListener("localStorageChange",n)}}let Se=0;function Dt(t,e){const o=t.querySelectorAll("td:last-child"),n=document.createElement("style");let s=1,i="";o.forEach((c,a)=>{const r=parseFloat(c.textContent.trim());if(c.id=`td_${a}`,!isNaN(r)){let d;a===0?(s=r,d=100):d=r/s*100,i+=`#td_${a}::before { min-width: ${d}%; }`}}),n.textContent=i,e.appendChild(n)}function jt(){const t=document.querySelector("#popup_tabitem");t.querySelectorAll(".portal").forEach((e,o,n)=>{ee(e,t,0,o,n.length)})}function Ht(t,e){t.querySelectorAll(`${e}, style`).forEach(n=>{t.removeChild(n)})}function Ft(t,e){const o=t.getAttribute("append-index");Array.from(t.children).forEach(s=>{if(s!==e)if(e.className.includes("gradio-accordion"))if(o){const i=parseInt(o,10);let c=e.children[2].children[i];e.children[2].insertBefore(s,c)}else e.children[2].append(s);else e.append(s)})}async function ee(t,e,o=0,n,s,i=!1){var m;const c=t.getAttribute("data-selector"),a=t.getAttribute("data-parent-selector");let r;if(o%2===0?r=document.querySelector(`${a} ${c}`):r=e.querySelector(`${c}`),r&&t){t.classList.contains("dynamic")&&(Ht(t,c),c.includes("popup-table")&&Dt(r,t)),t.append(r),i&&Se++,console.log("register | Ref",n,a,c),t.getAttribute("droppable")&&Ft(t,r);const g=t.getAttribute("show-button");g&&((m=document.querySelector(g))==null||m.classList.remove("hidden"))}else if(o<2){const y=t.getAttribute("data-timeout"),g=y?parseInt(y):500;await new Promise(v=>setTimeout(v,g)),console.log(o+1,"retry | ",g," | Ref",n,a,c),await ee(t,e,o+1,n,s,i)}else t.classList.contains("dynamic")?console.error("error | Ref",n,a,c):console.warn("dynamic | Ref",n,a,c),i&&Se++;Se===s&&i&&me.getItem("UiUxReady")==="false"&&(console.log("Runtime components initialized"),me.setItem("UiUxReady","true"))}async function Bt(t){await Promise.all(Array.from(t.querySelectorAll(".portal:not(.dynamic)")).map(async(e,o,n)=>{ee(e,t,0,o,n.length,!0)}))}async function Gt(t){const e=G();await Promise.all(Array.from(t.querySelectorAll(".xtabs-tab")).map(async n=>{if(n.addEventListener("click",()=>{const i=n.parentElement,c=n.getAttribute("tabGroup");n.getAttribute("data-click");const a=n.getAttribute("toggle"),r=n.classList.contains("active");function d(m){m.classList.remove("active");const y=m.getAttribute("tabItemId");e.querySelectorAll(y).forEach(g=>{g.classList.remove("fade-in"),g.classList.add("fade-out")})}if((!a||a&&r)&&(c?e.querySelectorAll(`[tabGroup="${c}"]`).forEach(m=>{m.classList.contains("active")&&d(m)}):i&&[].slice.call(i.children).forEach(y=>{y.classList.contains("active")&&d(y)})),!a||a&&!r){const m=n.getAttribute("tabItemId");e.querySelectorAll(m).forEach(y=>{y.classList.remove("fade-out"),y.classList.add("fade-in"),y.querySelectorAll(".portal.dynamic").forEach((g,v,E)=>{ee(g,document,0,v,E.length)})}),n.classList.add("active"),o(n)}}),!n.getAttribute("active")){const i=n.getAttribute("tabItemId");e.querySelectorAll(i).forEach(c=>{c.classList.remove("fade-in"),c.classList.add("fade-out")})}})),await Promise.all(Array.from(t.querySelectorAll(".xtabs-tab[active]")).map(async n=>{n.classList.add("active");const s=n.getAttribute("tabItemId");n.getAttribute("data-click"),e.querySelectorAll(s).forEach(i=>{i.classList.remove("fade-out"),i.classList.add("fade-in")}),o(n)}));function o(n,s,i){const c=n.closest(".accordion-bar");if(c){const a=c.parentElement;if(a.className.indexOf("expand")===-1){let r=c;const d=a.getAttribute("iconTrigger");if(d){const m=t.querySelector(d);m&&(r=m)}r.click()}}}}const Pe={DEFAULT_PATH:Be,FOCUS_PROMPT:"txt2img",loadCurrentTemplate:B,initUiUxComponents:et};async function Wt(){document.head.querySelectorAll(`
+`,"─────────╚╝"),console.log(`Initialize Anapnoe UI/UX runtime engine version ${bt}`),console.log("UI/UX Backend Optimizations:",Z),console.log(navigator.userAgent),console.log(wt()),console.log("Console log enabled: ",window.opts.uiux_enable_console_log),console.log("Dev Mode enabled: ",window.opts.uiux_enable_dev_mode),console.log("Theme editor enabled: ",window.opts.uiux_enable_theme_editor),console.log("Maximum resolution output: ",window.opts.uiux_max_resolution_output),console.log("Ignore overrides: ",window.opts.uiux_ignore_overrides),console.log("Show ticks for input range slider: ",window.opts.uiux_show_input_range_ticks),console.log("Default layout: ",window.opts.uiux_default_layout),console.log("Disable transitions: ",window.opts.uiux_disable_transitions),console.log("Aside labels: ",window.opts.uiux_show_labels_aside),console.log("Main labels: ",window.opts.uiux_show_labels_main),console.log("Tabs labels: ",window.opts.uiux_show_labels_tabs),console.log("Hide extra info for labels, checkboxes: ",window.opts.uiux_hide_extra_info),navigator.userAgent.toLowerCase().includes("firefox")&&console.log("Go to the Firefox about:config page, then search and toggle layout. css.has-selector. enabled"),window.opts.uiux_enable_console_log||(console.log=function(){});let e=document.querySelector("link[rel~='icon']");e||(e=document.createElement("link"),e.rel="icon",document.head.appendChild(e)),e.href=`${fe}favicon.svg/`}function Et(t){t?(console.log=J("log",console.oldLog),console.warn=J("warn",console.oldWarn)):console.log=function(){}}async function Lt(t){const e=[];return t.querySelectorAll(".template:not([status])").forEach(o=>{const n={},s=o.getAttribute("url");n.url=s||Je();const i=o.getAttribute("key");n.key=i||void 0;const a=o.getAttribute("template")||o.id;if(a)!Z&&a.includes("about")?n.template=`${a}-extension.html`:n.template=`${a}.html`;else{console.warn("Template not found on element:",o);return}n.id=o.id,n.extensionEnabled=kt(n.template),e.push(n)}),e}function kt(t){const e=We[t];return e?!!document.head.querySelector(`script[type="text/javascript"][src*="${e}"]`):!1}async function B(t,e){const o=t[e],n=e0&&(t=t.concat(p)),console.log("Template loaded",a),s.setAttribute("status","true"),s.append(d.firstElementChild),await B(t,e+1)}else r.status===404&&(console.error("404 template:",a),s.setAttribute("status","error"),await B(t,e+1))}catch(r){console.error("Error loading template:",r),s.setAttribute("status","error"),await B(t,e+1)}}}else console.log("Template files merged successfully")}async function qt(){console.log("Loading Templates",D.gradio);const t=[{url:Je(),template:"template-app-root.html",parent:Ve()}];await B(t,0)}function Ee(t){if(t){const e=new Event("input",{bubbles:!0});t.dispatchEvent(e)}}function Tt(){const t=G();t.addEventListener("animationend",e=>{e.animationName==="fade-out"&&e.target.classList.add("hidden")}),t.addEventListener("animationstart",e=>{const o=t.classList.contains("notransition");e.animationName==="fade-out"?o&&e.target.classList.add("hidden"):e.animationName==="fade-in"&&e.target.classList.remove("hidden")})}function $t(t){let e=0;const o=s=>{const i=Object.getOwnPropertyDescriptors(s);i&&i.onclick&&e++;for(const a of["onblur","onchange","onclick","oncontextmenu","ondblclick","onerror","onfocus","oninput","onkeydown","onkeypress","onkeyup","onload","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onresize","onscroll","onselect","onsubmit"])s[a]&&e++},n=s=>{o(s);for(let i=s.firstElementChild;i;i=i.nextElementSibling)n(i)};return n(t),e}const ue=new WeakMap;function Ke(t){if(!(t instanceof Element))return 0;let e=0;const o=ue.get(t);if(o)for(const n in o)e+=o[n].size;for(const n of t.children)e+=Ke(n);return e}(function(){const t=EventTarget.prototype.addEventListener,e=EventTarget.prototype.removeEventListener;EventTarget.prototype.addEventListener=function(o,n,s){typeof s>"u"&&(s=!1);const i=ue.get(this)||{};i[o]||(i[o]=new Set),i[o].add(n),ue.set(this,i),t.call(this,o,n,s)},EventTarget.prototype.removeEventListener=function(o,n,s){const i=ue.get(this);i&&i[o]&&(i[o].delete(n),i[o].size===0&&delete i[o]),e.call(this,o,n,s)},window.countEventListeners=Ke})();const C=typeof window<"u"?window:null,qe=C===null,Y=qe?void 0:C.document,I="addEventListener",M="removeEventListener",ve="getBoundingClientRect",V="_a",N="_b",R="_c",re="horizontal",U=()=>!1,zt=qe?"calc":`${["","-webkit-","-moz-","-o-"].filter(t=>{const e=Y.createElement("div");return e.style.cssText=`width:${t}calc(9px)`,!!e.style.length}).shift()}calc`,Ze=t=>typeof t=="string"||t instanceof String,Ue=t=>{if(Ze(t)){const e=Y.querySelector(t);if(!e)throw new Error(`Selector ${t} did not match a DOM element`);return e}return t},L=(t,e,o)=>{const n=t[e];return n!==void 0?n:o},ce=(t,e,o,n)=>{if(e){if(n==="end")return 0;if(n==="center")return t/2}else if(o){if(n==="start")return 0;if(n==="center")return t/2}return t},Ot=(t,e)=>{const o=Y.createElement("div");return o.className=`gutter gutter-${e}`,o},Ct=(t,e,o)=>{const n={};return Ze(e)?n[t]=e:n[t]=`${zt}(${e}% - ${o}px)`,n},It=(t,e)=>({[t]:`${e}px`}),Mt=(t,e={})=>{if(qe)return{};let o=t,n,s,i,a,r,c;Array.from&&(o=Array.from(o));const p=Ue(o[0]).parentNode,y=getComputedStyle?getComputedStyle(p):null,h=y?y.flexDirection:null;let v=L(e,"sizes")||o.map(()=>100/o.length);const E=L(e,"minSize",100),T=Array.isArray(E)?E:o.map(()=>E),b=L(e,"maxSize",1/0),A=Array.isArray(b)?b:o.map(()=>b),f=L(e,"expandToMin",!1),_=L(e,"gutterSize",10),x=L(e,"gutterAlign","center"),w=L(e,"snapOffset",30),k=Array.isArray(w)?w:o.map(()=>w),O=L(e,"dragInterval",1),P=L(e,"direction",re),ge=L(e,"cursor",P===re?"col-resize":"row-resize"),nt=L(e,"gutter",Ot),$e=L(e,"elementStyle",Ct),ot=L(e,"gutterStyle",It);P===re?(n="width",s="clientX",i="left",a="right",r="clientWidth"):P==="vertical"&&(n="height",s="clientY",i="top",a="bottom",r="clientHeight");function W(m,l,u,g){const S=$e(n,l,u,g);Object.keys(S).forEach(q=>{m.style[q]=S[q]})}function st(m,l,u){const g=ot(n,l,u);Object.keys(g).forEach(S=>{m.style[S]=g[S]})}function te(){return c.map(m=>m.size)}function ze(m){return"touches"in m?m.touches[0][s]:m[s]}function Oe(m){const l=c[this.a],u=c[this.b],g=l.size+u.size;l.size=m/this.size*g,u.size=g-m/this.size*g,W(l.element,l.size,this[N],l.i),W(u.element,u.size,this[R],u.i)}function it(m){let l;const u=c[this.a],g=c[this.b];this.dragging&&(l=ze(m)-this.start+(this[N]-this.dragOffset),O>1&&(l=Math.round(l/O)*O),l<=u.minSize+u.snapOffset+this[N]?l=u.minSize+this[N]:l>=this.size-(g.minSize+g.snapOffset+this[R])&&(l=this.size-(g.minSize+this[R])),l>=u.maxSize-u.snapOffset+this[N]?l=u.maxSize+this[N]:l<=this.size-(g.maxSize-g.snapOffset+this[R])&&(l=this.size-(g.maxSize+this[R])),Oe.call(this,l),L(e,"onDrag",U)(te()))}function Ce(){const m=c[this.a].element,l=c[this.b].element,u=m[ve](),g=l[ve]();this.size=u[n]+g[n]+this[N]+this[R],this.start=u[i],this.end=u[a]}function rt(m){if(!getComputedStyle)return null;const l=getComputedStyle(m);if(!l)return null;let u=m[r];return u===0?null:(P===re?u-=parseFloat(l.paddingLeft)+parseFloat(l.paddingRight):u-=parseFloat(l.paddingTop)+parseFloat(l.paddingBottom),u)}function Ie(m){const l=rt(p);if(l===null||T.reduce((q,$)=>q+$,0)>l)return m;let u=0;const g=[],S=m.map((q,$)=>{const F=l*q/100,ne=ce(_,$===0,$===m.length-1,x),oe=T[$]+ne;return F{let F=q;if(u>0&&g[$]-u>0){const ne=Math.min(u,g[$]-u);u-=ne,F=q-ne}return F/l*100})}function ct(){const m=this,l=c[m.a].element,u=c[m.b].element;m.dragging&&L(e,"onDragEnd",U)(te()),m.dragging=!1,C[M]("mouseup",m.stop),C[M]("touchend",m.stop),C[M]("touchcancel",m.stop),C[M]("mousemove",m.move),C[M]("touchmove",m.move),m.stop=null,m.move=null,l[M]("selectstart",U),l[M]("dragstart",U),u[M]("selectstart",U),u[M]("dragstart",U),l.style.userSelect="",l.style.webkitUserSelect="",l.style.MozUserSelect="",l.style.pointerEvents="",u.style.userSelect="",u.style.webkitUserSelect="",u.style.MozUserSelect="",u.style.pointerEvents="",m.gutter.style.cursor="",m.parent.style.cursor="",Y.body.style.cursor=""}function at(m){if("button"in m&&m.button!==0)return;const l=this,u=c[l.a].element,g=c[l.b].element;l.dragging||L(e,"onDragStart",U)(te()),m.preventDefault(),l.dragging=!0,l.move=it.bind(l),l.stop=ct.bind(l),C[I]("mouseup",l.stop),C[I]("touchend",l.stop),C[I]("touchcancel",l.stop),C[I]("mousemove",l.move),C[I]("touchmove",l.move),u[I]("selectstart",U),u[I]("dragstart",U),g[I]("selectstart",U),g[I]("dragstart",U),u.style.userSelect="none",u.style.webkitUserSelect="none",u.style.MozUserSelect="none",u.style.pointerEvents="none",g.style.userSelect="none",g.style.webkitUserSelect="none",g.style.MozUserSelect="none",g.style.pointerEvents="none",l.gutter.style.cursor=ge,l.parent.style.cursor=ge,Y.body.style.cursor=ge,Ce.call(l),l.dragOffset=ze(m)-l.end}v=Ie(v);const H=[];c=o.map((m,l)=>{const u={element:Ue(m),size:v[l],minSize:T[l],maxSize:A[l],snapOffset:k[l],i:l};let g;if(l>0&&(g={a:l-1,b:l,dragging:!1,direction:P,parent:p},g[N]=ce(_,l-1===0,!1,x),g[R]=ce(_,!1,l===o.length-1,x),h==="row-reverse"||h==="column-reverse")){const S=g.a;g.a=g.b,g.b=S}if(l>0){const S=nt(l,P,u.element);st(S,_,l),g[V]=at.bind(g),S[I]("mousedown",g[V]),S[I]("touchstart",g[V]),p.insertBefore(S,u.element),g.gutter=S}return W(u.element,u.size,ce(_,l===0,l===o.length-1,x),l),l>0&&H.push(g),u});function Me(m){const l=m.i===H.length,u=l?H[m.i-1]:H[m.i];Ce.call(u);const g=l?u.size-m.minSize-u[R]:m.minSize+u[N];Oe.call(u,g)}c.forEach(m=>{const l=m.element[ve]()[n];l{if(g>0){const S=H[g-1],q=c[S.a],$=c[S.b];q.size=l[g-1],$.size=u,W(q.element,q.size,S[N],q.i),W($.element,$.size,S[R],$.i)}})}function ut(m,l){H.forEach(u=>{if(l!==!0?u.parent.removeChild(u.gutter):(u.gutter[M]("mousedown",u[V]),u.gutter[M]("touchstart",u[V])),m!==!0){const g=$e(n,u.a.size,u[N]);Object.keys(g).forEach(S=>{c[u.a].element.style[S]="",c[u.b].element.style[S]=""})}})}return{setSizes:lt,getSizes:te,collapse(m){Me(c[m])},destroy:ut,parent:p,pairs:H}};class K{constructor(){return K.instance||(this.splitInstances={},K.instance=this),K.instance}set(e){Object.assign(this.splitInstances,e)}get(){return this.splitInstances}}const Te=new K;Object.freeze(Te);function Nt(t){Te.set(t)}function Ut(){return Te.get()}async function Pt(t){const e=[];await Promise.all(Array.from(t.querySelectorAll("div.split")).map(async o=>{const n=o.id,s=t.querySelector(`#${n}`),i=(s==null?void 0:s.getAttribute("direction"))==="vertical"?"vertical":"horizontal",a=(s==null?void 0:s.getAttribute("gutterSize"))||"8",r=t.querySelectorAll(`#${n} > div.split-container`),c=Array.from(r).map(h=>{const v=h.getAttribute("data-initSize")?parseInt(h.getAttribute("data-initSize")):100/r.length,E=h.getAttribute("data-minSize")?parseInt(h.getAttribute("data-minSize")):1/0;return{id:`#${h.id}`,initSize:v,minSize:E}}),d=c.map(h=>h.id),p=c.map(h=>h.initSize),y=c.map(h=>h.minSize);console.log("Split component",d,p,y,i,a),e[n]=Mt(d,{sizes:p,minSize:y,direction:i,gutterSize:parseInt(a),snapOffset:0,dragInterval:1,elementStyle:(h,v,E)=>({"flex-basis":`calc(${v}% - ${E}px)`}),gutterStyle:(h,v)=>({"flex-basis":`${v}px`,"min-width":`${v}px`,"min-height":`${v}px`})})})),Nt(e)}const me={setItem:function(t,e){localStorage.setItem(t,e),this.notifyChange(t,e)},getItem:function(t){return localStorage.getItem(t)},removeItem:function(t){localStorage.removeItem(t),this.notifyChange(t,null)},notifyChange:function(t,e){const o=new CustomEvent("localStorageChange",{detail:{key:t,value:e}});window.dispatchEvent(o)}};function Rt(t,e){const o=me.getItem(e);t(e,o);const n=s=>{t(s.detail.key,s.detail.value)};return window.addEventListener("localStorageChange",n),()=>{window.removeEventListener("localStorageChange",n)}}let Se=0;function Dt(t,e){const o=t.querySelectorAll("td:last-child"),n=document.createElement("style");let s=1,i="";o.forEach((a,r)=>{const c=parseFloat(a.textContent.trim());if(a.id=`td_${r}`,!isNaN(c)){let d;r===0?(s=c,d=100):d=c/s*100,i+=`#td_${r}::before { min-width: ${d}%; }`}}),n.textContent=i,e.appendChild(n)}function jt(){const t=document.querySelector("#popup_tabitem");t.querySelectorAll(".portal").forEach((e,o,n)=>{ee(e,t,0,o,n.length)})}function Ht(t,e){t.querySelectorAll(`${e}, style`).forEach(n=>{t.removeChild(n)})}function Ft(t,e){const o=t.getAttribute("append-index");Array.from(t.children).forEach(s=>{if(s!==e)if(e.className.includes("gradio-accordion"))if(o){const i=parseInt(o,10);let a=e.children[2].children[i];e.children[2].insertBefore(s,a)}else e.children[2].append(s);else e.append(s)})}async function ee(t,e,o=0,n,s,i=!1){var p;const a=t.getAttribute("data-selector"),r=t.getAttribute("data-parent-selector");let c;if(o%2===0?c=document.querySelector(`${r} ${a}`):c=e.querySelector(`${a}`),c&&t){t.classList.contains("dynamic")&&(Ht(t,a),a.includes("popup-table")&&Dt(c,t)),t.append(c),i&&Se++,console.log("register | Ref",n,r,a),t.getAttribute("droppable")&&Ft(t,c);const h=t.getAttribute("show-button");h&&((p=document.querySelector(h))==null||p.classList.remove("hidden"))}else if(o<2){const y=t.getAttribute("data-timeout"),h=y?parseInt(y):500;await new Promise(v=>setTimeout(v,h)),console.log(o+1,"retry | ",h," | Ref",n,r,a),await ee(t,e,o+1,n,s,i)}else t.classList.contains("dynamic")?console.error("error | Ref",n,r,a):console.warn("dynamic | Ref",n,r,a),i&&Se++;Se===s&&i&&me.getItem("UiUxReady")==="false"&&(console.log("Runtime components initialized"),me.setItem("UiUxReady","true"))}async function Bt(t){await Promise.all(Array.from(t.querySelectorAll(".portal:not(.dynamic)")).map(async(e,o,n)=>{ee(e,t,0,o,n.length,!0)}))}async function Gt(t){const e=G();await Promise.all(Array.from(t.querySelectorAll(".xtabs-tab")).map(async n=>{if(n.addEventListener("click",()=>{const i=n.parentElement,a=n.getAttribute("tabGroup");n.getAttribute("data-click");const r=n.getAttribute("toggle"),c=n.classList.contains("active");function d(p){p.classList.remove("active");const y=p.getAttribute("tabItemId");e.querySelectorAll(y).forEach(h=>{h.classList.remove("fade-in"),h.classList.add("fade-out")})}if((!r||r&&c)&&(a?e.querySelectorAll(`[tabGroup="${a}"]`).forEach(p=>{p.classList.contains("active")&&d(p)}):i&&[].slice.call(i.children).forEach(y=>{y.classList.contains("active")&&d(y)})),!r||r&&!c){const p=n.getAttribute("tabItemId");e.querySelectorAll(p).forEach(y=>{y.classList.remove("fade-out"),y.classList.add("fade-in"),y.querySelectorAll(".portal.dynamic").forEach((h,v,E)=>{ee(h,document,0,v,E.length)})}),n.classList.add("active"),o(n)}}),!n.getAttribute("active")){const i=n.getAttribute("tabItemId");e.querySelectorAll(i).forEach(a=>{a.classList.remove("fade-in"),a.classList.add("fade-out")})}})),await Promise.all(Array.from(t.querySelectorAll(".xtabs-tab[active]")).map(async n=>{n.classList.add("active");const s=n.getAttribute("tabItemId");n.getAttribute("data-click"),e.querySelectorAll(s).forEach(i=>{i.classList.remove("fade-out"),i.classList.add("fade-in")}),o(n)}));function o(n,s,i){const a=n.closest(".accordion-bar");if(a){const r=a.parentElement;if(r.className.indexOf("expand")===-1){let c=a;const d=r.getAttribute("iconTrigger");if(d){const p=t.querySelector(d);p&&(c=p)}c.click()}}}}const Pe={DEFAULT_PATH:Be,FOCUS_PROMPT:"txt2img",loadCurrentTemplate:B,initUiUxComponents:et};async function Wt(){document.head.querySelectorAll(`
[rel="stylesheet"][href*="/assets/"],
[rel="stylesheet"][href*="theme.css"],
[rel="stylesheet"][href*="index"]`).forEach(n=>{n.remove(),console.log("Remove stylesheet",n.getAttribute("href"))}),document.body.querySelectorAll(`
- [rel="stylesheet"][href*="file=style.css"]`).forEach(n=>{n.remove(),console.log("Remove stylesheet",n.getAttribute("href"))});const t=document.querySelectorAll('.styler, [class*="svelte"]:not(input)'),e=t.length;let o=0;t.forEach(n=>{n.style.display!=="none"&&n.style.display!=="block"&&(n.removeAttribute("style"),o++),[...n.classList].filter(s=>s.match(/^svelte.*/)).forEach(s=>n.classList.remove(s))}),console.log("Remove inline styles from DOM","Total Selectors:",e,"Removed Selectors:",o)}function Ye(t){var n;const e=t.getAttribute("data-apply"),o=e?e.match(/^(\w+)\s*\(.*\)$/):null;if(o&&typeof window[o[1]]=="function"){t.removeEventListener("click",window[o[1]]);const s=t.getAttribute("data-name")||t.getAttribute("data-path")||((n=t.closest(".card"))==null?void 0:n.getAttribute("data-name"));s&&console.log("Remove EventListener",`${s} - ${o[1]} - ${t.getAttribute("title")||""}`)}}function Re(t){var n;const{target:e,currentTarget:o}=t;if(e.classList.contains("card")||e.classList.contains("card-button")||e.classList.contains("tree-list-content")){let s=e.getAttribute("data-apply")||e.getAttribute("onClick");if(s&&(e.setAttribute("data-apply",s),e.removeAttribute("onClick")),e.setAttribute("onClick",s),e.click(),Ye(e),e.removeAttribute("onClick"),e.classList.contains("card-button")&&jt(),e.classList.contains("tree-list-content-dir")){const i=(n=o.closest(".layout-extra-networks"))==null?void 0:n.querySelector(".search_extra_networks");i&&e.getAttribute("data-path")&&(i.value=e.getAttribute("data-path"),Ee(i))}t.stopImmediatePropagation()}}async function Qe(t){if(window.opts.uiux_enable_event_delegation||Z){const e=Tt(t);console.log("Starting Optimizations for",t.id),Z||t.querySelectorAll(".card, .card-button, .tree-list-content").forEach(o=>{const n=o.getAttribute("onClick")||o.getAttribute("data-apply");n&&(o.setAttribute("data-apply",n),o.removeAttribute("onClick"),Ye(o))}),console.log("Total Inline Event Listeners Before:",e,"After:",0),console.log("Attaching Event Listener using Event Delegation",t.id),t.removeEventListener("click",Re),t.addEventListener("click",Re)}}async function Vt(){const t=j(),e=function(n){const s=n.target.value.toLowerCase(),i=n.target.getAttribute("data-target");t.querySelectorAll(i).forEach(c=>{let r=c.getAttribute("data-sort-path").toLowerCase().indexOf(s)!==-1;s.length<2&&(r=!0),c.style.display=r?"":"none"})};document.querySelectorAll(".search_extra_networks").forEach(n=>{n.addEventListener("input",e)});function o(n,s){function i(v,E){const $=v.getAttribute(s),b=E.getAttribute(s);return!isNaN($)&&!isNaN(b)?parseInt($)-parseInt(b):$b?1:0}const c=n.getAttribute("data-target"),a=t.querySelectorAll(c),r=a[0].parentElement,m=Array.from(a).sort(i);n.nextElementSibling.className.indexOf("active")!==-1&&m.reverse(),m.forEach(v=>r.appendChild(v))}document.querySelectorAll(".extra_networks_order_by").forEach(n=>{n.addEventListener("change",function(s){o(s.target,this.value)}),n.nextElementSibling.addEventListener("click",s=>{o(n,n.value),console.log("You selected: ",n.value)})})}async function Xt(){var t,e,o,n;if(!Z){const s=j();console.log("Remove Extra Networks Instances"),(t=s.querySelector("#img2img_textual_inversion_cards_html"))==null||t.remove(),(e=s.querySelector("#img2img_checkpoints_cards_html"))==null||e.remove(),(o=s.querySelector("#img2img_hypernetworks_cards_html"))==null||o.remove(),(n=s.querySelector("#img2img_lora_cards_html"))==null||n.remove(),console.log("Remove element #img2img_textual_inversion_cards_html"),console.log("Remove element #img2img_checkpoints_cards_html"),console.log("Remove element #img2img_hypernetworks_cards_html"),console.log("Remove element #img2img_lora_cards_html")}}async function Jt(t){await Promise.all(Array.from(t.querySelectorAll(".ae-button")).map(async e=>{const o=e.getAttribute("toggle"),n=e.getAttribute("active"),s=e.querySelector("input");s&&(s.checked===!0&&!n||s.checked===!1&&n)&&s.click(),n?e.classList.add("active"):e.classList.remove("active"),o&&e.addEventListener("click",c=>{const a=e.querySelector("input");a?(a.click(),a.checked===!0?e.classList.add("active"):a.checked===!1&&e.classList.remove("active")):e.classList.toggle("active")});const i=e.getAttribute("data-click");i&&e.addEventListener("click",c=>{var a;if(e.classList.contains("refresh-extra-networks")){const d=((a=e.closest(".layout"))==null?void 0:a.id).split("layout_")[1],m=document.querySelector(`#${d}_pane > div`);[document.querySelector(`#${d}_dirs`),document.querySelector(`#${d}_tree`),document.querySelector(`#${d}_cards`)].forEach(v=>{v&&m.append(v)}),document.querySelector(`#${d}_extra_refresh_internal`).dispatchEvent(new Event("click")),setTimeout(()=>{const v=document.querySelector(`#${d}_aside_split`);v.querySelectorAll(".portal").forEach((E,$,b)=>{ee(E,v,0,$,b.length)}),Qe(v)},1e3)}document.querySelectorAll(i).forEach(r=>{r.click()})})}))}async function Kt(t){const e=Ut();await Promise.all(Array.from(t.querySelectorAll(".accordion-bar")).map(async o=>{const n=o.parentElement,s=n.closest(".split-container");let i=o;const c=n.getAttribute("iconTrigger");if(c){const a=t.querySelector(c);a&&(i=a,o.classList.add("pointer-events-none"))}if(n.className.indexOf("accordion-vertical")!==-1&&s.className.indexOf("split")!==-1){n.classList.add("expand");const a=s.parentElement.id,r=e[a];s.setAttribute("data-sizes",JSON.stringify(r.getSizes())),i==null||i.addEventListener("click",()=>{if(n.classList.toggle("expand"),s.className.indexOf("v-expand")!==-1)s.classList.remove("v-expand"),r.setSizes(JSON.parse(s.getAttribute("data-sizes")));else{s.classList.add("v-expand");let d=r.getSizes();s.setAttribute("data-sizes",JSON.stringify(d)),console.log(d),d[d.length-1]=0,d[d.length-2]=100;const m=parseFloat(window.getComputedStyle(o,null).getPropertyValue("padding-left"))*2;s.style.minWidth=o.offsetWidth+m+"px",r.setSizes(d)}})}else i==null||i.addEventListener("click",()=>{n.classList.toggle("expand")})}))}async function et(t){var o;await Pt(t),await Bt(t),await Kt(t),await Gt(t),await Jt(t),document.querySelector("#container-console-log").append(Xe()),(o=document.querySelector("#logger_screen"))==null||o.remove()}async function Zt(t=ke,e=1){return await(await fetch(`https://api.github.com/repos/${t}/contributors?per_page=100&page=${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})).json()}async function tt(t=ke,e=1,o=[]){const n=await Zt(t,e);return o=o.concat(n),n.length===100?tt(t,e+1,o):o}function Yt(){const t=document.querySelector("#contributors"),e=document.querySelector("#contributors_tabitem"),o=document.createElement("div");o.id="contributors_grid",o.innerHTML=`Kindly allow us a moment to retrieve the contributors.
- We're grateful for the many individuals who have generously put their time and effort to make this possible.`,e.append(o),t.addEventListener("click",n=>{t.getAttribute("data-visited")||(t.setAttribute("data-visited","true"),tt().then(i=>{o.innerHTML="";for(let c=0;c
+ [rel="stylesheet"][href*="file=style.css"]`).forEach(n=>{n.remove(),console.log("Remove stylesheet",n.getAttribute("href"))});const t=document.querySelectorAll('.styler, [class*="svelte"]:not(input)'),e=t.length;let o=0;t.forEach(n=>{n.style.display!=="none"&&n.style.display!=="block"&&(n.removeAttribute("style"),o++),[...n.classList].filter(s=>s.match(/^svelte.*/)).forEach(s=>n.classList.remove(s))}),console.log("Remove inline styles from DOM","Total Selectors:",e,"Removed Selectors:",o)}function Ye(t){var n;const e=t.getAttribute("data-apply"),o=e?e.match(/^(\w+)\s*\(.*\)$/):null;if(o&&typeof window[o[1]]=="function"){t.removeEventListener("click",window[o[1]]);const s=t.getAttribute("data-name")||t.getAttribute("data-path")||((n=t.closest(".card"))==null?void 0:n.getAttribute("data-name"));s&&console.log("Remove EventListener",`${s} - ${o[1]} - ${t.getAttribute("title")||""}`)}}function Re(t){var n;const{target:e,currentTarget:o}=t;if(e.classList.contains("card")||e.classList.contains("card-button")||e.classList.contains("tree-list-content")){let s=e.getAttribute("data-apply")||e.getAttribute("onClick");if(s&&(e.setAttribute("data-apply",s),e.removeAttribute("onClick")),e.setAttribute("onClick",s),e.click(),Ye(e),e.removeAttribute("onClick"),e.classList.contains("card-button")&&jt(),e.classList.contains("tree-list-content-dir")){const i=(n=o.closest(".layout-extra-networks"))==null?void 0:n.querySelector(".search_extra_networks");i&&e.getAttribute("data-path")&&(i.value=e.getAttribute("data-path"),Ee(i))}t.stopImmediatePropagation()}}async function Qe(t){if(window.opts.uiux_enable_event_delegation||Z){const e=$t(t);console.log("Starting Optimizations for",t.id),Z||t.querySelectorAll(".card, .card-button, .tree-list-content").forEach(o=>{const n=o.getAttribute("onClick")||o.getAttribute("data-apply");n&&(o.setAttribute("data-apply",n),o.removeAttribute("onClick"),Ye(o))}),console.log("Total Inline Event Listeners Before:",e,"After:",0),console.log("Attaching Event Listener using Event Delegation",t.id),t.removeEventListener("click",Re),t.addEventListener("click",Re)}}async function Vt(){const t=j(),e=function(n){const s=n.target.value.toLowerCase(),i=n.target.getAttribute("data-target");t.querySelectorAll(i).forEach(a=>{let c=a.getAttribute("data-sort-path").toLowerCase().indexOf(s)!==-1;s.length<2&&(c=!0),a.style.display=c?"":"none"})};document.querySelectorAll(".search_extra_networks").forEach(n=>{n.addEventListener("input",e)});function o(n,s){function i(v,E){const T=v.getAttribute(s),b=E.getAttribute(s);return!isNaN(T)&&!isNaN(b)?parseInt(T)-parseInt(b):Tb?1:0}const a=n.getAttribute("data-target"),r=t.querySelectorAll(a),c=r[0].parentElement,p=Array.from(r).sort(i);n.nextElementSibling.className.indexOf("active")!==-1&&p.reverse(),p.forEach(v=>c.appendChild(v))}document.querySelectorAll(".extra_networks_order_by").forEach(n=>{n.addEventListener("change",function(s){o(s.target,this.value)}),n.nextElementSibling.addEventListener("click",s=>{o(n,n.value),console.log("You selected: ",n.value)})})}async function Xt(){var t,e,o,n;if(!Z){const s=j();console.log("Remove Extra Networks Instances"),(t=s.querySelector("#img2img_textual_inversion_cards_html"))==null||t.remove(),(e=s.querySelector("#img2img_checkpoints_cards_html"))==null||e.remove(),(o=s.querySelector("#img2img_hypernetworks_cards_html"))==null||o.remove(),(n=s.querySelector("#img2img_lora_cards_html"))==null||n.remove(),console.log("Remove element #img2img_textual_inversion_cards_html"),console.log("Remove element #img2img_checkpoints_cards_html"),console.log("Remove element #img2img_hypernetworks_cards_html"),console.log("Remove element #img2img_lora_cards_html")}}async function Jt(t){await Promise.all(Array.from(t.querySelectorAll(".ae-button")).map(async e=>{const o=e.getAttribute("toggle"),n=e.getAttribute("active"),s=e.querySelector("input");s&&(s.checked===!0&&!n||s.checked===!1&&n)&&s.click(),n?e.classList.add("active"):e.classList.remove("active"),o&&e.addEventListener("click",a=>{const r=e.querySelector("input");r?(r.click(),r.checked===!0?e.classList.add("active"):r.checked===!1&&e.classList.remove("active")):e.classList.toggle("active")});const i=e.getAttribute("data-click");i&&e.addEventListener("click",a=>{var r;if(e.classList.contains("refresh-extra-networks")){const d=((r=e.closest(".layout"))==null?void 0:r.id).split("layout_")[1],p=document.querySelector(`#${d}_pane > div`);[document.querySelector(`#${d}_dirs`),document.querySelector(`#${d}_tree`),document.querySelector(`#${d}_cards`)].forEach(v=>{v&&p.append(v)}),document.querySelector(`#${d}_extra_refresh_internal`).dispatchEvent(new Event("click")),setTimeout(()=>{const v=document.querySelector(`#${d}_aside_split`);v.querySelectorAll(".portal").forEach((E,T,b)=>{ee(E,v,0,T,b.length)}),Qe(v)},1e3)}document.querySelectorAll(i).forEach(c=>{c.click()})})}))}async function Kt(t){const e=Ut();await Promise.all(Array.from(t.querySelectorAll(".accordion-bar")).map(async o=>{const n=o.parentElement,s=n.closest(".split-container");let i=o;const a=n.getAttribute("iconTrigger");if(a){const r=t.querySelector(a);r&&(i=r,o.classList.add("pointer-events-none"))}if(n.className.indexOf("accordion-vertical")!==-1&&s.className.indexOf("split")!==-1){n.classList.add("expand");const r=s.parentElement.id,c=e[r];s.setAttribute("data-sizes",JSON.stringify(c.getSizes())),i==null||i.addEventListener("click",()=>{if(n.classList.toggle("expand"),s.className.indexOf("v-expand")!==-1)s.classList.remove("v-expand"),c.setSizes(JSON.parse(s.getAttribute("data-sizes")));else{s.classList.add("v-expand");let d=c.getSizes();s.setAttribute("data-sizes",JSON.stringify(d)),console.log(d),d[d.length-1]=0,d[d.length-2]=100;const p=parseFloat(window.getComputedStyle(o,null).getPropertyValue("padding-left"))*2;s.style.minWidth=o.offsetWidth+p+"px",c.setSizes(d)}})}else i==null||i.addEventListener("click",()=>{n.classList.toggle("expand")})}))}async function et(t){var o;await Pt(t),await Bt(t),await Kt(t),await Gt(t),await Jt(t),document.querySelector("#container-console-log").append(Xe()),(o=document.querySelector("#logger_screen"))==null||o.remove()}async function Zt(t=ke,e=1){return await(await fetch(`https://api.github.com/repos/${t}/contributors?per_page=100&page=${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})).json()}async function tt(t=ke,e=1,o=[]){const n=await Zt(t,e);return o=o.concat(n),n.length===100?tt(t,e+1,o):o}function Yt(){const t=document.querySelector("#contributors"),e=document.querySelector("#contributors_tabitem"),o=document.createElement("div");o.id="contributors_grid",o.innerHTML=`Kindly allow us a moment to retrieve the contributors.
+ We're grateful for the many individuals who have generously put their time and effort to make this possible.`,e.append(o),t.addEventListener("click",n=>{t.getAttribute("data-visited")||(t.setAttribute("data-visited","true"),tt().then(i=>{o.innerHTML="";for(let a=0;a
- ${a}
+ ${r}
- `}}))})}const De=()=>window.innerWidth<=768,ce=t=>{var o;const e=G();e.querySelectorAll("[mobile]").forEach(n=>{if(t){if(n.childElementCount===0){const s=n.getAttribute("mobile");if(s){const i=e.querySelector(s);i&&(n.setAttribute("mobile-restore",`#${i.parentElement.id}`),n.append(i))}}}else if(n.childElementCount>0){const s=n.getAttribute("mobile-restore");if(s){const i=e.querySelector(s);i&&i.append(n.firstElementChild)}}}),t?((o=e.querySelector(".accordion-vertical.expand #mask-icon-acc-arrow"))==null||o.click(),e.classList.add("default-mobile")):e.classList.remove("default-mobile")},Qt=()=>{const t=G(),e=window.opts.uiux_default_layout;t.classList.add(`default-${e.toLowerCase()}`),e==="Auto"?(window.addEventListener("resize",o=>{const n=De();ce(n)}),ce(De())):ce(e==="Mobile")};function en(){const t=G(),e=j();if(!t||!e){console.warn(`Required elements not found: ${t?"":"anapnoeApp"} ${e?"":"gradioApp"}`);return}e.querySelector("#setting_uiux_mobile_scale input[type=range]").classList.add("hidden");const n=e.querySelector("#setting_uiux_mobile_scale input[type=number]");function s(f){document.head.querySelector('meta[name="viewport"]').setAttribute("content",`width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=${f}`)}n.addEventListener("change",f=>{n.value=f.target.value,Ee(n),s(f.target.value)}),s(window.opts.uiux_mobile_scale);function i(f){e.querySelectorAll('[id$="2img_width"] input,[id$="2img_height"] input').forEach(_=>{_.max=f})}e.querySelector("#setting_uiux_max_resolution_output").addEventListener("input",f=>{let _=parseInt(f.target.value);_=Math.min(Math.max(_,512),16384),i(_)}),i(window.opts.uiux_max_resolution_output);function c(f){f.forEach(_=>{const x=_.step/(_.max-_.min)*100,w=`max(3px, calc(${x}% - 1px))`,k=`max(4px, calc(${x}% + 0px))`;_.style.setProperty("--ae-slider-bg-overlay",`repeating-linear-gradient(90deg, transparent, transparent ${w}, var(--ae-input-border-color) ${w}, var(--ae-input-border-color) ${k})`)})}function a(f,_){const w=e.querySelectorAll("input[type='range']");f?c(w):_&&w.forEach(k=>{k.style.setProperty("--ae-slider-bg-overlay","transparent")})}e.querySelector("#setting_uiux_show_input_range_ticks input").addEventListener("click",f=>{a(f.target.checked,!0)}),a(window.opts.uiux_show_input_range_ticks);function d(){const f=Array.from(e.querySelectorAll("#setting_uiux_ignore_overrides input:checked")).map(x=>x.nextElementSibling.innerHTML);e.querySelectorAll("[id$='2img_override_settings'] .token").forEach(x=>{var C;const[w,k]=x.querySelector("span").textContent.split(":").map(P=>P.trim());f.includes(w)&&(e.querySelector("[id$='2img_override_settings']").classList.add("show"),(C=x.querySelector(".token-remove"))==null||C.click())})}e.querySelector("#setting_uiux_ignore_overrides").addEventListener("click",()=>{setTimeout(d,100)});const m=new MutationObserver(f=>{f.forEach(_=>{_.type==="attributes"&&_.attributeName==="class"&&setTimeout(d,1e3)})}),y=new MutationObserver(f=>{f.forEach(_=>{_.addedNodes.length&&setTimeout(d,1e3)})});document.querySelectorAll("#txt2img_override_settings .wrap-inner, #img2img_override_settings .wrap_inner").forEach(f=>y.observe(f,{childList:!0})),document.querySelectorAll("#txt2img_nav, #img2img_nav").forEach(f=>m.observe(f,{attributes:!0}));function E(f,_){const x=e.querySelector(`${f} input`);if(x){const w=f.split("#setting_")[1],k=window.opts[w];t.classList.toggle(_,k),localStorage.setItem(w,k),x.addEventListener("click",C=>{localStorage.setItem(w,C.target.checked),t.classList.toggle(_,C.target.checked),w==="uiux_enable_console_log"&&Et(C.target.checked)})}}const $=[{key:"#setting_uiux_no_slider_layout",className:"no-slider-layout"},{key:"#setting_uiux_show_labels_aside",className:"aside-labels"},{key:"#setting_uiux_show_labels_main",className:"main-labels"},{key:"#setting_uiux_show_labels_tabs",className:"tab-labels"},{key:"#setting_uiux_hide_extra_info",className:"no-extra-info"},{key:"#setting_uiux_disable_transitions",className:"notransition"},{key:"#setting_uiux_enable_console_log",className:"debug-log"}];for(const{key:f,className:_}of $)E(f,_);function b(f,_){t.style.setProperty(f,_)}const A=["#setting_uiux_exnet_fit_size","#setting_uiux_exnet_aspect_ratio_x","#setting_uiux_exnet_aspect_ratio_y","#setting_uiux_exnet_header_size","#setting_uiux_min_wrap_size","#setting_uiux_exnet_image_tint"];for(const f of A){const _=document.querySelector(`${f} input[type=number]`),x=document.querySelector(`${f} input[type=range]`);if(x&&x.classList.add("hidden"),_){const w=f.split("#setting_")[1],k=`--ae-${w}`,C=window.opts[w];b(k,C),_.addEventListener("change",P=>{Ee(_),b(k,P.target.value)})}}}function tn(){["#txt2img","#img2img","#deforum"].forEach(e=>{var n;const o=document.querySelector(`${e}_generate`);if(o){(n=document.querySelector(`${e}_nav`))==null||n.classList.remove("hidden");const s=document.querySelector(`${e}_interrupt`),i=s.closest(".portal"),c=o.closest(".ae-button"),a=document.querySelector(`${e}_skip`).closest(".portal"),r=document.querySelector(`${e}_loop`);s.addEventListener("click",()=>{r==null||r.classList.add("stop")}),new MutationObserver(m=>{m.forEach(y=>{s.style.display==="none"?(document.querySelector(".progressDiv .progress")&&(i.classList.remove("disable"),setTimeout(()=>s.click(),500)),r?r.className.indexOf("stop")!==-1||r.className.indexOf("active")===-1?(r.classList.remove("stop"),i.classList.add("disable"),a==null||a.classList.add("disable"),c.classList.remove("active")):r.className.indexOf("active")!==-1&&o.click():(i.classList.add("disable"),c.classList.remove("active"))):(i.classList.remove("disable"),a==null||a.classList.remove("disable"),c.classList.add("active"))})}).observe(s,{attributes:!0,attributeFilter:["style"]})}})}function nn(){const t=document.querySelector("#setting_sd_model_checkpoint .wrap .secondary-wrap input")||document.querySelector(".gradio-dropdown.model_selection .wrap .secondary-wrap input");let e=t.value,o=document.querySelector(`#txt2img_checkpoints_cards .card[data-apply*="${e}"]`);const n=document.querySelector("#txt2img_checkpoints_main_footer .model-selected"),s=document.querySelector("#setting_sd_model_checkpoint .wrap")||document.querySelector(".gradio-dropdown.model_selection .wrap"),i=document.querySelector("#txt2img_checkpoints_main_footer .model-preloader");o&&(o.classList.add("selected"),n.textContent=e,console.log("Checkpoint name:",o.getAttribute("data-name"),"
")),i.append(s);const c=(r,d)=>{r&&o!==r&&(o==null||o.classList.remove("selected"),r.classList.add("selected"),o=r,n.textContent=d,console.log("Checkpoint:",d))},a=new MutationObserver(function(r){r.forEach(function(d){if(d.type==="attributes"&&d.target===t){const v=t.value,E=document.querySelector(`#txt2img_checkpoints_cards .card[data-apply*="${v}"]`);c(E,v)}const m=document.querySelector("#sd_checkpoint_hash"),y=m==null?void 0:m.textContent,g=document.querySelector(`#txt2img_checkpoints_cards .card[data-apply*="${y}"]`);c(g,t.value)})});a.observe(t,{attributes:!0}),a.observe(s,{childList:!0,subtree:!0})}function je(t){let e=t.startsWith("#")?t.slice(1):t,o=1;if(e.length===8?(o=parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)):e.length===3&&(e=e.split("").map(s=>s+s).join("")),e.length!==6)throw new Error("Invalid HEX color.");const n=e.match(/.{2}/g).map(s=>parseInt(s,16));return n.push(o),n}function de(t){const e=t[0]/255,o=t[1]/255,n=t[2]/255,s=Math.max(e,o,n),i=Math.min(e,o,n),c=s-i,a=s+i,r=i===s?0:e===s?(60*(o-n)/c+360)%360:o===s?60*(n-e)/c+120:60*(e-o)/c+240,d=.5*a,m=d===0?0:d===1?1:d<=.5?c/a:c/(2-a),y=t.length===4?t[3]:1;return[Math.round(r),Math.round(m*100),Math.round(d*100),y]}function Le(t,e,o,n=1){o/=100;const s=(n*255|256).toString(16).slice(1),i=c=>{const a=(c+t/30)%12,r=o-e*Math.min(o,1-o)/100*Math.max(Math.min(a-3,9-a,1),-1);return Math.round(255*Math.max(0,Math.min(r,1))).toString(16).padStart(2,"0")};return`#${i(0)}${i(8)}${i(4)}${s}`}function He(t){t.startsWith("#")&&(t=t.slice(1));let e=1;if(t.length===8&&(e=parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===3&&(t=t.split("").map(i=>i+i).join("")),t.length!==6)throw new Error("Invalid HEX color.");const o=(255-parseInt(t.slice(0,2),16)).toString(16),n=(255-parseInt(t.slice(2,4),16)).toString(16),s=(255-parseInt(t.slice(4,6),16)).toString(16);return`#${le(o)}${le(n)}${le(s)}${le(Math.round(e*255).toString(16))}`}function le(t,e=2){return(new Array(e).join("0")+t).slice(-e)}const z={};let Q,X=[0,0,0,0];const pe=t=>t.match(/[\d.]+/g).map(Number);function on(t,e,o,n){let s;if(o.includes("#")){let m=o.replace(/\s+/g,"");Q&&(m=He(m),z[e]=m),s=de(je(m))}else if((o.includes("hsl")||o.includes("rgb"))&&(s=o.includes("rgb")?de(pe(o)):pe(o),Q)){const m=Le(s[0],s[1],s[2],s[3]);z[e]=He(m),s=de(je(z[e]))}const i=((Number(s[0])||0)+(Number(n[0])||0))%360,c=Math.min(Math.max((Number(s[1])||0)+(Number(n[1])||0),0),100),a=Math.min(Math.max((Number(s[2])||0)+(Number(n[2])||0),0),100),r=Math.min(Math.max((Number(s[3])||1)+(Number(n[3])||0),0),1),d=Le(i,c,a,r).slice(0,-2);return t.value=d,`hsla(${i}, ${c}%, ${a}%, ${r})`}function xe(t){let e="";for(const s in z){const i=z[s];if(s!=""&&i&&i.length>0){const c=document.body.querySelector(`#${s} input`)||document.body.querySelector(`#${s} textarea`);if(c)if((c.type||"text")==="color"){const r=on(c,s,i,t);e+=`${s}:${r};`}else e+=`${s}:${z[s]};`}}Q=!1;const o=document.body.querySelector("#preview-styles");o.innerHTML=`:root {${e}}`,o.innerHTML+="@media only screen and (max-width: 860px) { :root { --ae-outside-gap-size: var(--ae-mobile-outside-gap-size); --ae-inside-padding-size: var(--ae-mobile-inside-padding-size); } }";const n=document.body.querySelector("#theme_vars textarea");n.value=e,window.updateInput(n)}function we(t){let e="";for(let i=0;im.trim()),r=c.replace(/\s+/g,"");z[r]=a,e+=`${r}:${a};`,document.body.querySelectorAll(`#${r} input, #${r} textarea`).forEach(m=>{const y=m.type||"text";if(y==="color")if(a.includes("hsl")||a.includes("rgb")){let g;a.includes("rgb")?g=de(pe(a)):g=pe(a),m.value=Le(g[0],g[1],g[2],g[3]).slice(0,-2)}else m.value=a;else y==="number"||y==="range"?m.value=parseFloat(a)||0:(y==="textarea"||y==="text")&&(m.value=a)})}const o=document.body.querySelector("#preview-styles");if(o)o.innerHTML=`:root {${e}}`,o.innerHTML+="@media only screen and (max-width: 860px) { :root { --ae-outside-gap-size: var(--ae-mobile-outside-gap-size); --ae-inside-padding-size: var(--ae-mobile-inside-padding-size); } }";else{const i=document.createElement("style");i.id="preview-styles",i.innerHTML=`:root {${e}}`,i.innerHTML+="@media only screen and (max-width: 860px) { :root { --ae-outside-gap-size: var(--ae-mobile-outside-gap-size); --ae-inside-padding-size: var(--ae-mobile-inside-padding-size); } }",document.body.appendChild(i)}const n=document.body.querySelector("#theme_vars textarea"),s=document.body.querySelector("#theme_css textarea");n.value=e,window.updateInput(n),window.updateInput(s)}function sn(t){const e=t.split("/*BREAKPOINT_CSS_CONTENT*/");let o=e[0].split("}")[0].split("{")[1].replace(/\n|\r/g,"");o=o.replace(/;+/,";").trim();const n=o.split(";"),s=document.body.querySelector("#theme_vars textarea"),i=document.body.querySelector("#theme_css textarea");s.value=o,window.updateInput(s);const c=e[1]!==void 0?e[1]:"";i.value=`/*BREAKPOINT_CSS_CONTENT*/${c}/*BREAKPOINT_CSS_CONTENT*/`,we(n);const a=document.body.querySelector("#preview-styles");if(!a){const b=document.createElement("style");b.id="preview-styles",b.innerHTML=t,document.body.appendChild(b)}let r;function d(b){let A=b.value,f=b.parentElement,_=b.type||"text";_==="range"||_==="number"?(f=b.closest(".gradio-slider")||b.closest(".gradio-number"),A+=f.id.indexOf("angle")!==-1?"deg":f.id.indexOf("slider-height")===-1?"px":"",z[f.id]=A):_==="color"?(f=b.closest(".gradio-colorpicker"),z[f.id]=A):_==="textarea"?(f=b.closest(".gradio-textbox"),A.length>0?z[f.id]=A:delete z[f.id]):_==="text"&&(f=b.closest(".gradio-dropdown"),f&&(z[f.id]=A)),r!=null&&clearInterval(r),r=setTimeout(()=>{let x=Object.entries(z).map(([w,k])=>`${w}:${k};`).join("");s.value=x,a.innerHTML=`:root {${x}}@media only screen and (max-width: 860px) { :root { --ae-outside-gap-size: var(--ae-mobile-outside-gap-size); --ae-inside-padding-size: var(--ae-mobile-inside-padding-size); } }`,window.updateInput(s),xe(X)},1e3)}document.body.querySelectorAll("#ui_theme_settings input, #ui_theme_settings textarea").forEach(b=>{b.addEventListener("input",A=>{d(A.currentTarget)})});const m=new MutationObserver(b=>{b.forEach(A=>{A.removedNodes.forEach(f=>{f.nodeType===1&&f.matches("ul")&&d(A.target.querySelector(".secondary-wrap input"))})})});document.body.querySelectorAll("#ui_theme_settings .gradio-dropdown").forEach(b=>{m.observe(b,{childList:!0,subtree:!0})}),document.getElementById("theme_reset_btn").addEventListener("click",b=>{b.preventDefault(),document.body.querySelectorAll("#ui_theme_hsv input").forEach(A=>{A.value=0}),X=[0,0,0],we(n)});let g;function v(){if(o!==s.value){clearInterval(g),o=s.value.replace(/\n|\r/g,""),o=o.split(":root{")[0],s.value=o;const b=o.split(";");we(b)}}document.body.querySelector("#themes_drop_down input").addEventListener("click",b=>{g!==null&&clearInterval(g),s.value=o,g=setInterval(v,500)}),document.body.querySelectorAll("#theme_hue input, #theme_sat input, #theme_brt input").forEach((b,A)=>{b.addEventListener("change",f=>{f.preventDefault(),X[Math.floor(A/2)]=f.currentTarget.value,xe(X)})}),document.getElementById("theme_invert_btn").addEventListener("click",b=>{b.preventDefault(),Q=!Q,xe(X)})}function Fe(t){var n;const o=(n=Array.from(t.sheet.cssRules).filter(s=>s instanceof CSSStyleRule&&s.selectorText===":root")[0])==null?void 0:n.cssText;o&&sn(o)}function rn(){const t=document.querySelector('[rel="stylesheet"][href*="user"]');if(j().querySelector('[id^="tab_ui_theme"]')&&t){Fe(t);return}const o=new MutationObserver(()=>{const n=document.querySelector('[rel="stylesheet"][href*="user"]');if(j().querySelector('[id^="tab_ui_theme"]'))if(n)o.disconnect(),setTimeout(()=>{Fe(n)},500);else{var i=document.createElement("link");i.rel="stylesheet",i.type="text/css",i.href="./file=user.css",document.head.appendChild(i)}});o.observe(j(),{childList:!0,subtree:!0})}function an(t){const e=document.querySelector("#logger_screen");e&&(document.querySelector("#container-console-log").append(getLoggerUiUx()),e.remove()),t.querySelectorAll(".extra-network-cards, .extra-network-tree").forEach(n=>{Qe(n)}),console.log("Finishing optimizations for Extra Networks"),Vt(),tn(),en(),Yt(),Qt(),nn(),document.querySelectorAll("#txt2img_styles_edit_button, #img2img_styles_edit_button").forEach(n=>{n.addEventListener("click",function(s){window.popup_trigger.click()})});function o(n){Pe.FOCUS_PROMPT=n.includes("txt2img")?"txt2img":"img2img"}document.querySelectorAll("#txt2img_prompt textarea, #img2img_prompt textarea, #txt2img_neg_prompt textarea, #img2img_neg_prompt textarea").forEach(n=>{n.addEventListener("focus",s=>{const i=s.target.closest(".gradio-textbox").id;o(i)})}),document.querySelectorAll("#about_tabitem img").forEach(n=>{const s=n.getAttribute("data-src");s&&(n.src=s.replace("file=extensions/sd-webui-ux/assets/",`${fe}`))}),window.UIUX=Pe,me.setItem("UiUxComplete","true"),window.opts.uiux_enable_theme_editor&&rn(),setTimeout(()=>{var n;(n=document.querySelector("#btn_checkpoints"))==null||n.click()},500)}async function cn(){const t=G(),e=j();await pt(),e.insertAdjacentElement("afterbegin",t);const o=Rt((n,s)=>{n==="UiUxReady"&&s==="true"&&(an(t),o())},"UiUxReady");(async()=>await et(t))(),$t(),setTimeout(()=>{ft("#infinite_image_browsing_container_wrapper iframe",["user.css","uiux-iibrowser.css"])},3e3)}async function ln(){try{At(),console.log("Starting DOM Optimizations"),Xt(),Wt(),console.log("Finishing DOM Optimizations"),gt(xt),D.gradio_major>3&&ht("style.css","style-gradio-4.css",document.body),(async()=>(await qt(),await cn()))()}catch(t){console.error("Error in run sequence:",t)}}function un(){if(localStorage.setItem("UiUxReady","false"),localStorage.setItem("UiUxComplete","false"),!document.getElementById("logger_screen")){const o=document.createElement("div");o.id="logger_screen",o.style="position: fixed; inset: 0; background-color: black; z-index: 99999; display: flex; flex-direction: column; overflow:auto;";const n=document.createElement("div");n.id="loggerUiUx",o.append(n),document.body.append(o)}const t=new MutationObserver(async()=>{if(Ve()&&window.opts&&Object.keys(window.opts).length){t.disconnect();try{await ln()}catch(n){console.error("Error running the function:",n)}}}),e=j();e?t.observe(e,{childList:!0,subtree:!0}):console.error("getGradioApp() did not return a valid target for observation")}un();
+ `}}))})}const De=()=>window.innerWidth<=768,ae=t=>{var o;const e=G();e.querySelectorAll("[mobile]").forEach(n=>{if(t){if(n.childElementCount===0){const s=n.getAttribute("mobile");if(s){const i=e.querySelector(s);i&&(n.setAttribute("mobile-restore",`#${i.parentElement.id}`),n.append(i))}}}else if(n.childElementCount>0){const s=n.getAttribute("mobile-restore");if(s){const i=e.querySelector(s);i&&i.append(n.firstElementChild)}}}),t?((o=e.querySelector(".accordion-vertical.expand #mask-icon-acc-arrow"))==null||o.click(),e.classList.add("default-mobile")):e.classList.remove("default-mobile")},Qt=()=>{const t=G(),e=window.opts.uiux_default_layout;t.classList.add(`default-${e.toLowerCase()}`),e==="Auto"?(window.addEventListener("resize",o=>{const n=De();ae(n)}),ae(De())):ae(e==="Mobile")};function en(){const t=G(),e=j();if(!t||!e){console.warn(`Required elements not found: ${t?"":"anapnoeApp"} ${e?"":"gradioApp"}`);return}e.querySelector("#setting_uiux_mobile_scale input[type=range]").classList.add("hidden");const n=e.querySelector("#setting_uiux_mobile_scale input[type=number]");function s(f){document.head.querySelector('meta[name="viewport"]').setAttribute("content",`width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=${f}`)}n.addEventListener("change",f=>{n.value=f.target.value,Ee(n),s(f.target.value)}),s(window.opts.uiux_mobile_scale);function i(f){e.querySelectorAll('[id$="2img_width"] input,[id$="2img_height"] input').forEach(_=>{_.max=f})}e.querySelector("#setting_uiux_max_resolution_output").addEventListener("input",f=>{let _=parseInt(f.target.value);_=Math.min(Math.max(_,512),16384),i(_)}),i(window.opts.uiux_max_resolution_output);function a(f){f.forEach(_=>{const x=_.step/(_.max-_.min)*100,w=`max(3px, calc(${x}% - 1px))`,k=`max(4px, calc(${x}% + 0px))`;_.style.setProperty("--ae-slider-bg-overlay",`repeating-linear-gradient(90deg, transparent, transparent ${w}, var(--ae-input-border-color) ${w}, var(--ae-input-border-color) ${k})`)})}function r(f,_){const w=e.querySelectorAll("input[type='range']");f?a(w):_&&w.forEach(k=>{k.style.setProperty("--ae-slider-bg-overlay","transparent")})}e.querySelector("#setting_uiux_show_input_range_ticks input").addEventListener("click",f=>{r(f.target.checked,!0)}),r(window.opts.uiux_show_input_range_ticks);function d(){const f=Array.from(e.querySelectorAll("#setting_uiux_ignore_overrides input:checked")).map(x=>x.nextElementSibling.innerHTML);e.querySelectorAll("[id$='2img_override_settings'] .token").forEach(x=>{var O;const[w,k]=x.querySelector("span").textContent.split(":").map(P=>P.trim());f.includes(w)&&(e.querySelector("[id$='2img_override_settings']").classList.add("show"),(O=x.querySelector(".token-remove"))==null||O.click())})}e.querySelector("#setting_uiux_ignore_overrides").addEventListener("click",()=>{setTimeout(d,100)});const p=new MutationObserver(f=>{f.forEach(_=>{_.type==="attributes"&&_.attributeName==="class"&&setTimeout(d,1e3)})}),y=new MutationObserver(f=>{f.forEach(_=>{_.addedNodes.length&&setTimeout(d,1e3)})});document.querySelectorAll("#txt2img_override_settings .wrap-inner, #img2img_override_settings .wrap_inner").forEach(f=>y.observe(f,{childList:!0})),document.querySelectorAll("#txt2img_nav, #img2img_nav").forEach(f=>p.observe(f,{attributes:!0}));function E(f,_){const x=e.querySelector(`${f} input`);if(x){const w=f.split("#setting_")[1],k=window.opts[w];t.classList.toggle(_,k),localStorage.setItem(w,k),x.addEventListener("click",O=>{localStorage.setItem(w,O.target.checked),t.classList.toggle(_,O.target.checked),w==="uiux_enable_console_log"&&Et(O.target.checked)})}}const T=[{key:"#setting_uiux_no_slider_layout",className:"no-slider-layout"},{key:"#setting_uiux_show_labels_aside",className:"aside-labels"},{key:"#setting_uiux_show_labels_main",className:"main-labels"},{key:"#setting_uiux_show_labels_tabs",className:"tab-labels"},{key:"#setting_uiux_hide_extra_info",className:"no-extra-info"},{key:"#setting_uiux_disable_transitions",className:"notransition"},{key:"#setting_uiux_enable_console_log",className:"debug-log"}];for(const{key:f,className:_}of T)E(f,_);function b(f,_){t.style.setProperty(f,_)}const A=["#setting_uiux_exnet_fit_size","#setting_uiux_exnet_aspect_ratio_x","#setting_uiux_exnet_aspect_ratio_y","#setting_uiux_exnet_header_size","#setting_uiux_min_wrap_size","#setting_uiux_exnet_image_tint"];for(const f of A){const _=document.querySelector(`${f} input[type=number]`),x=document.querySelector(`${f} input[type=range]`);if(x&&x.classList.add("hidden"),_){const w=f.split("#setting_")[1],k=`--ae-${w}`,O=window.opts[w];b(k,O),_.addEventListener("change",P=>{Ee(_),b(k,P.target.value)})}}}function tn(){["#txt2img","#img2img","#deforum"].forEach(e=>{var n;const o=document.querySelector(`${e}_generate`);if(o){(n=document.querySelector(`${e}_nav`))==null||n.classList.remove("hidden");const s=document.querySelector(`${e}_interrupt`),i=s.closest(".portal"),a=o.closest(".ae-button"),r=document.querySelector(`${e}_skip`).closest(".portal"),c=document.querySelector(`${e}_loop`);s.addEventListener("click",()=>{c==null||c.classList.add("stop")}),new MutationObserver(p=>{p.forEach(y=>{s.style.display==="none"?(document.querySelector(".progressDiv .progress")&&(i.classList.remove("disable"),setTimeout(()=>s.click(),500)),c?c.className.indexOf("stop")!==-1||c.className.indexOf("active")===-1?(c.classList.remove("stop"),i.classList.add("disable"),r==null||r.classList.add("disable"),a.classList.remove("active")):c.className.indexOf("active")!==-1&&o.click():(i.classList.add("disable"),a.classList.remove("active"))):(i.classList.remove("disable"),r==null||r.classList.remove("disable"),a.classList.add("active"))})}).observe(s,{attributes:!0,attributeFilter:["style"]})}})}function nn(){const t=document.querySelector("#setting_sd_model_checkpoint .wrap .secondary-wrap input")||document.querySelector(".gradio-dropdown.model_selection .wrap .secondary-wrap input"),e=document.querySelector("#setting_sd_model_checkpoint .wrap")||document.querySelector(".gradio-dropdown.model_selection .wrap"),o=document.querySelector("#txt2img_checkpoints_main_footer .model-selected");document.querySelector("#txt2img_checkpoints_main_footer .model-preloader").append(e);let s;const i=r=>{if(s!==r){console.log("Checkpoint:",r);const c=document.querySelector("#txt2img_checkpoints_cards .card.selected");c==null||c.classList.remove("selected");const d=document.querySelector(`#txt2img_checkpoints_cards .card[data-apply*="${r}"]`)||document.querySelector(`#txt2img_checkpoints_cards .card[onclick*="${r}"]`);d==null||d.classList.add("selected"),o.textContent=r,console.log("Checkpoint:",r),s=r}};i(t.value);const a=new MutationObserver(function(r){r.forEach(function(c){setTimeout(()=>i(t.value),1e3)})});a.observe(t,{attributes:!0}),a.observe(e,{childList:!0,subtree:!0})}function je(t){let e=t.startsWith("#")?t.slice(1):t,o=1;if(e.length===8?(o=parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)):e.length===3&&(e=e.split("").map(s=>s+s).join("")),e.length!==6)throw new Error("Invalid HEX color.");const n=e.match(/.{2}/g).map(s=>parseInt(s,16));return n.push(o),n}function de(t){const e=t[0]/255,o=t[1]/255,n=t[2]/255,s=Math.max(e,o,n),i=Math.min(e,o,n),a=s-i,r=s+i,c=i===s?0:e===s?(60*(o-n)/a+360)%360:o===s?60*(n-e)/a+120:60*(e-o)/a+240,d=.5*r,p=d===0?0:d===1?1:d<=.5?a/r:a/(2-r),y=t.length===4?t[3]:1;return[Math.round(c),Math.round(p*100),Math.round(d*100),y]}function Le(t,e,o,n=1){o/=100;const s=(n*255|256).toString(16).slice(1),i=a=>{const r=(a+t/30)%12,c=o-e*Math.min(o,1-o)/100*Math.max(Math.min(r-3,9-r,1),-1);return Math.round(255*Math.max(0,Math.min(c,1))).toString(16).padStart(2,"0")};return`#${i(0)}${i(8)}${i(4)}${s}`}function He(t){t.startsWith("#")&&(t=t.slice(1));let e=1;if(t.length===8&&(e=parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===3&&(t=t.split("").map(i=>i+i).join("")),t.length!==6)throw new Error("Invalid HEX color.");const o=(255-parseInt(t.slice(0,2),16)).toString(16),n=(255-parseInt(t.slice(2,4),16)).toString(16),s=(255-parseInt(t.slice(4,6),16)).toString(16);return`#${le(o)}${le(n)}${le(s)}${le(Math.round(e*255).toString(16))}`}function le(t,e=2){return(new Array(e).join("0")+t).slice(-e)}const z={};let Q,X=[0,0,0,0];const pe=t=>t.match(/[\d.]+/g).map(Number);function on(t,e,o,n){let s;if(o.includes("#")){let p=o.replace(/\s+/g,"");Q&&(p=He(p),z[e]=p),s=de(je(p))}else if((o.includes("hsl")||o.includes("rgb"))&&(s=o.includes("rgb")?de(pe(o)):pe(o),Q)){const p=Le(s[0],s[1],s[2],s[3]);z[e]=He(p),s=de(je(z[e]))}const i=((Number(s[0])||0)+(Number(n[0])||0))%360,a=Math.min(Math.max((Number(s[1])||0)+(Number(n[1])||0),0),100),r=Math.min(Math.max((Number(s[2])||0)+(Number(n[2])||0),0),100),c=Math.min(Math.max((Number(s[3])||1)+(Number(n[3])||0),0),1),d=Le(i,a,r,c).slice(0,-2);return t.value=d,`hsla(${i}, ${a}%, ${r}%, ${c})`}function xe(t){let e="";for(const s in z){const i=z[s];if(s!=""&&i&&i.length>0){const a=document.body.querySelector(`#${s} input`)||document.body.querySelector(`#${s} textarea`);if(a)if((a.type||"text")==="color"){const c=on(a,s,i,t);e+=`${s}:${c};`}else e+=`${s}:${z[s]};`}}Q=!1;const o=document.body.querySelector("#preview-styles");o.innerHTML=`:root {${e}}`,o.innerHTML+="@media only screen and (max-width: 860px) { :root { --ae-outside-gap-size: var(--ae-mobile-outside-gap-size); --ae-inside-padding-size: var(--ae-mobile-inside-padding-size); } }";const n=document.body.querySelector("#theme_vars textarea");n.value=e,window.updateInput(n)}function we(t){let e="";for(let i=0;ip.trim()),c=a.replace(/\s+/g,"");z[c]=r,e+=`${c}:${r};`,document.body.querySelectorAll(`#${c} input, #${c} textarea`).forEach(p=>{const y=p.type||"text";if(y==="color")if(r.includes("hsl")||r.includes("rgb")){let h;r.includes("rgb")?h=de(pe(r)):h=pe(r),p.value=Le(h[0],h[1],h[2],h[3]).slice(0,-2)}else p.value=r;else y==="number"||y==="range"?p.value=parseFloat(r)||0:(y==="textarea"||y==="text")&&(p.value=r)})}const o=document.body.querySelector("#preview-styles");if(o)o.innerHTML=`:root {${e}}`,o.innerHTML+="@media only screen and (max-width: 860px) { :root { --ae-outside-gap-size: var(--ae-mobile-outside-gap-size); --ae-inside-padding-size: var(--ae-mobile-inside-padding-size); } }";else{const i=document.createElement("style");i.id="preview-styles",i.innerHTML=`:root {${e}}`,i.innerHTML+="@media only screen and (max-width: 860px) { :root { --ae-outside-gap-size: var(--ae-mobile-outside-gap-size); --ae-inside-padding-size: var(--ae-mobile-inside-padding-size); } }",document.body.appendChild(i)}const n=document.body.querySelector("#theme_vars textarea"),s=document.body.querySelector("#theme_css textarea");n.value=e,window.updateInput(n),window.updateInput(s)}function sn(t){const e=t.split("/*BREAKPOINT_CSS_CONTENT*/");let o=e[0].split("}")[0].split("{")[1].replace(/\n|\r/g,"");o=o.replace(/;+/,";").trim();const n=o.split(";"),s=document.body.querySelector("#theme_vars textarea"),i=document.body.querySelector("#theme_css textarea");s.value=o,window.updateInput(s);const a=e[1]!==void 0?e[1]:"";i.value=`/*BREAKPOINT_CSS_CONTENT*/${a}/*BREAKPOINT_CSS_CONTENT*/`,we(n);const r=document.body.querySelector("#preview-styles");if(!r){const b=document.createElement("style");b.id="preview-styles",b.innerHTML=t,document.body.appendChild(b)}let c;function d(b){let A=b.value,f=b.parentElement,_=b.type||"text";_==="range"||_==="number"?(f=b.closest(".gradio-slider")||b.closest(".gradio-number"),A+=f.id.indexOf("angle")!==-1?"deg":f.id.indexOf("slider-height")===-1?"px":"",z[f.id]=A):_==="color"?(f=b.closest(".gradio-colorpicker"),z[f.id]=A):_==="textarea"?(f=b.closest(".gradio-textbox"),A.length>0?z[f.id]=A:delete z[f.id]):_==="text"&&(f=b.closest(".gradio-dropdown"),f&&(z[f.id]=A)),c!=null&&clearInterval(c),c=setTimeout(()=>{let x=Object.entries(z).map(([w,k])=>`${w}:${k};`).join("");s.value=x,r.innerHTML=`:root {${x}}@media only screen and (max-width: 860px) { :root { --ae-outside-gap-size: var(--ae-mobile-outside-gap-size); --ae-inside-padding-size: var(--ae-mobile-inside-padding-size); } }`,window.updateInput(s),xe(X)},1e3)}document.body.querySelectorAll("#ui_theme_settings input, #ui_theme_settings textarea").forEach(b=>{b.addEventListener("input",A=>{d(A.currentTarget)})});const p=new MutationObserver(b=>{b.forEach(A=>{A.removedNodes.forEach(f=>{f.nodeType===1&&f.matches("ul")&&d(A.target.querySelector(".secondary-wrap input"))})})});document.body.querySelectorAll("#ui_theme_settings .gradio-dropdown").forEach(b=>{p.observe(b,{childList:!0,subtree:!0})}),document.getElementById("theme_reset_btn").addEventListener("click",b=>{b.preventDefault(),document.body.querySelectorAll("#ui_theme_hsv input").forEach(A=>{A.value=0}),X=[0,0,0],we(n)});let h;function v(){if(o!==s.value){clearInterval(h),o=s.value.replace(/\n|\r/g,""),o=o.split(":root{")[0],s.value=o;const b=o.split(";");we(b)}}document.body.querySelector("#themes_drop_down input").addEventListener("click",b=>{h!==null&&clearInterval(h),s.value=o,h=setInterval(v,500)}),document.body.querySelectorAll("#theme_hue input, #theme_sat input, #theme_brt input").forEach((b,A)=>{b.addEventListener("change",f=>{f.preventDefault(),X[Math.floor(A/2)]=f.currentTarget.value,xe(X)})}),document.getElementById("theme_invert_btn").addEventListener("click",b=>{b.preventDefault(),Q=!Q,xe(X)})}function Fe(t){var n;const o=(n=Array.from(t.sheet.cssRules).filter(s=>s instanceof CSSStyleRule&&s.selectorText===":root")[0])==null?void 0:n.cssText;o&&sn(o)}function rn(){const t=document.querySelector('[rel="stylesheet"][href*="user"]');if(j().querySelector('[id^="tab_ui_theme"]')&&t){Fe(t);return}const o=new MutationObserver(()=>{const n=document.querySelector('[rel="stylesheet"][href*="user"]');if(j().querySelector('[id^="tab_ui_theme"]'))if(n)o.disconnect(),setTimeout(()=>{Fe(n)},500);else{var i=document.createElement("link");i.rel="stylesheet",i.type="text/css",i.href="./file=user.css",document.head.appendChild(i)}});o.observe(j(),{childList:!0,subtree:!0})}function cn(t){const e=document.querySelector("#logger_screen");e&&(document.querySelector("#container-console-log").append(getLoggerUiUx()),e.remove()),t.querySelectorAll(".extra-network-cards, .extra-network-tree").forEach(n=>{Qe(n)}),console.log("Finishing optimizations for Extra Networks"),Vt(),tn(),en(),Yt(),Qt(),nn(),document.querySelectorAll("#txt2img_styles_edit_button, #img2img_styles_edit_button").forEach(n=>{n.addEventListener("click",function(s){window.popup_trigger.click()})});function o(n){Pe.FOCUS_PROMPT=n.includes("txt2img")?"txt2img":"img2img"}document.querySelectorAll("#txt2img_prompt textarea, #img2img_prompt textarea, #txt2img_neg_prompt textarea, #img2img_neg_prompt textarea").forEach(n=>{n.addEventListener("focus",s=>{const i=s.target.closest(".gradio-textbox").id;o(i)})}),document.querySelectorAll("#about_tabitem img").forEach(n=>{const s=n.getAttribute("data-src");s&&(n.src=s.replace("file=extensions/sd-webui-ux/assets/",`${fe}`))}),window.UIUX=Pe,me.setItem("UiUxComplete","true"),window.opts.uiux_enable_theme_editor&&rn(),setTimeout(()=>{var n;(n=document.querySelector("#btn_checkpoints"))==null||n.click()},500)}async function an(){const t=G(),e=j();await pt(),e.insertAdjacentElement("afterbegin",t);const o=Rt((n,s)=>{n==="UiUxReady"&&s==="true"&&(cn(t),o())},"UiUxReady");(async()=>await et(t))(),Tt(),setTimeout(()=>{ft("#infinite_image_browsing_container_wrapper iframe",["user.css","uiux-iibrowser.css"])},3e3)}async function ln(){try{At(),console.log("Starting DOM Optimizations"),Xt(),Wt(),console.log("Finishing DOM Optimizations"),gt(xt),D.gradio_major>3&&ht("style.css","style-gradio-4.css",document.body),(async()=>(await qt(),await an()))()}catch(t){console.error("Error in run sequence:",t)}}function un(){if(localStorage.setItem("UiUxReady","false"),localStorage.setItem("UiUxComplete","false"),!document.getElementById("logger_screen")){const o=document.createElement("div");o.id="logger_screen",o.style="position: fixed; inset: 0; background-color: black; z-index: 99999; display: flex; flex-direction: column; overflow:auto;";const n=document.createElement("div");n.id="loggerUiUx",o.append(n),document.body.append(o)}const t=new MutationObserver(async()=>{if(Ve()&&window.opts&&Object.keys(window.opts).length){t.disconnect();try{await ln()}catch(n){console.error("Error running the function:",n)}}}),e=j();e?t.observe(e,{childList:!0,subtree:!0}):console.error("getGradioApp() did not return a valid target for observation")}un();