| @@ -1,44 +1,54 @@ | ||
| 1 | -var openStationApp_trash=function(G){"use strict";const tt="desktop-mode";function ae(){return window.wp?.i18n}function u(e,t=tt){return ae()?.__(e,t)??e}function H(e,...t){const n=ae()?.sprintf;if(n)return n(e,...t);let s=0;return e.replace(/%(?:(\d+)\$)?[sd]/g,(o,r)=>{const i=r?Number.parseInt(r,10)-1:s++;return String(t[i]??"")})}function T(e,...t){return{__wpdHtml:!0,strings:e,values:t}}function nt(e){return!!e&&e.__wpdHtml===!0}const st="$$wpd$$",b=/\$\$wpd\$\$(\d+)\$\$/g,ot="$$wpd-node$$",rt=/^\$\$wpd-node\$\$(\d+)\$\$$/,it=new Set(["style","script","textarea","title"]);function at(e){let t="",n=!1,s=null,o=!1,r=null,i="",c=!1;for(let a=0;a<e.length;a++){const l=e[a];t+=l;for(let d=0;d<l.length;d++){const p=l[d];if(o){l.startsWith("-->",d)&&(o=!1,d+=2);continue}if(r!==null){p==="<"&&l[d+1]==="/"&&l.slice(d+2,d+2+r.length).toLowerCase()===r&&(d+=1+r.length,r=null,n=!0,c=!1,i="");continue}if(s!==null){p===s&&(s=null);continue}if(n){p==='"'||p==="'"?(s=p,c=!1):p===">"?(n=!1,c=!1,it.has(i)&&(r=i),i=""):c&&(/[a-zA-Z0-9-]/.test(p)?i+=p.toLowerCase():c=!1);continue}if(l.startsWith("<!--",d)){o=!0,d+=3;continue}const m=l[d+1]??"";p==="<"&&/[a-zA-Z/!]/.test(m)&&(n=!0,i="",c=/[a-zA-Z]/.test(m))}a<e.length-1&&(t+=n||o||r!==null?`${st}${a}$$`:`<!--${ot}${a}$$-->`)}return t}const ce=new WeakMap;function le(e){const t=ce.get(e);if(t)return t;const n=document.createElement("template");n.innerHTML=at(e);const s=[],o=(c,a)=>{if(c.nodeType===Node.ELEMENT_NODE){const p=c;for(const m of Array.from(p.attributes)){const h=m.name,f=m.value,v=h[0];if(b.test(f))if(b.lastIndex=0,v==="@"){const y=b.exec(f);b.lastIndex=0,s.push({path:a,kind:"event",name:h.slice(1),valueIndex:y?Number(y[1]):0}),p.removeAttribute(h)}else if(v==="."){const y=b.exec(f);b.lastIndex=0,s.push({path:a,kind:"prop",name:h.slice(1),valueIndex:y?Number(y[1]):0}),p.removeAttribute(h)}else if(v==="?"){const y=b.exec(f);b.lastIndex=0,s.push({path:a,kind:"bool",name:h.slice(1),valueIndex:y?Number(y[1]):0}),p.removeAttribute(h)}else{const y=[],S=[];let k=0,I;for(b.lastIndex=0;(I=b.exec(f))!==null;)y.push(f.slice(k,I.index)),S.push(Number(I[1])),k=I.index+I[0].length;y.push(f.slice(k)),s.push({path:a,kind:"attr",name:h,template:y,valueIndices:S}),p.setAttribute(h,"")}}}const l=Array.from(c.childNodes);let d=0;for(let p=0;p<l.length;p++){const m=l[p],h=p+d;if(m.nodeType===Node.COMMENT_NODE){const f=rt.exec(m.data);if(f){const v=document.createTextNode("");m.parentNode.replaceChild(v,m),s.push({path:[...a,h],kind:"node",valueIndex:Number(f[1])})}continue}if(m.nodeType===Node.TEXT_NODE){const f=m.textContent||"";if(!b.test(f)){b.lastIndex=0;continue}b.lastIndex=0;const v=m.parentNode;let y=0,S;const k=[],I=[];for(b.lastIndex=0;(S=b.exec(f))!==null;){S.index>y&&k.push(document.createTextNode(f.slice(y,S.index)));const ie=document.createTextNode("");k.push(ie),I.push({path:[...a,h+k.length-1],kind:"node",valueIndex:Number(S[1])}),y=S.index+S[0].length}y<f.length&&k.push(document.createTextNode(f.slice(y)));for(const ie of k)v.insertBefore(ie,m);v.removeChild(m),d+=k.length-1,s.push(...I)}else o(m,[...a,h])}};o(n.content,[]);const i={template:n,buildParts:c=>{const a=[];for(const l of s){let d=c;for(const p of l.path)d=d.childNodes[p];l.kind==="node"?a.push({kind:"node",valueIndex:l.valueIndex,child:{anchor:d,state:null}}):l.kind==="attr"?a.push({kind:"attr",element:d,name:l.name,template:l.template,valueIndices:l.valueIndices}):l.kind==="event"?a.push({kind:"event",valueIndex:l.valueIndex,element:d,name:l.name}):l.kind==="prop"?a.push({kind:"prop",valueIndex:l.valueIndex,element:d,name:l.name}):l.kind==="bool"&&a.push({kind:"bool",valueIndex:l.valueIndex,element:d,name:l.name})}return a}};return ce.set(e,i),i}const de=new WeakMap;function ct(e,t){for(const n of e.nodes)if(n.parentNode!==t)return!1;return!0}function ue(e,t){const n=de.get(t);if(n&&n.strings===e.strings&&ct(n,t)){z(n.parts,e.values);return}const s=le(e.strings),o=s.template.content.cloneNode(!0),r=s.buildParts(o),i=Array.from(o.childNodes);for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(o),z(r,e.values),de.set(t,{strings:e.strings,parts:r,nodes:i})}function z(e,t){for(const n of e)if(n.kind==="node")W(n.child,t[n.valueIndex]);else if(n.kind==="attr"){let s=n.template[0];for(let o=0;o<n.valueIndices.length;o++)s+=fe(t[n.valueIndices[o]]),s+=n.template[o+1];s!==n.last&&(n.last=s,s===""?n.element.removeAttribute(n.name):n.element.setAttribute(n.name,s))}else if(n.kind==="event"){const s=t[n.valueIndex];s!==n.current&&(n.current&&n.element.removeEventListener(n.name,n.current),s&&n.element.addEventListener(n.name,s),n.current=s)}else if(n.kind==="prop"){const s=t[n.valueIndex];s!==n.last&&(n.last=s,n.element[n.name]=s)}else if(n.kind==="bool"){const s=!!t[n.valueIndex];s!==n.last&&(n.last=s,s?n.element.setAttribute(n.name,""):n.element.removeAttribute(n.name))}}function W(e,t){if(t==null||t===!1){e.state&&(_(e.state),e.state=null);return}if(Array.isArray(t)){ft(e,t);return}if(nt(t)){ut(e,t);return}if(t instanceof Node){lt(e,t);return}dt(e,fe(t))}function lt(e,t){const n=e.state;n?.shape==="node"&&n.node===t||(n&&_(n),N(e,[t]),e.state={shape:"node",node:t})}function dt(e,t){const n=e.state;if(n?.shape==="text"){n.text!==t&&(n.node.textContent=t,n.text=t);return}n&&_(n);const s=document.createTextNode(t);N(e,[s]),e.state={shape:"text",node:s,text:t}}function ut(e,t){const n=e.state;if(n?.shape==="template"&&n.strings===t.strings){z(n.parts,t.values);return}n&&_(n);const s=le(t.strings),o=s.template.content.cloneNode(!0),r=s.buildParts(o),i=Array.from(o.childNodes);N(e,[o]),z(r,t.values),e.state={shape:"template",strings:t.strings,parts:r,nodes:i}}function ft(e,t){const n=e.state;if(n?.shape==="array"){const o=Math.min(n.entries.length,t.length);for(let r=0;r<o;r++)W(n.entries[r],t[r]);if(t.length<n.entries.length){for(let r=t.length;r<n.entries.length;r++){const i=n.entries[r];i.state&&_(i.state),i.anchor.remove()}n.entries.length=t.length}else for(let r=n.entries.length;r<t.length;r++){const i=document.createTextNode("");N(e,[i]);const c={anchor:i,state:null};W(c,t[r]),n.entries.push(c)}return}n&&_(n);const s=[];for(const o of t){const r=document.createTextNode("");N(e,[r]);const i={anchor:r,state:null};W(i,o),s.push(i)}e.state={shape:"array",entries:s}}function N(e,t){const n=e.anchor.parentNode;if(n)for(const s of t)n.insertBefore(s,e.anchor)}function _(e){if(e.shape==="text"){e.node.remove();return}if(e.shape==="template"){for(const t of e.parts)t.kind==="node"&&t.child.state&&(_(t.child.state),t.child.state=null);for(const t of e.nodes)t.parentNode&&t.parentNode.removeChild(t);return}if(e.shape==="node"){e.node.parentNode&&e.node.parentNode.removeChild(e.node);return}for(const t of e.entries)t.state&&_(t.state),t.anchor.remove()}function fe(e){return e==null||e===!1?"":String(e)}const pt="data-os-mode";function pe(e=typeof document<"u"?document.documentElement:null){return!!e&&e.getAttribute(pt)==="mobile"}function ht(e,t=null){const n=t??(typeof document<"u"?document.documentElement:null);if(!!n&&pe(n)){e.hasAttribute("stacked")||e.setAttribute("stacked","");const r=e.getAttribute("sticky-columns");return r!==null&&(e.setAttribute("data-os-sticky-columns",r),e.removeAttribute("sticky-columns")),!0}e.hasAttribute("stacked")&&e.removeAttribute("stacked");const o=e.getAttribute("data-os-sticky-columns");return o!==null&&(e.setAttribute("sticky-columns",o),e.removeAttribute("data-os-sticky-columns")),!1}function mt(e,t){const n=t.local??{},s={id:e,hasLocal:i=>Object.prototype.hasOwnProperty.call(n,i),runLocal:(i,c,a,l)=>{const d=n[i];if(!d)return c;const p={...c},m=d(p,a,l);return m===void 0?p:m},render:i=>{ue(t.view(i),i.root),t.updated?.(i)},mounted:i=>t.mounted?.(i)},{placeholder:o}=t;o&&(s.placeholder=i=>o(i));const r=window;return(r.openStationApps??(r.openStationApps={}))[e]=s,s}const gt=1e3;async function yt(e){const{emptyBin:t,onProgress:n,maxIterations:s=gt}=e;let o=0,r=0,i=0,c=0,a="iteration-cap";for(let l=0;l<s;l++){const d=await t();if(o+=d.purged,r+=d.skipped,c=d.remaining,l===0&&(i=o+d.remaining),n?.({purged:o,skipped:r,initialTotal:i}),d.remaining===0){a="empty";break}if(d.purged===0&&d.skipped>0){a="no-progress";break}}return{purged:o,skipped:r,initialTotal:i,remaining:c,stoppedBecause:a}}const bt="os-recycle-bin-changed",wt="openstation_recycle_bin_seen_ts",vt="os-recycle-bin-changed",g={started:!1,seenTs:0,postMessageHandler:null,heartbeatSendHandler:null,heartbeatTickHandler:null};function he(e,t){const n={kind:"external",ok:0,errors:[],source:e,ts:t};document.dispatchEvent(new CustomEvent(bt,{detail:n}));const s=window.wp?.hooks;s&&typeof s.doAction=="function"&&s.doAction("openstation.recycleBin.changed",n)}function Et(){if(g.started)return;g.started=!0,g.seenTs=Date.now();const e=window.location.origin;g.postMessageHandler=n=>{if(n.origin!==e)return;const s=n.data;if(!s||s.type!==vt)return;const o=typeof s.ts=="number"?s.ts:Date.now();o<=g.seenTs||(g.seenTs=o,he("chromeless",o))},window.addEventListener("message",g.postMessageHandler);const t=window.jQuery;t&&(g.heartbeatSendHandler=(...n)=>{const s=n[1];s&&(s[wt]=g.seenTs)},t(document).on("heartbeat-send",g.heartbeatSendHandler),g.heartbeatTickHandler=(...n)=>{const o=n[1]?.openstation_recycle_bin;if(!o)return;const r=typeof o.ts=="number"?o.ts:0;r>g.seenTs&&(g.seenTs=r,o.changed&&he("heartbeat",r))},t(document).on("heartbeat-tick",g.heartbeatTickHandler))}function kt(){if(!g.started)return;g.started=!1,g.postMessageHandler&&(window.removeEventListener("message",g.postMessageHandler),g.postMessageHandler=null);const e=window.jQuery;e&&(g.heartbeatSendHandler&&e(document).off("heartbeat-send",g.heartbeatSendHandler),g.heartbeatTickHandler&&e(document).off("heartbeat-tick",g.heartbeatTickHandler)),g.heartbeatSendHandler=null,g.heartbeatTickHandler=null}function me(e){const t=document.createElement("textarea");return t.innerHTML=e,t.value}const $=class $ 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(ge)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(t,n,s){if(n===s)return;const o=Tt(t);this._propValues[o]=s,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(t){if(t==null){this.removeAttribute("class");return}const s=(Array.isArray(t)?t:String(t).split(/\s+/)).map(o=>String(o).trim()).filter(o=>o!=="");this.className=s.join(" ")}requestUpdate(){this._scheduleRender()}emit(t,n){return this.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0}))}_installPropAccessors(){const t=this.constructor;for(const n of t.props){if(Object.getOwnPropertyDescriptor(this,n))continue;const s=ge(n);Object.defineProperty(this,n,{get:()=>n in this._propValues?this._propValues[n]:this.getAttribute(s),set:o=>{let r;o==null||o===!1?r=null:o===!0?r="":r=String(o),this._propValues[n]=r,r===null?this.removeAttribute(s):this.setAttribute(s,r),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&ue(this.render(),this._renderRoot)}))}_adoptStyles(){const t=this.constructor;if(t.styles.length!==0)if(t.shadow&&this.shadowRoot){const n=t.styles.map(s=>s.sheet).filter(s=>s!==null);if(this.shadowRoot.adoptedStyleSheets=n,n.length!==t.styles.length){for(const s of t.styles)if(!s.sheet){const o=document.createElement("style");o.textContent=s.cssText,this.shadowRoot.appendChild(o)}}}else this._adoptLightStyles(t)}_adoptLightStyles(t){if(!$._lightStylesAdopted.has(t)){$._lightStylesAdopted.add(t);for(const n of t.styles){const s=document.createElement("style");s.dataset.osUi=this.tagName.toLowerCase(),s.textContent=n.cssText,document.head.appendChild(s)}}}};$.props=[],$.styles=[],$.shadow=!0,$._lightStylesAdopted=new WeakSet;let q=$;function St(e,t){customElements.get(e)||customElements.define(e,t)}function ge(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Tt(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}const _t=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function At(e,...t){let n=e[0];for(let s=1;s<e.length;s++){const o=t[s-1];if(typeof o=="string"||typeof o=="number")n+=String(o);else if(o&&o.__wpdCss)n+=o.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof o);n+=e[s]}if(_t){const s=new CSSStyleSheet;return s.replaceSync(n),{__wpdCss:!0,sheet:s,cssText:n}}return{__wpdCss:!0,sheet:null,cssText:n}}const Ct=At`:host{display:inline;color:inherit;font:inherit}`,B=new Set;let O=null;const xt=3e4;function $t(){O===null&&(O=window.setInterval(()=>{for(const e of B)e.tick()},xt))}function It(){O!==null&&B.size===0&&(window.clearInterval(O),O=null)}function Rt(e){if(!e)return null;const t=n=>{const s=new Date(n);return Number.isNaN(s.getTime())?null:s};return Mt(e)?t(e):t(e.replace(" ","T")+"Z")}function Mt(e){const t=Math.max(e.indexOf("T"),e.indexOf(" ")),n=t===-1?"":e.slice(t+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(n)}let Y=null,Z=null;function ye(){return typeof navigator<"u"&&navigator.language||"en"}function Nt(){return Y||(Y=new Intl.RelativeTimeFormat(ye(),{numeric:"auto"})),Y}function be(){return Z||(Z=new Intl.RelativeTimeFormat(ye(),{numeric:"always",style:"narrow"})),Z}function Ot(e,t){const n=Nt(),s=e.getTime()-t,o=Math.round(s/1e3),r=Math.abs;return r(o)<45?n.format(0,"second"):we(n,o)}function we(e,t){const n=Math.abs,s=Math.round(t/60);if(n(s)<45)return e.format(s,"minute");const o=Math.round(s/60);if(n(o)<22)return e.format(o,"hour");const r=Math.round(o/24);if(n(r)<26)return e.format(r,"day");const i=Math.round(r/30);if(n(i)<11)return e.format(i,"month");const c=Math.round(r/365);return e.format(c,"year")}function Lt(e,t){const n=Math.round((e.getTime()-t)/1e3),s=Math.abs;return s(n)<45?be().format(0,"second"):s(n)>604800?e.toLocaleDateString(void 0,{month:"short",day:"numeric"}):we(be(),n)}const j=class j extends q{connectedCallback(){super.connectedCallback(),B.add(this),$t()}disconnectedCallback(){B.delete(this),It()}tick(){this.requestUpdate()}render(){const t=this.datetime,n=Rt(t);if(!n)return T`<span>${t??""}</span>`;const s=Date.now(),o=this.hasAttribute("compact")?Lt(n,s):Ot(n,s),r=n.toLocaleString();return T`<time datetime=${n.toISOString()} title=${r} | |
| 2 | - >${o}</time | |
| 3 | - >`}};j.props=["datetime","compact"],j.styles=[Ct],j.help=void 0;let X=j;St("os-relative-time",X);function Pt(){const e=window.wp?.hooks;if(!e)throw new Error("[openstation] `window.wp.hooks` is not available. The plugin declares `wp-hooks` as a script dependency; if you are seeing this error, verify the enqueue order.");return e}function ve(e,t,...n){return Pt().applyFilters(e,t,...n)}const Ee={DESKTOP_THEME_ICON:"os.os-theme.icon",DESKTOP_THEME_ICON_COLOR:"os.os-theme.icon-color"},ke="__openStationSharedStores";function Dt(){const e=window;let t=e[ke];return t||(t=new Map,e[ke]=t),t}function Q(e,t){const n=Dt();let s=n.get(e);s||(s={state:t(),listeners:new Set,rebuild:t},n.set(e,s));const o={get state(){return s.state},set state(r){s.state=r},getState(){return s.state},notify(){for(const r of Array.from(s.listeners))try{r(s.state)}catch(i){console.error(`[desktop-mode/shared-store:${e}] subscriber threw:`,i)}},subscribe(r){return s.listeners.add(r),()=>{s.listeners.delete(r)}},setState(r){const i=s.state;if(typeof i!="object"||i===null){console.warn(`[desktop-mode/shared-store:${e}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(i,r),o.notify()},reset(){const r=s.rebuild(),i=s.state;if(typeof i=="object"&&i!==null&&typeof r=="object"&&r!==null){const c=i;for(const a of Object.keys(c))delete c[a];Object.assign(c,r)}else s.state=r;s.listeners.clear()}};return o}const Se=Q("desktop-mode/dock-rail-registry",()=>({registry:new Map,listeners:new Set,activeId:"default"}));Se.state.registry,Se.state.listeners;class jt extends Error{constructor(t,n,s){super(`[openstation] ${t} registration rejected — fields: `+n.join(", ")+"."),this.name="RegistrationError",this.kind=t,this.errors=n,this.def=s}}function Ht(e,t,n){if(t.length!==0)throw new jt(e,t,n)}const A=[[0,0],[100,0],[100,100],[0,100]],zt=48,Wt=80,J=6,ee=8,Te=4,_e=3,Ae=64,te=105,C=2;function Ce(e){return`${Math.round(e*1e3)/1e3}%`}function x(e){return e.slice().reverse()}function L(e,t,n,s){return[[e,t],[n,t],[n,s],[e,s]]}function Bt(e,t,n,s){const o=[];for(let r=0;r<s;r++){const i=r/s*Math.PI*2;o.push([e+Math.cos(i)*n,t+Math.sin(i)*n])}return o}function E(e,t=[]){const n=[],s=o=>{n.push(`${Ce(o[0])} ${Ce(o[1])}`)};for(const o of e)s(o);if(t.length>0){s(e[0]);for(const o of t){for(const r of o)s(r);s(o[0]),s(e[0])}}return`polygon( ${n.join(", ")} )`}function xe(e){return E(A,[x(Bt(50,50,e,zt))])}function $e(e){return E(A,[x(L(50-e,-C,50+e,100+C))])}function Ie(e){const t=100/J,n=[];for(let s=0;s<J;s++){const o=s*t;n.push(x(L(-C,o,100+C,o+e)))}return E(A,n)}function Re(e){return E(A,[x(L(-C,50-e,100+C,50+e))])}function Me(e){const t=100/ee,n=[];for(let s=0;s<ee;s++){const o=s*t;n.push(x(L(o,-C,o+e,100+C)))}return E(A,n)}function Ne(e){return E(A,[x([[50,50-e],[50+e,50],[50,50+e],[50-e,50]])])}function Oe(e){const t=100/Te,n=100/_e,s=[];for(let o=0;o<_e;o++)for(let r=0;r<Te;r++){const i=r*t+t/2,c=o*n+n/2,a=t/2*e,l=n/2*e;s.push(x(L(i-a,c-l,i+a,c+l)))}return E(A,s)}function Le(e){const t=-Math.PI/2,n=e/180*Math.PI,s=[[50,50]];for(let o=0;o<Ae;o++){const r=t+o/(Ae-1)*n;s.push([50+Math.cos(r)*te,50+Math.sin(r)*te])}return E(A,[x(s)])}function Ut(){return{from:xe(0),to:xe(Wt)}}function Vt(){return{from:$e(0),to:$e(52)}}function Ft(){return{from:Ie(0),to:Ie(100/J+.5)}}function Kt(){return{from:Re(0),to:Re(52)}}function Gt(){return{from:Me(0),to:Me(100/ee+.5)}}function qt(){return{from:Ne(0),to:Ne(te)}}function Yt(){return{from:Oe(0),to:Oe(1.04)}}function Zt(){return{from:Le(0),to:Le(360)}}function Xt(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 100% 0% )"}}function Qt(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 0% 100% )"}}function Jt(){return{from:E([[-60,0],[100,0],[100,100],[0,100]]),to:E([[100,0],[260,0],[260,100],[160,100]])}}const ne=6,se=100,R=se/2,U=200,Pe=90,De=["#5c5c6d","#525261","#484855","#3e3e49","#34343d","#2a2a31"],en="#101014",tn=1.25,M="http://www.w3.org/2000/svg";let nn=0;function V(e){return Math.round(e*1e3)/1e3}function oe(e){return e/ne*Math.PI*2-Math.PI/2}function sn(e){const n=oe(e)+Math.PI/ne+Math.PI/2;return{x:Math.cos(n),y:Math.sin(n)}}function on(e){const t=oe(e),n=oe(e+1);return[[R,R],[R+Math.cos(t)*U,R+Math.sin(t)*U],[R+Math.cos(n)*U,R+Math.sin(n)*U]]}function je(e,t){const n=on(e),s=document.createElementNS(M,"path");return s.setAttribute("d",`M ${n.map(([o,r])=>`${V(o)} ${V(r)}`).join(" L ")} Z`),t?s.setAttribute("fill","#fff"):(s.setAttribute("fill",De[e%De.length]),s.setAttribute("stroke",en),s.setAttribute("stroke-width",String(tn)),s.setAttribute("vector-effect","non-scaling-stroke"),s.setAttribute("stroke-linejoin","round")),s}function rn(){const e=`os-iris-${++nn}`,t=document.createElementNS(M,"svg");t.setAttribute("viewBox",`0 0 ${se} ${se}`),t.setAttribute("preserveAspectRatio","none"),t.setAttribute("aria-hidden","true"),t.style.width="100%",t.style.height="100%",t.style.display="block";const n=document.createElementNS(M,"defs"),s=document.createElementNS(M,"mask");s.setAttribute("id",e);const o=document.createElementNS(M,"g"),r=document.createElementNS(M,"g");r.setAttribute("mask",`url(#${e})`);const i=[];for(let a=0;a<ne;a++){const l=je(a,!0),d=je(a,!1);o.appendChild(l),r.appendChild(d),i.push({el:l,index:a},{el:d,index:a})}s.appendChild(o),n.appendChild(s),t.appendChild(n),t.appendChild(r);const c=document.createElement("div");return c.appendChild(t),{element:c,play:a=>i.map(({el:l,index:d})=>{const p=sn(d),m=V(p.x*Pe),h=V(p.y*Pe);return l.animate([{transform:"translate( 0px, 0px )"},{transform:`translate( ${m}px, ${h}px )`}],{duration:a.duration,easing:a.easing,delay:a.delay,fill:"both"})})}}const an="none",He=Q("desktop-mode/window-reveal-registry",()=>({registry:new Map,listeners:new Set})),cn=He.state.registry,ln=He.state.listeners,ze=/^[a-z0-9_/-]+$/;function We(e){const t=/^\s*([a-zA-Z-]+)\s*\(/.exec(e);return t?t[1].toLowerCase():""}function Be(e,t){const n=[],s=typeof e.from=="string"&&e.from.trim()!=="",o=typeof e.to=="string"&&e.to.trim()!=="";if(s||n.push(`${t}.from (missing — the clip-path covering the window)`),o||n.push(`${t}.to (missing — the clip-path uncovering the window)`),s&&o){const r=We(e.from),i=We(e.to);r===""||i===""?n.push(`${t}.from|to (must be shape functions, e.g. \`inset( … )\` or \`polygon( … )\` — bare keywords like \`none\` cannot be animated)`):r!==i&&n.push(`${t}.from|to (must use the same shape function to interpolate — got \`${r}()\` and \`${i}()\`)`)}return n}function dn(e){if(typeof KeyframeEffect!="function")return!0;try{return new KeyframeEffect(null,null,{easing:e}),!0}catch{return!1}}function w(e){const t=[];if(!e||typeof e!="object")t.push("def (not an object)");else{typeof e.id!="string"||e.id.trim()===""?t.push("id (missing)"):ze.test(e.id.trim().toLowerCase())?e.id.trim().toLowerCase()===an&&t.push('id ("none" is reserved)'):t.push(`id (must match ${ze} — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-id)`),(typeof e.label!="string"||e.label.trim()==="")&&t.push("label (missing)");const s=e.render!==void 0,o=Array.isArray(e.layers),r=e.from!==void 0||e.to!==void 0;s&&typeof e.render!="function"?t.push("render (not a function)"):s&&(o||r)?t.push("render|layers|from|to (supply exactly one of: a from/to pair, a layers array, or a render function)"):s||(o&&r?t.push("layers|from|to (supply EITHER a single from/to pair OR a layers array, not both)"):o?(e.layers.length===0&&t.push("layers (empty — supply at least one matched pair)"),e.layers.forEach((i,c)=>{if(!i||typeof i!="object"){t.push(`layers[ ${c} ] (not an object)`);return}t.push(...Be(i,`layers[ ${c} ]`))})):t.push(...Be(e,"").map(i=>i.replace(/^\./,"")))),e.easing!==void 0&&(typeof e.easing!="string"||e.easing.trim()===""?t.push("easing (not a non-empty string)"):dn(e.easing)||t.push("easing (not an easing the browser can parse — `Element.animate()` would throw at play time, with the covering surface already over the window)"))}Ht("WindowReveal",t,e);const n=e.id.trim().toLowerCase();cn.set(n,{...e,id:n}),un()}function un(){const e=Array.from(ln);for(const t of e)try{t()}catch(n){typeof console<"u"&&console.error("[openstation] window-reveal registry listener threw:",n)}}w({id:"sweep",label:u("Sweep"),description:u("A straight edge travels across the window, uncovering the page behind it."),...Qt(),duration:420}),w({id:"iris",label:u("Iris"),description:u("The page opens out from the centre of the window, like a camera shutter."),...Ut(),duration:520}),w({id:"curtain",label:u("Curtain"),description:u("Two panels part from the middle of the window and slide off the sides."),...Vt(),duration:480}),w({id:"blinds",label:u("Blinds"),description:u("Six horizontal slats retract at once, letting the page through between them."),...Ft(),duration:560}),w({id:"diagonal",label:u("Diagonal"),description:u("A slanted edge sweeps off the trailing corner of the window."),...Jt(),duration:460}),w({id:"rise",label:u("Rise"),description:u("The page rises into the window from the bottom edge upward."),...Xt(),duration:440}),w({id:"shutter",label:u("Shutter"),description:u("Two panels part from the middle of the window and slide off the top and bottom."),...Kt(),duration:480}),w({id:"slats",label:u("Slats"),description:u("Eight vertical slats retract at once, letting the page through between them."),...Gt(),duration:560}),w({id:"diamond",label:u("Diamond"),description:u("The page opens out from the centre of the window through a growing rhombus."),...qt(),duration:520}),w({id:"mosaic",label:u("Mosaic"),description:u("The page arrives as a grid of tiles, each opening out from its own centre."),...Yt(),duration:600}),w({id:"obturator",label:u("Camera shutter"),description:u("Six wedges slide aside in unison, opening a hexagonal aperture from the centre like the iris of a camera lens."),render:rn,duration:720,edgeLag:0}),w({id:"radar",label:u("Radar"),description:u("A spoke sweeps a full turn around the centre of the window, uncovering the page behind it."),...Zt(),duration:760});const Ue={dockSize:["compact","default","large"],desktopLayout:["classic","unified"],dockPlacement:["bottom","left","right"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"]},Ve=["dockRailRenderer","windowReveal","accent"],Fe={windowRevealDuration:{min:80,max:4e3}},fn=/^[a-z0-9_-]+$/;[...Object.keys(Ue),...Ve,...Object.keys(Fe)];function pn(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t=e,n={},s={};for(const[o,r]of Object.entries(Ue)){const i=t[o];typeof i=="string"&&r.includes(i)&&(n[o]=i)}for(const o of Ve){const r=t[o];typeof r=="string"&&fn.test(r)&&(n[o]=r)}for(const[o,r]of Object.entries(Fe)){const i=t[o];typeof i=="number"&&Number.isFinite(i)&&(s[o]=Math.min(r.max,Math.max(r.min,Math.round(i))))}return{...n,...s}}const hn=/^[a-z0-9_-]+$/,Ke=128;function mn(e){return typeof e!="string"||e===""||e.length>2048?!1:e.startsWith("dashicons-")||e.startsWith("https://")||e.startsWith("http://")||e.startsWith("data:image/")}function gn(e){if(!e||typeof e!="object")return null;const t=e,n=typeof t.slug=="string"?t.slug:"";if(!hn.test(n))return null;const s={};if(t.icons&&typeof t.icons=="object"){let a=0;for(const[l,d]of Object.entries(t.icons)){if(a>=Ke)break;l===""||!mn(d)||(s[l]=d,a+=1)}}const o={};if(t.tokens&&typeof t.tokens=="object")for(const[a,l]of Object.entries(t.tokens))typeof l=="string"&&(o[a]=l);const r=[];if(Array.isArray(t.fonts))for(const a of t.fonts)typeof a=="string"&&a!==""&&r.push(a);const i={};if(t.iconColors&&typeof t.iconColors=="object"){let a=0;for(const[l,d]of Object.entries(t.iconColors)){if(a>=Ke)break;l===""||typeof d!="string"||d===""||(i[l]=d,a+=1)}}const c=a=>typeof t[a]=="string"?t[a]:"";return{id:c("id")||n,slug:n,name:c("name")||n,version:c("version"),author:c("author"),description:c("description"),previewUrl:c("previewUrl"),cssUrl:c("cssUrl"),cssText:c("cssText"),tokens:o,fonts:r,icons:s,iconColors:i,recommendedOsSettings:pn(t.recommendedOsSettings),installedAt:typeof t.installedAt=="number"?t.installedAt:0,source:t.source==="code"?"code":"upload",cssDeferred:t.cssDeferred===!0}}function yn(){const t=window.openStationConfig?.serverDesktopThemes,n=[];if(Array.isArray(t))for(const s of t){const o=gn(s);o&&n.push(o)}return{themes:n,activeId:null,activeIcons:null,activeIconColors:null}}const bn=Q("desktop-mode/desktop-themes",yn);function Ge(){return bn}function wn(e){const t=Ge().state;if(t.activeIcons===null)return null;const n=t.activeIcons[e];if(typeof n!="string"||n==="")return null;const s=ve(Ee.DESKTOP_THEME_ICON,n,{slot:e,themeId:t.activeId??""});return typeof s=="string"&&s!==""?s:null}function vn(e){const t=Ge().state;if(t.activeIconColors===null||!e)return null;const n=t.activeIconColors[e];if(typeof n!="string"||n==="")return null;const s=ve(Ee.DESKTOP_THEME_ICON_COLOR,n,{slot:e,themeId:t.activeId??""});return typeof s=="string"&&s!==""?En(s):null}function En(e){const t=e.trim();if(t===""||t.length>64||/[;{}<>"'\\]/.test(t))return null;let n=0;for(const s of t)if(s==="(")n+=1;else if(s===")"&&(n-=1,n<0))return null;return n===0?t:null}const qe={RECYCLE_RESTORE:"RECYCLE_RESTORE",RECYCLE_DELETE:"RECYCLE_DELETE"};function kn(e){return e==="attachment"?"attachment":e==="comment"?"comment":"post"}const Ye={post:{bg:"#dbe9fe",fg:"#1d4ed8"},page:{bg:"#e0f2fe",fg:"#075985"},attachment:{bg:"#fef3c7",fg:"#92400e"},comment:{bg:"#dcfce7",fg:"#166534"},_default:{bg:"var( --os-ui-surface-sunken, #e5e7eb )",fg:"var( --os-ui-fg-muted, #374151 )"}};function Sn(e){return e?e.replace(/[_-]+/g," ").replace(/\b\w/g,t=>t.toUpperCase()):""}function Tn(e){const t=e.type_label&&e.type_label.length>0?e.type_label:Sn(e.type),n=Ye[e.type]??Ye._default,s=document.createElement("span");return s.setAttribute("data-os-recycle-bin-type-badge",e.type),s.textContent=t,s.style.cssText=["display: inline-flex","align-items: center","flex-shrink: 0","padding: 2px 8px","border-radius: 999px","font-size: 11px","font-weight: 600","line-height: 1.4","letter-spacing: 0.2px","text-transform: uppercase","white-space: nowrap","background: "+n.bg,"color: "+n.fg].join(";"),s}const _n={restore:'<path d="M12 5V2L7 6l5 4V7c2.76 0 5 2.24 5 5 0 .83-.21 1.61-.57 2.3l1.46 1.46A6.96 6.96 0 0 0 19 12c0-3.87-3.13-7-7-7zm0 12c-2.76 0-5-2.24-5-5 0-.83.21-1.61.57-2.3L6.11 8.24A6.96 6.96 0 0 0 5 12c0 3.87 3.13 7 7 7v3l5-4-5-4v3z" fill="currentColor"/>',trash:'<path d="M9 3v1H4v2h1v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6h1V4h-5V3H9zm0 5h2v9H9V8zm4 0h2v9h-2V8z" fill="currentColor"/>'};function Ze(e){const t=document.createElement("button");t.type="button",t.setAttribute("data-noclick",""),t.setAttribute("aria-label",e.label),t.title=e.label;const n=e.variant==="danger",s=n?"var( --os-ui-danger, #d63638 )":"var( --os-ui-fg-muted, #50575e )",o=n?"var( --os-ui-danger, #d63638 )":"var( --os-ui-border, #c3c4c7 )",r="var( --os-ui-surface, #fff )",i=()=>{t.style.background=r,t.style.color=s,t.style.borderColor=o},c=()=>{n?(t.style.background="var( --os-ui-danger, #d63638 )",t.style.color="var( --os-ui-fg-on-accent, #fff )",t.style.borderColor="var( --os-ui-danger, #d63638 )"):(t.style.background="var( --os-ui-hover, #f0f0f1 )",t.style.color="var( --os-ui-fg, #1d2327 )",t.style.borderColor="var( --os-ui-border-strong, #8c8f94 )")},a=e.labelled===!0;t.style.cssText=["display: inline-flex","align-items: center","justify-content: center",a?"gap: 6px":"",a?"flex: 0 0 auto":"flex: 0 0 30px",a?"width: auto":"width: 30px",a?"height: 36px":"height: 30px",a?"padding: 0 12px":"padding: 0",a?"font-size: 13px":"",a?"font-weight: 600":"","margin: 0","border: 1px solid "+o,"border-radius: 6px","background: "+r,"color: "+s,"cursor: pointer","box-sizing: border-box","line-height: 1","font: inherit","transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease"].join(";"),t.addEventListener("mouseenter",c),t.addEventListener("mouseleave",i),t.addEventListener("focus",c),t.addEventListener("blur",i);const l=e.icon==="restore"?qe.RECYCLE_RESTORE:qe.RECYCLE_DELETE,d=wn(l),p=vn(l)??"currentColor";if(d!==null&&!d.startsWith("dashicons-")&&/^(https?:\/\/|data:image\/)/i.test(d)&&!/['"()\\<>\s]/.test(d)){const h=document.createElement("span");h.setAttribute("aria-hidden","true"),h.style.cssText=["display: block","width: 18px","height: 18px","flex-shrink: 0",`background-color: ${p}`,`-webkit-mask: url("${d}") center / contain no-repeat`,`mask: url("${d}") center / contain no-repeat`].join(";"),t.appendChild(h)}else{const f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("width","18"),f.setAttribute("height","18"),f.setAttribute("viewBox","0 0 24 24"),f.setAttribute("aria-hidden","true"),f.setAttribute("focusable","false"),f.style.display="block",f.innerHTML=_n[e.icon]??"",t.appendChild(f)}if(a){const h=document.createElement("span");h.textContent=e.label,h.style.cssText="white-space: nowrap; line-height: 1;",t.appendChild(h)}return t.addEventListener("click",h=>{h.stopPropagation(),e.onClick()}),t}function An(e,t={}){const n=t.phone===!0,s=n?"font-weight:600;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;":"font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:320px;",o=[{key:"title",label:u("Title"),sortable:!0,stack:"title",render:(i,c)=>{const a=document.createElement("span");if(a.style.cssText="display:flex;align-items:center;gap:10px;min-width:0;",c.preview&&c.type==="attachment"&&c.mime.startsWith("image/")){const f=document.createElement("img");f.src=c.preview,f.alt="",f.loading="lazy",f.style.cssText="width:36px;height:36px;border-radius:4px;object-fit:cover;display:block;flex-shrink:0;",a.appendChild(f)}const d=document.createElement("span");d.style.cssText="display:flex;flex-direction:column;gap:2px;min-width:0;";const p=document.createElement("span");p.style.cssText="display:flex;align-items:center;gap:8px;min-width:0;",p.appendChild(Tn(c));const m=document.createElement("span");m.style.cssText=s;const h=me(c.title);if(m.textContent=h,m.title=h,p.appendChild(m),d.appendChild(p),c.subtitle){const f=document.createElement("span");f.style.cssText="font-size:12px;color:var( --os-ui-fg-muted, #50575e );white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:320px;";const v=me(c.subtitle);f.textContent=v,f.title=v,d.appendChild(f)}return a.appendChild(d),a}},{key:"deleted_at",label:u("Deleted"),sortable:!0,stack:"meta",width:"180px",sortValue:i=>Date.parse(i.deleted_at+"Z")||0,render:(i,c)=>{const a=document.createElement("os-relative-time");return a.setAttribute("datetime",c.deleted_at),a}},{key:"deleted_by",label:u("By"),sortable:!0,stack:"meta",width:"160px",render:(i,c)=>c.deleted_by||"—"},{key:"__actions",label:"",stack:"actions",width:"96px",align:"end",render:(i,c)=>{const a=document.createElement("span");return a.style.cssText=n?"display:flex;gap:8px;align-items:center;flex-wrap:wrap;line-height:1;":"display:inline-flex;gap:4px;justify-content:flex-end;align-items:center;flex-wrap:nowrap;white-space:nowrap;line-height:1;",c.can_restore&&a.appendChild(Ze({label:u("Restore"),icon:"restore",labelled:n,onClick:()=>e.onRestore({id:c.id,type:c.type})})),c.can_purge&&a.appendChild(Ze({label:u("Delete forever"),icon:"trash",variant:"danger",labelled:n,onClick:()=>e.onPurge({id:c.id,type:c.type})})),a}}],r=window.wp?.hooks;return r&&typeof r.applyFilters=="function"?r.applyFilters("openstation.recycleBin.columns",o):o}const Xe="desktop-mode-recycle-bin",P=()=>({selected:[],listKey:"",fingerprint:"",empty:{mode:"idle",purged:0,total:0},refreshTimer:null,lastArt:"",phoneColumns:null});function Cn(e){return e.length===0?"":e.map(t=>`${t.type}:${t.id}:${t.deleted_at}`).sort().join("|")}function F(e,t){const n={kind:e,ok:t,errors:[],source:"local"};document.dispatchEvent(new CustomEvent("os-recycle-bin-changed",{detail:n}));const s=window.wp?.hooks;s&&typeof s.doAction=="function"&&s.doAction("openstation.recycleBin.changed",n)}const re=e=>e.root.querySelector("[data-os-trash-table]");function D(e){const t=re(e);if(!t)return[];const n=new Set(Array.from(t.selection??[],String)),s=[];for(const o of t.visibleRows??[])n.has(`${o.type}:${o.id}`)&&s.push({id:o.id,type:o.type});return s}function K(e){re(e)?.clearSelection(),e.ui(P).selected=[]}async function Qe(e,t){t.length!==0&&(K(e),await e.dispatch("restore",{items:t}),F("restore",t.length))}async function Je(e,t){if(t.length===0)return;await e.dispatch("purge",{items:t},{confirm:{title:u("Delete forever?"),message:H(u("Permanently delete %d item(s)? This cannot be undone."),t.length),label:u("Delete forever"),danger:!0}})&&(K(e),F("purge",t.length))}async function xn(e,t){if(t.length===0)return;const n=window.wp?.os?.files?.rest;K(e);let s=0,o=0;for(const r of t){let i;try{const a=await e.fetch("desktop-mode/v1/recycle-bin/restore",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[r]})});if(!a.ok)throw new Error(String(a.status));i=await a.json()}catch(a){console.error("[trash] pin-to-desktop restore failed",a);continue}if(!i.ok.includes(r.id))continue;o+=1;const c=kn(r.type);if(!(!n||!c)){try{await n.createPlacement({type:c,ref:String(r.id),x:16+s%5*96,y:16+Math.floor(s/5)*110})}catch(a){console.error("[trash] pin-to-desktop placement failed",a)}s+=1}}F("restore",o),await e.dispatch("refresh")}async function $n(e){if(!await e.host.confirm?.({title:u("Empty Trash?"),message:u("Permanently delete ALL items in the Trash? This includes every type and any items hidden by the current filter or search. This cannot be undone."),confirmLabel:u("Empty Trash"),danger:!0}))return;const n=e.ui(P);n.empty={mode:"starting",purged:0,total:0},e.repaint();try{const s=await yt({emptyBin:async()=>{const o=await e.fetch("desktop-mode/v1/recycle-bin/empty",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!o.ok)throw new Error(String(o.status));return await o.json()},onProgress:({purged:o,initialTotal:r})=>{n.empty={mode:"progress",purged:o,total:r},e.repaint()}});F("empty",s.purged),s.skipped>0&&e.host.toast?.({message:H(u("%d item(s) skipped (insufficient permissions)."),s.skipped)})}catch(s){console.error("[trash] empty failed",s)}finally{n.empty={mode:"idle",purged:0,total:0},K(e),e.dispatch("refresh")}}function In(e){return e.empty.mode==="idle"?u("Empty Trash"):e.empty.mode==="starting"||e.empty.total===0?u("Emptying…"):H(u("Emptying… %1$d of %2$d"),e.empty.purged,e.empty.total)}function et(e,t,n){return T` | |
| 4 | - <span class="os-recycle-bin__count">${H(u("%d selected"),t.selected.length)}</span> | |
| 5 | - <os-button variant="secondary" @click=${()=>void Qe(e,D(e))}> | |
| 1 | +var openStationApp_trash=function(te){"use strict";const we="desktop-mode";function oe(){return window.wp?.i18n}function h(t,e=we){return oe()?.__(t,e)??t}function se(t,e,o,s=we){return oe()?._n(t,e,o,s)??(o===1?t:e)}function C(t,...e){const o=oe()?.sprintf;if(o)return o(t,...e);let s=0;return t.replace(/%(?:(\d+)\$)?[sd]/g,(n,r)=>{const i=r?Number.parseInt(r,10)-1:s++;return String(e[i]??"")})}function E(t,...e){return{__wpdHtml:!0,strings:t,values:e}}function Et(t){return!!t&&t.__wpdHtml===!0}const At="$$wpd$$",y=/\$\$wpd\$\$(\d+)\$\$/g,Tt="$$wpd-node$$",Rt=/^\$\$wpd-node\$\$(\d+)\$\$$/,$t=new Set(["style","script","textarea","title"]);function Lt(t){let e="",o=!1,s=null,n=!1,r=null,i="",a=!1;for(let l=0;l<t.length;l++){const c=t[l];e+=c;for(let d=0;d<c.length;d++){const u=c[d];if(n){c.startsWith("-->",d)&&(n=!1,d+=2);continue}if(r!==null){u==="<"&&c[d+1]==="/"&&c.slice(d+2,d+2+r.length).toLowerCase()===r&&(d+=1+r.length,r=null,o=!0,a=!1,i="");continue}if(s!==null){u===s&&(s=null);continue}if(o){u==='"'||u==="'"?(s=u,a=!1):u===">"?(o=!1,a=!1,$t.has(i)&&(r=i),i=""):a&&(/[a-zA-Z0-9-]/.test(u)?i+=u.toLowerCase():a=!1);continue}if(c.startsWith("<!--",d)){n=!0,d+=3;continue}const f=c[d+1]??"";u==="<"&&/[a-zA-Z/!]/.test(f)&&(o=!0,i="",a=/[a-zA-Z]/.test(f))}l<t.length-1&&(e+=o||n||r!==null?`${At}${l}$$`:`<!--${Tt}${l}$$-->`)}return e}const xe=new WeakMap;function Se(t){const e=xe.get(t);if(e)return e;const o=document.createElement("template");o.innerHTML=Lt(t);const s=[],n=(a,l)=>{if(a.nodeType===Node.ELEMENT_NODE){const u=a;for(const f of Array.from(u.attributes)){const m=f.name,p=f.value,_=m[0];if(y.test(p))if(y.lastIndex=0,_==="@"){const g=y.exec(p);y.lastIndex=0,s.push({path:l,kind:"event",name:m.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(m)}else if(_==="."){const g=y.exec(p);y.lastIndex=0,s.push({path:l,kind:"prop",name:m.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(m)}else if(_==="?"){const g=y.exec(p);y.lastIndex=0,s.push({path:l,kind:"bool",name:m.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(m)}else{const g=[],T=[];let S=0,N;for(y.lastIndex=0;(N=y.exec(p))!==null;)g.push(p.slice(S,N.index)),T.push(Number(N[1])),S=N.index+N[0].length;g.push(p.slice(S)),s.push({path:l,kind:"attr",name:m,template:g,valueIndices:T}),u.setAttribute(m,"")}}}const c=Array.from(a.childNodes);let d=0;for(let u=0;u<c.length;u++){const f=c[u],m=u+d;if(f.nodeType===Node.COMMENT_NODE){const p=Rt.exec(f.data);if(p){const _=document.createTextNode("");f.parentNode.replaceChild(_,f),s.push({path:[...l,m],kind:"node",valueIndex:Number(p[1])})}continue}if(f.nodeType===Node.TEXT_NODE){const p=f.textContent||"";if(!y.test(p)){y.lastIndex=0;continue}y.lastIndex=0;const _=f.parentNode;let g=0,T;const S=[],N=[];for(y.lastIndex=0;(T=y.exec(p))!==null;){T.index>g&&S.push(document.createTextNode(p.slice(g,T.index)));const ve=document.createTextNode("");S.push(ve),N.push({path:[...l,m+S.length-1],kind:"node",valueIndex:Number(T[1])}),g=T.index+T[0].length}g<p.length&&S.push(document.createTextNode(p.slice(g)));for(const ve of S)_.insertBefore(ve,f);_.removeChild(f),d+=S.length-1,s.push(...N)}else n(f,[...l,m])}};n(o.content,[]);const i={template:o,buildParts:a=>{const l=[];for(const c of s){let d=a;for(const u of c.path)d=d.childNodes[u];c.kind==="node"?l.push({kind:"node",valueIndex:c.valueIndex,child:{anchor:d,state:null}}):c.kind==="attr"?l.push({kind:"attr",element:d,name:c.name,template:c.template,valueIndices:c.valueIndices}):c.kind==="event"?l.push({kind:"event",valueIndex:c.valueIndex,element:d,name:c.name}):c.kind==="prop"?l.push({kind:"prop",valueIndex:c.valueIndex,element:d,name:c.name}):c.kind==="bool"&&l.push({kind:"bool",valueIndex:c.valueIndex,element:d,name:c.name})}return l}};return xe.set(t,i),i}const Ce=new WeakMap;function It(t,e){for(const o of t.nodes)if(o.parentNode!==e)return!1;return!0}function D(t,e){const o=Ce.get(e);if(o&&o.strings===t.strings&&It(o,e)){U(o.parts,t.values);return}const s=Se(t.strings),n=s.template.content.cloneNode(!0),r=s.buildParts(n),i=Array.from(n.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(n),U(r,t.values),Ce.set(e,{strings:t.strings,parts:r,nodes:i})}function U(t,e){for(const o of t)if(o.kind==="node")G(o.child,e[o.valueIndex]);else if(o.kind==="attr"){let s=o.template[0];for(let n=0;n<o.valueIndices.length;n++)s+=Ee(e[o.valueIndices[n]]),s+=o.template[n+1];s!==o.last&&(o.last=s,s===""?o.element.removeAttribute(o.name):o.element.setAttribute(o.name,s))}else if(o.kind==="event"){const s=e[o.valueIndex];s!==o.current&&(o.current&&o.element.removeEventListener(o.name,o.current),s&&o.element.addEventListener(o.name,s),o.current=s)}else if(o.kind==="prop"){const s=e[o.valueIndex];s!==o.last&&(o.last=s,o.element[o.name]=s)}else if(o.kind==="bool"){const s=!!e[o.valueIndex];s!==o.last&&(o.last=s,s?o.element.setAttribute(o.name,""):o.element.removeAttribute(o.name))}}function G(t,e){if(e==null||e===!1){t.state&&(R(t.state),t.state=null);return}if(Array.isArray(e)){Pt(t,e);return}if(Et(e)){Ot(t,e);return}if(e instanceof Node){Mt(t,e);return}Nt(t,Ee(e))}function Mt(t,e){const o=t.state;o?.shape==="node"&&o.node===e||(o&&R(o),j(t,[e]),t.state={shape:"node",node:e})}function Nt(t,e){const o=t.state;if(o?.shape==="text"){o.text!==e&&(o.node.textContent=e,o.text=e);return}o&&R(o);const s=document.createTextNode(e);j(t,[s]),t.state={shape:"text",node:s,text:e}}function Ot(t,e){const o=t.state;if(o?.shape==="template"&&o.strings===e.strings){U(o.parts,e.values);return}o&&R(o);const s=Se(e.strings),n=s.template.content.cloneNode(!0),r=s.buildParts(n),i=Array.from(n.childNodes);j(t,[n]),U(r,e.values),t.state={shape:"template",strings:e.strings,parts:r,nodes:i}}function Pt(t,e){const o=t.state;if(o?.shape==="array"){const n=Math.min(o.entries.length,e.length);for(let r=0;r<n;r++)G(o.entries[r],e[r]);if(e.length<o.entries.length){for(let r=e.length;r<o.entries.length;r++){const i=o.entries[r];i.state&&R(i.state),i.anchor.remove()}o.entries.length=e.length}else for(let r=o.entries.length;r<e.length;r++){const i=document.createTextNode("");j(t,[i]);const a={anchor:i,state:null};G(a,e[r]),o.entries.push(a)}return}o&&R(o);const s=[];for(const n of e){const r=document.createTextNode("");j(t,[r]);const i={anchor:r,state:null};G(i,n),s.push(i)}t.state={shape:"array",entries:s}}function j(t,e){const o=t.anchor.parentNode;if(o)for(const s of e)o.insertBefore(s,t.anchor)}function R(t){if(t.shape==="text"){t.node.remove();return}if(t.shape==="template"){for(const e of t.parts)e.kind==="node"&&e.child.state&&(R(e.child.state),e.child.state=null);for(const e of t.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(t.shape==="node"){t.node.parentNode&&t.node.parentNode.removeChild(t.node);return}for(const e of t.entries)e.state&&R(e.state),e.anchor.remove()}function Ee(t){return t==null||t===!1?"":String(t)}const Ht="data-os-mode";function Ae(t=typeof document<"u"?document.documentElement:null){return!!t&&t.getAttribute(Ht)==="mobile"}function zt(t,e=null){const o=e??(typeof document<"u"?document.documentElement:null);if(!!o&&Ae(o)){t.hasAttribute("stacked")||t.setAttribute("stacked","");const r=t.getAttribute("sticky-columns");return r!==null&&(t.setAttribute("data-os-sticky-columns",r),t.removeAttribute("sticky-columns")),!0}t.hasAttribute("stacked")&&t.removeAttribute("stacked");const n=t.getAttribute("data-os-sticky-columns");return n!==null&&(t.setAttribute("sticky-columns",n),t.removeAttribute("data-os-sticky-columns")),!1}function Dt(t,e){const o=e.local??{},s={id:t,hasLocal:i=>Object.prototype.hasOwnProperty.call(o,i),runLocal:(i,a,l,c)=>{const d=o[i];if(!d)return a;const u={...a},f=d(u,l,c);return f===void 0?u:f},render:i=>{D(e.view(i),i.root),e.updated?.(i)},mounted:i=>e.mounted?.(i)},{placeholder:n}=e;n&&(s.placeholder=i=>n(i));const r=window;return(r.openStationApps??(r.openStationApps={}))[t]=s,s}class Te extends Error{constructor(e,o){super(e||o.serverMessage||`HTTP ${o.status}`),this.name="RestError",this.status=o.status,this.code=o.code,this.data=o.data,this.serverMessage=o.serverMessage??""}}function Re(t){return t instanceof Te}function jt(t){const e=typeof t=="object"&&t!==null?t:void 0;return{code:typeof e?.code=="string"?e.code:void 0,data:e?.data,serverMessage:typeof e?.message=="string"?e.message:""}}function Ft(t,e,o=""){return new Te(o,{status:t,...jt(e)})}async function $e(t,e=""){let o=null;try{o=await t.json()}catch{o=null}return Ft(t.status,o,e)}const Wt="rest_cookie_invalid_nonce",Le=()=>h("Could not reach the site. Check your connection and try again.","desktop-mode");function Ie(t){return typeof navigator<"u"&&navigator.onLine===!1?!0:t instanceof TypeError}function qt(t){return Re(t)?t.code===Wt||t.status===401?"session":t.status>=200&&t.status<300?"unreadable":t.status===404?"gone":t.status>=500?"server":t.status>=400?"refused":"unknown":Ie(t)?"offline":"unknown"}function Bt(t){return Re(t)?t.serverMessage:Ie(t)?Le():t instanceof Error?t.message:""}function Vt(t,e){const{fallback:o,lead:s}=e,n=qt(t),r=n==="offline"||n==="unreadable"?"warning":"error";let i="",a=!0;switch(n){case"offline":i=Le();break;case"session":i=h("Your session has expired. Reload the page and try again.","desktop-mode");break;case"unreadable":i=h("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 c=t;c.serverMessage?i=c.serverMessage:n==="gone"?(i=h("It no longer exists. Reload the page to catch up.","desktop-mode"),a=!1):n==="server"?(i=C(h("The server answered with error %d.","desktop-mode"),c.status),a=!1):(i=C(h("The server refused the request (HTTP %d).","desktop-mode"),c.status),a=!1);break}case"unknown":default:i=Bt(t);break}let l;return s?l=i?`${s}: ${i}`:o:i?a?l=i:l=`${o} ${i}`:l=o,{message:l,reason:i,kind:n,type:r}}function ne(t,e,o){if(!t)return;const{duration:s,...n}=o,r=Vt(e,n),i={message:r.message,type:r.type};s&&(i.duration=s),t(i)}const Me="__openStationSharedStores";function Kt(){const t=window;let e=t[Me];return e||(e=new Map,t[Me]=e),e}function X(t,e){const o=Kt();let s=o.get(t);s||(s={state:e(),listeners:new Set,rebuild:e},o.set(t,s));const n={get state(){return s.state},set state(r){s.state=r},getState(){return s.state},notify(){for(const r of Array.from(s.listeners))try{r(s.state)}catch(i){console.error(`[desktop-mode/shared-store:${t}] subscriber threw:`,i)}},subscribe(r){return s.listeners.add(r),()=>{s.listeners.delete(r)}},setState(r){const i=s.state;if(typeof i!="object"||i===null){console.warn(`[desktop-mode/shared-store:${t}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(i,r),n.notify()},reset(){const r=s.rebuild(),i=s.state;if(typeof i=="object"&&i!==null&&typeof r=="object"&&r!==null){const a=i;for(const l of Object.keys(a))delete a[l];Object.assign(a,r)}else s.state=r;s.listeners.clear()}};return n}const v=X("openstation/trash-optimistic",()=>({changes:new Map,reconcile:new Set})),A=t=>`${t.type}:${t.id}`;function Ut(){return Array.from(v.state.changes.values())}function Gt(t,e){const o=v.subscribe(t);return e&&v.state.reconcile.add(e),()=>{o(),e&&v.state.reconcile.delete(e)}}function re(t,e="in"){const o=A(t);if(v.state.changes.get(o)?.pending)return null;const s={item:t,direction:e,pending:!0};return v.state.changes.set(o,s),v.notify(),{async finish(n){v.state.changes.get(o)!==s||!s.pending||(s.pending=!1,n&&(v.notify(),await Promise.allSettled(Array.from(v.state.reconcile,async r=>r()))),v.state.changes.get(o)===s&&(v.state.changes.delete(o),v.notify()))}}}function Ne(t,e,o="",s=""){const n=new Map(t.map(i=>[A(i),i]));let r=e;for(const{item:i,direction:a}of Ut()){const l=A(i);if(a==="out"){n.delete(l)&&r--;continue}const c=(!o||o===i.type||o==="desktop"&&["placement","shortcut","folder"].includes(i.type))&&(!s||`${i.title} ${i.subtitle}`.toLocaleLowerCase().includes(s.toLocaleLowerCase()));n.has(l)||r++,c&&n.set(l,{...n.get(l)??i,can_restore:!1,can_purge:!1})}return{items:Array.from(n.values()),total:Math.max(0,r)}}const M=class M 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(Pe)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,o,s){if(o===s)return;const n=Xt(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,o){return this.dispatchEvent(new CustomEvent(e,{detail:o,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const o of e.props){if(Object.getOwnPropertyDescriptor(this,o))continue;const s=Pe(o);Object.defineProperty(this,o,{get:()=>o in this._propValues?this._propValues[o]:this.getAttribute(s),set:n=>{let r;n==null||n===!1?r=null:n===!0?r="":r=String(n),this._propValues[o]=r,r===null?this.removeAttribute(s):this.setAttribute(s,r),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&D(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const o=e.styles.map(s=>s.sheet).filter(s=>s!==null);if(this.shadowRoot.adoptedStyleSheets=o,o.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(!M._lightStylesAdopted.has(e)){M._lightStylesAdopted.add(e);for(const o of e.styles){const s=document.createElement("style");s.dataset.osUi=this.tagName.toLowerCase(),s.textContent=o.cssText,document.head.appendChild(s)}}}};M.props=[],M.styles=[],M.shadow=!0,M._lightStylesAdopted=new WeakSet;let Y=M;function Oe(t,e){customElements.get(t)||customElements.define(t,e)}function Pe(t){return t.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function Xt(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}const Yt=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function k(t,...e){let o=t[0];for(let s=1;s<t.length;s++){const n=e[s-1];if(typeof n=="string"||typeof n=="number")o+=String(n);else if(n&&n.__wpdCss)o+=n.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof n);o+=t[s]}if(Yt){const s=new CSSStyleSheet;return s.replaceSync(o),{__wpdCss:!0,sheet:s,cssText:o}}return{__wpdCss:!0,sheet:null,cssText:o}}const He=k`: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 ) )}`,Zt=k` .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%}}`,Jt=k` .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%}}`,Qt=k` .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}}`,eo=k` .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}}`,to=k` .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}}`,oo=k` .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%}}`,so=k` .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}}`,no=k` 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}}`,ze=k` 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}}`,ro=k` @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}}`;k` ${He} ${Zt} ${Jt} ${Qt} ${eo} ${to} ${oo} ${so} ${no} ${ze} ${ro} `;const io=k` ${He} ${ze}: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}}`,O="__wpd_expander__",P="__wpd_select__",V=class V extends Y{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,o)=>o,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 o=new Set(this._columns.map(s=>s.key));for(const s of Object.keys(this._filters))o.has(s)||delete this._filters[s];for(const s of Array.from(this._filterCache.keys()))o.has(s)||this._filterCache.delete(s);this._sort&&!o.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((o,s)=>{this._selection.has(this._getRowId(o,s))&&e.push(o)}),e}get visibleRows(){return this._filteredRows().map(e=>e.row)}get getRowId(){return this._getRowId}set getRowId(e){this._getRowId=typeof e=="function"?e:(o,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 o=0;o<this._data.length;o++)this._subTable(this._data[o],o)&&(this._expanded.has(o)||(this._expanded.add(o),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 o=this._readSelectable(),s=o==="single"?Array.from(this._selection):[];o==="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:o}of this._filteredRows())this._selection.add(this._getRowId(e,o));this._emitSelectionChange(),this._syncSelectionDom("all")}}clearSelection(){this._selection.size!==0&&(this._selection.clear(),this._emitSelectionChange(),this._syncSelectionDom("all"))}_syncSelectionDom(e){const o=this.shadowRoot;if(!o)return;const s=o.querySelector("tbody");if(!s)return;let n=null;if(e!=="all"){n=new Set;for(const a of e)n.add(String(a))}const r=s.querySelectorAll("tr[data-row-id]");for(const a of r){const l=a.dataset.rowId;if(l===void 0||n&&!n.has(l))continue;const c=Number(a.dataset.rowIndex);if(!Number.isFinite(c))continue;const d=this._data[c];if(d===void 0)continue;const u=this._getRowId(d,c),f=this._selection.has(u);a.classList.toggle("is-selected",f);const m=a.querySelector("input.select-row-checkbox");m&&m.checked!==f&&(m.checked=f)}const i=o.querySelector("thead .select-all-checkbox");if(i){const{total:a,selected:l}=this._visibleSelectionStats();i.checked=a>0&&l===a,i.indeterminate=l>0&&l<a}}scrollToRow(e){const o=this.shadowRoot;if(!o)return;const n=o.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 E` | |
| 2 | + <div class="scroll" part="scroll"> | |
| 3 | + <table part="table"> | |
| 4 | + <colgroup></colgroup> | |
| 5 | + <thead></thead> | |
| 6 | + <tbody></tbody> | |
| 7 | + </table> | |
| 8 | + </div> | |
| 9 | + `}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")||D(this.render(),e);const o=e.querySelector("colgroup"),s=e.querySelector("thead"),n=e.querySelector("tbody");if(!o||!s||!n)return;const r=this._effectiveColumns();this._stacked=this.hasAttribute("stacked");const i=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(r,i),this._paintColgroup(o,r),this._paintHead(s,r,i),this._paintBody(n,r,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,o){const s=[];for(const n of o){const r=document.createElement("col");n.width&&(r.style.width=n.width),s.push(r)}e.replaceChildren(...s)}_paintHead(e,o,s){const n=document.createElement("tr");n.setAttribute("part","header-row");for(let l=0;l<o.length;l++)n.appendChild(this._buildHeaderCell(o[l],l,s));const r=e.querySelector(':scope > tr[part="header-row"]');r?e.replaceChild(n,r):e.insertBefore(n,e.firstChild);const i=o.some(l=>l.filter||Array.isArray(l.filterOptions)||typeof l.filterRender=="function");let a=e.querySelector(":scope > tr.filter-row");if(i){const l=[];for(let u=0;u<o.length;u++)l.push(this._buildFilterCell(o[u],u,s));a||(a=document.createElement("tr"),a.classList.add("filter-row"),a.setAttribute("part","filter-row"),e.appendChild(a));const c=Array.from(a.children);let d=c.length===l.length;if(d){for(let u=0;u<l.length;u++)if(c[u]!==l[u]){d=!1;break}}if(!d){const u=new Set(l);for(const f of l)a.appendChild(f);for(const f of Array.from(a.children))u.has(f)||a.removeChild(f)}}else a&&a.remove()}_buildHeaderCell(e,o,s){const n=document.createElement("th");if(n.setAttribute("scope","col"),n.dataset.key=e.key,this._applyCellClasses(n,e,o,s),e.minWidth&&(n.style.minWidth=e.minWidth),e.key===P){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:a,selected:l}=this._visibleSelectionStats();i.checked=a>0&&l===a,i.indeterminate=l>0&&l<a,i.addEventListener("change",()=>{i.checked?this.selectAll():this.clearSelection()}),n.appendChild(i)}return n}if(n.textContent=e.label??(e.key===O?"":e.key),e.sortable){n.classList.add("is-sortable");const r=this._sort?.key===e.key,i=document.createElement("span");i.className="sort-indicator";let a="";r&&(a=this._sort.direction==="asc"?" ▲":" ▼"),i.textContent=a,n.appendChild(i),r&&n.classList.add(this._sort.direction==="asc"?"sort-asc":"sort-desc"),n.addEventListener("click",()=>this._cycleSort(e.key))}return n}_buildFilterCell(e,o,s){const n=this._filterCache.get(e.key),r=Array.isArray(e.filterOptions),i=typeof e.filterRender=="function";let a;if(!e.filter&&!r&&!i||e.key===O||e.key===P?a="none":i?a="custom":e.filter==="select"||r?a="select":a="text",n&&n.kind===a){if(n.th.className="",this._applyCellClasses(n.th,e,o,s),a==="select"){const u=n.control,f=this._resolveFilterOptions(e),m=f.map(p=>p.value).join("|");m!==n.optionsKey?(this._populateSelect(u,f,this._filters[e.key]??""),n.optionsKey=m):u.value=this._filters[e.key]??""}else if(a==="text"){const u=n.control,f=this._filters[e.key]??"";u.value!==f&&u.ownerDocument.activeElement!==u&&(u.value=f)}else a==="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 l=document.createElement("th");if(this._applyCellClasses(l,e,o,s),a==="none")return this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"none"}),l;if(a==="custom"&&e.filterRender)return e.filterRender(l,{value:this._filters[e.key]??"",setValue:u=>this._onFilterChange(e.key,u),col:e}),this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"custom"}),l;let c,d="";if(a==="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 f=this._resolveFilterOptions(e);this._populateSelect(u,f,this._filters[e.key]??""),d=f.map(m=>m.value).join("|"),u.addEventListener("change",()=>{this._onFilterChange(e.key,u.value)}),c=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)}),c=u}return l.appendChild(c),this._filterCache.set(e.key,{th:l,control:c,optionsKey:d,kind:a}),l}_populateSelect(e,o,s){e.replaceChildren();const n=document.createElement("option");n.value="",n.textContent="All",e.appendChild(n);for(const r of o){const i=document.createElement("option");i.value=r.value,i.textContent=r.label,r.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(o=>({value:o,label:o}))}_paintBody(e,o,s){if(e.replaceChildren(),this.hasAttribute("loading")){const r=this._readLoadingRows();for(let i=0;i<r;i++)e.appendChild(this._buildSkeletonRow(o,i));return}const n=this._sortedRows(this._filteredRows());if(n.length===0){e.appendChild(this._buildEmptyRow(o.length));return}for(const{row:r,index:i}of n)if(e.appendChild(this._stacked?this._buildStackedRow(r,i,o):this._buildBodyRow(r,i,o,s)),this._expanded.has(i)&&this._subTable){const a=this._subTable(r,i);a&&e.appendChild(this._buildSubTableRow(a,o.length))}}_buildEmptyRow(e){const o=document.createElement("tr");o.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),o.appendChild(s),o}_buildSkeletonRow(e,o){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 r of[55+o*7%25,30+o*11%15]){const i=document.createElement("span");i.className="skeleton-bar",i.style.width=`${r}%`,n.appendChild(i)}return s.appendChild(n),s}for(const n of e){const r=document.createElement("td"),i=document.createElement("span");i.className="skeleton-bar";const a=50+(o*7+s.children.length*13)%40;i.style.width=`${a}%`,r.appendChild(i),s.appendChild(r)}return s}_buildBodyRow(e,o,s,n){const r=document.createElement("tr");r.setAttribute("part","row"),r.dataset.rowIndex=String(o);const i=this._getRowId(e,o);r.dataset.rowId=String(i),this._selection.has(i)&&r.classList.add("is-selected"),r.addEventListener("click",a=>{this._onRowClick(e,o,a)});for(let a=0;a<s.length;a++)r.appendChild(this._buildBodyCell(s[a],a,e,o,n));return r}_buildStackedRow(e,o,s){const n=document.createElement("tr");n.setAttribute("part","row"),n.classList.add("stack-row"),n.dataset.rowIndex=String(o);const r=this._getRowId(e,o);n.dataset.rowId=String(r),this._selection.has(r)&&n.classList.add("is-selected"),n.addEventListener("click",c=>{this._onRowClick(e,o,c)});const i=document.createElement("td");i.className="stack-body";let a=0,l=0;for(let c=0;c<s.length;c++){const d=s[c];if(d.key===P||d.key===O){n.appendChild(this._buildBodyCell(d,c,e,o,0));continue}l++;const u=ao(d,a++);if(u==="hidden")continue;const f=document.createElement("div");if(f.className=`stack-cell stack-${u}`,f.dataset.key=d.key,u==="meta"&&d.label){const g=document.createElement("span");g.className="stack-label",g.textContent=d.label,f.appendChild(g)}const m=document.createElement("span");m.className="stack-value";const p=e[d.key],_=Z(p);d.render?this._mountCellContent(m,d.render(p,e,o)):_!==null?m.appendChild(this._slotFor(_)):p!=null&&(m.textContent=String(p)),f.appendChild(m),i.appendChild(f)}return i.colSpan=Math.max(1,l),n.appendChild(i),n}_buildBodyCell(e,o,s,n,r){const i=document.createElement("td");if(this._applyCellClasses(i,e,o,r),e.minWidth&&(i.style.minWidth=e.minWidth),e.key===P){const c=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(c),d.addEventListener("change",()=>{d.checked?this.select(c):this.deselect(c)}),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===O){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",f=>{this._toggleRow(n,s,f)}),i.appendChild(u),i}const a=s[e.key],l=Z(a);if(e.render){const c=e.render(a,s,n);this._mountCellContent(i,c)}else l!==null?i.appendChild(this._slotFor(l)):a!=null&&(i.textContent=String(a));return i}_slotFor(e){const o=document.createElement("slot");return o.name=e,o}_buildSubTableRow(e,o){const s=document.createElement("tr");s.classList.add("subtable"),s.setAttribute("part","subtable-row");const n=document.createElement("td");n.colSpan=o;const r=document.createElement("div");if(r.classList.add("subtable-inner"),e instanceof Node)r.appendChild(e);else if(De(e))D(e,r);else{const i=document.createElement("os-table");i.columns=e.columns,i.data=e.data,e.subTable&&(i.subTable=e.subTable),r.appendChild(i)}return n.appendChild(r),s.appendChild(n),s}_mountCellContent(e,o){if(typeof o=="string"){e.textContent=o;return}if(o instanceof Node){e.appendChild(o);return}De(o)&&D(o,e)}_onFilterChange(e,o){o===""?delete this._filters[e]:this._filters[e]=o,this.emit("os-table-filter-change",{filters:{...this._filters}});const n=this.shadowRoot?.querySelector("tbody");if(n){const r=this._effectiveColumns(),i=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(r,i),this._paintBody(n,r,i),this._applyStickyOffsets()}}_onRowClick(e,o,s){const n=s.composedPath?.()??[];for(const r of n){if(r instanceof Element&&r.hasAttribute("data-noclick"))return;if(r===this)break}this.emit("os-table-row-click",{row:e,index:o,originalEvent:s})}_toggleRow(e,o,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:o,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=[],o=Object.keys(this._filters).filter(s=>this._filters[s]!=="");for(let s=0;s<this._data.length;s++){const n=this._data[s];let r=!0;for(const i of o){const a=this._columns.find(u=>u.key===i);if(a&&typeof a.filterRender=="function")continue;const l=this._filters[i]??"",c=n[i],d=ae(c);if(a?.filter==="select"){if(d!==l){r=!1;break}}else if(!d.toLowerCase().includes(l.toLowerCase())){r=!1;break}}r&&e.push({row:n,index:s})}return e}_sortedRows(e){if(!this._sort)return e;const o=this._columns.find(r=>r.key===this._sort.key);if(!o)return e;const s=this._sort.direction==="desc"?-1:1,n=e.slice();return n.sort((r,i)=>{const a=r.row[o.key],l=i.row[o.key],c=o.sortValue?o.sortValue(r.row,a):je(a),d=o.sortValue?o.sortValue(i.row,l):je(l);return lo(c,d)*s}),n}_uniqueValues(e){const o=new Set;for(const s of this._data){const n=s[e];n!=null&&o.add(ae(n))}return Array.from(o).sort()}_visibleSelectionStats(){let e=0,o=0;for(const{row:s,index:n}of this._filteredRows())e++,this._selection.has(this._getRowId(s,n))&&o++;return{total:e,selected:o}}_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,o,s){return this._stacked||s.sticky===!1?!1:s.sticky===!0?!0:e<o}_computeLastStickyIndex(e,o){let s=-1;for(let n=0;n<e.length;n++)this._isStickyIndex(n,o,e[n])&&(s=n);return s}_applyCellClasses(e,o,s,n){o.key===O&&e.classList.add("col-expander"),o.key===P&&e.classList.add("col-select"),o.align==="center"&&e.classList.add("align-center"),o.align==="end"&&e.classList.add("align-end"),this._isStickyIndex(s,n,o)&&(e.classList.add("is-sticky"),s===this._lastStickyIndex&&e.classList.add("is-sticky-edge"))}_effectiveColumns(){const e=[];return this._readSelectable()&&e.push({key:P,label:"",width:"40px",align:"center"}),this._subTable&&e.push({key:O,label:"",width:"36px",align:"center"}),e.push(...this._columns),e}_applyStickyOffsets(){const e=this.shadowRoot;if(!e)return;const o=e.querySelector("thead tr");if(!o)return;const s=Array.from(o.children),n=[];let r=0;for(let a=0;a<s.length;a++)n[a]=r,s[a].classList.contains("is-sticky")&&(r+=s[a].offsetWidth);e.querySelectorAll("thead tr, tbody tr:not(.subtable):not(.empty):not(.skeleton)").forEach(a=>{const l=Array.from(a.children);for(let c=0;c<l.length;c++)l[c].classList.contains("is-sticky")&&(l[c].style.insetInlineStart=`${n[c]}px`)}),this._maybeWarnStickyOffsetRace(s,n)}_maybeWarnStickyOffsetRace(e,o){if(this._stickyRaceWarned)return;const s=this._readStickyColumns();if(s<2)return;const n=Math.min(s-1,e.length-1);if(n<=0||o[n]!==0||this.offsetWidth===0)return;this._stickyRaceWarned=!0;const r=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 ${r}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 o=e.querySelector("thead tr");if(!o)return;const s=o.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."))}};V.props=["stickyColumns","stickyHeader","striped","hover","compact","bordered","empty","loading","loadingRows","selectable","stacked"],V.styles=[io],V.help=void 0;let ie=V;function De(t){return!!t&&t.__wpdHtml===!0}function ao(t,e){return t.stack?t.stack:e===0?"title":t.label?"meta":"actions"}function Z(t){return t&&typeof t=="object"&&typeof t.slot=="string"?t.slot:null}function ae(t){if(t==null)return"";if(Z(t)!==null){const e=t.text;return e==null?"":String(e)}return String(t)}function je(t){return Z(t)!==null?ae(t):t}function lo(t,e){if(t===e)return 0;if(t==null)return-1;if(e==null)return 1;if(typeof t=="number"&&typeof e=="number")return t-e;if(t instanceof Date&&e instanceof Date)return t.getTime()-e.getTime();const o=Number(t),s=Number(e);return Number.isFinite(o)&&Number.isFinite(s)?o-s:String(t).localeCompare(String(e))}Oe("os-table",ie);const co=1e3;async function uo(t){const{emptyBin:e,onProgress:o,maxIterations:s=co}=t;let n=0,r=0,i=0,a=0,l="iteration-cap";for(let c=0;c<s;c++){const d=await e();if(n+=d.purged,r+=d.skipped,a=d.remaining,c===0&&(i=n+d.remaining),o?.({purged:n,skipped:r,initialTotal:i}),d.remaining===0){l="empty";break}if(d.purged===0&&d.skipped>0){l="no-progress";break}}return{purged:n,skipped:r,initialTotal:i,remaining:a,stoppedBecause:l}}const ho="os-recycle-bin-changed",fo="openstation_recycle_bin_seen_ts",po="os-recycle-bin-changed",b={started:!1,seenTs:0,postMessageHandler:null,heartbeatSendHandler:null,heartbeatTickHandler:null};function Fe(t,e){const o={kind:"external",ok:0,errors:[],source:t,ts:e};document.dispatchEvent(new CustomEvent(ho,{detail:o}));const s=window.wp?.hooks;s&&typeof s.doAction=="function"&&s.doAction("openstation.recycleBin.changed",o)}function mo(){if(b.started)return;b.started=!0,b.seenTs=Date.now();const t=window.location.origin;b.postMessageHandler=o=>{if(o.origin!==t)return;const s=o.data;if(!s||s.type!==po)return;const n=typeof s.ts=="number"?s.ts:Date.now();n<=b.seenTs||(b.seenTs=n,Fe("chromeless",n))},window.addEventListener("message",b.postMessageHandler);const e=window.jQuery;e&&(b.heartbeatSendHandler=(...o)=>{const s=o[1];s&&(s[fo]=b.seenTs)},e(document).on("heartbeat-send",b.heartbeatSendHandler),b.heartbeatTickHandler=(...o)=>{const n=o[1]?.openstation_recycle_bin;if(!n)return;const r=typeof n.ts=="number"?n.ts:0;r>b.seenTs&&(b.seenTs=r,n.changed&&Fe("heartbeat",r))},e(document).on("heartbeat-tick",b.heartbeatTickHandler))}function bo(){if(!b.started)return;b.started=!1,b.postMessageHandler&&(window.removeEventListener("message",b.postMessageHandler),b.postMessageHandler=null);const t=window.jQuery;t&&(b.heartbeatSendHandler&&t(document).off("heartbeat-send",b.heartbeatSendHandler),b.heartbeatTickHandler&&t(document).off("heartbeat-tick",b.heartbeatTickHandler)),b.heartbeatSendHandler=null,b.heartbeatTickHandler=null}function le(t){const e=document.createElement("textarea");return e.innerHTML=t,e.value}const go=k`:host{display:inline;color:inherit;font:inherit}`,J=new Set;let F=null;const yo=3e4;function ko(){F===null&&(F=window.setInterval(()=>{for(const t of J)t.tick()},yo))}function _o(){F!==null&&J.size===0&&(window.clearInterval(F),F=null)}function vo(t){if(!t)return null;const e=o=>{const s=new Date(o);return Number.isNaN(s.getTime())?null:s};return wo(t)?e(t):e(t.replace(" ","T")+"Z")}function wo(t){const e=Math.max(t.indexOf("T"),t.indexOf(" ")),o=e===-1?"":t.slice(e+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(o)}let ce=null,de=null;function We(){return typeof navigator<"u"&&navigator.language||"en"}function xo(){return ce||(ce=new Intl.RelativeTimeFormat(We(),{numeric:"auto"})),ce}function qe(){return de||(de=new Intl.RelativeTimeFormat(We(),{numeric:"always",style:"narrow"})),de}function So(t,e){const o=xo(),s=t.getTime()-e,n=Math.round(s/1e3),r=Math.abs;return r(n)<45?o.format(0,"second"):Be(o,n)}function Be(t,e){const o=Math.abs,s=Math.round(e/60);if(o(s)<45)return t.format(s,"minute");const n=Math.round(s/60);if(o(n)<22)return t.format(n,"hour");const r=Math.round(n/24);if(o(r)<26)return t.format(r,"day");const i=Math.round(r/30);if(o(i)<11)return t.format(i,"month");const a=Math.round(r/365);return t.format(a,"year")}function Co(t,e){const o=Math.round((t.getTime()-e)/1e3),s=Math.abs;return s(o)<45?qe().format(0,"second"):s(o)>604800?t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):Be(qe(),o)}const K=class K extends Y{connectedCallback(){super.connectedCallback(),J.add(this),ko()}disconnectedCallback(){J.delete(this),_o()}tick(){this.requestUpdate()}render(){const e=this.datetime,o=vo(e);if(!o)return E`<span>${e??""}</span>`;const s=Date.now(),n=this.hasAttribute("compact")?Co(o,s):So(o,s),r=o.toLocaleString();return E`<time datetime=${o.toISOString()} title=${r} | |
| 10 | + >${n}</time | |
| 11 | + >`}};K.props=["datetime","compact"],K.styles=[go],K.help=void 0;let ue=K;Oe("os-relative-time",ue);function Eo(){const t=window.wp?.hooks;if(!t)throw new Error("[openstation] `window.wp.hooks` is not available. The plugin declares `wp-hooks` as a script dependency; if you are seeing this error, verify the enqueue order.");return t}function Ve(t,e,...o){return Eo().applyFilters(t,e,...o)}const Ke={DESKTOP_THEME_ICON:"os.os-theme.icon",DESKTOP_THEME_ICON_COLOR:"os.os-theme.icon-color"},Ue=X("desktop-mode/dock-rail-registry",()=>({registry:new Map,listeners:new Set,activeId:"default"}));Ue.state.registry,Ue.state.listeners;class Ao extends Error{constructor(e,o,s){super(`[openstation] ${e} registration rejected — fields: `+o.join(", ")+"."),this.name="RegistrationError",this.kind=e,this.errors=o,this.def=s}}function To(t,e,o){if(e.length!==0)throw new Ao(t,e,o)}const $=[[0,0],[100,0],[100,100],[0,100]],Ro=48,$o=80,he=6,fe=8,Ge=4,Xe=3,Ye=64,pe=105,L=2;function Ze(t){return`${Math.round(t*1e3)/1e3}%`}function I(t){return t.slice().reverse()}function W(t,e,o,s){return[[t,e],[o,e],[o,s],[t,s]]}function Lo(t,e,o,s){const n=[];for(let r=0;r<s;r++){const i=r/s*Math.PI*2;n.push([t+Math.cos(i)*o,e+Math.sin(i)*o])}return n}function x(t,e=[]){const o=[],s=n=>{o.push(`${Ze(n[0])} ${Ze(n[1])}`)};for(const n of t)s(n);if(e.length>0){s(t[0]);for(const n of e){for(const r of n)s(r);s(n[0]),s(t[0])}}return`polygon( ${o.join(", ")} )`}function Je(t){return x($,[I(Lo(50,50,t,Ro))])}function Qe(t){return x($,[I(W(50-t,-L,50+t,100+L))])}function et(t){const e=100/he,o=[];for(let s=0;s<he;s++){const n=s*e;o.push(I(W(-L,n,100+L,n+t)))}return x($,o)}function tt(t){return x($,[I(W(-L,50-t,100+L,50+t))])}function ot(t){const e=100/fe,o=[];for(let s=0;s<fe;s++){const n=s*e;o.push(I(W(n,-L,n+t,100+L)))}return x($,o)}function st(t){return x($,[I([[50,50-t],[50+t,50],[50,50+t],[50-t,50]])])}function nt(t){const e=100/Ge,o=100/Xe,s=[];for(let n=0;n<Xe;n++)for(let r=0;r<Ge;r++){const i=r*e+e/2,a=n*o+o/2,l=e/2*t,c=o/2*t;s.push(I(W(i-l,a-c,i+l,a+c)))}return x($,s)}function rt(t){const e=-Math.PI/2,o=t/180*Math.PI,s=[[50,50]];for(let n=0;n<Ye;n++){const r=e+n/(Ye-1)*o;s.push([50+Math.cos(r)*pe,50+Math.sin(r)*pe])}return x($,[I(s)])}function Io(){return{from:Je(0),to:Je($o)}}function Mo(){return{from:Qe(0),to:Qe(52)}}function No(){return{from:et(0),to:et(100/he+.5)}}function Oo(){return{from:tt(0),to:tt(52)}}function Po(){return{from:ot(0),to:ot(100/fe+.5)}}function Ho(){return{from:st(0),to:st(pe)}}function zo(){return{from:nt(0),to:nt(1.04)}}function Do(){return{from:rt(0),to:rt(360)}}function jo(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 100% 0% )"}}function Fo(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 0% 100% )"}}function Wo(){return{from:x([[-60,0],[100,0],[100,100],[0,100]]),to:x([[100,0],[260,0],[260,100],[160,100]])}}const me=6,be=100,H=be/2,Q=200,it=90,at=["#5c5c6d","#525261","#484855","#3e3e49","#34343d","#2a2a31"],qo="#101014",Bo=1.25,z="http://www.w3.org/2000/svg";let Vo=0;function ee(t){return Math.round(t*1e3)/1e3}function ge(t){return t/me*Math.PI*2-Math.PI/2}function Ko(t){const o=ge(t)+Math.PI/me+Math.PI/2;return{x:Math.cos(o),y:Math.sin(o)}}function Uo(t){const e=ge(t),o=ge(t+1);return[[H,H],[H+Math.cos(e)*Q,H+Math.sin(e)*Q],[H+Math.cos(o)*Q,H+Math.sin(o)*Q]]}function lt(t,e){const o=Uo(t),s=document.createElementNS(z,"path");return s.setAttribute("d",`M ${o.map(([n,r])=>`${ee(n)} ${ee(r)}`).join(" L ")} Z`),e?s.setAttribute("fill","#fff"):(s.setAttribute("fill",at[t%at.length]),s.setAttribute("stroke",qo),s.setAttribute("stroke-width",String(Bo)),s.setAttribute("vector-effect","non-scaling-stroke"),s.setAttribute("stroke-linejoin","round")),s}function Go(){const t=`os-iris-${++Vo}`,e=document.createElementNS(z,"svg");e.setAttribute("viewBox",`0 0 ${be} ${be}`),e.setAttribute("preserveAspectRatio","none"),e.setAttribute("aria-hidden","true"),e.style.width="100%",e.style.height="100%",e.style.display="block";const o=document.createElementNS(z,"defs"),s=document.createElementNS(z,"mask");s.setAttribute("id",t);const n=document.createElementNS(z,"g"),r=document.createElementNS(z,"g");r.setAttribute("mask",`url(#${t})`);const i=[];for(let l=0;l<me;l++){const c=lt(l,!0),d=lt(l,!1);n.appendChild(c),r.appendChild(d),i.push({el:c,index:l},{el:d,index:l})}s.appendChild(n),o.appendChild(s),e.appendChild(o),e.appendChild(r);const a=document.createElement("div");return a.appendChild(e),{element:a,play:l=>i.map(({el:c,index:d})=>{const u=Ko(d),f=ee(u.x*it),m=ee(u.y*it);return c.animate([{transform:"translate( 0px, 0px )"},{transform:`translate( ${f}px, ${m}px )`}],{duration:l.duration,easing:l.easing,delay:l.delay,fill:"both"})})}}const Xo="none",ct=X("desktop-mode/window-reveal-registry",()=>({registry:new Map,listeners:new Set})),Yo=ct.state.registry,Zo=ct.state.listeners,dt=/^[a-z0-9_/-]+$/;function ut(t){const e=/^\s*([a-zA-Z-]+)\s*\(/.exec(t);return e?e[1].toLowerCase():""}function ht(t,e){const o=[],s=typeof t.from=="string"&&t.from.trim()!=="",n=typeof t.to=="string"&&t.to.trim()!=="";if(s||o.push(`${e}.from (missing — the clip-path covering the window)`),n||o.push(`${e}.to (missing — the clip-path uncovering the window)`),s&&n){const r=ut(t.from),i=ut(t.to);r===""||i===""?o.push(`${e}.from|to (must be shape functions, e.g. \`inset( … )\` or \`polygon( … )\` — bare keywords like \`none\` cannot be animated)`):r!==i&&o.push(`${e}.from|to (must use the same shape function to interpolate — got \`${r}()\` and \`${i}()\`)`)}return o}function Jo(t){if(typeof KeyframeEffect!="function")return!0;try{return new KeyframeEffect(null,null,{easing:t}),!0}catch{return!1}}function w(t){const e=[];if(!t||typeof t!="object")e.push("def (not an object)");else{typeof t.id!="string"||t.id.trim()===""?e.push("id (missing)"):dt.test(t.id.trim().toLowerCase())?t.id.trim().toLowerCase()===Xo&&e.push('id ("none" is reserved)'):e.push(`id (must match ${dt} — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-id)`),(typeof t.label!="string"||t.label.trim()==="")&&e.push("label (missing)");const s=t.render!==void 0,n=Array.isArray(t.layers),r=t.from!==void 0||t.to!==void 0;s&&typeof t.render!="function"?e.push("render (not a function)"):s&&(n||r)?e.push("render|layers|from|to (supply exactly one of: a from/to pair, a layers array, or a render function)"):s||(n&&r?e.push("layers|from|to (supply EITHER a single from/to pair OR a layers array, not both)"):n?(t.layers.length===0&&e.push("layers (empty — supply at least one matched pair)"),t.layers.forEach((i,a)=>{if(!i||typeof i!="object"){e.push(`layers[ ${a} ] (not an object)`);return}e.push(...ht(i,`layers[ ${a} ]`))})):e.push(...ht(t,"").map(i=>i.replace(/^\./,"")))),t.easing!==void 0&&(typeof t.easing!="string"||t.easing.trim()===""?e.push("easing (not a non-empty string)"):Jo(t.easing)||e.push("easing (not an easing the browser can parse — `Element.animate()` would throw at play time, with the covering surface already over the window)"))}To("WindowReveal",e,t);const o=t.id.trim().toLowerCase();Yo.set(o,{...t,id:o}),Qo()}function Qo(){const t=Array.from(Zo);for(const e of t)try{e()}catch(o){typeof console<"u"&&console.error("[openstation] window-reveal registry listener threw:",o)}}w({id:"sweep",label:h("Sweep"),description:h("A straight edge travels across the window, uncovering the page behind it."),...Fo(),duration:420}),w({id:"iris",label:h("Iris"),description:h("The page opens out from the centre of the window, like a camera shutter."),...Io(),duration:520}),w({id:"curtain",label:h("Curtain"),description:h("Two panels part from the middle of the window and slide off the sides."),...Mo(),duration:480}),w({id:"blinds",label:h("Blinds"),description:h("Six horizontal slats retract at once, letting the page through between them."),...No(),duration:560}),w({id:"diagonal",label:h("Diagonal"),description:h("A slanted edge sweeps off the trailing corner of the window."),...Wo(),duration:460}),w({id:"rise",label:h("Rise"),description:h("The page rises into the window from the bottom edge upward."),...jo(),duration:440}),w({id:"shutter",label:h("Shutter"),description:h("Two panels part from the middle of the window and slide off the top and bottom."),...Oo(),duration:480}),w({id:"slats",label:h("Slats"),description:h("Eight vertical slats retract at once, letting the page through between them."),...Po(),duration:560}),w({id:"diamond",label:h("Diamond"),description:h("The page opens out from the centre of the window through a growing rhombus."),...Ho(),duration:520}),w({id:"mosaic",label:h("Mosaic"),description:h("The page arrives as a grid of tiles, each opening out from its own centre."),...zo(),duration:600}),w({id:"obturator",label:h("Camera shutter"),description:h("Six wedges slide aside in unison, opening a hexagonal aperture from the centre like the iris of a camera lens."),render:Go,duration:720,edgeLag:0}),w({id:"radar",label:h("Radar"),description:h("A spoke sweeps a full turn around the centre of the window, uncovering the page behind it."),...Do(),duration:760});const ft={dockSize:["compact","default","large"],desktopLayout:["classic","unified"],dockPlacement:["bottom","left","right"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"]},pt=["dockRailRenderer","windowReveal","accent"],mt={windowRevealDuration:{min:80,max:4e3}},es=/^[a-z0-9_-]+$/;[...Object.keys(ft),...pt,...Object.keys(mt)];function ts(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e=t,o={},s={};for(const[n,r]of Object.entries(ft)){const i=e[n];typeof i=="string"&&r.includes(i)&&(o[n]=i)}for(const n of pt){const r=e[n];typeof r=="string"&&es.test(r)&&(o[n]=r)}for(const[n,r]of Object.entries(mt)){const i=e[n];typeof i=="number"&&Number.isFinite(i)&&(s[n]=Math.min(r.max,Math.max(r.min,Math.round(i))))}return{...o,...s}}const os=/^[a-z0-9_-]+$/,bt=128;function ss(t){return typeof t!="string"||t===""||t.length>2048?!1:t.startsWith("dashicons-")||t.startsWith("https://")||t.startsWith("http://")||t.startsWith("data:image/")}function ns(t){if(!t||typeof t!="object")return null;const e=t,o=typeof e.slug=="string"?e.slug:"";if(!os.test(o))return null;const s={};if(e.icons&&typeof e.icons=="object"){let l=0;for(const[c,d]of Object.entries(e.icons)){if(l>=bt)break;c===""||!ss(d)||(s[c]=d,l+=1)}}const n={};if(e.tokens&&typeof e.tokens=="object")for(const[l,c]of Object.entries(e.tokens))typeof c=="string"&&(n[l]=c);const r=[];if(Array.isArray(e.fonts))for(const l of e.fonts)typeof l=="string"&&l!==""&&r.push(l);const i={};if(e.iconColors&&typeof e.iconColors=="object"){let l=0;for(const[c,d]of Object.entries(e.iconColors)){if(l>=bt)break;c===""||typeof d!="string"||d===""||(i[c]=d,l+=1)}}const a=l=>typeof e[l]=="string"?e[l]:"";return{id:a("id")||o,slug:o,name:a("name")||o,version:a("version"),author:a("author"),description:a("description"),previewUrl:a("previewUrl"),cssUrl:a("cssUrl"),cssText:a("cssText"),tokens:n,fonts:r,icons:s,iconColors:i,recommendedOsSettings:ts(e.recommendedOsSettings),installedAt:typeof e.installedAt=="number"?e.installedAt:0,source:e.source==="code"?"code":"upload",cssDeferred:e.cssDeferred===!0}}function rs(){const e=window.openStationConfig?.serverDesktopThemes,o=[];if(Array.isArray(e))for(const s of e){const n=ns(s);n&&o.push(n)}return{themes:o,activeId:null,activeIcons:null,activeIconColors:null}}const is=X("desktop-mode/desktop-themes",rs);function gt(){return is}function as(t){const e=gt().state;if(e.activeIcons===null)return null;const o=e.activeIcons[t];if(typeof o!="string"||o==="")return null;const s=Ve(Ke.DESKTOP_THEME_ICON,o,{slot:t,themeId:e.activeId??""});return typeof s=="string"&&s!==""?s:null}function ls(t){const e=gt().state;if(e.activeIconColors===null||!t)return null;const o=e.activeIconColors[t];if(typeof o!="string"||o==="")return null;const s=Ve(Ke.DESKTOP_THEME_ICON_COLOR,o,{slot:t,themeId:e.activeId??""});return typeof s=="string"&&s!==""?cs(s):null}function cs(t){const e=t.trim();if(e===""||e.length>64||/[;{}<>"'\\]/.test(e))return null;let o=0;for(const s of e)if(s==="(")o+=1;else if(s===")"&&(o-=1,o<0))return null;return o===0?e:null}const yt={RECYCLE_RESTORE:"RECYCLE_RESTORE",RECYCLE_DELETE:"RECYCLE_DELETE"};function ds(t){const e=document.createElement("button");e.type="button",e.setAttribute("data-noclick",""),e.setAttribute("aria-label",t.label),e.title=t.label;const o=t.variant==="danger",s=o?"var( --os-ui-danger, #d63638 )":"var( --os-ui-fg-muted, #50575e )",n=o?"var( --os-ui-danger, #d63638 )":"var( --os-ui-border, #c3c4c7 )",r="var( --os-ui-surface, #fff )",i=()=>{e.style.background=r,e.style.color=s,e.style.borderColor=n},a=()=>{o?(e.style.background="var( --os-ui-danger, #d63638 )",e.style.color="var( --os-ui-fg-on-accent, #fff )",e.style.borderColor="var( --os-ui-danger, #d63638 )"):(e.style.background="var( --os-ui-hover, #f0f0f1 )",e.style.color="var( --os-ui-fg, #1d2327 )",e.style.borderColor="var( --os-ui-border-strong, #8c8f94 )")},l=t.labelled===!0;if(e.style.cssText=["display: inline-flex","align-items: center","justify-content: center",l?"gap: 6px":"",l?"flex: 0 0 auto":"flex: 0 0 30px",l?"width: auto":"width: 30px",l?"height: 36px":"height: 30px",l?"padding: 0 12px":"padding: 0",l?"font-size: 13px":"",l?"font-weight: 600":"","margin: 0","border: 1px solid "+n,"border-radius: 6px","background: "+r,"color: "+s,"cursor: pointer","box-sizing: border-box","line-height: 1","font: inherit","transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease"].join(";"),e.addEventListener("mouseenter",a),e.addEventListener("mouseleave",i),e.addEventListener("focus",a),e.addEventListener("blur",i),e.appendChild(t.glyph),l){const c=document.createElement("span");c.textContent=t.label,c.style.cssText="white-space: nowrap; line-height: 1;",e.appendChild(c)}return e.addEventListener("click",c=>{c.stopPropagation(),t.onClick()}),e}function us(t){return t==="attachment"?"attachment":t==="comment"?"comment":"post"}const kt={post:{bg:"#dbe9fe",fg:"#1d4ed8"},page:{bg:"#e0f2fe",fg:"#075985"},attachment:{bg:"#fef3c7",fg:"#92400e"},comment:{bg:"#dcfce7",fg:"#166534"},_default:{bg:"var( --os-ui-surface-sunken, #e5e7eb )",fg:"var( --os-ui-fg-muted, #374151 )"}};function hs(t){return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase()):""}function fs(t){const e=t.type_label&&t.type_label.length>0?t.type_label:hs(t.type),o=kt[t.type]??kt._default,s=document.createElement("span");return s.setAttribute("data-os-recycle-bin-type-badge",t.type),s.textContent=e,s.style.cssText=["display: inline-flex","align-items: center","flex-shrink: 0","padding: 2px 8px","border-radius: 999px","font-size: 11px","font-weight: 600","line-height: 1.4","letter-spacing: 0.2px","text-transform: uppercase","white-space: nowrap","background: "+o.bg,"color: "+o.fg].join(";"),s}const ps={restore:'<path d="M12 5V2L7 6l5 4V7c2.76 0 5 2.24 5 5 0 .83-.21 1.61-.57 2.3l1.46 1.46A6.96 6.96 0 0 0 19 12c0-3.87-3.13-7-7-7zm0 12c-2.76 0-5-2.24-5-5 0-.83.21-1.61.57-2.3L6.11 8.24A6.96 6.96 0 0 0 5 12c0 3.87 3.13 7 7 7v3l5-4-5-4v3z" fill="currentColor"/>',trash:'<path d="M9 3v1H4v2h1v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6h1V4h-5V3H9zm0 5h2v9H9V8zm4 0h2v9h-2V8z" fill="currentColor"/>'};function _t(t){const e=t.icon==="restore"?yt.RECYCLE_RESTORE:yt.RECYCLE_DELETE,o=as(e),s=ls(e)??"currentColor",n=o!==null&&!o.startsWith("dashicons-")&&/^(https?:\/\/|data:image\/)/i.test(o)&&!/['"()\\<>\s]/.test(o);let r;if(n){const i=document.createElement("span");i.setAttribute("aria-hidden","true"),i.style.cssText=["display: block","width: 18px","height: 18px","flex-shrink: 0",`background-color: ${s}`,`-webkit-mask: url("${o}") center / contain no-repeat`,`mask: url("${o}") center / contain no-repeat`].join(";"),r=i}else{const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("width","18"),a.setAttribute("height","18"),a.setAttribute("viewBox","0 0 24 24"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false"),a.style.display="block",a.innerHTML=ps[t.icon]??"",r=a}return ds({label:t.label,glyph:r,onClick:t.onClick,variant:t.variant,labelled:t.labelled})}function ms(t,e={}){const o=e.phone===!0,s=o?"font-weight:600;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;":"font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:320px;",n=[{key:"title",label:h("Title"),sortable:!0,stack:"title",render:(i,a)=>{const l=document.createElement("span");if(l.style.cssText="display:flex;align-items:center;gap:10px;min-width:0;",a.preview&&a.type==="attachment"&&a.mime.startsWith("image/")){const p=document.createElement("img");p.src=a.preview,p.alt="",p.loading="lazy",p.style.cssText="width:36px;height:36px;border-radius:4px;object-fit:cover;display:block;flex-shrink:0;",l.appendChild(p)}const d=document.createElement("span");d.style.cssText="display:flex;flex-direction:column;gap:2px;min-width:0;";const u=document.createElement("span");u.style.cssText="display:flex;align-items:center;gap:8px;min-width:0;",u.appendChild(fs(a));const f=document.createElement("span");f.style.cssText=s;const m=le(a.title);if(f.textContent=m,f.title=m,u.appendChild(f),d.appendChild(u),a.subtitle){const p=document.createElement("span");p.style.cssText="font-size:12px;color:var( --os-ui-fg-muted, #50575e );white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:320px;";const _=le(a.subtitle);p.textContent=_,p.title=_,d.appendChild(p)}return l.appendChild(d),l}},{key:"deleted_at",label:h("Deleted"),sortable:!0,stack:"meta",width:"180px",sortValue:i=>Date.parse(i.deleted_at+"Z")||0,render:(i,a)=>{const l=document.createElement("os-relative-time");return l.setAttribute("datetime",a.deleted_at),l}},{key:"deleted_by",label:h("By"),sortable:!0,stack:"meta",width:"160px",render:(i,a)=>le(a.deleted_by??"")||"—"},{key:"__actions",label:"",stack:"actions",width:"96px",align:"end",render:(i,a)=>{const l=document.createElement("span");return l.style.cssText=o?"display:flex;gap:8px;align-items:center;flex-wrap:wrap;line-height:1;":"display:inline-flex;gap:4px;justify-content:flex-end;align-items:center;flex-wrap:nowrap;white-space:nowrap;line-height:1;",a.can_restore&&l.appendChild(_t({label:h("Restore"),icon:"restore",labelled:o,onClick:()=>t.onRestore({id:a.id,type:a.type})})),a.can_purge&&l.appendChild(_t({label:h("Delete forever"),icon:"trash",variant:"danger",labelled:o,onClick:()=>t.onPurge({id:a.id,type:a.type})})),l}}],r=window.wp?.hooks;return r&&typeof r.applyFilters=="function"?r.applyFilters("openstation.recycleBin.columns",n):n}const vt="desktop-mode-recycle-bin",q=()=>({selected:[],listKey:"",fingerprint:"",empty:{mode:"idle",purged:0,total:0},refreshTimer:null,lastArt:"",phoneColumns:null});function bs(t){return t.length===0?"":t.map(e=>JSON.stringify(e)).sort().join("|")}function ye(t,e){const o={kind:t,ok:e,errors:[],source:"local"};document.dispatchEvent(new CustomEvent("os-recycle-bin-changed",{detail:o}));const s=window.wp?.hooks;s&&typeof s.doAction=="function"&&s.doAction("openstation.recycleBin.changed",o)}const ke=t=>t.root.querySelector("[data-os-trash-table]");function B(t){const e=ke(t);if(!e)return[];const o=new Set(Array.from(e.selection??[],String)),s=[];for(const n of e.visibleRows??[])o.has(`${n.type}:${n.id}`)&&s.push({id:n.id,type:n.type});return s}function _e(t){ke(t)?.clearSelection(),t.ui(q).selected=[]}async function wt(t,e,o){const s=e.flatMap(n=>{const r=t.data.items.find(a=>A(a)===A(n)),i=r&&re(r,"out");return i?[{ref:n,operation:i}]:[]});if(s.length!==0){_e(t);try{const n=await t.dispatch(o,{items:s.map(l=>l.ref)}),r=new Set(t.data.items.map(A));let i=0;for(const{ref:l,operation:c}of s){const d=n&&!r.has(A(l));i+=Number(d),c.finish(d)}i>0&&ye(o,i);const a=n?s.length-i:0;a>0&&t.host.toast?.({message:C(o==="restore"?se("%d item could not be restored.","%d items could not be restored.",a):se("%d item could not be deleted.","%d items could not be deleted.",a),a),type:"error"})}catch(n){for(const{operation:r}of s)r.finish(!1);ne(t.host.toast,n,{fallback:h(o==="restore"?"Could not restore the selected items.":"Could not delete the selected items.")})}}}async function xt(t,e){await wt(t,e,"restore")}async function St(t,e){if(e.length===0)return;await t.host.confirm?.({title:h("Delete forever?"),message:C(h("Permanently delete %d item(s)? This cannot be undone."),e.length),confirmLabel:h("Delete forever"),danger:!0})&&await wt(t,e,"purge")}async function gs(t,e){if(e.length===0)return;const o=window.wp?.os?.files?.rest;_e(t);const s=e.flatMap(l=>{const c=t.data.items.find(u=>A(u)===A(l)),d=c&&re(c,"out");return d?[d]:[]});let n=0,r=0,i,a=0;for(const l of e){let c;try{const u=await t.fetch("desktop-mode/v1/recycle-bin/restore",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[l]})});if(!u.ok)throw await $e(u);c=await u.json()}catch(u){console.error("[trash] pin-to-desktop restore failed",u),r+=1,i??(i=u);continue}if(!c.ok.includes(l.id))continue;a+=1;const d=us(l.type);if(!(!o||!d)){try{await o.createPlacement({type:d,ref:String(l.id),x:16+n%5*96,y:16+Math.floor(n/5)*110})}catch(u){console.error("[trash] pin-to-desktop placement failed",u)}n+=1}}ye("restore",a),r>0&&ne(t.host.toast,i,{fallback:C(se("%d item could not be restored.","%d items could not be restored.",r),r)});try{await t.dispatch("refresh")}finally{s.forEach(l=>void l.finish(!1))}}async function ys(t){if(!await t.host.confirm?.({title:h("Empty Trash?"),message:h("Permanently delete ALL items in the Trash? This includes every type and any items hidden by the current filter or search. This cannot be undone."),confirmLabel:h("Empty Trash"),danger:!0}))return;const o=t.ui(q),s=t.data.items.flatMap(n=>{const r=re(n,"out");return r?[r]:[]});o.empty={mode:"starting",purged:0,total:0},t.repaint();try{const n=await uo({emptyBin:async()=>{const r=await t.fetch("desktop-mode/v1/recycle-bin/empty",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!r.ok)throw await $e(r);return await r.json()},onProgress:({purged:r,initialTotal:i})=>{o.empty={mode:"progress",purged:r,total:i},t.repaint()}});ye("empty",n.purged),n.skipped>0&&t.host.toast?.({message:C(h("%d item(s) skipped (insufficient permissions)."),n.skipped)})}catch(n){console.error("[trash] empty failed",n),ne(t.host.toast,n,{fallback:h("Could not empty the Recycle Bin.")})}finally{o.empty={mode:"idle",purged:0,total:0},_e(t);try{await t.dispatch("refresh")}finally{s.forEach(n=>void n.finish(!1)),t.repaint()}}}function ks(t){return t.empty.mode==="idle"?h("Empty Trash"):t.empty.mode==="starting"||t.empty.total===0?h("Emptying…"):C(h("Emptying… %1$d of %2$d"),t.empty.purged,t.empty.total)}function Ct(t,e,o){return E` | |
| 12 | + <span class="os-recycle-bin__count">${C(h("%d selected"),e.selected.length)}</span> | |
| 13 | + <os-button variant="secondary" @click=${()=>void xt(t,B(t))}> | |
| 6 | 14 | <span class="dashicons dashicons-image-rotate" aria-hidden="true"></span> |
| 7 | - ${u("Restore")} | |
| 15 | + ${h("Restore")} | |
| 8 | 16 | </os-button> |
| 9 | - ${n?"":T`<os-button variant="secondary" @click=${()=>void xn(e,D(e))}> | |
| 17 | + ${o?"":E`<os-button variant="secondary" @click=${()=>void gs(t,B(t))}> | |
| 10 | 18 | <span class="dashicons dashicons-desktop" aria-hidden="true"></span> |
| 11 | - ${u("Pin to desktop")} | |
| 19 | + ${h("Pin to desktop")} | |
| 12 | 20 | </os-button>`} |
| 13 | - <os-button variant="danger" @click=${()=>void Je(e,D(e))}> | |
| 21 | + <os-button variant="danger" @click=${()=>void St(t,B(t))}> | |
| 14 | 22 | <span class="dashicons dashicons-trash" aria-hidden="true"></span> |
| 15 | - ${u("Delete forever")} | |
| 23 | + ${h("Delete forever")} | |
| 16 | 24 | </os-button> |
| 17 | - `}const Rn=mt(Xe,{view:e=>{const{state:t,data:n}=e,s=e.ui(P),o=n.total>0,r=s.empty.mode!=="idle",i=pe(),c=s.selected.length>0;return T` | |
| 25 | + `}const _s=Dt(vt,{view:t=>{const{state:e,data:o}=t,s=t.ui(q),n=Ne(o.items,o.total,e.filter,e.search).total>0||s.empty.mode!=="idle",r=s.empty.mode!=="idle",i=Ae(),a=s.selected.length>0;return E` | |
| 18 | 26 | <div class="desktop-mode-recycle-bin" data-os-recycle-bin-root> |
| 19 | - <header class="os-recycle-bin__toolbar" ?hidden=${!o}> | |
| 27 | + <header class="os-recycle-bin__toolbar" ?hidden=${!n}> | |
| 20 | 28 | <div class="os-recycle-bin__toolbar-left"> |
| 21 | - <os-segmented os-bind="filter" os-action="refresh" value=${t.filter} label=${u("Filter by type")}> | |
| 22 | - <os-segment value="">${u("All")}</os-segment> | |
| 23 | - <os-segment value="post">${u("Posts")}</os-segment> | |
| 24 | - <os-segment value="page">${u("Pages")}</os-segment> | |
| 25 | - ${n.mediaTrash?T`<os-segment value="attachment">${u("Media")}</os-segment>`:""} | |
| 26 | - <os-segment value="comment">${u("Comments")}</os-segment> | |
| 27 | - <os-segment value="desktop">${u("Desktop")}</os-segment> | |
| 29 | + <os-segmented os-bind="filter" os-action="refresh" value=${e.filter} label=${h("Filter by type")}> | |
| 30 | + <os-segment value="">${h("All")}</os-segment> | |
| 31 | + <os-segment value="post">${h("Posts")}</os-segment> | |
| 32 | + <os-segment value="page">${h("Pages")}</os-segment> | |
| 33 | + ${o.mediaTrash?E`<os-segment value="attachment">${h("Media")}</os-segment>`:""} | |
| 34 | + <os-segment value="comment">${h("Comments")}</os-segment> | |
| 35 | + <os-segment value="desktop">${h("Desktop")}</os-segment> | |
| 28 | 36 | </os-segmented> |
| 29 | 37 | <os-text-field |
| 30 | 38 | type="search" |
| 39 | + label=${h("Search trash")} | |
| 40 | + hide-label | |
| 31 | 41 | os-bind="search" |
| 32 | 42 | os-action="refresh" |
| 33 | - placeholder=${u("Search trash…")} | |
| 43 | + placeholder=${h("Search trash…")} | |
| 34 | 44 | ></os-text-field> |
| 35 | 45 | </div> |
| 36 | - ${i?"":T`<div class="os-recycle-bin__toolbar-right" ?hidden=${!c}> | |
| 37 | - ${et(e,s,!1)} | |
| 46 | + ${i?"":E`<div class="os-recycle-bin__toolbar-right" ?hidden=${!a}> | |
| 47 | + ${Ct(t,s,!1)} | |
| 38 | 48 | </div>`} |
| 39 | 49 | <div class="os-recycle-bin__toolbar-trailing"> |
| 40 | - <os-button variant="ghost" os-action="refresh" title=${u("Refresh")}> | |
| 50 | + <os-button variant="ghost" os-action="refresh" title=${h("Refresh")}> | |
| 41 | 51 | <span class="dashicons dashicons-update" aria-hidden="true"></span> |
| 42 | 52 | </os-button> |
| 43 | 53 | <os-button |
| 44 | 54 | variant="danger" |
| @@ -43,12 +53,12 @@ | ||
| 43 | 53 | <os-button |
| 44 | 54 | variant="danger" |
| 45 | 55 | ?disabled=${r} |
| 46 | 56 | aria-busy=${r?"true":"false"} |
| 47 | - @click=${()=>void $n(e)} | |
| 57 | + @click=${()=>void ys(t)} | |
| 48 | 58 | > |
| 49 | 59 | <span class="dashicons dashicons-trash" aria-hidden="true"></span> |
| 50 | - ${In(s)} | |
| 60 | + ${ks(s)} | |
| 51 | 61 | </os-button> |
| 52 | 62 | </div> |
| 53 | 63 | </header> |
| 54 | 64 | <div class="os-recycle-bin__body"> |
| @@ -54,11 +64,11 @@ | ||
| 54 | 64 | <div class="os-recycle-bin__body"> |
| 55 | 65 | <os-empty-state |
| 56 | 66 | role="status" |
| 57 | 67 | icon="trash" |
| 58 | - heading=${u("The Trash is empty.")} | |
| 59 | - description=${u("Deleted posts, pages, and media show up here. Restoring puts them back where they were.")} | |
| 60 | - ?hidden=${o} | |
| 68 | + heading=${h("The Trash is empty.")} | |
| 69 | + description=${h("Deleted posts, pages, and media show up here. Restoring puts them back where they were.")} | |
| 70 | + ?hidden=${n} | |
| 61 | 71 | ></os-empty-state> |
| 62 | 72 | <os-table |
| 63 | 73 | data-os-trash-table |
| 64 | 74 | os-preserve |
| @@ -65,13 +75,13 @@ | ||
| 65 | 75 | selectable="multi" |
| 66 | 76 | sticky-header |
| 67 | 77 | hover |
| 68 | 78 | striped |
| 69 | - empty=${u("No items match the current filter or search.")} | |
| 70 | - ?hidden=${!o} | |
| 79 | + empty=${h("No items match the current filter or search.")} | |
| 80 | + ?hidden=${!n} | |
| 71 | 81 | ></os-table> |
| 72 | 82 | </div> |
| 73 | - ${i&&o?T`<footer class="os-recycle-bin__bulk" ?hidden=${!c}> | |
| 74 | - ${et(e,s,!0)} | |
| 83 | + ${i&&n?E`<footer class="os-recycle-bin__bulk" ?hidden=${!a}> | |
| 84 | + ${Ct(t,s,!0)} | |
| 75 | 85 | </footer>`:""} |
| 76 | 86 | </div> |
| 77 | - `},mounted:e=>{Et();const t=e.ui(P),n=o=>{const r=o.detail;!r?.source||r.source==="local"||(t.refreshTimer!==null&&window.clearTimeout(t.refreshTimer),t.refreshTimer=window.setTimeout(()=>{t.refreshTimer=null,e.dispatch("refresh")},200))};document.addEventListener("os-recycle-bin-changed",n);const s=()=>e.repaint();return document.addEventListener("os-mode-changed",s),()=>{kt(),document.removeEventListener("os-recycle-bin-changed",n),document.removeEventListener("os-mode-changed",s),t.refreshTimer!==null&&window.clearTimeout(t.refreshTimer)}},updated:e=>{const t=re(e);if(!t)return;const n=e.ui(P),s=ht(t);s!==n.phoneColumns&&(n.phoneColumns=s,t.columns=An({onRestore:c=>void Qe(e,[c]),onPurge:c=>void Je(e,[c])},{phone:s})),t.hasAttribute("data-os-trash-wired")||(t.setAttribute("data-os-trash-wired",""),t.getRowId=c=>`${c.type}:${c.id}`,t.sort={key:"deleted_at",direction:"desc"},t.addEventListener("os-table-selection-change",()=>{n.selected=D(e),e.repaint()}));const o=`${e.state.filter}|${e.state.search}`;o!==n.listKey&&(n.listKey=o,(t.selection?.size??0)>0&&t.clearSelection(),n.selected=[]);const r=Cn(e.data.items);if(r!==n.fingerprint){n.fingerprint=r,t.data=e.data.items;const c=new Set((t.visibleRows??[]).map(l=>`${l.type}:${l.id}`)),a=Array.from(t.selection??[],String).filter(l=>c.has(l));a.length!==(t.selection?.size??0)&&(t.selection=a,n.selected=D(e))}const i=String(e.extra[e.data.total>0?"full":"empty"]??"");i&&i!==n.lastArt&&(n.lastArt=i,e.host.setIcon?.(Xe,i))}});return G.default=Rn,Object.defineProperties(G,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),G}({}); | |
| 87 | + `},mounted:t=>{mo(),t.dispatch("refresh");let e=null;const o=Gt(()=>t.repaint(),()=>(e??(e=Promise.resolve().then(()=>(e=null,t.dispatch("refresh")))),e)),s=t.ui(q),n=i=>{const a=i.detail;!a?.source||a.source==="local"||(s.refreshTimer!==null&&window.clearTimeout(s.refreshTimer),s.refreshTimer=window.setTimeout(()=>{s.refreshTimer=null,t.dispatch("refresh")},200))};document.addEventListener("os-recycle-bin-changed",n);const r=()=>t.repaint();return document.addEventListener("os-mode-changed",r),()=>{o(),bo(),document.removeEventListener("os-recycle-bin-changed",n),document.removeEventListener("os-mode-changed",r),s.refreshTimer!==null&&window.clearTimeout(s.refreshTimer)}},updated:t=>{const e=ke(t);if(!e)return;const o=t.ui(q),s=zt(e);s!==o.phoneColumns&&(o.phoneColumns=s,e.columns=ms({onRestore:l=>void xt(t,[l]),onPurge:l=>void St(t,[l])},{phone:s})),e.hasAttribute("data-os-trash-wired")||(e.setAttribute("data-os-trash-wired",""),e.getRowId=l=>`${l.type}:${l.id}`,e.sort={key:"deleted_at",direction:"desc"},e.addEventListener("os-table-selection-change",()=>{o.selected=B(t),t.repaint()}));const n=`${t.state.filter}|${t.state.search}`;n!==o.listKey&&(o.listKey=n,(e.selection?.size??0)>0&&e.clearSelection(),o.selected=[]);const r=Ne(t.data.items,t.data.total,t.state.filter,t.state.search),i=bs(r.items);if(i!==o.fingerprint){o.fingerprint=i,e.data=r.items;const l=new Set((e.visibleRows??[]).map(d=>`${d.type}:${d.id}`)),c=Array.from(e.selection??[],String).filter(d=>l.has(d));c.length!==(e.selection?.size??0)&&(e.selection=c,o.selected=B(t))}const a=String(t.extra[r.total>0?"full":"empty"]??"");a&&a!==o.lastArt&&(o.lastArt=a,t.host.setIcon?.(vt,a))}});return te.default=_s,Object.defineProperties(te,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),te}({}); | |