PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.11
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.11
1.1.11 1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 0.8.8 All 35 releases
← All changes | assets/js/apps/posts.min.js +182 -180 1.1.9 → 1.1.11 View file →
@@ -1,25 +1,25 @@
1 -var openStationApp_posts=function(ct){"use strict";const ss="desktop-mode";function dt(){return window.wp?.i18n}function f(o,e=ss){return dt()?.__(o,e)??o}function de(o,e,t,s=ss){return dt()?._n(o,e,t,s)??(t===1?o:e)}function V(o,...e){const t=dt()?.sprintf;if(t)return t(o,...e);let s=0;return o.replace(/%(?:(\d+)\$)?[sd]/g,(n,a)=>{const i=a?Number.parseInt(a,10)-1:s++;return String(e[i]??"")})}function k(o,...e){return{__wpdHtml:!0,strings:o,values:e}}function $o(o){return!!o&&o.__wpdHtml===!0}const So="$$wpd$$",Z=/\$\$wpd\$\$(\d+)\$\$/g,Eo="$$wpd-node$$",Ao=/^\$\$wpd-node\$\$(\d+)\$\$$/,To=new Set(["style","script","textarea","title"]);function Mo(o){let e="",t=!1,s=null,n=!1,a=null,i="",r=!1;for(let c=0;c<o.length;c++){const l=o[c];e+=l;for(let u=0;u<l.length;u++){const d=l[u];if(n){l.startsWith("-->",u)&&(n=!1,u+=2);continue}if(a!==null){d==="<"&&l[u+1]==="/"&&l.slice(u+2,u+2+a.length).toLowerCase()===a&&(u+=1+a.length,a=null,t=!0,r=!1,i="");continue}if(s!==null){d===s&&(s=null);continue}if(t){d==='"'||d==="'"?(s=d,r=!1):d===">"?(t=!1,r=!1,To.has(i)&&(a=i),i=""):r&&(/[a-zA-Z0-9-]/.test(d)?i+=d.toLowerCase():r=!1);continue}if(l.startsWith("<!--",u)){n=!0,u+=3;continue}const h=l[u+1]??"";d==="<"&&/[a-zA-Z/!]/.test(h)&&(t=!0,i="",r=/[a-zA-Z]/.test(h))}c<o.length-1&&(e+=t||n||a!==null?`${So}${c}$$`:`<!--${Eo}${c}$$-->`)}return e}const os=new WeakMap;function ns(o){const e=os.get(o);if(e)return e;const t=document.createElement("template");t.innerHTML=Mo(o);const s=[],n=(r,c)=>{if(r.nodeType===Node.ELEMENT_NODE){const d=r;for(const h of Array.from(d.attributes)){const p=h.name,g=h.value,m=p[0];if(Z.test(g))if(Z.lastIndex=0,m==="@"){const b=Z.exec(g);Z.lastIndex=0,s.push({path:c,kind:"event",name:p.slice(1),valueIndex:b?Number(b[1]):0}),d.removeAttribute(p)}else if(m==="."){const b=Z.exec(g);Z.lastIndex=0,s.push({path:c,kind:"prop",name:p.slice(1),valueIndex:b?Number(b[1]):0}),d.removeAttribute(p)}else if(m==="?"){const b=Z.exec(g);Z.lastIndex=0,s.push({path:c,kind:"bool",name:p.slice(1),valueIndex:b?Number(b[1]):0}),d.removeAttribute(p)}else{const b=[],w=[];let $=0,M;for(Z.lastIndex=0;(M=Z.exec(g))!==null;)b.push(g.slice($,M.index)),w.push(Number(M[1])),$=M.index+M[0].length;b.push(g.slice($)),s.push({path:c,kind:"attr",name:p,template:b,valueIndices:w}),d.setAttribute(p,"")}}}const l=Array.from(r.childNodes);let u=0;for(let d=0;d<l.length;d++){const h=l[d],p=d+u;if(h.nodeType===Node.COMMENT_NODE){const g=Ao.exec(h.data);if(g){const m=document.createTextNode("");h.parentNode.replaceChild(m,h),s.push({path:[...c,p],kind:"node",valueIndex:Number(g[1])})}continue}if(h.nodeType===Node.TEXT_NODE){const g=h.textContent||"";if(!Z.test(g)){Z.lastIndex=0;continue}Z.lastIndex=0;const m=h.parentNode;let b=0,w;const $=[],M=[];for(Z.lastIndex=0;(w=Z.exec(g))!==null;){w.index>b&&$.push(document.createTextNode(g.slice(b,w.index)));const R=document.createTextNode("");$.push(R),M.push({path:[...c,p+$.length-1],kind:"node",valueIndex:Number(w[1])}),b=w.index+w[0].length}b<g.length&&$.push(document.createTextNode(g.slice(b)));for(const R of $)m.insertBefore(R,h);m.removeChild(h),u+=$.length-1,s.push(...M)}else n(h,[...c,p])}};n(t.content,[]);const i={template:t,buildParts:r=>{const c=[];for(const l of s){let u=r;for(const d of l.path)u=u.childNodes[d];l.kind==="node"?c.push({kind:"node",valueIndex:l.valueIndex,child:{anchor:u,state:null}}):l.kind==="attr"?c.push({kind:"attr",element:u,name:l.name,template:l.template,valueIndices:l.valueIndices}):l.kind==="event"?c.push({kind:"event",valueIndex:l.valueIndex,element:u,name:l.name}):l.kind==="prop"?c.push({kind:"prop",valueIndex:l.valueIndex,element:u,name:l.name}):l.kind==="bool"&&c.push({kind:"bool",valueIndex:l.valueIndex,element:u,name:l.name})}return c}};return os.set(o,i),i}const is=new WeakMap;function Io(o,e){for(const t of o.nodes)if(t.parentNode!==e)return!1;return!0}function ke(o,e){const t=is.get(e);if(t&&t.strings===o.strings&&Io(t,e)){Xe(t.parts,o.values);return}const s=ns(o.strings),n=s.template.content.cloneNode(!0),a=s.buildParts(n),i=Array.from(n.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(n),Xe(a,o.values),is.set(e,{strings:o.strings,parts:a,nodes:i})}function Xe(o,e){for(const t of o)if(t.kind==="node")Ye(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let s=t.template[0];for(let n=0;n<t.valueIndices.length;n++)s+=as(e[t.valueIndices[n]]),s+=t.template[n+1];s!==t.last&&(t.last=s,s===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,s))}else if(t.kind==="event"){const s=e[t.valueIndex];s!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),s&&t.element.addEventListener(t.name,s),t.current=s)}else if(t.kind==="prop"){const s=e[t.valueIndex];s!==t.last&&(t.last=s,t.element[t.name]=s)}else if(t.kind==="bool"){const s=!!e[t.valueIndex];s!==t.last&&(t.last=s,s?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function Ye(o,e){if(e==null||e===!1){o.state&&(ue(o.state),o.state=null);return}if(Array.isArray(e)){Ro(o,e);return}if($o(e)){zo(o,e);return}if(e instanceof Node){Lo(o,e);return}Po(o,as(e))}function Lo(o,e){const t=o.state;t?.shape==="node"&&t.node===e||(t&&ue(t),Me(o,[e]),o.state={shape:"node",node:e})}function Po(o,e){const t=o.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&ue(t);const s=document.createTextNode(e);Me(o,[s]),o.state={shape:"text",node:s,text:e}}function zo(o,e){const t=o.state;if(t?.shape==="template"&&t.strings===e.strings){Xe(t.parts,e.values);return}t&&ue(t);const s=ns(e.strings),n=s.template.content.cloneNode(!0),a=s.buildParts(n),i=Array.from(n.childNodes);Me(o,[n]),Xe(a,e.values),o.state={shape:"template",strings:e.strings,parts:a,nodes:i}}function Ro(o,e){const t=o.state;if(t?.shape==="array"){const n=Math.min(t.entries.length,e.length);for(let a=0;a<n;a++)Ye(t.entries[a],e[a]);if(e.length<t.entries.length){for(let a=e.length;a<t.entries.length;a++){const i=t.entries[a];i.state&&ue(i.state),i.anchor.remove()}t.entries.length=e.length}else for(let a=t.entries.length;a<e.length;a++){const i=document.createTextNode("");Me(o,[i]);const r={anchor:i,state:null};Ye(r,e[a]),t.entries.push(r)}return}t&&ue(t);const s=[];for(const n of e){const a=document.createTextNode("");Me(o,[a]);const i={anchor:a,state:null};Ye(i,n),s.push(i)}o.state={shape:"array",entries:s}}function Me(o,e){const t=o.anchor.parentNode;if(t)for(const s of e)t.insertBefore(s,o.anchor)}function ue(o){if(o.shape==="text"){o.node.remove();return}if(o.shape==="template"){for(const e of o.parts)e.kind==="node"&&e.child.state&&(ue(e.child.state),e.child.state=null);for(const e of o.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(o.shape==="node"){o.node.parentNode&&o.node.parentNode.removeChild(o.node);return}for(const e of o.entries)e.state&&ue(e.state),e.anchor.remove()}function as(o){return o==null||o===!1?"":String(o)}async function rs(o){if(o==="")return!1;const e=globalThis.navigator?.clipboard;if(e?.writeText)try{return await e.writeText(o),!0}catch{}return No(o)}function No(o){const e=globalThis.document;if(!e?.body||typeof e.execCommand!="function")return!1;const t=e.createElement("textarea");t.value=o,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="fixed",t.style.insetInlineStart="-9999px",t.style.opacity="0",e.body.appendChild(t);const s=e.activeElement;t.select();let n=!1;try{n=e.execCommand("copy")}catch{n=!1}return t.remove(),s?.focus?.(),n}const Do="data-os-mode";function ut(o=typeof document<"u"?document.documentElement:null){return!!o&&o.getAttribute(Do)==="mobile"}function Oo(o){return o.phone??ut()?k`<os-select
1 +var openStationApp_posts=function(dt){"use strict";const os="desktop-mode";function ut(){return window.wp?.i18n}function f(o,e=os){return ut()?.__(o,e)??o}function de(o,e,t,s=os){return ut()?._n(o,e,t,s)??(t===1?o:e)}function W(o,...e){const t=ut()?.sprintf;if(t)return t(o,...e);let s=0;return o.replace(/%(?:(\d+)\$)?[sd]/g,(n,a)=>{const i=a?Number.parseInt(a,10)-1:s++;return String(e[i]??"")})}function C(o,...e){return{__wpdHtml:!0,strings:o,values:e}}function Po(o){return!!o&&o.__wpdHtml===!0}const zo="$$wpd$$",Z=/\$\$wpd\$\$(\d+)\$\$/g,Ro="$$wpd-node$$",No=/^\$\$wpd-node\$\$(\d+)\$\$$/,Do=new Set(["style","script","textarea","title"]);function Oo(o){let e="",t=!1,s=null,n=!1,a=null,i="",r=!1;for(let c=0;c<o.length;c++){const l=o[c];e+=l;for(let d=0;d<l.length;d++){const u=l[d];if(n){l.startsWith("-->",d)&&(n=!1,d+=2);continue}if(a!==null){u==="<"&&l[d+1]==="/"&&l.slice(d+2,d+2+a.length).toLowerCase()===a&&(d+=1+a.length,a=null,t=!0,r=!1,i="");continue}if(s!==null){u===s&&(s=null);continue}if(t){u==='"'||u==="'"?(s=u,r=!1):u===">"?(t=!1,r=!1,Do.has(i)&&(a=i),i=""):r&&(/[a-zA-Z0-9-]/.test(u)?i+=u.toLowerCase():r=!1);continue}if(l.startsWith("<!--",d)){n=!0,d+=3;continue}const h=l[d+1]??"";u==="<"&&/[a-zA-Z/!]/.test(h)&&(t=!0,i="",r=/[a-zA-Z]/.test(h))}c<o.length-1&&(e+=t||n||a!==null?`${zo}${c}$$`:`<!--${Ro}${c}$$-->`)}return e}const ns=new WeakMap;function is(o){const e=ns.get(o);if(e)return e;const t=document.createElement("template");t.innerHTML=Oo(o);const s=[],n=(r,c)=>{if(r.nodeType===Node.ELEMENT_NODE){const u=r;for(const h of Array.from(u.attributes)){const p=h.name,m=h.value,_=p[0];if(Z.test(m))if(Z.lastIndex=0,_==="@"){const g=Z.exec(m);Z.lastIndex=0,s.push({path:c,kind:"event",name:p.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(p)}else if(_==="."){const g=Z.exec(m);Z.lastIndex=0,s.push({path:c,kind:"prop",name:p.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(p)}else if(_==="?"){const g=Z.exec(m);Z.lastIndex=0,s.push({path:c,kind:"bool",name:p.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(p)}else{const g=[],b=[];let v=0,S;for(Z.lastIndex=0;(S=Z.exec(m))!==null;)g.push(m.slice(v,S.index)),b.push(Number(S[1])),v=S.index+S[0].length;g.push(m.slice(v)),s.push({path:c,kind:"attr",name:p,template:g,valueIndices:b}),u.setAttribute(p,"")}}}const l=Array.from(r.childNodes);let d=0;for(let u=0;u<l.length;u++){const h=l[u],p=u+d;if(h.nodeType===Node.COMMENT_NODE){const m=No.exec(h.data);if(m){const _=document.createTextNode("");h.parentNode.replaceChild(_,h),s.push({path:[...c,p],kind:"node",valueIndex:Number(m[1])})}continue}if(h.nodeType===Node.TEXT_NODE){const m=h.textContent||"";if(!Z.test(m)){Z.lastIndex=0;continue}Z.lastIndex=0;const _=h.parentNode;let g=0,b;const v=[],S=[];for(Z.lastIndex=0;(b=Z.exec(m))!==null;){b.index>g&&v.push(document.createTextNode(m.slice(g,b.index)));const T=document.createTextNode("");v.push(T),S.push({path:[...c,p+v.length-1],kind:"node",valueIndex:Number(b[1])}),g=b.index+b[0].length}g<m.length&&v.push(document.createTextNode(m.slice(g)));for(const T of v)_.insertBefore(T,h);_.removeChild(h),d+=v.length-1,s.push(...S)}else n(h,[...c,p])}};n(t.content,[]);const i={template:t,buildParts:r=>{const c=[];for(const l of s){let d=r;for(const u of l.path)d=d.childNodes[u];l.kind==="node"?c.push({kind:"node",valueIndex:l.valueIndex,child:{anchor:d,state:null}}):l.kind==="attr"?c.push({kind:"attr",element:d,name:l.name,template:l.template,valueIndices:l.valueIndices}):l.kind==="event"?c.push({kind:"event",valueIndex:l.valueIndex,element:d,name:l.name}):l.kind==="prop"?c.push({kind:"prop",valueIndex:l.valueIndex,element:d,name:l.name}):l.kind==="bool"&&c.push({kind:"bool",valueIndex:l.valueIndex,element:d,name:l.name})}return c}};return ns.set(o,i),i}const as=new WeakMap;function Ho(o,e){for(const t of o.nodes)if(t.parentNode!==e)return!1;return!0}function ke(o,e){const t=as.get(e);if(t&&t.strings===o.strings&&Ho(t,e)){Xe(t.parts,o.values);return}const s=is(o.strings),n=s.template.content.cloneNode(!0),a=s.buildParts(n),i=Array.from(n.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(n),Xe(a,o.values),as.set(e,{strings:o.strings,parts:a,nodes:i})}function Xe(o,e){for(const t of o)if(t.kind==="node")Ye(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let s=t.template[0];for(let n=0;n<t.valueIndices.length;n++)s+=rs(e[t.valueIndices[n]]),s+=t.template[n+1];s!==t.last&&(t.last=s,s===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,s))}else if(t.kind==="event"){const s=e[t.valueIndex];s!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),s&&t.element.addEventListener(t.name,s),t.current=s)}else if(t.kind==="prop"){const s=e[t.valueIndex];s!==t.last&&(t.last=s,t.element[t.name]=s)}else if(t.kind==="bool"){const s=!!e[t.valueIndex];s!==t.last&&(t.last=s,s?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function Ye(o,e){if(e==null||e===!1){o.state&&(ue(o.state),o.state=null);return}if(Array.isArray(e)){Wo(o,e);return}if(Po(e)){Uo(o,e);return}if(e instanceof Node){qo(o,e);return}Fo(o,rs(e))}function qo(o,e){const t=o.state;t?.shape==="node"&&t.node===e||(t&&ue(t),Me(o,[e]),o.state={shape:"node",node:e})}function Fo(o,e){const t=o.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&ue(t);const s=document.createTextNode(e);Me(o,[s]),o.state={shape:"text",node:s,text:e}}function Uo(o,e){const t=o.state;if(t?.shape==="template"&&t.strings===e.strings){Xe(t.parts,e.values);return}t&&ue(t);const s=is(e.strings),n=s.template.content.cloneNode(!0),a=s.buildParts(n),i=Array.from(n.childNodes);Me(o,[n]),Xe(a,e.values),o.state={shape:"template",strings:e.strings,parts:a,nodes:i}}function Wo(o,e){const t=o.state;if(t?.shape==="array"){const n=Math.min(t.entries.length,e.length);for(let a=0;a<n;a++)Ye(t.entries[a],e[a]);if(e.length<t.entries.length){for(let a=e.length;a<t.entries.length;a++){const i=t.entries[a];i.state&&ue(i.state),i.anchor.remove()}t.entries.length=e.length}else for(let a=t.entries.length;a<e.length;a++){const i=document.createTextNode("");Me(o,[i]);const r={anchor:i,state:null};Ye(r,e[a]),t.entries.push(r)}return}t&&ue(t);const s=[];for(const n of e){const a=document.createTextNode("");Me(o,[a]);const i={anchor:a,state:null};Ye(i,n),s.push(i)}o.state={shape:"array",entries:s}}function Me(o,e){const t=o.anchor.parentNode;if(t)for(const s of e)t.insertBefore(s,o.anchor)}function ue(o){if(o.shape==="text"){o.node.remove();return}if(o.shape==="template"){for(const e of o.parts)e.kind==="node"&&e.child.state&&(ue(e.child.state),e.child.state=null);for(const e of o.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(o.shape==="node"){o.node.parentNode&&o.node.parentNode.removeChild(o.node);return}for(const e of o.entries)e.state&&ue(e.state),e.anchor.remove()}function rs(o){return o==null||o===!1?"":String(o)}async function ls(o){if(o==="")return!1;const e=globalThis.navigator?.clipboard;if(e?.writeText)try{return await e.writeText(o),!0}catch{}return Vo(o)}function Vo(o){const e=globalThis.document;if(!e?.body||typeof e.execCommand!="function")return!1;const t=e.createElement("textarea");t.value=o,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="fixed",t.style.insetInlineStart="-9999px",t.style.opacity="0",e.body.appendChild(t);const s=e.activeElement;t.select();let n=!1;try{n=e.execCommand("copy")}catch{n=!1}return t.remove(),s?.focus?.(),n}const Bo="data-os-mode";function pt(o=typeof document<"u"?document.documentElement:null){return!!o&&o.getAttribute(Bo)==="mobile"}function jo(o){return o.phone??pt()?C`<os-select
2 2 class="os-app-list__status"
3 3 os-bind=${o.bind}
4 4 os-action=${o.action}
5 5 .value=${o.value}
6 6 aria-label=${o.label}
7 - >${o.segments.map(t=>k`<os-option .value=${t.value}>${t.label}</os-option>`)}</os-select>`:k`<os-segmented
7 + >${o.segments.map(t=>C`<os-option .value=${t.value}>${t.label}</os-option>`)}</os-select>`:C`<os-segmented
8 8 class="os-app-list__status"
9 9 os-bind=${o.bind}
10 10 os-action=${o.action}
11 11 value=${o.value}
12 12 label=${o.label}
13 - >${o.segments.map(t=>k`<os-segment value=${t.value}>${t.label}</os-segment>`)}</os-segmented>`}function qo(o,e){const s=o.closest(".os-window")?.querySelector(".os-window__menu-panel")??null;if(!s||e.items.length===0)return null;const n=`${e.prefix}:`,a="data-os-app-menu-section";s.querySelectorAll(`[${a}="${e.prefix}"]`).forEach(u=>u.remove());const i=document.createElement("div");i.className="os-app__menu-section",i.setAttribute("role","presentation"),i.setAttribute(a,e.prefix),i.textContent=e.section,s.appendChild(i);const r=new Map;for(const u of e.items){const d=document.createElement("os-menu-item");d.setAttribute("role","menuitemcheckbox"),d.setAttribute("value",n+u.key),d.setAttribute(a,e.prefix),d.classList.add("os-window__menu-item","os-app__menu-item"),d.textContent=u.label||u.key,s.appendChild(d),r.set(u.key,d)}const c=()=>{for(const[u,d]of r)e.isChecked(u)?d.setAttribute("checked",""):d.removeAttribute("checked")};c();const l=u=>{const d=u.detail?.value;if(typeof d!="string"||!d.startsWith(n))return;const h=d.slice(n.length);r.has(h)&&(e.onToggle(h),c())};return s.addEventListener("os-menu-item-click",l),{refresh:c,dispose:()=>{s.removeEventListener("os-menu-item-click",l),i.remove();for(const u of r.values())u.remove();r.clear()}}}function Ho(o,e=null){const t=e??(typeof document<"u"?document.documentElement:null);if(!!t&&ut(t)){o.hasAttribute("stacked")||o.setAttribute("stacked","");const a=o.getAttribute("sticky-columns");return a!==null&&(o.setAttribute("data-os-sticky-columns",a),o.removeAttribute("sticky-columns")),!0}o.hasAttribute("stacked")&&o.removeAttribute("stacked");const n=o.getAttribute("data-os-sticky-columns");return n!==null&&(o.setAttribute("sticky-columns",n),o.removeAttribute("data-os-sticky-columns")),!1}function ls(o){return Array.from(o.selection??[],String)}function Fo(){let o=null,e=!1,t=null,s=null;return{invalidateColumns(){o=null},invalidateData(){s=null},sync(n){const a={phone:!1,columnsChanged:!1,dataChanged:!1,selectionChanged:!1},i=n.table;if(!i)return a;const r=n.rowId??(l=>l.id),c=Ho(i);if(a.phone=c,c!==o&&(o=c,i.columns=n.columns(c),a.columnsChanged=!0),e||(e=!0,n.wire?.(i)),n.listKey!==t&&(t=n.listKey,ls(i).length>0&&(i.clearSelection(),a.selectionChanged=!0,n.onSelection?.([]))),n.fingerprint!==s){s=n.fingerprint,i.data=n.rows,a.dataChanged=!0;const l=new Set(n.rows.map(h=>String(r(h)))),u=ls(i),d=u.filter(h=>l.has(h));d.length!==u.length&&(i.selection=d,a.selectionChanged=!0,n.onSelection?.(d))}return a}}}function Uo(o,e){const t=e.local??{},s={id:o,hasLocal:i=>Object.prototype.hasOwnProperty.call(t,i),runLocal:(i,r,c,l)=>{const u=t[i];if(!u)return r;const d={...r},h=u(d,c,l);return h===void 0?d:h},render:i=>{ke(e.view(i),i.root),e.updated?.(i)},mounted:i=>e.mounted?.(i)},{placeholder:n}=e;n&&(s.placeholder=i=>n(i));const a=window;return(a.openStationApps??(a.openStationApps={}))[o]=s,s}const pt=new Map;async function Wo(o){if(!o)return null;let e;try{e=new URL(o,window.location.href)}catch{return o}if(!/gravatar\.com$/i.test(e.hostname))return o;e.searchParams.delete("d"),e.searchParams.delete("s");const t=e.toString(),s=pt.get(t);if(s!==void 0)return s instanceof Promise,s;const n=new URL(o,window.location.href);n.searchParams.set("d","blank");const a=new Promise(i=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{try{const c=document.createElement("canvas");c.width=1,c.height=1;const l=c.getContext("2d",{willReadFrequently:!0});if(!l){i(o);return}l.drawImage(r,0,0,1,1);const u=l.getImageData(0,0,1,1).data;i(u[3]===0?null:o)}catch{i(o)}},r.onerror=()=>i(null),r.src=n.toString()}).then(i=>(pt.set(t,i),i));return pt.set(t,a),a}function Vo(o){return o?.["48"]??o?.["96"]??o?.["24"]??""}function Bo(o,e){e&&Wo(e).then(t=>{o.isConnected&&(t?o.setAttribute("src",t):o.removeAttribute("src"))})}function pe(o){const e=document.createElement("textarea");return e.innerHTML=o,e.value}const ge=class ge 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(cs)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,s){if(t===s)return;const n=jo(e);this._propValues[n]=s,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const s=(Array.isArray(e)?e:String(e).split(/\s+/)).map(n=>String(n).trim()).filter(n=>n!=="");this.className=s.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 s=cs(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(s),set:n=>{let a;n==null||n===!1?a=null:n===!0?a="":a=String(n),this._propValues[t]=a,a===null?this.removeAttribute(s):this.setAttribute(s,a),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&ke(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(s=>s.sheet).filter(s=>s!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const s of e.styles)if(!s.sheet){const n=document.createElement("style");n.textContent=s.cssText,this.shadowRoot.appendChild(n)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!ge._lightStylesAdopted.has(e)){ge._lightStylesAdopted.add(e);for(const t of e.styles){const s=document.createElement("style");s.dataset.osUi=this.tagName.toLowerCase(),s.textContent=t.cssText,document.head.appendChild(s)}}}};ge.props=[],ge.styles=[],ge.shadow=!0,ge._lightStylesAdopted=new WeakSet;let X=ge;function Q(o,e){customElements.get(o)||customElements.define(o,e)}function cs(o){return o.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function jo(o){return o.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const Ko=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function H(o,...e){let t=o[0];for(let s=1;s<o.length;s++){const n=e[s-1];if(typeof n=="string"||typeof n=="number")t+=String(n);else if(n&&n.__wpdCss)t+=n.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof n);t+=o[s]}if(Ko){const s=new CSSStyleSheet;return s.replaceSync(t),{__wpdCss:!0,sheet:s,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function Go(o){const e=[],t=[];let s=null,n=o.parentElement;for(;n&&!(n===document.body||n===document.documentElement);){const i=n.id||"";if(i.startsWith("wp-window-")){s=i.slice(10);break}if(n.tagName.toLowerCase()==="os-tabpanel"){const r=n.getAttribute("for");r&&t.unshift(r)}n=n.parentElement}s&&e.push(ht(s));for(const i of t)e.push("tab-"+ht(i));const a=o.getAttribute("label");return a&&e.push(ht(a)),e.length===0?"os-unnamed":"os-"+e.filter(i=>i!=="").join("-")}function ht(o){return o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ft(o){if(o.id)return o.id;const e=Go(o);return o.id=e,e}function Xo(o){if(!o)return 214;let e=5381;for(let t=0;t<o.length;t++)e=Math.imul(e,33)+o.charCodeAt(t);return(e%360+360)%360}const Yo=H`: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}}`,ds={xs:20,sm:24,md:40,lg:64,xl:96},us=new Set(["online","inactive","offline"]),Re=class Re extends X{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,s){super.attributeChangedCallback(e,t,s),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",s=this._attr("alt"),n=s!==null?s:t,a=this._attr("size"),i=this._resolveSize(a),r=this._presenceForRender(),c=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${i}px`);const l=e&&!this._imgFailed?"":this._initialsBg(t),u=e&&!this._imgFailed?k`<img
13 + >${o.segments.map(t=>C`<os-segment value=${t.value}>${t.label}</os-segment>`)}</os-segmented>`}function Ko(o,e){const s=o.closest(".os-window")?.querySelector(".os-window__menu-panel")??null;if(!s||e.items.length===0)return null;const n=`${e.prefix}:`,a="data-os-app-menu-section";s.querySelectorAll(`[${a}="${e.prefix}"]`).forEach(d=>d.remove());const i=document.createElement("div");i.className="os-app__menu-section",i.setAttribute("role","presentation"),i.setAttribute(a,e.prefix),i.textContent=e.section,s.appendChild(i);const r=new Map;for(const d of e.items){const u=document.createElement("os-menu-item");u.setAttribute("role","menuitemcheckbox"),u.setAttribute("value",n+d.key),u.setAttribute(a,e.prefix),u.classList.add("os-window__menu-item","os-app__menu-item"),u.textContent=d.label||d.key,s.appendChild(u),r.set(d.key,u)}const c=()=>{for(const[d,u]of r)e.isChecked(d)?u.setAttribute("checked",""):u.removeAttribute("checked")};c();const l=d=>{const u=d.detail?.value;if(typeof u!="string"||!u.startsWith(n))return;const h=u.slice(n.length);r.has(h)&&(e.onToggle(h),c())};return s.addEventListener("os-menu-item-click",l),{refresh:c,dispose:()=>{s.removeEventListener("os-menu-item-click",l),i.remove();for(const d of r.values())d.remove();r.clear()}}}function Go(o,e=null){const t=e??(typeof document<"u"?document.documentElement:null);if(!!t&&pt(t)){o.hasAttribute("stacked")||o.setAttribute("stacked","");const a=o.getAttribute("sticky-columns");return a!==null&&(o.setAttribute("data-os-sticky-columns",a),o.removeAttribute("sticky-columns")),!0}o.hasAttribute("stacked")&&o.removeAttribute("stacked");const n=o.getAttribute("data-os-sticky-columns");return n!==null&&(o.setAttribute("sticky-columns",n),o.removeAttribute("data-os-sticky-columns")),!1}function cs(o){return Array.from(o.selection??[],String)}function Xo(){let o=null,e=!1,t=null,s=null;return{invalidateColumns(){o=null},invalidateData(){s=null},sync(n){const a={phone:!1,columnsChanged:!1,dataChanged:!1,selectionChanged:!1},i=n.table;if(!i)return a;const r=n.rowId??(l=>l.id),c=Go(i);if(a.phone=c,c!==o&&(o=c,i.columns=n.columns(c),a.columnsChanged=!0),e||(e=!0,n.wire?.(i)),n.listKey!==t&&(t=n.listKey,cs(i).length>0&&(i.clearSelection(),a.selectionChanged=!0,n.onSelection?.([]))),n.fingerprint!==s){s=n.fingerprint,i.data=n.rows,a.dataChanged=!0;const l=new Set(n.rows.map(h=>String(r(h)))),d=cs(i),u=d.filter(h=>l.has(h));u.length!==d.length&&(i.selection=u,a.selectionChanged=!0,n.onSelection?.(u))}return a}}}function Yo(o,e){const t=e.local??{},s={id:o,hasLocal:i=>Object.prototype.hasOwnProperty.call(t,i),runLocal:(i,r,c,l)=>{const d=t[i];if(!d)return r;const u={...r},h=d(u,c,l);return h===void 0?u:h},render:i=>{ke(e.view(i),i.root),e.updated?.(i)},mounted:i=>e.mounted?.(i)},{placeholder:n}=e;n&&(s.placeholder=i=>n(i));const a=window;return(a.openStationApps??(a.openStationApps={}))[o]=s,s}const Zo=250,ds=window.location.origin;let us=0;function Jo(o,{timeoutMs:e=Zo}={}){const t=o?.contentWindow;if(!t)return Promise.resolve(!1);us+=1;const s=`os-unsaved-guard-${Date.now()}-${us}`;return new Promise(n=>{let a=null,i=!1;const r=l=>{i||(i=!0,window.removeEventListener("message",c),a!==null&&window.clearTimeout(a),n(l))},c=l=>{if(l.origin!==ds)return;const d=l?.data;!d||typeof d!="object"||d.type!=="os-bridge-beforeunload-response"||d.requestId!==s||r(d.prevent===!0)};window.addEventListener("message",c),a=window.setTimeout(()=>r(!1),e);try{t.postMessage({type:"os-bridge-beforeunload-query",requestId:s},ds)}catch{r(!1)}})}class Qo extends Error{constructor(e,t){super(e||t.serverMessage||`HTTP ${t.status}`),this.name="RestError",this.status=t.status,this.code=t.code,this.data=t.data,this.serverMessage=t.serverMessage??""}}function ps(o){return o instanceof Qo}const en="rest_cookie_invalid_nonce",hs=()=>f("Could not reach the site. Check your connection and try again.","desktop-mode");function fs(o){return typeof navigator<"u"&&navigator.onLine===!1?!0:o instanceof TypeError}function tn(o){return ps(o)?o.code===en||o.status===401?"session":o.status>=200&&o.status<300?"unreadable":o.status===404?"gone":o.status>=500?"server":o.status>=400?"refused":"unknown":fs(o)?"offline":"unknown"}function sn(o){return ps(o)?o.serverMessage:fs(o)?hs():o instanceof Error?o.message:""}function on(o,e){const{fallback:t,lead:s}=e,n=tn(o),a=n==="offline"||n==="unreadable"?"warning":"error";let i="",r=!0;switch(n){case"offline":i=hs();break;case"session":i=f("Your session has expired. Reload the page and try again.","desktop-mode");break;case"unreadable":i=f("The site sent an unreadable reply. Reload the page to check whether the change went through.","desktop-mode");break;case"gone":case"refused":case"server":{const l=o;l.serverMessage?i=l.serverMessage:n==="gone"?(i=f("It no longer exists. Reload the page to catch up.","desktop-mode"),r=!1):n==="server"?(i=W(f("The server answered with error %d.","desktop-mode"),l.status),r=!1):(i=W(f("The server refused the request (HTTP %d).","desktop-mode"),l.status),r=!1);break}case"unknown":default:i=sn(o);break}let c;return s?c=i?`${s}: ${i}`:t:i?r?c=i:c=`${t} ${i}`:c=t,{message:c,reason:i,kind:n,type:a}}function nn(o,e,t){if(!o)return;const{duration:s,...n}=t,a=on(e,n),i={message:a.message,type:a.type};s&&(i.duration=s),o(i)}const ht=new Map;async function an(o){if(!o)return null;let e;try{e=new URL(o,window.location.href)}catch{return o}if(!/gravatar\.com$/i.test(e.hostname))return o;e.searchParams.delete("d"),e.searchParams.delete("s");const t=e.toString(),s=ht.get(t);if(s!==void 0)return s instanceof Promise,s;const n=new URL(o,window.location.href);n.searchParams.set("d","blank");const a=new Promise(i=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{try{const c=document.createElement("canvas");c.width=1,c.height=1;const l=c.getContext("2d",{willReadFrequently:!0});if(!l){i(o);return}l.drawImage(r,0,0,1,1);const d=l.getImageData(0,0,1,1).data;i(d[3]===0?null:o)}catch{i(o)}},r.onerror=()=>i(null),r.src=n.toString()}).then(i=>(ht.set(t,i),i));return ht.set(t,a),a}function rn(o){return o?.["48"]??o?.["96"]??o?.["24"]??""}function ln(o,e){e&&an(e).then(t=>{o.isConnected&&(t?o.setAttribute("src",t):o.removeAttribute("src"))})}function pe(o){const e=document.createElement("textarea");return e.innerHTML=o,e.value}const ge=class ge 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(gs)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,s){if(t===s)return;const n=cn(e);this._propValues[n]=s,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const s=(Array.isArray(e)?e:String(e).split(/\s+/)).map(n=>String(n).trim()).filter(n=>n!=="");this.className=s.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 s=gs(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(s),set:n=>{let a;n==null||n===!1?a=null:n===!0?a="":a=String(n),this._propValues[t]=a,a===null?this.removeAttribute(s):this.setAttribute(s,a),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&ke(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(s=>s.sheet).filter(s=>s!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const s of e.styles)if(!s.sheet){const n=document.createElement("style");n.textContent=s.cssText,this.shadowRoot.appendChild(n)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!ge._lightStylesAdopted.has(e)){ge._lightStylesAdopted.add(e);for(const t of e.styles){const s=document.createElement("style");s.dataset.osUi=this.tagName.toLowerCase(),s.textContent=t.cssText,document.head.appendChild(s)}}}};ge.props=[],ge.styles=[],ge.shadow=!0,ge._lightStylesAdopted=new WeakSet;let X=ge;function Q(o,e){customElements.get(o)||customElements.define(o,e)}function gs(o){return o.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function cn(o){return o.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const dn=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function F(o,...e){let t=o[0];for(let s=1;s<o.length;s++){const n=e[s-1];if(typeof n=="string"||typeof n=="number")t+=String(n);else if(n&&n.__wpdCss)t+=n.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof n);t+=o[s]}if(dn){const s=new CSSStyleSheet;return s.replaceSync(t),{__wpdCss:!0,sheet:s,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function un(o){const e=[],t=[];let s=null,n=o.parentElement;for(;n&&!(n===document.body||n===document.documentElement);){const i=n.id||"";if(i.startsWith("wp-window-")){s=i.slice(10);break}if(n.tagName.toLowerCase()==="os-tabpanel"){const r=n.getAttribute("for");r&&t.unshift(r)}n=n.parentElement}s&&e.push(ft(s));for(const i of t)e.push("tab-"+ft(i));const a=o.getAttribute("label");return a&&e.push(ft(a)),e.length===0?"os-unnamed":"os-"+e.filter(i=>i!=="").join("-")}function ft(o){return o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function gt(o){if(o.id)return o.id;const e=un(o);return o.id=e,e}function pn(o){if(!o)return 214;let e=5381;for(let t=0;t<o.length;t++)e=Math.imul(e,33)+o.charCodeAt(t);return(e%360+360)%360}const hn=F`: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}}`,ms={xs:20,sm:24,md:40,lg:64,xl:96},bs=new Set(["online","inactive","offline"]),Re=class Re extends X{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,s){super.attributeChangedCallback(e,t,s),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",s=this._attr("alt"),n=s!==null?s:t,a=this._attr("size"),i=this._resolveSize(a),r=this._presenceForRender(),c=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${i}px`);const l=e&&!this._imgFailed?"":this._initialsBg(t),d=e&&!this._imgFailed?C`<img
14 14 src=${e}
15 15 alt=${n}
16 16 @error=${()=>this._onImgError()}
17 17 loading="lazy"
18 - />`:this._initials(t),d=r?k`<span
18 + />`:this._initials(t),u=r?C`<span
19 19 class=${`os-avatar__dot os-avatar__dot--${r}`}
20 20 aria-label=${this._presenceLabel(r)}
21 - ></span>`:k``;return c?k`
21 + ></span>`:C``;return c?C`
22 22 <button
23 23 type="button"
24 24 class="os-avatar__tile"
25 25 aria-label=${n||"User"}
@@ -24,29 +24,29 @@
24 24 class="os-avatar__tile"
25 25 aria-label=${n||"User"}
26 26 style=${l?`background:${l};`:""}
27 27 @click=${h=>this._onClick(h)}
28 - >${u}</button>
29 - ${d}
30 - `:k`
28 + >${d}</button>
29 + ${u}
30 + `:C`
31 31 <div
32 32 class="os-avatar__tile"
33 33 role="img"
34 34 aria-label=${n||"User"}
35 35 style=${l?`background:${l};`:""}
36 - >${u}</div>
37 - ${d}
38 - `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in ds)return ds[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=Xo(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&us.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"),s={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",s)}_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 s=this.getBoundingClientRect();if(s.width===0||s.height===0)return;const n=(t.clientX-s.left)/s.width-.5,a=(t.clientY-s.top)/s.height-.5,i=14;this._pendingTiltY=`${(n*i).toFixed(2)}deg`,this._pendingTiltX=`${(-a*i).toFixed(2)}deg`;const r=Math.max(0,Math.min(100,(n+.5)*100)),c=Math.max(0,Math.min(100,(a+.5)*100));this._pendingGlareX=`${r.toFixed(1)}%`,this._pendingGlareY=`${c.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"),s=!!e&&!t;s&&!this._presenceHandler?(this._presenceHandler=n=>{const a=n.detail;a&&String(a.userId)===String(e)&&a.newStatus&&us.has(a.newStatus)&&this.setAttribute("presence",a.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!s&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};Re.props=["src","alt","name","size","presence","userId","clickable"],Re.styles=[Yo],Re.help=void 0;let gt=Re;Q("os-avatar",gt);const Zo=H`:host{display:inline;color:inherit;font:inherit}`,Ze=new Set;let Ie=null;const Jo=3e4;function Qo(){Ie===null&&(Ie=window.setInterval(()=>{for(const o of Ze)o.tick()},Jo))}function en(){Ie!==null&&Ze.size===0&&(window.clearInterval(Ie),Ie=null)}function tn(o){if(!o)return null;const e=t=>{const s=new Date(t);return Number.isNaN(s.getTime())?null:s};return sn(o)?e(o):e(o.replace(" ","T")+"Z")}function sn(o){const e=Math.max(o.indexOf("T"),o.indexOf(" ")),t=e===-1?"":o.slice(e+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(t)}let mt=null,bt=null;function ps(){return typeof navigator<"u"&&navigator.language||"en"}function on(){return mt||(mt=new Intl.RelativeTimeFormat(ps(),{numeric:"auto"})),mt}function hs(){return bt||(bt=new Intl.RelativeTimeFormat(ps(),{numeric:"always",style:"narrow"})),bt}function nn(o,e){const t=on(),s=o.getTime()-e,n=Math.round(s/1e3),a=Math.abs;return a(n)<45?t.format(0,"second"):fs(t,n)}function fs(o,e){const t=Math.abs,s=Math.round(e/60);if(t(s)<45)return o.format(s,"minute");const n=Math.round(s/60);if(t(n)<22)return o.format(n,"hour");const a=Math.round(n/24);if(t(a)<26)return o.format(a,"day");const i=Math.round(a/30);if(t(i)<11)return o.format(i,"month");const r=Math.round(a/365);return o.format(r,"year")}function an(o,e){const t=Math.round((o.getTime()-e)/1e3),s=Math.abs;return s(t)<45?hs().format(0,"second"):s(t)>604800?o.toLocaleDateString(void 0,{month:"short",day:"numeric"}):fs(hs(),t)}const Ne=class Ne extends X{connectedCallback(){super.connectedCallback(),Ze.add(this),Qo()}disconnectedCallback(){Ze.delete(this),en()}tick(){this.requestUpdate()}render(){const e=this.datetime,t=tn(e);if(!t)return k`<span>${e??""}</span>`;const s=Date.now(),n=this.hasAttribute("compact")?an(t,s):nn(t,s),a=t.toLocaleString();return k`<time datetime=${t.toISOString()} title=${a}
36 + >${d}</div>
37 + ${u}
38 + `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in ms)return ms[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=pn(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&bs.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"),s={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",s)}_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 s=this.getBoundingClientRect();if(s.width===0||s.height===0)return;const n=(t.clientX-s.left)/s.width-.5,a=(t.clientY-s.top)/s.height-.5,i=14;this._pendingTiltY=`${(n*i).toFixed(2)}deg`,this._pendingTiltX=`${(-a*i).toFixed(2)}deg`;const r=Math.max(0,Math.min(100,(n+.5)*100)),c=Math.max(0,Math.min(100,(a+.5)*100));this._pendingGlareX=`${r.toFixed(1)}%`,this._pendingGlareY=`${c.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"),s=!!e&&!t;s&&!this._presenceHandler?(this._presenceHandler=n=>{const a=n.detail;a&&String(a.userId)===String(e)&&a.newStatus&&bs.has(a.newStatus)&&this.setAttribute("presence",a.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!s&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};Re.props=["src","alt","name","size","presence","userId","clickable"],Re.styles=[hn],Re.help=void 0;let mt=Re;Q("os-avatar",mt);const fn=F`:host{display:inline;color:inherit;font:inherit}`,Ze=new Set;let Ie=null;const gn=3e4;function mn(){Ie===null&&(Ie=window.setInterval(()=>{for(const o of Ze)o.tick()},gn))}function bn(){Ie!==null&&Ze.size===0&&(window.clearInterval(Ie),Ie=null)}function _n(o){if(!o)return null;const e=t=>{const s=new Date(t);return Number.isNaN(s.getTime())?null:s};return vn(o)?e(o):e(o.replace(" ","T")+"Z")}function vn(o){const e=Math.max(o.indexOf("T"),o.indexOf(" ")),t=e===-1?"":o.slice(e+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(t)}let bt=null,_t=null;function _s(){return typeof navigator<"u"&&navigator.language||"en"}function yn(){return bt||(bt=new Intl.RelativeTimeFormat(_s(),{numeric:"auto"})),bt}function vs(){return _t||(_t=new Intl.RelativeTimeFormat(_s(),{numeric:"always",style:"narrow"})),_t}function xn(o,e){const t=yn(),s=o.getTime()-e,n=Math.round(s/1e3),a=Math.abs;return a(n)<45?t.format(0,"second"):ys(t,n)}function ys(o,e){const t=Math.abs,s=Math.round(e/60);if(t(s)<45)return o.format(s,"minute");const n=Math.round(s/60);if(t(n)<22)return o.format(n,"hour");const a=Math.round(n/24);if(t(a)<26)return o.format(a,"day");const i=Math.round(a/30);if(t(i)<11)return o.format(i,"month");const r=Math.round(a/365);return o.format(r,"year")}function kn(o,e){const t=Math.round((o.getTime()-e)/1e3),s=Math.abs;return s(t)<45?vs().format(0,"second"):s(t)>604800?o.toLocaleDateString(void 0,{month:"short",day:"numeric"}):ys(vs(),t)}const Ne=class Ne extends X{connectedCallback(){super.connectedCallback(),Ze.add(this),mn()}disconnectedCallback(){Ze.delete(this),bn()}tick(){this.requestUpdate()}render(){const e=this.datetime,t=_n(e);if(!t)return C`<span>${e??""}</span>`;const s=Date.now(),n=this.hasAttribute("compact")?kn(t,s):xn(t,s),a=t.toLocaleString();return C`<time datetime=${t.toISOString()} title=${a}
39 39 >${n}</time
40 - >`}};Ne.props=["datetime","compact"],Ne.styles=[Zo],Ne.help=void 0;let _t=Ne;Q("os-relative-time",_t);function re(o,e,t,s){const n=`${e}|${t}`,a=o.get(n);if(a)return a;const i=s();return o.set(n,i),i}const gs={publish:f("Published"),future:f("Scheduled"),draft:f("Draft"),pending:f("Pending"),private:f("Private"),trash:f("Trash")};function rn(o){switch(o){case"publish":return{bg:"var(--os-ui-surface-raised, #e6f4ea)",fg:"var(--os-ui-success-fg, #1d6f42)"};case"draft":return{bg:"var(--os-ui-surface-raised, #fdecea)",fg:"var(--os-ui-danger, #a02622)"};case"pending":return{bg:"var(--os-ui-warning-bg, #fef7e0)",fg:"var(--os-ui-warning-fg, #8a6d00)"};case"private":return{bg:"var(--os-ui-info-bg, #e8f0fe)",fg:"var(--os-ui-info-fg, #1a52a8)"};case"future":return{bg:"var(--os-ui-surface-raised, #ede7f6)",fg:"var(--os-ui-accent, #5b3aa0)"};default:return{bg:"var(--os-ui-surface-raised, #f1f1f2)",fg:"var(--os-ui-fg-muted, #50575e)"}}}function vt(o,e){const t=o.editPostUrlBase??"",s=t.includes("?")?"&":"?";return`${t}${s}post=${e}&action=edit`}function yt(o){const e=o._embedded?.author?.[0];return e?{id:e.id,name:e.name,avatar:Vo(e.avatar_urls)||void 0}:{id:o.author,name:f("Unknown")}}function xt(o,e){for(const t of o._embedded?.["wp:term"]??[])if(t.length>0&&t[0].taxonomy===e)return t.map(s=>({id:s.id,name:s.name}));return[]}function kt(o){const e=o._embedded?.["wp:featuredmedia"]?.[0];if(!e)return null;const t=e.media_details?.sizes??{};return{url:t.thumbnail?.source_url??t.medium?.source_url??e.source_url,alt:e.alt_text??""}}function we(o){return pe(o.title.rendered)}function Je(o,e,t={}){const s=document.createElement("span");s.style.cssText=["display:inline-flex","align-items:center","gap:4px","padding:2px 8px","border-radius:10px","font-size:11px","font-weight:600",t.uppercase?"text-transform:uppercase;letter-spacing:0.04em":"",`background:${e.bg}`,`color:${e.fg}`,"white-space:nowrap","flex-shrink:0"].filter(Boolean).join(";"),t.icon&&s.appendChild(t.icon);const n=document.createElement("span");return n.textContent=o,s.appendChild(n),t.title&&(s.title=t.title),s}function ms(o,e=13){const t=document.createElement("span");return t.className=`dashicons ${o}`,t.setAttribute("aria-hidden","true"),t.style.cssText=`font-size:${e}px;width:${e}px;height:${e}px;line-height:1;`,t}function ln(){const o=document.createElement("span");return o.setAttribute("aria-hidden","true"),o.style.cssText="font-family:dashicons;font-size:14px;line-height:1;display:inline-block;speak:none;-webkit-font-smoothing:antialiased",o.textContent="",o}function bs(o){o.addEventListener("mouseenter",()=>{o.style.textDecoration="underline"}),o.addEventListener("mouseleave",()=>{o.style.textDecoration="none"})}function cn(o,e){const t=document.createElement("span");t.style.cssText="display:flex;flex-direction:column;gap:4px;min-width:0;";const s=document.createElement("span");s.style.cssText="display:flex;align-items:center;gap:8px;min-width:0;";const n=document.createElement("a");n.href=vt(e.extra,o.id),n.setAttribute("data-noclick","");const a=we(o)||f("(no title)");n.textContent=a,n.title=a,n.style.cssText="font-weight:600;color:inherit;text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:340px;",bs(n),n.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),e.openUrl(n.href,a,"dashicons-admin-post")}),s.appendChild(n);const i=o.openstation_lock??null;i&&s.appendChild(Je(i.userName,{fg:"var(--os-ui-danger, #b32d2e)",bg:"var(--os-ui-surface-raised, rgba(179, 45, 46, 0.1))"},{icon:ln(),title:V(f("%s is currently editing"),i.userName)}));const r=e.extra.mode==="pages";if(r&&typeof e.extra.frontPageId=="number"&&e.extra.frontPageId===o.id&&s.appendChild(Je(f("Front page"),{fg:"var(--os-ui-info-fg, #0a4b78)",bg:"var(--os-ui-info-bg, rgba(34,113,177,0.12))"},{icon:ms("dashicons-admin-home")})),r&&typeof e.extra.postsPageId=="number"&&e.extra.postsPageId===o.id&&s.appendChild(Je(f("Posts page"),{fg:"var(--os-ui-accent, #5b3aa0)",bg:"var(--os-ui-surface-raised, rgba(91,58,160,0.12))"},{icon:ms("dashicons-admin-post")})),o.status&&o.status!=="publish"&&s.appendChild(Je(gs[o.status]??o.status,rn(o.status),{uppercase:!0})),r&&typeof o.link=="string"&&o.link&&o.status==="publish"){const c=document.createElement("a");c.href=o.link,c.target="_blank",c.rel="noreferrer noopener",c.textContent=f("View"),c.title=o.link,c.setAttribute("data-noclick",""),c.style.cssText="font-size:11px;color:var(--wp-admin-theme-color, #2271b1);text-decoration:none;flex-shrink:0;",c.addEventListener("click",l=>l.stopPropagation()),bs(c),s.appendChild(c)}return t.appendChild(s),t}function dn(o){const e=yt(o),t=document.createElement("span");t.style.cssText="display:inline-flex;align-items:center;gap:8px;min-width:0;";const s=document.createElement("os-avatar");s.setAttribute("size","24"),e.name&&s.setAttribute("name",e.name),e.id>0&&s.setAttribute("user-id",String(e.id)),e.avatar&&Bo(s,e.avatar),t.appendChild(s);const n=document.createElement("span");return n.textContent=e.name,n.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",t.appendChild(n),t}function un(o){const e=document.createElement("span");e.style.cssText="display:flex;flex-direction:column;line-height:1.2;";const t=document.createElement("os-relative-time");if(t.setAttribute("datetime",o.date_gmt||o.date),e.appendChild(t),o.modified_gmt&&o.modified_gmt!==o.date_gmt){const s=document.createElement("span");s.textContent=f("modified"),s.style.cssText="font-size:11px;color:var(--os-ui-fg-muted, #646970);",e.appendChild(s)}return e}function pn(o){const e=document.createElement("div");e.style.cssText="display:flex;gap:16px;padding:12px 16px;background:var(--os-ui-surface-sunken, #fafafa);align-items:flex-start;";const t=kt(o);if(t){const r=document.createElement("img");r.src=t.url,r.alt=t.alt,r.loading="lazy",r.style.cssText="width:96px;height:96px;border-radius:6px;object-fit:cover;flex-shrink:0;",e.appendChild(r)}const s=document.createElement("div");s.style.cssText="flex:1;min-width:0;display:flex;flex-direction:column;gap:6px;";const n=document.createElement("div");n.style.cssText="font-size:13px;color:var(--os-ui-fg-muted, #646970);text-transform:uppercase;letter-spacing:0.04em;",n.textContent=f("Excerpt"),s.appendChild(n);const a=document.createElement("div");a.style.cssText="color:var(--os-ui-fg, #1d2327);line-height:1.5;";const i=o.excerpt?.rendered??"";return i?a.textContent=pe(i.replace(/<[^>]+>/g,"").trim())||f("(no excerpt)"):(a.textContent=f("(no excerpt)"),a.style.color="var(--os-ui-fg-muted, #a7aaad)"),s.appendChild(a),e.appendChild(s),e}const _s={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 vs(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function hn(o){return Object.prototype.hasOwnProperty.call(_s,o)?_s[o]:null}function fn(o,e={}){const t=hn(o);if(!t)return"";const{size:s=24,className:n,title:a,rotate:i}=e,r=['xmlns="http://www.w3.org/2000/svg"','viewBox="0 0 24 24"'];s!=null&&r.push(`width="${s}"`,`height="${s}"`),r.push(t.a),n&&r.push(`class="${vs(n)}"`),a?r.push('role="img"',`aria-label="${vs(a)}"`):r.push('aria-hidden="true"','focusable="false"');const c=i?`<g transform="rotate(${i} 12 12)">${t.b}</g>`:t.b;return`<svg ${r.join(" ")}>${c}</svg>`}function se(o,e={}){const t=fn(o,e),s=document.createElement("div");s.innerHTML=t;const n=s.firstElementChild;return n instanceof SVGSVGElement?n:document.createElementNS("http://www.w3.org/2000/svg","svg")}const gn=H`: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:var( --os-ui-field-font-size-compact,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}`,_e=H`: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 ) )}`,mn=H` .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%}}`,ys=H` .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%}}`,xs=H` .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}}`,ks=H` .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}}`,ws=H` .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}}`,bn=H` .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%}}`,_n=H` .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}}`,Cs=H` 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}}`,wt=H` 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}}`,$s=H` @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}}`;H` ${_e} ${mn} ${ys} ${xs} ${ks} ${ws} ${bn} ${_n} ${Cs} ${wt} ${$s} `;const vn=H` ${_e}: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}`,De=class De extends X{constructor(){super(...arguments),this._onHostKeyDown=e=>{if(this.dismissible!==null&&(e.key==="Backspace"||e.key==="Delete")){if(e.preventDefault(),this.disabled!==null)return;const n=this.label??"";this.emit("os-chip-dismiss",{label:n})}}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._onHostKeyDown)}disconnectedCallback(){this.removeEventListener("keydown",this._onHostKeyDown)}render(){const e=this.label??"",t=this.dismissible!==null,s=this.disabled!==null;return k`
40 + >`}};Ne.props=["datetime","compact"],Ne.styles=[fn],Ne.help=void 0;let vt=Ne;Q("os-relative-time",vt);function re(o,e,t,s){const n=`${e}|${t}`,a=o.get(n);if(a)return a;const i=s();return o.set(n,i),i}const xs={publish:f("Published"),future:f("Scheduled"),draft:f("Draft"),pending:f("Pending"),private:f("Private"),trash:f("Trash")};function wn(o){switch(o){case"publish":return{bg:"var(--os-ui-surface-raised, #e6f4ea)",fg:"var(--os-ui-success-fg, #1d6f42)"};case"draft":return{bg:"var(--os-ui-surface-raised, #fdecea)",fg:"var(--os-ui-danger, #a02622)"};case"pending":return{bg:"var(--os-ui-warning-bg, #fef7e0)",fg:"var(--os-ui-warning-fg, #8a6d00)"};case"private":return{bg:"var(--os-ui-info-bg, #e8f0fe)",fg:"var(--os-ui-info-fg, #1a52a8)"};case"future":return{bg:"var(--os-ui-surface-raised, #ede7f6)",fg:"var(--os-ui-accent, #5b3aa0)"};default:return{bg:"var(--os-ui-surface-raised, #f1f1f2)",fg:"var(--os-ui-fg-muted, #50575e)"}}}function yt(o,e){const t=o.editPostUrlBase??"",s=t.includes("?")?"&":"?";return`${t}${s}post=${e}&action=edit`}function xt(o){const e=o._embedded?.author?.[0];return e?{id:e.id,name:e.name,avatar:rn(e.avatar_urls)||void 0}:{id:o.author,name:f("Unknown")}}function kt(o,e){for(const t of o._embedded?.["wp:term"]??[])if(t.length>0&&t[0].taxonomy===e)return t.map(s=>({id:s.id,name:s.name}));return[]}function wt(o){const e=o._embedded?.["wp:featuredmedia"]?.[0];if(!e)return null;const t=e.media_details?.sizes??{};return{url:t.thumbnail?.source_url??t.medium?.source_url??e.source_url,alt:e.alt_text??""}}function we(o){return pe(o.title.rendered)}function Je(o,e,t={}){const s=document.createElement("span");s.style.cssText=["display:inline-flex","align-items:center","gap:4px","padding:2px 8px","border-radius:10px","font-size:11px","font-weight:600",t.uppercase?"text-transform:uppercase;letter-spacing:0.04em":"",`background:${e.bg}`,`color:${e.fg}`,"white-space:nowrap","flex-shrink:0"].filter(Boolean).join(";"),t.icon&&s.appendChild(t.icon);const n=document.createElement("span");return n.textContent=o,s.appendChild(n),t.title&&(s.title=t.title),s}function ks(o,e=13){const t=document.createElement("span");return t.className=`dashicons ${o}`,t.setAttribute("aria-hidden","true"),t.style.cssText=`font-size:${e}px;width:${e}px;height:${e}px;line-height:1;`,t}function Cn(){const o=document.createElement("span");return o.setAttribute("aria-hidden","true"),o.style.cssText="font-family:dashicons;font-size:14px;line-height:1;display:inline-block;speak:none;-webkit-font-smoothing:antialiased",o.textContent="",o}function ws(o){o.addEventListener("mouseenter",()=>{o.style.textDecoration="underline"}),o.addEventListener("mouseleave",()=>{o.style.textDecoration="none"})}function $n(o,e){const t=document.createElement("span");t.style.cssText="display:flex;flex-direction:column;gap:4px;min-width:0;";const s=document.createElement("span");s.style.cssText="display:flex;align-items:center;gap:8px;min-width:0;";const n=document.createElement("a");n.href=yt(e.extra,o.id),n.setAttribute("data-noclick","");const a=we(o)||f("(no title)");n.textContent=a,n.title=a,n.style.cssText="font-weight:600;color:inherit;text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:340px;",ws(n),n.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),e.openUrl(n.href,a,"dashicons-admin-post")}),s.appendChild(n);const i=o.openstation_lock??null;i&&s.appendChild(Je(i.userName,{fg:"var(--os-ui-danger, #b32d2e)",bg:"var(--os-ui-surface-raised, rgba(179, 45, 46, 0.1))"},{icon:Cn(),title:W(f("%s is currently editing"),i.userName)}));const r=e.extra.mode==="pages";if(r&&typeof e.extra.frontPageId=="number"&&e.extra.frontPageId===o.id&&s.appendChild(Je(f("Front page"),{fg:"var(--os-ui-info-fg, #0a4b78)",bg:"var(--os-ui-info-bg, rgba(34,113,177,0.12))"},{icon:ks("dashicons-admin-home")})),r&&typeof e.extra.postsPageId=="number"&&e.extra.postsPageId===o.id&&s.appendChild(Je(f("Posts page"),{fg:"var(--os-ui-accent, #5b3aa0)",bg:"var(--os-ui-surface-raised, rgba(91,58,160,0.12))"},{icon:ks("dashicons-admin-post")})),o.status&&o.status!=="publish"&&s.appendChild(Je(xs[o.status]??o.status,wn(o.status),{uppercase:!0})),r&&typeof o.link=="string"&&o.link&&o.status==="publish"){const c=document.createElement("a");c.href=o.link,c.target="_blank",c.rel="noreferrer noopener",c.textContent=f("View"),c.title=o.link,c.setAttribute("data-noclick",""),c.style.cssText="font-size:11px;color:var(--wp-admin-theme-color, #2271b1);text-decoration:none;flex-shrink:0;",c.addEventListener("click",l=>l.stopPropagation()),ws(c),s.appendChild(c)}return t.appendChild(s),t}function Sn(o){const e=xt(o),t=document.createElement("span");t.style.cssText="display:inline-flex;align-items:center;gap:8px;min-width:0;";const s=document.createElement("os-avatar");s.setAttribute("size","24"),e.name&&s.setAttribute("name",e.name),e.id>0&&s.setAttribute("user-id",String(e.id)),e.avatar&&ln(s,e.avatar),t.appendChild(s);const n=document.createElement("span");return n.textContent=e.name,n.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",t.appendChild(n),t}function En(o){const e=document.createElement("span");e.style.cssText="display:flex;flex-direction:column;line-height:1.2;";const t=document.createElement("os-relative-time");if(t.setAttribute("datetime",o.date_gmt||o.date),e.appendChild(t),o.modified_gmt&&o.modified_gmt!==o.date_gmt){const s=document.createElement("span");s.textContent=f("modified"),s.style.cssText="font-size:11px;color:var(--os-ui-fg-muted, #646970);",e.appendChild(s)}return e}function An(o){const e=document.createElement("div");e.style.cssText="display:flex;gap:16px;padding:12px 16px;background:var(--os-ui-surface-sunken, #fafafa);align-items:flex-start;";const t=wt(o);if(t){const r=document.createElement("img");r.src=t.url,r.alt=t.alt,r.loading="lazy",r.style.cssText="width:96px;height:96px;border-radius:6px;object-fit:cover;flex-shrink:0;",e.appendChild(r)}const s=document.createElement("div");s.style.cssText="flex:1;min-width:0;display:flex;flex-direction:column;gap:6px;";const n=document.createElement("div");n.style.cssText="font-size:13px;color:var(--os-ui-fg-muted, #646970);text-transform:uppercase;letter-spacing:0.04em;",n.textContent=f("Excerpt"),s.appendChild(n);const a=document.createElement("div");a.style.cssText="color:var(--os-ui-fg, #1d2327);line-height:1.5;";const i=o.excerpt?.rendered??"";return i?a.textContent=pe(i.replace(/<[^>]+>/g,"").trim())||f("(no excerpt)"):(a.textContent=f("(no excerpt)"),a.style.color="var(--os-ui-fg-muted, #a7aaad)"),s.appendChild(a),e.appendChild(s),e}const Cs={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 $s(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Tn(o){return Object.prototype.hasOwnProperty.call(Cs,o)?Cs[o]:null}function Mn(o,e={}){const t=Tn(o);if(!t)return"";const{size:s=24,className:n,title:a,rotate:i}=e,r=['xmlns="http://www.w3.org/2000/svg"','viewBox="0 0 24 24"'];s!=null&&r.push(`width="${s}"`,`height="${s}"`),r.push(t.a),n&&r.push(`class="${$s(n)}"`),a?r.push('role="img"',`aria-label="${$s(a)}"`):r.push('aria-hidden="true"','focusable="false"');const c=i?`<g transform="rotate(${i} 12 12)">${t.b}</g>`:t.b;return`<svg ${r.join(" ")}>${c}</svg>`}function se(o,e={}){const t=Mn(o,e),s=document.createElement("div");s.innerHTML=t;const n=s.firstElementChild;return n instanceof SVGSVGElement?n:document.createElementNS("http://www.w3.org/2000/svg","svg")}const In=F`: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:var( --os-ui-field-font-size-compact,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-accent-ink,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-accent-ink,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}`,_e=F`: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 ) )}`,Ln=F` .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%}}`,Ss=F` .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%}}`,Es=F` .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}}`,As=F` .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}}`,Ts=F` .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}}`,Pn=F` .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%}}`,zn=F` .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}}`,Ms=F` 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}}`,Ct=F` 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-accent-ink,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-accent-ink,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-accent-ink,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}}`,Is=F` @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}}`;F` ${_e} ${Ln} ${Ss} ${Es} ${As} ${Ts} ${Pn} ${zn} ${Ms} ${Ct} ${Is} `;const Rn=F` ${_e}: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}`,De=class De extends X{constructor(){super(...arguments),this._onHostKeyDown=e=>{if(this.dismissible!==null&&(e.key==="Backspace"||e.key==="Delete")){if(e.preventDefault(),this.disabled!==null)return;const n=this.label??"";this.emit("os-chip-dismiss",{label:n})}}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._onHostKeyDown)}disconnectedCallback(){this.removeEventListener("keydown",this._onHostKeyDown)}render(){const e=this.label??"",t=this.dismissible!==null,s=this.disabled!==null;return C`
41 41 <span part="chip" class="os-chip">
42 42 <span class="os-chip__icon">
43 43 <slot name="icon"></slot>
44 44 </span>
45 45 <span class="os-chip__label">
46 - ${e===""?k`<slot></slot>`:e}
46 + ${e===""?C`<slot></slot>`:e}
47 47 </span>
48 - ${t?k`
48 + ${t?C`
49 49 <button
50 50 part="dismiss"
51 51 class="os-chip__dismiss"
52 52 type="button"
@@ -55,13 +55,13 @@
55 55 @click=${n=>this._onDismiss(n)}
56 56 >
57 57 ${se("close",{size:null})}
58 58 </button>
59 - `:k``}
59 + `:C``}
60 60 </span>
61 - `}_onDismiss(e){if(e.stopPropagation(),this.disabled!==null)return;const s=this.label??"";this.emit("os-chip-dismiss",{label:s})}};De.props=["label","tone","size","dismissible","disabled","pending","selected"],De.styles=[vn],De.help=void 0;let Ct=De;Q("os-chip",Ct);const oe="10px",yn=H`: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% - ${oe} ) 0,100% 50%,calc( 100% - ${oe} ) 100%,0 100% )}.os-crumb--middle{padding-inline:22px;margin-inline-start:calc( -1 * ${oe} );clip-path:polygon( ${oe} 0,calc( 100% - ${oe} ) 0,100% 50%,calc( 100% - ${oe} ) 100%,${oe} 100%,0 50% )}.os-crumb--last{padding-inline-start:22px;padding-inline-end:14px;margin-inline-start:calc( -1 * ${oe} );clip-path:polygon( ${oe} 0,100% 0,100% 100%,${oe} 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}`,Oe=class Oe extends X{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?k``:k`
61 + `}_onDismiss(e){if(e.stopPropagation(),this.disabled!==null)return;const s=this.label??"";this.emit("os-chip-dismiss",{label:s})}};De.props=["label","tone","size","dismissible","disabled","pending","selected"],De.styles=[Rn],De.help=void 0;let $t=De;Q("os-chip",$t);const oe="10px",Nn=F`: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% - ${oe} ) 0,100% 50%,calc( 100% - ${oe} ) 100%,0 100% )}.os-crumb--middle{padding-inline:22px;margin-inline-start:calc( -1 * ${oe} );clip-path:polygon( ${oe} 0,calc( 100% - ${oe} ) 0,100% 50%,calc( 100% - ${oe} ) 100%,${oe} 100%,0 50% )}.os-crumb--last{padding-inline-start:22px;padding-inline-end:14px;margin-inline-start:calc( -1 * ${oe} );clip-path:polygon( ${oe} 0,100% 0,100% 100%,${oe} 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}`,Oe=class Oe extends X{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`
62 62 <div class="os-crumb-chain" role="group">
63 - ${t.map((s,n)=>{const a=As(n,t.length),i=s.color,r=i?`--os-ui-crumb-bg: ${i}; --os-ui-crumb-fg: ${Ts(i)};`:"";return k`
63 + ${t.map((s,n)=>{const a=zs(n,t.length),i=s.color,r=i?`--os-ui-crumb-bg: ${i}; --os-ui-crumb-fg: ${Rs(i)};`:"";return C`
64 64 <span
65 65 class=${`os-crumb os-crumb--${a}`}
66 66 style=${r}
67 67 title=${s.name}
@@ -69,9 +69,9 @@
69 69 @click=${c=>this._onSegmentClick(c,n,s)}
70 70 @dragstart=${c=>this._onSegmentDragStart(c,n,s)}
71 71 >
72 72 <span class="os-crumb__label">${s.name}</span>
73 - ${e?k`
73 + ${e?C`
74 74 <button
75 75 type="button"
76 76 class="os-crumb__remove"
77 77 aria-label=${`Remove ${s.name}`}
@@ -76,19 +76,19 @@
76 76 class="os-crumb__remove"
77 77 aria-label=${`Remove ${s.name}`}
78 78 draggable="false"
79 79 @click=${c=>this._onRemove(c,n,s)}
80 - >${Cn()}</button>
81 - `:k``}
80 + >${qn()}</button>
81 + `:C``}
82 82 </span>
83 83 `})}
84 84 </div>
85 - `}_onSegmentDragStart(e,t,s){if(e.target?.closest(".os-crumb__remove")){e.preventDefault();return}const a=this._segments.slice(t);if(e.dataTransfer){const i=kn(a);document.body.appendChild(i);const r=e.currentTarget?.getBoundingClientRect(),c=r?Math.min(30,r.width/2):16,l=r?Math.min(16,r.height/2):12;e.dataTransfer.setDragImage(i,c,l),requestAnimationFrame(()=>i.remove())}this.emit("os-chain-segment-dragstart",{index:t,id:s.id,segment:s,segments:a,dragEvent:e})}_onSegmentClick(e,t,s){e.target?.closest(".os-crumb__remove")||this.emit("os-chain-segment-click",{index:t,id:s.id,segment:s})}_onRemove(e,t,s){e.stopPropagation(),this.emit("os-chain-remove",{index:t,id:s.id,segment:s})}};Oe.props=["removable","disabled"],Oe.styles=[yn],Oe.help=void 0;let $t=Oe;Q("os-crumb-chain",$t);const xn=10;function kn(o){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=o.length,s=wn();return o.forEach((n,a)=>{const i=document.createElement("span"),r=n.color??s.bg,c=n.color?Ts(n.color):s.fg,l=As(a,t),u=["display: inline-flex","align-items: center","justify-content: center","min-height: 22px",`background: ${r}`,`color: ${c}`,"white-space: nowrap","box-sizing: border-box","letter-spacing: 0.01em"],d=xn;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% - ${d}px ) 0, 100% 50%, calc( 100% - ${d}px ) 100%, 0 100% )`):l==="middle"?u.push("padding: 2px 22px",`margin-inline-start: -${d}px`,`clip-path: polygon( ${d}px 0, calc( 100% - ${d}px ) 0, 100% 50%, calc( 100% - ${d}px ) 100%, ${d}px 100%, 0 50% )`):u.push("padding: 2px 14px 2px 22px",`margin-inline-start: -${d}px`,`clip-path: polygon( ${d}px 0, 100% 0, 100% 100%, ${d}px 100%, 0 50% )`),i.style.cssText=u.join("; "),i.textContent=n.name,e.appendChild(i)}),e}const Ss="rgba( 0, 0, 0, 0.08 )",Es="#1d2327";function wn(){if(typeof document>"u"||!document.body)return{bg:Ss,fg:Es};const o=getComputedStyle(document.body);return{bg:o.getPropertyValue("--os-ui-crumb-bg").trim()||Ss,fg:o.getPropertyValue("--os-ui-crumb-fg").trim()||Es}}function As(o,e){return e===1?"solo":o===0?"first":o===e-1?"last":"middle"}let Le=null;function Ts(o){Le||(Le=document.createElement("canvas"),Le.width=1,Le.height=1);const e=Le.getContext("2d",{willReadFrequently:!0});if(!e)return"#1d2327";try{e.clearRect(0,0,1,1),e.fillStyle=o,e.fillRect(0,0,1,1);const t=e.getImageData(0,0,1,1).data,s=t[3]/255,n=t[0]*s+255*(1-s),a=t[1]*s+255*(1-s),i=t[2]*s+255*(1-s),r=l=>{const u=l/255;return u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4)};return .2126*r(n)+.7152*r(a)+.0722*r(i)>.55?"#1d2327":"#fff"}catch{return"#1d2327"}}function Cn(){return se("close",{size:null})}const Ms="uncategorized",$n=1;function Qe(o){return o.id===$n?!0:(o.name||"").toLowerCase()===Ms}const qe=class qe extends X{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 s=this.disabled!==null,n=this.readonly!==null;s||n||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,s=this.readonly!==null,n=this.loading!==null,a=this["add-label"]||"Categorize",i=this.placeholder||"Search categories…",r=Math.max(0,parseInt(this["max-visible"]||"2",10)||2);return k`
85 + `}_onSegmentDragStart(e,t,s){if(e.target?.closest(".os-crumb__remove")){e.preventDefault();return}const a=this._segments.slice(t);if(e.dataTransfer){const i=On(a);document.body.appendChild(i);const r=e.currentTarget?.getBoundingClientRect(),c=r?Math.min(30,r.width/2):16,l=r?Math.min(16,r.height/2):12;e.dataTransfer.setDragImage(i,c,l),requestAnimationFrame(()=>i.remove())}this.emit("os-chain-segment-dragstart",{index:t,id:s.id,segment:s,segments:a,dragEvent:e})}_onSegmentClick(e,t,s){e.target?.closest(".os-crumb__remove")||this.emit("os-chain-segment-click",{index:t,id:s.id,segment:s})}_onRemove(e,t,s){e.stopPropagation(),this.emit("os-chain-remove",{index:t,id:s.id,segment:s})}};Oe.props=["removable","disabled"],Oe.styles=[Nn],Oe.help=void 0;let St=Oe;Q("os-crumb-chain",St);const Dn=10;function On(o){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=o.length,s=Hn();return o.forEach((n,a)=>{const i=document.createElement("span"),r=n.color??s.bg,c=n.color?Rs(n.color):s.fg,l=zs(a,t),d=["display: inline-flex","align-items: center","justify-content: center","min-height: 22px",`background: ${r}`,`color: ${c}`,"white-space: nowrap","box-sizing: border-box","letter-spacing: 0.01em"],u=Dn;l==="solo"?d.push("padding: 2px 12px","border-radius: 999px"):l==="first"?d.push("padding: 2px 22px 2px 12px",`clip-path: polygon( 0 0, calc( 100% - ${u}px ) 0, 100% 50%, calc( 100% - ${u}px ) 100%, 0 100% )`):l==="middle"?d.push("padding: 2px 22px",`margin-inline-start: -${u}px`,`clip-path: polygon( ${u}px 0, calc( 100% - ${u}px ) 0, 100% 50%, calc( 100% - ${u}px ) 100%, ${u}px 100%, 0 50% )`):d.push("padding: 2px 14px 2px 22px",`margin-inline-start: -${u}px`,`clip-path: polygon( ${u}px 0, 100% 0, 100% 100%, ${u}px 100%, 0 50% )`),i.style.cssText=d.join("; "),i.textContent=n.name,e.appendChild(i)}),e}const Ls="rgba( 0, 0, 0, 0.08 )",Ps="#1d2327";function Hn(){if(typeof document>"u"||!document.body)return{bg:Ls,fg:Ps};const o=getComputedStyle(document.body);return{bg:o.getPropertyValue("--os-ui-crumb-bg").trim()||Ls,fg:o.getPropertyValue("--os-ui-crumb-fg").trim()||Ps}}function zs(o,e){return e===1?"solo":o===0?"first":o===e-1?"last":"middle"}let Le=null;function Rs(o){Le||(Le=document.createElement("canvas"),Le.width=1,Le.height=1);const e=Le.getContext("2d",{willReadFrequently:!0});if(!e)return"#1d2327";try{e.clearRect(0,0,1,1),e.fillStyle=o,e.fillRect(0,0,1,1);const t=e.getImageData(0,0,1,1).data,s=t[3]/255,n=t[0]*s+255*(1-s),a=t[1]*s+255*(1-s),i=t[2]*s+255*(1-s),r=l=>{const d=l/255;return d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4)};return .2126*r(n)+.7152*r(a)+.0722*r(i)>.55?"#1d2327":"#fff"}catch{return"#1d2327"}}function qn(){return se("close",{size:null})}const Ns="uncategorized",Fn=1;function Qe(o){return o.id===Fn?!0:(o.name||"").toLowerCase()===Ns}const He=class He extends X{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 s=this.disabled!==null,n=this.readonly!==null;s||n||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,s=this.readonly!==null,n=this.loading!==null,a=this["add-label"]||"Categorize",i=this.placeholder||"Search categories…",r=Math.max(0,parseInt(this["max-visible"]||"2",10)||2);return C`
86 86 <span class="os-cat" role="group">
87 87 ${this._renderChipRow(r,s,t,a)}
88 - ${e?this._renderPopover(i,n):k``}
88 + ${e?this._renderPopover(i,n):C``}
89 89 </span>
90 - `}_renderChipRow(e,t,s,n){const a=this._selectedItemsInOrder();if(a.length===0)return k`
90 + `}_renderChipRow(e,t,s,n){const a=this._selectedItemsInOrder();if(a.length===0)return C`
91 91 <span class="os-cat__chips" role="list">
92 92 <span
93 93 class="os-cat__uncategorized"
94 94 title=${'Posts with no category appear as "Uncategorized" in WordPress.'}
@@ -94,9 +94,9 @@
94 94 title=${'Posts with no category appear as "Uncategorized" in WordPress.'}
95 95 @click=${this._onCellClick}
96 96 >${"Uncategorized"}</span>
97 97 </span>
98 - `;const i=this._buildChains(a);return k`
98 + `;const i=this._buildChains(a);return C`
99 99 <div
100 100 class="os-cat__chains"
101 101 role="list"
102 102 @click=${this._onCellClick}
@@ -102,9 +102,9 @@
102 102 @click=${this._onCellClick}
103 103 >
104 104 ${i.map(r=>this._renderChain(r,t,s))}
105 105 </div>
106 - `}_buildChains(e){const t=new Map;for(const r of this._items)t.set(r.id,r);const s=new Set(e.map(r=>r.id)),n=r=>{for(const c of s){if(c===r)continue;let l=t.get(c),u=16;for(;l&&u-- >0;){if(l.parent===r)return!0;if(!l.parent)break;l=t.get(l.parent)}}return!1},a=e.filter(r=>!n(r.id)),i=[];for(const r of a){const c=[];let l=r,u=16;for(;l&&u-- >0&&((l===r||s.has(l.id))&&c.unshift(l),!!l.parent);)l=t.get(l.parent);const d=c.map(h=>({id:h.id,name:h.name}));i.push({id:r.id,segments:d})}return i}_renderChain(e,t,s){const n=!t&&!s,a=r=>{r.stopPropagation();const c=r.detail,l=typeof c?.index=="number"?c.index:e.segments.length-1,u=new Set;for(const h of e.segments.slice(l))typeof h.id=="number"&&u.add(h.id);const d=this._value.filter(h=>!u.has(h));d.length!==this._value.length&&this.emit("os-categories-change",{value:d})},i=document.createElement("os-crumb-chain");return i.segments=e.segments,n&&i.setAttribute("removable",""),i.addEventListener("os-chain-remove",a),k`<div role="listitem">${i}</div>`}_renderPopover(e,t){const s=this._buildTree(),n=this._filterTree(s,this._query),a=this._flattenForDisplay(n);return this._focusedRow>=a.length&&(this._focusedRow=a.length>0?a.length-1:-1),k`
106 + `}_buildChains(e){const t=new Map;for(const r of this._items)t.set(r.id,r);const s=new Set(e.map(r=>r.id)),n=r=>{for(const c of s){if(c===r)continue;let l=t.get(c),d=16;for(;l&&d-- >0;){if(l.parent===r)return!0;if(!l.parent)break;l=t.get(l.parent)}}return!1},a=e.filter(r=>!n(r.id)),i=[];for(const r of a){const c=[];let l=r,d=16;for(;l&&d-- >0&&((l===r||s.has(l.id))&&c.unshift(l),!!l.parent);)l=t.get(l.parent);const u=c.map(h=>({id:h.id,name:h.name}));i.push({id:r.id,segments:u})}return i}_renderChain(e,t,s){const n=!t&&!s,a=r=>{r.stopPropagation();const c=r.detail,l=typeof c?.index=="number"?c.index:e.segments.length-1,d=new Set;for(const h of e.segments.slice(l))typeof h.id=="number"&&d.add(h.id);const u=this._value.filter(h=>!d.has(h));u.length!==this._value.length&&this.emit("os-categories-change",{value:u})},i=document.createElement("os-crumb-chain");return i.segments=e.segments,n&&i.setAttribute("removable",""),i.addEventListener("os-chain-remove",a),C`<div role="listitem">${i}</div>`}_renderPopover(e,t){const s=this._buildTree(),n=this._filterTree(s,this._query),a=this._flattenForDisplay(n);return this._focusedRow>=a.length&&(this._focusedRow=a.length>0?a.length-1:-1),C`
107 107 <div class="os-cat__popover" role="dialog" aria-label="Choose categories">
108 108 <input
109 109 class="os-cat__search"
110 110 type="text"
@@ -125,18 +125,18 @@
125 125 <strong>Uncategorized</strong>.
126 126 </span>
127 127 </div>
128 128 </div>
129 - `}_renderTreeBody(e,t){return e?k`
129 + `}_renderTreeBody(e,t){return e?C`
130 130 <div class="os-cat__loading">
131 131 <span class="os-cat__loading-spinner" aria-hidden="true"></span>
132 132 ${"Loading categories…"}
133 133 </div>
134 - `:t.length===0?k`
134 + `:t.length===0?C`
135 135 <div class="os-cat__empty">
136 136 ${this._items.length===0?"No categories yet — create one in WordPress to assign.":"No matches."}
137 137 </div>
138 - `:t.map((s,n)=>this._renderRow(s,n,t.length))}_renderRow(e,t,s){const{node:n,hasChildren:a}=e,i=this._value.includes(n.item.id),r=!this._collapsed.has(n.item.id),c=12+n.depth*16,l=n.depth>0?n.depth*16:0,u=t===this._focusedRow;return k`
138 + `:t.map((s,n)=>this._renderRow(s,n,t.length))}_renderRow(e,t,s){const{node:n,hasChildren:a}=e,i=this._value.includes(n.item.id),r=!this._collapsed.has(n.item.id),c=12+n.depth*16,l=n.depth>0?n.depth*16:0,d=t===this._focusedRow;return C`
139 139 <div class="os-cat__row-block">
140 140 <div
141 141 class="os-cat__row"
142 142 role="option"
@@ -142,33 +142,33 @@
142 142 role="option"
143 143 aria-selected=${i?"true":"false"}
144 144 data-selected=${i?"true":"false"}
145 145 data-expanded=${r?"true":"false"}
146 - data-focused=${u?"true":"false"}
146 + data-focused=${d?"true":"false"}
147 147 data-row-id=${String(n.item.id)}
148 148 style=${`--os-ui-cat-row-indent: ${c}px; --os-ui-cat-guide-width: ${l}px;`}
149 149 @mouseenter=${()=>{this._focusedRow=t,this.requestUpdate()}}
150 - @click=${d=>{d.preventDefault(),this._toggleSelection(n.item.id)}}
150 + @click=${u=>{u.preventDefault(),this._toggleSelection(n.item.id)}}
151 151 >
152 - ${a?k`<button
152 + ${a?C`<button
153 153 type="button"
154 154 class="os-cat__expander"
155 155 aria-label=${r?"Collapse":"Expand"}
156 - @click=${d=>{d.stopPropagation(),this._toggleExpand(n.item.id)}}
157 - >${Is()}</button>`:k`<span class="os-cat__expander os-cat__expander--placeholder" aria-hidden="true">${Is()}</span>`}
158 - <span class="os-cat__check" aria-hidden="true">${En()}</span>
156 + @click=${u=>{u.stopPropagation(),this._toggleExpand(n.item.id)}}
157 + >${Ds()}</button>`:C`<span class="os-cat__expander os-cat__expander--placeholder" aria-hidden="true">${Ds()}</span>`}
158 + <span class="os-cat__check" aria-hidden="true">${Wn()}</span>
159 159 <span class="os-cat__label">${this._highlight(n.item.name,this._query)}</span>
160 - ${Qe(n.item)?k``:k`<button
160 + ${Qe(n.item)?C``:C`<button
161 161 type="button"
162 162 class="os-cat__delete"
163 163 aria-label=${`Delete ${n.item.name}`}
164 164 title=${`Delete ${n.item.name}`}
165 - @click=${d=>this._onDeleteClick(d,n.item)}
166 - >${An()}</button>`}
165 + @click=${u=>this._onDeleteClick(u,n.item)}
166 + >${Vn()}</button>`}
167 167 </div>
168 - ${r&&!Qe(n.item)?this._renderCreateRow(n.item.id,12+(n.depth+1)*16,(n.depth+1)*16,n.item.name):k``}
168 + ${r&&!Qe(n.item)?this._renderCreateRow(n.item.id,12+(n.depth+1)*16,(n.depth+1)*16,n.item.name):C``}
169 169 </div>
170 - `}_renderCreateRow(e,t,s,n){const a=this._creatingValues.get(e)??"",i=this._creatingPending.has(e),r=e===0?"Add new category…":`Add child of "${n}"…`;return k`
170 + `}_renderCreateRow(e,t,s,n){const a=this._creatingValues.get(e)??"",i=this._creatingPending.has(e),r=e===0?"Add new category…":`Add child of "${n}"…`;return C`
171 171 <div
172 172 class="os-cat__create-row"
173 173 style=${`--os-ui-cat-row-indent: ${t}px; --os-ui-cat-guide-width: ${s}px;`}
174 174 @click=${c=>c.stopPropagation()}
@@ -185,20 +185,20 @@
185 185 ?disabled=${i}
186 186 @input=${c=>this._onCreateInput(c,e)}
187 187 @keydown=${c=>this._onCreateKeydown(c,e)}
188 188 />
189 - ${i?k`<span class="os-cat__create-spinner" aria-hidden="true"></span>`:k`<button
189 + ${i?C`<span class="os-cat__create-spinner" aria-hidden="true"></span>`:C`<button
190 190 type="button"
191 191 class="os-cat__create-submit"
192 192 aria-label=${e===0?"Create category":`Create child of ${n}`}
193 193 ?disabled=${a.trim().length===0}
194 194 @click=${c=>{c.stopPropagation(),this._submitCreate(e)}}
195 - >${Sn()}</button>`}
195 + >${Un()}</button>`}
196 196 </div>
197 197 </div>
198 - `}_onCreateInput(e,t){const s=e.target.value;s===""?this._creatingValues.delete(t):this._creatingValues.set(t,s),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 a of this._items)e.set(a.id,{item:a,children:[],depth:0});const t=[];for(const a of e.values()){const i=a.item.parent;i&&e.has(i)?e.get(i).children.push(a):t.push(a)}const s=(a,i)=>{a.depth=i;for(const r of a.children)s(r,i+1)};for(const a of t)s(a,0);const n=a=>{a.sort((i,r)=>{const c=Qe(i.item),l=Qe(r.item);return c!==l?c?-1:1:i.item.name.localeCompare(r.item.name)});for(const i of a)n(i.children)};return n(t),t}_filterTree(e,t){const s=t.trim().toLowerCase();if(!s)return e;const n=a=>{if(a.item.name.toLowerCase().includes(s))return{item:a.item,children:a.children.slice(),depth:a.depth};const r=a.children.map(n).filter(c=>c!==null);return r.length>0?{item:a.item,children:r,depth:a.depth}:null};return e.map(n).filter(a=>a!==null)}_flattenForDisplay(e){const t=[],s=this._query.trim()!=="",n=a=>{for(const i of a)t.push({node:i,visible:!0,hasChildren:i.children.length>0}),!(this._collapsed.has(i.item.id)&&!s)&&i.children.length>0&&n(i.children)};return n(e),t}_selectedItemsInOrder(){const e=new Map;for(const n of this._items)e.set(n.id,n);const t=[],s=[];for(const n of this._value){const a=e.get(n);a&&(a.name.toLowerCase()===Ms||a.id===1?s.push(a):t.push(a))}return t.length>0?t:s.length>0?[]:t}_highlight(e,t){const s=t.trim();if(!s)return e;const n=e.toLowerCase(),a=s.toLowerCase(),i=n.indexOf(a);return i===-1?e:k`${e.slice(0,i)}<span class="os-cat__match"
198 + `}_onCreateInput(e,t){const s=e.target.value;s===""?this._creatingValues.delete(t):this._creatingValues.set(t,s),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 a of this._items)e.set(a.id,{item:a,children:[],depth:0});const t=[];for(const a of e.values()){const i=a.item.parent;i&&e.has(i)?e.get(i).children.push(a):t.push(a)}const s=(a,i)=>{a.depth=i;for(const r of a.children)s(r,i+1)};for(const a of t)s(a,0);const n=a=>{a.sort((i,r)=>{const c=Qe(i.item),l=Qe(r.item);return c!==l?c?-1:1:i.item.name.localeCompare(r.item.name)});for(const i of a)n(i.children)};return n(t),t}_filterTree(e,t){const s=t.trim().toLowerCase();if(!s)return e;const n=a=>{if(a.item.name.toLowerCase().includes(s))return{item:a.item,children:a.children.slice(),depth:a.depth};const r=a.children.map(n).filter(c=>c!==null);return r.length>0?{item:a.item,children:r,depth:a.depth}:null};return e.map(n).filter(a=>a!==null)}_flattenForDisplay(e){const t=[],s=this._query.trim()!=="",n=a=>{for(const i of a)t.push({node:i,visible:!0,hasChildren:i.children.length>0}),!(this._collapsed.has(i.item.id)&&!s)&&i.children.length>0&&n(i.children)};return n(e),t}_selectedItemsInOrder(){const e=new Map;for(const n of this._items)e.set(n.id,n);const t=[],s=[];for(const n of this._value){const a=e.get(n);a&&(a.name.toLowerCase()===Ns||a.id===1?s.push(a):t.push(a))}return t.length>0?t:s.length>0?[]:t}_highlight(e,t){const s=t.trim();if(!s)return e;const n=e.toLowerCase(),a=s.toLowerCase(),i=n.indexOf(a);return i===-1?e:C`${e.slice(0,i)}<span class="os-cat__match"
199 199 >${e.slice(i,i+s.length)}</span
200 - >${e.slice(i+s.length)}`}_toggleSelection(e){const t=this._value.includes(e)?this._value.filter(s=>s!==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 s=t[this._focusedRow];s.hasChildren&&this._collapsed.has(s.node.item.id)&&(e.preventDefault(),this._toggleExpand(s.node.item.id));return}case"ArrowLeft":{if(this._focusedRow<0||this._focusedRow>=t.length)return;const s=t[this._focusedRow];s.hasChildren&&!this._collapsed.has(s.node.item.id)&&(e.preventDefault(),this._toggleExpand(s.node.item.id));return}case"Enter":case" ":{if(this._focusedRow<0||this._focusedRow>=t.length)return;e.preventDefault();const s=t[this._focusedRow];this._toggleSelection(s.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 s=t.getBoundingClientRect(),n=e.getBoundingClientRect();s.top<n.top?t.scrollIntoView({block:"nearest"}):s.bottom>n.bottom&&t.scrollIntoView({block:"nearest"})})}_positionPopover(){const e=this.shadowRoot?.querySelector(".os-cat__popover");if(!e)return;const t=this.getBoundingClientRect(),s=e.getBoundingClientRect(),n=window.innerWidth,a=window.innerHeight,i=8;let r=t.bottom+4;const c=r+s.height+i>a,l=t.top-4-s.height>=i;c&&l?r=t.top-4-s.height:c&&(r=Math.max(i,a-s.height-i));let u=t.left;u+s.width+i>n&&(u=t.right-s.width),u=Math.max(i,Math.min(u,n-s.width-i)),e.style.top=`${r}px`,e.style.left=`${u}px`}};qe.props=["placeholder","add-label","disabled","readonly","open","loading","max-visible"],qe.styles=[gn],qe.help=void 0;let St=qe;Q("os-category-picker",St);function Is(){return se("chevron-right",{size:14})}function Sn(){return se("plus",{size:16})}function En(){return se("check",{size:null})}function An(){return se("close",{size:null})}const Et="application/x-os-categories";function Ls(o){return o.categories.tree||(o.categories.tree=o.client.fetchAllCategories().then(e=>e.map(t=>({id:t.id,name:t.name,parent:t.parent})))),o.categories.tree}function At(o){o.categories.tree=null}function Tn(o){Ls(o).then(e=>{for(const t of o.categories.pickers)t.isConnected?t.items=e:o.categories.pickers.delete(t)}).catch(()=>{})}function Mn(o,e){const{client:t}=e,s=document.createElement("span");s.style.cssText="display:inline-flex;align-items:center;width:100%;min-width:0;border-radius:6px;transition:background-color 0.12s ease, box-shadow 0.12s ease;";const n=document.createElement("os-category-picker");n.setAttribute("placeholder",f("Search categories…")),n.setAttribute("add-label",f("Categorize")),n.setAttribute("data-noclick",""),e.categories.pickers.add(n),n.value=o.categories??[],n.items=xt(o,"category").map(d=>({id:d.id,name:d.name,parent:0}));const a={categoryIds:(o.categories??[]).slice()},i=d=>{a.categoryIds=d.slice(),n.value=d},r=async(d,h,p)=>{try{await t.updatePostCategories(o.id,d),e.announce("categorized",[o.id])}catch(g){i(h),e.toast(p,g)}};Ls(e).then(d=>{n.isConnected&&(n.items=d)}).catch(d=>{console.warn("[openstation:desktop-mode-posts] category tree fetch failed",d)}),n.addEventListener("os-categories-open",()=>{e.categories.tree&&e.categories.tree.then(d=>{n.items=d}).catch(()=>{})}),n.addEventListener("os-categories-create",async d=>{const h=d.detail,p=h?.parent??0;if(!h||!h.name){n.failCreating(p);return}try{const g=await t.createCategory(h.name,p);At(e),n.items=[...n.items,{id:g.id,name:g.name,parent:g.parent}];const m=a.categoryIds.slice(),b=[...m,g.id];i(b),n.endCreating(p),await r(b,m,f("Couldn’t assign new category."))}catch(g){n.failCreating(p,g instanceof Error?g.message:String(g)),e.toast(f("Couldn’t create category."),g)}}),n.addEventListener("os-categories-change",async d=>{const h=d.detail;if(!h||!Array.isArray(h.value))return;const p=a.categoryIds.slice(),g=h.value.slice();i(g),await r(g,p,f("Couldn’t update categories."))}),n.addEventListener("os-categories-delete",async d=>{const h=d.detail;if(!(!h||typeof h.id!="number"||!await e.confirm({title:f("Delete category?"),message:V(f('Delete the category "%s"? Posts assigned only to it will fall back to Uncategorized.'),h.name),confirmLabel:f("Delete"),danger:!0})))try{if(await t.deleteTerm("categories",h.id),a.categoryIds.includes(h.id)){const g=a.categoryIds.filter(m=>m!==h.id);i(g);try{await t.updatePostCategories(o.id,g)}catch(m){e.toast(f("Couldn’t update post categories after delete."),m)}}}catch(g){e.toast(f("Couldn’t delete category."),g)}}),n.addEventListener("os-chain-segment-dragstart",d=>{const h=d.detail;if(!h?.dragEvent?.dataTransfer)return;const p=h.segments.map(m=>m.id).filter(m=>typeof m=="number");if(p.length===0)return;const g=h.dragEvent.dataTransfer;g.setData(Et,JSON.stringify({ids:p,source:"posts-window",sourcePostId:o.id})),g.setData("text/plain",p.join(",")),g.effectAllowed="copy"});let c=0;const l=d=>{s.style.backgroundColor=d?"color-mix(in srgb, var(--wp-admin-theme-color, #2271b1) 12%, transparent)":"",s.style.boxShadow=d?"inset 0 0 0 2px var(--wp-admin-theme-color, #2271b1)":""},u=d=>Array.from(d.dataTransfer?.types??[]).includes(Et);return s.addEventListener("dragenter",d=>{u(d)&&(d.preventDefault(),c++,l(!0))}),s.addEventListener("dragover",d=>{u(d)&&(d.preventDefault(),d.dataTransfer&&(d.dataTransfer.dropEffect="copy"))}),s.addEventListener("dragleave",()=>{c>0&&c--,c===0&&l(!1)}),s.addEventListener("drop",async d=>{if(c=0,l(!1),!u(d))return;d.preventDefault();let h=null;try{h=JSON.parse(d.dataTransfer?.getData(Et)??"")}catch{return}if(!h||!Array.isArray(h.ids))return;const p=h.ids.filter(b=>typeof b=="number"&&Number.isFinite(b));if(p.length===0)return;const g=a.categoryIds.slice(),m=Array.from(new Set([...g,...p]));m.length!==g.length&&(i(m),await r(m,g,f("Couldn’t add category.")))}),s.appendChild(n),s}function Ps(o,e){o.parentTitles.clear();for(const t of e)o.parentTitles.set(t.id,we(t))}function In(o,e){const t=document.createElement("span"),s=typeof o.parent=="number"?o.parent:0;if(s===0)return t.textContent="—",t.setAttribute("aria-label",f("Top-level page")),t;const n=e.parentTitles.get(s);return t.textContent=n?`↳ ${n}`:V(f("↳ #%d"),s),t}function Ln(o,e){const t=document.createElement("span"),s=typeof o.template=="string"?o.template:"",n=e.extra.pageTemplates??{};return t.textContent=n[s]??(s===""?f("Default template"):s),s!==""&&(t.title=s),t}function Pn(o,e){const t=document.createElement("button");t.type="button";const s=typeof o.slug=="string"?o.slug:"";return t.textContent=s||"—",t.disabled=s==="",t.title=s?f("Click to copy slug"):"",Object.assign(t.style,{appearance:"none",background:"transparent",border:"none",padding:"2px 6px",font:"inherit",color:"inherit",cursor:s?"copy":"default",textAlign:"left",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',fontSize:"12px",borderRadius:"4px",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),t.addEventListener("click",n=>{n.stopPropagation(),s&&rs(s).then(a=>{if(!a){e.toast(f("Couldn’t copy the slug."),null);return}t.textContent=f("Copied!"),t.style.color="var(--wp-admin-theme-color, #2271b1)",setTimeout(()=>{t.textContent=s,t.style.color=""},1200)})}),t}function zn(o){const e=document.createElement("span");Object.assign(e.style,{display:"inline-flex",alignItems:"center",gap:"6px",fontVariantNumeric:"tabular-nums"});const t=typeof o.openstation_comment_count=="number"?o.openstation_comment_count:null;if(t===null)return e.textContent="—",e.style.color="var(--os-ui-fg-muted, #8c8f94)",e;const s=document.createElement("span");s.className="dashicons dashicons-admin-comments",s.setAttribute("aria-hidden","true"),Object.assign(s.style,{fontSize:"16px",width:"16px",height:"16px",color:t>0?"var(--wp-admin-theme-color, #2271b1)":"var(--os-ui-fg-muted, #8c8f94)"});const n=document.createElement("span");return n.textContent=String(t),t===0&&(n.style.color="var(--os-ui-fg-muted, #8c8f94)"),e.appendChild(s),e.appendChild(n),e.setAttribute("aria-label",V(de("%d comment","%d comments",t),t)),e}const Rn=H` ${_e} ${wt}: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 )}:host( [ stacked ] ) .scroll{border:0;border-radius:0}:host( [ stacked ] ) table,:host( [ stacked ] ) tbody{display:block;width:100%}:host( [ stacked ] ) colgroup,:host( [ stacked ] ) thead{display:none}:host( [ stacked ] ) tbody tr{display:flex;align-items:flex-start;gap:12px;padding:12px 14px;border-bottom:1px solid var( --_border );background-color:var( --_bg )}:host( [ stacked ] ) tbody tr:last-child{border-bottom:0}:host( [ stacked ] ) tbody td{display:block;padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none;min-width:0;width:auto;vertical-align:baseline}:host( [ stacked ] ) tbody tr.is-selected td,:host( [ stacked ] ) tbody tr.is-selected:hover td,:host( [ stacked ][ striped ] ) tbody tr:nth-child( odd ) td,:host( [ stacked ][ hover ] ) tbody tr:hover td,:host( [ stacked ][ hover ][ striped ] ) tbody tr:nth-child( odd ):hover td,:host( [ stacked ][ bordered ] ) tbody td{padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none}:host( [ stacked ][ hover ] ) tbody tr:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ stacked ] ) tbody tr.is-selected,:host( [ stacked ] ) tbody tr.is-selected:hover{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none;box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody:dir( rtl ) tr.is-selected{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody td.col-select,:host( [ stacked ] ) tbody td.col-expander{flex:0 0 auto;display:flex;align-items:center;justify-content:center;min-width:0}:host( [ stacked ] ) tbody td.col-select{width:44px;height:44px;margin:-11px 0 -11px -11px;cursor:pointer}:host( [ stacked ] ) .select-row-checkbox{width:22px;height:22px}:host( [ stacked ] ) tbody td.col-expander{width:28px;height:22px;margin-inline-start:-4px}:host( [ stacked ] ) tbody td.stack-body{flex:1 1 auto;display:flex;flex-direction:column;gap:4px;min-width:0}.stack-cell{display:flex;align-items:baseline;gap:6px;min-width:0;line-height:1.4}.stack-title{font-size:15px;font-weight:600;line-height:1.35}.stack-meta{font-size:13px}.stack-label{flex:0 0 auto;font-size:12px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) )}.stack-label::after{content:'·';margin-inline-start:6px}.stack-value{flex:1 1 auto;min-width:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px}.stack-actions{margin-block-start:6px}.stack-actions .stack-value{gap:8px}.stack-actions .stack-value>*{justify-content:flex-start;max-width:100%}:host( [ stacked ] ) tr.subtable,:host( [ stacked ] ) tr.empty{display:block;padding:0}:host( [ stacked ] ) tr.subtable td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ stacked ] ) tr.subtable .subtable-inner{padding:8px 14px 12px}:host( [ stacked ] ) tr.empty td{padding:24px}:host( [ stacked ] ) tr.skeleton{display:block;padding:14px;border-bottom:1px solid var( --_border )}:host( [ stacked ] ) tr.skeleton td.stack-body{gap:8px}:host( [ stacked ] ) tr.skeleton .skeleton-bar:first-child{height:15px}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}}`,Ce="__wpd_expander__",$e="__wpd_select__",He=class He extends X{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._stacked=!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(s=>s.key));for(const s of Object.keys(this._filters))t.has(s)||delete this._filters[s];for(const s of Array.from(this._filterCache.keys()))t.has(s)||this._filterCache.delete(s);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,s)=>{this._selection.has(this._getRowId(t,s))&&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,s)=>s,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(),s=t==="single"?Array.from(this._selection):[];t==="single"&&this._selection.clear(),this._selection.add(e),this._emitSelectionChange(),this._syncSelectionDom([e,...s])}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 s=t.querySelector("tbody");if(!s)return;let n=null;if(e!=="all"){n=new Set;for(const r of e)n.add(String(r))}const a=s.querySelectorAll("tr[data-row-id]");for(const r of a){const c=r.dataset.rowId;if(c===void 0||n&&!n.has(c))continue;const l=Number(r.dataset.rowIndex);if(!Number.isFinite(l))continue;const u=this._data[l];if(u===void 0)continue;const d=this._getRowId(u,l),h=this._selection.has(d);r.classList.toggle("is-selected",h);const p=r.querySelector("input.select-row-checkbox");p&&p.checked!==h&&(p.checked=h)}const i=t.querySelector("thead .select-all-checkbox");if(i){const{total:r,selected:c}=this._visibleSelectionStats();i.checked=r>0&&c===r,i.indeterminate=c>0&&c<r}}scrollToRow(e){const t=this.shadowRoot;if(!t)return;const n=t.querySelectorAll("tbody tr:not(.subtable):not(.empty):not(.skeleton)")[e];n&&n.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 k`
200 + >${e.slice(i+s.length)}`}_toggleSelection(e){const t=this._value.includes(e)?this._value.filter(s=>s!==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 s=t[this._focusedRow];s.hasChildren&&this._collapsed.has(s.node.item.id)&&(e.preventDefault(),this._toggleExpand(s.node.item.id));return}case"ArrowLeft":{if(this._focusedRow<0||this._focusedRow>=t.length)return;const s=t[this._focusedRow];s.hasChildren&&!this._collapsed.has(s.node.item.id)&&(e.preventDefault(),this._toggleExpand(s.node.item.id));return}case"Enter":case" ":{if(this._focusedRow<0||this._focusedRow>=t.length)return;e.preventDefault();const s=t[this._focusedRow];this._toggleSelection(s.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 s=t.getBoundingClientRect(),n=e.getBoundingClientRect();s.top<n.top?t.scrollIntoView({block:"nearest"}):s.bottom>n.bottom&&t.scrollIntoView({block:"nearest"})})}_positionPopover(){const e=this.shadowRoot?.querySelector(".os-cat__popover");if(!e)return;const t=this.getBoundingClientRect(),s=e.getBoundingClientRect(),n=window.innerWidth,a=window.innerHeight,i=8;let r=t.bottom+4;const c=r+s.height+i>a,l=t.top-4-s.height>=i;c&&l?r=t.top-4-s.height:c&&(r=Math.max(i,a-s.height-i));let d=t.left;d+s.width+i>n&&(d=t.right-s.width),d=Math.max(i,Math.min(d,n-s.width-i)),e.style.top=`${r}px`,e.style.left=`${d}px`}};He.props=["placeholder","add-label","disabled","readonly","open","loading","max-visible"],He.styles=[In],He.help=void 0;let Et=He;Q("os-category-picker",Et);function Ds(){return se("chevron-right",{size:14})}function Un(){return se("plus",{size:16})}function Wn(){return se("check",{size:null})}function Vn(){return se("close",{size:null})}const At="application/x-os-categories";function Os(o){return o.categories.tree||(o.categories.tree=o.client.fetchAllCategories().then(e=>e.map(t=>({id:t.id,name:t.name,parent:t.parent})))),o.categories.tree}function Tt(o){o.categories.tree=null}function Bn(o){Os(o).then(e=>{for(const t of o.categories.pickers)t.isConnected?t.items=e:o.categories.pickers.delete(t)}).catch(()=>{})}function jn(o,e){const{client:t}=e,s=document.createElement("span");s.style.cssText="display:inline-flex;align-items:center;width:100%;min-width:0;border-radius:6px;transition:background-color 0.12s ease, box-shadow 0.12s ease;";const n=document.createElement("os-category-picker");n.setAttribute("placeholder",f("Search categories…")),n.setAttribute("add-label",f("Categorize")),n.setAttribute("data-noclick",""),e.categories.pickers.add(n),n.value=o.categories??[],n.items=kt(o,"category").map(u=>({id:u.id,name:u.name,parent:0}));const a={categoryIds:(o.categories??[]).slice()},i=u=>{a.categoryIds=u.slice(),n.value=u},r=async(u,h,p)=>{try{await t.updatePostCategories(o.id,u),e.announce("categorized",[o.id])}catch(m){i(h),e.toast(p,m)}};Os(e).then(u=>{n.isConnected&&(n.items=u)}).catch(u=>{console.warn("[openstation:desktop-mode-posts] category tree fetch failed",u)}),n.addEventListener("os-categories-open",()=>{e.categories.tree&&e.categories.tree.then(u=>{n.items=u}).catch(()=>{})}),n.addEventListener("os-categories-create",async u=>{const h=u.detail,p=h?.parent??0;if(!h||!h.name){n.failCreating(p);return}try{const m=await t.createCategory(h.name,p);Tt(e),n.items=[...n.items,{id:m.id,name:m.name,parent:m.parent}];const _=a.categoryIds.slice(),g=[..._,m.id];i(g),n.endCreating(p),await r(g,_,f("Couldn’t assign new category."))}catch(m){n.failCreating(p,m instanceof Error?m.message:String(m)),e.toast(f("Couldn’t create category."),m)}}),n.addEventListener("os-categories-change",async u=>{const h=u.detail;if(!h||!Array.isArray(h.value))return;const p=a.categoryIds.slice(),m=h.value.slice();i(m),await r(m,p,f("Couldn’t update categories."))}),n.addEventListener("os-categories-delete",async u=>{const h=u.detail;if(!(!h||typeof h.id!="number"||!await e.confirm({title:f("Delete category?"),message:W(f('Delete the category "%s"? Posts assigned only to it will fall back to Uncategorized.'),h.name),confirmLabel:f("Delete"),danger:!0})))try{if(await t.deleteTerm("categories",h.id),a.categoryIds.includes(h.id)){const m=a.categoryIds.filter(_=>_!==h.id);i(m);try{await t.updatePostCategories(o.id,m)}catch(_){e.toast(f("Couldn’t update post categories after delete."),_)}}}catch(m){e.toast(f("Couldn’t delete category."),m)}}),n.addEventListener("os-chain-segment-dragstart",u=>{const h=u.detail;if(!h?.dragEvent?.dataTransfer)return;const p=h.segments.map(_=>_.id).filter(_=>typeof _=="number");if(p.length===0)return;const m=h.dragEvent.dataTransfer;m.setData(At,JSON.stringify({ids:p,source:"posts-window",sourcePostId:o.id})),m.setData("text/plain",p.join(",")),m.effectAllowed="copy"});let c=0;const l=u=>{s.style.backgroundColor=u?"color-mix(in srgb, var(--wp-admin-theme-color, #2271b1) 12%, transparent)":"",s.style.boxShadow=u?"inset 0 0 0 2px var(--wp-admin-theme-color, #2271b1)":""},d=u=>Array.from(u.dataTransfer?.types??[]).includes(At);return s.addEventListener("dragenter",u=>{d(u)&&(u.preventDefault(),c++,l(!0))}),s.addEventListener("dragover",u=>{d(u)&&(u.preventDefault(),u.dataTransfer&&(u.dataTransfer.dropEffect="copy"))}),s.addEventListener("dragleave",()=>{c>0&&c--,c===0&&l(!1)}),s.addEventListener("drop",async u=>{if(c=0,l(!1),!d(u))return;u.preventDefault();let h=null;try{h=JSON.parse(u.dataTransfer?.getData(At)??"")}catch{return}if(!h||!Array.isArray(h.ids))return;const p=h.ids.filter(g=>typeof g=="number"&&Number.isFinite(g));if(p.length===0)return;const m=a.categoryIds.slice(),_=Array.from(new Set([...m,...p]));_.length!==m.length&&(i(_),await r(_,m,f("Couldn’t add category.")))}),s.appendChild(n),s}function Hs(o,e){o.parentTitles.clear();for(const t of e)o.parentTitles.set(t.id,we(t))}function Kn(o,e){const t=document.createElement("span"),s=typeof o.parent=="number"?o.parent:0;if(s===0)return t.textContent="—",t.setAttribute("aria-label",f("Top-level page")),t;const n=e.parentTitles.get(s);return t.textContent=n?`↳ ${n}`:W(f("↳ #%d"),s),t}function Gn(o,e){const t=document.createElement("span"),s=typeof o.template=="string"?o.template:"",n=e.extra.pageTemplates??{};return t.textContent=n[s]??(s===""?f("Default template"):s),s!==""&&(t.title=s),t}function Xn(o,e){const t=document.createElement("button");t.type="button";const s=typeof o.slug=="string"?o.slug:"";return t.textContent=s||"—",t.disabled=s==="",t.title=s?f("Click to copy slug"):"",Object.assign(t.style,{appearance:"none",background:"transparent",border:"none",padding:"2px 6px",font:"inherit",color:"inherit",cursor:s?"copy":"default",textAlign:"left",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',fontSize:"12px",borderRadius:"4px",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),t.addEventListener("click",n=>{n.stopPropagation(),s&&ls(s).then(a=>{if(!a){e.toast(f("Couldn’t copy the slug."),null);return}t.textContent=f("Copied!"),t.style.color="var(--wp-admin-theme-color, #2271b1)",setTimeout(()=>{t.textContent=s,t.style.color=""},1200)})}),t}function Yn(o){const e=document.createElement("span");Object.assign(e.style,{display:"inline-flex",alignItems:"center",gap:"6px",fontVariantNumeric:"tabular-nums"});const t=typeof o.openstation_comment_count=="number"?o.openstation_comment_count:null;if(t===null)return e.textContent="—",e.style.color="var(--os-ui-fg-muted, #8c8f94)",e;const s=document.createElement("span");s.className="dashicons dashicons-admin-comments",s.setAttribute("aria-hidden","true"),Object.assign(s.style,{fontSize:"16px",width:"16px",height:"16px",color:t>0?"var(--wp-admin-theme-color, #2271b1)":"var(--os-ui-fg-muted, #8c8f94)"});const n=document.createElement("span");return n.textContent=String(t),t===0&&(n.style.color="var(--os-ui-fg-muted, #8c8f94)"),e.appendChild(s),e.appendChild(n),e.setAttribute("aria-label",W(de("%d comment","%d comments",t),t)),e}const Zn=F` ${_e} ${Ct}: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 )}:host( [ stacked ] ) .scroll{border:0;border-radius:0}:host( [ stacked ] ) table,:host( [ stacked ] ) tbody{display:block;width:100%}:host( [ stacked ] ) colgroup,:host( [ stacked ] ) thead{display:none}:host( [ stacked ] ) tbody tr{display:flex;align-items:flex-start;gap:12px;padding:12px 14px;border-bottom:1px solid var( --_border );background-color:var( --_bg )}:host( [ stacked ] ) tbody tr:last-child{border-bottom:0}:host( [ stacked ] ) tbody td{display:block;padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none;min-width:0;width:auto;vertical-align:baseline}:host( [ stacked ] ) tbody tr.is-selected td,:host( [ stacked ] ) tbody tr.is-selected:hover td,:host( [ stacked ][ striped ] ) tbody tr:nth-child( odd ) td,:host( [ stacked ][ hover ] ) tbody tr:hover td,:host( [ stacked ][ hover ][ striped ] ) tbody tr:nth-child( odd ):hover td,:host( [ stacked ][ bordered ] ) tbody td{padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none}:host( [ stacked ][ hover ] ) tbody tr:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ stacked ] ) tbody tr.is-selected,:host( [ stacked ] ) tbody tr.is-selected:hover{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none;box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody:dir( rtl ) tr.is-selected{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody td.col-select,:host( [ stacked ] ) tbody td.col-expander{flex:0 0 auto;display:flex;align-items:center;justify-content:center;min-width:0}:host( [ stacked ] ) tbody td.col-select{width:44px;height:44px;margin:-11px 0 -11px -11px;cursor:pointer}:host( [ stacked ] ) .select-row-checkbox{width:22px;height:22px}:host( [ stacked ] ) tbody td.col-expander{width:28px;height:22px;margin-inline-start:-4px}:host( [ stacked ] ) tbody td.stack-body{flex:1 1 auto;display:flex;flex-direction:column;gap:4px;min-width:0}.stack-cell{display:flex;align-items:baseline;gap:6px;min-width:0;line-height:1.4}.stack-title{font-size:15px;font-weight:600;line-height:1.35}.stack-meta{font-size:13px}.stack-label{flex:0 0 auto;font-size:12px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) )}.stack-label::after{content:'·';margin-inline-start:6px}.stack-value{flex:1 1 auto;min-width:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px}.stack-actions{margin-block-start:6px}.stack-actions .stack-value{gap:8px}.stack-actions .stack-value>*{justify-content:flex-start;max-width:100%}:host( [ stacked ] ) tr.subtable,:host( [ stacked ] ) tr.empty{display:block;padding:0}:host( [ stacked ] ) tr.subtable td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ stacked ] ) tr.subtable .subtable-inner{padding:8px 14px 12px}:host( [ stacked ] ) tr.empty td{padding:24px}:host( [ stacked ] ) tr.skeleton{display:block;padding:14px;border-bottom:1px solid var( --_border )}:host( [ stacked ] ) tr.skeleton td.stack-body{gap:8px}:host( [ stacked ] ) tr.skeleton .skeleton-bar:first-child{height:15px}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}}`,Ce="__wpd_expander__",$e="__wpd_select__",qe=class qe extends X{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._stacked=!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(s=>s.key));for(const s of Object.keys(this._filters))t.has(s)||delete this._filters[s];for(const s of Array.from(this._filterCache.keys()))t.has(s)||this._filterCache.delete(s);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,s)=>{this._selection.has(this._getRowId(t,s))&&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,s)=>s,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(),s=t==="single"?Array.from(this._selection):[];t==="single"&&this._selection.clear(),this._selection.add(e),this._emitSelectionChange(),this._syncSelectionDom([e,...s])}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 s=t.querySelector("tbody");if(!s)return;let n=null;if(e!=="all"){n=new Set;for(const r of e)n.add(String(r))}const a=s.querySelectorAll("tr[data-row-id]");for(const r of a){const c=r.dataset.rowId;if(c===void 0||n&&!n.has(c))continue;const l=Number(r.dataset.rowIndex);if(!Number.isFinite(l))continue;const d=this._data[l];if(d===void 0)continue;const u=this._getRowId(d,l),h=this._selection.has(u);r.classList.toggle("is-selected",h);const p=r.querySelector("input.select-row-checkbox");p&&p.checked!==h&&(p.checked=h)}const i=t.querySelector("thead .select-all-checkbox");if(i){const{total:r,selected:c}=this._visibleSelectionStats();i.checked=r>0&&c===r,i.indeterminate=c>0&&c<r}}scrollToRow(e){const t=this.shadowRoot;if(!t)return;const n=t.querySelectorAll("tbody tr:not(.subtable):not(.empty):not(.skeleton)")[e];n&&n.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`
201 201 <div class="scroll" part="scroll">
202 202 <table part="table">
203 203 <colgroup></colgroup>
204 204 <thead></thead>
@@ -204,13 +204,13 @@
204 204 <thead></thead>
205 205 <tbody></tbody>
206 206 </table>
207 207 </div>
208 - `}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")||ke(this.render(),e);const t=e.querySelector("colgroup"),s=e.querySelector("thead"),n=e.querySelector("tbody");if(!t||!s||!n)return;const a=this._effectiveColumns();this._stacked=this.hasAttribute("stacked");const i=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(a,i),this._paintColgroup(t,a),this._paintHead(s,a,i),this._paintBody(n,a,i),this._applyStickyOffsets(),this._measureHeaderHeight(),this._scheduleStickyOffsets(),this._maybeWarnStickyHeader(),this._maybeWarnLoadingDesync(n),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 s=[];for(const n of t){const a=document.createElement("col");n.width&&(a.style.width=n.width),s.push(a)}e.replaceChildren(...s)}_paintHead(e,t,s){const n=document.createElement("tr");n.setAttribute("part","header-row");for(let c=0;c<t.length;c++)n.appendChild(this._buildHeaderCell(t[c],c,s));const a=e.querySelector(':scope > tr[part="header-row"]');a?e.replaceChild(n,a):e.insertBefore(n,e.firstChild);const i=t.some(c=>c.filter||Array.isArray(c.filterOptions)||typeof c.filterRender=="function");let r=e.querySelector(":scope > tr.filter-row");if(i){const c=[];for(let d=0;d<t.length;d++)c.push(this._buildFilterCell(t[d],d,s));r||(r=document.createElement("tr"),r.classList.add("filter-row"),r.setAttribute("part","filter-row"),e.appendChild(r));const l=Array.from(r.children);let u=l.length===c.length;if(u){for(let d=0;d<c.length;d++)if(l[d]!==c[d]){u=!1;break}}if(!u){const d=new Set(c);for(const h of c)r.appendChild(h);for(const h of Array.from(r.children))d.has(h)||r.removeChild(h)}}else r&&r.remove()}_buildHeaderCell(e,t,s){const n=document.createElement("th");if(n.setAttribute("scope","col"),n.dataset.key=e.key,this._applyCellClasses(n,e,t,s),e.minWidth&&(n.style.minWidth=e.minWidth),e.key===$e){if(this._readSelectable()==="multi"){const i=document.createElement("input");i.type="checkbox",i.className="select-all-checkbox",i.setAttribute("data-noclick",""),i.setAttribute("aria-label","Select all rows");const{total:r,selected:c}=this._visibleSelectionStats();i.checked=r>0&&c===r,i.indeterminate=c>0&&c<r,i.addEventListener("change",()=>{i.checked?this.selectAll():this.clearSelection()}),n.appendChild(i)}return n}if(n.textContent=e.label??(e.key===Ce?"":e.key),e.sortable){n.classList.add("is-sortable");const a=this._sort?.key===e.key,i=document.createElement("span");i.className="sort-indicator";let r="";a&&(r=this._sort.direction==="asc"?" ▲":" ▼"),i.textContent=r,n.appendChild(i),a&&n.classList.add(this._sort.direction==="asc"?"sort-asc":"sort-desc"),n.addEventListener("click",()=>this._cycleSort(e.key))}return n}_buildFilterCell(e,t,s){const n=this._filterCache.get(e.key),a=Array.isArray(e.filterOptions),i=typeof e.filterRender=="function";let r;if(!e.filter&&!a&&!i||e.key===Ce||e.key===$e?r="none":i?r="custom":e.filter==="select"||a?r="select":r="text",n&&n.kind===r){if(n.th.className="",this._applyCellClasses(n.th,e,t,s),r==="select"){const d=n.control,h=this._resolveFilterOptions(e),p=h.map(g=>g.value).join("|");p!==n.optionsKey?(this._populateSelect(d,h,this._filters[e.key]??""),n.optionsKey=p):d.value=this._filters[e.key]??""}else if(r==="text"){const d=n.control,h=this._filters[e.key]??"";d.value!==h&&d.ownerDocument.activeElement!==d&&(d.value=h)}else r==="custom"&&e.filterRender&&e.filterRender(n.th,{value:this._filters[e.key]??"",setValue:d=>this._onFilterChange(e.key,d),col:e});return n.th}const c=document.createElement("th");if(this._applyCellClasses(c,e,t,s),r==="none")return this._filterCache.set(e.key,{th:c,control:null,optionsKey:"",kind:"none"}),c;if(r==="custom"&&e.filterRender)return e.filterRender(c,{value:this._filters[e.key]??"",setValue:d=>this._onFilterChange(e.key,d),col:e}),this._filterCache.set(e.key,{th:c,control:null,optionsKey:"",kind:"custom"}),c;let l,u="";if(r==="select"){const d=document.createElement("select");d.classList.add("filter-select"),d.setAttribute("data-noclick",""),d.setAttribute("aria-label",`Filter ${e.label??e.key}`);const h=this._resolveFilterOptions(e);this._populateSelect(d,h,this._filters[e.key]??""),u=h.map(p=>p.value).join("|"),d.addEventListener("change",()=>{this._onFilterChange(e.key,d.value)}),l=d}else{const d=document.createElement("input");d.type="search",d.classList.add("filter-input"),d.setAttribute("data-noclick",""),d.setAttribute("placeholder","Filter…"),d.setAttribute("aria-label",`Filter ${e.label??e.key}`),d.value=this._filters[e.key]??"",d.addEventListener("input",()=>{this._onFilterChange(e.key,d.value)}),l=d}return c.appendChild(l),this._filterCache.set(e.key,{th:c,control:l,optionsKey:u,kind:r}),c}_populateSelect(e,t,s){e.replaceChildren();const n=document.createElement("option");n.value="",n.textContent="All",e.appendChild(n);for(const a of t){const i=document.createElement("option");i.value=a.value,i.textContent=a.label,a.value===s&&(i.selected=!0),e.appendChild(i)}e.value=s}_resolveFilterOptions(e){return Array.isArray(e.filterOptions)?e.filterOptions:this._uniqueValues(e.key).map(t=>({value:t,label:t}))}_paintBody(e,t,s){if(e.replaceChildren(),this.hasAttribute("loading")){const a=this._readLoadingRows();for(let i=0;i<a;i++)e.appendChild(this._buildSkeletonRow(t,i));return}const n=this._sortedRows(this._filteredRows());if(n.length===0){e.appendChild(this._buildEmptyRow(t.length));return}for(const{row:a,index:i}of n)if(e.appendChild(this._stacked?this._buildStackedRow(a,i,t):this._buildBodyRow(a,i,t,s)),this._expanded.has(i)&&this._subTable){const r=this._subTable(a,i);r&&e.appendChild(this._buildSubTableRow(r,t.length))}}_buildEmptyRow(e){const t=document.createElement("tr");t.classList.add("empty");const s=document.createElement("td");s.colSpan=e;const n=document.createElement("slot");return n.name="empty",n.textContent=this.getAttribute("empty")||"No data",s.appendChild(n),t.appendChild(s),t}_buildSkeletonRow(e,t){const s=document.createElement("tr");if(s.classList.add("skeleton"),s.setAttribute("aria-hidden","true"),this._stacked){s.classList.add("stack-row");const n=document.createElement("td");n.className="stack-body",n.colSpan=Math.max(1,e.length);for(const a of[55+t*7%25,30+t*11%15]){const i=document.createElement("span");i.className="skeleton-bar",i.style.width=`${a}%`,n.appendChild(i)}return s.appendChild(n),s}for(const n of e){const a=document.createElement("td"),i=document.createElement("span");i.className="skeleton-bar";const r=50+(t*7+s.children.length*13)%40;i.style.width=`${r}%`,a.appendChild(i),s.appendChild(a)}return s}_buildBodyRow(e,t,s,n){const a=document.createElement("tr");a.setAttribute("part","row"),a.dataset.rowIndex=String(t);const i=this._getRowId(e,t);a.dataset.rowId=String(i),this._selection.has(i)&&a.classList.add("is-selected"),a.addEventListener("click",r=>{this._onRowClick(e,t,r)});for(let r=0;r<s.length;r++)a.appendChild(this._buildBodyCell(s[r],r,e,t,n));return a}_buildStackedRow(e,t,s){const n=document.createElement("tr");n.setAttribute("part","row"),n.classList.add("stack-row"),n.dataset.rowIndex=String(t);const a=this._getRowId(e,t);n.dataset.rowId=String(a),this._selection.has(a)&&n.classList.add("is-selected"),n.addEventListener("click",l=>{this._onRowClick(e,t,l)});const i=document.createElement("td");i.className="stack-body";let r=0,c=0;for(let l=0;l<s.length;l++){const u=s[l];if(u.key===$e||u.key===Ce){n.appendChild(this._buildBodyCell(u,l,e,t,0));continue}c++;const d=Nn(u,r++);if(d==="hidden")continue;const h=document.createElement("div");if(h.className=`stack-cell stack-${d}`,h.dataset.key=u.key,d==="meta"&&u.label){const m=document.createElement("span");m.className="stack-label",m.textContent=u.label,h.appendChild(m)}const p=document.createElement("span");p.className="stack-value";const g=e[u.key];u.render?this._mountCellContent(p,u.render(g,e,t)):g!=null&&(p.textContent=String(g)),h.appendChild(p),i.appendChild(h)}return i.colSpan=Math.max(1,c),n.appendChild(i),n}_buildBodyCell(e,t,s,n,a){const i=document.createElement("td");if(this._applyCellClasses(i,e,t,a),e.minWidth&&(i.style.minWidth=e.minWidth),e.key===$e){const c=this._getRowId(s,n),l=document.createElement("input");return l.type="checkbox",l.className="select-row-checkbox",l.setAttribute("data-noclick",""),l.setAttribute("aria-label","Select row"),l.checked=this._selection.has(c),l.addEventListener("change",()=>{l.checked?this.select(c):this.deselect(c)}),i.appendChild(l),this._stacked&&(i.setAttribute("data-noclick",""),i.addEventListener("click",u=>{u.target===i&&(l.checked=!l.checked,l.dispatchEvent(new Event("change")))})),i}if(e.key===Ce){if(!(this._subTable?!!this._subTable(s,n):!1))return i;const l=this._expanded.has(n),u=document.createElement("button");return u.type="button",u.className="expander",u.setAttribute("data-noclick",""),u.setAttribute("aria-expanded",l?"true":"false"),u.setAttribute("aria-label",l?"Collapse row":"Expand row"),u.textContent=l?"▾":"▸",u.addEventListener("click",d=>{this._toggleRow(n,s,d)}),i.appendChild(u),i}const r=s[e.key];if(e.render){const c=e.render(r,s,n);this._mountCellContent(i,c)}else r!=null&&(i.textContent=String(r));return i}_buildSubTableRow(e,t){const s=document.createElement("tr");s.classList.add("subtable"),s.setAttribute("part","subtable-row");const n=document.createElement("td");n.colSpan=t;const a=document.createElement("div");if(a.classList.add("subtable-inner"),e instanceof Node)a.appendChild(e);else if(zs(e))ke(e,a);else{const i=document.createElement("os-table");i.columns=e.columns,i.data=e.data,e.subTable&&(i.subTable=e.subTable),a.appendChild(i)}return n.appendChild(a),s.appendChild(n),s}_mountCellContent(e,t){if(typeof t=="string"){e.textContent=t;return}if(t instanceof Node){e.appendChild(t);return}zs(t)&&ke(t,e)}_onFilterChange(e,t){t===""?delete this._filters[e]:this._filters[e]=t,this.emit("os-table-filter-change",{filters:{...this._filters}});const n=this.shadowRoot?.querySelector("tbody");if(n){const a=this._effectiveColumns(),i=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(a,i),this._paintBody(n,a,i),this._applyStickyOffsets()}}_onRowClick(e,t,s){const n=s.composedPath?.()??[];for(const a of n){if(a instanceof Element&&a.hasAttribute("data-noclick"))return;if(a===this)break}this.emit("os-table-row-click",{row:e,index:t,originalEvent:s})}_toggleRow(e,t,s){s.stopPropagation();const n=this._expanded.has(e);n?this._expanded.delete(e):this._expanded.add(e),this.emit("os-table-expand-change",{row:t,index:e,expanded:!n}),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(s=>this._filters[s]!=="");for(let s=0;s<this._data.length;s++){const n=this._data[s];let a=!0;for(const i of t){const r=this._columns.find(d=>d.key===i);if(r&&typeof r.filterRender=="function")continue;const c=this._filters[i]??"",l=n[i],u=l==null?"":String(l);if(r?.filter==="select"){if(u!==c){a=!1;break}}else if(!u.toLowerCase().includes(c.toLowerCase())){a=!1;break}}a&&e.push({row:n,index:s})}return e}_sortedRows(e){if(!this._sort)return e;const t=this._columns.find(a=>a.key===this._sort.key);if(!t)return e;const s=this._sort.direction==="desc"?-1:1,n=e.slice();return n.sort((a,i)=>{const r=t.sortValue?t.sortValue(a.row,a.row[t.key]):a.row[t.key],c=t.sortValue?t.sortValue(i.row,i.row[t.key]):i.row[t.key];return Dn(r,c)*s}),n}_uniqueValues(e){const t=new Set;for(const s of this._data){const n=s[e];n!=null&&t.add(String(n))}return Array.from(t).sort()}_visibleSelectionStats(){let e=0,t=0;for(const{row:s,index:n}of this._filteredRows())e++,this._selection.has(this._getRowId(s,n))&&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,s){return this._stacked||s.sticky===!1?!1:s.sticky===!0?!0:e<t}_computeLastStickyIndex(e,t){let s=-1;for(let n=0;n<e.length;n++)this._isStickyIndex(n,t,e[n])&&(s=n);return s}_applyCellClasses(e,t,s,n){t.key===Ce&&e.classList.add("col-expander"),t.key===$e&&e.classList.add("col-select"),t.align==="center"&&e.classList.add("align-center"),t.align==="end"&&e.classList.add("align-end"),this._isStickyIndex(s,n,t)&&(e.classList.add("is-sticky"),s===this._lastStickyIndex&&e.classList.add("is-sticky-edge"))}_effectiveColumns(){const e=[];return this._readSelectable()&&e.push({key:$e,label:"",width:"40px",align:"center"}),this._subTable&&e.push({key:Ce,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 s=Array.from(t.children),n=[];let a=0;for(let r=0;r<s.length;r++)n[r]=a,s[r].classList.contains("is-sticky")&&(a+=s[r].offsetWidth);e.querySelectorAll("thead tr, tbody tr:not(.subtable):not(.empty):not(.skeleton)").forEach(r=>{const c=Array.from(r.children);for(let l=0;l<c.length;l++)c[l].classList.contains("is-sticky")&&(c[l].style.insetInlineStart=`${n[l]}px`)}),this._maybeWarnStickyOffsetRace(s,n)}_maybeWarnStickyOffsetRace(e,t){if(this._stickyRaceWarned)return;const s=this._readStickyColumns();if(s<2)return;const n=Math.min(s-1,e.length-1);if(n<=0||t[n]!==0||this.offsetWidth===0)return;this._stickyRaceWarned=!0;const a=e[0]?.offsetWidth??0;console.warn(`[os-table] sticky-columns: column ${n} resolved to inset-inline-start: 0px while the host is visible. ths[0].offsetWidth was ${a}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 s=t.offsetHeight;s>0&&this.style.setProperty("--os-ui-table-header-height",`${s}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."))}};He.props=["stickyColumns","stickyHeader","striped","hover","compact","bordered","empty","loading","loadingRows","selectable","stacked"],He.styles=[Rn],He.help=void 0;let Tt=He;function zs(o){return!!o&&o.__wpdHtml===!0}function Nn(o,e){return o.stack?o.stack:e===0?"title":o.label?"meta":"actions"}function Dn(o,e){if(o===e)return 0;if(o==null)return-1;if(e==null)return 1;if(typeof o=="number"&&typeof e=="number")return o-e;if(o instanceof Date&&e instanceof Date)return o.getTime()-e.getTime();const t=Number(o),s=Number(e);return Number.isFinite(t)&&Number.isFinite(s)?t-s:String(o).localeCompare(String(e))}Q("os-table",Tt);const On=H` ${_e}: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}}`,qn=H`:host{display:none}`,Fe=class Fe extends X{render(){return k``}};Fe.props=["value","disabled"],Fe.styles=[qn],Fe.help=void 0;let Mt=Fe;Q("os-option",Mt);const Ue=class Ue extends X{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,s=this._popup();s&&t instanceof Node&&(t===s||s.contains(t))||this._hide()},this._onWindowResize=()=>this._hide()}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const a of Array.from(t))a.remove();for(const a of e){const i=document.createElement("os-option");i.setAttribute("value",a.value),i.textContent=a.label,this.appendChild(i)}const s=this.value;!(s!==null&&e.some(a=>a.value===s))&&e.length>0&&(this.value=e[0].value),this.requestUpdate()}connectedCallback(){super.connectedCallback(),ft(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,s=this.placeholder||"",n=this.disabled!==null;e&&this.setAttribute("aria-label",e);const a=this.getAttribute("aria-label")||"",i=e||a||s,r=this._readOptions(),c=r.find(g=>g.value===t),l=c?c.label:s,u=this.id||"os-unnamed",d=`${u}__listbox`,h=`${u}__trigger`,p=this._open&&this._activeIndex>=0?`${u}__opt-${this._activeIndex}`:"";return k`
209 - ${e?k`<label
208 + `}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")||ke(this.render(),e);const t=e.querySelector("colgroup"),s=e.querySelector("thead"),n=e.querySelector("tbody");if(!t||!s||!n)return;const a=this._effectiveColumns();this._stacked=this.hasAttribute("stacked");const i=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(a,i),this._paintColgroup(t,a),this._paintHead(s,a,i),this._paintBody(n,a,i),this._applyStickyOffsets(),this._measureHeaderHeight(),this._scheduleStickyOffsets(),this._maybeWarnStickyHeader(),this._maybeWarnLoadingDesync(n),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 s=[];for(const n of t){const a=document.createElement("col");n.width&&(a.style.width=n.width),s.push(a)}e.replaceChildren(...s)}_paintHead(e,t,s){const n=document.createElement("tr");n.setAttribute("part","header-row");for(let c=0;c<t.length;c++)n.appendChild(this._buildHeaderCell(t[c],c,s));const a=e.querySelector(':scope > tr[part="header-row"]');a?e.replaceChild(n,a):e.insertBefore(n,e.firstChild);const i=t.some(c=>c.filter||Array.isArray(c.filterOptions)||typeof c.filterRender=="function");let r=e.querySelector(":scope > tr.filter-row");if(i){const c=[];for(let u=0;u<t.length;u++)c.push(this._buildFilterCell(t[u],u,s));r||(r=document.createElement("tr"),r.classList.add("filter-row"),r.setAttribute("part","filter-row"),e.appendChild(r));const l=Array.from(r.children);let d=l.length===c.length;if(d){for(let u=0;u<c.length;u++)if(l[u]!==c[u]){d=!1;break}}if(!d){const u=new Set(c);for(const h of c)r.appendChild(h);for(const h of Array.from(r.children))u.has(h)||r.removeChild(h)}}else r&&r.remove()}_buildHeaderCell(e,t,s){const n=document.createElement("th");if(n.setAttribute("scope","col"),n.dataset.key=e.key,this._applyCellClasses(n,e,t,s),e.minWidth&&(n.style.minWidth=e.minWidth),e.key===$e){if(this._readSelectable()==="multi"){const i=document.createElement("input");i.type="checkbox",i.className="select-all-checkbox",i.setAttribute("data-noclick",""),i.setAttribute("aria-label","Select all rows");const{total:r,selected:c}=this._visibleSelectionStats();i.checked=r>0&&c===r,i.indeterminate=c>0&&c<r,i.addEventListener("change",()=>{i.checked?this.selectAll():this.clearSelection()}),n.appendChild(i)}return n}if(n.textContent=e.label??(e.key===Ce?"":e.key),e.sortable){n.classList.add("is-sortable");const a=this._sort?.key===e.key,i=document.createElement("span");i.className="sort-indicator";let r="";a&&(r=this._sort.direction==="asc"?" ▲":" ▼"),i.textContent=r,n.appendChild(i),a&&n.classList.add(this._sort.direction==="asc"?"sort-asc":"sort-desc"),n.addEventListener("click",()=>this._cycleSort(e.key))}return n}_buildFilterCell(e,t,s){const n=this._filterCache.get(e.key),a=Array.isArray(e.filterOptions),i=typeof e.filterRender=="function";let r;if(!e.filter&&!a&&!i||e.key===Ce||e.key===$e?r="none":i?r="custom":e.filter==="select"||a?r="select":r="text",n&&n.kind===r){if(n.th.className="",this._applyCellClasses(n.th,e,t,s),r==="select"){const u=n.control,h=this._resolveFilterOptions(e),p=h.map(m=>m.value).join("|");p!==n.optionsKey?(this._populateSelect(u,h,this._filters[e.key]??""),n.optionsKey=p):u.value=this._filters[e.key]??""}else if(r==="text"){const u=n.control,h=this._filters[e.key]??"";u.value!==h&&u.ownerDocument.activeElement!==u&&(u.value=h)}else r==="custom"&&e.filterRender&&e.filterRender(n.th,{value:this._filters[e.key]??"",setValue:u=>this._onFilterChange(e.key,u),col:e});return n.th}const c=document.createElement("th");if(this._applyCellClasses(c,e,t,s),r==="none")return this._filterCache.set(e.key,{th:c,control:null,optionsKey:"",kind:"none"}),c;if(r==="custom"&&e.filterRender)return e.filterRender(c,{value:this._filters[e.key]??"",setValue:u=>this._onFilterChange(e.key,u),col:e}),this._filterCache.set(e.key,{th:c,control:null,optionsKey:"",kind:"custom"}),c;let l,d="";if(r==="select"){const u=document.createElement("select");u.classList.add("filter-select"),u.setAttribute("data-noclick",""),u.setAttribute("aria-label",`Filter ${e.label??e.key}`);const h=this._resolveFilterOptions(e);this._populateSelect(u,h,this._filters[e.key]??""),d=h.map(p=>p.value).join("|"),u.addEventListener("change",()=>{this._onFilterChange(e.key,u.value)}),l=u}else{const u=document.createElement("input");u.type="search",u.classList.add("filter-input"),u.setAttribute("data-noclick",""),u.setAttribute("placeholder","Filter…"),u.setAttribute("aria-label",`Filter ${e.label??e.key}`),u.value=this._filters[e.key]??"",u.addEventListener("input",()=>{this._onFilterChange(e.key,u.value)}),l=u}return c.appendChild(l),this._filterCache.set(e.key,{th:c,control:l,optionsKey:d,kind:r}),c}_populateSelect(e,t,s){e.replaceChildren();const n=document.createElement("option");n.value="",n.textContent="All",e.appendChild(n);for(const a of t){const i=document.createElement("option");i.value=a.value,i.textContent=a.label,a.value===s&&(i.selected=!0),e.appendChild(i)}e.value=s}_resolveFilterOptions(e){return Array.isArray(e.filterOptions)?e.filterOptions:this._uniqueValues(e.key).map(t=>({value:t,label:t}))}_paintBody(e,t,s){if(e.replaceChildren(),this.hasAttribute("loading")){const a=this._readLoadingRows();for(let i=0;i<a;i++)e.appendChild(this._buildSkeletonRow(t,i));return}const n=this._sortedRows(this._filteredRows());if(n.length===0){e.appendChild(this._buildEmptyRow(t.length));return}for(const{row:a,index:i}of n)if(e.appendChild(this._stacked?this._buildStackedRow(a,i,t):this._buildBodyRow(a,i,t,s)),this._expanded.has(i)&&this._subTable){const r=this._subTable(a,i);r&&e.appendChild(this._buildSubTableRow(r,t.length))}}_buildEmptyRow(e){const t=document.createElement("tr");t.classList.add("empty");const s=document.createElement("td");s.colSpan=e;const n=document.createElement("slot");return n.name="empty",n.textContent=this.getAttribute("empty")||"No data",s.appendChild(n),t.appendChild(s),t}_buildSkeletonRow(e,t){const s=document.createElement("tr");if(s.classList.add("skeleton"),s.setAttribute("aria-hidden","true"),this._stacked){s.classList.add("stack-row");const n=document.createElement("td");n.className="stack-body",n.colSpan=Math.max(1,e.length);for(const a of[55+t*7%25,30+t*11%15]){const i=document.createElement("span");i.className="skeleton-bar",i.style.width=`${a}%`,n.appendChild(i)}return s.appendChild(n),s}for(const n of e){const a=document.createElement("td"),i=document.createElement("span");i.className="skeleton-bar";const r=50+(t*7+s.children.length*13)%40;i.style.width=`${r}%`,a.appendChild(i),s.appendChild(a)}return s}_buildBodyRow(e,t,s,n){const a=document.createElement("tr");a.setAttribute("part","row"),a.dataset.rowIndex=String(t);const i=this._getRowId(e,t);a.dataset.rowId=String(i),this._selection.has(i)&&a.classList.add("is-selected"),a.addEventListener("click",r=>{this._onRowClick(e,t,r)});for(let r=0;r<s.length;r++)a.appendChild(this._buildBodyCell(s[r],r,e,t,n));return a}_buildStackedRow(e,t,s){const n=document.createElement("tr");n.setAttribute("part","row"),n.classList.add("stack-row"),n.dataset.rowIndex=String(t);const a=this._getRowId(e,t);n.dataset.rowId=String(a),this._selection.has(a)&&n.classList.add("is-selected"),n.addEventListener("click",l=>{this._onRowClick(e,t,l)});const i=document.createElement("td");i.className="stack-body";let r=0,c=0;for(let l=0;l<s.length;l++){const d=s[l];if(d.key===$e||d.key===Ce){n.appendChild(this._buildBodyCell(d,l,e,t,0));continue}c++;const u=Jn(d,r++);if(u==="hidden")continue;const h=document.createElement("div");if(h.className=`stack-cell stack-${u}`,h.dataset.key=d.key,u==="meta"&&d.label){const g=document.createElement("span");g.className="stack-label",g.textContent=d.label,h.appendChild(g)}const p=document.createElement("span");p.className="stack-value";const m=e[d.key],_=et(m);d.render?this._mountCellContent(p,d.render(m,e,t)):_!==null?p.appendChild(this._slotFor(_)):m!=null&&(p.textContent=String(m)),h.appendChild(p),i.appendChild(h)}return i.colSpan=Math.max(1,c),n.appendChild(i),n}_buildBodyCell(e,t,s,n,a){const i=document.createElement("td");if(this._applyCellClasses(i,e,t,a),e.minWidth&&(i.style.minWidth=e.minWidth),e.key===$e){const l=this._getRowId(s,n),d=document.createElement("input");return d.type="checkbox",d.className="select-row-checkbox",d.setAttribute("data-noclick",""),d.setAttribute("aria-label","Select row"),d.checked=this._selection.has(l),d.addEventListener("change",()=>{d.checked?this.select(l):this.deselect(l)}),i.appendChild(d),this._stacked&&(i.setAttribute("data-noclick",""),i.addEventListener("click",u=>{u.target===i&&(d.checked=!d.checked,d.dispatchEvent(new Event("change")))})),i}if(e.key===Ce){if(!(this._subTable?!!this._subTable(s,n):!1))return i;const d=this._expanded.has(n),u=document.createElement("button");return u.type="button",u.className="expander",u.setAttribute("data-noclick",""),u.setAttribute("aria-expanded",d?"true":"false"),u.setAttribute("aria-label",d?"Collapse row":"Expand row"),u.textContent=d?"▾":"▸",u.addEventListener("click",h=>{this._toggleRow(n,s,h)}),i.appendChild(u),i}const r=s[e.key],c=et(r);if(e.render){const l=e.render(r,s,n);this._mountCellContent(i,l)}else c!==null?i.appendChild(this._slotFor(c)):r!=null&&(i.textContent=String(r));return i}_slotFor(e){const t=document.createElement("slot");return t.name=e,t}_buildSubTableRow(e,t){const s=document.createElement("tr");s.classList.add("subtable"),s.setAttribute("part","subtable-row");const n=document.createElement("td");n.colSpan=t;const a=document.createElement("div");if(a.classList.add("subtable-inner"),e instanceof Node)a.appendChild(e);else if(qs(e))ke(e,a);else{const i=document.createElement("os-table");i.columns=e.columns,i.data=e.data,e.subTable&&(i.subTable=e.subTable),a.appendChild(i)}return n.appendChild(a),s.appendChild(n),s}_mountCellContent(e,t){if(typeof t=="string"){e.textContent=t;return}if(t instanceof Node){e.appendChild(t);return}qs(t)&&ke(t,e)}_onFilterChange(e,t){t===""?delete this._filters[e]:this._filters[e]=t,this.emit("os-table-filter-change",{filters:{...this._filters}});const n=this.shadowRoot?.querySelector("tbody");if(n){const a=this._effectiveColumns(),i=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(a,i),this._paintBody(n,a,i),this._applyStickyOffsets()}}_onRowClick(e,t,s){const n=s.composedPath?.()??[];for(const a of n){if(a instanceof Element&&a.hasAttribute("data-noclick"))return;if(a===this)break}this.emit("os-table-row-click",{row:e,index:t,originalEvent:s})}_toggleRow(e,t,s){s.stopPropagation();const n=this._expanded.has(e);n?this._expanded.delete(e):this._expanded.add(e),this.emit("os-table-expand-change",{row:t,index:e,expanded:!n}),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(s=>this._filters[s]!=="");for(let s=0;s<this._data.length;s++){const n=this._data[s];let a=!0;for(const i of t){const r=this._columns.find(u=>u.key===i);if(r&&typeof r.filterRender=="function")continue;const c=this._filters[i]??"",l=n[i],d=It(l);if(r?.filter==="select"){if(d!==c){a=!1;break}}else if(!d.toLowerCase().includes(c.toLowerCase())){a=!1;break}}a&&e.push({row:n,index:s})}return e}_sortedRows(e){if(!this._sort)return e;const t=this._columns.find(a=>a.key===this._sort.key);if(!t)return e;const s=this._sort.direction==="desc"?-1:1,n=e.slice();return n.sort((a,i)=>{const r=a.row[t.key],c=i.row[t.key],l=t.sortValue?t.sortValue(a.row,r):Fs(r),d=t.sortValue?t.sortValue(i.row,c):Fs(c);return Qn(l,d)*s}),n}_uniqueValues(e){const t=new Set;for(const s of this._data){const n=s[e];n!=null&&t.add(It(n))}return Array.from(t).sort()}_visibleSelectionStats(){let e=0,t=0;for(const{row:s,index:n}of this._filteredRows())e++,this._selection.has(this._getRowId(s,n))&&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,s){return this._stacked||s.sticky===!1?!1:s.sticky===!0?!0:e<t}_computeLastStickyIndex(e,t){let s=-1;for(let n=0;n<e.length;n++)this._isStickyIndex(n,t,e[n])&&(s=n);return s}_applyCellClasses(e,t,s,n){t.key===Ce&&e.classList.add("col-expander"),t.key===$e&&e.classList.add("col-select"),t.align==="center"&&e.classList.add("align-center"),t.align==="end"&&e.classList.add("align-end"),this._isStickyIndex(s,n,t)&&(e.classList.add("is-sticky"),s===this._lastStickyIndex&&e.classList.add("is-sticky-edge"))}_effectiveColumns(){const e=[];return this._readSelectable()&&e.push({key:$e,label:"",width:"40px",align:"center"}),this._subTable&&e.push({key:Ce,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 s=Array.from(t.children),n=[];let a=0;for(let r=0;r<s.length;r++)n[r]=a,s[r].classList.contains("is-sticky")&&(a+=s[r].offsetWidth);e.querySelectorAll("thead tr, tbody tr:not(.subtable):not(.empty):not(.skeleton)").forEach(r=>{const c=Array.from(r.children);for(let l=0;l<c.length;l++)c[l].classList.contains("is-sticky")&&(c[l].style.insetInlineStart=`${n[l]}px`)}),this._maybeWarnStickyOffsetRace(s,n)}_maybeWarnStickyOffsetRace(e,t){if(this._stickyRaceWarned)return;const s=this._readStickyColumns();if(s<2)return;const n=Math.min(s-1,e.length-1);if(n<=0||t[n]!==0||this.offsetWidth===0)return;this._stickyRaceWarned=!0;const a=e[0]?.offsetWidth??0;console.warn(`[os-table] sticky-columns: column ${n} resolved to inset-inline-start: 0px while the host is visible. ths[0].offsetWidth was ${a}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 s=t.offsetHeight;s>0&&this.style.setProperty("--os-ui-table-header-height",`${s}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."))}};qe.props=["stickyColumns","stickyHeader","striped","hover","compact","bordered","empty","loading","loadingRows","selectable","stacked"],qe.styles=[Zn],qe.help=void 0;let Mt=qe;function qs(o){return!!o&&o.__wpdHtml===!0}function Jn(o,e){return o.stack?o.stack:e===0?"title":o.label?"meta":"actions"}function et(o){return o&&typeof o=="object"&&typeof o.slot=="string"?o.slot:null}function It(o){if(o==null)return"";if(et(o)!==null){const e=o.text;return e==null?"":String(e)}return String(o)}function Fs(o){return et(o)!==null?It(o):o}function Qn(o,e){if(o===e)return 0;if(o==null)return-1;if(e==null)return 1;if(typeof o=="number"&&typeof e=="number")return o-e;if(o instanceof Date&&e instanceof Date)return o.getTime()-e.getTime();const t=Number(o),s=Number(e);return Number.isFinite(t)&&Number.isFinite(s)?t-s:String(o).localeCompare(String(e))}Q("os-table",Mt);const ei=F` ${_e}: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-accent-ink,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}}`,ti=F`:host{display:none}`,Fe=class Fe extends X{render(){return C``}};Fe.props=["value","disabled"],Fe.styles=[ti],Fe.help=void 0;let Lt=Fe;Q("os-option",Lt);const Ue=class Ue extends X{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,s=this._popup();s&&t instanceof Node&&(t===s||s.contains(t))||this._hide()},this._onWindowResize=()=>this._hide()}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const a of Array.from(t))a.remove();for(const a of e){const i=document.createElement("os-option");i.setAttribute("value",a.value),i.textContent=a.label,this.appendChild(i)}const s=this.value;!(s!==null&&e.some(a=>a.value===s))&&e.length>0&&(this.value=e[0].value),this.requestUpdate()}connectedCallback(){super.connectedCallback(),gt(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,s=this.placeholder||"",n=this.disabled!==null;e&&this.setAttribute("aria-label",e);const a=this.getAttribute("aria-label")||"",i=e||a||s,r=this._readOptions(),c=r.find(m=>m.value===t),l=c?c.label:s,d=this.id||"os-unnamed",u=`${d}__listbox`,h=`${d}__trigger`,p=this._open&&this._activeIndex>=0?`${d}__opt-${this._activeIndex}`:"";return C`
209 + ${e?C`<label
210 210 class="os-select__label"
211 211 for=${h}
212 - >${e}</label>`:k``}
212 + >${e}</label>`:C``}
213 213 <button
214 214 type="button"
215 215 class="os-select__trigger"
216 216 id=${h}
@@ -216,14 +216,14 @@
216 216 id=${h}
217 217 role="combobox"
218 218 aria-haspopup="listbox"
219 219 aria-expanded=${this._open?"true":"false"}
220 - aria-controls=${d}
220 + aria-controls=${u}
221 221 aria-label=${i}
222 222 aria-activedescendant=${p}
223 223 ?disabled=${n}
224 224 @click=${()=>this._toggle()}
225 - @keydown=${g=>this._onTriggerKeydown(g)}
225 + @keydown=${m=>this._onTriggerKeydown(m)}
226 226 >
227 227 <span
228 228 class="os-select__value${c?"":" os-select__value--placeholder"}"
229 229 >${l}</span
@@ -231,40 +231,40 @@
231 231 ${se("chevron-right",{size:16,rotate:90,className:"os-select__chevron"})}
232 232 </button>
233 233 <div
234 234 class="os-select__popup"
235 - id=${d}
235 + id=${u}
236 236 role="listbox"
237 237 popover="auto"
238 238 aria-label=${i}
239 - @toggle=${g=>this._onPopoverToggle(g)}
239 + @toggle=${m=>this._onPopoverToggle(m)}
240 240 >
241 - ${r.map((g,m)=>k`
241 + ${r.map((m,_)=>C`
242 242 <div
243 243 class="os-select__option"
244 - id=${`${u}__opt-${m}`}
244 + id=${`${d}__opt-${_}`}
245 245 role="option"
246 - data-value=${g.value}
247 - aria-selected=${g.value===t?"true":"false"}
248 - aria-disabled=${g.disabled?"true":"false"}
249 - ?data-active=${this._open&&m===this._activeIndex}
250 - @click=${()=>this._onOptionClick(g)}
251 - @pointermove=${()=>this._setActive(m)}
246 + data-value=${m.value}
247 + aria-selected=${m.value===t?"true":"false"}
248 + aria-disabled=${m.disabled?"true":"false"}
249 + ?data-active=${this._open&&_===this._activeIndex}
250 + @click=${()=>this._onOptionClick(m)}
251 + @pointermove=${()=>this._setActive(_)}
252 252 >
253 253 ${se("check",{size:16,className:"os-select__check"})}
254 254 <span class="os-select__option-label"
255 - >${g.label}</span
255 + >${m.label}</span
256 256 >
257 257 </div>
258 258 `)}
259 259 </div>
260 - `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const s of Array.from(t)){const n=s.getAttribute("value");n!==null&&e.push({value:n,label:(s.textContent||n).trim(),disabled:s.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 s=this._readOptions(),n=this.value,a=s.findIndex(r=>r.value===n&&!r.disabled);this._activeIndex=a>=0?a:s.findIndex(r=>!r.disabled);const i=t.getBoundingClientRect();e.style.minWidth=`${i.width}px`,typeof e.showPopover=="function"?(e.style.left=`${i.left}px`,e.style.top=`${i.bottom+4}px`,e.showPopover(),i.bottom+4+e.offsetHeight>window.innerHeight-8&&(e.style.top=`${Math.max(8,i.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 s=this._activeIndex;for(let n=0;n<t.length&&(s=Math.min(Math.max(s+e,0),t.length-1),!(!t[s]?.disabled||s===0||s===t.length-1));n++);s!==this._activeIndex&&t[s]&&!t[s].disabled&&(this._activeIndex=s,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 s=this._readOptions().findIndex(n=>!n.disabled&&n.label.toLowerCase().startsWith(this._typed));s>=0&&(this._activeIndex=s,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(s=>!s.disabled)),e.key==="End"){for(let s=t.length-1;s>=0;s--)if(!t[s].disabled){this._activeIndex=s;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(s=>!s.disabled),this.requestUpdate(),this._scrollActiveIntoView();break;case"End":e.preventDefault();for(let s=t.length-1;s>=0;s--)if(!t[s].disabled){this._activeIndex=s,this.requestUpdate(),this._scrollActiveIntoView();break}break;case"Enter":case" ":{e.preventDefault();const s=t[this._activeIndex];s&&!s.disabled&&this._commit(s.value);break}case"Tab":{const s=t[this._activeIndex];s&&!s.disabled?this._commit(s.value):this._hide();break}case"Escape":e.preventDefault(),this._hide();break;default:e.key.length===1&&e.key.trim()!==""&&this._typeAhead(e.key)}}}};Ue.props=["value","label","placeholder","disabled","name"],Ue.styles=[On],Ue.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:k`
260 + `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const s of Array.from(t)){const n=s.getAttribute("value");n!==null&&e.push({value:n,label:(s.textContent||n).trim(),disabled:s.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 s=this._readOptions(),n=this.value,a=s.findIndex(r=>r.value===n&&!r.disabled);this._activeIndex=a>=0?a:s.findIndex(r=>!r.disabled);const i=t.getBoundingClientRect();e.style.minWidth=`${i.width}px`,typeof e.showPopover=="function"?(e.style.left=`${i.left}px`,e.style.top=`${i.bottom+4}px`,e.showPopover(),i.bottom+4+e.offsetHeight>window.innerHeight-8&&(e.style.top=`${Math.max(8,i.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 s=this._activeIndex;for(let n=0;n<t.length&&(s=Math.min(Math.max(s+e,0),t.length-1),!(!t[s]?.disabled||s===0||s===t.length-1));n++);s!==this._activeIndex&&t[s]&&!t[s].disabled&&(this._activeIndex=s,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 s=this._readOptions().findIndex(n=>!n.disabled&&n.label.toLowerCase().startsWith(this._typed));s>=0&&(this._activeIndex=s,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(s=>!s.disabled)),e.key==="End"){for(let s=t.length-1;s>=0;s--)if(!t[s].disabled){this._activeIndex=s;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(s=>!s.disabled),this.requestUpdate(),this._scrollActiveIntoView();break;case"End":e.preventDefault();for(let s=t.length-1;s>=0;s--)if(!t[s].disabled){this._activeIndex=s,this.requestUpdate(),this._scrollActiveIntoView();break}break;case"Enter":case" ":{e.preventDefault();const s=t[this._activeIndex];s&&!s.disabled&&this._commit(s.value);break}case"Tab":{const s=t[this._activeIndex];s&&!s.disabled?this._commit(s.value):this._hide();break}case"Escape":e.preventDefault(),this._hide();break;default:e.key.length===1&&e.key.trim()!==""&&this._typeAhead(e.key)}}}};Ue.props=["value","label","placeholder","disabled","name"],Ue.styles=[ei],Ue.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`
261 261 <os-select value="eur" label="Currency">
262 262 <os-option value="eur">Euro</os-option>
263 263 <os-option value="usd">US Dollar</os-option>
264 264 <os-option value="jpy">Japanese Yen</os-option>
265 265 </os-select>
266 - `};let It=Ue;Q("os-select",It);const Hn=H`
266 + `};let Pt=Ue;Q("os-select",Pt);const si=F`
267 267 :host {
268 268 display: flex;
269 269 flex-direction: column;
270 270 gap: 4px;
@@ -347,9 +347,9 @@
347 347
348 348 :host( [ open ] ) .os-multiselect__chevron {
349 349 transform: rotate( 180deg );
350 350 }
351 -`;function Fn(){const o="os-multiselect-popover-styles";if(document.getElementById(o))return;const e=document.createElement("style");e.id=o,e.textContent=`
351 +`;function oi(){const o="os-multiselect-popover-styles";if(document.getElementById(o))return;const e=document.createElement("style");e.id=o,e.textContent=`
352 352 .os-multiselect__popover {
353 353 position: fixed;
354 354 z-index: 100000;
355 355 max-height: 320px;
@@ -449,13 +449,13 @@
449 449
450 450 @keyframes os-multiselect-spin {
451 451 to { transform: rotate( 360deg ); }
452 452 }
453 -`,document.head.appendChild(e)}typeof document<"u"&&Fn();const We=class We extends X{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 a of Array.from(t))a.remove();for(const a of e){const i=document.createElement("os-option");i.setAttribute("value",a.value),i.textContent=a.label,this.appendChild(i)}this._loadingMore=!1;const s=new Set(e.map(a=>a.value)),n=this._readValues().filter(a=>s.has(a));this._writeValueAttribute(n),this.requestUpdate(),this._refreshPopover()}get values(){return this._readValues()}set values(e){const t=Array.isArray(e)?e.map(s=>String(s)).filter(s=>s!==""):[];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(s=>s.getAttribute("value")));for(const s of e){if(t.has(s.value))continue;const n=document.createElement("os-option");n.setAttribute("value",s.value),n.textContent=s.label,this.appendChild(n)}this.requestUpdate(),this._refreshPopover()}connectedCallback(){super.connectedCallback(),ft(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",s=this.disabled!==null;e?this.setAttribute("aria-label",e):this.removeAttribute("aria-label");const n=e||t,a=this._summarize(t),i=this._readValues().length>0,c=`${this.id||"os-unnamed"}__trigger`;return k`
454 - ${e?k`<label
453 +`,document.head.appendChild(e)}typeof document<"u"&&oi();const We=class We extends X{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 a of Array.from(t))a.remove();for(const a of e){const i=document.createElement("os-option");i.setAttribute("value",a.value),i.textContent=a.label,this.appendChild(i)}this._loadingMore=!1;const s=new Set(e.map(a=>a.value)),n=this._readValues().filter(a=>s.has(a));this._writeValueAttribute(n),this.requestUpdate(),this._refreshPopover()}get values(){return this._readValues()}set values(e){const t=Array.isArray(e)?e.map(s=>String(s)).filter(s=>s!==""):[];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(s=>s.getAttribute("value")));for(const s of e){if(t.has(s.value))continue;const n=document.createElement("os-option");n.setAttribute("value",s.value),n.textContent=s.label,this.appendChild(n)}this.requestUpdate(),this._refreshPopover()}connectedCallback(){super.connectedCallback(),gt(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",s=this.disabled!==null;e?this.setAttribute("aria-label",e):this.removeAttribute("aria-label");const n=e||t,a=this._summarize(t),i=this._readValues().length>0,c=`${this.id||"os-unnamed"}__trigger`;return C`
454 + ${e?C`<label
455 455 class="os-multiselect__label"
456 456 for=${c}
457 - >${e}</label>`:k``}
457 + >${e}</label>`:C``}
458 458 <button
459 459 id=${c}
460 460 type="button"
461 461 class="os-multiselect__trigger"
@@ -468,9 +468,9 @@
468 468 >
469 469 <span class="os-multiselect__summary">${a}</span>
470 470 ${se("chevron-right",{size:16,rotate:90,className:"os-multiselect__chevron"})}
471 471 </button>
472 - `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const s of Array.from(t)){const n=s.getAttribute("value");n!==null&&e.push({value:n,label:(s.textContent||n).trim(),disabled:s.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 s=this._readOptions(),n=new Map(s.map(a=>[a.value,a.label]));return t.length===1?n.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=i=>{const r=i.target;if(!r)return;const c=this.shadowRoot?.querySelector(".os-multiselect__trigger");e.contains(r)||c&&c.contains(r)||this._closePopover()},s=i=>{i.key==="Escape"&&(i.stopPropagation(),this._closePopover(),this.shadowRoot?.querySelector(".os-multiselect__trigger")?.focus())},n=()=>this._placePopover(),a=()=>{if(!this._hasMore||this._loadingMore)return;const i=e.scrollHeight,r=e.clientHeight,c=e.scrollTop;i-(c+r)<64&&this.emit("os-multiselect-load-more",{})};setTimeout(()=>{document.addEventListener("pointerdown",t,!0)},0),document.addEventListener("keydown",s,!0),window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),e.addEventListener("scroll",a),this._teardownOpen=()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",s,!0),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0),e.removeEventListener("scroll",a)},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(),s=new Set(this._readValues());if(e.replaceChildren(),t.length===0){const n=document.createElement("div");n.className="os-multiselect__empty",n.textContent="No options",e.appendChild(n);return}if(s.size>0){const n=document.createElement("button");n.type="button",n.className="os-multiselect__clear",n.textContent="Clear",n.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this._writeValueAttribute([]),this.requestUpdate(),this._refreshPopover(),this._emitPick()}),e.appendChild(n)}for(const n of t){const a=document.createElement("label");a.className="os-multiselect__option",a.setAttribute("role","option"),a.setAttribute("aria-selected",s.has(n.value)?"true":"false"),n.disabled&&(a.setAttribute("aria-disabled","true"),a.dataset.disabled="true");const i=document.createElement("input");i.type="checkbox",i.checked=s.has(n.value),i.disabled=n.disabled,i.addEventListener("change",()=>{const c=new Set(this._readValues());i.checked?c.add(n.value):c.delete(n.value);const l=t.map(u=>u.value).filter(u=>c.has(u));this._writeValueAttribute(l),a.setAttribute("aria-selected",i.checked?"true":"false"),this.requestUpdate(),this._refreshPopover(),this._emitPick()});const r=document.createElement("span");r.textContent=n.label,a.appendChild(i),a.appendChild(r),e.appendChild(a)}if(this._loadingMore){const n=document.createElement("div");n.className="os-multiselect__loading";const a=document.createElement("span");a.className="os-multiselect__spinner",a.setAttribute("aria-hidden","true");const i=document.createElement("span");i.textContent="Loading…",n.appendChild(a),n.appendChild(i),e.appendChild(n)}}_placePopover(){const e=this._popover,t=this.shadowRoot?.querySelector(".os-multiselect__trigger");if(!e||!t)return;const s=t.getBoundingClientRect(),n=window.innerWidth,a=window.innerHeight,i=Math.max(s.width,200);e.style.minWidth=`${i}px`;let r=s.left;r+i>n-8&&(r=Math.max(8,n-i-8)),e.style.left=`${r}px`,e.style.top=`${s.bottom+4}px`;const c=e.offsetHeight||200;s.bottom+4+c>a-8&&(e.style.top=`${Math.max(8,s.top-c-4)}px`)}_emitPick(){const e=this._readValues();this.emit("os-pick",{value:e.join(","),values:e})}};We.props=["value","label","placeholder","disabled","name","open"],We.styles=[Hn],We.help=void 0;let Lt=We;Q("os-multiselect",Lt);const Un="openstation.postsWindow.columns",Wn="openstation.postsWindow.statusSegments",Vn="openstation.postsWindow.bulkActions",Bn="openstation.postsWindow.toolbarTrailing",jn="openstation.postsWindow.opened",Kn="openstation.postsWindow.dataLoaded",Pt="[openstation:desktop-mode-posts]",Rs=new Set(["title"]),Gn=new Set(["title","author","parent","date"]);function et(){try{const o=window.wp?.os;if(o&&typeof o.getOsSettings=="function"){const e=o.getOsSettings();if(Array.isArray(e.nativePostsHiddenColumns))return new Set(e.nativePostsHiddenColumns)}}catch{}return new Set}const zt={authors:[],tags:[]};function Ns(o,e,t,s){const n="osPostsFilterMounted",a=o,i=t.map(l=>({value:String(l.id),label:l.name})),r=i.map(l=>`${l.value}:${l.label}`).join("|");if(a[n]){const l=a[n];l.listSig!==r&&(l.picker.items=i,l.listSig=r),l.picker.getAttribute("value")!==e.value&&l.picker.setAttribute("value",e.value),l.picker.hasMore=!!s.hasMore;return}const c=document.createElement("os-multiselect");if(c.setAttribute("placeholder",s.label),c.setAttribute("aria-label",s.ariaLabel),c.setAttribute("data-noclick",""),c.setAttribute("value",e.value),s.dataKey&&c.setAttribute("data-key",s.dataKey),o.appendChild(c),c.items=i,c.hasMore=!!s.hasMore,c.addEventListener("os-pick",l=>{const u=l.detail?.value??"";e.value=u,e.setValue(u)}),s.onLoadMore){const l=s.onLoadMore;c.addEventListener("os-multiselect-load-more",()=>{c.loadingMore=!0,l()})}a[n]={picker:c,listSig:r}}function Ds(o,e,t){const s={key:"title",label:f("Title"),sortable:!0,sticky:!0,render:(l,u)=>re(e,u.id,"title",()=>cn(u,o))},n={key:"author",label:f("Author"),sortable:!0,width:"180px",filterRender:(l,u)=>Ns(l,u,t.authors,{label:f("All authors"),ariaLabel:f("Filter by author")}),render:(l,u)=>re(e,u.id,"author",()=>dn(u))},a={key:"date",label:f("Date"),sortable:!0,width:"170px",sortValue:l=>Date.parse(l.date_gmt+"Z")||0,render:(l,u)=>re(e,u.id,"date",()=>un(u))};if(o.extra.mode==="pages")return[s,n,{key:"parent",label:f("Parent"),width:"200px",render:(l,u)=>re(e,u.id,"parent",()=>In(u,o))},{key:"template",label:f("Template"),width:"180px",render:(l,u)=>re(e,u.id,"template",()=>Ln(u,o))},{key:"slug",label:f("Slug"),width:"200px",render:(l,u)=>re(e,u.id,"slug",()=>Pn(u,o))},{key:"comments",label:f("Comments"),width:"110px",sortValue:l=>typeof l.openstation_comment_count=="number"?l.openstation_comment_count:0,render:(l,u)=>re(e,u.id,"comments",()=>zn(u))},a];const i=[s,n],{categories:r,tags:c}=o.cells;return r&&i.push({key:"categories",label:f("Categories"),width:"260px",render:(l,u)=>re(e,u.id,"categories",()=>r(u,o))}),c&&i.push({key:"tags",label:f("Tags"),minWidth:"360px",filterRender:(l,u)=>Ns(l,u,t.tags.map(d=>({id:d.id,name:d.name})),{label:f("All tags"),ariaLabel:f("Filter by tag"),dataKey:"tags",hasMore:!!t.tagsHasMore,onLoadMore:t.loadMoreTags}),render:(l,u)=>re(e,u.id,"tags",()=>c(u,o))}),i.push(a),i}function Os(o,e,t=zt){const s=Ds(o,e,t),n=window.wp?.hooks;return n&&typeof n.applyFilters=="function"?n.applyFilters(Un,s):s}function Xn(o,e=zt,t=et()){const s=new Set(Ds(o,new Map,e).map(n=>n.key));return Rt(o,new Map,e,!1,t).filter(n=>!s.has(n.key))}function Yn(o){return Os(o,new Map).filter(e=>!Rs.has(e.key)).map(e=>({key:e.key,label:e.label||e.key}))}function Rt(o,e,t=zt,s=!1,n=et()){const a=Os(o,e,t),i=n.size===0?a:a.filter(r=>Rs.has(r.key)||!n.has(r.key));return s?i.filter(r=>Gn.has(r.key)):i}function Zn(){return[{value:"",label:f("All")},{value:"publish",label:f("Published")},{value:"draft",label:f("Drafts")},{value:"pending",label:f("Pending")},{value:"future",label:f("Scheduled")},{value:"trash",label:f("Trash")}]}function Jn(){const o=window.wp?.hooks,e=Zn();if(!o||typeof o.applyFilters!="function")return e;try{const t=o.applyFilters(Wn,e);return Array.isArray(t)&&t.length>0?t:e}catch(t){return console.error(`${Pt} status-segments filter threw; falling back to defaults:`,t),e}}function Qn(o,e){return[{id:"trash",label:f("Move to trash"),icon:"dashicons-trash",variant:"danger",confirm:t=>V(o==="pages"?de("Move %d page to the trash?","Move %d pages to the trash?",t):de("Move %d post to the trash?","Move %d posts to the trash?",t),t),run:async(t,s)=>{const n=s.table.data??[],a=t.filter(i=>{const r=n.find(c=>c.id===i);return r&&r.status!=="trash"});return a.length>0&&await e(a),s.table.clearSelection(),!1}}]}function ei(o){const e=window.wp?.hooks;if(!e||typeof e.applyFilters!="function")return o;try{const t=e.applyFilters(Vn,o);return Array.isArray(t)?t:o}catch(t){return console.error(`${Pt} bulk-actions filter threw; falling back to defaults:`,t),o}}function ti(o){const e=window.wp?.hooks;if(!e||typeof e.applyFilters!="function")return[];try{const t=e.applyFilters(Bn,[],o);return Array.isArray(t)?t.filter(s=>s instanceof HTMLElement):[]}catch(t){return console.error(`${Pt} toolbar-trailing filter threw; ignoring:`,t),[]}}function si(o,e="date"){switch(o){case"title":case"author":case"date":case"modified":return o;case"comments":return"comment_count";default:return e}}function oi(o){return o==="comment_count"?"comments":o}function tt(o,e,t){const s=window.wp?.os;s&&typeof s.broadcast=="function"&&s.broadcast("os.term.changed",{source:"posts-window",taxonomy:o,action:e,id:t})}function he(o){const e=new URLSearchParams;for(const[s,n]of Object.entries(o))n!==void 0&&n!==""&&e.set(s,String(n));const t=e.toString();return t?`?${t}`:""}function ni(o){const e=async(i,r={})=>{const c=await o(i,{...r,headers:{...r.body?{"Content-Type":"application/json"}:{},...r.headers??{}}});if(!c.ok){let u=`${c.status} ${c.statusText}`;try{const d=await c.json();d&&typeof d.message=="string"&&(u=d.message)}catch{}throw new Error(u)}return{data:r.expectJson===!1?null:await c.json(),headers:c.headers}},t=async(i,r)=>{const c={per_page:20,_fields:"id,name,slug,count",orderby:"count",order:"desc"};i&&(c.search=i,c.orderby="name",c.order="asc");const{data:l}=await e(`wp/v2/tags${he(c)}`,{method:"GET",signal:r});return Array.isArray(l)?l:[]},s=async i=>{const{data:r}=await e(`wp/v2/categories${he({per_page:100,_fields:"id,name,slug,parent",orderby:"name",order:"asc"})}`,{method:"GET",signal:i});return Array.isArray(r)?r:[]},n=(i,r=0)=>{const c=i.openstation_count;return{id:i.id??r,name:i.name??"",slug:i.slug??"",parent:i.parent??0,count:typeof c=="number"?c:i.count??0,description:i.description??"",isDefault:i.openstation_is_default===!0}},a=async(i,r={})=>{const{data:c,headers:l}=await e(`wp/v2/${i}${he({per_page:r.perPage??50,page:r.page??1,_fields:"id,name,slug,parent,count,description,openstation_is_default",orderby:r.orderby??"name",order:r.order??"asc",search:r.search,parent:typeof r.parent=="number"&&r.parent>=0?r.parent:void 0})}`,{method:"GET"});return{items:Array.isArray(c)?c.map(u=>n(u)):[],total:parseInt(l.get("X-WP-Total")??"0",10)||0,totalPages:parseInt(l.get("X-WP-TotalPages")??"0",10)||0}};return{searchTags:t,fetchAllCategories:s,async createTag(i){try{const{data:r}=await e("wp/v2/tags",{method:"POST",body:JSON.stringify({name:i})});return tt("post_tag","created",r.id),r}catch(r){const c=r instanceof Error?r.message:String(r);if(/term[\s_]?exists/i.test(c)){const l=(await t(i)).find(u=>u.name.toLowerCase()===i.toLowerCase());if(l)return l}throw r}},async updatePostTags(i,r){const{data:c}=await e(`wp/v2/posts/${i}`,{method:"POST",body:JSON.stringify({tags:r})});return c},async fetchAuthorOptions(i){try{const{data:r}=await e(`wp/v2/users${he({per_page:100,who:"authors",_fields:"id,name",orderby:"name",order:"asc"})}`,{method:"GET",signal:i});return Array.isArray(r)?r:[]}catch{return[]}},async fetchTagOptions(i=1,r=50,c){try{const{data:l,headers:u}=await e(`wp/v2/tags${he({per_page:Math.max(1,r),page:Math.max(1,i),_fields:"id,name,count",orderby:"count",order:"desc"})}`,{method:"GET",signal:c});return{items:Array.isArray(l)?l:[],totalPages:parseInt(u.get("X-WP-TotalPages")??"0",10)||0}}catch{return{items:[],totalPages:0}}},async createCategory(i,r=0,c={}){const l={name:i,parent:r};c.slug&&(l.slug=c.slug),c.description&&(l.description=c.description);try{const{data:u}=await e("wp/v2/categories",{method:"POST",body:JSON.stringify(l)});return tt("category","created",u.id),u}catch(u){const d=u instanceof Error?u.message:String(u);if(/term[\s_]?exists/i.test(d)){const h=(await s()).find(p=>p.name.toLowerCase()===i.toLowerCase()&&p.parent===r);if(h)return h}throw u}},async updatePostCategories(i,r){const{data:c}=await e(`wp/v2/posts/${i}`,{method:"POST",body:JSON.stringify({categories:r})});return c},fetchTerms:a,async fetchAllTerms(i){const r=[];let c=1;for(;c<=5;){const l=await a(i,{page:c,perPage:100});if(r.push(...l.items),c>=l.totalPages)break;c++}return r},async fetchTagCooccurrence(i="tags",r=8){const{data:c}=await e(`desktop-mode/v1/tag-cooccurrence${he({taxonomy:i==="tags"?"post_tag":"category",limit:r})}`,{method:"GET"}),l=new Map,u=c&&typeof c=="object"&&!Array.isArray(c)?c.pairs:void 0;if(!u)return l;for(const[d,h]of Object.entries(u)){const p=parseInt(d,10);if(!Number.isFinite(p)||p<=0)continue;const g=[];for(const m of h){const b=Number(m?.id),w=Number(m?.shared);Number.isFinite(b)&&b>0&&Number.isFinite(w)&&w>0&&g.push({id:b,shared:w})}g.length>0&&l.set(p,g)}return l},async updateTerm(i,r,c){const{data:l}=await e(`wp/v2/${i}/${r}`,{method:"POST",body:JSON.stringify(c)});return tt(i==="categories"?"category":"post_tag","updated",r),n(l,r)},async deleteTerm(i,r){await e(`wp/v2/${i}/${r}?force=true`,{method:"DELETE"}),tt(i==="categories"?"category":"post_tag","deleted",r)},async fetchTermPosts(i,r,c,l){const{data:u,headers:d}=await e(`wp/v2/posts${he({[i]:r,per_page:l,page:c,status:"any",_fields:"id,title,status"})}`,{method:"GET"}),h=parseInt(d.get("X-WP-Total")??"",10);return{items:(Array.isArray(u)?u:[]).map(p=>({id:p.id,title:p.title?.rendered||`#${p.id}`})),totalPages:Math.max(1,parseInt(d.get("X-WP-TotalPages")??"1",10)||1),total:Number.isFinite(h)?h:-1}},async fetchTermCounts(i,r){const{data:c}=await e(`desktop-mode/v1/term-counts${he({taxonomy:i,ids:r.join(",")})}`,{method:"GET"});return c&&typeof c=="object"?c:{}}}}const ii="[openstation:desktop-mode-posts]",ee=o=>o.root.querySelector("[data-os-posts-table]");function ai(o){return{page:o.page,perPage:o.perPage,search:o.search||void 0,status:o.status||void 0,orderby:o.orderby,order:o.order,author:o.author.length>0?o.author:void 0,tag:o.tag.length>0?o.tag:void 0}}function Nt(o,e){if(!e.postsCtx){const t={body:o.root,get table(){return ee(o)},refresh:()=>o.dispatch("refresh").then(()=>{}),getSelectedIds:()=>Array.from(ee(o)?.selection??[]).map(s=>Number(s)),getSelectedRows:()=>{const s=new Set(t.getSelectedIds());return(ee(o)?.data??[]).filter(n=>s.has(n.id))},getCurrentParams:()=>ai(o.state)};e.postsCtx=t}return e.postsCtx}async function ri(o,e,t){const s=t.getSelectedIds();if(s.length===0)return;const{confirm:n}=e;if(n){const a=typeof n=="function"?n(s.length):V(n,s.length);if(!await(o.host.confirm?.({message:a,danger:!0})??Promise.resolve(!1)))return}try{if(await e.run(s,t)===!1)return}catch(a){console.error(`${ii} bulk action "${e.id}" failed`,a)}t.table.clearSelection(),await t.refresh()}function li(o){const e={items:o.list.items,total:o.list.total,totalPages:o.list.pages,page:o.list.page},t=window.wp?.hooks;t&&typeof t.doAction=="function"&&t.doAction(Kn,e),document.dispatchEvent(new CustomEvent("os-posts-window-data-loaded",{detail:e}))}class ci{constructor(){this.items=[],this.pending=!1,this.error=!1,this.key="",this.lastData=null,this.page=0,this.pages=0,this.expected=0,this.disposed=!1,this.ctx=null,this.observer=null,this.sentinel=null,this.generation=0}queryKey(e){return JSON.stringify([e.search,e.status,e.orderby,e.order,e.author,e.tag,e.perPage])}reconcile(e){this.ctx=e;const{state:t,data:s}=e,n=this.queryKey(t);if(n!==this.key&&(this.generation++,this.expected=0,this.key=n,this.items=[],this.page=0,this.pages=0,this.lastData=null,this.error=!1),!e.loading&&s&&s!==this.lastData&&s.list.page===t.page&&(!s.query||this.queryKey(s.query)===n))if(this.lastData=s,s.list.error)this.error=!0;else{if(s.list.page>1&&this.page===0&&s.list.page!==this.expected&&!s.list.replace)return{...e,data:{...s,list:{...s.list,items:this.items}}};const a=s.list.page===1||s.list.replace?s.list.items:[...this.items,...s.list.items];this.items=Array.from(new Map(a.map(i=>[i.id,i])).values()),this.page=s.list.page,this.pages=s.list.pages,this.error=!1}return s?{...e,data:{...s,list:{...s.list,items:this.items}}}:e}get hasMore(){return this.page>0&&this.page<this.pages}async more(){const e=this.ctx;if(!e||this.disposed||this.pending||e.loading||!this.hasMore)return;const t=this.generation;this.pending=!0,this.error=!1,this.expected=this.page+1,e.repaint();try{const s=await e.dispatch("page",{page:this.expected});t===this.generation&&(!s||e.data?.list.error)&&(this.error=!0)}catch{t===this.generation&&(this.error=!0)}finally{this.pending=!1,this.expected=0,this.sentinel=null,this.disposed||e.repaint()}}tail(){let e=this.items.length?f("You’re all caught up."):"";return this.pending?e=f("Loading more…"):this.hasMore&&(e=k`<os-button variant="ghost" @click=${()=>void this.more()}>${this.error?f("Could not load more. Retry"):f("Load more")}</os-button>`),k`<div class="os-posts-desk__continuation" data-content-feed-end role="status">${e}</div>`}observe(e){const t=e.querySelector(".os-posts-desk__feed [data-content-feed-end]");t!==this.sentinel&&(this.observer?.disconnect(),this.sentinel=t,!(!t||typeof IntersectionObserver>"u")&&(this.observer=new IntersectionObserver(s=>{s.some(n=>n.isIntersecting)&&!this.error&&this.more()},{root:e.querySelector(".os-posts-desk__feed"),rootMargin:"0px 0px 240px 0px"}),this.observer.observe(t)))}dispose(){this.disposed=!0,this.observer?.disconnect()}}function di(o){const e=new DOMParser().parseFromString(o,"text/html");e.querySelectorAll("script, style").forEach(n=>n.remove()),e.querySelectorAll("p, div, li, h1, h2, h3, h4, h5, h6, br").forEach(n=>n.append(e.createTextNode(" ")));const t=e.body.textContent||"",s=Intl.Segmenter;return s?Array.from(new s(void 0,{granularity:"word"}).segment(t)).filter(n=>n.isWordLike).length:(t.match(/[\p{L}\p{N}]+/gu)||[]).length}async function ui(o,e,t,s){const n={},a=async(c,l,u,d)=>{try{const h=await o(l,{...u,signal:s},{silent:!0});if(!h.ok)return n[c]=h.status===429||h.status>=500?"retry":"unavailable",null;const p=await d(h);return p===null&&(n[c]="unavailable"),p}catch{return n[c]="retry",null}},[i,r]=await Promise.all([a("words",`wp/v2/${e}/${t}?context=edit&_fields=content`,{},async c=>{const l=await c.json();return typeof l.content?.rendered=="string"&&!l.content.protected?di(l.content.rendered):null}),a("comments",`wp/v2/comments?post=${t}&status=approve&per_page=1`,{method:"HEAD"},async c=>{const l=c.headers.get("X-WP-Total");return l!==null&&/^\d+$/.test(l)?Number(l):null})]);return Object.keys(n).length?{words:i,comments:r,errors:n}:{words:i,comments:r}}function pi(o,e,t){const s=new AbortController,n=new Map,a=new Set,i=new Map,r=new Map,c=new Set,l=new WeakMap;let u=0;const d=()=>{for(const m of o.querySelectorAll("[data-content-metrics]")){const b=n.get(m.dataset.contentMetrics||"");if(!b)continue;for(const M of["words","comments"]){const R=m.querySelector(`[data-metric="${M}"]`);R?.setAttribute("value",b[M]===null?"—":b[M].toLocaleString());let O=b.errors?.[M]?f("This count is unavailable or access is restricted."):"";b.errors?.[M]==="retry"&&(O=f("Could not load this count.")),R?.setAttribute("title",O)}const w=m.dataset.contentMetrics||"";let $=m.querySelector("[data-retry-metrics]");Object.values(b.errors||{}).includes("retry")&&(r.get(w)||0)>=3?$||($=document.createElement("os-button"),$.setAttribute("variant","ghost"),$.setAttribute("data-retry-metrics",""),$.textContent=f("Retry counts"),$.addEventListener("click",()=>{r.delete(w),n.delete(w),$?.remove(),h(w,Number(m.dataset.postId)),p()}),m.append($)):$?.remove()}},h=(m,b)=>{!a.has(m)&&!s.signal.aborted&&(a.add(m),i.set(m,b))},p=()=>{if(!s.signal.aborted)for(;u<2&&i.size;){const[m,b]=i.entries().next().value;i.delete(m),u++,r.set(m,(r.get(m)||0)+1),ui(e,t,b,s.signal).then(w=>{if(!s.signal.aborted&&(n.set(m,w),d(),Object.values(w.errors||{}).includes("retry")&&r.get(m)<3)){const $=setTimeout(()=>{c.delete($),h(m,b),p()},500*r.get(m));c.add($)}}).finally(()=>{a.delete(m),u--,p()})}},g=typeof IntersectionObserver>"u"?null:new IntersectionObserver(m=>{for(const b of m){if(!b.isIntersecting)continue;const w=b.target,$=w.dataset.contentMetrics||"";n.has($)||h($,Number(w.dataset.postId)),g?.unobserve(w)}p()},{root:o.querySelector(".os-posts-desk__feed"),rootMargin:"80px"});return{sync:()=>{d(),o.querySelectorAll("[data-content-metrics]").forEach(m=>{const b=m.getAttribute("data-content-metrics")||"";l.get(m)!==b&&(l.set(m,b),g?.observe(m))})},dispose:()=>{s.abort(),g?.disconnect(),c.forEach(clearTimeout),c.clear(),i.clear(),n.clear()}}}const qs=H` .desktop-mode-posts .os-app-list__toolbar-right.os-app-list__bulk--footer{flex:0 0 auto;align-content:start;gap:8px;padding:8px 12px}.os-posts-desk__continuation{grid-column:1 / -1;padding:14px 8px;text-align:center;font-size:11px;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__filter-toggle{display:none}.os-posts-desk__metrics{display:flex;gap:22px;margin-block:18px 0;--os-ui-stat-padding:0;--os-ui-stat-border:transparent;--os-ui-stat-value-size:24px;--os-ui-stat-value-color:var( --os-ui-fg,#1d2327 )}.os-posts-desk__metrics os-stat{min-inline-size:62px}.desktop-mode-posts:not(.desktop-mode-pages) .os-posts-desk__story{position:relative;border-radius:3px 12px 12px 3px;padding-inline-start:34px;background-image:repeating-linear-gradient(transparent 0 27px,var( --os-ui-surface-subtle,#f0f0f1 ) 27px 28px);background-position:0 10px}.desktop-mode-posts:not(.desktop-mode-pages) .os-posts-desk__story::before{content:'';position:absolute;inset-block:0;inset-inline-start:22px;border-inline-start:1px solid var( --os-ui-accent-dim,#c3c4c7 );opacity:.3}.desktop-mode-pages .os-posts-desk__story{position:relative;border-radius:3px 22px 3px 3px;box-shadow:3px 4px 0 -1px var( --os-ui-surface,#fff ),3px 4px 0 0 var( --os-ui-border,#dcdcde )}.desktop-mode-pages .os-posts-desk__story::after{content:'';position:absolute;inset-block-start:0;inset-inline-end:0;inline-size:16px;block-size:16px;border-end-start-radius:3px;border-inline-start:1px solid var( --os-ui-border,#dcdcde );border-block-end:1px solid var( --os-ui-border,#dcdcde );background:var( --os-ui-surface-sunken,#f6f7f7 );pointer-events:none}.desktop-mode-pages .os-posts-desk__select{margin-inline-end:6px}.os-pages-atlas-host{flex:1;min-block-size:0;display:flex;position:relative}@container content-desk (max-width:600px){.os-posts-desk__hero{padding:8px 12px;min-block-size:36px;gap:8px}.os-posts-desk__hero h2{font-size:17px;margin:0;letter-spacing:-.03em}.os-posts-desk__hero p,.os-posts-desk__eyebrow{display:none}.desktop-mode-posts .os-app-list__toolbar{display:none}.desktop-mode-posts[data-desk-options="true"] .os-app-list__toolbar{display:flex;padding:6px 12px}.os-posts-desk__tools{padding:6px 12px;gap:8px}.os-posts-desk__tools .os-app-list__search{flex:1;min-inline-size:0}.os-posts-desk__filter-toggle{display:block;flex:0 0 auto}.os-posts-desk__tools:not(.is-expanded)>os-select,.os-posts-desk__tools:not(.is-expanded)>os-checkbox{display:none}.os-posts-desk__tools.is-expanded>os-checkbox{flex-basis:100%}.os-posts-desk__feed,.desktop-mode-pages .os-posts-desk__feed{display:block;padding:8px 12px 14px}.os-posts-desk__story,.desktop-mode-pages .os-posts-desk__story,.os-posts-desk__story.is-current{padding:9px 12px;margin-block-end:9px}.desktop-mode-posts:not(.desktop-mode-pages) .os-posts-desk__story{padding-inline-start:24px}.desktop-mode-posts:not(.desktop-mode-pages) .os-posts-desk__story::before{inset-inline-start:14px}.os-posts-desk__story-top{margin-block-end:3px;min-block-size:18px}.os-posts-desk__story-content,.desktop-mode-pages .os-posts-desk__story-content{flex-direction:row;gap:10px}.os-posts-desk__page-mark,.os-posts-desk__kicker{display:none}.os-posts-desk__story h3,.desktop-mode-pages .os-posts-desk__story h3{font-size:18px;margin-block-end:2px;line-height:1.2}.os-posts-desk__thumbnail{inline-size:46px;block-size:46px}.os-posts-desk__excerpt{-webkit-line-clamp:1;line-clamp:1;font-size:11px;line-height:1.4}.desktop-mode-pages .os-posts-desk__excerpt{display:none}.os-posts-desk__metrics{gap:14px;margin-block-start:7px;--os-ui-stat-value-size:14px}.os-posts-desk__metrics os-stat{min-inline-size:0;flex-direction:row;align-items:baseline}.os-posts-desk__metrics os-stat::part(value),.os-posts-desk__metrics os-stat::part(label){display:inline}.os-posts-desk__metrics os-stat::part(label){font-size:9px;margin-inline-start:4px;letter-spacing:0;text-transform:none}.os-posts-desk__story-foot{margin-block-start:4px;gap:4px;flex-wrap:nowrap}.desktop-mode-pages .os-posts-desk__story-foot>.os-posts-desk__byline,.os-posts-desk__story-foot>.os-posts-desk__byline{flex:1;margin:0;font-size:10px;min-inline-size:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.os-posts-desk__story-foot os-button{--os-ui-button-padding:5px 9px;font-size:11px}.desktop-mode-posts .os-app-list__pager{padding:6px 12px;gap:4px;flex-wrap:nowrap}.desktop-mode-posts .os-app-list__pager-meta{font-size:10px;flex:1}.desktop-mode-posts .os-app-list__pager-perpage{display:none}.desktop-mode-posts .os-app-list__pager-nav{flex:0 0 auto}.desktop-mode-posts .os-app-list__pager-nav os-button{font-size:10px}}`,Hs=H` .desktop-mode-posts{container:content-desk / inline-size;color:var( --os-ui-fg,#1d2327 );background:var( --os-ui-surface-sunken,#f6f7f7 )}.desktop-mode-posts [hidden]{display:none !important}.os-posts-desk__hero{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:24px 26px 20px;background:var( --os-ui-surface,#fff )}.os-posts-desk__eyebrow,.os-posts-desk__inspector-head{font-size:10px;font-weight:600;letter-spacing:0.14em;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__hero h2{margin:7px 0;font-size:clamp( 24px,3.4cqi,38px );font-weight:500;letter-spacing:-0.045em;line-height:1.1;color:inherit}.os-posts-desk__hero p{margin:0;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__hero>os-button{flex-shrink:0}.desktop-mode-posts .os-app-list__toolbar{padding:12px 24px;background:var( --os-ui-surface,#fff );flex-wrap:wrap}.desktop-mode-posts .os-app-list__toolbar-left{flex-wrap:wrap;min-inline-size:0}.desktop-mode-posts .os-app-list__search{min-inline-size:150px;flex:1 1 190px}.os-posts-desk__tools{display:flex;align-items:center;gap:10px;padding:9px 24px;border-block-end:1px solid var( --os-ui-border,#dcdcde );background:var( --os-ui-surface,#fff );flex-shrink:0}.os-posts-desk__tools>os-checkbox{margin-inline-end:auto;font-size:11px}.os-posts-desk__tools os-select{inline-size:155px}.os-posts-desk__workspace{display:flex;flex:1;min-block-size:0;min-inline-size:0;overflow:hidden}.os-posts-desk__feed{flex:1;min-inline-size:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:20px 24px 32px}.os-posts-desk__story{padding:20px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:12px;background:var( --os-ui-surface,#fff );margin-block-end:12px;min-inline-size:0;transition:border-color 140ms ease,box-shadow 140ms ease}.os-posts-desk__story:hover{border-color:var( --os-ui-accent-dim,#2271b1 )}.os-posts-desk__story.is-current{border-inline-start:3px solid var( --os-ui-accent,#2271b1 );padding-inline-start:18px}.os-posts-desk__story-top{display:flex;align-items:center;gap:8px;margin-block-end:13px;min-block-size:22px}.os-posts-desk__id{margin-inline-start:auto;flex:0 0 auto;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;font-variant-numeric:tabular-nums;--os-ui-button-padding:3px 5px}.os-posts-desk__id::part(button){color:var( --os-ui-fg-muted,#646970 );gap:5px;min-block-size:24px}.os-posts-desk__id .dashicons{font-size:12px;inline-size:12px;block-size:12px}.os-posts-desk__id + .os-posts-desk__select{margin-inline-start:0}.os-posts-desk__select{margin-inline-start:auto;flex:0 0 20px;inline-size:20px;block-size:20px}.os-posts-desk__status,.os-posts-desk__role{display:inline-flex;align-items:center;gap:6px;font-size:10px;font-weight:600;line-height:1.6;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__status::before{content:"";inline-size:6px;block-size:6px;border-radius:50%;background:currentColor}.os-posts-desk__status[data-status="publish"]{color:var( --os-ui-success-fg,#008a20 )}.os-posts-desk__status[data-status="draft"],.os-posts-desk__status[data-status="pending"]{color:var( --os-ui-warning,#996800 )}.os-posts-desk__status[data-status="future"],.os-posts-desk__role{color:var( --os-ui-accent,#2271b1 )}.os-posts-desk__role{border-inline-start:1px solid var( --os-ui-border,#dcdcde );padding-inline-start:8px}.os-posts-desk__story-content{display:flex;gap:18px;align-items:flex-start}.os-posts-desk__story-copy{min-inline-size:0;flex:1}.os-posts-desk__thumbnail{inline-size:104px;block-size:104px;object-fit:cover;border-radius:7px;flex:0 0 auto}.os-posts-desk__kicker{font-size:10px;letter-spacing:0.06em;color:var( --os-ui-fg-muted,#646970 );margin-block-end:5px;overflow-wrap:anywhere}.os-posts-desk__story h3{font-family:Georgia,"Times New Roman",serif;font-size:23px;font-weight:400;line-height:1.18;letter-spacing:-0.025em;margin:0 0 8px;color:inherit;overflow-wrap:anywhere}.os-posts-desk__story h3 a{color:inherit;text-decoration:none}.os-posts-desk__story h3 a:hover{text-decoration:underline;text-underline-offset:3px}.os-posts-desk__excerpt{font-size:12px;line-height:1.65;margin:0;color:var( --os-ui-fg-muted,#646970 );display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.os-posts-desk__story-foot{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin-block-start:16px}.os-posts-desk__byline{font-size:11px;line-height:1.5;color:var( --os-ui-fg-muted,#646970 );margin-inline-end:auto;overflow-wrap:anywhere}.os-posts-desk__story-foot>.os-posts-desk__byline{flex:1 1 100px}.os-posts-desk__plugin-stat{display:flex;flex-direction:column;gap:4px;min-width:0}.os-posts-desk__plugin-stat-value{display:flex;align-items:center;min-height:22px}.os-posts-desk__plugin-stat-label{font-size:10px;line-height:1.2;letter-spacing:0.06em;text-transform:uppercase;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__lock{font-size:11px;color:var( --os-ui-warning,#996800 )}.os-posts-desk__inspector{flex:0 0 330px;max-inline-size:40%;min-inline-size:0;display:flex;flex-direction:column;border-inline-start:1px solid var( --os-ui-border,#dcdcde );background:var( --os-ui-surface,#fff )}.os-posts-desk__inspector-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 18px;border-block-end:1px solid var( --os-ui-border,#dcdcde )}.os-posts-desk__inspector-head os-button{letter-spacing:normal}.os-posts-desk__inspector-scroll{flex:1;min-block-size:0;overflow:auto;padding:20px;overscroll-behavior:contain}.os-posts-desk__cover{inline-size:100%;max-block-size:180px;object-fit:cover;border-radius:8px;margin-block-end:20px}.os-posts-desk__inspector h2{font-family:Georgia,"Times New Roman",serif;font-size:27px;font-weight:400;line-height:1.2;letter-spacing:-0.03em;margin:10px 0;color:inherit;overflow-wrap:anywhere}.os-posts-desk__preview{font-size:13px;line-height:1.8;color:var( --os-ui-fg-muted,#646970 );overflow-wrap:anywhere}.os-posts-desk__dates{padding-block:16px;border-block:1px solid var( --os-ui-border,#dcdcde );font-size:11px}.os-posts-desk__dates>div{display:flex;justify-content:space-between;gap:10px;margin-block:4px}.os-posts-desk__dates dt{color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__dates dd{margin:0}.os-posts-desk__fields section{padding-block:8px;font-size:12px;overflow-wrap:anywhere}.os-posts-desk__fields h3{font-size:11px;font-weight:600;margin:0 0 8px;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__inspector-actions{display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:16px 20px;border-block-start:1px solid var( --os-ui-border,#dcdcde );font-size:11px}.os-posts-desk__inspector-actions a{color:var( --os-ui-accent,#2271b1 )}.os-posts-desk__empty{padding:48px 20px;text-align:center;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__empty>.dashicons{font-size:40px;inline-size:40px;block-size:40px}.desktop-mode-posts .os-app-list__bulk--footer{padding:10px 24px}.desktop-mode-posts .os-app-list__bulk--footer .os-app-list__count,.desktop-mode-posts .os-app-list__bulk--footer .os-app-list__bulk-actions{flex:0 1 auto}.desktop-mode-pages .os-posts-desk__feed{display:grid;grid-template-columns:repeat( auto-fill,minmax( 230px,1fr ) );align-content:start;gap:16px}.desktop-mode-pages .os-posts-desk__story{margin:0;display:flex;flex-direction:column}.desktop-mode-pages .os-posts-desk__story-content{flex-direction:column;flex:1}.desktop-mode-pages .os-posts-desk__story h3,.desktop-mode-pages .os-posts-desk__inspector h2{font-family:inherit;font-weight:600;font-size:21px}.os-posts-desk__page-mark{border:1px solid var( --os-ui-border,#dcdcde );border-radius:5px;inline-size:42px;block-size:50px;padding:8px;color:var( --os-ui-accent,#2271b1 );background:var( --os-ui-surface-sunken,#f6f7f7 )}.os-posts-desk__page-mark i{display:block;block-size:2px;margin-block-start:4px;background:var( --os-ui-border,#dcdcde )}.os-posts-desk__page-mark i:last-child{inline-size:60%}@container content-desk (max-width:850px){.os-posts-desk__inspector{display:none}.os-posts-desk__inspector.is-open{display:flex;flex:1;max-inline-size:none;border-inline-start:0}.os-posts-desk__workspace.has-detail .os-posts-desk__feed{display:none}.os-posts-desk__hero{padding:20px}}@container content-desk (max-width:540px){.os-posts-desk__hero{padding:16px;gap:12px}.os-posts-desk__hero p,.os-posts-desk__eyebrow{display:none}.os-posts-desk__hero h2{font-size:23px}.desktop-mode-posts .os-app-list__toolbar,.os-posts-desk__tools{padding:8px 12px}.os-posts-desk__tools{flex-wrap:wrap}.os-posts-desk__tools>os-checkbox{flex-basis:100%}.os-posts-desk__tools os-select{flex:1;inline-size:130px}.os-posts-desk__feed{padding:12px}.os-posts-desk__story{padding:16px}.os-posts-desk__story.is-current{padding-inline-start:14px}.os-posts-desk__thumbnail{inline-size:64px;block-size:64px}.os-posts-desk__story h3{font-size:21px}}@media (prefers-reduced-motion:reduce){.os-posts-desk__story{transition:none}}.os-posts-desk__tools .os-app-list__search{flex:1 1 170px;min-inline-size:130px}.os-posts-desk__tools>os-checkbox{flex-shrink:0}@container content-desk (max-width:700px){.os-posts-desk__tools{flex-wrap:wrap}.os-posts-desk__tools .os-app-list__search{flex-basis:calc( 100% - 145px )}.os-posts-desk__tools>os-checkbox{flex-basis:auto}.os-posts-desk__tools os-select{flex:1 1 130px;min-inline-size:130px}}.desktop-mode-pages .os-posts-desk__story-foot>.os-posts-desk__byline{flex-basis:100%;margin-block-end:4px}html[data-os-mode="mobile"] .desktop-mode-posts .os-app-list__toolbar-left{flex:1 1 140px}html[data-os-mode="mobile"] .desktop-mode-posts .os-app-list__toolbar-trailing{flex:0 0 auto}`,hi=H` ${_e} ${wt}: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}`,Ve=class Ve extends X{render(){const e=this.checked!==null,t=this.disabled!==null,s=this.label||"",n=this.value;return k`
472 + `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const s of Array.from(t)){const n=s.getAttribute("value");n!==null&&e.push({value:n,label:(s.textContent||n).trim(),disabled:s.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 s=this._readOptions(),n=new Map(s.map(a=>[a.value,a.label]));return t.length===1?n.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=i=>{const r=i.target;if(!r)return;const c=this.shadowRoot?.querySelector(".os-multiselect__trigger");e.contains(r)||c&&c.contains(r)||this._closePopover()},s=i=>{i.key==="Escape"&&(i.stopPropagation(),this._closePopover(),this.shadowRoot?.querySelector(".os-multiselect__trigger")?.focus())},n=()=>this._placePopover(),a=()=>{if(!this._hasMore||this._loadingMore)return;const i=e.scrollHeight,r=e.clientHeight,c=e.scrollTop;i-(c+r)<64&&this.emit("os-multiselect-load-more",{})};setTimeout(()=>{document.addEventListener("pointerdown",t,!0)},0),document.addEventListener("keydown",s,!0),window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),e.addEventListener("scroll",a),this._teardownOpen=()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",s,!0),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0),e.removeEventListener("scroll",a)},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(),s=new Set(this._readValues());if(e.replaceChildren(),t.length===0){const n=document.createElement("div");n.className="os-multiselect__empty",n.textContent="No options",e.appendChild(n);return}if(s.size>0){const n=document.createElement("button");n.type="button",n.className="os-multiselect__clear",n.textContent="Clear",n.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this._writeValueAttribute([]),this.requestUpdate(),this._refreshPopover(),this._emitPick()}),e.appendChild(n)}for(const n of t){const a=document.createElement("label");a.className="os-multiselect__option",a.setAttribute("role","option"),a.setAttribute("aria-selected",s.has(n.value)?"true":"false"),n.disabled&&(a.setAttribute("aria-disabled","true"),a.dataset.disabled="true");const i=document.createElement("input");i.type="checkbox",i.checked=s.has(n.value),i.disabled=n.disabled,i.addEventListener("change",()=>{const c=new Set(this._readValues());i.checked?c.add(n.value):c.delete(n.value);const l=t.map(d=>d.value).filter(d=>c.has(d));this._writeValueAttribute(l),a.setAttribute("aria-selected",i.checked?"true":"false"),this.requestUpdate(),this._refreshPopover(),this._emitPick()});const r=document.createElement("span");r.textContent=n.label,a.appendChild(i),a.appendChild(r),e.appendChild(a)}if(this._loadingMore){const n=document.createElement("div");n.className="os-multiselect__loading";const a=document.createElement("span");a.className="os-multiselect__spinner",a.setAttribute("aria-hidden","true");const i=document.createElement("span");i.textContent="Loading…",n.appendChild(a),n.appendChild(i),e.appendChild(n)}}_placePopover(){const e=this._popover,t=this.shadowRoot?.querySelector(".os-multiselect__trigger");if(!e||!t)return;const s=t.getBoundingClientRect(),n=window.innerWidth,a=window.innerHeight,i=Math.max(s.width,200);e.style.minWidth=`${i}px`;let r=s.left;r+i>n-8&&(r=Math.max(8,n-i-8)),e.style.left=`${r}px`,e.style.top=`${s.bottom+4}px`;const c=e.offsetHeight||200;s.bottom+4+c>a-8&&(e.style.top=`${Math.max(8,s.top-c-4)}px`)}_emitPick(){const e=this._readValues();this.emit("os-pick",{value:e.join(","),values:e})}};We.props=["value","label","placeholder","disabled","name","open"],We.styles=[si],We.help=void 0;let zt=We;Q("os-multiselect",zt);const ni="openstation.postsWindow.columns",ii="openstation.postsWindow.statusSegments",ai="openstation.postsWindow.bulkActions",ri="openstation.postsWindow.toolbarTrailing",li="openstation.postsWindow.opened",ci="openstation.postsWindow.dataLoaded",Rt="[openstation:desktop-mode-posts]",Us=new Set(["title"]),di=new Set(["title","author","parent","date"]);function Ws(o){try{const e=window.wp?.os;if(e&&typeof e.getOsSettings=="function"){const s=e.getOsSettings()[o];if(Array.isArray(s))return new Set(s.filter(n=>typeof n=="string"))}}catch{}return new Set}const Nt={authors:[],tags:[]};function Vs(o,e,t,s){const n="osPostsFilterMounted",a=o,i=t.map(l=>({value:String(l.id),label:l.name})),r=i.map(l=>`${l.value}:${l.label}`).join("|");if(a[n]){const l=a[n];l.listSig!==r&&(l.picker.items=i,l.listSig=r),l.picker.getAttribute("value")!==e.value&&l.picker.setAttribute("value",e.value),l.picker.hasMore=!!s.hasMore;return}const c=document.createElement("os-multiselect");if(c.setAttribute("placeholder",s.label),c.setAttribute("aria-label",s.ariaLabel),c.setAttribute("data-noclick",""),c.setAttribute("value",e.value),s.dataKey&&c.setAttribute("data-key",s.dataKey),o.appendChild(c),c.items=i,c.hasMore=!!s.hasMore,c.addEventListener("os-pick",l=>{const d=l.detail?.value??"";e.value=d,e.setValue(d)}),s.onLoadMore){const l=s.onLoadMore;c.addEventListener("os-multiselect-load-more",()=>{c.loadingMore=!0,l()})}a[n]={picker:c,listSig:r}}function Bs(o,e,t){const s={key:"title",label:f("Title"),sortable:!0,sticky:!0,render:(l,d)=>re(e,d.id,"title",()=>$n(d,o))},n={key:"author",label:f("Author"),sortable:!0,width:"180px",filterRender:(l,d)=>Vs(l,d,t.authors,{label:f("All authors"),ariaLabel:f("Filter by author")}),render:(l,d)=>re(e,d.id,"author",()=>Sn(d))},a={key:"date",label:f("Date"),sortable:!0,width:"170px",sortValue:l=>Date.parse(l.date_gmt+"Z")||0,render:(l,d)=>re(e,d.id,"date",()=>En(d))};if(o.extra.mode==="pages")return[s,n,{key:"parent",label:f("Parent"),width:"200px",render:(l,d)=>re(e,d.id,"parent",()=>Kn(d,o))},{key:"template",label:f("Template"),width:"180px",render:(l,d)=>re(e,d.id,"template",()=>Gn(d,o))},{key:"slug",label:f("Slug"),width:"200px",render:(l,d)=>re(e,d.id,"slug",()=>Xn(d,o))},{key:"comments",label:f("Comments"),width:"110px",sortValue:l=>typeof l.openstation_comment_count=="number"?l.openstation_comment_count:0,render:(l,d)=>re(e,d.id,"comments",()=>Yn(d))},a];const i=[s,n],{categories:r,tags:c}=o.cells;return r&&i.push({key:"categories",label:f("Categories"),width:"260px",render:(l,d)=>re(e,d.id,"categories",()=>r(d,o))}),c&&i.push({key:"tags",label:f("Tags"),minWidth:"360px",filterRender:(l,d)=>Vs(l,d,t.tags.map(u=>({id:u.id,name:u.name})),{label:f("All tags"),ariaLabel:f("Filter by tag"),dataKey:"tags",hasMore:!!t.tagsHasMore,onLoadMore:t.loadMoreTags}),render:(l,d)=>re(e,d.id,"tags",()=>c(d,o))}),i.push(a),i}function js(o,e,t=Nt){const s=Bs(o,e,t),n=window.wp?.hooks;return n&&typeof n.applyFilters=="function"?n.applyFilters(ni,s):s}function ui(o,e=Nt,t=new Set){const s=new Set(Bs(o,new Map,e).map(n=>n.key));return Dt(o,new Map,e,!1,t).filter(n=>!s.has(n.key))}function pi(o){return js(o,new Map).filter(e=>!Us.has(e.key)).map(e=>({key:e.key,label:e.label||e.key}))}function Dt(o,e,t=Nt,s=!1,n=new Set){const a=js(o,e,t),i=n.size===0?a:a.filter(r=>Us.has(r.key)||!n.has(r.key));return s?i.filter(r=>di.has(r.key)):i}function hi(){return[{value:"",label:f("All")},{value:"publish",label:f("Published")},{value:"draft",label:f("Drafts")},{value:"pending",label:f("Pending")},{value:"future",label:f("Scheduled")},{value:"trash",label:f("Trash")}]}function fi(){const o=window.wp?.hooks,e=hi();if(!o||typeof o.applyFilters!="function")return e;try{const t=o.applyFilters(ii,e);return Array.isArray(t)&&t.length>0?t:e}catch(t){return console.error(`${Rt} status-segments filter threw; falling back to defaults:`,t),e}}function gi(o,e){return[{id:"trash",label:f("Move to trash"),icon:"dashicons-trash",variant:"danger",confirm:t=>W(o==="pages"?de("Move %d page to the trash?","Move %d pages to the trash?",t):de("Move %d post to the trash?","Move %d posts to the trash?",t),t),run:async(t,s)=>{const n=s.table.data??[],a=t.filter(i=>{const r=n.find(c=>c.id===i);return r&&r.status!=="trash"});return a.length>0&&await e(a),s.table.clearSelection(),!1}}]}function mi(o){const e=window.wp?.hooks;if(!e||typeof e.applyFilters!="function")return o;try{const t=e.applyFilters(ai,o);return Array.isArray(t)?t:o}catch(t){return console.error(`${Rt} bulk-actions filter threw; falling back to defaults:`,t),o}}function bi(o){const e=window.wp?.hooks;if(!e||typeof e.applyFilters!="function")return[];try{const t=e.applyFilters(ri,[],o);return Array.isArray(t)?t.filter(s=>s instanceof HTMLElement):[]}catch(t){return console.error(`${Rt} toolbar-trailing filter threw; ignoring:`,t),[]}}function _i(o,e="date"){switch(o){case"title":case"author":case"date":case"modified":return o;case"comments":return"comment_count";default:return e}}function vi(o){return o==="comment_count"?"comments":o}function tt(o,e,t){const s=window.wp?.os;s&&typeof s.broadcast=="function"&&s.broadcast("os.term.changed",{source:"posts-window",taxonomy:o,action:e,id:t})}function he(o){const e=new URLSearchParams;for(const[s,n]of Object.entries(o))n!==void 0&&n!==""&&e.set(s,String(n));const t=e.toString();return t?`?${t}`:""}function yi(o){const e=async(i,r={})=>{const c=await o(i,{...r,headers:{...r.body?{"Content-Type":"application/json"}:{},...r.headers??{}}});if(!c.ok){let d=`${c.status} ${c.statusText}`;try{const u=await c.json();u&&typeof u.message=="string"&&(d=u.message)}catch{}throw new Error(d)}return{data:r.expectJson===!1?null:await c.json(),headers:c.headers}},t=async(i,r)=>{const c={per_page:20,_fields:"id,name,slug,count",orderby:"count",order:"desc"};i&&(c.search=i,c.orderby="name",c.order="asc");const{data:l}=await e(`wp/v2/tags${he(c)}`,{method:"GET",signal:r});return Array.isArray(l)?l:[]},s=async i=>{const{data:r}=await e(`wp/v2/categories${he({per_page:100,_fields:"id,name,slug,parent",orderby:"name",order:"asc"})}`,{method:"GET",signal:i});return Array.isArray(r)?r:[]},n=(i,r=0)=>{const c=i.openstation_count;return{id:i.id??r,name:i.name??"",slug:i.slug??"",parent:i.parent??0,count:typeof c=="number"?c:i.count??0,description:i.description??"",isDefault:i.openstation_is_default===!0}},a=async(i,r={})=>{const{data:c,headers:l}=await e(`wp/v2/${i}${he({per_page:r.perPage??50,page:r.page??1,_fields:"id,name,slug,parent,count,description,openstation_is_default",orderby:r.orderby??"name",order:r.order??"asc",search:r.search,parent:typeof r.parent=="number"&&r.parent>=0?r.parent:void 0})}`,{method:"GET"});return{items:Array.isArray(c)?c.map(d=>n(d)):[],total:parseInt(l.get("X-WP-Total")??"0",10)||0,totalPages:parseInt(l.get("X-WP-TotalPages")??"0",10)||0}};return{searchTags:t,fetchAllCategories:s,async createTag(i){try{const{data:r}=await e("wp/v2/tags",{method:"POST",body:JSON.stringify({name:i})});return tt("post_tag","created",r.id),r}catch(r){const c=r instanceof Error?r.message:String(r);if(/term[\s_]?exists/i.test(c)){const l=(await t(i)).find(d=>d.name.toLowerCase()===i.toLowerCase());if(l)return l}throw r}},async updatePostTags(i,r){const{data:c}=await e(`wp/v2/posts/${i}`,{method:"POST",body:JSON.stringify({tags:r})});return c},async fetchAuthorOptions(i){try{const{data:r}=await e(`wp/v2/users${he({per_page:100,who:"authors",_fields:"id,name",orderby:"name",order:"asc"})}`,{method:"GET",signal:i});return Array.isArray(r)?r:[]}catch{return[]}},async fetchTagOptions(i=1,r=50,c){try{const{data:l,headers:d}=await e(`wp/v2/tags${he({per_page:Math.max(1,r),page:Math.max(1,i),_fields:"id,name,count",orderby:"count",order:"desc"})}`,{method:"GET",signal:c});return{items:Array.isArray(l)?l:[],totalPages:parseInt(d.get("X-WP-TotalPages")??"0",10)||0}}catch{return{items:[],totalPages:0}}},async createCategory(i,r=0,c={}){const l={name:i,parent:r};c.slug&&(l.slug=c.slug),c.description&&(l.description=c.description);try{const{data:d}=await e("wp/v2/categories",{method:"POST",body:JSON.stringify(l)});return tt("category","created",d.id),d}catch(d){const u=d instanceof Error?d.message:String(d);if(/term[\s_]?exists/i.test(u)){const h=(await s()).find(p=>p.name.toLowerCase()===i.toLowerCase()&&p.parent===r);if(h)return h}throw d}},async updatePostCategories(i,r){const{data:c}=await e(`wp/v2/posts/${i}`,{method:"POST",body:JSON.stringify({categories:r})});return c},fetchTerms:a,async fetchAllTerms(i){const r=[];let c=1;for(;c<=5;){const l=await a(i,{page:c,perPage:100});if(r.push(...l.items),c>=l.totalPages)break;c++}return r},async fetchTagCooccurrence(i="tags",r=8){const{data:c}=await e(`desktop-mode/v1/tag-cooccurrence${he({taxonomy:i==="tags"?"post_tag":"category",limit:r})}`,{method:"GET"}),l=new Map,d=c&&typeof c=="object"&&!Array.isArray(c)?c.pairs:void 0;if(!d)return l;for(const[u,h]of Object.entries(d)){const p=parseInt(u,10);if(!Number.isFinite(p)||p<=0)continue;const m=[];for(const _ of h){const g=Number(_?.id),b=Number(_?.shared);Number.isFinite(g)&&g>0&&Number.isFinite(b)&&b>0&&m.push({id:g,shared:b})}m.length>0&&l.set(p,m)}return l},async updateTerm(i,r,c){const{data:l}=await e(`wp/v2/${i}/${r}`,{method:"POST",body:JSON.stringify(c)});return tt(i==="categories"?"category":"post_tag","updated",r),n(l,r)},async deleteTerm(i,r){await e(`wp/v2/${i}/${r}?force=true`,{method:"DELETE"}),tt(i==="categories"?"category":"post_tag","deleted",r)},async fetchTermPosts(i,r,c,l){const{data:d,headers:u}=await e(`wp/v2/posts${he({[i]:r,per_page:l,page:c,status:"any",_fields:"id,title,status"})}`,{method:"GET"}),h=parseInt(u.get("X-WP-Total")??"",10);return{items:(Array.isArray(d)?d:[]).map(p=>({id:p.id,title:p.title?.rendered||`#${p.id}`})),totalPages:Math.max(1,parseInt(u.get("X-WP-TotalPages")??"1",10)||1),total:Number.isFinite(h)?h:-1}},async fetchTermCounts(i,r){const{data:c}=await e(`desktop-mode/v1/term-counts${he({taxonomy:i,ids:r.join(",")})}`,{method:"GET"});return c&&typeof c=="object"?c:{}}}}const xi="[openstation:desktop-mode-posts]",ee=o=>o.root.querySelector("[data-os-posts-table]");function ki(o){return{page:o.page,perPage:o.perPage,search:o.search||void 0,status:o.status||void 0,orderby:o.orderby,order:o.order,author:o.author.length>0?o.author:void 0,tag:o.tag.length>0?o.tag:void 0}}function Ot(o,e){if(!e.postsCtx){const t={body:o.root,get table(){return ee(o)},refresh:()=>o.dispatch("refresh").then(()=>{}),getSelectedIds:()=>Array.from(ee(o)?.selection??[]).map(s=>Number(s)),getSelectedRows:()=>{const s=new Set(t.getSelectedIds());return(ee(o)?.data??[]).filter(n=>s.has(n.id))},getCurrentParams:()=>ki(o.state)};e.postsCtx=t}return e.postsCtx}async function wi(o,e,t){const s=t.getSelectedIds();if(s.length===0)return;const{confirm:n}=e;if(n){const a=typeof n=="function"?n(s.length):W(n,s.length);if(!await(o.host.confirm?.({message:a,danger:!0})??Promise.resolve(!1)))return}try{if(await e.run(s,t)===!1)return}catch(a){console.error(`${xi} bulk action "${e.id}" failed`,a)}t.table.clearSelection(),await t.refresh()}function Ci(o){const e={items:o.list.items,total:o.list.total,totalPages:o.list.pages,page:o.list.page},t=window.wp?.hooks;t&&typeof t.doAction=="function"&&t.doAction(ci,e),document.dispatchEvent(new CustomEvent("os-posts-window-data-loaded",{detail:e}))}class $i{constructor(){this.items=[],this.pending=!1,this.error=!1,this.key="",this.lastData=null,this.page=0,this.pages=0,this.expected=0,this.disposed=!1,this.ctx=null,this.observer=null,this.sentinel=null,this.generation=0}queryKey(e){return JSON.stringify([e.search,e.status,e.orderby,e.order,e.author,e.tag,e.perPage])}reconcile(e){this.ctx=e;const{state:t,data:s}=e,n=this.queryKey(t);if(n!==this.key&&(this.generation++,this.expected=0,this.key=n,this.items=[],this.page=0,this.pages=0,this.lastData=null,this.error=!1),!e.loading&&s&&s!==this.lastData&&s.list.page===t.page&&(!s.query||this.queryKey(s.query)===n))if(this.lastData=s,s.list.error)this.error=!0;else{if(s.list.page>1&&this.page===0&&s.list.page!==this.expected&&!s.list.replace)return{...e,data:{...s,list:{...s.list,items:this.items}}};const a=s.list.page===1||s.list.replace?s.list.items:[...this.items,...s.list.items];this.items=Array.from(new Map(a.map(i=>[i.id,i])).values()),this.page=s.list.page,this.pages=s.list.pages,this.error=!1}return s?{...e,data:{...s,list:{...s.list,items:this.items}}}:e}get hasMore(){return this.page>0&&this.page<this.pages}async more(){const e=this.ctx;if(!e||this.disposed||this.pending||e.loading||!this.hasMore)return;const t=this.generation;this.pending=!0,this.error=!1,this.expected=this.page+1,e.repaint();try{const s=await e.dispatch("page",{page:this.expected});t===this.generation&&(!s||e.data?.list.error)&&(this.error=!0)}catch{t===this.generation&&(this.error=!0)}finally{this.pending=!1,this.expected=0,this.sentinel=null,this.disposed||e.repaint()}}tail(){let e=this.items.length?f("You’re all caught up."):"";return this.pending?e=f("Loading more…"):this.hasMore&&(e=C`<os-button variant="ghost" @click=${()=>void this.more()}>${this.error?f("Could not load more. Retry"):f("Load more")}</os-button>`),C`<div class="os-posts-desk__continuation" data-content-feed-end role="status">${e}</div>`}observe(e){const t=e.querySelector(".os-posts-desk__feed [data-content-feed-end]");t!==this.sentinel&&(this.observer?.disconnect(),this.sentinel=t,!(!t||typeof IntersectionObserver>"u")&&(this.observer=new IntersectionObserver(s=>{s.some(n=>n.isIntersecting)&&!this.error&&this.more()},{root:e.querySelector(".os-posts-desk__feed"),rootMargin:"0px 0px 240px 0px"}),this.observer.observe(t)))}dispose(){this.disposed=!0,this.observer?.disconnect()}}function Si(o){const e=new DOMParser().parseFromString(o,"text/html");e.querySelectorAll("script, style").forEach(n=>n.remove()),e.querySelectorAll("p, div, li, h1, h2, h3, h4, h5, h6, br").forEach(n=>n.append(e.createTextNode(" ")));const t=e.body.textContent||"",s=Intl.Segmenter;return s?Array.from(new s(void 0,{granularity:"word"}).segment(t)).filter(n=>n.isWordLike).length:(t.match(/[\p{L}\p{N}]+/gu)||[]).length}async function Ei(o,e,t,s){const n={},a=async(c,l,d,u)=>{try{const h=await o(l,{...d,signal:s},{silent:!0});if(!h.ok)return n[c]=h.status===429||h.status>=500?"retry":"unavailable",null;const p=await u(h);return p===null&&(n[c]="unavailable"),p}catch{return n[c]="retry",null}},[i,r]=await Promise.all([a("words",`wp/v2/${e}/${t}?context=edit&_fields=content`,{},async c=>{const l=await c.json();return typeof l.content?.rendered=="string"&&!l.content.protected?Si(l.content.rendered):null}),a("comments",`wp/v2/comments?post=${t}&status=approve&per_page=1`,{method:"HEAD"},async c=>{const l=c.headers.get("X-WP-Total");return l!==null&&/^\d+$/.test(l)?Number(l):null})]);return Object.keys(n).length?{words:i,comments:r,errors:n}:{words:i,comments:r}}function Ai(o,e,t){const s=new AbortController,n=new Map,a=new Set,i=new Map,r=new Map,c=new Set,l=new WeakMap;let d=0;const u=()=>{for(const _ of o.querySelectorAll("[data-content-metrics]")){const g=n.get(_.dataset.contentMetrics||"");if(!g)continue;for(const S of["words","comments"]){const T=_.querySelector(`[data-metric="${S}"]`);T?.setAttribute("value",g[S]===null?"—":g[S].toLocaleString());let z=g.errors?.[S]?f("This count is unavailable or access is restricted."):"";g.errors?.[S]==="retry"&&(z=f("Could not load this count.")),T?.setAttribute("title",z)}const b=_.dataset.contentMetrics||"";let v=_.querySelector("[data-retry-metrics]");Object.values(g.errors||{}).includes("retry")&&(r.get(b)||0)>=3?v||(v=document.createElement("os-button"),v.setAttribute("variant","ghost"),v.setAttribute("data-retry-metrics",""),v.textContent=f("Retry counts"),v.addEventListener("click",()=>{r.delete(b),n.delete(b),v?.remove(),h(b,Number(_.dataset.postId)),p()}),_.append(v)):v?.remove()}},h=(_,g)=>{!a.has(_)&&!s.signal.aborted&&(a.add(_),i.set(_,g))},p=()=>{if(!s.signal.aborted)for(;d<2&&i.size;){const[_,g]=i.entries().next().value;i.delete(_),d++,r.set(_,(r.get(_)||0)+1),Ei(e,t,g,s.signal).then(b=>{if(!s.signal.aborted&&(n.set(_,b),u(),Object.values(b.errors||{}).includes("retry")&&r.get(_)<3)){const v=setTimeout(()=>{c.delete(v),h(_,g),p()},500*r.get(_));c.add(v)}}).finally(()=>{a.delete(_),d--,p()})}},m=typeof IntersectionObserver>"u"?null:new IntersectionObserver(_=>{for(const g of _){if(!g.isIntersecting)continue;const b=g.target,v=b.dataset.contentMetrics||"";n.has(v)||h(v,Number(b.dataset.postId)),m?.unobserve(b)}p()},{root:o.querySelector(".os-posts-desk__feed"),rootMargin:"80px"});return{sync:()=>{u(),o.querySelectorAll("[data-content-metrics]").forEach(_=>{const g=_.getAttribute("data-content-metrics")||"";l.get(_)!==g&&(l.set(_,g),m?.observe(_))})},dispose:()=>{s.abort(),m?.disconnect(),c.forEach(clearTimeout),c.clear(),i.clear(),n.clear()}}}const Ks=F` .desktop-mode-posts .os-app-list__toolbar-right.os-app-list__bulk--footer{flex:0 0 auto;align-content:start;gap:8px;padding:8px 12px}.os-posts-desk__continuation{grid-column:1 / -1;padding:14px 8px;text-align:center;font-size:11px;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__filter-toggle{display:none}.os-posts-desk__metrics{display:flex;gap:22px;margin-block:18px 0;--os-ui-stat-padding:0;--os-ui-stat-border:transparent;--os-ui-stat-value-size:24px;--os-ui-stat-value-color:var( --os-ui-fg,#1d2327 )}.os-posts-desk__metrics os-stat{min-inline-size:62px}.desktop-mode-posts:not(.desktop-mode-pages) .os-posts-desk__story{position:relative;border-radius:3px 12px 12px 3px;padding-inline-start:34px;background-image:repeating-linear-gradient(transparent 0 27px,var( --os-ui-surface-subtle,#f0f0f1 ) 27px 28px);background-position:0 10px}.desktop-mode-posts:not(.desktop-mode-pages) .os-posts-desk__story::before{content:'';position:absolute;inset-block:0;inset-inline-start:22px;border-inline-start:1px solid var( --os-ui-accent-dim,#c3c4c7 );opacity:.3}.desktop-mode-pages .os-posts-desk__story{position:relative;border-radius:3px 22px 3px 3px;box-shadow:3px 4px 0 -1px var( --os-ui-surface,#fff ),3px 4px 0 0 var( --os-ui-border,#dcdcde )}.desktop-mode-pages .os-posts-desk__story::after{content:'';position:absolute;inset-block-start:0;inset-inline-end:0;inline-size:16px;block-size:16px;border-end-start-radius:3px;border-inline-start:1px solid var( --os-ui-border,#dcdcde );border-block-end:1px solid var( --os-ui-border,#dcdcde );background:var( --os-ui-surface-sunken,#f6f7f7 );pointer-events:none}.desktop-mode-pages .os-posts-desk__select{margin-inline-end:6px}.os-pages-atlas-host{flex:1;min-block-size:0;display:flex;position:relative}@container content-desk (max-width:600px){.os-posts-desk__hero{padding:8px 12px;min-block-size:36px;gap:8px}.os-posts-desk__hero h2{font-size:17px;margin:0;letter-spacing:-.03em}.os-posts-desk__hero p,.os-posts-desk__eyebrow{display:none}.desktop-mode-posts .os-app-list__toolbar{display:none}.desktop-mode-posts[data-desk-options="true"] .os-app-list__toolbar{display:flex;padding:6px 12px}.os-posts-desk__tools{padding:6px 12px;gap:8px}.os-posts-desk__tools .os-app-list__search{flex:1;min-inline-size:0}.os-posts-desk__filter-toggle{display:block;flex:0 0 auto}.os-posts-desk__tools:not(.is-expanded)>os-select,.os-posts-desk__tools:not(.is-expanded)>os-checkbox{display:none}.os-posts-desk__tools.is-expanded>os-checkbox{flex-basis:100%}.os-posts-desk__feed,.desktop-mode-pages .os-posts-desk__feed{display:block;padding:8px 12px 14px}.os-posts-desk__story,.desktop-mode-pages .os-posts-desk__story,.os-posts-desk__story.is-current{padding:9px 12px;margin-block-end:9px}.desktop-mode-posts:not(.desktop-mode-pages) .os-posts-desk__story{padding-inline-start:24px}.desktop-mode-posts:not(.desktop-mode-pages) .os-posts-desk__story::before{inset-inline-start:14px}.os-posts-desk__story-top{margin-block-end:3px;min-block-size:18px}.os-posts-desk__story-content,.desktop-mode-pages .os-posts-desk__story-content{flex-direction:row;gap:10px}.os-posts-desk__page-mark,.os-posts-desk__kicker{display:none}.os-posts-desk__story h3,.desktop-mode-pages .os-posts-desk__story h3{font-size:18px;margin-block-end:2px;line-height:1.2}.os-posts-desk__thumbnail{inline-size:46px;block-size:46px}.os-posts-desk__excerpt{-webkit-line-clamp:1;line-clamp:1;font-size:11px;line-height:1.4}.desktop-mode-pages .os-posts-desk__excerpt{display:none}.os-posts-desk__metrics{gap:14px;margin-block-start:7px;--os-ui-stat-value-size:14px}.os-posts-desk__metrics os-stat{min-inline-size:0;flex-direction:row;align-items:baseline}.os-posts-desk__metrics os-stat::part(value),.os-posts-desk__metrics os-stat::part(label){display:inline}.os-posts-desk__metrics os-stat::part(label){font-size:9px;margin-inline-start:4px;letter-spacing:0;text-transform:none}.os-posts-desk__story-foot{margin-block-start:4px;gap:4px;flex-wrap:nowrap}.desktop-mode-pages .os-posts-desk__story-foot>.os-posts-desk__byline,.os-posts-desk__story-foot>.os-posts-desk__byline{flex:1;margin:0;font-size:10px;min-inline-size:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.os-posts-desk__story-foot os-button{--os-ui-button-padding:5px 9px;font-size:11px}.desktop-mode-posts .os-app-list__pager{padding:6px 12px;gap:4px;flex-wrap:nowrap}.desktop-mode-posts .os-app-list__pager-meta{font-size:10px;flex:1}.desktop-mode-posts .os-app-list__pager-perpage{display:none}.desktop-mode-posts .os-app-list__pager-nav{flex:0 0 auto}.desktop-mode-posts .os-app-list__pager-nav os-button{font-size:10px}}`,Gs=F` .desktop-mode-posts{container:content-desk / inline-size;color:var( --os-ui-fg,#1d2327 );background:var( --os-ui-surface-sunken,#f6f7f7 )}.desktop-mode-posts [hidden]{display:none !important}.os-posts-desk__hero{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:24px 26px 20px;background:var( --os-ui-surface,#fff )}.os-posts-desk__eyebrow,.os-posts-desk__inspector-head{font-size:10px;font-weight:600;letter-spacing:0.14em;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__hero h2{margin:7px 0;font-size:clamp( 24px,3.4cqi,38px );font-weight:500;letter-spacing:-0.045em;line-height:1.1;color:inherit}.os-posts-desk__hero p{margin:0;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__hero>os-button{flex-shrink:0}.desktop-mode-posts .os-app-list__toolbar{padding:12px 24px;background:var( --os-ui-surface,#fff );flex-wrap:wrap}.desktop-mode-posts .os-app-list__toolbar-left{flex-wrap:wrap;min-inline-size:0}.desktop-mode-posts .os-app-list__search{min-inline-size:150px;flex:1 1 190px}.os-posts-desk__tools{display:flex;align-items:center;gap:10px;padding:9px 24px;border-block-end:1px solid var( --os-ui-border,#dcdcde );background:var( --os-ui-surface,#fff );flex-shrink:0}.os-posts-desk__tools>os-checkbox{margin-inline-end:auto;font-size:11px}.os-posts-desk__tools os-select{inline-size:155px}.os-posts-desk__workspace{display:flex;flex:1;min-block-size:0;min-inline-size:0;overflow:hidden}.os-posts-desk__feed{flex:1;min-inline-size:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:20px 24px 32px}.os-posts-desk__story{padding:20px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:12px;background:var( --os-ui-surface,#fff );margin-block-end:12px;min-inline-size:0;transition:border-color 140ms ease,box-shadow 140ms ease}.os-posts-desk__story:hover{border-color:var( --os-ui-accent-dim,#2271b1 )}.os-posts-desk__story.is-current{border-inline-start:3px solid var( --os-ui-accent,#2271b1 );padding-inline-start:18px}.os-posts-desk__story-top{display:flex;align-items:center;gap:8px;margin-block-end:13px;min-block-size:22px}.os-posts-desk__id{margin-inline-start:auto;flex:0 0 auto;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;font-variant-numeric:tabular-nums;--os-ui-button-padding:3px 5px}.os-posts-desk__id::part(button){color:var( --os-ui-fg-muted,#646970 );gap:5px;min-block-size:24px}.os-posts-desk__id .dashicons{font-size:12px;inline-size:12px;block-size:12px}.os-posts-desk__id + .os-posts-desk__select{margin-inline-start:0}.os-posts-desk__select{margin-inline-start:auto;flex:0 0 20px;inline-size:20px;block-size:20px}.os-posts-desk__status,.os-posts-desk__role{display:inline-flex;align-items:center;gap:6px;font-size:10px;font-weight:600;line-height:1.6;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__status::before{content:"";inline-size:6px;block-size:6px;border-radius:50%;background:currentColor}.os-posts-desk__status[data-status="publish"]{color:var( --os-ui-success-fg,#008a20 )}.os-posts-desk__status[data-status="draft"],.os-posts-desk__status[data-status="pending"]{color:var( --os-ui-warning,#996800 )}.os-posts-desk__status[data-status="future"],.os-posts-desk__role{color:var( --os-ui-accent,#2271b1 )}.os-posts-desk__role{border-inline-start:1px solid var( --os-ui-border,#dcdcde );padding-inline-start:8px}.os-posts-desk__story-content{display:flex;gap:18px;align-items:flex-start}.os-posts-desk__story-copy{min-inline-size:0;flex:1}.os-posts-desk__thumbnail{inline-size:104px;block-size:104px;object-fit:cover;border-radius:7px;flex:0 0 auto}.os-posts-desk__kicker{font-size:10px;letter-spacing:0.06em;color:var( --os-ui-fg-muted,#646970 );margin-block-end:5px;overflow-wrap:anywhere}.os-posts-desk__story h3{font-family:Georgia,"Times New Roman",serif;font-size:23px;font-weight:400;line-height:1.18;letter-spacing:-0.025em;margin:0 0 8px;color:inherit;overflow-wrap:anywhere}.os-posts-desk__story h3 a{color:inherit;text-decoration:none}.os-posts-desk__story h3 a:hover{text-decoration:underline;text-underline-offset:3px}.os-posts-desk__excerpt{font-size:12px;line-height:1.65;margin:0;color:var( --os-ui-fg-muted,#646970 );display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.os-posts-desk__story-foot{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin-block-start:16px}.os-posts-desk__byline{font-size:11px;line-height:1.5;color:var( --os-ui-fg-muted,#646970 );margin-inline-end:auto;overflow-wrap:anywhere}.os-posts-desk__story-foot>.os-posts-desk__byline{flex:1 1 100px}.os-posts-desk__plugin-stat{display:flex;flex-direction:column;gap:4px;min-width:0}.os-posts-desk__plugin-stat-value{display:flex;align-items:center;min-height:22px}.os-posts-desk__plugin-stat-label{font-size:10px;line-height:1.2;letter-spacing:0.06em;text-transform:uppercase;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__lock{font-size:11px;color:var( --os-ui-warning,#996800 )}.os-posts-desk__inspector{flex:0 0 330px;max-inline-size:40%;min-inline-size:0;display:flex;flex-direction:column;border-inline-start:1px solid var( --os-ui-border,#dcdcde );background:var( --os-ui-surface,#fff )}.os-posts-desk__inspector-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 18px;border-block-end:1px solid var( --os-ui-border,#dcdcde )}.os-posts-desk__inspector-head os-button{letter-spacing:normal}.os-posts-desk__inspector-scroll{flex:1;min-block-size:0;overflow:auto;padding:20px;overscroll-behavior:contain}.os-posts-desk__cover{inline-size:100%;max-block-size:180px;object-fit:cover;border-radius:8px;margin-block-end:20px}.os-posts-desk__inspector h2{font-family:Georgia,"Times New Roman",serif;font-size:27px;font-weight:400;line-height:1.2;letter-spacing:-0.03em;margin:10px 0;color:inherit;overflow-wrap:anywhere}.os-posts-desk__preview{font-size:13px;line-height:1.8;color:var( --os-ui-fg-muted,#646970 );overflow-wrap:anywhere}.os-posts-desk__dates{padding-block:16px;border-block:1px solid var( --os-ui-border,#dcdcde );--os-ui-facts-font-size:11px;--os-ui-facts-row-gap:4px;--os-ui-facts-column-gap:10px}.os-posts-desk__fields section{padding-block:8px;font-size:12px;overflow-wrap:anywhere}.os-posts-desk__fields h3{font-size:11px;font-weight:600;margin:0 0 8px;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__inspector-actions{display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:16px 20px;border-block-start:1px solid var( --os-ui-border,#dcdcde );font-size:11px}.os-posts-desk__inspector-actions a{color:var( --os-ui-accent,#2271b1 )}.os-posts-desk__empty{padding:48px 20px;text-align:center;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__empty>.dashicons{font-size:40px;inline-size:40px;block-size:40px}.desktop-mode-posts .os-app-list__bulk--footer{padding:10px 24px}.desktop-mode-posts .os-app-list__bulk--footer .os-app-list__count,.desktop-mode-posts .os-app-list__bulk--footer .os-app-list__bulk-actions{flex:0 1 auto}.desktop-mode-pages .os-posts-desk__feed{display:grid;grid-template-columns:repeat( auto-fill,minmax( 230px,1fr ) );align-content:start;gap:16px}.desktop-mode-pages .os-posts-desk__story{margin:0;display:flex;flex-direction:column}.desktop-mode-pages .os-posts-desk__story-content{flex-direction:column;flex:1}.desktop-mode-pages .os-posts-desk__story h3,.desktop-mode-pages .os-posts-desk__inspector h2{font-family:inherit;font-weight:600;font-size:21px}.os-posts-desk__page-mark{border:1px solid var( --os-ui-border,#dcdcde );border-radius:5px;inline-size:42px;block-size:50px;padding:8px;color:var( --os-ui-accent,#2271b1 );background:var( --os-ui-surface-sunken,#f6f7f7 )}.os-posts-desk__page-mark i{display:block;block-size:2px;margin-block-start:4px;background:var( --os-ui-border,#dcdcde )}.os-posts-desk__page-mark i:last-child{inline-size:60%}@container content-desk (max-width:850px){.os-posts-desk__inspector{display:none}.os-posts-desk__inspector.is-open{display:flex;flex:1;max-inline-size:none;border-inline-start:0}.os-posts-desk__workspace.has-detail .os-posts-desk__feed{display:none}.os-posts-desk__hero{padding:20px}}@container content-desk (max-width:540px){.os-posts-desk__hero{padding:16px;gap:12px}.os-posts-desk__hero p,.os-posts-desk__eyebrow{display:none}.os-posts-desk__hero h2{font-size:23px}.desktop-mode-posts .os-app-list__toolbar,.os-posts-desk__tools{padding:8px 12px}.os-posts-desk__tools{flex-wrap:wrap}.os-posts-desk__tools>os-checkbox{flex-basis:100%}.os-posts-desk__tools os-select{flex:1;inline-size:130px}.os-posts-desk__feed{padding:12px}.os-posts-desk__story{padding:16px}.os-posts-desk__story.is-current{padding-inline-start:14px}.os-posts-desk__thumbnail{inline-size:64px;block-size:64px}.os-posts-desk__story h3{font-size:21px}}@media (prefers-reduced-motion:reduce){.os-posts-desk__story{transition:none}}.os-posts-desk__tools .os-app-list__search{flex:1 1 170px;min-inline-size:130px}.os-posts-desk__tools>os-checkbox{flex-shrink:0}@container content-desk (max-width:700px){.os-posts-desk__tools{flex-wrap:wrap}.os-posts-desk__tools .os-app-list__search{flex-basis:calc( 100% - 145px )}.os-posts-desk__tools>os-checkbox{flex-basis:auto}.os-posts-desk__tools os-select{flex:1 1 130px;min-inline-size:130px}}.desktop-mode-pages .os-posts-desk__story-foot>.os-posts-desk__byline{flex-basis:100%;margin-block-end:4px}html[data-os-mode="mobile"] .desktop-mode-posts .os-app-list__toolbar-left{flex:1 1 140px}html[data-os-mode="mobile"] .desktop-mode-posts .os-app-list__toolbar-trailing{flex:0 0 auto}`,Ti=F` ${_e} ${Ct}: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}`,Ve=class Ve extends X{render(){const e=this.checked!==null,t=this.disabled!==null,s=this.label||"",n=this.value;return C`
473 473 <label>
474 474 <input
475 475 type="checkbox"
476 476 .checked=${e}
@@ -479,16 +479,16 @@
479 479 @change=${a=>this._onChange(a)}
480 480 />
481 481 <span class="os-checkbox__label">${s}</span>
482 482 </label>
483 - `}_onChange(e){const s=e.target.checked;s?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:s,value:this.value})}};Ve.props=["checked","value","label","disabled"],Ve.styles=[hi],Ve.help=void 0;let Dt=Ve;Q("os-checkbox",Dt);const fi=H`:host{--_border:var( --os-ui-stat-border,var( --os-ui-border,#dcdcde ) );--_bg:var( --os-ui-stat-bg,transparent );--_value-color:var( --os-ui-stat-value-color,var( --wp-admin-theme-color,#2271b1 ) );--_value-size:var( --os-ui-stat-value-size,20px );--_label-color:var( --os-ui-stat-label-color,var( --os-ui-fg-muted,#646970 ) );display:flex;flex-direction:column;gap:2px;padding:var( --os-ui-stat-padding,10px 12px );border:1px solid var( --_border );border-radius:var( --os-ui-stat-radius,8px );background:var( --_bg );min-inline-size:0}:host( [ hidden ] ){display:none}.value{font-size:var( --_value-size );font-weight:700;line-height:1.1;color:var( --_value-color );font-variant-numeric:tabular-nums}.label{display:inline-flex;align-items:center;gap:6px;font-size:11px;letter-spacing:0.05em;text-transform:uppercase;color:var( --_label-color )}.caption{font-size:11px;color:var( --_label-color )}.swatch{display:inline-block;inline-size:10px;block-size:10px;border-radius:3px;flex:none;background:var( --os-app-tone,var( --os-ui-fg-muted,#646970 ) )}`,Be=class Be extends X{render(){const e=this,t=e.caption||"";return k`
483 + `}_onChange(e){const s=e.target.checked;s?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:s,value:this.value})}};Ve.props=["checked","value","label","disabled"],Ve.styles=[Ti],Ve.help=void 0;let Ht=Ve;Q("os-checkbox",Ht);const Mi=F`:host{--_border:var( --os-ui-stat-border,var( --os-ui-border,#dcdcde ) );--_bg:var( --os-ui-stat-bg,transparent );--_value-color:var( --os-ui-stat-value-color,var( --wp-admin-theme-color,#2271b1 ) );--_value-size:var( --os-ui-stat-value-size,20px );--_label-color:var( --os-ui-stat-label-color,var( --os-ui-fg-muted,#646970 ) );display:flex;flex-direction:column;gap:2px;padding:var( --os-ui-stat-padding,10px 12px );border:1px solid var( --_border );border-radius:var( --os-ui-stat-radius,8px );background:var( --_bg );min-inline-size:0}:host( [ hidden ] ){display:none}.value{font-size:var( --_value-size );font-weight:700;line-height:1.1;color:var( --_value-color );font-variant-numeric:tabular-nums}.label{display:inline-flex;align-items:center;gap:6px;font-size:11px;letter-spacing:0.05em;text-transform:uppercase;color:var( --_label-color )}.caption{font-size:11px;color:var( --_label-color )}.swatch{display:inline-block;inline-size:10px;block-size:10px;border-radius:3px;flex:none;background:var( --os-app-tone,var( --os-ui-fg-muted,#646970 ) )}`,Be=class Be extends X{render(){const e=this,t=e.caption||"";return C`
484 484 <span class="value" part="value">${e.value||""}</span>
485 485 <span class="label" part="label">
486 - ${this.hasAttribute("swatch")?k`<i class="swatch" aria-hidden="true"></i>`:""}
486 + ${this.hasAttribute("swatch")?C`<i class="swatch" aria-hidden="true"></i>`:""}
487 487 ${e.label||""}
488 488 </span>
489 - ${t?k`<span class="caption" part="caption">${t}</span>`:""}
490 - `}};Be.props=["value","label","caption","swatch"],Be.styles=[fi],Be.help=void 0;let Ot=Be;Q("os-stat",Ot);const gi=()=>({view:"desk",filters:!1,peek:!1,focused:null,inspectorKey:"",fields:[]});function Fs(o){return pe((o.excerpt?.rendered??"").replace(/<[^>]*>/g," ")).replace(/\s+/g," ").trim()}function mi(o,e){if(!o.parent)return f("Top-level page");const t=e.find(s=>s.id===o.parent);return t?we(t):V(f("Parent page #%d"),o.parent)}function qt(o,e){o.host.openUrl?.(vt(o.extra,e.id),we(e)||f("(no title)"),o.extra.mode==="pages"?"dashicons-admin-page":"dashicons-admin-post")}function Us(o){return k`<span class="os-posts-desk__status" data-status=${o.status}>${gs[o.status]??o.status}</span>`}function bi(o,e){return o.extra.frontPageId===e.id?f("Front page"):o.extra.postsPageId===e.id?f("Posts page"):""}function Ws(o,e){queueMicrotask(()=>o.querySelector(e)?.shadowRoot?.querySelector("button")?.focus())}function _i(o,e){const t=o.extra.mode==="pages",s=o.data?.list.items??[],n=ee(o)?.selection??new Set,a=s.length>0&&s.every(c=>n.has(c.id)),i=c=>{e.view=c.detail.value==="table"?"table":"desk",o.repaint()},r=c=>{const[l,u]=String(c.detail.value).split(":");o.dispatch("sort",{orderby:l,order:u})};return k`<div class="os-posts-desk__tools ${e.filters?"is-expanded":""}">
489 + ${t?C`<span class="caption" part="caption">${t}</span>`:""}
490 + `}};Be.props=["value","label","caption","swatch"],Be.styles=[Mi],Be.help=void 0;let qt=Be;Q("os-stat",qt);const Ii=()=>({view:"desk",filters:!1,peek:!1,focused:null,inspectorKey:"",fields:[]});function Xs(o){return pe((o.excerpt?.rendered??"").replace(/<[^>]*>/g," ")).replace(/\s+/g," ").trim()}function Li(o,e){if(!o.parent)return f("Top-level page");const t=e.find(s=>s.id===o.parent);return t?we(t):W(f("Parent page #%d"),o.parent)}function Ft(o,e){o.host.openUrl?.(yt(o.extra,e.id),we(e)||f("(no title)"),o.extra.mode==="pages"?"dashicons-admin-page":"dashicons-admin-post")}function Ys(o){return C`<span class="os-posts-desk__status" data-status=${o.status}>${xs[o.status]??o.status}</span>`}function Pi(o,e){return o.extra.frontPageId===e.id?f("Front page"):o.extra.postsPageId===e.id?f("Posts page"):""}function Zs(o,e){queueMicrotask(()=>o.querySelector(e)?.shadowRoot?.querySelector("button")?.focus())}function zi(o,e){const t=o.extra.mode==="pages",s=o.data?.list.items??[],n=ee(o)?.selection??new Set,a=s.length>0&&s.every(c=>n.has(c.id)),i=c=>{e.view=c.detail.value==="table"?"table":"desk",o.repaint()},r=c=>{const[l,d]=String(c.detail.value).split(":");o.dispatch("sort",{orderby:l,order:d})};return C`<div class="os-posts-desk__tools ${e.filters?"is-expanded":""}">
491 491 <os-text-field id=${`${o.windowId}-content-search`} class="os-app-list__search" data-os-posts-search
492 492 aria-label=${f(t?"Search pages":"Search posts")} os-bind="search" os-action="filter" os-debounce="250"
493 493 value=${o.state.search} placeholder=${f(t?"Search pages…":"Search posts…")}></os-text-field>
494 494 <os-button class="os-posts-desk__filter-toggle" variant="secondary" aria-expanded=${String(e.filters)} @click=${()=>{e.filters=!e.filters,o.repaint()}}>${f("Options")}</os-button>
@@ -494,9 +494,9 @@
494 494 <os-button class="os-posts-desk__filter-toggle" variant="secondary" aria-expanded=${String(e.filters)} @click=${()=>{e.filters=!e.filters,o.repaint()}}>${f("Options")}</os-button>
495 495 <os-checkbox label=${f("Select loaded")} ?checked=${a}
496 496 @os-checkbox-change=${()=>{a?ee(o)?.clearSelection():ee(o)?.selectAll()}}></os-checkbox>
497 497 <os-select aria-label=${f("Sort content")} value=${`${o.state.orderby}:${o.state.order}`} @os-pick=${r}>
498 - ${t?k`<os-option value="menu_order:asc">${f("Page order")}</os-option>`:""}
498 + ${t?C`<os-option value="menu_order:asc">${f("Page order")}</os-option>`:""}
499 499 <os-option value="date:desc">${f("Newest first")}</os-option>
500 500 <os-option value="date:asc">${f("Oldest first")}</os-option>
501 501 <os-option value="modified:desc">${f("Recently edited")}</os-option>
502 502 <os-option value="title:asc">${f("Title A–Z")}</os-option>
@@ -510,90 +510,90 @@
510 510 <os-select aria-label=${f("Content view")} value=${e.view} @os-pick=${i} data-os-posts-view>
511 511 <os-option value="desk">${f(t?"Page directory":"Writing desk")}</os-option>
512 512 <os-option value="table">${f("Details table")}</os-option>
513 513 </os-select>
514 - </div>`}function vi(o,e){const t=o.extra.mode==="pages",s=V(f(t?"Copy page ID %d":"Copy post ID %d"),e.id);return k`<os-button variant="ghost" class="os-posts-desk__id" title=${s} @click=${async n=>{n.stopPropagation();const i=await rs(String(e.id))?V(f(t?"Copied page ID #%d.":"Copied post ID #%d."),e.id):f("Couldn’t copy the ID. Please try again.");o.host.toast?.({message:i})}}><span class="screen-reader-text">${s}</span><span aria-hidden="true">#${e.id}</span><span class="dashicons dashicons-admin-page" aria-hidden="true"></span></os-button>`}function yi(o,e){const t=e[o.key];let s="";return o.render?s=o.render(t,e,0):t!=null&&(s=String(t)),s==null||s===""||s instanceof Element&&!s.childNodes.length&&!s.textContent?"":k`<div class="os-posts-desk__plugin-stat" data-column=${o.key}><span class="os-posts-desk__plugin-stat-value">${s}</span><span class="os-posts-desk__plugin-stat-label">${o.label||o.key}</span></div>`}function xi(o,e,t,s,n=[]){const a=o.extra.mode==="pages",i=we(t)||f("(no title)"),r=kt(t),c=xt(t,"category")[0]?.name,l=bi(o,t),u=a?mi(t,o.data?.list.items??[]):pe(c||f("Story"));let d="";a?d=k`<div class="os-posts-desk__page-mark" aria-hidden="true"><span class="dashicons ${l?"dashicons-admin-home":"dashicons-admin-page"}"></span><i></i><i></i><i></i></div>`:r&&(d=k`<img class="os-posts-desk__thumbnail" src=${r.url} alt="" loading="lazy" @error=${p=>p.target.hidden=!0}>`);const h=()=>{e.focused=t.id,e.peek=!0,o.repaint(),Ws(o.root,"[data-os-posts-inspect-close]")};return k`<article class="os-posts-desk__story ${s===t.id?"is-current":""}" data-story-id=${t.id}>
514 + </div>`}function Ri(o,e){const t=o.extra.mode==="pages",s=W(f(t?"Copy page ID %d":"Copy post ID %d"),e.id);return C`<os-button variant="ghost" class="os-posts-desk__id" title=${s} @click=${async n=>{n.stopPropagation();const i=await ls(String(e.id))?W(f(t?"Copied page ID #%d.":"Copied post ID #%d."),e.id):f("Couldn’t copy the ID. Please try again.");o.host.toast?.({message:i})}}><span class="screen-reader-text">${s}</span><span aria-hidden="true">#${e.id}</span><span class="dashicons dashicons-admin-page" aria-hidden="true"></span></os-button>`}function Ni(o,e){const t=e[o.key];let s="";return o.render?s=o.render(t,e,0):t!=null&&(s=String(t)),s==null||s===""||s instanceof Element&&!s.childNodes.length&&!s.textContent?"":C`<div class="os-posts-desk__plugin-stat" data-column=${o.key}><span class="os-posts-desk__plugin-stat-value">${s}</span><span class="os-posts-desk__plugin-stat-label">${o.label||o.key}</span></div>`}function Di(o,e,t,s,n=[]){const a=o.extra.mode==="pages",i=we(t)||f("(no title)"),r=wt(t),c=kt(t,"category")[0]?.name,l=Pi(o,t),d=a?Li(t,o.data?.list.items??[]):pe(c||f("Story"));let u="";a?u=C`<div class="os-posts-desk__page-mark" aria-hidden="true"><span class="dashicons ${l?"dashicons-admin-home":"dashicons-admin-page"}"></span><i></i><i></i><i></i></div>`:r&&(u=C`<img class="os-posts-desk__thumbnail" src=${r.url} alt="" loading="lazy" @error=${p=>p.target.hidden=!0}>`);const h=()=>{e.focused=t.id,e.peek=!0,o.repaint(),Zs(o.root,"[data-os-posts-inspect-close]")};return C`<article class="os-posts-desk__story ${s===t.id?"is-current":""}" data-story-id=${t.id}>
515 515 <div class="os-posts-desk__story-top">
516 - ${Us(t)}
517 - ${l?k`<span class="os-posts-desk__role">${l}</span>`:""}
518 - ${vi(o,t)}
519 - <os-checkbox aria-label=${V(f("Select %s"),i)}
516 + ${Ys(t)}
517 + ${l?C`<span class="os-posts-desk__role">${l}</span>`:""}
518 + ${Ri(o,t)}
519 + <os-checkbox aria-label=${W(f("Select %s"),i)}
520 520 class="os-posts-desk__select" ?checked=${ee(o)?.selection.has(t.id)??!1}
521 521 @os-checkbox-change=${p=>{p.detail.checked?ee(o)?.select(t.id):ee(o)?.deselect(t.id)}}></os-checkbox>
522 522 </div>
523 523 <div class="os-posts-desk__story-content">
524 - ${d}
524 + ${u}
525 525 <div class="os-posts-desk__story-copy">
526 - <div class="os-posts-desk__kicker">${u}</div>
527 - <h3><a href=${vt(o.extra,t.id)} @click=${p=>{p.preventDefault(),qt(o,t)}}>${i}</a></h3>
528 - <p class="os-posts-desk__excerpt">${a?`/${t.slug||""}`:Fs(t)||f("Every story starts somewhere. Open the editor to keep writing.")}</p>
526 + <div class="os-posts-desk__kicker">${d}</div>
527 + <h3><a href=${yt(o.extra,t.id)} @click=${p=>{p.preventDefault(),Ft(o,t)}}>${i}</a></h3>
528 + <p class="os-posts-desk__excerpt">${a?`/${t.slug||""}`:Xs(t)||f("Every story starts somewhere. Open the editor to keep writing.")}</p>
529 529 </div>
530 530 </div>
531 531 <div class="os-posts-desk__metrics" data-content-metrics=${`${t.id}:${t.modified_gmt}`} data-post-id=${t.id}>
532 532 <os-stat data-metric="words" value="—" label=${f("Words")} title=${f("Words in the complete page or post body")}></os-stat>
533 533 <os-stat data-metric="comments" value=${typeof t.openstation_comment_count=="number"?String(t.openstation_comment_count):"—"} label=${f("Comments")} title=${f("Approved comments")}></os-stat>
534 - ${a?"":k`<os-stat value=${String(t.tags?.length??0)} label=${f("Tags")}></os-stat>`}
535 - ${n.map(p=>yi(p,t))}
534 + ${a?"":C`<os-stat value=${String(t.tags?.length??0)} label=${f("Tags")}></os-stat>`}
535 + ${n.map(p=>Ni(p,t))}
536 536 </div>
537 - ${t.openstation_lock?k`<p class="os-posts-desk__lock"><span class="dashicons dashicons-lock" aria-hidden="true"></span>${V(f("%s is editing"),t.openstation_lock.userName)}</p>`:""}
537 + ${t.openstation_lock?C`<p class="os-posts-desk__lock"><span class="dashicons dashicons-lock" aria-hidden="true"></span>${W(f("%s is editing"),t.openstation_lock.userName)}</p>`:""}
538 538 <footer class="os-posts-desk__story-foot">
539 - <span class="os-posts-desk__byline">${yt(t).name}<span aria-hidden="true"> · </span><os-relative-time datetime=${t.modified_gmt||t.date_gmt}></os-relative-time></span>
540 - <os-button variant="ghost" @click=${()=>qt(o,t)}>${f("Edit")}<span aria-hidden="true"> ↗</span></os-button>
539 + <span class="os-posts-desk__byline">${xt(t).name}<span aria-hidden="true"> · </span><os-relative-time datetime=${t.modified_gmt||t.date_gmt}></os-relative-time></span>
540 + <os-button variant="ghost" @click=${()=>Ft(o,t)}>${f("Edit")}<span aria-hidden="true"> ↗</span></os-button>
541 541 <os-button variant="secondary" data-inspect-id=${t.id} @click=${h}>${f("Details")}</os-button>
542 542 </footer>
543 - </article>`}function ki(o,e,t,s,n,a){if(!a||!e.peek||e.focused===null)return"";const i=JSON.stringify([a,Array.from(n)]);if(i!==e.inspectorKey){e.inspectorKey=i,e.fields=Rt(t,new Map,s,!1,n).filter(l=>!["title","author","date"].includes(l.key)).map(l=>({key:l.key,label:l.label||l.key,node:l.render?l.render(a[l.key],a,0):String(a[l.key]??"—")}));for(const l of t.categories.pickers)l.isConnected||t.categories.pickers.delete(l)}const r=kt(a),c=()=>{const l=e.focused??a.id;e.focused=null,e.peek=!1,o.repaint(),Ws(o.root,`[data-inspect-id="${l}"]`)};return k`<aside class="os-posts-desk__inspector ${e.focused!==null?"is-open":""}" aria-label=${f("Content details")}
543 + </article>`}function Oi(o,e,t,s,n,a){if(!a||!e.peek||e.focused===null)return"";const i=JSON.stringify([a,Array.from(n)]);if(i!==e.inspectorKey){e.inspectorKey=i,e.fields=Dt(t,new Map,s,!1,n).filter(l=>!["title","author","date"].includes(l.key)).map(l=>({key:l.key,label:l.label||l.key,node:l.render?l.render(a[l.key],a,0):String(a[l.key]??"—")}));for(const l of t.categories.pickers)l.isConnected||t.categories.pickers.delete(l)}const r=wt(a),c=()=>{const l=e.focused??a.id;e.focused=null,e.peek=!1,o.repaint(),Zs(o.root,`[data-inspect-id="${l}"]`)};return C`<aside class="os-posts-desk__inspector ${e.focused!==null?"is-open":""}" aria-label=${f("Content details")}
544 544 @keydown=${l=>{l.key==="Escape"&&(l.stopPropagation(),c())}}>
545 545 <header class="os-posts-desk__inspector-head"><span>${o.extra.mode==="pages"?f("PAGE DETAILS"):f("STORY DETAILS")}</span><os-button variant="ghost" data-os-posts-inspect-close @click=${c}>${f("Close details")}</os-button></header>
546 546 <div class="os-posts-desk__inspector-scroll">
547 - ${r?k`<img class="os-posts-desk__cover" src=${r.url} alt=${r.alt} @error=${l=>l.target.hidden=!0}>`:""}
548 - ${Us(a)}
547 + ${r?C`<img class="os-posts-desk__cover" src=${r.url} alt=${r.alt} @error=${l=>l.target.hidden=!0}>`:""}
548 + ${Ys(a)}
549 549 <h2>${we(a)||f("(no title)")}</h2>
550 - <p class="os-posts-desk__byline">${yt(a).name}</p>
551 - ${a.openstation_lock?k`<os-notice tone="warning">${V(f("%s is currently editing"),a.openstation_lock.userName)}</os-notice>`:""}
552 - <p class="os-posts-desk__preview">${Fs(a)||f("No excerpt yet.")}</p>
553 - <dl class="os-posts-desk__dates"><div><dt>${a.status==="future"?f("Scheduled for"):f("Date")}</dt><dd><os-relative-time datetime=${a.date_gmt||a.date}></os-relative-time></dd></div><div><dt>${f("Last edited")}</dt><dd><os-relative-time datetime=${a.modified_gmt||a.modified}></os-relative-time></dd></div></dl>
554 - <div class="os-posts-desk__fields">${e.fields.map(l=>k`<section data-detail-field=${l.key}><h3>${l.label}</h3>${l.node}</section>`)}</div>
550 + <p class="os-posts-desk__byline">${xt(a).name}</p>
551 + ${a.openstation_lock?C`<os-notice tone="warning">${W(f("%s is currently editing"),a.openstation_lock.userName)}</os-notice>`:""}
552 + <p class="os-posts-desk__preview">${Xs(a)||f("No excerpt yet.")}</p>
553 + <os-facts layout="between" class="os-posts-desk__dates"><os-fact label=${a.status==="future"?f("Scheduled for"):f("Date")}><os-relative-time datetime=${a.date_gmt||a.date}></os-relative-time></os-fact><os-fact label=${f("Last edited")}><os-relative-time datetime=${a.modified_gmt||a.modified}></os-relative-time></os-fact></os-facts>
554 + <div class="os-posts-desk__fields">${e.fields.map(l=>C`<section data-detail-field=${l.key}><h3>${l.label}</h3>${l.node}</section>`)}</div>
555 555 </div>
556 - <footer class="os-posts-desk__inspector-actions"><os-button variant="primary" @click=${()=>qt(o,a)}>${f("Open editor")}<span aria-hidden="true"> ↗</span></os-button>
557 - ${a.link&&a.status==="publish"?k`<a href=${a.link} target="_blank" rel="noopener noreferrer">${f("View on site")} ↗</a>`:""}
556 + <footer class="os-posts-desk__inspector-actions"><os-button variant="primary" @click=${()=>Ft(o,a)}>${f("Open editor")}<span aria-hidden="true"> ↗</span></os-button>
557 + ${a.link&&a.status==="publish"?C`<a href=${a.link} target="_blank" rel="noopener noreferrer">${f("View on site")} ↗</a>`:""}
558 558 </footer>
559 - </aside>`}function wi(o,e,t,s,n,a){const i=o.extra.mode==="pages"?f("No pages found."):f("No posts found."),r=o.data?.list.items??[],c=r.find(u=>u.id===e.focused)??r[0],l=r.length?Xn(t,s,n):[];return k`<div class="os-posts-desk__workspace ${e.focused!==null&&c?"has-detail":""}" ?hidden=${e.view!=="desk"}>
559 + </aside>`}function Hi(o,e,t,s,n,a){const i=o.extra.mode==="pages"?f("No pages found."):f("No posts found."),r=o.data?.list.items??[],c=r.find(d=>d.id===e.focused)??r[0],l=r.length?ui(t,s,n):[];return C`<div class="os-posts-desk__workspace ${e.focused!==null&&c?"has-detail":""}" ?hidden=${e.view!=="desk"}>
560 560 <div class="os-posts-desk__feed" aria-label=${o.extra.mode==="pages"?f("Page directory"):f("Stories")}>
561 - ${r.length?r.map(u=>xi(o,e,u,e.peek?c?.id:void 0,l)):k`<div class="os-posts-desk__empty"><span class="dashicons dashicons-welcome-write-blog" aria-hidden="true"></span><h3>${o.loading?f("Opening your workspace…"):i}</h3><p>${o.loading?f("Your content will appear here."):f("Try a different search or change the status filter.")}</p></div>`}
561 + ${r.length?r.map(d=>Di(o,e,d,e.peek?c?.id:void 0,l)):C`<div class="os-posts-desk__empty"><span class="dashicons dashicons-welcome-write-blog" aria-hidden="true"></span><h3>${o.loading?f("Opening your workspace…"):i}</h3><p>${o.loading?f("Your content will appear here."):f("Try a different search or change the status filter.")}</p></div>`}
562 562 ${a??""}
563 563 </div>
564 - ${e.peek?ki(o,e,t,s,n,c):""}
565 - </div>`}function Ci(o){queueMicrotask(()=>{for(const t of o.querySelectorAll(".os-posts-desk__select, [data-os-posts-search]"))t.shadowRoot?.querySelector("input")?.setAttribute("aria-label",t.getAttribute("aria-label")||"");const e=o.querySelector(".os-posts-desk__filter-toggle");e?.shadowRoot?.querySelector("button")?.setAttribute("aria-expanded",e.getAttribute("aria-expanded")||"false")})}const $i="[openstation:desktop-mode-posts]",Si=50,Ht=()=>({desk:gi(),feed:new ci,client:null,env:null,cellCache:new Map,table:Fo(),filterData:{authors:[],tags:[]},columnsKey:"",hidden:null,selected:0,bulkActions:null,extras:null,postsCtx:null,tab:"posts",canvases:{categories:null,tags:null},canvasPending:new Set,menu:null,disposed:!1,tagPage:0,tagTotalPages:1,tagFetching:!1}),Vs=o=>o.mode==="pages"?"pages":"posts";function Ei(o){return o.map(e=>`${e.id}:${e.status}:${e.modified_gmt}`).join("|")}function st(o,e){return e.client||(e.client=ni(o.fetch)),e.client}function Se(o){return o.hidden||(o.hidden=et()),o.hidden}function Bs(o,e,t){let s="";t instanceof Error?s=t.message:t!=null&&(s=String(t)),o.host.toast?.({message:`${e} ${s}`.trim(),duration:6e3})}function Ft(o,e,t){return e.env||(e.env={extra:o.extra,client:st(o,e),cells:t,openUrl:(s,n,a)=>o.host.openUrl?.(s,n,a),confirm:s=>o.host.confirm?.(s)??Promise.resolve(!1),toast:(s,n)=>Bs(o,s,n),announce:(s,n)=>o.host.announce?.("post",s,n),parentTitles:new Map,categories:{tree:null,pickers:new Set}}),e.env}function Ai(o,e){return{client:st(o,e),extra:o.extra,openUrl:(t,s,n)=>o.host.openUrl?.(t,s,n),toast:(t,s)=>Bs(o,t,s),leaveFullscreen:()=>{const t=window.wp?.os?.windowManager?.getById?.(o.windowId);t?.isFullscreen?.()&&t.toggleFullscreen?.()}}}async function js(o,e){if(!(e.tagFetching||e.tagPage>=e.tagTotalPages)){e.tagFetching=!0;try{const t=e.tagPage+1,s=await st(o,e).fetchTagOptions(t,Si);e.tagPage=t,e.tagTotalPages=Math.max(e.tagTotalPages,s.totalPages||t);const n=new Set(e.filterData.tags.map(a=>a.id));for(const a of s.items)n.has(a.id)||(e.filterData.tags.push(a),n.add(a.id));e.filterData.tagsHasMore=e.tagPage<e.tagTotalPages,o.repaint()}finally{e.tagFetching=!1}}}const Ti=o=>`${o.authors.map(e=>e.id).join(",")}|${o.tags.map(e=>e.id).join(",")}|${o.tagsHasMore?1:0}`,Ks=o=>o.split(",").map(e=>parseInt(e.trim(),10)).filter(e=>Number.isFinite(e)&&e>0),Gs=(o,e)=>o.length===e.length&&o.every((t,s)=>t===e[s]);function Mi(o,e,t){const s=o.extra;t.getRowId=a=>a.id,t.subTable=a=>pn(a);const n=oi(o.state.orderby);t.sort=t.columns.some(a=>a.key===n)?{key:n,direction:o.state.order}:null,t.addEventListener("os-table-selection-change",()=>{e.selected=t.selection?.size??0,o.repaint()}),t.addEventListener("os-table-sort-change",a=>{const i=a.detail?.sort,r=s.defaultOrderby??"date";o.dispatch("sort",i?{orderby:si(i.key,r),order:i.direction}:{orderby:r,order:s.defaultOrder??"desc"})}),t.addEventListener("os-table-filter-change",a=>{const i=a.detail?.filters??{},r=Ks(i.author??""),c=Ks(i.tags??"");Gs(r,o.state.author)&&Gs(c,o.state.tag)||(o.local("set-column-filters",{author:r,tag:c}),o.dispatch("filter"))})}function Ii(o,e={}){const t=e.terms,s=e.cells??{},n=(r,c,l)=>{if(!t||c.canvases[l]||c.canvasPending.has(l))return;const u=r.root.querySelector(l==="categories"?"[data-os-posts-cats-host]":"[data-os-posts-tags-host]");u&&(c.canvasPending.add(l),t[l](u,Ai(r,c)).then(d=>{if(c.disposed){d();return}c.canvases[l]=d}).catch(d=>{console.error(`${$i} ${l} canvas failed`,d)}).finally(()=>c.canvasPending.delete(l)))},a=(r,c,l,u)=>(c.bulkActions||(c.bulkActions=ei(Qn(l,d=>r.dispatch("trash",{ids:d})))),k`
566 - <div class="os-app-list__toolbar-right ${"os-app-list__bulk--footer"}" data-os-posts-bulk ?hidden=${c.selected===0}>
567 - <span class="os-app-list__count" data-os-posts-count>${V(f("%d selected"),c.selected)}</span>
568 - <os-button variant="ghost" @click=${()=>ee(r)?.clearSelection()}>${f("Clear selection")}</os-button>
569 - <span class="os-app-list__bulk-actions" data-os-posts-bulk-actions>${c.bulkActions.map(d=>k`<os-button
570 - variant=${d.variant??"secondary"}
571 - data-os-posts-bulk-action=${d.id}
572 - @click=${()=>void ri(r,d,Nt(r,c))}
573 - >${d.icon?k`<span class="dashicons ${d.icon}" aria-hidden="true"></span>`:""} ${d.label}</os-button>`)}</span>
564 + ${e.peek?Oi(o,e,t,s,n,c):""}
565 + </div>`}function qi(o){queueMicrotask(()=>{for(const t of o.querySelectorAll(".os-posts-desk__select, [data-os-posts-search]"))t.shadowRoot?.querySelector("input")?.setAttribute("aria-label",t.getAttribute("aria-label")||"");const e=o.querySelector(".os-posts-desk__filter-toggle");e?.shadowRoot?.querySelector("button")?.setAttribute("aria-expanded",e.getAttribute("aria-expanded")||"false")})}const Fi="[openstation:desktop-mode-posts]",Ui=50,st=()=>({desk:Ii(),feed:new $i,client:null,env:null,cellCache:new Map,table:Xo(),filterData:{authors:[],tags:[]},columnsKey:"",hidden:null,selected:0,bulkActions:null,extras:null,postsCtx:null,tab:"posts",serverTab:"posts",editor:null,canvases:{categories:null,tags:null},canvasPending:new Set,menu:null,disposed:!1,tagPage:0,tagTotalPages:1,tagFetching:!1}),Js=o=>o.mode==="pages"?"pages":"posts";function Wi(o){return o.map(e=>`${e.id}:${e.status}:${e.modified_gmt}`).join("|")}function ot(o,e){return e.client||(e.client=yi(o.fetch)),e.client}function Se(o,e){return o.hidden||(o.hidden=Ws(e)),o.hidden}function Qs(o,e,t){const s=e.replace(/:\s*$/,"");nn(o.host.toast,t,s===e?{fallback:e,duration:6e3}:{lead:s,fallback:`${s}.`,duration:6e3})}function Ut(o,e,t){return e.env||(e.env={extra:o.extra,client:ot(o,e),cells:t,openUrl:(s,n,a)=>o.host.openUrl?.(s,n,a),confirm:s=>o.host.confirm?.(s)??Promise.resolve(!1),toast:(s,n)=>Qs(o,s,n),announce:(s,n)=>o.host.announce?.("post",s,n),parentTitles:new Map,categories:{tree:null,pickers:new Set}}),e.env}function Vi(o,e){return{client:ot(o,e),extra:o.extra,openUrl:(t,s,n)=>o.host.openUrl?.(t,s,n),toast:(t,s)=>Qs(o,t,s),leaveFullscreen:()=>{const t=window.wp?.os?.windowManager?.getById?.(o.windowId);t?.isFullscreen?.()&&t.toggleFullscreen?.()}}}async function eo(o,e){if(!(e.tagFetching||e.tagPage>=e.tagTotalPages)){e.tagFetching=!0;try{const t=e.tagPage+1,s=await ot(o,e).fetchTagOptions(t,Ui);e.tagPage=t,e.tagTotalPages=Math.max(e.tagTotalPages,s.totalPages||t);const n=new Set(e.filterData.tags.map(a=>a.id));for(const a of s.items)n.has(a.id)||(e.filterData.tags.push(a),n.add(a.id));e.filterData.tagsHasMore=e.tagPage<e.tagTotalPages,o.repaint()}finally{e.tagFetching=!1}}}const Bi=o=>`${o.authors.map(e=>e.id).join(",")}|${o.tags.map(e=>e.id).join(",")}|${o.tagsHasMore?1:0}`,to=o=>o.split(",").map(e=>parseInt(e.trim(),10)).filter(e=>Number.isFinite(e)&&e>0),so=(o,e)=>o.length===e.length&&o.every((t,s)=>t===e[s]);function ji(o,e,t){const s=o.extra;t.getRowId=a=>a.id,t.subTable=a=>An(a);const n=vi(o.state.orderby);t.sort=t.columns.some(a=>a.key===n)?{key:n,direction:o.state.order}:null,t.addEventListener("os-table-selection-change",()=>{e.selected=t.selection?.size??0,o.repaint()}),t.addEventListener("os-table-sort-change",a=>{const i=a.detail?.sort,r=s.defaultOrderby??"date";o.dispatch("sort",i?{orderby:_i(i.key,r),order:i.direction}:{orderby:r,order:s.defaultOrder??"desc"})}),t.addEventListener("os-table-filter-change",a=>{const i=a.detail?.filters??{},r=to(i.author??""),c=to(i.tags??"");so(r,o.state.author)&&so(c,o.state.tag)||(o.local("set-column-filters",{author:r,tag:c}),o.dispatch("filter"))})}function Ki(o,e={}){const t=e.terms,s=e.cells??{},n="nativePostsHiddenColumns",a=(g,b,v)=>{if(!t||b.canvases[v]||b.canvasPending.has(v))return;const S=g.root.querySelector(v==="categories"?"[data-os-posts-cats-host]":"[data-os-posts-tags-host]");S&&(b.canvasPending.add(v),t[v](S,Vi(g,b)).then(T=>{if(b.disposed){T();return}b.canvases[v]=T}).catch(T=>{console.error(`${Fi} ${v} canvas failed`,T)}).finally(()=>b.canvasPending.delete(v)))},i=(g,b,v,S)=>(b.bulkActions||(b.bulkActions=mi(gi(v,T=>g.dispatch("trash",{ids:T})))),C`
566 + <div class="os-app-list__toolbar-right ${"os-app-list__bulk--footer"}" data-os-posts-bulk ?hidden=${b.selected===0}>
567 + <span class="os-app-list__count" data-os-posts-count>${W(f("%d selected"),b.selected)}</span>
568 + <os-button variant="ghost" @click=${()=>ee(g)?.clearSelection()}>${f("Clear selection")}</os-button>
569 + <span class="os-app-list__bulk-actions" data-os-posts-bulk-actions>${b.bulkActions.map(T=>C`<os-button
570 + variant=${T.variant??"secondary"}
571 + data-os-posts-bulk-action=${T.id}
572 + @click=${()=>void wi(g,T,Ot(g,b))}
573 + >${T.icon?C`<span class="dashicons ${T.icon}" aria-hidden="true"></span>`:""} ${T.label}</os-button>`)}</span>
574 574 </div>
575 - `),i=(r,c,l,u)=>{const d=c.feed.reconcile(r),{state:h,data:p}=d,g=p?.list,m=l==="pages",b=r.extra,w=Ft(r,c,s);Ps(w,g?.items??[]);const $=()=>r.host.openUrl?.(b.newPostUrl??"",f(m?"Add New Page":"Add New Post"),m?"dashicons-admin-page":"dashicons-admin-post");return c.extras||(c.extras=ti(Nt(r,c))),k`
575 + `),r=g=>Jo(g.root.querySelector("[data-os-posts-editor] iframe")),c=(g,b)=>{b.editor&&r(g).then(v=>{v||b.disposed||!b.editor||(b.editor(),b.editor=null)})},l=(g,b)=>{const v="os.native-window.before-close",S=window.wp?.hooks;if(!S?.addFilter||!S.removeFilter)return()=>{};const T=`desktop-mode/posts/close-guard/${g.windowId}`;let z=!1;return S.addFilter(v,T,(...P)=>{const y=P[0];return P[1]?.windowId!==g.windowId||!b.editor||z?y:(z=!0,(async()=>{const R=!await r(g)||await g.host.confirm?.({title:f("Leave without saving?"),message:f("This post has changes that have not been saved. Closing the window discards them."),confirmLabel:f("Discard and close"),danger:!0})===!0;z=!1,R&&(b.editor?.(),b.editor=null,window.wp?.os?.windowManager?.getById(g.windowId)?.close())})(),!1)}),()=>S.removeFilter?.(v,T)},d=(g,b)=>{if(b.editor)return;const v=g.root.querySelector("[data-os-posts-editor]"),S=g.extra.newPostUrl??"";v&&S&&(b.editor=window.wp?.os?.embedAdminPage?.(v,S)??null)},u=(g,b,v)=>{const S=g.root.querySelector("os-tabs");if(!S){const T=v==="pages";g.host.openUrl?.(g.extra.newPostUrl??"",f(T?"Add Page":"Add Post"),T?"dashicons-admin-page":"dashicons-admin-post");return}S.value="new",p(g,b,"new")},h=g=>g.extra.menuTabs??[],p=(g,b,v)=>{if(b.tab==="new"&&v!=="new"&&c(g,b),b.tab=v,v==="new"){d(g,b);return}if(v==="atlas"&&!b.atlas&&e.atlas){const S=g.root.querySelector("[data-os-pages-atlas]");S&&(b.atlas=e.atlas(S,g));return}(v==="categories"||v==="tags")&&a(g,b,v)},m=(g,b)=>{const v=String(g.state.tab??"")||"posts";if(v===b.serverTab||(b.serverTab=v,v===b.tab))return;const S=g.root.querySelector("os-tabs");S&&(S.value=v),p(g,b,v)},_=(g,b,v,S)=>{const T=b.feed.reconcile(g),{state:z,data:P}=T,y=P?.list,E=v==="pages",M=Ut(g,b,s);Hs(M,y?.items??[]);const R=()=>u(g,b,v);return b.extras||(b.extras=bi(Ot(g,b))),C`
576 576 <header class="os-posts-desk__hero">
577 - <div><span class="os-posts-desk__eyebrow">${f(m?"THE SHAPE OF YOUR SITE":"YOUR EDITORIAL SPACE")}</span><h2>${f(m?"A place for every page.":"Stories in motion.")}</h2><p>${f(m?"Find a page. See where it belongs. Make it yours.":"From first thought to published story. Keep the words moving.")}</p></div>
578 - <os-button variant="holo" data-os-posts-new @click=${$}><span class="dashicons dashicons-plus" aria-hidden="true"></span>${f(m?"New page":"Write a post")}</os-button>
577 + <div><span class="os-posts-desk__eyebrow">${f(E?"THE SHAPE OF YOUR SITE":"YOUR EDITORIAL SPACE")}</span><h2>${f(E?"A place for every page.":"Stories in motion.")}</h2><p>${f(E?"Find a page. See where it belongs. Make it yours.":"From first thought to published story. Keep the words moving.")}</p></div>
578 + <os-button variant="holo" data-os-posts-new @click=${R}><span class="dashicons dashicons-plus" aria-hidden="true"></span>${f(E?"New page":"Write a post")}</os-button>
579 579 </header>
580 580 <header class="os-app-list__toolbar" data-os-posts-toolbar>
581 581 <div class="os-app-list__toolbar-left">
582 - ${Oo({segments:Jn(),value:h.status,bind:"status",action:"filter",label:f("Filter by status"),phone:u})}
582 + ${jo({segments:fi(),value:z.status,bind:"status",action:"filter",label:f("Filter by status"),phone:S})}
583 583 </div>
584 584
585 585 <div class="os-app-list__toolbar-trailing">
586 - <span data-os-posts-toolbar-extras>${c.extras}</span>
586 + <span data-os-posts-toolbar-extras>${b.extras}</span>
587 587 <os-button variant="ghost" os-action="refresh" data-os-posts-refresh title=${f("Refresh")}>
588 588 <span class="dashicons dashicons-update" aria-hidden="true"></span>${f("Refresh")}
589 589 </os-button>
590 590 </div>
591 591 </header>
592 - ${g?.error?k`<os-notice tone="danger">${g.error}</os-notice>`:""}
593 - ${_i(d,c.desk)}
594 - ${wi(d,c.desk,w,c.filterData,Se(c),c.feed.tail())}
595 - <div class="os-app-list__body" data-os-posts-body ?hidden=${c.desk.view!=="table"}>
592 + ${y?.error?C`<os-notice tone="danger">${y.error}</os-notice>`:""}
593 + ${zi(T,b.desk)}
594 + ${Hi(T,b.desk,M,b.filterData,Se(b,n),b.feed.tail())}
595 + <div class="os-app-list__body" data-os-posts-body ?hidden=${b.desk.view!=="table"}>
596 596 <os-table
597 597 data-os-posts-table
598 598 os-preserve
599 599 selectable="multi"
@@ -603,10 +603,10 @@
603 603 striped
604 604 bordered
605 605 >
606 606 <div slot="empty" class="os-app-list__empty">
607 - <span class="dashicons ${m?"dashicons-admin-page":"dashicons-admin-post"}" aria-hidden="true"></span>
608 - <p>${f(m?"No pages found.":"No posts found.")}</p>
607 + <span class="dashicons ${E?"dashicons-admin-page":"dashicons-admin-post"}" aria-hidden="true"></span>
608 + <p>${f(E?"No pages found.":"No posts found.")}</p>
609 609 <p class="os-app-list__empty-hint">
610 610 ${f("Try a different search or change the status filter.")}
611 611 </p>
612 612 </div>
@@ -611,27 +611,28 @@
611 611 </p>
612 612 </div>
613 613 </os-table>
614 614 </div>
615 - ${c.desk.view==="table"?c.feed.tail():""}
616 - ${a(r,c,l)}
617 - `};return Uo(o,{local:{"set-column-filters":(r,c)=>{r.author=Array.isArray(c.author)?c.author:[],r.tag=Array.isArray(c.tag)?c.tag:[]}},placeholder:r=>({list:{items:[],total:0,pages:0,page:r.page,perPage:r.perPage,error:"",code:""}}),view:r=>{const c=r.ui(Ht),l=Vs(r.extra),u=ut(),d=i(r,c,l,u),h=`os-app-list desktop-mode-posts${l==="pages"?" desktop-mode-pages":""}`;if(!t&&!e.atlas)return k`<div class=${h} data-os-posts-root data-desk-options=${String(c.desk.filters)}><style>${Hs.cssText}${qs.cssText}</style>
618 - <div class="os-app-list__panel">${d}</div>
619 - </div>`;const p=g=>{const m=g.detail?.value??"posts";if(c.tab=m,m==="atlas"&&!c.atlas&&e.atlas){const b=r.root.querySelector("[data-os-pages-atlas]");b&&(c.atlas=e.atlas(b,r))}(m==="categories"||m==="tags")&&n(r,c,m)};return k`<div class=${h} data-os-posts-root data-desk-options=${String(c.desk.filters)}><style>${Hs.cssText}${qs.cssText}</style>
620 - <os-tabs value=${c.tab} class="os-app-list__tabs" @os-tab-change=${p}>
621 - <os-tab value="posts">${f(l==="pages"?"All pages":"All posts")}</os-tab>
622 - ${e.atlas?k`<os-tab value="atlas">${f("Page atlas")}</os-tab>`:""}
623 - ${t?k`<os-tab value="categories">${f("Categories")}</os-tab><os-tab value="tags">${f("Tags")}</os-tab>`:""}
615 + ${b.desk.view==="table"?b.feed.tail():""}
616 + ${i(g,b,v)}
617 + `};return Yo(o,{local:{"set-column-filters":(g,b)=>{g.author=Array.isArray(b.author)?b.author:[],g.tag=Array.isArray(b.tag)?b.tag:[]}},placeholder:g=>({list:{items:[],total:0,pages:0,page:g.page,perPage:g.perPage,error:"",code:""}}),view:g=>{const b=g.ui(st),v=Js(g.extra),S=pt(),T=_(g,b,v,S),z=`os-app-list desktop-mode-posts${v==="pages"?" desktop-mode-pages":""}`;if(!t&&!e.atlas)return C`<div class=${z} data-os-posts-root data-desk-options=${String(b.desk.filters)}><style>${Gs.cssText}${Ks.cssText}</style>
618 + <div class="os-app-list__panel">${T}</div>
619 + </div>`;const P=y=>{const E=y.detail?.value??"posts";p(g,b,E)};return C`<div class=${z} data-os-posts-root data-desk-options=${String(b.desk.filters)}><style>${Gs.cssText}${Ks.cssText}</style>
620 + <os-tabs value=${b.tab} class="os-app-list__tabs" @os-tab-change=${P}>
621 + ${h(g).map(y=>C`<os-tab value=${y.id}>${y.label}</os-tab>`)}
624 622 </os-tabs>
625 - <os-tabpanel for="posts" class="os-app-list__panel">${d}</os-tabpanel>
626 - ${e.atlas?k`<os-tabpanel for="atlas" class="os-app-list__panel"><div data-os-pages-atlas class="os-pages-atlas-host" os-preserve></div></os-tabpanel>`:""}
627 - ${t?k`<os-tabpanel for="categories" class="os-app-list__panel">
623 + <os-tabpanel for="posts" class="os-app-list__panel">${T}</os-tabpanel>
624 + <os-tabpanel for="new" class="os-app-list__panel">
625 + <div data-os-posts-editor class="os-posts__embed-host" os-preserve></div>
626 + </os-tabpanel>
627 + ${e.atlas?C`<os-tabpanel for="atlas" class="os-app-list__panel"><div data-os-pages-atlas class="os-pages-atlas-host" os-preserve></div></os-tabpanel>`:""}
628 + ${t?C`<os-tabpanel for="categories" class="os-app-list__panel">
628 629 <div data-os-posts-cats-host class="os-posts__terms-host" os-preserve></div>
629 630 </os-tabpanel>
630 631 <os-tabpanel for="tags" class="os-app-list__panel">
631 632 <div data-os-posts-tags-host class="os-posts__terms-host" os-preserve></div>
632 633 </os-tabpanel>`:""}
633 - </div>`},mounted:r=>{const c=r.ui(Ht),l=[];c.stats=pi(r.root,r.fetch,Vs(r.extra)),c.stats.sync(),l.push(()=>c.stats?.dispose());const u=Ft(r,c,s),d=new MutationObserver(()=>{ee(r)?.toggleAttribute("loading",r.root.getAttribute("aria-busy")==="true")});d.observe(r.root,{attributes:!0,attributeFilter:["aria-busy"]}),l.push(()=>d.disconnect()),st(r,c).fetchAuthorOptions().then(b=>{c.filterData.authors=b,r.repaint()}),c.filterData.loadMoreTags=()=>void js(r,c),js(r,c),c.menu=qo(r.root,{section:f("Show columns"),prefix:o,items:Yn(u),isChecked:b=>!Se(c).has(b),onToggle:b=>{const w=Se(c);w.has(b)?w.delete(b):w.add(b);const $=window.wp?.os;$&&typeof $.updateOsSettings=="function"&&$.updateOsSettings({nativePostsHiddenColumns:Array.from(w).sort()},{windowId:r.windowId}),r.repaint()}}),l.push(()=>c.menu?.dispose());const h=window.wp?.os;if(h&&typeof h.subscribeOsSettings=="function"){let b=Array.from(Se(c)).sort().join(",");l.push(h.subscribeOsSettings(()=>{const w=et(),$=Array.from(w).sort().join(",");$!==b&&(b=$,c.hidden=w,r.repaint(),c.menu?.refresh())}))}h&&typeof h.subscribe=="function"&&l.push(h.subscribe("os.term.changed",b=>{b?.taxonomy==="category"&&(At(u),Tn(u))}));const p=()=>r.repaint();document.addEventListener("os-mode-changed",p),l.push(()=>document.removeEventListener("os-mode-changed",p));const g=Nt(r,c),m=window.wp?.hooks;return m&&typeof m.doAction=="function"&&m.doAction(jn,g),document.dispatchEvent(new CustomEvent("os-posts-window-opened",{detail:g})),()=>{c.disposed=!0;for(const b of l)b();c.feed.dispose(),c.atlas?.(),c.canvases.categories?.(),c.canvases.tags?.(),c.canvases={categories:null,tags:null},At(u)}},updated:r=>{Ci(r.root);const c=ee(r);if(!c)return;r.loading&&c.setAttribute("loading","");const l=r.ui(Ht);l.stats?.sync(),l.feed.observe(r.root);const{state:u,data:d}=r,h=Ft(r,l,s),p=`${Array.from(Se(l)).sort().join(",")}|${Ti(l.filterData)}`;p!==l.columnsKey&&(l.columnsKey=p,l.cellCache.clear(),l.table.invalidateColumns());const g=l.feed.items;l.table.sync({table:c,rows:g,listKey:[u.perPage,u.search,u.status,u.orderby,u.order,u.author.join(","),u.tag.join(",")].join("|"),fingerprint:Ei(g),columns:b=>(l.cellCache.clear(),Rt(h,l.cellCache,l.filterData,b,Se(l))),wire:()=>Mi(r,l,c),onSelection:b=>{l.selected=b.length}}).dataChanged&&(g.some(b=>b.id===l.desk.focused)||(l.desk.focused=null),queueMicrotask(()=>{l.disposed||r.repaint()}),l.cellCache.clear(),Ps(h,g),d&&li(d))}})}function Xs(o){return Math.hypot(o.b.x-o.a.x,o.b.y-o.a.y)}function Ys(o){return{x:(o.a.x+o.b.x)/2,y:(o.a.y+o.b.y)/2}}function Li(o,e,t,s){const n=Xs(e),a=Xs(t),i=n>0&&a>0?a/n:1,r=Math.max(s.min,Math.min(s.max,o.scale*i)),c=Ys(e),l=Ys(t),u=(c.x-o.x)/o.scale,d=(c.y-o.y)/o.scale;return{scale:r,x:l.x-u*r,y:l.y-d*r}}function Pi(o,e){const t=o.ownerDocument.defaultView,s=new AbortController,n=new Map,a=o.style.touchAction;o.style.touchAction="none";let i=!1,r=0;const c=d=>{const h=o.getBoundingClientRect();return{x:d.clientX-h.left,y:d.clientY-h.top}},l={capture:!0,passive:!1,signal:s.signal};t.addEventListener("pointerdown",d=>{d.pointerType!=="touch"||!d.composedPath().includes(o)||(n.set(d.pointerId,c(d)),n.size>=2&&(d.preventDefault(),i||(i=!0,e.start())))},l),t.addEventListener("pointermove",d=>{if(!n.has(d.pointerId))return;if(!i){n.set(d.pointerId,c(d));return}const[h,p]=n.values();if(n.set(d.pointerId,c(d)),d.preventDefault(),p){const[g,m]=n.values();e.write(Li(e.read(),{a:h,b:p},{a:g,b:m},e.bounds))}},l);const u=d=>{n.delete(d.pointerId)&&i&&(d.preventDefault(),n.size||(i=!1,r=performance.now()+300,e.end()))};return t.addEventListener("pointerup",u,l),t.addEventListener("pointercancel",u,l),t.addEventListener("lostpointercapture",u,l),t.addEventListener("click",d=>{d.detail>0&&(i||performance.now()<r)&&d.composedPath().includes(o)&&(d.preventDefault(),d.stopImmediatePropagation())},l),{active:()=>i,dispose:()=>{s.abort(),n.clear(),i&&e.end(),i=!1,o.style.touchAction=a}}}const Zs="__openStationSharedStores";function zi(){const o=window;let e=o[Zs];return e||(e=new Map,o[Zs]=e),e}function Ri(o,e){const t=zi();let s=t.get(o);s||(s={state:e(),listeners:new Set,rebuild:e},t.set(o,s));const n={get state(){return s.state},set state(a){s.state=a},getState(){return s.state},notify(){for(const a of Array.from(s.listeners))try{a(s.state)}catch(i){console.error(`[desktop-mode/shared-store:${o}] subscriber threw:`,i)}},subscribe(a){return s.listeners.add(a),()=>{s.listeners.delete(a)}},setState(a){const i=s.state;if(typeof i!="object"||i===null){console.warn(`[desktop-mode/shared-store:${o}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(i,a),n.notify()},reset(){const a=s.rebuild(),i=s.state;if(typeof i=="object"&&i!==null&&typeof a=="object"&&a!==null){const r=i;for(const c of Object.keys(r))delete r[c];Object.assign(r,a)}else s.state=a;s.listeners.clear()}};return n}const Js=Object.freeze({top:0,right:0,bottom:0,left:0});function Ni(o,e,t,s){return{left:o,top:e,width:t,height:s,right:o+t,bottom:e+s}}function Di(o,e){const t=n=>Math.min(Math.max(0,e.width),Math.max(0,n)),s=n=>Math.min(Math.max(0,e.height),Math.max(0,n));return{top:s(o.top-e.top),bottom:s(e.bottom-o.bottom),left:t(o.left-e.left),right:t(e.right-o.right)}}const Oi="os/work-area";function qi(){return{insets:{...Js},rect:{x:0,y:0,width:0,height:0},viewport:{x:0,y:0,width:0,height:0},area:{width:0,height:0}}}const Hi=Ri(Oi,()=>({snapshot:qi(),installed:!1,areaEl:null}));function Fi(o){const{installed:e,snapshot:t}=Hi.state;if(!e)return{...Js};const s=t.viewport;return Di(Ni(s.x,s.y,s.width,s.height),o.getBoundingClientRect())}const ot=170,Ui=()=>({pixiInteractionAt:0,pinchUntil:0,lastFocusChange:0,panMovedDist:0,panActive:!1,panStart:null}),ne=o=>performance.now()<o.pinchUntil;function ve(o,e){e.stopPropagation?.(),o.pixiInteractionAt=performance.now()}function Qs(o,e){return!o||!e?.global?1/0:Math.hypot(e.global.x-o.x,e.global.y-o.y)}function Wi(o,e,t){const s=performance.now();return ne(o)||s-o.lastFocusChange<250||s-o.pixiInteractionAt<250||o.panMovedDist>4?!1:e.target===t}function Vi(o,e,t){const s={targetScale:o.scale.x,targetWorldX:o.x,targetWorldY:o.y,ease(){const r=s.targetScale-o.scale.x,c=s.targetWorldX-o.x,l=s.targetWorldY-o.y;(Math.abs(r)>5e-4||Math.abs(c)>.5||Math.abs(l)>.5)&&(o.scale.set(o.scale.x+r*.22),o.x+=c*.22,o.y+=l*.22)},stageToWorld(i){return{x:(i.x-o.x)/o.scale.x,y:(i.y-o.y)/o.scale.y}},pan(i,r){o.x+=i,o.y+=r,s.targetWorldX+=i,s.targetWorldY+=r},fitToView(i,r={}){const c=r.padding??90,l=r.animate??!1,u=e.getBoundingClientRect(),d=Fi(e),h=d.left,p=d.top,g=Math.max(0,u.width-d.left-d.right),m=Math.max(0,u.height-d.top-d.bottom);if(!i||g===0||m===0){const P=h+g/2,N=p+m/2;s.targetScale=1,s.targetWorldX=P,s.targetWorldY=N,l||(o.x=P,o.y=N,o.scale.set(1));return}const b=Math.max(1,i.maxX-i.minX),w=Math.max(1,i.maxY-i.minY),$=(g-c*2)/b,M=(m-c*2)/w,R=Math.max(.2,Math.min(1.5,Math.min($,M))),O=(i.minX+i.maxX)/2,I=(i.minY+i.maxY)/2,x=h+g/2-O*R,E=p+m/2-I*R;s.targetScale=R,s.targetWorldX=x,s.targetWorldY=E,l||(o.scale.set(R),o.x=x,o.y=E)},frameOn(i,r){const c=e.getBoundingClientRect();if(c.width<=0||c.height<=0)return!1;const l=ot+70,u=c.width*.85/(2*l),d=c.height*.85/(2*l),h=Math.max(.5,Math.min(1.6,Math.min(u,d)));return s.targetScale=h,s.targetWorldX=c.width/2-i*h,s.targetWorldY=c.height/2-r*h,!0},dispose(){e.removeEventListener("wheel",n),a.dispose()}};function n(i){i.preventDefault();const c=Math.exp(-i.deltaY*8e-4),l=s.targetScale,u=Math.max(.3,Math.min(2.5,l*c));if(Math.abs(u-l)<5e-4)return;const d=e.getBoundingClientRect(),h=i.clientX-d.left,p=i.clientY-d.top,g=(h-s.targetWorldX)/l,m=(p-s.targetWorldY)/l;s.targetScale=u,s.targetWorldX=h-g*u,s.targetWorldY=p-m*u}const a=Pi(e,{read:()=>({x:o.x,y:o.y,scale:o.scale.x}),write:i=>{o.scale.set(i.scale),o.x=i.x,o.y=i.y,s.targetScale=i.scale,s.targetWorldX=i.x,s.targetWorldY=i.y},bounds:{min:.2,max:2.5},start:()=>t?.start(),end:()=>t?.end()});return e.addEventListener("wheel",n,{passive:!1}),s}function Bi(o,e,t,s){let n=!1,a=0,i=0;const r=24,c=80;let l=null;const u=()=>{const h=t.getBoundingClientRect();e.renderer.resize(h.width,h.height),e.stage.hitArea=new o.Rectangle(0,0,h.width,h.height),!n&&h.width>0&&h.height>0&&(n=!0,a=h.width,i=h.height,s.onFirstFit(),t.classList.remove("is-loading")),l!==null&&window.clearTimeout(l),l=window.setTimeout(()=>{l=null;const p=t.getBoundingClientRect();(Math.abs(p.width-a)>=r||Math.abs(p.height-i)>=r)&&(a=p.width,i=p.height,s.onSettle())},c),e.render(),s.onResize?.()},d=new ResizeObserver(u);return d.observe(t),()=>{d.disconnect(),l!==null&&window.clearTimeout(l)}}const Ee='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',Ae=4;function Te(o,e){return o.length>e?o.slice(0,e-1)+"…":o}async function ji(o,e){const t=window.wp?.os;if(!t||typeof t.loadModules!="function")return o.textContent=`${e} ${f("Shell modules API missing.")}`,null;try{await t.loadModules(["pixijs"])}catch{return o.textContent=e,null}const s=window.PIXI;return s||(o.textContent=e),s??null}async function Ki(o,e,t){const s=new o.Application;await s.init({resizeTo:e,backgroundAlpha:0,antialias:!0,autoDensity:!0,resolution:Math.min(window.devicePixelRatio||1,2)}),e.appendChild(s.canvas),s.canvas.classList.add(t);const n=new o.Container;return n.x=e.clientWidth/2,n.y=e.clientHeight/2,s.stage.addChild(n),s.stage.eventMode="static",s.stage.hitArea=new o.Rectangle(0,0,e.clientWidth,e.clientHeight),{app:s,world:n}}function Gi(o,e,t){try{o.ticker?.stop()}catch{}try{o.destroy({removeView:!0},{children:!0})}catch{}e.replaceChildren(),e.classList.remove(...t)}function nt(o=document.body){try{const e=getComputedStyle(o),t=e.getPropertyValue("--os-ui-accent").trim()||e.getPropertyValue("--wp-admin-theme-color").trim();if(!t)return 210;const s=document.createElement("span");s.style.color=t,o.appendChild(s);const n=getComputedStyle(s).color;s.remove();const a=n.match(/\d+/g);return!a||a.length<3?210:Xi(parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10))}catch{return 210}}function Xi(o,e,t){const s=o/255,n=e/255,a=t/255,i=Math.max(s,n,a),r=Math.min(s,n,a),c=i-r;if(c===0)return 210;let l;switch(i){case s:l=(n-a)/c+(n<a?6:0);break;case n:l=(a-s)/c+2;break;default:l=(s-n)/c+4;break}return Math.round(l*60)}function eo(o,e,t){const s=e/100,n=t/100,a=(1-Math.abs(2*n-1))*s,i=o/60,r=a*(1-Math.abs(i%2-1));let c=0,l=0,u=0;i<1?(c=a,l=r):i<2?(c=r,l=a):i<3?(l=a,u=r):i<4?(l=r,u=a):i<5?(c=r,u=a):(c=a,u=r);const d=n-a/2;return Math.round((c+d)*255)*65536+Math.round((l+d)*255)*256+Math.round((u+d)*255)}function Yi(o,e){const t=Math.floor(o/65536)%256,s=Math.floor(o/256)%256,n=o%256,a=i=>Math.round(i*(1+e));return a(t)*65536+a(s)*256+a(n)}function to(o){return`#${o.toString(16).padStart(6,"0")}`}function Zi(o){const e=document.createElement("div");return e.innerHTML=o,e.textContent||e.innerText||""}const Ji=H` .os-term-canvas__intro{padding:22px 24px 18px;background:var( --os-ui-surface,#fff );flex-shrink:0}.os-term-canvas__intro h2{font-size:28px;font-weight:500;letter-spacing:-0.035em;margin:0 0 6px;color:var( --os-ui-fg,#1d2327 )}.os-term-canvas__intro p{font-size:12px;margin:0;color:var( --os-ui-fg-muted,#646970 )}.os-term-directory{position:absolute;inset-block:12px;inset-inline-start:12px;inline-size:min( 300px,calc( 100% - 24px ) );z-index:5;box-sizing:border-box;display:flex;flex-direction:column;gap:10px;padding:16px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:12px;background:var( --os-ui-surface,#fff );color:var( --os-ui-fg,#1d2327 );box-shadow:var( --os-ui-shadow-sheet,0 6px 24px rgba( 0,0,0,0.12 ) )}.os-term-directory header{display:flex;align-items:center;justify-content:space-between}.os-term-directory h3{font-size:17px;margin:0;color:inherit}.os-term-directory__count{font-size:11px;margin:0;color:var( --os-ui-fg-muted,#646970 )}.os-term-directory__items{overflow:auto;min-block-size:0;flex:1;display:flex;flex-direction:column;gap:4px}.os-term-directory__items os-button{flex-shrink:0}.os-term-directory__items os-button::part( button ){inline-size:100%;justify-content:space-between;text-align:start;white-space:normal}.os-term-directory__items small{color:var( --os-ui-fg-muted,#646970 );white-space:nowrap;font-size:10px}@container content-desk (max-width:540px){.os-term-canvas__intro{padding:14px}.os-term-canvas__intro h2{font-size:23px}.os-term-canvas__intro p{display:none}}.os-term-canvas__toolbar{flex-wrap:wrap;padding:12px 20px}.os-term-canvas__toolbar>button,.os-term-directory__toggle{flex-shrink:0;white-space:nowrap}.os-term-canvas__toolbar .os-term-canvas__hint{flex-basis:100%;font-size:11px}.os-term-canvas__search-input{border-radius:8px;border:1px solid var( --os-ui-border,#dcdcde );padding:8px 10px;background:var( --os-ui-surface,#fff );color:var( --os-ui-fg,#1d2327 )}`,B="os-term-canvas";function Ut(o,e){const t=document.createElement("button");return t.type="button",t.className=`${B}__btn${o?` ${B}__btn--${o}`:""}`,t.textContent=e,t}function Qi(o,e,t){o.replaceChildren(),o.classList.add(B,e);const s=document.createElement("style");s.textContent=Ji.cssText,o.appendChild(s);const n=document.createElement("header");n.className="os-term-canvas__intro";const a=document.createElement("h2");a.textContent=f(e==="os-mindmap"?"Give your ideas a home.":"Find the threads.");const i=document.createElement("p");i.textContent=f(e==="os-mindmap"?"Build branches for your stories. Choose a category to explore its posts.":"See what connects your stories. Choose a tag to follow the conversation."),n.append(a,i),o.appendChild(n);const r=document.createElement("div");r.className=`${B}__toolbar`;const c=t.buttons.map(b=>{const w=Ut(b.variant??"",""),$=document.createElement("span");return $.className=`dashicons ${b.icon}`,$.setAttribute("aria-hidden","true"),w.replaceChildren($,document.createTextNode(b.label)),b.title&&(w.title=b.title),r.appendChild(w),w}),l=document.createElement("div");l.className=`${B}__search`;const u=document.createElement("input");u.type="search",u.className=`${B}__search-input`,u.placeholder=t.searchPlaceholder,u.setAttribute("aria-label",t.searchAria),l.appendChild(u);const d=document.createElement("ul");d.className=`${B}__search-results`,d.hidden=!0,l.appendChild(d);const h=document.createElement("span");h.className=`${B}__hint`,h.textContent=t.hint,r.appendChild(l),r.appendChild(h),o.appendChild(r);const p=document.createElement("div");p.className=`${B}__layout`,o.appendChild(p);const g=document.createElement("div");g.className=`${B}__stage is-loading`,p.appendChild(g);const m=document.createElement("aside");return m.className=`${B}__sidebar`,p.appendChild(m),{toolbar:r,stage:g,sidebar:m,buttons:c,searchWrap:l,searchInput:u,searchResults:d}}function ea(o,e){const{searchInput:t,searchResults:s,searchWrap:n}=o;let a=[],i=0;const r=()=>{s.querySelectorAll(`.${B}__search-result`).forEach((g,m)=>{const b=m===i;g.classList.toggle("is-active",b),b&&g.scrollIntoView({block:"nearest"})})},c=()=>{t.value="",s.hidden=!0,s.replaceChildren(),a=[],i=0},l=g=>{c(),e.select(g)},u=()=>{const g=t.value.trim().toLowerCase();if(g.length===0){s.hidden=!0,s.replaceChildren(),a=[],i=0;return}a=e.matches(g).sort((m,b)=>b.count-m.count).slice(0,10),i=0,s.replaceChildren(),a.forEach((m,b)=>{const w=document.createElement("li"),$=document.createElement("button");$.type="button",$.className=`${B}__search-result`,b===0&&$.classList.add("is-active");const M=document.createElement("span");M.className=`${B}__search-title`,M.textContent=m.name||`#${m.id}`;const R=document.createElement("span");R.className=`${B}__search-meta`,R.textContent=V(de("%d post","%d posts",m.count),m.count),$.appendChild(M),$.appendChild(R),$.addEventListener("mousedown",O=>{O.preventDefault(),l(m)}),$.addEventListener("mouseenter",()=>{i=b,r()}),w.appendChild($),s.appendChild(w)}),s.hidden=a.length===0},d=g=>{if(g.key==="ArrowDown"||g.key==="ArrowUp"||g.key==="Enter"){if(a.length===0)return;g.preventDefault(),g.key==="ArrowDown"?(i=Math.min(i+1,a.length-1),r()):g.key==="ArrowUp"?(i=Math.max(i-1,0),r()):l(a[i])}else g.key==="Escape"&&c()},h=()=>{setTimeout(()=>{s.hidden=!0},120)},p=g=>{n.contains(g.target)||(s.hidden=!0)};return t.addEventListener("input",u),t.addEventListener("focus",u),t.addEventListener("keydown",d),t.addEventListener("blur",h),document.addEventListener("click",p),()=>{t.removeEventListener("input",u),t.removeEventListener("focus",u),t.removeEventListener("keydown",d),t.removeEventListener("blur",h),document.removeEventListener("click",p)}}const ta=H` ${_e} ${ys} ${xs} ${ks} ${ws} ${$s}: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 )}}`,je=class je extends X{render(){const e=this.disabled!==null,t=this.busy!==null,s=this.type||"button";return k`
634 + </div>`},mounted:g=>{const b=g.ui(st),v=[];b.stats=Ai(g.root,g.fetch,Js(g.extra)),b.stats.sync(),v.push(()=>b.stats?.dispose());const S=Ut(g,b,s),T=new MutationObserver(()=>{ee(g)?.toggleAttribute("loading",g.root.getAttribute("aria-busy")==="true")});T.observe(g.root,{attributes:!0,attributeFilter:["aria-busy"]}),v.push(()=>T.disconnect()),ot(g,b).fetchAuthorOptions().then(M=>{b.filterData.authors=M,g.repaint()}),b.filterData.loadMoreTags=()=>void eo(g,b),eo(g,b),b.menu=Ko(g.root,{section:f("Show columns"),prefix:o,items:pi(S),isChecked:M=>!Se(b,n).has(M),onToggle:M=>{const R=Se(b,n);R.has(M)?R.delete(M):R.add(M);const H=window.wp?.os;H&&typeof H.updateOsSettings=="function"&&H.updateOsSettings({[n]:Array.from(R).sort()},{windowId:g.windowId}),g.repaint()}}),v.push(()=>b.menu?.dispose());const z=window.wp?.os;if(z&&typeof z.subscribeOsSettings=="function"){let M=Array.from(Se(b,n)).sort().join(",");v.push(z.subscribeOsSettings(()=>{const R=Ws(n),H=Array.from(R).sort().join(",");H!==M&&(M=H,b.hidden=R,g.repaint(),b.menu?.refresh())}))}z&&typeof z.subscribe=="function"&&v.push(z.subscribe("os.term.changed",M=>{M?.taxonomy==="category"&&(Tt(S),Bn(S))}));const P=()=>g.repaint();document.addEventListener("os-mode-changed",P),v.push(()=>document.removeEventListener("os-mode-changed",P)),v.push(l(g,b));const y=Ot(g,b),E=window.wp?.hooks;return E&&typeof E.doAction=="function"&&E.doAction(li,y),document.dispatchEvent(new CustomEvent("os-posts-window-opened",{detail:y})),()=>{b.disposed=!0;for(const M of v)M();b.feed.dispose(),b.atlas?.(),b.editor?.(),b.editor=null,b.canvases.categories?.(),b.canvases.tags?.(),b.canvases={categories:null,tags:null},Tt(S)}},updated:g=>{qi(g.root),m(g,g.ui(st));const b=ee(g);if(!b)return;g.loading&&b.setAttribute("loading","");const v=g.ui(st);v.stats?.sync(),v.feed.observe(g.root);const{state:S,data:T}=g,z=Ut(g,v,s),P=`${Array.from(Se(v,n)).sort().join(",")}|${Bi(v.filterData)}`;P!==v.columnsKey&&(v.columnsKey=P,v.cellCache.clear(),v.table.invalidateColumns());const y=v.feed.items;v.table.sync({table:b,rows:y,listKey:[S.perPage,S.search,S.status,S.orderby,S.order,S.author.join(","),S.tag.join(",")].join("|"),fingerprint:Wi(y),columns:M=>(v.cellCache.clear(),Dt(z,v.cellCache,v.filterData,M,Se(v,n))),wire:()=>ji(g,v,b),onSelection:M=>{v.selected=M.length}}).dataChanged&&(y.some(M=>M.id===v.desk.focused)||(v.desk.focused=null),queueMicrotask(()=>{v.disposed||g.repaint()}),v.cellCache.clear(),Hs(z,y),T&&Ci(T))}})}function oo(o){return Math.hypot(o.b.x-o.a.x,o.b.y-o.a.y)}function no(o){return{x:(o.a.x+o.b.x)/2,y:(o.a.y+o.b.y)/2}}function Gi(o,e,t,s){const n=oo(e),a=oo(t),i=n>0&&a>0?a/n:1,r=Math.max(s.min,Math.min(s.max,o.scale*i)),c=no(e),l=no(t),d=(c.x-o.x)/o.scale,u=(c.y-o.y)/o.scale;return{scale:r,x:l.x-d*r,y:l.y-u*r}}function Xi(o,e){const t=o.ownerDocument.defaultView,s=new AbortController,n=new Map,a=o.style.touchAction;o.style.touchAction="none";let i=!1,r=0;const c=u=>{const h=o.getBoundingClientRect();return{x:u.clientX-h.left,y:u.clientY-h.top}},l={capture:!0,passive:!1,signal:s.signal};t.addEventListener("pointerdown",u=>{u.pointerType!=="touch"||!u.composedPath().includes(o)||(n.set(u.pointerId,c(u)),n.size>=2&&(u.preventDefault(),i||(i=!0,e.start())))},l),t.addEventListener("pointermove",u=>{if(!n.has(u.pointerId))return;if(!i){n.set(u.pointerId,c(u));return}const[h,p]=n.values();if(n.set(u.pointerId,c(u)),u.preventDefault(),p){const[m,_]=n.values();e.write(Gi(e.read(),{a:h,b:p},{a:m,b:_},e.bounds))}},l);const d=u=>{n.delete(u.pointerId)&&i&&(u.preventDefault(),n.size||(i=!1,r=performance.now()+300,e.end()))};return t.addEventListener("pointerup",d,l),t.addEventListener("pointercancel",d,l),t.addEventListener("lostpointercapture",d,l),t.addEventListener("click",u=>{u.detail>0&&(i||performance.now()<r)&&u.composedPath().includes(o)&&(u.preventDefault(),u.stopImmediatePropagation())},l),{active:()=>i,dispose:()=>{s.abort(),n.clear(),i&&e.end(),i=!1,o.style.touchAction=a}}}const io="__openStationSharedStores";function Yi(){const o=window;let e=o[io];return e||(e=new Map,o[io]=e),e}function Zi(o,e){const t=Yi();let s=t.get(o);s||(s={state:e(),listeners:new Set,rebuild:e},t.set(o,s));const n={get state(){return s.state},set state(a){s.state=a},getState(){return s.state},notify(){for(const a of Array.from(s.listeners))try{a(s.state)}catch(i){console.error(`[desktop-mode/shared-store:${o}] subscriber threw:`,i)}},subscribe(a){return s.listeners.add(a),()=>{s.listeners.delete(a)}},setState(a){const i=s.state;if(typeof i!="object"||i===null){console.warn(`[desktop-mode/shared-store:${o}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(i,a),n.notify()},reset(){const a=s.rebuild(),i=s.state;if(typeof i=="object"&&i!==null&&typeof a=="object"&&a!==null){const r=i;for(const c of Object.keys(r))delete r[c];Object.assign(r,a)}else s.state=a;s.listeners.clear()}};return n}const ao=Object.freeze({top:0,right:0,bottom:0,left:0});function Ji(o,e,t,s){return{left:o,top:e,width:t,height:s,right:o+t,bottom:e+s}}function Qi(o,e){const t=n=>Math.min(Math.max(0,e.width),Math.max(0,n)),s=n=>Math.min(Math.max(0,e.height),Math.max(0,n));return{top:s(o.top-e.top),bottom:s(e.bottom-o.bottom),left:t(o.left-e.left),right:t(e.right-o.right)}}const ea="os/work-area";function ta(){return{insets:{...ao},rect:{x:0,y:0,width:0,height:0},viewport:{x:0,y:0,width:0,height:0},area:{width:0,height:0}}}const sa=Zi(ea,()=>({snapshot:ta(),installed:!1,areaEl:null}));function oa(o){const{installed:e,snapshot:t}=sa.state;if(!e)return{...ao};const s=t.viewport;return Qi(Ji(s.x,s.y,s.width,s.height),o.getBoundingClientRect())}const nt=170,na=()=>({pixiInteractionAt:0,pinchUntil:0,lastFocusChange:0,panMovedDist:0,panActive:!1,panStart:null}),ne=o=>performance.now()<o.pinchUntil;function ve(o,e){e.stopPropagation?.(),o.pixiInteractionAt=performance.now()}function ro(o,e){return!o||!e?.global?1/0:Math.hypot(e.global.x-o.x,e.global.y-o.y)}function ia(o,e,t){const s=performance.now();return ne(o)||s-o.lastFocusChange<250||s-o.pixiInteractionAt<250||o.panMovedDist>4?!1:e.target===t}function aa(o,e,t){const s={targetScale:o.scale.x,targetWorldX:o.x,targetWorldY:o.y,ease(){const r=s.targetScale-o.scale.x,c=s.targetWorldX-o.x,l=s.targetWorldY-o.y;(Math.abs(r)>5e-4||Math.abs(c)>.5||Math.abs(l)>.5)&&(o.scale.set(o.scale.x+r*.22),o.x+=c*.22,o.y+=l*.22)},stageToWorld(i){return{x:(i.x-o.x)/o.scale.x,y:(i.y-o.y)/o.scale.y}},pan(i,r){o.x+=i,o.y+=r,s.targetWorldX+=i,s.targetWorldY+=r},fitToView(i,r={}){const c=r.padding??90,l=r.animate??!1,d=e.getBoundingClientRect(),u=oa(e),h=u.left,p=u.top,m=Math.max(0,d.width-u.left-u.right),_=Math.max(0,d.height-u.top-u.bottom);if(!i||m===0||_===0){const M=h+m/2,R=p+_/2;s.targetScale=1,s.targetWorldX=M,s.targetWorldY=R,l||(o.x=M,o.y=R,o.scale.set(1));return}const g=Math.max(1,i.maxX-i.minX),b=Math.max(1,i.maxY-i.minY),v=(m-c*2)/g,S=(_-c*2)/b,T=Math.max(.2,Math.min(1.5,Math.min(v,S))),z=(i.minX+i.maxX)/2,P=(i.minY+i.maxY)/2,y=h+m/2-z*T,E=p+_/2-P*T;s.targetScale=T,s.targetWorldX=y,s.targetWorldY=E,l||(o.scale.set(T),o.x=y,o.y=E)},frameOn(i,r){const c=e.getBoundingClientRect();if(c.width<=0||c.height<=0)return!1;const l=nt+70,d=c.width*.85/(2*l),u=c.height*.85/(2*l),h=Math.max(.5,Math.min(1.6,Math.min(d,u)));return s.targetScale=h,s.targetWorldX=c.width/2-i*h,s.targetWorldY=c.height/2-r*h,!0},dispose(){e.removeEventListener("wheel",n),a.dispose()}};function n(i){i.preventDefault();const c=Math.exp(-i.deltaY*8e-4),l=s.targetScale,d=Math.max(.3,Math.min(2.5,l*c));if(Math.abs(d-l)<5e-4)return;const u=e.getBoundingClientRect(),h=i.clientX-u.left,p=i.clientY-u.top,m=(h-s.targetWorldX)/l,_=(p-s.targetWorldY)/l;s.targetScale=d,s.targetWorldX=h-m*d,s.targetWorldY=p-_*d}const a=Xi(e,{read:()=>({x:o.x,y:o.y,scale:o.scale.x}),write:i=>{o.scale.set(i.scale),o.x=i.x,o.y=i.y,s.targetScale=i.scale,s.targetWorldX=i.x,s.targetWorldY=i.y},bounds:{min:.2,max:2.5},start:()=>t?.start(),end:()=>t?.end()});return e.addEventListener("wheel",n,{passive:!1}),s}function ra(o,e,t,s){let n=!1,a=0,i=0;const r=24,c=80;let l=null;const d=()=>{const h=t.getBoundingClientRect();e.renderer.resize(h.width,h.height),e.stage.hitArea=new o.Rectangle(0,0,h.width,h.height),!n&&h.width>0&&h.height>0&&(n=!0,a=h.width,i=h.height,s.onFirstFit(),t.classList.remove("is-loading")),l!==null&&window.clearTimeout(l),l=window.setTimeout(()=>{l=null;const p=t.getBoundingClientRect();(Math.abs(p.width-a)>=r||Math.abs(p.height-i)>=r)&&(a=p.width,i=p.height,s.onSettle())},c),e.render(),s.onResize?.()},u=new ResizeObserver(d);return u.observe(t),()=>{u.disconnect(),l!==null&&window.clearTimeout(l)}}const Ee='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',Ae=4;function Te(o,e){return o.length>e?o.slice(0,e-1)+"…":o}async function la(o,e){const t=window.wp?.os;if(!t||typeof t.loadModules!="function")return o.textContent=`${e} ${f("Shell modules API missing.")}`,null;try{await t.loadModules(["pixijs"])}catch{return o.textContent=e,null}const s=window.PIXI;return s||(o.textContent=e),s??null}async function ca(o,e,t){const s=new o.Application;await s.init({resizeTo:e,backgroundAlpha:0,antialias:!0,autoDensity:!0,resolution:Math.min(window.devicePixelRatio||1,2)}),e.appendChild(s.canvas),s.canvas.classList.add(t);const n=new o.Container;return n.x=e.clientWidth/2,n.y=e.clientHeight/2,s.stage.addChild(n),s.stage.eventMode="static",s.stage.hitArea=new o.Rectangle(0,0,e.clientWidth,e.clientHeight),{app:s,world:n}}function da(o,e,t){try{o.ticker?.stop()}catch{}try{o.destroy({removeView:!0},{children:!0})}catch{}e.replaceChildren(),e.classList.remove(...t)}function it(o=document.body){try{const e=getComputedStyle(o),t=e.getPropertyValue("--os-ui-accent").trim()||e.getPropertyValue("--wp-admin-theme-color").trim();if(!t)return 210;const s=document.createElement("span");s.style.color=t,o.appendChild(s);const n=getComputedStyle(s).color;s.remove();const a=n.match(/\d+/g);return!a||a.length<3?210:ua(parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10))}catch{return 210}}function ua(o,e,t){const s=o/255,n=e/255,a=t/255,i=Math.max(s,n,a),r=Math.min(s,n,a),c=i-r;if(c===0)return 210;let l;switch(i){case s:l=(n-a)/c+(n<a?6:0);break;case n:l=(a-s)/c+2;break;default:l=(s-n)/c+4;break}return Math.round(l*60)}function lo(o,e,t){const s=e/100,n=t/100,a=(1-Math.abs(2*n-1))*s,i=o/60,r=a*(1-Math.abs(i%2-1));let c=0,l=0,d=0;i<1?(c=a,l=r):i<2?(c=r,l=a):i<3?(l=a,d=r):i<4?(l=r,d=a):i<5?(c=r,d=a):(c=a,d=r);const u=n-a/2;return Math.round((c+u)*255)*65536+Math.round((l+u)*255)*256+Math.round((d+u)*255)}function pa(o,e){const t=Math.floor(o/65536)%256,s=Math.floor(o/256)%256,n=o%256,a=i=>Math.round(i*(1+e));return a(t)*65536+a(s)*256+a(n)}function co(o){return`#${o.toString(16).padStart(6,"0")}`}function ha(o){const e=document.createElement("div");return e.innerHTML=o,e.textContent||e.innerText||""}const fa=F` .os-term-canvas__intro{padding:22px 24px 18px;background:var( --os-ui-surface,#fff );flex-shrink:0}.os-term-canvas__intro h2{font-size:28px;font-weight:500;letter-spacing:-0.035em;margin:0 0 6px;color:var( --os-ui-fg,#1d2327 )}.os-term-canvas__intro p{font-size:12px;margin:0;color:var( --os-ui-fg-muted,#646970 )}.os-term-directory{position:absolute;inset-block:12px;inset-inline-start:12px;inline-size:min( 300px,calc( 100% - 24px ) );z-index:5;box-sizing:border-box;display:flex;flex-direction:column;gap:10px;padding:16px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:12px;background:var( --os-ui-surface,#fff );color:var( --os-ui-fg,#1d2327 );box-shadow:var( --os-ui-shadow-sheet,0 6px 24px rgba( 0,0,0,0.12 ) )}.os-term-directory header{display:flex;align-items:center;justify-content:space-between}.os-term-directory h3{font-size:17px;margin:0;color:inherit}.os-term-directory__count{font-size:11px;margin:0;color:var( --os-ui-fg-muted,#646970 )}.os-term-directory__items{overflow:auto;min-block-size:0;flex:1;display:flex;flex-direction:column;gap:4px}.os-term-directory__items os-button{flex-shrink:0}.os-term-directory__items os-button::part( button ){inline-size:100%;justify-content:space-between;text-align:start;white-space:normal}.os-term-directory__items small{color:var( --os-ui-fg-muted,#646970 );white-space:nowrap;font-size:10px}@container content-desk (max-width:540px){.os-term-canvas__intro{padding:14px}.os-term-canvas__intro h2{font-size:23px}.os-term-canvas__intro p{display:none}}.os-term-canvas__toolbar{flex-wrap:wrap;padding:12px 20px}.os-term-canvas__toolbar>button,.os-term-directory__toggle{flex-shrink:0;white-space:nowrap}.os-term-canvas__toolbar .os-term-canvas__hint{flex-basis:100%;font-size:11px}.os-term-canvas__search-input{border-radius:8px;border:1px solid var( --os-ui-border,#dcdcde );padding:8px 10px;background:var( --os-ui-surface,#fff );color:var( --os-ui-fg,#1d2327 )}`,B="os-term-canvas";function Wt(o,e){const t=document.createElement("button");return t.type="button",t.className=`${B}__btn${o?` ${B}__btn--${o}`:""}`,t.textContent=e,t}function ga(o,e,t){o.replaceChildren(),o.classList.add(B,e);const s=document.createElement("style");s.textContent=fa.cssText,o.appendChild(s);const n=document.createElement("header");n.className="os-term-canvas__intro";const a=document.createElement("h2");a.textContent=f(e==="os-mindmap"?"Give your ideas a home.":"Find the threads.");const i=document.createElement("p");i.textContent=f(e==="os-mindmap"?"Build branches for your stories. Choose a category to explore its posts.":"See what connects your stories. Choose a tag to follow the conversation."),n.append(a,i),o.appendChild(n);const r=document.createElement("div");r.className=`${B}__toolbar`;const c=t.buttons.map(g=>{const b=Wt(g.variant??"",""),v=document.createElement("span");return v.className=`dashicons ${g.icon}`,v.setAttribute("aria-hidden","true"),b.replaceChildren(v,document.createTextNode(g.label)),g.title&&(b.title=g.title),r.appendChild(b),b}),l=document.createElement("div");l.className=`${B}__search`;const d=document.createElement("input");d.type="search",d.className=`${B}__search-input`,d.placeholder=t.searchPlaceholder,d.setAttribute("aria-label",t.searchAria),l.appendChild(d);const u=document.createElement("ul");u.className=`${B}__search-results`,u.hidden=!0,l.appendChild(u);const h=document.createElement("span");h.className=`${B}__hint`,h.textContent=t.hint,r.appendChild(l),r.appendChild(h),o.appendChild(r);const p=document.createElement("div");p.className=`${B}__layout`,o.appendChild(p);const m=document.createElement("div");m.className=`${B}__stage is-loading`,p.appendChild(m);const _=document.createElement("aside");return _.className=`${B}__sidebar`,p.appendChild(_),{toolbar:r,stage:m,sidebar:_,buttons:c,searchWrap:l,searchInput:d,searchResults:u}}function ma(o,e){const{searchInput:t,searchResults:s,searchWrap:n}=o;let a=[],i=0;const r=()=>{s.querySelectorAll(`.${B}__search-result`).forEach((m,_)=>{const g=_===i;m.classList.toggle("is-active",g),g&&m.scrollIntoView({block:"nearest"})})},c=()=>{t.value="",s.hidden=!0,s.replaceChildren(),a=[],i=0},l=m=>{c(),e.select(m)},d=()=>{const m=t.value.trim().toLowerCase();if(m.length===0){s.hidden=!0,s.replaceChildren(),a=[],i=0;return}a=e.matches(m).sort((_,g)=>g.count-_.count).slice(0,10),i=0,s.replaceChildren(),a.forEach((_,g)=>{const b=document.createElement("li"),v=document.createElement("button");v.type="button",v.className=`${B}__search-result`,g===0&&v.classList.add("is-active");const S=document.createElement("span");S.className=`${B}__search-title`,S.textContent=_.name||`#${_.id}`;const T=document.createElement("span");T.className=`${B}__search-meta`,T.textContent=W(de("%d post","%d posts",_.count),_.count),v.appendChild(S),v.appendChild(T),v.addEventListener("mousedown",z=>{z.preventDefault(),l(_)}),v.addEventListener("mouseenter",()=>{i=g,r()}),b.appendChild(v),s.appendChild(b)}),s.hidden=a.length===0},u=m=>{if(m.key==="ArrowDown"||m.key==="ArrowUp"||m.key==="Enter"){if(a.length===0)return;m.preventDefault(),m.key==="ArrowDown"?(i=Math.min(i+1,a.length-1),r()):m.key==="ArrowUp"?(i=Math.max(i-1,0),r()):l(a[i])}else m.key==="Escape"&&c()},h=()=>{setTimeout(()=>{s.hidden=!0},120)},p=m=>{n.contains(m.target)||(s.hidden=!0)};return t.addEventListener("input",d),t.addEventListener("focus",d),t.addEventListener("keydown",u),t.addEventListener("blur",h),document.addEventListener("click",p),()=>{t.removeEventListener("input",d),t.removeEventListener("focus",d),t.removeEventListener("keydown",u),t.removeEventListener("blur",h),document.removeEventListener("click",p)}}const ba=F` ${_e} ${Ss} ${Es} ${As} ${Ts} ${Is}: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-accent-ink,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 )}}`,je=class je extends X{static get observedAttributes(){return[...super.observedAttributes,"aria-label"]}render(){const e=this.disabled!==null,t=this.busy!==null,s=this.type||"button",n=this.getAttribute("aria-label")||"";return C`
634 635 <button
635 636 part="button"
636 637 class="os-holo-edge os-holo-sheen"
637 638 type=${s}
@@ -636,10 +637,11 @@
636 637 class="os-holo-edge os-holo-sheen"
637 638 type=${s}
638 639 ?disabled=${e||t}
639 640 aria-busy=${t?"true":"false"}
641 + aria-label=${n}
640 642 >
641 - ${t?k`<span class="os-button__spinner" aria-hidden="true"></span>`:""}
643 + ${t?C`<span class="os-button__spinner" aria-hidden="true"></span>`:""}
642 644 <slot></slot>
643 645 <!--
644 646 The two motion layers. Elements rather than
645 647 pseudo-elements because the sheen and the hairline
@@ -649,38 +651,38 @@
649 651 -->
650 652 <span class="os-holo-glint" aria-hidden="true"></span>
651 653 <span class="os-holo-ring" aria-hidden="true"></span>
652 654 </button>
653 - `}};je.props=["variant","disabled","type","busy","fill-cell"],je.styles=[ta],je.help=void 0;let Wt=je;Q("os-button",Wt);const sa=H` ${_e} ${Cs}:host{--_field-size:var( --os-ui-field-font-size,13px );--_field-radius:var( --os-ui-field-radius,6px );display:flex;flex-direction:column;gap:4px;font-size:var( --_field-size );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__label--hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;white-space:nowrap;clip-path:inset( 50% )}.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:var( --_field-radius );font:inherit;font-size:var( --_field-size );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__row--has-clear input{padding-inline-end:36px}.os-text-field__row--has-reveal.os-text-field__row--has-clear input{padding-inline-end:68px}.os-text-field__clear{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}.os-text-field__row--has-reveal .os-text-field__clear{inset-inline-end:34px;border-radius:0}.os-text-field__clear:hover{color:var( --os-ui-accent,#2271b1 )}.os-text-field__clear:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.os-text-field__clear:disabled{opacity:0.45;cursor:default}.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}`,Ke=class Ke extends X{constructor(){super(...arguments),this._revealed=!1}connectedCallback(){super.connectedCallback(),ft(this)}render(){const e=this.label||"",t=this.hideLabel!==null,s=this.value??"",n=this.placeholder||"",a=this.disabled!==null,i=this.readonly!==null,r=this.autocomplete,c=this.type||"text",l=c==="password";let u=r||"off";l&&(!r||u==="off")&&(u="new-password");const d=this.maxlength,h=this.minlength,p=this.pattern||"",g=this.name||"",m=this.suffix||"",b=this.invalid!==null,w=this.reveal!==null,$=this.clearable!==null,M=c==="password",R=M&&!(w&&this._revealed);let O;M||w&&this._revealed?O="text":O=c;const I=["os-text-field__row",w?"os-text-field__row--has-reveal":"",$?"os-text-field__row--has-clear":""].filter(Boolean).join(" "),x=R?"os-text-field__input os-text-field__input--masked":"os-text-field__input",P=`${this.id||"os-unnamed"}__input`;return k`
654 - ${e?k`<label
655 + `}};je.props=["variant","disabled","type","busy","fill-cell"],je.styles=[ba],je.help=void 0;let Vt=je;Q("os-button",Vt);const _a=F` ${_e} ${Ms}:host{--_field-size:var( --os-ui-field-font-size,13px );--_field-radius:var( --os-ui-field-radius,6px );display:flex;flex-direction:column;gap:4px;font-size:var( --_field-size );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__label--hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;white-space:nowrap;clip-path:inset( 50% )}.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:var( --_field-radius );font:inherit;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 )}input:is( [ type='date' ],[ type='datetime-local' ],[ type='month' ],[ type='week' ] )::-webkit-calendar-picker-indicator{--_calendar-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath d='M4.75 7.25L4.75 18C4.75 18.6904 5.30964 19.25 6 19.25H18C18.6904 19.25 19.25 18.6904 19.25 18V7.25V6C19.25 5.30964 18.6904 4.75 18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V7.25ZM19.25 7.25H4.75M7.25 10.75H9.25M11 10.75H13M14.75 10.75H16.75M7.25 14.5H9.25M11 14.5H13M14.75 14.5H16.75' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V7.25H19.25V6C19.25 5.30964 18.6904 4.75 18 4.75Z' fill='currentColor' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");background:var( --os-ui-fg-muted,#646970 );-webkit-mask:var( --_calendar-icon ) center / contain no-repeat;mask:var( --_calendar-icon ) center / contain no-repeat;width:16px;height:16px;cursor:pointer}@media ( forced-colors:active ){input:is( [ type='date' ],[ type='datetime-local' ],[ type='month' ],[ type='week' ] )::-webkit-calendar-picker-indicator{background:ButtonText;forced-color-adjust:none}}.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}:host( [ clearable ] ) input::-webkit-search-cancel-button{-webkit-appearance:none;display:none}.os-text-field__row--has-clear input{padding-inline-end:36px}.os-text-field__row--has-reveal.os-text-field__row--has-clear input{padding-inline-end:68px}.os-text-field__clear{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}.os-text-field__row--has-reveal .os-text-field__clear{inset-inline-end:34px;border-radius:0}.os-text-field__clear:hover{color:var( --os-ui-accent,#2271b1 )}.os-text-field__clear:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.os-text-field__clear:disabled{opacity:0.45;cursor:default}.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}`,Ke=class Ke extends X{constructor(){super(...arguments),this._revealed=!1}connectedCallback(){super.connectedCallback(),gt(this)}render(){const e=this.label||"",t=this.hideLabel!==null,s=this.value??"",n=this.placeholder||"",a=this.disabled!==null,i=this.readonly!==null,r=this.autocomplete,c=this.type||"text",l=c==="password";let d=r||"off";l&&(!r||d==="off")&&(d="new-password");const u=this.maxlength,h=this.minlength,p=this.pattern||"",m=this.name||"",_=this.suffix||"",g=this.invalid!==null,b=this.reveal!==null,v=this.clearable!==null,S=c==="password",T=S&&!(b&&this._revealed);let z;S||b&&this._revealed?z="text":z=c;const P=["os-text-field__row",b?"os-text-field__row--has-reveal":"",v?"os-text-field__row--has-clear":""].filter(Boolean).join(" "),y=T?"os-text-field__input os-text-field__input--masked":"os-text-field__input",M=`${this.id||"os-unnamed"}__input`;return C`
656 + ${e?C`<label
655 657 class=${t?"os-text-field__label os-text-field__label--hidden":"os-text-field__label"}
656 - for=${P}
657 - >${e}</label>`:k``}
658 - <span class=${I}>
658 + for=${M}
659 + >${e}</label>`:C``}
660 + <span class=${P}>
659 661 <input
660 - id=${P}
661 - class=${x}
662 - type=${O}
662 + id=${M}
663 + class=${y}
664 + type=${z}
663 665 .value=${s}
664 666 placeholder=${n}
665 667 ?disabled=${a}
666 668 ?readonly=${i}
667 - autocomplete=${u}
668 - maxlength=${d??""}
669 + autocomplete=${d}
670 + maxlength=${u??""}
669 671 minlength=${h??""}
670 672 pattern=${p}
671 - name=${g}
672 - aria-invalid=${b?"true":"false"}
673 + name=${m}
674 + aria-invalid=${g?"true":"false"}
673 675 aria-label=${e||""}
674 - @input=${N=>this._onInput(N)}
675 - @change=${N=>this._onChange(N)}
676 - @keydown=${N=>this._onKeyDown(N)}
676 + @input=${R=>this._onInput(R)}
677 + @change=${R=>this._onChange(R)}
678 + @keydown=${R=>this._onKeyDown(R)}
677 679 />
678 - ${m?k`<span class="os-text-field__suffix">${m}</span>`:k``}
679 - ${$&&s!==""?this._renderClearButton(a):k``}
680 - ${w?this._renderRevealButton(a):k``}
680 + ${_?C`<span class="os-text-field__suffix">${_}</span>`:C``}
681 + ${v&&s!==""?this._renderClearButton(a):C``}
682 + ${b?this._renderRevealButton(a):C``}
681 683 </span>
682 - `}_renderClearButton(e){return k`
684 + `}_renderClearButton(e){return C`
683 685 <button
684 686 type="button"
685 687 class="os-text-field__clear"
686 688 aria-label="Clear"
@@ -687,11 +689,11 @@
687 689 ?disabled=${e}
688 690 tabindex="0"
689 691 @click=${()=>this._onClear()}
690 692 >
691 - ${oa()}
693 + ${va()}
692 694 </button>
693 - `}_onClear(){this.value="",this.emit("os-input-change",{value:""}),this.emit("os-input-commit",{value:""}),this.shadowRoot?.querySelector("input")?.focus()}_renderRevealButton(e){const t=this._revealed?"Hide":"Show";return k`
695 + `}_onClear(){this.value="",this.emit("os-input-change",{value:""}),this.emit("os-input-commit",{value:""}),this.shadowRoot?.querySelector("input")?.focus()}_renderRevealButton(e){const t=this._revealed?"Hide":"Show";return C`
694 696 <button
695 697 type="button"
696 698 class="os-text-field__reveal"
697 699 aria-label=${t}
@@ -699,11 +701,11 @@
699 701 ?disabled=${e}
700 702 tabindex="0"
701 703 @click=${()=>this._onToggleReveal()}
702 704 >
703 - ${this._revealed?ia():na()}
705 + ${this._revealed?xa():ya()}
704 706 </button>
705 - `}_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})}}};Ke.props=["label","hideLabel","value","placeholder","disabled","readonly","autocomplete","type","maxlength","minlength","pattern","name","suffix","invalid","reveal","clearable"],Ke.styles=[sa],Ke.help=void 0;let Vt=Ke;Q("os-text-field",Vt);function oa(){return k`
707 + `}_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})}}};Ke.props=["label","hideLabel","value","placeholder","disabled","readonly","autocomplete","type","maxlength","minlength","pattern","name","suffix","invalid","reveal","clearable"],Ke.styles=[_a],Ke.help=void 0;let Bt=Ke;Q("os-text-field",Bt);function va(){return C`
706 708 <svg
707 709 viewBox="0 0 16 16"
708 710 width="14"
709 711 height="14"
@@ -715,9 +717,9 @@
715 717 focusable="false"
716 718 >
717 719 <path d="M4 4l8 8M12 4l-8 8" />
718 720 </svg>
719 - `}function na(){return k`
721 + `}function ya(){return C`
720 722 <svg
721 723 viewBox="0 0 16 16"
722 724 width="14"
723 725 height="14"
@@ -731,9 +733,9 @@
731 733 >
732 734 <path d="M1 8C1 8 3.5 3 8 3s7 5 7 5-2.5 5-7 5S1 8 1 8z" />
733 735 <circle cx="8" cy="8" r="2" />
734 736 </svg>
735 - `}function ia(){return k`
737 + `}function xa(){return C`
736 738 <svg
737 739 viewBox="0 0 16 16"
738 740 width="14"
739 741 height="14"
@@ -748,20 +750,20 @@
748 750 <path d="M1 8C1 8 3.5 3 8 3s7 5 7 5-2.5 5-7 5S1 8 1 8z" />
749 751 <circle cx="8" cy="8" r="2" />
750 752 <line x1="2" y1="2" x2="14" y2="14" />
751 753 </svg>
752 - `}function aa(o,e,t){const s=e.trim().toLocaleLowerCase();return o.filter(n=>(!t||n.count===0)&&pe(n.name).toLocaleLowerCase().includes(s)).sort((n,a)=>pe(n.name).localeCompare(pe(a.name)))}function ra(o,e,t){const s=document.createElement("os-button");s.setAttribute("variant","secondary"),s.textContent=f("Browse topics"),s.className="os-term-directory__toggle",o.toolbar.insertBefore(s,o.searchWrap);const n=document.createElement("section");n.className="os-term-directory",n.setAttribute("aria-label",f("Topic directory")),n.hidden=!0,o.stage.appendChild(n);let a="",i=!1,r=50;const c=()=>s.shadowRoot?.querySelector("button")?.focus(),l=()=>{n.hidden=!0,s.setAttribute("aria-expanded","false"),s.shadowRoot?.querySelector("button")?.setAttribute("aria-expanded","false"),c()},u=()=>{const p=e(),g=aa(p,a,i);ke(k`<header><h3>${f("Your topics")}</h3><os-button variant="ghost" @click=${l}>${f("Close")}</os-button></header>
754 + `}function ka(o,e,t){const s=e.trim().toLocaleLowerCase();return o.filter(n=>(!t||n.count===0)&&pe(n.name).toLocaleLowerCase().includes(s)).sort((n,a)=>pe(n.name).localeCompare(pe(a.name)))}function wa(o,e,t){const s=document.createElement("os-button");s.setAttribute("variant","secondary"),s.textContent=f("Browse topics"),s.className="os-term-directory__toggle",o.toolbar.insertBefore(s,o.searchWrap);const n=document.createElement("section");n.className="os-term-directory",n.setAttribute("aria-label",f("Topic directory")),n.hidden=!0,o.stage.appendChild(n);let a="",i=!1,r=50;const c=()=>s.shadowRoot?.querySelector("button")?.focus(),l=()=>{n.hidden=!0,s.setAttribute("aria-expanded","false"),s.shadowRoot?.querySelector("button")?.setAttribute("aria-expanded","false"),c()},d=()=>{const p=e(),m=ka(p,a,i);ke(C`<header><h3>${f("Your topics")}</h3><os-button variant="ghost" @click=${l}>${f("Close")}</os-button></header>
753 755 <os-text-field label=${f("Find a topic")} value=${a} placeholder=${f("Find a topic…")}
754 - @os-input-change=${m=>{a=m.detail.value,r=50,u()}}></os-text-field>
756 + @os-input-change=${_=>{a=_.detail.value,r=50,d()}}></os-text-field>
755 757 <os-select label=${f("Show topics")} value=${i?"unused":"all"}
756 - @os-pick=${m=>{i=m.detail.value==="unused",r=50,u()}}>
758 + @os-pick=${_=>{i=_.detail.value==="unused",r=50,d()}}>
757 759 <os-option value="all">${f("All topics")}</os-option><os-option value="unused">${f("No posts yet")}</os-option>
758 760 </os-select>
759 - <p class="os-term-directory__count" role="status">${V(de("%d topic","%d topics",g.length),g.length)}</p>
760 - <div class="os-term-directory__items">${g.slice(0,r).map(m=>k`<os-button variant="ghost" data-topic-id=${m.id} @click=${()=>{l(),t(m.id)}}><span>${pe(m.name)}</span><small>${V(de("%d post","%d posts",m.count),m.count)}</small></os-button>`)}
761 - ${g.length===0?k`<p>${f("No matching topics. Try another search or filter.")}</p>`:""}
762 - ${g.length>r?k`<os-button variant="secondary" @click=${()=>{r+=50,u()}}>${f("Show more")}</os-button>`:""}
763 - </div>`,n)},d=()=>{if(!n.hidden){l();return}u(),n.hidden=!1,s.setAttribute("aria-expanded","true"),s.shadowRoot?.querySelector("button")?.setAttribute("aria-expanded","true"),queueMicrotask(()=>n.querySelector("os-text-field")?.shadowRoot?.querySelector("input")?.focus())},h=p=>{p.key==="Escape"&&(p.stopPropagation(),l())};return s.addEventListener("click",d),n.addEventListener("keydown",h),()=>{s.removeEventListener("click",d),n.removeEventListener("keydown",h),s.remove(),n.remove()}}function it(o){const e=ye(o,"--os-ui-surface","#ffffff",16777215);return{surface:e,raised:ye(o,"--os-ui-surface-elevated","#ffffff",e),fg:ye(o,"--os-ui-fg","#1d2327",e),muted:ye(o,"--os-ui-fg-muted","#50575e",e),faint:ye(o,"--os-ui-fg-faint","#b0b3b8",e),border:ye(o,"--os-ui-border","#dcdcde",e),accent:ye(o,"--os-ui-accent","#2271b1",e)}}function ye(o,e,t,s=16777215){const n=document.createElement("span");n.hidden=!0,n.style.color=`var(${e}, ${t})`,o.append(n);const a=getComputedStyle(n).color;n.remove();const i=a.match(/[\d.]+/g)?.map(Number);if(!i||i.length<3)return parseInt(t.slice(1),16);const r=i[3]??1,c=a.startsWith("color(srgb");return[16,8,0].reduce((l,u,d)=>{const h=i[d]*(c?255:1),p=Math.floor(s/2**u)%256;return l+Math.round(h*r+p*(1-r))*2**u},0)}function la(o,e,t){let s=JSON.stringify([it(o),t?.()]);const n=()=>{const i=JSON.stringify([it(o),t?.()]);i!==s&&(s=i,e())},a=new MutationObserver(n);for(let i=o;i;i=i.parentElement)a.observe(i,{attributes:!0,attributeFilter:["style","class"]});return document.addEventListener("os-desktop-theme-changed",n),()=>{a.disconnect(),document.removeEventListener("os-desktop-theme-changed",n)}}function so(o,e){const t=a=>[16,8,0].reduce((i,r,c)=>{const l=Math.floor(a/2**r)%256/255;return i+(l<=.04045?l/12.92:((l+.055)/1.055)**2.4)*[.2126,.7152,.0722][c]},0),s=t(o),n=a=>{const i=t(a);return(Math.max(i,s)+.05)/(Math.min(i,s)+.05)};return n(e.fg)>=n(e.surface)?e.fg:e.surface}const ca=10,da=22,ua=6e4;function pa(o){const{pixi:e,postLayer:t,postChipLayer:s,postEdgeGfx:n,interaction:a,env:i,palette:r}=o,c=new Map,l=new Map,u=new Map;let d=0;const h=new e.Container;h.eventMode="passive",h.visible=!1,t.addChild(h);const p=new e.Graphics,g=new e.Graphics,m=new e.Text({text:"1 / 1",style:{fill:r.muted,fontSize:o.pagerLabelSize,fontFamily:Ee,fontWeight:"600"},...o.pagerTextRes?{resolution:o.pagerTextRes}:{}});m.anchor.set(.5);for(const x of[p,g])x.eventMode="static",x.cursor="pointer",x.hitArea=new e.Circle(0,0,16),x.on("pointerdown",E=>ve(a,E));h.addChild(p),h.addChild(m),h.addChild(g),p.on("pointertap",x=>{ne(a)||(ve(a,x),a.lastFocusChange=performance.now(),I.focusPage>1&&(I.focusPage--,I.load()))}),g.on("pointertap",x=>{ne(a)||(ve(a,x),a.lastFocusChange=performance.now(),I.focusPage<I.focusTotalPages&&(I.focusPage++,I.load()))});function b(x,E,P){x.clear(),x.circle(0,0,14),x.fill({color:P?r.surface:r.raised,alpha:P?.7:1}),x.stroke({color:r.border,width:1,alpha:1});const N=x.children?.[0]??null;if(N)N.text=E,N.style.fill=P?r.faint:r.muted;else{const F=new e.Text({text:E,style:{fill:P?r.faint:r.muted,fontSize:o.pagerGlyphSize,fontFamily:Ee,fontWeight:"600"},...o.pagerTextRes?{resolution:o.pagerTextRes}:{}});F.anchor.set(.5),x.addChild(F)}}function w(){const x=I.focusId===null?null:o.getCenter(I.focusId);if(!x||I.focusTotalPages<=1){h.visible=!1;return}h.visible=!0;const E=I.focusPage<=1,P=I.focusPage>=I.focusTotalPages;b(p,"◀",E),b(g,"▶",P),p.cursor=E?"default":"pointer",g.cursor=P?"default":"pointer",m.text=`${I.focusPage} / ${I.focusTotalPages}`,p.x=-38,g.x=38,p.y=0,g.y=0,m.x=0,m.y=0,h.x=x.x,h.y=x.y+ot+60}function $(x,E){x.titleText.style.fill=r.fg;const P=Te(E.title,da);x.titleText.text!==P&&(x.titleText.text=P);const N=9,F=3,U=4,j=6,G=x.titleText.width,q=x.titleText.height,z=N+U*2+j+G+N,D=Math.max(q,U*2)+F*2,v=-z/2,_=-D/2;x.bg.clear(),x.bg.roundRect(v,_,z,D,D/2),x.cachedHover?(x.bg.fill({color:r.raised,alpha:1}),x.bg.stroke({color:E.tone,width:1.5,alpha:1})):(x.bg.fill({color:r.surface,alpha:1}),x.bg.stroke({color:r.border,width:1,alpha:1})),x.dot.clear(),x.dot.circle(v+N+U,0,U),x.dot.fill({color:E.tone,alpha:.85}),x.dot.stroke({color:r.border,width:1}),x.titleText.x=v+N+U*2+j,x.titleText.y=-q/2}function M(x){if(l.has(x.id))return;const E=new e.Container;E.eventMode="static",E.cursor="pointer",E.alpha=0;const P=new e.Graphics,N=new e.Graphics,F=new e.Text({text:x.title,style:{fill:r.fg,fontSize:o.chipFontSize,fontFamily:Ee,fontWeight:"500"},resolution:o.chipTextRes});E.addChild(P),E.addChild(N),E.addChild(F);const U={container:E,bg:P,dot:N,titleText:F,cachedHover:!1};l.set(x.id,U),s.addChild(E),E.on("pointerdown",j=>ve(a,j)),E.on("pointertap",()=>{ne(a)||(i.leaveFullscreen(),i.openUrl(x.editUrl,x.title,"dashicons-admin-post"),o.onOpenPost())}),E.on("pointerover",()=>{U.cachedHover=!0,$(U,x)}),E.on("pointerout",()=>{U.cachedHover=!1,$(U,x)}),$(U,x)}function R(x){I.clear();const E=I.focusId===null?null:o.getCenter(I.focusId);if(!E)return;const P=x.length,N=ot+Math.max(0,P-8)*6;x.forEach((F,U)=>{const j=2*Math.PI/Math.max(1,P)*U-Math.PI/2,G=new e.Graphics;t.addChild(G);const q={id:F.id,title:F.title,editUrl:F.editUrl,angle:j,r:N,x:E.x,y:E.y,tx:E.x+Math.cos(j)*N,ty:E.y+Math.sin(j)*N,gfx:G,tone:E.tone};c.set(F.id,q),M(q)}),w()}function O(x,E){I.focusTotalPages=x.totalPages,Number.isFinite(x.realTotal)&&x.realTotal>=0&&o.onCountReconciled(E,x.realTotal),R(x.items)}const I={repaintTheme(){const x=I.focusId===null?null:o.getCenter(I.focusId)?.tone;m.style.fill=r.muted,w();for(const E of c.values()){x!=null&&(E.tone=x);const P=l.get(E.id);P&&$(P,E)}},focusId:null,focusPage:1,focusTotalPages:1,async load(){if(I.focusId===null)return;const x=++d,E=I.focusId,P=`${E}:${I.focusPage}`,N=u.get(P);if(N&&performance.now()-N.fetchedAt<ua){O(N,E);return}try{const F=await i.client.fetchTermPosts(o.param,E,I.focusPage,ca);if(x!==d||I.focusId!==E)return;const U=i.extra.editPostUrlBase??"",j=U.includes("?")?"&":"?",G={items:F.items.map(q=>({id:q.id,title:Zi(q.title),editUrl:`${U}${j}post=${q.id}&action=edit`})),totalPages:F.totalPages,realTotal:F.total,fetchedAt:performance.now()};u.set(P,G),O(G,E)}catch(F){i.toast(f("Couldn’t load posts:"),F)}},clear(){for(const x of c.values())t.removeChild(x.gfx),x.gfx.destroy();c.clear();for(const x of l.values())s.removeChild(x.container),x.container.destroy({children:!0});l.clear(),n.clear(),h.visible=!1},invalidate(){d++},ease(){for(const x of c.values())x.x+=(x.tx-x.x)*.18,x.y+=(x.ty-x.y)*.18,x.gfx.x=x.x,x.gfx.y=x.y},drawEdges(){n.clear();const x=I.focusId===null?null:o.getCenter(I.focusId);if(x)for(const E of c.values())n.moveTo(x.x,x.y),n.lineTo(E.x,E.y),n.stroke({color:x.tone,width:1,alpha:.35})},syncChips(x){for(const E of c.values()){const P=l.get(E.id);P&&(P.container.x=E.x,P.container.y=E.y,P.container.scale.set(x),P.container.alpha<1&&(P.container.alpha=Math.min(1,P.container.alpha+.18)))}}};return I}const Bt=ot+130;async function oo(o,e,t){const s=await ji(o,t.unavailable);if(!s)return null;const n=s,a=Qi(o,t.modifier,t.chrome),{stage:i,sidebar:r}=a,{app:c,world:l}=await Ki(n,i,`${B}__canvas`),u={};for(const z of t.layers){const D=new n.Container;u[z]=D,l.addChild(D)}const d=new n.Graphics;u.postEdge.addChild(d);const h=it(i),p=Ui();let g=null;const m=Vi(l,i,{start:()=>{p.pinchUntil=1/0,p.panActive=!1,p.panStart=null,g?.cancelGesture()},end:()=>{p.pinchUntil=performance.now()+300}});let b=null,w=null,$=performance.now(),M=null,R=null,O=null,I=!1;const x=pa({palette:h,pixi:n,postLayer:u.post,postChipLayer:u.postChip,postEdgeGfx:d,env:e,param:t.taxonomy,interaction:p,...t.fan,getCenter:z=>g?.center(z)??null,onCountReconciled:(z,D)=>g?.countReconciled(z,D),onOpenPost:()=>q.closeFocus()}),P=la(i,()=>{Object.assign(h,it(i)),g?.themeChanged(),x.repaintTheme(),c.render()}),N=()=>document.hidden||i.clientWidth===0||i.clientHeight===0,F=()=>{if(w=null,I||!g||N())return;const z=performance.now(),D=Math.min(50,z-$);$=z,m.ease(),g.frame(D),w=requestAnimationFrame(F)},U=()=>{I||w!==null||!g||N()||($=performance.now(),w=requestAnimationFrame(F))},j=()=>U();c.stage.on("pointerdown",z=>{if(ne(p))return;const D=z;p.panActive=!0,p.panStart={x:D.global.x,y:D.global.y},p.panMovedDist=0}),c.stage.on("pointermove",z=>{if(ne(p))return;const D=z;if(!g?.pointerMove(D,m.stageToWorld(D.global))&&p.panActive&&p.panStart){const v=D.global.x-p.panStart.x,_=D.global.y-p.panStart.y;m.pan(v,_),p.panMovedDist+=Math.sqrt(v*v+_*_),p.panStart={x:D.global.x,y:D.global.y}}});const G=async z=>{ne(p)||await g?.pointerUp(z),p.panActive=!1,p.panStart=null};c.stage.on("pointerup",z=>void G(z)),c.stage.on("pointerupoutside",z=>void G(z)),c.canvas.addEventListener("click",z=>{Wi(p,z,c.canvas)&&!g?.dragging()&&x.focusId!==null&&q.closeFocus()});const q={palette:h,pixi:n,app:c,world:l,layers:u,postEdgeGfx:d,chrome:a,stage:i,sidebar:r,interaction:p,camera:m,fan:x,terms:[],nudge:null,async focusOn(z){if(x.focusId===z){q.closeFocus();return}const D=x.focusId!==null;x.focusId=z,x.focusPage=1,p.lastFocusChange=performance.now();const v=g?.center(z)??null;v&&(D||(b={scale:m.targetScale,x:m.targetWorldX,y:m.targetWorldY}),m.frameOn(v.x,v.y),q.nudge={x:v.x,y:v.y,radius:Bt},g?.focusOpened?.(v)),g?.focusChanged(),await x.load()},closeFocus(){x.focusId=null,p.lastFocusChange=performance.now(),x.invalidate(),q.nudge=null,g?.focusClosed?.(),b&&(m.targetScale=b.scale,m.targetWorldX=b.x,m.targetWorldY=b.y,b=null),x.clear(),g?.focusChanged()},recenter(){const z=x.focusId===null?null:g?.center(x.focusId)??null;z&&m.frameOn(z.x,z.y)||m.fitToView(g?.bounds()??null,{animate:!0})},syncEmptyHint(z){const D=i.querySelector(`.${B}__empty`);if(z&&!D){const v=document.createElement("div");v.className=`${B}__empty`,v.textContent=t.emptyHint,i.appendChild(v)}else!z&&D&&D.remove()},async refreshCounts(){if(q.terms.length!==0)try{const z=await e.client.fetchTermCounts(t.restTaxonomy,q.terms.map(v=>v.id));let D=!1;q.terms=q.terms.map(v=>{const _=z[String(v.id)];return typeof _=="number"&&_!==v.count?(D=!0,{...v,count:_}):v}),D&&!I&&g?.countsChanged()}catch{}},start(z){g=z,M=Bi(n,c,i,{onFirstFit:()=>m.fitToView(z.bounds()),onSettle:()=>q.recenter(),onResize:U}),document.addEventListener("visibilitychange",j),R=ra(a,()=>q.terms,D=>void q.focusOn(D)),O=ea(a,{matches:z.search,select:D=>void q.focusOn(D.id)}),U(),q.refreshCounts()},teardown(){I=!0,w!==null&&(cancelAnimationFrame(w),w=null),document.removeEventListener("visibilitychange",j),M?.(),O?.(),R?.(),P(),m.dispose(),Gi(c,o,[B,t.modifier])}};try{q.terms=await e.client.fetchAllTerms(t.taxonomy)}catch(z){e.toast(t.loadFailed,z)}return q}const jt=18;function ha(o,e,t,s){const n=new Map,a=s.palette;function i(l,u){const d=s.isFocused(u.id),h=Te(u.name,jt),p=String(u.count);l.nameText.text!==h&&(l.nameText.text=h),l.countText.text!==p&&(l.countText.text=p),l.cachedName=h,l.cachedCount=u.count,l.cachedFocused=d,l.cachedColor=u.color;const g=9,m=3,b=5,w=5,$=2,M=l.nameText.width,R=l.nameText.height,O=l.countText.width,I=l.countText.height,x=Math.max(18,O+w*2),E=I+$*2,P=g+M+b+x+g,N=Math.max(R,E)+m*2,F=-P/2;l.bg.clear(),l.bg.roundRect(F,0,P,N,N/2),d?(l.bg.fill(a.raised),l.bg.stroke({color:u.color,width:2})):l.cachedHover?(l.bg.fill({color:a.raised,alpha:1}),l.bg.stroke({color:u.color,width:1.5,alpha:1})):(l.bg.fill({color:a.surface,alpha:1}),l.bg.stroke({color:a.border,width:1,alpha:1})),l.nameText.x=F+g,l.nameText.y=(N-R)/2,l.nameText.style.fill=a.fg;const U=F+g+M+b,j=(N-E)/2;l.countBg.clear(),l.countBg.roundRect(U,j,x,E,E/2),l.countBg.fill(u.color),l.countText.style.fill=so(u.color,a),l.countText.x=U+(x-O)/2,l.countText.y=j+(E-I)/2}function r(l){const u=n.get(l.id);if(u)return u;const d=new o.Container;d.eventMode="static",d.cursor="pointer";const h=new o.Graphics,p=new o.Text({text:Te(l.name,jt),style:{fill:a.fg,fontSize:14,fontFamily:Ee,fontWeight:"600"},resolution:Ae}),g=new o.Graphics,m=new o.Text({text:String(l.count),style:{fill:a.fg,fontSize:12,fontFamily:Ee,fontWeight:"700"},resolution:Ae});d.addChild(h),d.addChild(p),d.addChild(g),d.addChild(m);const b={container:d,bg:h,nameText:p,countBg:g,countText:m,cachedName:"",cachedCount:-1,cachedFocused:!1,cachedHover:!1,cachedColor:-1};return n.set(l.id,b),e.addChild(d),d.on("pointerdown",w=>ve(t,w)),d.on("pointertap",()=>{ne(t)||s.onTap(l.id)}),d.on("pointerover",()=>{b.cachedHover=!0,i(b,l)}),d.on("pointerout",()=>{b.cachedHover=!1,i(b,l)}),b}const c={relayout(l){i(r(l),l)},destroy(l){const u=n.get(l);u&&(e.removeChild(u.container),u.container.destroy({children:!0}),n.delete(l))},sync(l,u,d){for(const p of[...n.keys()])l.has(p)||c.destroy(p);const h=d!==null;for(const p of l.values()){const g=r(p);g.container.x=p.x,g.container.y=p.y+p.radius+6,g.container.scale.set(u);const m=d===p.id,b=!h||m?1:.4;for(const w of[g.container,p.gfx])Math.abs(w.alpha-b)>.005?w.alpha+=(b-w.alpha)*.18:w.alpha=b;(g.cachedName!==Te(p.name,jt)||g.cachedCount!==p.count||g.cachedFocused!==m||g.cachedColor!==p.color)&&i(g,p)}}};return c}function no(o,e,t,s,n,a,i,r,c){const l=1-o;return{x:l*l*l*e+3*l*l*o*s+3*l*o*o*a+o*o*o*r,y:l*l*l*t+3*l*l*o*n+3*l*o*o*i+o*o*o*c}}function Kt(o,e,t,s,n,a,i={}){const r=s-e,c=e+r*.5,l=s-r*.5,u=i.alpha??.5,d=i.width??1.5;if(!i.dashed){o.moveTo(e,t),o.bezierCurveTo(c,t,l,n,s,n),o.stroke({color:a,width:d,alpha:u});return}const h=32,p=i.dashPhase??0,g=Math.max(1,i.dashStride??1);let m=e,b=t;for(let w=1;w<=h;w++){const $=no(w/h,e,t,c,t,l,n,s,n);Math.floor((w-1+p)/g)%2===0&&(o.moveTo(m,b),o.lineTo($.x,$.y),o.stroke({color:a,width:d,alpha:u})),m=$.x,b=$.y}}function le(o,e,t,s){const n=e.gfx;n.clear();const a=e.radius;t||(n.circle(0,5,a),n.fill({color:0,alpha:.18})),t&&(n.circle(0,0,a+10),n.fill({color:e.color,alpha:.22})),n.circle(0,0,a),n.fill(Yi(e.color,-.18)),n.circle(0,-a*.06,a*.94),n.fill(e.color),n.circle(-a*.32,-a*.42,a*.3),n.fill({color:16777215,alpha:.32}),n.circle(0,0,a),n.stroke({color:s.border,width:t?3:2,alignment:0}),n.x=e.x,n.y=e.y,n.zIndex=10,n.hitArea=new o.Circle(0,0,a+4)}function io(o,e,t,s){le(o,e,!1,s);const n=e.gfx,a=Math.sin(performance.now()/280)*.5+.5;n.circle(0,0,e.radius+6+a*5),n.stroke({color:t,width:3,alpha:.6+a*.35}),n.circle(0,0,e.radius*.42),n.fill({color:t,alpha:.85}),n.hitArea=new o.Circle(0,0,e.radius+12)}const fa=5500,ao=.05,ga=130;function ro(o,e,t){const s=Array.from(o.values());for(const n of s){if(n.pinned){n.x+=(n.tx-n.x)*.12,n.y+=(n.ty-n.y)*.12,n.gfx.x=n.x,n.gfx.y=n.y;continue}let a=0,i=0;for(const c of s){if(n===c)continue;const l=n.x-c.x,u=n.y-c.y,d=l*l+u*u+1,h=fa/d,p=Math.sqrt(d);a+=l/p*h,i+=u/p*h}const r=o.get(n.parent);if(r){const c=r.x-n.x,l=r.y-n.y,u=Math.sqrt(c*c+l*l)||1,d=u-ga;a+=c/u*d*ao,i+=l/u*d*ao}else a+=-n.x*8e-4,i+=-n.y*8e-4;if(t.nudge&&n.id!==t.focusId){const c=n.x-t.nudge.x,l=n.y-t.nudge.y,u=Math.sqrt(c*c+l*l)||1,d=t.nudge.radius+n.radius;u<d&&(a+=c/u*18*(d-u),i+=l/u*18*(d-u))}n!==t.dragNode&&(n.x+=a*e*.001+(n.tx-n.x)*.02,n.y+=i*e*.001+(n.ty-n.y)*.02),n.gfx.x=n.x,n.gfx.y=n.y}}function ma(o,e){const t={dragNode:null,focusId:null,nudge:null};for(let s=0;s<e;s++)ro(o,16,t);for(const s of o.values())s.tx=s.x,s.ty=s.y}const te=B;function at(o,e,t){const s=document.createElement("div");s.className=`${te}__sidebar-header`;const n=document.createElement("span");n.className=`${te}__sidebar-dot`,n.style.background=e;const a=document.createElement("code");a.className=`${te}__sidebar-slug`,a.textContent=t,s.appendChild(n),s.appendChild(a),o.appendChild(s)}function lo(o,e){const t=document.createElement("label");t.className=`${te}__sidebar-label`,t.textContent=e,o.appendChild(t)}function Pe(o,e,t,s){lo(o,e);const n=document.createElement("input");return n.type="text",n.className=`${te}__editor-name`,n.value=t,n.placeholder=s,o.appendChild(n),n}function Gt(o,e){const t=Pe(o,f("Slug"),e,f("auto-from-name"));return t.spellcheck=!1,t.autocapitalize="off",t.addEventListener("input",()=>{const s=t.value,n=s.toLowerCase().replace(/[^a-z0-9-]+/g,"-");if(s!==n){const a=t.selectionStart??n.length;t.value=n,t.setSelectionRange(a,a)}}),t}function rt(o,e){lo(o,f("Description"));const t=document.createElement("textarea");return t.className=`${te}__editor-desc`,t.value=e,t.placeholder=f("Description (optional)"),t.rows=4,o.appendChild(t),t}function co(o,e){const t=document.createElement("p");t.className=`${te}__sidebar-meta`,t.textContent=e,o.appendChild(t)}const fe=Ut;function lt(o,e){const t=document.createElement("div");t.className=`${te}__editor-actions`;for(const s of e)t.appendChild(s);o.appendChild(t)}function uo(o,e,t,s){const n=document.createElement("div");n.className=`${te}__sidebar-empty`;const a=document.createElement("span");a.className=`dashicons ${e}`,a.setAttribute("aria-hidden","true"),n.appendChild(a);const i=document.createElement("h3");i.className=`${te}__sidebar-empty-title`,i.textContent=t,n.appendChild(i);const r=document.createElement("p");r.className=`${te}__sidebar-empty-hint`,r.textContent=s,n.appendChild(r),o.appendChild(n)}function po(o){const e=Ut("danger",f("Delete"));let t=null;return e.addEventListener("click",async()=>{if(!e.classList.contains("is-armed")){e.textContent=f("Click again to delete"),e.classList.add("is-armed"),t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{e.textContent=f("Delete"),e.classList.remove("is-armed"),t=null},2500);return}t!==null&&(window.clearTimeout(t),t=null),await o()}),e}function ho(o,e,t){o.addEventListener("keydown",s=>{s.key==="Enter"?(s.preventDefault(),e()):s.key==="Escape"&&t()})}function ba(o,e){const{sidebar:t,client:s}=o,n=e.parent!==0?o.node(e.parent):void 0,a=n?n.color:o.clusterColor(o.terms().length);at(t,to(a),n?V(f("New child of %s"),n.name):f("New root category"));const i=Pe(t,f("Name"),"",f("e.g. Recipes"));requestAnimationFrame(()=>i.focus());const r=Gt(t,""),c=rt(t,""),l=fe("primary",f("Create")),u=fe("danger",f("Cancel")),d=()=>{o.setDraft(null),ie(o)},h=async()=>{const p=i.value.trim();if(!p){i.focus();return}l.disabled=!0;try{const g=await s.createCategory(p,e.parent,{slug:r.value.trim()||void 0,description:c.value||void 0}),m={id:g.id,name:g.name,slug:g.slug||"",parent:g.parent,count:0,description:g.description||"",isDefault:!1};o.terms().some(b=>b.id===m.id)||o.setTerms(o.terms().concat(m)),o.setDraft(null),o.buildTree(),o.setFocus(g.id),ie(o),await o.loadPosts()}catch(g){l.disabled=!1,o.toast(f("Couldn’t create:"),g)}};l.addEventListener("click",()=>void h()),u.addEventListener("click",d),ho(i,()=>void h(),d),lt(t,[l,u])}function _a(o,e){const{sidebar:t,client:s}=o,n=e.id;at(t,to(e.color),`#${n}`);const a=o.terms().find(p=>p.id===n),i=Pe(t,f("Name"),e.name,f("Name")),r=Gt(t,a?.slug||""),c=rt(t,e.description||"");co(t,V(de("%d post in this category.","%d posts in this category.",e.count),e.count));const l=fe("secondary",f("+ Child"));l.addEventListener("click",()=>{o.setDraft({parent:n}),ie(o)});const u=e.parent&&e.parent!==0?fe("secondary",f("Make root")):null;u&&(u.title=f("Promote this category to a top-level root (no parent)."),u.addEventListener("click",async()=>{try{await s.updateTerm("categories",n,{parent:0});const p=o.node(n);p&&(p.parent=0),o.setTerms(o.terms().map(g=>g.id===n?{...g,parent:0}:g)),o.buildTree(),ie(o)}catch(p){o.toast(f("Couldn’t reparent:"),p)}}));const d=fe("primary",f("Save"));d.addEventListener("click",async()=>{const p=i.value.trim();if(!p)return;const g=c.value,m=r.value.trim(),b=a?.slug??"";if(p===e.name&&g===(e.description||"")&&m===b)return;const w={name:p,description:g};m!==b&&(w.slug=m);try{const $=await s.updateTerm("categories",n,w),M=o.node(n);M&&(M.name=$.name,M.description=$.description),o.setTerms(o.terms().map(R=>R.id===n?{...R,name:$.name,description:$.description,slug:$.slug||R.slug}:R)),o.relayoutNode(n),ie(o)}catch($){o.toast(f("Couldn’t save:"),$)}});const h=po(async()=>{try{await s.deleteTerm("categories",n),o.setTerms(o.terms().filter(p=>p.id!==n)),o.setFocus(null),o.clearPosts(),o.buildTree(),ie(o)}catch(p){o.toast(f("Couldn’t delete:"),p)}});lt(t,u?[l,u,d,h]:[l,d,h])}function ie(o){o.sidebar.replaceChildren();const e=o.draft();if(e!==null){ba(o,e);return}const t=o.focusId();if(t===null){uo(o.sidebar,"dashicons-admin-tools",f("No category selected"),f("Click a node on the mindmap to edit its name, description, and posts."));return}const s=o.node(t);if(!s){o.setFocus(null),ie(o);return}_a(o,s)}const fo=22,va=48;function go(o,e){const t=Math.max(1,...e.map(s=>s.count));return fo+(va-fo)*Math.sqrt(o/t)}function Xt(o){return o.isDefault||o.id===1||o.slug==="uncategorized"||o.name.toLowerCase()==="uncategorized"}async function ya(o,e){const t=await oo(o,e,{taxonomy:"categories",restTaxonomy:"category",modifier:"os-mindmap",unavailable:f("Mindmap unavailable."),loadFailed:f("Couldn’t load categories:"),emptyHint:f('No custom categories yet. Click "Add root category" to start branching.'),chrome:{buttons:[{variant:"primary",icon:"dashicons-plus",label:f("Add root category")},{icon:"dashicons-image-rotate",label:f("Recenter")}],searchPlaceholder:f("Search categories…"),searchAria:f("Search categories in the mindmap"),hint:f("Click a node to focus + edit · drag onto another to reparent · scroll or pinch to zoom")},layers:["edge","postEdge","post","node","chip","postChip"],fan:{chipFontSize:14,chipTextRes:Ae,pagerLabelSize:14,pagerGlyphSize:16,pagerTextRes:Ae}});if(!t)return()=>{};const s=t,{pixi:n,layers:a,fan:i,camera:r,interaction:c,world:l,palette:u}=s,{client:d}=e,h=new n.Graphics;a.edge.addChild(h);const p=new Map,g=ha(n,a.chip,c,{palette:u,isFocused:v=>i.focusId===v,onTap:v=>void s.focusOn(v)});let m=null,b=null,w=null,$={x:0,y:0};const M=new Map;let R=null,O=nt(o);const I=v=>eo((O+v*47)%360,55,52);function x(v,_){let S=p.get(v.id);if(S)S.parent=v.parent,S.name=v.name,S.description=v.description,S.count=v.count,S.depth=_.depth,S.color=_.color,S.radius=_.radius,S.tx=_.tx,S.ty=_.ty,S.pinned=_.pinned;else{const y=new n.Graphics;y.eventMode="static",y.cursor="pointer",S={id:v.id,parent:v.parent,name:v.name,description:v.description,count:v.count,x:_.tx,y:_.ty,tx:_.tx,ty:_.ty,radius:_.radius,depth:_.depth,color:_.color,gfx:y,pinned:_.pinned},a.node.addChild(y);const C=S;y.on("pointerdown",A=>N(A,C)),p.set(v.id,S)}return le(n,S,!1,u),S}function E(){const v=s.terms,_=new Map;for(const W of v){const T=_.get(W.parent)??[];T.push(W),_.set(W.parent,T)}const S=_.get(0)??[],y=S.filter(W=>!Xt(W)),C=S.find(Xt),A=(W,T,Y,ae,me)=>{const J=y.length>1?110+y.length*28:0,be=C?Math.max(J,140):J,xe=T===0?be:be+160+(T-1)*150,Da=T===0?I(Y):p.get(W.parent)?.color??I(Y);x(W,{tx:xe*Math.cos(ae),ty:xe*Math.sin(ae),radius:go(W.count,v),depth:T,color:Da,pinned:T===0});const ts=_.get(W.id)??[];if(ts.length>0){const Co=me/ts.length;ts.forEach((Oa,qa)=>A(Oa,T+1,Y,ae-me/2+Co*(qa+.5),Co*.85))}},L=new Set(v.map(W=>W.id));for(const[W,T]of p)L.has(W)||(a.node.removeChild(T.gfx),T.gfx.destroy(),p.delete(W),g.destroy(W));const K=Math.max(1,y.length);y.forEach((W,T)=>A(W,0,T,2*Math.PI/K*T,2*Math.PI/K)),C&&x(C,{tx:0,ty:0,radius:go(C.count,v),depth:0,color:9211796,pinned:!0}),s.syncEmptyHint(v.length<=1)}function P(){h.clear();for(const v of p.values()){const _=v.parent?p.get(v.parent):void 0;if(!_)continue;const S=m!==null&&v===m,y=i.focusId!==null&&(v.id===i.focusId||v.parent===i.focusId),C=i.focusId!==null&&!y?.35:1;Kt(h,_.x,_.y,v.x,v.y,_.color,S?{dashed:!0,alpha:.28*C}:{alpha:.5*C})}if(m&&b){const{x:v,y:_}=m,{x:S,y,color:C}=b;Kt(h,v,_,S,y,C,{alpha:.22,width:9}),Kt(h,v,_,S,y,C,{alpha:.95,width:2.5,dashed:!0,dashStride:2,dashPhase:Math.floor(performance.now()/70)});const A=performance.now()%1300/1300,L=S-v,K=no(A,v,_,v+L*.5,_,S-L*.5,y,S,y);h.circle(K.x,K.y,5),h.fill({color:16777215,alpha:.95}),h.stroke({color:C,width:2,alpha:1})}i.drawEdges()}function N(v,_){if(ne(c))return;ve(c,v),m=_,_.pinned=!0,_.tx=_.x,_.ty=_.y,w={x:v.global.x,y:v.global.y};const S=r.stageToWorld(v.global);$={x:_.x-S.x,y:_.y-S.y}}function F(v,_){let S=p.get(_),y=32;for(;S&&y-- >0;){if(S.id===v)return!0;if(!S.parent)return!1;S=p.get(S.parent)}return!1}function U(v){if(!m)return;const _=v.x+$.x,S=v.y+$.y;m.x=_,m.y=S,m.tx=_,m.ty=S,m.gfx.x=_,m.gfx.y=S;let y=null;for(const C of p.values()){if(C===m)continue;const A=C.x-v.x,L=C.y-v.y;if(A*A+L*L<C.radius*C.radius){y=C;break}}y!==b&&(b&&le(n,b,i.focusId===b.id,u),b=y,y&&io(n,y,m.color,u))}async function j(v){if(!m)return;const _=m,S=b,y=Qs(w,v);if(m=null,b=null,w=null,_.pinned=_.depth===0,!S&&y<2){s.focusOn(_.id);return}if(S&&S.id!==_.parent&&!F(_.id,S.id))try{await d.updateTerm("categories",_.id,{parent:S.id}),_.parent=S.id,s.terms=s.terms.map(C=>C.id===_.id?{...C,parent:S.id}:C),E()}catch(C){e.toast(f("Reparent failed:"),C)}else le(n,_,i.focusId===_.id,u),S&&le(n,S,i.focusId===S.id,u)}const G={sidebar:s.sidebar,client:d,toast:e.toast,terms:()=>s.terms,setTerms:v=>{s.terms=v},node:v=>p.get(v),focusId:()=>i.focusId,setFocus:v=>{i.focusId=v},draft:()=>R,setDraft:v=>{R=v&&v.parent!==0&&!p.get(v.parent)?R:v},clusterColor:I,buildTree:E,relayoutNode:v=>{const _=p.get(v);_&&g.relayout(_)},clearPosts:()=>i.clear(),loadPosts:()=>i.load()};function q(){if(p.size===0)return null;const v=30,_={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const S of p.values())_.minX=Math.min(_.minX,S.tx-S.radius),_.minY=Math.min(_.minY,S.ty-S.radius),_.maxX=Math.max(_.maxX,S.tx+S.radius),_.maxY=Math.max(_.maxY,S.ty+S.radius+v);return _}const[z,D]=s.chrome.buttons;return D.addEventListener("click",()=>s.recenter()),z.addEventListener("click",()=>{R={parent:0},ie(G)}),E(),ie(G),ma(p,80),s.start({themeChanged:()=>{const v=nt(o);if(v!==O){O=v;const _=s.terms.filter(S=>!S.parent&&!Xt(S));for(const S of p.values()){let y=S;const C=new Set;for(;y.parent&&p.has(y.parent)&&!C.has(y.id);)C.add(y.id),y=p.get(y.parent);const A=_.findIndex(L=>L.id===y.id);A>=0&&(S.color=I(A))}}for(const _ of p.values())le(n,_,i.focusId===_.id,u),g.relayout(_)},center:v=>{const _=p.get(v);return _?{x:_.x,y:_.y,tone:_.color}:null},countReconciled:(v,_)=>{const S=p.get(v);S&&S.count!==_&&(S.count=_,s.terms=s.terms.map(y=>y.id===v?{...y,count:_}:y),g.relayout(S))},focusChanged:()=>{for(const v of p.values())le(n,v,i.focusId===v.id,u);ie(G)},focusOpened:v=>{M.clear();for(const _ of p.values()){if(_.id===i.focusId||!_.pinned)continue;const S=_.x-v.x,y=_.y-v.y,C=Math.sqrt(S*S+y*y)||1;if(C>=Bt+_.radius)continue;M.set(_.id,{tx:_.tx,ty:_.ty});const A=Bt+_.radius+20;_.tx=v.x+S/C*A,_.ty=v.y+y/C*A}},focusClosed:()=>{for(const[v,_]of M){const S=p.get(v);S&&(S.tx=_.tx,S.ty=_.ty)}M.clear()},bounds:q,frame:v=>{ro(p,v,{dragNode:m,focusId:i.focusId,nudge:s.nudge}),i.ease(),P(),m&&b&&io(n,b,m.color,u);const _=1/Math.max(.01,l.scale.x);g.sync(p,_,i.focusId),i.syncChips(_)},countsChanged:()=>{for(const v of s.terms){const _=p.get(v.id);_&&_.count!==v.count&&(_.count=v.count,g.relayout(_))}E(),r.fitToView(q(),{animate:!0})},dragging:()=>m!==null,pointerMove:(v,_)=>m?(U(_),!0):!1,pointerUp:j,cancelGesture:()=>{m&&(m.pinned=m.depth===0,le(n,m,i.focusId===m.id,u)),b&&le(n,b,i.focusId===b.id,u),m=null,b=null,w=null},search:v=>Array.from(p.values()).filter(_=>_.name.toLowerCase().includes(v))}),()=>s.teardown()}const xa=H`: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:var( --os-ui-field-font-size-compact,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}`,Ge=class Ge extends X{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,s=this.readonly!==null,n=this.removable!==null||this.removable===null&&!s,a=this.creatable!==null,i=this["add-label"]||"Add",r=this.placeholder||"Add a tag…";return k`
761 + <p class="os-term-directory__count" role="status">${W(de("%d topic","%d topics",m.length),m.length)}</p>
762 + <div class="os-term-directory__items">${m.slice(0,r).map(_=>C`<os-button variant="ghost" data-topic-id=${_.id} @click=${()=>{l(),t(_.id)}}><span>${pe(_.name)}</span><small>${W(de("%d post","%d posts",_.count),_.count)}</small></os-button>`)}
763 + ${m.length===0?C`<p>${f("No matching topics. Try another search or filter.")}</p>`:""}
764 + ${m.length>r?C`<os-button variant="secondary" @click=${()=>{r+=50,d()}}>${f("Show more")}</os-button>`:""}
765 + </div>`,n)},u=()=>{if(!n.hidden){l();return}d(),n.hidden=!1,s.setAttribute("aria-expanded","true"),s.shadowRoot?.querySelector("button")?.setAttribute("aria-expanded","true"),queueMicrotask(()=>n.querySelector("os-text-field")?.shadowRoot?.querySelector("input")?.focus())},h=p=>{p.key==="Escape"&&(p.stopPropagation(),l())};return s.addEventListener("click",u),n.addEventListener("keydown",h),()=>{s.removeEventListener("click",u),n.removeEventListener("keydown",h),s.remove(),n.remove()}}function at(o){const e=ye(o,"--os-ui-surface","#ffffff",16777215);return{surface:e,raised:ye(o,"--os-ui-surface-elevated","#ffffff",e),fg:ye(o,"--os-ui-fg","#1d2327",e),muted:ye(o,"--os-ui-fg-muted","#50575e",e),faint:ye(o,"--os-ui-fg-faint","#b0b3b8",e),border:ye(o,"--os-ui-border","#dcdcde",e),accent:ye(o,"--os-ui-accent","#2271b1",e)}}function ye(o,e,t,s=16777215){const n=document.createElement("span");n.hidden=!0,n.style.color=`var(${e}, ${t})`,o.append(n);const a=getComputedStyle(n).color;n.remove();const i=a.match(/[\d.]+/g)?.map(Number);if(!i||i.length<3)return parseInt(t.slice(1),16);const r=i[3]??1,c=a.startsWith("color(srgb");return[16,8,0].reduce((l,d,u)=>{const h=i[u]*(c?255:1),p=Math.floor(s/2**d)%256;return l+Math.round(h*r+p*(1-r))*2**d},0)}function Ca(o,e,t){let s=JSON.stringify([at(o),t?.()]);const n=()=>{const i=JSON.stringify([at(o),t?.()]);i!==s&&(s=i,e())},a=new MutationObserver(n);for(let i=o;i;i=i.parentElement)a.observe(i,{attributes:!0,attributeFilter:["style","class"]});return document.addEventListener("os-desktop-theme-changed",n),()=>{a.disconnect(),document.removeEventListener("os-desktop-theme-changed",n)}}function uo(o,e){const t=a=>[16,8,0].reduce((i,r,c)=>{const l=Math.floor(a/2**r)%256/255;return i+(l<=.04045?l/12.92:((l+.055)/1.055)**2.4)*[.2126,.7152,.0722][c]},0),s=t(o),n=a=>{const i=t(a);return(Math.max(i,s)+.05)/(Math.min(i,s)+.05)};return n(e.fg)>=n(e.surface)?e.fg:e.surface}const $a=10,Sa=22,Ea=6e4;function Aa(o){const{pixi:e,postLayer:t,postChipLayer:s,postEdgeGfx:n,interaction:a,env:i,palette:r}=o,c=new Map,l=new Map,d=new Map;let u=0;const h=new e.Container;h.eventMode="passive",h.visible=!1,t.addChild(h);const p=new e.Graphics,m=new e.Graphics,_=new e.Text({text:"1 / 1",style:{fill:r.muted,fontSize:o.pagerLabelSize,fontFamily:Ee,fontWeight:"600"},...o.pagerTextRes?{resolution:o.pagerTextRes}:{}});_.anchor.set(.5);for(const y of[p,m])y.eventMode="static",y.cursor="pointer",y.hitArea=new e.Circle(0,0,16),y.on("pointerdown",E=>ve(a,E));h.addChild(p),h.addChild(_),h.addChild(m),p.on("pointertap",y=>{ne(a)||(ve(a,y),a.lastFocusChange=performance.now(),P.focusPage>1&&(P.focusPage--,P.load()))}),m.on("pointertap",y=>{ne(a)||(ve(a,y),a.lastFocusChange=performance.now(),P.focusPage<P.focusTotalPages&&(P.focusPage++,P.load()))});function g(y,E,M){y.clear(),y.circle(0,0,14),y.fill({color:M?r.surface:r.raised,alpha:M?.7:1}),y.stroke({color:r.border,width:1,alpha:1});const R=y.children?.[0]??null;if(R)R.text=E,R.style.fill=M?r.faint:r.muted;else{const H=new e.Text({text:E,style:{fill:M?r.faint:r.muted,fontSize:o.pagerGlyphSize,fontFamily:Ee,fontWeight:"600"},...o.pagerTextRes?{resolution:o.pagerTextRes}:{}});H.anchor.set(.5),y.addChild(H)}}function b(){const y=P.focusId===null?null:o.getCenter(P.focusId);if(!y||P.focusTotalPages<=1){h.visible=!1;return}h.visible=!0;const E=P.focusPage<=1,M=P.focusPage>=P.focusTotalPages;g(p,"◀",E),g(m,"▶",M),p.cursor=E?"default":"pointer",m.cursor=M?"default":"pointer",_.text=`${P.focusPage} / ${P.focusTotalPages}`,p.x=-38,m.x=38,p.y=0,m.y=0,_.x=0,_.y=0,h.x=y.x,h.y=y.y+nt+60}function v(y,E){y.titleText.style.fill=r.fg;const M=Te(E.title,Sa);y.titleText.text!==M&&(y.titleText.text=M);const R=9,H=3,U=4,j=6,G=y.titleText.width,q=y.titleText.height,D=R+U*2+j+G+R,O=Math.max(q,U*2)+H*2,k=-D/2,x=-O/2;y.bg.clear(),y.bg.roundRect(k,x,D,O,O/2),y.cachedHover?(y.bg.fill({color:r.raised,alpha:1}),y.bg.stroke({color:E.tone,width:1.5,alpha:1})):(y.bg.fill({color:r.surface,alpha:1}),y.bg.stroke({color:r.border,width:1,alpha:1})),y.dot.clear(),y.dot.circle(k+R+U,0,U),y.dot.fill({color:E.tone,alpha:.85}),y.dot.stroke({color:r.border,width:1}),y.titleText.x=k+R+U*2+j,y.titleText.y=-q/2}function S(y){if(l.has(y.id))return;const E=new e.Container;E.eventMode="static",E.cursor="pointer",E.alpha=0;const M=new e.Graphics,R=new e.Graphics,H=new e.Text({text:y.title,style:{fill:r.fg,fontSize:o.chipFontSize,fontFamily:Ee,fontWeight:"500"},resolution:o.chipTextRes});E.addChild(M),E.addChild(R),E.addChild(H);const U={container:E,bg:M,dot:R,titleText:H,cachedHover:!1};l.set(y.id,U),s.addChild(E),E.on("pointerdown",j=>ve(a,j)),E.on("pointertap",()=>{ne(a)||(i.leaveFullscreen(),i.openUrl(y.editUrl,y.title,"dashicons-admin-post"),o.onOpenPost())}),E.on("pointerover",()=>{U.cachedHover=!0,v(U,y)}),E.on("pointerout",()=>{U.cachedHover=!1,v(U,y)}),v(U,y)}function T(y){P.clear();const E=P.focusId===null?null:o.getCenter(P.focusId);if(!E)return;const M=y.length,R=nt+Math.max(0,M-8)*6;y.forEach((H,U)=>{const j=2*Math.PI/Math.max(1,M)*U-Math.PI/2,G=new e.Graphics;t.addChild(G);const q={id:H.id,title:H.title,editUrl:H.editUrl,angle:j,r:R,x:E.x,y:E.y,tx:E.x+Math.cos(j)*R,ty:E.y+Math.sin(j)*R,gfx:G,tone:E.tone};c.set(H.id,q),S(q)}),b()}function z(y,E){P.focusTotalPages=y.totalPages,Number.isFinite(y.realTotal)&&y.realTotal>=0&&o.onCountReconciled(E,y.realTotal),T(y.items)}const P={repaintTheme(){const y=P.focusId===null?null:o.getCenter(P.focusId)?.tone;_.style.fill=r.muted,b();for(const E of c.values()){y!=null&&(E.tone=y);const M=l.get(E.id);M&&v(M,E)}},focusId:null,focusPage:1,focusTotalPages:1,async load(){if(P.focusId===null)return;const y=++u,E=P.focusId,M=`${E}:${P.focusPage}`,R=d.get(M);if(R&&performance.now()-R.fetchedAt<Ea){z(R,E);return}try{const H=await i.client.fetchTermPosts(o.param,E,P.focusPage,$a);if(y!==u||P.focusId!==E)return;const U=i.extra.editPostUrlBase??"",j=U.includes("?")?"&":"?",G={items:H.items.map(q=>({id:q.id,title:ha(q.title),editUrl:`${U}${j}post=${q.id}&action=edit`})),totalPages:H.totalPages,realTotal:H.total,fetchedAt:performance.now()};d.set(M,G),z(G,E)}catch(H){i.toast(f("Couldn’t load posts:"),H)}},clear(){for(const y of c.values())t.removeChild(y.gfx),y.gfx.destroy();c.clear();for(const y of l.values())s.removeChild(y.container),y.container.destroy({children:!0});l.clear(),n.clear(),h.visible=!1},invalidate(){u++},ease(){for(const y of c.values())y.x+=(y.tx-y.x)*.18,y.y+=(y.ty-y.y)*.18,y.gfx.x=y.x,y.gfx.y=y.y},drawEdges(){n.clear();const y=P.focusId===null?null:o.getCenter(P.focusId);if(y)for(const E of c.values())n.moveTo(y.x,y.y),n.lineTo(E.x,E.y),n.stroke({color:y.tone,width:1,alpha:.35})},syncChips(y){for(const E of c.values()){const M=l.get(E.id);M&&(M.container.x=E.x,M.container.y=E.y,M.container.scale.set(y),M.container.alpha<1&&(M.container.alpha=Math.min(1,M.container.alpha+.18)))}}};return P}const jt=nt+130;async function po(o,e,t){const s=await la(o,t.unavailable);if(!s)return null;const n=s,a=ga(o,t.modifier,t.chrome),{stage:i,sidebar:r}=a,{app:c,world:l}=await ca(n,i,`${B}__canvas`),d={};for(const D of t.layers){const O=new n.Container;d[D]=O,l.addChild(O)}const u=new n.Graphics;d.postEdge.addChild(u);const h=at(i),p=na();let m=null;const _=aa(l,i,{start:()=>{p.pinchUntil=1/0,p.panActive=!1,p.panStart=null,m?.cancelGesture()},end:()=>{p.pinchUntil=performance.now()+300}});let g=null,b=null,v=performance.now(),S=null,T=null,z=null,P=!1;const y=Aa({palette:h,pixi:n,postLayer:d.post,postChipLayer:d.postChip,postEdgeGfx:u,env:e,param:t.taxonomy,interaction:p,...t.fan,getCenter:D=>m?.center(D)??null,onCountReconciled:(D,O)=>m?.countReconciled(D,O),onOpenPost:()=>q.closeFocus()}),M=Ca(i,()=>{Object.assign(h,at(i)),m?.themeChanged(),y.repaintTheme(),c.render()}),R=()=>document.hidden||i.clientWidth===0||i.clientHeight===0,H=()=>{if(b=null,P||!m||R())return;const D=performance.now(),O=Math.min(50,D-v);v=D,_.ease(),m.frame(O),b=requestAnimationFrame(H)},U=()=>{P||b!==null||!m||R()||(v=performance.now(),b=requestAnimationFrame(H))},j=()=>U();c.stage.on("pointerdown",D=>{if(ne(p))return;const O=D;p.panActive=!0,p.panStart={x:O.global.x,y:O.global.y},p.panMovedDist=0}),c.stage.on("pointermove",D=>{if(ne(p))return;const O=D;if(!m?.pointerMove(O,_.stageToWorld(O.global))&&p.panActive&&p.panStart){const k=O.global.x-p.panStart.x,x=O.global.y-p.panStart.y;_.pan(k,x),p.panMovedDist+=Math.sqrt(k*k+x*x),p.panStart={x:O.global.x,y:O.global.y}}});const G=async D=>{ne(p)||await m?.pointerUp(D),p.panActive=!1,p.panStart=null};c.stage.on("pointerup",D=>void G(D)),c.stage.on("pointerupoutside",D=>void G(D)),c.canvas.addEventListener("click",D=>{ia(p,D,c.canvas)&&!m?.dragging()&&y.focusId!==null&&q.closeFocus()});const q={palette:h,pixi:n,app:c,world:l,layers:d,postEdgeGfx:u,chrome:a,stage:i,sidebar:r,interaction:p,camera:_,fan:y,terms:[],nudge:null,async focusOn(D){if(y.focusId===D){q.closeFocus();return}const O=y.focusId!==null;y.focusId=D,y.focusPage=1,p.lastFocusChange=performance.now();const k=m?.center(D)??null;k&&(O||(g={scale:_.targetScale,x:_.targetWorldX,y:_.targetWorldY}),_.frameOn(k.x,k.y),q.nudge={x:k.x,y:k.y,radius:jt},m?.focusOpened?.(k)),m?.focusChanged(),await y.load()},closeFocus(){y.focusId=null,p.lastFocusChange=performance.now(),y.invalidate(),q.nudge=null,m?.focusClosed?.(),g&&(_.targetScale=g.scale,_.targetWorldX=g.x,_.targetWorldY=g.y,g=null),y.clear(),m?.focusChanged()},recenter(){const D=y.focusId===null?null:m?.center(y.focusId)??null;D&&_.frameOn(D.x,D.y)||_.fitToView(m?.bounds()??null,{animate:!0})},syncEmptyHint(D){const O=i.querySelector(`.${B}__empty`);if(D&&!O){const k=document.createElement("div");k.className=`${B}__empty`,k.textContent=t.emptyHint,i.appendChild(k)}else!D&&O&&O.remove()},async refreshCounts(){if(q.terms.length!==0)try{const D=await e.client.fetchTermCounts(t.restTaxonomy,q.terms.map(k=>k.id));let O=!1;q.terms=q.terms.map(k=>{const x=D[String(k.id)];return typeof x=="number"&&x!==k.count?(O=!0,{...k,count:x}):k}),O&&!P&&m?.countsChanged()}catch{}},start(D){m=D,S=ra(n,c,i,{onFirstFit:()=>_.fitToView(D.bounds()),onSettle:()=>q.recenter(),onResize:U}),document.addEventListener("visibilitychange",j),T=wa(a,()=>q.terms,O=>void q.focusOn(O)),z=ma(a,{matches:D.search,select:O=>void q.focusOn(O.id)}),U(),q.refreshCounts()},teardown(){P=!0,b!==null&&(cancelAnimationFrame(b),b=null),document.removeEventListener("visibilitychange",j),S?.(),z?.(),T?.(),M(),_.dispose(),da(c,o,[B,t.modifier])}};try{q.terms=await e.client.fetchAllTerms(t.taxonomy)}catch(D){e.toast(t.loadFailed,D)}return q}const Kt=18;function Ta(o,e,t,s){const n=new Map,a=s.palette;function i(l,d){const u=s.isFocused(d.id),h=Te(d.name,Kt),p=String(d.count);l.nameText.text!==h&&(l.nameText.text=h),l.countText.text!==p&&(l.countText.text=p),l.cachedName=h,l.cachedCount=d.count,l.cachedFocused=u,l.cachedColor=d.color;const m=9,_=3,g=5,b=5,v=2,S=l.nameText.width,T=l.nameText.height,z=l.countText.width,P=l.countText.height,y=Math.max(18,z+b*2),E=P+v*2,M=m+S+g+y+m,R=Math.max(T,E)+_*2,H=-M/2;l.bg.clear(),l.bg.roundRect(H,0,M,R,R/2),u?(l.bg.fill(a.raised),l.bg.stroke({color:d.color,width:2})):l.cachedHover?(l.bg.fill({color:a.raised,alpha:1}),l.bg.stroke({color:d.color,width:1.5,alpha:1})):(l.bg.fill({color:a.surface,alpha:1}),l.bg.stroke({color:a.border,width:1,alpha:1})),l.nameText.x=H+m,l.nameText.y=(R-T)/2,l.nameText.style.fill=a.fg;const U=H+m+S+g,j=(R-E)/2;l.countBg.clear(),l.countBg.roundRect(U,j,y,E,E/2),l.countBg.fill(d.color),l.countText.style.fill=uo(d.color,a),l.countText.x=U+(y-z)/2,l.countText.y=j+(E-P)/2}function r(l){const d=n.get(l.id);if(d)return d;const u=new o.Container;u.eventMode="static",u.cursor="pointer";const h=new o.Graphics,p=new o.Text({text:Te(l.name,Kt),style:{fill:a.fg,fontSize:14,fontFamily:Ee,fontWeight:"600"},resolution:Ae}),m=new o.Graphics,_=new o.Text({text:String(l.count),style:{fill:a.fg,fontSize:12,fontFamily:Ee,fontWeight:"700"},resolution:Ae});u.addChild(h),u.addChild(p),u.addChild(m),u.addChild(_);const g={container:u,bg:h,nameText:p,countBg:m,countText:_,cachedName:"",cachedCount:-1,cachedFocused:!1,cachedHover:!1,cachedColor:-1};return n.set(l.id,g),e.addChild(u),u.on("pointerdown",b=>ve(t,b)),u.on("pointertap",()=>{ne(t)||s.onTap(l.id)}),u.on("pointerover",()=>{g.cachedHover=!0,i(g,l)}),u.on("pointerout",()=>{g.cachedHover=!1,i(g,l)}),g}const c={relayout(l){i(r(l),l)},destroy(l){const d=n.get(l);d&&(e.removeChild(d.container),d.container.destroy({children:!0}),n.delete(l))},sync(l,d,u){for(const p of[...n.keys()])l.has(p)||c.destroy(p);const h=u!==null;for(const p of l.values()){const m=r(p);m.container.x=p.x,m.container.y=p.y+p.radius+6,m.container.scale.set(d);const _=u===p.id,g=!h||_?1:.4;for(const b of[m.container,p.gfx])Math.abs(b.alpha-g)>.005?b.alpha+=(g-b.alpha)*.18:b.alpha=g;(m.cachedName!==Te(p.name,Kt)||m.cachedCount!==p.count||m.cachedFocused!==_||m.cachedColor!==p.color)&&i(m,p)}}};return c}function ho(o,e,t,s,n,a,i,r,c){const l=1-o;return{x:l*l*l*e+3*l*l*o*s+3*l*o*o*a+o*o*o*r,y:l*l*l*t+3*l*l*o*n+3*l*o*o*i+o*o*o*c}}function Gt(o,e,t,s,n,a,i={}){const r=s-e,c=e+r*.5,l=s-r*.5,d=i.alpha??.5,u=i.width??1.5;if(!i.dashed){o.moveTo(e,t),o.bezierCurveTo(c,t,l,n,s,n),o.stroke({color:a,width:u,alpha:d});return}const h=32,p=i.dashPhase??0,m=Math.max(1,i.dashStride??1);let _=e,g=t;for(let b=1;b<=h;b++){const v=ho(b/h,e,t,c,t,l,n,s,n);Math.floor((b-1+p)/m)%2===0&&(o.moveTo(_,g),o.lineTo(v.x,v.y),o.stroke({color:a,width:u,alpha:d})),_=v.x,g=v.y}}function le(o,e,t,s){const n=e.gfx;n.clear();const a=e.radius;t||(n.circle(0,5,a),n.fill({color:0,alpha:.18})),t&&(n.circle(0,0,a+10),n.fill({color:e.color,alpha:.22})),n.circle(0,0,a),n.fill(pa(e.color,-.18)),n.circle(0,-a*.06,a*.94),n.fill(e.color),n.circle(-a*.32,-a*.42,a*.3),n.fill({color:16777215,alpha:.32}),n.circle(0,0,a),n.stroke({color:s.border,width:t?3:2,alignment:0}),n.x=e.x,n.y=e.y,n.zIndex=10,n.hitArea=new o.Circle(0,0,a+4)}function fo(o,e,t,s){le(o,e,!1,s);const n=e.gfx,a=Math.sin(performance.now()/280)*.5+.5;n.circle(0,0,e.radius+6+a*5),n.stroke({color:t,width:3,alpha:.6+a*.35}),n.circle(0,0,e.radius*.42),n.fill({color:t,alpha:.85}),n.hitArea=new o.Circle(0,0,e.radius+12)}const Ma=5500,go=.05,Ia=130;function mo(o,e,t){const s=Array.from(o.values());for(const n of s){if(n.pinned){n.x+=(n.tx-n.x)*.12,n.y+=(n.ty-n.y)*.12,n.gfx.x=n.x,n.gfx.y=n.y;continue}let a=0,i=0;for(const c of s){if(n===c)continue;const l=n.x-c.x,d=n.y-c.y,u=l*l+d*d+1,h=Ma/u,p=Math.sqrt(u);a+=l/p*h,i+=d/p*h}const r=o.get(n.parent);if(r){const c=r.x-n.x,l=r.y-n.y,d=Math.sqrt(c*c+l*l)||1,u=d-Ia;a+=c/d*u*go,i+=l/d*u*go}else a+=-n.x*8e-4,i+=-n.y*8e-4;if(t.nudge&&n.id!==t.focusId){const c=n.x-t.nudge.x,l=n.y-t.nudge.y,d=Math.sqrt(c*c+l*l)||1,u=t.nudge.radius+n.radius;d<u&&(a+=c/d*18*(u-d),i+=l/d*18*(u-d))}n!==t.dragNode&&(n.x+=a*e*.001+(n.tx-n.x)*.02,n.y+=i*e*.001+(n.ty-n.y)*.02),n.gfx.x=n.x,n.gfx.y=n.y}}function La(o,e){const t={dragNode:null,focusId:null,nudge:null};for(let s=0;s<e;s++)mo(o,16,t);for(const s of o.values())s.tx=s.x,s.ty=s.y}const te=B;function rt(o,e,t){const s=document.createElement("div");s.className=`${te}__sidebar-header`;const n=document.createElement("span");n.className=`${te}__sidebar-dot`,n.style.background=e;const a=document.createElement("code");a.className=`${te}__sidebar-slug`,a.textContent=t,s.appendChild(n),s.appendChild(a),o.appendChild(s)}function bo(o,e){const t=document.createElement("label");t.className=`${te}__sidebar-label`,t.textContent=e,o.appendChild(t)}function Pe(o,e,t,s){bo(o,e);const n=document.createElement("input");return n.type="text",n.className=`${te}__editor-name`,n.value=t,n.placeholder=s,o.appendChild(n),n}function Xt(o,e){const t=Pe(o,f("Slug"),e,f("auto-from-name"));return t.spellcheck=!1,t.autocapitalize="off",t.addEventListener("input",()=>{const s=t.value,n=s.toLowerCase().replace(/[^a-z0-9-]+/g,"-");if(s!==n){const a=t.selectionStart??n.length;t.value=n,t.setSelectionRange(a,a)}}),t}function lt(o,e){bo(o,f("Description"));const t=document.createElement("textarea");return t.className=`${te}__editor-desc`,t.value=e,t.placeholder=f("Description (optional)"),t.rows=4,o.appendChild(t),t}function _o(o,e){const t=document.createElement("p");t.className=`${te}__sidebar-meta`,t.textContent=e,o.appendChild(t)}const fe=Wt;function ct(o,e){const t=document.createElement("div");t.className=`${te}__editor-actions`;for(const s of e)t.appendChild(s);o.appendChild(t)}function vo(o,e,t,s){const n=document.createElement("div");n.className=`${te}__sidebar-empty`;const a=document.createElement("span");a.className=`dashicons ${e}`,a.setAttribute("aria-hidden","true"),n.appendChild(a);const i=document.createElement("h3");i.className=`${te}__sidebar-empty-title`,i.textContent=t,n.appendChild(i);const r=document.createElement("p");r.className=`${te}__sidebar-empty-hint`,r.textContent=s,n.appendChild(r),o.appendChild(n)}function yo(o){const e=Wt("danger",f("Delete"));let t=null;return e.addEventListener("click",async()=>{if(!e.classList.contains("is-armed")){e.textContent=f("Click again to delete"),e.classList.add("is-armed"),t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{e.textContent=f("Delete"),e.classList.remove("is-armed"),t=null},2500);return}t!==null&&(window.clearTimeout(t),t=null),await o()}),e}function xo(o,e,t){o.addEventListener("keydown",s=>{s.key==="Enter"?(s.preventDefault(),e()):s.key==="Escape"&&t()})}function Pa(o,e){const{sidebar:t,client:s}=o,n=e.parent!==0?o.node(e.parent):void 0,a=n?n.color:o.clusterColor(o.terms().length);rt(t,co(a),n?W(f("New child of %s"),n.name):f("New root category"));const i=Pe(t,f("Name"),"",f("e.g. Recipes"));requestAnimationFrame(()=>i.focus());const r=Xt(t,""),c=lt(t,""),l=fe("primary",f("Create")),d=fe("danger",f("Cancel")),u=()=>{o.setDraft(null),ie(o)},h=async()=>{const p=i.value.trim();if(!p){i.focus();return}l.disabled=!0;try{const m=await s.createCategory(p,e.parent,{slug:r.value.trim()||void 0,description:c.value||void 0}),_={id:m.id,name:m.name,slug:m.slug||"",parent:m.parent,count:0,description:m.description||"",isDefault:!1};o.terms().some(g=>g.id===_.id)||o.setTerms(o.terms().concat(_)),o.setDraft(null),o.buildTree(),o.setFocus(m.id),ie(o),await o.loadPosts()}catch(m){l.disabled=!1,o.toast(f("Couldn’t create:"),m)}};l.addEventListener("click",()=>void h()),d.addEventListener("click",u),xo(i,()=>void h(),u),ct(t,[l,d])}function za(o,e){const{sidebar:t,client:s}=o,n=e.id;rt(t,co(e.color),`#${n}`);const a=o.terms().find(p=>p.id===n),i=Pe(t,f("Name"),e.name,f("Name")),r=Xt(t,a?.slug||""),c=lt(t,e.description||"");_o(t,W(de("%d post in this category.","%d posts in this category.",e.count),e.count));const l=fe("secondary",f("+ Child"));l.addEventListener("click",()=>{o.setDraft({parent:n}),ie(o)});const d=e.parent&&e.parent!==0?fe("secondary",f("Make root")):null;d&&(d.title=f("Promote this category to a top-level root (no parent)."),d.addEventListener("click",async()=>{try{await s.updateTerm("categories",n,{parent:0});const p=o.node(n);p&&(p.parent=0),o.setTerms(o.terms().map(m=>m.id===n?{...m,parent:0}:m)),o.buildTree(),ie(o)}catch(p){o.toast(f("Couldn’t reparent:"),p)}}));const u=fe("primary",f("Save"));u.addEventListener("click",async()=>{const p=i.value.trim();if(!p)return;const m=c.value,_=r.value.trim(),g=a?.slug??"";if(p===e.name&&m===(e.description||"")&&_===g)return;const b={name:p,description:m};_!==g&&(b.slug=_);try{const v=await s.updateTerm("categories",n,b),S=o.node(n);S&&(S.name=v.name,S.description=v.description),o.setTerms(o.terms().map(T=>T.id===n?{...T,name:v.name,description:v.description,slug:v.slug||T.slug}:T)),o.relayoutNode(n),ie(o)}catch(v){o.toast(f("Couldn’t save:"),v)}});const h=yo(async()=>{try{await s.deleteTerm("categories",n),o.setTerms(o.terms().filter(p=>p.id!==n)),o.setFocus(null),o.clearPosts(),o.buildTree(),ie(o)}catch(p){o.toast(f("Couldn’t delete:"),p)}});ct(t,d?[l,d,u,h]:[l,u,h])}function ie(o){o.sidebar.replaceChildren();const e=o.draft();if(e!==null){Pa(o,e);return}const t=o.focusId();if(t===null){vo(o.sidebar,"dashicons-admin-tools",f("No category selected"),f("Click a node on the mindmap to edit its name, description, and posts."));return}const s=o.node(t);if(!s){o.setFocus(null),ie(o);return}za(o,s)}const ko=22,Ra=48;function wo(o,e){const t=Math.max(1,...e.map(s=>s.count));return ko+(Ra-ko)*Math.sqrt(o/t)}function Yt(o){return o.isDefault||o.id===1||o.slug==="uncategorized"||o.name.toLowerCase()==="uncategorized"}async function Na(o,e){const t=await po(o,e,{taxonomy:"categories",restTaxonomy:"category",modifier:"os-mindmap",unavailable:f("Mindmap unavailable."),loadFailed:f("Couldn’t load categories:"),emptyHint:f('No custom categories yet. Click "Add root category" to start branching.'),chrome:{buttons:[{variant:"primary",icon:"dashicons-plus",label:f("Add root category")},{icon:"dashicons-image-rotate",label:f("Recenter")}],searchPlaceholder:f("Search categories…"),searchAria:f("Search categories in the mindmap"),hint:f("Click a node to focus + edit · drag onto another to reparent · scroll or pinch to zoom")},layers:["edge","postEdge","post","node","chip","postChip"],fan:{chipFontSize:14,chipTextRes:Ae,pagerLabelSize:14,pagerGlyphSize:16,pagerTextRes:Ae}});if(!t)return()=>{};const s=t,{pixi:n,layers:a,fan:i,camera:r,interaction:c,world:l,palette:d}=s,{client:u}=e,h=new n.Graphics;a.edge.addChild(h);const p=new Map,m=Ta(n,a.chip,c,{palette:d,isFocused:k=>i.focusId===k,onTap:k=>void s.focusOn(k)});let _=null,g=null,b=null,v={x:0,y:0};const S=new Map;let T=null,z=it(o);const P=k=>lo((z+k*47)%360,55,52);function y(k,x){let A=p.get(k.id);if(A)A.parent=k.parent,A.name=k.name,A.description=k.description,A.count=k.count,A.depth=x.depth,A.color=x.color,A.radius=x.radius,A.tx=x.tx,A.ty=x.ty,A.pinned=x.pinned;else{const w=new n.Graphics;w.eventMode="static",w.cursor="pointer",A={id:k.id,parent:k.parent,name:k.name,description:k.description,count:k.count,x:x.tx,y:x.ty,tx:x.tx,ty:x.ty,radius:x.radius,depth:x.depth,color:x.color,gfx:w,pinned:x.pinned},a.node.addChild(w);const $=A;w.on("pointerdown",I=>R(I,$)),p.set(k.id,A)}return le(n,A,!1,d),A}function E(){const k=s.terms,x=new Map;for(const V of k){const L=x.get(V.parent)??[];L.push(V),x.set(V.parent,L)}const A=x.get(0)??[],w=A.filter(V=>!Yt(V)),$=A.find(Yt),I=(V,L,Y,ae,me)=>{const J=w.length>1?110+w.length*28:0,be=$?Math.max(J,140):J,xe=L===0?be:be+160+(L-1)*150,Qa=L===0?P(Y):p.get(V.parent)?.color??P(Y);y(V,{tx:xe*Math.cos(ae),ty:xe*Math.sin(ae),radius:wo(V.count,k),depth:L,color:Qa,pinned:L===0});const ss=x.get(V.id)??[];if(ss.length>0){const Lo=me/ss.length;ss.forEach((er,tr)=>I(er,L+1,Y,ae-me/2+Lo*(tr+.5),Lo*.85))}},N=new Set(k.map(V=>V.id));for(const[V,L]of p)N.has(V)||(a.node.removeChild(L.gfx),L.gfx.destroy(),p.delete(V),m.destroy(V));const K=Math.max(1,w.length);w.forEach((V,L)=>I(V,0,L,2*Math.PI/K*L,2*Math.PI/K)),$&&y($,{tx:0,ty:0,radius:wo($.count,k),depth:0,color:9211796,pinned:!0}),s.syncEmptyHint(k.length<=1)}function M(){h.clear();for(const k of p.values()){const x=k.parent?p.get(k.parent):void 0;if(!x)continue;const A=_!==null&&k===_,w=i.focusId!==null&&(k.id===i.focusId||k.parent===i.focusId),$=i.focusId!==null&&!w?.35:1;Gt(h,x.x,x.y,k.x,k.y,x.color,A?{dashed:!0,alpha:.28*$}:{alpha:.5*$})}if(_&&g){const{x:k,y:x}=_,{x:A,y:w,color:$}=g;Gt(h,k,x,A,w,$,{alpha:.22,width:9}),Gt(h,k,x,A,w,$,{alpha:.95,width:2.5,dashed:!0,dashStride:2,dashPhase:Math.floor(performance.now()/70)});const I=performance.now()%1300/1300,N=A-k,K=ho(I,k,x,k+N*.5,x,A-N*.5,w,A,w);h.circle(K.x,K.y,5),h.fill({color:16777215,alpha:.95}),h.stroke({color:$,width:2,alpha:1})}i.drawEdges()}function R(k,x){if(ne(c))return;ve(c,k),_=x,x.pinned=!0,x.tx=x.x,x.ty=x.y,b={x:k.global.x,y:k.global.y};const A=r.stageToWorld(k.global);v={x:x.x-A.x,y:x.y-A.y}}function H(k,x){let A=p.get(x),w=32;for(;A&&w-- >0;){if(A.id===k)return!0;if(!A.parent)return!1;A=p.get(A.parent)}return!1}function U(k){if(!_)return;const x=k.x+v.x,A=k.y+v.y;_.x=x,_.y=A,_.tx=x,_.ty=A,_.gfx.x=x,_.gfx.y=A;let w=null;for(const $ of p.values()){if($===_)continue;const I=$.x-k.x,N=$.y-k.y;if(I*I+N*N<$.radius*$.radius){w=$;break}}w!==g&&(g&&le(n,g,i.focusId===g.id,d),g=w,w&&fo(n,w,_.color,d))}async function j(k){if(!_)return;const x=_,A=g,w=ro(b,k);if(_=null,g=null,b=null,x.pinned=x.depth===0,!A&&w<2){s.focusOn(x.id);return}if(A&&A.id!==x.parent&&!H(x.id,A.id))try{await u.updateTerm("categories",x.id,{parent:A.id}),x.parent=A.id,s.terms=s.terms.map($=>$.id===x.id?{...$,parent:A.id}:$),E()}catch($){e.toast(f("Reparent failed:"),$)}else le(n,x,i.focusId===x.id,d),A&&le(n,A,i.focusId===A.id,d)}const G={sidebar:s.sidebar,client:u,toast:e.toast,terms:()=>s.terms,setTerms:k=>{s.terms=k},node:k=>p.get(k),focusId:()=>i.focusId,setFocus:k=>{i.focusId=k},draft:()=>T,setDraft:k=>{T=k&&k.parent!==0&&!p.get(k.parent)?T:k},clusterColor:P,buildTree:E,relayoutNode:k=>{const x=p.get(k);x&&m.relayout(x)},clearPosts:()=>i.clear(),loadPosts:()=>i.load()};function q(){if(p.size===0)return null;const k=30,x={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const A of p.values())x.minX=Math.min(x.minX,A.tx-A.radius),x.minY=Math.min(x.minY,A.ty-A.radius),x.maxX=Math.max(x.maxX,A.tx+A.radius),x.maxY=Math.max(x.maxY,A.ty+A.radius+k);return x}const[D,O]=s.chrome.buttons;return O.addEventListener("click",()=>s.recenter()),D.addEventListener("click",()=>{T={parent:0},ie(G)}),E(),ie(G),La(p,80),s.start({themeChanged:()=>{const k=it(o);if(k!==z){z=k;const x=s.terms.filter(A=>!A.parent&&!Yt(A));for(const A of p.values()){let w=A;const $=new Set;for(;w.parent&&p.has(w.parent)&&!$.has(w.id);)$.add(w.id),w=p.get(w.parent);const I=x.findIndex(N=>N.id===w.id);I>=0&&(A.color=P(I))}}for(const x of p.values())le(n,x,i.focusId===x.id,d),m.relayout(x)},center:k=>{const x=p.get(k);return x?{x:x.x,y:x.y,tone:x.color}:null},countReconciled:(k,x)=>{const A=p.get(k);A&&A.count!==x&&(A.count=x,s.terms=s.terms.map(w=>w.id===k?{...w,count:x}:w),m.relayout(A))},focusChanged:()=>{for(const k of p.values())le(n,k,i.focusId===k.id,d);ie(G)},focusOpened:k=>{S.clear();for(const x of p.values()){if(x.id===i.focusId||!x.pinned)continue;const A=x.x-k.x,w=x.y-k.y,$=Math.sqrt(A*A+w*w)||1;if($>=jt+x.radius)continue;S.set(x.id,{tx:x.tx,ty:x.ty});const I=jt+x.radius+20;x.tx=k.x+A/$*I,x.ty=k.y+w/$*I}},focusClosed:()=>{for(const[k,x]of S){const A=p.get(k);A&&(A.tx=x.tx,A.ty=x.ty)}S.clear()},bounds:q,frame:k=>{mo(p,k,{dragNode:_,focusId:i.focusId,nudge:s.nudge}),i.ease(),M(),_&&g&&fo(n,g,_.color,d);const x=1/Math.max(.01,l.scale.x);m.sync(p,x,i.focusId),i.syncChips(x)},countsChanged:()=>{for(const k of s.terms){const x=p.get(k.id);x&&x.count!==k.count&&(x.count=k.count,m.relayout(x))}E(),r.fitToView(q(),{animate:!0})},dragging:()=>_!==null,pointerMove:(k,x)=>_?(U(x),!0):!1,pointerUp:j,cancelGesture:()=>{_&&(_.pinned=_.depth===0,le(n,_,i.focusId===_.id,d)),g&&le(n,g,i.focusId===g.id,d),_=null,g=null,b=null},search:k=>Array.from(p.values()).filter(x=>x.name.toLowerCase().includes(k))}),()=>s.teardown()}const Da=F`: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:var( --os-ui-field-font-size-compact,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}`,Ge=class Ge extends X{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,s=this.readonly!==null,n=this.removable!==null||this.removable===null&&!s,a=this.creatable!==null,i=this["add-label"]||"Add",r=this.placeholder||"Add a tag…";return C`
764 766 <span
765 767 class="os-tag-input"
766 768 role="group"
767 769 aria-label=${this.label??""}
@@ -768,11 +770,11 @@
768 770 >
769 771 ${this._renderChips(n,t)}
770 772 ${this._renderTrailing({isOpen:e,readonly:s,disabled:t,placeholder:r,creatable:a,addLabel:i})}
771 773 </span>
772 - `}_renderTrailing(e){return e.isOpen?this._renderEditor(e.placeholder,e.creatable):e.readonly||e.disabled?k``:this._renderTrigger(e.addLabel)}_renderChips(e,t){const s=this._value;return s.length===0?k``:k`
774 + `}_renderTrailing(e){return e.isOpen?this._renderEditor(e.placeholder,e.creatable):e.readonly||e.disabled?C``:this._renderTrigger(e.addLabel)}_renderChips(e,t){const s=this._value;return s.length===0?C``:C`
773 775 <span class="os-tag-input__chips" role="list">
774 - ${s.map((n,a)=>{const i=n.tone??"neutral";return k`
776 + ${s.map((n,a)=>{const i=n.tone??"neutral";return C`
775 777 <os-chip
776 778 role="listitem"
777 779 size="compact"
778 780 tone=${i}
@@ -786,9 +788,9 @@
786 788 @focus=${()=>this._focusedChip=a}
787 789 ></os-chip>
788 790 `})}
789 791 </span>
790 - `}_renderTrigger(e){const t=this.disabled!==null;return k`
792 + `}_renderTrigger(e){const t=this.disabled!==null;return C`
791 793 <button
792 794 type="button"
793 795 class="os-tag-input__add"
794 796 aria-label=${e}
@@ -796,12 +798,12 @@
796 798 aria-expanded="false"
797 799 ?disabled=${t}
798 800 @click=${()=>this.openInput()}
799 801 >
800 - ${ka()}
802 + ${Oa()}
801 803 <span>${e}</span>
802 804 </button>
803 - `}_renderEditor(e,t){const s=this._suggestions.length>0||this._suggestionsLoading||t&&this._query.trim().length>0;return k`
805 + `}_renderEditor(e,t){const s=this._suggestions.length>0||this._suggestionsLoading||t&&this._query.trim().length>0;return C`
804 806 <span class="os-tag-input__editor">
805 807 <input
806 808 class="os-tag-input__input"
807 809 type="text"
@@ -816,27 +818,27 @@
816 818 @input=${n=>this._onInput(n)}
817 819 @keydown=${n=>this._onInputKeyDown(n)}
818 820 @blur=${n=>this._onInputBlur(n)}
819 821 />
820 - ${s?this._renderSuggestions(t):k``}
822 + ${s?this._renderSuggestions(t):C``}
821 823 </span>
822 - `}_renderSuggestions(e){const t=this._query.trim(),s=this._suggestions,n=e&&t.length>0&&!s.some(a=>a.label.toLowerCase()===t.toLowerCase())&&!this._value.some(a=>a.label.toLowerCase()===t.toLowerCase());return k`
824 + `}_renderSuggestions(e){const t=this._query.trim(),s=this._suggestions,n=e&&t.length>0&&!s.some(a=>a.label.toLowerCase()===t.toLowerCase())&&!this._value.some(a=>a.label.toLowerCase()===t.toLowerCase());return C`
823 825 <div
824 826 class="os-tag-input__suggestions"
825 827 role="listbox"
826 828 >
827 - ${this._suggestionsLoading?k`
829 + ${this._suggestionsLoading?C`
828 830 <div class="os-tag-input__suggestion-loading">
829 831 <span class="os-tag-input__suggestion-spinner" aria-hidden="true"></span>
830 832 <span>Searching…</span>
831 833 </div>
832 - `:k``}
833 - ${s.length===0&&!this._suggestionsLoading&&!n?k`
834 + `:C``}
835 + ${s.length===0&&!this._suggestionsLoading&&!n?C`
834 836 <div class="os-tag-input__suggestion-empty">
835 837 ${t.length>0?"No matches.":"Type to search."}
836 838 </div>
837 - `:k``}
838 - ${s.map((a,i)=>{const r=i===this._highlight;return k`
839 + `:C``}
840 + ${s.map((a,i)=>{const r=i===this._highlight;return C`
839 841 <div
840 842 id=${`os-tag-suggestion-${i}`}
841 843 role="option"
842 844 aria-selected=${r?"true":"false"}
@@ -846,9 +848,9 @@
846 848 >
847 849 <span>${a.label}</span>
848 850 </div>
849 851 `})}
850 - ${n?k`
852 + ${n?C`
851 853 <div
852 854 id=${`os-tag-suggestion-${s.length}`}
853 855 role="option"
854 856 aria-selected=${this._highlight===s.length?"true":"false"}
@@ -857,7 +859,7 @@
857 859 @mouseenter=${()=>{this._highlight=s.length,this.requestUpdate()}}
858 860 >
859 861 Create "${t}"
860 862 </div>
861 - `:k``}
863 + `:C``}
862 864 </div>
863 - `}_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,s=this._suggestions,n=this._query.trim(),a=t&&n.length>0&&!s.some(r=>r.label.toLowerCase()===n.toLowerCase())&&!this._value.some(r=>r.label.toLowerCase()===n.toLowerCase()),i=s.length+(a?1:0);switch(e.key){case"ArrowDown":{if(i===0)return;e.preventDefault(),this._highlight=this._highlight+1>=i?0:this._highlight+1,this.requestUpdate();return}case"ArrowUp":{if(i===0)return;e.preventDefault(),this._highlight=this._highlight<=0?i-1:this._highlight-1,this.requestUpdate();return}case"Enter":{if(e.preventDefault(),this._highlight>=0&&this._highlight<s.length){this._addSuggestion(s[this._highlight],!1);return}if(this._highlight===s.length&&a){this._addSuggestion({label:n},!0);return}if(a&&n.length>0){this._addSuggestion({label:n},!0);return}return}case"Escape":{e.preventDefault(),this.closeInput();return}case"Backspace":{if(this._query===""&&this._value.length>0){e.preventDefault();const r=this._value.length-1;this._focusedChip===r?(this.emit("os-tag-remove",{tag:this._value[r]}),this._focusedChip=-1):(this._focusedChip=r,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(n=>n.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()})}};Ge.props=["label","placeholder","add-label","creatable","removable","disabled","readonly","size","min-query","open"],Ge.styles=[xa],Ge.help=void 0;let Yt=Ge;Q("os-tag-input",Yt);function ka(){return se("plus",{size:14})}function wa(o,e){const{client:t}=e,s=document.createElement("span");s.style.cssText="display:inline-flex;align-items:center;width:100%;min-width:0;";const n=document.createElement("os-tag-input");n.setAttribute("creatable",""),n.setAttribute("removable",""),n.setAttribute("min-query","0"),n.setAttribute("placeholder",f("Add tag…")),n.setAttribute("add-label",f("Tag")),n.setAttribute("data-noclick","");const a=xt(o,"post_tag").map(c=>({id:c.id,label:c.name}));n.value=a;const i={tags:a.slice(),suggestAbort:null,suggestDebounce:null,lastQuery:""},r=c=>{i.tags=c.slice(),n.value=c};return n.addEventListener("os-tag-suggest",c=>{const l=c.detail?.query??"";i.lastQuery=l,i.suggestDebounce!==null&&window.clearTimeout(i.suggestDebounce),i.suggestDebounce=window.setTimeout(async()=>{i.suggestDebounce=null,i.suggestAbort?.abort();const u=new AbortController;i.suggestAbort=u;try{const d=await t.searchTags(l,u.signal);if(i.lastQuery!==l)return;const h=new Set(i.tags.map(p=>p.id));n.suggestions=d.filter(p=>!h.has(p.id)).map(p=>({id:p.id,label:p.name}))}catch(d){if(d?.name==="AbortError")return;n.suggestions=[],console.warn("[openstation:desktop-mode-posts] tag search failed",d)}finally{n.suggestionsLoading=!1}},200)}),n.addEventListener("os-tag-add",async c=>{const l=c.detail;if(l?.tag){r([...i.tags,{id:l.tag.id,label:l.tag.label,pending:!0}]);try{const u=l.isNew||typeof l.tag.id!="number"?await t.createTag(l.tag.label):{id:Number(l.tag.id),name:l.tag.label,slug:""},d=[...i.tags.filter(h=>!h.pending).map(h=>Number(h.id)),u.id];await t.updatePostTags(o.id,d),r(i.tags.map(h=>h.label.toLowerCase()===l.tag.label.toLowerCase()?{id:u.id,label:u.name}:h)),e.announce("tagged",[o.id])}catch(u){r(i.tags.filter(d=>d.label.toLowerCase()!==l.tag.label.toLowerCase())),e.toast(V(f('Couldn’t add tag "%s".'),l.tag.label),u)}}}),n.addEventListener("os-tag-remove",async c=>{const l=c.detail;if(!l?.tag)return;const u=l.tag,d=i.tags.slice();r(i.tags.map(h=>h.label===u.label?{...h,pending:!0}:h));try{const h=d.filter(p=>p.label!==u.label).map(p=>Number(p.id)).filter(p=>Number.isFinite(p));await t.updatePostTags(o.id,h),r(d.filter(p=>p.label!==u.label)),e.announce("untagged",[o.id])}catch(h){r(d),e.toast(V(f('Couldn’t remove tag "%s".'),u.label),h)}}),s.appendChild(n),s}const ze=11,Ca=6,Zt=4,mo=8,bo=22,_o=o=>eo(o,70,48);function $a(o,e,t,s,n){const a=new o.Container;a.eventMode="static",a.cursor="pointer";const i=new o.Graphics,r=new o.Graphics,c=(h,p,g,m)=>new o.Text({text:h,style:{fill:p,fontSize:g,fontFamily:Ee,fontWeight:m},resolution:Ae}),l=c("#",n.accent,s,"700"),u=c(Te(t.name,bo),n.fg,s,"600"),d=c(String(t.count),n.fg,Math.max(10,Math.round(s*.55)),"700");for(const h of[i,r,l,u,d])a.addChild(h);return e.addChild(a),{container:a,shadow:i,bg:r,hashText:l,nameText:u,countText:d,cachedHover:!1}}function Sa(o,e,t){const s=o.chip,n=Te(o.name,bo),a=String(o.count);s.nameText.text!==n&&(s.nameText.text=n),s.countText.text!==a&&(s.countText.text=a),s.nameText.style.fontSize=o.fontSize,s.hashText.style.fontSize=o.fontSize,s.countText.style.fontSize=Math.max(10,Math.round(o.fontSize*.55));const i=s.nameText.height,r=Math.max(18,s.countText.width+10),c=Math.max(14,s.countText.height+4);o.width=ze+s.hashText.width+Zt+s.nameText.width+mo+r+ze,o.height=Math.max(i,c)+Ca*2,vo(o,e,t)}function vo(o,e,t){const s=o.chip,n=o.width,a=o.height,i=-n/2,r=-a/2,c=a/2,l=e||s.cachedHover?t.raised:t.surface,u=e?t.accent:t.border,d=_o(o.hue);s.shadow.clear(),s.shadow.roundRect(i-1,r+3,n+2,a+2,c+1);let h=.1;e?h=.18:s.cachedHover&&(h=.16),s.shadow.fill({color:0,alpha:h}),s.bg.clear(),s.bg.roundRect(i,r,n,a,c),s.bg.fill(l),s.bg.stroke({color:u,width:e?2:1.25,alpha:e?1:.85});const p=s.hashText.width,g=s.nameText.width,m=s.nameText.height,b=s.countText.width,w=s.countText.height,$=Math.max(18,b+10),M=Math.max(14,w+4);s.hashText.x=i+ze,s.hashText.y=(a-m)/2+r,s.hashText.style.fill=t.accent,s.nameText.x=i+ze+p+Zt,s.nameText.y=(a-m)/2+r,s.nameText.style.fill=t.fg;const R=i+ze+p+Zt+g+mo,O=(a-M)/2+r;s.bg.roundRect(R,O,$,M,M/2),s.bg.fill(d),s.countText.x=R+($-b)/2,s.countText.y=O+(M-w)/2,s.countText.style.fill=so(d,t)}const yo=11,Ea=28,Aa=14;function xo(o,e){const t=Math.sqrt(o/Math.max(1,e));return Math.round(yo+(Ea-yo)*t)}function Ta(o,e){return o.x<e.x+e.w&&o.x+o.w>e.x&&o.y<e.y+e.h&&o.y+o.h>e.y}function ko(o){let e=0;for(let t=0;t<o.length;t++)e=(e*31+o.charCodeAt(t))%2147483647;return e}function Jt(o,e){return((e+ko(o)%256*1.4)%360+360)%360}function wo(o){const e=ko(o);return(e%2===0?-1:1)*(Math.floor(e/2)%4)*.011}function Ma(o,e,t,s=0,n=0){if(t.length===0)return{x:s,y:n};const a=Aa,i=(c,l)=>{const u={x:c-o/2-a,y:l-e/2-a,w:o+a*2,h:e+a*2};return!t.some(d=>Ta(u,d))};if(i(s,n))return{x:s,y:n};let r=0;for(let c=0;c<1e4;c++){r+=.18;const l=r*5,u=s+l*Math.cos(r),d=n+l*Math.sin(r)*.7;if(i(u,d))return{x:u,y:d}}return{x:s,y:n+(t.length+1)*(e+a)}}function Qt(o,e,t,s){let n=0;const a=()=>{const i=n++;if(i===0)return{x:0,y:0};const r=i*2.4,c=120+i*70;return{x:c*Math.cos(r),y:c*Math.sin(r)*.8}};for(const i of o){let r=0,c=0,l=!1;const u=s.get(i.id);if(u&&u.length>0){let h=0,p=0,g=0;for(const m of u){const b=t.get(m.id);b&&(h+=b.x*m.shared,p+=b.y*m.shared,g+=m.shared)}g>0&&(r=h/g,c=p/g,l=!0)}if(!l){const h=a();r=h.x,c=h.y}const d=Ma(i.width,i.height,e,r,c);i.tx=d.x,i.ty=d.y,t.set(i.id,{x:d.x,y:d.y}),e.push({x:d.x-i.width/2,y:d.y-i.height/2,w:i.width,h:i.height})}}function Ia(){try{const o=window.location.host||"unknown",e=window.location.pathname.replace(/\/?wp-admin\/?.*$/,"");return`os-tagcloud-positions:${o}${e}`}catch{return"os-tagcloud-positions:fallback"}}function La(o){const e=new Map;try{const t=window.localStorage.getItem(o),s=t?JSON.parse(t):null;if(!s||typeof s!="object")return e;for(const[n,a]of Object.entries(s)){const i=parseInt(n,10),r=a;Number.isFinite(i)&&typeof r?.x=="number"&&typeof r?.y=="number"&&e.set(i,{x:r.x,y:r.y})}}catch{}return e}function es(o,e){try{const t={};for(const[s,n]of e)t[String(s)]=n;window.localStorage.setItem(o,JSON.stringify(t))}catch{}}function Pa(o){const{sidebar:e,client:t}=o;at(e,`hsl( ${o.themeHue}deg 60% 55% )`,f("New tag"));const s=Pe(e,f("Name"),"",f("e.g. featured"));requestAnimationFrame(()=>s.focus());const n=rt(e,""),a=fe("primary",f("Create")),i=fe("danger",f("Cancel")),r=()=>{o.setDraft(!1),ce(o)},c=async()=>{const l=s.value.trim();if(!l){s.focus();return}a.disabled=!0;try{const u=await t.createTag(l),d={id:u.id,name:u.name,slug:u.slug||"",parent:0,count:0,description:u.description||"",isDefault:!1};o.terms().some(p=>p.id===d.id)||o.setTerms(o.terms().concat(d));const h=n.value.trim();if(h)try{const p=await t.updateTerm("tags",u.id,{description:h});o.setTerms(o.terms().map(g=>g.id===p.id?{...g,description:p.description||h}:g))}catch(p){o.toast(f("Tag created but description failed:"),p)}o.setDraft(!1),o.buildCloud(),o.setFocus(u.id),ce(o),await o.loadPosts()}catch(u){a.disabled=!1,o.toast(f("Couldn’t create:"),u)}};a.addEventListener("click",()=>void c()),i.addEventListener("click",r),ho(s,()=>void c(),r),lt(e,[a,i])}function za(o,e){const{sidebar:t,client:s}=o,n=e.id;at(t,`hsl( ${e.hue}deg 60% 55% )`,`#${n}`);const a=o.terms().find(d=>d.id===n),i=Pe(t,f("Name"),e.name,f("Name")),r=Gt(t,a?.slug||""),c=rt(t,e.description||"");co(t,V(de("%d post tagged with this.","%d posts tagged with this.",e.count),e.count));const l=fe("primary",f("Save"));l.addEventListener("click",async()=>{const d=i.value.trim();if(!d)return;const h=c.value,p=r.value.trim(),g=a?.slug??"";if(d===e.name&&h===(e.description||"")&&p===g)return;const m={name:d,description:h};p!==g&&(m.slug=p);try{const b=await s.updateTerm("tags",n,m);o.applyTagUpdate(n,{name:b.name,description:b.description,slug:b.slug||e.slug}),o.setTerms(o.terms().map(w=>w.id===n?{...w,name:b.name,description:b.description,slug:b.slug||w.slug}:w)),ce(o)}catch(b){o.toast(f("Couldn’t save:"),b)}});const u=po(async()=>{try{await s.deleteTerm("tags",n),o.setTerms(o.terms().filter(d=>d.id!==n)),o.forgetTag(n),o.setFocus(null),o.clearPosts(),o.buildCloud(),ce(o)}catch(d){o.toast(f("Couldn’t delete:"),d)}});lt(t,[l,u])}function ce(o){if(o.sidebar.replaceChildren(),o.draft()){Pa(o);return}const e=o.focusId();if(e===null){uo(o.sidebar,"dashicons-tag",f("No tag selected"),f("Click a tag on the cloud to edit it, or click + Add tag to create a new one."));return}const t=o.tag(e);if(!t){o.setFocus(null),ce(o);return}za(o,t)}async function Ra(o,e){const t=await oo(o,e,{taxonomy:"tags",restTaxonomy:"post_tag",modifier:"os-tagcloud",unavailable:f("Tag cloud unavailable."),loadFailed:f("Couldn’t load tags:"),emptyHint:f('No tags yet. Click "Add tag" to start building the cloud.'),chrome:{buttons:[{variant:"primary",icon:"dashicons-plus",label:f("Add tag")},{icon:"dashicons-image-rotate",label:f("Recenter")},{icon:"dashicons-grid-view",label:f("Reflow"),title:f("Recompute the chip layout from scratch — discards manual repositioning.")}],searchPlaceholder:f("Search tags…"),searchAria:f("Search tags in the cloud"),hint:f("Click a tag to focus + edit · drag to reposition · scroll or pinch to zoom")},layers:["postEdge","chip","post","postChip"],fan:{chipFontSize:12,chipTextRes:Ae,pagerLabelSize:12,pagerGlyphSize:14}});if(!t)return()=>{};const s=t,{pixi:n,layers:a,fan:i,camera:r,interaction:c,world:l,palette:u}=s,{client:d}=e,h=new Map;let p=null,g={x:0,y:0},m=null,b=null,w=!1;const $=Ia(),M=La($);let R=new Map,O=nt(o);const I=y=>i.focusId===y,x=y=>Sa(y,I(y.id),u),E=y=>vo(y,I(y.id),u);function P(){const y=s.terms,C=new Set(y.map(T=>T.id));for(const[T,Y]of h)C.has(T)||(a.chip.removeChild(Y.chip.container),Y.chip.container.destroy({children:!0}),h.delete(T));const A=Math.max(1,...y.map(T=>T.count)),L=[];for(const T of y){const Y=xo(T.count,A),ae=Jt(T.slug||T.name,O),me=wo(T.slug||T.name),J=h.get(T.id);if(J){J.name=T.name,J.slug=T.slug,J.description=T.description,J.count=T.count,J.fontSize=Y,J.hue=ae,J.rotation=me,x(J);continue}const be=M.get(T.id),xe={id:T.id,name:T.name,slug:T.slug,description:T.description,count:T.count,fontSize:Y,hue:ae,rotation:me,x:be?.x??0,y:be?.y??0,tx:be?.x??0,ty:be?.y??0,width:0,height:0,chip:$a(n,a.chip,T,Y,u)};h.set(T.id,xe),x(xe),N(xe),be||L.push(xe)}const K=[],W=new Map;for(const T of h.values())L.includes(T)||(K.push({x:T.tx-T.width/2,y:T.ty-T.height/2,w:T.width,h:T.height}),W.set(T.id,{x:T.tx,y:T.ty}));L.sort((T,Y)=>Y.count-T.count),Qt(L,K,W,R);for(const T of L)T.x=T.tx,T.y=T.ty;s.syncEmptyHint(y.length===0)}function N(y){const C=y.chip.container;C.on("pointerdown",A=>{if(ne(c))return;const L=A;ve(c,A),p=y,b={x:y.tx,y:y.ty},m={x:L.global.x,y:L.global.y};const K=r.stageToWorld(L.global);g={x:y.x-K.x,y:y.y-K.y}}),C.on("pointerover",()=>{y.chip.cachedHover=!0,E(y)}),C.on("pointerout",()=>{y.chip.cachedHover=!1,E(y)})}function F(y){const C=s.nudge;for(const A of h.values()){if(A===p)continue;let L=A.tx,K=A.ty;if(C&&A.id!==i.focusId){const T=A.tx-C.x,Y=A.ty-C.y,ae=Math.sqrt(T*T+Y*Y)||1,me=C.radius+Math.max(A.width,A.height)/2;if(ae<me){const J=me+12;L=C.x+T/ae*J,K=C.y+Y/ae*J}}const W=1-Math.exp(-y*.012);A.x+=(L-A.x)*W,A.y+=(K-A.y)*W}}function U(){const y=1/Math.max(.01,l.scale.x),C=i.focusId!==null;for(const A of h.values()){const L=A.chip.container;L.x=A.x,L.y=A.y,L.scale.set(1),L.rotation=A.rotation;const K=!C||i.focusId===A.id?1:.32;Math.abs(L.alpha-K)>.005?L.alpha+=(K-L.alpha)*.18:L.alpha=K}i.syncChips(y)}function j(y){if(!p)return;const C=p,A=Qs(m,y);p=null,m=null,A<3?s.focusOn(C.id):(M.set(C.id,{x:C.tx,y:C.ty}),es($,M))}const G={sidebar:s.sidebar,client:d,toast:e.toast,themeHue:O,terms:()=>s.terms,setTerms:y=>{s.terms=y},tag:y=>h.get(y),focusId:()=>i.focusId,setFocus:y=>{i.focusId=y},draft:()=>w,setDraft:y=>{w=y},applyTagUpdate:(y,C)=>{const A=h.get(y);A&&(A.name=C.name,A.description=C.description,A.slug=C.slug,A.hue=Jt(A.slug||A.name,O),A.rotation=wo(A.slug||A.name),x(A))},forgetTag:y=>{M.delete(y),es($,M)},buildCloud:P,clearPosts:()=>i.clear(),loadPosts:()=>i.load()};function q(){if(h.size===0)return null;const y={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const C of h.values())y.minX=Math.min(y.minX,C.tx-C.width/2),y.minY=Math.min(y.minY,C.ty-C.height/2),y.maxX=Math.max(y.maxX,C.tx+C.width/2),y.maxY=Math.max(y.maxY,C.ty+C.height/2);return y}function z(){const y=[],C=new Map,A=[];for(const L of h.values())M.has(L.id)?(y.push({x:L.tx-L.width/2,y:L.ty-L.height/2,w:L.width,h:L.height}),C.set(L.id,{x:L.tx,y:L.ty})):A.push(L);A.sort((L,K)=>K.count-L.count),Qt(A,y,C,R)}async function D(){try{R=await d.fetchTagCooccurrence("tags",8),R.size>0&&z()}catch{}}const[v,_,S]=s.chrome.buttons;return _.addEventListener("click",()=>s.recenter()),v.addEventListener("click",()=>{w=!0,ce(G)}),S.addEventListener("click",()=>{M.clear(),es($,M);for(const C of h.values())C.tx=0,C.ty=0;const y=Array.from(h.values()).sort((C,A)=>A.count-C.count);Qt(y,[],new Map,R),r.fitToView(q(),{animate:!0}),D()}),P(),ce(G),s.start({themeChanged:()=>{O=nt(o);for(const y of h.values())y.hue=Jt(y.slug||y.name,O),E(y)},center:y=>{const C=h.get(y);return C?{x:C.x,y:C.y,tone:_o(C.hue)}:null},countReconciled:(y,C)=>{const A=h.get(y);A&&A.count!==C&&(A.count=C,s.terms=s.terms.map(L=>L.id===y?{...L,count:C}:L),x(A))},focusChanged:()=>{for(const y of h.values())E(y);ce(G)},bounds:q,frame:y=>{F(y),i.ease(),i.drawEdges(),U()},countsChanged:()=>{const y=Math.max(1,...s.terms.map(C=>C.count));for(const C of s.terms){const A=h.get(C.id);A&&(A.count=C.count,A.fontSize=xo(C.count,y),x(A))}i.focusId!==null&&ce(G)},dragging:()=>p!==null,pointerMove:(y,C)=>p?(p.x=C.x+g.x,p.y=C.y+g.y,p.tx=p.x,p.ty=p.y,!0):!1,pointerUp:j,cancelGesture:()=>{p&&b&&(p.x=p.tx=b.x,p.y=p.ty=b.y),p=null,m=null,b=null},search:y=>Array.from(h.values()).filter(C=>C.name.toLowerCase().includes(y)||C.slug.toLowerCase().includes(y))}),D(),()=>s.teardown()}const Na=Ii("desktop-mode-posts",{cells:{tags:wa,categories:Mn},terms:{categories:ya,tags:Ra}});return ct.default=Na,Object.defineProperties(ct,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),ct}({});
865 + `}_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,s=this._suggestions,n=this._query.trim(),a=t&&n.length>0&&!s.some(r=>r.label.toLowerCase()===n.toLowerCase())&&!this._value.some(r=>r.label.toLowerCase()===n.toLowerCase()),i=s.length+(a?1:0);switch(e.key){case"ArrowDown":{if(i===0)return;e.preventDefault(),this._highlight=this._highlight+1>=i?0:this._highlight+1,this.requestUpdate();return}case"ArrowUp":{if(i===0)return;e.preventDefault(),this._highlight=this._highlight<=0?i-1:this._highlight-1,this.requestUpdate();return}case"Enter":{if(e.preventDefault(),this._highlight>=0&&this._highlight<s.length){this._addSuggestion(s[this._highlight],!1);return}if(this._highlight===s.length&&a){this._addSuggestion({label:n},!0);return}if(a&&n.length>0){this._addSuggestion({label:n},!0);return}return}case"Escape":{e.preventDefault(),this.closeInput();return}case"Backspace":{if(this._query===""&&this._value.length>0){e.preventDefault();const r=this._value.length-1;this._focusedChip===r?(this.emit("os-tag-remove",{tag:this._value[r]}),this._focusedChip=-1):(this._focusedChip=r,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(n=>n.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()})}};Ge.props=["name","label","placeholder","add-label","creatable","removable","disabled","readonly","size","min-query","open"],Ge.styles=[Da],Ge.help=void 0;let Zt=Ge;Q("os-tag-input",Zt);function Oa(){return se("plus",{size:14})}function Ha(o,e){const{client:t}=e,s=document.createElement("span");s.style.cssText="display:inline-flex;align-items:center;width:100%;min-width:0;";const n=document.createElement("os-tag-input");n.setAttribute("creatable",""),n.setAttribute("removable",""),n.setAttribute("min-query","0"),n.setAttribute("placeholder",f("Add tag…")),n.setAttribute("add-label",f("Tag")),n.setAttribute("data-noclick","");const a=kt(o,"post_tag").map(c=>({id:c.id,label:c.name}));n.value=a;const i={tags:a.slice(),suggestAbort:null,suggestDebounce:null,lastQuery:""},r=c=>{i.tags=c.slice(),n.value=c};return n.addEventListener("os-tag-suggest",c=>{const l=c.detail?.query??"";i.lastQuery=l,i.suggestDebounce!==null&&window.clearTimeout(i.suggestDebounce),i.suggestDebounce=window.setTimeout(async()=>{i.suggestDebounce=null,i.suggestAbort?.abort();const d=new AbortController;i.suggestAbort=d;try{const u=await t.searchTags(l,d.signal);if(i.lastQuery!==l)return;const h=new Set(i.tags.map(p=>p.id));n.suggestions=u.filter(p=>!h.has(p.id)).map(p=>({id:p.id,label:p.name}))}catch(u){if(u?.name==="AbortError")return;n.suggestions=[],console.warn("[openstation:desktop-mode-posts] tag search failed",u)}finally{n.suggestionsLoading=!1}},200)}),n.addEventListener("os-tag-add",async c=>{const l=c.detail;if(l?.tag){r([...i.tags,{id:l.tag.id,label:l.tag.label,pending:!0}]);try{const d=l.isNew||typeof l.tag.id!="number"?await t.createTag(l.tag.label):{id:Number(l.tag.id),name:l.tag.label,slug:""},u=[...i.tags.filter(h=>!h.pending).map(h=>Number(h.id)),d.id];await t.updatePostTags(o.id,u),r(i.tags.map(h=>h.label.toLowerCase()===l.tag.label.toLowerCase()?{id:d.id,label:d.name}:h)),e.announce("tagged",[o.id])}catch(d){r(i.tags.filter(u=>u.label.toLowerCase()!==l.tag.label.toLowerCase())),e.toast(W(f('Couldn’t add tag "%s".'),l.tag.label),d)}}}),n.addEventListener("os-tag-remove",async c=>{const l=c.detail;if(!l?.tag)return;const d=l.tag,u=i.tags.slice();r(i.tags.map(h=>h.label===d.label?{...h,pending:!0}:h));try{const h=u.filter(p=>p.label!==d.label).map(p=>Number(p.id)).filter(p=>Number.isFinite(p));await t.updatePostTags(o.id,h),r(u.filter(p=>p.label!==d.label)),e.announce("untagged",[o.id])}catch(h){r(u),e.toast(W(f('Couldn’t remove tag "%s".'),d.label),h)}}),s.appendChild(n),s}const ze=11,qa=6,Jt=4,Co=8,$o=22,So=o=>lo(o,70,48);function Fa(o,e,t,s,n){const a=new o.Container;a.eventMode="static",a.cursor="pointer";const i=new o.Graphics,r=new o.Graphics,c=(h,p,m,_)=>new o.Text({text:h,style:{fill:p,fontSize:m,fontFamily:Ee,fontWeight:_},resolution:Ae}),l=c("#",n.accent,s,"700"),d=c(Te(t.name,$o),n.fg,s,"600"),u=c(String(t.count),n.fg,Math.max(10,Math.round(s*.55)),"700");for(const h of[i,r,l,d,u])a.addChild(h);return e.addChild(a),{container:a,shadow:i,bg:r,hashText:l,nameText:d,countText:u,cachedHover:!1}}function Ua(o,e,t){const s=o.chip,n=Te(o.name,$o),a=String(o.count);s.nameText.text!==n&&(s.nameText.text=n),s.countText.text!==a&&(s.countText.text=a),s.nameText.style.fontSize=o.fontSize,s.hashText.style.fontSize=o.fontSize,s.countText.style.fontSize=Math.max(10,Math.round(o.fontSize*.55));const i=s.nameText.height,r=Math.max(18,s.countText.width+10),c=Math.max(14,s.countText.height+4);o.width=ze+s.hashText.width+Jt+s.nameText.width+Co+r+ze,o.height=Math.max(i,c)+qa*2,Eo(o,e,t)}function Eo(o,e,t){const s=o.chip,n=o.width,a=o.height,i=-n/2,r=-a/2,c=a/2,l=e||s.cachedHover?t.raised:t.surface,d=e?t.accent:t.border,u=So(o.hue);s.shadow.clear(),s.shadow.roundRect(i-1,r+3,n+2,a+2,c+1);let h=.1;e?h=.18:s.cachedHover&&(h=.16),s.shadow.fill({color:0,alpha:h}),s.bg.clear(),s.bg.roundRect(i,r,n,a,c),s.bg.fill(l),s.bg.stroke({color:d,width:e?2:1.25,alpha:e?1:.85});const p=s.hashText.width,m=s.nameText.width,_=s.nameText.height,g=s.countText.width,b=s.countText.height,v=Math.max(18,g+10),S=Math.max(14,b+4);s.hashText.x=i+ze,s.hashText.y=(a-_)/2+r,s.hashText.style.fill=t.accent,s.nameText.x=i+ze+p+Jt,s.nameText.y=(a-_)/2+r,s.nameText.style.fill=t.fg;const T=i+ze+p+Jt+m+Co,z=(a-S)/2+r;s.bg.roundRect(T,z,v,S,S/2),s.bg.fill(u),s.countText.x=T+(v-g)/2,s.countText.y=z+(S-b)/2,s.countText.style.fill=uo(u,t)}const Ao=11,Wa=28,Va=14;function To(o,e){const t=Math.sqrt(o/Math.max(1,e));return Math.round(Ao+(Wa-Ao)*t)}function Ba(o,e){return o.x<e.x+e.w&&o.x+o.w>e.x&&o.y<e.y+e.h&&o.y+o.h>e.y}function Mo(o){let e=0;for(let t=0;t<o.length;t++)e=(e*31+o.charCodeAt(t))%2147483647;return e}function Qt(o,e){return((e+Mo(o)%256*1.4)%360+360)%360}function Io(o){const e=Mo(o);return(e%2===0?-1:1)*(Math.floor(e/2)%4)*.011}function ja(o,e,t,s=0,n=0){if(t.length===0)return{x:s,y:n};const a=Va,i=(c,l)=>{const d={x:c-o/2-a,y:l-e/2-a,w:o+a*2,h:e+a*2};return!t.some(u=>Ba(d,u))};if(i(s,n))return{x:s,y:n};let r=0;for(let c=0;c<1e4;c++){r+=.18;const l=r*5,d=s+l*Math.cos(r),u=n+l*Math.sin(r)*.7;if(i(d,u))return{x:d,y:u}}return{x:s,y:n+(t.length+1)*(e+a)}}function es(o,e,t,s){let n=0;const a=()=>{const i=n++;if(i===0)return{x:0,y:0};const r=i*2.4,c=120+i*70;return{x:c*Math.cos(r),y:c*Math.sin(r)*.8}};for(const i of o){let r=0,c=0,l=!1;const d=s.get(i.id);if(d&&d.length>0){let h=0,p=0,m=0;for(const _ of d){const g=t.get(_.id);g&&(h+=g.x*_.shared,p+=g.y*_.shared,m+=_.shared)}m>0&&(r=h/m,c=p/m,l=!0)}if(!l){const h=a();r=h.x,c=h.y}const u=ja(i.width,i.height,e,r,c);i.tx=u.x,i.ty=u.y,t.set(i.id,{x:u.x,y:u.y}),e.push({x:u.x-i.width/2,y:u.y-i.height/2,w:i.width,h:i.height})}}function Ka(){try{const o=window.location.host||"unknown",e=window.location.pathname.replace(/\/?wp-admin\/?.*$/,"");return`os-tagcloud-positions:${o}${e}`}catch{return"os-tagcloud-positions:fallback"}}function Ga(o){const e=new Map;try{const t=window.localStorage.getItem(o),s=t?JSON.parse(t):null;if(!s||typeof s!="object")return e;for(const[n,a]of Object.entries(s)){const i=parseInt(n,10),r=a;Number.isFinite(i)&&typeof r?.x=="number"&&typeof r?.y=="number"&&e.set(i,{x:r.x,y:r.y})}}catch{}return e}function ts(o,e){try{const t={};for(const[s,n]of e)t[String(s)]=n;window.localStorage.setItem(o,JSON.stringify(t))}catch{}}function Xa(o){const{sidebar:e,client:t}=o;rt(e,`hsl( ${o.themeHue}deg 60% 55% )`,f("New tag"));const s=Pe(e,f("Name"),"",f("e.g. featured"));requestAnimationFrame(()=>s.focus());const n=lt(e,""),a=fe("primary",f("Create")),i=fe("danger",f("Cancel")),r=()=>{o.setDraft(!1),ce(o)},c=async()=>{const l=s.value.trim();if(!l){s.focus();return}a.disabled=!0;try{const d=await t.createTag(l),u={id:d.id,name:d.name,slug:d.slug||"",parent:0,count:0,description:d.description||"",isDefault:!1};o.terms().some(p=>p.id===u.id)||o.setTerms(o.terms().concat(u));const h=n.value.trim();if(h)try{const p=await t.updateTerm("tags",d.id,{description:h});o.setTerms(o.terms().map(m=>m.id===p.id?{...m,description:p.description||h}:m))}catch(p){o.toast(f("Tag created but description failed:"),p)}o.setDraft(!1),o.buildCloud(),o.setFocus(d.id),ce(o),await o.loadPosts()}catch(d){a.disabled=!1,o.toast(f("Couldn’t create:"),d)}};a.addEventListener("click",()=>void c()),i.addEventListener("click",r),xo(s,()=>void c(),r),ct(e,[a,i])}function Ya(o,e){const{sidebar:t,client:s}=o,n=e.id;rt(t,`hsl( ${e.hue}deg 60% 55% )`,`#${n}`);const a=o.terms().find(u=>u.id===n),i=Pe(t,f("Name"),e.name,f("Name")),r=Xt(t,a?.slug||""),c=lt(t,e.description||"");_o(t,W(de("%d post tagged with this.","%d posts tagged with this.",e.count),e.count));const l=fe("primary",f("Save"));l.addEventListener("click",async()=>{const u=i.value.trim();if(!u)return;const h=c.value,p=r.value.trim(),m=a?.slug??"";if(u===e.name&&h===(e.description||"")&&p===m)return;const _={name:u,description:h};p!==m&&(_.slug=p);try{const g=await s.updateTerm("tags",n,_);o.applyTagUpdate(n,{name:g.name,description:g.description,slug:g.slug||e.slug}),o.setTerms(o.terms().map(b=>b.id===n?{...b,name:g.name,description:g.description,slug:g.slug||b.slug}:b)),ce(o)}catch(g){o.toast(f("Couldn’t save:"),g)}});const d=yo(async()=>{try{await s.deleteTerm("tags",n),o.setTerms(o.terms().filter(u=>u.id!==n)),o.forgetTag(n),o.setFocus(null),o.clearPosts(),o.buildCloud(),ce(o)}catch(u){o.toast(f("Couldn’t delete:"),u)}});ct(t,[l,d])}function ce(o){if(o.sidebar.replaceChildren(),o.draft()){Xa(o);return}const e=o.focusId();if(e===null){vo(o.sidebar,"dashicons-tag",f("No tag selected"),f("Click a tag on the cloud to edit it, or click + Add tag to create a new one."));return}const t=o.tag(e);if(!t){o.setFocus(null),ce(o);return}Ya(o,t)}async function Za(o,e){const t=await po(o,e,{taxonomy:"tags",restTaxonomy:"post_tag",modifier:"os-tagcloud",unavailable:f("Tag cloud unavailable."),loadFailed:f("Couldn’t load tags:"),emptyHint:f('No tags yet. Click "Add tag" to start building the cloud.'),chrome:{buttons:[{variant:"primary",icon:"dashicons-plus",label:f("Add tag")},{icon:"dashicons-image-rotate",label:f("Recenter")},{icon:"dashicons-grid-view",label:f("Reflow"),title:f("Recompute the chip layout from scratch — discards manual repositioning.")}],searchPlaceholder:f("Search tags…"),searchAria:f("Search tags in the cloud"),hint:f("Click a tag to focus + edit · drag to reposition · scroll or pinch to zoom")},layers:["postEdge","chip","post","postChip"],fan:{chipFontSize:12,chipTextRes:Ae,pagerLabelSize:12,pagerGlyphSize:14}});if(!t)return()=>{};const s=t,{pixi:n,layers:a,fan:i,camera:r,interaction:c,world:l,palette:d}=s,{client:u}=e,h=new Map;let p=null,m={x:0,y:0},_=null,g=null,b=!1;const v=Ka(),S=Ga(v);let T=new Map,z=it(o);const P=w=>i.focusId===w,y=w=>Ua(w,P(w.id),d),E=w=>Eo(w,P(w.id),d);function M(){const w=s.terms,$=new Set(w.map(L=>L.id));for(const[L,Y]of h)$.has(L)||(a.chip.removeChild(Y.chip.container),Y.chip.container.destroy({children:!0}),h.delete(L));const I=Math.max(1,...w.map(L=>L.count)),N=[];for(const L of w){const Y=To(L.count,I),ae=Qt(L.slug||L.name,z),me=Io(L.slug||L.name),J=h.get(L.id);if(J){J.name=L.name,J.slug=L.slug,J.description=L.description,J.count=L.count,J.fontSize=Y,J.hue=ae,J.rotation=me,y(J);continue}const be=S.get(L.id),xe={id:L.id,name:L.name,slug:L.slug,description:L.description,count:L.count,fontSize:Y,hue:ae,rotation:me,x:be?.x??0,y:be?.y??0,tx:be?.x??0,ty:be?.y??0,width:0,height:0,chip:Fa(n,a.chip,L,Y,d)};h.set(L.id,xe),y(xe),R(xe),be||N.push(xe)}const K=[],V=new Map;for(const L of h.values())N.includes(L)||(K.push({x:L.tx-L.width/2,y:L.ty-L.height/2,w:L.width,h:L.height}),V.set(L.id,{x:L.tx,y:L.ty}));N.sort((L,Y)=>Y.count-L.count),es(N,K,V,T);for(const L of N)L.x=L.tx,L.y=L.ty;s.syncEmptyHint(w.length===0)}function R(w){const $=w.chip.container;$.on("pointerdown",I=>{if(ne(c))return;const N=I;ve(c,I),p=w,g={x:w.tx,y:w.ty},_={x:N.global.x,y:N.global.y};const K=r.stageToWorld(N.global);m={x:w.x-K.x,y:w.y-K.y}}),$.on("pointerover",()=>{w.chip.cachedHover=!0,E(w)}),$.on("pointerout",()=>{w.chip.cachedHover=!1,E(w)})}function H(w){const $=s.nudge;for(const I of h.values()){if(I===p)continue;let N=I.tx,K=I.ty;if($&&I.id!==i.focusId){const L=I.tx-$.x,Y=I.ty-$.y,ae=Math.sqrt(L*L+Y*Y)||1,me=$.radius+Math.max(I.width,I.height)/2;if(ae<me){const J=me+12;N=$.x+L/ae*J,K=$.y+Y/ae*J}}const V=1-Math.exp(-w*.012);I.x+=(N-I.x)*V,I.y+=(K-I.y)*V}}function U(){const w=1/Math.max(.01,l.scale.x),$=i.focusId!==null;for(const I of h.values()){const N=I.chip.container;N.x=I.x,N.y=I.y,N.scale.set(1),N.rotation=I.rotation;const K=!$||i.focusId===I.id?1:.32;Math.abs(N.alpha-K)>.005?N.alpha+=(K-N.alpha)*.18:N.alpha=K}i.syncChips(w)}function j(w){if(!p)return;const $=p,I=ro(_,w);p=null,_=null,I<3?s.focusOn($.id):(S.set($.id,{x:$.tx,y:$.ty}),ts(v,S))}const G={sidebar:s.sidebar,client:u,toast:e.toast,themeHue:z,terms:()=>s.terms,setTerms:w=>{s.terms=w},tag:w=>h.get(w),focusId:()=>i.focusId,setFocus:w=>{i.focusId=w},draft:()=>b,setDraft:w=>{b=w},applyTagUpdate:(w,$)=>{const I=h.get(w);I&&(I.name=$.name,I.description=$.description,I.slug=$.slug,I.hue=Qt(I.slug||I.name,z),I.rotation=Io(I.slug||I.name),y(I))},forgetTag:w=>{S.delete(w),ts(v,S)},buildCloud:M,clearPosts:()=>i.clear(),loadPosts:()=>i.load()};function q(){if(h.size===0)return null;const w={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const $ of h.values())w.minX=Math.min(w.minX,$.tx-$.width/2),w.minY=Math.min(w.minY,$.ty-$.height/2),w.maxX=Math.max(w.maxX,$.tx+$.width/2),w.maxY=Math.max(w.maxY,$.ty+$.height/2);return w}function D(){const w=[],$=new Map,I=[];for(const N of h.values())S.has(N.id)?(w.push({x:N.tx-N.width/2,y:N.ty-N.height/2,w:N.width,h:N.height}),$.set(N.id,{x:N.tx,y:N.ty})):I.push(N);I.sort((N,K)=>K.count-N.count),es(I,w,$,T)}async function O(){try{T=await u.fetchTagCooccurrence("tags",8),T.size>0&&D()}catch{}}const[k,x,A]=s.chrome.buttons;return x.addEventListener("click",()=>s.recenter()),k.addEventListener("click",()=>{b=!0,ce(G)}),A.addEventListener("click",()=>{S.clear(),ts(v,S);for(const $ of h.values())$.tx=0,$.ty=0;const w=Array.from(h.values()).sort(($,I)=>I.count-$.count);es(w,[],new Map,T),r.fitToView(q(),{animate:!0}),O()}),M(),ce(G),s.start({themeChanged:()=>{z=it(o);for(const w of h.values())w.hue=Qt(w.slug||w.name,z),E(w)},center:w=>{const $=h.get(w);return $?{x:$.x,y:$.y,tone:So($.hue)}:null},countReconciled:(w,$)=>{const I=h.get(w);I&&I.count!==$&&(I.count=$,s.terms=s.terms.map(N=>N.id===w?{...N,count:$}:N),y(I))},focusChanged:()=>{for(const w of h.values())E(w);ce(G)},bounds:q,frame:w=>{H(w),i.ease(),i.drawEdges(),U()},countsChanged:()=>{const w=Math.max(1,...s.terms.map($=>$.count));for(const $ of s.terms){const I=h.get($.id);I&&(I.count=$.count,I.fontSize=To($.count,w),y(I))}i.focusId!==null&&ce(G)},dragging:()=>p!==null,pointerMove:(w,$)=>p?(p.x=$.x+m.x,p.y=$.y+m.y,p.tx=p.x,p.ty=p.y,!0):!1,pointerUp:j,cancelGesture:()=>{p&&g&&(p.x=p.tx=g.x,p.y=p.ty=g.y),p=null,_=null,g=null},search:w=>Array.from(h.values()).filter($=>$.name.toLowerCase().includes(w)||$.slug.toLowerCase().includes(w))}),O(),()=>s.teardown()}const Ja=Ki("desktop-mode-posts",{cells:{tags:Ha,categories:jn},terms:{categories:Na,tags:Za}});return dt.default=Ja,Object.defineProperties(dt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),dt}({});