PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.12
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.12
1.1.13 1.1.12 1.1.11 1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 All 37 releases
← All changes | assets/js/agent-run-window.min.js +38 -37 1.1.8 → 1.1.12 View file →
@@ -1,30 +1,30 @@
1 -(function(){"use strict";const ct="desktop-mode";function $e(){return window.wp?.i18n}function f(o,e=ct){return $e()?.__(o,e)??o}function Ae(o,...e){const t=$e()?.sprintf;if(t)return t(o,...e);let n=0;return o.replace(/%(?:(\d+)\$)?[sd]/g,(s,r)=>{const i=r?Number.parseInt(r,10)-1:n++;return String(e[i]??"")})}function lt(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function he(o){return o.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,n)=>/^https?:\/\//i.test(n.trim())?`<a href="${n.trim()}" target="_blank" rel="noopener noreferrer">${t}</a>`:t).replace(/\*\*([^*\n]+?)\*\*/g,"<strong>$1</strong>").replace(/(?<![*\w])\*([^*\n]+?)\*(?![*\w])/g,"<em>$1</em>").replace(/(?<![_\w])_([^_\n]+?)_(?![_\w])/g,"<em>$1</em>").replace(/`([^`\n]+?)`/g,"<code>$1</code>")}function dt(o){if(!o)return"";const e=lt(o),t=[];let n=[],s=null;const r=()=>{n.length>0&&(t.push(`<p>${n.join("<br>")}</p>`),n=[])},i=()=>{s&&(t.push(`<${s.tag}>${s.items.join("")}</${s.tag}>`),s=null)};for(const d of e.split(/\n/)){const a=d.trim();if(a===""){r(),i();continue}const l=/^(#{1,6})\s+(.*)$/.exec(a);if(l){r(),i();const _=Math.min(6,l[1].length+2);t.push(`<h${_}>${he(l[2])}</h${_}>`);continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(a)){r(),i(),t.push("<hr>");continue}const u=/^[-*]\s+(.*)$/.exec(a),g=/^\d+\.\s+(.*)$/.exec(a);if(u||g){r();const _=u?"ul":"ol";(!s||s.tag!==_)&&(i(),s={tag:_,items:[]}),s.items.push(`<li>${he((u??g)[1])}</li>`);continue}i(),n.push(he(a))}return r(),i(),t.join("")}function k(o,...e){return{__wpdHtml:!0,strings:o,values:e}}function ut(o){return!!o&&o.__wpdHtml===!0}const ht="$$wpd$$",S=/\$\$wpd\$\$(\d+)\$\$/g,pt="$$wpd-node$$",ft=/^\$\$wpd-node\$\$(\d+)\$\$$/,mt=new Set(["style","script","textarea","title"]);function gt(o){let e="",t=!1,n=null,s=!1,r=null,i="",d=!1;for(let a=0;a<o.length;a++){const l=o[a];e+=l;for(let u=0;u<l.length;u++){const g=l[u];if(s){l.startsWith("-->",u)&&(s=!1,u+=2);continue}if(r!==null){g==="<"&&l[u+1]==="/"&&l.slice(u+2,u+2+r.length).toLowerCase()===r&&(u+=1+r.length,r=null,t=!0,d=!1,i="");continue}if(n!==null){g===n&&(n=null);continue}if(t){g==='"'||g==="'"?(n=g,d=!1):g===">"?(t=!1,d=!1,mt.has(i)&&(r=i),i=""):d&&(/[a-zA-Z0-9-]/.test(g)?i+=g.toLowerCase():d=!1);continue}if(l.startsWith("<!--",u)){s=!0,u+=3;continue}const _=l[u+1]??"";g==="<"&&/[a-zA-Z/!]/.test(_)&&(t=!0,i="",d=/[a-zA-Z]/.test(_))}a<o.length-1&&(e+=t||s||r!==null?`${ht}${a}$$`:`<!--${pt}${a}$$-->`)}return e}const Ce=new WeakMap;function Ee(o){const e=Ce.get(o);if(e)return e;const t=document.createElement("template");t.innerHTML=gt(o);const n=[],s=(d,a)=>{if(d.nodeType===Node.ELEMENT_NODE){const g=d;for(const _ of Array.from(g.attributes)){const $=_.name,v=_.value,T=$[0];if(S.test(v))if(S.lastIndex=0,T==="@"){const A=S.exec(v);S.lastIndex=0,n.push({path:a,kind:"event",name:$.slice(1),valueIndex:A?Number(A[1]):0}),g.removeAttribute($)}else if(T==="."){const A=S.exec(v);S.lastIndex=0,n.push({path:a,kind:"prop",name:$.slice(1),valueIndex:A?Number(A[1]):0}),g.removeAttribute($)}else if(T==="?"){const A=S.exec(v);S.lastIndex=0,n.push({path:a,kind:"bool",name:$.slice(1),valueIndex:A?Number(A[1]):0}),g.removeAttribute($)}else{const A=[],c=[];let h=0,p;for(S.lastIndex=0;(p=S.exec(v))!==null;)A.push(v.slice(h,p.index)),c.push(Number(p[1])),h=p.index+p[0].length;A.push(v.slice(h)),n.push({path:a,kind:"attr",name:$,template:A,valueIndices:c}),g.setAttribute($,"")}}}const l=Array.from(d.childNodes);let u=0;for(let g=0;g<l.length;g++){const _=l[g],$=g+u;if(_.nodeType===Node.COMMENT_NODE){const v=ft.exec(_.data);if(v){const T=document.createTextNode("");_.parentNode.replaceChild(T,_),n.push({path:[...a,$],kind:"node",valueIndex:Number(v[1])})}continue}if(_.nodeType===Node.TEXT_NODE){const v=_.textContent||"";if(!S.test(v)){S.lastIndex=0;continue}S.lastIndex=0;const T=_.parentNode;let A=0,c;const h=[],p=[];for(S.lastIndex=0;(c=S.exec(v))!==null;){c.index>A&&h.push(document.createTextNode(v.slice(A,c.index)));const y=document.createTextNode("");h.push(y),p.push({path:[...a,$+h.length-1],kind:"node",valueIndex:Number(c[1])}),A=c.index+c[0].length}A<v.length&&h.push(document.createTextNode(v.slice(A)));for(const y of h)T.insertBefore(y,_);T.removeChild(_),u+=h.length-1,n.push(...p)}else s(_,[...a,$])}};s(t.content,[]);const i={template:t,buildParts:d=>{const a=[];for(const l of n){let u=d;for(const g of l.path)u=u.childNodes[g];l.kind==="node"?a.push({kind:"node",valueIndex:l.valueIndex,child:{anchor:u,state:null}}):l.kind==="attr"?a.push({kind:"attr",element:u,name:l.name,template:l.template,valueIndices:l.valueIndices}):l.kind==="event"?a.push({kind:"event",valueIndex:l.valueIndex,element:u,name:l.name}):l.kind==="prop"?a.push({kind:"prop",valueIndex:l.valueIndex,element:u,name:l.name}):l.kind==="bool"&&a.push({kind:"bool",valueIndex:l.valueIndex,element:u,name:l.name})}return a}};return Ce.set(o,i),i}const Ne=new WeakMap;function bt(o,e){for(const t of o.nodes)if(t.parentNode!==e)return!1;return!0}function vt(o,e){const t=Ne.get(e);if(t&&t.strings===o.strings&&bt(t,e)){re(t.parts,o.values);return}const n=Ee(o.strings),s=n.template.content.cloneNode(!0),r=n.buildParts(s),i=Array.from(s.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(s),re(r,o.values),Ne.set(e,{strings:o.strings,parts:r,nodes:i})}function re(o,e){for(const t of o)if(t.kind==="node")ie(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let n=t.template[0];for(let s=0;s<t.valueIndices.length;s++)n+=Se(e[t.valueIndices[s]]),n+=t.template[s+1];n!==t.last&&(t.last=n,n===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,n))}else if(t.kind==="event"){const n=e[t.valueIndex];n!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),n&&t.element.addEventListener(t.name,n),t.current=n)}else if(t.kind==="prop"){const n=e[t.valueIndex];n!==t.last&&(t.last=n,t.element[t.name]=n)}else if(t.kind==="bool"){const n=!!e[t.valueIndex];n!==t.last&&(t.last=n,n?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function ie(o,e){if(e==null||e===!1){o.state&&(F(o.state),o.state=null);return}if(Array.isArray(e)){kt(o,e);return}if(ut(e)){xt(o,e);return}if(e instanceof Node){_t(o,e);return}yt(o,Se(e))}function _t(o,e){const t=o.state;t?.shape==="node"&&t.node===e||(t&&F(t),O(o,[e]),o.state={shape:"node",node:e})}function yt(o,e){const t=o.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&F(t);const n=document.createTextNode(e);O(o,[n]),o.state={shape:"text",node:n,text:e}}function xt(o,e){const t=o.state;if(t?.shape==="template"&&t.strings===e.strings){re(t.parts,e.values);return}t&&F(t);const n=Ee(e.strings),s=n.template.content.cloneNode(!0),r=n.buildParts(s),i=Array.from(s.childNodes);O(o,[s]),re(r,e.values),o.state={shape:"template",strings:e.strings,parts:r,nodes:i}}function kt(o,e){const t=o.state;if(t?.shape==="array"){const s=Math.min(t.entries.length,e.length);for(let r=0;r<s;r++)ie(t.entries[r],e[r]);if(e.length<t.entries.length){for(let r=e.length;r<t.entries.length;r++){const i=t.entries[r];i.state&&F(i.state),i.anchor.remove()}t.entries.length=e.length}else for(let r=t.entries.length;r<e.length;r++){const i=document.createTextNode("");O(o,[i]);const d={anchor:i,state:null};ie(d,e[r]),t.entries.push(d)}return}t&&F(t);const n=[];for(const s of e){const r=document.createTextNode("");O(o,[r]);const i={anchor:r,state:null};ie(i,s),n.push(i)}o.state={shape:"array",entries:n}}function O(o,e){const t=o.anchor.parentNode;if(t)for(const n of e)t.insertBefore(n,o.anchor)}function F(o){if(o.shape==="text"){o.node.remove();return}if(o.shape==="template"){for(const e of o.parts)e.kind==="node"&&e.child.state&&(F(e.child.state),e.child.state=null);for(const e of o.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(o.shape==="node"){o.node.parentNode&&o.node.parentNode.removeChild(o.node);return}for(const e of o.entries)e.state&&F(e.state),e.anchor.remove()}function Se(o){return o==null||o===!1?"":String(o)}const D=class D 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(Te)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,n){if(t===n)return;const s=wt(e);this._propValues[s]=n,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const n=(Array.isArray(e)?e:String(e).split(/\s+/)).map(s=>String(s).trim()).filter(s=>s!=="");this.className=n.join(" ")}requestUpdate(){this._scheduleRender()}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const t of e.props){if(Object.getOwnPropertyDescriptor(this,t))continue;const n=Te(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(n),set:s=>{let r;s==null||s===!1?r=null:s===!0?r="":r=String(s),this._propValues[t]=r,r===null?this.removeAttribute(n):this.setAttribute(n,r),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&vt(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(n=>n.sheet).filter(n=>n!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const n of e.styles)if(!n.sheet){const s=document.createElement("style");s.textContent=n.cssText,this.shadowRoot.appendChild(s)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!D._lightStylesAdopted.has(e)){D._lightStylesAdopted.add(e);for(const t of e.styles){const n=document.createElement("style");n.dataset.osUi=this.tagName.toLowerCase(),n.textContent=t.cssText,document.head.appendChild(n)}}}};D.props=[],D.styles=[],D.shadow=!0,D._lightStylesAdopted=new WeakSet;let M=D;function U(o,e){customElements.get(o)||customElements.define(o,e)}function Te(o){return o.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function wt(o){return o.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const $t=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function C(o,...e){let t=o[0];for(let n=1;n<o.length;n++){const s=e[n-1];if(typeof s=="string"||typeof s=="number")t+=String(s);else if(s&&s.__wpdCss)t+=s.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof s);t+=o[n]}if($t){const n=new CSSStyleSheet;return n.replaceSync(t),{__wpdCss:!0,sheet:n,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function At(o){const e=[],t=[];let n=null,s=o.parentElement;for(;s&&!(s===document.body||s===document.documentElement);){const i=s.id||"";if(i.startsWith("wp-window-")){n=i.slice(10);break}if(s.tagName.toLowerCase()==="os-tabpanel"){const d=s.getAttribute("for");d&&t.unshift(d)}s=s.parentElement}n&&e.push(pe(n));for(const i of t)e.push("tab-"+pe(i));const r=o.getAttribute("label");return r&&e.push(pe(r)),e.length===0?"os-unnamed":"os-"+e.filter(i=>i!=="").join("-")}function pe(o){return o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Ct(o){if(o.id)return o.id;const e=At(o);return o.id=e,e}function Et(o){if(!o)return 214;let e=5381;for(let t=0;t<o.length;t++)e=Math.imul(e,33)+o.charCodeAt(t);return(e%360+360)%360}const Nt=C`:host{display:inline-flex;position:relative;width:var( --os-ui-avatar-size,32px );height:var( --os-ui-avatar-size,32px );flex:0 0 auto;vertical-align:middle;line-height:0;perspective:calc( var( --os-ui-avatar-size,32px ) * 8 );--os-ui-avatar-tilt-x:0deg;--os-ui-avatar-tilt-y:0deg;--os-ui-avatar-hover:0;--os-ui-avatar-glare-x:50%;--os-ui-avatar-glare-y:50%}:host( [ hidden ] ){display:none}.os-avatar__tile{position:relative;width:100%;height:100%;border-radius:50%;overflow:hidden;background:var( --os-window-bg,#f0f0f1 );color:var( --os-ui-fg-on-accent,#fff );display:flex;align-items:center;justify-content:center;font-weight:700;font-size:calc( var( --os-ui-avatar-size,32px ) * 0.48 );line-height:1;letter-spacing:0;font-feature-settings:'tnum' 1;user-select:none;transform-style:preserve-3d;transform:rotateX( var( --os-ui-avatar-tilt-x ) ) rotateY( var( --os-ui-avatar-tilt-y ) ) scale( calc( 1 + var( --os-ui-avatar-hover ) * 0.07 ) );transition:transform 220ms cubic-bezier( 0.2,0.8,0.2,1 ),box-shadow 220ms cubic-bezier( 0.2,0.8,0.2,1 );box-shadow:inset 0 0 0 1px rgba( 255,255,255,calc( 0.18 + 0.22 * var( --os-ui-avatar-hover ) ) ),inset 0 0 0 calc( 1px + var( --os-ui-avatar-hover ) * 1px ) rgba( 0,0,0,calc( 0.08 + 0.04 * var( --os-ui-avatar-hover ) ) ),0 calc( 1px + var( --os-ui-avatar-hover ) * 8px ) calc( 6px + var( --os-ui-avatar-hover ) * 18px ) rgba( 0,0,0,calc( 0.08 + 0.18 * var( --os-ui-avatar-hover ) ) )}.os-avatar__tile::after{content:'';position:absolute;inset:0;border-radius:50%;background:radial-gradient( circle at var( --os-ui-avatar-glare-x ) var( --os-ui-avatar-glare-y ),var( --os-ui-scrim,rgba( 255,255,255,0.55 ) ) 0%,var( --os-ui-hover,rgba( 255,255,255,0 ) ) 55% );opacity:var( --os-ui-avatar-hover );mix-blend-mode:overlay;pointer-events:none;transition:opacity 220ms cubic-bezier( 0.2,0.8,0.2,1 )}.os-avatar__tile::before{content:'';position:absolute;inset:calc( var( --os-ui-avatar-hover ) * -3px );border-radius:50%;background:radial-gradient( circle at var( --os-ui-avatar-glare-x ) var( --os-ui-avatar-glare-y ),color-mix( in srgb,var( --os-ui-avatar-halo,rgb( 99,102,241 ) ) calc( 35% * var( --os-ui-avatar-hover ) ),transparent ) 0%,transparent 70% );filter:blur( 4px );pointer-events:none;z-index:-1;transition:inset 220ms cubic-bezier( 0.2,0.8,0.2,1 ),background 220ms}.os-avatar__tile img{width:calc( 100% + 2px );height:calc( 100% + 2px );margin:-1px;object-fit:cover;display:block;transform:translateZ( 1px )}.os-avatar__dot{position:absolute;bottom:0;inset-inline-end:0;width:calc( var( --os-ui-avatar-size,32px ) * 0.32 );height:calc( var( --os-ui-avatar-size,32px ) * 0.32 );min-width:8px;min-height:8px;border-radius:50%;box-sizing:border-box;border:2px solid var( --os-ui-avatar-dot-ring,var( --os-window-bg,#fff ) );background:var( --os-ui-avatar-dot-color,transparent );z-index:2}.os-avatar__dot--online{background:var( --os-ui-success-fg,#00a32a )}.os-avatar__dot--online::after{content:'';position:absolute;inset:-2px;border-radius:50%;border:1px solid var( --os-ui-success-fg,#00a32a );animation:os-avatar-presence 6s var( --os-ui-ease-out,cubic-bezier( 0.22,0.9,0.28,1 ) ) infinite;pointer-events:none}@keyframes os-avatar-presence{0%{opacity:0.6;transform:scale( 1 )}20%{opacity:0;transform:scale( 2.2 )}100%{opacity:0;transform:scale( 2.2 )}}.os-avatar__dot--inactive{background:var( --os-ui-warning-fg,#dba617 )}.os-avatar__dot--offline{background:var( --os-ui-fg-muted,#8c8f94 )}@media ( prefers-reduced-motion:reduce ){.os-avatar__dot--online::after{animation:none;opacity:0.6}.os-avatar__tile{transform:none;transition:box-shadow 200ms}.os-avatar__tile::after,.os-avatar__tile::before{display:none}}`,Ie={xs:20,sm:24,md:40,lg:64,xl:96},Re=new Set(["online","inactive","offline"]),J=class J extends M{constructor(){super(...arguments),this._presenceHandler=null,this._imgFailed=!1,this._onPointerMove=null,this._onPointerEnter=null,this._onPointerLeave=null,this._tiltRaf=0,this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%"}connectedCallback(){super.connectedCallback(),this._maybeAttachPresenceListener(),this._attachHoverEffect()}disconnectedCallback(){this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null),this._detachHoverEffect()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",n=this._attr("alt"),s=n!==null?n:t,r=this._attr("size"),i=this._resolveSize(r),d=this._presenceForRender(),a=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${i}px`);const l=e&&!this._imgFailed?"":this._initialsBg(t),u=e&&!this._imgFailed?k`<img
1 +(function(){"use strict";const yt="desktop-mode";function Ie(){return window.wp?.i18n}function h(o,e=yt){return Ie()?.__(o,e)??o}function ue(o,...e){const t=Ie()?.sprintf;if(t)return t(o,...e);let n=0;return o.replace(/%(?:(\d+)\$)?[sd]/g,(s,r)=>{const i=r?Number.parseInt(r,10)-1:n++;return String(e[i]??"")})}const ze="X-WP-Nonce";function xt(o,e){const t=kt();if(!t)return e;const n=wt(o);if(!n||!$t(n))return e;const s=e?.headers??(typeof Request<"u"&&o instanceof Request?o.headers:void 0),r=new Headers(s??{});return r.has(ze)?e:(r.set(ze,t),{...e??{},headers:r})}function kt(){if(typeof window>"u")return;const e=window.openStationConfig?.restNonce;return typeof e=="string"&&e.length>0?e:void 0}function wt(o){try{const e=typeof window<"u"&&window.location?window.location.href:void 0;return typeof o=="string"?new URL(o,e):o instanceof URL?o:typeof Request<"u"&&o instanceof Request?new URL(o.url,e):null}catch{return null}}function $t(o){return typeof window>"u"||!window.location||o.origin!==window.location.origin?!1:!!(o.pathname.includes("/wp-json/")||o.searchParams.has("rest_route"))}function Pe(o,e,t={}){const n=window.wp?.os?.fetch;if(typeof n=="function")return n(o,e,t);const s=xt(o,e);return fetch(o,s)}class he extends Error{constructor(e,t){super(e||t.serverMessage||`HTTP ${t.status}`),this.name="RestError",this.status=t.status,this.code=t.code,this.data=t.data,this.serverMessage=t.serverMessage??""}}function Me(o){return o instanceof he}function At(o){const e=typeof o=="object"&&o!==null?o:void 0;return{code:typeof e?.code=="string"?e.code:void 0,data:e?.data,serverMessage:typeof e?.message=="string"?e.message:""}}function ye(o,e,t=""){return new he(t,{status:o,...At(e)})}const Ct="rest_cookie_invalid_nonce",Fe=()=>h("Could not reach the site. Check your connection and try again.","desktop-mode");function De(o){return typeof navigator<"u"&&navigator.onLine===!1?!0:o instanceof TypeError}function Et(o){return Me(o)?o.code===Ct||o.status===401?"session":o.status>=200&&o.status<300?"unreadable":o.status===404?"gone":o.status>=500?"server":o.status>=400?"refused":"unknown":De(o)?"offline":"unknown"}function St(o){return Me(o)?o.serverMessage:De(o)?Fe():o instanceof Error?o.message:""}function Nt(o,e){const{fallback:t,lead:n}=e,s=Et(o),r=s==="offline"||s==="unreadable"?"warning":"error";let i="",l=!0;switch(s){case"offline":i=Fe();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 a=o;a.serverMessage?i=a.serverMessage:s==="gone"?(i=h("It no longer exists. Reload the page to catch up.","desktop-mode"),l=!1):s==="server"?(i=ue(h("The server answered with error %d.","desktop-mode"),a.status),l=!1):(i=ue(h("The server refused the request (HTTP %d).","desktop-mode"),a.status),l=!1);break}case"unknown":default:i=St(o);break}let c;return n?c=i?`${n}: ${i}`:t:i?l?c=i:c=`${t} ${i}`:c=t,{message:c,reason:i,kind:s,type:r}}function Tt(o,e,t){if(!o)return;const{duration:n,...s}=t,r=Nt(e,s),i={message:r.message,type:r.type};n&&(i.duration=n),o(i)}function Rt(o){const e=window.wp?.os;return typeof e?.showToast!="function"?()=>{}:e.showToast(o)??(()=>{})}function Lt(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function xe(o){return o.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,n)=>/^https?:\/\//i.test(n.trim())?`<a href="${n.trim()}" target="_blank" rel="noopener noreferrer">${t}</a>`:t).replace(/\*\*([^*\n]+?)\*\*/g,"<strong>$1</strong>").replace(/(?<![*\w])\*([^*\n]+?)\*(?![*\w])/g,"<em>$1</em>").replace(/(?<![_\w])_([^_\n]+?)_(?![_\w])/g,"<em>$1</em>").replace(/`([^`\n]+?)`/g,"<code>$1</code>")}function It(o){if(!o)return"";const e=Lt(o),t=[];let n=[],s=null;const r=()=>{n.length>0&&(t.push(`<p>${n.join("<br>")}</p>`),n=[])},i=()=>{s&&(t.push(`<${s.tag}>${s.items.join("")}</${s.tag}>`),s=null)};for(const l of e.split(/\n/)){const c=l.trim();if(c===""){r(),i();continue}const a=/^(#{1,6})\s+(.*)$/.exec(c);if(a){r(),i();const f=Math.min(6,a[1].length+2);t.push(`<h${f}>${xe(a[2])}</h${f}>`);continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(c)){r(),i(),t.push("<hr>");continue}const u=/^[-*]\s+(.*)$/.exec(c),p=/^\d+\.\s+(.*)$/.exec(c);if(u||p){r();const f=u?"ul":"ol";(!s||s.tag!==f)&&(i(),s={tag:f,items:[]}),s.items.push(`<li>${xe((u??p)[1])}</li>`);continue}i(),n.push(xe(c))}return r(),i(),t.join("")}function y(o,...e){return{__wpdHtml:!0,strings:o,values:e}}function zt(o){return!!o&&o.__wpdHtml===!0}const Pt="$$wpd$$",L=/\$\$wpd\$\$(\d+)\$\$/g,Mt="$$wpd-node$$",Ft=/^\$\$wpd-node\$\$(\d+)\$\$$/,Dt=new Set(["style","script","textarea","title"]);function jt(o){let e="",t=!1,n=null,s=!1,r=null,i="",l=!1;for(let c=0;c<o.length;c++){const a=o[c];e+=a;for(let u=0;u<a.length;u++){const p=a[u];if(s){a.startsWith("-->",u)&&(s=!1,u+=2);continue}if(r!==null){p==="<"&&a[u+1]==="/"&&a.slice(u+2,u+2+r.length).toLowerCase()===r&&(u+=1+r.length,r=null,t=!0,l=!1,i="");continue}if(n!==null){p===n&&(n=null);continue}if(t){p==='"'||p==="'"?(n=p,l=!1):p===">"?(t=!1,l=!1,Dt.has(i)&&(r=i),i=""):l&&(/[a-zA-Z0-9-]/.test(p)?i+=p.toLowerCase():l=!1);continue}if(a.startsWith("<!--",u)){s=!0,u+=3;continue}const f=a[u+1]??"";p==="<"&&/[a-zA-Z/!]/.test(f)&&(t=!0,i="",l=/[a-zA-Z]/.test(f))}c<o.length-1&&(e+=t||s||r!==null?`${Pt}${c}$$`:`<!--${Mt}${c}$$-->`)}return e}const je=new WeakMap;function He(o){const e=je.get(o);if(e)return e;const t=document.createElement("template");t.innerHTML=jt(o);const n=[],s=(l,c)=>{if(l.nodeType===Node.ELEMENT_NODE){const p=l;for(const f of Array.from(p.attributes)){const x=f.name,b=f.value,S=x[0];if(L.test(b))if(L.lastIndex=0,S==="@"){const w=L.exec(b);L.lastIndex=0,n.push({path:c,kind:"event",name:x.slice(1),valueIndex:w?Number(w[1]):0}),p.removeAttribute(x)}else if(S==="."){const w=L.exec(b);L.lastIndex=0,n.push({path:c,kind:"prop",name:x.slice(1),valueIndex:w?Number(w[1]):0}),p.removeAttribute(x)}else if(S==="?"){const w=L.exec(b);L.lastIndex=0,n.push({path:c,kind:"bool",name:x.slice(1),valueIndex:w?Number(w[1]):0}),p.removeAttribute(x)}else{const w=[],N=[];let T=0,F;for(L.lastIndex=0;(F=L.exec(b))!==null;)w.push(b.slice(T,F.index)),N.push(Number(F[1])),T=F.index+F[0].length;w.push(b.slice(T)),n.push({path:c,kind:"attr",name:x,template:w,valueIndices:N}),p.setAttribute(x,"")}}}const a=Array.from(l.childNodes);let u=0;for(let p=0;p<a.length;p++){const f=a[p],x=p+u;if(f.nodeType===Node.COMMENT_NODE){const b=Ft.exec(f.data);if(b){const S=document.createTextNode("");f.parentNode.replaceChild(S,f),n.push({path:[...c,x],kind:"node",valueIndex:Number(b[1])})}continue}if(f.nodeType===Node.TEXT_NODE){const b=f.textContent||"";if(!L.test(b)){L.lastIndex=0;continue}L.lastIndex=0;const S=f.parentNode;let w=0,N;const T=[],F=[];for(L.lastIndex=0;(N=L.exec(b))!==null;){N.index>w&&T.push(document.createTextNode(b.slice(w,N.index)));const H=document.createTextNode("");T.push(H),F.push({path:[...c,x+T.length-1],kind:"node",valueIndex:Number(N[1])}),w=N.index+N[0].length}w<b.length&&T.push(document.createTextNode(b.slice(w)));for(const H of T)S.insertBefore(H,f);S.removeChild(f),u+=T.length-1,n.push(...F)}else s(f,[...c,x])}};s(t.content,[]);const i={template:t,buildParts:l=>{const c=[];for(const a of n){let u=l;for(const p of a.path)u=u.childNodes[p];a.kind==="node"?c.push({kind:"node",valueIndex:a.valueIndex,child:{anchor:u,state:null}}):a.kind==="attr"?c.push({kind:"attr",element:u,name:a.name,template:a.template,valueIndices:a.valueIndices}):a.kind==="event"?c.push({kind:"event",valueIndex:a.valueIndex,element:u,name:a.name}):a.kind==="prop"?c.push({kind:"prop",valueIndex:a.valueIndex,element:u,name:a.name}):a.kind==="bool"&&c.push({kind:"bool",valueIndex:a.valueIndex,element:u,name:a.name})}return c}};return je.set(o,i),i}const We=new WeakMap;function Ht(o,e){for(const t of o.nodes)if(t.parentNode!==e)return!1;return!0}function Wt(o,e){const t=We.get(e);if(t&&t.strings===o.strings&&Ht(t,e)){pe(t.parts,o.values);return}const n=He(o.strings),s=n.template.content.cloneNode(!0),r=n.buildParts(s),i=Array.from(s.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(s),pe(r,o.values),We.set(e,{strings:o.strings,parts:r,nodes:i})}function pe(o,e){for(const t of o)if(t.kind==="node")fe(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let n=t.template[0];for(let s=0;s<t.valueIndices.length;s++)n+=qe(e[t.valueIndices[s]]),n+=t.template[s+1];n!==t.last&&(t.last=n,n===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,n))}else if(t.kind==="event"){const n=e[t.valueIndex];n!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),n&&t.element.addEventListener(t.name,n),t.current=n)}else if(t.kind==="prop"){const n=e[t.valueIndex];n!==t.last&&(t.last=n,t.element[t.name]=n)}else if(t.kind==="bool"){const n=!!e[t.valueIndex];n!==t.last&&(t.last=n,n?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function fe(o,e){if(e==null||e===!1){o.state&&(O(o.state),o.state=null);return}if(Array.isArray(e)){Bt(o,e);return}if(zt(e)){Ot(o,e);return}if(e instanceof Node){qt(o,e);return}Ut(o,qe(e))}function qt(o,e){const t=o.state;t?.shape==="node"&&t.node===e||(t&&O(t),Z(o,[e]),o.state={shape:"node",node:e})}function Ut(o,e){const t=o.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&O(t);const n=document.createTextNode(e);Z(o,[n]),o.state={shape:"text",node:n,text:e}}function Ot(o,e){const t=o.state;if(t?.shape==="template"&&t.strings===e.strings){pe(t.parts,e.values);return}t&&O(t);const n=He(e.strings),s=n.template.content.cloneNode(!0),r=n.buildParts(s),i=Array.from(s.childNodes);Z(o,[s]),pe(r,e.values),o.state={shape:"template",strings:e.strings,parts:r,nodes:i}}function Bt(o,e){const t=o.state;if(t?.shape==="array"){const s=Math.min(t.entries.length,e.length);for(let r=0;r<s;r++)fe(t.entries[r],e[r]);if(e.length<t.entries.length){for(let r=e.length;r<t.entries.length;r++){const i=t.entries[r];i.state&&O(i.state),i.anchor.remove()}t.entries.length=e.length}else for(let r=t.entries.length;r<e.length;r++){const i=document.createTextNode("");Z(o,[i]);const l={anchor:i,state:null};fe(l,e[r]),t.entries.push(l)}return}t&&O(t);const n=[];for(const s of e){const r=document.createTextNode("");Z(o,[r]);const i={anchor:r,state:null};fe(i,s),n.push(i)}o.state={shape:"array",entries:n}}function Z(o,e){const t=o.anchor.parentNode;if(t)for(const n of e)t.insertBefore(n,o.anchor)}function O(o){if(o.shape==="text"){o.node.remove();return}if(o.shape==="template"){for(const e of o.parts)e.kind==="node"&&e.child.state&&(O(e.child.state),e.child.state=null);for(const e of o.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(o.shape==="node"){o.node.parentNode&&o.node.parentNode.removeChild(o.node);return}for(const e of o.entries)e.state&&O(e.state),e.anchor.remove()}function qe(o){return o==null||o===!1?"":String(o)}const B=class B 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(Ue)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,n){if(t===n)return;const s=Kt(e);this._propValues[s]=n,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const n=(Array.isArray(e)?e:String(e).split(/\s+/)).map(s=>String(s).trim()).filter(s=>s!=="");this.className=n.join(" ")}requestUpdate(){this._scheduleRender()}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const t of e.props){if(Object.getOwnPropertyDescriptor(this,t))continue;const n=Ue(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(n),set:s=>{let r;s==null||s===!1?r=null:s===!0?r="":r=String(s),this._propValues[t]=r,r===null?this.removeAttribute(n):this.setAttribute(n,r),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&Wt(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(n=>n.sheet).filter(n=>n!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const n of e.styles)if(!n.sheet){const s=document.createElement("style");s.textContent=n.cssText,this.shadowRoot.appendChild(s)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!B._lightStylesAdopted.has(e)){B._lightStylesAdopted.add(e);for(const t of e.styles){const n=document.createElement("style");n.dataset.osUi=this.tagName.toLowerCase(),n.textContent=t.cssText,document.head.appendChild(n)}}}};B.props=[],B.styles=[],B.shadow=!0,B._lightStylesAdopted=new WeakSet;let q=B;function K(o,e){customElements.get(o)||customElements.define(o,e)}function Ue(o){return o.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function Kt(o){return o.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const Xt=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function E(o,...e){let t=o[0];for(let n=1;n<o.length;n++){const s=e[n-1];if(typeof s=="string"||typeof s=="number")t+=String(s);else if(s&&s.__wpdCss)t+=s.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof s);t+=o[n]}if(Xt){const n=new CSSStyleSheet;return n.replaceSync(t),{__wpdCss:!0,sheet:n,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function Yt(o){const e=[],t=[];let n=null,s=o.parentElement;for(;s&&!(s===document.body||s===document.documentElement);){const i=s.id||"";if(i.startsWith("wp-window-")){n=i.slice(10);break}if(s.tagName.toLowerCase()==="os-tabpanel"){const l=s.getAttribute("for");l&&t.unshift(l)}s=s.parentElement}n&&e.push(ke(n));for(const i of t)e.push("tab-"+ke(i));const r=o.getAttribute("label");return r&&e.push(ke(r)),e.length===0?"os-unnamed":"os-"+e.filter(i=>i!=="").join("-")}function ke(o){return o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Gt(o){if(o.id)return o.id;const e=Yt(o);return o.id=e,e}function Vt(o){if(!o)return 214;let e=5381;for(let t=0;t<o.length;t++)e=Math.imul(e,33)+o.charCodeAt(t);return(e%360+360)%360}const Jt=E`:host{display:inline-flex;position:relative;width:var( --os-ui-avatar-size,32px );height:var( --os-ui-avatar-size,32px );flex:0 0 auto;vertical-align:middle;line-height:0;perspective:calc( var( --os-ui-avatar-size,32px ) * 8 );--os-ui-avatar-tilt-x:0deg;--os-ui-avatar-tilt-y:0deg;--os-ui-avatar-hover:0;--os-ui-avatar-glare-x:50%;--os-ui-avatar-glare-y:50%}:host( [ hidden ] ){display:none}.os-avatar__tile{position:relative;width:100%;height:100%;border-radius:50%;overflow:hidden;background:var( --os-window-bg,#f0f0f1 );color:var( --os-ui-fg-on-accent,#fff );display:flex;align-items:center;justify-content:center;font-weight:700;font-size:calc( var( --os-ui-avatar-size,32px ) * 0.48 );line-height:1;letter-spacing:0;font-feature-settings:'tnum' 1;user-select:none;transform-style:preserve-3d;transform:rotateX( var( --os-ui-avatar-tilt-x ) ) rotateY( var( --os-ui-avatar-tilt-y ) ) scale( calc( 1 + var( --os-ui-avatar-hover ) * 0.07 ) );transition:transform 220ms cubic-bezier( 0.2,0.8,0.2,1 ),box-shadow 220ms cubic-bezier( 0.2,0.8,0.2,1 );box-shadow:inset 0 0 0 1px rgba( 255,255,255,calc( 0.18 + 0.22 * var( --os-ui-avatar-hover ) ) ),inset 0 0 0 calc( 1px + var( --os-ui-avatar-hover ) * 1px ) rgba( 0,0,0,calc( 0.08 + 0.04 * var( --os-ui-avatar-hover ) ) ),0 calc( 1px + var( --os-ui-avatar-hover ) * 8px ) calc( 6px + var( --os-ui-avatar-hover ) * 18px ) rgba( 0,0,0,calc( 0.08 + 0.18 * var( --os-ui-avatar-hover ) ) )}.os-avatar__tile::after{content:'';position:absolute;inset:0;border-radius:50%;background:radial-gradient( circle at var( --os-ui-avatar-glare-x ) var( --os-ui-avatar-glare-y ),var( --os-ui-scrim,rgba( 255,255,255,0.55 ) ) 0%,var( --os-ui-hover,rgba( 255,255,255,0 ) ) 55% );opacity:var( --os-ui-avatar-hover );mix-blend-mode:overlay;pointer-events:none;transition:opacity 220ms cubic-bezier( 0.2,0.8,0.2,1 )}.os-avatar__tile::before{content:'';position:absolute;inset:calc( var( --os-ui-avatar-hover ) * -3px );border-radius:50%;background:radial-gradient( circle at var( --os-ui-avatar-glare-x ) var( --os-ui-avatar-glare-y ),color-mix( in srgb,var( --os-ui-avatar-halo,rgb( 99,102,241 ) ) calc( 35% * var( --os-ui-avatar-hover ) ),transparent ) 0%,transparent 70% );filter:blur( 4px );pointer-events:none;z-index:-1;transition:inset 220ms cubic-bezier( 0.2,0.8,0.2,1 ),background 220ms}.os-avatar__tile img{width:calc( 100% + 2px );height:calc( 100% + 2px );margin:-1px;object-fit:cover;display:block;transform:translateZ( 1px )}.os-avatar__dot{position:absolute;bottom:0;inset-inline-end:0;width:calc( var( --os-ui-avatar-size,32px ) * 0.32 );height:calc( var( --os-ui-avatar-size,32px ) * 0.32 );min-width:8px;min-height:8px;border-radius:50%;box-sizing:border-box;border:2px solid var( --os-ui-avatar-dot-ring,var( --os-window-bg,#fff ) );background:var( --os-ui-avatar-dot-color,transparent );z-index:2}.os-avatar__dot--online{background:var( --os-ui-success-fg,#00a32a )}.os-avatar__dot--online::after{content:'';position:absolute;inset:-2px;border-radius:50%;border:1px solid var( --os-ui-success-fg,#00a32a );animation:os-avatar-presence 6s var( --os-ui-ease-out,cubic-bezier( 0.22,0.9,0.28,1 ) ) infinite;pointer-events:none}@keyframes os-avatar-presence{0%{opacity:0.6;transform:scale( 1 )}20%{opacity:0;transform:scale( 2.2 )}100%{opacity:0;transform:scale( 2.2 )}}.os-avatar__dot--inactive{background:var( --os-ui-warning-fg,#dba617 )}.os-avatar__dot--offline{background:var( --os-ui-fg-muted,#8c8f94 )}@media ( prefers-reduced-motion:reduce ){.os-avatar__dot--online::after{animation:none;opacity:0.6}.os-avatar__tile{transform:none;transition:box-shadow 200ms}.os-avatar__tile::after,.os-avatar__tile::before{display:none}}`,Oe={xs:20,sm:24,md:40,lg:64,xl:96},Be=new Set(["online","inactive","offline"]),oe=class oe extends q{constructor(){super(...arguments),this._presenceHandler=null,this._imgFailed=!1,this._onPointerMove=null,this._onPointerEnter=null,this._onPointerLeave=null,this._tiltRaf=0,this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%"}connectedCallback(){super.connectedCallback(),this._maybeAttachPresenceListener(),this._attachHoverEffect()}disconnectedCallback(){this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null),this._detachHoverEffect()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",n=this._attr("alt"),s=n!==null?n:t,r=this._attr("size"),i=this._resolveSize(r),l=this._presenceForRender(),c=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${i}px`);const a=e&&!this._imgFailed?"":this._initialsBg(t),u=e&&!this._imgFailed?y`<img
2 2 src=${e}
3 3 alt=${s}
4 4 @error=${()=>this._onImgError()}
5 5 loading="lazy"
6 - />`:this._initials(t),g=d?k`<span
7 - class=${`os-avatar__dot os-avatar__dot--${d}`}
8 - aria-label=${this._presenceLabel(d)}
9 - ></span>`:k``;return a?k`
6 + />`:this._initials(t),p=l?y`<span
7 + class=${`os-avatar__dot os-avatar__dot--${l}`}
8 + aria-label=${this._presenceLabel(l)}
9 + ></span>`:y``;return c?y`
10 10 <button
11 11 type="button"
12 12 class="os-avatar__tile"
13 13 aria-label=${s||"User"}
14 - style=${l?`background:${l};`:""}
15 - @click=${_=>this._onClick(_)}
14 + style=${a?`background:${a};`:""}
15 + @click=${f=>this._onClick(f)}
16 16 >${u}</button>
17 - ${g}
18 - `:k`
17 + ${p}
18 + `:y`
19 19 <div
20 20 class="os-avatar__tile"
21 21 role="img"
22 22 aria-label=${s||"User"}
23 - style=${l?`background:${l};`:""}
23 + style=${a?`background:${a};`:""}
24 24 >${u}</div>
25 - ${g}
26 - `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in Ie)return Ie[e];const t=Number(e);return Number.isFinite(t)&&t>0?t:32}_initials(e){const t=e.trim();return t?Array.from(t)[0]?.toUpperCase()??"?":"?"}_initialsBg(e){const t=Et(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&Re.has(e)?e:null}_presenceLabel(e){switch(e){case"online":return"Online";case"inactive":return"Inactive";case"offline":return"Offline"}}_onImgError(){this._imgFailed=!0,this.requestUpdate()}_onClick(e){const t=this._attr("user-id"),n={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",n)}_attachHoverEffect(){typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||(this._onPointerEnter=()=>{this.style.setProperty("--os-ui-avatar-hover","1")},this._onPointerLeave=()=>{this.style.setProperty("--os-ui-avatar-hover","0"),this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%",this._flushTilt()},this._onPointerMove=t=>{const n=this.getBoundingClientRect();if(n.width===0||n.height===0)return;const s=(t.clientX-n.left)/n.width-.5,r=(t.clientY-n.top)/n.height-.5,i=14;this._pendingTiltY=`${(s*i).toFixed(2)}deg`,this._pendingTiltX=`${(-r*i).toFixed(2)}deg`;const d=Math.max(0,Math.min(100,(s+.5)*100)),a=Math.max(0,Math.min(100,(r+.5)*100));this._pendingGlareX=`${d.toFixed(1)}%`,this._pendingGlareY=`${a.toFixed(1)}%`,this._tiltRaf||(this._tiltRaf=requestAnimationFrame(()=>this._flushTilt()))},this.addEventListener("pointerenter",this._onPointerEnter),this.addEventListener("pointerleave",this._onPointerLeave),this.addEventListener("pointermove",this._onPointerMove))}_flushTilt(){this._tiltRaf=0,this.style.setProperty("--os-ui-avatar-tilt-x",this._pendingTiltX),this.style.setProperty("--os-ui-avatar-tilt-y",this._pendingTiltY),this.style.setProperty("--os-ui-avatar-glare-x",this._pendingGlareX),this.style.setProperty("--os-ui-avatar-glare-y",this._pendingGlareY)}_detachHoverEffect(){this._onPointerMove&&(this.removeEventListener("pointermove",this._onPointerMove),this._onPointerMove=null),this._onPointerEnter&&(this.removeEventListener("pointerenter",this._onPointerEnter),this._onPointerEnter=null),this._onPointerLeave&&(this.removeEventListener("pointerleave",this._onPointerLeave),this._onPointerLeave=null),this._tiltRaf&&(cancelAnimationFrame(this._tiltRaf),this._tiltRaf=0)}_maybeAttachPresenceListener(){const e=this._attr("user-id"),t=this._attr("presence"),n=!!e&&!t;n&&!this._presenceHandler?(this._presenceHandler=s=>{const r=s.detail;r&&String(r.userId)===String(e)&&r.newStatus&&Re.has(r.newStatus)&&this.setAttribute("presence",r.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!n&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};J.props=["src","alt","name","size","presence","userId","clickable"],J.styles=[Nt],J.help=void 0;let fe=J;U("os-avatar",fe);const ae=C`: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 ) )}`,St=C` .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%}}`,Le=C` .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%}}`,ze=C` .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}}`,Pe=C` .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}}`,Me=C` .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}}`,Tt=C` .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%}}`,It=C` .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}}`,Fe=C` 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}}`,Rt=C` input[ type='checkbox' ],input[ type='radio' ]{appearance:none;-webkit-appearance:none;position:relative;flex:0 0 auto;box-sizing:border-box;width:16px;height:16px;margin:0;padding:0;border:1px solid var( --_holo-track-edge );border-radius:4px;background-color:var( --_holo-track );background-image:none;background-repeat:no-repeat;cursor:inherit;transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='radio' ]{border-radius:50%}input[ type='checkbox' ]:hover:not(:disabled ),input[ type='radio' ]:hover:not(:disabled ){border-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:focus-visible,input[ type='radio' ]:focus-visible{outline:none;box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked,input[ type='checkbox' ]:indeterminate,input[ type='radio' ]:checked{border-color:transparent;background-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:checked:focus-visible,input[ type='radio' ]:checked:focus-visible{box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:46%;width:3.5px;height:7.5px;border:solid var( --os-ui-fg-on-accent,#fff );border-width:0 2px 2px 0;transform:translate( -50%,-50% ) rotate( 45deg );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:indeterminate::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:8px;height:2px;border:0;border-radius:1px;background:var( --os-ui-fg-on-accent,#fff );transform:translate( -50%,-50% )}input[ type='radio' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:6px;height:6px;border-radius:50%;background:var( --os-ui-fg-on-accent,#fff );transform:translate( -50%,-50% );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:disabled,input[ type='radio' ]:disabled{cursor:not-allowed}@keyframes os-holo-tick{from{opacity:0;transform:translate( -50%,-50% ) rotate( 45deg ) scale( 0.4 )}}@media ( prefers-reduced-motion:reduce ){input[ type='checkbox' ]:checked::after,input[ type='radio' ]:checked::after{animation:none}}`,De=C` @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}}`;C` ${ae} ${St} ${Le} ${ze} ${Pe} ${Me} ${Tt} ${It} ${Fe} ${Rt} ${De} `;const Lt=C` ${ae} ${Le} ${ze} ${Pe} ${Me} ${De}:host{display:inline-flex}:host( [ fill-cell ] ){display:flex;width:100%}button{appearance:none;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:var( --os-ui-button-padding,6px 12px );border-radius:var( --os-ui-button-border-radius,6px );font:inherit;font-weight:500;cursor:pointer;transition:background-color var( --_holo-t ) ease,color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,transform 80ms ease;background:var( --os-ui-button-bg,transparent );background-image:var( --os-ui-button-bg-image,none );background-repeat:var( --os-ui-button-bg-image-repeat,repeat );background-size:var( --os-ui-button-bg-image-size,auto );background-position:var( --os-ui-button-bg-image-position,center );color:var( --os-ui-button-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-button-border,1px solid var( --os-ui-border,#c3c4c7 ) )}:host( [ fill-cell ] ) button{width:100%;min-height:var( --os-ui-button-min-height,44px )}button:disabled{opacity:0.5;cursor:not-allowed}button:active:not(:disabled ){transform:translateY( 1px )}button:hover:not(:disabled ){background-color:var( --os-ui-button-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}button:disabled::before,button:disabled::after,button:disabled .os-holo-glint{opacity:0 !important}:host( [ variant='primary' ] ) button{background-color:var( --os-ui-button-bg,var( --wp-admin-theme-color,#2271b1 ) );color:var( --os-ui-button-fg,var( --os-ui-fg-on-accent,#fff ) );border:var( --os-ui-button-border,1px solid transparent )}:host( [ variant='primary' ] ) button:hover:not(:disabled ){filter:brightness( 1.06 );background-color:var( --os-ui-button-bg,var( --wp-admin-theme-color,#2271b1 ) );box-shadow:var( --_holo-glow )}:host( [ variant='holo' ] ) button{background-color:transparent;background-image:var( --_holo-fill );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;color:var( --os-ui-button-fg,var( --_holo-ink ) );border:var( --os-ui-button-border,1px solid transparent );box-shadow:var( --_holo-glow );font-weight:600;transition:background-position var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,filter var( --_holo-t ) ease,transform 80ms ease}:host( [ variant='holo' ] ) button:hover:not(:disabled ){background-color:transparent;background-position:74% 66%;box-shadow:var( --_holo-glow-strong )}:host( [ variant='holo' ] ) button:active:not(:disabled ){background-position:88% 82%;filter:brightness( 0.94 )}:host( [ variant='holo' ] ) button::before{display:none}@media ( prefers-reduced-motion:reduce ){:host( [ variant='holo' ] ) button:hover:not(:disabled ),:host( [ variant='holo' ] ) button:active:not(:disabled ){background-position:22% 28%}}:host( [ variant='secondary' ] ) button{background-color:var( --os-ui-button-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );color:var( --os-ui-button-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-button-border,1px solid transparent )}:host( [ variant='secondary' ] ) button:hover:not(:disabled ){background-color:var( --os-ui-button-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.1 ) ) )}:host( [ variant='danger' ] ) button{background-color:var( --os-ui-button-bg,transparent );color:var( --os-ui-button-fg,var( --os-ui-danger,#d63638 ) );border:var( --os-ui-button-border,1px solid currentColor )}:host( [ variant='danger' ] ) button:hover:not(:disabled ){background-color:var( --os-ui-danger,#d63638 );color:var( --os-ui-fg-on-accent,#fff )}:host( [ variant='danger' ] ) button::after{display:none}:host( [ variant='link' ] ) button{background-color:transparent;background-image:none;color:var( --os-ui-button-fg,var( --wp-admin-theme-color,#2271b1 ) );border:0;padding:0;text-decoration:underline}:host( [ variant='link' ] ) button::before,:host( [ variant='link' ] ) button::after,:host( [ variant='link' ] ) .os-holo-glint,:host( [ variant='link' ] ) .os-holo-ring{display:none}:host( [ variant='link' ] ) button:active:not(:disabled ){transform:none}:host( [ busy ] ) button{pointer-events:none;opacity:0.75}:host( [ variant='holo' ][ busy ] ) button{animation:os-holo-drift 12s ease-in-out infinite}@media ( prefers-reduced-motion:reduce ){:host( [ variant='holo' ][ busy ] ) button{animation:none}}.os-button__spinner{box-sizing:border-box;display:inline-block;width:12px;height:12px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:os-button-spin 0.6s linear infinite;flex-shrink:0}@keyframes os-button-spin{to{transform:rotate( 360deg )}}`,Z=class Z extends M{render(){const e=this.disabled!==null,t=this.busy!==null,n=this.type||"button";return k`
25 + ${p}
26 + `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in Oe)return Oe[e];const t=Number(e);return Number.isFinite(t)&&t>0?t:32}_initials(e){const t=e.trim();return t?Array.from(t)[0]?.toUpperCase()??"?":"?"}_initialsBg(e){const t=Vt(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&Be.has(e)?e:null}_presenceLabel(e){switch(e){case"online":return"Online";case"inactive":return"Inactive";case"offline":return"Offline"}}_onImgError(){this._imgFailed=!0,this.requestUpdate()}_onClick(e){const t=this._attr("user-id"),n={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",n)}_attachHoverEffect(){typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||(this._onPointerEnter=()=>{this.style.setProperty("--os-ui-avatar-hover","1")},this._onPointerLeave=()=>{this.style.setProperty("--os-ui-avatar-hover","0"),this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%",this._flushTilt()},this._onPointerMove=t=>{const n=this.getBoundingClientRect();if(n.width===0||n.height===0)return;const s=(t.clientX-n.left)/n.width-.5,r=(t.clientY-n.top)/n.height-.5,i=14;this._pendingTiltY=`${(s*i).toFixed(2)}deg`,this._pendingTiltX=`${(-r*i).toFixed(2)}deg`;const l=Math.max(0,Math.min(100,(s+.5)*100)),c=Math.max(0,Math.min(100,(r+.5)*100));this._pendingGlareX=`${l.toFixed(1)}%`,this._pendingGlareY=`${c.toFixed(1)}%`,this._tiltRaf||(this._tiltRaf=requestAnimationFrame(()=>this._flushTilt()))},this.addEventListener("pointerenter",this._onPointerEnter),this.addEventListener("pointerleave",this._onPointerLeave),this.addEventListener("pointermove",this._onPointerMove))}_flushTilt(){this._tiltRaf=0,this.style.setProperty("--os-ui-avatar-tilt-x",this._pendingTiltX),this.style.setProperty("--os-ui-avatar-tilt-y",this._pendingTiltY),this.style.setProperty("--os-ui-avatar-glare-x",this._pendingGlareX),this.style.setProperty("--os-ui-avatar-glare-y",this._pendingGlareY)}_detachHoverEffect(){this._onPointerMove&&(this.removeEventListener("pointermove",this._onPointerMove),this._onPointerMove=null),this._onPointerEnter&&(this.removeEventListener("pointerenter",this._onPointerEnter),this._onPointerEnter=null),this._onPointerLeave&&(this.removeEventListener("pointerleave",this._onPointerLeave),this._onPointerLeave=null),this._tiltRaf&&(cancelAnimationFrame(this._tiltRaf),this._tiltRaf=0)}_maybeAttachPresenceListener(){const e=this._attr("user-id"),t=this._attr("presence"),n=!!e&&!t;n&&!this._presenceHandler?(this._presenceHandler=s=>{const r=s.detail;r&&String(r.userId)===String(e)&&r.newStatus&&Be.has(r.newStatus)&&this.setAttribute("presence",r.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!n&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};oe.props=["src","alt","name","size","presence","userId","clickable"],oe.styles=[Jt],oe.help=void 0;let we=oe;K("os-avatar",we);const me=E`: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=E` .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%}}`,Ke=E` .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%}}`,Xe=E` .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}}`,Ye=E` .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}}`,Ge=E` .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}}`,Qt=E` .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%}}`,eo=E` .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}}`,Ve=E` 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}}`,to=E` 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}}`,Je=E` @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}}`;E` ${me} ${Zt} ${Ke} ${Xe} ${Ye} ${Ge} ${Qt} ${eo} ${Ve} ${to} ${Je} `;const oo=E` ${me} ${Ke} ${Xe} ${Ye} ${Ge} ${Je}:host{display:inline-flex}:host( [ fill-cell ] ){display:flex;width:100%}button{appearance:none;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:var( --os-ui-button-padding,6px 12px );border-radius:var( --os-ui-button-border-radius,6px );font:inherit;font-weight:500;cursor:pointer;transition:background-color var( --_holo-t ) ease,color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,transform 80ms ease;background:var( --os-ui-button-bg,transparent );background-image:var( --os-ui-button-bg-image,none );background-repeat:var( --os-ui-button-bg-image-repeat,repeat );background-size:var( --os-ui-button-bg-image-size,auto );background-position:var( --os-ui-button-bg-image-position,center );color:var( --os-ui-button-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-button-border,1px solid var( --os-ui-border,#c3c4c7 ) )}:host( [ fill-cell ] ) button{width:100%;min-height:var( --os-ui-button-min-height,44px )}button:disabled{opacity:0.5;cursor:not-allowed}button:active:not(:disabled ){transform:translateY( 1px )}button:hover:not(:disabled ){background-color:var( --os-ui-button-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}button:disabled::before,button:disabled::after,button:disabled .os-holo-glint{opacity:0 !important}:host( [ variant='primary' ] ) button{background-color:var( --os-ui-button-bg,var( --wp-admin-theme-color,#2271b1 ) );color:var( --os-ui-button-fg,var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) ) );border:var( --os-ui-button-border,1px solid transparent )}:host( [ variant='primary' ] ) button:hover:not(:disabled ){filter:brightness( 1.06 );background-color:var( --os-ui-button-bg,var( --wp-admin-theme-color,#2271b1 ) );box-shadow:var( --_holo-glow )}:host( [ variant='holo' ] ) button{background-color:transparent;background-image:var( --_holo-fill );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;color:var( --os-ui-button-fg,var( --_holo-ink ) );border:var( --os-ui-button-border,1px solid transparent );box-shadow:var( --_holo-glow );font-weight:600;transition:background-position var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,filter var( --_holo-t ) ease,transform 80ms ease}:host( [ variant='holo' ] ) button:hover:not(:disabled ){background-color:transparent;background-position:74% 66%;box-shadow:var( --_holo-glow-strong )}:host( [ variant='holo' ] ) button:active:not(:disabled ){background-position:88% 82%;filter:brightness( 0.94 )}:host( [ variant='holo' ] ) button::before{display:none}@media ( prefers-reduced-motion:reduce ){:host( [ variant='holo' ] ) button:hover:not(:disabled ),:host( [ variant='holo' ] ) button:active:not(:disabled ){background-position:22% 28%}}:host( [ variant='secondary' ] ) button{background-color:var( --os-ui-button-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );color:var( --os-ui-button-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-button-border,1px solid transparent )}:host( [ variant='secondary' ] ) button:hover:not(:disabled ){background-color:var( --os-ui-button-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.1 ) ) )}:host( [ variant='danger' ] ) button{background-color:var( --os-ui-button-bg,transparent );color:var( --os-ui-button-fg,var( --os-ui-danger,#d63638 ) );border:var( --os-ui-button-border,1px solid currentColor )}:host( [ variant='danger' ] ) button:hover:not(:disabled ){background-color:var( --os-ui-danger,#d63638 );color:var( --os-ui-fg-on-accent,#fff )}:host( [ variant='danger' ] ) button::after{display:none}:host( [ variant='link' ] ) button{background-color:transparent;background-image:none;color:var( --os-ui-button-fg,var( --wp-admin-theme-color,#2271b1 ) );border:0;padding:0;text-decoration:underline}:host( [ variant='link' ] ) button::before,:host( [ variant='link' ] ) button::after,:host( [ variant='link' ] ) .os-holo-glint,:host( [ variant='link' ] ) .os-holo-ring{display:none}:host( [ variant='link' ] ) button:active:not(:disabled ){transform:none}:host( [ busy ] ) button{pointer-events:none;opacity:0.75}:host( [ variant='holo' ][ busy ] ) button{animation:os-holo-drift 12s ease-in-out infinite}@media ( prefers-reduced-motion:reduce ){:host( [ variant='holo' ][ busy ] ) button{animation:none}}.os-button__spinner{box-sizing:border-box;display:inline-block;width:12px;height:12px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:os-button-spin 0.6s linear infinite;flex-shrink:0}@keyframes os-button-spin{to{transform:rotate( 360deg )}}`,ne=class ne extends q{static get observedAttributes(){return[...super.observedAttributes,"aria-label"]}render(){const e=this.disabled!==null,t=this.busy!==null,n=this.type||"button",s=this.getAttribute("aria-label")||"";return y`
27 27 <button
28 28 part="button"
29 29 class="os-holo-edge os-holo-sheen"
30 30 type=${n}
@@ -29,10 +29,11 @@
29 29 class="os-holo-edge os-holo-sheen"
30 30 type=${n}
31 31 ?disabled=${e||t}
32 32 aria-busy=${t?"true":"false"}
33 + aria-label=${s}
33 34 >
34 - ${t?k`<span class="os-button__spinner" aria-hidden="true"></span>`:""}
35 + ${t?y`<span class="os-button__spinner" aria-hidden="true"></span>`:""}
35 36 <slot></slot>
36 37 <!--
37 38 The two motion layers. Elements rather than
38 39 pseudo-elements because the sheen and the hairline
@@ -42,16 +43,16 @@
42 43 -->
43 44 <span class="os-holo-glint" aria-hidden="true"></span>
44 45 <span class="os-holo-ring" aria-hidden="true"></span>
45 46 </button>
46 - `}};Z.props=["variant","disabled","type","busy","fill-cell"],Z.styles=[Lt],Z.help=void 0;let me=Z;U("os-button",me);const zt=C`:host{display:inline-flex;align-items:center;justify-content:center;width:var( --os-ui-icon-size,16px );height:var( --os-ui-icon-size,16px );color:inherit;line-height:1}:host( [ hidden ] ){display:none}.os-icon__glyph{font-size:var( --os-ui-icon-size,16px );width:var( --os-ui-icon-size,16px );height:var( --os-ui-icon-size,16px );line-height:1;color:inherit;display:inline-flex;align-items:center;justify-content:center}.os-icon__glyph--char{font-family:dashicons;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;speak:none}.os-icon__glyph.dashicons{font-family:dashicons}`;let ce=null;function Pt(o){let e=o.trim();if(e==="")return null;(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));const t=e.match(/^\\([0-9a-f]{1,6})\s?$/i);return t?String.fromCodePoint(parseInt(t[1],16)):e||null}function je(){const o=new Map;if(typeof document>"u")return o;const e=Array.from(document.styleSheets??[]);for(const t of e){let n=null;try{n=t.cssRules}catch{continue}if(n)for(const s of Array.from(n)){const r=s;if(!r||!r.selectorText)continue;const i=r.selectorText.match(/\.dashicons-([a-z0-9-]+)::?before/i);if(!i)continue;const d=r.style?.content;if(!d)continue;const a=Pt(d);a&&o.set(i[1],a)}}return o}function Mt(o){ce||(ce=je());const e=o.startsWith("dashicons-")?o.slice(10):o;return ce.get(e)??null}function Ft(){ce=je()}let Ue=!1;function Dt(){if(Ue||typeof window>"u")return;Ue=!0;const o=()=>{Ft()};document.readyState==="loading"&&document.addEventListener("DOMContentLoaded",o,{once:!0}),window.addEventListener("load",o,{once:!0})}Dt();const Q=class Q extends M{render(){const e=this.name||"",t=e.startsWith("dashicons-")?e.slice(10):e,n=this.size;n&&/^\d+$/.test(n)&&this.style.setProperty("--os-ui-icon-size",`${n}px`);const s=Mt(t);return s?k`<span
47 + `}};ne.props=["variant","disabled","type","busy","fill-cell"],ne.styles=[oo],ne.help=void 0;let $e=ne;K("os-button",$e);const no=E`:host{display:inline-flex;align-items:center;justify-content:center;width:var( --os-ui-icon-size,16px );height:var( --os-ui-icon-size,16px );color:inherit;line-height:1}:host( [ hidden ] ){display:none}.os-icon__glyph{font-size:var( --os-ui-icon-size,16px );width:var( --os-ui-icon-size,16px );height:var( --os-ui-icon-size,16px );line-height:1;color:inherit;display:inline-flex;align-items:center;justify-content:center}.os-icon__glyph--char{font-family:dashicons;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;speak:none}.os-icon__glyph.dashicons{font-family:dashicons}`;let ge=null;function so(o){let e=o.trim();if(e==="")return null;(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));const t=e.match(/^\\([0-9a-f]{1,6})\s?$/i);return t?String.fromCodePoint(parseInt(t[1],16)):e||null}function Ze(){const o=new Map;if(typeof document>"u")return o;const e=Array.from(document.styleSheets??[]);for(const t of e){let n=null;try{n=t.cssRules}catch{continue}if(n)for(const s of Array.from(n)){const r=s;if(!r||!r.selectorText)continue;const i=r.selectorText.match(/\.dashicons-([a-z0-9-]+)::?before/i);if(!i)continue;const l=r.style?.content;if(!l)continue;const c=so(l);c&&o.set(i[1],c)}}return o}function ro(o){ge||(ge=Ze());const e=o.startsWith("dashicons-")?o.slice(10):o;return ge.get(e)??null}function io(){ge=Ze()}let Qe=!1;function ao(){if(Qe||typeof window>"u")return;Qe=!0;const o=()=>{io()};document.readyState==="loading"&&document.addEventListener("DOMContentLoaded",o,{once:!0}),window.addEventListener("load",o,{once:!0})}ao();const se=class se extends q{render(){const e=this.name||"",t=e.startsWith("dashicons-")?e.slice(10):e,n=this.size;n&&/^\d+$/.test(n)&&this.style.setProperty("--os-ui-icon-size",`${n}px`);const s=ro(t);return s?y`<span
47 48 class="os-icon__glyph os-icon__glyph--char dashicons dashicons-${t}"
48 49 aria-hidden="true"
49 - >${s}</span>`:k`<span
50 + >${s}</span>`:y`<span
50 51 class="os-icon__glyph dashicons dashicons-${t}"
51 52 aria-hidden="true"
52 - ></span>`}};Q.props=["name","size"],Q.styles=[zt],Q.help=void 0;let ge=Q;U("os-icon",ge);const jt=C`:host{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:32px 24px;text-align:center;color:var( --os-ui-empty-state-fg,var( --os-ui-fg-muted,#646970 ) )}:host( [ hidden ] ){display:none}.os-empty-state__icon{margin-bottom:4px;color:var( --os-ui-empty-state-icon-color,currentColor );opacity:0.75}.os-empty-state__heading{margin:0;font-size:14px;font-weight:600;color:var( --os-ui-fg,#1d2327 )}.os-empty-state__description{margin:0;font-size:12px;line-height:1.4;max-width:48ch}.os-empty-state__description:empty{display:none}.os-empty-state__cta{margin-top:8px}.os-empty-state__cta:empty{display:none}`,ee=class ee extends M{render(){const e=this.icon||"",t=this.heading||"",n=this.description||"";return k`
53 - ${e?k`<os-icon
53 + ></span>`}};se.props=["name","size"],se.styles=[no],se.help=void 0;let Ae=se;K("os-icon",Ae);const co=E`:host{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:32px 24px;text-align:center;color:var( --os-ui-empty-state-fg,var( --os-ui-fg-muted,#646970 ) )}:host( [ hidden ] ){display:none}.os-empty-state__icon{margin-bottom:4px;color:var( --os-ui-empty-state-icon-color,currentColor );opacity:0.75}.os-empty-state__heading{margin:0;font-size:14px;font-weight:600;color:var( --os-ui-fg,#1d2327 )}.os-empty-state__description{margin:0;font-size:12px;line-height:1.4;max-width:48ch}.os-empty-state__description:empty{display:none}.os-empty-state__cta{margin-top:8px}.os-empty-state__cta:empty{display:none}`,re=class re extends q{render(){const e=this.icon||"",t=this.heading||"",n=this.description||"";return y`
54 + ${e?y`<os-icon
54 55 class="os-empty-state__icon"
55 56 name=${e}
56 57 size="28"
57 58 ></os-icon>`:null}
@@ -60,43 +61,43 @@
60 61 <div class="os-empty-state__cta">
61 62 <slot name="cta"></slot>
62 63 </div>
63 64 <slot></slot>
64 - `}};ee.props=["icon","heading","description"],ee.styles=[jt],ee.help=void 0;let be=ee;U("os-empty-state",be);const Ut=C`:host{display:inline-block;--_color:var( --os-ui-spinner-color,var( --wp-admin-theme-color,#21759b ) );--_accent:var( --os-ui-spinner-accent,var( --os-ui-fg-on-accent,#fff ) );--_size:var( --os-ui-spinner-size,48px );width:var( --_size );height:var( --_size );color:var( --_color );vertical-align:middle;line-height:0}:host( [ hidden ] ){display:none}:host( [ preset='inline' ] ){--os-ui-spinner-color:currentColor;--os-ui-spinner-size:16px}.root,.root svg{display:block;width:100%;height:100%}.root svg .mark{fill:var( --_accent )}@keyframes os-spinner-spin{to{transform:rotate( 360deg )}}@keyframes os-spinner-scale{0%,100%{transform:scale( 1 )}50%{transform:scale( 1.045 )}}@keyframes os-spinner-opacity{0%,100%{opacity:1}50%{opacity:0.7}}@media ( prefers-reduced-motion:reduce ){.root svg [ style*='animation' ]{animation:none !important}}`,We=Object.freeze({classic:{sp1:12,sp2:24,sp3:40,a1:28,a2:15,a3:8,gap:4,dir2:1,dir3:-1,pulse:"none",dots:0},comet:{sp1:8,sp2:14,sp3:26,a1:50,a2:28,a3:12,gap:3,dir2:1,dir3:1,pulse:"none",dots:5},orbit:{sp1:10,sp2:10,sp3:32,a1:50,a2:50,a3:8,gap:5,dir2:-1,dir3:-1,pulse:"opacity",dots:3},pulse:{sp1:6,sp2:18,sp3:30,a1:20,a2:12,a3:6,gap:4,dir2:1,dir3:-1,pulse:"both",dots:8},inline:{sp1:8,sp2:8,sp3:8,a1:25,a2:25,a3:25,gap:0,dir2:1,dir3:1,pulse:"none",dots:0}}),L=61.26,z=61.26,qe=58.453,Wt='<path d="m8.708 61.26c0 20.802 12.089 38.779 29.619 47.298l-25.069-68.686c-2.916 6.536-4.55 13.769-4.55 21.388z"/><path d="m96.74 58.608c0-6.495-2.333-10.993-4.334-14.494-2.664-4.329-5.161-7.995-5.161-12.324 0-4.831 3.664-9.328 8.825-9.328.233 0 .454.029.681.042-9.35-8.566-21.807-13.796-35.489-13.796-18.36 0-34.513 9.42-43.91 23.688 1.233.037 2.395.063 3.382.063 5.497 0 14.006-.667 14.006-.667 2.833-.167 3.167 3.994.337 4.329 0 0-2.847.335-6.015.501l19.138 56.925 11.501-34.493-8.188-22.434c-2.83-.166-5.511-.501-5.511-.501-2.832-.166-2.5-4.496.332-4.329 0 0 8.679.667 13.843.667 5.496 0 14.006-.667 14.006-.667 2.835-.167 3.168 3.994.337 4.329 0 0-2.853.335-6.015.501l18.992 56.494 5.242-17.517c2.272-7.269 4.001-12.49 4.001-16.989z"/><path d="m62.184 65.857-15.768 45.819c4.708 1.384 9.687 2.141 14.846 2.141 6.12 0 11.989-1.058 17.452-2.979-.141-.225-.269-.464-.374-.724z"/><path d="m107.376 36.046c.226 1.674.354 3.471.354 5.404 0 5.333-.996 11.328-3.996 18.824l-16.053 46.413c15.624-9.111 26.133-26.038 26.133-45.426.001-9.137-2.333-17.729-6.438-25.215z"/>',te=class te extends M{constructor(){super(...arguments),this._paintScheduled=!1}connectedCallback(){super.connectedCallback(),this._schedulePaint()}render(){return k`<div class="root" part="root"></div>`}requestUpdate(){super.requestUpdate(),this._schedulePaint()}_schedulePaint(){this._paintScheduled||!this.isConnected||(this._paintScheduled=!0,queueMicrotask(()=>{this._paintScheduled=!1,this.isConnected&&this._paint()}))}_paint(){this._syncCssVars();const e=this.shadowRoot?.querySelector(".root");e&&(e.innerHTML=this._buildSvg())}_syncCssVars(){const e=(t,n,s)=>{const r=this.getAttribute(t);r===null?this.style.removeProperty(n):this.style.setProperty(n,s?s(r):r)};e("color","--os-ui-spinner-color"),e("accent","--os-ui-spinner-accent"),e("size","--os-ui-spinner-size",t=>/^-?\d+(\.\d+)?$/.test(t.trim())?`${t}px`:t)}_effectiveConfig(){const e=this.getAttribute("preset")??"classic",t=We[e]??We.classic,n=(i,d)=>{const a=this.getAttribute(i);if(a===null)return d;const l=parseFloat(a);return Number.isFinite(l)?l:d},s=(i,d)=>{const a=this.getAttribute(i);if(a===null)return d;const l=a.toLowerCase();return l==="-1"||l==="ccw"||l==="reverse"?-1:1},r=()=>{const i=this.getAttribute("pulse");return i==="scale"||i==="opacity"||i==="both"||i==="none"?i:t.pulse};return{sp1:n("sp1",t.sp1),sp2:n("sp2",t.sp2),sp3:n("sp3",t.sp3),a1:n("a1",t.a1),a2:n("a2",t.a2),a3:n("a3",t.a3),gap:n("gap",t.gap),dir2:s("dir2",t.dir2),dir3:s("dir3",t.dir3),pulse:r(),dots:Math.max(0,Math.floor(n("dots",t.dots)))}}_buildInlineSvg(e){const t=He(this.getAttribute("label")??"Loading"),n=9,s=(e.sp1/10).toFixed(2);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-label="${t}"><circle cx="12" cy="12" r="${n}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-opacity="0.22"/><circle cx="12" cy="12" r="${n}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-dasharray="${le(n,e.a1)}" style="transform-origin:12px 12px;animation: os-spinner-spin ${s}s linear infinite"/></svg>`}_buildSvg(){const e=this._effectiveConfig();if(this.getAttribute("preset")==="inline")return this._buildInlineSvg(e);const t=He(this.getAttribute("label")??"Loading"),n=e.gap*3+14,s=-n,r=122.52+n*2,i=qe+e.gap+2,d=i+e.gap+2,a=d+e.gap+1.5,l=`animation: os-spinner-spin ${(e.sp1/10).toFixed(2)}s linear infinite`,u=`animation: os-spinner-spin ${(e.sp2/10).toFixed(2)}s linear infinite${e.dir2<0?" reverse":""}`,g=`animation: os-spinner-spin ${(e.sp3/10).toFixed(2)}s linear infinite${e.dir3<0?" reverse":""}`,_=(e.sp1*1.8/10).toFixed(1),$=(e.sp1*2.3/10).toFixed(1);let v="";e.pulse==="scale"?v=`animation: os-spinner-scale ${_}s ease-in-out infinite`:e.pulse==="opacity"?v=`animation: os-spinner-opacity ${$}s ease-in-out infinite`:e.pulse==="both"&&(v=`animation: os-spinner-scale ${_}s ease-in-out infinite, os-spinner-opacity ${$}s ease-in-out infinite`);let T="";if(e.dots>0){const A=a+e.gap+1,c=2*Math.PI*A,h=1.6,p=(e.sp1*.65/10).toFixed(2);for(let y=0;y<e.dots;y++){const E=-(y/e.dots)*c;T+=`<circle cx="${L}" cy="${z}" r="${A.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="${h}" stroke-dasharray="${h.toFixed(2)} ${(c-h).toFixed(2)}" stroke-dashoffset="${E.toFixed(2)}" stroke-linecap="round" stroke-opacity="0.65" style="transform-origin:${L}px ${z}px;animation: os-spinner-spin ${p}s linear infinite"/>`}}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${s} ${s} ${r} ${r}" role="img" aria-label="${t}"><g style="transform-origin:${L}px ${z}px${v?";"+v:""}"><circle cx="${L}" cy="${z}" r="${qe}" fill="currentColor"/><g class="mark">${Wt}</g></g><circle cx="${L}" cy="${z}" r="${i.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.6" stroke-opacity="0.2"/><circle cx="${L}" cy="${z}" r="${i.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="2.2" stroke-dasharray="${le(i,e.a1)}" stroke-linecap="round" style="transform-origin:${L}px ${z}px;${l}"/><circle cx="${L}" cy="${z}" r="${d.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.5" stroke-opacity="0.15"/><circle cx="${L}" cy="${z}" r="${d.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.6" stroke-opacity="0.8" stroke-dasharray="${le(d,e.a2)}" stroke-linecap="round" style="transform-origin:${L}px ${z}px;${u}"/><circle cx="${L}" cy="${z}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.4" stroke-opacity="0.12"/><circle cx="${L}" cy="${z}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.0" stroke-opacity="0.6" stroke-dasharray="${le(a,e.a3)}" stroke-linecap="round" style="transform-origin:${L}px ${z}px;${g}"/>`+T+"</svg>"}};te.props=["preset","size","color","accent","sp1","sp2","sp3","a1","a2","a3","gap","dir2","dir3","pulse","dots","label"],te.styles=[Ut],te.help=void 0;let ve=te;function le(o,e){const t=2*Math.PI*o,n=e/100*t,s=t-n;return`${n.toFixed(2)} ${s.toFixed(2)}`}function He(o){return String(o).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}U("os-spinner",ve);const qt=C` ${ae} ${Fe}:host{--_field-size:var( --os-ui-field-font-size,13px );--_field-radius:var( --os-ui-field-radius,6px );display:flex;flex-direction:column;gap:4px;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-textarea__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}textarea{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:8px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:var( --_field-radius );font:inherit;font-size:var( --_field-size );line-height:1.45;color:var( --os-ui-fg,#1d2327 );resize:vertical}textarea:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}textarea[ aria-invalid='true' ],textarea[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}textarea[ aria-invalid='true' ]:focus,textarea[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}:host( [ auto-grow ] ) textarea{resize:none;overflow:hidden}`,oe=class oe extends M{constructor(){super(...arguments),this._textareaEl=null}connectedCallback(){super.connectedCallback(),Ct(this)}render(){const e=this._attr("label")||"",t=this._attr("value")??"",n=this._attr("placeholder")||"",s=this._boolAttr("disabled"),r=this._boolAttr("readonly"),i=this._attr("aria-label")||e,d=this._attr("name")||"",a=Number(this._attr("rows"))||3,l=this._attr("maxlength"),u=this._attr("minlength"),g=this._boolAttr("invalid"),$=`${this.id||"os-unnamed"}__field`;return k`
65 - ${e?k`<label class="os-textarea__label" for=${$}>${e}</label>`:k``}
65 + `}};re.props=["icon","heading","description"],re.styles=[co],re.help=void 0;let Ce=re;K("os-empty-state",Ce);const lo=E`:host{display:inline-block;--_color:var( --os-ui-spinner-color,var( --wp-admin-theme-color,#21759b ) );--_accent:var( --os-ui-spinner-accent,var( --os-ui-fg-on-accent,#fff ) );--_size:var( --os-ui-spinner-size,48px );width:var( --_size );height:var( --_size );color:var( --_color );vertical-align:middle;line-height:0}:host( [ hidden ] ){display:none}:host( [ preset='inline' ] ){--os-ui-spinner-color:currentColor;--os-ui-spinner-size:16px}.root,.root svg{display:block;width:100%;height:100%}.root svg .mark{fill:var( --_accent )}@keyframes os-spinner-spin{to{transform:rotate( 360deg )}}@keyframes os-spinner-scale{0%,100%{transform:scale( 1 )}50%{transform:scale( 1.045 )}}@keyframes os-spinner-opacity{0%,100%{opacity:1}50%{opacity:0.7}}@media ( prefers-reduced-motion:reduce ){.root svg [ style*='animation' ]{animation:none !important}}`,et=Object.freeze({classic:{sp1:12,sp2:24,sp3:40,a1:28,a2:15,a3:8,gap:4,dir2:1,dir3:-1,pulse:"none",dots:0},comet:{sp1:8,sp2:14,sp3:26,a1:50,a2:28,a3:12,gap:3,dir2:1,dir3:1,pulse:"none",dots:5},orbit:{sp1:10,sp2:10,sp3:32,a1:50,a2:50,a3:8,gap:5,dir2:-1,dir3:-1,pulse:"opacity",dots:3},pulse:{sp1:6,sp2:18,sp3:30,a1:20,a2:12,a3:6,gap:4,dir2:1,dir3:-1,pulse:"both",dots:8},inline:{sp1:8,sp2:8,sp3:8,a1:25,a2:25,a3:25,gap:0,dir2:1,dir3:1,pulse:"none",dots:0}}),P=61.26,M=61.26,tt=58.453,uo='<path d="m8.708 61.26c0 20.802 12.089 38.779 29.619 47.298l-25.069-68.686c-2.916 6.536-4.55 13.769-4.55 21.388z"/><path d="m96.74 58.608c0-6.495-2.333-10.993-4.334-14.494-2.664-4.329-5.161-7.995-5.161-12.324 0-4.831 3.664-9.328 8.825-9.328.233 0 .454.029.681.042-9.35-8.566-21.807-13.796-35.489-13.796-18.36 0-34.513 9.42-43.91 23.688 1.233.037 2.395.063 3.382.063 5.497 0 14.006-.667 14.006-.667 2.833-.167 3.167 3.994.337 4.329 0 0-2.847.335-6.015.501l19.138 56.925 11.501-34.493-8.188-22.434c-2.83-.166-5.511-.501-5.511-.501-2.832-.166-2.5-4.496.332-4.329 0 0 8.679.667 13.843.667 5.496 0 14.006-.667 14.006-.667 2.835-.167 3.168 3.994.337 4.329 0 0-2.853.335-6.015.501l18.992 56.494 5.242-17.517c2.272-7.269 4.001-12.49 4.001-16.989z"/><path d="m62.184 65.857-15.768 45.819c4.708 1.384 9.687 2.141 14.846 2.141 6.12 0 11.989-1.058 17.452-2.979-.141-.225-.269-.464-.374-.724z"/><path d="m107.376 36.046c.226 1.674.354 3.471.354 5.404 0 5.333-.996 11.328-3.996 18.824l-16.053 46.413c15.624-9.111 26.133-26.038 26.133-45.426.001-9.137-2.333-17.729-6.438-25.215z"/>',ie=class ie extends q{constructor(){super(...arguments),this._paintScheduled=!1}connectedCallback(){super.connectedCallback(),this._schedulePaint()}render(){return y`<div class="root" part="root"></div>`}requestUpdate(){super.requestUpdate(),this._schedulePaint()}_schedulePaint(){this._paintScheduled||!this.isConnected||(this._paintScheduled=!0,queueMicrotask(()=>{this._paintScheduled=!1,this.isConnected&&this._paint()}))}_paint(){this._syncCssVars();const e=this.shadowRoot?.querySelector(".root");e&&(e.innerHTML=this._buildSvg())}_syncCssVars(){const e=(t,n,s)=>{const r=this.getAttribute(t);r===null?this.style.removeProperty(n):this.style.setProperty(n,s?s(r):r)};e("color","--os-ui-spinner-color"),e("accent","--os-ui-spinner-accent"),e("size","--os-ui-spinner-size",t=>/^-?\d+(\.\d+)?$/.test(t.trim())?`${t}px`:t)}_effectiveConfig(){const e=this.getAttribute("preset")??"classic",t=et[e]??et.classic,n=(i,l)=>{const c=this.getAttribute(i);if(c===null)return l;const a=parseFloat(c);return Number.isFinite(a)?a:l},s=(i,l)=>{const c=this.getAttribute(i);if(c===null)return l;const a=c.toLowerCase();return a==="-1"||a==="ccw"||a==="reverse"?-1:1},r=()=>{const i=this.getAttribute("pulse");return i==="scale"||i==="opacity"||i==="both"||i==="none"?i:t.pulse};return{sp1:n("sp1",t.sp1),sp2:n("sp2",t.sp2),sp3:n("sp3",t.sp3),a1:n("a1",t.a1),a2:n("a2",t.a2),a3:n("a3",t.a3),gap:n("gap",t.gap),dir2:s("dir2",t.dir2),dir3:s("dir3",t.dir3),pulse:r(),dots:Math.max(0,Math.floor(n("dots",t.dots)))}}_buildInlineSvg(e){const t=ot(this.getAttribute("label")??"Loading"),n=9,s=(e.sp1/10).toFixed(2);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-label="${t}"><circle cx="12" cy="12" r="${n}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-opacity="0.22"/><circle cx="12" cy="12" r="${n}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-dasharray="${be(n,e.a1)}" style="transform-origin:12px 12px;animation: os-spinner-spin ${s}s linear infinite"/></svg>`}_buildSvg(){const e=this._effectiveConfig();if(this.getAttribute("preset")==="inline")return this._buildInlineSvg(e);const t=ot(this.getAttribute("label")??"Loading"),n=e.gap*3+14,s=-n,r=122.52+n*2,i=tt+e.gap+2,l=i+e.gap+2,c=l+e.gap+1.5,a=`animation: os-spinner-spin ${(e.sp1/10).toFixed(2)}s linear infinite`,u=`animation: os-spinner-spin ${(e.sp2/10).toFixed(2)}s linear infinite${e.dir2<0?" reverse":""}`,p=`animation: os-spinner-spin ${(e.sp3/10).toFixed(2)}s linear infinite${e.dir3<0?" reverse":""}`,f=(e.sp1*1.8/10).toFixed(1),x=(e.sp1*2.3/10).toFixed(1);let b="";e.pulse==="scale"?b=`animation: os-spinner-scale ${f}s ease-in-out infinite`:e.pulse==="opacity"?b=`animation: os-spinner-opacity ${x}s ease-in-out infinite`:e.pulse==="both"&&(b=`animation: os-spinner-scale ${f}s ease-in-out infinite, os-spinner-opacity ${x}s ease-in-out infinite`);let S="";if(e.dots>0){const w=c+e.gap+1,N=2*Math.PI*w,T=1.6,F=(e.sp1*.65/10).toFixed(2);for(let H=0;H<e.dots;H++){const le=-(H/e.dots)*N;S+=`<circle cx="${P}" cy="${M}" r="${w.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="${T}" stroke-dasharray="${T.toFixed(2)} ${(N-T).toFixed(2)}" stroke-dashoffset="${le.toFixed(2)}" stroke-linecap="round" stroke-opacity="0.65" style="transform-origin:${P}px ${M}px;animation: os-spinner-spin ${F}s linear infinite"/>`}}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${s} ${s} ${r} ${r}" role="img" aria-label="${t}"><g style="transform-origin:${P}px ${M}px${b?";"+b:""}"><circle cx="${P}" cy="${M}" r="${tt}" fill="currentColor"/><g class="mark">${uo}</g></g><circle cx="${P}" cy="${M}" r="${i.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.6" stroke-opacity="0.2"/><circle cx="${P}" cy="${M}" r="${i.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="2.2" stroke-dasharray="${be(i,e.a1)}" stroke-linecap="round" style="transform-origin:${P}px ${M}px;${a}"/><circle cx="${P}" cy="${M}" r="${l.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.5" stroke-opacity="0.15"/><circle cx="${P}" cy="${M}" r="${l.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.6" stroke-opacity="0.8" stroke-dasharray="${be(l,e.a2)}" stroke-linecap="round" style="transform-origin:${P}px ${M}px;${u}"/><circle cx="${P}" cy="${M}" r="${c.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.4" stroke-opacity="0.12"/><circle cx="${P}" cy="${M}" r="${c.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.0" stroke-opacity="0.6" stroke-dasharray="${be(c,e.a3)}" stroke-linecap="round" style="transform-origin:${P}px ${M}px;${p}"/>`+S+"</svg>"}};ie.props=["preset","size","color","accent","sp1","sp2","sp3","a1","a2","a3","gap","dir2","dir3","pulse","dots","label"],ie.styles=[lo],ie.help=void 0;let Ee=ie;function be(o,e){const t=2*Math.PI*o,n=e/100*t,s=t-n;return`${n.toFixed(2)} ${s.toFixed(2)}`}function ot(o){return String(o).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}K("os-spinner",Ee);const ho=E` ${me} ${Ve}:host{--_field-size:var( --os-ui-field-font-size,13px );--_field-radius:var( --os-ui-field-radius,6px );display:flex;flex-direction:column;gap:4px;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-textarea__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}textarea{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:8px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:var( --_field-radius );font:inherit;font-size:var( --_field-size );line-height:1.45;color:var( --os-ui-fg,#1d2327 );resize:vertical}textarea:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}textarea[ aria-invalid='true' ],textarea[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}textarea[ aria-invalid='true' ]:focus,textarea[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}:host( [ auto-grow ] ) textarea{resize:none;overflow:hidden}`,ae=class ae extends q{constructor(){super(...arguments),this._textareaEl=null}connectedCallback(){super.connectedCallback(),Gt(this)}render(){const e=this._attr("label")||"",t=this._attr("value")??"",n=this._attr("placeholder")||"",s=this._boolAttr("disabled"),r=this._boolAttr("readonly"),i=this._attr("aria-label")||e,l=this._attr("name")||"",c=Number(this._attr("rows"))||3,a=this._attr("maxlength"),u=this._attr("minlength"),p=this._boolAttr("invalid"),x=`${this.id||"os-unnamed"}__field`;return y`
66 + ${e?y`<label class="os-textarea__label" for=${x}>${e}</label>`:y``}
66 67 <textarea
67 - id=${$}
68 + id=${x}
68 69 part="textarea"
69 70 .value=${t}
70 71 placeholder=${n}
71 72 ?disabled=${s}
72 73 ?readonly=${r}
73 - rows=${a}
74 - maxlength=${l??""}
74 + rows=${c}
75 + maxlength=${a??""}
75 76 minlength=${u??""}
76 - name=${d}
77 - aria-invalid=${g?"true":"false"}
77 + name=${l}
78 + aria-invalid=${p?"true":"false"}
78 79 aria-label=${i||""}
79 - @input=${v=>this._onInput(v)}
80 - @change=${v=>this._onChange(v)}
81 - @keydown=${v=>this._onKeyDown(v)}
80 + @input=${b=>this._onInput(b)}
81 + @change=${b=>this._onChange(b)}
82 + @keydown=${b=>this._onKeyDown(b)}
82 83 ></textarea>
83 - `}_attr(e){return this.getAttribute(e)}_boolAttr(e){return this.getAttribute(e)!==null}_onInput(e){const t=e.target;this._textareaEl=t,this.setAttribute("value",t.value),this.emit("os-input-change",{value:t.value}),this._boolAttr("auto-grow")&&this._autosize(t)}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(this._boolAttr("submit-on-enter")&&e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){e.preventDefault();const t=e.target;this.emit("os-submit",{value:t.value})}}_autosize(e){const t=Number(this._attr("max-rows"))||8,n=window.getComputedStyle(e),s=parseFloat(n.fontSize)||13,r=n.lineHeight,i=r==="normal"?s*1.45:parseFloat(r)||s*1.45,d=parseFloat(n.paddingTop)||0,a=parseFloat(n.paddingBottom)||0,l=i*t+d+a;e.style.height="auto";const u=Math.min(e.scrollHeight,l);e.style.height=`${u}px`}refreshAutosize(){this._textareaEl&&this._boolAttr("auto-grow")&&this._autosize(this._textareaEl)}focusInput(){(this.shadowRoot??this).querySelector("textarea")?.focus()}clear(){this.setAttribute("value","");const t=(this.shadowRoot??this).querySelector("textarea");t&&(t.value="",this._boolAttr("auto-grow")&&this._autosize(t))}};oe.props=["label","value","placeholder","disabled","readonly","ariaLabel","name","rows","maxlength","minlength","invalid","autoGrow","maxRows","submitOnEnter"],oe.styles=[qt],oe.help=void 0;let _e=oe;U("os-textarea",_e);const ye=new Map;async function Ht(o){if(!o)return null;let e;try{e=new URL(o,window.location.href)}catch{return o}if(!/gravatar\.com$/i.test(e.hostname))return o;e.searchParams.delete("d"),e.searchParams.delete("s");const t=e.toString(),n=ye.get(t);if(n!==void 0)return n instanceof Promise,n;const s=new URL(o,window.location.href);s.searchParams.set("d","blank");const r=new Promise(i=>{const d=new Image;d.crossOrigin="anonymous",d.onload=()=>{try{const a=document.createElement("canvas");a.width=1,a.height=1;const l=a.getContext("2d",{willReadFrequently:!0});if(!l){i(o);return}l.drawImage(d,0,0,1,1);const u=l.getImageData(0,0,1,1).data;i(u[3]===0?null:o)}catch{i(o)}},d.onerror=()=>i(null),d.src=s.toString()}).then(i=>(ye.set(t,i),i));return ye.set(t,r),r}function Xt(o,e){e&&Ht(e).then(t=>{o.isConnected&&(t?o.setAttribute("src",t):o.removeAttribute("src"))})}const Xe="__openStationSharedStores";function Bt(){const o=window;let e=o[Xe];return e||(e=new Map,o[Xe]=e),e}function Be(o,e){const t=Bt();let n=t.get(o);n||(n={state:e(),listeners:new Set,rebuild:e},t.set(o,n));const s={get state(){return n.state},set state(r){n.state=r},getState(){return n.state},notify(){for(const r of Array.from(n.listeners))try{r(n.state)}catch(i){console.error(`[desktop-mode/shared-store:${o}] subscriber threw:`,i)}},subscribe(r){return n.listeners.add(r),()=>{n.listeners.delete(r)}},setState(r){const i=n.state;if(typeof i!="object"||i===null){console.warn(`[desktop-mode/shared-store:${o}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(i,r),s.notify()},reset(){const r=n.rebuild(),i=n.state;if(typeof i=="object"&&i!==null&&typeof r=="object"&&r!==null){const d=i;for(const a of Object.keys(d))delete d[a];Object.assign(d,r)}else n.state=r;n.listeners.clear()}};return s}const b=Be("desktop-mode/agents-chat",()=>({activeAgent:null,transcripts:{},conversationIds:{},conversationsRev:0}));function Ke(o){b.state.activeAgent=o,b.state.transcripts[o.id]||(b.state.transcripts[o.id]=[]),b.state.conversationIds||(b.state.conversationIds={},b.state.conversationsRev=0),b.notify()}const Kt="my-wordpress",xe=Be("desktop-mode/agents/editor-target",()=>({agentId:null,requestedAt:0}));function Ot(o){if(!Number.isFinite(o)||o<=0)return;xe.state.agentId=o,xe.state.requestedAt=Date.now(),xe.notify();const e=window.wp?.os?.openWindow;typeof e=="function"&&e(Kt,{source:"agents/editor"})}function Oe(){return window.wp?.os}function de(){const o=Oe()?.config?.adminUrl??"/wp-admin/";return o.endsWith("/")?o:`${o}/`}function Ye(o){switch(o){case"page":return"dashicons-admin-page";case"media":return"dashicons-admin-media";case"user":return"dashicons-admin-users";case"comment":return"dashicons-admin-comments";default:return"dashicons-admin-post"}}function Ge(o){switch(o){case"page":return f("Page","desktop-mode");case"media":return f("Media","desktop-mode");case"user":return f("User","desktop-mode");case"comment":return f("Comment","desktop-mode");default:return f("Post","desktop-mode")}}function Yt(o){const e=encodeURIComponent(String(o.id));switch(o.kind){case"user":return`${de()}user-edit.php?user_id=${e}`;case"comment":return`${de()}comment.php?action=editcomment&c=${e}`;default:return`${de()}post.php?post=${e}&action=edit`}}function Gt(o){const e=Oe();if(!e?.windowManager?.open||!e.deriveWindowId)return!1;const t=Yt(o),n=e.deriveWindowId(t,de());return e.windowManager.open({id:n,baseId:n,url:t,title:o.title,icon:Ye(o.kind)}),!0}const Ve="X-WP-Nonce";function Vt(o,e){const t=Jt();if(!t)return e;const n=Zt(o);if(!n||!Qt(n))return e;const s=e?.headers??(typeof Request<"u"&&o instanceof Request?o.headers:void 0),r=new Headers(s??{});return r.has(Ve)?e:(r.set(Ve,t),{...e??{},headers:r})}function Jt(){if(typeof window>"u")return;const e=window.openStationConfig?.restNonce;return typeof e=="string"&&e.length>0?e:void 0}function Zt(o){try{const e=typeof window<"u"&&window.location?window.location.href:void 0;return typeof o=="string"?new URL(o,e):o instanceof URL?o:typeof Request<"u"&&o instanceof Request?new URL(o.url,e):null}catch{return null}}function Qt(o){return typeof window>"u"||!window.location||o.origin!==window.location.origin?!1:!!(o.pathname.includes("/wp-json/")||o.searchParams.has("rest_route"))}function Je(o,e,t={}){const n=window.wp?.os?.fetch;if(typeof n=="function")return n(o,e,t);const s=Vt(o,e);return fetch(o,s)}const eo="http://localhost/";function Ze(o,e){const t=typeof window<"u"&&window.location?window.location.href:eo,n=new URL(o,t),s=e.replace(/^\/+/,""),r=s.indexOf("?"),i=r===-1?s:s.slice(0,r),d=r===-1?"":s.slice(r+1);if(n.searchParams.has("rest_route")){const a=n.searchParams.get("rest_route")??"/",l=a.endsWith("/")?a:a+"/";n.searchParams.set("rest_route",l+i)}else{const a=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";n.pathname=a+i}return d&&new URLSearchParams(d).forEach((l,u)=>{n.searchParams.append(u,l)}),n.toString()}function to(){const o=crypto.getRandomValues(new Uint8Array(16));o[6]=o[6]%16+64,o[8]=o[8]%64+128;const e=Array.from(o,t=>t.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}class X extends Error{constructor(e,t){super(e),this.retryable=t}}async function oo(o,e,t){const n=new AbortController,s=window.setTimeout(()=>n.abort(),15e3);try{const r=await Je(Ze(o.restRoot,e),{method:t?"POST":"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":o.restNonce},body:t?JSON.stringify(t):void 0,signal:n.signal,cache:"no-store"},{source:"desktop-mode/agents",silent:!t}),i=await r.json().catch(()=>null);if(!r.ok)throw new X(i?.message||`HTTP ${r.status}`,r.status>=500&&!i?.code||r.status===408);if(!i||!i.jobId&&typeof i.text!="string")throw new X(f("The job status could not be read.","desktop-mode"),!0);return i}finally{window.clearTimeout(s)}}function no(o){return new Promise(e=>window.setTimeout(e,o))}async function so(o,e,t,n,s=()=>{}){const r=`desktop-mode/v1/agents/${o}`,i=Date.now()+2*60*60*1e3;let d=!1,a=2e3;for(;Date.now()<i;){try{const l=await oo(t,d?`${r}/jobs/${n}`:`${r}/invoke`,d?void 0:{...e,async:!0,requestId:n});if(!("jobId"in l))return l;if(l.jobId!==n)throw new X(f("The server returned a different job.","desktop-mode"),!1);if(d=!0,l.status==="completed"&&l.result)return l.result;if(l.status==="failed")throw new X(l.error?.message||f("The agent job failed.","desktop-mode"),!1);if(l.status!=="queued"&&l.status!=="running")throw new X(f("The server returned an invalid job state.","desktop-mode"),!1);s(l.status),a=Math.min(1e4,Math.max(a*1.25,(l.pollAfter||3)*1e3))}catch(l){if(l instanceof X&&!l.retryable)throw l;s("reconnecting"),a=Math.min(a*2,3e4)}await no(document.hidden?Math.max(a,15e3):a)}throw new Error(f("The background job has not returned a result. Some work may already have been applied. Check the site before submitting again.","desktop-mode"))}const Y="desktop-mode/v1/agents/conversations";async function G(o,e,t={}){const n=await Je(Ze(o.restRoot,e),{...t,headers:{"Content-Type":"application/json","X-WP-Nonce":o.restNonce,...t.headers??{}}},{source:"desktop-mode/agents",silent:!0}),s=await n.json().catch(()=>null);if(!n.ok){const r=s&&typeof s=="object"&&typeof s.message=="string"?s.message:`HTTP ${n.status}`;throw new Error(r)}return s}async function ro(o){const e=await G(o,Y);return Array.isArray(e)?e:[]}function io(o,e){return G(o,`${Y}/${e}`)}function ao(o,e){return G(o,`${Y}/${e}`,{method:"DELETE"})}function co(o){return o.filter(e=>!e.pending)}async function lo(o,e){const t=b.state,n=co(t.transcripts[o.id]??[]);if(n.length!==0){t.conversationIds||(t.conversationIds={});try{const s=t.conversationIds[o.id];if(s)await G(e,`${Y}/${s}`,{method:"PUT",body:JSON.stringify({messages:n})});else{const r=await G(e,Y,{method:"POST",body:JSON.stringify({agentId:o.id,messages:n})});t.conversationIds[o.id]=r.id}t.conversationsRev=(t.conversationsRev??0)+1,b.notify()}catch(s){console.warn("[desktop-mode/agents] conversation save failed:",s)}}}async function uo(o,e){const t=await io(o,e),n=b.state;n.activeAgent={id:t.agentId,name:t.agentName,description:t.agentDescription,avatarUrl:t.agentAvatarUrl},n.transcripts[t.agentId]=Array.isArray(t.messages)?t.messages:[],n.conversationIds||(n.conversationIds={}),n.conversationIds[t.agentId]=t.id,b.notify()}const Qe={post:"post",page:"page",attachment:"media",media:"media",user:"user",comment:"comment"};function et(o){const e=Number.parseInt(String(o??""),10);return Number.isFinite(e)&&e>0?e:0}function tt(o){if(o.type==="shortcut"){const e=o.data;let t=Qe[String(e.kind??"")];t==="post"&&e.bridgePayload?.postType==="page"&&(t="page");const n=et(e.ref);return!t||!n?null:{kind:t,id:n,title:String(e.title??"")||`#${n}`}}if(o.type==="desktop-file"){const t=o.data.placement?.file;if(!t)return null;const n=Qe[String(t.type??"")],s=et(t.ref);return!n||!s?null:{kind:n,id:s,title:String(t.title??"")||`#${s}`}}return null}function ho(o){return Ae(f('The user dropped the %1$s "%2$s" (id %3$s) onto you. Handle it according to your instructions, using your tools as needed.',"desktop-mode"),o.kind,o.title,String(o.id))}function po(o){return{kind:o.kind,id:o.id,title:o.title}}function fo(o,e="agents"){Ke(o);const t=window.wp?.os?.openWindow;typeof t=="function"&&t("desktop-mode-agent-run",{source:e})}async function ot(o,e,t,n,s){Ke(o);const r=b.state.transcripts[o.id],i=r.filter(a=>!a.pending&&a.role!=="error").map(a=>({role:a.role,text:a.text}));r.push({role:"user",text:e,at:Date.now(),attachment:s});const d={role:"agent",text:f("Working…","desktop-mode"),at:Date.now(),pending:!0};r.push(d),b.notify();try{const a=await so(o.id,{message:e,source:n,history:i},t,to(),l=>{const u={queued:f("Queued — waiting for a WordPress worker…","desktop-mode"),reconnecting:f("Reconnecting to the background job…","desktop-mode"),running:f("Working in the background…","desktop-mode")};d.text=u[l],b.notify()});d.text=a.text||f("The agent finished without a text answer.","desktop-mode"),d.toolCalls=a.toolCalls,Array.isArray(a.callToActions)&&a.callToActions.length>0&&(d.callToActions=a.callToActions)}catch(a){d.role="error",d.text=a instanceof Error?a.message:String(a)}d.pending=!1,b.notify(),lo(o,t)}function mo(o,e,t){return fo(o,"agents-drop"),ot(o,ho(e),t,"drag",po(e))}const go=C` ${ae}:host{display:none;position:fixed;inset:0;align-items:center;justify-content:center;background:var( --os-ui-scrim,rgba( 0,0,0,0.45 ) );background-image:var( --os-ui-scrim-image,none );background-repeat:var( --os-ui-scrim-image-repeat,repeat );background-size:var( --os-ui-scrim-image-size,auto );background-position:var( --os-ui-scrim-image-position,center );backdrop-filter:blur( 2px );z-index:10000}:host( [ open ] ){display:flex;animation:os-confirm-scrim var( --_holo-t ) var( --_holo-ease )}:host( [ open ] ) .dialog{animation:os-confirm-dialog var( --_holo-t ) var( --_holo-spring )}@keyframes os-confirm-scrim{from{opacity:0}}@keyframes os-confirm-dialog{from{opacity:0;transform:scale( 0.96 ) translateY( 8px )}}@media ( prefers-reduced-motion:reduce ){:host( [ open ] ),:host( [ open ] ) .dialog{animation:none}}.dialog{width:min( 420px,92vw );background-color:var( --os-ui-confirm-dialog-bg,#1d2327 );background-image:var( --os-ui-dialog-bg-image,none );background-repeat:var( --os-ui-dialog-bg-image-repeat,repeat );background-size:var( --os-ui-dialog-bg-image-size,auto );background-position:var( --os-ui-dialog-bg-image-position,center );color:var( --os-ui-confirm-dialog-fg,var( --os-fg,#fff ) );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.08 ) );border-radius:10px;box-shadow:0 20px 50px rgba( 0,0,0,0.6 );padding:20px 22px 18px;display:flex;flex-direction:column;gap:10px;position:relative}.close{position:absolute;top:8px;right:10px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;background:transparent;border:0;border-radius:6px;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );cursor:pointer;font-size:22px;line-height:1;padding:0}.close:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) );color:inherit}.btn:focus,.close:focus{outline:none;box-shadow:var( --_holo-focus )}.dialog:focus,.dialog:focus-visible{outline:none}.title{margin:0 0 4px;font-size:16px;font-weight:600}.message{margin:0;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );line-height:1.45;white-space:pre-line}.remember{display:flex;align-items:center;gap:8px;margin-top:4px;font-size:12px;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );cursor:pointer;user-select:none}.remember__box{margin:0;accent-color:var( --os-ui-accent,#2271b1 );cursor:pointer}.remember__box:focus,.remember__box:focus-visible{outline:none;box-shadow:var( --_holo-focus )}.actions{display:flex;justify-content:flex-end;gap:8px;margin-top:6px}.btn{border:0;border-radius:6px;padding:8px 14px;font-size:13px;cursor:pointer;font-weight:500}.btn--secondary{background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) );color:inherit}.btn--secondary:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.14 ) )}.btn--primary{background:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.btn--primary:hover{filter:brightness( 1.08 )}.btn--danger{background:var( --os-ui-danger,#d63638 );color:var( --os-ui-fg-on-accent,#fff )}.btn--danger:hover{filter:brightness( 1.08 )}`,nt='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function bo(o){let e=o?.activeElement??null;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e&&e!==o?.body?e:null}function st(o){const e=o.composedPath(),t=e.length>0?e[0]:o.target;return t instanceof HTMLElement?t:null}function rt(o){return o!==null&&o.matches(nt)}const ne=class ne extends M{constructor(){super(...arguments),this._prevFocus=null,this._focusTries=0,this._onKey=e=>{if(e.key==="Escape"){e.preventDefault(),this._cancel();return}if(e.key==="Tab"){this._trapTab(e);return}if(e.key==="Enter"&&!e.isComposing){if(rt(st(e))||this.hasAttribute("danger"))return;e.preventDefault(),this._confirm()}},this._focusInitial=()=>{if(!this.hasAttribute("open"))return;const e=this.isConnected?this._initialFocusTarget():null;if(e){e.focus();return}if(this._focusTries++<5){queueMicrotask(this._focusInitial);return}this.isConnected&&this.focus()},this._onBackdrop=e=>{const t=e.composedPath();(t.length>0?t[0]:e.target)===this&&this._cancel()},this._confirm=()=>{this.emit("os-confirm",{confirmed:!0,remember:this._remembered()}),this.removeAttribute("open")},this._cancel=()=>{this.emit("os-cancel",{confirmed:!1}),this.removeAttribute("open")}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","dialog"),this.setAttribute("aria-modal","true"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),this.addEventListener("keydown",this._onKey),this.addEventListener("click",this._onBackdrop)}disconnectedCallback(){this.removeEventListener("keydown",this._onKey),this.removeEventListener("click",this._onBackdrop),this._restoreFocus()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e==="open"&&(n!==null?(this._prevFocus=bo(this.ownerDocument),this._focusTries=0,queueMicrotask(this._focusInitial)):this._restoreFocus())}_focusables(){const e=this.shadowRoot;return e?Array.from(e.querySelectorAll(nt)):[]}_trapTab(e){const t=this._focusables();if(t.length===0)return;const n=t[0],s=t[t.length-1],r=st(e),i=!rt(r);e.shiftKey&&(i||r===n)?(e.preventDefault(),s.focus()):!e.shiftKey&&(i||r===s)&&(e.preventDefault(),n.focus())}_initialFocusTarget(){const e=this.shadowRoot;if(!e)return null;const t=e.querySelector(".btn--secondary"),n=e.querySelector(".dialog");return this.hasAttribute("danger")?t??e.querySelector(".close")??n:e.querySelector(".btn--primary, .btn--danger")??t??n}_restoreFocus(){const e=this._prevFocus;this._prevFocus=null,!(!e||!e.isConnected)&&e.focus()}_remembered(){return this.shadowRoot?.querySelector(".remember__box")?.checked===!0}render(){const e=this.title??"",t=this.message??"",n=this["confirm-label"]||"Confirm",s=this["cancel-label"]||"Cancel",r=this.hasAttribute("danger"),i=this.hasAttribute("hide-cancel"),d=this.hasAttribute("dismissable"),a=this["remember-label"]??"";return k`
84 + `}_attr(e){return this.getAttribute(e)}_boolAttr(e){return this.getAttribute(e)!==null}_onInput(e){const t=e.target;this._textareaEl=t,this.setAttribute("value",t.value),this.emit("os-input-change",{value:t.value}),this._boolAttr("auto-grow")&&this._autosize(t)}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(!(!this._boolAttr("submit-on-enter")||e.isComposing||e.keyCode===229)&&e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){e.preventDefault();const t=e.target;this.emit("os-submit",{value:t.value})}}_autosize(e){const t=Number(this._attr("max-rows"))||8,n=window.getComputedStyle(e),s=parseFloat(n.fontSize)||13,r=n.lineHeight,i=r==="normal"?s*1.45:parseFloat(r)||s*1.45,l=parseFloat(n.paddingTop)||0,c=parseFloat(n.paddingBottom)||0,a=(parseFloat(n.borderTopWidth)||0)+(parseFloat(n.borderBottomWidth)||0),u=i*t+l+c+a;e.style.height="auto",e.style.overflowY="hidden";const p=e.value?e.scrollHeight+a:i*(Number(this._attr("rows"))||3)+l+c+a,f=Math.min(p,u);e.style.height=`${Math.ceil(f)}px`,e.style.overflowY=p>Math.ceil(u)?"auto":"hidden"}refreshAutosize(){this._textareaEl&&this._boolAttr("auto-grow")&&this._autosize(this._textareaEl)}focusInput(){(this.shadowRoot??this).querySelector("textarea")?.focus()}clear(){this.setAttribute("value","");const t=(this.shadowRoot??this).querySelector("textarea");t&&(t.value="",this._boolAttr("auto-grow")&&this._autosize(t))}};ae.props=["label","value","placeholder","disabled","readonly","ariaLabel","name","rows","maxlength","minlength","invalid","autoGrow","maxRows","submitOnEnter"],ae.styles=[ho],ae.help=void 0;let Se=ae;K("os-textarea",Se);const Ne=new Map;async function po(o){if(!o)return null;let e;try{e=new URL(o,window.location.href)}catch{return o}if(!/gravatar\.com$/i.test(e.hostname))return o;e.searchParams.delete("d"),e.searchParams.delete("s");const t=e.toString(),n=Ne.get(t);if(n!==void 0)return n instanceof Promise,n;const s=new URL(o,window.location.href);s.searchParams.set("d","blank");const r=new Promise(i=>{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>{try{const c=document.createElement("canvas");c.width=1,c.height=1;const a=c.getContext("2d",{willReadFrequently:!0});if(!a){i(o);return}a.drawImage(l,0,0,1,1);const u=a.getImageData(0,0,1,1).data;i(u[3]===0?null:o)}catch{i(o)}},l.onerror=()=>i(null),l.src=s.toString()}).then(i=>(Ne.set(t,i),i));return Ne.set(t,r),r}function fo(o,e){e&&po(e).then(t=>{o.isConnected&&(t?o.setAttribute("src",t):o.removeAttribute("src"))})}const nt="__openStationSharedStores";function mo(){const o=window;let e=o[nt];return e||(e=new Map,o[nt]=e),e}function st(o,e){const t=mo();let n=t.get(o);n||(n={state:e(),listeners:new Set,rebuild:e},t.set(o,n));const s={get state(){return n.state},set state(r){n.state=r},getState(){return n.state},notify(){for(const r of Array.from(n.listeners))try{r(n.state)}catch(i){console.error(`[desktop-mode/shared-store:${o}] subscriber threw:`,i)}},subscribe(r){return n.listeners.add(r),()=>{n.listeners.delete(r)}},setState(r){const i=n.state;if(typeof i!="object"||i===null){console.warn(`[desktop-mode/shared-store:${o}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(i,r),s.notify()},reset(){const r=n.rebuild(),i=n.state;if(typeof i=="object"&&i!==null&&typeof r=="object"&&r!==null){const l=i;for(const c of Object.keys(l))delete l[c];Object.assign(l,r)}else n.state=r;n.listeners.clear()}};return s}const g=st("desktop-mode/agents-chat",()=>({activeAgent:null,transcripts:{},conversationIds:{},conversationsRev:0}));function rt(o){g.state.activeAgent=o,g.state.transcripts[o.id]||(g.state.transcripts[o.id]=[]),g.state.conversationIds||(g.state.conversationIds={},g.state.conversationsRev=0),g.notify()}const go="my-wordpress",Te=st("desktop-mode/agents/editor-target",()=>({agentId:null,requestedAt:0}));function bo(o){if(!Number.isFinite(o)||o<=0)return;Te.state.agentId=o,Te.state.requestedAt=Date.now(),Te.notify();const e=window.wp?.os?.openWindow;typeof e=="function"&&e(go,{source:"agents/editor"})}function it(){return window.wp?.os}function ve(){const o=it()?.config?.adminUrl??"/wp-admin/";return o.endsWith("/")?o:`${o}/`}function at(o){switch(o){case"page":return"dashicons-admin-page";case"media":return"dashicons-admin-media";case"user":return"dashicons-admin-users";case"comment":return"dashicons-admin-comments";default:return"dashicons-admin-post"}}function ct(o){switch(o){case"page":return h("Page","desktop-mode");case"media":return h("Media","desktop-mode");case"user":return h("User","desktop-mode");case"comment":return h("Comment","desktop-mode");default:return h("Post","desktop-mode")}}function vo(o){const e=encodeURIComponent(String(o.id));switch(o.kind){case"user":return`${ve()}user-edit.php?user_id=${e}`;case"comment":return`${ve()}comment.php?action=editcomment&c=${e}`;default:return`${ve()}post.php?post=${e}&action=edit`}}function _o(o){const e=it();if(!e?.windowManager?.open||!e.deriveWindowId)return!1;const t=vo(o),n=e.deriveWindowId(t,ve());return e.windowManager.open({id:n,baseId:n,url:t,title:o.title,icon:at(o.kind)}),!0}const yo="http://localhost/";function lt(o,e){const t=typeof window<"u"&&window.location?window.location.href:yo,n=new URL(o,t),s=e.replace(/^\/+/,""),r=s.indexOf("?"),i=r===-1?s:s.slice(0,r),l=r===-1?"":s.slice(r+1);if(n.searchParams.has("rest_route")){const c=n.searchParams.get("rest_route")??"/",a=c.endsWith("/")?c:c+"/";n.searchParams.set("rest_route",a+i)}else{const c=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";n.pathname=c+i}return l&&new URLSearchParams(l).forEach((a,u)=>{n.searchParams.append(u,a)}),n.toString()}function xo(){const o=crypto.getRandomValues(new Uint8Array(16));o[6]=o[6]%16+64,o[8]=o[8]%64+128;const e=Array.from(o,t=>t.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}class Y extends he{constructor(e,t,n=new he("",{status:0})){super(e,{status:n.status,code:n.code,data:n.data,serverMessage:n.serverMessage}),this.name="JobRequestError",this.retryable=t}}async function ko(o,e,t){const n=new AbortController,s=window.setTimeout(()=>n.abort(),15e3);try{const r=await Pe(lt(o.restRoot,e),{method:t?"POST":"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":o.restNonce},body:t?JSON.stringify(t):void 0,signal:n.signal,cache:"no-store"},{source:"desktop-mode/agents",silent:!t}),i=await r.json().catch(()=>null);if(!r.ok)throw new Y(i?.message||`HTTP ${r.status}`,r.status>=500&&!i?.code||r.status===408,ye(r.status,i));if(!i||!i.jobId&&typeof i.text!="string")throw new Y(h("The job status could not be read.","desktop-mode"),!0,ye(r.status,null));return i}finally{window.clearTimeout(s)}}function wo(o){return new Promise(e=>window.setTimeout(e,o))}async function $o(o,e,t,n,s=()=>{}){const r=`desktop-mode/v1/agents/${o}`,i=Date.now()+2*60*60*1e3;let l=!1,c=2e3;for(;Date.now()<i;){try{const a=await ko(t,l?`${r}/jobs/${n}`:`${r}/invoke`,l?void 0:{...e,async:!0,requestId:n});if(!("jobId"in a))return a;if(a.jobId!==n)throw new Y(h("The server returned a different job.","desktop-mode"),!1);if(l=!0,a.status==="completed"&&a.result)return a.result;if(a.status==="failed")throw new Y(a.error?.message||h("The agent job failed.","desktop-mode"),!1);if(a.status!=="queued"&&a.status!=="running")throw new Y(h("The server returned an invalid job state.","desktop-mode"),!1);s(a.status),c=Math.min(1e4,Math.max(c*1.25,(a.pollAfter||3)*1e3))}catch(a){if(a instanceof Y&&!a.retryable)throw a;s("reconnecting"),c=Math.min(c*2,3e4)}await wo(document.hidden?Math.max(c,15e3):c)}throw new Error(h("The background job has not returned a result. Some work may already have been applied. Check the site before submitting again.","desktop-mode"))}const Q="desktop-mode/v1/agents/conversations";async function ee(o,e,t={}){const n=await Pe(lt(o.restRoot,e),{...t,headers:{"Content-Type":"application/json","X-WP-Nonce":o.restNonce,...t.headers??{}}},{source:"desktop-mode/agents",silent:!0}),s=await n.json().catch(()=>null);if(!n.ok)throw ye(n.status,s);return s}async function Ao(o){const e=await ee(o,Q);return Array.isArray(e)?e:[]}function Co(o,e){return ee(o,`${Q}/${e}`)}function Eo(o,e){return ee(o,`${Q}/${e}`,{method:"DELETE"})}function So(o){return o.filter(e=>!e.pending)}async function No(o,e){const t=g.state,n=So(t.transcripts[o.id]??[]);if(n.length!==0){t.conversationIds||(t.conversationIds={});try{const s=t.conversationIds[o.id];if(s)await ee(e,`${Q}/${s}`,{method:"PUT",body:JSON.stringify({messages:n})});else{const r=await ee(e,Q,{method:"POST",body:JSON.stringify({agentId:o.id,messages:n})});t.conversationIds[o.id]=r.id}t.conversationsRev=(t.conversationsRev??0)+1,g.notify()}catch(s){console.warn("[desktop-mode/agents] conversation save failed:",s)}}}async function To(o,e){const t=await Co(o,e),n=g.state;n.activeAgent={id:t.agentId,name:t.agentName,description:t.agentDescription,avatarUrl:t.agentAvatarUrl},n.transcripts[t.agentId]=Array.isArray(t.messages)?t.messages:[],n.conversationIds||(n.conversationIds={}),n.conversationIds[t.agentId]=t.id,g.notify()}const dt={post:"post",page:"page",attachment:"media",media:"media",user:"user",comment:"comment"};function ut(o){const e=Number.parseInt(String(o??""),10);return Number.isFinite(e)&&e>0?e:0}function ht(o){if(o.type==="shortcut"){const e=o.data;let t=dt[String(e.kind??"")];t==="post"&&e.bridgePayload?.postType==="page"&&(t="page");const n=ut(e.ref);return!t||!n?null:{kind:t,id:n,title:String(e.title??"")||`#${n}`}}if(o.type==="desktop-file"){const t=o.data.placement?.file;if(!t)return null;const n=dt[String(t.type??"")],s=ut(t.ref);return!n||!s?null:{kind:n,id:s,title:String(t.title??"")||`#${s}`}}return null}function Ro(o){return ue(h('The user dropped the %1$s "%2$s" (id %3$s) onto you. Handle it according to your instructions, using your tools as needed.',"desktop-mode"),o.kind,o.title,String(o.id))}function Lo(o){return{kind:o.kind,id:o.id,title:o.title}}function Io(o,e="agents"){rt(o);const t=window.wp?.os?.openWindow;typeof t=="function"&&t("desktop-mode-agent-run",{source:e})}async function pt(o,e,t,n,s){rt(o);const r=g.state.transcripts[o.id],i=h("The agent finished without a text answer.","desktop-mode"),l=r.filter(a=>!a.pending&&a.role!=="error"&&!(a.role==="agent"&&a.text===i)).map(a=>({role:a.role,text:a.text}));r.push({role:"user",text:e,at:Date.now(),attachment:s});const c={role:"agent",text:h("Working…","desktop-mode"),at:Date.now(),pending:!0};r.push(c),g.notify();try{const a=await $o(o.id,{message:e,source:n,history:l},t,xo(),u=>{const p={queued:h("Queued — waiting for a WordPress worker…","desktop-mode"),reconnecting:h("Reconnecting to the background job…","desktop-mode"),running:h("Working in the background…","desktop-mode")};c.text=p[u],g.notify()});a.text?.trim()?c.text=a.text:(c.role="error",c.text=i),c.toolCalls=a.toolCalls,Array.isArray(a.callToActions)&&a.callToActions.length>0&&(c.callToActions=a.callToActions)}catch(a){c.role="error",c.text=a instanceof Error?a.message:String(a)}c.pending=!1,g.notify(),No(o,t)}function zo(o,e,t){return Io(o,"agents-drop"),pt(o,Ro(e),t,"drag",Lo(e))}const Po=E` ${me}:host{display:none;position:fixed;inset:0;align-items:center;justify-content:center;background:var( --os-ui-scrim,rgba( 0,0,0,0.45 ) );background-image:var( --os-ui-scrim-image,none );background-repeat:var( --os-ui-scrim-image-repeat,repeat );background-size:var( --os-ui-scrim-image-size,auto );background-position:var( --os-ui-scrim-image-position,center );backdrop-filter:blur( 2px );z-index:10000}:host( [ open ] ){display:flex;animation:os-confirm-scrim var( --_holo-t ) var( --_holo-ease )}:host( [ open ] ) .dialog{animation:os-confirm-dialog var( --_holo-t ) var( --_holo-spring )}@keyframes os-confirm-scrim{from{opacity:0}}@keyframes os-confirm-dialog{from{opacity:0;transform:scale( 0.96 ) translateY( 8px )}}@media ( prefers-reduced-motion:reduce ){:host( [ open ] ),:host( [ open ] ) .dialog{animation:none}}.dialog{width:min( 420px,92vw );background-color:var( --os-ui-confirm-dialog-bg,#1d2327 );background-image:var( --os-ui-dialog-bg-image,none );background-repeat:var( --os-ui-dialog-bg-image-repeat,repeat );background-size:var( --os-ui-dialog-bg-image-size,auto );background-position:var( --os-ui-dialog-bg-image-position,center );color:var( --os-ui-confirm-dialog-fg,var( --os-fg,#fff ) );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.08 ) );border-radius:10px;box-shadow:0 20px 50px rgba( 0,0,0,0.6 );padding:20px 22px 18px;display:flex;flex-direction:column;gap:10px;position:relative}.close{position:absolute;top:8px;right:10px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;background:transparent;border:0;border-radius:6px;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );cursor:pointer;font-size:22px;line-height:1;padding:0}.close:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) );color:inherit}.btn:focus,.close:focus{outline:none;box-shadow:var( --_holo-focus )}.dialog:focus,.dialog:focus-visible{outline:none}.title{margin:0 0 4px;font-size:16px;font-weight:600}.message{margin:0;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );line-height:1.45;white-space:pre-line}.remember{display:flex;align-items:center;gap:8px;margin-top:4px;font-size:12px;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );cursor:pointer;user-select:none}.remember__box{margin:0;accent-color:var( --os-ui-accent,#2271b1 );cursor:pointer}.remember__box:focus,.remember__box:focus-visible{outline:none;box-shadow:var( --_holo-focus )}.actions{display:flex;justify-content:flex-end;gap:8px;margin-top:6px}.btn{border:0;border-radius:6px;padding:8px 14px;font-size:13px;cursor:pointer;font-weight:500}.btn--secondary{background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) );color:inherit}.btn--secondary:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.14 ) )}.btn--primary{background:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) )}.btn--primary:hover{filter:brightness( 1.08 )}.btn--danger{background:var( --os-ui-danger,#d63638 );color:var( --os-ui-fg-on-accent,#fff )}.btn--danger:hover{filter:brightness( 1.08 )}`,ft='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Mo(o){let e=o?.activeElement??null;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e&&e!==o?.body?e:null}function mt(o){const e=o.composedPath(),t=e.length>0?e[0]:o.target;return t instanceof HTMLElement?t:null}function gt(o){return o!==null&&o.matches(ft)}const ce=class ce extends q{constructor(){super(...arguments),this._prevFocus=null,this._focusTries=0,this._onKey=e=>{if(e.key==="Escape"){e.preventDefault(),this._cancel();return}if(e.key==="Tab"){this._trapTab(e);return}if(e.key==="Enter"&&!e.isComposing){if(gt(mt(e))||this.hasAttribute("danger"))return;e.preventDefault(),this._confirm()}},this._focusInitial=()=>{if(!this.hasAttribute("open"))return;const e=this.isConnected?this._initialFocusTarget():null;if(e){e.focus();return}if(this._focusTries++<5){queueMicrotask(this._focusInitial);return}this.isConnected&&this.focus()},this._onBackdrop=e=>{const t=e.composedPath();(t.length>0?t[0]:e.target)===this&&this._cancel()},this._confirm=()=>{this.emit("os-confirm",{confirmed:!0,remember:this._remembered()}),this.removeAttribute("open")},this._cancel=()=>{this.emit("os-cancel",{confirmed:!1}),this.removeAttribute("open")}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","dialog"),this.setAttribute("aria-modal","true"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),this.addEventListener("keydown",this._onKey),this.addEventListener("click",this._onBackdrop)}disconnectedCallback(){this.removeEventListener("keydown",this._onKey),this.removeEventListener("click",this._onBackdrop),this._restoreFocus()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e==="open"&&(n!==null?(this._prevFocus=Mo(this.ownerDocument),this._focusTries=0,queueMicrotask(this._focusInitial)):this._restoreFocus())}_focusables(){const e=this.shadowRoot;return e?Array.from(e.querySelectorAll(ft)):[]}_trapTab(e){const t=this._focusables();if(t.length===0)return;const n=t[0],s=t[t.length-1],r=mt(e),i=!gt(r);e.shiftKey&&(i||r===n)?(e.preventDefault(),s.focus()):!e.shiftKey&&(i||r===s)&&(e.preventDefault(),n.focus())}_initialFocusTarget(){const e=this.shadowRoot;if(!e)return null;const t=e.querySelector(".btn--secondary"),n=e.querySelector(".dialog");return this.hasAttribute("danger")?t??e.querySelector(".close")??n:e.querySelector(".btn--primary, .btn--danger")??t??n}_restoreFocus(){const e=this._prevFocus;this._prevFocus=null,!(!e||!e.isConnected)&&e.focus()}_remembered(){return this.shadowRoot?.querySelector(".remember__box")?.checked===!0}render(){const e=this.title??"",t=this.message??"",n=this["confirm-label"]||"Confirm",s=this["cancel-label"]||"Cancel",r=this.hasAttribute("danger"),i=this.hasAttribute("hide-cancel"),l=this.hasAttribute("dismissable"),c=this["remember-label"]??"";return y`
84 85 <div class="dialog" tabindex="-1">
85 - ${d?k`<button
86 + ${l?y`<button
86 87 type="button"
87 88 class="close"
88 89 aria-label="Close"
89 90 @click=${()=>this._cancel()}
90 - >&times;</button>`:k``}
91 - ${e?k`<h2 class="title">${e}</h2>`:k``}
92 - ${t?k`<p class="message">${t}</p>`:k``}
93 - ${a?k`<label class="remember">
91 + >&times;</button>`:y``}
92 + ${e?y`<h2 class="title">${e}</h2>`:y``}
93 + ${t?y`<p class="message">${t}</p>`:y``}
94 + ${c?y`<label class="remember">
94 95 <input type="checkbox" class="remember__box" />
95 - <span class="remember__label">${a}</span>
96 - </label>`:k``}
96 + <span class="remember__label">${c}</span>
97 + </label>`:y``}
97 98 <div class="actions">
98 - ${i?k``:k`<button
99 + ${i?y``:y`<button
99 100 type="button"
100 101 class="btn btn--secondary"
101 102 @click=${()=>this._cancel()}
102 103 >
@@ -110,5 +111,5 @@
110 111 ${n}
111 112 </button>
112 113 </div>
113 114 </div>
114 - `}};ne.props=["open","title","message","confirm-label","cancel-label","danger","hide-cancel","dismissable","remember-label"],ne.styles=[go],ne.help=void 0;let ke=ne;U("os-confirm-dialog",ke);function vo(o){return new Promise(e=>{const t=document.createElement("os-confirm-dialog");t.setAttribute("open",""),o.title&&t.setAttribute("title",o.title),t.setAttribute("message",o.message),o.confirmLabel&&t.setAttribute("confirm-label",o.confirmLabel),o.cancelLabel&&t.setAttribute("cancel-label",o.cancelLabel),o.danger&&t.setAttribute("danger",""),o.hideCancel&&t.setAttribute("hide-cancel",""),o.dismissable&&t.setAttribute("dismissable",""),o.rememberLabel&&t.setAttribute("remember-label",o.rememberLabel);const n=s=>{t.remove(),e(s)};t.addEventListener("os-confirm",s=>{o.onRemember?.(s.detail?.remember===!0),n(!0)}),t.addEventListener("os-cancel",()=>n(!1)),document.body.appendChild(t)})}const it="desktop-mode-agent-run",V=window;let _o=0;function B(){const o=V.openStationWindowConfig?.[it];return o&&typeof o.restRoot=="string"?o:null}function yo(o){const e=new Date(o);if(Number.isNaN(e.getTime()))return"";const t=new Date,n=r=>new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),s=Math.round((n(t)-n(e))/864e5);return s<=0?e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):s===1?f("Yesterday","desktop-mode"):s<7?e.toLocaleDateString(void 0,{weekday:"short"}):e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}const xo='<svg class="dm-agent-chat__send-icon" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="M8 13.5V2.5M8 2.5 3.5 7M8 2.5 12.5 7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>';function ue(o,e,t,n){const s=document.createElement("os-avatar");return s.className=o,s.setAttribute("size",String(e)),s.setAttribute("name",n),s.setAttribute("alt",n),t&&Xt(s,t),s}function at(o,e){o.setAttribute("clickable",""),o.setAttribute("title",f("Open the agent in WP Explorer","desktop-mode")),o.addEventListener("click",t=>{t.stopPropagation(),Ot(e)}),o.addEventListener("keydown",t=>{(t.key==="Enter"||t.key===" ")&&t.stopPropagation()})}function ko(o){const e=document.createElement("button");e.type="button",e.className="dm-agent-chat__attachment",e.title=Ae(f('Open the %1$s "%2$s"',"desktop-mode"),Ge(o.kind),o.title);const t=document.createElement("span");t.className=`dm-agent-chat__attachment-icon dashicons ${Ye(o.kind)}`,t.setAttribute("aria-hidden","true");const n=document.createElement("span");n.className="dm-agent-chat__attachment-text";const s=document.createElement("span");s.className="dm-agent-chat__attachment-title",s.textContent=o.title;const r=document.createElement("span");r.className="dm-agent-chat__attachment-meta",r.textContent=`${Ge(o.kind)} · #${o.id}`,n.append(s,r);const i=document.createElement("span");return i.className="dm-agent-chat__attachment-open dashicons dashicons-external",i.setAttribute("aria-hidden","true"),e.append(t,n,i),e.addEventListener("click",()=>{Gt(o)}),e}function we(o){const{transcripts:e}=b.state;return e[o.id]||(e[o.id]=[]),e[o.id]}function wo(o){const e=o.querySelector("[data-os-agent-run-root]")??o,t=()=>{const c=b.state.activeAgent;return!!c&&we(c).some(h=>h.pending)};let n=[],s=!1,r=-1;const i=()=>{const c=B();if(!c){s=!0;return}ro({restRoot:c.restRoot,restNonce:c.restNonce}).then(h=>{n=h}).catch(()=>{n=[]}).finally(()=>{s=!0,u()})},d=c=>{b.state.transcripts[c.id]=[],b.state.conversationIds||(b.state.conversationIds={}),b.state.conversationIds[c.id]=null,b.notify()},a=async c=>{const h=B();if(!h||!await vo({title:f("Delete conversation?","desktop-mode"),message:f("Cannot be undone.","desktop-mode"),confirmLabel:f("Delete","desktop-mode"),danger:!0}))return;try{await ao({restRoot:h.restRoot,restNonce:h.restNonce},c.id)}catch{return}const y=b.state;y.conversationIds?.[c.agentId]===c.id&&(y.transcripts[c.agentId]=[],y.conversationIds[c.agentId]=null),y.conversationsRev=(y.conversationsRev??0)+1,b.notify()},l=c=>{const h=B(),p=document.createElement("div");p.className="dm-agent-chat__sidebar";const y=document.createElement("os-button");y.className="dm-agent-chat__new",y.textContent=f("+ New chat","desktop-mode"),(!c||t())&&y.setAttribute("disabled",""),y.addEventListener("click",()=>{c&&!t()&&d(c)}),p.appendChild(y);const E=document.createElement("div");E.className="dm-agent-chat__convs";const x=c?b.state.conversationIds?.[c.id]??null:null,I=c?n.filter(m=>m.agentId===c.id):n;if(s&&I.length===0){const m=document.createElement("div");m.className="dm-agent-chat__convs-empty",m.textContent=f("No conversations yet.","desktop-mode"),E.appendChild(m)}for(const m of I){const w=document.createElement("div");w.className="dm-agent-chat__conv",m.id===x&&w.classList.add("dm-agent-chat__conv--active"),w.setAttribute("role","button"),w.tabIndex=0,w.title=`${m.agentName} — ${m.title}`;const se=ue("dm-agent-chat__conv-avatar",28,m.agentAvatarUrl,m.agentName);m.agentId>0&&at(se,m.agentId);const W=document.createElement("span");W.className="dm-agent-chat__conv-text";const N=document.createElement("span");N.className="dm-agent-chat__conv-top";const P=document.createElement("span");P.className="dm-agent-chat__conv-name",P.textContent=m.agentName;const q=document.createElement("time");q.className="dm-agent-chat__conv-time",q.dateTime=m.updatedAt,q.textContent=yo(m.updatedAt),N.append(P,q);const K=document.createElement("span");K.className="dm-agent-chat__conv-preview",K.textContent=m.preview||m.title,W.append(N,K);const R=()=>{t()||!h||uo({restRoot:h.restRoot,restNonce:h.restNonce},m.id).catch(H=>{console.warn("[desktop-mode/agents] conversation load failed:",H)})};w.addEventListener("click",R),w.addEventListener("keydown",H=>{(H.key==="Enter"||H.key===" ")&&(H.preventDefault(),R())});const j=document.createElement("button");j.type="button",j.className="dm-agent-chat__conv-delete",j.textContent="×",j.setAttribute("aria-label",f("Delete conversation","desktop-mode")),j.addEventListener("click",H=>{H.stopPropagation(),a(m)}),w.append(se,W,j),E.appendChild(w)}return p.appendChild(E),p},u=()=>{const c=b.state.activeAgent;e.replaceChildren();const h=document.createElement("div");h.className="dm-agent-chat",h.appendChild(l(c));const p=document.createElement("div");if(p.className="dm-agent-chat__main",h.appendChild(p),!c){const R=document.createElement("os-empty-state");R.setAttribute("icon","superhero"),R.setAttribute("heading",f("No agent selected","desktop-mode")),R.setAttribute("description",f("Open an agent from the Agents section of WP Explorer, or pick a past conversation.","desktop-mode")),p.appendChild(R),e.appendChild(h);return}const y=document.createElement("div");y.className="dm-agent-chat__head";const E=ue("dm-agent-chat__avatar",40,c.avatarUrl,c.name);at(E,c.id);const x=document.createElement("div");x.className="dm-agent-chat__title";const I=document.createElement("strong");I.textContent=c.name;const m=document.createElement("span");m.className="dm-agent-chat__desc",m.textContent=c.description,x.append(I,m),y.append(E,x),p.appendChild(y);const w=document.createElement("div");w.className="dm-agent-chat__scroll";const se=we(c);for(const[R,j]of se.entries())w.appendChild(g(j,c,R===se.length-1));p.appendChild(w);const W=document.createElement("div");W.className="dm-agent-chat__composer";const N=document.createElement("os-textarea");N.setAttribute("aria-label",f("Message the agent","desktop-mode")),N.setAttribute("placeholder",f("Ask the agent to do something…","desktop-mode")),N.setAttribute("rows","1"),N.setAttribute("auto-grow",""),N.setAttribute("max-rows","6"),N.setAttribute("submit-on-enter",""),t()&&N.setAttribute("disabled","");const P=document.createElement("os-button");P.className="dm-agent-chat__send",P.setAttribute("variant","primary"),P.setAttribute("title",f("Send","desktop-mode")),P.innerHTML=`${xo}<span class="dm-agent-chat__send-label">${f("Send","desktop-mode")}</span>`;const q=()=>{const R=(N.value??"").trim()==="";t()||R?P.setAttribute("disabled",""):P.removeAttribute("disabled")};q();const K=()=>{const R=(N.value??"").trim();R===""||t()||_(c,R)};N.addEventListener("os-input-change",q),N.addEventListener("os-submit",K),P.addEventListener("click",K),W.append(N,P),p.appendChild(W),e.appendChild(h),w.scrollTop=w.scrollHeight},g=(c,h,p=!1)=>{const y=document.createElement("div");if(y.className=`dm-agent-chat__line dm-agent-chat__line--${c.role}`,c.pending&&y.classList.add("dm-agent-chat__line--pending"),c.role==="agent")y.appendChild(ue("dm-agent-chat__msg-avatar",28,h.avatarUrl,h.name));else if(c.role==="user"){const x=B()?.currentUser;(x?.avatarUrl||x?.name)&&y.appendChild(ue("dm-agent-chat__msg-avatar",28,x.avatarUrl??"",x.name??""))}const E=document.createElement("div");if(E.className=`dm-agent-chat__msg dm-agent-chat__msg--${c.role}`,c.pending&&E.classList.add("dm-agent-chat__msg--pending"),y.appendChild(E),c.attachment){E.appendChild(ko(c.attachment));const x=document.createElement("div");x.className="dm-agent-chat__msg-caption",x.textContent=f("Shared with the agent","desktop-mode"),E.appendChild(x)}else{if(c.pending){const I=document.createElement("os-spinner");I.setAttribute("preset","inline"),E.appendChild(I)}const x=document.createElement("div");x.className="dm-agent-chat__msg-text",c.role==="agent"&&!c.pending?x.innerHTML=dt(c.text):x.textContent=c.text,E.appendChild(x)}if(c.toolCalls&&c.toolCalls.length>0){const x=document.createElement("details");x.className="dm-agent-chat__tools";const I=document.createElement("summary");I.textContent=`${f("Tool calls","desktop-mode")} (${c.toolCalls.length})`,x.appendChild(I);for(const m of c.toolCalls){const w=document.createElement("div");w.className="dm-agent-chat__tool",w.textContent=m.error?`${m.name} — ${m.error}`:`${m.name}(${JSON.stringify(m.args)})`,x.appendChild(w)}E.appendChild(x)}if(c.callToActions&&c.callToActions.length>0&&!c.pending){const x=document.createElement("div");x.className="dm-agent-chat__ctas";const I=p&&!c.ctaUsed&&!t();for(const m of c.callToActions){const w=document.createElement("os-button");w.setAttribute("variant",m.style??"secondary"),w.textContent=m.label,I||w.setAttribute("disabled",""),w.addEventListener("click",()=>{!I||!m.reply||(c.ctaUsed=!0,_(h,m.reply))}),x.appendChild(w)}E.appendChild(x)}return y},_=async(c,h)=>{const p=B();if(!p){we(c).push({role:"error",text:f("Chat window config is missing.","desktop-mode"),at:Date.now()}),b.notify();return}await ot(c,h,{restRoot:p.restRoot,restNonce:p.restNonce},"chat")};let $;const v=B(),T=V.wp?.os?.dragManager;T&&v&&($=T.registerDropTarget({id:`dm-agent-chat-${++_o}`,element:e,accept:c=>{const h=b.state.activeAgent;if(!h)return!1;const p=tt(c);return p!==null&&!(p.kind==="user"&&p.id===h.id)},acceptLabel:f("Send to agent","desktop-mode"),onDrop:c=>{const h=b.state.activeAgent,p=tt(c.payload);!h||!p||mo(h,p,{restRoot:v.restRoot,restNonce:v.restNonce})}}));const A=b.subscribe(()=>{const c=b.state.conversationsRev??0;c!==r&&(r=c,i()),u()});return r=b.state.conversationsRev??0,i(),u(),()=>{$?.(),A()}}V.openStationNativeWindows=V.openStationNativeWindows||{},V.openStationNativeWindows[it]=wo})();
115 + `}};ce.props=["open","title","message","confirm-label","cancel-label","danger","hide-cancel","dismissable","remember-label"],ce.styles=[Po],ce.help=void 0;let Re=ce;K("os-confirm-dialog",Re);function Fo(o){return new Promise(e=>{const t=document.createElement("os-confirm-dialog");t.setAttribute("open",""),o.title&&t.setAttribute("title",o.title),t.setAttribute("message",o.message),o.confirmLabel&&t.setAttribute("confirm-label",o.confirmLabel),o.cancelLabel&&t.setAttribute("cancel-label",o.cancelLabel),o.danger&&t.setAttribute("danger",""),o.hideCancel&&t.setAttribute("hide-cancel",""),o.dismissable&&t.setAttribute("dismissable",""),o.rememberLabel&&t.setAttribute("remember-label",o.rememberLabel);const n=s=>{t.remove(),e(s)};t.addEventListener("os-confirm",s=>{o.onRemember?.(s.detail?.remember===!0),n(!0)}),t.addEventListener("os-cancel",()=>n(!1)),document.body.appendChild(t)})}const bt="desktop-mode-agent-run",te=window;let Do=0;function G(){const o=te.openStationWindowConfig?.[bt];return o&&typeof o.restRoot=="string"?o:null}function jo(o){const e=new Date(o);if(Number.isNaN(e.getTime()))return"";const t=new Date,n=r=>new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),s=Math.round((n(t)-n(e))/864e5);return s<=0?e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):s===1?h("Yesterday","desktop-mode"):s<7?e.toLocaleDateString(void 0,{weekday:"short"}):e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}const Ho='<svg class="dm-agent-chat__send-icon" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="M8 13.5V2.5M8 2.5 3.5 7M8 2.5 12.5 7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>';function _e(o,e,t,n){const s=document.createElement("os-avatar");return s.className=o,s.setAttribute("size",String(e)),s.setAttribute("name",n),s.setAttribute("alt",n),t&&fo(s,t),s}function vt(o,e){o.setAttribute("clickable",""),o.setAttribute("title",h("Open the agent in WP Explorer","desktop-mode")),o.addEventListener("click",t=>{t.stopPropagation(),bo(e)}),o.addEventListener("keydown",t=>{(t.key==="Enter"||t.key===" ")&&t.stopPropagation()})}function Wo(o){const e=document.createElement("button");e.type="button",e.className="dm-agent-chat__attachment",e.title=ue(h('Open the %1$s "%2$s"',"desktop-mode"),ct(o.kind),o.title);const t=document.createElement("span");t.className=`dm-agent-chat__attachment-icon dashicons ${at(o.kind)}`,t.setAttribute("aria-hidden","true");const n=document.createElement("span");n.className="dm-agent-chat__attachment-text";const s=document.createElement("span");s.className="dm-agent-chat__attachment-title",s.textContent=o.title;const r=document.createElement("span");r.className="dm-agent-chat__attachment-meta",r.textContent=`${ct(o.kind)} · #${o.id}`,n.append(s,r);const i=document.createElement("span");return i.className="dm-agent-chat__attachment-open dashicons dashicons-external",i.setAttribute("aria-hidden","true"),e.append(t,n,i),e.addEventListener("click",()=>{_o(o)}),e}function Le(o){const{transcripts:e}=g.state;return e[o.id]||(e[o.id]=[]),e[o.id]}function qo(o){const e=o.querySelector("[data-os-agent-run-root]")??o,t=()=>{const d=g.state.activeAgent;return!!d&&Le(d).some(v=>v.pending)};let n=[],s=!1,r=!1,i=-1;const l=()=>{const d=G();if(!d){s=!0;return}Ao({restRoot:d.restRoot,restNonce:d.restNonce}).then(v=>{n=v,r=!1}).catch(v=>{n=[],r=!0,console.error("[openstation] agents: conversations failed to load:",v)}).finally(()=>{s=!0,N()})},c=d=>{g.state.transcripts[d.id]=[],g.state.conversationIds||(g.state.conversationIds={}),g.state.conversationIds[d.id]=null,g.notify()},a=async d=>{const v=G();if(!v||!await Fo({title:h("Delete conversation?","desktop-mode"),message:h("Cannot be undone.","desktop-mode"),confirmLabel:h("Delete","desktop-mode"),danger:!0}))return;try{await Eo({restRoot:v.restRoot,restNonce:v.restNonce},d.id)}catch(C){console.error("[openstation] agents: conversation delete failed:",C),Tt(Rt,C,{fallback:h("Could not delete the conversation.","desktop-mode")});return}const k=g.state;k.conversationIds?.[d.agentId]===d.id&&(k.transcripts[d.agentId]=[],k.conversationIds[d.agentId]=null),k.conversationsRev=(k.conversationsRev??0)+1,g.notify()},u=d=>{const v=G(),$=document.createElement("div");$.className="dm-agent-chat__sidebar";const k=document.createElement("os-button");k.className="dm-agent-chat__new",k.textContent=h("+ New chat","desktop-mode"),(!d||t())&&k.setAttribute("disabled",""),k.addEventListener("click",()=>{d&&!t()&&c(d)}),$.appendChild(k);const C=document.createElement("div");C.className="dm-agent-chat__convs";const _=d?g.state.conversationIds?.[d.id]??null:null,I=d?n.filter(m=>m.agentId===d.id):n;if(s&&I.length===0){const m=document.createElement("div");m.className="dm-agent-chat__convs-empty",m.textContent=h(r?"Could not load conversations.":"No conversations yet.","desktop-mode"),C.appendChild(m)}for(const m of I){const A=document.createElement("div");A.className="dm-agent-chat__conv",m.id===_&&A.classList.add("dm-agent-chat__conv--active"),A.setAttribute("role","button"),A.tabIndex=0,A.title=`${m.agentName} — ${m.title}`;const z=_e("dm-agent-chat__conv-avatar",28,m.agentAvatarUrl,m.agentName);m.agentId>0&&vt(z,m.agentId);const V=document.createElement("span");V.className="dm-agent-chat__conv-text";const X=document.createElement("span");X.className="dm-agent-chat__conv-top";const R=document.createElement("span");R.className="dm-agent-chat__conv-name",R.textContent=m.agentName;const D=document.createElement("time");D.className="dm-agent-chat__conv-time",D.dateTime=m.updatedAt,D.textContent=jo(m.updatedAt),X.append(R,D);const J=document.createElement("span");J.className="dm-agent-chat__conv-preview",J.textContent=m.preview||m.title,V.append(X,J);const de=()=>{t()||!v||(x=!0,To({restRoot:v.restRoot,restNonce:v.restNonce},m.id).catch(W=>{console.warn("[desktop-mode/agents] conversation load failed:",W)}))};A.addEventListener("click",de),A.addEventListener("keydown",W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),de())});const U=document.createElement("button");U.type="button",U.className="dm-agent-chat__conv-delete",U.textContent="×",U.setAttribute("aria-label",h("Delete conversation","desktop-mode")),U.addEventListener("click",W=>{W.stopPropagation(),a(m)}),A.append(z,V,U),C.appendChild(A)}return $.appendChild(C),$},p=8;let f=!0,x=!1,b=0,S;const w=d=>d.scrollHeight-d.scrollTop-d.clientHeight<=p,N=()=>{const d=g.state.activeAgent,v=e.querySelector(".dm-agent-chat__scroll");v&&(b=v.scrollTop,f=x||w(v)),x=!1,S?.disconnect(),S=void 0,e.replaceChildren();const $=document.createElement("div");$.className="dm-agent-chat",$.appendChild(u(d));const k=document.createElement("div");if(k.className="dm-agent-chat__main",$.appendChild(k),!d){const j=document.createElement("os-empty-state");j.setAttribute("icon","superhero"),j.setAttribute("heading",h("No agent selected","desktop-mode")),j.setAttribute("description",h("Open an agent from the Agents section of WP Explorer, or pick a past conversation.","desktop-mode")),k.appendChild(j),e.appendChild($);return}const C=document.createElement("div");C.className="dm-agent-chat__head";const _=_e("dm-agent-chat__avatar",40,d.avatarUrl,d.name);vt(_,d.id);const I=document.createElement("div");I.className="dm-agent-chat__title";const m=document.createElement("strong");m.textContent=d.name;const A=document.createElement("span");A.className="dm-agent-chat__desc",A.textContent=d.description,I.append(m,A),C.append(_,I),k.appendChild(C);const z=document.createElement("div");z.className="dm-agent-chat__scroll";const V=Le(d);for(const[j,Oo]of V.entries())z.appendChild(T(Oo,d,j===V.length-1));k.appendChild(z);const X=document.createElement("div");X.className="dm-agent-chat__composer";const R=document.createElement("os-textarea");R.setAttribute("aria-label",h("Message the agent","desktop-mode")),R.setAttribute("placeholder",h("Ask the agent to do something…","desktop-mode")),R.setAttribute("rows","1"),R.setAttribute("auto-grow",""),R.setAttribute("max-rows","6"),R.setAttribute("submit-on-enter",""),t()&&R.setAttribute("disabled","");const D=document.createElement("os-button");D.className="dm-agent-chat__send",D.setAttribute("variant","primary"),D.setAttribute("title",h("Send","desktop-mode")),D.innerHTML=`${Ho}<span class="dm-agent-chat__send-label">${h("Send","desktop-mode")}</span>`;const J=()=>{const j=(R.value??"").trim()==="";t()||j?D.setAttribute("disabled",""):D.removeAttribute("disabled")};J();const de=()=>{const j=(R.value??"").trim();j===""||t()||F(d,j)};R.addEventListener("os-input-change",J),R.addEventListener("os-submit",de),D.addEventListener("click",de),X.append(R,D),k.appendChild(X),e.appendChild($);let U=-1;const W=()=>{f&&(z.scrollTop=z.scrollHeight,U=z.scrollTop)};if(f||(z.scrollTop=b),W(),z.addEventListener("scroll",()=>{f&&z.scrollTop===U||(f=w(z))}),typeof ResizeObserver=="function"){S=new ResizeObserver(W),S.observe(z);for(const j of z.children)S.observe(j)}},T=(d,v,$=!1)=>{const k=document.createElement("div");if(k.className=`dm-agent-chat__line dm-agent-chat__line--${d.role}`,d.pending&&k.classList.add("dm-agent-chat__line--pending"),d.role==="agent")k.appendChild(_e("dm-agent-chat__msg-avatar",28,v.avatarUrl,v.name));else if(d.role==="user"){const _=G()?.currentUser;(_?.avatarUrl||_?.name)&&k.appendChild(_e("dm-agent-chat__msg-avatar",28,_.avatarUrl??"",_.name??""))}const C=document.createElement("div");if(C.className=`dm-agent-chat__msg dm-agent-chat__msg--${d.role}`,d.pending&&C.classList.add("dm-agent-chat__msg--pending"),k.appendChild(C),d.attachment){C.appendChild(Wo(d.attachment));const _=document.createElement("div");_.className="dm-agent-chat__msg-caption",_.textContent=h("Shared with the agent","desktop-mode"),C.appendChild(_)}else{if(d.pending){const I=document.createElement("os-spinner");I.setAttribute("preset","inline"),C.appendChild(I)}const _=document.createElement("div");_.className="dm-agent-chat__msg-text",d.role==="agent"&&!d.pending?_.innerHTML=It(d.text):_.textContent=d.text,C.appendChild(_)}if(d.toolCalls&&d.toolCalls.length>0){const _=document.createElement("details");_.className="dm-agent-chat__tools";const I=document.createElement("summary");I.textContent=`${h("Tool calls","desktop-mode")} (${d.toolCalls.length})`,_.appendChild(I);for(const m of d.toolCalls){const A=document.createElement("div");A.className="dm-agent-chat__tool",A.textContent=m.error?`${m.name} — ${m.error}`:`${m.name}(${JSON.stringify(m.args)})`,_.appendChild(A)}C.appendChild(_)}if(d.callToActions&&d.callToActions.length>0&&!d.pending){const _=document.createElement("div");_.className="dm-agent-chat__ctas";const I=$&&!d.ctaUsed&&!t();for(const m of d.callToActions){const A=document.createElement("os-button");A.setAttribute("variant",m.style??"secondary"),A.textContent=m.label,I||A.setAttribute("disabled",""),A.addEventListener("click",()=>{!I||!m.reply||(d.ctaUsed=!0,F(v,m.reply))}),_.appendChild(A)}C.appendChild(_)}return k},F=async(d,v)=>{const $=G();if(x=!0,!$){Le(d).push({role:"error",text:h("Chat window config is missing.","desktop-mode"),at:Date.now()}),g.notify();return}await pt(d,v,{restRoot:$.restRoot,restNonce:$.restNonce},"chat")};let H;const le=G(),_t=te.wp?.os?.dragManager;_t&&le&&(H=_t.registerDropTarget({id:`dm-agent-chat-${++Do}`,element:e,accept:d=>{const v=g.state.activeAgent;if(!v)return!1;const $=ht(d);return $!==null&&!($.kind==="user"&&$.id===v.id)},acceptLabel:h("Send to agent","desktop-mode"),onDrop:d=>{const v=g.state.activeAgent,$=ht(d.payload);!v||!$||(x=!0,zo(v,$,{restRoot:le.restRoot,restNonce:le.restNonce}))}}));const Uo=g.subscribe(()=>{const d=g.state.conversationsRev??0;d!==i&&(i=d,l()),N()});return i=g.state.conversationsRev??0,l(),N(),()=>{H?.(),S?.disconnect(),Uo()}}te.openStationNativeWindows=te.openStationNativeWindows||{},te.openStationNativeWindows[bt]=qo})();