| 1 |
import{b as l,a as S}from"./constant-CWUMdlVX.js";import{__tla as A}from"./config-DRcPrVwf.js";import{__tla as I}from"./build-CgNAQheS.js";import{__tla as O}from"./oxide_parser_wasm-B0b9k-jb.min.js";import{g as P,l as W}from"./intellisense-BK8U5f4A.js";import{l as q}from"./logger-BTW-zIW3.js";import{c as z}from"./index.browser-CJrp5d7n.min.js";import{__tla as T}from"./monaco-editor-BsKw__A9.min.js";Promise.all([(()=>{try{return A}catch{}})(),(()=>{try{return I}catch{}})(),(()=>{try{return O}catch{}})(),(()=>{try{return T}catch{}})()]).then(async()=>{const m=()=>z("1234567890abcdefghijklmnopqrstuvwxyz",6)();function $(){let r=m();for(;r.match(/^\d/);)r=m();return`windpress${r}`}async function v(){l.$_state.globalVariables=l.$_state.globalVariables.filter(n=>n.category!=="windpress"),l.$_state.globalVariablesCategories.find(n=>n.id==="windpress")||l.$_state.globalVariablesCategories.push({id:"windpress",name:"WindPress"});const r=await S.contentWindow.wp.hooks.applyFilters("windpress.module.design_system.main_css");(await P(await W(r))).forEach(n=>{l.$_state.globalVariables.push({id:$(),name:n.key.substring(2),value:n.value,category:"windpress"})})}new BroadcastChannel("windpress").addEventListener("message",async r=>{const n=r.data;n.source==="windpress/autocomplete"&&n.task==="windpress.main_css.saved.done"&&setTimeout(()=>{v()},1e3)}),v();function C(){var g,E,k,L;if(l.$_state.activePanel!=="element"||!((E=(g=l.$_state)==null?void 0:g.activeElement)!=null&&E.id)||!((k=S)!=null&&k.contentWindow))return;const r=document.querySelector(".expand .options-wrapper"),n=r==null?void 0:r.querySelector(".searchable"),c=r==null?void 0:r.querySelector(".dropdown"),p=c==null?void 0:c.querySelectorAll(".variable-picker-item:not(.title)"),a=(L=document.querySelector(".variable-picker-button.open"))==null?void 0:L.previousElementSibling;if(!a||!(p!=null&&p.length)||!r||!c||!n)return;const x=e=>{var t;const o=((t=e.querySelector("span:first-of-type"))==null?void 0:t.textContent)??"";!a||!o||y(h(o))},j=e=>{var s;const o=((s=e.querySelector("span:first-of-type"))==null?void 0:s.textContent)??"";if(!a||!o)return;const t=h(o);a.value=t,a.click()},M=(e,o)=>{e.forEach(t=>{t.isIntersecting&&!t.target.classList.contains("open")&&t.target.click()})},f=()=>{y(V);const e=a.nextElementSibling;_.observe(e),r.removeEventListener("mouseleave",f)},w=(e,o)=>{e.forEach(t=>{const[s,d]=Object.entries(t)[0]||[];o.insertAdjacentHTML("beforeend",` |
| 2 |
<li class="variable-picker-item"> |
| 3 |
<span>${s}</span> |
| 4 |
<span class="option-value">${d}</span> |
| 5 |
</li> |
| 6 |
`)}),i.querySelectorAll(".variable-picker-item").forEach(t=>{t.addEventListener("mouseenter",()=>x(t)),t.addEventListener("click",()=>j(t))})},y=e=>{a.value=e,a.dispatchEvent(new Event("input")),a.focus()},h=e=>`var(--${e})`,u=[];c.remove(),p.forEach(e=>{var s,d;const o=((s=e.querySelector("span:first-of-type"))==null?void 0:s.textContent)??"",t=((d=e.querySelector("span.option-value"))==null?void 0:d.textContent)??"";u.push({[o]:t})});const i=document.createElement("ul");i.classList.add("custom-dropdown"),i.setAttribute("style",` |
| 7 |
max-height: calc(32px * 10); |
| 8 |
overflow: hidden; |
| 9 |
overflow-y: auto; |
| 10 |
position: relative; |
| 11 |
scrollbar-color: rgba(0, 0, 0, .4) rgba(0, 0, 0, .2); |
| 12 |
scrollbar-width: thin; |
| 13 |
`),w(u,i),r.appendChild(i),n.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation()}),n.addEventListener("input",e=>{const o=u.filter(t=>{var s;return(((s=Object.keys(t)[0])==null?void 0:s.toLowerCase())??"").includes(n.value.toLowerCase())});i.innerHTML="",w(o,i)});let V=(a==null?void 0:a.value)??" ";const _=new IntersectionObserver(M,{root:a.parentElement});r.addEventListener("mouseleave",f),_.disconnect()}const b=document.querySelector("#bricks-panel-inner:not(div.bricks-control-popup *)");if(!b)throw q("Inner panel not found, can't initialize preview of variables on hover",{module:"variables",type:"error"}),new Error("Inner panel not found, can't initialize preview of variables on hover");new MutationObserver(C).observe(b,{subtree:!0,childList:!0,attributes:!0}),q("Module loaded!",{module:"variables"})}); |
| 14 |
|