| 1 |
(function(){"use strict";const Pr="desktop-mode";function ni(){return window.wp?.i18n}function d(s,e=Pr){return ni()?.__(s,e)??s}function j(s,...e){const t=ni()?.sprintf;if(t)return t(s,...e);let o=0;return s.replace(/%(?:(\d+)\$)?[sd]/g,(i,n)=>{const r=n?Number.parseInt(n,10)-1:o++;return String(e[r]??"")})}function c(s,...e){return{__wpdHtml:!0,strings:s,values:e}}function zr(s){return!!s&&s.__wpdHtml===!0}const Ir="$$wpd$$",D=/\$\$wpd\$\$(\d+)\$\$/g;function Mr(s){let e=s[0];for(let t=1;t<s.length;t++)e+=`${Ir}${t-1}$$`+s[t];return e}const ri=new WeakMap;function ai(s){const e=ri.get(s);if(e)return e;const t=document.createElement("template");t.innerHTML=Mr(s);const o=[],i=(a,l)=>{if(a.nodeType===Node.ELEMENT_NODE){const p=a;for(const m of Array.from(p.attributes)){const _=m.name,b=m.value,y=_[0];if(D.test(b))if(D.lastIndex=0,y==="@"){const v=D.exec(b);D.lastIndex=0,o.push({path:l,kind:"event",name:_.slice(1),valueIndex:v?Number(v[1]):0}),p.removeAttribute(_)}else if(y==="."){const v=D.exec(b);D.lastIndex=0,o.push({path:l,kind:"prop",name:_.slice(1),valueIndex:v?Number(v[1]):0}),p.removeAttribute(_)}else if(y==="?"){const v=D.exec(b);D.lastIndex=0,o.push({path:l,kind:"bool",name:_.slice(1),valueIndex:v?Number(v[1]):0}),p.removeAttribute(_)}else{const v=[],f=[];let g=0,x;for(D.lastIndex=0;(x=D.exec(b))!==null;)v.push(b.slice(g,x.index)),f.push(Number(x[1])),g=x.index+x[0].length;v.push(b.slice(g)),o.push({path:l,kind:"attr",name:_,template:v,valueIndices:f}),p.setAttribute(_,"")}}}const u=Array.from(a.childNodes);let h=0;for(let p=0;p<u.length;p++){const m=u[p],_=p+h;if(m.nodeType===Node.TEXT_NODE){const b=m.textContent||"";if(!D.test(b)){D.lastIndex=0;continue}D.lastIndex=0;const y=m.parentNode;let v=0,f;const g=[],x=[];for(D.lastIndex=0;(f=D.exec(b))!==null;){f.index>v&&g.push(document.createTextNode(b.slice(v,f.index)));const A=document.createTextNode("");g.push(A),x.push({path:[...l,_+g.length-1],kind:"node",valueIndex:Number(f[1])}),v=f.index+f[0].length}v<b.length&&g.push(document.createTextNode(b.slice(v)));for(const A of g)y.insertBefore(A,m);y.removeChild(m),h+=g.length-1,o.push(...x)}else i(m,[...l,_])}};i(t.content,[]);const r={template:t,buildParts:a=>{const l=[];for(const u of o){let h=a;for(const p of u.path)h=h.childNodes[p];u.kind==="node"?l.push({kind:"node",valueIndex:u.valueIndex,child:{anchor:h,state:null}}):u.kind==="attr"?l.push({kind:"attr",element:h,name:u.name,template:u.template,valueIndices:u.valueIndices}):u.kind==="event"?l.push({kind:"event",valueIndex:u.valueIndex,element:h,name:u.name}):u.kind==="prop"?l.push({kind:"prop",valueIndex:u.valueIndex,element:h,name:u.name}):u.kind==="bool"&&l.push({kind:"bool",valueIndex:u.valueIndex,element:h,name:u.name})}return l}};return ri.set(s,r),r}const li=new WeakMap;function Dr(s,e){for(const t of s.nodes)if(t.parentNode!==e)return!1;return!0}function L(s,e){const t=li.get(e);if(t&&t.strings===s.strings&&Dr(t,e)){Nt(t.parts,s.values);return}const o=ai(s.strings),i=o.template.content.cloneNode(!0),n=o.buildParts(i),r=Array.from(i.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(i),Nt(n,s.values),li.set(e,{strings:s.strings,parts:n,nodes:r})}function Nt(s,e){for(const t of s)if(t.kind==="node")ls(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let o=t.template[0];for(let i=0;i<t.valueIndices.length;i++)o+=ci(e[t.valueIndices[i]]),o+=t.template[i+1];o!==t.last&&(t.last=o,o===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,o))}else if(t.kind==="event"){const o=e[t.valueIndex];o!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),o&&t.element.addEventListener(t.name,o),t.current=o)}else if(t.kind==="prop"){const o=e[t.valueIndex];o!==t.last&&(t.last=o,t.element[t.name]=o)}else if(t.kind==="bool"){const o=!!e[t.valueIndex];o!==t.last&&(t.last=o,o?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function ls(s,e){if(e==null||e===!1){s.state&&(ne(s.state),s.state=null);return}if(Array.isArray(e)){Ur(s,e);return}if(zr(e)){qr(s,e);return}if(e instanceof Node){Nr(s,e);return}Hr(s,ci(e))}function Nr(s,e){const t=s.state;t?.shape==="node"&&t.node===e||(t&&ne(t),Ht(s,[e]),s.state={shape:"node",node:e})}function Hr(s,e){const t=s.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&ne(t);const o=document.createTextNode(e);Ht(s,[o]),s.state={shape:"text",node:o,text:e}}function qr(s,e){const t=s.state;if(t?.shape==="template"&&t.strings===e.strings){Nt(t.parts,e.values);return}t&&ne(t);const o=ai(e.strings),i=o.template.content.cloneNode(!0),n=o.buildParts(i),r=Array.from(i.childNodes);Ht(s,[i]),Nt(n,e.values),s.state={shape:"template",strings:e.strings,parts:n,nodes:r}}function Ur(s,e){const t=s.state;if(t?.shape==="array"&&t.entries.length===e.length){for(let i=0;i<e.length;i++)ls(t.entries[i],e[i]);return}t&&ne(t);const o=[];for(const i of e){const n=document.createTextNode("");Ht(s,[n]);const r={anchor:n,state:null};ls(r,i),o.push(r)}s.state={shape:"array",entries:o}}function Ht(s,e){const t=s.anchor.parentNode;if(t)for(const o of e)t.insertBefore(o,s.anchor)}function ne(s){if(s.shape==="text"){s.node.remove();return}if(s.shape==="template"){for(const e of s.parts)e.kind==="node"&&e.child.state&&(ne(e.child.state),e.child.state=null);for(const e of s.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(s.shape==="node"){s.node.parentNode&&s.node.parentNode.removeChild(s.node);return}for(const e of s.entries)e.state&&ne(e.state),e.anchor.remove()}function ci(s){return s==null||s===!1?"":String(s)}const oe=class oe extends HTMLElement{constructor(){super(),this._renderScheduled=!1,this._propValues={},this.constructor.shadow?(this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot):this._renderRoot=this,this._installPropAccessors()}static get observedAttributes(){return this.props.map(di)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,o){if(t===o)return;const i=Fr(e);this._propValues[i]=o,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const o=(Array.isArray(e)?e:String(e).split(/\s+/)).map(i=>String(i).trim()).filter(i=>i!=="");this.className=o.join(" ")}requestUpdate(){this._scheduleRender()}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const t of e.props){if(Object.getOwnPropertyDescriptor(this,t))continue;const o=di(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(o),set:i=>{let n;i==null||i===!1?n=null:i===!0?n="":n=String(i),this._propValues[t]=n,n===null?this.removeAttribute(o):this.setAttribute(o,n),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&L(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(o=>o.sheet).filter(o=>o!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const o of e.styles)if(!o.sheet){const i=document.createElement("style");i.textContent=o.cssText,this.shadowRoot.appendChild(i)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!oe._lightStylesAdopted.has(e)){oe._lightStylesAdopted.add(e);for(const t of e.styles){const o=document.createElement("style");o.dataset.osUi=this.tagName.toLowerCase(),o.textContent=t.cssText,document.head.appendChild(o)}}}};oe.props=[],oe.styles=[],oe.shadow=!0,oe._lightStylesAdopted=new WeakSet;let k=oe;function $(s,e){customElements.get(s)||customElements.define(s,e)}function di(s){return s.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function Fr(s){return s.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const Wr=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function w(s,...e){let t=s[0];for(let o=1;o<s.length;o++){const i=e[o-1];if(typeof i=="string"||typeof i=="number")t+=String(i);else if(i&&i.__wpdCss)t+=i.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof i);t+=s[o]}if(Wr){const o=new CSSStyleSheet;return o.replaceSync(t),{__wpdCss:!0,sheet:o,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function jr(s){const e=[],t=[];let o=null,i=s.parentElement;for(;i&&!(i===document.body||i===document.documentElement);){const r=i.id||"";if(r.startsWith("wp-window-")){o=r.slice(10);break}if(i.tagName.toLowerCase()==="os-tabpanel"){const a=i.getAttribute("for");a&&t.unshift(a)}i=i.parentElement}o&&e.push(cs(o));for(const r of t)e.push("tab-"+cs(r));const n=s.getAttribute("label");return n&&e.push(cs(n)),e.length===0?"os-unnamed":"os-"+e.filter(r=>r!=="").join("-")}function cs(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ge(s){if(s.id)return s.id;const e=jr(s);return s.id=e,e}const ui={close:{a:'fill="currentColor"',b:'<path d="m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z" />'},check:{a:'fill="currentColor"',b:'<path d="M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" />'},"chevron-right":{a:'fill="currentColor"',b:'<path d="M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" />'},"arrow-up-right":{a:'fill="currentColor"',b:'<path d="M10 6H18V14H16.5V8.5L7 18L6 17L15.5 7.5H10V6Z" />'},plus:{a:'fill="currentColor"',b:'<path d="M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" />'},search:{a:'fill="currentColor"',b:'<path d="M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" />'},pin:{a:'fill="currentColor"',b:'<path d="m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z" />'},trash:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" />'},download:{a:'fill="currentColor"',b:'<path d="M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" />'},settings:{a:'fill="currentColor"',b:'<path d="m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" /><path d="m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" />'},info:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" />'},bell:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M17 11.5c0 1.353.17 2.368.976 3 .266.209.602.376 1.024.5v1H5v-1c.422-.124.757-.291 1.024-.5.806-.632.976-1.647.976-3V9c0-2.8 2.2-5 5-5s5 2.2 5 5v2.5ZM15.5 9v2.5c0 .93.066 1.98.515 2.897l.053.103H7.932a4.018 4.018 0 0 0 .053-.103c.449-.917.515-1.967.515-2.897V9c0-1.972 1.528-3.5 3.5-3.5s3.5 1.528 3.5 3.5Zm-5.492 9.008c0-.176.023-.346.065-.508h3.854A1.996 1.996 0 0 1 12 20c-1.1 0-1.992-.892-1.992-1.992Z" />'},more:{a:'fill="currentColor"',b:'<path d="M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z" />'},maximize:{a:'fill="currentColor"',b:'<path d="M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" />'},edit:{a:'fill="currentColor"',b:'<path d="m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" />'},color:{a:'fill="currentColor"',b:'<path d="M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" />'},wallpaper:{a:'fill="currentColor"',b:'<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" />'},warning:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-.75 12v-1.5h1.5V16h-1.5Zm0-8v5h1.5V8h-1.5Z" />'},minimize:{a:'fill="currentColor"',b:'<path d="M5 11.25h14v1.5H5z" />'},window:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="4.125" y="5.4375" width="15.75" height="13.125" rx="1.75"/><path d="M4.125 9.8125h15.75"/><circle cx="7.275" cy="7.625" r="0.7438" fill="currentColor" stroke="none"/>'},windows:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="8.5" width="11.375" height="10.0625" rx="1.75"/><path d="M3.6875 12h11.375"/><path d="M8.5 8.5V7.1875a1.75 1.75 0 0 1 1.75-1.75h7.875A1.75 1.75 0 0 1 19.875 7.1875v7a1.75 1.75 0 0 1-1.75 1.75h-3.0625"/>'},dock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.25" y="8.5" width="17.5" height="7" rx="3.5"/><circle cx="7.625" cy="12" r="1.0062" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.0062" fill="currentColor" stroke="none"/><circle cx="16.375" cy="12" r="1.0062" fill="currentColor" stroke="none"/>'},spaces:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="5.4375" width="7.4375" height="7.875" rx="1.75"/><rect x="12.875" y="5.4375" width="7.4375" height="7.875" rx="1.75"/><circle cx="9.375" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/><circle cx="12" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/><circle cx="14.625" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/>'},copilot:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<path d="M10 2.5Q10.9 8.5 17.5 10Q10.9 11.5 10 17.5Q9.1 11.5 2.5 10Q9.1 8.5 10 2.5Z" fill="currentColor" stroke="none"/><path d="M17.9 14Q18.35 17.1 21.5 17.6Q18.35 18.1 17.9 21.2Q17.45 18.1 14.3 17.6Q17.45 17.1 17.9 14Z" fill="currentColor" stroke="none"/>'},snap:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="5.4375" width="16.625" height="13.125" rx="1.75"/><path d="M12 5.4375v13.125"/><path d="M12 12h8.3125"/>'},command:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<path d="M14.625 6.75v10.5a2.625 2.625 0 1 0 2.625-2.625H6.75a2.625 2.625 0 1 0 2.625 2.625V6.75a2.625 2.625 0 1 0-2.625 2.625h10.5a2.625 2.625 0 1 0-2.625-2.625"/>'},apps:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="4.125" y="4.125" width="6.5625" height="6.5625" rx="1.75"/><rect x="13.3125" y="4.125" width="6.5625" height="6.5625" rx="1.75"/><rect x="4.125" y="13.3125" width="6.5625" height="6.5625" rx="1.75"/><rect x="13.3125" y="13.3125" width="6.5625" height="6.5625" rx="1.75"/>'},widgets:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="3.6875" width="9.625" height="9.625" rx="1.75"/><rect x="15.0625" y="3.6875" width="5.25" height="5.25" rx="1.75"/><rect x="15.0625" y="10.6875" width="5.25" height="9.625" rx="1.75"/><rect x="3.6875" y="15.0625" width="9.625" height="5.25" rx="1.75"/>'},user:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<circle cx="12" cy="8.9375" r="3.5"/><path d="M5.4375 19.4375a6.5625 6.5625 0 0 1 13.125 0"/>'},lock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="5.4375" y="10.6875" width="13.125" height="8.75" rx="1.75"/><path d="M8.5 10.6875V8.0625a3.5 3.5 0 0 1 7 0v2.625"/>'}};function hi(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Vr(s){return Object.prototype.hasOwnProperty.call(ui,s)?ui[s]:null}function Or(s,e={}){const t=Vr(s);if(!t)return"";const{size:o=24,className:i,title:n,rotate:r}=e,a=['xmlns="http://www.w3.org/2000/svg"','viewBox="0 0 24 24"'];o!=null&&a.push(`width="${o}"`,`height="${o}"`),a.push(t.a),i&&a.push(`class="${hi(i)}"`),n?a.push('role="img"',`aria-label="${hi(n)}"`):a.push('aria-hidden="true"','focusable="false"');const l=r?`<g transform="rotate(${r} 12 12)">${t.b}</g>`:t.b;return`<svg ${a.join(" ")}>${l}</svg>`}function z(s,e={}){const t=Or(s,e),o=document.createElement("div");o.innerHTML=t;const i=o.firstElementChild;return i instanceof SVGSVGElement?i:document.createElementNS("http://www.w3.org/2000/svg","svg")}const R=w`:host{--_holo-fill:var( --os-ui-holo-fill,${"linear-gradient( 124deg, #afa2e8 0%, #f5a8ea 46%, #8ee9f7 100% )"} );--_holo-ink:var( --os-ui-holo-ink,#0c0b0f );--_holo-sheen:var( --os-ui-holo-sheen,linear-gradient( 124deg,rgba( 159,214,255,0.1 ) 0%,rgba( 236,155,255,0.12 ) 34%,rgba( 242,82,252,0.1 ) 58%,rgba( 147,240,198,0.09 ) 100% ) );--_holo-edge:var( --os-ui-holo-edge,linear-gradient( 124deg,rgba( 154,242,255,0.7 ) 0%,rgba( 236,155,255,0.85 ) 38%,rgba( 242,82,252,0.7 ) 62%,rgba( 159,152,255,0.6 ) 100% ) );--_holo-edge-quiet:var( --os-ui-holo-edge-quiet,linear-gradient( 124deg,rgba( 154,242,255,0.22 ) 0%,rgba( 236,155,255,0.28 ) 38%,rgba( 242,82,252,0.22 ) 62%,rgba( 159,152,255,0.2 ) 100% ) );--_holo-glow:var( --os-ui-holo-glow,0 0 0 1px rgba( 242,82,252,0.28 ),0 2px 10px rgba( 242,82,252,0.22 ) );--_holo-glow-strong:var( --os-ui-holo-glow-strong,0 0 0 1px rgba( 242,82,252,0.42 ),0 4px 18px rgba( 242,82,252,0.38 ),0 1px 3px rgba( 12,11,15,0.6 ) );--_holo-track:var( --os-ui-holo-track,rgba( 255,251,255,0.16 ) );--_holo-track-edge:var( --os-ui-holo-track-edge,#8c8f94 );--_holo-ring-color:var( --os-ui-accent-dim,#2271b1 );--_holo-focus:var( --os-ui-focus-ring,0 0 0 2px rgba( 12,11,15,0.9 ),0 0 0 4px #f252fc,0 0 12px 2px rgba( 242,82,252,0.45 ) );--_holo-focus-field:var( --os-ui-focus-ring-field,0 0 0 1px #f252fc,0 0 0 4px rgba( 242,82,252,0.18 ) );--_holo-t:var( --os-ui-holo-transition,220ms );--_holo-t-fast:var( --os-ui-motion-fast,140ms );--_holo-t-slow:var( --os-ui-motion-slow,340ms );--_holo-t-ambient:var( --os-ui-motion-ambient,12s );--_holo-spring:var( --os-ui-ease-spring,cubic-bezier( 0.32,1.5,0.55,1 ) );--_holo-ease:var( --os-ui-ease-out,cubic-bezier( 0.22,0.9,0.28,1 ) );--_holo-loop:var( --os-ui-ease-loop,cubic-bezier( 0.45,0,0.55,1 ) )}`,Kr=w` .os-holo-fill{background-color:transparent;background-image:var( --_holo-fill );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;color:var( --_holo-ink );transition:background-position var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,filter var( --_holo-t ) ease}.os-holo-fill:hover{background-position:74% 66%}.os-holo-fill:active{background-position:88% 82%;filter:brightness( 0.94 )}@media ( prefers-reduced-motion:reduce ){.os-holo-fill{transition-duration:1ms}.os-holo-fill:hover,.os-holo-fill:active{background-position:22% 28%}}`,qt=w` .os-holo-sheen{position:relative;isolation:isolate}.os-holo-sheen::before{content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;background-image:var( --_holo-sheen );background-size:200% 200%;background-position:20% 30%;opacity:0;pointer-events:none;transition:opacity var( --_holo-t ) ease,background-position var( --_holo-t ) ease}.os-holo-sheen:hover::before,.os-holo-sheen:focus-visible::before{opacity:1;background-position:76% 68%}@media ( prefers-reduced-motion:reduce ){.os-holo-sheen::before{transition-duration:1ms}.os-holo-sheen:hover::before,.os-holo-sheen:focus-visible::before{background-position:20% 30%}}`,pi=w` .os-holo-edge{position:relative}.os-holo-edge::after{content:'';position:absolute;inset:0;border-radius:inherit;padding:1px;background-image:var( --_holo-edge-quiet );opacity:0;pointer-events:none;-webkit-mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );mask-composite:exclude;transition:opacity var( --_holo-t ) ease}.os-holo-edge:hover::after,.os-holo-edge:focus-visible::after{background-image:var( --_holo-edge );opacity:1}.os-holo-edge.is-lit::after{background-image:var( --_holo-edge );opacity:1}@media ( prefers-reduced-motion:reduce ){.os-holo-edge::after{transition-duration:1ms}}`,Ut=w` .os-holo-glint{position:absolute;inset:0;border-radius:inherit;overflow:hidden;pointer-events:none}.os-holo-glint::before{content:'';position:absolute;top:-60%;bottom:-60%;width:45%;inset-inline-start:-60%;background:linear-gradient( 90deg,transparent 0%,rgba( 255,251,255,0.14 ) 45%,rgba( 255,251,255,0.22 ) 50%,rgba( 255,251,255,0.14 ) 55%,transparent 100% );transform:rotate( 18deg ) translateX( 0 );opacity:0}:hover>.os-holo-glint::before,:focus-visible>.os-holo-glint::before,:host(:hover )>.os-holo-glint::before,:host(:focus-visible )>.os-holo-glint::before{animation:os-holo-glint var( --_holo-t-slow ) var( --_holo-ease )}@keyframes os-holo-glint{0%{opacity:0;transform:rotate( 18deg ) translateX( 0 )}15%{opacity:1}85%{opacity:1}100%{opacity:0;transform:rotate( 18deg ) translateX( 240vw )}}@media ( prefers-reduced-motion:reduce ){:hover>.os-holo-glint::before,:focus-visible>.os-holo-glint::before,:host(:hover )>.os-holo-glint::before,:host(:focus-visible )>.os-holo-glint::before{animation:none}}`,ds=w` .os-holo-ring{position:absolute;inset:0;border-radius:inherit;box-shadow:0 0 0 0 var( --_holo-ring-color );opacity:0;pointer-events:none}:active:not(:disabled )>.os-holo-ring,:host(:active:not( [ disabled ] ) )>.os-holo-ring{animation:os-holo-ring var( --_holo-t-slow ) var( --_holo-ease )}@keyframes os-holo-ring{0%{opacity:0.45;box-shadow:0 0 0 0 var( --_holo-ring-color )}100%{opacity:0;box-shadow:0 0 0 10px transparent}}@media ( prefers-reduced-motion:reduce ){:active:not(:disabled )>.os-holo-ring,:host(:active:not( [ disabled ] ) )>.os-holo-ring{animation:none}}`,fi=w` .os-holo-shimmer{background-image:var( --_holo-fill );background-size:300% 300%;background-repeat:no-repeat;animation:os-holo-shimmer 2.4s var( --_holo-loop ) infinite}@keyframes os-holo-shimmer{0%{background-position:0% 50%}100%{background-position:100% 50%}}@media ( prefers-reduced-motion:reduce ){.os-holo-shimmer{animation:none;background-position:30% 50%}}`,us=w` .os-holo-enter{animation:os-holo-enter var( --_holo-t ) var( --_holo-spring )}@keyframes os-holo-enter{from{opacity:0;transform:scale( 0.96 )}}@media ( prefers-reduced-motion:reduce ){.os-holo-enter{animation:none}}`,hs=w` input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ),select,textarea{transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):hover:not(:disabled ),select:hover:not(:disabled ),textarea:hover:not(:disabled ){border-color:var( --os-ui-border-strong,#8c8f94 )}input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):focus,input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):focus-visible,select:focus,select:focus-visible,textarea:focus,textarea:focus-visible{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}input::placeholder,textarea::placeholder{color:var( --os-ui-fg-faint,#8c8f94 );opacity:1}input::selection,textarea::selection{background:var( --os-ui-selection-bg,rgba( 159,152,255,0.6 ) );color:var( --os-ui-selection-fg,#fffbff )}@media ( prefers-reduced-motion:reduce ){input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ),select,textarea{transition-duration:1ms}}`,Ft=w` input[ type='checkbox' ],input[ type='radio' ]{appearance:none;-webkit-appearance:none;position:relative;flex:0 0 auto;box-sizing:border-box;width:16px;height:16px;margin:0;padding:0;border:1px solid var( --_holo-track-edge );border-radius:4px;background-color:var( --_holo-track );background-image:none;background-repeat:no-repeat;cursor:inherit;transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='radio' ]{border-radius:50%}input[ type='checkbox' ]:hover:not(:disabled ),input[ type='radio' ]:hover:not(:disabled ){border-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:focus-visible,input[ type='radio' ]:focus-visible{outline:none;box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked,input[ type='checkbox' ]:indeterminate,input[ type='radio' ]:checked{border-color:transparent;background-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:checked:focus-visible,input[ type='radio' ]:checked:focus-visible{box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:46%;width:3.5px;height:7.5px;border:solid var( --os-ui-fg-on-accent,#fff );border-width:0 2px 2px 0;transform:translate( -50%,-50% ) rotate( 45deg );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:indeterminate::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:8px;height:2px;border:0;border-radius:1px;background:var( --os-ui-fg-on-accent,#fff );transform:translate( -50%,-50% )}input[ type='radio' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:6px;height:6px;border-radius:50%;background:var( --os-ui-fg-on-accent,#fff );transform:translate( -50%,-50% );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:disabled,input[ type='radio' ]:disabled{cursor:not-allowed}@keyframes os-holo-tick{from{opacity:0;transform:translate( -50%,-50% ) rotate( 45deg ) scale( 0.4 )}}@media ( prefers-reduced-motion:reduce ){input[ type='checkbox' ]:checked::after,input[ type='radio' ]:checked::after{animation:none}}`,gi=w` @keyframes os-holo-drift{0%{background-position:16% 26%}50%{background-position:84% 74%}100%{background-position:16% 26%}}.os-holo-alive{animation:os-holo-drift var( --_holo-t-ambient ) var( --_holo-loop ) infinite}@media ( prefers-reduced-motion:reduce ){.os-holo-alive{animation:none}}`;w` ${R} ${Kr} ${qt} ${pi} ${Ut} ${ds} ${fi} ${us} ${hs} ${Ft} ${gi} `;const Br=w` ${R} ${qt} ${pi} ${Ut} ${ds} ${gi}:host{display:inline-flex}:host( [ fill-cell ] ){display:flex;width:100%}button{appearance:none;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:var( --os-ui-button-padding,6px 12px );border-radius:var( --os-ui-button-border-radius,6px );font:inherit;font-weight:500;cursor:pointer;transition:background-color var( --_holo-t ) ease,color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,transform 80ms ease;background:var( --os-ui-button-bg,transparent );background-image:var( --os-ui-button-bg-image,none );background-repeat:var( --os-ui-button-bg-image-repeat,repeat );background-size:var( --os-ui-button-bg-image-size,auto );background-position:var( --os-ui-button-bg-image-position,center );color:var( --os-ui-button-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-button-border,1px solid var( --os-ui-border,#c3c4c7 ) )}:host( [ fill-cell ] ) button{width:100%;min-height:var( --os-ui-button-min-height,44px )}button:disabled{opacity:0.5;cursor:not-allowed}button:active:not(:disabled ){transform:translateY( 1px )}button:hover:not(:disabled ){background-color:var( --os-ui-button-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}button:disabled::before,button:disabled::after,button:disabled .os-holo-glint{opacity:0 !important}:host( [ variant='primary' ] ) button{background-color:var( --os-ui-button-bg,var( --wp-admin-theme-color,#2271b1 ) );color:var( --os-ui-button-fg,var( --os-ui-fg-on-accent,#fff ) );border:var( --os-ui-button-border,1px solid transparent )}:host( [ variant='primary' ] ) button:hover:not(:disabled ){filter:brightness( 1.06 );background-color:var( --os-ui-button-bg,var( --wp-admin-theme-color,#2271b1 ) );box-shadow:var( --_holo-glow )}:host( [ variant='holo' ] ) button{background-color:transparent;background-image:var( --_holo-fill );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;color:var( --os-ui-button-fg,var( --_holo-ink ) );border:var( --os-ui-button-border,1px solid transparent );box-shadow:var( --_holo-glow );font-weight:600;transition:background-position var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,filter var( --_holo-t ) ease,transform 80ms ease}:host( [ variant='holo' ] ) button:hover:not(:disabled ){background-color:transparent;background-position:74% 66%;box-shadow:var( --_holo-glow-strong )}:host( [ variant='holo' ] ) button:active:not(:disabled ){background-position:88% 82%;filter:brightness( 0.94 )}:host( [ variant='holo' ] ) button::before{display:none}@media ( prefers-reduced-motion:reduce ){:host( [ variant='holo' ] ) button:hover:not(:disabled ),:host( [ variant='holo' ] ) button:active:not(:disabled ){background-position:22% 28%}}:host( [ variant='secondary' ] ) button{background-color:var( --os-ui-button-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );color:var( --os-ui-button-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-button-border,1px solid transparent )}:host( [ variant='secondary' ] ) button:hover:not(:disabled ){background-color:var( --os-ui-button-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.1 ) ) )}:host( [ variant='danger' ] ) button{background-color:var( --os-ui-button-bg,transparent );color:var( --os-ui-button-fg,var( --os-ui-danger,#d63638 ) );border:var( --os-ui-button-border,1px solid currentColor )}:host( [ variant='danger' ] ) button:hover:not(:disabled ){background-color:var( --os-ui-danger,#d63638 );color:var( --os-ui-fg-on-accent,#fff )}:host( [ variant='danger' ] ) button::after{display:none}:host( [ variant='link' ] ) button{background-color:transparent;background-image:none;color:var( --os-ui-button-fg,var( --wp-admin-theme-color,#2271b1 ) );border:0;padding:0;text-decoration:underline}:host( [ variant='link' ] ) button::before,:host( [ variant='link' ] ) button::after,:host( [ variant='link' ] ) .os-holo-glint,:host( [ variant='link' ] ) .os-holo-ring{display:none}:host( [ variant='link' ] ) button:active:not(:disabled ){transform:none}:host( [ busy ] ) button{pointer-events:none;opacity:0.75}:host( [ variant='holo' ][ busy ] ) button{animation:os-holo-drift 12s ease-in-out infinite}@media ( prefers-reduced-motion:reduce ){:host( [ variant='holo' ][ busy ] ) button{animation:none}}.os-button__spinner{box-sizing:border-box;display:inline-block;width:12px;height:12px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:os-button-spin 0.6s linear infinite;flex-shrink:0}@keyframes os-button-spin{to{transform:rotate( 360deg )}}`,Ce=class Ce extends k{render(){const e=this.disabled!==null,t=this.busy!==null,o=this.type||"button";return c` |
| 2 |
<button |
| 3 |
part="button" |
| 4 |
class="os-holo-edge os-holo-sheen" |
| 5 |
type=${o} |
| 6 |
?disabled=${e||t} |
| 7 |
aria-busy=${t?"true":"false"} |
| 8 |
> |
| 9 |
${t?c`<span class="os-button__spinner" aria-hidden="true"></span>`:""} |
| 10 |
<slot></slot> |
| 11 |
<!-- |
| 12 |
The two motion layers. Elements rather than |
| 13 |
pseudo-elements because the sheen and the hairline |
| 14 |
have already taken this button's ::before and |
| 15 |
::after — see the pseudo-element budget note in |
| 16 |
src/ui/holo.ts. Both are inert and aria-hidden. |
| 17 |
--> |
| 18 |
<span class="os-holo-glint" aria-hidden="true"></span> |
| 19 |
<span class="os-holo-ring" aria-hidden="true"></span> |
| 20 |
</button> |
| 21 |
`}};Ce.props=["variant","disabled","type","busy","fill-cell"],Ce.styles=[Br],Ce.help=void 0;let ps=Ce;$("os-button",ps);const Gr=w` ${R} ${Ft}:host{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var( --os-ui-fg,#1d2327 );cursor:pointer;-webkit-user-select:none;user-select:none}label{display:inline-flex;align-items:center;gap:8px;cursor:pointer}:host( [ disabled ] ){opacity:0.5;cursor:not-allowed}:host( [ disabled ] ) label,:host( [ disabled ] ) input[ type='checkbox' ]{cursor:not-allowed}`,Se=class Se extends k{render(){const e=this.label||"",t=this.checked!==null,o=this.disabled!==null;return c` |
| 22 |
<label> |
| 23 |
<input |
| 24 |
type="checkbox" |
| 25 |
?checked=${t} |
| 26 |
?disabled=${o} |
| 27 |
@change=${i=>this._onChange(i)} |
| 28 |
/> |
| 29 |
<span class="os-checkbox-label__text">${e}</span> |
| 30 |
</label> |
| 31 |
`}_onChange(e){if(this.disabled!==null)return;const t=e.target.checked;t?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:t})}};Se.props=["label","checked","disabled"],Se.styles=[Gr],Se.help=void 0;let fs=Se;$("os-checkbox-label",fs);const Xr=w` ${R}:host{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}label{display:inline-flex;align-items:center;gap:8px}input[ type='color' ]{width:28px;height:28px;padding:0;border:1px solid var( --os-ui-border,#c3c4c7 );border-radius:6px;background:transparent;cursor:pointer;transition:border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='color' ]:hover{border-color:var( --os-ui-border-strong,#8c8f94 )}input[ type='color' ]:focus-visible{outline:none;box-shadow:var( --_holo-focus )}:host( [ variant='block' ] ){display:flex;width:100%}:host( [ variant='block' ] ) label{display:flex;flex:1;align-items:center}:host( [ variant='block' ] ) input[ type='color' ]{flex:1;width:auto;height:32px}input[ type='color' ]::-webkit-color-swatch-wrapper{padding:2px}input[ type='color' ]::-webkit-color-swatch{border:none;border-radius:2px}`,Ee=class Ee extends k{open(){const e=()=>{const t=this.shadowRoot?.querySelector("input");if(!t)return!1;try{t.showPicker()}catch{t.click()}return!0};e()||queueMicrotask(()=>void e())}render(){const e=this.label||"",t=this.value||"#000000";return c` |
| 32 |
<label> |
| 33 |
<span class="os-color-field__label">${e}</span> |
| 34 |
<input |
| 35 |
type="color" |
| 36 |
.value=${t} |
| 37 |
@input=${o=>this._onInput(o)} |
| 38 |
/> |
| 39 |
</label> |
| 40 |
`}_onInput(e){const t=e.target;this.value=t.value,this.emit("os-color-change",{value:t.value})}};Ee.props=["label","value","variant"],Ee.styles=[Xr],Ee.help=void 0;let gs=Ee;$("os-color-field",gs);const Zr=w`:host{display:inline-flex;align-items:center;justify-content:center;width:var( --os-ui-icon-size,16px );height:var( --os-ui-icon-size,16px );color:inherit;line-height:1}:host( [ hidden ] ){display:none}.os-icon__glyph{font-size:var( --os-ui-icon-size,16px );width:var( --os-ui-icon-size,16px );height:var( --os-ui-icon-size,16px );line-height:1;color:inherit;display:inline-flex;align-items:center;justify-content:center}.os-icon__glyph--char{font-family:dashicons;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;speak:none}.os-icon__glyph.dashicons{font-family:dashicons}`;let Wt=null;function Yr(s){let e=s.trim();if(e==="")return null;(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));const t=e.match(/^\\([0-9a-f]{1,6})\s?$/i);return t?String.fromCodePoint(parseInt(t[1],16)):e||null}function bi(){const s=new Map;if(typeof document>"u")return s;const e=Array.from(document.styleSheets??[]);for(const t of e){let o=null;try{o=t.cssRules}catch{continue}if(o)for(const i of Array.from(o)){const n=i;if(!n||!n.selectorText)continue;const r=n.selectorText.match(/\.dashicons-([a-z0-9-]+)::?before/i);if(!r)continue;const a=n.style?.content;if(!a)continue;const l=Yr(a);l&&s.set(r[1],l)}}return s}function Jr(s){Wt||(Wt=bi());const e=s.startsWith("dashicons-")?s.slice(10):s;return Wt.get(e)??null}function Qr(){Wt=bi()}let mi=!1;function ea(){if(mi||typeof window>"u")return;mi=!0;const s=()=>{Qr()};document.readyState==="loading"&&document.addEventListener("DOMContentLoaded",s,{once:!0}),window.addEventListener("load",s,{once:!0})}ea();const Le=class Le extends k{render(){const e=this.name||"",t=e.startsWith("dashicons-")?e.slice(10):e,o=this.size;o&&/^\d+$/.test(o)&&this.style.setProperty("--os-ui-icon-size",`${o}px`);const i=Jr(t);return i?c`<span |
| 41 |
class="os-icon__glyph os-icon__glyph--char dashicons dashicons-${t}" |
| 42 |
aria-hidden="true" |
| 43 |
>${i}</span>`:c`<span |
| 44 |
class="os-icon__glyph dashicons dashicons-${t}" |
| 45 |
aria-hidden="true" |
| 46 |
></span>`}};Le.props=["name","size"],Le.styles=[Zr],Le.help=void 0;let bs=Le;$("os-icon",bs);const ta=w`:host{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:32px 24px;text-align:center;color:var( --os-ui-empty-state-fg,var( --os-ui-fg-muted,#646970 ) )}:host( [ hidden ] ){display:none}.os-empty-state__icon{margin-bottom:4px;color:var( --os-ui-empty-state-icon-color,currentColor );opacity:0.75}.os-empty-state__heading{margin:0;font-size:14px;font-weight:600;color:var( --os-ui-fg,#1d2327 )}.os-empty-state__description{margin:0;font-size:12px;line-height:1.4;max-width:48ch}.os-empty-state__description:empty{display:none}.os-empty-state__cta{margin-top:8px}.os-empty-state__cta:empty{display:none}`,Re=class Re extends k{render(){const e=this.icon||"",t=this.heading||"",o=this.description||"";return c` |
| 47 |
${e?c`<os-icon |
| 48 |
class="os-empty-state__icon" |
| 49 |
name=${e} |
| 50 |
size="28" |
| 51 |
></os-icon>`:null} |
| 52 |
<h3 class="os-empty-state__heading">${t}</h3> |
| 53 |
<p class="os-empty-state__description">${o}</p> |
| 54 |
<div class="os-empty-state__cta"> |
| 55 |
<slot name="cta"></slot> |
| 56 |
</div> |
| 57 |
<slot></slot> |
| 58 |
`}};Re.props=["icon","heading","description"],Re.styles=[ta],Re.help=void 0;let ms=Re;$("os-empty-state",ms);const sa=w`:host{display:flex;align-items:flex-start;gap:10px;width:100%;box-sizing:border-box;padding:10px 14px;font:var( --os-ui-notice-font,13px/1.5 var( --os-font,system-ui ) );color:var( --os-ui-notice-color,var( --os-ui-fg,#1d2327 ) );background:var( --os-ui-notice-bg,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) );border-block-end:1px solid var( --os-ui-notice-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );border-inline-start:4px solid var( --os-ui-notice-accent,var( --os-ui-border,#646970 ) )}:host( [ hidden ] ){display:none}.os-notice__icon{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;color:var( --os-ui-notice-accent,var( --os-ui-accent,#646970 ) )}.os-notice__icon[ hidden ]{display:none}.os-notice__label{flex:1;min-width:0;word-wrap:break-word}::slotted( a ){color:var( --os-ui-notice-link,var( --wp-admin-theme-color,#2271b1 ) );border-radius:2px}::slotted( a:hover ),::slotted( a:focus-visible ){color:var( --os-ui-notice-link-hover,var( --os-ui-accent-strong,#135e96 ) )}::slotted( a:focus-visible ){outline:2px solid var( --os-ui-notice-link-hover,var( --os-ui-accent-strong,#135e96 ) );outline-offset:2px}::slotted( p:first-child ){margin-block-start:0}::slotted( p:last-child ){margin-block-end:0}.os-notice__close{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;color:inherit;opacity:0.6;cursor:pointer;border-radius:4px;transition:opacity 0.12s ease,background-color 0.12s ease}.os-notice__close:hover{opacity:1;background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) )}.os-notice__close:focus-visible{opacity:1;outline:2px solid var( --wp-admin-theme-color,#2271b1 );outline-offset:1px}.os-notice__close[ hidden ]{display:none}.os-notice__close svg{width:14px;height:14px}:host( [ tone='info' ] ){--os-ui-notice-accent:var( --os-ui-notice-info,var( --os-ui-info-fg,#0969da ) );--os-ui-notice-bg:var( --os-ui-notice-info-bg,rgba( 9,105,218,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-info-border,rgba( 9,105,218,0.16 ) )}:host( [ tone='success' ] ){--os-ui-notice-accent:var( --os-ui-notice-success,var( --os-ui-success-fg,#1a7f37 ) );--os-ui-notice-bg:var( --os-ui-notice-success-bg,rgba( 26,127,55,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-success-border,rgba( 26,127,55,0.16 ) )}:host( [ tone='warning' ] ){--os-ui-notice-accent:var( --os-ui-notice-warning,var( --os-ui-warning-fg,#9a6700 ) );--os-ui-notice-bg:var( --os-ui-notice-warning-bg,rgba( 154,103,0,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-warning-border,rgba( 154,103,0,0.16 ) )}:host( [ tone='error' ] ),:host( [ tone='danger' ] ){--os-ui-notice-accent:var( --os-ui-notice-error,var( --os-ui-danger,#cf222e ) );--os-ui-notice-bg:var( --os-ui-notice-error-bg,rgba( 207,34,46,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-error-border,rgba( 207,34,46,0.16 ) )}:host( [ tone='neutral' ] ){--os-ui-notice-accent:var( --os-ui-notice-neutral,var( --os-ui-fg-muted,#57606a ) );--os-ui-notice-bg:var( --os-ui-notice-neutral-bg,rgba( 87,96,106,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-neutral-border,rgba( 87,96,106,0.16 ) )}`,oa="desktop-mode-notice-dismissed";function ia(){const e=window.wp?.os?.config?.currentUserId;return typeof e=="number"&&e>0?String(e):"anon"}function vi(){return`${oa}:${ia()}`}function vs(){try{const s=window.localStorage.getItem(vi());if(!s)return{};const e=JSON.parse(s);if(e&&typeof e=="object"&&!Array.isArray(e))return e}catch{}return{}}function _i(s){try{window.localStorage.setItem(vi(),JSON.stringify(s))}catch{}}function na(s){return s?vs()[s]===!0:!1}function ra(s){if(!s)return;const e=vs();e[s]=!0,_i(e)}function aa(s){if(!s)return;const e=vs();e[s]&&(delete e[s],_i(e))}const Te=class Te extends k{connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("tone")||this.setAttribute("tone","info");const e=this.getAttribute("notice-id");e&&na(e)&&(this.hidden=!0)}dismiss(){this.hidden=!0;const e=this.getAttribute("notice-id");e&&ra(e),this.emit("os-notice-dismiss",{noticeId:e??void 0})}undismiss(){const e=this.getAttribute("notice-id");e&&aa(e),this.hidden=!1}render(){const e=this.getAttribute("icon"),t=!this.hasAttribute("not-dismissible");return c` |
| 59 |
<span |
| 60 |
class="os-notice__icon dashicons ${e??""}" |
| 61 |
?hidden=${!e} |
| 62 |
aria-hidden="true" |
| 63 |
></span> |
| 64 |
<span class="os-notice__label"><slot></slot></span> |
| 65 |
<button |
| 66 |
type="button" |
| 67 |
class="os-notice__close" |
| 68 |
?hidden=${!t} |
| 69 |
aria-label=${d("Dismiss notice")} |
| 70 |
@click=${o=>this._onDismiss(o)} |
| 71 |
> |
| 72 |
${z("close",{size:null})} |
| 73 |
</button> |
| 74 |
`}_onDismiss(e){e.preventDefault(),e.stopPropagation(),this.dismiss()}};Te.props=["tone","notDismissible","icon","noticeId"],Te.styles=[sa],Te.help=void 0;let _s=Te;$("os-notice",_s);const la=w`:host{display:flex;flex-direction:column;gap:var( --os-ui-panel-gap,12px );padding:var( --os-ui-panel-padding,16px );background-image:var( --os-ui-panel-bg-image,none );background-repeat:var( --os-ui-panel-bg-image-repeat,repeat );background-size:var( --os-ui-panel-bg-image-size,auto );background-position:var( --os-ui-panel-bg-image-position,center );box-sizing:border-box}:host( [ hidden ] ){display:none}`,Pe=class Pe extends k{render(){const e=this.gap,t=this.padding;return e&&/^\d+$/.test(e)&&this.style.setProperty("--os-ui-panel-gap",`${e}px`),t&&/^\d+$/.test(t)&&this.style.setProperty("--os-ui-panel-padding",`${t}px`),c`<slot></slot>`}};Pe.props=["gap","padding"],Pe.styles=[la],Pe.help=void 0;let ys=Pe;$("os-panel",ys);const ca=w` ${R}:host{display:flex;align-items:center;gap:10px;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}input[ type='range' ]{appearance:none;-webkit-appearance:none;flex:1;min-width:0;height:18px;margin:0;padding:0;background:transparent;cursor:pointer}input[ type='range' ]:disabled{cursor:not-allowed;opacity:0.5}input[ type='range' ]::-webkit-slider-runnable-track{height:6px;border-radius:999px;background-image:linear-gradient( var( --_range-angle,90deg ),transparent var( --_fill,0% ),var( --_holo-track ) var( --_fill,0% ) ),linear-gradient( var( --os-ui-accent,#2271b1 ),var( --os-ui-accent,#2271b1 ) );background-size:auto,auto;background-position:center,center;background-repeat:no-repeat;box-shadow:inset 0 0 0 1px var( --_holo-track-edge )}input[ type='range' ]::-moz-range-track{height:6px;border-radius:999px;background-image:linear-gradient( var( --_range-angle,90deg ),transparent var( --_fill,0% ),var( --_holo-track ) var( --_fill,0% ) ),linear-gradient( var( --os-ui-accent,#2271b1 ),var( --os-ui-accent,#2271b1 ) );background-size:auto,auto;background-position:center,center;background-repeat:no-repeat;box-shadow:inset 0 0 0 1px var( --_holo-track-edge )}input[ type='range' ]::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:16px;height:16px;margin-top:-5px;border:0;border-radius:50%;background:var( --os-ui-switch-knob,#fffbff );box-shadow:0 1px 3px rgba( 12,11,15,0.5 ),0 0 0 1px rgba( 12,11,15,0.14 );cursor:inherit;transition:transform var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='range' ]::-moz-range-thumb{width:16px;height:16px;border:0;border-radius:50%;background:var( --os-ui-switch-knob,#fffbff );box-shadow:0 1px 3px rgba( 12,11,15,0.5 ),0 0 0 1px rgba( 12,11,15,0.14 );cursor:inherit;transition:transform var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='range' ]:active::-webkit-slider-thumb{transform:scale( 1.15 );box-shadow:var( --_holo-glow-strong )}input[ type='range' ]:active::-moz-range-thumb{transform:scale( 1.15 );box-shadow:var( --_holo-glow-strong )}input[ type='range' ]:focus-visible{outline:none}input[ type='range' ]:focus-visible::-webkit-slider-thumb{box-shadow:var( --_holo-focus )}input[ type='range' ]:focus-visible::-moz-range-thumb{box-shadow:var( --_holo-focus )}.os-range-field__value{width:var( --os-ui-range-readout-width,3ch );flex:none;text-align:end;font-variant-numeric:tabular-nums;color:var( --os-ui-fg,#1d2327 )}@media ( prefers-reduced-motion:reduce ){input[ type='range' ]::-webkit-slider-thumb{transition-duration:1ms}input[ type='range' ]::-moz-range-thumb{transition-duration:1ms}}`;function da(s,e,t){const o=Number.parseFloat(s),i=Number.parseFloat(e),n=Number.parseFloat(t);if(!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(n)||n===i)return"0%";const r=(o-i)/(n-i);return`${Math.min(100,Math.max(0,r*100)).toFixed(2)}%`}function ua(s){const e=s.indexOf(".");return e<0?0:Math.min(3,s.length-e-1)}function ha(s,e,t,o){const i=r=>{const a=Number.parseFloat(r);return Number.isFinite(a)?String(Math.trunc(Math.abs(a))).length+(a<0?1:0):3};return Math.max(i(s),i(e))+(t>0?t+1:0)+o.length}const ze=class ze extends k{render(){const e=this.label||"",t=this.value||"0",o=this.min||"0",i=this.max||"100",n=this.step||"1",r=this.suffix||"",a=this.decimals,l=a?Math.min(6,Math.max(0,Number.parseInt(a,10)||0)):ua(n),u=Number.parseFloat(t),h=Number.isFinite(u)?u.toFixed(l):t,p=ha(o,i,l,r);return c` |
| 75 |
<label class="os-range-field__label">${e}</label> |
| 76 |
<input |
| 77 |
type="range" |
| 78 |
min=${o} |
| 79 |
max=${i} |
| 80 |
step=${n} |
| 81 |
style="--_fill: ${da(t,o,i)}" |
| 82 |
.value=${t} |
| 83 |
@input=${m=>this._onInput(m)} |
| 84 |
/> |
| 85 |
<span |
| 86 |
class="os-range-field__value" |
| 87 |
style="--os-ui-range-readout-width: ${p}ch" |
| 88 |
>${h}${r}</span |
| 89 |
> |
| 90 |
`}connectedCallback(){super.connectedCallback(),getComputedStyle(this).direction==="rtl"&&this.style.setProperty("--_range-angle","270deg")}_onInput(e){const t=e.target,o=parseFloat(t.value);Number.isFinite(o)&&(this.value=String(o),this.emit("os-range-change",{value:o}))}};ze.props=["label","value","min","max","step","suffix","decimals"],ze.styles=[ca],ze.help=void 0;let ws=ze;$("os-range-field",ws);const pa=w`:host{display:block;margin-block-end:36px}:host( [ hidden ] ){display:none}.os-section__heading{margin:0 0 5px;font-size:20px;font-weight:500;letter-spacing:-0.01em;color:var( --os-ui-fg,#1d2327 )}.os-section__description{margin:0 0 14px;max-width:78ch;font-size:14px;color:var( --os-ui-fg-muted,#646970 );line-height:1.55}.os-section__description:empty{display:none}:host( [ stack ] ) .os-section__body{display:flex;flex-direction:column;gap:var( --os-ui-section-gap,12px )}`,Ie=class Ie extends k{render(){const e=this.heading||"",t=this.description||"";return c` |
| 91 |
${e?c`<h3 class="os-section__heading">${e}</h3>`:""} |
| 92 |
${t?c`<p class="os-section__description">${t}</p>`:""} |
| 93 |
<div class="os-section__body" part="body"><slot></slot></div> |
| 94 |
`}};Ie.props=["heading","description","stack"],Ie.styles=[pa],Ie.help=void 0;let xs=Ie;$("os-section",xs);const fa=w` ${R}:host{display:inline-flex;position:relative;padding:3px;background:var( --os-ui-segmented-bg,var( --os-ui-hover,rgba( 0,0,0,0.05 ) ) );border-radius:8px;gap:2px}.os-segmented__thumb{position:absolute;top:3px;bottom:3px;left:0;width:var( --_thumb-w,0px );border-radius:6px;background-color:var( --os-ui-segmented-selected-bg,var( --os-ui-accent,#2271b1 ) );background-image:var( --os-ui-segmented-selected-image,none );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;transform:translateX( var( --_thumb-x,0px ) );pointer-events:none;opacity:0}:host( [ data-thumb ] ) .os-segmented__thumb{opacity:1}:host( [ data-thumb-ready ] ) .os-segmented__thumb{transition:transform var( --_holo-t-slow ) var( --_holo-spring ),width var( --_holo-t-slow ) var( --_holo-ease ),opacity var( --_holo-t-fast ) linear}@media ( prefers-reduced-motion:reduce ){:host( [ data-thumb-ready ] ) .os-segmented__thumb{transition-duration:1ms}}`,ga=w` ${R} ${qt}:host{flex:1 1 auto;min-width:0}button{appearance:none;display:block;width:100%;padding:6px 13px;background:transparent;border:0;font:inherit;font-size:13px;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:6px;transition:background-color var( --_holo-t ) ease,color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,background-position var( --_holo-t ) ease;white-space:nowrap}button:hover{color:var( --os-ui-fg,#1d2327 )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}:host( [ aria-checked='true' ] ) button{color:var( --os-ui-segmented-selected-fg,var( --os-ui-fg-on-accent,#fff ) );transition-duration:var( --_holo-t-fast )}:host( [ aria-checked='true' ] ) button::before{display:none}`,Me=class Me extends k{render(){return this.setAttribute("role","radio"),c` |
| 95 |
<button |
| 96 |
type="button" |
| 97 |
class="os-holo-sheen" |
| 98 |
@click=${()=>this._onPick()} |
| 99 |
> |
| 100 |
<slot></slot> |
| 101 |
</button> |
| 102 |
`}_onPick(){this.emit("os-segment-pick",{value:this.value})}};Me.props=["value"],Me.styles=[ga],Me.help=void 0;let ks=Me;$("os-segment",ks);const De=class De extends k{constructor(){super(...arguments),this._resizeObserver=null}connectedCallback(){super.connectedCallback(),this.addEventListener("os-segment-pick",e=>{const t=e.detail;e.stopPropagation(),this.value=t.value,this.emit("os-pick",{value:t.value})}),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._placeThumb()),this._resizeObserver.observe(this))}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null}_placeThumb(){if(!this.shadowRoot?.querySelector(".os-segmented__thumb"))return;const t=this.value,o=Array.from(this.querySelectorAll(":scope > os-segment")).find(u=>u.getAttribute("value")===t);if(!o||this.offsetWidth===0){this.removeAttribute("data-thumb");return}const i=this.getBoundingClientRect(),n=i.width/this.offsetWidth,r=Math.abs(n-1)<.02?1:n;if(!(r>0))return;const a=o.getBoundingClientRect(),l=u=>`${Math.round(u*100)/100}px`;this.style.setProperty("--_thumb-x",l((a.left-i.left)/r)),this.style.setProperty("--_thumb-w",l(a.width/r)),this.setAttribute("data-thumb",""),this.hasAttribute("data-thumb-ready")||requestAnimationFrame(()=>this.setAttribute("data-thumb-ready",""))}set items(e){const t=this.querySelectorAll(":scope > os-segment");for(const n of Array.from(t))n.remove();for(const n of e){const r=document.createElement("os-segment");r.setAttribute("value",n.value),r.textContent=n.label,this.appendChild(r)}const o=this.value;!(o!==null&&e.some(n=>n.value===o))&&e.length>0?this.value=e[0].value:this.requestUpdate()}render(){const e=this.label||"";e&&this.setAttribute("aria-label",e),this.setAttribute("role","radiogroup");const t=this.value;return queueMicrotask(()=>{const o=this.querySelectorAll("os-segment");for(const i of Array.from(o)){const n=i.getAttribute("value");i.setAttribute("aria-checked",n===t?"true":"false")}this._placeThumb()}),c`<span class="os-segmented__thumb" aria-hidden="true"></span |
| 103 |
><slot></slot>`}};De.props=["value","label"],De.styles=[fa],De.help={title:"Segmented",summary:"iOS-style segmented radio group. Pill-shaped bar of equal-width <os-segment> children where exactly one is active.",status:"stable",props:[{name:"value",type:"string",description:"Currently selected segment value. Mirrored onto child aria-checked."},{name:"label",type:"string",description:"aria-label for the radiogroup."}],slots:[{name:"(default)",description:'<os-segment value="…"> children.'}],events:[{name:"os-pick",description:"Fires when the selected segment changes.",detail:"{ value: string }"}],cssProps:[{name:"--os-window-bg",description:"Pill background."},{name:"--os-ui-fg",description:"Active label colour."},{name:"--os-ui-fg-muted",description:"Inactive label colour."}],example:c` |
| 104 |
<os-segmented value="md" label="Dock size"> |
| 105 |
<os-segment value="sm">Small</os-segment> |
| 106 |
<os-segment value="md">Medium</os-segment> |
| 107 |
<os-segment value="lg">Large</os-segment> |
| 108 |
</os-segmented> |
| 109 |
`};let $s=De;$("os-segmented",$s);const ba=w` ${R}:host{display:flex;flex-direction:column;gap:8px;font-size:13px;color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-select__label{font-size:13px;line-height:1.5;color:var( --os-ui-fg-muted,#646970 )}.os-select__trigger{appearance:none;display:flex;align-items:center;gap:8px;width:100%;min-width:0;padding:8px 12px;background:var( --os-ui-hover,rgba( 0,0,0,0.05 ) );border:1px solid transparent;border-radius:8px;font:inherit;font-size:13px;line-height:1.5;color:var( --os-ui-fg,#1d2327 );text-align:start;cursor:pointer;transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}.os-select__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.08 ) );border-color:var( --os-ui-border-strong,#8c8f94 )}.os-select__trigger:focus,.os-select__trigger:focus-visible{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}.os-select__trigger:disabled{opacity:0.5;cursor:not-allowed}:host( [ plain ] ){display:inline-flex;flex-direction:row;align-items:center}:host( [ plain ] ) .os-select__label{display:none}:host( [ plain ] ) .os-select__trigger{width:auto;padding:4px 6px;background:transparent;border-color:transparent;border-radius:6px}:host( [ plain ] ) .os-select__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.05 ) );border-color:transparent}:host( [ plain ] ) .os-select__trigger:focus,:host( [ plain ] ) .os-select__trigger:focus-visible{border-color:var( --os-ui-accent,#2271b1 )}:host( [ plain ] ) .os-select__value{flex:0 1 auto}.os-select__value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-select__value--placeholder{color:var( --os-ui-fg-muted,#646970 )}.os-select__chevron{flex:0 0 auto;pointer-events:none;color:var( --os-ui-fg-muted,#646970 )}.os-select__trigger:hover .os-select__chevron{color:var( --os-ui-fg,#1d2327 )}.os-select__trigger:focus .os-select__chevron,.os-select__trigger:focus-visible .os-select__chevron{color:var( --os-ui-accent,#2271b1 )}.os-select__popup{position:fixed;inset:auto;margin:0;max-height:min( 320px,60vh );overflow-y:auto;padding:4px;background:var( --os-ui-surface,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:8px;box-shadow:0 12px 32px rgba( 0,0,0,0.45 );color:var( --os-ui-fg,#1d2327 )}.os-select__popup:not( [ data-open ] ){display:none}.os-select__popup:popover-open{display:block}.os-select__popup[ data-open ]{position:absolute;top:calc( 100% + 4px );left:0;min-width:100%;z-index:1000}:host{position:relative}.os-select__option{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:6px;font-size:13px;line-height:1.5;cursor:pointer;white-space:nowrap}.os-select__check{flex:0 0 auto;visibility:hidden}.os-select__option[ aria-selected='true' ] .os-select__check{visibility:visible}.os-select__option[ data-active ],.os-select__option:hover{background:var( --os-ui-accent,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.os-select__option[ aria-disabled='true' ]{opacity:0.5;cursor:not-allowed}.os-select__option[ aria-disabled='true' ]:hover{background:transparent;color:inherit}@media ( prefers-reduced-motion:reduce ){.os-select__trigger{transition-duration:1ms}}`,ma=w`:host{display:none}`,Ne=class Ne extends k{render(){return c``}};Ne.props=["value","disabled"],Ne.styles=[ma],Ne.help=void 0;let As=Ne;$("os-option",As);const He=class He extends k{constructor(){super(...arguments),this._optionObserver=null,this._open=!1,this._activeIndex=-1,this._typed="",this._dismissedAt=0,this._typedTimer=null,this._onWindowScroll=e=>{const t=e.target,o=this._popup();o&&t instanceof Node&&(t===o||o.contains(t))||this._hide()},this._onWindowResize=()=>this._hide()}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const n of Array.from(t))n.remove();for(const n of e){const r=document.createElement("os-option");r.setAttribute("value",n.value),r.textContent=n.label,this.appendChild(r)}const o=this.value;!(o!==null&&e.some(n=>n.value===o))&&e.length>0&&(this.value=e[0].value),this.requestUpdate()}connectedCallback(){super.connectedCallback(),ge(this),this._optionObserver=new MutationObserver(()=>this.requestUpdate()),this._optionObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","disabled"],characterData:!0})}disconnectedCallback(){this._optionObserver?.disconnect(),this._optionObserver=null,this._teardownDismiss(),this._open=!1,this._typedTimer&&(clearTimeout(this._typedTimer),this._typedTimer=null)}render(){const e=this.label||"",t=this.value,o=this.placeholder||"",i=this.disabled!==null;e&&this.setAttribute("aria-label",e);const n=this.getAttribute("aria-label")||"",r=e||n||o,a=this._readOptions(),l=a.find(b=>b.value===t),u=l?l.label:o,h=this.id||"os-unnamed",p=`${h}__listbox`,m=`${h}__trigger`,_=this._open&&this._activeIndex>=0?`${h}__opt-${this._activeIndex}`:"";return c` |
| 110 |
${e?c`<label |
| 111 |
class="os-select__label" |
| 112 |
for=${m} |
| 113 |
>${e}</label>`:c``} |
| 114 |
<button |
| 115 |
type="button" |
| 116 |
class="os-select__trigger" |
| 117 |
id=${m} |
| 118 |
role="combobox" |
| 119 |
aria-haspopup="listbox" |
| 120 |
aria-expanded=${this._open?"true":"false"} |
| 121 |
aria-controls=${p} |
| 122 |
aria-label=${r} |
| 123 |
aria-activedescendant=${_} |
| 124 |
?disabled=${i} |
| 125 |
@click=${()=>this._toggle()} |
| 126 |
@keydown=${b=>this._onTriggerKeydown(b)} |
| 127 |
> |
| 128 |
<span |
| 129 |
class="os-select__value${l?"":" os-select__value--placeholder"}" |
| 130 |
>${u}</span |
| 131 |
> |
| 132 |
${z("chevron-right",{size:16,rotate:90,className:"os-select__chevron"})} |
| 133 |
</button> |
| 134 |
<div |
| 135 |
class="os-select__popup" |
| 136 |
id=${p} |
| 137 |
role="listbox" |
| 138 |
popover="auto" |
| 139 |
aria-label=${r} |
| 140 |
@toggle=${b=>this._onPopoverToggle(b)} |
| 141 |
> |
| 142 |
${a.map((b,y)=>c` |
| 143 |
<div |
| 144 |
class="os-select__option" |
| 145 |
id=${`${h}__opt-${y}`} |
| 146 |
role="option" |
| 147 |
data-value=${b.value} |
| 148 |
aria-selected=${b.value===t?"true":"false"} |
| 149 |
aria-disabled=${b.disabled?"true":"false"} |
| 150 |
?data-active=${this._open&&y===this._activeIndex} |
| 151 |
@click=${()=>this._onOptionClick(b)} |
| 152 |
@pointermove=${()=>this._setActive(y)} |
| 153 |
> |
| 154 |
${z("check",{size:16,className:"os-select__check"})} |
| 155 |
<span class="os-select__option-label" |
| 156 |
>${b.label}</span |
| 157 |
> |
| 158 |
</div> |
| 159 |
`)} |
| 160 |
</div> |
| 161 |
`}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const o of Array.from(t)){const i=o.getAttribute("value");i!==null&&e.push({value:i,label:(o.textContent||i).trim(),disabled:o.hasAttribute("disabled")})}return e}_popup(){return this.shadowRoot?.querySelector(".os-select__popup")??null}_trigger(){return this.shadowRoot?.querySelector(".os-select__trigger")??null}_toggle(){if(this._open){this._hide();return}performance.now()-this._dismissedAt<250||this._show()}_show(){const e=this._popup(),t=this._trigger();if(!e||!t||this._open)return;this._open=!0;const o=this._readOptions(),i=this.value,n=o.findIndex(a=>a.value===i&&!a.disabled);this._activeIndex=n>=0?n:o.findIndex(a=>!a.disabled);const r=t.getBoundingClientRect();e.style.minWidth=`${r.width}px`,typeof e.showPopover=="function"?(e.style.left=`${r.left}px`,e.style.top=`${r.bottom+4}px`,e.showPopover(),r.bottom+4+e.offsetHeight>window.innerHeight-8&&(e.style.top=`${Math.max(8,r.top-4-e.offsetHeight)}px`)):e.setAttribute("data-open",""),window.addEventListener("scroll",this._onWindowScroll,{capture:!0,passive:!0}),window.addEventListener("resize",this._onWindowResize),this.requestUpdate(),this._scrollActiveIntoView()}_hide(){if(!this._open)return;this._open=!1;const e=this._popup();if(e){if(typeof e.hidePopover=="function")try{e.hidePopover()}catch{}e.removeAttribute("data-open")}this._teardownDismiss(),this.requestUpdate()}_teardownDismiss(){window.removeEventListener("scroll",this._onWindowScroll,{capture:!0}),window.removeEventListener("resize",this._onWindowResize)}_onPopoverToggle(e){e.newState==="closed"&&this._open&&(this._dismissedAt=performance.now(),this._open=!1,this._teardownDismiss(),this.requestUpdate())}_onOptionClick(e){e.disabled||this._commit(e.value)}_commit(e){this._hide(),this.value=e,this.emit("os-pick",{value:e})}_setActive(e){if(e===this._activeIndex)return;const t=this._readOptions();!t[e]||t[e].disabled||(this._activeIndex=e,this.requestUpdate())}_moveActive(e){const t=this._readOptions();let o=this._activeIndex;for(let i=0;i<t.length&&(o=Math.min(Math.max(o+e,0),t.length-1),!(!t[o]?.disabled||o===0||o===t.length-1));i++);o!==this._activeIndex&&t[o]&&!t[o].disabled&&(this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView())}_scrollActiveIntoView(){queueMicrotask(()=>{this.shadowRoot?.querySelector(".os-select__option[data-active]")?.scrollIntoView?.({block:"nearest"})})}_typeAhead(e){this._typedTimer&&clearTimeout(this._typedTimer),this._typed+=e.toLowerCase(),this._typedTimer=setTimeout(()=>{this._typed=""},500);const o=this._readOptions().findIndex(i=>!i.disabled&&i.label.toLowerCase().startsWith(this._typed));o>=0&&(this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView())}_onTriggerKeydown(e){const t=this._readOptions();if(t.length!==0){if(!this._open){if(["ArrowDown","ArrowUp","Enter"," ","Home","End"].includes(e.key)){if(e.preventDefault(),this._show(),e.key==="Home"&&(this._activeIndex=t.findIndex(o=>!o.disabled)),e.key==="End"){for(let o=t.length-1;o>=0;o--)if(!t[o].disabled){this._activeIndex=o;break}}this.requestUpdate()}else e.key.length===1&&e.key.trim()!==""&&(this._show(),this._typeAhead(e.key));return}switch(e.key){case"ArrowDown":e.preventDefault(),this._moveActive(1);break;case"ArrowUp":e.preventDefault(),this._moveActive(-1);break;case"Home":e.preventDefault(),this._activeIndex=t.findIndex(o=>!o.disabled),this.requestUpdate(),this._scrollActiveIntoView();break;case"End":e.preventDefault();for(let o=t.length-1;o>=0;o--)if(!t[o].disabled){this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView();break}break;case"Enter":case" ":{e.preventDefault();const o=t[this._activeIndex];o&&!o.disabled&&this._commit(o.value);break}case"Tab":{const o=t[this._activeIndex];o&&!o.disabled?this._commit(o.value):this._hide();break}case"Escape":e.preventDefault(),this._hide();break;default:e.key.length===1&&e.key.trim()!==""&&this._typeAhead(e.key)}}}};He.props=["value","label","placeholder","disabled","name"],He.styles=[ba],He.help={title:"Select",summary:"Dropdown picker: a combobox trigger plus a custom top-layer listbox, so the popup wears the station instead of the operating system. Mirrors the <os-segmented> contract (set value, listen for os-pick).",status:"stable",props:[{name:"value",type:"string",description:"Currently selected option value."},{name:"label",type:"string",description:"Visible label rendered above the trigger and used as the accessible name."},{name:"placeholder",type:"string",description:"Trigger text shown when no value is set."},{name:"disabled",type:"boolean attribute",description:"Disables the trigger and dims the chrome."},{name:"plain",type:"boolean attribute",description:"Drops the field chrome and shrinks to the value, for a picker that is a list row’s trailing control rather than a field of its own. The container already draws the box; use with no `label`."},{name:"name",type:"string",description:"Accepted for compatibility. Shadow-DOM controls never participated in light-DOM form submission, so nothing is lost by the native select being gone; read `value` off the host instead."}],slots:[{name:"(default)",description:'<os-option value="…"> children.'}],events:[{name:"os-pick",description:"Fires when the user picks a new option.",detail:"{ value: string }"}],cssProps:[{name:"--os-ui-fg",description:"Label + value colour."},{name:"--os-ui-fg-muted",description:"Placeholder + chevron colour."},{name:"--os-ui-accent",description:"Active option row + selected check."}],example:c` |
| 162 |
<os-select value="eur" label="Currency"> |
| 163 |
<os-option value="eur">Euro</os-option> |
| 164 |
<os-option value="usd">US Dollar</os-option> |
| 165 |
<os-option value="jpy">Japanese Yen</os-option> |
| 166 |
</os-select> |
| 167 |
`};let Cs=He;$("os-select",Cs);const va=w` ${R}:host{display:block;width:100%;aspect-ratio:4 / 3}:host( [ size='small' ] ){display:inline-block;width:32px;height:32px;aspect-ratio:1 / 1;flex:0 0 auto}:host( [ variant='accent' ] ){display:inline-block;width:28px;height:28px;aspect-ratio:1 / 1;flex:0 0 auto}:host( [ size='small' ][ variant='accent' ] ) button{border-radius:8px}:host( [ size='small' ][ variant='accent' ] ) button[ aria-pressed='true' ]{box-shadow:0 0 0 2px var( --os-ui-surface-sunken,#f0f0f1 ),0 0 0 4px var( --os-ui-accent,#2271b1 )}:host( [ size='small' ][ variant='accent' ] ) button[ aria-pressed='true' ]:focus-visible{box-shadow:var( --_holo-focus )}:host( [ variant='wallpaper' ] ){aspect-ratio:16 / 10}:host( [ variant='wallpaper' ] ) button{display:flex;align-items:flex-end;justify-content:flex-start;padding:8px;overflow:hidden}button{appearance:none;position:relative;width:100%;height:100%;padding:0;border-radius:10px;border:2px solid transparent;cursor:pointer;background-color:var( --os-ui-surface-sunken,#eee );background-size:cover;background-position:center;transition:transform 0.15s ease,border-color 0.15s ease,box-shadow 0.15s ease}:host( [ size='small' ] ) button{border-radius:50%}button:hover{transform:scale( 1.04 )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}button[ aria-pressed='true' ]{border-color:transparent;box-shadow:0 0 0 2px var( --os-ui-accent,#2271b1 )}button[ aria-pressed='true' ]:focus-visible{box-shadow:var( --_holo-focus )}:host( [ variant='wallpaper' ] ) button:hover{transform:translateY( -2px )}`,qe=class qe extends k{render(){const e=this.selected!==null,t=this.label||"",o=this.preview||"";return c` |
| 168 |
<button |
| 169 |
type="button" |
| 170 |
aria-pressed=${e?"true":"false"} |
| 171 |
aria-label=${t} |
| 172 |
title=${t} |
| 173 |
style="background: ${o}" |
| 174 |
@click=${()=>this._onPick()} |
| 175 |
> |
| 176 |
<slot></slot> |
| 177 |
</button> |
| 178 |
`}_onPick(){this.emit("os-pick",{value:this.value})}};qe.props=["value","label","selected","preview","size","variant"],qe.styles=[va],qe.help=void 0;let Ss=qe;$("os-swatch",Ss);const _a=w`:host{display:grid;grid-template-columns:repeat( var( --os-ui-swatch-grid-cols,4 ),1fr );gap:12px}:host( [ mode='row' ] ){display:flex;flex-wrap:wrap;align-items:center;gap:10px}`,Ue=class Ue extends k{render(){const e=this.label||"",t=this.columns||"";return t&&this.style.setProperty("--os-ui-swatch-grid-cols",t),this.setAttribute("role","radiogroup"),e&&this.setAttribute("aria-label",e),c`<slot></slot>`}};Ue.props=["label","columns","mode"],Ue.styles=[_a],Ue.help=void 0;let Es=Ue;$("os-swatch-grid",Es);const ya=w`:host{display:flex;gap:4px;margin-bottom:10px;border-bottom:1px solid var( --os-ui-border,#dcdcde )}:host( [ orientation='vertical' ] ){flex-direction:column;align-items:stretch;gap:0;margin-bottom:0;border-bottom:0}`,wa=w`:host{display:block}:host( [ hidden ] ){display:none}:host(:focus-visible ){outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:4px;border-radius:4px}`,xa=w` ${R}:host{display:inline-block}:host( [ data-orientation='vertical' ] ){display:block;--_tab-edge:var( --os-ui-tab-edge,linear-gradient( var( --os-ui-accent,#f252fc ),var( --os-ui-accent,#f252fc ) ) );--_tab-wash:var( --os-ui-tab-wash,linear-gradient( 90deg,rgba( 242,82,252,0.16 ) 0%,rgba( 255,251,255,0.04 ) 42%,transparent 100% ) );--_tab-bloom:var( --os-ui-tab-bloom,linear-gradient( 90deg,rgba( 242,82,252,0.26 ),transparent ) )}:host( [ data-orientation='vertical' ] ) button{display:flex;align-items:center;gap:11px;isolation:isolate;width:100%;min-height:40px;padding:0 14px 0 20px;margin-bottom:0;border-radius:0;text-align:start;font-size:14px;font-weight:400;line-height:1.5;white-space:nowrap}:host( [ data-orientation='vertical' ] ) slot::slotted( svg ){flex:0 0 17px;width:17px;height:17px;opacity:0.8;transition:opacity var( --_holo-t ) var( --_holo-ease )}:host( [ data-orientation='vertical' ] ) button:hover slot::slotted( svg ),:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) slot::slotted( svg ){opacity:1}:host( [ data-orientation='vertical' ] ) button::after{inset-inline:0 auto;inset-block:0;z-index:-1;width:2px;height:auto;border-radius:0;background-image:var( --_tab-edge );transition:opacity var( --_holo-t ) var( --_holo-ease )}:host( [ data-orientation='vertical' ] ) button::before{content:'';position:absolute;inset-inline:0 auto;inset-block:0;z-index:-1;width:44px;background-image:var( --_tab-bloom );filter:blur( 8px );opacity:0;pointer-events:none;transition:opacity var( --_holo-t ) var( --_holo-ease )}:host( [ data-orientation='vertical' ] ) button:hover::after{inset-inline:0 auto;opacity:0}:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) button{background-image:var( --_tab-wash );font-weight:400}:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) button::after,:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) button:hover::after{inset-inline:0 auto;opacity:1}:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) button::before{opacity:1}@media ( prefers-reduced-motion:reduce ){:host( [ data-orientation='vertical' ] ) button::before,:host( [ data-orientation='vertical' ] ) slot::slotted( svg ){transition-duration:1ms}}button{appearance:none;position:relative;padding:6px 10px 8px;border:none;background:transparent;color:var( --os-ui-fg-muted,#50575e );font:inherit;font-size:12px;font-weight:500;cursor:pointer;margin-bottom:-1px;transition:color var( --_holo-t ) ease}button::after{content:'';position:absolute;inset-inline:50%;bottom:0;height:2px;border-radius:2px 2px 0 0;background-image:linear-gradient( var( --os-ui-accent,#2271b1 ),var( --os-ui-accent,#2271b1 ) );background-size:100% 100%;opacity:0;transition:inset-inline var( --_holo-t ) ease,opacity var( --_holo-t ) ease}button:hover{color:var( --os-ui-fg,#1d2327 )}button:hover::after{inset-inline:30%;opacity:0.45}button:focus-visible{outline:none;box-shadow:var( --_holo-focus );border-radius:4px}:host( [ aria-selected='true' ] ) button{color:var( --os-ui-fg,#1d2327 );font-weight:600}:host( [ aria-selected='true' ] ) button::after,:host( [ aria-selected='true' ] ) button:hover::after{inset-inline:0;opacity:1}@media ( prefers-reduced-motion:reduce ){button::after{transition-duration:1ms}}`,Fe=class Fe extends k{render(){return this.setAttribute("role","tab"),c` |
| 179 |
<button type="button" @click=${()=>this._onPick()}> |
| 180 |
<slot></slot> |
| 181 |
</button> |
| 182 |
`}_onPick(){this.emit("os-tab-pick",{value:this.value})}};Fe.props=["value"],Fe.styles=[xa],Fe.help=void 0;let Ls=Fe;$("os-tab",Ls);const We=class We extends k{constructor(){super(...arguments),this._tabObserver=null,this._onKeyDown=e=>{const t=this.orientation==="vertical",o=t?"ArrowDown":"ArrowRight",i=t?"ArrowUp":"ArrowLeft";if(e.key!==o&&e.key!==i&&e.key!=="Home"&&e.key!=="End")return;const n=Array.from(this.querySelectorAll("os-tab")).filter(h=>!h.hasAttribute("data-search-hidden"));if(n.length===0)return;const r=this.value,a=n.findIndex(h=>h.getAttribute("value")===r);let l=0;if(e.key==="End")l=n.length-1;else if(e.key!=="Home"){const h=e.key===o?1:-1;l=(a+h+n.length)%n.length}const u=n[l]?.getAttribute("value");!u||u===r||(e.preventDefault(),this.value=u,this.emit("os-tab-change",{value:u}),queueMicrotask(()=>{n[l]?.focus()}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("os-tab-pick",e=>{const t=e.detail;e.stopPropagation(),this.value=t.value,this.emit("os-tab-change",{value:t.value})}),this.addEventListener("keydown",this._onKeyDown),this._tabObserver=new MutationObserver(()=>this.requestUpdate()),this._tabObserver.observe(this,{childList:!0})}disconnectedCallback(){this._tabObserver?.disconnect(),this._tabObserver=null,this.removeEventListener("keydown",this._onKeyDown)}set items(e){ka(this,"os-tab",e);const t=this.value;!(t!==null&&e.some(i=>i.value===t))&&e.length>0?this.value=e[0].value:this.requestUpdate()}render(){this.setAttribute("role","tablist");const e=this.label||"";e&&this.setAttribute("aria-label",e);const t=this.orientation==="vertical";this.setAttribute("aria-orientation",t?"vertical":"horizontal");for(const i of Array.from(this.querySelectorAll("os-tab")))t?i.setAttribute("data-orientation","vertical"):i.removeAttribute("data-orientation");const o=this.value;return queueMicrotask(()=>{const i=this.querySelectorAll("os-tab");for(const n of Array.from(i)){const r=n.getAttribute("value");n.setAttribute("aria-selected",r===o?"true":"false"),n.setAttribute("tabindex",r===o?"0":"-1")}yi(this,o)}),c`<slot></slot>`}};We.props=["value","label","orientation"],We.styles=[ya],We.help={title:"Tabs",summary:'Underline-accent tab strip. Pair with sibling <os-tabpanel for="…"> elements and the strip auto-toggles their hidden attribute on selection. Set orientation="vertical" for a sidebar instead of a strip.',status:"stable",props:[{name:"value",type:"string",description:"Currently active tab value. Mirrored to child <os-tab> aria-selected."},{name:"label",type:"string",description:"aria-label for the tablist — describe the tab group for assistive tech."},{name:"orientation",type:"'horizontal' | 'vertical'",description:"Lay the tabs across the top (default) or down the side. Vertical also sets aria-orientation and moves each tab's accent from an underline to a leading edge."}],slots:[{name:"(default)",description:'<os-tab value="…"> children forming the strip.'}],events:[{name:"os-tab-change",description:"Fires when the active tab changes.",detail:"{ value: string }"}],example:c` |
| 183 |
<os-tabs value="one" label="Demo tabs"> |
| 184 |
<os-tab value="one">One</os-tab> |
| 185 |
<os-tab value="two">Two</os-tab> |
| 186 |
<os-tab value="three">Three</os-tab> |
| 187 |
</os-tabs> |
| 188 |
<os-tabpanel for="one">First panel.</os-tabpanel> |
| 189 |
<os-tabpanel for="two">Second panel.</os-tabpanel> |
| 190 |
<os-tabpanel for="three">Third panel.</os-tabpanel> |
| 191 |
`};let Rs=We;$("os-tabs",Rs);const je=class je extends k{connectedCallback(){super.connectedCallback(),this.setAttribute("role","tabpanel"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const e=$a(this);e&&yi(e,e.getAttribute("value"))}render(){return c`<slot></slot>`}};je.props=["for"],je.styles=[wa],je.help={title:"Tab panel",summary:'Auto-managed panel paired with a sibling <os-tabs>. Declares which tab it belongs to via `for="<tab-value>"`; the parent strip toggles `hidden` whenever the active tab changes. role="tabpanel" and tabindex="0" are set automatically.',status:"stable",props:[{name:"for",type:"string",description:"Matches the `value` of the owning <os-tab>. Panel is shown when its parent tabs strip is on that value."}],slots:[{name:"(default)",description:"Panel body content."}],example:c` |
| 192 |
<os-tabs value="two" label="Demo tabs"> |
| 193 |
<os-tab value="one">One</os-tab> |
| 194 |
<os-tab value="two">Two</os-tab> |
| 195 |
</os-tabs> |
| 196 |
<os-tabpanel for="one"> |
| 197 |
Hidden — the strip is on "two". |
| 198 |
</os-tabpanel> |
| 199 |
<os-tabpanel for="two"> |
| 200 |
Visible, because this panel's <code>for</code> matches the |
| 201 |
strip's <code>value</code>. |
| 202 |
</os-tabpanel> |
| 203 |
`};let Ts=je;$("os-tabpanel",Ts);function ka(s,e,t){const o=s.querySelectorAll(`:scope > ${e}`);for(const i of Array.from(o))i.remove();for(const i of t){const n=document.createElement(e);n.setAttribute("value",i.value),n.textContent=i.label,s.appendChild(n)}}function $a(s){const e=s.parentElement;if(!e)return null;const t=e.querySelector(":scope > os-tabs");return t||s.closest("os-tabs")}function yi(s,e){const t=new Set,o=s.parentElement;if(o)for(const i of Array.from(o.querySelectorAll(":scope > os-tabpanel")))t.add(i);for(const i of Array.from(s.querySelectorAll(":scope > os-tabpanel")))t.add(i);for(const i of t){const n=i.getAttribute("for"),r=n!==null&&n===e;r?i.removeAttribute("hidden"):i.setAttribute("hidden",""),i.setAttribute("aria-hidden",r?"false":"true")}}const wi=w` ${R} ${hs}:host{display:flex;flex-direction:column;gap:4px;font-size:13px;color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-text-field__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-text-field__row{position:relative;display:flex;align-items:center;width:100%}input{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:7px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:6px;font:inherit;font-size:13px;color:var( --os-ui-fg,#1d2327 )}.os-text-field__suffix{position:absolute;inset-inline-end:10px;top:50%;transform:translateY( -50% );pointer-events:none;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-text-field__row--has-reveal input{padding-inline-end:36px}.os-text-field__reveal{position:absolute;inset-inline-end:0;top:0;bottom:0;width:34px;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:0 6px 6px 0;transition:color 0.12s ease}.os-text-field__reveal:hover{color:var( --os-ui-accent,#2271b1 )}.os-text-field__reveal:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 );border-radius:0 6px 6px 0}.os-text-field__reveal:disabled{opacity:0.45;cursor:not-allowed}.os-text-field__input--masked{-webkit-text-security:disc;text-security:disc}@supports not ( ( -webkit-text-security:disc ) or ( text-security:disc ) ){.os-text-field__input--masked{font-family:text-security-disc,"password",monospace;letter-spacing:0.2em}}input:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}input[ aria-invalid='true' ],input[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}input[ aria-invalid='true' ]:focus,input[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}input[ type='number' ]::-webkit-inner-spin-button,input[ type='number' ]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[ type='number' ]{-moz-appearance:textfield}`,Ve=class Ve extends k{constructor(){super(...arguments),this._revealed=!1}connectedCallback(){super.connectedCallback(),ge(this)}render(){const e=this.label||"",t=this.value??"",o=this.placeholder||"",i=this.disabled!==null,n=this.readonly!==null,r=this.autocomplete,a=this.type||"text",l=a==="password";let u=r||"off";l&&(!r||u==="off")&&(u="new-password");const h=this.maxlength,p=this.minlength,m=this.pattern||"",_=this.name||"",b=this.suffix||"",y=this.invalid!==null,v=this.reveal!==null,f=a==="password",g=f&&!(v&&this._revealed);let x;f||v&&this._revealed?x="text":x=a;const A=v?"os-text-field__row os-text-field__row--has-reveal":"os-text-field__row",M=g?"os-text-field__input os-text-field__input--masked":"os-text-field__input",H=`${this.id||"os-unnamed"}__input`;return c` |
| 204 |
${e?c`<label |
| 205 |
class="os-text-field__label" |
| 206 |
for=${H} |
| 207 |
>${e}</label>`:c``} |
| 208 |
<span class=${A}> |
| 209 |
<input |
| 210 |
id=${H} |
| 211 |
class=${M} |
| 212 |
type=${x} |
| 213 |
.value=${t} |
| 214 |
placeholder=${o} |
| 215 |
?disabled=${i} |
| 216 |
?readonly=${n} |
| 217 |
autocomplete=${u} |
| 218 |
maxlength=${h??""} |
| 219 |
minlength=${p??""} |
| 220 |
pattern=${m} |
| 221 |
name=${_} |
| 222 |
aria-invalid=${y?"true":"false"} |
| 223 |
aria-label=${e||""} |
| 224 |
@input=${S=>this._onInput(S)} |
| 225 |
@change=${S=>this._onChange(S)} |
| 226 |
@keydown=${S=>this._onKeyDown(S)} |
| 227 |
/> |
| 228 |
${b?c`<span class="os-text-field__suffix">${b}</span>`:c``} |
| 229 |
${v?this._renderRevealButton(i):c``} |
| 230 |
</span> |
| 231 |
`}_renderRevealButton(e){const t=this._revealed?"Hide":"Show";return c` |
| 232 |
<button |
| 233 |
type="button" |
| 234 |
class="os-text-field__reveal" |
| 235 |
aria-label=${t} |
| 236 |
aria-pressed=${this._revealed?"true":"false"} |
| 237 |
?disabled=${e} |
| 238 |
tabindex="0" |
| 239 |
@click=${()=>this._onToggleReveal()} |
| 240 |
> |
| 241 |
${this._revealed?Ca():Aa()} |
| 242 |
</button> |
| 243 |
`}_onToggleReveal(){this._revealed=!this._revealed,this.requestUpdate()}_onInput(e){const t=e.target;this.value=t.value,this.emit("os-input-change",{value:t.value})}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey){const t=e.target;this.emit("os-submit",{value:t.value})}}};Ve.props=["label","value","placeholder","disabled","readonly","autocomplete","type","maxlength","minlength","pattern","name","suffix","invalid","reveal"],Ve.styles=[wi],Ve.help=void 0;let Ps=Ve;$("os-text-field",Ps);function Aa(){return c` |
| 244 |
<svg |
| 245 |
viewBox="0 0 16 16" |
| 246 |
width="14" |
| 247 |
height="14" |
| 248 |
fill="none" |
| 249 |
stroke="currentColor" |
| 250 |
stroke-width="1.5" |
| 251 |
stroke-linecap="round" |
| 252 |
stroke-linejoin="round" |
| 253 |
aria-hidden="true" |
| 254 |
focusable="false" |
| 255 |
> |
| 256 |
<path d="M1 8C1 8 3.5 3 8 3s7 5 7 5-2.5 5-7 5S1 8 1 8z" /> |
| 257 |
<circle cx="8" cy="8" r="2" /> |
| 258 |
</svg> |
| 259 |
`}function Ca(){return c` |
| 260 |
<svg |
| 261 |
viewBox="0 0 16 16" |
| 262 |
width="14" |
| 263 |
height="14" |
| 264 |
fill="none" |
| 265 |
stroke="currentColor" |
| 266 |
stroke-width="1.5" |
| 267 |
stroke-linecap="round" |
| 268 |
stroke-linejoin="round" |
| 269 |
aria-hidden="true" |
| 270 |
focusable="false" |
| 271 |
> |
| 272 |
<path d="M1 8C1 8 3.5 3 8 3s7 5 7 5-2.5 5-7 5S1 8 1 8z" /> |
| 273 |
<circle cx="8" cy="8" r="2" /> |
| 274 |
<line x1="2" y1="2" x2="14" y2="14" /> |
| 275 |
</svg> |
| 276 |
`}const Sa="os-window-tab-change";function xi(s){return Array.from(s.querySelectorAll(".os-window__tab"))}function ki(s){return s.replace(/[^a-zA-Z0-9_-]/g,"-")}function $i(s,e){return`${s.id||"os-window"}-tab-${ki(e)}`}function Ai(s,e){return`${s.id||"os-window"}-panel-${ki(e)}`}function Ea(s){const e=s.querySelector(".os-window__tab-plate");if(!e)return;const t=s.querySelector(".os-window__tab--active");if(!t){e.dataset.empty="",s.dataset.tabPlateEmpty="";return}delete e.dataset.empty,delete s.dataset.tabPlateEmpty,s.style.setProperty("--_tab-plate-x",`${t.offsetLeft}px`),s.style.setProperty("--_tab-plate-w",`${t.offsetWidth}px`),s.style.setProperty("--_tab-strip-w",`${s.clientWidth}px`),t.offsetWidth>0&&(e.dataset.placed="")}function La(s){if(s){if(s.querySelector(":scope > .os-window__tab")){s.setAttribute("role","tablist");const e=s.dataset.tablistLabel;e&&s.setAttribute("aria-label",e);return}s.setAttribute("role","presentation"),s.removeAttribute("aria-label")}}function Ra(s){const e=xi(s);if(e.length===0)return;const t=e.find(o=>o.classList.contains("os-window__tab--active"))??e[0];for(const o of e){const i=o===t?0:-1;o.tabIndex!==i&&(o.tabIndex=i)}}function Ci(s){const e=new Map;for(const t of xi(s))t.dataset.kind==="panel"&&t.dataset.panel&&e.set(t.dataset.panel,t);return e}function Si(s){const e=s.querySelector(".os-window__body");return e?Array.from(e.querySelectorAll("os-tabpanel[ for ]")).filter(t=>!t.parentElement?.closest("os-tabpanel, os-tabs")):[]}function Ta(s,e){const t=s.querySelector(".os-window__tabs");if(!t)return;let o=!1;for(const[i,n]of Ci(t)){const r=i===e;o=o||r,n.classList.toggle("os-window__tab--active",r),n.setAttribute("aria-selected",r?"true":"false")}if(o){for(const i of Si(s)){const n=i.getAttribute("for")===e;i.toggleAttribute("hidden",!n),i.setAttribute("aria-hidden",n?"false":"true")}Ra(t),Ea(t),s.dispatchEvent(new CustomEvent(Sa,{bubbles:!0,detail:{value:e}}))}}function Pa(s,e,t){const o=s.querySelector(".os-window__tabs");if(!o)return;const i=Ci(o),n=Array.from(i.entries()).find(([,h])=>h.classList.contains("os-window__tab--active"))?.[0];let r=o.querySelector(".os-window__tab-plate");for(const h of e){let p=i.get(h.value);if(p)i.delete(h.value);else{const m=document.createElement("button");m.type="button",p=m,p.className="os-window__tab",p.dataset.kind="panel",p.dataset.panel=h.value,p.setAttribute("role","tab"),p.setAttribute("aria-selected","false"),p.tabIndex=-1}p.textContent!==h.label&&(p.textContent=h.label),p.id=$i(s,h.value),p.setAttribute("aria-controls",Ai(s,h.value)),p.previousElementSibling!==r&&o.insertBefore(p,r?r.nextSibling:o.firstChild),r=p}for(const h of i.values())h.remove();La(o);const a=o.querySelector(":scope > .os-window__tab")!==null;for(const h of Si(s)){const p=h.getAttribute("for");p&&(h.id=Ai(s,p),a?h.setAttribute("aria-labelledby",$i(s,p)):h.removeAttribute("aria-labelledby"))}const l=h=>h!==void 0&&e.some(p=>p.value===h),u=[t,n,e[0]?.value].find(l);u!==void 0&&Ta(s,u)}const be={size:null},Ei={appearance:()=>z("color",be),themes:()=>{const s=document.createElementNS("http://www.w3.org/2000/svg","svg");return s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","currentColor"),s.setAttribute("aria-hidden","true"),s.innerHTML='<path fill-rule="evenodd" clip-rule="evenodd" d="M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z" />',s},windows:()=>z("windows",be),navigation:()=>{const s=document.createElementNS("http://www.w3.org/2000/svg","svg");return s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","currentColor"),s.setAttribute("aria-hidden","true"),s.innerHTML='<path d="M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" />',s},features:()=>z("settings",be),help:()=>z("widgets",be),"os-file-associations":()=>{const s=document.createElementNS("http://www.w3.org/2000/svg","svg");return s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","currentColor"),s.setAttribute("aria-hidden","true"),s.innerHTML='<path d="M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" /><path d="M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" />',s},about:()=>z("info",be)},zs=1920,Is=1080,za=40,Ia=300,jt="custom-gradient",V="custom-image",Li="galaxy",me="custom",Ri=[{id:"pulse",label:"Pulse",value:"#f252fc"},{id:"nebula",label:"Nebula",value:"#ec9bff"},{id:"sirius",label:"Sirius",value:"#9af2ff"},{id:"lagoon",label:"Lagoon",value:"#9f98ff"},{id:"wp-blue",label:"WordPress Blue",value:"#2271b1"},{id:"indigo",label:"Indigo",value:"#3858e9"},{id:"teal",label:"Teal",value:"#04a4cc"},{id:"emerald",label:"Emerald",value:"#059669"},{id:"amber",label:"Amber",value:"#d97706"},{id:"rose",label:"Rose",value:"#e11d48"}];function Ms(){const e=window.wp?.os?.config?.accentColors;if(!Array.isArray(e)||e.length===0)return Ri;const t=[];for(const o of e)o&&typeof o=="object"&&typeof o.id=="string"&&typeof o.label=="string"&&typeof o.value=="string"&&o.id!==""&&o.label!==""&&/^#[0-9a-f]{3,8}$/i.test(o.value)&&t.push({id:o.id,label:o.label,value:o.value});return t.length>0?t:Ri}const Ti=[{id:"compact",label:"Compact",width:48,icon:18},{id:"default",label:"Default",width:56,icon:20},{id:"large",label:"Large",width:72,icon:26}],Pi=[{id:"sharp",label:"Sharp",value:0},{id:"default",label:"Default",value:8},{id:"round",label:"Round",value:16}],zi=[{id:"static",label:"Static"},{id:"dynamic",label:"Dynamic"},{id:"hidden",label:"Hidden"}],Ii=[{id:"bottom",label:"Bottom"},{id:"left",label:"Left"},{id:"right",label:"Right"}],Mi=[{id:"unified",label:"Unified"},{id:"classic",label:"Split"}],J={wallpaper:Li,accent:"pulse",customAccent:"#f252fc",dockSize:"default",windowRadius:"round",adminBarMode:"hidden",desktopLayout:"unified",dockPlacement:"bottom",dockRailRenderer:"default",desktopTheme:"",appliedThemeRecommendations:[],unfocusEffect:"darken",windowReveal:"none",windowRevealDuration:0,windowLinkRenderer:"svg-splines",windowLinkVisibility:"always",windowLinksEnabled:!0,windowLinkRaiseOnFocus:!0,windowLinkHighlight:!0,customGradient:{from:"#2271b1",to:"#7c3aed",angle:135},customImage:null,wallpaperSettings:{},libraryHdOnly:!0,ai:{enabled:!1},heartbeatRate:60,nativePostsEnabled:!1,nativePostsHiddenColumns:[],nativePagesEnabled:!1,nativeUsersEnabled:!1,nativePluginsEnabled:!1,nativeCommentsEnabled:!1,showDesktopOnWallpaperClick:!1,mioEnabled:!1,mioStyle:{appearance:{},physics:{}},showPostStatusRibbons:!0,developerModeEnabled:!1,foldersSharingEnabled:!0,navPlacement:{},navOrder:[],dockPromotedPositions:{}};function Ds(s){return!!s&&typeof s=="object"&&typeof s.then=="function"}function Ma(s){return s.replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"wallpaper"}function Da(s){if(!s||typeof s.id!="number"||!s.source_url)return!1;const e=s.media_details;return!!e&&typeof e.width=="number"&&typeof e.height=="number"&&e.width>0&&e.height>0}function Na(s){if(!s)return"";const e=document.createElement("div");return e.innerHTML=s,e.textContent?.trim()||""}const Di="X-WP-Nonce";function Ha(s,e){const t=qa();if(!t)return e;const o=Ua(s);if(!o||!Fa(o))return e;const i=e?.headers??(typeof Request<"u"&&s instanceof Request?s.headers:void 0),n=new Headers(i??{});return n.has(Di)?e:(n.set(Di,t),{...e??{},headers:n})}function qa(){if(typeof window>"u")return;const e=window.openStationConfig?.restNonce;return typeof e=="string"&&e.length>0?e:void 0}function Ua(s){try{const e=typeof window<"u"&&window.location?window.location.href:void 0;return typeof s=="string"?new URL(s,e):s instanceof URL?s:typeof Request<"u"&&s instanceof Request?new URL(s.url,e):null}catch{return null}}function Fa(s){return typeof window>"u"||!window.location||s.origin!==window.location.origin?!1:!!(s.pathname.includes("/wp-json/")||s.searchParams.has("rest_route"))}function O(s,e,t={}){const o=window.wp?.os?.fetch;if(typeof o=="function")return o(s,e,t);const i=Ha(s,e);return fetch(s,i)}function Wa(){return{...J,customGradient:{...J.customGradient},customImage:null,wallpaperSettings:{...J.wallpaperSettings},ai:{...J.ai},appliedThemeRecommendations:[...J.appliedThemeRecommendations],navPlacement:{...J.navPlacement},navOrder:[...J.navOrder],dockPromotedPositions:{...J.dockPromotedPositions}}}const Ni="__openStationSharedStores";function ja(){const s=window;let e=s[Ni];return e||(e=new Map,s[Ni]=e),e}function K(s,e){const t=ja();let o=t.get(s);o||(o={state:e(),listeners:new Set,rebuild:e},t.set(s,o));const i={get state(){return o.state},set state(n){o.state=n},getState(){return o.state},notify(){for(const n of Array.from(o.listeners))try{n(o.state)}catch(r){console.error(`[desktop-mode/shared-store:${s}] subscriber threw:`,r)}},subscribe(n){return o.listeners.add(n),()=>{o.listeners.delete(n)}},setState(n){const r=o.state;if(typeof r!="object"||r===null){console.warn(`[desktop-mode/shared-store:${s}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(r,n),i.notify()},reset(){const n=o.rebuild(),r=o.state;if(typeof r=="object"&&r!==null&&typeof n=="object"&&n!==null){const a=r;for(const l of Object.keys(a))delete a[l];Object.assign(a,n)}else o.state=n;o.listeners.clear()}};return i}const Hi=K("desktop-mode/settings-tab-registry",()=>({registry:new Map,listeners:new Set})),Va=Hi.state.registry,qi=Hi.state.listeners;function Oa(){return Array.from(Va.values()).sort((s,e)=>(s.order??100)-(e.order??100))}function Ka(s){return qi.add(s),()=>{qi.delete(s)}}const Ui="https://openstation.blog/",Fi="https://openstation.blog/feed/",Ba="https://github.com/WordPress/openstation/";function Ga(s,e){return s.clientWidth>0&&s.clientHeight>0?Promise.resolve():new Promise(t=>{const o=()=>{i.disconnect(),e.removeEventListener("abort",o),t()},i=new ResizeObserver(()=>{s.clientWidth>0&&s.clientHeight>0&&o()});e.addEventListener("abort",o,{once:!0}),i.observe(s)})}function Ns(s){if(typeof s!="string"||s==="")return"";try{const e=new URL(s,window.location.href);return e.protocol==="http:"||e.protocol==="https:"?e.href:""}catch{return""}}function ae(s){return typeof s=="string"?s.trim():""}function Xa(s){if(!s||typeof s!="object")return null;const e=s,o=(Array.isArray(e.items)?e.items:[]).map(i=>{if(!i||typeof i!="object")return null;const n=i,r=ae(n.title),a=Ns(n.url);return r===""||a===""?null:{title:r,url:a,author:ae(n.author),publishedAt:ae(n.publishedAt),excerpt:ae(n.excerpt)}}).filter(i=>i!==null).slice(0,5);return{title:ae(e.title)||d("OpenStation"),description:ae(e.description)||d("A public dev diary — building a desktop OS for wp-admin."),homeUrl:Ns(e.homeUrl)||Ui,feedUrl:Ns(e.feedUrl)||Fi,items:o,stale:e.stale===!0}}function Za(s){if(s==="")return"";const e=new Date(s);return Number.isNaN(e.getTime())?"":e.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Wi(s){const e=Za(s.publishedAt);return e&&s.author?j("%1$s · %2$s",e,s.author):e||s.author}function Ya(s){return c` |
| 277 |
<article class="os-settings__about-featured"> |
| 278 |
<a href=${s.url} target="_blank" rel="noopener noreferrer"> |
| 279 |
<div class="os-settings__about-featured-copy"> |
| 280 |
<span class="os-settings__about-kicker" |
| 281 |
>${d("Latest dispatch")}</span |
| 282 |
> |
| 283 |
<h3>${s.title}</h3> |
| 284 |
${s.excerpt?c`<p>${s.excerpt}</p>`:c``} |
| 285 |
</div> |
| 286 |
<footer> |
| 287 |
<span>${Wi(s)}</span> |
| 288 |
<strong |
| 289 |
>${d("Read the dispatch")} |
| 290 |
<span aria-hidden="true">↗</span></strong |
| 291 |
> |
| 292 |
</footer> |
| 293 |
</a> |
| 294 |
</article> |
| 295 |
`}function Ja(s){return c` |
| 296 |
<article class="os-settings__about-card" role="listitem"> |
| 297 |
<a href=${s.url} target="_blank" rel="noopener noreferrer"> |
| 298 |
<span class="os-settings__about-card-meta" |
| 299 |
>${Wi(s)}</span |
| 300 |
> |
| 301 |
<h3>${s.title}</h3> |
| 302 |
${s.excerpt?c`<p>${s.excerpt}</p>`:c``} |
| 303 |
<strong |
| 304 |
>${d("Read more")} |
| 305 |
<span aria-hidden="true">↗</span></strong |
| 306 |
> |
| 307 |
</a> |
| 308 |
</article> |
| 309 |
`}function Qa(s){if(s.kind==="loading")return c` |
| 310 |
<div |
| 311 |
class="os-settings__about-status" |
| 312 |
role="status" |
| 313 |
aria-live="polite" |
| 314 |
> |
| 315 |
<span |
| 316 |
class="os-settings__about-spinner" |
| 317 |
aria-hidden="true" |
| 318 |
></span> |
| 319 |
<div> |
| 320 |
<strong>${d("Opening the journal…")}</strong> |
| 321 |
<span |
| 322 |
>${d("The latest posts are arriving over RSS.")}</span |
| 323 |
> |
| 324 |
</div> |
| 325 |
</div> |
| 326 |
`;if(s.kind==="error")return c` |
| 327 |
<div |
| 328 |
class="os-settings__about-status os-settings__about-status--error" |
| 329 |
role="alert" |
| 330 |
> |
| 331 |
<span class="dashicons dashicons-rss" aria-hidden="true"></span> |
| 332 |
<div> |
| 333 |
<strong>${d("The journal could not be reached.")}</strong> |
| 334 |
<span |
| 335 |
>${d("You can still read every post on openstation.blog.")}</span |
| 336 |
> |
| 337 |
</div> |
| 338 |
</div> |
| 339 |
`;if(s.feed.items.length===0)return c` |
| 340 |
<div class="os-settings__about-status" role="status"> |
| 341 |
<span class="dashicons dashicons-rss" aria-hidden="true"></span> |
| 342 |
<div> |
| 343 |
<strong>${d("No dispatches yet.")}</strong> |
| 344 |
<span |
| 345 |
>${d("The journal is open and waiting for its next post.")}</span |
| 346 |
> |
| 347 |
</div> |
| 348 |
</div> |
| 349 |
`;const[e,...t]=s.feed.items;return c` |
| 350 |
${s.feed.stale?c`<p class="os-settings__about-stale" role="status"> |
| 351 |
${d("Showing the last saved copy while the journal reconnects.")} |
| 352 |
</p>`:c``} |
| 353 |
<section |
| 354 |
class="os-settings__about-feed" |
| 355 |
aria-label=${d("Latest journal posts")} |
| 356 |
> |
| 357 |
${Ya(e)} |
| 358 |
${t.length>0?c`<div class="os-settings__about-grid" role="list"> |
| 359 |
${t.map(Ja)} |
| 360 |
</div>`:c``} |
| 361 |
</section> |
| 362 |
`}function Vt(s,e,t){const o=t.kind==="ready"?t.feed:null,i=o?.homeUrl||Ui,n=o?.feedUrl||Fi,r=o?.description||d("A public dev diary — building a desktop OS for wp-admin."),a=`${e.pluginUrl??""}/assets/images/openstation-mark.svg`,l=e.pluginVersion??"";L(c` |
| 363 |
<div class="os-settings__about-inner"> |
| 364 |
<header class="os-settings__about-overview"> |
| 365 |
<div class="os-settings__about-identity"> |
| 366 |
<img src=${a} alt="" width="64" height="64" /> |
| 367 |
<div> |
| 368 |
<span class="os-settings__about-eyebrow" |
| 369 |
>${d("About OpenStation")}</span |
| 370 |
> |
| 371 |
<h2>${d("A desktop for WordPress.")}</h2> |
| 372 |
<p> |
| 373 |
${d("OpenStation reshapes wp-admin into a personal workspace, with movable windows, a dock, themes, and focused tools that keep your site close at hand.")} |
| 374 |
</p> |
| 375 |
</div> |
| 376 |
</div> |
| 377 |
<div class="os-settings__about-story"> |
| 378 |
<p> |
| 379 |
${d("It is a playful, open-source experiment by Automattic exploring what WordPress can feel like when the dashboard becomes a place of its own.")} |
| 380 |
</p> |
| 381 |
<div class="os-settings__about-meta"> |
| 382 |
<span> |
| 383 |
<strong |
| 384 |
>OpenStation${l?` ${l}`:""}</strong |
| 385 |
> |
| 386 |
<small |
| 387 |
>${d("An experiment by Automattic")}</small |
| 388 |
> |
| 389 |
</span> |
| 390 |
<a |
| 391 |
href=${Ba} |
| 392 |
target="_blank" |
| 393 |
rel="noopener noreferrer" |
| 394 |
> |
| 395 |
${d("View the project")} |
| 396 |
<span aria-hidden="true">↗</span> |
| 397 |
</a> |
| 398 |
</div> |
| 399 |
</div> |
| 400 |
</header> |
| 401 |
|
| 402 |
<div class="os-settings__about-journal-head"> |
| 403 |
<div> |
| 404 |
<span class="os-settings__about-eyebrow" |
| 405 |
>${d("OpenStation Journal")}</span |
| 406 |
> |
| 407 |
<h2>${d("Latest from the station")}</h2> |
| 408 |
<p>${r}</p> |
| 409 |
</div> |
| 410 |
<a |
| 411 |
class="os-settings__about-journal-link" |
| 412 |
href=${i} |
| 413 |
target="_blank" |
| 414 |
rel="noopener noreferrer" |
| 415 |
> |
| 416 |
${d("Visit the journal")} |
| 417 |
<span aria-hidden="true">↗</span> |
| 418 |
</a> |
| 419 |
</div> |
| 420 |
|
| 421 |
${Qa(t)} |
| 422 |
|
| 423 |
<footer class="os-settings__about-footer"> |
| 424 |
<p> |
| 425 |
<strong>${d("OpenStation Journal")}</strong> |
| 426 |
<span |
| 427 |
>${d("News and field notes, delivered over RSS.")}</span |
| 428 |
> |
| 429 |
</p> |
| 430 |
<a |
| 431 |
href=${n} |
| 432 |
target="_blank" |
| 433 |
rel="noopener noreferrer" |
| 434 |
> |
| 435 |
<span |
| 436 |
class="dashicons dashicons-rss" |
| 437 |
aria-hidden="true" |
| 438 |
></span> |
| 439 |
${d("RSS feed")} |
| 440 |
</a> |
| 441 |
</footer> |
| 442 |
</div> |
| 443 |
`,s)}function el(){const s=document.createElement("div");s.classList.add("os-settings__about");const e=window.openStationConfig??{};Vt(s,e,{kind:"loading"});const t=new AbortController;let o=!1;const i=async()=>{if(await Ga(s,t.signal),!(o||!s.isConnected)){if(!e.aboutFeedUrl){Vt(s,e,{kind:"error"});return}try{const r=await O(e.aboutFeedUrl,{credentials:"same-origin",signal:t.signal},{windowId:"desktop-mode-os-settings",source:"openstation/about-feed"});if(!r.ok)throw new Error(`about feed returned ${r.status}`);const a=await r.json(),l=a.success?Xa(a.data):null;if(!l)throw new Error("about feed returned an invalid payload");!o&&s.isConnected&&Vt(s,e,{kind:"ready",feed:l})}catch(r){if(t.signal.aborted||o)return;typeof console<"u"&&console.error("[openstation/about] journal feed failed:",r),Vt(s,e,{kind:"error"})}}};requestAnimationFrame(()=>{i()});const n=new MutationObserver(()=>{s.isConnected||(o=!0,t.abort(),n.disconnect())});return n.observe(document.body,{childList:!0,subtree:!0}),s}function tl(s,e){switch(s){case"wp-blue":return d("WordPress Blue");case"indigo":return d("Indigo");case"teal":return d("Teal");case"emerald":return d("Emerald");case"amber":return d("Amber");case"rose":return d("Rose");default:return e}}function sl(s,e){switch(s){case"compact":return d("Compact");case"default":return d("Default");case"large":return d("Large");default:return e}}function ol(s,e){switch(s){case"sharp":return d("Sharp");case"default":return d("Default");case"round":return d("Round");default:return e}}function il(s,e){switch(s){case"static":return d("Static");case"dynamic":return d("Dynamic");case"hidden":return d("Hidden");default:return e}}function nl(s,e){switch(s){case"bottom":return d("Bottom");case"left":return d("Left");case"right":return d("Right");default:return e}}function rl(s,e){switch(s){case"classic":return d("Split");case"unified":return d("Unified");default:return e}}function al(s){switch(s){case"classic":return d("Core admin menus are placed in a sidebar; plugins, apps, and OpenStation controls in a dock along the bottom edge.");case"unified":return d("Every menu in a single dock.");default:return""}}const ll="conic-gradient( #f252fc, #9af2ff, #93f0c6, #f8f2b6, #ff5a5a, #f252fc )";function cl(s){const e=()=>{const r=i.querySelector(".os-settings__accent-picker");if(r)try{r.showPicker()}catch{r.click()}},t=r=>{const a=r.detail?.value??"";a!==me&&!Ms().some(l=>l.id===a)||(s.state.accent=a,s.save(),s.apply(),n(),a===me&&e())},o=r=>{const a=r.target.value;/^#[0-9a-fA-F]{6}$/.test(a)&&(s.state.customAccent=a,s.state.accent=me,s.save(),s.apply(),n())},i=document.createElement("div"),n=()=>{const r=s.state.accent===me;L(c` |
| 444 |
<os-section |
| 445 |
heading=${d("Accent color")} |
| 446 |
description=${d("Used in focused window title bars, buttons, and focus rings.")} |
| 447 |
> |
| 448 |
<os-swatch-grid |
| 449 |
label=${d("Accent color")} |
| 450 |
mode="row" |
| 451 |
@os-pick=${t} |
| 452 |
> |
| 453 |
${Ms().map(a=>c`<os-swatch |
| 454 |
value=${a.id} |
| 455 |
label=${tl(a.id,a.label)} |
| 456 |
preview=${a.value} |
| 457 |
size="small" |
| 458 |
variant="accent" |
| 459 |
?selected=${s.state.accent===a.id} |
| 460 |
></os-swatch>`)} |
| 461 |
<span class="os-settings__accent-custom"> |
| 462 |
<os-swatch |
| 463 |
value=${me} |
| 464 |
label=${d("Custom")} |
| 465 |
preview=${r?s.state.customAccent:ll} |
| 466 |
size="small" |
| 467 |
variant="accent" |
| 468 |
?selected=${r} |
| 469 |
></os-swatch> |
| 470 |
<input |
| 471 |
type="color" |
| 472 |
class="os-settings__accent-picker" |
| 473 |
tabindex="-1" |
| 474 |
aria-hidden="true" |
| 475 |
.value=${s.state.customAccent} |
| 476 |
@input=${o} |
| 477 |
/> |
| 478 |
</span> |
| 479 |
</os-swatch-grid> |
| 480 |
</os-section> |
| 481 |
`,i)};return n(),i}function dl(s){switch(s){case"dynamic":return d("The admin bar slides out of the way and comes back when you move the pointer to the top edge of the screen.");case"hidden":return d("The admin bar is never shown. Use the Exit OpenStation tile on the dock to get back to the classic admin.");default:return d("The admin bar is always visible above the desktop.")}}function ul(s){const e=i=>{const n=i.detail?.value??"";zi.some(r=>r.id===n)&&(s.state.adminBarMode=n,s.save(),s.apply(),o())},t=document.createElement("div"),o=()=>L(c` |
| 482 |
<os-section |
| 483 |
heading=${d("Admin bar")} |
| 484 |
description=${dl(s.state.adminBarMode)} |
| 485 |
> |
| 486 |
<os-segmented |
| 487 |
value=${s.state.adminBarMode} |
| 488 |
label=${d("Admin bar")} |
| 489 |
@os-pick=${e} |
| 490 |
> |
| 491 |
${zi.map(i=>c`<os-segment value=${i.id} |
| 492 |
>${il(i.id,i.label)}</os-segment |
| 493 |
>`)} |
| 494 |
</os-segmented> |
| 495 |
</os-section> |
| 496 |
`,t);return o(),t}const hl=w` ${R}:host{display:none;position:fixed;inset:0;align-items:center;justify-content:center;background:var( --os-ui-scrim,rgba( 0,0,0,0.45 ) );background-image:var( --os-ui-scrim-image,none );background-repeat:var( --os-ui-scrim-image-repeat,repeat );background-size:var( --os-ui-scrim-image-size,auto );background-position:var( --os-ui-scrim-image-position,center );backdrop-filter:blur( 2px );z-index:10000}:host( [ open ] ){display:flex;animation:os-confirm-scrim var( --_holo-t ) var( --_holo-ease )}:host( [ open ] ) .dialog{animation:os-confirm-dialog var( --_holo-t ) var( --_holo-spring )}@keyframes os-confirm-scrim{from{opacity:0}}@keyframes os-confirm-dialog{from{opacity:0;transform:scale( 0.96 ) translateY( 8px )}}@media ( prefers-reduced-motion:reduce ){:host( [ open ] ),:host( [ open ] ) .dialog{animation:none}}.dialog{width:min( 420px,92vw );background-color:var( --os-ui-confirm-dialog-bg,#1d2327 );background-image:var( --os-ui-dialog-bg-image,none );background-repeat:var( --os-ui-dialog-bg-image-repeat,repeat );background-size:var( --os-ui-dialog-bg-image-size,auto );background-position:var( --os-ui-dialog-bg-image-position,center );color:var( --os-ui-confirm-dialog-fg,var( --os-fg,#fff ) );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.08 ) );border-radius:10px;box-shadow:0 20px 50px rgba( 0,0,0,0.6 );padding:20px 22px 18px;display:flex;flex-direction:column;gap:10px;position:relative}.close{position:absolute;top:8px;right:10px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;background:transparent;border:0;border-radius:6px;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );cursor:pointer;font-size:22px;line-height:1;padding:0}.close:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) );color:inherit}.btn:focus,.close:focus{outline:none;box-shadow:var( --_holo-focus )}.dialog:focus,.dialog:focus-visible{outline:none}.title{margin:0 0 4px;font-size:16px;font-weight:600}.message{margin:0;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );line-height:1.45;white-space:pre-line}.actions{display:flex;justify-content:flex-end;gap:8px;margin-top:6px}.btn{border:0;border-radius:6px;padding:8px 14px;font-size:13px;cursor:pointer;font-weight:500}.btn--secondary{background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) );color:inherit}.btn--secondary:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.14 ) )}.btn--primary{background:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.btn--primary:hover{filter:brightness( 1.08 )}.btn--danger{background:var( --os-ui-danger,#d63638 );color:var( --os-ui-fg-on-accent,#fff )}.btn--danger:hover{filter:brightness( 1.08 )}`,ji='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function pl(s){let e=s?.activeElement??null;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e&&e!==s?.body?e:null}function Vi(s){const e=s.composedPath(),t=e.length>0?e[0]:s.target;return t instanceof HTMLElement?t:null}function Oi(s){return s!==null&&s.matches(ji)}const Oe=class Oe extends k{constructor(){super(...arguments),this._prevFocus=null,this._focusTries=0,this._onKey=e=>{if(e.key==="Escape"){e.preventDefault(),this._cancel();return}if(e.key==="Tab"){this._trapTab(e);return}if(e.key==="Enter"&&!e.isComposing){if(Oi(Vi(e))||this.hasAttribute("danger"))return;e.preventDefault(),this._confirm()}},this._focusInitial=()=>{if(!this.hasAttribute("open"))return;const e=this.isConnected?this._initialFocusTarget():null;if(e){e.focus();return}if(this._focusTries++<5){queueMicrotask(this._focusInitial);return}this.isConnected&&this.focus()},this._onBackdrop=e=>{const t=e.composedPath();(t.length>0?t[0]:e.target)===this&&this._cancel()},this._confirm=()=>{this.emit("os-confirm",{confirmed:!0}),this.removeAttribute("open")},this._cancel=()=>{this.emit("os-cancel",{confirmed:!1}),this.removeAttribute("open")}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","dialog"),this.setAttribute("aria-modal","true"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),this.addEventListener("keydown",this._onKey),this.addEventListener("click",this._onBackdrop)}disconnectedCallback(){this.removeEventListener("keydown",this._onKey),this.removeEventListener("click",this._onBackdrop),this._restoreFocus()}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),e==="open"&&(o!==null?(this._prevFocus=pl(this.ownerDocument),this._focusTries=0,queueMicrotask(this._focusInitial)):this._restoreFocus())}_focusables(){const e=this.shadowRoot;return e?Array.from(e.querySelectorAll(ji)):[]}_trapTab(e){const t=this._focusables();if(t.length===0)return;const o=t[0],i=t[t.length-1],n=Vi(e),r=!Oi(n);e.shiftKey&&(r||n===o)?(e.preventDefault(),i.focus()):!e.shiftKey&&(r||n===i)&&(e.preventDefault(),o.focus())}_initialFocusTarget(){const e=this.shadowRoot;if(!e)return null;const t=e.querySelector(".btn--secondary"),o=e.querySelector(".dialog");return this.hasAttribute("danger")?t??e.querySelector(".close")??o:e.querySelector(".btn--primary, .btn--danger")??t??o}_restoreFocus(){const e=this._prevFocus;this._prevFocus=null,!(!e||!e.isConnected)&&e.focus()}render(){const e=this.title??"",t=this.message??"",o=this["confirm-label"]||"Confirm",i=this["cancel-label"]||"Cancel",n=this.hasAttribute("danger"),r=this.hasAttribute("hide-cancel"),a=this.hasAttribute("dismissable");return c` |
| 497 |
<div class="dialog" tabindex="-1"> |
| 498 |
${a?c`<button |
| 499 |
type="button" |
| 500 |
class="close" |
| 501 |
aria-label="Close" |
| 502 |
@click=${()=>this._cancel()} |
| 503 |
>×</button>`:c``} |
| 504 |
${e?c`<h2 class="title">${e}</h2>`:c``} |
| 505 |
${t?c`<p class="message">${t}</p>`:c``} |
| 506 |
<div class="actions"> |
| 507 |
${r?c``:c`<button |
| 508 |
type="button" |
| 509 |
class="btn btn--secondary" |
| 510 |
@click=${()=>this._cancel()} |
| 511 |
> |
| 512 |
${i} |
| 513 |
</button>`} |
| 514 |
<button |
| 515 |
type="button" |
| 516 |
class="btn ${n?"btn--danger":"btn--primary"}" |
| 517 |
@click=${()=>this._confirm()} |
| 518 |
> |
| 519 |
${o} |
| 520 |
</button> |
| 521 |
</div> |
| 522 |
</div> |
| 523 |
`}};Oe.props=["open","title","message","confirm-label","cancel-label","danger","hide-cancel","dismissable"],Oe.styles=[hl],Oe.help=void 0;let Hs=Oe;$("os-confirm-dialog",Hs);function Ki(s){return new Promise(e=>{const t=document.createElement("os-confirm-dialog");t.setAttribute("open",""),s.title&&t.setAttribute("title",s.title),t.setAttribute("message",s.message),s.confirmLabel&&t.setAttribute("confirm-label",s.confirmLabel),s.cancelLabel&&t.setAttribute("cancel-label",s.cancelLabel),s.danger&&t.setAttribute("danger",""),s.hideCancel&&t.setAttribute("hide-cancel",""),s.dismissable&&t.setAttribute("dismissable","");const o=i=>{t.remove(),e(i)};t.addEventListener("os-confirm",()=>o(!0)),t.addEventListener("os-cancel",()=>o(!1)),document.body.appendChild(t)})}const Bi=K("desktop-mode/dock-rail-registry",()=>({registry:new Map,listeners:new Set,activeId:"default"})),Gi=Bi.state.registry,Xi=Bi.state.listeners;function fl(s){return Gi.get(s)}function Zi(){return Array.from(Gi.values())}function gl(s){return Xi.add(s),()=>{Xi.delete(s)}}function Ot(){const s=window.wp?.hooks;if(!s)throw new Error("[openstation] `window.wp.hooks` is not available. The plugin declares `wp-hooks` as a script dependency; if you are seeing this error, verify the enqueue order.");return s}function bl(s,e,t,o){Ot().addAction(s,e,t,o)}function ml(s,e){return Ot().removeAction(s,e)}function Q(s,e,...t){return Ot().applyFilters(s,e,...t)}function re(s,...e){Ot().doAction(s,...e)}const F={WALLPAPERS:"os.wallpapers",UNFOCUS_EFFECTS:"os.unfocus-effects",WINDOW_REVEALS:"os.window-reveals",WALLPAPER_PREVIEW_PARAMS:"os.wallpaper.preview-params",WALLPAPER_SETTINGS_CHANGED:"os.wallpaper.settings-changed",SHELL_ERROR:"os.shell.error",DESKTOP_THEME_ICON:"os.os-theme.icon",DESKTOP_THEME_ICON_COLOR:"os.os-theme.icon-color",WALLPAPERS_SERVER_CHANGED:"os.wallpapers.server-changed",WINDOW_LINK_RENDERERS:"os.window-links.renderers"};function Yi(s,e){if(!s||typeof s!="object")return["def (not an object)"];const t=s,o=[];for(const i of e)i.valid(t)||o.push(`${i.field} (${i.message})`);return o}class vl extends Error{constructor(e,t,o){super(`[openstation] ${e} registration rejected — fields: `+t.join(", ")+"."),this.name="RegistrationError",this.kind=e,this.errors=t,this.def=o}}function qs(s,e,t){if(e.length!==0)throw new vl(s,e,t)}const ee=[[0,0],[100,0],[100,100],[0,100]],_l=48,yl=80,Us=6,Fs=8,Ji=4,Qi=3,en=64,Ws=105,te=2;function tn(s){return`${Math.round(s*1e3)/1e3}%`}function se(s){return s.slice().reverse()}function ve(s,e,t,o){return[[s,e],[t,e],[t,o],[s,o]]}function wl(s,e,t,o){const i=[];for(let n=0;n<o;n++){const r=n/o*Math.PI*2;i.push([s+Math.cos(r)*t,e+Math.sin(r)*t])}return i}function B(s,e=[]){const t=[],o=i=>{t.push(`${tn(i[0])} ${tn(i[1])}`)};for(const i of s)o(i);if(e.length>0){o(s[0]);for(const i of e){for(const n of i)o(n);o(i[0]),o(s[0])}}return`polygon( ${t.join(", ")} )`}function sn(s){return B(ee,[se(wl(50,50,s,_l))])}function on(s){return B(ee,[se(ve(50-s,-te,50+s,100+te))])}function nn(s){const e=100/Us,t=[];for(let o=0;o<Us;o++){const i=o*e;t.push(se(ve(-te,i,100+te,i+s)))}return B(ee,t)}function rn(s){return B(ee,[se(ve(-te,50-s,100+te,50+s))])}function an(s){const e=100/Fs,t=[];for(let o=0;o<Fs;o++){const i=o*e;t.push(se(ve(i,-te,i+s,100+te)))}return B(ee,t)}function ln(s){return B(ee,[se([[50,50-s],[50+s,50],[50,50+s],[50-s,50]])])}function cn(s){const e=100/Ji,t=100/Qi,o=[];for(let i=0;i<Qi;i++)for(let n=0;n<Ji;n++){const r=n*e+e/2,a=i*t+t/2,l=e/2*s,u=t/2*s;o.push(se(ve(r-l,a-u,r+l,a+u)))}return B(ee,o)}function dn(s){const e=-Math.PI/2,t=s/180*Math.PI,o=[[50,50]];for(let i=0;i<en;i++){const n=e+i/(en-1)*t;o.push([50+Math.cos(n)*Ws,50+Math.sin(n)*Ws])}return B(ee,[se(o)])}function xl(){return{from:sn(0),to:sn(yl)}}function kl(){return{from:on(0),to:on(52)}}function $l(){return{from:nn(0),to:nn(100/Us+.5)}}function Al(){return{from:rn(0),to:rn(52)}}function Cl(){return{from:an(0),to:an(100/Fs+.5)}}function Sl(){return{from:ln(0),to:ln(Ws)}}function El(){return{from:cn(0),to:cn(1.04)}}function Ll(){return{from:dn(0),to:dn(360)}}function Rl(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 100% 0% )"}}function Tl(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 0% 100% )"}}function Pl(){return{from:B([[-60,0],[100,0],[100,100],[0,100]]),to:B([[100,0],[260,0],[260,100],[160,100]])}}const js=6,Vs=100,le=Vs/2,Kt=200,un=90,hn=["#5c5c6d","#525261","#484855","#3e3e49","#34343d","#2a2a31"],zl="#101014",Il=1.25,ce="http://www.w3.org/2000/svg";let Ml=0;function Bt(s){return Math.round(s*1e3)/1e3}function Os(s){return s/js*Math.PI*2-Math.PI/2}function Dl(s){const t=Os(s)+Math.PI/js+Math.PI/2;return{x:Math.cos(t),y:Math.sin(t)}}function Nl(s){const e=Os(s),t=Os(s+1);return[[le,le],[le+Math.cos(e)*Kt,le+Math.sin(e)*Kt],[le+Math.cos(t)*Kt,le+Math.sin(t)*Kt]]}function pn(s,e){const t=Nl(s),o=document.createElementNS(ce,"path");return o.setAttribute("d",`M ${t.map(([i,n])=>`${Bt(i)} ${Bt(n)}`).join(" L ")} Z`),e?o.setAttribute("fill","#fff"):(o.setAttribute("fill",hn[s%hn.length]),o.setAttribute("stroke",zl),o.setAttribute("stroke-width",String(Il)),o.setAttribute("vector-effect","non-scaling-stroke"),o.setAttribute("stroke-linejoin","round")),o}function Hl(){const s=`os-iris-${++Ml}`,e=document.createElementNS(ce,"svg");e.setAttribute("viewBox",`0 0 ${Vs} ${Vs}`),e.setAttribute("preserveAspectRatio","none"),e.setAttribute("aria-hidden","true"),e.style.width="100%",e.style.height="100%",e.style.display="block";const t=document.createElementNS(ce,"defs"),o=document.createElementNS(ce,"mask");o.setAttribute("id",s);const i=document.createElementNS(ce,"g"),n=document.createElementNS(ce,"g");n.setAttribute("mask",`url(#${s})`);const r=[];for(let l=0;l<js;l++){const u=pn(l,!0),h=pn(l,!1);i.appendChild(u),n.appendChild(h),r.push({el:u,index:l},{el:h,index:l})}o.appendChild(i),t.appendChild(o),e.appendChild(t),e.appendChild(n);const a=document.createElement("div");return a.appendChild(e),{element:a,play:l=>r.map(({el:u,index:h})=>{const p=Dl(h),m=Bt(p.x*un),_=Bt(p.y*un);return u.animate([{transform:"translate( 0px, 0px )"},{transform:`translate( ${m}px, ${_}px )`}],{duration:l.duration,easing:l.easing,delay:l.delay,fill:"both"})})}}const _e="none",fn=K("desktop-mode/window-reveal-registry",()=>({registry:new Map,listeners:new Set})),Ks=fn.state.registry,Bs=fn.state.listeners,gn=/^[a-z0-9_/-]+$/;function bn(s){const e=/^\s*([a-zA-Z-]+)\s*\(/.exec(s);return e?e[1].toLowerCase():""}const ql=0;function mn(s,e){const t=[],o=typeof s.from=="string"&&s.from.trim()!=="",i=typeof s.to=="string"&&s.to.trim()!=="";if(o||t.push(`${e}.from (missing — the clip-path covering the window)`),i||t.push(`${e}.to (missing — the clip-path uncovering the window)`),o&&i){const n=bn(s.from),r=bn(s.to);n===""||r===""?t.push(`${e}.from|to (must be shape functions, e.g. \`inset( … )\` or \`polygon( … )\` — bare keywords like \`none\` cannot be animated)`):n!==r&&t.push(`${e}.from|to (must use the same shape function to interpolate — got \`${n}()\` and \`${r}()\`)`)}return t}function Ul(s){if(typeof KeyframeEffect!="function")return!0;try{return new KeyframeEffect(null,null,{easing:s}),!0}catch{return!1}}function W(s){const e=[];if(!s||typeof s!="object")e.push("def (not an object)");else{typeof s.id!="string"||s.id.trim()===""?e.push("id (missing)"):gn.test(s.id.trim().toLowerCase())?s.id.trim().toLowerCase()===_e&&e.push('id ("none" is reserved)'):e.push(`id (must match ${gn} — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-id)`),(typeof s.label!="string"||s.label.trim()==="")&&e.push("label (missing)");const o=s.render!==void 0,i=Array.isArray(s.layers),n=s.from!==void 0||s.to!==void 0;o&&typeof s.render!="function"?e.push("render (not a function)"):o&&(i||n)?e.push("render|layers|from|to (supply exactly one of: a from/to pair, a layers array, or a render function)"):o||(i&&n?e.push("layers|from|to (supply EITHER a single from/to pair OR a layers array, not both)"):i?(s.layers.length===0&&e.push("layers (empty — supply at least one matched pair)"),s.layers.forEach((r,a)=>{if(!r||typeof r!="object"){e.push(`layers[ ${a} ] (not an object)`);return}e.push(...mn(r,`layers[ ${a} ]`))})):e.push(...mn(s,"").map(r=>r.replace(/^\./,"")))),s.easing!==void 0&&(typeof s.easing!="string"||s.easing.trim()===""?e.push("easing (not a non-empty string)"):Ul(s.easing)||e.push("easing (not an easing the browser can parse — `Element.animate()` would throw at play time, with the covering surface already over the window)"))}qs("WindowReveal",e,s);const t=s.id.trim().toLowerCase();Ks.set(t,{...s,id:t}),jl()}function vn(){const s=Array.from(Ks.values()),e=Q(F.WINDOW_REVEALS,s);return Array.isArray(e)?e:(typeof console<"u"&&console.warn("[openstation] `os.window-reveals` filter returned a non-array; falling back to registry list."),s)}function Fl(s){return Ks.has(s)}function Wl(s){return Bs.add(s),()=>{Bs.delete(s)}}function jl(){const s=Array.from(Bs);for(const e of s)try{e()}catch(t){typeof console<"u"&&console.error("[openstation] window-reveal registry listener threw:",t)}}W({id:"sweep",label:d("Sweep"),description:d("A straight edge travels across the window, uncovering the page behind it."),...Tl(),duration:420}),W({id:"iris",label:d("Iris"),description:d("The page opens out from the centre of the window, like a camera shutter."),...xl(),duration:520}),W({id:"curtain",label:d("Curtain"),description:d("Two panels part from the middle of the window and slide off the sides."),...kl(),duration:480}),W({id:"blinds",label:d("Blinds"),description:d("Six horizontal slats retract at once, letting the page through between them."),...$l(),duration:560}),W({id:"diagonal",label:d("Diagonal"),description:d("A slanted edge sweeps off the trailing corner of the window."),...Pl(),duration:460}),W({id:"rise",label:d("Rise"),description:d("The page rises into the window from the bottom edge upward."),...Rl(),duration:440}),W({id:"shutter",label:d("Shutter"),description:d("Two panels part from the middle of the window and slide off the top and bottom."),...Al(),duration:480}),W({id:"slats",label:d("Slats"),description:d("Eight vertical slats retract at once, letting the page through between them."),...Cl(),duration:560}),W({id:"diamond",label:d("Diamond"),description:d("The page opens out from the centre of the window through a growing rhombus."),...Sl(),duration:520}),W({id:"mosaic",label:d("Mosaic"),description:d("The page arrives as a grid of tiles, each opening out from its own centre."),...El(),duration:600}),W({id:"obturator",label:d("Camera shutter"),description:d("Six wedges slide aside in unison, opening a hexagonal aperture from the centre like the iris of a camera lens."),render:Hl,duration:720,edgeLag:0}),W({id:"radar",label:d("Radar"),description:d("A spoke sweeps a full turn around the centre of the window, uncovering the page behind it."),...Ll(),duration:760});const _n={dockSize:["compact","default","large"],desktopLayout:["classic","unified"],dockPlacement:["bottom","left","right"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"]},yn=["dockRailRenderer","windowReveal","accent"],wn={windowRevealDuration:{min:80,max:4e3}},Vl=/^[a-z0-9_-]+$/;[...Object.keys(_n),...yn,...Object.keys(wn)];function xn(s){if(!s||typeof s!="object"||Array.isArray(s))return{};const e=s,t={},o={};for(const[i,n]of Object.entries(_n)){const r=e[i];typeof r=="string"&&n.includes(r)&&(t[i]=r)}for(const i of yn){const n=e[i];typeof n=="string"&&Vl.test(n)&&(t[i]=n)}for(const[i,n]of Object.entries(wn)){const r=e[i];typeof r=="number"&&Number.isFinite(r)&&(o[i]=Math.min(n.max,Math.max(n.min,Math.round(r))))}return{...t,...o}}function Gs(s){const e=xn(s);return typeof e.dockRailRenderer=="string"&&fl(e.dockRailRenderer)===void 0&&delete e.dockRailRenderer,typeof e.windowReveal=="string"&&e.windowReveal!==_e&&!Fl(e.windowReveal)&&delete e.windowReveal,typeof e.accent=="string"&&!Ms().some(t=>t.id===e.accent)&&delete e.accent,e}const Ol=/^[a-z0-9_-]+$/,kn=128;function Kl(s){return typeof s!="string"||s===""||s.length>2048?!1:s.startsWith("dashicons-")||s.startsWith("https://")||s.startsWith("http://")||s.startsWith("data:image/")}function $n(s){if(!s||typeof s!="object")return null;const e=s,t=typeof e.slug=="string"?e.slug:"";if(!Ol.test(t))return null;const o={};if(e.icons&&typeof e.icons=="object"){let l=0;for(const[u,h]of Object.entries(e.icons)){if(l>=kn)break;u===""||!Kl(h)||(o[u]=h,l+=1)}}const i={};if(e.tokens&&typeof e.tokens=="object")for(const[l,u]of Object.entries(e.tokens))typeof u=="string"&&(i[l]=u);const n=[];if(Array.isArray(e.fonts))for(const l of e.fonts)typeof l=="string"&&l!==""&&n.push(l);const r={};if(e.iconColors&&typeof e.iconColors=="object"){let l=0;for(const[u,h]of Object.entries(e.iconColors)){if(l>=kn)break;u===""||typeof h!="string"||h===""||(r[u]=h,l+=1)}}const a=l=>typeof e[l]=="string"?e[l]:"";return{id:a("id")||t,slug:t,name:a("name")||t,version:a("version"),author:a("author"),description:a("description"),previewUrl:a("previewUrl"),cssUrl:a("cssUrl"),cssText:a("cssText"),tokens:i,fonts:n,icons:o,iconColors:r,recommendedOsSettings:xn(e.recommendedOsSettings),installedAt:typeof e.installedAt=="number"?e.installedAt:0,source:e.source==="code"?"code":"upload"}}function Bl(){const e=window.openStationConfig?.serverDesktopThemes,t=[];if(Array.isArray(e))for(const o of e){const i=$n(o);i&&t.push(i)}return{themes:t,activeId:null,activeIcons:null,activeIconColors:null}}const Z=K("desktop-mode/desktop-themes",Bl);function An(){return Z}function Gl(){return Z.getState().themes.slice()}function Cn(s){if(typeof s!="string"||s==="")return null;const e=s.replace(/\//g,"-");return Z.getState().themes.find(t=>t.slug===e||t.id===s)??null}function Xl(s){const e=$n(s);if(!e)return null;const t=Z.state.themes.slice(),o=t.findIndex(i=>i.slug===e.slug);return o>=0?t[o]=e:t.push(e),t.sort((i,n)=>i.name.localeCompare(n.name)),Z.setState({themes:t}),e}function Zl(s){const e=Z.state.themes.filter(t=>t.slug!==s);e.length!==Z.state.themes.length&&Z.setState({themes:e})}function Yl(s){return Z.subscribe(s)}async function Sn(s,e){try{const t=await s.json();if(t&&typeof t.message=="string"&&t.message!=="")return t.message}catch{}return`${e} (HTTP ${s.status}).`}function En(s){const e=s?.serverWallpapers;Array.isArray(e)&&re(F.WALLPAPERS_SERVER_CHANGED,{wallpapers:e})}async function Jl(s,e){const t=s.desktopThemesUrl??"";if(t==="")throw new Error("[openstation] No desktopThemesUrl in the shell config — the desktop-themes REST route is unavailable.");const o=new FormData;o.append("file",e,e.name);const i=await O(t,{method:"POST",credentials:"same-origin",headers:{"X-WP-Nonce":s.restNonce},body:o},{source:"desktop-mode/desktop-themes/upload"});if(!i.ok)throw new Error(await Sn(i,"Theme upload failed"));const n=await i.json();return En(n),n}async function Ql(s,e){const t=s.desktopThemesUrl??"";if(t==="")throw new Error("[openstation] No desktopThemesUrl in the shell config — the desktop-themes REST route is unavailable.");const o=await O(`${t}/${encodeURIComponent(e)}`,{method:"DELETE",credentials:"same-origin",headers:{"X-WP-Nonce":s.restNonce}},{source:"desktop-mode/desktop-themes/delete"});if(!o.ok)throw new Error(await Sn(o,"Theme delete failed"));try{En(await o.json())}catch{}}function ec(s){const e=An().state;if(e.activeIcons===null||!s)return null;const t=e.activeIcons[s];if(typeof t!="string"||t==="")return null;const o=Q(F.DESKTOP_THEME_ICON,t,{slot:s,themeId:e.activeId??""});return typeof o=="string"&&o!==""?o:null}function tc(s){const e=An().state;if(e.activeIconColors===null||!s)return null;const t=e.activeIconColors[s];if(typeof t!="string"||t==="")return null;const o=Q(F.DESKTOP_THEME_ICON_COLOR,t,{slot:s,themeId:e.activeId??""});return typeof o=="string"&&o!==""?sc(o):null}function sc(s){const e=s.trim();if(e===""||e.length>64||/[;{}<>"'\\]/.test(e))return null;let t=0;for(const o of e)if(o==="(")t+=1;else if(o===")"&&(t-=1,t<0))return null;return t===0?e:null}const ye={OS_SETTINGS:"OS_SETTINGS",RECYCLE_BIN:"RECYCLE_BIN",BUG_REPORT:"BUG_REPORT",EXIT_OPENSTATION:"EXIT_OPENSTATION",PWA_INSTALL:"PWA_INSTALL"},oc={"desktop-mode-os-settings":ye.OS_SETTINGS,"desktop-mode-recycle-bin":ye.RECYCLE_BIN,"desktop-mode-bug-report":ye.BUG_REPORT,"os-exit":ye.EXIT_OPENSTATION,"os-pwa-install":ye.PWA_INSTALL};function ic(s){if(typeof s!="string"||s==="")return"";const e=oc[s];if(e)return e;const t=s.toLowerCase().replace(/[^a-z0-9_-]/g,"");return t===""?"":`APP:${t}`}const Ln="",nc="system-default",Rn={accent:"pulse",desktopLayout:"unified",dockPlacement:"bottom"};function Tn(s,e,t={}){const o=e===Ln,i=o?null:Cn(e);if(!o&&!i)return{};const n=o?nc:i.slug,r=s.appliedThemeRecommendations.includes(n);if(r&&!t.force)return{};const a=Gs(o?Rn:i.recommendedOsSettings),l=Object.keys(a);if(l.length===0)return{};const u=s,h={};for(const p of l){const m=a[p];typeof m!="string"&&typeof m!="number"||!(p in s)||typeof u[p]!=typeof m||(u[p]=m,h[p]=m)}return Object.keys(h).length===0?{}:(r||(s.appliedThemeRecommendations=[...s.appliedThemeRecommendations,n].slice(-64)),h)}function rc(s){if(s===Ln)return Object.keys(Gs(Rn)).length>0;const e=Cn(s);return e?Object.keys(Gs(e.recommendedOsSettings)).length>0:!1}const Gt="",Pn="OpenStation";function ac(s){const e=s.trim().split(/\s+/).filter(Boolean);return e.length===0?"?":e.length>=2?(e[0][0]+e[1][0]).toUpperCase():e[0].slice(0,2).toUpperCase()}function lc(s){const e=document.createElement("div");e.className="os-settings__themes";let t="",o=!1;const i=!!s.config.canManageDesktopThemes,n=f=>{s.state.desktopTheme!==f&&(s.state.desktopTheme=f,Tn(s.state,f),s.save(),s.apply(),y())},r=f=>{const g=Tn(s.state,f,{force:!0});Object.keys(g).length!==0&&(s.save(),s.apply(),y())},a=async f=>{if(!o){o=!0,t="",y();try{const g=await Jl(s.config,f);Xl(g)}catch(g){t=g instanceof Error?g.message:d("That theme could not be installed.")}finally{o=!1,y()}}},l=async f=>{if(await Ki({title:d("Delete this theme?"),message:j(d("“%s” will be removed from this site for everyone. This cannot be undone."),f.name),confirmLabel:d("Delete"),danger:!0})){t="";try{await Ql(s.config,f.slug),Zl(f.slug),s.state.desktopTheme===f.slug&&(s.state.desktopTheme=Gt,s.save(),s.apply())}catch(x){t=x instanceof Error?x.message:d("That theme could not be deleted.")}y()}},u=f=>{const g=f.currentTarget,x=g.files?.[0];x&&a(x),g.value=""},h=f=>{f.preventDefault(),f.currentTarget.classList.remove("os-settings__theme-upload--dragover");const g=f.dataTransfer?.files?.[0];g&&a(g)},p=f=>{const g=s.state.desktopTheme===f.slug;return c`<div class="os-settings__theme-card-wrap"> |
| 524 |
<button |
| 525 |
type="button" |
| 526 |
class="os-settings__theme-card" |
| 527 |
aria-pressed=${g?"true":"false"} |
| 528 |
data-theme-slug=${f.slug} |
| 529 |
@click=${()=>n(f.slug)} |
| 530 |
> |
| 531 |
<span class="os-settings__theme-preview"> |
| 532 |
${f.previewUrl?c`<img |
| 533 |
src=${f.previewUrl} |
| 534 |
alt="" |
| 535 |
aria-hidden="true" |
| 536 |
draggable="false" |
| 537 |
/>`:c`<span |
| 538 |
class="os-settings__theme-initials" |
| 539 |
aria-hidden="true" |
| 540 |
>${ac(f.name)}</span |
| 541 |
>`} |
| 542 |
</span> |
| 543 |
<span class="os-settings__theme-name" |
| 544 |
>${f.name}</span |
| 545 |
> |
| 546 |
<span class="os-settings__theme-meta"> |
| 547 |
${f.version!==""?j(d("Version %s"),f.version):""} |
| 548 |
</span> |
| 549 |
</button> |
| 550 |
${i&&f.source!=="code"?c`<button |
| 551 |
type="button" |
| 552 |
class="os-settings__theme-delete" |
| 553 |
aria-label=${j(d("Delete %s"),f.name)} |
| 554 |
@click=${()=>void l(f)} |
| 555 |
> |
| 556 |
× |
| 557 |
</button>`:""} |
| 558 |
</div>`},m=()=>{const f=s.state.desktopTheme===Gt;return c`<div class="os-settings__theme-card-wrap"> |
| 559 |
<button |
| 560 |
type="button" |
| 561 |
class="os-settings__theme-card os-settings__theme-card--system" |
| 562 |
aria-pressed=${f?"true":"false"} |
| 563 |
@click=${()=>n(Gt)} |
| 564 |
> |
| 565 |
<span |
| 566 |
class="os-settings__theme-preview os-settings__theme-preview--system" |
| 567 |
aria-hidden="true" |
| 568 |
></span> |
| 569 |
<span class="os-settings__theme-name" |
| 570 |
>${Pn}</span |
| 571 |
> |
| 572 |
<span class="os-settings__theme-meta" |
| 573 |
>${d("The look OpenStation ships with")}</span |
| 574 |
> |
| 575 |
</button> |
| 576 |
</div>`},_=()=>c`<div |
| 577 |
class=${o?"os-settings__theme-upload os-settings__theme-upload--busy":"os-settings__theme-upload"} |
| 578 |
@dragover=${f=>{f.preventDefault(),f.currentTarget.classList.add("os-settings__theme-upload--dragover")}} |
| 579 |
@dragleave=${f=>{f.currentTarget.classList.remove("os-settings__theme-upload--dragover")}} |
| 580 |
@drop=${h} |
| 581 |
> |
| 582 |
<label class="os-settings__theme-upload-label"> |
| 583 |
<input |
| 584 |
type="file" |
| 585 |
accept=".zip,application/zip" |
| 586 |
class="os-settings__file-input" |
| 587 |
?disabled=${o} |
| 588 |
@change=${u} |
| 589 |
/> |
| 590 |
<span class="os-settings__theme-upload-plus" aria-hidden="true" |
| 591 |
>+</span |
| 592 |
> |
| 593 |
<span class="os-settings__theme-upload-prompt" |
| 594 |
>${d(o?"Installing…":"Drop a theme .zip here, or click to upload")}</span |
| 595 |
> |
| 596 |
</label> |
| 597 |
</div>`,b=f=>{const g=s.state.desktopTheme;if(!rc(g))return"";const x=g===Gt?Pn:f.find(A=>A.slug===g)?.name;return x===void 0?"":c`<div class="os-settings__theme-recommendation"> |
| 598 |
<os-button |
| 599 |
variant="secondary" |
| 600 |
@click=${()=>r(g)} |
| 601 |
>${j(d("Apply %s’s recommended layout and effects"),x)}</os-button |
| 602 |
> |
| 603 |
</div>`};function y(){const f=Gl();L(c` |
| 604 |
${t!==""?c`<os-notice tone="error">${t}</os-notice>`:""} |
| 605 |
<os-section heading=${d("Installed")}> |
| 606 |
<!-- |
| 607 |
role="group", not radiogroup. The upload tile is the |
| 608 |
last cell of this grid, the way the wallpaper picker |
| 609 |
on Appearance ends with "Use your own image", and a |
| 610 |
radiogroup may contain nothing but radios. The cards |
| 611 |
are toggle buttons carrying aria-pressed, which is |
| 612 |
what the swatches in that other picker already do, |
| 613 |
so the two now agree. |
| 614 |
--> |
| 615 |
<div |
| 616 |
class="os-settings__theme-grid" |
| 617 |
role="group" |
| 618 |
aria-label=${d("Desktop theme")} |
| 619 |
> |
| 620 |
${m()} |
| 621 |
${f.map(g=>p(g))} |
| 622 |
${i?_():""} |
| 623 |
</div> |
| 624 |
${b(f)} |
| 625 |
</os-section> |
| 626 |
`,e)}y();const v=Yl(()=>{if(!e.isConnected){v();return}y()});return e}function zn(s){if(!s)return 214;let e=5381;for(let t=0;t<s.length;t++)e=Math.imul(e,33)+s.charCodeAt(t);return(e%360+360)%360}function cc(s){return typeof s!="string"||s===""||s.length>4096||!/^(https?:\/\/|data:image\/)/i.test(s)?!1:!/['"()\\<>\s]/.test(s)}function In(s,e,t){if(!cc(e))return!1;const o=`url("${e}") center / contain no-repeat`;return s.style.backgroundImage="none",s.style.backgroundColor=t,s.style.setProperty("-webkit-mask",o),s.style.setProperty("mask",o),!0}const Mn="data:image/svg+xml;base64,",Xt=new Map;function dc(s){const e=Xt.get(s);if(e!==void 0)return e;let t=!1;try{t=atob(s.slice(Mn.length)).includes("currentColor")}catch{}return Xt.size>=256&&Xt.clear(),Xt.set(s,t),t}function Dn(s,e){const t=e.className??"",o=e.title??"";let i=null;if(e.slot){const l=ec(e.slot);l!==null&&(s=l),i=tc(e.slot)}if(typeof s=="string"&&s.startsWith("dashicons-")){const l=document.createElement("span");return l.className=`dashicons ${s} ${t}`.trim(),l.setAttribute("aria-hidden","true"),i!==null&&(l.style.color=i),l}if(i!==null&&typeof s=="string"){const l=document.createElement("span");if(l.className=t,l.setAttribute("aria-hidden","true"),l.style.display="inline-block",In(l,s,i))return l}if(typeof s=="string"&&s.startsWith("data:image/svg+xml;base64,")){const l=s.slice(Mn.length);if(/^[A-Za-z0-9+/=]+$/.test(l)){const u=document.createElement("span");return u.className=t,u.setAttribute("aria-hidden","true"),u.style.display="inline-block",dc(s)&&In(u,s,"currentColor")||(u.style.backgroundImage=`url("${s}")`,u.style.backgroundRepeat="no-repeat",u.style.backgroundPosition="center",u.style.backgroundSize="contain"),u}}if(typeof s=="string"&&/^data:image\/(png|jpeg|jpg|gif|webp|x-icon|vnd\.microsoft\.icon);base64,/i.test(s)){const l=s.indexOf(","),u=l>=0?s.slice(l+1):"";if(/^[A-Za-z0-9+/=]+$/.test(u))return Nn(s,t)}if(typeof s=="string"&&(s.startsWith("http://")||s.startsWith("https://")))return Nn(s,t);const n=document.createElement("span");n.className=`${t} os-icon-letter`.trim(),n.setAttribute("aria-hidden","true");const r=uc(o);n.textContent=r;const a=zn(o);return n.style.backgroundColor=`hsl( ${a}, 60%, 45% )`,n.style.color="#fff",n.style.display="inline-flex",n.style.alignItems="center",n.style.justifyContent="center",n.style.fontWeight="600",n.style.borderRadius="4px",n}function Nn(s,e){const t=document.createElement("img");return t.className=e,t.src=s,t.alt="",t.setAttribute("aria-hidden","true"),t.draggable=!1,t}function uc(s){const e=(s??"").trim();if(e==="")return"?";const t=e.split(/\s+/);if(t.length>=2)return(t[0][0]+t[1][0]).toUpperCase();const o=t[0];return o.length>=2?o.slice(0,2).toUpperCase():o.toUpperCase()}const hc={core:"rail",plugin:"rail",app:"desktop",control:"rail"};function pc(s,e){return s==="core"&&e==="classic"?"sidebar":"dock"}function fc(s,e){return s.locked?"rail":e[s.id]??s.defaultPlacement??hc[s.kind]}function gc(s){return s.map((e,t)=>({item:e,index:t})).sort((e,t)=>(e.item.order??0)-(t.item.order??0)||e.index-t.index).map(e=>e.item)}const bc=[{kinds:["core"],heading:d("WordPress Core"),description:d("The admin menus WordPress itself registers.")},{kinds:["plugin","app"],heading:d("Plugins & Apps"),description:d("Menus from installed plugins and apps.")},{kinds:["control"],heading:d("OpenStation"),description:d("The OpenStation’s own controls.")}];function mc(){const s=window.wp?.os;return typeof s?.getNavItems=="function"?s.getNavItems():[]}function vc(s){return s.locked||s.transient?!1:s.menu||s.entry?!0:s.tile?.placeable===!0}function _c(s){const e=document.createElement("div"),t=(u,h)=>{s.state.navPlacement={...s.state.navPlacement,[u]:h},s.save(),r()},o=u=>h=>{const m=h.detail?.value;(m==="both"||m==="rail"||m==="desktop"||m==="hidden")&&t(u,m)},i=u=>d(u==="classic"?"Choose where each menu shows up: on the dock/sidebar, on the desktop wallpaper, both, or hidden entirely. Changes apply instantly.":"Choose where each menu shows up: on the dock, on the desktop wallpaper, both, or hidden entirely. Changes apply instantly."),n=(u,h)=>[{id:"rail",label:pc(u,h)==="sidebar"?d("In the sidebar"):d("On the dock")},{id:"desktop",label:d("On the desktop")},{id:"both",label:d("On both")},{id:"hidden",label:d("Hidden")}],r=(u=s.state.navPlacement,h=s.state.desktopLayout)=>{const p=mc().filter(vc),m=bc.map(_=>({..._,rows:gc(p.filter(b=>_.kinds.includes(b.kind)))})).filter(_=>_.rows.length>0);L(c` |
| 627 |
<p class="os-settings__page-description os-nav-settings__lead"> |
| 628 |
${i(h)} |
| 629 |
</p> |
| 630 |
${m.length===0?c`<os-empty-state |
| 631 |
heading=${d("Nothing registered yet")} |
| 632 |
description=${d("Plugins and the admin menu will appear here once they’re registered.")} |
| 633 |
></os-empty-state>`:m.map(_=>c` |
| 634 |
<os-section |
| 635 |
class="os-nav-settings" |
| 636 |
heading=${_.heading} |
| 637 |
description=${_.description} |
| 638 |
> |
| 639 |
${_.rows.map(b=>a(b,u,h))} |
| 640 |
</os-section> |
| 641 |
`)} |
| 642 |
`,e)},a=(u,h,p)=>c`<div class="os-nav-settings__row" data-item-id=${u.id}> |
| 643 |
<div class="os-nav-settings__identity"> |
| 644 |
${Dn(u.icon,{title:u.title,className:"os-nav-settings__icon",slot:ic(u.id)})} |
| 645 |
<div class="os-nav-settings__title">${u.title}</div> |
| 646 |
</div> |
| 647 |
<os-select |
| 648 |
plain |
| 649 |
label=${u.title} |
| 650 |
value=${fc(u,h)} |
| 651 |
@os-pick=${o(u.id)} |
| 652 |
> |
| 653 |
${n(u.kind,p).map(m=>c`<os-option value=${m.id}>${m.label}</os-option>`)} |
| 654 |
</os-select> |
| 655 |
</div>`;r();const l=window.wp?.os;if(l?.subscribeOsSettings){const u=l.subscribeOsSettings(h=>{if(!e.isConnected){u();return}r(h.navPlacement,h.desktopLayout)})}return e}const yc={unified:[{kind:"win",style:"left:12%;top:14%;width:44%;height:42%"},{kind:"win",style:"left:30%;top:30%;width:44%;height:42%"},{kind:"bar",accent:!0,style:"left:24%;bottom:10%;width:52%;height:9%"}],classic:[{kind:"bar",accent:!0,style:"left:0;top:0;bottom:0;width:5%"},{kind:"win",style:"left:14%;top:14%;width:44%;height:42%"},{kind:"win",style:"left:32%;top:30%;width:44%;height:42%"},{kind:"bar",accent:!0,style:"left:33%;bottom:10%;width:38%;height:9%"}]};function wc(s){const e=l=>{Mi.some(u=>u.id===l)&&(s.state.desktopLayout=l,s.save(),s.apply(),a())},t=l=>{const u=l.detail?.value??"";Ii.some(h=>h.id===u)&&(s.state.dockPlacement=u,s.save(),s.apply(),a())},o=l=>{const u=l.detail?.value??"";Ti.some(h=>h.id===u)&&(s.state.dockSize=u,s.save(),s.apply(),a())},i=()=>c`<div class="os-settings__dock-options"> |
| 656 |
<div class="os-settings__dock-option"> |
| 657 |
<span |
| 658 |
class="os-settings__dock-option-label" |
| 659 |
id="os-settings-dock-placement-label" |
| 660 |
>${d("Placement")}</span |
| 661 |
> |
| 662 |
<os-segmented |
| 663 |
value=${s.state.dockPlacement} |
| 664 |
label=${d("Dock position")} |
| 665 |
@os-pick=${t} |
| 666 |
> |
| 667 |
${Ii.map(l=>c`<os-segment value=${l.id} |
| 668 |
>${nl(l.id,l.label)}</os-segment |
| 669 |
>`)} |
| 670 |
</os-segmented> |
| 671 |
</div> |
| 672 |
</div>`,n=()=>c`<div |
| 673 |
class="os-settings__dock-options os-settings__dock-options--page" |
| 674 |
> |
| 675 |
<div class="os-settings__dock-option"> |
| 676 |
<span |
| 677 |
class="os-settings__dock-option-label" |
| 678 |
id="os-settings-dock-size-label" |
| 679 |
>${d("Dock size")}</span |
| 680 |
> |
| 681 |
<os-segmented |
| 682 |
value=${s.state.dockSize} |
| 683 |
label=${d("Dock size")} |
| 684 |
@os-pick=${o} |
| 685 |
> |
| 686 |
${Ti.map(l=>c`<os-segment value=${l.id} |
| 687 |
>${sl(l.id,l.label)}</os-segment |
| 688 |
>`)} |
| 689 |
</os-segmented> |
| 690 |
</div> |
| 691 |
</div>`,r=document.createElement("div"),a=()=>L(c` |
| 692 |
<os-section |
| 693 |
heading=${d("Desktop layout")} |
| 694 |
description=${d("Where the menus live.")} |
| 695 |
> |
| 696 |
<div |
| 697 |
class="os-settings__layout-grid" |
| 698 |
role="radiogroup" |
| 699 |
aria-label=${d("Desktop layout")} |
| 700 |
> |
| 701 |
${Mi.map(l=>{const u=s.state.desktopLayout===l.id;return c`<div class="os-settings__layout-card"> |
| 702 |
<button |
| 703 |
type="button" |
| 704 |
class="os-settings__layout-choice" |
| 705 |
role="radio" |
| 706 |
aria-checked=${u?"true":"false"} |
| 707 |
@click=${()=>e(l.id)} |
| 708 |
> |
| 709 |
<span |
| 710 |
class="os-settings__layout-preview" |
| 711 |
aria-hidden="true" |
| 712 |
> |
| 713 |
${(yc[l.id]??[]).map(h=>c`<span |
| 714 |
class="os-settings__layout-${h.kind}${h.accent?" is-accent":""}" |
| 715 |
style=${h.style} |
| 716 |
></span>`)} |
| 717 |
</span> |
| 718 |
<span class="os-settings__layout-name" |
| 719 |
>${rl(l.id,l.label)}</span |
| 720 |
> |
| 721 |
<span class="os-settings__layout-desc" |
| 722 |
>${al(l.id)}</span |
| 723 |
> |
| 724 |
</button> |
| 725 |
${l.id==="unified"&&u?i():c``} |
| 726 |
</div>`})} |
| 727 |
</div> |
| 728 |
${n()} |
| 729 |
</os-section> |
| 730 |
`,r);return a(),r}function xc(s){const e=i=>{const n=i.detail?.value??"";Pi.some(r=>r.id===n)&&(s.state.windowRadius=n,s.save(),s.apply(),o())},t=document.createElement("div"),o=()=>L(c` |
| 731 |
<os-section |
| 732 |
heading=${d("Window corners")} |
| 733 |
description=${d("How rounded the corners of windows are.")} |
| 734 |
> |
| 735 |
<os-segmented |
| 736 |
value=${s.state.windowRadius} |
| 737 |
label=${d("Window corners")} |
| 738 |
@os-pick=${e} |
| 739 |
> |
| 740 |
${Pi.map(i=>c`<os-segment value=${i.id} |
| 741 |
>${ol(i.id,i.label)}</os-segment |
| 742 |
>`)} |
| 743 |
</os-segmented> |
| 744 |
</os-section> |
| 745 |
`,t);return o(),t}const kc="os.activity.";function Xs(s){return kc+String(s).replace(/[^a-zA-Z0-9_.-]/g,".")}let $c=0;const Hn={publish(s,e){re(Xs(s),e)},subscribe(s,e){const t=`os/activity-sub/${++$c}`,o=Xs(s);bl(o,t,n=>e(n));let i=!1;return()=>{i||(i=!0,ml(o,t))}},filter(s,e,...t){return Q(Xs(s),e,...t)}};function Ac(s){s.style.setProperty("--os-file-tile-enter-delay",`${(Math.random()*.25).toFixed(3)}s`),s.style.setProperty("--os-file-tile-enter-duration",`${(.3+Math.random()*.25).toFixed(3)}s`)}const Zs=new Map;function Cc(s){let e,t;try{const i=new URL(s,document.baseURI);e=i.origin,t=i.pathname}catch{return null}if(!t)return null;const o=document.querySelectorAll("script[src]");for(const i of Array.from(o))try{const n=new URL(i.src,document.baseURI);if(n.origin===e&&n.pathname===t)return i}catch{}return null}function Sc(s,e){const t=Zs.get(s);if(t)return t;const o=new Promise((i,n)=>{const r=`script[data-os-vendor="${Ec(s)}"]`,a=document.querySelector(r);if(a){if(a.dataset.loaded==="1"){i();return}a.addEventListener("load",()=>i(),{once:!0}),a.addEventListener("error",()=>n(new Error(`Failed to load ${s}`)),{once:!0});return}const l=Cc(s);if(l){l.dataset.osVendor=s,l.dataset.loaded="1",i();return}e?.translations&&Zt(e.translations);for(const h of e?.l10n??[])Zt(h);for(const h of e?.before??[])Zt(h);const u=document.createElement("script");u.src=s,u.async=!0,u.dataset.osVendor=s,u.addEventListener("load",()=>{u.dataset.loaded="1";for(const h of e?.after??[])Zt(h);i()},{once:!0}),u.addEventListener("error",()=>{Zs.delete(s),u.remove(),n(new Error(`Failed to load ${s}`))},{once:!0}),document.head.appendChild(u)});return Zs.set(s,o),o}function Zt(s){if(!s)return;const e=document.createElement("script");e.textContent=s,e.dataset.osVendorInline="1",document.head.appendChild(e)}function Ec(s){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(s):s.replace(/["\\]/g,"\\$&")}K("desktop-mode/native-url-remap",()=>({remaps:[],deps:null}));function Lc(s){const e=document.createElement("div"),t=a=>{const l=a.detail?.value??"";l!==""&&(s.state.dockRailRenderer=l,s.save(),s.apply(),i())};let o=Zi();const i=()=>{if(o.length<=1){L(c``,e);return}L(c` |
| 746 |
<os-section |
| 747 |
heading=${d("Dock style")} |
| 748 |
description=${d("How the rail itself paints — the shipped icon strip, or anything a plugin replaces it with. Switching is instant; the dock rebuilds with the new renderer.")} |
| 749 |
> |
| 750 |
<os-segmented |
| 751 |
value=${s.state.dockRailRenderer} |
| 752 |
label=${d("Dock style")} |
| 753 |
@os-pick=${t} |
| 754 |
> |
| 755 |
${o.map(a=>c`<os-segment value=${a.id} |
| 756 |
>${a.label}</os-segment |
| 757 |
>`)} |
| 758 |
</os-segmented> |
| 759 |
</os-section> |
| 760 |
`,e)},n=gl(()=>{o=Zi(),i()}),r=new MutationObserver(()=>{e.isConnected||(n(),r.disconnect())});return queueMicrotask(()=>{e.parentNode&&r.observe(e.parentNode,{childList:!0,subtree:!1})}),i(),e}const Yt="none",qn=K("desktop-mode/unfocus-effect-registry",()=>({registry:new Map,listeners:new Set})),Un=qn.state.registry,Ys=qn.state.listeners,Fn=/^[a-z0-9_/-]+$/;function Js(s){const e=[];!s||typeof s!="object"?e.push("def (not an object)"):(typeof s.id!="string"||s.id.trim()===""?e.push("id (missing)"):Fn.test(s.id.trim().toLowerCase())?s.id.trim().toLowerCase()===Yt&&e.push('id ("none" is reserved)'):e.push(`id (must match ${Fn} — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-id)`),(typeof s.label!="string"||s.label.trim()==="")&&e.push("label (missing)"),typeof s.className!="string"&&typeof s.apply!="function"&&e.push("className|apply (at least one must be provided — a CSS class to toggle or an apply callback)")),qs("UnfocusEffect",e,s);const t=s.id.trim().toLowerCase();Un.set(t,{...s,id:t}),Tc()}function Wn(){const s=Array.from(Un.values()),e=Q(F.UNFOCUS_EFFECTS,s);return Array.isArray(e)?e:(typeof console<"u"&&console.warn("[openstation] `os.unfocus-effects` filter returned a non-array; falling back to registry list."),s)}function Rc(s){return Ys.add(s),()=>{Ys.delete(s)}}function Tc(){const s=Array.from(Ys);for(const e of s)try{e()}catch(t){typeof console<"u"&&console.error("[openstation] unfocus-effect registry listener threw:",t)}}Js({id:"darken",label:d("Darken"),description:d("Dim unfocused windows so the focused one stands out."),className:"os-window--fx-darken"}),Js({id:"frost",label:d("Frost"),description:d("Throw unfocused windows out of focus — a soft, frosted-glass blur, as if you were looking at them through an iced-over pane."),className:"os-window--fx-frost"}),Js({id:"grayscale",label:d("Grayscale"),description:d("Drain the colour from unfocused windows so the focused one is the only thing still in colour — your eye snaps right to it."),className:"os-window--fx-grayscale"});const Qs="none",jn=K("desktop-mode/window-link-renderer-registry",()=>({registry:new Map,listeners:new Set})),Pc=jn.state.registry,Vn=jn.state.listeners;function On(){const s=Array.from(Pc.values()),e=Q(F.WINDOW_LINK_RENDERERS,s);return Array.isArray(e)?e:(typeof console<"u"&&console.warn("[openstation] `os.window-links.renderers` filter returned a non-array; falling back to registry list."),s)}function zc(s){return Vn.add(s),()=>{Vn.delete(s)}}const Kn=[{value:ql,label:()=>d("Default (per reveal)")},{value:200,label:()=>d("Very fast — 200 ms")},{value:320,label:()=>d("Fast — 320 ms")},{value:460,label:()=>d("Normal — 460 ms")},{value:700,label:()=>d("Slow — 700 ms")},{value:1100,label:()=>d("Very slow — 1100 ms")}],Ic=[{id:"focus",label:()=>d("When a related window is focused")},{id:"always",label:()=>d("Always")},{id:"off",label:()=>d("Off")}];function Mc(s){const e=document.createElement("div"),t=y=>{const v=y.detail?.value??"";v!==""&&(v!==Yt&&!a.some(f=>f.id===v)||(s.state.unfocusEffect=v,s.save(),s.apply(),h()))},o=y=>{const v=y.detail?.value??"";v!==""&&(v!==_e&&!l.some(f=>f.id===v)||(s.state.windowReveal=v,s.save(),h()))},i=y=>{const v=y.detail?.value??"";if(v==="")return;const f=Number(v);Kn.some(g=>g.value===f)&&(s.state.windowRevealDuration=f,s.save(),h())},n=y=>{const v=y.detail?.value??"";v!==""&&(v!==Qs&&!u.some(f=>f.id===v)||(s.state.windowLinkRenderer=v,s.save(),s.apply(),h()))},r=y=>{const v=y.detail?.value??"";v!=="focus"&&v!=="always"&&v!=="off"||(s.state.windowLinkVisibility=v,s.save(),s.apply(),h())};let a=Wn(),l=vn(),u=On();const h=()=>{const y=a.find(S=>S.id===s.state.unfocusEffect),v=d("Apply a visual treatment to every window except the one you are working in."),f=s.state.unfocusEffect!==Yt&&y?.description?y.description:v,g=l.find(S=>S.id===s.state.windowReveal),x=d("Uncover a window’s content when it finishes loading, instead of fading it in."),A=s.state.windowReveal!==_e&&g?.description?g.description:x,M=u.find(S=>S.id===s.state.windowLinkRenderer),X=d("Draw a visual tie between windows showing related content — a post and its comments or media."),H=s.state.windowLinkRenderer!==Qs&&M?.description?M.description:X;L(c` |
| 761 |
<os-section |
| 762 |
heading=${d("Unfocused windows")} |
| 763 |
description=${f} |
| 764 |
> |
| 765 |
<os-select |
| 766 |
value=${s.state.unfocusEffect} |
| 767 |
label=${d("Unfocused window effect")} |
| 768 |
@os-pick=${t} |
| 769 |
> |
| 770 |
<os-option value=${Yt}> |
| 771 |
${d("None")} |
| 772 |
</os-option> |
| 773 |
${a.map(S=>c`<os-option value=${S.id} |
| 774 |
>${S.label}</os-option |
| 775 |
>`)} |
| 776 |
</os-select> |
| 777 |
</os-section> |
| 778 |
<os-section |
| 779 |
heading=${d("Window reveal")} |
| 780 |
description=${A} |
| 781 |
> |
| 782 |
<os-select |
| 783 |
value=${s.state.windowReveal} |
| 784 |
label=${d("Reveal style")} |
| 785 |
@os-pick=${o} |
| 786 |
> |
| 787 |
<os-option value=${_e}> |
| 788 |
${d("None")} |
| 789 |
</os-option> |
| 790 |
${l.map(S=>c`<os-option value=${S.id} |
| 791 |
>${S.label}</os-option |
| 792 |
>`)} |
| 793 |
</os-select> |
| 794 |
<os-select |
| 795 |
value=${String(s.state.windowRevealDuration)} |
| 796 |
label=${d("Reveal speed")} |
| 797 |
@os-pick=${i} |
| 798 |
> |
| 799 |
${Kn.map(S=>c`<os-option value=${String(S.value)} |
| 800 |
>${S.label()}</os-option |
| 801 |
>`)} |
| 802 |
</os-select> |
| 803 |
</os-section> |
| 804 |
<os-section |
| 805 |
heading=${d("Window links")} |
| 806 |
description=${H} |
| 807 |
> |
| 808 |
<os-select |
| 809 |
value=${s.state.windowLinkRenderer} |
| 810 |
label=${d("Link style")} |
| 811 |
@os-pick=${n} |
| 812 |
> |
| 813 |
<os-option value=${Qs}> |
| 814 |
${d("None")} |
| 815 |
</os-option> |
| 816 |
${u.map(S=>c`<os-option value=${S.id} |
| 817 |
>${S.label}</os-option |
| 818 |
>`)} |
| 819 |
</os-select> |
| 820 |
<os-select |
| 821 |
value=${s.state.windowLinkVisibility} |
| 822 |
label=${d("Show links")} |
| 823 |
@os-pick=${r} |
| 824 |
> |
| 825 |
${Ic.map(S=>c`<os-option value=${S.id} |
| 826 |
>${S.label()}</os-option |
| 827 |
>`)} |
| 828 |
</os-select> |
| 829 |
</os-section> |
| 830 |
`,e)},p=Rc(()=>{a=Wn(),h()}),m=Wl(()=>{l=vn(),h()}),_=zc(()=>{u=On(),h()}),b=new MutationObserver(()=>{e.isConnected||(p(),m(),_(),b.disconnect())});return queueMicrotask(()=>{e.parentNode&&b.observe(e.parentNode,{childList:!0,subtree:!1})}),h(),e}function Dc(s){const{extendedOptions:e,extendedOptionsUrl:t,restNonce:o}=s.config,i={media_library_enhanced:e?.media_library_enhanced===!0,games:e?.games===!0,agents:e?.agents===!0,saving:!1,error:""},n=document.createElement("div");let r=!1;const a=async()=>{if(!(!t||!o)){if(i.saving){r=!0;return}i.saving=!0,i.error="",p();try{const m=await O(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":o},body:JSON.stringify({options:{media_library_enhanced:i.media_library_enhanced,games:i.games,agents:i.agents}})},{source:"desktop-mode/settings/extended"});if(m.ok){const _=await m.json().catch(()=>null);_&&typeof _=="object"&&(s.config.extendedOptions=_)}else{const _=await m.json().catch(()=>({}));i.error=_.message??`Error ${m.status}`}}catch{i.error=d("Network error — check your connection.")}finally{i.saving=!1,r?(r=!1,await a()):p()}}},l=m=>{i.media_library_enhanced=m.detail?.checked===!0,a()},u=m=>{i.games=m.detail?.checked===!0,a()},h=m=>{i.agents=m.detail?.checked===!0,a()},p=()=>L(c` |
| 831 |
<os-section |
| 832 |
heading=${d("Extended options")} |
| 833 |
description=${d("Site-wide enhancements that apply to every user. Toggling requires the affected page to be reloaded for the change to take effect.")} |
| 834 |
> |
| 835 |
<div class="os-features__item"> |
| 836 |
<os-checkbox-label |
| 837 |
label=${d("Enable drag-and-drop in the Media Library")} |
| 838 |
?checked=${i.media_library_enhanced} |
| 839 |
@os-checkbox-change=${l} |
| 840 |
></os-checkbox-label> |
| 841 |
<p class="os-features__hint"> |
| 842 |
${d("Makes every item in the WordPress Media Library draggable. Drop a media item into text fields, rich-text editors, Gutenberg blocks, or any target that accepts images or files. No replacement of the library — just a drag-and-drop layer on top of the one you already know.")} |
| 843 |
</p> |
| 844 |
</div> |
| 845 |
|
| 846 |
<div class="os-features__item"> |
| 847 |
<os-checkbox-label |
| 848 |
label=${d("Enable games")} |
| 849 |
?checked=${i.games} |
| 850 |
@os-checkbox-change=${u} |
| 851 |
></os-checkbox-label> |
| 852 |
<p class="os-features__hint"> |
| 853 |
${d("Adds a Games app for every user: built-in games, scoreboards, and player-to-player challenges. Off by default — while off, nothing game-related runs anywhere, on the server or in the browser. Saved scores are kept across a disable and reappear when re-enabled.")} |
| 854 |
</p> |
| 855 |
</div> |
| 856 |
|
| 857 |
<div class="os-features__item"> |
| 858 |
<os-checkbox-label |
| 859 |
label=${d("Enable AI agents")} |
| 860 |
?checked=${i.agents} |
| 861 |
@os-checkbox-change=${h} |
| 862 |
></os-checkbox-label> |
| 863 |
<p class="os-features__hint"> |
| 864 |
${d("Adds an Agents section to WP Explorer: durable AI workers that live on the site as login-blocked users, act through the WordPress Abilities API under their own role, and answer in a chat window. Requires a configured AI connector to run. Off by default — while off, nothing agent-related loads. Agent definitions are kept across a disable and reappear when re-enabled.")} |
| 865 |
</p> |
| 866 |
</div> |
| 867 |
|
| 868 |
${i.error?c`<p class="os-ext__error">${i.error}</p>`:c``} |
| 869 |
${i.saving?c`<p class="os-ext__saving">${d("Saving…")}</p>`:c``} |
| 870 |
</os-section> |
| 871 |
`,n);return p(),n}let eo=null;function Jt(){return!!window.openStationShellOverlays}function Nc(s){return new Promise((e,t)=>{const o=document.querySelector('script[data-os-shell-overlays="1"]'),i=()=>{if(Jt()){e();return}t(new Error("[openstation] shell-overlays bundle loaded but did not set `window.openStationShellOverlays`."))};if(o){Jt()?i():(o.addEventListener("load",i),o.addEventListener("error",()=>t(new Error("failed to load shell-overlays bundle"))));return}const n=document.createElement("script");n.src=s,n.async=!0,n.dataset.osShellOverlays="1",n.addEventListener("load",i),n.addEventListener("error",()=>t(new Error("failed to load shell-overlays bundle"))),document.head.appendChild(n)})}function Hc(s){return Jt()||!s?Promise.resolve():(eo||(eo=Nc(s)),eo)}function qc(){return window.openStationConfig?.shellOverlaysBundleUrl??""}function Uc(s,e){const t=qc();if(Jt()||!t){e();return}Hc(t).then(()=>{s()&&e()}).catch(o=>{typeof console<"u"&&console.warn("[openstation] shell-overlays failed to load; menu/dialog suppressed:",o)})}const Fc=4e3,Wc=200,jc=1200;function to(s){const e=Hn.filter("os/toast-requested",{...s});if(!e||e.cancel===!0)return()=>{};let t=!1,o=null;return Uc(()=>!t,()=>{o=Vc(e)}),()=>{t=!0,o&&o()}}function Vc(s){const e=Gc(),t=document.createElement("os-toast");t.textContent=s.message,s.action&&(t.setAttribute("action",s.action.label),t.addEventListener("os-toast-action",()=>{s.action?.onClick(),l()})),s.dismissible&&(t.setAttribute("dismissible",""),t.addEventListener("os-toast-dismiss",()=>{s.onDismiss?.(),l()})),e.appendChild(t);let o=!1,i=null,n=s.duration??Fc,r=0;const a=()=>{i!==null&&(window.clearTimeout(i),i=null)},l=()=>{o||(o=!0,a(),Bc(t),t.setAttribute("state","out"),window.setTimeout(()=>{t.remove(),Kc()},Wc))},u=()=>{o||s.persistent||i!==null||(r=Date.now(),i=window.setTimeout(l,n))},h=()=>{i!==null&&(n=Math.max(0,n-(Date.now()-r)),a())};return requestAnimationFrame(()=>{t.setAttribute("state","in")}),t.addEventListener("os-toast-hold",p=>{if(p.detail?.held){h();return}n=Math.max(n,jc),u()}),Oc(t),u(),Hn.publish("os/toast-shown",{...s}),l}let Qt=null,we=0;function Bn(s){const e=s.target;e instanceof HTMLElement&&(e.closest("os-toast-container")||(Qt=e))}function Oc(s){we===0&&document.addEventListener("focusin",Bn,!0),we+=1;const e=s.ownerDocument,t=e.activeElement;t instanceof HTMLElement&&t!==e.body&&!t.closest("os-toast-container")&&(Qt=t)}function Kc(){we=Math.max(0,we-1),we===0&&document.removeEventListener("focusin",Bn,!0)}function Bc(s){const e=s.ownerDocument.activeElement;e!==s&&!s.contains(e)||Qt?.isConnected===!0&&Qt.focus()}function Gc(){const s=document.querySelector("os-toast-container");if(s)return s;const e=document.createElement("os-toast-container");return document.body.appendChild(e),e}const Xc=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/i.test(navigator.platform||navigator.userAgent||"")?"⌘K":"Ctrl+K";function Zc(s){const e=document.createElement("div"),t=C=>{const E=C.detail?.checked===!0;s.state.nativePostsEnabled=E,s.save(),T()},o=C=>{const E=C.detail?.value,I=Number(E);if([15,30,45,60].includes(I)){s.state.heartbeatRate=I,s.save();try{const N=window.wp,ie=I>=60?"slow":"standard";N?.heartbeat?.interval?.(ie)}catch{}T()}},i=C=>{const E=C.detail?.checked===!0;s.state.nativePagesEnabled=E,s.save(),T()},n=C=>{const E=C.detail?.checked===!0;s.state.nativeUsersEnabled=E,s.save(),T()},r=C=>{const E=C.detail?.checked===!0;s.state.nativePluginsEnabled=E,s.save(),T()},a=C=>{const E=C.detail?.checked===!0;s.state.nativeCommentsEnabled=E,s.save(),T()},l=C=>{const E=C.detail?.checked===!0;s.state.showDesktopOnWallpaperClick=E,s.save(),T()},u=C=>{const E=C.detail?.checked===!0;s.state.windowLinksEnabled=E,s.save(),s.apply(),T()},h=C=>{const E=C.detail?.checked===!0;s.state.windowLinkRaiseOnFocus=E,s.save(),s.apply(),T()},p=C=>{const E=C.detail?.checked===!0;s.state.windowLinkHighlight=E,s.save(),s.apply(),T()},m=C=>{const E=C.detail?.checked===!0;s.state.showPostStatusRibbons=E,s.save(),T()},_=C=>{const E=C.detail?.checked===!0;s.state.developerModeEnabled=E,s.save(),T()},b=C=>{const E=C.detail?.checked===!0;s.state.foldersSharingEnabled=E,s.save(),T()};let y=!1;const v=async()=>{if(y||!await Ki({title:d("Delete folder sharing data?"),message:d("This drops every shares table on the site (current + legacy). All invites, accept/deny decisions, and share rows are permanently removed. Recipients lose their access until someone shares with them again. The empty tables are recreated on the next admin load so the feature keeps working — but every existing share is gone."),confirmLabel:d("Delete data"),danger:!0}))return;const E=f?.filesUrl,I=f?.restNonce;if(!E||!I){to({message:d("Files REST endpoint is not available.")});return}y=!0,T();try{const N=E.replace(/\/+$/,"")+"/folder-sharing-tables/purge",ie=await O(N,{method:"POST",headers:{"X-WP-Nonce":I},credentials:"same-origin"},{source:"os-settings/folder-sharing-purge"});if(!ie.ok){const kh=await ie.text();throw new Error(`${ie.status}: ${kh.slice(0,200)}`)}const xh=await ie.json();to({message:d("Folder sharing data deleted.")+" ("+xh.dropped.length+" tables)"})}catch(N){const ie=N instanceof Error?N.message:String(N);to({message:d("Could not delete sharing data.")+" "+ie})}finally{y=!1,T()}},f=window.openStationConfig,g={enabled:f?.commentsAi?.enabled??!1,providerConfigured:f?.commentsAi?.providerConfigured??!1,saving:!1},x=async C=>{const E=C.detail?.checked===!0;if(!(!f?.commentsAiUrl||g.saving)){g.saving=!0,g.enabled=E,T();try{const I=await O(f.commentsAiUrl,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":f.restNonce??""},body:JSON.stringify({enabled:E})},{source:"os-settings/comments-ai"});if(I.ok){const N=await I.json();g.enabled=N.enabled,g.providerConfigured=N.providerConfigured,f.commentsAi&&(f.commentsAi.enabled=N.enabled,f.commentsAi.providerConfigured=N.providerConfigured)}else g.enabled=!E}catch{g.enabled=!E}g.saving=!1,T()}},A=C=>{const E=C.detail?.checked===!0;s.state.ai={...s.state.ai,enabled:E},s.save(),T()},M=async()=>{const C=f?.aiAssistant;if(!(!C||!f?.aiStatusUrl))try{const E=await O(f.aiStatusUrl,{credentials:"same-origin",headers:{"X-WP-Nonce":f.restNonce??""}},{source:"os-settings/ai-status",silent:!0});if(!E.ok)return;const I=await E.json(),N=C.available!==(I.available===!0)||C.assistantProviderConfigured!==(I.assistantProviderConfigured===!0);C.available=I.available===!0,C.providerConfigured=I.providerConfigured===!0,C.assistantProviderConfigured=I.assistantProviderConfigured===!0,g.providerConfigured=C.providerConfigured,T(),N&&document.dispatchEvent(new CustomEvent("os-ai-status-changed"))}catch{}};let X=!1;const H=C=>{C.detail?.windowId==="desktop-mode-os-settings"&&(X||(X=!0,M().finally(()=>{X=!1})))};document.addEventListener("os-window-focused",H);const S=new MutationObserver(()=>{e.isConnected||(document.removeEventListener("os-window-focused",H),S.disconnect())});S.observe(document.body,{childList:!0,subtree:!0});const Y=()=>{const C=f?.aiAssistant?.connectorsUrl??"";if(!C)return;const E=window.wp?.os;if(E?.windowManager?.open){const I=E.deriveWindowId?E.deriveWindowId(C):C;E.windowManager.open({id:I,url:C,title:d("Connectors"),icon:"dashicons-admin-settings"})}else window.open(C,"_blank","noopener")};let Dt=!1;const wh=async()=>{if(Dt)return;const C=window.openStationConfig;if(C?.seenIntrosUrl){Dt=!0,T();try{await O(C.seenIntrosUrl,{method:"DELETE",credentials:"same-origin",headers:{"X-WP-Nonce":C.restNonce??""}},{source:"os-settings/reset-intros"}),document.dispatchEvent(new CustomEvent("os-intros-reset"))}catch{}Dt=!1,T()}},T=()=>L(c` |
| 872 |
<!-- |
| 873 |
No heading. The page title above already says |
| 874 |
"Features", and its description already covers the |
| 875 |
per-account, takes-effect-immediately point that used |
| 876 |
to open this section. |
| 877 |
--> |
| 878 |
<os-section |
| 879 |
heading="" |
| 880 |
description=${d("Watch the dot in the OpenStation Preferences title bar to see when a change has been saved.")} |
| 881 |
> |
| 882 |
${f?.aiAssistant?.available?c` |
| 883 |
<div class="os-features__item"> |
| 884 |
<os-checkbox-label |
| 885 |
label=${d("AI assistant")} |
| 886 |
?checked=${s.state.ai.enabled} |
| 887 |
?disabled=${!f.aiAssistant.assistantProviderConfigured} |
| 888 |
@os-checkbox-change=${A} |
| 889 |
></os-checkbox-label> |
| 890 |
<p class="os-features__hint"> |
| 891 |
${j(d("Adds an AI mode to the %s command palette: find content and ask about your site."),Xc)} |
| 892 |
</p> |
| 893 |
${f.aiAssistant.assistantProviderConfigured?"":c` |
| 894 |
<os-notice tone="warning" not-dismissible> |
| 895 |
${d("This feature requires an AI provider configured in")} |
| 896 |
<a |
| 897 |
href=${f.aiAssistant.connectorsUrl} |
| 898 |
@click=${C=>{C.preventDefault(),Y()}} |
| 899 |
>${d("Settings → Connectors")}</a |
| 900 |
>. |
| 901 |
</os-notice> |
| 902 |
`} |
| 903 |
</div> |
| 904 |
`:""} |
| 905 |
${f?.commentsAi?c` |
| 906 |
<div class="os-features__item"> |
| 907 |
<os-checkbox-label |
| 908 |
label=${d("Score new comments with AI")} |
| 909 |
?checked=${g.enabled} |
| 910 |
?disabled=${g.saving||!g.providerConfigured} |
| 911 |
@os-checkbox-change=${x} |
| 912 |
></os-checkbox-label> |
| 913 |
<p class="os-features__hint"> |
| 914 |
${d("Rates incoming comments so you can triage the queue faster.")} |
| 915 |
</p> |
| 916 |
${g.providerConfigured?"":c` |
| 917 |
<os-notice tone="warning" not-dismissible> |
| 918 |
${d("This feature requires an AI provider configured in")} |
| 919 |
<a |
| 920 |
href=${f?.aiAssistant?.connectorsUrl??""} |
| 921 |
@click=${C=>{C.preventDefault(),Y()}} |
| 922 |
>${d("Settings → Connectors")}</a |
| 923 |
>. |
| 924 |
</os-notice> |
| 925 |
`} |
| 926 |
</div> |
| 927 |
`:""} |
| 928 |
<div class="os-features__item"> |
| 929 |
<os-checkbox-label |
| 930 |
label=${d("Window links")} |
| 931 |
?checked=${s.state.windowLinksEnabled} |
| 932 |
@os-checkbox-change=${u} |
| 933 |
></os-checkbox-label> |
| 934 |
<p class="os-features__hint"> |
| 935 |
${d("Draws connector lines between related windows. Line style and visibility live in Windows → Window links.")} |
| 936 |
</p> |
| 937 |
<div class="os-features__item"> |
| 938 |
<os-checkbox-label |
| 939 |
label=${d("Bring related windows to front")} |
| 940 |
?checked=${s.state.windowLinkRaiseOnFocus} |
| 941 |
?disabled=${!s.state.windowLinksEnabled} |
| 942 |
@os-checkbox-change=${h} |
| 943 |
></os-checkbox-label> |
| 944 |
<p class="os-features__hint"> |
| 945 |
${d("Clicking a window also surfaces its parent and children.")} |
| 946 |
</p> |
| 947 |
</div> |
| 948 |
<div class="os-features__item"> |
| 949 |
<os-checkbox-label |
| 950 |
label=${d("Highlight related windows")} |
| 951 |
?checked=${s.state.windowLinkHighlight} |
| 952 |
?disabled=${!s.state.windowLinksEnabled} |
| 953 |
@os-checkbox-change=${p} |
| 954 |
></os-checkbox-label> |
| 955 |
<p class="os-features__hint"> |
| 956 |
${d("Related windows get an accent outline while one of them is focused.")} |
| 957 |
</p> |
| 958 |
</div> |
| 959 |
</div> |
| 960 |
<div class="os-features__item"> |
| 961 |
<os-checkbox-label |
| 962 |
label=${d("Show desktop when clicking the wallpaper")} |
| 963 |
?checked=${s.state.showDesktopOnWallpaperClick} |
| 964 |
@os-checkbox-change=${l} |
| 965 |
></os-checkbox-label> |
| 966 |
<p class="os-features__hint"> |
| 967 |
${d("A click on the empty desktop minimizes every window; a second click restores them.")} |
| 968 |
</p> |
| 969 |
</div> |
| 970 |
<div class="os-features__item"> |
| 971 |
<os-checkbox-label |
| 972 |
label=${d("Show post/page status ribbon")} |
| 973 |
?checked=${s.state.showPostStatusRibbons} |
| 974 |
@os-checkbox-change=${m} |
| 975 |
></os-checkbox-label> |
| 976 |
<p class="os-features__hint"> |
| 977 |
${d("Marks unpublished posts and pages with a corner ribbon on their tiles.")} |
| 978 |
</p> |
| 979 |
</div> |
| 980 |
<div class="os-features__item"> |
| 981 |
<os-checkbox-label |
| 982 |
label=${d("Enable developer mode")} |
| 983 |
?checked=${s.state.developerModeEnabled} |
| 984 |
@os-checkbox-change=${_} |
| 985 |
></os-checkbox-label> |
| 986 |
<p class="os-features__hint"> |
| 987 |
${d("Unlocks developer surfaces meant for plugin authors.")} |
| 988 |
</p> |
| 989 |
</div> |
| 990 |
<div class="os-features__item"> |
| 991 |
<os-checkbox-label |
| 992 |
label=${d("Folder sharing")} |
| 993 |
?checked=${s.state.foldersSharingEnabled} |
| 994 |
@os-checkbox-change=${b} |
| 995 |
></os-checkbox-label> |
| 996 |
<p class="os-features__hint"> |
| 997 |
${d("Share desktop folders with other users or roles, with read or write access.")} |
| 998 |
</p> |
| 999 |
${f?.currentUserIsAdmin?c` |
| 1000 |
<div class="os-features__danger-row"> |
| 1001 |
<p class="os-features__hint"> |
| 1002 |
${d("Removes every share and its access list. Cannot be undone.")} |
| 1003 |
</p> |
| 1004 |
<os-button |
| 1005 |
variant="danger" |
| 1006 |
?disabled=${y} |
| 1007 |
@click=${v} |
| 1008 |
> |
| 1009 |
${d(y?"Deleting…":"Delete folder sharing data")} |
| 1010 |
</os-button> |
| 1011 |
</div> |
| 1012 |
`:""} |
| 1013 |
</div> |
| 1014 |
<div class="os-features__item"> |
| 1015 |
<label class="os-features__select-label"> |
| 1016 |
<span class="os-features__select-title">${d("WordPress Heartbeat rate")}</span> |
| 1017 |
<os-select |
| 1018 |
value=${String(s.state.heartbeatRate)} |
| 1019 |
@os-pick=${o} |
| 1020 |
> |
| 1021 |
<os-option value="15">${d("Fast (15s, not recommended)")}</os-option> |
| 1022 |
<os-option value="30">${d("Medium (30s)")}</os-option> |
| 1023 |
<os-option value="45">${d("Slow (45s)")}</os-option> |
| 1024 |
<os-option value="60">${d("Very slow (60s, default)")}</os-option> |
| 1025 |
</os-select> |
| 1026 |
</label> |
| 1027 |
<p class="os-features__hint"> |
| 1028 |
${d("How often the Heartbeat API runs. Faster means quicker live updates and more server traffic. The 30s and 45s rates apply exactly from the next page load.")} |
| 1029 |
</p> |
| 1030 |
</div> |
| 1031 |
<div class="os-features__row"> |
| 1032 |
<p class="os-features__hint"> |
| 1033 |
${d("Brings back the one-time announcements you have dismissed, such as the welcome dialog.")} |
| 1034 |
</p> |
| 1035 |
<os-button |
| 1036 |
variant="secondary" |
| 1037 |
?disabled=${Dt} |
| 1038 |
@click=${wh} |
| 1039 |
> |
| 1040 |
${d(Dt?"Resetting…":"Reset what’s-new dialogs")} |
| 1041 |
</os-button> |
| 1042 |
</div> |
| 1043 |
</os-section> |
| 1044 |
<os-section |
| 1045 |
heading=${d("Beta features")} |
| 1046 |
description=${d("Experimental redesigns of core admin screens, off by default. Each toggle affects only your account and takes effect immediately.")} |
| 1047 |
> |
| 1048 |
<div class="os-features__item"> |
| 1049 |
<os-checkbox-label |
| 1050 |
label=${d("Use the native Posts window")} |
| 1051 |
?checked=${s.state.nativePostsEnabled} |
| 1052 |
@os-checkbox-change=${t} |
| 1053 |
></os-checkbox-label> |
| 1054 |
<p class="os-features__hint"> |
| 1055 |
${d("Replaces the classic Posts list with a native table window: sticky header, paginated rows, bulk actions, and a row preview.")} |
| 1056 |
</p> |
| 1057 |
</div> |
| 1058 |
<div class="os-features__item"> |
| 1059 |
<os-checkbox-label |
| 1060 |
label=${d("Use the native Pages window")} |
| 1061 |
?checked=${s.state.nativePagesEnabled} |
| 1062 |
@os-checkbox-change=${i} |
| 1063 |
></os-checkbox-label> |
| 1064 |
<p class="os-features__hint"> |
| 1065 |
${d("The Posts table experience for Pages, with a Parent column, hierarchical sort, and edit-lock indicators.")} |
| 1066 |
</p> |
| 1067 |
</div> |
| 1068 |
<div class="os-features__item"> |
| 1069 |
<os-checkbox-label |
| 1070 |
label=${d("Use the native Users window")} |
| 1071 |
?checked=${s.state.nativeUsersEnabled} |
| 1072 |
@os-checkbox-change=${n} |
| 1073 |
></os-checkbox-label> |
| 1074 |
<p class="os-features__hint"> |
| 1075 |
${d("A native Users list with bulk role changes, online indicators, and one-click password resets.")} |
| 1076 |
</p> |
| 1077 |
</div> |
| 1078 |
<div class="os-features__item"> |
| 1079 |
<os-checkbox-label |
| 1080 |
label=${d("Use the native Plugins window")} |
| 1081 |
?checked=${s.state.nativePluginsEnabled} |
| 1082 |
@os-checkbox-change=${r} |
| 1083 |
></os-checkbox-label> |
| 1084 |
<p class="os-features__hint"> |
| 1085 |
${d("A native Plugins window with an Installed list, bulk actions, and a Browse gallery from the WordPress.org directory.")} |
| 1086 |
</p> |
| 1087 |
</div> |
| 1088 |
<div class="os-features__item"> |
| 1089 |
<os-checkbox-label |
| 1090 |
label=${d("Use the native Comments window")} |
| 1091 |
?checked=${s.state.nativeCommentsEnabled} |
| 1092 |
@os-checkbox-change=${a} |
| 1093 |
></os-checkbox-label> |
| 1094 |
<p class="os-features__hint"> |
| 1095 |
${d("A native two-pane Comments window: a list of conversations beside the full reply thread.")} |
| 1096 |
</p> |
| 1097 |
</div> |
| 1098 |
</os-section> |
| 1099 |
`,e);return T(),e}const Yc=w` |
| 1100 |
:host { |
| 1101 |
display: flex; |
| 1102 |
flex-direction: column; |
| 1103 |
gap: 4px; |
| 1104 |
font-size: 13px; |
| 1105 |
color: var( --os-ui-fg, #1d2327 ); |
| 1106 |
min-width: 0; |
| 1107 |
} |
| 1108 |
|
| 1109 |
:host( [ hidden ] ) { |
| 1110 |
display: none; |
| 1111 |
} |
| 1112 |
|
| 1113 |
.os-multiselect__label { |
| 1114 |
font-size: 12px; |
| 1115 |
color: var( --os-ui-fg-muted, #646970 ); |
| 1116 |
} |
| 1117 |
|
| 1118 |
.os-multiselect__trigger { |
| 1119 |
appearance: none; |
| 1120 |
display: inline-flex; |
| 1121 |
align-items: center; |
| 1122 |
justify-content: space-between; |
| 1123 |
gap: 8px; |
| 1124 |
width: 100%; |
| 1125 |
min-width: 0; |
| 1126 |
padding: 7px 12px 7px 12px; |
| 1127 |
background: var( --os-ui-hover, rgba( 0, 0, 0, 0.05 ) ); |
| 1128 |
border: 1px solid transparent; |
| 1129 |
border-radius: 7px; |
| 1130 |
font: inherit; |
| 1131 |
font-size: 13px; |
| 1132 |
color: var( --os-ui-fg, #1d2327 ); |
| 1133 |
cursor: pointer; |
| 1134 |
text-align: start; |
| 1135 |
transition: background-color 0.12s ease, border-color 0.12s ease, |
| 1136 |
box-shadow 0.12s ease; |
| 1137 |
} |
| 1138 |
|
| 1139 |
.os-multiselect__trigger:hover { |
| 1140 |
background: var( --os-ui-hover, rgba( 0, 0, 0, 0.08 ) ); |
| 1141 |
} |
| 1142 |
|
| 1143 |
.os-multiselect__trigger:focus-visible { |
| 1144 |
outline: none; |
| 1145 |
border-color: var( --os-ui-accent, #2271b1 ); |
| 1146 |
box-shadow: var( |
| 1147 |
--os-ui-focus-ring-field, |
| 1148 |
0 0 0 1px #2271b1, 0 0 0 4px rgba( 34, 113, 177, 0.18 ) |
| 1149 |
); |
| 1150 |
} |
| 1151 |
|
| 1152 |
.os-multiselect__trigger:disabled { |
| 1153 |
opacity: 0.5; |
| 1154 |
cursor: not-allowed; |
| 1155 |
} |
| 1156 |
|
| 1157 |
.os-multiselect__trigger[ data-active='true' ] { |
| 1158 |
color: var( --wp-admin-theme-color, #2271b1 ); |
| 1159 |
font-weight: 600; |
| 1160 |
} |
| 1161 |
|
| 1162 |
.os-multiselect__summary { |
| 1163 |
flex: 1 1 auto; |
| 1164 |
min-width: 0; |
| 1165 |
overflow: hidden; |
| 1166 |
text-overflow: ellipsis; |
| 1167 |
white-space: nowrap; |
| 1168 |
} |
| 1169 |
|
| 1170 |
.os-multiselect__chevron { |
| 1171 |
color: var( --os-ui-fg-muted, #646970 ); |
| 1172 |
flex-shrink: 0; |
| 1173 |
transition: color 0.12s ease, transform 0.18s ease; |
| 1174 |
} |
| 1175 |
|
| 1176 |
.os-multiselect__trigger:hover .os-multiselect__chevron, |
| 1177 |
.os-multiselect__trigger:focus-visible .os-multiselect__chevron { |
| 1178 |
color: var( --os-ui-fg, #1d2327 ); |
| 1179 |
} |
| 1180 |
|
| 1181 |
:host( [ open ] ) .os-multiselect__chevron { |
| 1182 |
transform: rotate( 180deg ); |
| 1183 |
} |
| 1184 |
`;function Jc(){const s="os-multiselect-popover-styles";if(document.getElementById(s))return;const e=document.createElement("style");e.id=s,e.textContent=` |
| 1185 |
.os-multiselect__popover { |
| 1186 |
position: fixed; |
| 1187 |
z-index: 100000; |
| 1188 |
max-height: 320px; |
| 1189 |
overflow-y: auto; |
| 1190 |
min-width: 200px; |
| 1191 |
padding: 4px 0; |
| 1192 |
background: var( --os-window-bg, #fff ); |
| 1193 |
color: var( --os-ui-fg, #1d2327 ); |
| 1194 |
border: 1px solid var( --os-window-border, #c3c4c7 ); |
| 1195 |
border-radius: 8px; |
| 1196 |
box-shadow: 0 8px 28px rgba( 0, 0, 0, 0.18 ); |
| 1197 |
font: inherit; |
| 1198 |
font-size: 13px; |
| 1199 |
} |
| 1200 |
|
| 1201 |
.os-multiselect__clear { |
| 1202 |
display: block; |
| 1203 |
width: 100%; |
| 1204 |
padding: 6px 12px; |
| 1205 |
font: inherit; |
| 1206 |
font-size: 11px; |
| 1207 |
font-weight: 600; |
| 1208 |
letter-spacing: 0.04em; |
| 1209 |
text-transform: uppercase; |
| 1210 |
text-align: start; |
| 1211 |
border: 0; |
| 1212 |
border-bottom: 1px solid var( --os-window-border, #dcdcde ); |
| 1213 |
background: transparent; |
| 1214 |
color: var( --wp-admin-theme-color, #2271b1 ); |
| 1215 |
cursor: pointer; |
| 1216 |
} |
| 1217 |
|
| 1218 |
.os-multiselect__clear:hover { |
| 1219 |
background: color-mix( |
| 1220 |
in srgb, |
| 1221 |
var( --wp-admin-theme-color, #2271b1 ) 10%, |
| 1222 |
transparent |
| 1223 |
); |
| 1224 |
} |
| 1225 |
|
| 1226 |
.os-multiselect__option { |
| 1227 |
display: flex; |
| 1228 |
align-items: center; |
| 1229 |
gap: 8px; |
| 1230 |
padding: 6px 12px; |
| 1231 |
cursor: pointer; |
| 1232 |
user-select: none; |
| 1233 |
} |
| 1234 |
|
| 1235 |
.os-multiselect__option:hover { |
| 1236 |
background: var( --os-ui-hover, rgba( 0, 0, 0, 0.05 ) ); |
| 1237 |
} |
| 1238 |
|
| 1239 |
.os-multiselect__option[ data-disabled='true' ] { |
| 1240 |
opacity: 0.5; |
| 1241 |
cursor: not-allowed; |
| 1242 |
} |
| 1243 |
|
| 1244 |
.os-multiselect__option > span { |
| 1245 |
flex: 1 1 auto; |
| 1246 |
min-width: 0; |
| 1247 |
overflow: hidden; |
| 1248 |
text-overflow: ellipsis; |
| 1249 |
white-space: nowrap; |
| 1250 |
} |
| 1251 |
|
| 1252 |
.os-multiselect__option > input[ type='checkbox' ] { |
| 1253 |
margin: 0; |
| 1254 |
flex-shrink: 0; |
| 1255 |
accent-color: var( --wp-admin-theme-color, #2271b1 ); |
| 1256 |
} |
| 1257 |
|
| 1258 |
.os-multiselect__empty { |
| 1259 |
padding: 8px 12px; |
| 1260 |
color: var( --os-ui-fg-muted, #646970 ); |
| 1261 |
font-style: italic; |
| 1262 |
} |
| 1263 |
|
| 1264 |
.os-multiselect__loading { |
| 1265 |
display: flex; |
| 1266 |
align-items: center; |
| 1267 |
gap: 8px; |
| 1268 |
padding: 8px 12px; |
| 1269 |
color: var( --os-ui-fg-muted, #646970 ); |
| 1270 |
font-size: 12px; |
| 1271 |
} |
| 1272 |
|
| 1273 |
.os-multiselect__spinner { |
| 1274 |
display: inline-block; |
| 1275 |
width: 12px; |
| 1276 |
height: 12px; |
| 1277 |
border-radius: 50%; |
| 1278 |
border: 2px solid currentColor; |
| 1279 |
border-top-color: transparent; |
| 1280 |
animation: os-multiselect-spin 0.8s linear infinite; |
| 1281 |
} |
| 1282 |
|
| 1283 |
@keyframes os-multiselect-spin { |
| 1284 |
to { transform: rotate( 360deg ); } |
| 1285 |
} |
| 1286 |
`,document.head.appendChild(e)}typeof document<"u"&&Jc();const Ke=class Ke extends k{constructor(){super(...arguments),this._optionObserver=null,this._popover=null,this._teardownOpen=null,this._hasMore=!1,this._loadingMore=!1}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const n of Array.from(t))n.remove();for(const n of e){const r=document.createElement("os-option");r.setAttribute("value",n.value),r.textContent=n.label,this.appendChild(r)}this._loadingMore=!1;const o=new Set(e.map(n=>n.value)),i=this._readValues().filter(n=>o.has(n));this._writeValueAttribute(i),this.requestUpdate(),this._refreshPopover()}get values(){return this._readValues()}set values(e){const t=Array.isArray(e)?e.map(o=>String(o)).filter(o=>o!==""):[];this._writeValueAttribute(t),this.requestUpdate(),this._refreshPopover()}get hasMore(){return this._hasMore}set hasMore(e){this._hasMore=!!e,this._refreshPopover()}get loadingMore(){return this._loadingMore}set loadingMore(e){this._loadingMore=!!e,this._refreshPopover()}appendItems(e){if(this._loadingMore=!1,!e||e.length===0){this._refreshPopover();return}const t=new Set(Array.from(this.querySelectorAll(":scope > os-option")).map(o=>o.getAttribute("value")));for(const o of e){if(t.has(o.value))continue;const i=document.createElement("os-option");i.setAttribute("value",o.value),i.textContent=o.label,this.appendChild(i)}this.requestUpdate(),this._refreshPopover()}connectedCallback(){super.connectedCallback(),ge(this),this._optionObserver=new MutationObserver(()=>{this.requestUpdate(),this._refreshPopover()}),this._optionObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","disabled"],characterData:!0})}disconnectedCallback(){this._optionObserver?.disconnect(),this._optionObserver=null,this._closePopover()}render(){const e=this.label||"",t=this.placeholder||"All",o=this.disabled!==null;e?this.setAttribute("aria-label",e):this.removeAttribute("aria-label");const i=e||t,n=this._summarize(t),r=this._readValues().length>0,l=`${this.id||"os-unnamed"}__trigger`;return c` |
| 1287 |
${e?c`<label |
| 1288 |
class="os-multiselect__label" |
| 1289 |
for=${l} |
| 1290 |
>${e}</label>`:c``} |
| 1291 |
<button |
| 1292 |
id=${l} |
| 1293 |
type="button" |
| 1294 |
class="os-multiselect__trigger" |
| 1295 |
aria-haspopup="listbox" |
| 1296 |
aria-expanded=${this._isOpen()?"true":"false"} |
| 1297 |
aria-label=${i} |
| 1298 |
?disabled=${o} |
| 1299 |
data-active=${r?"true":"false"} |
| 1300 |
@click=${u=>this._onTriggerClick(u)} |
| 1301 |
> |
| 1302 |
<span class="os-multiselect__summary">${n}</span> |
| 1303 |
${z("chevron-right",{size:16,rotate:90,className:"os-multiselect__chevron"})} |
| 1304 |
</button> |
| 1305 |
`}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const o of Array.from(t)){const i=o.getAttribute("value");i!==null&&e.push({value:i,label:(o.textContent||i).trim(),disabled:o.hasAttribute("disabled")})}return e}_readValues(){return(this.value??"").split(",").map(t=>t.trim()).filter(t=>t!=="")}_writeValueAttribute(e){const t=e.join(",");this.value=t}_summarize(e){const t=this._readValues();if(t.length===0)return e;const o=this._readOptions(),i=new Map(o.map(n=>[n.value,n.label]));return t.length===1?i.get(t[0])??t[0]:`${t.length} selected`}_isOpen(){return this.open!==null}_onTriggerClick(e){e.stopPropagation(),e.preventDefault(),this.disabled===null&&(this._popover?this._closePopover():this._openPopover())}_openPopover(){if(this._popover)return;const e=document.createElement("div");e.className="os-multiselect__popover",e.setAttribute("role","listbox"),e.setAttribute("aria-multiselectable","true"),e.style.setProperty("--wp-admin-theme-color",getComputedStyle(this).getPropertyValue("--wp-admin-theme-color")||"#2271b1"),document.body.appendChild(e),this._popover=e,this._refreshPopover(),this._placePopover();const t=r=>{const a=r.target;if(!a)return;const l=this.shadowRoot?.querySelector(".os-multiselect__trigger");e.contains(a)||l&&l.contains(a)||this._closePopover()},o=r=>{r.key==="Escape"&&(r.stopPropagation(),this._closePopover(),this.shadowRoot?.querySelector(".os-multiselect__trigger")?.focus())},i=()=>this._placePopover(),n=()=>{if(!this._hasMore||this._loadingMore)return;const r=e.scrollHeight,a=e.clientHeight,l=e.scrollTop;r-(l+a)<64&&this.emit("os-multiselect-load-more",{})};setTimeout(()=>{document.addEventListener("pointerdown",t,!0)},0),document.addEventListener("keydown",o,!0),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),e.addEventListener("scroll",n),this._teardownOpen=()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",o,!0),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0),e.removeEventListener("scroll",n)},this.setAttribute("open",""),this.requestUpdate(),this.emit("os-multiselect-open",{})}_closePopover(){this._teardownOpen&&(this._teardownOpen(),this._teardownOpen=null),this._popover&&(this._popover.remove(),this._popover=null,this.removeAttribute("open"),this.requestUpdate(),this.emit("os-multiselect-close",{}))}_refreshPopover(){const e=this._popover;if(!e)return;const t=this._readOptions(),o=new Set(this._readValues());if(e.replaceChildren(),t.length===0){const i=document.createElement("div");i.className="os-multiselect__empty",i.textContent="No options",e.appendChild(i);return}if(o.size>0){const i=document.createElement("button");i.type="button",i.className="os-multiselect__clear",i.textContent="Clear",i.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation(),this._writeValueAttribute([]),this.requestUpdate(),this._refreshPopover(),this._emitPick()}),e.appendChild(i)}for(const i of t){const n=document.createElement("label");n.className="os-multiselect__option",n.setAttribute("role","option"),n.setAttribute("aria-selected",o.has(i.value)?"true":"false"),i.disabled&&(n.setAttribute("aria-disabled","true"),n.dataset.disabled="true");const r=document.createElement("input");r.type="checkbox",r.checked=o.has(i.value),r.disabled=i.disabled,r.addEventListener("change",()=>{const l=new Set(this._readValues());r.checked?l.add(i.value):l.delete(i.value);const u=t.map(h=>h.value).filter(h=>l.has(h));this._writeValueAttribute(u),n.setAttribute("aria-selected",r.checked?"true":"false"),this.requestUpdate(),this._refreshPopover(),this._emitPick()});const a=document.createElement("span");a.textContent=i.label,n.appendChild(r),n.appendChild(a),e.appendChild(n)}if(this._loadingMore){const i=document.createElement("div");i.className="os-multiselect__loading";const n=document.createElement("span");n.className="os-multiselect__spinner",n.setAttribute("aria-hidden","true");const r=document.createElement("span");r.textContent="Loading…",i.appendChild(n),i.appendChild(r),e.appendChild(i)}}_placePopover(){const e=this._popover,t=this.shadowRoot?.querySelector(".os-multiselect__trigger");if(!e||!t)return;const o=t.getBoundingClientRect(),i=window.innerWidth,n=window.innerHeight,r=Math.max(o.width,200);e.style.minWidth=`${r}px`;let a=o.left;a+r>i-8&&(a=Math.max(8,i-r-8)),e.style.left=`${a}px`,e.style.top=`${o.bottom+4}px`;const l=e.offsetHeight||200;o.bottom+4+l>n-8&&(e.style.top=`${Math.max(8,o.top-l-4)}px`)}_emitPick(){const e=this._readValues();this.emit("os-pick",{value:e.join(","),values:e})}};Ke.props=["value","label","placeholder","disabled","name","open"],Ke.styles=[Yc],Ke.help=void 0;let so=Ke;$("os-multiselect",so);const Be=class Be extends k{connectedCallback(){super.connectedCallback(),ge(this)}render(){const e=this.label||"",t=this.value??"",o=this.placeholder||"",i=this.disabled!==null,n=this.readonly!==null,r=this.name||"",a=this.suffix||"",l=this.min,u=this.max,h=this.step||"any",p=this.invalid!==null,_=`${this.id||"os-unnamed"}__input`;return c` |
| 1306 |
${e?c`<label |
| 1307 |
class="os-text-field__label" |
| 1308 |
for=${_} |
| 1309 |
>${e}</label>`:c``} |
| 1310 |
<span class="os-text-field__row"> |
| 1311 |
<input |
| 1312 |
id=${_} |
| 1313 |
type="number" |
| 1314 |
.value=${t} |
| 1315 |
placeholder=${o} |
| 1316 |
?disabled=${i} |
| 1317 |
?readonly=${n} |
| 1318 |
inputmode="decimal" |
| 1319 |
autocomplete="off" |
| 1320 |
min=${l??""} |
| 1321 |
max=${u??""} |
| 1322 |
step=${h} |
| 1323 |
name=${r} |
| 1324 |
aria-invalid=${p?"true":"false"} |
| 1325 |
aria-label=${e||""} |
| 1326 |
@input=${b=>this._onInput(b)} |
| 1327 |
@change=${b=>this._onCommit(b)} |
| 1328 |
@keydown=${b=>this._onKeyDown(b)} |
| 1329 |
/> |
| 1330 |
${a?c`<span class="os-text-field__suffix">${a}</span>`:c``} |
| 1331 |
</span> |
| 1332 |
`}_readRange(){const e=this.min,t=this.max,o=e!==null?parseFloat(e):-1/0,i=t!==null?parseFloat(t):1/0;return{min:Number.isFinite(o)?o:-1/0,max:Number.isFinite(i)?i:1/0}}_clamp(e){const{min:t,max:o}=this._readRange();return e<t?t:e>o?o:e}_onInput(e){const t=e.target,o=parseFloat(t.value);Number.isFinite(o)&&(this.value=String(o),this.emit("os-input-change",{value:o}))}_onCommit(e){const t=e.target,o=parseFloat(t.value);if(!Number.isFinite(o))return;const i=this._clamp(o);i!==o&&(t.value=String(i),this.value=String(i)),this.emit("os-input-commit",{value:i})}_onKeyDown(e){if(e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey){const t=e.target,o=parseFloat(t.value);if(!Number.isFinite(o))return;const i=this._clamp(o);i!==o&&(t.value=String(i),this.value=String(i)),this.emit("os-submit",{value:i})}}};Be.props=["label","value","placeholder","disabled","readonly","name","suffix","min","max","step","invalid"],Be.styles=[wi],Be.help=void 0;let oo=Be;$("os-number-field",oo);const Qc=w` ${R} ${Ft}:host{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var( --os-ui-fg,#1d2327 );cursor:pointer}:host( [ disabled ] ){cursor:not-allowed;opacity:0.55}:host( [ block ] ){display:flex;cursor:default}:host( [ block ] ) label{cursor:pointer}:host( [ block ][ disabled ] ) label{cursor:not-allowed}label{display:inline-flex;align-items:center;gap:6px;cursor:inherit}.os-checkbox__label{line-height:1.3}.os-checkbox__label:empty{display:none}`,Ge=class Ge extends k{render(){const e=this.checked!==null,t=this.disabled!==null,o=this.label||"",i=this.value;return c` |
| 1333 |
<label> |
| 1334 |
<input |
| 1335 |
type="checkbox" |
| 1336 |
?checked=${e} |
| 1337 |
?disabled=${t} |
| 1338 |
.value=${i??""} |
| 1339 |
@change=${n=>this._onChange(n)} |
| 1340 |
/> |
| 1341 |
<span class="os-checkbox__label">${o}</span> |
| 1342 |
</label> |
| 1343 |
`}_onChange(e){const o=e.target.checked;o?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:o,value:this.value})}};Ge.props=["checked","value","label","disabled"],Ge.styles=[Qc],Ge.help=void 0;let io=Ge;$("os-checkbox",io);const ed=w` ${R}:host{--_h:22px;--_pad:2px;--_knob:calc( var( --_h ) - 2 * var( --_pad ) );--_travel:calc( var( --_w ) - var( --_knob ) - 2 * var( --_pad ) );--_w:calc( var( --_h ) * 1.85 );--_drag:0px;--_dir:1;display:inline-flex;align-items:center;gap:10px;font-size:13px;line-height:1.3;color:var( --os-ui-fg,#1d2327 );cursor:pointer;-webkit-user-select:none;user-select:none}:host( [ size='sm' ] ){--_h:16px;--_pad:2px;font-size:12px;gap:8px}:host( [ size='lg' ] ){--_h:30px;--_pad:3px;font-size:14px;gap:12px}:host( [ block ] ){display:flex;width:100%;justify-content:space-between}:host( [ label-position='start' ] ) .os-switch__row{flex-direction:row-reverse}:host( [ disabled ] ){cursor:not-allowed;opacity:0.5}.os-switch__row{display:inline-flex;align-items:center;gap:inherit;flex:1 1 auto;justify-content:inherit}button{appearance:none;flex:0 0 auto;position:relative;box-sizing:border-box;width:var( --_w );height:var( --_h );padding:0;margin:0;border:0;border-radius:999px;background-color:var( --_holo-track );background-image:none;box-shadow:inset 0 0 0 1px var( --_holo-track-edge );cursor:inherit;outline:none;transition:background-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}button:disabled{cursor:not-allowed}:host( [ checked ] ) button{background-image:none;background-color:var( --os-ui-accent,#2271b1 );box-shadow:none}button:focus-visible{box-shadow:var( --_holo-focus ),inset 0 0 0 1px var( --_holo-track-edge )}:host( [ checked ] ) button:focus-visible{box-shadow:var( --_holo-focus )}:host( [ tone='accent' ][ checked ] ) button,:host( [ tone='danger' ][ checked ] ) button,:host( [ tone='success' ][ checked ] ) button{background-image:none}:host( [ tone='accent' ][ checked ] ) button{background-color:var( --os-ui-accent,#2271b1 )}:host( [ tone='danger' ][ checked ] ) button{background-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px rgba( 255,90,90,0.3 ),0 2px 10px rgba( 255,90,90,0.25 )}:host( [ tone='success' ][ checked ] ) button{background-color:var( --os-ui-success-fg,#00a32a );box-shadow:0 0 0 1px rgba( 147,240,198,0.3 ),0 2px 10px rgba( 147,240,198,0.25 )}.os-switch__knob{position:absolute;top:var( --_pad );inset-inline-start:var( --_pad );width:var( --_knob );height:var( --_knob );border-radius:999px;background:var( --os-ui-switch-knob,#fffbff );box-shadow:0 1px 2px rgba( 12,11,15,0.45 ),0 0 0 1px var( --os-ui-switch-knob-edge,rgba( 12,11,15,0.55 ) );pointer-events:none;transition:transform var( --_holo-t ) var( --_holo-spring ),width var( --_holo-t ) ease}.os-switch__knob{transform:translateX( calc( var( --_dir ) * var( --_drag ) ) )}:host( [ checked ] ) .os-switch__knob{transform:translateX( calc( var( --_dir ) * ( var( --_travel ) + var( --_drag ) ) ) )}:host(:not( [ disabled ] ) ) button:active .os-switch__knob{width:calc( var( --_knob ) * 1.28 )}:host( [ checked ]:not( [ disabled ] ) ) button:active .os-switch__knob{width:calc( var( --_knob ) * 1.28 );transform:translateX( calc( var( --_dir ) * ( var( --_travel ) - var( --_knob ) * 0.28 + var( --_drag ) ) ) )}:host( [ data-dragging ] ) .os-switch__knob{transition:width var( --_holo-t ) ease}.os-switch__label{line-height:1.3}.os-switch__label:empty{display:none}.os-switch__text{display:flex;flex-direction:column;gap:2px;min-width:0}.os-switch__description{font-size:0.92em;color:var( --os-ui-fg-muted,#646970 )}@media ( prefers-reduced-motion:reduce ){.os-switch__knob{transition-duration:1ms}}`,td=4,Xe=class Xe extends k{constructor(){super(...arguments),this._pointerId=null,this._startX=0,this._travel=0,this._moved=!1,this._dir=1,this._swallowClick=!1}render(){const e=this._attr("checked")!==null,t=this._attr("disabled")!==null,o=this._attr("label")||"",i=this._attr("description")||"";return c` |
| 1344 |
<div class="os-switch__row"> |
| 1345 |
<span class="os-switch__text"> |
| 1346 |
<span class="os-switch__label">${o}</span> |
| 1347 |
<span class="os-switch__description" id="os-switch-desc" |
| 1348 |
>${i}</span |
| 1349 |
> |
| 1350 |
</span> |
| 1351 |
<button |
| 1352 |
type="button" |
| 1353 |
role="switch" |
| 1354 |
aria-checked=${e?"true":"false"} |
| 1355 |
aria-label=${o||"Toggle"} |
| 1356 |
aria-describedby=${i?"os-switch-desc":""} |
| 1357 |
?disabled=${t} |
| 1358 |
@click=${()=>this._onClick()} |
| 1359 |
@keydown=${n=>this._onKeyDown(n)} |
| 1360 |
@pointerdown=${n=>this._onPointerDown(n)} |
| 1361 |
@pointermove=${n=>this._onPointerMove(n)} |
| 1362 |
@pointerup=${n=>this._onPointerUp(n)} |
| 1363 |
@pointercancel=${()=>this._endGesture()} |
| 1364 |
> |
| 1365 |
<span class="os-switch__knob"></span> |
| 1366 |
</button> |
| 1367 |
</div> |
| 1368 |
`}_onPointerDown(e){if(this._attr("disabled")!==null)return;const t=e.currentTarget;this._pointerId=e.pointerId,this._startX=e.clientX,this._moved=!1,this._dir=getComputedStyle(this).direction==="rtl"?-1:1,this.style.setProperty("--_dir",String(this._dir)),this._travel=Math.max(0,t.clientWidth-t.clientHeight),t.setPointerCapture(e.pointerId)}_onPointerMove(e){if(this._pointerId!==e.pointerId||this._travel===0)return;const t=(e.clientX-this._startX)*this._dir;if(!this._moved&&Math.abs(t)>=td&&(this._moved=!0,this.setAttribute("data-dragging","")),!this._moved)return;const o=this._attr("checked")!==null,i=o?-this._travel:0,n=o?0:this._travel;this.style.setProperty("--_drag",`${Math.min(n,Math.max(i,t))}px`)}_onPointerUp(e){if(this._pointerId!==e.pointerId)return;const t=this._moved,o=(e.clientX-this._startX)*this._dir;if(this._swallowClick=t,this._endGesture(),!t)return;const i=this._attr("checked")!==null,r=(i?this._travel:0)+o>this._travel/2;r!==i&&this._commit(r)}_endGesture(){this._pointerId=null,this._moved=!1,this.removeAttribute("data-dragging"),this.style.removeProperty("--_drag")}_onClick(){if(this._swallowClick){this._swallowClick=!1;return}this._attr("disabled")===null&&this._commit(this._attr("checked")===null)}_onKeyDown(e){this._attr("disabled")===null&&(e.key==="ArrowRight"||e.key==="End"?(e.preventDefault(),this._attr("checked")===null&&this._commit(!0)):(e.key==="ArrowLeft"||e.key==="Home")&&(e.preventDefault(),this._attr("checked")!==null&&this._commit(!1)))}_commit(e){e?this.setAttribute("checked",""):this.removeAttribute("checked");const t={checked:e,value:this._attr("value")};this.emit("os-switch-change",t),this.emit("os-checkbox-change",t)}_attr(e){return this[e]??null}};Xe.props=["checked","value","label","description","disabled","size","tone","block","labelPosition"],Xe.styles=[ed],Xe.help=void 0;let no=Xe;$("os-switch",no);const sd=w`:host{position:fixed;top:calc( var( --wp-admin--admin-bar--height,32px ) + 16px );inset-inline-end:16px;display:flex;flex-direction:column;gap:8px;z-index:calc( var( --os-z-fullscreen,99999 ) + 10 );pointer-events:none}`,od=w` ${R}:host{display:flex;align-items:center;gap:12px;min-width:280px;max-width:420px;padding:10px 14px;background-color:var( --os-ui-toast-bg,var( --os-ui-modal-bg,#1d2327 ) );background-image:var( --os-ui-toast-bg-image,none );background-repeat:var( --os-ui-toast-bg-image-repeat,repeat );background-size:var( --os-ui-toast-bg-image-size,auto );background-position:var( --os-ui-toast-bg-image-position,center );color:var( --os-ui-fg-on-accent,#fff );border-radius:10px;border:1px solid var( --os-ui-border,rgba( 255,255,255,0.12 ) );box-shadow:0 10px 30px rgba( 0,0,0,0.4 ),0 2px 6px rgba( 0,0,0,0.18 ),inset 0 0 0 1px rgba( 255,255,255,0.04 );font-size:13px;line-height:1.4;opacity:0;transform:translateY( -10px ) scale( 0.97 );transition:opacity var( --_holo-t-fast ) linear,transform var( --_holo-t ) var( --_holo-spring );pointer-events:auto}:host( [ state='in' ] ){opacity:1;transform:translateY( 0 ) scale( 1 )}:host( [ state='out' ] ){opacity:0;transform:translateX( 16px ) scale( 0.97 );transition:opacity var( --_holo-t-fast ) linear,transform var( --_holo-t ) var( --_holo-ease )}.os-toast__label{flex:1}button[ hidden ]{display:none}button{flex-shrink:0;padding:4px 10px;border:none;border-radius:4px;background:var( --os-ui-hover,rgba( 255,255,255,0.12 ) );color:var( --os-ui-fg-on-accent,#fff );font:inherit;font-size:12px;font-weight:500;cursor:pointer;transition:background-color 0.12s ease}button:hover{background:var( --os-ui-scrim,rgba( 255,255,255,0.22 ) )}button:focus-visible{outline:2px solid var( --os-ui-border,rgba( 255,255,255,0.6 ) );outline-offset:2px}.os-toast__close{display:inline-flex;align-items:center;justify-content:center;padding:4px;border-radius:6px;background:transparent;color:var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) )}.os-toast__close:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.14 ) );color:var( --os-ui-fg-on-accent,#fff )}@media ( prefers-reduced-motion:reduce ){:host{transition-duration:0.01ms}}`,rs=class rs extends k{connectedCallback(){super.connectedCallback(),this.setAttribute("aria-live","polite")}render(){return c`<slot></slot>`}};rs.styles=[sd],rs.help=void 0;let ro=rs;$("os-toast-container",ro);const Ze=class Ze extends k{constructor(){super(...arguments),this._hovered=!1,this._focused=!1,this._onEnter=()=>{this._hovered=!0,this._syncHold()},this._onLeave=()=>{this._hovered=!1,this._syncHold()},this._onFocusIn=()=>{this._focused=!0,this._syncHold()},this._onFocusOut=e=>{const t=e.relatedTarget;t instanceof Node&&this._containsDeep(t)||(this._focused=!1,this._syncHold())}}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","status"),this.addEventListener("mouseenter",this._onEnter),this.addEventListener("mouseleave",this._onLeave),this.addEventListener("focusin",this._onFocusIn),this.addEventListener("focusout",this._onFocusOut)}disconnectedCallback(){this.removeEventListener("mouseenter",this._onEnter),this.removeEventListener("mouseleave",this._onLeave),this.removeEventListener("focusin",this._onFocusIn),this.removeEventListener("focusout",this._onFocusOut)}_containsDeep(e){let t=e;for(;t;){if(t===this)return!0;const o=t.parentNode;t=o instanceof ShadowRoot?o.host:o}return!1}_syncHold(){const e=this._hovered||this._focused;e!==this.hasAttribute("held")&&(e?this.setAttribute("held",""):this.removeAttribute("held"),this.emit("os-toast-hold",{held:e}))}render(){const e=this.action||"",t=this.hasAttribute("dismissible");return c` |
| 1369 |
<span class="os-toast__label"><slot></slot></span> |
| 1370 |
<button |
| 1371 |
type="button" |
| 1372 |
?hidden=${!e} |
| 1373 |
@click=${o=>this._onAction(o)} |
| 1374 |
> |
| 1375 |
${e} |
| 1376 |
</button> |
| 1377 |
<button |
| 1378 |
type="button" |
| 1379 |
class="os-toast__close" |
| 1380 |
aria-label=${d("Dismiss")} |
| 1381 |
?hidden=${!t} |
| 1382 |
@click=${o=>this._onDismiss(o)} |
| 1383 |
> |
| 1384 |
${z("close",{size:16})} |
| 1385 |
</button> |
| 1386 |
`}_onAction(e){e.preventDefault(),e.stopPropagation(),this.emit("os-toast-action",{})}_onDismiss(e){e.preventDefault(),e.stopPropagation(),this.emit("os-toast-dismiss",{})}};Ze.props=["action","state","dismissible"],Ze.styles=[od],Ze.help={title:"Toast",summary:'Single transient notification. Message is slotted; fade-in / fade-out is CSS-driven by flipping the state attribute between "in" and "out". Usually created via the showToast() helper rather than authored by hand.',status:"stable",props:[{name:"action",type:"string",description:"Optional action button label. When set, a button renders on the right and emits os-toast-action on click."},{name:"state",type:"'in' | 'out'",description:'Drives the CSS fade transition. Set to "in" when rendered, flip to "out" before removal.'},{name:"dismissible",type:"boolean",description:"When set, a close (×) button renders on the right and emits os-toast-dismiss on click. Use for persistent toasts the user must be able to close."},{name:"held",type:"boolean (reflected, read-only)",description:"Set by the component while the pointer is over the toast or focus is inside it. showToast() pauses the auto-dismiss timer for as long as it is present. Do not set it by hand — pass `persistent` for a toast that should never expire."}],slots:[{name:"(default)",description:"Message text."}],events:[{name:"os-toast-action",description:"Fires when the action button is clicked.",detail:"{}"},{name:"os-toast-dismiss",description:"Fires when the close (×) button is clicked.",detail:"{}"},{name:"os-toast-hold",description:"Fires when the toast starts or stops being attended to — pointer over it, or focus inside it. showToast() pauses the auto-dismiss timer while held is true.",detail:"{ held: boolean }"}],example:c` |
| 1387 |
<os-toast state="in" action="Undo">Post moved to trash.</os-toast> |
| 1388 |
`};let ao=Ze;$("os-toast",ao);const id=w`:host{display:inline-flex}button{display:flex;align-items:center;justify-content:center;width:30px;height:30px;padding:0;border:none;border-radius:var( --os-ui-btn-radius,5px );background-color:var( --os-ui-btn-bg,transparent );background-image:var( --os-ui-btn-bg-image,none );background-repeat:var( --os-ui-btn-bg-image-repeat,no-repeat );background-size:var( --os-ui-btn-bg-image-size,auto );background-position:var( --os-ui-btn-bg-image-position,center );color:var( --os-ui-btn-color,currentColor );cursor:pointer;transition:background-color 0.15s ease,color 0.15s ease,transform 80ms ease}button:active{transform:scale( 0.9 )}@media ( prefers-reduced-motion:reduce ){button:active{transform:none}}button:hover{color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) )}button:focus-visible{color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );outline:2px solid var( --os-ui-btn-outline,currentColor );outline-offset:1px}:host( [ active ] ) button{color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-active,var( --os-ui-hover,rgba( 0,0,0,0.08 ) ) )}:host( [ danger ] ) button:hover{color:var( --os-ui-fg-on-accent,#fff );background-color:var( --os-ui-btn-danger-hover,var( --os-ui-danger,#d63638 ) )}svg{display:block;pointer-events:none;flex-shrink:0}svg:empty{display:none}.themed-icon{display:block;width:14px;height:14px;flex-shrink:0;pointer-events:none;background-color:var( --os-ui-btn-icon-color,currentColor )}::slotted( span ){line-height:1}::slotted( svg ){display:block}`,nd={minimize:'<path d="M3 6h6" stroke="currentColor" stroke-width="1.25" stroke-linecap="round"/>',maximize:'<rect x="3" y="3" width="6" height="6" rx="1" stroke="currentColor" stroke-width="1.25" fill="none"/>',fullscreen:'<path d="M4.5 2H2v2.5M10 4.5V2H7.5M4.5 10H2V7.5M10 7.5V10H7.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',"fullscreen-exit":'<path d="M2 4.5H4.5V2M7.5 2V4.5H10M2 7.5H4.5V10M7.5 10V7.5H10" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',detach:'<path d="M5 2H2.5v7.5H10V7M6.5 2H10v3.5M10 2L5.5 6.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',reload:'<g transform="translate(0.6 0.6) scale(0.021)" fill="currentColor"><path d="m504.554 233.704-76.447 91.467c-6.329 7.572-15.417 11.479-24.571 11.479a31.872 31.872 0 0 1-20.504-7.447l-91.467-76.447c-13.561-11.334-15.366-31.515-4.032-45.075s31.515-15.366 45.075-4.032l37.506 31.347c-10.274-74.891-74.668-132.774-152.337-132.774C132.984 102.223 64 171.207 64 256s68.984 153.777 153.777 153.777c17.673 0 32 14.327 32 32s-14.327 32-32 32c-58.17 0-112.859-22.653-153.991-63.785C22.653 368.859 0 314.17 0 256s22.653-112.859 63.786-153.992c41.132-41.132 95.821-63.785 153.991-63.785s112.859 22.653 153.992 63.785c32.517 32.516 53.471 73.508 60.829 117.991l22.849-27.339c11.334-13.56 31.515-15.364 45.075-4.032 13.56 11.335 15.365 31.516 4.032 45.076z"/></g>',close:'<path d="M3.25 3.25l5.5 5.5M3.25 8.75l5.5-5.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round"/>',menu:'<circle cx="3" cy="6" r="1.2" fill="currentColor"/><circle cx="6" cy="6" r="1.2" fill="currentColor"/><circle cx="9" cy="6" r="1.2" fill="currentColor"/>'};function rd(s){const e=(s??"").trim();return e===""||e.length>4096||!/^(https?:\/\/|data:image\/)/i.test(e)||/['"()\\<>\s]/.test(e)?"":e}const Ye=class Ye extends k{constructor(){super(...arguments),this._activateWired=!1}static get observedAttributes(){return[...super.observedAttributes,"aria-label"]}render(){const e=rd(this["icon-src"]||this.getAttribute("icon-src")||""),t=e?"":this.icon||"",o=nd[t]||"",i=this.getAttribute("aria-label")||"";return e?c` |
| 1389 |
<button type="button" aria-label="${i}"> |
| 1390 |
<span |
| 1391 |
class="themed-icon" |
| 1392 |
aria-hidden="true" |
| 1393 |
style="-webkit-mask: url('${e}') center / contain no-repeat; mask: url('${e}') center / contain no-repeat;" |
| 1394 |
></span> |
| 1395 |
<slot></slot> |
| 1396 |
</button> |
| 1397 |
`:c` |
| 1398 |
<button type="button" aria-label="${i}"> |
| 1399 |
<svg |
| 1400 |
width="14" |
| 1401 |
height="14" |
| 1402 |
viewBox="0 0 12 12" |
| 1403 |
aria-hidden="true" |
| 1404 |
focusable="false" |
| 1405 |
></svg> |
| 1406 |
<slot></slot> |
| 1407 |
</button> |
| 1408 |
<span data-svg-buffer style="display:none">${o}</span> |
| 1409 |
`}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg()),queueMicrotask(()=>this._wireActivateEvent())}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("svg"),o=e.querySelector("[data-svg-buffer]");if(t&&o){const i=o.textContent||"";t.innerHTML!==i&&(t.innerHTML=i)}}_wireActivateEvent(){if(this._activateWired)return;const e=this.shadowRoot;if(!e)return;const t=e.querySelector("button");t&&(this._activateWired=!0,t.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("os-button-activate",{bubbles:!0,composed:!0,cancelable:!0}))}))}};Ye.props=["icon","icon-src","active","danger"],Ye.styles=[id],Ye.help=void 0;let lo=Ye;$("os-window-button",lo);const ad=w` ${R} ${us}:host{display:block;animation:os-holo-enter var( --_holo-t ) var( --_holo-spring );transform-origin:top left;min-width:220px;padding:4px;background:var( --os-window-bg,#fff );background-image:var( --os-ui-menu-bg-image,none );background-repeat:var( --os-ui-menu-bg-image-repeat,repeat );background-size:var( --os-ui-menu-bg-image-size,auto );background-position:var( --os-ui-menu-bg-image-position,center );color:var( --os-ui-fg,#1d2327 );border:1px solid var( --os-window-border,#c3c4c7 );border-radius:8px;box-shadow:0 8px 24px rgba( 0,0,0,0.18 ),0 2px 6px rgba( 0,0,0,0.08 )}:host(:dir( rtl ) ){transform-origin:top right}@media ( prefers-reduced-motion:reduce ){:host{animation:none}}:host( [ hidden ] ){display:none}`,ld=w`:host{display:block}button{display:flex;align-items:center;gap:10px;width:100%;min-height:32px;padding:6px 10px;border:none;border-radius:6px;background:transparent;color:inherit;font:inherit;font-size:13px;line-height:1.3;text-align:start;cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease}button:hover,button:focus-visible{background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) );color:var( --os-ui-fg,#000 );outline:none}button:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.os-menu-item__icon{flex-shrink:0;width:18px;height:18px;font-size:18px;line-height:1;color:var( --wp-admin-theme-color,#2271b1 )}.os-menu-item__icon[ hidden ]{display:none}.os-menu-item__label{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.os-menu-item__check{flex-shrink:0;width:16px;height:16px;border-radius:3px;border:1.5px solid var( --os-ui-border,rgba( 0,0,0,0.25 ) );position:relative;background:transparent;transition:background-color 0.12s ease,border-color 0.12s ease}.os-menu-item__check[ hidden ]{display:none}:host( [ checked ] ) .os-menu-item__check{background-color:transparent;background-image:var( --os-ui-holo-fill,linear-gradient( 124deg,#afa2e8 0%,#f5a8ea 46%,#8ee9f7 100% ) );background-size:200% 200%;background-position:25% 30%;border-color:transparent;box-shadow:var( --os-ui-holo-glow,0 0 0 1px rgba( 242,82,252,0.28 ),0 2px 10px rgba( 242,82,252,0.22 ) )}:host( [ checked ] ) .os-menu-item__check::after{content:'';position:absolute;top:1px;left:4px;width:4px;height:8px;border:solid var( --os-ui-holo-ink,#0c0b0f );border-width:0 2px 2px 0;transform:rotate( 45deg )}`,as=class as extends k{connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}render(){return c`<slot></slot>`}};as.styles=[ad],as.help=void 0;let co=as;$("os-menu",co);const Je=class Je extends k{connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","menuitem")}render(){const e=this.icon||"",t=this.getAttribute("role")==="menuitemcheckbox",o=this.checked!==null;return t&&this.setAttribute("aria-checked",o?"true":"false"),c` |
| 1410 |
<button type="button" @click=${i=>this._onPick(i)}> |
| 1411 |
<span |
| 1412 |
class="os-menu-item__check" |
| 1413 |
?hidden=${!t} |
| 1414 |
></span> |
| 1415 |
<span |
| 1416 |
class="os-menu-item__icon dashicons ${e}" |
| 1417 |
aria-hidden="true" |
| 1418 |
?hidden=${t||!e} |
| 1419 |
></span> |
| 1420 |
<span class="os-menu-item__label"> |
| 1421 |
<slot></slot> |
| 1422 |
</span> |
| 1423 |
</button> |
| 1424 |
`}_onPick(e){e.preventDefault(),this.emit("os-menu-item-click",{value:this.value})}};Je.props=["icon","value","checked"],Je.styles=[ld],Je.help={title:"Menu item",summary:'Single row inside a <os-menu>. Supports three looks: plain label, left-aligned dashicon (icon="dashicons-…"), or a checkbox indicator (role="menuitemcheckbox" + checked).',status:"stable",props:[{name:"icon",type:"string (dashicons class)",description:'Dashicons class rendered on the left. Ignored when role="menuitemcheckbox".'},{name:"value",type:"string",description:"Identifier emitted in os-menu-item-click.detail.value."},{name:"checked",type:"boolean attribute",description:'Visible check indicator. Only honoured when role="menuitemcheckbox".'}],slots:[{name:"(default)",description:"Menu item label."}],events:[{name:"os-menu-item-click",description:"Fires when the item is clicked; bubbles so the <os-menu> parent can delegate.",detail:"{ value: string | null }"}],example:c` |
| 1425 |
<os-menu> |
| 1426 |
<os-menu-item value="plain">Plain item</os-menu-item> |
| 1427 |
<os-menu-item value="icon" icon="dashicons-external"> |
| 1428 |
With an icon |
| 1429 |
</os-menu-item> |
| 1430 |
<os-menu-item value="startup" role="menuitemcheckbox" checked> |
| 1431 |
Checked (menuitemcheckbox) |
| 1432 |
</os-menu-item> |
| 1433 |
</os-menu> |
| 1434 |
`};let uo=Je;$("os-menu-item",uo);const cd=w` ${R} ${us}:host{display:none;position:fixed;min-width:180px;background-color:var( --os-ui-context-menu-bg,#1d2327 );background-image:var( --os-ui-menu-bg-image,none );background-repeat:var( --os-ui-menu-bg-image-repeat,repeat );background-size:var( --os-ui-menu-bg-image-size,auto );background-position:var( --os-ui-menu-bg-image-position,center );color:var( --os-ui-context-menu-fg,var( --os-fg,#fff ) );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.08 ) );border-radius:8px;box-shadow:0 8px 24px rgba( 0,0,0,0.45 );padding:4px;font-size:13px;line-height:1.3;z-index:9999}:host( [ open ] ){display:block;animation:os-holo-enter var( --_holo-t-fast ) var( --_holo-ease );transform-origin:top left}:host( [ open ]:dir( rtl ) ){transform-origin:top right}@media ( prefers-reduced-motion:reduce ){:host( [ open ] ){animation:none}}`,dd=w`:host{display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:0;background:transparent;color:inherit;text-align:start;cursor:pointer;border-radius:4px;box-sizing:border-box;user-select:none}:host(:hover ),:host( [ active ] ){background:var( --os-ui-hover,rgba( 255,255,255,0.1 ) );outline:none}:host( [ disabled ] ){opacity:0.45;cursor:not-allowed}:host( [ danger ] ){color:var( --os-ui-danger-hover,#ff8a8a )}:host( [ danger ]:hover ){background:var( --os-ui-badge-danger-bg,rgba( 255,90,90,0.18 ) )}:host( [ heading ] ){padding:8px 10px 4px;font-size:10px;font-weight:700;letter-spacing:0.06em;text-transform:uppercase;color:var( --os-ui-context-menu-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.5 ) ) );pointer-events:none}.icon{display:inline-flex;align-items:center;justify-content:center;font-size:18px;width:20px;height:20px}.label{flex:1}.chevron{margin-inline-start:auto;padding-inline-start:8px;font-size:16px;line-height:1;opacity:0.7}.check{display:inline-flex;align-items:center;justify-content:center;width:14px;font-size:13px;line-height:1;opacity:0.95}`,Qe=class Qe extends k{render(){return c` |
| 1435 |
<slot></slot> |
| 1436 |
`}connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}};Qe.props=["open"],Qe.styles=[cd],Qe.help=void 0;let ho=Qe;$("os-context-menu",ho);const et=class et extends k{constructor(){super(...arguments),this._onActivate=e=>{if(this.hasAttribute("disabled")||this.hasAttribute("heading"))return;const t=e.target;t&&t!==this&&t.closest("os-context-menu-option")!==this||this.emit("os-context-menu-pick",{id:this.dataset.menuItemId??this.id??"",value:this.getAttribute("value")??""})},this._onKey=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._onActivate(e))}}connectedCallback(){super.connectedCallback();const e=this.hasAttribute("heading");this.setAttribute("role",e?"presentation":"menuitem"),e||this.setAttribute("tabindex","0"),this.addEventListener("click",this._onActivate),this.addEventListener("keydown",this._onKey)}disconnectedCallback(){this.removeEventListener("click",this._onActivate),this.removeEventListener("keydown",this._onKey)}render(){const e=this.getAttribute("icon"),t=this.hasAttribute("has-children"),o=this.hasAttribute("checked");return c` |
| 1437 |
${o?c`<span class="check" aria-hidden="true">✓</span>`:c``} |
| 1438 |
${e?c`<span class="icon dashicons ${e}" aria-hidden="true"></span>`:c``} |
| 1439 |
<span class="label"><slot></slot></span> |
| 1440 |
${t?c`<span class="chevron" aria-hidden="true">›</span>`:c``} |
| 1441 |
`}};et.props=["value","icon","disabled","danger","heading","has-children","checked"],et.styles=[dd],et.help={title:"Context menu option",summary:"Single row inside <os-context-menu>. Use `icon` for a leading dashicon, `danger` for destructive items, `heading` for a non-interactive section header, `has-children` to render a trailing chevron.",status:"stable",props:[{name:"value",type:"string",description:"Forwarded as `detail.value` on activation."},{name:"icon",type:"string",description:"Dashicon class (e.g. `dashicons-trash`)."},{name:"disabled",type:"boolean attribute",description:"Renders the option dimmed; clicks are ignored."},{name:"danger",type:"boolean attribute",description:"Destructive styling — red text, red hover."},{name:"heading",type:"boolean attribute",description:"Non-interactive section header. Ignores clicks."},{name:"has-children",type:"boolean attribute",description:"Renders a trailing chevron to suggest a submenu."},{name:"checked",type:"boolean attribute",description:"Renders a leading check mark — for radio-style picks inside a submenu (e.g. the active Sort By order)."}],slots:[{name:"(default)",description:"Visible label."}],events:[{name:"os-context-menu-pick",description:"Bubbled on click / Enter for non-heading non-disabled options. Detail: `{ id, value }`."}],example:c` |
| 1442 |
<os-context-menu open style="position: relative; z-index: 0"> |
| 1443 |
<os-context-menu-option heading>Every variant</os-context-menu-option> |
| 1444 |
<os-context-menu-option value="plain">Plain</os-context-menu-option> |
| 1445 |
<os-context-menu-option value="icon" icon="dashicons-admin-page"> |
| 1446 |
With an icon |
| 1447 |
</os-context-menu-option> |
| 1448 |
<os-context-menu-option value="checked" checked> |
| 1449 |
Checked |
| 1450 |
</os-context-menu-option> |
| 1451 |
<os-context-menu-option value="children" has-children> |
| 1452 |
With a submenu |
| 1453 |
</os-context-menu-option> |
| 1454 |
<os-context-menu-option value="off" disabled>Disabled</os-context-menu-option> |
| 1455 |
<os-context-menu-option value="del" danger icon="dashicons-trash"> |
| 1456 |
Danger |
| 1457 |
</os-context-menu-option> |
| 1458 |
</os-context-menu> |
| 1459 |
`};let po=et;$("os-context-menu-option",po);const ud=w` ${R}:host{display:none;position:fixed;inset:0;align-items:center;justify-content:center;background:var( --os-ui-scrim,rgba( 0,0,0,0.45 ) );background-image:var( --os-ui-scrim-image,none );background-repeat:var( --os-ui-scrim-image-repeat,repeat );background-size:var( --os-ui-scrim-image-size,auto );background-position:var( --os-ui-scrim-image-position,center );backdrop-filter:blur( 2px );z-index:10000;--os-ui-fg:var( --os-ui-modal-text,#f0f0f1 );--os-ui-fg-muted:var( --os-ui-modal-text-muted,#a7aaad );--os-ui-border:var( --os-ui-modal-border,rgba( 255,255,255,0.25 ) );--os-window-bg:var( --os-ui-modal-field-bg,#2c3338 );--os-ui-button-bg-hover:var( --os-ui-modal-button-bg-hover,rgba( 255,255,255,0.08 ) );--os-ui-surface:var( --os-ui-modal-surface,#2c3338 );--os-ui-surface-elevated:var( --os-ui-modal-surface-elevated,#3c434a );--os-ui-border-strong:var( --os-ui-modal-border-strong,rgba( 255,255,255,0.35 ) );--os-ui-hover:var( --os-ui-modal-hover,rgba( 255,255,255,0.08 ) )}:host( [ open ] ){display:flex;animation:os-modal-scrim var( --_holo-t ) var( --_holo-ease )}:host( [ open ] ) .dialog{animation:os-modal-dialog var( --_holo-t ) var( --_holo-spring )}@keyframes os-modal-scrim{from{opacity:0}}@keyframes os-modal-dialog{from{opacity:0;transform:scale( 0.96 ) translateY( 8px )}}@media ( prefers-reduced-motion:reduce ){:host( [ open ] ),:host( [ open ] ) .dialog{animation:none}}.dialog{max-width:92vw;max-height:90vh;background-color:var( --os-ui-modal-bg,#1d2327 );background-image:var( --os-ui-dialog-bg-image,none );background-repeat:var( --os-ui-dialog-bg-image-repeat,repeat );background-size:var( --os-ui-dialog-bg-image-size,auto );background-position:var( --os-ui-dialog-bg-image-position,center );color:var( --os-ui-modal-fg,var( --os-fg,#fff ) );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.08 ) );border-radius:10px;box-shadow:0 20px 50px rgba( 0,0,0,0.6 );display:flex;flex-direction:column;overflow:hidden}:host( [ size='sm' ] ) .dialog{width:min( 360px,92vw )}:host(:not( [ size ] ) ) .dialog,:host( [ size='md' ] ) .dialog{width:min( 540px,92vw )}:host( [ size='lg' ] ) .dialog{width:min( 760px,94vw )}.header{display:flex;align-items:center;gap:10px;padding:16px 20px 12px;border-bottom:1px solid var( --os-ui-border,rgba( 255,255,255,0.06 ) )}.title{margin:0;flex:1;font-size:15px;font-weight:600}.header-actions{display:flex;gap:6px}.header-actions::slotted( * ){margin-inline-start:6px}.close{background:transparent;border:0;color:inherit;font-size:18px;line-height:1;padding:4px 8px;border-radius:4px;cursor:pointer;opacity:0.7}.close:hover{opacity:1;background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) )}.body{padding:16px 20px;overflow:auto;flex:1 1 auto;font-size:13px;line-height:1.5}.footer{padding:12px 20px 16px;border-top:1px solid var( --os-ui-border,rgba( 255,255,255,0.06 ) )}.footer slot{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap}:host( [ mandatory ] ) .close{display:none}`,Gn='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',tt=class tt extends k{constructor(){super(...arguments),this._prevFocus=null,this._onKey=e=>{if(e.key==="Escape"&&!this.hasAttribute("mandatory")){e.preventDefault(),this._cancel();return}if(e.key==="Tab"){const t=this._focusables();if(t.length===0)return;const o=t[0],i=t[t.length-1],n=this.ownerDocument,r=n?n.activeElement:null,a=e.composedPath()[0]||r;e.shiftKey&&a===o?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),o.focus())}},this._onBackdrop=e=>{if(this.hasAttribute("mandatory"))return;const t=e.composedPath();(t.length>0?t[0]:e.target)===this&&this._cancel()}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","dialog"),this.setAttribute("aria-modal","true"),this.addEventListener("keydown",this._onKey),this.addEventListener("click",this._onBackdrop)}disconnectedCallback(){this.removeEventListener("keydown",this._onKey),this.removeEventListener("click",this._onBackdrop)}attributeChangedCallback(e,t,o){if(super.attributeChangedCallback?.(e,t,o),e==="open"){if(o!==null){const i=this.ownerDocument;this._prevFocus=i?i.activeElement:null,queueMicrotask(()=>this._focusFirst())}else if(this._prevFocus){try{this._prevFocus.focus()}catch{}this._prevFocus=null}}}showModal(){this.setAttribute("open","")}hideModal(){this.removeAttribute("open")}_focusables(){const e=this.shadowRoot;if(!e)return[];const t=Array.from(this.querySelectorAll(Gn)),o=Array.from(e.querySelectorAll(Gn));return[...t,...o].filter(i=>i.offsetParent!==null||i.tagName==="BUTTON")}_focusFirst(){const e=this._focusables();e.length>0?e[0].focus():this.shadowRoot?.querySelector(".dialog")?.focus?.()}_cancel(){const e=new CustomEvent("os-modal-cancel",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e)&&this.hideModal()}render(){const e=this.getAttribute("title")??"",t=this.hasAttribute("mandatory");return c` |
| 1460 |
<div part="dialog" class="dialog" tabindex="-1"> |
| 1461 |
${e?c` |
| 1462 |
<div class="header"> |
| 1463 |
<h2 class="title">${e}</h2> |
| 1464 |
<div class="header-actions"> |
| 1465 |
<slot name="header-actions"></slot> |
| 1466 |
${t?c``:c`<button |
| 1467 |
type="button" |
| 1468 |
class="close" |
| 1469 |
aria-label="Close" |
| 1470 |
@click=${()=>this._cancel()} |
| 1471 |
>×</button>`} |
| 1472 |
</div> |
| 1473 |
</div> |
| 1474 |
`:c``} |
| 1475 |
<div class="body"> |
| 1476 |
<slot></slot> |
| 1477 |
</div> |
| 1478 |
<div class="footer"> |
| 1479 |
<slot name="footer"></slot> |
| 1480 |
</div> |
| 1481 |
</div> |
| 1482 |
`}};tt.props=["open","title","size","mandatory"],tt.styles=[ud],tt.help=void 0;let fo=tt;$("os-modal",fo);const hd=w`:host{display:block;position:relative;font-size:13px}.input{width:100%;padding:8px 10px;background:var( --os-ui-input-bg,var( --os-ui-hover,rgba( 255,255,255,0.06 ) ) );color:inherit;border:1px solid var( --os-ui-border,rgba( 255,255,255,0.12 ) );border-radius:6px;font:inherit;box-sizing:border-box}.input:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --os-ui-focus-ring-field,0 0 0 1px #2271b1,0 0 0 4px rgba( 34,113,177,0.18 ) )}.dropdown{background:var( --os-bg,#1d2327 );color:var( --os-fg,#fff );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.18 ) );border-radius:6px;overflow:auto;z-index:11000;box-shadow:0 12px 32px rgba( 0,0,0,0.5 )}.empty.error{color:var( --os-ui-danger-hover,#ff8080 )}.item{display:flex;align-items:center;gap:10px;padding:8px 10px;cursor:pointer;border:0;background:transparent;color:inherit;width:100%;text-align:start;font:inherit}.item:hover,.item:focus{background:var( --os-ui-hover,rgba( 255,255,255,0.06 ) );outline:none}.avatar{width:24px;height:24px;border-radius:50%;flex:0 0 auto;background:var( --os-ui-hover,rgba( 255,255,255,0.1 ) )}.name{font-weight:500}.slug{opacity:0.6;font-size:12px}.empty{padding:12px;color:var( --os-ui-fg-muted,rgba( 255,255,255,0.5 ) );font-size:12px}`,st=class st extends k{constructor(){super(...arguments),this._timer=null,this._abort=null,this._results=[],this._query="",this._open=!1,this._phase="idle",this._error="",this._dropdownStyle="",this._onScrollOrResize=()=>{},this._onInput=e=>{const t=e.target.value;this._query=t,this._scheduleSearch(t)},this._onFocus=()=>{if(this._results.length===0&&this._phase==="idle"){this._scheduleSearch(this._query);return}this._open=!0,this._positionDropdown(),this.requestUpdate()},this._onBlur=()=>{setTimeout(()=>{this._open=!1,this.requestUpdate()},150)},this._pick=e=>{this.emit("os-user-pick",{user:e}),this._results=[],this._open=!1,this._phase="idle",this._query="";const t=this.shadowRoot?.querySelector(".input");t&&(t.value=""),this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this._onScrollOrResize=()=>{this._open&&(this._positionDropdown(),this.requestUpdate())},window.addEventListener("resize",this._onScrollOrResize),window.addEventListener("scroll",this._onScrollOrResize,!0)}disconnectedCallback(){this._timer&&clearTimeout(this._timer),this._abort&&this._abort.abort(),window.removeEventListener("resize",this._onScrollOrResize),window.removeEventListener("scroll",this._onScrollOrResize,!0)}_endpoint(){const e=this.getAttribute("endpoint");return e||window.openStationConfig?.filesUsersSearchUrl||""}_scheduleSearch(e){this._timer&&clearTimeout(this._timer),this._phase="loading",this._open=!0,this._positionDropdown(),this.requestUpdate(),this._timer=setTimeout(()=>this._runSearch(e),200)}async _runSearch(e){const t=this._endpoint();if(!t){this._phase="error",this._error="Search endpoint is not configured.",this._results=[],this._open=!0,this.requestUpdate();return}this._abort&&this._abort.abort();const o=new AbortController;this._abort=o;const i=this.getAttribute("exclude")||"",n=t+"?q="+encodeURIComponent(e)+"&exclude="+encodeURIComponent(i);try{const r={signal:o.signal,credentials:"same-origin"},a=await O(n,r,{source:"desktop-mode/files-user-search",silent:!0});if(!a.ok)throw new Error(`HTTP ${a.status}`);const l=await a.json();this._results=l&&Array.isArray(l.users)?l.users:[],this._phase="ready",this._error="",this._open=!0}catch(r){if(r.name==="AbortError")return;this._results=[],this._phase="error",this._error=r.message||"Search failed.",this._open=!0}this._positionDropdown(),this.requestUpdate()}_positionDropdown(){const e=this.shadowRoot?.querySelector(".input");if(!e)return;const t=e.getBoundingClientRect(),o=t.bottom+4,i=t.left,n=t.width,a=window.innerHeight-t.bottom,l=t.top,u=Math.max(120,Math.min(280,Math.max(a,l)-16));a<200&&l>a?this._dropdownStyle=["position:fixed",`left:${i}px`,`top:${t.top-4-u}px`,`width:${n}px`,`max-height:${u}px`].join(";"):this._dropdownStyle=["position:fixed",`left:${i}px`,`top:${o}px`,`width:${n}px`,`max-height:${u}px`].join(";")}_dropdownContent(){if(this._phase==="loading")return c`<div class="empty">Searching…</div>`;if(this._phase==="error")return c`<div class="empty error">${this._error}</div>`;if(this._results.length===0){const e=this._query?"No matches.":"No users available.";return c`<div class="empty">${e}</div>`}return this._results.map(e=>c` |
| 1483 |
<button |
| 1484 |
type="button" |
| 1485 |
class="item" |
| 1486 |
role="option" |
| 1487 |
@mousedown=${t=>t.preventDefault()} |
| 1488 |
@click=${()=>this._pick(e)} |
| 1489 |
> |
| 1490 |
<img class="avatar" src=${e.avatarUrl} alt="" /> |
| 1491 |
<div> |
| 1492 |
<div class="name">${e.name}</div> |
| 1493 |
<div class="slug">${e.slug}</div> |
| 1494 |
</div> |
| 1495 |
</button> |
| 1496 |
`)}render(){const e=this.getAttribute("placeholder")||"Search users…";return c` |
| 1497 |
<input |
| 1498 |
class="input" |
| 1499 |
type="search" |
| 1500 |
placeholder=${e} |
| 1501 |
autocomplete="off" |
| 1502 |
@input=${this._onInput} |
| 1503 |
@focus=${this._onFocus} |
| 1504 |
@blur=${this._onBlur} |
| 1505 |
.value=${this._query} |
| 1506 |
/> |
| 1507 |
${this._open?c` |
| 1508 |
<div class="dropdown" role="listbox" style=${this._dropdownStyle}> |
| 1509 |
${this._dropdownContent()} |
| 1510 |
</div> |
| 1511 |
`:c``} |
| 1512 |
`}};st.props=["placeholder","exclude","endpoint"],st.styles=[hd],st.help=void 0;let go=st;$("os-user-search",go);const pd=w`:host{display:flex;flex-wrap:wrap;gap:6px;font-size:13px}.chip{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;background:var( --os-ui-hover,rgba( 255,255,255,0.06 ) );color:inherit;border:1px solid var( --os-ui-border,rgba( 255,255,255,0.12 ) );cursor:pointer;font:inherit}.chip:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.12 ) )}.chip[ aria-pressed='true' ]{background:var( --wp-admin-theme-color,#2271b1 );border-color:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.empty{color:var( --os-ui-fg-muted,rgba( 255,255,255,0.5 ) );font-size:12px}`,ot=class ot extends k{constructor(){super(...arguments),this._onToggle=e=>{const t=!this._selectedSet().has(e);this.emit("os-role-toggle",{slug:e,selected:t})}}_selectedSet(){const e=this.getAttribute("selected")||"";return new Set(e.split(",").map(t=>t.trim()).filter(t=>t!==""))}_roles(){const e=this.getAttribute("roles");if(e)try{const t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return window.openStationConfig?.shareEligibleRoles||[]}render(){const e=this._roles();if(e.length===0)return c`<span class="empty">No eligible roles.</span>`;const t=this._selectedSet();return c` |
| 1513 |
${e.map(o=>{const i=t.has(o.slug);return c` |
| 1514 |
<button |
| 1515 |
type="button" |
| 1516 |
class="chip" |
| 1517 |
aria-pressed=${i?"true":"false"} |
| 1518 |
@click=${()=>this._onToggle(o.slug)} |
| 1519 |
>${o.name}</button> |
| 1520 |
`})} |
| 1521 |
`}};ot.props=["selected","roles"],ot.styles=[pd],ot.help=void 0;let bo=ot;$("os-role-picker",bo);const fd=w`:host{display:block;position:absolute;z-index:10;background:var( --os-ui-flyout-bg,var( --os-ui-surface-elevated,#ffffff ) );background-image:var( --os-ui-panel-bg-image,none );background-repeat:var( --os-ui-panel-bg-image-repeat,repeat );background-size:var( --os-ui-panel-bg-image-size,auto );background-position:var( --os-ui-panel-bg-image-position,center );color:var( --os-ui-flyout-fg,var( --os-fg,#1d2327 ) );border-radius:14px;box-shadow:var( --os-ui-flyout-shadow,0 16px 48px rgba( 0,25,53,0.4 ) );transform:translateX( 110% );opacity:0;pointer-events:none;transition:transform 220ms cubic-bezier( 0.22,1,0.36,1 ),opacity 180ms ease}:host( [ open ] ){transform:translateX( 0 );opacity:1;pointer-events:auto}:host( [ placement='end' ] ),:host(:not( [ placement ] ) ){inset-block:64px 14px;inset-inline-end:14px;width:min( 320px,calc( 100% - 28px ) )}:host( [ placement='start' ] ){inset-block:64px 14px;inset-inline-start:14px;width:min( 320px,calc( 100% - 28px ) );transform:translateX( -110% )}:host( [ placement='start' ][ open ] ){transform:translateX( 0 )}:host( [ placement='top' ] ){inset-block-start:14px;inset-inline:14px;max-block-size:calc( 100% - 28px );transform:translateY( -110% )}:host( [ placement='top' ][ open ] ){transform:translateY( 0 )}:host-context( [ dir='rtl' ] ):host( [ placement='end' ] ),:host-context( [ dir='rtl' ] ):host(:not( [ placement ] ) ){transform:translateX( -110% )}:host-context( [ dir='rtl' ] ):host( [ placement='end' ][ open ] ),:host-context( [ dir='rtl' ] ):host(:not( [ placement ] ) [ open ] ){transform:translateX( 0 )}:host-context( [ dir='rtl' ] ):host( [ placement='start' ] ){transform:translateX( 110% )}:host-context( [ dir='rtl' ] ):host( [ placement='start' ][ open ] ){transform:translateX( 0 )}:host::before{content:'';position:fixed;inset:0;background:var( --os-ui-flyout-backdrop,transparent );z-index:-1;pointer-events:none;transition:opacity 180ms ease;opacity:0}:host( [ open ] )::before{opacity:1}@media ( prefers-reduced-motion:reduce ){:host{transition:none}:host::before{transition:none}}`,Xn=["a[href]","area[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(","),gd="[data-flyout-close]",it=class it extends k{constructor(){super(...arguments),this._trigger=null,this._onDocKey=null,this._onScopePointerDown=null,this._onHostClick=null,this._onHostKeyDown=null,this._pendingReason=null}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")||this.setAttribute("inert","")}disconnectedCallback(){this._detachOpenListeners()}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),e==="open"&&(o!==null&&t===null?this._handleOpen():o===null&&t!==null&&this._handleClose())}_handleOpen(){this.removeAttribute("inert");const e=this.ownerDocument,t=e?.activeElement??null;this._trigger=t instanceof HTMLElement&&t!==this&&t!==e?.body&&t!==e?.documentElement?t:null,queueMicrotask(()=>{if(!this.hasAttribute("open"))return;(this._firstFocusable()??this).focus?.({preventScroll:!0})}),this._attachOpenListeners()}_handleClose(){const e=this._pendingReason??"api";this._pendingReason=null,this.setAttribute("inert",""),this._detachOpenListeners(),this.emit("os-flyout-dismiss",{reason:e});const t=this._trigger;this._trigger=null,t&&t.isConnected&&t.focus?.({preventScroll:!0})}_dismiss(e){this.hasAttribute("open")&&(this._pendingReason=e,this.removeAttribute("open"))}_attachOpenListeners(){const e=this._resolveScopeRoot();this._onScopePointerDown=t=>{if(!this.hasAttribute("open"))return;const o=t.composedPath();o.includes(this)||this._trigger&&o.includes(this._trigger)||this._dismiss("pointer")},e.addEventListener("pointerdown",this._onScopePointerDown),this._onDocKey=t=>{t.key==="Escape"&&this.hasAttribute("open")&&(t.preventDefault(),this._dismiss("escape"))},document.addEventListener("keydown",this._onDocKey),this._onHostKeyDown=t=>{if(t.key!=="Tab")return;const o=this._allFocusable();if(o.length===0){t.preventDefault();return}const i=o[0],n=o[o.length-1],r=this.ownerDocument?.activeElement??null;t.shiftKey&&(r===i||r===this)?(t.preventDefault(),n.focus({preventScroll:!0})):!t.shiftKey&&r===n&&(t.preventDefault(),i.focus({preventScroll:!0}))},this.addEventListener("keydown",this._onHostKeyDown),this._onHostClick=t=>{const i=t.target?.closest?.(gd);i&&this.contains(i)&&this._dismiss("close-button")},this.addEventListener("click",this._onHostClick)}_detachOpenListeners(){this._onDocKey&&(document.removeEventListener("keydown",this._onDocKey),this._onDocKey=null),this._onScopePointerDown&&(this._resolveScopeRoot().removeEventListener("pointerdown",this._onScopePointerDown),this._onScopePointerDown=null),this._onHostKeyDown&&(this.removeEventListener("keydown",this._onHostKeyDown),this._onHostKeyDown=null),this._onHostClick&&(this.removeEventListener("click",this._onHostClick),this._onHostClick=null)}_resolveScopeRoot(){const e=this.getAttribute("scope")??"window";return e==="document"?document.body:e==="parent"?this.parentElement??document.body:this.closest(".os-window__body")??this.parentElement??document.body}_firstFocusable(){return this.querySelector(Xn)??null}_allFocusable(){return Array.from(this.querySelectorAll(Xn)).filter(e=>!e.disabled)}render(){return c`<slot></slot>`}};it.props=["open","placement","scope","aria-label","aria-labelledby"],it.styles=[fd],it.help=void 0;let mo=it;$("os-flyout",mo);const bd=w` ${R}:host{display:inline-flex}button{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:4px;background:transparent;color:var( --os-ui-fg-muted,rgba( 0,0,0,0.45 ) );cursor:pointer;transition:background-color 0.15s ease,color 0.15s ease,transform 0.12s ease}:host( [ variant='detach' ] ) button:hover{color:var( --wp-admin-theme-color,#2271b1 );background:var( --os-ui-accent-soft,rgba( 34,113,177,0.12 ) );transform:translateY( -1px )}:host( [ variant='detach' ] ) button:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );background:var( --os-ui-accent-soft,rgba( 34,113,177,0.12 ) );box-shadow:var( --_holo-focus )}:host( [ variant='close' ] ) button:hover{color:var( --os-ui-fg-on-accent,#fff );background:var( --os-ui-danger,#d63638 )}:host( [ variant='close' ] ) button:focus-visible{color:var( --os-ui-fg-on-accent,#fff );background:var( --os-ui-danger,#d63638 );outline:none;box-shadow:0 0 0 2px rgba( 12,11,15,0.9 ),0 0 0 4px var( --os-ui-danger,#d63638 ),0 0 12px 2px rgba( 214,54,56,0.45 )}svg{display:block;pointer-events:none;width:12px;height:12px}@media ( prefers-reduced-motion:reduce ){button{transition-duration:0.01ms}:host( [ variant='detach' ] ) button:hover{transform:none}}`,md={detach:'<path d="M5 2H2.5v7.5H10V7M6.5 2H10v3.5M10 2L5.5 6.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',close:'<path d="M2.5 2.5l7 7M9.5 2.5l-7 7" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>'},nt=class nt extends k{render(){const e=this.variant||"",t=md[e]||"";return c` |
| 1522 |
<button type="button"> |
| 1523 |
<svg |
| 1524 |
viewBox="0 0 12 12" |
| 1525 |
aria-hidden="true" |
| 1526 |
focusable="false" |
| 1527 |
></svg> |
| 1528 |
<slot></slot> |
| 1529 |
</button> |
| 1530 |
<span data-svg-buffer style="display:none">${t}</span> |
| 1531 |
`}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg())}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("svg"),o=e.querySelector("[data-svg-buffer]");if(t&&o){const i=o.textContent||"";t.innerHTML!==i&&(t.innerHTML=i)}}};nt.props=["variant"],nt.styles=[bd],nt.help=void 0;let vo=nt;$("os-tab-chip",vo);const vd=w`:host{display:flex;flex-direction:column;gap:var( --os-ui-stack-gap,12px );align-items:var( --os-ui-stack-align,stretch );padding:var( --os-ui-stack-padding,0 )}:host( [ hidden ] ){display:none}`,rt=class rt extends k{render(){const e=this.gap,t=this.align,o=this.padding,i=e&&/^\d+$/.test(e)?`${e}px`:"";return i&&this.style.setProperty("--os-ui-stack-gap",i),t&&this.style.setProperty("--os-ui-stack-align",t),o!==null&&/^\d+$/.test(o)&&this.style.setProperty("--os-ui-stack-padding",`${o}px`),c`<slot></slot>`}};rt.props=["gap","align","padding"],rt.styles=[vd],rt.help=void 0;let _o=rt;$("os-stack",_o);const _d=w`:host{display:flex;flex-direction:row;flex-wrap:wrap;gap:var( --os-ui-cluster-gap,8px );justify-content:var( --os-ui-cluster-justify,flex-start );align-items:var( --os-ui-cluster-align,center )}:host( [ hidden ] ){display:none}`,at=class at extends k{render(){const e=this.gap,t=this.justify,o=this.align,i=e&&/^\d+$/.test(e)?`${e}px`:"";return i&&this.style.setProperty("--os-ui-cluster-gap",i),t&&this.style.setProperty("--os-ui-cluster-justify",t),o&&this.style.setProperty("--os-ui-cluster-align",o),c`<slot></slot>`}};at.props=["gap","justify","align"],at.styles=[_d],at.help=void 0;let yo=at;$("os-cluster",yo);const yd=w`:host{display:flex;flex-direction:column;gap:var( --os-ui-body-gap,12px );padding:var( --os-ui-body-padding,16px );box-sizing:border-box;width:100%;height:100%;min-width:0;min-height:0}:host( [ scroll ] ){overflow:auto}:host( [ hidden ] ){display:none}::slotted( * ){min-width:0}`,lt=class lt extends k{render(){const e=this.gap,t=this.padding;return e&&/^\d+$/.test(e)&&this.style.setProperty("--os-ui-body-gap",`${e}px`),t&&/^\d+$/.test(t)&&this.style.setProperty("--os-ui-body-padding",`${t}px`),c`<slot></slot>`}};lt.props=["gap","padding","scroll"],lt.styles=[yd],lt.help=void 0;let wo=lt;$("os-body",wo);const wd=w`:host{display:grid;grid-template-columns:repeat( 12,minmax( 0,1fr ) );gap:var( --os-ui-row-gap,12px );row-gap:var( --os-ui-row-row-gap,var( --os-ui-row-gap,12px ) );column-gap:var( --os-ui-row-column-gap,var( --os-ui-row-gap,12px ) );width:100%;min-width:0}:host( [ hidden ] ){display:none}::slotted( [ col='1' ] ){grid-column:span 1}::slotted( [ col='2' ] ){grid-column:span 2}::slotted( [ col='3' ] ){grid-column:span 3}::slotted( [ col='4' ] ){grid-column:span 4}::slotted( [ col='5' ] ){grid-column:span 5}::slotted( [ col='6' ] ){grid-column:span 6}::slotted( [ col='7' ] ){grid-column:span 7}::slotted( [ col='8' ] ){grid-column:span 8}::slotted( [ col='9' ] ){grid-column:span 9}::slotted( [ col='10' ] ){grid-column:span 10}::slotted( [ col='11' ] ){grid-column:span 11}::slotted( [ col='12' ] ){grid-column:span 12}::slotted(:not( [ col ] ) ){grid-column:1 / -1}::slotted( * ){min-width:0}`,ct=class ct extends k{render(){const e=this.gap,t=this["column-gap"],o=this["row-gap"];return e&&/^\d+$/.test(e)&&this.style.setProperty("--os-ui-row-gap",`${e}px`),t&&/^\d+$/.test(t)&&this.style.setProperty("--os-ui-row-column-gap",`${t}px`),o&&/^\d+$/.test(o)&&this.style.setProperty("--os-ui-row-row-gap",`${o}px`),c`<slot></slot>`}};ct.props=["gap","column-gap","row-gap"],ct.styles=[wd],ct.help=void 0;let xo=ct;$("os-row",xo);const xd=w`:host{display:grid;grid-template-columns:var( --os-ui-grid-columns,1fr );grid-template-rows:var( --os-ui-grid-rows,auto );gap:var( --os-ui-grid-gap,8px );column-gap:var( --os-ui-grid-column-gap,var( --os-ui-grid-gap,8px ) );row-gap:var( --os-ui-grid-row-gap,var( --os-ui-grid-gap,8px ) )}:host( [ hidden ] ){display:none}`,dt=class dt extends k{render(){const e=this.columns,t=this.rows,o=this.gap,i=this["column-gap"],n=this["row-gap"];return e&&/^\d+$/.test(e)&&this.style.setProperty("--os-ui-grid-columns",`repeat(${e}, minmax(0, 1fr))`),t&&/^\d+$/.test(t)&&this.style.setProperty("--os-ui-grid-rows",`repeat(${t}, minmax(0, 1fr))`),o&&/^\d+$/.test(o)&&this.style.setProperty("--os-ui-grid-gap",`${o}px`),i&&/^\d+$/.test(i)&&this.style.setProperty("--os-ui-grid-column-gap",`${i}px`),n&&/^\d+$/.test(n)&&this.style.setProperty("--os-ui-grid-row-gap",`${n}px`),c`<slot></slot>`}};dt.props=["columns","rows","gap","column-gap","row-gap"],dt.styles=[xd],dt.help=void 0;let ko=dt;$("os-grid",ko);const kd=w`:host{display:flex;align-items:center;justify-content:var( --os-ui-display-align,flex-end );width:100%;min-height:calc( var( --os-ui-display-size,28px ) * 1.4 );padding:8px 14px;box-sizing:border-box;font-size:var( --os-ui-display-size,28px );font-variant-numeric:tabular-nums;font-weight:500;letter-spacing:0.01em;color:var( --os-ui-display-fg,var( --os-ui-fg,#1d2327 ) );background:var( --os-ui-display-bg,transparent );border-radius:var( --os-ui-display-border-radius,0 );line-height:1.1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host( [ hidden ] ){display:none}.os-display__output{display:block;font:inherit;color:inherit;text-align:var( --os-ui-display-align,end );overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}`,Zn={sm:"16px",md:"20px",lg:"28px",xl:"40px"},ut=class ut extends k{connectedCallback(){super.connectedCallback?.(),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite"),this.hasAttribute("role")||this.setAttribute("role","status")}render(){const e=this.value,t=this.size||"lg",o=this.align||"end";return this.style.setProperty("--os-ui-display-size",Zn[t]||Zn.lg),this.style.setProperty("--os-ui-display-align",o),c` |
| 1532 |
<output part="output" class="os-display__output"> |
| 1533 |
${e??c`<slot></slot>`} |
| 1534 |
</output> |
| 1535 |
`}};ut.props=["value","size","align"],ut.styles=[kd],ut.help=void 0;let $o=ut;$("os-display",$o);const $d=w` ${R} ${qt} ${Ut} ${ds}:host{display:inline-flex;user-select:none}:host( [ fill-cell ] ),:host{display:flex;width:100%}:host( [ hidden ] ){display:none}button{width:100%;min-height:var( --os-ui-key-min-height,48px );appearance:none;display:inline-flex;align-items:center;justify-content:center;padding:var( --os-ui-key-padding,8px 12px );font:inherit;font-size:var( --os-ui-key-font-size,16px );font-weight:500;cursor:pointer;border-radius:var( --os-ui-key-border-radius,8px );background:var( --os-ui-key-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );color:var( --os-ui-key-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-key-border,1px solid transparent );transition:transform 0.08s ease,background-color 0.12s ease,box-shadow 0.12s ease}button:hover:not(:disabled ){background:var( --os-ui-key-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.1 ) ) )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}button:disabled::before{opacity:0 !important}:host( [ variant='primary' ] ) button{background:var( --os-ui-key-bg,var( --wp-admin-theme-color,#2271b1 ) );color:var( --os-ui-key-fg,var( --os-ui-fg-on-accent,#fff ) )}:host( [ variant='primary' ] ) button:hover:not(:disabled ){filter:brightness( 1.06 )}:host( [ variant='secondary' ] ) button{background:var( --os-ui-key-bg,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) )}:host( [ variant='ghost' ] ) button{background:transparent;border:var( --os-ui-key-border,1px solid var( --os-ui-border,#c3c4c7 ) )}:host( [ variant='danger' ] ) button{background:transparent;color:var( --os-ui-danger,#d63638 );border:1px solid currentColor}:host( .os-key--pressed ) button,button:active:not(:disabled ){transform:scale( 0.96 );box-shadow:inset 0 1px 2px rgba( 0,0,0,0.22 );background:var( --os-ui-key-bg-pressed,var( --os-ui-hover,rgba( 0,0,0,0.14 ) ) )}button:disabled{opacity:0.5;cursor:not-allowed}`,es="os-key--pressed",ht=class ht extends k{constructor(){super(...arguments),this._onKeyDown=null,this._onKeyUp=null,this._keyHeldByKeyboard=!1}connectedCallback(){super.connectedCallback?.(),this._onKeyDown=e=>this.handleKeyboardDown(e),this._onKeyUp=e=>this.handleKeyboardUp(e),document.addEventListener("keydown",this._onKeyDown),document.addEventListener("keyup",this._onKeyUp)}disconnectedCallback(){this._onKeyDown&&document.removeEventListener("keydown",this._onKeyDown),this._onKeyUp&&document.removeEventListener("keyup",this._onKeyUp)}render(){const e=this.label,t=this.disabled!==null;return c` |
| 1536 |
<button |
| 1537 |
part="button" |
| 1538 |
class="os-holo-sheen" |
| 1539 |
type="button" |
| 1540 |
?disabled=${t} |
| 1541 |
@click=${o=>this.handleClick(o)} |
| 1542 |
> |
| 1543 |
${e!=null&&e!==""?e:c`<slot></slot>`} |
| 1544 |
<span class="os-holo-glint" aria-hidden="true"></span> |
| 1545 |
<span class="os-holo-ring" aria-hidden="true"></span> |
| 1546 |
</button> |
| 1547 |
`}handleClick(e){if(this.isDisabled())return;const t=this.buildDetail("click");this.flashPressed(),this.hasAttribute("hold")?(this.emitKey("os-key-down",t),this.emitKey("os-key-up",t)):this.emitKey("os-key",t),e.stopPropagation()}handleKeyboardDown(e){if(this.isDisabled()||!this.matchesEvent(e)||this._keyHeldByKeyboard)return;this._keyHeldByKeyboard=!0,this.classList.add(es);const t=this.buildDetail("keyboard");this.hasAttribute("hold")?this.emitKey("os-key-down",t):this.emitKey("os-key",t)}handleKeyboardUp(e){!this._keyHeldByKeyboard||!this.matchesEvent(e,!0)||(this._keyHeldByKeyboard=!1,this.classList.remove(es),this.hasAttribute("hold")&&this.emitKey("os-key-up",this.buildDetail("keyboard")))}matchesEvent(e,t=!1){const o=this.code||"",i=this.key||"";if(o){if(e.code!==o)return!1}else if(i){if(e.key!==i)return!1}else return!1;const n=this.modifier||"",r=new Set(n.split("+").map(p=>p.trim().toLowerCase()).filter(Boolean)),a=r.has("ctrl")||r.has("control"),l=r.has("alt"),u=r.has("shift"),h=r.has("meta")||r.has("cmd")||r.has("command");return e.ctrlKey===a&&e.altKey===l&&e.shiftKey===u&&e.metaKey===h}buildDetail(e){const t=this.label||this.textContent?.trim()||"";return{key:this.key||"",code:this.code||"",label:t,source:e}}isDisabled(){return this.disabled!==null}emitKey(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}flashPressed(){this.classList.add(es),window.setTimeout(()=>{this.classList.remove(es)},120)}};ht.props=["key","code","label","variant","fill-cell","hold","modifier","disabled"],ht.styles=[$d],ht.help=void 0;let Ao=ht;$("os-key",Ao);const Ad=w`:host{display:inline}:host( [ hidden ] ){display:none}code{font-family:var( --os-ui-code-font-family,ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace );font-size:var( --os-ui-code-font-size,0.92em );padding:var( --os-ui-code-padding,0.1em 0.4em );border-radius:var( --os-ui-code-border-radius,4px );background:var( --os-ui-code-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );color:var( --os-ui-code-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-code-border,1px solid rgba( 0,0,0,0.08 ) );white-space:var( --os-ui-code-white-space,nowrap );overflow-wrap:anywhere}:host( [ block ] ){display:block}:host( [ block ] ) code{display:block;padding:var( --os-ui-code-block-padding,10px 12px );white-space:pre;overflow-x:auto}:host( [ copy ] ){position:relative}:host( [ copy ] ):not( [ block ] ){display:inline-flex;align-items:center;gap:4px}.copy{appearance:none;background:transparent;border:0;padding:0;margin:0;font:inherit;cursor:pointer;color:var( --os-ui-code-copy-color,var( --os-ui-fg-muted,#57606a ) );opacity:var( --os-ui-code-copy-opacity,0.6 );transition:opacity 120ms ease,color 120ms ease;line-height:1;font-size:0.95em}.copy:hover,.copy:focus-visible{opacity:1;color:var( --os-ui-code-copy-color-hover,var( --wp-admin-theme-color,#007cba ) )}:host( [ block ] ) .copy{position:absolute;top:6px;inset-inline-end:8px;padding:4px 6px;background:var( --os-ui-code-copy-bg,var( --os-ui-hover,rgba( 255,255,255,0.6 ) ) );border-radius:4px;opacity:0}:host( [ block ] ):hover .copy,:host( [ block ] ):focus-within .copy{opacity:1}`,pt=class pt extends k{constructor(){super(...arguments),this._copied=!1,this._resetTimer=null,this._onCopy=e=>{e.stopPropagation();const t=this._readSlotText();if(t==="")return;const o=n=>{n&&(this._copied=!0,this.requestUpdate(),this.emit("os-copy",{text:t}),this._resetTimer&&clearTimeout(this._resetTimer),this._resetTimer=setTimeout(()=>{this._copied=!1,this._resetTimer=null,this.requestUpdate()},1500))},i=navigator.clipboard;i&&typeof i.writeText=="function"?i.writeText(t).then(()=>o(!0),()=>o(this._fallbackCopy(t))):o(this._fallbackCopy(t))}}_readSlotText(){const e=this.shadowRoot?.querySelector("slot");return e?e.assignedNodes({flatten:!0}).map(i=>i.textContent??"").join("").trim():(this.textContent||"").trim()}_fallbackCopy(e){try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select();const o=document.execCommand("copy");return document.body.removeChild(t),o}catch{return!1}}render(){const e=this.getAttribute("copy")!==null;return c`<code><slot></slot></code>${e?c`<button |
| 1548 |
type="button" |
| 1549 |
class="copy" |
| 1550 |
part="copy" |
| 1551 |
aria-label="${this._copied?"Copied":"Copy code to clipboard"}" |
| 1552 |
@click=${this._onCopy} |
| 1553 |
> |
| 1554 |
${this._copied?"✓":"⧉"} |
| 1555 |
</button>`:""}`}};pt.props=["block","copy"],pt.styles=[Ad],pt.help=void 0;let Co=pt;$("os-code",Co);const Cd=w` ${R}:host{display:inline-flex;align-items:center;gap:var( --os-ui-badge-gap,6px );padding:var( --os-ui-badge-padding,2px 8px );font:var( --os-ui-badge-font,500 12px/1.4 var( --os-font,system-ui ) );color:var( --os-ui-badge-color,var( --os-ui-fg,#1d2327 ) );background:var( --os-ui-badge-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );border:var( --os-ui-badge-border,1px solid transparent );border-radius:var( --os-ui-badge-border-radius,999px );white-space:nowrap;vertical-align:baseline}:host( [ hidden ] ){display:none}.dot{width:var( --os-ui-badge-dot-size,8px );height:var( --os-ui-badge-dot-size,8px );border-radius:50%;background:currentColor;flex:0 0 auto}:host( [ tone="success" ] ){--os-ui-badge-color:var( --os-ui-badge-success,var( --os-ui-success-fg,#1a7f37 ) );--os-ui-badge-bg:var( --os-ui-badge-success-bg,rgba( 26,127,55,0.12 ) )}:host( [ tone="warning" ] ){--os-ui-badge-color:var( --os-ui-badge-warning,var( --os-ui-warning-fg,#9a6700 ) );--os-ui-badge-bg:var( --os-ui-badge-warning-bg,rgba( 154,103,0,0.12 ) )}:host( [ tone="danger" ] ){--os-ui-badge-color:var( --os-ui-badge-danger,var( --os-ui-danger,#cf222e ) );--os-ui-badge-bg:var( --os-ui-badge-danger-bg,rgba( 207,34,46,0.12 ) )}:host( [ tone="info" ] ){--os-ui-badge-color:var( --os-ui-badge-info,var( --os-ui-info-fg,#0969da ) );--os-ui-badge-bg:var( --os-ui-badge-info-bg,rgba( 9,105,218,0.12 ) )}:host( [ tone="neutral" ] ){--os-ui-badge-color:var( --os-ui-badge-neutral,var( --os-ui-fg-muted,#57606a ) );--os-ui-badge-bg:var( --os-ui-badge-neutral-bg,rgba( 87,96,106,0.12 ) )}:host( [ tone="accent" ] ){--os-ui-badge-color:var( --os-ui-badge-accent,var( --_holo-ink ) );background-color:transparent;background-image:var( --os-ui-badge-accent-bg,var( --_holo-fill ) );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;box-shadow:var( --_holo-glow );font-weight:600}:host( [ tone="accent" ] ) .dot{display:none}:host( [ no-dot ] ) .dot{display:none}`,ft=class ft extends k{render(){return c`<span class="dot" aria-hidden="true"></span><slot></slot>`}};ft.props=["tone","noDot"],ft.styles=[Cd],ft.help=void 0;let So=ft;$("os-badge",So);const Sd=w`:host{position:absolute;width:var( --os-ui-ribbon-size,90px );height:var( --os-ui-ribbon-size,90px );overflow:hidden;pointer-events:none;z-index:var( --os-ui-ribbon-z,2 )}:host( [ hidden ] ){display:none}.banner{position:absolute;display:block;width:var( --os-ui-ribbon-banner-width,140px );padding:var( --os-ui-ribbon-padding,4px 0 );text-align:center;font:var( --os-ui-ribbon-font,700 10px/1.4 var( --os-font,system-ui ) );letter-spacing:var( --os-ui-ribbon-tracking,0.06em );text-transform:uppercase;color:var( --os-ui-ribbon-fg,var( --os-ui-fg-on-accent,#fff ) );background:var( --os-ui-ribbon-bg,var( --wp-admin-theme-color,#2271b1 ) );background-size:260% 260%;background-position:30% 40%;box-shadow:var( --os-ui-ribbon-shadow,0 2px 4px rgba( 0,0,0,0.2 ) )}:host(:not( [ placement ] ) ),:host( [ placement='top-end' ] ){inset-block-start:0;inset-inline-end:0}:host(:not( [ placement ] ) ) .banner,:host( [ placement='top-end' ] ) .banner{inset-block-start:var( --os-ui-ribbon-banner-offset,20px );inset-inline-end:var( --os-ui-ribbon-banner-pull,-36px );transform:rotate( 45deg )}:host( [ placement='top-start' ] ){inset-block-start:0;inset-inline-start:0}:host( [ placement='top-start' ] ) .banner{inset-block-start:var( --os-ui-ribbon-banner-offset,20px );inset-inline-start:var( --os-ui-ribbon-banner-pull,-36px );transform:rotate( -45deg )}:host( [ placement='bottom-end' ] ){inset-block-end:0;inset-inline-end:0}:host( [ placement='bottom-end' ] ) .banner{inset-block-end:var( --os-ui-ribbon-banner-offset,20px );inset-inline-end:var( --os-ui-ribbon-banner-pull,-36px );transform:rotate( -45deg )}:host( [ placement='bottom-start' ] ){inset-block-end:0;inset-inline-start:0}:host( [ placement='bottom-start' ] ) .banner{inset-block-end:var( --os-ui-ribbon-banner-offset,20px );inset-inline-start:var( --os-ui-ribbon-banner-pull,-36px );transform:rotate( 45deg )}:host-context( [ dir='rtl' ] ):host(:not( [ placement ] ) ) .banner,:host-context( [ dir='rtl' ] ):host( [ placement='top-end' ] ) .banner{transform:rotate( -45deg )}:host-context( [ dir='rtl' ] ):host( [ placement='top-start' ] ) .banner{transform:rotate( 45deg )}:host-context( [ dir='rtl' ] ):host( [ placement='bottom-end' ] ) .banner{transform:rotate( 45deg )}:host-context( [ dir='rtl' ] ):host( [ placement='bottom-start' ] ) .banner{transform:rotate( -45deg )}:host( [ tone='success' ] ) .banner{background:var( --os-ui-ribbon-success,var( --os-ui-success-fg,#1a7f37 ) )}:host( [ tone='warning' ] ) .banner{background:var( --os-ui-ribbon-warning,var( --os-ui-warning-bg,#9a6700 ) )}:host( [ tone='danger' ] ) .banner{background:var( --os-ui-ribbon-danger,var( --os-ui-danger,#cf222e ) )}:host( [ tone='info' ] ) .banner{background:var( --os-ui-ribbon-info,var( --os-ui-info-bg,#0969da ) )}:host( [ tone='neutral' ] ) .banner{background:var( --os-ui-ribbon-neutral,var( --os-ui-surface,#57606a ) )}`,gt=class gt extends k{render(){return c`<span class="banner" part="banner"><slot></slot></span>`}};gt.props=["placement","tone"],gt.styles=[Sd],gt.help=void 0;let Eo=gt;$("os-ribbon",Eo);const Ed=w`:host{display:inline-block}`,P="os-file-tile",Yn={draft:"Draft",pending:"Pending",private:"Private",future:"Scheduled"};function Ld(){const s=window.wp?.os?.getOsSettings;if(typeof s!="function")return!0;try{return s()?.showPostStatusRibbons!==!1}catch{return!0}}function Rd(){return window.wp?.os?.dragManager??null}const Td=["type","ref","label","icon","thumbnail","kind","status","selected","selectable","missing","access-gated","drag-kind","drag-title","drag-icon"],fe=class fe extends k{constructor(){super(...arguments),this._pointerdownHandler=null,this._keydownHandler=null,this._onSettingsSave=e=>{e.detail?.phase==="saved"&&this._paint()}}connectedCallback(){super.connectedCallback(),this._keydownHandler||(this._keydownHandler=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.click())},this.addEventListener("keydown",this._keydownHandler)),document.addEventListener("os-settings-save-lifecycle",this._onSettingsSave),this._paint()}disconnectedCallback(){this._pointerdownHandler&&(this.removeEventListener("pointerdown",this._pointerdownHandler),this._pointerdownHandler=null),this._keydownHandler&&(this.removeEventListener("keydown",this._keydownHandler),this._keydownHandler=null),document.removeEventListener("os-settings-save-lifecycle",this._onSettingsSave)}requestUpdate(){this.isConnected&&this._paint()}attributeChangedCallback(e,t,o){if(t!==o){if(e==="selected"||e==="selectable"||e==="aria-selected"){this._paintSelection();return}super.attributeChangedCallback(e,t,o)}}_paintSelection(){const e=this.hasAttribute("selected"),t=this.hasAttribute("selectable");if(this.classList.toggle(`${P}--selected`,e),this.setAttribute("role",t?"option":"listitem"),t){const o=e?"true":"false";this.getAttribute("aria-selected")!==o&&this.setAttribute("aria-selected",o)}else this.removeAttribute("aria-selected")}render(){return c``}_paint(){const e=this.getAttribute("type")??"",t=this.getAttribute("ref")??"",o=this.getAttribute("label")??"",i=this.getAttribute("icon")??"",n=this.getAttribute("thumbnail")??"",r=this.getAttribute("kind")??"entry",a=this.getAttribute("status")??"",l=this.hasAttribute("selected"),u=this.hasAttribute("selectable"),h=this.hasAttribute("missing"),p=this.hasAttribute("access-gated"),m=[P,`${P}--folder`,`${P}--missing`,`${P}--access-gated`,`${P}--selected`];for(const f of m)this.classList.remove(f);this.classList.add(P),r==="folder"&&this.classList.add(`${P}--folder`),h&&this.classList.add(`${P}--missing`),p&&this.classList.add(`${P}--access-gated`),l&&this.classList.add(`${P}--selected`),this.dataset.fileType=e,this.dataset.fileRef=t,r&&(this.dataset.role=r),this.setAttribute("role",u?"option":"listitem"),u?this.setAttribute("aria-selected",l?"true":"false"):this.removeAttribute("aria-selected"),this.setAttribute("aria-label",o),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const _="You don’t have permission to open this — ask the folder owner for access.";p?(this.title=_,this.setAttribute("aria-disabled","true")):(this.removeAttribute("aria-disabled"),this.title===_&&this.removeAttribute("title"));const b=[`${P}__visual`,`${P}__label`,`${P}__lock`];for(const f of b)this.querySelectorAll(`:scope > .${f}`).forEach(g=>g.remove());this.querySelectorAll(":scope > os-ribbon").forEach(f=>f.remove());const y=document.createElement("span");if(y.className=`${P}__visual`,n){const f=document.createElement("img");f.src=n,f.alt="",f.loading="lazy",f.decoding="async",f.className=`${P}__preview`,f.draggable=!1,y.appendChild(f)}else if(i){const f=Dn(i,{title:o,className:`${P}__icon`});y.appendChild(f)}this.appendChild(y);const v=document.createElement("span");if(v.className=`${P}__label`,v.textContent=o,this.appendChild(v),p){const f=document.createElement("span");f.className=`${P}__lock dashicons dashicons-lock`,f.setAttribute("aria-hidden","true"),this.appendChild(f)}if(a&&a!=="publish"&&Yn[a]&&Ld()){const f=document.createElement("os-ribbon");f.setAttribute("placement","top-end"),f.setAttribute("tone",Pd(a)),f.textContent=Yn[a],this.appendChild(f)}Ac(this),re("os.tile.rendered",{tile:this}),this._wireDragOut()}_wireDragOut(){this._pointerdownHandler&&(this.removeEventListener("pointerdown",this._pointerdownHandler),this._pointerdownHandler=null);const e=this.getAttribute("drag-kind");if(!e)return;const t=o=>{if(o.button!==0)return;const i=Rd();if(!i)return;const n=this.getAttribute("ref")??"",r=this.getAttribute("drag-title")??this.getAttribute("label")??void 0,a=this.getAttribute("drag-icon")??this.getAttribute("icon")??void 0,l=this.getBoundingClientRect();i.start({payload:{type:"shortcut",source:this,data:{kind:e,ref:n,title:r,icon:a},ghost:{offsetX:o.clientX-l.left,offsetY:o.clientY-l.top}},origin:o})};this._pointerdownHandler=t,this.addEventListener("pointerdown",t)}};fe.shadow=!1,fe.props=Td,fe.styles=[Ed],fe.help=void 0;let Lo=fe;function Pd(s){switch(s){case"draft":return"warning";case"pending":return"info";case"private":return"danger";case"future":return"primary";default:return"primary"}}$("os-tile",Lo);const zd=w`:host{display:block;position:relative;overflow-y:auto;overflow-x:hidden;font:var( --os-ui-log-font,12px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace );color:var( --os-ui-log-fg,var( --os-ui-fg,#1d2327 ) );background:var( --os-ui-log-bg,transparent );border:var( --os-ui-log-border,1px solid rgba( 0,0,0,0.06 ) );border-radius:var( --os-ui-log-border-radius,4px );min-height:var( --os-ui-log-min-height,120px );contain:strict}:host( [ hidden ] ){display:none}.spacer{position:relative;width:100%}.window{position:absolute;left:0;right:0;top:0}.row{box-sizing:border-box;display:block;padding:var( --os-ui-log-row-padding,2px 8px );min-height:var( --os-ui-log-row-height,22px );border-bottom:var( --os-ui-log-row-border,1px solid rgba( 0,0,0,0.04 ) );white-space:var( --os-ui-log-row-white-space,pre );overflow:hidden;text-overflow:ellipsis}:host( [ auto-row-height ] ) .row{min-height:0;overflow:visible;text-overflow:clip;white-space:var( --os-ui-log-row-white-space,normal )}.empty{display:flex;align-items:center;justify-content:center;padding:16px;color:var( --os-ui-fg-muted,#57606a );font-style:italic}`;function Jn(s){const e=document.createElement("span");let t;if(typeof s=="string")t=s;else try{t=JSON.stringify(s)}catch{t=String(s)}return e.textContent=t,e}const bt=class bt extends k{constructor(){super(...arguments),this._entries=[],this._renderRow=Jn,this._stickToBottom=!0,this._heights=[],this._offsets=[],this._offsetsValid=!1,this._onScroll=()=>{const e=this.scrollHeight-this.clientHeight-this.scrollTop;this._stickToBottom=e<=4,this._paintWindow()},this._resizeObserver=null}connectedCallback(){super.connectedCallback(),this.addEventListener("scroll",this._onScroll,{passive:!0}),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._paintWindow()),this._resizeObserver.observe(this)),queueMicrotask(()=>{this._paintSpacer(),this._stickToBottom&&(this.scrollTop=this.scrollHeight),this._paintWindow()})}disconnectedCallback(){this.removeEventListener("scroll",this._onScroll),this._resizeObserver?.disconnect(),this._resizeObserver=null}get renderRow(){return this._renderRow}set renderRow(e){this._renderRow=typeof e=="function"?e:Jn,this._heights=[],this._invalidateOffsets(),this._paintSpacer(),this._paintWindow()}get entries(){return this._entries}set entries(e){this._entries=Array.isArray(e)?e.slice():[],this._heights=[],this._invalidateOffsets(),this._enforceMaxRows(),this._afterEntriesMutation()}push(e){this._entries.push(e),this._enforceMaxRows(),this._afterEntriesMutation(),this.emit("os-log-append",{entry:e,length:this._entries.length})}pushMany(e){if(!(!Array.isArray(e)||e.length===0)){for(const t of e)this._entries.push(t);this._enforceMaxRows(),this._afterEntriesMutation()}}clear(){this._entries=[],this._heights=[],this._invalidateOffsets(),this._afterEntriesMutation()}scrollToBottom(){this._stickToBottom=!0,this.scrollTop=this.scrollHeight}_enforceMaxRows(){const e=this._readMaxRows();if(e>0&&this._entries.length>e){const t=this._entries.length-e;this._entries.splice(0,t),this._heights.length>0&&this._heights.splice(0,Math.min(t,this._heights.length)),this._invalidateOffsets()}}_afterEntriesMutation(){this._paintSpacer(),this._stickToBottom&&(this.scrollTop=this.scrollHeight),this._paintWindow()}_readRowHeight(){const e=parseFloat(this.getAttribute("row-height")||"22");return Number.isFinite(e)&&e>0?e:22}_readMaxRows(){const e=parseFloat(this.getAttribute("max-rows")||"0");return Number.isFinite(e)&&e>0?Math.floor(e):0}_readOverscan(){const e=parseFloat(this.getAttribute("overscan")||"6");return Number.isFinite(e)&&e>=0?Math.floor(e):6}_isAutoHeight(){return this.getAttribute("auto-row-height")!==null}_invalidateOffsets(){this._offsetsValid=!1,this._offsets=[]}_ensureOffsets(){if(this._offsetsValid)return;const e=this._readRowHeight(),t=new Array(this._entries.length);let o=0;for(let i=0;i<this._entries.length;i++){t[i]=o;const n=this._heights[i];o+=Number.isFinite(n)&&n>0?n:e}this._offsets=t,this._totalHeight=o,this._offsetsValid=!0}_totalContentHeight(){return this._isAutoHeight()?(this._ensureOffsets(),this._totalHeight??0):this._entries.length*this._readRowHeight()}_findIndexAtOffset(e){const t=this._offsets;if(t.length===0)return 0;let o=0,i=t.length-1;for(;o<i;){const n=Math.floor((o+i+1)/2);t[n]<=e?o=n:i=n-1}return o}_paintSpacer(){const e=this.shadowRoot?.querySelector(".spacer");e&&(e.style.height=`${this._totalContentHeight()}px`)}_paintWindow(){const e=this.shadowRoot?.querySelector(".window"),t=this.shadowRoot?.querySelector(".empty");if(!e)return;if(this._entries.length===0){e.replaceChildren(),t&&(t.style.display="");return}t&&(t.style.display="none");const o=this._isAutoHeight(),i=this._readRowHeight(),n=this._readOverscan(),r=this.clientHeight,a=this.scrollTop;let l,u;if(o){this._ensureOffsets();const b=this._findIndexAtOffset(a),y=this._findIndexAtOffset(a+r);l=Math.max(0,b-n),u=Math.min(this._entries.length,y+1+n)}else l=Math.max(0,Math.floor(a/i)-n),u=Math.min(this._entries.length,Math.ceil((a+r)/i)+n);const h=document.createDocumentFragment(),p=[];for(let b=l;b<u;b++){const y=this._renderRow(this._entries[b],b);let v;y instanceof HTMLElement?v=y:(v=document.createElement("span"),v.textContent=String(y)),v.classList.add("row"),v.style.position="absolute",v.style.left="0",v.style.right="0",o?(v.style.top=`${this._offsets[b]}px`,v.style.height="auto"):(v.style.top=`${b*i}px`,v.style.height=`${i}px`),h.appendChild(v),p.push({idx:b,el:v})}if(e.replaceChildren(h),!o)return;let m=!1;const _=this._readRowHeight();for(const{idx:b,el:y}of p){const v=y.offsetHeight||_,f=this._heights[b];(!Number.isFinite(f)||Math.abs(f-v)>.5)&&(this._heights[b]=v,m=!0)}if(m){this._invalidateOffsets(),this._ensureOffsets();for(const{idx:b,el:y}of p)y.style.top=`${this._offsets[b]}px`;this._paintSpacer(),this._stickToBottom&&(this.scrollTop=this.scrollHeight)}}render(){const e=this.getAttribute("empty")||"No entries";return c` |
| 1556 |
<div class="spacer"> |
| 1557 |
<div class="window" part="window"></div> |
| 1558 |
</div> |
| 1559 |
<div class="empty" part="empty">${e}</div> |
| 1560 |
`}};bt.props=["rowHeight","maxRows","overscan","empty","autoRowHeight"],bt.styles=[zd],bt.help=void 0;let Ro=bt;$("os-log",Ro);const Id=w`:host{display:block;counter-reset:os-step}:host( [ hidden ] ){display:none}.os-steps__list{display:flex;flex-direction:column;gap:var( --os-ui-steps-gap,16px );margin:0;padding:0;list-style:none}`,Md=w`:host{display:grid;grid-template-columns:var( --os-ui-step-chip-size,28px ) 1fr;column-gap:var( --os-ui-step-gap,12px );align-items:start;counter-increment:os-step}:host( [ hidden ] ){display:none}:host::before{content:counter( os-step );display:inline-flex;align-items:center;justify-content:center;width:var( --os-ui-step-chip-size,28px );height:var( --os-ui-step-chip-size,28px );border-radius:50%;background:var( --os-ui-step-chip-bg,var( --wp-admin-theme-color,#2271b1 ) );background-size:200% 200%;background-position:30% 40%;color:var( --os-ui-step-chip-fg,var( --os-ui-fg-on-accent,#fff ) );font-size:var( --os-ui-step-chip-font-size,13px );font-weight:600;line-height:1;flex-shrink:0}:host( [ done ] )::before{content:'✓';background:var( --os-ui-step-chip-done-bg,var( --os-ui-fg-muted,#646970 ) )}.os-step__body{min-width:0}.os-step__title{margin:0 0 4px;font-size:14px;font-weight:600;color:var( --os-ui-fg,#1d2327 );line-height:1.3}.os-step__title:empty{display:none}.os-step__body::slotted( * ){margin-block:0}`,mt=class mt extends k{render(){return c`<ol class="os-steps__list"><slot></slot></ol>`}};mt.props=[],mt.styles=[Id],mt.help=void 0;let To=mt;$("os-steps",To);const vt=class vt extends k{render(){const e=this.title||"";return c` |
| 1561 |
<div class="os-step__body"> |
| 1562 |
<div class="os-step__title">${e}</div> |
| 1563 |
<slot></slot> |
| 1564 |
</div> |
| 1565 |
`}};vt.props=["title","done"],vt.styles=[Md],vt.help={title:"Step",summary:"A single numbered step inside <os-steps>. Renders an auto-numbered chip and an optional bold title above the slotted body.",status:"stable",props:[{name:"title",type:"string",description:"Optional bold title rendered above the body."},{name:"done",type:"boolean",description:"When present, the chip shows a ✓ in a muted colour instead of the number."}],slots:[{name:"(default)",description:"Step body content."}],cssProps:[{name:"--os-ui-step-gap",default:"12px"},{name:"--os-ui-step-chip-size",default:"28px"},{name:"--os-ui-step-chip-bg",default:"var(--wp-admin-theme-color)"},{name:"--os-ui-step-chip-fg",default:"#fff"},{name:"--os-ui-step-chip-done-bg",default:"var(--os-ui-fg-muted)"},{name:"--os-ui-step-chip-font-size",default:"13px"}],example:c` |
| 1566 |
<os-steps> |
| 1567 |
<os-step title="Configure">Open OpenStation Preferences → AI.</os-step> |
| 1568 |
<os-step title="Connect" done>Key confirmed.</os-step> |
| 1569 |
</os-steps> |
| 1570 |
`};let Po=vt;$("os-step",Po);const Dd=w` ${R} ${Ft}:host{display:block;--_bg:var( --os-ui-table-bg,var( --os-ui-surface,#fff ) );--_border:var( --os-ui-table-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );--_column-border:var( --os-ui-table-column-border,var( --os-ui-border-strong,rgba( 0,0,0,0.14 ) ) );--_header-bg:var( --os-ui-table-header-bg,var( --os-ui-surface-elevated,#f6f7f7 ) );--_row-hover:var( --os-ui-table-row-hover,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) );--_stripe:var( --os-ui-table-stripe,var( --os-ui-surface-subtle,rgba( 0,0,0,0.03 ) ) );--_cell-padding:var( --os-ui-table-cell-padding,8px 12px );--_font-size:var( --os-ui-table-font-size,13px );--_max-height:var( --os-ui-table-max-height,none );font-size:var( --_font-size );color:inherit}:host( [ hidden ] ){display:none}.scroll{position:relative;overflow:auto;max-height:var( --_max-height );border:1px solid var( --_border );border-radius:4px;background:var( --_bg )}table{width:100%;border-collapse:separate;border-spacing:0;background:var( --_bg )}thead th{text-align:start;font-weight:600;background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );padding:var( --_cell-padding );border-bottom:1px solid var( --_border );white-space:nowrap}tbody td{padding:var( --_cell-padding );border-bottom:1px solid var( --_border );background-color:var( --_bg );vertical-align:middle}tbody tr:last-child td{border-bottom:0}:host( [ striped ] ) tbody tr:nth-child( odd ) td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ hover ] ) tbody tr:hover td{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ hover ] [ striped ] ) tbody tr:nth-child( odd ):hover td{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) ),linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ compact ] ){--os-ui-table-cell-padding:4px 8px;--os-ui-table-font-size:12px}:host( [ bordered ] ) thead th,:host( [ bordered ] ) tbody td{border-inline-end:1px solid var( --_column-border )}:host( [ bordered ] ) thead th:last-child,:host( [ bordered ] ) tbody td:last-child{border-inline-end:0}th.is-sticky,td.is-sticky{position:sticky;z-index:10}tbody td.is-sticky{background-color:var( --_bg )}thead th.is-sticky{background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );z-index:30}:host( [ sticky-header ] ) thead th{position:sticky;top:0;z-index:20}:host( [ sticky-header ] ) thead tr.filter-row th{top:var( --os-ui-table-header-height,33px );z-index:20}:host( [ sticky-header ] ) thead th.is-sticky{z-index:40}:host( [ sticky-header ] ) thead tr.filter-row th.is-sticky{z-index:40}th.is-sticky-edge,td.is-sticky-edge{border-inline-end:var( --os-ui-table-sticky-edge,2px solid var( --_border ) )}.align-center{text-align:center}.align-end{text-align:end}.filter-row th{padding:4px 8px;background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );border-bottom:1px solid var( --_border );font-weight:400}.filter-input,.filter-select{width:100%;min-width:60px;box-sizing:border-box;padding:4px 6px;font:inherit;color:inherit;background-color:var( --_bg );border:1px solid var( --_border );border-radius:3px}.filter-input:focus,.filter-select:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}.expander{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border:0;background:transparent;color:inherit;cursor:pointer;border-radius:3px;font-size:11px;line-height:1}.expander:hover{background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) )}td.col-expander,th.col-expander{width:36px;min-width:36px;padding-left:0;padding-right:0;text-align:center}tr.subtable td{padding:0;background-color:var( --_bg );background-image:linear-gradient( var( --_stripe ),var( --_stripe ) );border-bottom:1px solid var( --_border )}tr.subtable .subtable-inner{padding:8px 12px 8px 32px}tr.empty td{padding:24px;text-align:center;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) );font-style:italic}thead th.is-sortable{cursor:pointer;user-select:none}thead th.is-sortable:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}thead th.is-sortable:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.sort-indicator{font-size:10px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) );margin-inline-start:2px}thead th.sort-asc .sort-indicator,thead th.sort-desc .sort-indicator{color:var( --wp-admin-theme-color,#2271b1 )}td.col-select,th.col-select{width:40px;min-width:40px;padding-left:0;padding-right:0;text-align:center}.select-all-checkbox,.select-row-checkbox{cursor:pointer;margin:0}tbody tr.is-selected td{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none}tbody tr.is-selected:hover td{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 16%,var( --_bg ) )}tbody tr.is-selected td:first-child{box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}tbody:dir( rtl ) tr.is-selected td:first-child{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}tbody tr.skeleton td{padding:var( --_cell-padding )}.skeleton-bar{display:block;height:12px;border-radius:3px;background:linear-gradient( 90deg,var( --os-ui-table-skeleton-color,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) ) 0%,var( --os-ui-table-skeleton-highlight,var( --os-ui-hover,rgba( 0,0,0,0.14 ) ) ) 50%,var( --os-ui-table-skeleton-color,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) ) 100% );background-size:200% 100%;animation:os-table-skeleton-pulse 1.4s ease-in-out infinite}@keyframes os-table-skeleton-pulse{0%{background-position:200% 50%}100%{background-position:-200% 50%}}@media ( prefers-reduced-motion:reduce ){.skeleton-bar{animation:none}}`,xe="__wpd_expander__",ke="__wpd_select__",_t=class _t extends k{constructor(){super(...arguments),this._data=[],this._columns=[],this._filters={},this._expanded=new Set,this._subTable=null,this._sort=null,this._selection=new Set,this._getRowId=(e,t)=>t,this._filterCache=new Map,this._paintScheduled=!1,this._stickyHeaderWarned=!1,this._stickyRaceWarned=!1,this._resizeObserver=null,this._stickyMicroScheduled=!1,this._stickyRafHandle=null,this._loadingDesyncWarned=!1,this._lastStickyIndex=-1}get data(){return this._data}set data(e){this._data=Array.isArray(e)?e.slice():[],this._expanded.clear(),this._schedulePaint()}get columns(){return this._columns}set columns(e){this._columns=Array.isArray(e)?e.slice():[];const t=new Set(this._columns.map(o=>o.key));for(const o of Object.keys(this._filters))t.has(o)||delete this._filters[o];for(const o of Array.from(this._filterCache.keys()))t.has(o)||this._filterCache.delete(o);this._sort&&!t.has(this._sort.key)&&(this._sort=null),this._schedulePaint()}get filters(){return{...this._filters}}set filters(e){this._filters=e?{...e}:{},this._schedulePaint()}get sort(){return this._sort?{...this._sort}:null}set sort(e){this._sort=e?{...e}:null,this._schedulePaint()}get selection(){return new Set(this._selection)}set selection(e){this._selection=new Set(e??[]),this._schedulePaint()}get selectedRows(){const e=[];return this._data.forEach((t,o)=>{this._selection.has(this._getRowId(t,o))&&e.push(t)}),e}get visibleRows(){return this._filteredRows().map(e=>e.row)}get getRowId(){return this._getRowId}set getRowId(e){this._getRowId=typeof e=="function"?e:(t,o)=>o,this._schedulePaint()}get subTable(){return this._subTable}set subTable(e){this._subTable=typeof e=="function"?e:null,this._expanded.clear(),this._schedulePaint()}get expanded(){return new Set(this._expanded)}set expanded(e){this._expanded=new Set(e??[]),this._schedulePaint()}expand(e){e<0||e>=this._data.length||this._expanded.has(e)||(this._expanded.add(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!0}),this._schedulePaint())}collapse(e){this._expanded.has(e)&&(this._expanded.delete(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!1}),this._schedulePaint())}expandAll(){if(!this._subTable)return;let e=!1;for(let t=0;t<this._data.length;t++)this._subTable(this._data[t],t)&&(this._expanded.has(t)||(this._expanded.add(t),e=!0));e&&this._schedulePaint()}collapseAll(){this._expanded.size!==0&&(this._expanded.clear(),this._schedulePaint())}isExpanded(e){return this._expanded.has(e)}clearFilters(){Object.keys(this._filters).length!==0&&(this._filters={},this.emit("os-table-filter-change",{filters:{}}),this._schedulePaint())}clearSort(){this._sort!==null&&(this._sort=null,this.emit("os-table-sort-change",{sort:null}),this._schedulePaint())}select(e){if(this._selection.has(e))return;const t=this._readSelectable(),o=t==="single"?Array.from(this._selection):[];t==="single"&&this._selection.clear(),this._selection.add(e),this._emitSelectionChange(),this._syncSelectionDom([e,...o])}deselect(e){this._selection.delete(e)&&(this._emitSelectionChange(),this._syncSelectionDom([e]))}selectAll(){if(this._readSelectable()==="multi"){for(const{row:e,index:t}of this._filteredRows())this._selection.add(this._getRowId(e,t));this._emitSelectionChange(),this._syncSelectionDom("all")}}clearSelection(){this._selection.size!==0&&(this._selection.clear(),this._emitSelectionChange(),this._syncSelectionDom("all"))}_syncSelectionDom(e){const t=this.shadowRoot;if(!t)return;const o=t.querySelector("tbody");if(!o)return;let i=null;if(e!=="all"){i=new Set;for(const a of e)i.add(String(a))}const n=o.querySelectorAll("tr[data-row-id]");for(const a of n){const l=a.dataset.rowId;if(l===void 0||i&&!i.has(l))continue;const u=Number(a.dataset.rowIndex);if(!Number.isFinite(u))continue;const h=this._data[u];if(h===void 0)continue;const p=this._getRowId(h,u),m=this._selection.has(p);a.classList.toggle("is-selected",m);const _=a.querySelector("input.select-row-checkbox");_&&_.checked!==m&&(_.checked=m)}const r=t.querySelector("thead .select-all-checkbox");if(r){const{total:a,selected:l}=this._visibleSelectionStats();r.checked=a>0&&l===a,r.indeterminate=l>0&&l<a}}scrollToRow(e){const t=this.shadowRoot;if(!t)return;const i=t.querySelectorAll("tbody tr:not(.subtable):not(.empty):not(.skeleton)")[e];i&&i.scrollIntoView({block:"nearest",inline:"nearest"})}connectedCallback(){super.connectedCallback(),this._schedulePaint()}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null,this._stickyRafHandle!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this._stickyRafHandle),this._stickyRafHandle=null)}recomputeLayout(){this._applyStickyOffsets(),this._measureHeaderHeight()}render(){return c` |
| 1571 |
<div class="scroll" part="scroll"> |
| 1572 |
<table part="table"> |
| 1573 |
<colgroup></colgroup> |
| 1574 |
<thead></thead> |
| 1575 |
<tbody></tbody> |
| 1576 |
</table> |
| 1577 |
</div> |
| 1578 |
`}requestUpdate(){super.requestUpdate(),this._schedulePaint()}_schedulePaint(){this._paintScheduled||!this.isConnected||(this._paintScheduled=!0,queueMicrotask(()=>{this._paintScheduled=!1,this.isConnected&&this._paint()}))}_paint(){const e=this.shadowRoot;if(!e)return;e.querySelector("tbody")||L(this.render(),e);const t=e.querySelector("colgroup"),o=e.querySelector("thead"),i=e.querySelector("tbody");if(!t||!o||!i)return;const n=this._effectiveColumns(),r=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(n,r),this._paintColgroup(t,n),this._paintHead(o,n,r),this._paintBody(i,n,r),this._applyStickyOffsets(),this._measureHeaderHeight(),this._scheduleStickyOffsets(),this._maybeWarnStickyHeader(),this._maybeWarnLoadingDesync(i),this._ensureResizeObserver()}_maybeWarnLoadingDesync(e){this._loadingDesyncWarned||this.hasAttribute("loading")&&(e.querySelector("tr.skeleton")||(this._loadingDesyncWarned=!0,console.warn("[os-table] `loading` attribute is set but no skeleton rows rendered. Either attributeChangedCallback didn't route through requestUpdate (framework regression), or `loading` was set after the most recent paint and no follow-up trigger ran. Toggling `data` will force a paint as a workaround.")))}_scheduleStickyOffsets(){this._stickyMicroScheduled||(this._stickyMicroScheduled=!0,queueMicrotask(()=>{this._stickyMicroScheduled=!1,this.isConnected&&this._applyStickyOffsets()})),this._stickyRafHandle===null&&typeof requestAnimationFrame<"u"&&(this._stickyRafHandle=requestAnimationFrame(()=>{this._stickyRafHandle=null,this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight())}))}_ensureResizeObserver(){if(this._resizeObserver||typeof ResizeObserver>"u")return;const e=this.shadowRoot?.querySelector(".scroll");e&&(this._resizeObserver=new ResizeObserver(()=>{this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight(),this._stickyHeaderWarned=!1,this._maybeWarnStickyHeader())}),this._resizeObserver.observe(e),this._resizeObserver.observe(this))}_paintColgroup(e,t){const o=[];for(const i of t){const n=document.createElement("col");i.width&&(n.style.width=i.width),o.push(n)}e.replaceChildren(...o)}_paintHead(e,t,o){const i=document.createElement("tr");i.setAttribute("part","header-row");for(let l=0;l<t.length;l++)i.appendChild(this._buildHeaderCell(t[l],l,o));const n=e.querySelector(':scope > tr[part="header-row"]');n?e.replaceChild(i,n):e.insertBefore(i,e.firstChild);const r=t.some(l=>l.filter||Array.isArray(l.filterOptions)||typeof l.filterRender=="function");let a=e.querySelector(":scope > tr.filter-row");if(r){const l=[];for(let p=0;p<t.length;p++)l.push(this._buildFilterCell(t[p],p,o));a||(a=document.createElement("tr"),a.classList.add("filter-row"),a.setAttribute("part","filter-row"),e.appendChild(a));const u=Array.from(a.children);let h=u.length===l.length;if(h){for(let p=0;p<l.length;p++)if(u[p]!==l[p]){h=!1;break}}if(!h){const p=new Set(l);for(const m of l)a.appendChild(m);for(const m of Array.from(a.children))p.has(m)||a.removeChild(m)}}else a&&a.remove()}_buildHeaderCell(e,t,o){const i=document.createElement("th");if(i.setAttribute("scope","col"),i.dataset.key=e.key,this._applyCellClasses(i,e,t,o),e.minWidth&&(i.style.minWidth=e.minWidth),e.key===ke){if(this._readSelectable()==="multi"){const r=document.createElement("input");r.type="checkbox",r.className="select-all-checkbox",r.setAttribute("data-noclick",""),r.setAttribute("aria-label","Select all rows");const{total:a,selected:l}=this._visibleSelectionStats();r.checked=a>0&&l===a,r.indeterminate=l>0&&l<a,r.addEventListener("change",()=>{r.checked?this.selectAll():this.clearSelection()}),i.appendChild(r)}return i}if(i.textContent=e.label??(e.key===xe?"":e.key),e.sortable){i.classList.add("is-sortable");const n=this._sort?.key===e.key,r=document.createElement("span");r.className="sort-indicator";let a="";n&&(a=this._sort.direction==="asc"?" ▲":" ▼"),r.textContent=a,i.appendChild(r),n&&i.classList.add(this._sort.direction==="asc"?"sort-asc":"sort-desc"),i.addEventListener("click",()=>this._cycleSort(e.key))}return i}_buildFilterCell(e,t,o){const i=this._filterCache.get(e.key),n=Array.isArray(e.filterOptions),r=typeof e.filterRender=="function";let a;if(!e.filter&&!n&&!r||e.key===xe||e.key===ke?a="none":r?a="custom":e.filter==="select"||n?a="select":a="text",i&&i.kind===a){if(i.th.className="",this._applyCellClasses(i.th,e,t,o),a==="select"){const p=i.control,m=this._resolveFilterOptions(e),_=m.map(b=>b.value).join("|");_!==i.optionsKey?(this._populateSelect(p,m,this._filters[e.key]??""),i.optionsKey=_):p.value=this._filters[e.key]??""}else if(a==="text"){const p=i.control,m=this._filters[e.key]??"";p.value!==m&&p.ownerDocument.activeElement!==p&&(p.value=m)}else a==="custom"&&e.filterRender&&e.filterRender(i.th,{value:this._filters[e.key]??"",setValue:p=>this._onFilterChange(e.key,p),col:e});return i.th}const l=document.createElement("th");if(this._applyCellClasses(l,e,t,o),a==="none")return this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"none"}),l;if(a==="custom"&&e.filterRender)return e.filterRender(l,{value:this._filters[e.key]??"",setValue:p=>this._onFilterChange(e.key,p),col:e}),this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"custom"}),l;let u,h="";if(a==="select"){const p=document.createElement("select");p.classList.add("filter-select"),p.setAttribute("data-noclick",""),p.setAttribute("aria-label",`Filter ${e.label??e.key}`);const m=this._resolveFilterOptions(e);this._populateSelect(p,m,this._filters[e.key]??""),h=m.map(_=>_.value).join("|"),p.addEventListener("change",()=>{this._onFilterChange(e.key,p.value)}),u=p}else{const p=document.createElement("input");p.type="search",p.classList.add("filter-input"),p.setAttribute("data-noclick",""),p.setAttribute("placeholder","Filter…"),p.setAttribute("aria-label",`Filter ${e.label??e.key}`),p.value=this._filters[e.key]??"",p.addEventListener("input",()=>{this._onFilterChange(e.key,p.value)}),u=p}return l.appendChild(u),this._filterCache.set(e.key,{th:l,control:u,optionsKey:h,kind:a}),l}_populateSelect(e,t,o){e.replaceChildren();const i=document.createElement("option");i.value="",i.textContent="All",e.appendChild(i);for(const n of t){const r=document.createElement("option");r.value=n.value,r.textContent=n.label,n.value===o&&(r.selected=!0),e.appendChild(r)}e.value=o}_resolveFilterOptions(e){return Array.isArray(e.filterOptions)?e.filterOptions:this._uniqueValues(e.key).map(t=>({value:t,label:t}))}_paintBody(e,t,o){if(e.replaceChildren(),this.hasAttribute("loading")){const n=this._readLoadingRows();for(let r=0;r<n;r++)e.appendChild(this._buildSkeletonRow(t,r));return}const i=this._sortedRows(this._filteredRows());if(i.length===0){e.appendChild(this._buildEmptyRow(t.length));return}for(const{row:n,index:r}of i)if(e.appendChild(this._buildBodyRow(n,r,t,o)),this._expanded.has(r)&&this._subTable){const a=this._subTable(n,r);a&&e.appendChild(this._buildSubTableRow(a,t.length))}}_buildEmptyRow(e){const t=document.createElement("tr");t.classList.add("empty");const o=document.createElement("td");o.colSpan=e;const i=document.createElement("slot");return i.name="empty",i.textContent=this.getAttribute("empty")||"No data",o.appendChild(i),t.appendChild(o),t}_buildSkeletonRow(e,t){const o=document.createElement("tr");o.classList.add("skeleton"),o.setAttribute("aria-hidden","true");for(const i of e){const n=document.createElement("td"),r=document.createElement("span");r.className="skeleton-bar";const a=50+(t*7+o.children.length*13)%40;r.style.width=`${a}%`,n.appendChild(r),o.appendChild(n)}return o}_buildBodyRow(e,t,o,i){const n=document.createElement("tr");n.setAttribute("part","row"),n.dataset.rowIndex=String(t);const r=this._getRowId(e,t);n.dataset.rowId=String(r),this._selection.has(r)&&n.classList.add("is-selected"),n.addEventListener("click",a=>{this._onRowClick(e,t,a)});for(let a=0;a<o.length;a++)n.appendChild(this._buildBodyCell(o[a],a,e,t,i));return n}_buildBodyCell(e,t,o,i,n){const r=document.createElement("td");if(this._applyCellClasses(r,e,t,n),e.minWidth&&(r.style.minWidth=e.minWidth),e.key===ke){const l=this._getRowId(o,i),u=document.createElement("input");return u.type="checkbox",u.className="select-row-checkbox",u.setAttribute("data-noclick",""),u.setAttribute("aria-label","Select row"),u.checked=this._selection.has(l),u.addEventListener("change",()=>{u.checked?this.select(l):this.deselect(l)}),r.appendChild(u),r}if(e.key===xe){if(!(this._subTable?!!this._subTable(o,i):!1))return r;const u=this._expanded.has(i),h=document.createElement("button");return h.type="button",h.className="expander",h.setAttribute("data-noclick",""),h.setAttribute("aria-expanded",u?"true":"false"),h.setAttribute("aria-label",u?"Collapse row":"Expand row"),h.textContent=u?"▾":"▸",h.addEventListener("click",p=>{this._toggleRow(i,o,p)}),r.appendChild(h),r}const a=o[e.key];if(e.render){const l=e.render(a,o,i);this._mountCellContent(r,l)}else a!=null&&(r.textContent=String(a));return r}_buildSubTableRow(e,t){const o=document.createElement("tr");o.classList.add("subtable"),o.setAttribute("part","subtable-row");const i=document.createElement("td");i.colSpan=t;const n=document.createElement("div");if(n.classList.add("subtable-inner"),e instanceof Node)n.appendChild(e);else if(Qn(e))L(e,n);else{const r=document.createElement("os-table");r.columns=e.columns,r.data=e.data,e.subTable&&(r.subTable=e.subTable),n.appendChild(r)}return i.appendChild(n),o.appendChild(i),o}_mountCellContent(e,t){if(typeof t=="string"){e.textContent=t;return}if(t instanceof Node){e.appendChild(t);return}Qn(t)&&L(t,e)}_onFilterChange(e,t){t===""?delete this._filters[e]:this._filters[e]=t,this.emit("os-table-filter-change",{filters:{...this._filters}});const i=this.shadowRoot?.querySelector("tbody");if(i){const n=this._effectiveColumns(),r=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(n,r),this._paintBody(i,n,r),this._applyStickyOffsets()}}_onRowClick(e,t,o){const i=o.composedPath?.()??[];for(const n of i){if(n instanceof Element&&n.hasAttribute("data-noclick"))return;if(n===this)break}this.emit("os-table-row-click",{row:e,index:t,originalEvent:o})}_toggleRow(e,t,o){o.stopPropagation();const i=this._expanded.has(e);i?this._expanded.delete(e):this._expanded.add(e),this.emit("os-table-expand-change",{row:t,index:e,expanded:!i}),this._schedulePaint()}_cycleSort(e){!this._sort||this._sort.key!==e?this._sort={key:e,direction:"asc"}:this._sort.direction==="asc"?this._sort={key:e,direction:"desc"}:this._sort=null,this.emit("os-table-sort-change",{sort:this._sort?{...this._sort}:null}),this._schedulePaint()}_emitSelectionChange(){this.emit("os-table-selection-change",{selection:Array.from(this._selection),rows:this.selectedRows})}_filteredRows(){const e=[],t=Object.keys(this._filters).filter(o=>this._filters[o]!=="");for(let o=0;o<this._data.length;o++){const i=this._data[o];let n=!0;for(const r of t){const a=this._columns.find(p=>p.key===r);if(a&&typeof a.filterRender=="function")continue;const l=this._filters[r]??"",u=i[r],h=u==null?"":String(u);if(a?.filter==="select"){if(h!==l){n=!1;break}}else if(!h.toLowerCase().includes(l.toLowerCase())){n=!1;break}}n&&e.push({row:i,index:o})}return e}_sortedRows(e){if(!this._sort)return e;const t=this._columns.find(n=>n.key===this._sort.key);if(!t)return e;const o=this._sort.direction==="desc"?-1:1,i=e.slice();return i.sort((n,r)=>{const a=t.sortValue?t.sortValue(n.row,n.row[t.key]):n.row[t.key],l=t.sortValue?t.sortValue(r.row,r.row[t.key]):r.row[t.key];return Nd(a,l)*o}),i}_uniqueValues(e){const t=new Set;for(const o of this._data){const i=o[e];i!=null&&t.add(String(i))}return Array.from(t).sort()}_visibleSelectionStats(){let e=0,t=0;for(const{row:o,index:i}of this._filteredRows())e++,this._selection.has(this._getRowId(o,i))&&t++;return{total:e,selected:t}}_readStickyColumns(){const e=parseInt(this.getAttribute("sticky-columns")||"0",10);return Number.isFinite(e)&&e>0?e:0}_readLoadingRows(){const e=parseInt(this.getAttribute("loading-rows")||"5",10);return Number.isFinite(e)&&e>0?Math.min(e,100):5}_readSelectable(){const e=this.getAttribute("selectable");return e==="single"?"single":e==="multi"||e===""?"multi":null}_isStickyIndex(e,t,o){return o.sticky===!1?!1:o.sticky===!0?!0:e<t}_computeLastStickyIndex(e,t){let o=-1;for(let i=0;i<e.length;i++)this._isStickyIndex(i,t,e[i])&&(o=i);return o}_applyCellClasses(e,t,o,i){t.key===xe&&e.classList.add("col-expander"),t.key===ke&&e.classList.add("col-select"),t.align==="center"&&e.classList.add("align-center"),t.align==="end"&&e.classList.add("align-end"),this._isStickyIndex(o,i,t)&&(e.classList.add("is-sticky"),o===this._lastStickyIndex&&e.classList.add("is-sticky-edge"))}_effectiveColumns(){const e=[];return this._readSelectable()&&e.push({key:ke,label:"",width:"40px",align:"center"}),this._subTable&&e.push({key:xe,label:"",width:"36px",align:"center"}),e.push(...this._columns),e}_applyStickyOffsets(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("thead tr");if(!t)return;const o=Array.from(t.children),i=[];let n=0;for(let a=0;a<o.length;a++)i[a]=n,o[a].classList.contains("is-sticky")&&(n+=o[a].offsetWidth);e.querySelectorAll("thead tr, tbody tr:not(.subtable):not(.empty):not(.skeleton)").forEach(a=>{const l=Array.from(a.children);for(let u=0;u<l.length;u++)l[u].classList.contains("is-sticky")&&(l[u].style.insetInlineStart=`${i[u]}px`)}),this._maybeWarnStickyOffsetRace(o,i)}_maybeWarnStickyOffsetRace(e,t){if(this._stickyRaceWarned)return;const o=this._readStickyColumns();if(o<2)return;const i=Math.min(o-1,e.length-1);if(i<=0||t[i]!==0||this.offsetWidth===0)return;this._stickyRaceWarned=!0;const n=e[0]?.offsetWidth??0;console.warn(`[os-table] sticky-columns: column ${i} resolved to inset-inline-start: 0px while the host is visible. ths[0].offsetWidth was ${n}px at measurement time. Likely a layout race — call recomputeLayout() after the panel finishes its mount/transition, or wrap the assignment of \`data\` in a requestAnimationFrame.`)}_measureHeaderHeight(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("thead tr");if(!t)return;const o=t.offsetHeight;o>0&&this.style.setProperty("--os-ui-table-header-height",`${o}px`)}_maybeWarnStickyHeader(){if(this._stickyHeaderWarned||!this.hasAttribute("sticky-header")||this.hasAttribute("loading")||this._data.length<8)return;const e=this.shadowRoot?.querySelector(".scroll");e&&e.offsetWidth!==0&&e.scrollHeight<=e.clientHeight+1&&(this._stickyHeaderWarned=!0,console.warn("[os-table] sticky-header is set but the table has no scroll container. Set --os-ui-table-max-height on the host (or wrap it in a scrolling parent) so the header has something to stick to."))}};_t.props=["stickyColumns","stickyHeader","striped","hover","compact","bordered","empty","loading","loadingRows","selectable"],_t.styles=[Dd],_t.help=void 0;let zo=_t;function Qn(s){return!!s&&s.__wpdHtml===!0}function Nd(s,e){if(s===e)return 0;if(s==null)return-1;if(e==null)return 1;if(typeof s=="number"&&typeof e=="number")return s-e;if(s instanceof Date&&e instanceof Date)return s.getTime()-e.getTime();const t=Number(s),o=Number(e);return Number.isFinite(t)&&Number.isFinite(o)?t-o:String(s).localeCompare(String(e))}$("os-table",zo);const Hd=w`:host{display:inline-block;--_color:var( --os-ui-spinner-color,var( --wp-admin-theme-color,#21759b ) );--_accent:var( --os-ui-spinner-accent,var( --os-ui-fg-on-accent,#fff ) );--_size:var( --os-ui-spinner-size,48px );width:var( --_size );height:var( --_size );color:var( --_color );vertical-align:middle;line-height:0}:host( [ hidden ] ){display:none}:host( [ preset='inline' ] ){--os-ui-spinner-color:currentColor;--os-ui-spinner-size:16px}.root,.root svg{display:block;width:100%;height:100%}.root svg .mark{fill:var( --_accent )}@keyframes os-spinner-spin{to{transform:rotate( 360deg )}}@keyframes os-spinner-scale{0%,100%{transform:scale( 1 )}50%{transform:scale( 1.045 )}}@keyframes os-spinner-opacity{0%,100%{opacity:1}50%{opacity:0.7}}@media ( prefers-reduced-motion:reduce ){.root svg [ style*='animation' ]{animation:none !important}}`,er=Object.freeze({classic:{sp1:12,sp2:24,sp3:40,a1:28,a2:15,a3:8,gap:4,dir2:1,dir3:-1,pulse:"none",dots:0},comet:{sp1:8,sp2:14,sp3:26,a1:50,a2:28,a3:12,gap:3,dir2:1,dir3:1,pulse:"none",dots:5},orbit:{sp1:10,sp2:10,sp3:32,a1:50,a2:50,a3:8,gap:5,dir2:-1,dir3:-1,pulse:"opacity",dots:3},pulse:{sp1:6,sp2:18,sp3:30,a1:20,a2:12,a3:6,gap:4,dir2:1,dir3:-1,pulse:"both",dots:8},inline:{sp1:8,sp2:8,sp3:8,a1:25,a2:25,a3:25,gap:0,dir2:1,dir3:1,pulse:"none",dots:0}}),q=61.26,U=61.26,tr=58.453,qd='<path d="m8.708 61.26c0 20.802 12.089 38.779 29.619 47.298l-25.069-68.686c-2.916 6.536-4.55 13.769-4.55 21.388z"/><path d="m96.74 58.608c0-6.495-2.333-10.993-4.334-14.494-2.664-4.329-5.161-7.995-5.161-12.324 0-4.831 3.664-9.328 8.825-9.328.233 0 .454.029.681.042-9.35-8.566-21.807-13.796-35.489-13.796-18.36 0-34.513 9.42-43.91 23.688 1.233.037 2.395.063 3.382.063 5.497 0 14.006-.667 14.006-.667 2.833-.167 3.167 3.994.337 4.329 0 0-2.847.335-6.015.501l19.138 56.925 11.501-34.493-8.188-22.434c-2.83-.166-5.511-.501-5.511-.501-2.832-.166-2.5-4.496.332-4.329 0 0 8.679.667 13.843.667 5.496 0 14.006-.667 14.006-.667 2.835-.167 3.168 3.994.337 4.329 0 0-2.853.335-6.015.501l18.992 56.494 5.242-17.517c2.272-7.269 4.001-12.49 4.001-16.989z"/><path d="m62.184 65.857-15.768 45.819c4.708 1.384 9.687 2.141 14.846 2.141 6.12 0 11.989-1.058 17.452-2.979-.141-.225-.269-.464-.374-.724z"/><path d="m107.376 36.046c.226 1.674.354 3.471.354 5.404 0 5.333-.996 11.328-3.996 18.824l-16.053 46.413c15.624-9.111 26.133-26.038 26.133-45.426.001-9.137-2.333-17.729-6.438-25.215z"/>',yt=class yt extends k{constructor(){super(...arguments),this._paintScheduled=!1}connectedCallback(){super.connectedCallback(),this._schedulePaint()}render(){return c`<div class="root" part="root"></div>`}requestUpdate(){super.requestUpdate(),this._schedulePaint()}_schedulePaint(){this._paintScheduled||!this.isConnected||(this._paintScheduled=!0,queueMicrotask(()=>{this._paintScheduled=!1,this.isConnected&&this._paint()}))}_paint(){this._syncCssVars();const e=this.shadowRoot?.querySelector(".root");e&&(e.innerHTML=this._buildSvg())}_syncCssVars(){const e=(t,o,i)=>{const n=this.getAttribute(t);n===null?this.style.removeProperty(o):this.style.setProperty(o,i?i(n):n)};e("color","--os-ui-spinner-color"),e("accent","--os-ui-spinner-accent"),e("size","--os-ui-spinner-size",t=>/^-?\d+(\.\d+)?$/.test(t.trim())?`${t}px`:t)}_effectiveConfig(){const e=this.getAttribute("preset")??"classic",t=er[e]??er.classic,o=(r,a)=>{const l=this.getAttribute(r);if(l===null)return a;const u=parseFloat(l);return Number.isFinite(u)?u:a},i=(r,a)=>{const l=this.getAttribute(r);if(l===null)return a;const u=l.toLowerCase();return u==="-1"||u==="ccw"||u==="reverse"?-1:1},n=()=>{const r=this.getAttribute("pulse");return r==="scale"||r==="opacity"||r==="both"||r==="none"?r:t.pulse};return{sp1:o("sp1",t.sp1),sp2:o("sp2",t.sp2),sp3:o("sp3",t.sp3),a1:o("a1",t.a1),a2:o("a2",t.a2),a3:o("a3",t.a3),gap:o("gap",t.gap),dir2:i("dir2",t.dir2),dir3:i("dir3",t.dir3),pulse:n(),dots:Math.max(0,Math.floor(o("dots",t.dots)))}}_buildInlineSvg(e){const t=sr(this.getAttribute("label")??"Loading"),o=9,i=(e.sp1/10).toFixed(2);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-label="${t}"><circle cx="12" cy="12" r="${o}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-opacity="0.22"/><circle cx="12" cy="12" r="${o}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-dasharray="${ts(o,e.a1)}" style="transform-origin:12px 12px;animation: os-spinner-spin ${i}s linear infinite"/></svg>`}_buildSvg(){const e=this._effectiveConfig();if(this.getAttribute("preset")==="inline")return this._buildInlineSvg(e);const t=sr(this.getAttribute("label")??"Loading"),o=e.gap*3+14,i=-o,n=122.52+o*2,r=tr+e.gap+2,a=r+e.gap+2,l=a+e.gap+1.5,u=`animation: os-spinner-spin ${(e.sp1/10).toFixed(2)}s linear infinite`,h=`animation: os-spinner-spin ${(e.sp2/10).toFixed(2)}s linear infinite${e.dir2<0?" reverse":""}`,p=`animation: os-spinner-spin ${(e.sp3/10).toFixed(2)}s linear infinite${e.dir3<0?" reverse":""}`,m=(e.sp1*1.8/10).toFixed(1),_=(e.sp1*2.3/10).toFixed(1);let b="";e.pulse==="scale"?b=`animation: os-spinner-scale ${m}s ease-in-out infinite`:e.pulse==="opacity"?b=`animation: os-spinner-opacity ${_}s ease-in-out infinite`:e.pulse==="both"&&(b=`animation: os-spinner-scale ${m}s ease-in-out infinite, os-spinner-opacity ${_}s ease-in-out infinite`);let y="";if(e.dots>0){const v=l+e.gap+1,f=2*Math.PI*v,g=1.6,x=(e.sp1*.65/10).toFixed(2);for(let A=0;A<e.dots;A++){const M=-(A/e.dots)*f;y+=`<circle cx="${q}" cy="${U}" r="${v.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="${g}" stroke-dasharray="${g.toFixed(2)} ${(f-g).toFixed(2)}" stroke-dashoffset="${M.toFixed(2)}" stroke-linecap="round" stroke-opacity="0.65" style="transform-origin:${q}px ${U}px;animation: os-spinner-spin ${x}s linear infinite"/>`}}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${i} ${i} ${n} ${n}" role="img" aria-label="${t}"><g style="transform-origin:${q}px ${U}px${b?";"+b:""}"><circle cx="${q}" cy="${U}" r="${tr}" fill="currentColor"/><g class="mark">${qd}</g></g><circle cx="${q}" cy="${U}" r="${r.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.6" stroke-opacity="0.2"/><circle cx="${q}" cy="${U}" r="${r.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="2.2" stroke-dasharray="${ts(r,e.a1)}" stroke-linecap="round" style="transform-origin:${q}px ${U}px;${u}"/><circle cx="${q}" cy="${U}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.5" stroke-opacity="0.15"/><circle cx="${q}" cy="${U}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.6" stroke-opacity="0.8" stroke-dasharray="${ts(a,e.a2)}" stroke-linecap="round" style="transform-origin:${q}px ${U}px;${h}"/><circle cx="${q}" cy="${U}" r="${l.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.4" stroke-opacity="0.12"/><circle cx="${q}" cy="${U}" r="${l.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.0" stroke-opacity="0.6" stroke-dasharray="${ts(l,e.a3)}" stroke-linecap="round" style="transform-origin:${q}px ${U}px;${p}"/>`+y+"</svg>"}};yt.props=["preset","size","color","accent","sp1","sp2","sp3","a1","a2","a3","gap","dir2","dir3","pulse","dots","label"],yt.styles=[Hd],yt.help=void 0;let Io=yt;function ts(s,e){const t=2*Math.PI*s,o=e/100*t,i=t-o;return`${o.toFixed(2)} ${i.toFixed(2)}`}function sr(s){return String(s).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}$("os-spinner",Io);const Ud=w`:host{display:inline;color:inherit;font:inherit}`,ss=new Set;let $e=null;const Fd=3e4;function Wd(){$e===null&&($e=window.setInterval(()=>{for(const s of ss)s.tick()},Fd))}function jd(){$e!==null&&ss.size===0&&(window.clearInterval($e),$e=null)}function Vd(s){if(!s)return null;const e=t=>{const o=new Date(t);return Number.isNaN(o.getTime())?null:o};return Od(s)?e(s):e(s.replace(" ","T")+"Z")}function Od(s){const e=Math.max(s.indexOf("T"),s.indexOf(" ")),t=e===-1?"":s.slice(e+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(t)}let Mo=null,Do=null;function or(){return typeof navigator<"u"&&navigator.language||"en"}function Kd(){return Mo||(Mo=new Intl.RelativeTimeFormat(or(),{numeric:"auto"})),Mo}function ir(){return Do||(Do=new Intl.RelativeTimeFormat(or(),{numeric:"always",style:"narrow"})),Do}function Bd(s,e){const t=Kd(),o=s.getTime()-e,i=Math.round(o/1e3),n=Math.abs;return n(i)<45?t.format(0,"second"):nr(t,i)}function nr(s,e){const t=Math.abs,o=Math.round(e/60);if(t(o)<45)return s.format(o,"minute");const i=Math.round(o/60);if(t(i)<22)return s.format(i,"hour");const n=Math.round(i/24);if(t(n)<26)return s.format(n,"day");const r=Math.round(n/30);if(t(r)<11)return s.format(r,"month");const a=Math.round(n/365);return s.format(a,"year")}function Gd(s,e){const t=Math.round((s.getTime()-e)/1e3),o=Math.abs;return o(t)<45?ir().format(0,"second"):o(t)>7*24*60*60?s.toLocaleDateString(void 0,{month:"short",day:"numeric"}):nr(ir(),t)}const wt=class wt extends k{connectedCallback(){super.connectedCallback(),ss.add(this),Wd()}disconnectedCallback(){ss.delete(this),jd()}tick(){this.requestUpdate()}render(){const e=this.datetime,t=Vd(e);if(!t)return c`<span>${e??""}</span>`;const o=Date.now(),i=this.hasAttribute("compact")?Gd(t,o):Bd(t,o),n=t.toLocaleString();return c`<time datetime=${t.toISOString()} title=${n} |
| 1579 |
>${i}</time |
| 1580 |
>`}};wt.props=["datetime","compact"],wt.styles=[Ud],wt.help=void 0;let No=wt;$("os-relative-time",No);const Xd=w`:host{display:inline-flex;position:relative;width:var( --os-ui-avatar-size,32px );height:var( --os-ui-avatar-size,32px );flex:0 0 auto;vertical-align:middle;line-height:0;perspective:calc( var( --os-ui-avatar-size,32px ) * 8 );--os-ui-avatar-tilt-x:0deg;--os-ui-avatar-tilt-y:0deg;--os-ui-avatar-hover:0;--os-ui-avatar-glare-x:50%;--os-ui-avatar-glare-y:50%}:host( [ hidden ] ){display:none}.os-avatar__tile{position:relative;width:100%;height:100%;border-radius:50%;overflow:hidden;background:var( --os-window-bg,#f0f0f1 );color:var( --os-ui-fg-on-accent,#fff );display:flex;align-items:center;justify-content:center;font-weight:700;font-size:calc( var( --os-ui-avatar-size,32px ) * 0.48 );line-height:1;letter-spacing:0;font-feature-settings:'tnum' 1;user-select:none;transform-style:preserve-3d;transform:rotateX( var( --os-ui-avatar-tilt-x ) ) rotateY( var( --os-ui-avatar-tilt-y ) ) scale( calc( 1 + var( --os-ui-avatar-hover ) * 0.07 ) );transition:transform 220ms cubic-bezier( 0.2,0.8,0.2,1 ),box-shadow 220ms cubic-bezier( 0.2,0.8,0.2,1 );box-shadow:inset 0 0 0 1px rgba( 255,255,255,calc( 0.18 + 0.22 * var( --os-ui-avatar-hover ) ) ),inset 0 0 0 calc( 1px + var( --os-ui-avatar-hover ) * 1px ) rgba( 0,0,0,calc( 0.08 + 0.04 * var( --os-ui-avatar-hover ) ) ),0 calc( 1px + var( --os-ui-avatar-hover ) * 8px ) calc( 6px + var( --os-ui-avatar-hover ) * 18px ) rgba( 0,0,0,calc( 0.08 + 0.18 * var( --os-ui-avatar-hover ) ) )}.os-avatar__tile::after{content:'';position:absolute;inset:0;border-radius:50%;background:radial-gradient( circle at var( --os-ui-avatar-glare-x ) var( --os-ui-avatar-glare-y ),var( --os-ui-scrim,rgba( 255,255,255,0.55 ) ) 0%,var( --os-ui-hover,rgba( 255,255,255,0 ) ) 55% );opacity:var( --os-ui-avatar-hover );mix-blend-mode:overlay;pointer-events:none;transition:opacity 220ms cubic-bezier( 0.2,0.8,0.2,1 )}.os-avatar__tile::before{content:'';position:absolute;inset:calc( var( --os-ui-avatar-hover ) * -3px );border-radius:50%;background:radial-gradient( circle at var( --os-ui-avatar-glare-x ) var( --os-ui-avatar-glare-y ),color-mix( in srgb,var( --os-ui-avatar-halo,rgb( 99,102,241 ) ) calc( 35% * var( --os-ui-avatar-hover ) ),transparent ) 0%,transparent 70% );filter:blur( 4px );pointer-events:none;z-index:-1;transition:inset 220ms cubic-bezier( 0.2,0.8,0.2,1 ),background 220ms}.os-avatar__tile img{width:calc( 100% + 2px );height:calc( 100% + 2px );margin:-1px;object-fit:cover;display:block;transform:translateZ( 1px )}.os-avatar__dot{position:absolute;bottom:0;inset-inline-end:0;width:calc( var( --os-ui-avatar-size,32px ) * 0.32 );height:calc( var( --os-ui-avatar-size,32px ) * 0.32 );min-width:8px;min-height:8px;border-radius:50%;box-sizing:border-box;border:2px solid var( --os-ui-avatar-dot-ring,var( --os-window-bg,#fff ) );background:var( --os-ui-avatar-dot-color,transparent );z-index:2}.os-avatar__dot--online{background:var( --os-ui-success-fg,#00a32a )}.os-avatar__dot--online::after{content:'';position:absolute;inset:-2px;border-radius:50%;border:1px solid var( --os-ui-success-fg,#00a32a );animation:os-avatar-presence 6s var( --os-ui-ease-out,cubic-bezier( 0.22,0.9,0.28,1 ) ) infinite;pointer-events:none}@keyframes os-avatar-presence{0%{opacity:0.6;transform:scale( 1 )}20%{opacity:0;transform:scale( 2.2 )}100%{opacity:0;transform:scale( 2.2 )}}.os-avatar__dot--inactive{background:var( --os-ui-warning-fg,#dba617 )}.os-avatar__dot--offline{background:var( --os-ui-fg-muted,#8c8f94 )}@media ( prefers-reduced-motion:reduce ){.os-avatar__dot--online::after{animation:none;opacity:0.6}.os-avatar__tile{transform:none;transition:box-shadow 200ms}.os-avatar__tile::after,.os-avatar__tile::before{display:none}}`,rr={xs:20,sm:24,md:40,lg:64,xl:96},ar=new Set(["online","inactive","offline"]),xt=class xt extends k{constructor(){super(...arguments),this._presenceHandler=null,this._imgFailed=!1,this._onPointerMove=null,this._onPointerEnter=null,this._onPointerLeave=null,this._tiltRaf=0,this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%"}connectedCallback(){super.connectedCallback(),this._maybeAttachPresenceListener(),this._attachHoverEffect()}disconnectedCallback(){this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null),this._detachHoverEffect()}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",o=this._attr("alt"),i=o!==null?o:t,n=this._attr("size"),r=this._resolveSize(n),a=this._presenceForRender(),l=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${r}px`);const u=e&&!this._imgFailed?"":this._initialsBg(t),h=e&&!this._imgFailed?c`<img |
| 1581 |
src=${e} |
| 1582 |
alt=${i} |
| 1583 |
@error=${()=>this._onImgError()} |
| 1584 |
loading="lazy" |
| 1585 |
/>`:this._initials(t),p=a?c`<span |
| 1586 |
class=${`os-avatar__dot os-avatar__dot--${a}`} |
| 1587 |
aria-label=${this._presenceLabel(a)} |
| 1588 |
></span>`:c``;return l?c` |
| 1589 |
<button |
| 1590 |
type="button" |
| 1591 |
class="os-avatar__tile" |
| 1592 |
aria-label=${i||"User"} |
| 1593 |
style=${u?`background:${u};`:""} |
| 1594 |
@click=${m=>this._onClick(m)} |
| 1595 |
>${h}</button> |
| 1596 |
${p} |
| 1597 |
`:c` |
| 1598 |
<div |
| 1599 |
class="os-avatar__tile" |
| 1600 |
role="img" |
| 1601 |
aria-label=${i||"User"} |
| 1602 |
style=${u?`background:${u};`:""} |
| 1603 |
>${h}</div> |
| 1604 |
${p} |
| 1605 |
`}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in rr)return rr[e];const t=Number(e);return Number.isFinite(t)&&t>0?t:32}_initials(e){const t=e.trim();return t?Array.from(t)[0]?.toUpperCase()??"?":"?"}_initialsBg(e){const t=zn(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&ar.has(e)?e:null}_presenceLabel(e){switch(e){case"online":return"Online";case"inactive":return"Inactive";case"offline":return"Offline"}}_onImgError(){this._imgFailed=!0,this.requestUpdate()}_onClick(e){const t=this._attr("user-id"),o={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",o)}_attachHoverEffect(){typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||(this._onPointerEnter=()=>{this.style.setProperty("--os-ui-avatar-hover","1")},this._onPointerLeave=()=>{this.style.setProperty("--os-ui-avatar-hover","0"),this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%",this._flushTilt()},this._onPointerMove=t=>{const o=this.getBoundingClientRect();if(o.width===0||o.height===0)return;const i=(t.clientX-o.left)/o.width-.5,n=(t.clientY-o.top)/o.height-.5,r=14;this._pendingTiltY=`${(i*r).toFixed(2)}deg`,this._pendingTiltX=`${(-n*r).toFixed(2)}deg`;const a=Math.max(0,Math.min(100,(i+.5)*100)),l=Math.max(0,Math.min(100,(n+.5)*100));this._pendingGlareX=`${a.toFixed(1)}%`,this._pendingGlareY=`${l.toFixed(1)}%`,this._tiltRaf||(this._tiltRaf=requestAnimationFrame(()=>this._flushTilt()))},this.addEventListener("pointerenter",this._onPointerEnter),this.addEventListener("pointerleave",this._onPointerLeave),this.addEventListener("pointermove",this._onPointerMove))}_flushTilt(){this._tiltRaf=0,this.style.setProperty("--os-ui-avatar-tilt-x",this._pendingTiltX),this.style.setProperty("--os-ui-avatar-tilt-y",this._pendingTiltY),this.style.setProperty("--os-ui-avatar-glare-x",this._pendingGlareX),this.style.setProperty("--os-ui-avatar-glare-y",this._pendingGlareY)}_detachHoverEffect(){this._onPointerMove&&(this.removeEventListener("pointermove",this._onPointerMove),this._onPointerMove=null),this._onPointerEnter&&(this.removeEventListener("pointerenter",this._onPointerEnter),this._onPointerEnter=null),this._onPointerLeave&&(this.removeEventListener("pointerleave",this._onPointerLeave),this._onPointerLeave=null),this._tiltRaf&&(cancelAnimationFrame(this._tiltRaf),this._tiltRaf=0)}_maybeAttachPresenceListener(){const e=this._attr("user-id"),t=this._attr("presence"),o=!!e&&!t;o&&!this._presenceHandler?(this._presenceHandler=i=>{const n=i.detail;n&&String(n.userId)===String(e)&&n.newStatus&&ar.has(n.newStatus)&&this.setAttribute("presence",n.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!o&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};xt.props=["src","alt","name","size","presence","userId","clickable"],xt.styles=[Xd],xt.help=void 0;let Ho=xt;$("os-avatar",Ho);const Zd=w` ${R} ${hs}:host{display:flex;flex-direction:column;gap:4px;font-size:13px;color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-textarea__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}textarea{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:8px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:6px;font:inherit;font-size:13px;line-height:1.45;color:var( --os-ui-fg,#1d2327 );resize:vertical}textarea:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}textarea[ aria-invalid='true' ],textarea[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}textarea[ aria-invalid='true' ]:focus,textarea[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}:host( [ auto-grow ] ) textarea{resize:none;overflow:hidden}`,kt=class kt extends k{constructor(){super(...arguments),this._textareaEl=null}connectedCallback(){super.connectedCallback(),ge(this)}render(){const e=this._attr("label")||"",t=this._attr("value")??"",o=this._attr("placeholder")||"",i=this._boolAttr("disabled"),n=this._boolAttr("readonly"),r=this._attr("aria-label")||e,a=this._attr("name")||"",l=Number(this._attr("rows"))||3,u=this._attr("maxlength"),h=this._attr("minlength"),p=this._boolAttr("invalid"),_=`${this.id||"os-unnamed"}__field`;return c` |
| 1606 |
${e?c`<label class="os-textarea__label" for=${_}>${e}</label>`:c``} |
| 1607 |
<textarea |
| 1608 |
id=${_} |
| 1609 |
part="textarea" |
| 1610 |
.value=${t} |
| 1611 |
placeholder=${o} |
| 1612 |
?disabled=${i} |
| 1613 |
?readonly=${n} |
| 1614 |
rows=${l} |
| 1615 |
maxlength=${u??""} |
| 1616 |
minlength=${h??""} |
| 1617 |
name=${a} |
| 1618 |
aria-invalid=${p?"true":"false"} |
| 1619 |
aria-label=${r||""} |
| 1620 |
@input=${b=>this._onInput(b)} |
| 1621 |
@change=${b=>this._onChange(b)} |
| 1622 |
@keydown=${b=>this._onKeyDown(b)} |
| 1623 |
></textarea> |
| 1624 |
`}_attr(e){return this.getAttribute(e)}_boolAttr(e){return this.getAttribute(e)!==null}_onInput(e){const t=e.target;this._textareaEl=t,this.setAttribute("value",t.value),this.emit("os-input-change",{value:t.value}),this._boolAttr("auto-grow")&&this._autosize(t)}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(this._boolAttr("submit-on-enter")&&e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){e.preventDefault();const t=e.target;this.emit("os-submit",{value:t.value})}}_autosize(e){const t=Number(this._attr("max-rows"))||8,o=window.getComputedStyle(e),i=parseFloat(o.fontSize)||13,n=o.lineHeight,r=n==="normal"?i*1.45:parseFloat(n)||i*1.45,a=parseFloat(o.paddingTop)||0,l=parseFloat(o.paddingBottom)||0,u=r*t+a+l;e.style.height="auto";const h=Math.min(e.scrollHeight,u);e.style.height=`${h}px`}refreshAutosize(){this._textareaEl&&this._boolAttr("auto-grow")&&this._autosize(this._textareaEl)}focusInput(){(this.shadowRoot??this).querySelector("textarea")?.focus()}clear(){this.setAttribute("value","");const t=(this.shadowRoot??this).querySelector("textarea");t&&(t.value="",this._boolAttr("auto-grow")&&this._autosize(t))}};kt.props=["label","value","placeholder","disabled","readonly","ariaLabel","name","rows","maxlength","minlength","invalid","autoGrow","maxRows","submitOnEnter"],kt.styles=[Zd],kt.help=void 0;let qo=kt;$("os-textarea",qo);const Yd=w` ${R}:host{display:inline-flex;max-width:100%;vertical-align:middle}:host( [ hidden ] ){display:none}.os-chip{display:inline-flex;align-items:center;gap:var( --os-ui-chip-gap,4px );padding:var( --os-ui-chip-padding,2px 8px );border-radius:var( --os-ui-chip-radius,999px );font-size:var( --os-ui-chip-font-size,12px );line-height:var( --os-ui-chip-line-height,1.6 );font-weight:var( --os-ui-chip-font-weight,500 );background:var( --os-ui-chip-bg,var( --os-ui-surface,#f0f0f1 ) );color:var( --os-ui-chip-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-chip-border,1px solid transparent );max-width:100%;box-sizing:border-box;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease,transform 0.12s ease,opacity 0.12s ease}:host( [ tone='accent' ] ) .os-chip{background:var( --os-ui-chip-bg,color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 14%,transparent ) );color:var( --os-ui-chip-fg,var( --wp-admin-theme-color,#2271b1 ) )}:host( [ tone='positive' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 30,132,73,0.14 ) );color:var( --os-ui-chip-fg,var( --os-ui-success-fg,#1d6f42 ) )}:host( [ tone='warning' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 217,119,6,0.18 ) );color:var( --os-ui-chip-fg,var( --os-ui-warning-fg,#8a4a06 ) )}:host( [ tone='danger' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 214,54,56,0.14 ) );color:var( --os-ui-chip-fg,var( --os-ui-danger-hover,#a02622 ) )}:host( [ pending ] ) .os-chip{opacity:0.65;animation:os-chip-pulse 1.2s ease-in-out infinite}@keyframes os-chip-pulse{0%,100%{opacity:0.55}50%{opacity:0.95}}.os-chip__label{max-width:var( --os-ui-chip-label-max,220px );overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-chip__icon{display:inline-flex;align-items:center;flex-shrink:0}.os-chip__icon::slotted( * ){display:inline-flex}.os-chip__dismiss{appearance:none;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:16px;height:16px;margin-inline-start:2px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer;opacity:0.55;transition:opacity 0.12s ease,background-color 0.12s ease}.os-chip__dismiss:hover,.os-chip__dismiss:focus-visible{opacity:1;background:var( --os-ui-hover,rgba( 0,0,0,0.12 ) );outline:none}.os-chip__dismiss:focus-visible{box-shadow:var( --_holo-focus )}.os-chip__dismiss[ disabled ]{opacity:0.35;cursor:not-allowed}.os-chip__dismiss svg{display:block;width:14px;height:14px}:host( [ disabled ] ) .os-chip{opacity:0.55;cursor:not-allowed}:host( [ size='compact' ] ) .os-chip{padding:var( --os-ui-chip-padding,1px 6px );font-size:var( --os-ui-chip-font-size,11px )}:host( [ selected ] ) .os-chip{position:relative;background:var( --os-ui-chip-bg,var( --os-ui-accent-soft,rgba( 34,113,177,0.14 ) ) );color:var( --os-ui-chip-fg,var( --os-ui-fg,#1d2327 ) )}:host( [ selected ] ) .os-chip::after{content:'';position:absolute;inset:0;border-radius:inherit;padding:1px;background-image:var( --_holo-edge );pointer-events:none;-webkit-mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );mask-composite:exclude}`,$t=class $t extends k{constructor(){super(...arguments),this._onHostKeyDown=e=>{if(this.dismissible!==null&&(e.key==="Backspace"||e.key==="Delete")){if(e.preventDefault(),this.disabled!==null)return;const i=this.label??"";this.emit("os-chip-dismiss",{label:i})}}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._onHostKeyDown)}disconnectedCallback(){this.removeEventListener("keydown",this._onHostKeyDown)}render(){const e=this.label??"",t=this.dismissible!==null,o=this.disabled!==null;return c` |
| 1625 |
<span part="chip" class="os-chip"> |
| 1626 |
<span class="os-chip__icon"> |
| 1627 |
<slot name="icon"></slot> |
| 1628 |
</span> |
| 1629 |
<span class="os-chip__label"> |
| 1630 |
${e===""?c`<slot></slot>`:e} |
| 1631 |
</span> |
| 1632 |
${t?c` |
| 1633 |
<button |
| 1634 |
part="dismiss" |
| 1635 |
class="os-chip__dismiss" |
| 1636 |
type="button" |
| 1637 |
aria-label=${`Remove ${e||"chip"}`} |
| 1638 |
?disabled=${o} |
| 1639 |
@click=${i=>this._onDismiss(i)} |
| 1640 |
> |
| 1641 |
${z("close",{size:null})} |
| 1642 |
</button> |
| 1643 |
`:c``} |
| 1644 |
</span> |
| 1645 |
`}_onDismiss(e){if(e.stopPropagation(),this.disabled!==null)return;const o=this.label??"";this.emit("os-chip-dismiss",{label:o})}};$t.props=["label","tone","size","dismissible","disabled","pending","selected"],$t.styles=[Yd],$t.help=void 0;let Uo=$t;$("os-chip",Uo);const Jd=w`:host{display:inline-flex;max-width:100%}.os-tag-input{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-tag-input-gap,4px );padding:var( --os-ui-tag-input-padding,2px );min-height:24px;max-width:100%}.os-tag-input__chips{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-tag-input-gap,4px );min-width:0}.os-tag-input__add{appearance:none;display:inline-flex;align-items:center;gap:3px;padding:1px 8px;min-height:22px;font:inherit;font-size:11px;font-weight:500;line-height:1;color:var( --os-ui-tag-input-add-fg,var( --os-ui-fg-muted,#50575e ) );background:transparent;border:1px dashed var( --os-ui-tag-input-add-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease}.os-tag-input__add:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) );color:var( --os-ui-tag-input-add-fg-hover,var( --os-ui-fg,#1d2327 ) );border-color:var( --os-ui-tag-input-add-border-hover,var( --os-ui-border-strong,#8c8f94 ) )}.os-tag-input__add:focus-visible{outline:none;border-style:solid;box-shadow:var( --os-ui-focus-ring,0 0 0 2px rgba( 12,11,15,0.9 ),0 0 0 4px #2271b1 )}.os-tag-input__add:disabled{opacity:0.5;cursor:not-allowed}.os-tag-input__add svg{display:block}.os-tag-input__editor{position:relative;display:inline-flex;align-items:center;flex:0 1 auto;min-width:120px}.os-tag-input__input{appearance:none;font:inherit;font-size:12px;line-height:1.4;padding:2px 8px;border:1px solid var( --os-ui-tag-input-input-border,var( --os-ui-border,#2271b1 ) );border-radius:999px;background:var( --os-ui-tag-input-input-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-tag-input-input-fg,var( --os-ui-fg,#1d2327 ) );min-width:80px;max-width:240px}.os-tag-input__input:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --os-ui-focus-ring-field,0 0 0 1px #2271b1,0 0 0 4px rgba( 34,113,177,0.18 ) )}.os-tag-input__suggestions{position:absolute;top:calc( 100% + 4px );left:0;min-width:220px;max-width:320px;max-height:240px;overflow-y:auto;padding:4px 0;background:var( --os-ui-tag-input-pop-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-tag-input-pop-fg,var( --os-ui-fg,#1d2327 ) );border:1px solid var( --os-ui-tag-input-pop-border,var( --os-ui-border,#c3c4c7 ) );border-radius:8px;box-shadow:0 6px 16px rgba( 0,0,0,0.08 ),0 1px 2px rgba( 0,0,0,0.06 );z-index:50}.os-tag-input__suggestion-item{display:flex;align-items:center;gap:6px;padding:6px 12px;font-size:13px;cursor:pointer;user-select:none}.os-tag-input__suggestion-item[ aria-selected='true' ]{background:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,transparent );color:var( --wp-admin-theme-color,#2271b1 )}.os-tag-input__suggestion-create{font-style:italic;color:var( --os-ui-tag-input-create-fg,var( --os-ui-fg-muted,#50575e ) );border-top:1px solid var( --os-ui-tag-input-pop-divider,var( --os-ui-border,#f0f0f1 ) )}.os-tag-input__suggestion-create[ aria-selected='true' ]{color:var( --wp-admin-theme-color,#2271b1 )}.os-tag-input__suggestion-empty,.os-tag-input__suggestion-loading{display:flex;align-items:center;gap:8px;padding:8px 12px;font-size:12px;color:var( --os-ui-tag-input-pop-muted,var( --os-ui-fg-muted,#646970 ) )}.os-tag-input__suggestion-spinner{display:inline-block;width:10px;height:10px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;animation:os-tag-input-spin 0.8s linear infinite}@keyframes os-tag-input-spin{to{transform:rotate( 360deg )}}:host( [ disabled ] ) .os-tag-input{opacity:0.6;pointer-events:none}`,At=class At extends k{constructor(){super(...arguments),this._value=[],this._suggestions=[],this._suggestionsLoading=!1,this._query="",this._highlight=-1,this._focusedChip=-1,this._onDocumentPointerDown=e=>{!this.isOpen||e.composedPath().includes(this)||this.closeInput()}}get _input(){const e=this.shadowRoot;return e?e.querySelector(".os-tag-input__input"):null}get value(){return this._value}set value(e){this._value=Array.isArray(e)?e.slice():[],this._focusedChip>=this._value.length&&(this._focusedChip=-1),this.requestUpdate()}get suggestions(){return this._suggestions}set suggestions(e){this._suggestions=Array.isArray(e)?e.slice():[],this._highlight=this._suggestions.length>0?0:-1,this._suggestionsLoading=!1,this.requestUpdate()}get suggestionsLoading(){return this._suggestionsLoading}set suggestionsLoading(e){this._suggestionsLoading=!!e,this.requestUpdate()}get query(){return this._query}get isOpen(){return this.open!==null}openInput(){this.isOpen||(this.open="",this._query="",this._highlight=-1,this.emit("os-tag-open",{}),queueMicrotask(()=>{this._input?.focus(),this._emitSuggest("")}))}closeInput(){this.isOpen&&(this.open=null,this._query="",this._suggestions=[],this._highlight=-1,this._suggestionsLoading=!1,this.emit("os-tag-close",{}),this.requestUpdate())}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocumentPointerDown,!0)}disconnectedCallback(){document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0)}render(){const e=this.isOpen,t=this.disabled!==null,o=this.readonly!==null,i=this.removable!==null||this.removable===null&&!o,n=this.creatable!==null,r=this["add-label"]||"Add",a=this.placeholder||"Add a tag…";return c` |
| 1646 |
<span |
| 1647 |
class="os-tag-input" |
| 1648 |
role="group" |
| 1649 |
aria-label=${this.label??""} |
| 1650 |
> |
| 1651 |
${this._renderChips(i,t)} |
| 1652 |
${this._renderTrailing({isOpen:e,readonly:o,disabled:t,placeholder:a,creatable:n,addLabel:r})} |
| 1653 |
</span> |
| 1654 |
`}_renderTrailing(e){return e.isOpen?this._renderEditor(e.placeholder,e.creatable):e.readonly||e.disabled?c``:this._renderTrigger(e.addLabel)}_renderChips(e,t){const o=this._value;return o.length===0?c``:c` |
| 1655 |
<span class="os-tag-input__chips" role="list"> |
| 1656 |
${o.map((i,n)=>{const r=i.tone??"neutral";return c` |
| 1657 |
<os-chip |
| 1658 |
role="listitem" |
| 1659 |
size="compact" |
| 1660 |
tone=${r} |
| 1661 |
label=${i.label} |
| 1662 |
?dismissible=${e&&!t} |
| 1663 |
?disabled=${t} |
| 1664 |
?pending=${!!i.pending} |
| 1665 |
tabindex=${n===this._focusedChip?"0":"-1"} |
| 1666 |
data-idx=${String(n)} |
| 1667 |
@os-chip-dismiss=${a=>this._onChipDismiss(a,i)} |
| 1668 |
@focus=${()=>this._focusedChip=n} |
| 1669 |
></os-chip> |
| 1670 |
`})} |
| 1671 |
</span> |
| 1672 |
`}_renderTrigger(e){const t=this.disabled!==null;return c` |
| 1673 |
<button |
| 1674 |
type="button" |
| 1675 |
class="os-tag-input__add" |
| 1676 |
aria-label=${e} |
| 1677 |
aria-haspopup="listbox" |
| 1678 |
aria-expanded="false" |
| 1679 |
?disabled=${t} |
| 1680 |
@click=${()=>this.openInput()} |
| 1681 |
> |
| 1682 |
${Qd()} |
| 1683 |
<span>${e}</span> |
| 1684 |
</button> |
| 1685 |
`}_renderEditor(e,t){const o=this._suggestions.length>0||this._suggestionsLoading||t&&this._query.trim().length>0;return c` |
| 1686 |
<span class="os-tag-input__editor"> |
| 1687 |
<input |
| 1688 |
class="os-tag-input__input" |
| 1689 |
type="text" |
| 1690 |
autocomplete="off" |
| 1691 |
autocapitalize="off" |
| 1692 |
spellcheck="false" |
| 1693 |
placeholder=${e} |
| 1694 |
.value=${this._query} |
| 1695 |
aria-autocomplete="list" |
| 1696 |
aria-expanded=${o?"true":"false"} |
| 1697 |
aria-activedescendant=${this._highlight>=0?`os-tag-suggestion-${this._highlight}`:""} |
| 1698 |
@input=${i=>this._onInput(i)} |
| 1699 |
@keydown=${i=>this._onInputKeyDown(i)} |
| 1700 |
@blur=${i=>this._onInputBlur(i)} |
| 1701 |
/> |
| 1702 |
${o?this._renderSuggestions(t):c``} |
| 1703 |
</span> |
| 1704 |
`}_renderSuggestions(e){const t=this._query.trim(),o=this._suggestions,i=e&&t.length>0&&!o.some(n=>n.label.toLowerCase()===t.toLowerCase())&&!this._value.some(n=>n.label.toLowerCase()===t.toLowerCase());return c` |
| 1705 |
<div |
| 1706 |
class="os-tag-input__suggestions" |
| 1707 |
role="listbox" |
| 1708 |
> |
| 1709 |
${this._suggestionsLoading?c` |
| 1710 |
<div class="os-tag-input__suggestion-loading"> |
| 1711 |
<span class="os-tag-input__suggestion-spinner" aria-hidden="true"></span> |
| 1712 |
<span>Searching…</span> |
| 1713 |
</div> |
| 1714 |
`:c``} |
| 1715 |
${o.length===0&&!this._suggestionsLoading&&!i?c` |
| 1716 |
<div class="os-tag-input__suggestion-empty"> |
| 1717 |
${t.length>0?"No matches.":"Type to search."} |
| 1718 |
</div> |
| 1719 |
`:c``} |
| 1720 |
${o.map((n,r)=>{const a=r===this._highlight;return c` |
| 1721 |
<div |
| 1722 |
id=${`os-tag-suggestion-${r}`} |
| 1723 |
role="option" |
| 1724 |
aria-selected=${a?"true":"false"} |
| 1725 |
class="os-tag-input__suggestion-item" |
| 1726 |
@mousedown=${l=>{l.preventDefault(),this._addSuggestion(n,!1)}} |
| 1727 |
@mouseenter=${()=>{this._highlight=r,this.requestUpdate()}} |
| 1728 |
> |
| 1729 |
<span>${n.label}</span> |
| 1730 |
</div> |
| 1731 |
`})} |
| 1732 |
${i?c` |
| 1733 |
<div |
| 1734 |
id=${`os-tag-suggestion-${o.length}`} |
| 1735 |
role="option" |
| 1736 |
aria-selected=${this._highlight===o.length?"true":"false"} |
| 1737 |
class="os-tag-input__suggestion-item os-tag-input__suggestion-create" |
| 1738 |
@mousedown=${n=>{n.preventDefault(),this._addSuggestion({label:t},!0)}} |
| 1739 |
@mouseenter=${()=>{this._highlight=o.length,this.requestUpdate()}} |
| 1740 |
> |
| 1741 |
Create "${t}" |
| 1742 |
</div> |
| 1743 |
`:c``} |
| 1744 |
</div> |
| 1745 |
`}_onChipDismiss(e,t){e.stopPropagation(),this.emit("os-tag-remove",{tag:t})}_onInput(e){const t=e.target.value;this._query=t,this._emitSuggest(t)}_emitSuggest(e){const t=parseInt(this["min-query"]||"0",10)||0;if(e.length<t){this._suggestions=[],this._suggestionsLoading=!1,this.requestUpdate();return}this._suggestionsLoading=!0,this.requestUpdate(),this.emit("os-tag-suggest",{query:e})}_onInputKeyDown(e){const t=this.creatable!==null,o=this._suggestions,i=this._query.trim(),n=t&&i.length>0&&!o.some(a=>a.label.toLowerCase()===i.toLowerCase())&&!this._value.some(a=>a.label.toLowerCase()===i.toLowerCase()),r=o.length+(n?1:0);switch(e.key){case"ArrowDown":{if(r===0)return;e.preventDefault(),this._highlight=this._highlight+1>=r?0:this._highlight+1,this.requestUpdate();return}case"ArrowUp":{if(r===0)return;e.preventDefault(),this._highlight=this._highlight<=0?r-1:this._highlight-1,this.requestUpdate();return}case"Enter":{if(e.preventDefault(),this._highlight>=0&&this._highlight<o.length){this._addSuggestion(o[this._highlight],!1);return}if(this._highlight===o.length&&n){this._addSuggestion({label:i},!0);return}if(n&&i.length>0){this._addSuggestion({label:i},!0);return}return}case"Escape":{e.preventDefault(),this.closeInput();return}case"Backspace":{if(this._query===""&&this._value.length>0){e.preventDefault();const a=this._value.length-1;this._focusedChip===a?(this.emit("os-tag-remove",{tag:this._value[a]}),this._focusedChip=-1):(this._focusedChip=a,this.requestUpdate())}return}default:this._focusedChip!==-1&&(this._focusedChip=-1)}}_onInputBlur(e){queueMicrotask(()=>{this.shadowRoot?.activeElement||this.closeInput()})}_addSuggestion(e,t){if(this._value.some(i=>i.label.toLowerCase()===e.label.toLowerCase())){this._query="",this._highlight=-1,this._suggestions=[],this.requestUpdate(),this._input?.focus();return}this.emit("os-tag-add",{tag:e,isNew:t}),this._query="",this._highlight=-1,this._suggestions=[],this._suggestionsLoading=!1,this.requestUpdate(),queueMicrotask(()=>{this._input?.focus()})}};At.props=["label","placeholder","add-label","creatable","removable","disabled","readonly","size","min-query","open"],At.styles=[Jd],At.help=void 0;let Fo=At;$("os-tag-input",Fo);function Qd(){return z("plus",{size:14})}const eu=w`:host{display:block;container-type:inline-size;container-name:os-form;font-size:13px;color:var( --os-ui-fg,#1d2327 )}:host( [ hidden ] ){display:none}.header{margin:0 0 18px}.header:empty{display:none}.fields{display:grid;grid-template-columns:1fr;gap:14px 16px;margin:0 0 18px}@container os-form ( min-width:480px ){.fields{grid-template-columns:repeat( 2,minmax( 0,1fr ) )}}@container os-form ( min-width:760px ){:host( [ columns="3" ] ) .fields{grid-template-columns:repeat( 3,minmax( 0,1fr ) )}}:host( [ columns="1" ] ) .fields{grid-template-columns:1fr}:host( [ columns="2" ] ) .fields{grid-template-columns:repeat( 2,minmax( 0,1fr ) )}::slotted( [ full-width ] ){grid-column:1 / -1}::slotted( [ slot ] ){display:contents}.error{margin:0 0 14px;padding:10px 12px;border-radius:6px;background:var( --os-ui-notice-error-bg,rgba( 179,45,46,0.10 ) );color:var( --os-ui-danger-hover,#b32d2e );font-size:13px;line-height:1.4}.error[ hidden ]{display:none}.footer{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:flex-end;border-top:1px solid var( --os-ui-border,#dcdcde );padding-top:14px}:host( [ align="start" ] ) .footer{justify-content:flex-start}:host( [ align="stretch" ] ) .footer{justify-content:stretch}:host( [ align="stretch" ] ) .footer .footer-actions{flex:1 1 auto}.footer-leading,.footer-trailing{display:contents}.footer-actions{display:inline-flex;gap:8px;align-items:center;margin-inline-start:auto}:host( [ align="start" ] ) .footer-actions{margin-inline-start:0}:host( [ busy ] ){pointer-events:none}:host( [ busy ] ) .fields{opacity:0.6}:host( [ busy ] ) .footer{pointer-events:auto}.busy-spinner{display:inline-flex;width:14px;height:14px;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:os-form-spin 0.7s linear infinite;vertical-align:-2px;margin-inline-end:6px}@keyframes os-form-spin{to{transform:rotate( 360deg )}}@media ( prefers-reduced-motion:reduce ){.busy-spinner{animation-duration:2s}}`,Ct=class Ct extends k{constructor(){super(...arguments),this._initial=new Map,this._captured=!1,this._fieldChangeListener=null,this._enterSubmitListener=null}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._captureInitialValues()),this._fieldChangeListener=e=>this._onAnyFieldInput(e),this.addEventListener("os-input-change",this._fieldChangeListener),this.addEventListener("os-input-commit",this._fieldChangeListener),this.addEventListener("os-checkbox-change",this._fieldChangeListener),this.addEventListener("os-select-change",this._fieldChangeListener),this.addEventListener("change",this._fieldChangeListener),this._enterSubmitListener=()=>this.submit(),this.addEventListener("os-submit",this._enterSubmitListener)}disconnectedCallback(){this._fieldChangeListener&&(this.removeEventListener("os-input-change",this._fieldChangeListener),this.removeEventListener("os-input-commit",this._fieldChangeListener),this.removeEventListener("os-checkbox-change",this._fieldChangeListener),this.removeEventListener("os-select-change",this._fieldChangeListener),this.removeEventListener("change",this._fieldChangeListener),this._fieldChangeListener=null),this._enterSubmitListener&&(this.removeEventListener("os-submit",this._enterSubmitListener),this._enterSubmitListener=null)}render(){const e=this["submit-label"]||"Submit",t=this["reset-label"]||"Reset",o=this.error||"",i=this.busy!==null,r=this["show-reset"]!=="false";return c` |
| 1746 |
<div class="header" part="header"> |
| 1747 |
<slot name="header"></slot> |
| 1748 |
</div> |
| 1749 |
<div class="fields" part="fields"> |
| 1750 |
<slot></slot> |
| 1751 |
</div> |
| 1752 |
<slot name="error"> |
| 1753 |
${o?c`<p class="error" role="alert" part="error">${o}</p>`:c`<p class="error" role="alert" part="error" hidden></p>`} |
| 1754 |
</slot> |
| 1755 |
<footer class="footer" part="footer"> |
| 1756 |
<span class="footer-leading" |
| 1757 |
><slot name="footer-leading"></slot |
| 1758 |
></span> |
| 1759 |
<span class="footer-actions"> |
| 1760 |
${r?c`<os-button |
| 1761 |
variant="ghost" |
| 1762 |
data-os-form-action="reset" |
| 1763 |
?disabled=${i} |
| 1764 |
@click=${()=>this.reset()} |
| 1765 |
>${t}</os-button>`:c``} |
| 1766 |
<os-button |
| 1767 |
variant="primary" |
| 1768 |
data-os-form-action="submit" |
| 1769 |
?disabled=${i} |
| 1770 |
@click=${()=>this.submit()} |
| 1771 |
> |
| 1772 |
${i?c`<span class="busy-spinner" aria-hidden="true"></span>`:c``} |
| 1773 |
${e} |
| 1774 |
</os-button> |
| 1775 |
</span> |
| 1776 |
<span class="footer-trailing" |
| 1777 |
><slot name="footer-trailing"></slot |
| 1778 |
></span> |
| 1779 |
</footer> |
| 1780 |
`}getValues(){const e={};for(const t of this._namedFields()){const o=t.getAttribute("name");o&&(e[o]=this._readField(t))}return e}setValues(e){for(const[t,o]of Object.entries(e)){const i=this._fieldByName(t);i&&this._writeField(i,o)}}setBusy(e){e?this.setAttribute("busy",""):this.removeAttribute("busy")}setError(e){e?this.setAttribute("error",e):this.removeAttribute("error")}setFieldInvalid(e,t=!0,o=null){const i=this._fieldByName(e);i&&(t?(i.setAttribute("invalid",""),o!==null&&i.setAttribute("error",o)):(i.removeAttribute("invalid"),i.removeAttribute("error")))}clearErrors(){this.setError(null);for(const e of this._namedFields())e.removeAttribute("invalid"),e.removeAttribute("error")}reset(){this.clearErrors();for(const[e,t]of this._initial.entries()){const o=this._fieldByName(e);if(o){if(t.checked!==null){o.checked=t.checked,t.checked?o.setAttribute("checked",""):o.removeAttribute("checked");continue}this._writeField(o,t.value)}}this.dispatchEvent(new CustomEvent("os-form-reset",{bubbles:!0,composed:!0,detail:{form:this}}))}submit(){const e=[];for(const i of this._namedFields()){const n=i.getAttribute("name");if(!n||!i.hasAttribute("required"))continue;const a=this._readField(i);if(a==null||a===""||Array.isArray(a)&&a.length===0){i.setAttribute("invalid","");const u=i.getAttribute("label");e.push(u||n)}}if(e.length>0){const i=e.join(", ");this.setError(`Required: ${i}`);return}const t=this.getValues(),o=new CustomEvent("os-form-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{values:t,form:this}});this.dispatchEvent(o)}_captureInitialValues(){if(this._captured)return;const e=this._namedFields();if(e.length!==0){for(const t of e){const o=t.getAttribute("name");if(!o)continue;const i=t.tagName==="OS-CHECKBOX"||t.tagName==="OS-CHECKBOX-LABEL"||t.tagName==="INPUT"&&t.type==="checkbox";this._initial.set(o,{value:this._readField(t),checked:i?!!t.checked:null})}this._captured=!0}}_namedFields(){return Array.from(this.querySelectorAll("[name]"))}_fieldByName(e){const t=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&");return this.querySelector(`[name="${t}"]`)}_readField(e){const t=e.tagName.toUpperCase();return t==="OS-CHECKBOX"||t==="OS-CHECKBOX-LABEL"||t==="INPUT"&&e.type==="checkbox"?typeof e.checked=="boolean"?e.checked:e.hasAttribute("checked"):e.value!==void 0&&e.value!==null?e.value:e.getAttribute("value")??""}_writeField(e,t){const o=e.tagName.toUpperCase();if(o==="OS-CHECKBOX"||o==="OS-CHECKBOX-LABEL"||o==="INPUT"&&e.type==="checkbox"){const r=!!t;e.checked=r,r?e.setAttribute("checked",""):e.removeAttribute("checked");return}const n=t==null?"":String(t);e.value=n,e.setAttribute("value",n)}_onAnyFieldInput(e){const t=e.target;if(!t)return;const o=t.getAttribute?.("name");o&&(this.dispatchEvent(new CustomEvent("os-form-input",{bubbles:!0,composed:!0,detail:{name:o,value:this._readField(t),form:this}})),t.hasAttribute("invalid")&&t.removeAttribute("invalid"))}};Ct.props=["submit-label","reset-label","error","busy","columns","min-column","show-reset","align"],Ct.styles=[eu],Ct.help=void 0;let Wo=Ct;$("os-form",Wo);const tu=w`:host{display:inline-flex;align-items:center;gap:6px;font-size:var( --os-ui-save-status-font-size,11px );line-height:1;color:var( --os-ui-save-status-fg,currentColor );vertical-align:middle;min-width:0;opacity:1;pointer-events:auto}.os-save-status__indicator{display:inline-flex;align-items:center;justify-content:center;width:var( --os-ui-save-status-size,12px );height:var( --os-ui-save-status-size,12px );border-radius:50%;flex-shrink:0;box-sizing:border-box;background:var( --os-ui-save-status-bg,transparent );border:2px solid var( --os-ui-save-status-idle-color,color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 55%,transparent ) );color:var( --wp-admin-theme-color,#2271b1 );transition:background-color 0.2s ease,border-color 0.2s ease,box-shadow 0.2s ease}:host( [ phase='pending' ] ) .os-save-status__indicator,:host( [ phase='saving' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-bg,var( --wp-admin-theme-color,#2271b1 ) );border-color:transparent;color:var( --wp-admin-theme-color,#2271b1 );animation:os-save-status-pulse 1.2s ease-in-out infinite}:host( [ animation='modem' ][ phase='pending' ] ) .os-save-status__indicator,:host( [ animation='modem' ][ phase='saving' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-bg,var( --wp-admin-theme-color,#2271b1 ) );border-color:transparent;color:var( --wp-admin-theme-color,#2271b1 );animation:os-save-status-modem-stutter 1.8s ease-in-out infinite,os-save-status-modem-glow 2.4s ease-in-out infinite}@keyframes os-save-status-modem-stutter{0%,4%{opacity:1}5%,30%{opacity:0.22}31%,36%{opacity:1}37%,39%{opacity:0.22}40%,44%{opacity:1}45%,67%{opacity:0.22}68%,76%{opacity:1}77%,100%{opacity:0.22}}@keyframes os-save-status-modem-glow{0%,12%{box-shadow:0 0 0 0 transparent}13%,22%{box-shadow:0 0 4px 0 currentColor}23%,50%{box-shadow:0 0 0 0 transparent}51%,58%{box-shadow:0 0 4px 0 currentColor}59%,84%{box-shadow:0 0 0 0 transparent}85%,94%{box-shadow:0 0 5px 0 currentColor}95%,100%{box-shadow:0 0 0 0 transparent}}@media ( prefers-reduced-motion:reduce ){:host( [ phase='pending' ] ) .os-save-status__indicator,:host( [ phase='saving' ] ) .os-save-status__indicator,:host( [ animation='modem' ][ phase='pending' ] ) .os-save-status__indicator,:host( [ animation='modem' ][ phase='saving' ] ) .os-save-status__indicator{animation:none;opacity:0.85}}:host( [ phase='saved' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-saved-bg,var( --os-ui-success-fg,#1d6f42 ) );border-color:transparent;color:var( --os-ui-save-status-saved-bg,var( --os-ui-success-fg,#1d6f42 ) )}:host( [ phase='failed' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) );border-color:transparent;color:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) );animation:os-save-status-pulse 0.8s ease-in-out 2}:host( [ variant='ring' ] ) .os-save-status__indicator{background:transparent}:host( [ variant='ring' ][ phase='pending' ] ) .os-save-status__indicator,:host( [ variant='ring' ][ phase='saving' ] ) .os-save-status__indicator{background:transparent;border-color:var( --os-ui-save-status-ring-color,var( --os-ui-save-status-bg,var( --wp-admin-theme-color,#2271b1 ) ) );animation:os-save-status-ring-pulse 1.6s var( --os-ui-ease-loop,ease-in-out ) infinite}:host( [ variant='ring' ][ phase='failed' ] ) .os-save-status__indicator{background:transparent;border-color:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) );animation:os-save-status-ring-alert 0.62s var( --os-ui-ease-out,ease-out ) 1}:host( [ variant='ring' ][ phase='failed' ] ) .os-save-status__glyph{color:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) )}:host( [ variant='ring' ][ phase='saved' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-saved-bg,var( --wp-admin-theme-color,#2271b1 ) );border-color:transparent;animation:os-save-status-ring-land 0.42s var( --os-ui-ease-out,ease-out ) 1}:host( [ variant='ring' ][ phase='saved' ] ) .os-save-status__glyph,:host( [ variant='ring' ][ phase='failed' ] ) .os-save-status__glyph{animation:os-save-status-glyph-in 0.24s var( --os-ui-ease-out,ease-out ) 0.08s 1 backwards}@keyframes os-save-status-ring-pulse{0%,100%{opacity:0.45;scale:0.9}50%{opacity:1;scale:1}}@keyframes os-save-status-ring-land{0%{scale:0.82}55%{scale:1.06}100%{scale:1}}@keyframes os-save-status-ring-alert{0%{scale:0.9}25%{scale:1.08}50%{scale:0.98}75%{scale:1.04}100%{scale:1}}@keyframes os-save-status-glyph-in{0%{opacity:0;scale:0.4}100%{opacity:1;scale:1}}@media ( prefers-reduced-motion:reduce ){:host( [ variant='ring' ] ) .os-save-status__indicator,:host( [ variant='ring' ] ) .os-save-status__glyph{animation:none;opacity:1;scale:1}}@keyframes os-save-status-pulse{0%,100%{opacity:0.55;transform:scale( 0.9 )}50%{opacity:1;transform:scale( 1 )}}:host( [ mode='pill' ] ) .os-save-status{display:inline-flex;align-items:center;gap:6px;padding:2px 10px;border-radius:999px;background:var( --os-ui-save-status-pill-bg,transparent );font-weight:500;white-space:nowrap}:host( [ mode='pill' ][ phase='saving' ] ) .os-save-status,:host( [ mode='pill' ][ phase='pending' ] ) .os-save-status{background:var( --os-ui-save-status-pill-bg,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) );color:var( --os-ui-save-status-pill-fg,var( --os-ui-fg-muted,#50575e ) )}:host( [ mode='pill' ][ phase='saved' ] ) .os-save-status{background:var( --os-ui-save-status-pill-bg,rgba( 30,132,73,0.12 ) );color:var( --os-ui-save-status-pill-fg,var( --os-ui-success-fg,#1d6f42 ) )}:host( [ mode='pill' ][ phase='failed' ] ) .os-save-status{background:var( --os-ui-save-status-pill-bg,rgba( 214,54,56,0.12 ) );color:var( --os-ui-save-status-pill-fg,var( --os-ui-danger-hover,#a02622 ) )}.os-save-status__label{min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host( [ phase='saved' ] ) .os-save-status__glyph,:host( [ phase='failed' ] ) .os-save-status__glyph{display:inline-block;color:var( --os-ui-fg-on-accent,#fff );width:calc( var( --os-ui-save-status-size,12px ) * 0.66 );height:calc( var( --os-ui-save-status-size,12px ) * 0.66 )}.os-save-status__glyph{display:none}.os-save-status__glyph svg{display:block;width:100%;height:100%}`,lr="os-settings-save-lifecycle",su=2200,ou=6e3,St=class St extends k{constructor(){super(...arguments),this._autoTimer=null,this._docListener=null}connectedCallback(){super.connectedCallback(),this.auto!==null&&this._installAutoListener()}disconnectedCallback(){this._removeAutoListener(),this._autoTimer!==null&&(window.clearTimeout(this._autoTimer),this._autoTimer=null)}attributeChangedCallback(e,t,o){if(super.attributeChangedCallback(e,t,o),(e==="auto"||e==="event")&&(this._removeAutoListener(),this.auto!==null&&this._installAutoListener()),e==="phase"){this._scheduleAutoClear();const i={phase:this.phase??"idle",error:this.error??void 0};this.emit("os-save-status-change",i)}}render(){const e=this.phase??"idle",t=this.mode??"dot",i=(this.error??"")||this._labelForPhase(e);return i?this.setAttribute("title",i):this.removeAttribute("title"),this.setAttribute("aria-live",e==="failed"?"assertive":"polite"),this.setAttribute("role",e==="failed"?"alert":"status"),c` |
| 1781 |
<span class="os-save-status"> |
| 1782 |
<span class="os-save-status__indicator" aria-hidden="true"> |
| 1783 |
<span class="os-save-status__glyph">${this._renderGlyph(e)}</span> |
| 1784 |
</span> |
| 1785 |
${t==="pill"?c`<span class="os-save-status__label" |
| 1786 |
>${this._labelForPhase(e)}</span |
| 1787 |
>`:c``} |
| 1788 |
</span> |
| 1789 |
`}_renderGlyph(e){return e==="saved"?iu():e==="failed"?nu():""}_labelForPhase(e){switch(e){case"pending":case"saving":return this["saving-label"]??"Saving…";case"saved":return this["saved-label"]??"Saved";case"failed":return(this.error??"")||"Couldn’t save";default:return this["idle-label"]??""}}_installAutoListener(){const e=this.event||lr;this._docListener=t=>{const o=t.detail;!o||typeof o.phase!="string"||(this.phase=o.phase,o.error?this.error=o.error:o.phase!=="failed"&&this.error&&this.removeAttribute("error"))},document.addEventListener(e,this._docListener)}_removeAutoListener(){if(!this._docListener)return;const e=this.event||lr;document.removeEventListener(e,this._docListener),this._docListener=null}_scheduleAutoClear(){this._autoTimer!==null&&(window.clearTimeout(this._autoTimer),this._autoTimer=null);const e=this.phase??"idle",t=this._autoClearMsFor(e);t<=0||(this._autoTimer=window.setTimeout(()=>{this._autoTimer=null,this.phase="idle"},t))}_autoClearMsFor(e){if(e==="saved"){const t=this["auto-clear-saved-ms"];return parseInt(t||"",10)||su}if(e==="failed"){const t=this["auto-clear-failed-ms"];return parseInt(t||"",10)||ou}return 0}};St.props=["phase","mode","variant","animation","auto","event","error","saving-label","saved-label","idle-label","auto-clear-saved-ms","auto-clear-failed-ms"],St.styles=[tu],St.help=void 0;let jo=St;$("os-save-status",jo);function iu(){return c` |
| 1790 |
<svg |
| 1791 |
viewBox="0 0 12 12" |
| 1792 |
aria-hidden="true" |
| 1793 |
focusable="false" |
| 1794 |
fill="none" |
| 1795 |
stroke="currentColor" |
| 1796 |
stroke-width="2" |
| 1797 |
stroke-linecap="round" |
| 1798 |
stroke-linejoin="round" |
| 1799 |
> |
| 1800 |
<path d="M2.5 6 L5 8.5 L9.5 4" /> |
| 1801 |
</svg> |
| 1802 |
`}function nu(){return c` |
| 1803 |
<svg |
| 1804 |
viewBox="0 0 12 12" |
| 1805 |
aria-hidden="true" |
| 1806 |
focusable="false" |
| 1807 |
fill="currentColor" |
| 1808 |
> |
| 1809 |
<path |
| 1810 |
d="M5 2 H7 V7 H5 z M5 8.5 H7 V10.5 H5 z" |
| 1811 |
/> |
| 1812 |
</svg> |
| 1813 |
`}const ru=w`:host{display:flex;width:100%;min-width:0;max-width:100%;align-items:stretch}.os-cat{display:flex;flex-direction:column;align-items:stretch;gap:4px;padding:var( --os-ui-cat-padding,2px );min-height:24px;max-width:100%;width:100%}.os-cat__chips{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-cat-gap,4px );min-width:0}.os-cat__chains{display:flex;flex-wrap:wrap;gap:4px;min-width:0}.os-cat__viz-host{display:flex;align-items:center;gap:4px;min-width:0;flex:1 1 auto;max-width:100%;min-height:28px;cursor:pointer;position:relative}.os-cat__viz-svg{display:block;width:100%;max-width:100%;min-width:0;overflow:visible;flex:1 1 auto}.os-cat__viz-svg .os-cat-edge{fill:none;stroke:var( --os-ui-cat-edge-color,currentColor );stroke-width:1.25;stroke-linecap:round;opacity:0.55;transition:stroke-width 0.18s ease,opacity 0.18s ease}.os-cat__viz-svg .os-cat-edge[ data-active='true' ]{stroke-width:2;opacity:1}.os-cat__viz-svg .os-cat-node{cursor:pointer;transition:r 0.2s cubic-bezier( 0.34,1.56,0.64,1 ),fill 0.18s ease,stroke-width 0.18s ease,filter 0.18s ease}.os-cat__viz-svg .os-cat-node[ data-selected='true' ]{filter:drop-shadow( 0 0 6px var( --os-ui-cat-node-glow,rgba( 0,0,0,0.18 ) ) )}.os-cat__viz-svg .os-cat-node:hover,.os-cat__viz-svg .os-cat-node:focus-visible{filter:drop-shadow( 0 0 8px var( --os-ui-cat-node-glow,rgba( 0,0,0,0.3 ) ) );outline:none}.os-cat__viz-svg .os-cat-label{font-family:var( --os-ui-font,system-ui,sans-serif );font-size:10.5px;fill:var( --os-ui-cat-label-fg,var( --os-ui-fg,#1d2327 ) );font-weight:500;pointer-events:none;user-select:none}.os-cat__viz-svg .os-cat-label[ data-selected='false' ]{fill:var( --os-ui-cat-label-muted,var( --os-ui-fg-muted,#8c8f94 ) );font-weight:400;font-style:italic}.os-cat__trigger{appearance:none;display:inline-flex;align-items:center;gap:4px;padding:1px 8px;min-height:22px;font:inherit;font-size:11px;font-weight:500;line-height:1;color:var( --os-ui-cat-trigger-fg,var( --os-ui-fg-muted,#50575e ) );background:transparent;border:1px dashed var( --os-ui-cat-trigger-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease}.os-cat__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) );color:var( --os-ui-cat-trigger-fg-hover,var( --os-ui-fg,#1d2327 ) );border-color:var( --os-ui-cat-trigger-border-hover,var( --os-ui-border-strong,#8c8f94 ) )}.os-cat__trigger:focus-visible{outline:none;border-style:solid;box-shadow:0 0 0 2px var( --wp-admin-theme-color,#2271b1 )}.os-cat__trigger svg{display:block}.os-cat__uncategorized{display:inline-flex;align-items:center;gap:4px;padding:1px 10px;min-height:22px;font-size:11px;font-weight:500;line-height:1.6;color:var( --os-ui-cat-uncat-fg,var( --os-ui-fg-muted,#8c8f94 ) );background:transparent;border:1px dashed var( --os-ui-cat-uncat-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;font-style:italic}.os-cat__popover{position:fixed;top:0;left:0;min-width:280px;max-width:360px;max-height:360px;display:flex;flex-direction:column;background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-cat-pop-fg,var( --os-ui-fg,#1d2327 ) );border:1px solid var( --os-ui-cat-pop-border,var( --os-ui-border,#c3c4c7 ) );border-radius:8px;box-shadow:0 6px 16px rgba( 0,0,0,0.08 ),0 1px 2px rgba( 0,0,0,0.06 );z-index:1000}.os-cat__editor{position:relative;display:inline-flex;align-items:center}.os-cat__search{appearance:none;font:inherit;font-size:13px;padding:8px 12px;border:0;border-bottom:1px solid var( --os-ui-cat-pop-divider,var( --os-ui-border,#f0f0f1 ) );background:transparent;color:inherit;outline:none}.os-cat__search:focus{border-bottom-color:var( --wp-admin-theme-color,#2271b1 )}.os-cat__tree{flex:1 1 auto;min-height:0;overflow-y:auto;padding:4px 0}.os-cat__row-block{display:contents}.os-cat__row{display:flex;align-items:center;gap:6px;padding:4px 8px 4px var( --os-ui-cat-row-indent,12px );cursor:pointer;user-select:none;font-size:13px;line-height:1.4;position:relative}.os-cat__row:hover,.os-cat__row[ data-focused='true' ]{background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) )}.os-cat__row[ data-selected='true' ]{color:var( --wp-admin-theme-color,#2271b1 );font-weight:600}.os-cat__row::before{content:'';position:absolute;left:0;top:0;bottom:0;width:var( --os-ui-cat-guide-width,0px );border-left:1px dotted var( --os-ui-cat-guide-color,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) )}.os-cat__expander{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;border:0;background:transparent;color:inherit;cursor:pointer;flex-shrink:0;opacity:0.65}.os-cat__expander:hover{opacity:1}.os-cat__expander svg{display:block;transition:transform 0.12s ease}.os-cat__row[ data-expanded='true' ] .os-cat__expander svg{transform:rotate( 90deg )}.os-cat__expander--placeholder{visibility:hidden}.os-cat__create-row{display:flex;align-items:center;padding:2px 8px 2px var( --os-ui-cat-row-indent,28px );position:relative}.os-cat__create-row::before{content:'';position:absolute;left:0;top:0;bottom:0;width:var( --os-ui-cat-guide-width,0px );border-left:1px dotted var( --os-ui-cat-guide-color,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) )}.os-cat__create-wrap{display:inline-flex;align-items:center;flex:1 1 auto;min-width:0;gap:4px;padding:1px 1px 1px 0;border:1px solid transparent;border-radius:6px;background:transparent;transition:border-color 0.12s ease,background-color 0.12s ease,box-shadow 0.12s ease}.os-cat__create-wrap:hover{border-color:var( --os-ui-border,rgba( 0,0,0,0.12 ) );background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) )}.os-cat__create-wrap:focus-within{border-color:var( --wp-admin-theme-color,#2271b1 );background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) );box-shadow:0 0 0 2px color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 15%,transparent )}.os-cat__create-input{flex:1 1 auto;min-width:0;appearance:none;font:inherit;font-size:12px;padding:3px 6px;border:0;background:transparent;color:inherit;outline:none}.os-cat__create-input::placeholder{color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#8c8f94 ) );font-style:italic;opacity:1}.os-cat__create-submit{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex-shrink:0;padding:0;border:0;border-radius:4px;background:transparent;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#8c8f94 ) );cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease}.os-cat__create-wrap:focus-within .os-cat__create-submit:not( [ disabled ] ){background:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.os-cat__create-submit:hover:not( [ disabled ] ){filter:brightness( 1.05 )}.os-cat__create-submit[ disabled ]{cursor:default;opacity:0.5}.os-cat__create-submit svg{display:block}.os-cat__create-spinner{display:inline-block;width:12px;height:12px;margin:0 4px;border-radius:50%;border:2px solid var( --wp-admin-theme-color,#2271b1 );border-top-color:transparent;animation:os-cat-spin 0.8s linear infinite;flex-shrink:0}.os-cat__check{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;border:1.5px solid var( --os-ui-cat-check-border,var( --os-ui-border,#8c8f94 ) );border-radius:3px;color:transparent;transition:background-color 0.12s ease,border-color 0.12s ease,color 0.12s ease}.os-cat__row[ data-selected='true' ] .os-cat__check{background:var( --wp-admin-theme-color,#2271b1 );border-color:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.os-cat__check svg{display:block;width:14px;height:14px}.os-cat__label{min-width:0;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-cat__delete{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:18px;height:18px;border:0;border-radius:50%;padding:0;background:transparent;color:var( --os-ui-cat-delete-color,var( --os-ui-danger,#d63638 ) );cursor:pointer;opacity:0;transition:opacity 0.12s ease,background-color 0.12s ease}.os-cat__row:hover .os-cat__delete,.os-cat__row[ data-focused='true' ] .os-cat__delete,.os-cat__delete:focus-visible{opacity:1}.os-cat__delete:hover,.os-cat__delete:focus-visible{background:var( --os-ui-badge-danger-bg,rgba( 214,54,56,0.12 ) )}.os-cat__delete svg{display:block;width:14px;height:14px}.os-cat__match{background:var( --os-ui-search-highlight-bg,rgba( 252,211,77,0.45 ) );border-radius:2px;padding:0 1px}.os-cat__empty,.os-cat__loading{padding:12px;font-size:12px;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#646970 ) );text-align:center}.os-cat__loading-spinner{display:inline-block;width:12px;height:12px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;animation:os-cat-spin 0.8s linear infinite;margin-inline-end:8px;vertical-align:middle}@keyframes os-cat-spin{to{transform:rotate( 360deg )}}.os-cat__footer{padding:8px 12px;font-size:11px;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#646970 ) );border-top:1px solid var( --os-ui-cat-pop-divider,var( --os-ui-border,#f0f0f1 ) );border-radius:10px;background:var( --os-ui-cat-pop-footer-bg,var( --os-ui-surface,#fafafb ) );display:flex;align-items:center;gap:6px;line-height:1.4}.os-cat__footer .dashicons{font-size:14px;width:14px;height:14px;flex-shrink:0}:host( [ disabled ] ) .os-cat{opacity:0.6;pointer-events:none}`,G="10px",au=w`:host{display:inline-flex;max-width:100%;align-items:center;min-width:0;font-family:var( --os-ui-font,system-ui,sans-serif );font-size:12px;line-height:1;font-weight:500}.os-crumb-chain{display:inline-flex;flex-wrap:nowrap;align-items:stretch;max-width:100%;min-width:0;min-height:22px;border-radius:999px;overflow:hidden;filter:drop-shadow( 0 1px 1px rgba( 0,0,0,0.06 ) )}.os-crumb{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:22px;padding:2px 12px;background:var( --os-ui-crumb-bg,var( --os-ui-surface,#c3c4c7 ) );color:var( --os-ui-crumb-fg,var( --os-ui-fg,#1d2327 ) );text-align:center;min-width:0;max-width:100%;flex-shrink:1;font-size:12px;font-weight:500;letter-spacing:0.01em;white-space:nowrap;cursor:grab;transition:filter 0.15s ease,transform 0.15s ease,background-color 0.12s ease}.os-crumb:active{cursor:grabbing}.os-crumb:hover{filter:brightness( 1.06 )}.os-crumb__remove{cursor:pointer}.os-crumb--first{padding-inline-end:22px;clip-path:polygon( 0 0,calc( 100% - ${G} ) 0,100% 50%,calc( 100% - ${G} ) 100%,0 100% )}.os-crumb--middle{padding-inline:22px;margin-inline-start:calc( -1 * ${G} );clip-path:polygon( ${G} 0,calc( 100% - ${G} ) 0,100% 50%,calc( 100% - ${G} ) 100%,${G} 100%,0 50% )}.os-crumb--last{padding-inline-start:22px;padding-inline-end:14px;margin-inline-start:calc( -1 * ${G} );clip-path:polygon( ${G} 0,100% 0,100% 100%,${G} 100%,0 50% )}.os-crumb--solo{padding:2px 12px;border-radius:999px}.os-crumb__label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.4}.os-crumb__remove{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer;opacity:0.65;transition:opacity 0.12s ease,background-color 0.12s ease,transform 0.12s ease}.os-crumb__remove:hover,.os-crumb__remove:focus-visible{opacity:1;background:var( --os-ui-scrim,rgba( 0,0,0,0.22 ) );outline:none;transform:scale( 1.1 )}.os-crumb__remove svg{display:block;width:100%;height:100%}.os-crumb-chain:hover{filter:drop-shadow( 0 2px 3px rgba( 0,0,0,0.12 ) )}:host( [ disabled ] ) .os-crumb-chain{opacity:0.55;pointer-events:none}`,Et=class Et extends k{constructor(){super(...arguments),this._segments=[]}get segments(){return this._segments}set segments(e){this._segments=Array.isArray(e)?e.slice():[],this.requestUpdate()}render(){const e=this.removable!==null,t=this._segments;return t.length===0?c``:c` |
| 1814 |
<div class="os-crumb-chain" role="group"> |
| 1815 |
${t.map((o,i)=>{const n=cr(i,t.length),r=o.color??"rgba( 0, 0, 0, 0.08 )",a=dr(r),l=`--os-ui-crumb-bg: ${r}; --os-ui-crumb-fg: ${a};`;return c` |
| 1816 |
<span |
| 1817 |
class=${`os-crumb os-crumb--${n}`} |
| 1818 |
style=${l} |
| 1819 |
title=${o.name} |
| 1820 |
draggable="true" |
| 1821 |
@click=${u=>this._onSegmentClick(u,i,o)} |
| 1822 |
@dragstart=${u=>this._onSegmentDragStart(u,i,o)} |
| 1823 |
> |
| 1824 |
<span class="os-crumb__label">${o.name}</span> |
| 1825 |
${e?c` |
| 1826 |
<button |
| 1827 |
type="button" |
| 1828 |
class="os-crumb__remove" |
| 1829 |
aria-label=${`Remove ${o.name}`} |
| 1830 |
draggable="false" |
| 1831 |
@click=${u=>this._onRemove(u,i,o)} |
| 1832 |
>${du()}</button> |
| 1833 |
`:c``} |
| 1834 |
</span> |
| 1835 |
`})} |
| 1836 |
</div> |
| 1837 |
`}_onSegmentDragStart(e,t,o){if(e.target?.closest(".os-crumb__remove")){e.preventDefault();return}const n=this._segments.slice(t);if(e.dataTransfer){const r=cu(n);document.body.appendChild(r);const a=e.currentTarget?.getBoundingClientRect(),l=a?Math.min(30,a.width/2):16,u=a?Math.min(16,a.height/2):12;e.dataTransfer.setDragImage(r,l,u),requestAnimationFrame(()=>r.remove())}this.emit("os-chain-segment-dragstart",{index:t,id:o.id,segment:o,segments:n,dragEvent:e})}_onSegmentClick(e,t,o){e.target?.closest(".os-crumb__remove")||this.emit("os-chain-segment-click",{index:t,id:o.id,segment:o})}_onRemove(e,t,o){e.stopPropagation(),this.emit("os-chain-remove",{index:t,id:o.id,segment:o})}};Et.props=["removable","disabled"],Et.styles=[au],Et.help=void 0;let Vo=Et;$("os-crumb-chain",Vo);const lu=10;function cu(s){const e=document.createElement("div");e.style.cssText=["display: inline-flex","align-items: stretch","border-radius: 999px","overflow: hidden","filter: drop-shadow( 0 1px 2px rgba( 0, 0, 0, 0.18 ) )",'font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',"font-size: 12px","line-height: 1","font-weight: 500","position: fixed","top: -10000px","left: -10000px","pointer-events: none","z-index: 2147483647"].join("; ");const t=s.length;return s.forEach((o,i)=>{const n=document.createElement("span"),r=o.color??"rgba( 0, 0, 0, 0.08 )",a=dr(r),l=cr(i,t),u=["display: inline-flex","align-items: center","justify-content: center","min-height: 22px",`background: ${r}`,`color: ${a}`,"white-space: nowrap","box-sizing: border-box","letter-spacing: 0.01em"],h=lu;l==="solo"?u.push("padding: 2px 12px","border-radius: 999px"):l==="first"?u.push("padding: 2px 22px 2px 12px",`clip-path: polygon( 0 0, calc( 100% - ${h}px ) 0, 100% 50%, calc( 100% - ${h}px ) 100%, 0 100% )`):l==="middle"?u.push("padding: 2px 22px",`margin-inline-start: -${h}px`,`clip-path: polygon( ${h}px 0, calc( 100% - ${h}px ) 0, 100% 50%, calc( 100% - ${h}px ) 100%, ${h}px 100%, 0 50% )`):u.push("padding: 2px 14px 2px 22px",`margin-inline-start: -${h}px`,`clip-path: polygon( ${h}px 0, 100% 0, 100% 100%, ${h}px 100%, 0 50% )`),n.style.cssText=u.join("; "),n.textContent=o.name,e.appendChild(n)}),e}function cr(s,e){return e===1?"solo":s===0?"first":s===e-1?"last":"middle"}let Ae=null;function dr(s){Ae||(Ae=document.createElement("canvas"),Ae.width=1,Ae.height=1);const e=Ae.getContext("2d",{willReadFrequently:!0});if(!e)return"#1d2327";try{e.clearRect(0,0,1,1),e.fillStyle=s,e.fillRect(0,0,1,1);const t=e.getImageData(0,0,1,1).data,o=t[3]/255,i=t[0]*o+255*(1-o),n=t[1]*o+255*(1-o),r=t[2]*o+255*(1-o),a=u=>{const h=u/255;return h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4)};return .2126*a(i)+.7152*a(n)+.0722*a(r)>.55?"#1d2327":"#fff"}catch{return"#1d2327"}}function du(){return z("close",{size:null})}const ur="uncategorized",uu=1;function os(s){return s.id===uu?!0:(s.name||"").toLowerCase()===ur}const Lt=class Lt extends k{constructor(){super(...arguments),this._items=[],this._value=[],this._query="",this._collapsed=new Set,this._focusedRow=-1,this._creatingValues=new Map,this._creatingPending=new Set,this._onCellClick=e=>{if(e.target?.closest(".os-cat-node")||this.isOpen)return;const o=this.disabled!==null,i=this.readonly!==null;o||i||this.openPicker()},this._onDocPointerDown=e=>{!this.isOpen||e.composedPath().includes(this)||this.closePicker()},this._onLayoutChange=()=>{this.isOpen&&this.closePicker()},this._onDocKeydown=e=>{this.isOpen&&e.key==="Escape"&&(e.preventDefault(),this.closePicker())}}get items(){return this._items}set items(e){this._items=Array.isArray(e)?e.slice():[],this.requestUpdate()}get value(){return this._value}set value(e){this._value=Array.isArray(e)?e.slice():[],this.requestUpdate()}get isOpen(){return this.open!==null}openPicker(){this.isOpen||(this.open="",this._query="",this._focusedRow=0,this.emit("os-categories-open",{}),queueMicrotask(()=>{this._positionPopover(),this._searchInput?.focus()}))}closePicker(){this.isOpen&&(this.open=null,this._query="",this._focusedRow=-1,this.emit("os-categories-close",{}),this.requestUpdate())}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocPointerDown,!0),document.addEventListener("keydown",this._onDocKeydown,!0),window.addEventListener("resize",this._onLayoutChange,{passive:!0}),window.addEventListener("scroll",this._onLayoutChange,{passive:!0,capture:!0})}disconnectedCallback(){document.removeEventListener("pointerdown",this._onDocPointerDown,!0),document.removeEventListener("keydown",this._onDocKeydown,!0),window.removeEventListener("resize",this._onLayoutChange),window.removeEventListener("scroll",this._onLayoutChange,{capture:!0})}get _searchInput(){return this.shadowRoot?.querySelector(".os-cat__search")??null}render(){const e=this.isOpen,t=this.disabled!==null,o=this.readonly!==null,i=this.loading!==null,n=this["add-label"]||"Categorize",r=this.placeholder||"Search categories…",a=Math.max(0,parseInt(this["max-visible"]||"2",10)||2);return c` |
| 1838 |
<span class="os-cat" role="group"> |
| 1839 |
${this._renderChipRow(a,o,t,n)} |
| 1840 |
${e?this._renderPopover(r,i):c``} |
| 1841 |
</span> |
| 1842 |
`}_renderChipRow(e,t,o,i){const n=this._selectedItemsInOrder();if(n.length===0)return c` |
| 1843 |
<span class="os-cat__chips" role="list"> |
| 1844 |
<span |
| 1845 |
class="os-cat__uncategorized" |
| 1846 |
title=${'Posts with no category appear as "Uncategorized" in WordPress.'} |
| 1847 |
@click=${this._onCellClick} |
| 1848 |
>${"Uncategorized"}</span> |
| 1849 |
</span> |
| 1850 |
`;const r=this._buildChains(n);return c` |
| 1851 |
<div |
| 1852 |
class="os-cat__chains" |
| 1853 |
role="list" |
| 1854 |
@click=${this._onCellClick} |
| 1855 |
> |
| 1856 |
${r.map(a=>this._renderChain(a,t,o))} |
| 1857 |
</div> |
| 1858 |
`}_buildChains(e){const t=new Map;for(const a of this._items)t.set(a.id,a);const o=new Set(e.map(a=>a.id)),i=a=>{for(const l of o){if(l===a)continue;let u=t.get(l),h=16;for(;u&&h-- >0;){if(u.parent===a)return!0;if(!u.parent)break;u=t.get(u.parent)}}return!1},n=e.filter(a=>!i(a.id)),r=[];for(const a of n){const l=[];let u=a,h=16;for(;u&&h-- >0&&((u===a||o.has(u.id))&&l.unshift(u),!!u.parent);)u=t.get(u.parent);const p=l.map(m=>({id:m.id,name:m.name}));r.push({id:a.id,segments:p})}return r}_renderChain(e,t,o){const i=!t&&!o,n=a=>{a.stopPropagation();const l=a.detail,u=typeof l?.index=="number"?l.index:e.segments.length-1,h=new Set;for(const m of e.segments.slice(u))typeof m.id=="number"&&h.add(m.id);const p=this._value.filter(m=>!h.has(m));p.length!==this._value.length&&this.emit("os-categories-change",{value:p})},r=document.createElement("os-crumb-chain");return r.segments=e.segments,i&&r.setAttribute("removable",""),r.addEventListener("os-chain-remove",n),c`<div role="listitem">${r}</div>`}_renderPopover(e,t){const o=this._buildTree(),i=this._filterTree(o,this._query),n=this._flattenForDisplay(i);return this._focusedRow>=n.length&&(this._focusedRow=n.length>0?n.length-1:-1),c` |
| 1859 |
<div class="os-cat__popover" role="dialog" aria-label="Choose categories"> |
| 1860 |
<input |
| 1861 |
class="os-cat__search" |
| 1862 |
type="text" |
| 1863 |
autocomplete="off" |
| 1864 |
placeholder=${e} |
| 1865 |
.value=${this._query} |
| 1866 |
@input=${r=>this._onSearchInput(r)} |
| 1867 |
@keydown=${r=>this._onSearchKeydown(r,n)} |
| 1868 |
/> |
| 1869 |
<div class="os-cat__tree" role="listbox" aria-multiselectable="true"> |
| 1870 |
${this._renderCreateRow(0,12,0,"")} |
| 1871 |
${this._renderTreeBody(t,n)} |
| 1872 |
</div> |
| 1873 |
<div class="os-cat__footer"> |
| 1874 |
<span class="dashicons dashicons-info-outline" aria-hidden="true"></span> |
| 1875 |
<span> |
| 1876 |
Posts with no category appear as |
| 1877 |
<strong>Uncategorized</strong>. |
| 1878 |
</span> |
| 1879 |
</div> |
| 1880 |
</div> |
| 1881 |
`}_renderTreeBody(e,t){return e?c` |
| 1882 |
<div class="os-cat__loading"> |
| 1883 |
<span class="os-cat__loading-spinner" aria-hidden="true"></span> |
| 1884 |
${"Loading categories…"} |
| 1885 |
</div> |
| 1886 |
`:t.length===0?c` |
| 1887 |
<div class="os-cat__empty"> |
| 1888 |
${this._items.length===0?"No categories yet — create one in WordPress to assign.":"No matches."} |
| 1889 |
</div> |
| 1890 |
`:t.map((o,i)=>this._renderRow(o,i,t.length))}_renderRow(e,t,o){const{node:i,hasChildren:n}=e,r=this._value.includes(i.item.id),a=!this._collapsed.has(i.item.id),l=12+i.depth*16,u=i.depth>0?i.depth*16:0,h=t===this._focusedRow;return c` |
| 1891 |
<div class="os-cat__row-block"> |
| 1892 |
<div |
| 1893 |
class="os-cat__row" |
| 1894 |
role="option" |
| 1895 |
aria-selected=${r?"true":"false"} |
| 1896 |
data-selected=${r?"true":"false"} |
| 1897 |
data-expanded=${a?"true":"false"} |
| 1898 |
data-focused=${h?"true":"false"} |
| 1899 |
data-row-id=${String(i.item.id)} |
| 1900 |
style=${`--os-ui-cat-row-indent: ${l}px; --os-ui-cat-guide-width: ${u}px;`} |
| 1901 |
@mouseenter=${()=>{this._focusedRow=t,this.requestUpdate()}} |
| 1902 |
@click=${p=>{p.preventDefault(),this._toggleSelection(i.item.id)}} |
| 1903 |
> |
| 1904 |
${n?c`<button |
| 1905 |
type="button" |
| 1906 |
class="os-cat__expander" |
| 1907 |
aria-label=${a?"Collapse":"Expand"} |
| 1908 |
@click=${p=>{p.stopPropagation(),this._toggleExpand(i.item.id)}} |
| 1909 |
>${hr()}</button>`:c`<span class="os-cat__expander os-cat__expander--placeholder" aria-hidden="true">${hr()}</span>`} |
| 1910 |
<span class="os-cat__check" aria-hidden="true">${pu()}</span> |
| 1911 |
<span class="os-cat__label">${this._highlight(i.item.name,this._query)}</span> |
| 1912 |
${os(i.item)?c``:c`<button |
| 1913 |
type="button" |
| 1914 |
class="os-cat__delete" |
| 1915 |
aria-label=${`Delete ${i.item.name}`} |
| 1916 |
title=${`Delete ${i.item.name}`} |
| 1917 |
@click=${p=>this._onDeleteClick(p,i.item)} |
| 1918 |
>${fu()}</button>`} |
| 1919 |
</div> |
| 1920 |
${a&&!os(i.item)?this._renderCreateRow(i.item.id,12+(i.depth+1)*16,(i.depth+1)*16,i.item.name):c``} |
| 1921 |
</div> |
| 1922 |
`}_renderCreateRow(e,t,o,i){const n=this._creatingValues.get(e)??"",r=this._creatingPending.has(e),a=e===0?"Add new category…":`Add child of "${i}"…`;return c` |
| 1923 |
<div |
| 1924 |
class="os-cat__create-row" |
| 1925 |
style=${`--os-ui-cat-row-indent: ${t}px; --os-ui-cat-guide-width: ${o}px;`} |
| 1926 |
@click=${l=>l.stopPropagation()} |
| 1927 |
> |
| 1928 |
<div class="os-cat__create-wrap"> |
| 1929 |
<input |
| 1930 |
class="os-cat__create-input" |
| 1931 |
type="text" |
| 1932 |
autocomplete="off" |
| 1933 |
spellcheck="false" |
| 1934 |
placeholder=${a} |
| 1935 |
aria-label=${a} |
| 1936 |
.value=${n} |
| 1937 |
?disabled=${r} |
| 1938 |
@input=${l=>this._onCreateInput(l,e)} |
| 1939 |
@keydown=${l=>this._onCreateKeydown(l,e)} |
| 1940 |
/> |
| 1941 |
${r?c`<span class="os-cat__create-spinner" aria-hidden="true"></span>`:c`<button |
| 1942 |
type="button" |
| 1943 |
class="os-cat__create-submit" |
| 1944 |
aria-label=${e===0?"Create category":`Create child of ${i}`} |
| 1945 |
?disabled=${n.trim().length===0} |
| 1946 |
@click=${l=>{l.stopPropagation(),this._submitCreate(e)}} |
| 1947 |
>${hu()}</button>`} |
| 1948 |
</div> |
| 1949 |
</div> |
| 1950 |
`}_onCreateInput(e,t){const o=e.target.value;o===""?this._creatingValues.delete(t):this._creatingValues.set(t,o),this.requestUpdate()}_onCreateKeydown(e,t){if(e.key==="Escape"){e.preventDefault(),this._creatingValues.delete(t),this.requestUpdate();return}e.key==="Enter"&&(e.preventDefault(),this._submitCreate(t))}_submitCreate(e){const t=(this._creatingValues.get(e)??"").trim();!t||this._creatingPending.has(e)||(this._creatingPending.add(e),this.requestUpdate(),this.emit("os-categories-create",{name:t,parent:e}))}endCreating(e=0){this._creatingPending.delete(e),this._creatingValues.delete(e),this.requestUpdate()}failCreating(e=0,t){this._creatingPending.delete(e),this.requestUpdate()}_buildTree(){const e=new Map;for(const n of this._items)e.set(n.id,{item:n,children:[],depth:0});const t=[];for(const n of e.values()){const r=n.item.parent;r&&e.has(r)?e.get(r).children.push(n):t.push(n)}const o=(n,r)=>{n.depth=r;for(const a of n.children)o(a,r+1)};for(const n of t)o(n,0);const i=n=>{n.sort((r,a)=>{const l=os(r.item),u=os(a.item);return l!==u?l?-1:1:r.item.name.localeCompare(a.item.name)});for(const r of n)i(r.children)};return i(t),t}_filterTree(e,t){const o=t.trim().toLowerCase();if(!o)return e;const i=n=>{if(n.item.name.toLowerCase().includes(o))return{item:n.item,children:n.children.slice(),depth:n.depth};const a=n.children.map(i).filter(l=>l!==null);return a.length>0?{item:n.item,children:a,depth:n.depth}:null};return e.map(i).filter(n=>n!==null)}_flattenForDisplay(e){const t=[],o=this._query.trim()!=="",i=n=>{for(const r of n)t.push({node:r,visible:!0,hasChildren:r.children.length>0}),!(this._collapsed.has(r.item.id)&&!o)&&r.children.length>0&&i(r.children)};return i(e),t}_selectedItemsInOrder(){const e=new Map;for(const i of this._items)e.set(i.id,i);const t=[],o=[];for(const i of this._value){const n=e.get(i);n&&(n.name.toLowerCase()===ur||n.id===1?o.push(n):t.push(n))}return t.length>0?t:o.length>0?[]:t}_highlight(e,t){const o=t.trim();if(!o)return e;const i=e.toLowerCase(),n=o.toLowerCase(),r=i.indexOf(n);return r===-1?e:c`${e.slice(0,r)}<span class="os-cat__match" |
| 1951 |
>${e.slice(r,r+o.length)}</span |
| 1952 |
>${e.slice(r+o.length)}`}_toggleSelection(e){const t=this._value.includes(e)?this._value.filter(o=>o!==e):[...this._value,e];this.emit("os-categories-change",{value:t})}_onDeleteClick(e,t){e.stopPropagation(),e.preventDefault(),this.emit("os-categories-delete",{id:t.id,name:t.name})}_toggleExpand(e){this._collapsed.has(e)?this._collapsed.delete(e):this._collapsed.add(e),this.requestUpdate()}_onSearchInput(e){this._query=e.target.value,this._focusedRow=0,this.requestUpdate()}_onSearchKeydown(e,t){switch(e.key){case"ArrowDown":{if(t.length===0)return;e.preventDefault(),this._focusedRow=this._focusedRow+1>=t.length?0:this._focusedRow+1,this.requestUpdate(),this._scrollFocusedIntoView();return}case"ArrowUp":{if(t.length===0)return;e.preventDefault(),this._focusedRow=this._focusedRow<=0?t.length-1:this._focusedRow-1,this.requestUpdate(),this._scrollFocusedIntoView();return}case"ArrowRight":{if(this._focusedRow<0||this._focusedRow>=t.length)return;const o=t[this._focusedRow];o.hasChildren&&this._collapsed.has(o.node.item.id)&&(e.preventDefault(),this._toggleExpand(o.node.item.id));return}case"ArrowLeft":{if(this._focusedRow<0||this._focusedRow>=t.length)return;const o=t[this._focusedRow];o.hasChildren&&!this._collapsed.has(o.node.item.id)&&(e.preventDefault(),this._toggleExpand(o.node.item.id));return}case"Enter":case" ":{if(this._focusedRow<0||this._focusedRow>=t.length)return;e.preventDefault();const o=t[this._focusedRow];this._toggleSelection(o.node.item.id);return}case"Escape":e.preventDefault(),this.closePicker()}}_scrollFocusedIntoView(){queueMicrotask(()=>{const e=this.shadowRoot?.querySelector(".os-cat__tree");if(!e)return;const t=e.querySelector('.os-cat__row[data-focused="true"]');if(!t)return;const o=t.getBoundingClientRect(),i=e.getBoundingClientRect();o.top<i.top?t.scrollIntoView({block:"nearest"}):o.bottom>i.bottom&&t.scrollIntoView({block:"nearest"})})}_positionPopover(){const e=this.shadowRoot?.querySelector(".os-cat__popover");if(!e)return;const t=this.getBoundingClientRect(),o=e.getBoundingClientRect(),i=window.innerWidth,n=window.innerHeight,r=8;let a=t.bottom+4;const l=a+o.height+r>n,u=t.top-4-o.height>=r;l&&u?a=t.top-4-o.height:l&&(a=Math.max(r,n-o.height-r));let h=t.left;h+o.width+r>i&&(h=t.right-o.width),h=Math.max(r,Math.min(h,i-o.width-r)),e.style.top=`${a}px`,e.style.left=`${h}px`}};Lt.props=["placeholder","add-label","disabled","readonly","open","loading","max-visible"],Lt.styles=[ru],Lt.help=void 0;let Oo=Lt;$("os-category-picker",Oo);function hr(){return z("chevron-right",{size:14})}function hu(){return z("plus",{size:16})}function pu(){return z("check",{size:null})}function fu(){return z("close",{size:null})}const gu=w` ${R} ${Ut}:host(:not( [ interactive ] ) ) .os-holo-glint,:host( [ disabled ] ) .os-holo-glint{display:none}:host{display:flex;flex-direction:column;position:relative;gap:var( --os-ui-card-gap,12px );padding:var( --os-ui-card-padding,16px );border:1px solid var( --os-ui-card-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );border-radius:var( --os-ui-card-radius,12px );background:var( --os-ui-card-bg,var( --os-ui-surface,#fff ) );background-image:var( --os-ui-panel-bg-image,none );background-repeat:var( --os-ui-panel-bg-image-repeat,repeat );background-size:var( --os-ui-panel-bg-image-size,auto );background-position:var( --os-ui-panel-bg-image-position,center );color:var( --os-ui-card-fg,inherit );box-sizing:border-box;min-width:0;transition:transform 180ms ease,box-shadow 180ms ease,border-color 180ms ease}:host( [ hidden ] ){display:none}:host( [ compact ] ){padding:var( --os-ui-card-padding-compact,10px );gap:var( --os-ui-card-gap-compact,6px );border-radius:var( --os-ui-card-radius-compact,8px )}:host( [ interactive ] ){cursor:pointer;outline-offset:2px}:host( [ interactive ]:hover ),:host( [ interactive ]:focus-visible ){transform:translateY( -2px );box-shadow:var( --os-ui-card-shadow-hover,0 4px 16px rgba( 0,0,0,0.08 ) );border-color:var( --os-ui-card-border-hover,var( --os-ui-border-strong,rgba( 0,0,0,0.16 ) ) )}:host( [ interactive ]:focus-visible ){outline:none;box-shadow:var( --_holo-focus )}:host( [ selected ] ){border-color:var( --os-ui-card-border-selected,var( --wp-admin-theme-color,#2271b1 ) );box-shadow:var( --os-ui-card-shadow-selected,0 0 0 1px var( --wp-admin-theme-color,#2271b1 ) inset )}:host( [ selected ] )::after{content:'';position:absolute;inset:-1px;border-radius:inherit;padding:1px;background-image:var( --_holo-edge );pointer-events:none;-webkit-mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );mask-composite:exclude}:host( [ disabled ] ){opacity:0.55;pointer-events:none;cursor:not-allowed}@media ( prefers-reduced-motion:reduce ){:host{transition:none}:host( [ interactive ]:hover ),:host( [ interactive ]:focus-visible ){transform:none}}::slotted( header ){display:flex;align-items:center;gap:12px;min-width:0}::slotted( footer ){display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:auto}`,pr="[data-noclick]",Rt=class Rt extends k{constructor(){super(...arguments),this._onClick=e=>{!this.hasAttribute("interactive")||this.hasAttribute("disabled")||e.target?.closest(pr)||this._emitCardClick(e)},this._onKeyDown=e=>{if(!this.hasAttribute("interactive")||this.hasAttribute("disabled")||e.key!=="Enter"&&e.key!==" "&&e.key!=="Spacebar")return;const t=e.target;t&&t!==this&&t.closest(pr)||t instanceof HTMLElement&&t!==this&&(t.tagName==="BUTTON"||t.tagName==="A"||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")||(e.preventDefault(),this._emitCardClick(e))}}connectedCallback(){super.connectedCallback(),this._syncRoles(),this.addEventListener("click",this._onClick),this.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){this.removeEventListener("click",this._onClick),this.removeEventListener("keydown",this._onKeyDown)}render(){return this._syncRoles(),c`<span class="os-holo-glint" aria-hidden="true"></span |
| 1953 |
><slot name="header"></slot><slot></slot><slot name="footer"></slot>`}_syncRoles(){const e=this.hasAttribute("interactive"),t=this.hasAttribute("disabled");e?(this.hasAttribute("role")||this.setAttribute("role","button"),this.setAttribute("tabindex",t?"-1":"0"),this.setAttribute("aria-disabled",t?"true":"false")):(this.removeAttribute("role"),this.removeAttribute("tabindex"),this.removeAttribute("aria-disabled"))}_emitCardClick(e){this.dispatchEvent(new CustomEvent("os-card-click",{detail:{originalEvent:e},bubbles:!0,composed:!0}))}};Rt.props=["interactive","selected","compact","disabled"],Rt.styles=[gu],Rt.help=void 0;let Ko=Rt;$("os-card",Ko);const bu=w`:host{display:block;--_track:var( --os-ui-rating-track,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );--_fill:var( --os-ui-rating-fill,linear-gradient( 90deg,#f5af00 0%,#ffd245 100% ) );--_star:var( --os-ui-rating-star,#f5af00 );--_star-empty:var( --os-ui-rating-star-empty,var( --os-ui-fg-faint,rgba( 0,0,0,0.18 ) ) );--_surface:var( --os-ui-rating-surface,var( --os-ui-surface-elevated,rgba( 255,255,255,0.7 ) ) );--_border:var( --os-ui-rating-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );--_fg:var( --os-ui-rating-fg,var( --os-ui-fg,inherit ) );--_fg-muted:var( --os-ui-rating-fg-muted,var( --os-ui-fg-muted,#666 ) )}:host( [ hidden ] ){display:none}.summary-card{display:grid;grid-template-columns:minmax( 140px,180px ) 1fr;gap:28px;align-items:center;padding:18px 20px;background:var( --_surface );border:1px solid var( --_border );border-radius:14px;color:var( --_fg )}.summary{display:flex;flex-direction:column;align-items:center;gap:8px;padding-inline-end:20px;border-inline-end:1px solid var( --_border )}.big{font-size:44px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums;letter-spacing:-0.02em;color:var( --_fg )}.stars{display:inline-flex;gap:2px;color:var( --_star )}.stars svg{width:16px;height:16px;display:block}.stars .empty{color:var( --_star-empty )}.total{font-size:12px;color:var( --_fg-muted )}.bars{display:grid;gap:6px;min-width:0}.row{display:grid;grid-template-columns:42px 1fr 60px;gap:12px;align-items:center;font-size:12.5px;color:var( --_fg-muted )}.row__label{display:inline-flex;align-items:center;gap:4px;font-variant-numeric:tabular-nums;font-weight:600}.row__label svg{width:11px;height:11px;color:var( --_star )}.row__track{position:relative;height:10px;background:var( --_track );border-radius:999px;overflow:hidden}.row__fill{position:absolute;inset:0;background:var( --_fill );border-radius:999px;transform-origin:left center;transform:scaleX( var( --ratio,0 ) );transition:transform 600ms cubic-bezier( 0.2,0.8,0.2,1 )}:host(:dir( rtl ) ) .row__fill,:host-context( [ dir='rtl' ] ) .row__fill{transform-origin:right center}.row__count{text-align:end;font-variant-numeric:tabular-nums;color:var( --_fg )}@media ( prefers-reduced-motion:reduce ){.row__fill{transition:none}}@media ( max-width:540px ){.summary-card{grid-template-columns:1fr;gap:16px}.summary{padding-inline-end:0;border-inline-end:0;border-block-end:1px solid var( --_border );padding-block-end:14px}}`,Tt=class Tt extends k{constructor(){super(...arguments),this._ratings={}}get ratings(){return{...this._ratings}}set ratings(e){this._ratings=e?{...e}:{},this.requestUpdate()}render(){const e=mu(fr(this,"rating")),t=e/100*5,o=fr(this,"total"),i=o>0?o:(this._ratings[5]??0)+(this._ratings[4]??0)+(this._ratings[3]??0)+(this._ratings[2]??0)+(this._ratings[1]??0),n=new Intl.NumberFormat,r=e>0?(e/100*5).toFixed(1):"—";return c` |
| 1954 |
<div class="summary-card" role="img" aria-label=${vu(e,i)}> |
| 1955 |
<div class="summary"> |
| 1956 |
<div class="big">${r}</div> |
| 1957 |
<div class="stars" aria-hidden="true"> |
| 1958 |
${_u(t)} |
| 1959 |
</div> |
| 1960 |
<div class="total"> |
| 1961 |
${i===1?"1 rating":`${n.format(i)} ratings`} |
| 1962 |
</div> |
| 1963 |
</div> |
| 1964 |
<div class="bars"> |
| 1965 |
${[5,4,3,2,1].map(a=>{const l=this._ratings[String(a)]??0,u=i===0?0:l/i;return c` |
| 1966 |
<div |
| 1967 |
class="row" |
| 1968 |
role="presentation" |
| 1969 |
aria-label=${`${a} stars: ${n.format(l)}`} |
| 1970 |
> |
| 1971 |
<span class="row__label"> |
| 1972 |
${a} ${gr()} |
| 1973 |
</span> |
| 1974 |
<span class="row__track"> |
| 1975 |
<span |
| 1976 |
class="row__fill" |
| 1977 |
style=${`--ratio: ${u.toFixed(4)}`} |
| 1978 |
></span> |
| 1979 |
</span> |
| 1980 |
<span class="row__count">${n.format(l)}</span> |
| 1981 |
</div> |
| 1982 |
`})} |
| 1983 |
</div> |
| 1984 |
</div> |
| 1985 |
`}};Tt.props=["rating","total"],Tt.styles=[bu],Tt.help=void 0;let Bo=Tt;function fr(s,e){const t=s.getAttribute(e);if(t===null||t==="")return 0;const o=Number(t);return Number.isFinite(o)?o:0}function mu(s){return s<0?0:s>100?100:s}function vu(s,e){return e===0?"No ratings yet":`Average rating ${(s/100*5).toFixed(1)} out of 5, from ${e} ratings`}function _u(s){const e=Math.floor(s),t=s-e>=.5?1:0,o=5-e-t,i=[];for(let n=0;n<e;n++)i.push(gr());for(let n=0;n<t;n++)i.push(yu());for(let n=0;n<o;n++)i.push(wu());return i}function gr(){return c` |
| 1986 |
<svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"> |
| 1987 |
<path |
| 1988 |
d="M8 1.5l2.06 4.17 4.6.67-3.33 3.25.79 4.58L8 12L3.88 14.17l.79-4.58L1.34 6.34l4.6-.67L8 1.5z" |
| 1989 |
/> |
| 1990 |
</svg> |
| 1991 |
`}function yu(){return c` |
| 1992 |
<svg viewBox="0 0 16 16" aria-hidden="true"> |
| 1993 |
<defs> |
| 1994 |
<linearGradient id="os-half-star"> |
| 1995 |
<stop offset="50%" stop-color="currentColor" /> |
| 1996 |
<stop |
| 1997 |
offset="50%" |
| 1998 |
stop-color="currentColor" |
| 1999 |
stop-opacity="0.22" |
| 2000 |
/> |
| 2001 |
</linearGradient> |
| 2002 |
</defs> |
| 2003 |
<path |
| 2004 |
fill="url(#os-half-star)" |
| 2005 |
d="M8 1.5l2.06 4.17 4.6.67-3.33 3.25.79 4.58L8 12L3.88 14.17l.79-4.58L1.34 6.34l4.6-.67L8 1.5z" |
| 2006 |
/> |
| 2007 |
</svg> |
| 2008 |
`}function wu(){return c` |
| 2009 |
<svg |
| 2010 |
class="empty" |
| 2011 |
viewBox="0 0 16 16" |
| 2012 |
fill="currentColor" |
| 2013 |
aria-hidden="true" |
| 2014 |
> |
| 2015 |
<path |
| 2016 |
d="M8 1.5l2.06 4.17 4.6.67-3.33 3.25.79 4.58L8 12L3.88 14.17l.79-4.58L1.34 6.34l4.6-.67L8 1.5z" |
| 2017 |
/> |
| 2018 |
</svg> |
| 2019 |
`}$("os-rating-summary",Bo);const xu=w` ${R} ${fi}:host{display:block;--_track-bg:var( --os-ui-progress-track-bg,var( --os-ui-surface-sunken,rgba( 0,0,0,0.08 ) ) );--_fill:var( --os-ui-progress-fill,var( --wp-admin-theme-color,#2271b1 ) );--_height:var( --os-ui-progress-height,6px );--_radius:var( --os-ui-progress-radius,999px );--_label-color:var( --os-ui-progress-label-color,inherit );--_label-size:var( --os-ui-progress-label-size,12px );--_label-gap:var( --os-ui-progress-label-gap,4px );width:100%;font:inherit;color:var( --_label-color )}:host( [ hidden ] ){display:none}.header{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:var( --_label-gap );font-size:var( --_label-size );line-height:1.3}.label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.percent{font-variant-numeric:tabular-nums;opacity:0.75;flex-shrink:0}.track{position:relative;width:100%;height:var( --_height );background:var( --_track-bg );border-radius:var( --_radius );overflow:hidden}.fill{position:absolute;inset-block:0;inset-inline-start:0;width:0;background:var( --_fill );border-radius:inherit;transition:width 0.18s ease-out}:host( [ tone='success' ] ){--os-ui-progress-fill:var( --os-ui-success-fg,#3a8a3a )}:host( [ tone='warning' ] ){--os-ui-progress-fill:var( --os-ui-warning-fg,#dba617 )}:host( [ tone='danger' ] ){--os-ui-progress-fill:var( --os-ui-danger,#d63638 )}:host( [ indeterminate ] ) .fill{width:100%;transition:none;background-image:var( --_fill );background-size:300% 300%;background-repeat:no-repeat;animation:os-holo-shimmer 2.4s var( --_holo-loop ) infinite}:host( [ indeterminate ][ tone ] ) .fill{width:33%;background-image:none;animation:os-progress-sweep 1.1s linear infinite}@keyframes os-progress-sweep{0%{transform:translateX( -120% )}100%{transform:translateX( 320% )}}@media ( prefers-reduced-motion:reduce ){.fill{transition:none}:host( [ indeterminate ] ) .fill,:host( [ indeterminate ][ tone ] ) .fill{animation:none;width:100%;opacity:0.6}}`,Pt=class Pt extends k{constructor(){super(...arguments),this._ownedAriaLabel=null}render(){return c`<div class="root" part="root"> |
| 2020 |
<div class="header" part="header" hidden> |
| 2021 |
<span class="label" part="label"></span> |
| 2022 |
<span class="percent" part="percent"></span> |
| 2023 |
</div> |
| 2024 |
<div class="track" part="track"> |
| 2025 |
<div class="fill" part="fill"></div> |
| 2026 |
</div> |
| 2027 |
</div>`}requestUpdate(){super.requestUpdate(),queueMicrotask(()=>this._paint())}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paint())}_paint(){const e=this.shadowRoot;if(!e)return;const t=this._readMax(),o=this.hasAttribute("indeterminate")||t<=0,i=o?0:this._readValue(t),n=o?0:i/t,r=Math.round(n*100),a=this.getAttribute("label")??"",l=this.hasAttribute("show-percent"),u=e.querySelector(".fill");u&&!o?u.style.width=`${(n*100).toFixed(2)}%`:u&&o&&u.style.removeProperty("width");const h=e.querySelector(".header"),p=e.querySelector(".label"),m=e.querySelector(".percent");if(h&&p&&m){const b=a||l&&!o;h.hidden=!b,p.textContent=a,m.hidden=!(l&&!o),m.textContent=`${r}%`}this._syncAria(t,i,o,a);const _=e.querySelector(".track");_&&(_.setAttribute("role","progressbar"),_.setAttribute("aria-valuemin","0"),o?(_.removeAttribute("aria-valuenow"),_.removeAttribute("aria-valuemax")):(_.setAttribute("aria-valuemax",String(t)),_.setAttribute("aria-valuenow",String(i))),a?_.setAttribute("aria-label",a):_.removeAttribute("aria-label"))}_syncAria(e,t,o,i){this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","0"),o?(this.removeAttribute("aria-valuenow"),this.removeAttribute("aria-valuemax")):(this.setAttribute("aria-valuemax",String(e)),this.setAttribute("aria-valuenow",String(t)));const n=this.getAttribute("aria-label");i?(n===null||n===this._ownedAriaLabel)&&(this.setAttribute("aria-label",i),this._ownedAriaLabel=i):n!==null&&n===this._ownedAriaLabel&&(this.removeAttribute("aria-label"),this._ownedAriaLabel=null)}_readMax(){const e=this.getAttribute("max");if(e===null)return 100;const t=parseFloat(e);return Number.isFinite(t)?t:100}_readValue(e){const t=parseFloat(this.getAttribute("value")??"0");return!Number.isFinite(t)||t<0?0:t>e?e:t}};Pt.props=["value","max","indeterminate","tone","label","showPercent"],Pt.styles=[xu],Pt.help=void 0;let Go=Pt;$("os-progress-bar",Go);const ku=w`:host{--_gap:var( --os-ui-field-row-gap,6px );--_label-width:var( --os-ui-field-row-label-width,12rem );display:flex;flex-direction:column;gap:var( --_gap );container-type:inline-size}:host( [ hidden ] ){display:none}.os-field-row__head{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:0}.os-field-row__head:empty{display:none}.os-field-row__label{font-size:13px;font-weight:500;line-height:1.4;color:var( --os-ui-fg,#1d2327 );cursor:default}.os-field-row__required{margin-inline-start:2px;color:var( --os-ui-danger,#d63638 )}.os-field-row__action:empty{display:none}.os-field-row__control{min-width:0}.os-field-row__hint,.os-field-row__error{margin:0;font-size:12px;line-height:1.4}.os-field-row__hint{color:var( --os-ui-fg-muted,#646970 )}.os-field-row__error{color:var( --os-ui-danger,#d63638 )}:host( [ layout='inline' ] ){display:grid;grid-template-columns:var( --_label-width ) minmax( 0,1fr );align-items:start;column-gap:12px;row-gap:2px}:host( [ layout='inline' ] ) .os-field-row__head{grid-column:1;grid-row:1;padding-block-start:5px}:host( [ layout='inline' ] ) .os-field-row__control{grid-column:2;grid-row:1}:host( [ layout='inline' ] ) .os-field-row__hint,:host( [ layout='inline' ] ) .os-field-row__error{grid-column:2;grid-row:2}@container ( max-width:30rem ){:host( [ layout='inline' ] ){display:flex;flex-direction:column;gap:var( --_gap )}:host( [ layout='inline' ] ) .os-field-row__head{padding-block-start:0}}::slotted( input:where(:not( [ type='checkbox' ],[ type='radio' ] ) ) ),::slotted( select ),::slotted( textarea ){box-sizing:border-box;width:100%;padding:6px 8px;border-radius:4px;background:var( --os-ui-field-bg,#fff );border:1px solid var( --os-ui-field-border,#8c8f94 );color:var( --os-ui-field-fg,#2c3338 );font:inherit}`,$u='input, select, textarea, [contenteditable="true"], [role="textbox"], [role="combobox"], [os-field-control]';let Au=0;const zt=class zt extends k{constructor(){super(...arguments),this.uid=`os-field-row-${++Au}`,this.syncControl=()=>{const e=this.control;if(!e)return;const t=this.error,o=this.hint,i=this.hasAttribute("required");let n="";t?n=`${this.uid}-error`:o&&(n=`${this.uid}-hint`);const r=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(l=>l&&!l.startsWith(this.uid)),a=n?[...r,n]:r;a.length?e.setAttribute("aria-describedby",a.join(" ")):e.removeAttribute("aria-describedby"),t?e.setAttribute("aria-invalid","true"):e.getAttribute("aria-invalid")==="true"&&e.removeAttribute("aria-invalid"),i&&(e.setAttribute("required",""),e.setAttribute("aria-required","true"))},this.focusControl=()=>{const e=this.control;e&&e.focus?.()}}get control(){const e=this["control-id"];return e?Array.from(this.querySelectorAll("[id]")).find(t=>t.id===e)??null:this.querySelector($u)}render(){const e=this.label||"",t=this.hint||"",o=this.error||"",i=this.hasAttribute("required");queueMicrotask(this.syncControl);let n=null;return o?n=c`<p |
| 2028 |
class="os-field-row__error" |
| 2029 |
id="${this.uid}-error" |
| 2030 |
role="alert" |
| 2031 |
> |
| 2032 |
${o} |
| 2033 |
</p>`:t&&(n=c`<p class="os-field-row__hint" id="${this.uid}-hint"> |
| 2034 |
${t} |
| 2035 |
</p>`),c` |
| 2036 |
<div class="os-field-row__head"> |
| 2037 |
${e?c`<span |
| 2038 |
class="os-field-row__label" |
| 2039 |
id="${this.uid}-label" |
| 2040 |
@click=${this.focusControl} |
| 2041 |
> |
| 2042 |
${e}${i?c`<span |
| 2043 |
class="os-field-row__required" |
| 2044 |
aria-hidden="true" |
| 2045 |
>*</span |
| 2046 |
>`:null} |
| 2047 |
</span>`:null} |
| 2048 |
<span class="os-field-row__action"><slot name="action"></slot></span> |
| 2049 |
</div> |
| 2050 |
<div class="os-field-row__control"> |
| 2051 |
<slot @slotchange=${this.syncControl}></slot> |
| 2052 |
</div> |
| 2053 |
${n} |
| 2054 |
`}};zt.props=["label","hint","error","required","layout","control-id"],zt.styles=[ku],zt.help=void 0;let Xo=zt;$("os-field-row",Xo);const Cu=w`:host{--_gap:var( --os-ui-repeater-gap,8px );--_row-bg:var( --os-ui-repeater-row-bg,var( --os-ui-surface,#fff ) );--_border:var( --os-ui-repeater-row-border,var( --os-ui-border,#dcdcde ) );display:flex;flex-direction:column;gap:var( --_gap )}:host( [ hidden ] ){display:none}.os-repeater__rows{display:flex;flex-direction:column;gap:var( --_gap )}.os-repeater__row{display:flex;align-items:start;gap:6px;padding:8px;border:1px solid var( --_border );border-radius:6px;background:var( --_row-bg )}.os-repeater__content{flex:1 1 auto;min-width:0}.os-repeater__handles{display:flex;flex-direction:column;gap:2px;flex:0 0 auto}.os-repeater__handle,.os-repeater__remove{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:4px;background:transparent;color:var( --os-ui-fg-muted,#646970 );cursor:pointer}.os-repeater__handle:hover:not(:disabled ),.os-repeater__remove:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) );color:var( --os-ui-fg,#1d2327 )}.os-repeater__remove:hover:not(:disabled ){color:var( --os-ui-danger,#d63638 )}.os-repeater__handle:disabled,.os-repeater__remove:disabled{opacity:0.4;cursor:default}.os-repeater__handle:focus-visible,.os-repeater__remove:focus-visible{outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:1px}.os-repeater__remove{flex:0 0 auto}.os-repeater__empty{padding:12px;border:1px dashed var( --_border );border-radius:6px;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-repeater__empty:has( slot[ name='empty' ]:not(:has( * ) ) ):empty{display:none}.os-repeater__footer{display:flex;align-items:center;gap:8px}`,It=class It extends k{constructor(){super(...arguments),this._keys=[],this.onAdd=()=>{this.isDisabled||this.emit("os-repeater-add",{keys:[...this._keys]})},this.onKeydown=e=>{if(!e.altKey||!this.hasAttribute("reorderable"))return;let t=0;if(e.key==="ArrowUp"?t=-1:e.key==="ArrowDown"&&(t=1),t===0)return;const i=e.target?.closest?.('[slot^="row-"]')?.getAttribute("slot")?.slice(4);i&&(e.preventDefault(),this.onMove(i,t))}}get keys(){return this._keys}set keys(e){this._keys=Array.isArray(e)?[...e]:[],this.requestUpdate()}get isDisabled(){return this.hasAttribute("disabled")}numeric(e){const t=this.getAttribute(e);if(t===null||t.trim()==="")return null;const o=Number(t);return Number.isFinite(o)?o:null}onRemove(e){if(this.isDisabled)return;const t=this._keys.indexOf(e);this.emit("os-repeater-remove",{key:e,index:t,keys:this._keys.filter(o=>o!==e)})}onMove(e,t){if(this.isDisabled)return;const o=this._keys.indexOf(e),i=o+t;if(o<0||i<0||i>=this._keys.length)return;const n=[...this._keys];n.splice(i,0,...n.splice(o,1)),this.emit("os-repeater-move",{key:e,from:o,to:i,keys:n})}render(){const e=this._keys,t=this.isDisabled,o=this.hasAttribute("reorderable"),i=this,n=i["row-label"]||"row",r=i["add-label"]||"Add row",a=i["empty-text"]||"",l=this.numeric("min"),u=this.numeric("max"),h=l===null||e.length>l,p=u===null||e.length<u;return c` |
| 2055 |
<div class="os-repeater__rows" @keydown=${this.onKeydown}> |
| 2056 |
${e.length===0?c`<div class="os-repeater__empty"> |
| 2057 |
<slot name="empty">${a}</slot> |
| 2058 |
</div>`:e.map((m,_)=>c` |
| 2059 |
<div class="os-repeater__row" data-key=${m}> |
| 2060 |
${o?c`<div class="os-repeater__handles"> |
| 2061 |
<button |
| 2062 |
type="button" |
| 2063 |
class="os-repeater__handle" |
| 2064 |
?disabled=${t||_===0} |
| 2065 |
aria-label="Move ${n} up" |
| 2066 |
@click=${()=>this.onMove(m,-1)} |
| 2067 |
> |
| 2068 |
<os-icon name="arrow-up-alt2" size="14"></os-icon> |
| 2069 |
</button> |
| 2070 |
<button |
| 2071 |
type="button" |
| 2072 |
class="os-repeater__handle" |
| 2073 |
?disabled=${t||_===e.length-1} |
| 2074 |
aria-label="Move ${n} down" |
| 2075 |
@click=${()=>this.onMove(m,1)} |
| 2076 |
> |
| 2077 |
<os-icon name="arrow-down-alt2" size="14"></os-icon> |
| 2078 |
</button> |
| 2079 |
</div>`:null} |
| 2080 |
<div class="os-repeater__content"> |
| 2081 |
<slot name="row-${m}"></slot> |
| 2082 |
</div> |
| 2083 |
<button |
| 2084 |
type="button" |
| 2085 |
class="os-repeater__remove" |
| 2086 |
?disabled=${t||!h} |
| 2087 |
aria-label="Remove ${n}" |
| 2088 |
@click=${()=>this.onRemove(m)} |
| 2089 |
> |
| 2090 |
<os-icon name="trash" size="14"></os-icon> |
| 2091 |
</button> |
| 2092 |
</div> |
| 2093 |
`)} |
| 2094 |
</div> |
| 2095 |
<div class="os-repeater__footer"> |
| 2096 |
<os-button |
| 2097 |
variant="secondary" |
| 2098 |
size="small" |
| 2099 |
?disabled=${t||!p} |
| 2100 |
@click=${this.onAdd} |
| 2101 |
>${r}</os-button |
| 2102 |
> |
| 2103 |
<slot name="footer"></slot> |
| 2104 |
</div> |
| 2105 |
`}};It.props=["add-label","empty-text","disabled","reorderable","min","max","row-label"],It.styles=[Cu],It.help=void 0;let Zo=It;$("os-repeater",Zo);const Su=w`:host{--_bg:var( --os-ui-token-field-bg,var( --os-ui-field-bg,#fff ) );--_border:var( --os-ui-token-field-border,var( --os-ui-field-border,#8c8f94 ) );--_fg:var( --os-ui-token-field-fg,var( --os-ui-field-fg,#2c3338 ) );--_chip-bg:var( --os-ui-token-field-chip-bg,var( --os-ui-surface-raised,rgba( 0,0,0,0.06 ) ) );display:block;position:relative}:host( [ hidden ] ){display:none}.os-token-field{display:flex;flex-direction:column;gap:6px}.os-token-field__label{font-size:13px;font-weight:500;color:var( --os-ui-fg,#1d2327 )}.os-token-field__input{box-sizing:border-box;width:100%;padding:6px 8px;border-radius:4px;background:var( --_bg );border:1px solid var( --_border );color:var( --_fg );font:inherit;resize:vertical}.os-token-field__input:focus-visible{outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:1px}.os-token-field__input:disabled{opacity:0.6}.os-token-field__toolbar{display:flex;align-items:center;gap:6px}.os-token-field__catalogue{position:absolute;inset-inline-start:0;inset-block-start:100%;z-index:20;max-height:18rem;overflow-y:auto;width:100%;padding:4px;box-sizing:border-box;border:1px solid var( --os-ui-border,#dcdcde );border-radius:6px;background:var( --os-ui-surface-elevated,#fff );box-shadow:0 8px 24px rgba( 0,0,0,0.18 )}.os-token-field__group{margin:6px 6px 2px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.04em;color:var( --os-ui-fg-faint,#8c8f94 )}.os-token-field__option{display:grid;grid-template-columns:minmax( 0,1fr ) auto;gap:2px 8px;width:100%;padding:6px 8px;border:0;border-radius:4px;background:transparent;color:var( --os-ui-fg,#1d2327 );font:inherit;text-align:start;cursor:pointer}.os-token-field__option:hover,.os-token-field__option:focus-visible{background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) );outline:none}.os-token-field__option-label{font-size:13px;min-width:0}.os-token-field__option-token{grid-column:2;grid-row:1;padding:1px 5px;border-radius:3px;background:var( --_chip-bg );font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;color:var( --os-ui-fg-muted,#646970 )}.os-token-field__option-sample,.os-token-field__option-description{grid-column:1 / -1;font-size:11px;color:var( --os-ui-fg-muted,#646970 )}.os-token-field__option-sample{font-style:italic}.os-token-field__hint{margin:0;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-token-field__preview{display:flex;gap:6px;margin:0;font-size:12px;line-height:1.4;color:var( --os-ui-fg-muted,#646970 )}.os-token-field__preview-label{flex:0 0 auto;font-weight:600}.os-token-field__preview-body{min-width:0;overflow-wrap:anywhere;white-space:pre-wrap}`,Mt=class Mt extends k{constructor(){super(...arguments),this._tokens=[],this._value="",this.caret=null,this.onInput=e=>{const t=e.target;this._value=t.value,this.emit("os-token-field-input",{value:this._value}),this.requestUpdate()},this.rememberCaret=()=>{const e=this.field;e&&(this.caret={start:e.selectionStart??e.value.length,end:e.selectionEnd??e.value.length})},this.toggleCatalogue=()=>{if(!(this.hasAttribute("disabled")||this.hasAttribute("readonly"))){if(this.isOpen){this.removeAttribute("open");return}this.rememberCaret(),this.setAttribute("open","")}},this.onKeydown=e=>{e.key==="Escape"&&this.isOpen&&(e.stopPropagation(),this.removeAttribute("open"),this.field?.focus())}}get tokens(){return this._tokens}set tokens(e){this._tokens=Array.isArray(e)?[...e]:[],this.requestUpdate()}get value(){return this._value}set value(e){this._value=typeof e=="string"?e:"";const t=this.field;t&&t.value!==this._value&&(t.value=this._value),this.requestUpdate()}get field(){return this.shadowRoot?.querySelector(".os-token-field__input")??null}get isOpen(){return this.hasAttribute("open")}grouped(){const e=new Map;for(const t of this._tokens){const o=t.group??"",i=e.get(o);i?i.push(t):e.set(o,[t])}return[...e.entries()].sort((t,o)=>t[0]===""?1:o[0]===""?-1:0)}preview(){let e=this._value,t=!1;for(const o of this._tokens)!o.sample||!e.includes(o.token)||(e=e.split(o.token).join(o.sample),t=!0);return t?e:null}insert(e){const t=this.field,o=this.caret??{start:this._value.length,end:this._value.length},i=this._value.slice(0,o.start),n=this._value.slice(o.end);this._value=`${i}${e.token}${n}`,this.removeAttribute("open"),t&&(t.value=this._value),this.emit("os-token-insert",{token:e.token,value:this._value}),this.emit("os-token-field-input",{value:this._value}),this.requestUpdate();const r=i.length+e.token.length;this.caret={start:r,end:r},queueMicrotask(()=>{const a=this.field;a?.focus(),a?.setSelectionRange?.(r,r)})}render(){const e=this.label||"",t=this.hint||"",o=this.placeholder||"",i=this,n=i["insert-label"]||"Insert a value",r=i["preview-label"]||"Reads as",a=this.hasAttribute("multiline"),l=this.hasAttribute("disabled"),u=this.hasAttribute("readonly"),h=Number(this.getAttribute("rows"))||4,p=this.preview(),m=this.grouped(),_=a?c`<textarea |
| 2106 |
class="os-token-field__input" |
| 2107 |
rows=${h} |
| 2108 |
placeholder=${o} |
| 2109 |
?disabled=${l} |
| 2110 |
?readonly=${u} |
| 2111 |
.value=${this._value} |
| 2112 |
@input=${this.onInput} |
| 2113 |
@keyup=${this.rememberCaret} |
| 2114 |
@click=${this.rememberCaret} |
| 2115 |
@blur=${this.rememberCaret} |
| 2116 |
></textarea>`:c`<input |
| 2117 |
type="text" |
| 2118 |
class="os-token-field__input" |
| 2119 |
placeholder=${o} |
| 2120 |
?disabled=${l} |
| 2121 |
?readonly=${u} |
| 2122 |
.value=${this._value} |
| 2123 |
@input=${this.onInput} |
| 2124 |
@keyup=${this.rememberCaret} |
| 2125 |
@click=${this.rememberCaret} |
| 2126 |
@blur=${this.rememberCaret} |
| 2127 |
/>`;return c` |
| 2128 |
<div class="os-token-field" @keydown=${this.onKeydown}> |
| 2129 |
${e?c`<span class="os-token-field__label">${e}</span>`:null} |
| 2130 |
${_} |
| 2131 |
<div class="os-token-field__toolbar"> |
| 2132 |
<os-button |
| 2133 |
variant="ghost" |
| 2134 |
size="small" |
| 2135 |
?disabled=${l||u||m.length===0} |
| 2136 |
aria-expanded=${this.isOpen?"true":"false"} |
| 2137 |
@click=${this.toggleCatalogue} |
| 2138 |
> |
| 2139 |
<os-icon name="editor-code" size="14"></os-icon> |
| 2140 |
${n} |
| 2141 |
</os-button> |
| 2142 |
<slot name="action"></slot> |
| 2143 |
</div> |
| 2144 |
${this.isOpen?c`<div |
| 2145 |
class="os-token-field__catalogue" |
| 2146 |
role="listbox" |
| 2147 |
aria-label=${n} |
| 2148 |
> |
| 2149 |
${m.map(([b,y])=>c` |
| 2150 |
${b?c`<p class="os-token-field__group">${b}</p>`:null} |
| 2151 |
${y.map(v=>c` |
| 2152 |
<button |
| 2153 |
type="button" |
| 2154 |
role="option" |
| 2155 |
class="os-token-field__option" |
| 2156 |
@click=${()=>this.insert(v)} |
| 2157 |
> |
| 2158 |
<span class="os-token-field__option-label" |
| 2159 |
>${v.label}</span |
| 2160 |
> |
| 2161 |
<code class="os-token-field__option-token" |
| 2162 |
>${v.token}</code |
| 2163 |
> |
| 2164 |
${v.sample?c`<span class="os-token-field__option-sample" |
| 2165 |
>${v.sample}</span |
| 2166 |
>`:null} |
| 2167 |
${v.description?c`<span |
| 2168 |
class="os-token-field__option-description" |
| 2169 |
>${v.description}</span |
| 2170 |
>`:null} |
| 2171 |
</button> |
| 2172 |
`)} |
| 2173 |
`)} |
| 2174 |
</div>`:null} |
| 2175 |
${t?c`<p class="os-token-field__hint">${t}</p>`:null} |
| 2176 |
${p!==null?c`<p class="os-token-field__preview"> |
| 2177 |
<span class="os-token-field__preview-label" |
| 2178 |
>${r}</span |
| 2179 |
> |
| 2180 |
<span class="os-token-field__preview-body">${p}</span> |
| 2181 |
</p>`:null} |
| 2182 |
</div> |
| 2183 |
`}};Mt.props=["label","placeholder","hint","multiline","rows","disabled","readonly","insert-label","preview-label","open"],Mt.styles=[Su],Mt.help=void 0;let Yo=Mt;$("os-token-field",Yo);const Eu=["os-section","os-button","os-swatch","os-swatch-grid","os-segmented","os-segment","os-select","os-option","os-multiselect","os-color-field","os-range-field","os-text-field","os-number-field","os-checkbox","os-checkbox-label","os-switch","os-toast","os-toast-container","os-tabs","os-tab","os-tabpanel","os-window-button","os-menu","os-menu-item","os-context-menu","os-context-menu-option","os-confirm-dialog","os-modal","os-user-search","os-role-picker","os-flyout","os-tab-chip","os-stack","os-cluster","os-icon","os-body","os-panel","os-row","os-grid","os-display","os-empty-state","os-key","os-code","os-badge","os-ribbon","os-tile","os-log","os-steps","os-step","os-table","os-spinner","os-relative-time","os-avatar","os-textarea","os-chip","os-tag-input","os-form","os-save-status","os-category-picker","os-crumb-chain","os-card","os-rating-summary","os-notice","os-progress-bar","os-field-row","os-repeater","os-token-field"];function Lu(s,e,t,o){const i=[s,e,...o];if(t){i.push(t.summary??"",t.status??"");const n=[t.props,t.slots,t.events,t.parts,t.cssProps];for(const r of n)for(const a of r??[]){const l=a;i.push(l.name??"",l.description??"")}}return i.join(" ").toLowerCase()}function Ru(s,e){const t=e.toLowerCase().split(/\s+/).filter(Boolean);return t.length?t.every(o=>s.haystack.includes(o)):!0}function Tu(s,e){const t=e?.help?.exampleInit,o=s.querySelector(".os-settings__help-example");if(!(!t||!o)){customElements.upgrade(o);try{t(o)}catch(i){console.error(`[openstation] <${e?.tag}> exampleInit threw:`,i)}}}let br=!1;function Pu(){if(br)return;br=!0;const s=["background: #ffb400","color: #1a1a1a","font-weight: 700","font-size: 12px","padding: 4px 8px","border-radius: 3px"].join(";"),e=["color: #b25c00","font-weight: 500"].join(";");console.log(`%c⚠ wp.os — INTENTIONAL DEMO%c |
| 2184 |
The next three console.error entries are fired ON PURPOSE by the |
| 2185 |
OpenStation Preferences → Components tab to demonstrate the <os-*> missing- |
| 2186 |
import warner. They are not real bugs. |
| 2187 |
|
| 2188 |
1. <os-example-console-fail-due-to-unregistered-component> |
| 2189 |
2. <os-buton> (typo of <os-button>) |
| 2190 |
3. <os-totally-made-up-thing> |
| 2191 |
|
| 2192 |
Source: src/settings/sections/help.ts — the "Missing-import |
| 2193 |
warner — live demo" section. Remove that section in your fork |
| 2194 |
if you want a quieter Components tab.`,s,e)}function zu(s){const e=Fu(),t=document.createElement("div");t.classList.add("os-settings__help");let o=e[0]?.tag??"",i="",n="";const r=()=>{s.state.developerModeEnabled&&Pu();const l=e.filter(p=>Ru(p,i)),u=l.find(p=>p.tag===o)??l[0];L(c` |
| 2195 |
<!-- |
| 2196 |
No intro card. The page header above already names the |
| 2197 |
tab and says what it is, and a count of how many |
| 2198 |
components are registered answered a question nobody |
| 2199 |
asked while costing the two panes the height they |
| 2200 |
actually need. This tab is the list; it starts at the |
| 2201 |
list. |
| 2202 |
--> |
| 2203 |
${s.state.developerModeEnabled?c` |
| 2204 |
<os-section |
| 2205 |
heading=${d("Missing-import warner — live demo")} |
| 2206 |
description=${d('The three <os-*> tags below are intentionally bogus. Open the browser console: within ~2 seconds you should see three console.error entries from the framework, each pointing the developer at the fix (typo with "did you mean", and unknown tags). The tags are kept off-screen so they do not affect layout. Remove this section in your fork if you want a quieter Components tab.')} |
| 2207 |
> |
| 2208 |
<div |
| 2209 |
class="os-settings__help-warner-demo" |
| 2210 |
aria-hidden="true" |
| 2211 |
style="position:absolute;width:0;height:0;overflow:hidden;clip:rect(0 0 0 0);" |
| 2212 |
> |
| 2213 |
<!-- |
| 2214 |
Case 1 — invented name, nothing close in the registry. |
| 2215 |
Triggers the "no component by that name exists" branch. |
| 2216 |
--> |
| 2217 |
<os-example-console-fail-due-to-unregistered-component></os-example-console-fail-due-to-unregistered-component> |
| 2218 |
|
| 2219 |
<!-- |
| 2220 |
Case 2 — typo within Levenshtein distance of a real tag. |
| 2221 |
Triggers the "Did you mean <os-button>?" branch. |
| 2222 |
--> |
| 2223 |
<os-buton></os-buton> |
| 2224 |
|
| 2225 |
<!-- |
| 2226 |
Case 3 — looks plausible but is not in the registry. |
| 2227 |
Triggers the unknown-tag branch with no suggestion. |
| 2228 |
--> |
| 2229 |
<os-totally-made-up-thing></os-totally-made-up-thing> |
| 2230 |
</div> |
| 2231 |
</os-section> |
| 2232 |
`:""} |
| 2233 |
|
| 2234 |
<div class="os-settings__help-layout"> |
| 2235 |
<div class="os-settings__help-sidebar"> |
| 2236 |
<os-text-field |
| 2237 |
class="os-settings__help-search" |
| 2238 |
type="search" |
| 2239 |
label=${d("Search components")} |
| 2240 |
placeholder=${d("Name, tag, prop, event…")} |
| 2241 |
autocomplete="off" |
| 2242 |
value=${i} |
| 2243 |
@os-input-change=${p=>{i=(p.detail?.value??"").trim(),r()}} |
| 2244 |
></os-text-field> |
| 2245 |
<nav |
| 2246 |
class="os-settings__help-nav" |
| 2247 |
aria-label=${d("Components")} |
| 2248 |
> |
| 2249 |
${l.length?"":c`<p |
| 2250 |
class="os-settings__help-nav-empty" |
| 2251 |
> |
| 2252 |
${d("No components match.")} |
| 2253 |
</p>`} |
| 2254 |
${l.map(p=>c` |
| 2255 |
<button |
| 2256 |
type="button" |
| 2257 |
class=${mr("os-settings__help-nav-item",p.tag===(u?.tag??"")?"is-active":"")} |
| 2258 |
aria-pressed=${p.tag===(u?.tag??"")?"true":"false"} |
| 2259 |
@click=${()=>{o=p.tag,r()}} |
| 2260 |
> |
| 2261 |
<span class="os-settings__help-nav-title" |
| 2262 |
>${p.title}</span |
| 2263 |
> |
| 2264 |
<span class="os-settings__help-nav-tag" |
| 2265 |
><${p.tag}></span |
| 2266 |
> |
| 2267 |
</button> |
| 2268 |
`)} |
| 2269 |
</nav> |
| 2270 |
</div> |
| 2271 |
<div class="os-settings__help-detail"> |
| 2272 |
${u?Iu(u):Uu()} |
| 2273 |
</div> |
| 2274 |
</div> |
| 2275 |
`,t);const h=t.querySelector(".os-settings__help-detail");h&&(u?.tag??"")!==n&&(h.scrollTop=0),n=u?.tag??"",Tu(t,u)};r();const a=window.wp?.os;if(a?.subscribeOsSettings){const l=a.subscribeOsSettings(()=>{if(!t.isConnected){l();return}r()})}return t}function Iu(s){const e=s.help,t=e?.status??"stable";return c` |
| 2276 |
<header class="os-settings__help-head"> |
| 2277 |
<h3 class="os-settings__help-title">${s.title}</h3> |
| 2278 |
<code class="os-settings__help-code" |
| 2279 |
><${s.tag}></code |
| 2280 |
> |
| 2281 |
<span |
| 2282 |
class=${mr("os-settings__help-badge",`is-${t}`)} |
| 2283 |
>${ju(t)}</span |
| 2284 |
> |
| 2285 |
</header> |
| 2286 |
|
| 2287 |
${e?.summary?c`<p class="os-settings__help-summary"> |
| 2288 |
${e.summary} |
| 2289 |
</p>`:c``} |
| 2290 |
|
| 2291 |
${e?.example?c` |
| 2292 |
<section class="os-settings__help-group"> |
| 2293 |
<h4>${d("Example")}</h4> |
| 2294 |
<div class="os-settings__help-example"> |
| 2295 |
${e.example} |
| 2296 |
</div> |
| 2297 |
</section> |
| 2298 |
`:c``} |
| 2299 |
${Mu(s,e)} ${Du(e)} |
| 2300 |
${Nu(e)} ${Hu(e)} |
| 2301 |
${qu(e)} |
| 2302 |
${e?c``:c`<p class="os-settings__help-note"> |
| 2303 |
${d("This component has no help descriptor yet. Add `static help` to its class for a fuller reference.")} |
| 2304 |
</p>`} |
| 2305 |
`}function Mu(s,e){const t=e?.props??[],o=new Set(t.map(n=>n.name)),i=s.props.filter(n=>!o.has(n));return t.length===0&&i.length===0?c``:c` |
| 2306 |
<section class="os-settings__help-group"> |
| 2307 |
<h4>${d("Props")}</h4> |
| 2308 |
<table class="os-settings__help-table"> |
| 2309 |
<thead> |
| 2310 |
<tr> |
| 2311 |
<th>${d("Name")}</th> |
| 2312 |
<th>${d("Type")}</th> |
| 2313 |
<th>${d("Default")}</th> |
| 2314 |
<th>${d("Description")}</th> |
| 2315 |
</tr> |
| 2316 |
</thead> |
| 2317 |
<tbody> |
| 2318 |
${t.map(n=>c` |
| 2319 |
<tr> |
| 2320 |
<td><code>${n.name}</code></td> |
| 2321 |
<td>${n.type??"—"}</td> |
| 2322 |
<td>${n.default??"—"}</td> |
| 2323 |
<td>${n.description??""}</td> |
| 2324 |
</tr> |
| 2325 |
`)} |
| 2326 |
${i.map(n=>c` |
| 2327 |
<tr> |
| 2328 |
<td><code>${n}</code></td> |
| 2329 |
<td>—</td> |
| 2330 |
<td>—</td> |
| 2331 |
<td> |
| 2332 |
<em |
| 2333 |
>${d("Undocumented — declared via static props.")}</em |
| 2334 |
> |
| 2335 |
</td> |
| 2336 |
</tr> |
| 2337 |
`)} |
| 2338 |
</tbody> |
| 2339 |
</table> |
| 2340 |
</section> |
| 2341 |
`}function Du(s){return s?.slots?.length?c` |
| 2342 |
<section class="os-settings__help-group"> |
| 2343 |
<h4>${d("Slots")}</h4> |
| 2344 |
<ul class="os-settings__help-list"> |
| 2345 |
${s.slots.map(e=>c` |
| 2346 |
<li> |
| 2347 |
<code>${e.name}</code> |
| 2348 |
${e.description?c` — ${e.description}`:c``} |
| 2349 |
</li> |
| 2350 |
`)} |
| 2351 |
</ul> |
| 2352 |
</section> |
| 2353 |
`:c``}function Nu(s){return s?.events?.length?c` |
| 2354 |
<section class="os-settings__help-group"> |
| 2355 |
<h4>${d("Events")}</h4> |
| 2356 |
<ul class="os-settings__help-list"> |
| 2357 |
${s.events.map(e=>c` |
| 2358 |
<li> |
| 2359 |
<code>${e.name}</code> |
| 2360 |
${e.detail?c` — <code>${e.detail}</code>`:c``} |
| 2361 |
${e.description?c` — ${e.description}`:c``} |
| 2362 |
</li> |
| 2363 |
`)} |
| 2364 |
</ul> |
| 2365 |
</section> |
| 2366 |
`:c``}function Hu(s){return s?.parts?.length?c` |
| 2367 |
<section class="os-settings__help-group"> |
| 2368 |
<h4>${d("Shadow parts")}</h4> |
| 2369 |
<ul class="os-settings__help-list"> |
| 2370 |
${s.parts.map(e=>c` |
| 2371 |
<li> |
| 2372 |
<code>::part(${e.name})</code> |
| 2373 |
${e.description?c` — ${e.description}`:c``} |
| 2374 |
</li> |
| 2375 |
`)} |
| 2376 |
</ul> |
| 2377 |
</section> |
| 2378 |
`:c``}function qu(s){return s?.cssProps?.length?c` |
| 2379 |
<section class="os-settings__help-group"> |
| 2380 |
<h4>${d("CSS custom properties")}</h4> |
| 2381 |
<ul class="os-settings__help-list"> |
| 2382 |
${s.cssProps.map(e=>c` |
| 2383 |
<li> |
| 2384 |
<code>${e.name}</code> |
| 2385 |
${e.default?c` |
| 2386 |
(${d("default")} |
| 2387 |
<code>${e.default}</code>) |
| 2388 |
`:c``} |
| 2389 |
${e.description?c` — ${e.description}`:c``} |
| 2390 |
</li> |
| 2391 |
`)} |
| 2392 |
</ul> |
| 2393 |
</section> |
| 2394 |
`:c``}function Uu(){return c`<p>${d("No components registered.")}</p>`}function Fu(){const s=[];for(const e of Eu){const t=customElements.get(e);if(!t)continue;const o=t.help??null,i=o?.title??Wu(e),n=t.props??[];s.push({tag:e,title:i,help:o,props:n,haystack:Lu(e,i,o,n)})}return s.sort((e,t)=>e.title.localeCompare(t.title)),s}function Wu(s){const e=s.replace(/^os-/,"").replace(/-/g," ");return e.charAt(0).toUpperCase()+e.slice(1)}function ju(s){switch(s){case"experimental":return d("Experimental");case"planned":return d("Planned");case"stable":default:return d("Stable")}}function mr(...s){return s.filter(Boolean).join(" ")}const vr=K("desktop-mode/wallpaper-registry",()=>({seed:[],listeners:new Set})),de=vr.state.seed,Jo=vr.state.listeners;function Qo(s){qs("Wallpaper",Yi(s,wr),s);const e=de.findIndex(t=>t.id===s.id);e>=0?de[e]=s:de.push(s),_r()}function Vu(s){const e=de.findIndex(t=>t.id===s);e>=0&&(de.splice(e,1),_r())}function Ou(s){return Jo.add(s),()=>{Jo.delete(s)}}function _r(){const s=Array.from(Jo);for(const e of s)try{e()}catch(t){typeof console<"u"&&console.error("[openstation] wallpaper registry listener threw:",t)}}function yr(){const s=de.slice(),e=Q(F.WALLPAPERS,s);return Array.isArray(e)?e.filter(Ku):(typeof console<"u"&&console.warn("[openstation] `os.wallpapers` filter returned a non-array; falling back to seed list."),s)}function ue(s){return yr().find(e=>e.id===s)}const wr=[{field:"id",message:"missing or not a non-empty string",valid:s=>typeof s.id=="string"&&s.id!==""},{field:"label",message:"missing or not a non-empty string",valid:s=>typeof s.label=="string"&&s.label!==""},{field:"preview",message:"missing or not a non-empty string",valid:s=>typeof s.preview=="string"&&s.preview!==""},{field:"type",message:'must be "css" or "canvas"',valid:s=>s.type==="css"||s.type==="canvas"},{field:"value/resolveValue/mount",message:"css types need `value` or `resolveValue`; canvas types need `mount`",valid:s=>s.type==="css"?typeof s.value=="string"||typeof s.resolveValue=="function":s.type==="canvas"?typeof s.mount=="function":!0}];function Ku(s){return Yi(s,wr).length===0}const he=K("desktop-mode/wallpaper-lazy",()=>({pending:new Map,inflight:new Map}));function Bu(s){he.state.pending.delete(s)}function Gu(s){return(window.openStationWallpapers||{})[s]??null}function Xu(s){const e=he.state.inflight.get(s);if(e)return e;const t=he.state.pending.get(s);if(!t)return Promise.resolve(null);const o=(async()=>{try{await Sc(t.scriptUrl,{translations:t.scriptTranslations,l10n:t.scriptL10n,before:t.scriptBefore,after:t.scriptAfter})}catch(n){return re(F.SHELL_ERROR,{scope:"wallpaper-script-load",id:t.id,error:n}),null}let i=Gu(t.id);if(i&&!i.description&&t.description&&(i={...i,description:t.description}),!i)return re(F.SHELL_ERROR,{scope:"wallpaper-missing-def",id:t.id,error:new Error(`[openstation] No wallpaper def on window.openStationWallpapers["${t.id}"]. Script loaded but didn't publish a def — check the plugin's enqueue + global assignment.`)}),null;try{Qo(i)}catch(n){return re(F.SHELL_ERROR,{scope:"wallpaper-register",id:t.id,error:n}),null}return Bu(t.id),i})().finally(()=>{he.state.inflight.delete(s)});return he.state.inflight.set(s,o),o}async function Zu(){const s=Array.from(he.state.pending.keys());s.length!==0&&await Promise.all(s.map(e=>Xu(e)))}const xr=K("desktop-mode/wallpaper-settings",()=>({values:{}}));function ei(s){return{...xr.state.values[s]??{}}}function Yu(s,e){xr.state.values[s]={...e},re(F.WALLPAPER_SETTINGS_CHANGED,{id:s,settings:{...e}})}async function Ju(s,e,t,o){const i=new URL(s.mediaUrl);i.searchParams.set("media_type","image"),i.searchParams.set("per_page",String(za)),i.searchParams.set("page",String(e)),i.searchParams.set("orderby","date"),i.searchParams.set("order","desc"),i.searchParams.set("_fields","id,source_url,alt_text,title,media_details"),t&&i.searchParams.set("search",t),o&&(i.searchParams.set("openstation_min_width",String(zs)),i.searchParams.set("openstation_min_height",String(Is)));const n=await O(i.toString(),{credentials:"same-origin",headers:{"X-WP-Nonce":s.restNonce}},{source:"desktop-mode/settings/media"});if(!n.ok){let u=`HTTP ${n.status}`;try{const h=await n.json();h&&typeof h.message=="string"&&(u=h.message)}catch{}throw new Error(u)}const r=n.headers.get("X-WP-TotalPages"),a=r?parseInt(r,10):1;return{items:(await n.json()).filter(Da),totalPages:a||1}}async function Qu(s,e){const t=await O(s.mediaUrl,{method:"POST",credentials:"same-origin",headers:{"X-WP-Nonce":s.restNonce,"Content-Type":e.type,"Content-Disposition":`attachment; filename="${Ma(e.name)}"`},body:e},{source:"desktop-mode/settings/media-upload"});if(!t.ok){let i=`Upload failed (HTTP ${t.status}).`;try{const n=await t.json();n&&typeof n.message=="string"&&(i=n.message)}catch{}throw new Error(i)}const o=await t.json();return{id:o.id,url:o.source_url}}function eh(s,e){const t=[],o=document.createElement("div");o.className="os-settings__tab-pane",s.config.canUpload&&t.push({key:"upload",label:d("Upload new"),render:()=>th(s,o,e)}),t.push({key:"library",label:d("Media Library"),render:()=>sh(s,o,e)});const i=t[0].key,n=a=>{const l=a.detail.value;t.find(u=>u.key===l)?.render()},r=document.createElement("div");return L(c` |
| 2395 |
<div class="os-settings__uploader"> |
| 2396 |
<!-- |
| 2397 |
No heading. "Use your own image" is the dashed tile in |
| 2398 |
the grid above that opens this, and repeating it here |
| 2399 |
names the same thing twice within 40px. |
| 2400 |
--> |
| 2401 |
${t.length>1?c`<os-tabs |
| 2402 |
value=${i} |
| 2403 |
label=${d("Image source")} |
| 2404 |
@os-tab-change=${n} |
| 2405 |
> |
| 2406 |
${t.map(a=>c`<os-tab value=${a.key} |
| 2407 |
>${a.label}</os-tab |
| 2408 |
>`)} |
| 2409 |
</os-tabs>`:null} |
| 2410 |
${o} |
| 2411 |
</div> |
| 2412 |
`,r),t.find(a=>a.key===i)?.render(),r.firstElementChild}function th(s,e,t){const o=document.createElement("div");o.className="os-settings__upload-tile",o.dataset.wallpaperId=V,o.setAttribute("aria-pressed",s.state.wallpaper===V?"true":"false");const i=document.createElement("input");i.type="file",i.accept="image/*",i.className="os-settings__file-input",i.addEventListener("change",()=>{const n=i.files?.[0];n&&kr(s,n,o,t),i.value=""}),L(c`${i}${o}`,e),is(s,o,i,t)}function is(s,e,t,o){e.classList.remove("os-settings__upload-tile--filled"),e.classList.remove("os-settings__upload-tile--dragover"),e.classList.remove("os-settings__upload-tile--busy"),e.removeAttribute("aria-label");const i=!!s.state.customImage;i?(e.classList.add("os-settings__upload-tile--filled"),e.setAttribute("aria-label",d("Custom image wallpaper")),e.style.backgroundImage=`url("${encodeURI(s.state.customImage.url)}")`):(e.style.backgroundImage="",e.setAttribute("aria-label",d("Upload a wallpaper image")));const n=r=>{r.stopPropagation(),s.state.customImage=null,s.state.wallpaper===V&&(s.state.wallpaper=Li),si(s.state),s.save(),s.apply(),is(s,e,t,o),ns(s,o)};L(i?c` |
| 2413 |
<os-button |
| 2414 |
variant="danger" |
| 2415 |
class="os-settings__upload-remove" |
| 2416 |
aria-label=${d("Remove custom image")} |
| 2417 |
@click=${n} |
| 2418 |
>${d("Remove")}</os-button |
| 2419 |
> |
| 2420 |
`:c` |
| 2421 |
<div class="os-settings__upload-inner"> |
| 2422 |
<span |
| 2423 |
class="os-settings__upload-plus" |
| 2424 |
aria-hidden="true" |
| 2425 |
>+</span |
| 2426 |
> |
| 2427 |
<span class="os-settings__upload-prompt" |
| 2428 |
>${d("Drop an image here, or click to upload")}</span |
| 2429 |
> |
| 2430 |
<span class="os-settings__upload-hint" |
| 2431 |
>${d("JPEG, PNG, or WebP · goes straight to your Media Library")}</span |
| 2432 |
> |
| 2433 |
</div> |
| 2434 |
`,e),e.onclick=()=>{if(!e.classList.contains("os-settings__upload-tile--busy")){if(s.state.customImage){Er(s,V,o);return}t.click()}},e.ondragover=r=>{r.preventDefault(),e.classList.add("os-settings__upload-tile--dragover")},e.ondragleave=()=>{e.classList.remove("os-settings__upload-tile--dragover")},e.ondrop=r=>{r.preventDefault(),e.classList.remove("os-settings__upload-tile--dragover");const a=r.dataTransfer?.files?.[0];a&&kr(s,a,e,o)}}async function kr(s,e,t,o){if(!e.type.startsWith("image/")){$r(t,d("That file isn’t an image."));return}t.classList.add("os-settings__upload-tile--busy"),L(c`<span class="os-settings__upload-status" |
| 2435 |
>${d("Uploading…")}</span |
| 2436 |
>`,t);const i=t.parentElement?.querySelector(".os-settings__file-input");try{const n=await Qu(s.config,e);s.state.customImage={id:n.id,url:n.url},s.state.wallpaper=V,si(s.state),s.save(),s.apply(),i&&is(s,t,i,o),ns(s,o)}catch(n){t.classList.remove("os-settings__upload-tile--busy"),i&&is(s,t,i,o);const r=n instanceof Error?n.message:d("Upload failed.");$r(t,r)}}function $r(s,e){let t=s.querySelector(".os-settings__upload-error");t||(t=document.createElement("span"),t.className="os-settings__upload-error",t.setAttribute("role","status"),s.appendChild(t)),t.textContent=e,window.setTimeout(()=>{t?.remove()},4e3)}function sh(s,e,t){const o=document.createElement("input");o.type="search",o.placeholder=d("Search your media"),o.className="os-settings__library-search",o.setAttribute("aria-label",d("Search media"));const i=document.createElement("div");i.className="os-settings__library-grid";const n=document.createElement("span");n.className="os-settings__library-meta";const r=document.createElement("os-button");r.setAttribute("variant","ghost"),r.textContent=d("Load more");let a="",l=0,u=0,h=[],p=0,m=!1;const _=x=>{s.state.libraryHdOnly=x.detail.checked,s.save(),f()};L(c` |
| 2437 |
<div class="os-settings__library"> |
| 2438 |
<div class="os-settings__library-toolbar"> |
| 2439 |
${o} |
| 2440 |
<os-checkbox-label |
| 2441 |
label=${j(d("Only HD (≥%1$d×%2$d)"),zs,Is)} |
| 2442 |
?checked=${s.state.libraryHdOnly} |
| 2443 |
@os-checkbox-change=${_} |
| 2444 |
></os-checkbox-label> |
| 2445 |
</div> |
| 2446 |
${i} |
| 2447 |
<div class="os-settings__library-footer"> |
| 2448 |
${n}${r} |
| 2449 |
</div> |
| 2450 |
</div> |
| 2451 |
`,e);const b=()=>{const x=Ar(s.state,h).length,A=[j(d("Showing %d"),x)];s.state.libraryHdOnly&&p>0&&A.push(j(d("%d hidden by HD filter"),p)),n.textContent=A.join(" · "),r.hidden=l>=u,m?r.setAttribute("disabled",""):r.removeAttribute("disabled")},y=()=>{const x=Ar(s.state,h);if(p=h.length-x.length,x.length===0&&!m)L(c`<p class="os-settings__library-empty"> |
| 2452 |
${s.state.libraryHdOnly?d("No HD images found. Try unchecking the filter, or upload a larger image."):d("No images in your Media Library yet.")} |
| 2453 |
</p>`,i);else{i.innerHTML="";for(const A of x)i.appendChild(oh(s,A,t))}b()},v=async()=>{if(!(m||u>0&&l>=u)){m=!0,b(),l===0&&L(c`${Array.from({length:8},()=>c`<div |
| 2454 |
class="os-settings__library-tile os-settings__library-tile--skeleton" |
| 2455 |
></div>`)}`,i);try{const x=await Ju(s.config,l+1,a,s.state.libraryHdOnly);l=l+1,u=x.totalPages,h=h.concat(x.items),y()}catch(x){L(c`<p class="os-settings__library-error"> |
| 2456 |
${x instanceof Error?j(d("Couldn’t load your media: %s"),x.message):d("Couldn’t load your media.")} |
| 2457 |
</p>`,i)}finally{m=!1,b()}}},f=()=>{l=0,u=0,h=[],p=0,v()};let g=null;o.addEventListener("input",()=>{g!==null&&window.clearTimeout(g),g=window.setTimeout(()=>{g=null,a=o.value.trim(),f()},Ia)}),r.addEventListener("click",()=>{v()}),v()}function Ar(s,e){return s.libraryHdOnly?e.filter(t=>t.media_details.width>=zs&&t.media_details.height>=Is):e}function oh(s,e,t){const o=s.state.wallpaper===V&&s.state.customImage?.id===e.id,i=e.media_details.sizes||{},n=i.medium?.source_url||i.thumbnail?.source_url||i.large?.source_url||e.source_url,r=e.alt_text||Na(e.title?.rendered||"")||`Image #${e.id}`,a=()=>{s.state.customImage={id:e.id,url:e.source_url},s.state.wallpaper=V,si(s.state),s.save(),s.apply(),ns(s,t);const u=l.firstElementChild?.parentElement;u&&u.querySelectorAll("[data-media-id]").forEach(h=>{const p=h.dataset.mediaId===String(e.id);h.setAttribute("aria-pressed",p?"true":"false"),h.classList.toggle("os-settings__library-tile--selected",p)})},l=document.createElement("div");return L(c` |
| 2458 |
<button |
| 2459 |
type="button" |
| 2460 |
class=${o?"os-settings__library-tile os-settings__library-tile--selected":"os-settings__library-tile"} |
| 2461 |
data-media-id=${String(e.id)} |
| 2462 |
aria-pressed=${o?"true":"false"} |
| 2463 |
aria-label=${r} |
| 2464 |
title=${r} |
| 2465 |
style=${`background-image: url("${encodeURI(n)}")`} |
| 2466 |
@click=${a} |
| 2467 |
> |
| 2468 |
<span class="os-settings__library-tile-dims" |
| 2469 |
>${e.media_details.width}×${e.media_details.height}</span |
| 2470 |
> |
| 2471 |
</button> |
| 2472 |
`,l),l.firstElementChild}const ih=4,Cr=24,Sr=4,nh=250,rh="os-settings__wallpaper-live-preview";function ah(s){const e=s.type==="canvas"?s.needs:void 0;if(!e||e.length===0)return Promise.resolve();const t=window.wp?.os;return t?.loadModules?t.loadModules(e):Promise.reject(new Error(`[openstation] Wallpaper "${s.id}" declares needs but wp.os.loadModules is unavailable.`))}function lh(){return window.openStationConfig?.pluginUrl??""}function ch(){return typeof window.matchMedia=="function"&&window.matchMedia("( prefers-reduced-motion: reduce )").matches}function dh(s){const e={...s.previewParams??{}},t=Q(F.WALLPAPER_PREVIEW_PARAMS,e,s.id);return!t||typeof t!="object"?e:t}function uh(s){const e=new Map;let t=!1;const o=()=>{let g=0;return e.forEach(x=>{(x.teardown||x.mounting)&&g++}),g},i=g=>{g.remountTimer!==null&&(clearTimeout(g.remountTimer),g.remountTimer=null)},n=g=>{if(g.generation++,g.mounting=!1,i(g),g.teardown){const x=g.teardown;g.teardown=null;try{x()}catch(A){typeof console<"u"&&console.error(`[openstation] Wallpaper "${g.defId}" preview teardown threw:`,A)}}g.overlay.innerHTML=""},r=g=>{t||!g.visible||g.teardown||g.mounting||_&&(g.tile.clientWidth<Cr||g.tile.clientHeight<Cr)||a(g)},a=g=>{const x=ue(g.defId);if(!x?.renderPreview||o()>=ih)return;const A=++g.generation;g.mounting=!0,g.mountWidth=g.tile.clientWidth,g.mountHeight=g.tile.clientHeight;const M={id:x.id,pluginUrl:lh(),prefersReducedMotion:ch(),visible:!document.hidden,settings:ei(x.id),params:dh(x),width:g.mountWidth,height:g.mountHeight},X=S=>{if(A!==g.generation||t){try{S()}catch{}return}g.mounting=!1,g.teardown=S,l(g)&&u(g)},H=S=>{A===g.generation&&(g.mounting=!1,g.overlay.innerHTML="",typeof console<"u"&&console.error(`[openstation] Wallpaper "${x.id}" renderPreview failed:`,S))};ah(x).then(()=>{if(A!==g.generation||t)return;let S;try{S=x.renderPreview(g.overlay,M)}catch(Y){H(Y);return}if(Ds(S)){S.then(X,H);return}X(S)},H)},l=g=>Math.abs(g.tile.clientWidth-g.mountWidth)>Sr||Math.abs(g.tile.clientHeight-g.mountHeight)>Sr,u=g=>{i(g),g.remountTimer=setTimeout(()=>{g.remountTimer=null,!(t||!g.teardown||!l(g))&&(n(g),r(g))},nh)},h=g=>{for(const x of g){const A=e.get(x.target);A&&(A.visible=x.isIntersecting,x.isIntersecting?r(A):n(A))}},p=typeof IntersectionObserver=="function"?new IntersectionObserver(h,{threshold:.1}):null,m=g=>{for(const x of g){const A=e.get(x.target);!A||t||(!A.teardown&&!A.mounting?r(A):A.teardown&&l(A)&&u(A))}},_=typeof ResizeObserver=="function"?new ResizeObserver(m):null,b=g=>{n(g),p?.unobserve(g.tile),_?.unobserve(g.tile),g.overlay.remove(),e.delete(g.tile)},y=()=>{if(t)return;const g=s.querySelectorAll("os-swatch[data-wallpaper-id]"),x=new Set;g.forEach(A=>{x.add(A);const M=A.dataset.wallpaperId??"",H=!!ue(M)?.renderPreview&&!!p,S=e.get(A);if(S&&(S.defId!==M||!H)&&b(S),!H||e.has(A))return;const Y=document.createElement("div");Y.className=rh,Y.setAttribute("aria-hidden","true"),A.appendChild(Y),e.set(A,{tile:A,overlay:Y,defId:M,generation:0,teardown:null,mounting:!1,visible:!1,mountWidth:0,mountHeight:0,remountTimer:null}),p.observe(A),_?.observe(A)}),e.forEach((A,M)=>{x.has(M)||b(A)})},v=()=>{t||(t=!0,e.forEach(g=>n(g)),e.clear(),p?.disconnect(),_?.disconnect(),document.removeEventListener("os-window-closed",f))},f=()=>{s.isConnected||v()};return document.addEventListener("os-window-closed",f),{sync:y,dispose:v}}function ti(s){const{from:e,to:t,angle:o}=s.customGradient;return`linear-gradient(${o}deg, ${e}, ${t})`}const hh=()=>d("Mix your own two-colour gradient and set the angle — your desk, your palette.");function ph(s){Qo({id:jt,label:d("Custom gradient"),type:"css",preview:ti(s.state),description:hh(),resolveValue:()=>ti(s.state),renderEditor:e=>gh(s,e)})}function si(s){if(!s.customImage){Vu(V);return}const t=`url("${encodeURI(s.customImage.url)}") center/cover no-repeat, #1d2327`;Qo({id:V,label:d("Custom image"),type:"css",value:t,preview:t,description:d("Any image from your media library or an upload, sized to cover the whole desk.")})}function Er(s,e,t){s.state.wallpaper=e,s.save(),s.apply(),ns(s,t);const o=t.querySelector(".os-settings__wallpaper-config-slot");o&&oi(s,o)}function oi(s,e){const t=e.firstElementChild;if(!t)return;const o=ue(s.state.wallpaper);if(!o||typeof o.renderConfig!="function"){e.dataset.expanded="false",e.style.marginTop="";return}e.style.marginTop="12px",L(c` |
| 2473 |
<div class="os-settings__wallpaper-config"> |
| 2474 |
<os-button |
| 2475 |
variant="secondary" |
| 2476 |
@click=${()=>fh(s,o)} |
| 2477 |
> |
| 2478 |
<os-icon name="admin-generic"></os-icon> |
| 2479 |
${d("Wallpaper settings")} |
| 2480 |
</os-button> |
| 2481 |
</div> |
| 2482 |
`,t),e.dataset.expanded="true"}function fh(s,e){if(typeof e.renderConfig!="function")return;const t=document.createElement("os-modal");t.setAttribute("size","sm"),t.setAttribute("title",j(d("%s settings"),e.label));const o=document.createElement("div");o.className="os-settings__wallpaper-config-form",o.style.display="flex",o.style.flexDirection="column",o.style.gap="14px",t.appendChild(o);const i=document.createElement("os-button");i.setAttribute("slot","footer"),i.setAttribute("variant","primary"),i.textContent=d("Done"),t.appendChild(i);let n=null,r=!1;const a=()=>{if(!r){if(r=!0,n){try{n()}catch(u){typeof console<"u"&&console.error(`[openstation] Wallpaper "${e.id}" config teardown threw:`,u)}n=null}t.remove()}};i.addEventListener("click",a),t.addEventListener("os-modal-cancel",a);const l={id:e.id,pluginUrl:"",prefersReducedMotion:typeof window.matchMedia=="function"&&window.matchMedia("( prefers-reduced-motion: reduce )").matches,visible:!document.hidden,settings:ei(e.id),setSettings:u=>{const h={...s.state.wallpaperSettings[e.id]??{},...u};s.state.wallpaperSettings[e.id]=h,s.save(),Yu(e.id,h)}};document.body.appendChild(t),t.setAttribute("open","");try{const u=e.renderConfig(o,l);Ds(u)?u.then(h=>{if(r){try{h()}catch{}return}n=h}):n=u}catch(u){typeof console<"u"&&console.error(`[openstation] Wallpaper "${e.id}" renderConfig threw:`,u),a()}}function ns(s,e){e.querySelectorAll("[data-wallpaper-id]").forEach(t=>{const o=t.dataset.wallpaperId===s.state.wallpaper;o?t.setAttribute("selected",""):t.removeAttribute("selected"),t.setAttribute("aria-pressed",o?"true":"false")})}function ii(s,e,t){Lr(s);const o=document.createElement("div");if(o.className="os-settings__editor-slot-inner",e.textContent="",e.appendChild(o),!t.renderEditor){e.dataset.expanded="false";return}const i={id:t.id,pluginUrl:"",prefersReducedMotion:typeof window.matchMedia=="function"&&window.matchMedia("( prefers-reduced-motion: reduce )").matches,visible:!document.hidden,settings:ei(t.id)};try{const n=t.renderEditor(o,i);Ds(n)?n.then(r=>{s.activeEditorTeardown=r}):s.activeEditorTeardown=n}catch(n){typeof console<"u"&&console.error(`[openstation] Wallpaper "${t.id}" renderEditor threw:`,n)}e.dataset.expanded="true"}function Lr(s){if(s.activeEditorTeardown){try{s.activeEditorTeardown()}catch(e){typeof console<"u"&&console.error("[openstation] Wallpaper editor teardown threw:",e)}s.activeEditorTeardown=null}}function gh(s,e){e.classList.add("os-settings__gradient-editor-inner");const t=a=>{s.state.customGradient.from=a.detail.value,n()},o=a=>{s.state.customGradient.to=a.detail.value,n()},i=a=>{s.state.customGradient.angle=a.detail.value,n()},n=()=>{s.save(),s.apply(),bh(s,e),r()},r=()=>L(c` |
| 2483 |
<div class="os-settings__gradient-row"> |
| 2484 |
<os-color-field |
| 2485 |
variant="block" |
| 2486 |
label=${d("From")} |
| 2487 |
value=${s.state.customGradient.from} |
| 2488 |
@os-color-change=${t} |
| 2489 |
></os-color-field> |
| 2490 |
<os-color-field |
| 2491 |
variant="block" |
| 2492 |
label=${d("To")} |
| 2493 |
value=${s.state.customGradient.to} |
| 2494 |
@os-color-change=${o} |
| 2495 |
></os-color-field> |
| 2496 |
</div> |
| 2497 |
<os-range-field |
| 2498 |
label=${d("Angle")} |
| 2499 |
min="0" |
| 2500 |
max="360" |
| 2501 |
step="1" |
| 2502 |
suffix="°" |
| 2503 |
value=${String(s.state.customGradient.angle)} |
| 2504 |
@os-range-change=${i} |
| 2505 |
></os-range-field> |
| 2506 |
`,e);return r(),()=>{}}function bh(s,e){const o=e.closest("os-section")?.querySelector(`[data-wallpaper-id="${jt}"]`);o&&(o.style.background=ti(s.state))}let Rr=null;function mh(s,e){const t=document.createElement("div");t.className="os-settings__editor-slot",t.dataset.expanded="false";const o=document.createElement("div");o.className="os-settings__editor-slot-inner",t.appendChild(o);const i=document.createElement("div");i.className="os-settings__wallpaper-config-slot",i.dataset.expanded="false";const n=document.createElement("div");n.className="os-settings__wallpaper-config-slot-inner",i.appendChild(n);const r=f=>{const g=f.detail?.value??"",x=ue(g);!x||x.id===V||(Er(s,x.id,e),ii(s,t,x),b())},a=eh(s,e);let l=!!s.state.customImage;const u=document.createElement("div");u.className="os-settings__image-picker-slot",u.dataset.expanded=String(l);const h=document.createElement("div");h.className="os-settings__image-picker-slot-inner",h.appendChild(a),u.appendChild(h);const p=()=>{l=!l,u.dataset.expanded=String(l),b()},m=document.createElement("div");Rr?.dispose();const _=uh(m);Rr=_;const b=()=>L(c` |
| 2507 |
<os-section |
| 2508 |
heading=${d("Wallpaper")} |
| 2509 |
description=${d("The backdrop behind your windows. Pick a preset, mix your own gradient, or drop in an image.")} |
| 2510 |
> |
| 2511 |
<div |
| 2512 |
class="os-settings__grid os-settings__grid--wallpapers" |
| 2513 |
@os-pick=${r} |
| 2514 |
> |
| 2515 |
${yr().filter(f=>f.id!==V).sort((f,g)=>+(f.id===jt)-+(g.id===jt)).map(f=>c`<os-swatch |
| 2516 |
value=${f.id} |
| 2517 |
label=${f.label} |
| 2518 |
preview=${f.preview} |
| 2519 |
variant="wallpaper" |
| 2520 |
data-wallpaper-id=${f.id} |
| 2521 |
?selected=${s.state.wallpaper===f.id} |
| 2522 |
> |
| 2523 |
<span class="os-settings__swatch-label" |
| 2524 |
>${f.label}</span |
| 2525 |
> |
| 2526 |
</os-swatch>`)} |
| 2527 |
<!-- |
| 2528 |
Your own image, as a tile in the grid rather |
| 2529 |
than as a heading under it. It is one of the |
| 2530 |
ways to answer "what is behind my windows", |
| 2531 |
so it belongs in the row of answers; dashed |
| 2532 |
because it is the only one that cannot show |
| 2533 |
you what you are picking until you have |
| 2534 |
picked it. |
| 2535 |
--> |
| 2536 |
<button |
| 2537 |
type="button" |
| 2538 |
class="os-settings__wallpaper-add" |
| 2539 |
aria-expanded=${l?"true":"false"} |
| 2540 |
@click=${p} |
| 2541 |
> |
| 2542 |
<span |
| 2543 |
class="os-settings__wallpaper-add-plus" |
| 2544 |
aria-hidden="true" |
| 2545 |
>+</span |
| 2546 |
> |
| 2547 |
<span>${d("Use your own image")}</span> |
| 2548 |
</button> |
| 2549 |
</div> |
| 2550 |
${i} ${t} |
| 2551 |
${u} |
| 2552 |
</os-section> |
| 2553 |
`,m);b(),_.sync();const y=ue(s.state.wallpaper);y&&ii(s,t,y),oi(s,i);const v=Ou(()=>{if(!m.isConnected){v(),_.dispose();return}b(),_.sync();const f=ue(s.state.wallpaper);f&&ii(s,t,f),oi(s,i)});return Zu(),m}function vh(s,e){return s.capability&&s.capability==="manage_options"?e:!0}function Tr(s){return s<20?1:s<40?2:3}const _h=["heading","description","label","placeholder"];function pe(s,e=""){return c` |
| 2554 |
<header class="os-settings__page-header"> |
| 2555 |
<h2 class="os-settings__page-title">${s}</h2> |
| 2556 |
${e?c`<p class="os-settings__page-description"> |
| 2557 |
${e} |
| 2558 |
</p>`:c``} |
| 2559 |
</header> |
| 2560 |
`}function yh(s,e){ph(s),Lr(s),s.tabRegistryUnsubscribe&&(s.tabRegistryUnsubscribe(),s.tabRegistryUnsubscribe=null),e.classList.add("os-settings");const t=()=>{const b=s.state.customImage;s.state={...Wa(),customImage:b},s.save(),s.apply(),s.renderPanel(e)},o=s.config.isAdmin,i=Oa().filter(b=>vh(b,o)),n=[{id:"appearance",order:10,label:d("Appearance"),panel:c`<os-tabpanel for="appearance"> |
| 2561 |
<os-panel> |
| 2562 |
${pe(d("Appearance"),d("Personalize your desktop. Changes apply instantly and are saved to this browser."))} |
| 2563 |
<!-- |
| 2564 |
Accent first. It is one row of swatches and the |
| 2565 |
fastest thing on the page to change, where the |
| 2566 |
wallpaper grid below it is fourteen tiles deep. |
| 2567 |
Under the grid it fell below the fold on a short |
| 2568 |
window and read as an afterthought to it. |
| 2569 |
--> |
| 2570 |
${cl(s)} |
| 2571 |
${mh(s,e)} |
| 2572 |
${wc(s)} |
| 2573 |
${Lc(s)} |
| 2574 |
${ul(s)} |
| 2575 |
</os-panel> |
| 2576 |
</os-tabpanel>`},{id:"windows",order:18,label:d("Windows"),panel:c`<os-tabpanel for="windows"> |
| 2577 |
<os-panel> |
| 2578 |
${pe(d("Windows"),d("How windows look, how they arrive, and how they behave when they are not the one you are using."))} |
| 2579 |
${xc(s)} |
| 2580 |
${Mc(s)} |
| 2581 |
</os-panel> |
| 2582 |
</os-tabpanel>`},{id:"features",order:30,label:d("Features"),panel:c`<os-tabpanel for="features"> |
| 2583 |
<os-panel> |
| 2584 |
${pe(d("Features"),d("The assistant, the developer tools, and the betas. Every switch here affects only your account and takes effect immediately."))} |
| 2585 |
${Zc(s)} |
| 2586 |
${o?Dc(s):""} |
| 2587 |
</os-panel> |
| 2588 |
</os-tabpanel>`},{id:"themes",order:12,label:d("Themes"),panel:c`<os-tabpanel for="themes"> |
| 2589 |
<os-panel> |
| 2590 |
${pe(d("Themes"),d("A desktop theme repaints every token at once. A coarser version of what Appearance does one control at a time."))} |
| 2591 |
${lc(s)} |
| 2592 |
</os-panel> |
| 2593 |
</os-tabpanel>`},{id:"navigation",order:22,label:d("Navigation"),panel:c`<os-tabpanel for="navigation"> |
| 2594 |
<os-panel> |
| 2595 |
<!-- |
| 2596 |
No description here. The page's opening |
| 2597 |
sentence names the rails the user is |
| 2598 |
actually looking at, which the split layout |
| 2599 |
changes, so the section owns it — that is |
| 2600 |
the node that repaints on a settings change. |
| 2601 |
--> |
| 2602 |
${pe(d("Navigation"))} |
| 2603 |
${_c(s)} |
| 2604 |
</os-panel> |
| 2605 |
</os-tabpanel>`}];o&&n.push({id:"help",order:40,label:d("Components"),panel:c`<os-tabpanel for="help"> |
| 2606 |
<os-panel> |
| 2607 |
${pe(d("Components"),d("Every <os-*> web component shipped by this plugin, with its props, slots, and a live example."))} |
| 2608 |
${zu(s)} |
| 2609 |
</os-panel> |
| 2610 |
</os-tabpanel>`}),n.push({id:"about",order:Number.MAX_SAFE_INTEGER,label:d("About"),panel:c`<os-tabpanel for="about"> |
| 2611 |
<os-panel padding="0">${el()}</os-panel> |
| 2612 |
</os-tabpanel>`});for(const b of i){const y=`ext-${b.id}`,v=`os-settings-tab-host-${b.id}`,f=b;n.push({id:y,order:b.order??100,label:b.label,icon:Ei[b.id]?.(),panel:c`<os-tabpanel for=${y}> |
| 2613 |
<os-panel><div data-host=${v}></div></os-panel> |
| 2614 |
</os-tabpanel>`,mount:g=>{const x=g.querySelector(`[data-host="${v}"]`);if(x)try{f.render(x,{isAdmin:o,getOsSettings:()=>s.getOsSettingsSnapshot(),subscribeOsSettings:A=>s.subscribeOsSettings(A)})}catch(A){typeof console<"u"&&console.error("[openstation] settings tab render threw:",f.id,A)}}})}n.sort((b,y)=>b.order-y.order);const r=s.activeTabId??"appearance",l=n.some(b=>b.id===r)?r:"appearance",u=()=>{const b=new Map;for(const y of n){const v=e.querySelector(`os-tabpanel[for="${y.id}"]`),f=[y.label,v?.textContent??""];if(v){const g=v.querySelectorAll("[heading],[description],[label],[placeholder]");for(const x of Array.from(g))for(const A of _h)f.push(x.getAttribute(A)??"")}b.set(y.id,f.join(" ").replace(/\s+/g," ").toLowerCase())}return b};let h=null;const p=b=>{const y=b.target.value.trim().toLowerCase();h=h??u();let v=0;for(const g of Array.from(e.querySelectorAll(":scope > os-tabs > os-tab"))){const x=g.getAttribute("value")??"",A=y===""||(h.get(x)??"").includes(y);g.toggleAttribute("data-search-hidden",!A),A&&v++}const f=e.querySelector(".os-settings__search-empty");f&&(f.hidden=v>0)};L(c` |
| 2615 |
<div class="os-settings__search"> |
| 2616 |
<label class="os-settings__search-field"> |
| 2617 |
${z("search",{size:null})} |
| 2618 |
<input |
| 2619 |
type="search" |
| 2620 |
class="os-settings__search-input" |
| 2621 |
placeholder=${d("Search settings")} |
| 2622 |
aria-label=${d("Search settings")} |
| 2623 |
aria-controls="os-settings-nav" |
| 2624 |
@input=${p} |
| 2625 |
/> |
| 2626 |
</label> |
| 2627 |
</div> |
| 2628 |
<os-tabs |
| 2629 |
id="os-settings-nav" |
| 2630 |
orientation="vertical" |
| 2631 |
value=${l} |
| 2632 |
label=${d("Settings sections")} |
| 2633 |
> |
| 2634 |
${n.map((b,y)=>{const v=y>0&&Tr(b.order)!==Tr(n[y-1].order);return c`<os-tab |
| 2635 |
value=${b.id} |
| 2636 |
data-group-start=${v?"true":null} |
| 2637 |
>${Ei[b.id]?.()??b.icon??c`<span |
| 2638 |
class="os-settings__nav-glyph-blank" |
| 2639 |
aria-hidden="true" |
| 2640 |
></span>`}${b.label}</os-tab |
| 2641 |
>`})} |
| 2642 |
</os-tabs> |
| 2643 |
<p class="os-settings__search-empty" hidden> |
| 2644 |
${d("No settings match that.")} |
| 2645 |
</p> |
| 2646 |
<os-panel class="os-settings__footer"> |
| 2647 |
<os-button variant="ghost" @click=${t} |
| 2648 |
>${d("Reset to defaults")}</os-button |
| 2649 |
> |
| 2650 |
</os-panel> |
| 2651 |
${n.map(b=>b.panel)} |
| 2652 |
`,e);for(const b of n)b.mount&&b.mount(e);const m=e.querySelector("os-tabs");if(m){s.tabChangeAbort?.abort();const b=new AbortController;s.tabChangeAbort=b,m.addEventListener("os-tab-change",y=>{const v=y.detail;v?.value&&(s.activeTabId=v.value)},{signal:b.signal})}const _=e.closest(".os-window");_&&Pa(_,[]),s.activeTabId=l,s.tabRegistryUnsubscribe=Ka(()=>{if(!e.isConnected){s.tabRegistryUnsubscribe&&(s.tabRegistryUnsubscribe(),s.tabRegistryUnsubscribe=null);return}s.renderPanel(e)})}window.openStationRenderOsSettingsPanel=yh})(); |
| 2653 |
|