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.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 0.8.9 All 36 releases
← All changes | assets/js/window-system.min.js +31 -22 1.1.3 → 1.1.12 View file →
@@ -1,6 +1,11 @@
1 -(function(){"use strict";function _e(){const e=window.wp?.hooks;if(!e)throw new Error("[openstation] `window.wp.hooks` is not available. The plugin declares `wp-hooks` as a script dependency; if you are seeing this error, verify the enqueue order.");return e}function Rt(e,t,n,o){_e().addAction(e,t,n,o)}function Nt(e,t){return _e().removeAction(e,t)}function L(e,t,...n){return _e().applyFilters(e,t,...n)}function f(e,...t){_e().doAction(e,...t)}const h={INIT:"os.init",WALLPAPERS:"os.wallpapers",GAMES:"os.games",UNFOCUS_EFFECTS:"os.unfocus-effects",WINDOW_REVEALS:"os.window-reveals",WALLPAPER_MOUNTING:"os.wallpaper.mounting",WALLPAPER_MOUNTED:"os.wallpaper.mounted",WALLPAPER_UNMOUNTING:"os.wallpaper.unmounting",WALLPAPER_MOUNT_FAILED:"os.wallpaper.mount-failed",WALLPAPER_VISIBILITY:"os.wallpaper.visibility",WALLPAPER_SUSPEND:"os.wallpaper.suspend",WALLPAPER_PREVIEW_PARAMS:"os.wallpaper.preview-params",WALLPAPER_SETTINGS_CHANGED:"os.wallpaper.settings-changed",IFRAME_READY:"os.iframe.ready",IFRAME_ERROR:"os.iframe.error",IFRAME_NETWORK_COMPLETED:"os.iframe.network-completed",SHELL_ERROR:"os.shell.error",BROADCAST:"os.broadcast",MONITOR_ENTRY:"os.monitor.entry",WALLPAPER_SURFACES:"os.wallpaper.surfaces",DESKTOP_THEME_CHANGED:"os.os-theme.changed",DESKTOP_THEME_ICON:"os.os-theme.icon",DESKTOP_THEME_ICON_COLOR:"os.os-theme.icon-color",WALLPAPERS_SERVER_CHANGED:"os.wallpapers.server-changed",WINDOW_GEOMETRY:"os.window.geometry",WINDOW_OPENED:"os.window.opened",WINDOW_CONTENT_LOADING:"os.window.content-loading",WINDOW_CONTENT_LOADED:"os.window.content-loaded",WINDOW_LOADING_OVERLAY:"os.window.loading-overlay",WINDOW_REOPENED:"os.window.reopened",WINDOW_MENU_OPENED:"os.window.menu-opened",WINDOW_CLOSING:"os.window.closing",WINDOW_CLOSED:"os.window.closed",WINDOW_FOCUSED:"os.window.focused",WINDOW_BLURRED:"os.window.blurred",WINDOW_MINIMIZED:"os.window.minimized",WINDOW_RESTORED:"os.window.restored",WINDOW_CHILD_BLOCKED:"os.window.child-blocked",WINDOW_MAXIMIZED:"os.window.maximized",WINDOW_UNMAXIMIZED:"os.window.unmaximized",WINDOW_FULLSCREEN_ENTERED:"os.window.fullscreen-entered",WINDOW_FULLSCREEN_EXITED:"os.window.fullscreen-exited",WINDOW_AUTO_EXIT_FULLSCREEN:"os.window.auto-exit-fullscreen",WINDOW_FOCUS_ON_DRAG_HOVER:"os.window.focus-on-drag-hover",WINDOW_BOUNDS_CHANGED:"os.window.bounds-changed",WINDOW_MOVED:"os.window.moved",WINDOW_RESIZED:"os.window.resized",WINDOW_DRAG_START:"os.window.drag-start",WINDOW_DRAG_END:"os.window.drag-end",WINDOW_RESIZE_START:"os.window.resize-start",WINDOW_RESIZE_END:"os.window.resize-end",WINDOW_DETACHED:"os.window.detached",WINDOW_RELOADED:"os.window.reloaded",WINDOW_TITLE_CHANGED:"os.window.title-changed",WINDOW_HIGHLIGHT_CHANGED:"os.window.highlight-changed",WINDOW_BODY_RESIZED:"os.window.body-resized",NATIVE_WINDOW_BEFORE_RENDER:"os.native-window.before-render",NATIVE_WINDOW_AFTER_RENDER:"os.native-window.after-render",NATIVE_WINDOW_BEFORE_CLOSE:"os.native-window.before-close",WINDOW_CHROME_THEME:"os.window.chrome.theme",WINDOW_CHROME_CONTROLS:"os.window.chrome.controls",WINDOW_CHROME_SLOT:"os.window.chrome.slot",WINDOW_CHROME_RENDER:"os.window.chrome.render",WINDOW_CHROME_APPLIED:"os.window.chrome.applied",WINDOW_CHROME_THEME_CHANGED:"os.window.chrome.theme-changed",DESKTOP_ICON_CLICKED:"os.os-icon.clicked",DESKTOP_ICONS_RENDERED:"os.os-icons.rendered",ICON_BADGE_CHANGED:"os.icon.badge-changed",COMPONENTS_REGISTERED:"os.components.registered",DOCK_ITEM_APPENDED:"os.dock.item-appended",DOCK_ITEM_REMOVED:"os.dock.item-removed",DOCK_BEFORE_RENDER:"os.dock.before-render",DOCK_AFTER_RENDER:"os.dock.after-render",DOCK_REFRESH_ACTIVE:"os.dock.refresh-active",DOCK_TILE_CLASS:"os.dock.tile-class",DOCK_TILE_ELEMENT:"os.dock.tile-element",DOCK_TILE_RENDERED:"os.dock.tile-rendered",DOCK_TILE_TOOLTIP:"os.dock.tile-tooltip",DOCK_PEEK_CARD_CONTENT:"os.dock.peek-card-content",DOCK_PEEK_CARD_ELEMENT:"os.dock.peek-card-element",CONSTELLATION_PANEL:"os.constellation.panel",CONSTELLATION_OPENED:"os.constellation.opened",CONSTELLATION_CLOSED:"os.constellation.closed",OVERVIEW_ENTERING:"os.overview.entering",OVERVIEW_ENTERED:"os.overview.entered",OVERVIEW_EXITING:"os.overview.exiting",OVERVIEW_EXITED:"os.overview.exited",OVERVIEW_WINDOW_HOVER:"os.overview.window-hover",OVERVIEW_WINDOW_UNHOVER:"os.overview.window-unhover",OVERVIEW_WINDOW_CLICK:"os.overview.window-click",ARRANGE_CASCADE_STARTING:"os.arrange.cascade.starting",ARRANGE_CASCADE_APPLIED:"os.arrange.cascade.applied",ARRANGE_TILE_STARTING:"os.arrange.tile.starting",ARRANGE_TILE_APPLIED:"os.arrange.tile.applied",ARRANGE_TILE_DIMENSIONS:"os.arrange.tile.dimensions",ARRANGE_SNAP_CHANGED:"os.arrange.snap.changed",ARRANGE_SNAP_CELL_SIZE:"os.arrange.snap.cell-size",ARRANGE_CUSTOM_ACTION:"os.arrange.custom-action",SNAP_ZONE_PENDING:"os.snap.zone-pending",SNAP_ZONE_CANCELED:"os.snap.zone-canceled",SNAP_ZONE_COMMITTED:"os.snap.zone-committed",SNAP_SPLIT_FILLED:"os.snap.split-filled",WIDGETS:"os.widgets",WIDGET_MOUNTING:"os.widget.mounting",WIDGET_MOUNTED:"os.widget.mounted",WIDGET_UNMOUNTING:"os.widget.unmounting",WIDGET_MOUNT_FAILED:"os.widget.mount-failed",WIDGET_ADDED:"os.widget.added",WIDGET_REMOVED:"os.widget.removed",DESKTOP_CREATED:"os.os.created",DESKTOP_CLOSED:"os.os.closed",DESKTOP_SWITCHED:"os.os.switched",DESKTOP_RENAMED:"os.os.renamed",PRIMARY_DESKTOP_ID:"os.primary-desktop-id",WINDOWS_BEFORE_CLOSE_ALL:"os.windows.before-close-all",WINDOWS_CLOSE_ALL:"os.windows.close-all",WINDOWS_AFTER_CLOSE_ALL:"os.windows.after-close-all",COMMAND_BEFORE_RUN:"os.command.before-run",COMMAND_AFTER_RUN:"os.command.after-run",COMMAND_ERROR:"os.command.error",SHELL_RESIZED:"os.shell.resized",SHELL_VISIBILITY:"os.shell.visibility",CONNECTION_OPENED:"os.connection.opened",CONNECTION_CLOSED:"os.connection.closed",CONNECTION_MESSAGE:"os.connection.message",IFRAME_CONNECTION_REQUEST:"os.iframe.connection-request",WINDOW_CONTENT_CHANGED:"os.window-links.content-changed",WINDOW_LINK_GROUPS_CHANGED:"os.window-links.groups-changed",WINDOW_LINKS_CONTENT:"os.window-links.content",WINDOW_LINK_GROUPS:"os.window-links.groups",WINDOW_LINK_EDGES:"os.window-links.edges",RELATED_ENTITIES_ITEMS:"os.related-entities.items",WINDOW_LINK_RENDERERS:"os.window-links.renderers",WINDOW_LINK_RENDERER:"os.window-links.renderer",EDITOR_PREVIEW_WINDOW_CONFIG:"os.editor-preview.window-config",EDITOR_PREVIEW_LIVE:"os.editor-preview.live",EDITOR_PREVIEW_OPENED:"os.editor-preview.opened",EDITOR_PREVIEW_CLOSED:"os.editor-preview.closed",FILE_DROP_FILES_DETECTED:"os.drop.files-detected",FILE_DROP_FILES_REJECTED:"os.drop.files-rejected",FILE_DROP_DIALOG_FIELDS:"os.drop.dialog-fields",FILE_DROP_BEFORE_UPLOAD:"os.drop.before-upload",FILE_DROP_UPLOAD_STARTED:"os.drop.upload-started",FILE_DROP_UPLOAD_PROGRESS:"os.drop.upload-progress",FILE_DROP_AFTER_UPLOAD:"os.drop.after-upload",FILE_DROP_UPLOAD_FAILED:"os.drop.upload-failed",AUTH_LOST:"os.auth.lost",AUTH_RESTORED:"os.auth.restored"},To="os.activity.";function Be(e){return To+String(e).replace(/[^a-zA-Z0-9_.-]/g,".")}let Ro=0;const Ge={publish(e,t){f(Be(e),t)},subscribe(e,t){const n=`os/activity-sub/${++Ro}`,o=Be(e);Rt(o,n,i=>t(i));let s=!1;return()=>{s||(s=!0,Nt(o,n))}},filter(e,t,...n){return L(Be(e),t,...n)}},qe=new Map,Ve=new Map;function we(e,t,n,o){let s=e.get(t);if(!s){if(!o)return;s=new Map,e.set(t,s)}let i=s.get(n);if(!i){if(!o)return;i=new Set,s.set(n,i)}return i}function Ot(e,t,n,o){const s={channel:n,windowId:t},i=we(e,t,n,!1);if(i)for(const d of Array.from(i))try{d(o,s)}catch(a){typeof console<"u"&&console.error(`[openstation] window-channel subscriber for "${n}" threw:`,a)}const r=we(e,t,"*",!1);if(r)for(const d of Array.from(r))try{d(o,s)}catch(a){typeof console<"u"&&console.error(`[openstation] window-channel wildcard subscriber for "${t}" threw:`,a)}}function No(e,t,n){const o=we(qe,e,t,!0);o.add(n);let s=!1;return()=>{s||(s=!0,o.delete(n))}}function Dt(e,t,n){Ot(qe,e,t,n)}function Oo(e,t,n){const o=we(Ve,e,t,!0);o.add(n);let s=!1;return()=>{s||(s=!0,o.delete(n))}}function Do(e,t,n){Ot(Ve,e,t,n)}const ye=new Set,ve=new Set,ne=new Map;function Wt(e){return ye.has(e)}function Ee(e){ve.has(e)||(ve.add(e),f(h.WINDOW_CONTENT_LOADING,{windowId:e}),typeof document<"u"&&document.dispatchEvent(new CustomEvent("os-window-content-loading",{detail:{windowId:e}})))}function P(e){if(!ye.has(e)){ye.add(e);const t=ne.get(e);if(t){ne.delete(e);for(const n of t)try{n.flush()}catch(o){typeof console<"u"&&console.error(`[openstation] flushing queued window-send for "${n.channel}" threw:`,o)}}}ve.delete(e)&&(f(h.WINDOW_CONTENT_LOADED,{windowId:e}),typeof document<"u"&&document.dispatchEvent(new CustomEvent("os-window-content-loaded",{detail:{windowId:e}})))}function Wo(e,t,n,o){let s=ne.get(e);s||(s=[],ne.set(e,s)),s.push({channel:t,payload:n,flush:o})}function Mo(e){qe.delete(e),Ve.delete(e),ye.delete(e),ve.delete(e),ne.delete(e)}const Po=new Map;function $o(e){return Po.get(e)??null}const Ho="desktop-mode";function Mt(){return window.wp?.i18n}function m(e,t=Ho){return Mt()?.__(e,t)??e}function Q(e,...t){const n=Mt()?.sprintf;if(n)return n(e,...t);let o=0;return e.replace(/%(?:(\d+)\$)?[sd]/g,(s,i)=>{const r=i?Number.parseInt(i,10)-1:o++;return String(t[r]??"")})}const zo="os-window-tab-change";function je(e){return Array.from(e.querySelectorAll(".os-window__tab"))}function Pt(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function $t(e,t){return`${e.id||"os-window"}-tab-${Pt(t)}`}function Ht(e,t){return`${e.id||"os-window"}-panel-${Pt(t)}`}function zt(e){const t=e.querySelector(".os-window__tab-plate");if(!t)return;const n=e.querySelector(".os-window__tab--active");if(!n){t.dataset.empty="",e.dataset.tabPlateEmpty="";return}delete t.dataset.empty,delete e.dataset.tabPlateEmpty,e.style.setProperty("--_tab-plate-x",`${n.offsetLeft}px`),e.style.setProperty("--_tab-plate-w",`${n.offsetWidth}px`),e.style.setProperty("--_tab-strip-w",`${e.clientWidth}px`),n.offsetWidth>0&&(t.dataset.placed="")}function oe(e){if(e){if(e.querySelector(":scope > .os-window__tab")){e.setAttribute("role","tablist");const t=e.dataset.tablistLabel;t&&e.setAttribute("aria-label",t);return}e.setAttribute("role","presentation"),e.removeAttribute("aria-label")}}function Ft(e){const t=je(e);if(t.length===0)return;const n=t.find(o=>o.classList.contains("os-window__tab--active"))??t[0];for(const o of t){const s=o===n?0:-1;o.tabIndex!==s&&(o.tabIndex=s)}}function Fo(e,t){const n=t;if(n.altKey||n.ctrlKey||n.metaKey)return;const s=n.target?.closest(".os-window__tab");if(!s)return;const i=je(e),r=i.indexOf(s);if(r<0)return;const d=getComputedStyle(e).direction==="rtl";let a;switch(n.key){case"ArrowRight":a=i[d?r-1:r+1];break;case"ArrowLeft":a=i[d?r+1:r-1];break;case"Home":a=i[0];break;case"End":a=i[i.length-1];break;default:return}!a||a===s||(n.preventDefault(),s.tabIndex=-1,a.tabIndex=0,a.focus(),a.scrollIntoView?.({block:"nearest",inline:"nearest"}))}function Ut(e){const t=new Map;for(const n of je(e))n.dataset.kind==="panel"&&n.dataset.panel&&t.set(n.dataset.panel,n);return t}function Bt(e){const t=e.querySelector(".os-window__body");return t?Array.from(t.querySelectorAll("os-tabpanel[ for ]")).filter(n=>!n.parentElement?.closest("os-tabpanel, os-tabs")):[]}function Ke(e,t){const n=e.querySelector(".os-window__tabs");if(!n)return;let o=!1;for(const[s,i]of Ut(n)){const r=s===t;o=o||r,i.classList.toggle("os-window__tab--active",r),i.setAttribute("aria-selected",r?"true":"false")}if(o){for(const s of Bt(e)){const i=s.getAttribute("for")===t;s.toggleAttribute("hidden",!i),s.setAttribute("aria-hidden",i?"false":"true")}Ft(n),zt(n),e.dispatchEvent(new CustomEvent(zo,{bubbles:!0,detail:{value:t}}))}}function Uo(e,t,n){const o=e.querySelector(".os-window__tabs");if(!o)return;const s=Ut(o),i=Array.from(s.entries()).find(([,c])=>c.classList.contains("os-window__tab--active"))?.[0];let r=o.querySelector(".os-window__tab-plate");for(const c of t){let u=s.get(c.value);if(u)s.delete(c.value);else{const g=document.createElement("button");g.type="button",u=g,u.className="os-window__tab",u.dataset.kind="panel",u.dataset.panel=c.value,u.setAttribute("role","tab"),u.setAttribute("aria-selected","false"),u.tabIndex=-1}u.textContent!==c.label&&(u.textContent=c.label),u.id=$t(e,c.value),u.setAttribute("aria-controls",Ht(e,c.value)),u.previousElementSibling!==r&&o.insertBefore(u,r?r.nextSibling:o.firstChild),r=u}for(const c of s.values())c.remove();oe(o);const d=o.querySelector(":scope > .os-window__tab")!==null;for(const c of Bt(e)){const u=c.getAttribute("for");u&&(c.id=Ht(e,u),d?c.setAttribute("aria-labelledby",$t(e,u)):c.removeAttribute("aria-labelledby"))}const a=c=>c!==void 0&&t.some(u=>u.value===c),l=[n,i,t[0]?.value].find(a);l!==void 0&&Ke(e,l)}let Bo=0;function Go(e,t={}){const n=++Bo,o=c=>`desktop-mode/native-render-ctx/${e}/${n}/${c}`,s=new AbortController,i=[],r=(c,u,g,b)=>{const _=o(u);Rt(c,_,w=>{g(w)&&b(w)});const C=()=>{Nt(c,_)};return i.push(C),C},d=c=>!!c&&typeof c=="object"&&c.windowId===e;return{ctx:{window:{send(c,u){typeof c!="string"||c===""||Dt(e,c,u)},on(c,u){return typeof c!="string"||c===""||typeof u!="function"?()=>{}:Oo(e,c,u)},markLoading(){Ee(e)},markReady(){P(e)}},markLoading(){Ee(e)},markReady(){P(e)},signal:s.signal,onResize(c){return typeof c!="function"?()=>{}:r(h.WINDOW_BODY_RESIZED,"on-resize",d,u=>{const{width:g,height:b}=u;try{c(g,b)}catch(_){f(h.SHELL_ERROR,{scope:"native-render-ctx/onResize",id:e,error:_})}})},onHide(c){return typeof c!="function"?()=>{}:r(h.WINDOW_MINIMIZED,"on-hide",d,()=>{try{c()}catch(u){f(h.SHELL_ERROR,{scope:"native-render-ctx/onHide",id:e,error:u})}})},onShow(c){return typeof c!="function"?()=>{}:r(h.WINDOW_RESTORED,"on-show",d,()=>{try{c()}catch(u){f(h.SHELL_ERROR,{scope:"native-render-ctx/onShow",id:e,error:u})}})},params:t},dispose:()=>{try{s.abort()}catch{}for(;i.length;){const c=i.pop();try{c?.()}catch{}}}}}const qo=["post_type","page","taxonomy","path","post","c","tag_ID","item","p"].filter(e=>e!=="p");function Gt(e){try{const t=new URL(e,window.location.origin),n=new URLSearchParams;for(const s of qo){const i=t.searchParams.get(s);i&&n.set(s,i)}n.sort();const o=n.toString();return t.pathname.replace(/\/+$/,"")+(o?`?${o}`:"")}catch{return e}}function G(e){try{const t=new URL(e,window.location.origin);return t.searchParams.delete("openstation_chromeless"),t.searchParams.delete("desktop_mode_portal"),t.pathname.replace(/\/+$/,"")+"?"+t.searchParams.toString()}catch{return e}}const qt="__openStationSharedStores";function Vo(){const e=window;let t=e[qt];return t||(t=new Map,e[qt]=t),t}function I(e,t){const n=Vo();let o=n.get(e);o||(o={state:t(),listeners:new Set,rebuild:t},n.set(e,o));const s={get state(){return o.state},set state(i){o.state=i},getState(){return o.state},notify(){for(const i of Array.from(o.listeners))try{i(o.state)}catch(r){console.error(`[desktop-mode/shared-store:${e}] subscriber threw:`,r)}},subscribe(i){return o.listeners.add(i),()=>{o.listeners.delete(i)}},setState(i){const r=o.state;if(typeof r!="object"||r===null){console.warn(`[desktop-mode/shared-store:${e}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(r,i),s.notify()},reset(){const i=o.rebuild(),r=o.state;if(typeof r=="object"&&r!==null&&typeof i=="object"&&i!==null){const d=r;for(const a of Object.keys(d))delete d[a];Object.assign(d,i)}else o.state=i;o.listeners.clear()}};return s}const Vt=I("desktop-mode/dock-rail-registry",()=>({registry:new Map,listeners:new Set,activeId:"default"}));Vt.state.registry,Vt.state.listeners;function jo(e,t){if(!e||typeof e!="object")return["def (not an object)"];const n=e,o=[];for(const s of t)s.valid(n)||o.push(`${s.field} (${s.message})`);return o}class Ko extends Error{constructor(t,n,o){super(`[openstation] ${t} registration rejected — fields: `+n.join(", ")+"."),this.name="RegistrationError",this.kind=t,this.errors=n,this.def=o}}function Ye(e,t,n){if(t.length!==0)throw new Ko(e,t,n)}function jt(e,t,n){typeof console>"u"||console.warn(`[openstation] ${e} registration rejected — fields: `+t.join(", ")+".",n)}const q=[[0,0],[100,0],[100,100],[0,100]],Yo=48,Xo=80,Xe=6,Ze=8,Kt=4,Yt=3,Xt=64,Qe=105,V=2;function Zt(e){return`${Math.round(e*1e3)/1e3}%`}function j(e){return e.slice().reverse()}function se(e,t,n,o){return[[e,t],[n,t],[n,o],[e,o]]}function Zo(e,t,n,o){const s=[];for(let i=0;i<o;i++){const r=i/o*Math.PI*2;s.push([e+Math.cos(r)*n,t+Math.sin(r)*n])}return s}function $(e,t=[]){const n=[],o=s=>{n.push(`${Zt(s[0])} ${Zt(s[1])}`)};for(const s of e)o(s);if(t.length>0){o(e[0]);for(const s of t){for(const i of s)o(i);o(s[0]),o(e[0])}}return`polygon( ${n.join(", ")} )`}function Qt(e){return $(q,[j(Zo(50,50,e,Yo))])}function Jt(e){return $(q,[j(se(50-e,-V,50+e,100+V))])}function en(e){const t=100/Xe,n=[];for(let o=0;o<Xe;o++){const s=o*t;n.push(j(se(-V,s,100+V,s+e)))}return $(q,n)}function tn(e){return $(q,[j(se(-V,50-e,100+V,50+e))])}function nn(e){const t=100/Ze,n=[];for(let o=0;o<Ze;o++){const s=o*t;n.push(j(se(s,-V,s+e,100+V)))}return $(q,n)}function on(e){return $(q,[j([[50,50-e],[50+e,50],[50,50+e],[50-e,50]])])}function sn(e){const t=100/Kt,n=100/Yt,o=[];for(let s=0;s<Yt;s++)for(let i=0;i<Kt;i++){const r=i*t+t/2,d=s*n+n/2,a=t/2*e,l=n/2*e;o.push(j(se(r-a,d-l,r+a,d+l)))}return $(q,o)}function rn(e){const t=-Math.PI/2,n=e/180*Math.PI,o=[[50,50]];for(let s=0;s<Xt;s++){const i=t+s/(Xt-1)*n;o.push([50+Math.cos(i)*Qe,50+Math.sin(i)*Qe])}return $(q,[j(o)])}function Qo(){return{from:Qt(0),to:Qt(Xo)}}function Jo(){return{from:Jt(0),to:Jt(52)}}function es(){return{from:en(0),to:en(100/Xe+.5)}}function ts(){return{from:tn(0),to:tn(52)}}function ns(){return{from:nn(0),to:nn(100/Ze+.5)}}function os(){return{from:on(0),to:on(Qe)}}function ss(){return{from:sn(0),to:sn(1.04)}}function is(){return{from:rn(0),to:rn(360)}}function rs(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 100% 0% )"}}function as(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 0% 100% )"}}function ls(){return{from:$([[-60,0],[100,0],[100,100],[0,100]]),to:$([[100,0],[260,0],[260,100],[160,100]])}}const Je=6,et=100,J=et/2,Ae=200,an=90,ln=["#5c5c6d","#525261","#484855","#3e3e49","#34343d","#2a2a31"],cs="#101014",ds=1.25,ee="http://www.w3.org/2000/svg";let us=0;function Se(e){return Math.round(e*1e3)/1e3}function tt(e){return e/Je*Math.PI*2-Math.PI/2}function hs(e){const n=tt(e)+Math.PI/Je+Math.PI/2;return{x:Math.cos(n),y:Math.sin(n)}}function fs(e){const t=tt(e),n=tt(e+1);return[[J,J],[J+Math.cos(t)*Ae,J+Math.sin(t)*Ae],[J+Math.cos(n)*Ae,J+Math.sin(n)*Ae]]}function cn(e,t){const n=fs(e),o=document.createElementNS(ee,"path");return o.setAttribute("d",`M ${n.map(([s,i])=>`${Se(s)} ${Se(i)}`).join(" L ")} Z`),t?o.setAttribute("fill","#fff"):(o.setAttribute("fill",ln[e%ln.length]),o.setAttribute("stroke",cs),o.setAttribute("stroke-width",String(ds)),o.setAttribute("vector-effect","non-scaling-stroke"),o.setAttribute("stroke-linejoin","round")),o}function ps(){const e=`os-iris-${++us}`,t=document.createElementNS(ee,"svg");t.setAttribute("viewBox",`0 0 ${et} ${et}`),t.setAttribute("preserveAspectRatio","none"),t.setAttribute("aria-hidden","true"),t.style.width="100%",t.style.height="100%",t.style.display="block";const n=document.createElementNS(ee,"defs"),o=document.createElementNS(ee,"mask");o.setAttribute("id",e);const s=document.createElementNS(ee,"g"),i=document.createElementNS(ee,"g");i.setAttribute("mask",`url(#${e})`);const r=[];for(let a=0;a<Je;a++){const l=cn(a,!0),c=cn(a,!1);s.appendChild(l),i.appendChild(c),r.push({el:l,index:a},{el:c,index:a})}o.appendChild(s),n.appendChild(o),t.appendChild(n),t.appendChild(i);const d=document.createElement("div");return d.appendChild(t),{element:d,play:a=>r.map(({el:l,index:c})=>{const u=hs(c),g=Se(u.x*an),b=Se(u.y*an);return l.animate([{transform:"translate( 0px, 0px )"},{transform:`translate( ${g}px, ${b}px )`}],{duration:a.duration,easing:a.easing,delay:a.delay,fill:"both"})})}}const nt="none",ms=70,gs=600,dn=I("desktop-mode/window-reveal-registry",()=>({registry:new Map,listeners:new Set})),un=dn.state.registry,bs=dn.state.listeners,hn=/^[a-z0-9_/-]+$/;function fn(e){const t=/^\s*([a-zA-Z-]+)\s*\(/.exec(e);return t?t[1].toLowerCase():""}const _s=0;function ws(e){return typeof e!="number"||!Number.isFinite(e)?ms:Math.min(gs,Math.max(0,e))}function ys(e){return typeof e.render=="function"?[]:Array.isArray(e.layers)&&e.layers.length>0?e.layers:typeof e.from=="string"&&typeof e.to=="string"?[{from:e.from,to:e.to}]:[]}function pn(e,t){const n=[],o=typeof e.from=="string"&&e.from.trim()!=="",s=typeof e.to=="string"&&e.to.trim()!=="";if(o||n.push(`${t}.from (missing — the clip-path covering the window)`),s||n.push(`${t}.to (missing — the clip-path uncovering the window)`),o&&s){const i=fn(e.from),r=fn(e.to);i===""||r===""?n.push(`${t}.from|to (must be shape functions, e.g. \`inset( … )\` or \`polygon( … )\` — bare keywords like \`none\` cannot be animated)`):i!==r&&n.push(`${t}.from|to (must use the same shape function to interpolate — got \`${i}()\` and \`${r}()\`)`)}return n}function vs(e){if(typeof KeyframeEffect!="function")return!0;try{return new KeyframeEffect(null,null,{easing:e}),!0}catch{return!1}}function O(e){const t=[];if(!e||typeof e!="object")t.push("def (not an object)");else{typeof e.id!="string"||e.id.trim()===""?t.push("id (missing)"):hn.test(e.id.trim().toLowerCase())?e.id.trim().toLowerCase()===nt&&t.push('id ("none" is reserved)'):t.push(`id (must match ${hn} — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-id)`),(typeof e.label!="string"||e.label.trim()==="")&&t.push("label (missing)");const o=e.render!==void 0,s=Array.isArray(e.layers),i=e.from!==void 0||e.to!==void 0;o&&typeof e.render!="function"?t.push("render (not a function)"):o&&(s||i)?t.push("render|layers|from|to (supply exactly one of: a from/to pair, a layers array, or a render function)"):o||(s&&i?t.push("layers|from|to (supply EITHER a single from/to pair OR a layers array, not both)"):s?(e.layers.length===0&&t.push("layers (empty — supply at least one matched pair)"),e.layers.forEach((r,d)=>{if(!r||typeof r!="object"){t.push(`layers[ ${d} ] (not an object)`);return}t.push(...pn(r,`layers[ ${d} ]`))})):t.push(...pn(e,"").map(r=>r.replace(/^\./,"")))),e.easing!==void 0&&(typeof e.easing!="string"||e.easing.trim()===""?t.push("easing (not a non-empty string)"):vs(e.easing)||t.push("easing (not an easing the browser can parse — `Element.animate()` would throw at play time, with the covering surface already over the window)"))}Ye("WindowReveal",t,e);const n=e.id.trim().toLowerCase();un.set(n,{...e,id:n}),Ss()}function Es(){const e=Array.from(un.values()),t=L(h.WINDOW_REVEALS,e);return Array.isArray(t)?t:(typeof console<"u"&&console.warn("[openstation] `os.window-reveals` filter returned a non-array; falling back to registry list."),e)}function As(e){return Es().find(t=>t.id===e)}function Ss(){const e=Array.from(bs);for(const t of e)try{t()}catch(n){typeof console<"u"&&console.error("[openstation] window-reveal registry listener threw:",n)}}O({id:"sweep",label:m("Sweep"),description:m("A straight edge travels across the window, uncovering the page behind it."),...as(),duration:420}),O({id:"iris",label:m("Iris"),description:m("The page opens out from the centre of the window, like a camera shutter."),...Qo(),duration:520}),O({id:"curtain",label:m("Curtain"),description:m("Two panels part from the middle of the window and slide off the sides."),...Jo(),duration:480}),O({id:"blinds",label:m("Blinds"),description:m("Six horizontal slats retract at once, letting the page through between them."),...es(),duration:560}),O({id:"diagonal",label:m("Diagonal"),description:m("A slanted edge sweeps off the trailing corner of the window."),...ls(),duration:460}),O({id:"rise",label:m("Rise"),description:m("The page rises into the window from the bottom edge upward."),...rs(),duration:440}),O({id:"shutter",label:m("Shutter"),description:m("Two panels part from the middle of the window and slide off the top and bottom."),...ts(),duration:480}),O({id:"slats",label:m("Slats"),description:m("Eight vertical slats retract at once, letting the page through between them."),...ns(),duration:560}),O({id:"diamond",label:m("Diamond"),description:m("The page opens out from the centre of the window through a growing rhombus."),...os(),duration:520}),O({id:"mosaic",label:m("Mosaic"),description:m("The page arrives as a grid of tiles, each opening out from its own centre."),...ss(),duration:600}),O({id:"obturator",label:m("Camera shutter"),description:m("Six wedges slide aside in unison, opening a hexagonal aperture from the centre like the iris of a camera lens."),render:ps,duration:720,edgeLag:0}),O({id:"radar",label:m("Radar"),description:m("A spoke sweeps a full turn around the centre of the window, uncovering the page behind it."),...is(),duration:760});const mn={dockSize:["compact","default","large"],desktopLayout:["classic","unified"],dockPlacement:["bottom","left","right"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"]},gn=["dockRailRenderer","windowReveal","accent"],bn={windowRevealDuration:{min:80,max:4e3}},Cs=/^[a-z0-9_-]+$/;[...Object.keys(mn),...gn,...Object.keys(bn)];function ks(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t=e,n={},o={};for(const[s,i]of Object.entries(mn)){const r=t[s];typeof r=="string"&&i.includes(r)&&(n[s]=r)}for(const s of gn){const i=t[s];typeof i=="string"&&Cs.test(i)&&(n[s]=i)}for(const[s,i]of Object.entries(bn)){const r=t[s];typeof r=="number"&&Number.isFinite(r)&&(o[s]=Math.min(i.max,Math.max(i.min,Math.round(r))))}return{...n,...o}}const xs=/^[a-z0-9_-]+$/,_n=128;function Ls(e){return typeof e!="string"||e===""||e.length>2048?!1:e.startsWith("dashicons-")||e.startsWith("https://")||e.startsWith("http://")||e.startsWith("data:image/")}function Is(e){if(!e||typeof e!="object")return null;const t=e,n=typeof t.slug=="string"?t.slug:"";if(!xs.test(n))return null;const o={};if(t.icons&&typeof t.icons=="object"){let a=0;for(const[l,c]of Object.entries(t.icons)){if(a>=_n)break;l===""||!Ls(c)||(o[l]=c,a+=1)}}const s={};if(t.tokens&&typeof t.tokens=="object")for(const[a,l]of Object.entries(t.tokens))typeof l=="string"&&(s[a]=l);const i=[];if(Array.isArray(t.fonts))for(const a of t.fonts)typeof a=="string"&&a!==""&&i.push(a);const r={};if(t.iconColors&&typeof t.iconColors=="object"){let a=0;for(const[l,c]of Object.entries(t.iconColors)){if(a>=_n)break;l===""||typeof c!="string"||c===""||(r[l]=c,a+=1)}}const d=a=>typeof t[a]=="string"?t[a]:"";return{id:d("id")||n,slug:n,name:d("name")||n,version:d("version"),author:d("author"),description:d("description"),previewUrl:d("previewUrl"),cssUrl:d("cssUrl"),cssText:d("cssText"),tokens:s,fonts:i,icons:o,iconColors:r,recommendedOsSettings:ks(t.recommendedOsSettings),installedAt:typeof t.installedAt=="number"?t.installedAt:0,source:t.source==="code"?"code":"upload"}}function Ts(){const t=window.openStationConfig?.serverDesktopThemes,n=[];if(Array.isArray(t))for(const o of t){const s=Is(o);s&&n.push(s)}return{themes:n,activeId:null,activeIcons:null,activeIconColors:null}}const Rs=I("desktop-mode/desktop-themes",Ts);function wn(){return Rs}function yn(e){const t=wn().state;if(t.activeIcons===null||!e)return null;const n=t.activeIcons[e];if(typeof n!="string"||n==="")return null;const o=L(h.DESKTOP_THEME_ICON,n,{slot:e,themeId:t.activeId??""});return typeof o=="string"&&o!==""?o:null}function vn(e){const t=wn().state;if(t.activeIconColors===null||!e)return null;const n=t.activeIconColors[e];if(typeof n!="string"||n==="")return null;const o=L(h.DESKTOP_THEME_ICON_COLOR,n,{slot:e,themeId:t.activeId??""});return typeof o=="string"&&o!==""?Ns(o):null}function Ns(e){const t=e.trim();if(t===""||t.length>64||/[;{}<>"'\\]/.test(t))return null;let n=0;for(const o of t)if(o==="(")n+=1;else if(o===")"&&(n-=1,n<0))return null;return n===0?t:null}const ie={OS_SETTINGS:"OS_SETTINGS",RECYCLE_BIN:"RECYCLE_BIN",BUG_REPORT:"BUG_REPORT",EXIT_OPENSTATION:"EXIT_OPENSTATION",PWA_INSTALL:"PWA_INSTALL"},Os={"desktop-mode-os-settings":ie.OS_SETTINGS,"desktop-mode-recycle-bin":ie.RECYCLE_BIN,"desktop-mode-bug-report":ie.BUG_REPORT,"os-exit":ie.EXIT_OPENSTATION,"os-pwa-install":ie.PWA_INSTALL};function Ds(e){if(typeof e!="string"||e==="")return"";const t=Os[e];if(t)return t;const n=e.toLowerCase().replace(/[^a-z0-9_-]/g,"");return n===""?"":`APP:${n}`}function Ws(e){if(typeof e!="string"||e==="")return"";const t=e.replace(/^core\//,"").toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"");return t===""?"":`WINDOW_CONTROL_${t}`}function ot(e,t){const n=Ws(t),o=yn(n),s=vn(n);if(o===null&&s===null)return!1;if(s!==null?e.style.setProperty("--os-ui-btn-icon-color",s):e.style.removeProperty("--os-ui-btn-icon-color"),o===null)return e.style.setProperty("color",s),!1;if(o.startsWith("dashicons-")){e.removeAttribute("icon-src"),e.removeAttribute("icon");const i=document.createElement("span");return i.className=`dashicons ${o}`,i.setAttribute("aria-hidden","true"),s!==null&&(i.style.color=s),e.appendChild(i),!0}return e.setAttribute("icon-src",o),!0}let st=null;function Ce(){return!!window.openStationShellOverlays}function Ms(e){return new Promise((t,n)=>{const o=document.querySelector('script[data-os-shell-overlays="1"]'),s=()=>{if(Ce()){t();return}n(new Error("[openstation] shell-overlays bundle loaded but did not set `window.openStationShellOverlays`."))};if(o){Ce()?s():(o.addEventListener("load",s),o.addEventListener("error",()=>n(new Error("failed to load shell-overlays bundle"))));return}const i=document.createElement("script");i.src=e,i.async=!0,i.dataset.osShellOverlays="1",i.addEventListener("load",s),i.addEventListener("error",()=>n(new Error("failed to load shell-overlays bundle"))),document.head.appendChild(i)})}function Ps(e){return Ce()||!e?Promise.resolve():(st||(st=Ms(e)),st)}function $s(){return window.openStationConfig?.shellOverlaysBundleUrl??""}function Hs(e,t){const n=$s();if(Ce()||!n){t();return}Ps(n).then(()=>{e()&&t()}).catch(o=>{typeof console<"u"&&console.warn("[openstation] shell-overlays failed to load; menu/dialog suppressed:",o)})}const zs=4e3,Fs=200,Us=1200;function it(e){const t=Ge.filter("os/toast-requested",{...e});if(!t||t.cancel===!0)return()=>{};let n=!1,o=null;return Hs(()=>!n,()=>{o=Bs(t)}),()=>{n=!0,o&&o()}}function Bs(e){const t=js(),n=document.createElement("os-toast");n.textContent=e.message,e.action&&(n.setAttribute("action",e.action.label),n.addEventListener("os-toast-action",()=>{e.action?.onClick(),a()})),e.dismissible&&(n.setAttribute("dismissible",""),n.addEventListener("os-toast-dismiss",()=>{e.onDismiss?.(),a()})),t.appendChild(n);let o=!1,s=null,i=e.duration??zs,r=0;const d=()=>{s!==null&&(window.clearTimeout(s),s=null)},a=()=>{o||(o=!0,d(),Vs(n),n.setAttribute("state","out"),window.setTimeout(()=>{n.remove(),qs()},Fs))},l=()=>{o||e.persistent||s!==null||(r=Date.now(),s=window.setTimeout(a,i))},c=()=>{s!==null&&(i=Math.max(0,i-(Date.now()-r)),d())};return requestAnimationFrame(()=>{n.setAttribute("state","in")}),n.addEventListener("os-toast-hold",u=>{if(u.detail?.held){c();return}i=Math.max(i,Us),l()}),Gs(n),l(),Ge.publish("os/toast-shown",{...e}),a}let ke=null,re=0;function En(e){const t=e.target;t instanceof HTMLElement&&(t.closest("os-toast-container")||(ke=t))}function Gs(e){re===0&&document.addEventListener("focusin",En,!0),re+=1;const t=e.ownerDocument,n=t.activeElement;n instanceof HTMLElement&&n!==t.body&&!n.closest("os-toast-container")&&(ke=n)}function qs(){re=Math.max(0,re-1),re===0&&document.removeEventListener("focusin",En,!0)}function Vs(e){const t=e.ownerDocument.activeElement;t!==e&&!e.contains(t)||ke?.isConnected===!0&&ke.focus()}function js(){const e=document.querySelector("os-toast-container");if(e)return e;const t=document.createElement("os-toast-container");return document.body.appendChild(t),t}const An="X-WP-Nonce";function Ks(e,t){const n=Ys();if(!n)return t;const o=Xs(e);if(!o||!Zs(o))return t;const s=t?.headers??(typeof Request<"u"&&e instanceof Request?e.headers:void 0),i=new Headers(s??{});return i.has(An)?t:(i.set(An,n),{...t??{},headers:i})}function Ys(){if(typeof window>"u")return;const t=window.openStationConfig?.restNonce;return typeof t=="string"&&t.length>0?t:void 0}function Xs(e){try{const t=typeof window<"u"&&window.location?window.location.href:void 0;return typeof e=="string"?new URL(e,t):e instanceof URL?e:typeof Request<"u"&&e instanceof Request?new URL(e.url,t):null}catch{return null}}function Zs(e){return typeof window>"u"||!window.location||e.origin!==window.location.origin?!1:!!(e.pathname.includes("/wp-json/")||e.searchParams.has("rest_route"))}function Qs(e,t,n={}){const o=window.wp?.os?.fetch;if(typeof o=="function")return o(e,t,n);const s=Ks(e,t);return fetch(e,s)}const Js="http://localhost/";function ei(e,t){const n=typeof window<"u"&&window.location?window.location.href:Js,o=new URL(e,n),s=t.replace(/^\/+/,""),i=s.indexOf("?"),r=i===-1?s:s.slice(0,i),d=i===-1?"":s.slice(i+1);if(o.searchParams.has("rest_route")){const a=o.searchParams.get("rest_route")??"/",l=a.endsWith("/")?a:a+"/";o.searchParams.set("rest_route",l+r)}else{const a=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";o.pathname=a+r}return d&&new URLSearchParams(d).forEach((l,c)=>{o.searchParams.append(c,l)}),o.toString()}`${btoa('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="currentColor"><rect x="6" y="6" width="23" height="23" rx="4"/><rect x="35" y="6" width="23" height="23" rx="4"/><rect x="6" y="35" width="23" height="23" rx="4"/><rect x="35" y="35" width="23" height="23" rx="4"/></svg>')}`,`${btoa('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none" stroke="currentColor" stroke-width="6" stroke-linecap="round"><path d="M10 22h44M10 42h44"/><circle cx="24" cy="22" r="7" fill="currentColor" stroke="none"/><circle cx="42" cy="42" r="7" fill="currentColor" stroke="none"/></svg>')}`;function ti(e){try{(window.top??window).location.assign(e)}catch{window.location.assign(e)}}const Sn=800;function ni(e,t=Sn){window.setTimeout(()=>{if(e){ti(e);return}try{(window.top??window).location.reload()}catch{window.location.reload()}},t)}const oi="desktop-mode/v1",si=3e4,ii=3,ae=I("desktop-mode/plugin-presence",()=>({confirmInFlight:!1,lastConfirmAt:null,exiting:!1,booted:!1,negativeConfirms:0}));function rt(){return window.wp?.os?.config??{}}function ri(){const e=rt().adminUrl||"/wp-admin/";let t;try{t=new URL(e,window.location.href).pathname}catch{t="/wp-admin/"}return t.endsWith("/")?t:`${t}/`}function ai(){const e=rt().restUrl;return e?ei(e,oi):null}function li(){ae.state.negativeConfirms=0}async function ci(){const e=ae.state;if(e.exiting||e.confirmInFlight||e.negativeConfirms>=ii)return;const t=ai();if(!t)return;const n=Date.now();if(!(e.lastConfirmAt!==null&&n-e.lastConfirmAt<si)){e.lastConfirmAt=n,e.confirmInFlight=!0;try{const o=await Qs(t,{credentials:"same-origin"},{silent:!0,source:"desktop-mode/plugin-presence"});if(o.status!==404){e.negativeConfirms+=1;return}if((await o.json())?.code!=="rest_no_route"){e.negativeConfirms+=1;return}di()}catch{}finally{e.confirmInFlight=!1}}}function di(){if(!ae.state.exiting){ae.state.exiting=!0,ni(rt().adminUrl||"");try{it({message:m("OpenStation is no longer active. Returning to the WordPress dashboard…"),duration:Sn})}catch{}}}function at(e){if(ae.state.exiting)return;let t=null;try{t=e.contentDocument}catch{return}if(!(!t?.body||!t.location)&&t.location.pathname.startsWith(ri())){if(t.body.classList.contains("os-chromeless")){li();return}ci()}}const z=0,lt=40,Cn=5,ui=Cn*Cn,hi=3e3,fi=120,ct="os-window__loading",kn="os-window__loading--visible",pi=I("desktop-mode/window-reveal-active",()=>({id:nt,duration:_s}));function mi(){const e=pi.state.id;return!e||e===nt?null:As(e)??null}const dt="os-window__reveal",gi="os-window__reveal--edge",bi="os-window__reveal--custom",xn="data-os-reveal",Ln="data-os-reveal-layer",_i=I("desktop-mode/window-reveal-rendered",()=>({plays:new WeakMap})).state.plays;function In(e,t,n,o){const s=document.createElement("div");s.className=o?`${dt} ${gi}`:dt;const i=o?e.edgeColor:t.color??e.surfaceColor;return typeof i=="string"&&i!==""&&(s.style.background=i),s.setAttribute("aria-hidden","true"),s.setAttribute(xn,e.id),s.setAttribute(Ln,String(n)),s.style.clipPath=t.from,s}function wi(){const e=mi();if(!e)return[];if(typeof e.render=="function"){let o;try{o=e.render()}catch(i){return typeof console<"u"&&console.error(`[openstation] window reveal "${e.id}" render threw:`,i),[]}if(!o?.element||typeof o.play!="function")return[];const s=o.element;return s.classList.add(dt),s.classList.add(bi),s.setAttribute("aria-hidden","true"),s.setAttribute(xn,e.id),s.setAttribute(Ln,"0"),_i.set(s,o.play),[s]}const t=ys(e);if(t.length===0)return[];const n=[];return ws(e.edgeLag)>0&&t.forEach((o,s)=>n.push(In(e,o,s,!0))),t.forEach((o,s)=>n.push(In(e,o,s,!1))),n}const Tn="os-window__body--loading",Rn="data-os-loading-at",Nn="data-os-loading-cycle";function yi(e){return e.getAttribute(Nn)??"0"}function vi(e){e.setAttribute(Rn,String(Date.now())),e.setAttribute(Nn,String(Number(yi(e))+1))}function Ei(e,t){const n=Number(e.getAttribute(Rn)),o=Number.isFinite(n)&&n>0?Date.now()-n:0,s=fi-o;if(s<=0){t.classList.add(kn);return}window.setTimeout(()=>{t.isConnected&&e.classList.contains(Tn)&&t.classList.add(kn)},s)}const Ai=Symbol.for("desktop-mode/window-config");function Si(e,t){e[Ai]=t}const On=window.location.origin;function xe(e){const t=new URL(e,On);return t.origin!==On?null:(t.searchParams.set("openstation_chromeless","1"),t.toString())}function te(){const e=document.querySelectorAll(".os-window--fullscreen:not(.os-window--minimized)").length>0;document.body.classList.toggle("os-has-fullscreen-window",e)}function Ci(){const e=document.createElement("div");e.className=ct,e.setAttribute("role","status"),e.setAttribute("aria-live","polite");const t=document.createElement("os-spinner");return t.setAttribute("preset","classic"),t.setAttribute("size","clamp(96px, 14vw, 192px)"),t.setAttribute("label",m("Loading window content")),e.appendChild(t),e}function ki(e){let t=Ci();const n={windowId:e.id,config:e};if(typeof e.loading?.render=="function")try{e.loading.render(t,n)}catch(o){typeof console<"u"&&console.error(`[openstation] loading.render threw for "${e.id}":`,o)}try{const o=L(h.WINDOW_LOADING_OVERLAY,t,n);o instanceof HTMLElement&&(t=o)}catch(o){typeof console<"u"&&console.error(`[openstation] WINDOW_LOADING_OVERLAY filter threw for "${e.id}":`,o)}return t&&!t.classList.contains(ct)&&t.classList.add(ct),t}function K(e){const t=document.createElement("span");return t.className=`os-window__slot os-window__slot--${e}`,t.dataset.slot=e,t}function xi(e){const t=document.createElement("div");t.className="os-window",e.native&&t.classList.add("os-window--native"),t.id=`wp-window-${e.id}`,t.setAttribute("role","dialog"),t.setAttribute("aria-labelledby",`wp-window-title-${e.id}`),t.setAttribute("aria-busy","true"),t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.width=`${e.width}px`,t.style.height=`${e.height}px`;const n=document.createElement("div");n.className="os-window__titlebar";const o=document.createElement("os-window-button");o.setAttribute("icon","menu"),ot(o,"core/menu"),o.setAttribute("aria-label",m("Window actions")),o.setAttribute("aria-haspopup","menu"),o.setAttribute("aria-expanded","false"),o.classList.add("os-window__btn"),o.classList.add("os-window__menu-btn");const s=document.createElement("os-menu");s.classList.add("os-window__menu-panel"),s.hidden=!0;const i=document.createElement("os-menu-item");if(i.setAttribute("role","menuitemcheckbox"),i.setAttribute("value","startup"),i.classList.add("os-window__menu-item"),i.classList.add("os-window__menu-item--startup"),i.textContent=m("Open on startup"),s.appendChild(i),e.multi){const p=document.createElement("os-menu-item");p.setAttribute("role","menuitem"),p.setAttribute("value","open-another"),p.setAttribute("icon","dashicons-plus-alt2"),p.classList.add("os-window__menu-item"),p.classList.add("os-window__menu-item--open-another"),p.textContent=Q(m("Open another %s"),e.title),s.appendChild(p)}if(!e.native){const p=document.createElement("os-menu-item");p.setAttribute("role","menuitem"),p.setAttribute("value","open-in-new-window"),p.setAttribute("icon","dashicons-plus-alt"),p.classList.add("os-window__menu-item"),p.classList.add("os-window__menu-item--open-in-new-window"),p.textContent=m("Open in new window"),s.appendChild(p)}if(!e.native||e.render){const p=document.createElement("os-menu-item");p.setAttribute("role","menuitem"),p.setAttribute("value","reload"),p.setAttribute("icon","dashicons-update"),p.classList.add("os-window__menu-item"),p.classList.add("os-window__menu-item--reload"),p.textContent=m("Reload"),s.appendChild(p)}if(!e.native){const p=document.createElement("os-menu-item");p.setAttribute("role","menuitem"),p.setAttribute("value","open-external"),p.setAttribute("icon","dashicons-external"),p.classList.add("os-window__menu-item"),p.classList.add("os-window__menu-item--open-external"),p.textContent=m("Open in browser tab"),s.appendChild(p)}const r=K("icon"),d=K("title"),a=document.createElement("span");a.className="os-window__title",a.id=`wp-window-title-${e.id}`,a.textContent=e.title,d.appendChild(a);const l=K("before-titlebar"),c=K("before-icon"),u=K("after-title"),g=K("before-controls"),b=K("after-controls"),_=K("after-titlebar"),C=document.createElement("div");C.className="os-window__controls";const w=document.createElement("div");w.className="os-window__screen-meta";const E=document.createElement("span");E.className="os-window__custom-buttons os-window__custom-buttons--left";const y=document.createElement("span");y.className="os-window__custom-buttons os-window__custom-buttons--right";const v=document.createElement("os-save-status");v.className="os-window__status",v.setAttribute("mode","icon"),v.setAttribute("variant","ring"),v.setAttribute("phase","idle"),v.setAttribute("data-os-activity-indicator","");const A=document.createElement("span");A.className="os-window__activity-status",A.setAttribute("role","status"),A.setAttribute("aria-live","polite"),n.appendChild(A),n.appendChild(v),n.appendChild(c),n.appendChild(r),n.appendChild(d),n.appendChild(u),n.appendChild(E),n.appendChild(w),o&&s&&s.children.length>0&&(n.appendChild(o),n.appendChild(s)),n.appendChild(y),n.appendChild(g),n.appendChild(C),n.appendChild(b);for(const p of Array.from(n.children))p.setAttribute("data-os-default-chrome","");const x=document.createElement("div");if(x.className=`os-window__body ${Tn}`,vi(x),e.native)x.classList.add("os-window__body--native");else{const p=document.createElement("iframe");p.className="os-window__iframe",p.setAttribute("name",`os-frame-${e.id}`);const D=e.url?xe(e.url):null;p.src=D??"about:blank",x.appendChild(p);const Fe=()=>{P(e.id),at(p)};p.addEventListener("load",Fe)}const M=ki(e);x.appendChild(M),Ei(x,M);for(const p of wi())x.appendChild(p);Ee(e.id);const ge=[];for(const p of["ne","nw","se","sw"]){const D=document.createElement("div");D.className=`os-window__resize-handle os-window__resize-handle--${p}`,D.dataset.dir=p,D.setAttribute("aria-hidden","true"),ge.push(D)}t.appendChild(l),t.appendChild(n),t.appendChild(_);{const p=document.createElement("nav");p.className="os-window__tabs";const D=document.createElement("span");D.className="os-window__tab-plate",D.setAttribute("aria-hidden","true");const Fe=document.createElement("span");Fe.className="os-window__tab-plate-fill";const Lo=document.createElement("span");Lo.className="os-window__tab-plate-joint",D.appendChild(Fe),D.appendChild(Lo),p.appendChild(D),e.native?p.dataset.tablistLabel=Q(m("%s sections"),e.title):p.dataset.tablistLabel=Q(m("%s sub-pages"),e.title);const Ue=(e.submenu??[]).filter(Tt=>!Tt.offSite);if(Ue.length>0&&e.url){const Tt=G(e.url),Io=e.parentUrl??e.url,tl=G(Io),nl=Ue.some(be=>G(be.url)===tl)?[...Ue]:[{title:e.selfLabel||e.title,url:Io},...Ue];for(const be of nl){const H=document.createElement("button");H.className="os-window__tab",H.dataset.kind="submenu",H.setAttribute("type","button"),H.setAttribute("role","tab"),H.dataset.url=be.url,H.textContent=be.title,G(be.url)===Tt?(H.classList.add("os-window__tab--active"),H.setAttribute("aria-selected","true")):H.setAttribute("aria-selected","false"),p.appendChild(H)}}oe(p),t.appendChild(p)}t.appendChild(x);for(const p of ge)t.appendChild(p);return Si(t,e),t}function Li(e,t){let n;try{n=new URL(t,window.location.origin)}catch{return null}const o=Gt(t);let s=null,i=-1;for(const r of e){const d=r.dataset.url;if(!d||Gt(d)!==o)continue;let a;try{a=new URL(d,window.location.origin)}catch{continue}let l=0,c=!1;for(const[u,g]of a.searchParams)if(!(u==="openstation_chromeless"||u==="desktop_mode_portal")){if(n.searchParams.get(u)!==g){c=!0;break}l++}!c&&l>i&&(s=r,i=l)}return s}function ut(e,t){const n=e.element.querySelectorAll('.os-window__tab[data-kind="submenu"]');if(!n.length)return;if(e._activeTabId!=="primary"){for(const i of n)i.classList.remove("os-window__tab--active"),i.setAttribute("aria-selected","false");return}const o=G(t);let s=null;for(const i of n){const r=i.dataset.url;if(r&&G(r)===o){s=i;break}}if(s||(s=Li(n,t)),!s){if(Array.from(n).some(d=>d.classList.contains("os-window__tab--active")))return;let r=!1;try{const d=new URL(t,window.location.origin);r=d.pathname.endsWith("/admin.php")&&d.searchParams.has("page")}catch{return}if(!r||!n[0])return;s=n[0]}for(const i of n){const r=i===s;i.classList.toggle("os-window__tab--active",r),i.setAttribute("aria-selected",r?"true":"false")}}function Dn(e,t,n){if(!e.iframe)return;const o=e.element.querySelector(".os-window__tabs"),s=e.element.querySelector(".os-window__body");if(!o||!s)return;Ii(e,o);const i=`ext-${++e._externalTabSeq}`,r=document.createElement("button");r.className="os-window__tab os-window__tab--external",r.dataset.kind="external",r.dataset.tabId=i,r.setAttribute("type","button"),r.setAttribute("role","tab"),r.setAttribute("aria-selected","false"),r.title=t;const d=document.createElement("span");d.className="os-window__tab-label",d.textContent=n,r.appendChild(d);const a=document.createElement("os-tab-chip");a.setAttribute("variant","detach"),a.dataset.tabAction="detach",a.dataset.tabId=i,a.setAttribute("aria-label",m("Open in a new browser tab")),a.title=m("Open in a new browser tab"),r.appendChild(a);const l=document.createElement("os-tab-chip");l.setAttribute("variant","close"),l.dataset.tabAction="close",l.dataset.tabId=i,l.setAttribute("aria-label",m("Close tab")),l.title=m("Close tab"),r.appendChild(l),o.appendChild(r),oe(o);const c=document.createElement("iframe");c.className="os-window__iframe os-window__iframe--external",c.dataset.tabId=i,c.style.display="none",c.src=t,s.appendChild(c);let u=!1;const g=()=>{u=!0};c.addEventListener("load",g,{once:!0});const b=window.setTimeout(()=>{u||(c.removeEventListener("load",g),Ri(e,i))},hi),_=()=>{c.removeEventListener("load",g),window.clearTimeout(b)};e._externalTabs.set(i,{tabEl:r,iframe:c,url:t,label:n,cancelProbe:_}),le(e,i),r.scrollIntoView({behavior:"smooth",inline:"end",block:"nearest"}),e._emitChange("state")}function Ii(e,t){if(t.querySelector('[data-kind="main"]')||t.querySelector('[data-kind="submenu"]'))return;const n=document.createElement("button");n.className="os-window__tab os-window__tab--main os-window__tab--active",n.dataset.kind="main",n.setAttribute("type","button"),n.setAttribute("role","tab"),n.setAttribute("aria-selected","true"),n.textContent=e.config.title||"Main",t.prepend(n),oe(t)}function le(e,t){if(e._activeTabId===t)return;e._activeTabId=t,e.iframe&&(e.iframe.style.display=t==="primary"?"":"none");for(const[o,s]of e._externalTabs)s.iframe.style.display=t===o?"":"none";e.element.querySelectorAll(".os-window__tab").forEach(o=>{let s;o.dataset.kind==="main"?s=t==="primary":o.dataset.kind==="external"?s=o.dataset.tabId===t:s=t==="primary"&&o.classList.contains("os-window__tab--active"),o.classList.toggle("os-window__tab--active",s),o.setAttribute("aria-selected",s?"true":"false")})}function ht(e,t){const n=e._externalTabs.get(t);n&&(n.cancelProbe(),n.tabEl.remove(),n.iframe.remove(),e._externalTabs.delete(t),e._activeTabId===t&&le(e,"primary"),e._externalTabs.size===0&&e.element.querySelector(".os-window__tab--main")?.remove(),oe(e.element.querySelector(".os-window__tabs")),e._emitChange("state"))}function Ti(e,t){const n=e._externalTabs.get(t);if(!n)return;let o=n.url;try{const s=n.iframe.contentWindow?.location.href;s&&s!=="about:blank"&&(o=s)}catch{}window.open(o,"_blank","noopener"),ht(e,t)}function Ri(e,t){const n=e._externalTabs.get(t);if(!n)return;const{url:o,label:s}=n;ht(e,t),it({message:Q(m(`Opened "%s" in a new browser tab — this site doesn't allow embedding.`),s),action:{label:m("Open"),onClick:()=>{window.open(o,"_blank","noopener")}}}),window.open(o,"_blank","noopener")}function Ni(e){return e._externalTabs.size}function Oi(e){const t=[];for(const n of e._externalTabs.values()){let o=n.url;try{const s=n.iframe.contentWindow?.location.href;s&&s!=="about:blank"&&(o=s)}catch{}t.push({url:o,label:n.label})}return t}function Di(e,t){const n=t.target,o=n.closest("[data-tab-action]");if(o){t.stopPropagation();const d=o.dataset.tabAction,a=o.dataset.tabId;if(!a)return;d==="close"?ht(e,a):d==="detach"&&Ti(e,a);return}const s=n.closest(".os-window__tab");if(!s)return;t.stopPropagation();const i=s.dataset.kind,r=s.dataset.tabId;if(i==="external"&&r){le(e,r);return}if(i==="main"){le(e,"primary");return}if(i==="panel"&&s.dataset.panel){Ke(e.element,s.dataset.panel);return}if(s.dataset.url){const d=xe(s.dataset.url);d&&e.iframe&&(e.markContentLoading(),e.iframe.src=d),le(e,"primary"),ut(e,s.dataset.url)}}const ft=1;function Wi(e,t){const n=Math.max(0,e.scrollWidth-e.clientWidth);if(n<=ft){delete e.dataset.overflow;return}const o=Math.abs(e.scrollLeft),s=o<=ft,i=o>=n-ft,r=t??window.getComputedStyle(e).direction==="rtl",d=r?!i:!s,a=r?!s:!i;d&&a?e.dataset.overflow="both":d?e.dataset.overflow="left":a?e.dataset.overflow="right":delete e.dataset.overflow}function Mi(e){let t=null,n=null;const o=()=>{n===null&&(n=window.requestAnimationFrame(()=>{n=null,t===null&&(t=window.getComputedStyle(e).direction==="rtl"),Wi(e,t),zt(e),Ft(e)}))},s=()=>{t=null,o()};e.addEventListener("scroll",o,{passive:!0});const i=typeof ResizeObserver>"u"?null:new ResizeObserver(s);i?.observe(e);const r=typeof MutationObserver>"u"?null:new MutationObserver(s);return r?.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),o(),()=>{e.removeEventListener("scroll",o),i?.disconnect(),r?.disconnect(),n!==null&&(window.cancelAnimationFrame(n),n=null)}}const Pi=I("desktop-mode/native-url-remap",()=>({remaps:[],deps:null}));function Wn(e){const{deps:t,remaps:n}=Pi.state;if(!t||!e)return!1;let o;try{o=new URL(e,t.adminUrl)}catch{return!1}const s=t.getSnapshot();for(const i of n){if(!i.matches(e,o)||i.enabled&&!i.enabled(s))continue;if(i.onMatch)try{i.onMatch(e,o)}catch(a){console.warn(`[openstation] URL remap onMatch hook threw for "${i.id}":`,a)}let r;if(i.params)try{r=i.params(e,o)??void 0}catch(a){console.warn(`[openstation] URL remap params hook threw for "${i.id}":`,a)}if(r?t.openById(i.nativeWindowId,{params:r}):t.openById(i.nativeWindowId))return!0}return!1}const $i=I("desktop-mode/destructive-admin-actions",()=>({entries:[]}));function Hi(e,t){for(const n of $i.state.entries)try{if(n.matches(e,t))return n.id}catch(o){console.warn(`[openstation] destructive-action predicate threw for "${n.id}":`,o)}return null}const zi=32,Fi=64,Ui=/^[a-z0-9_/-]+$/,F=I("desktop-mode/window-links",()=>({contentByWindow:new Map,focusSeq:new Map,seq:0,listeners:new Set,lastGroupsSignature:"",manager:null,started:!1}));function Le(e){return`${e.type}:${e.id}`}function Mn(e){return e.root?Le(e.root):Le(e)}function Pn(e){const t=o=>typeof o=="number"&&Number.isFinite(o)||typeof o=="string"&&o.trim()!=="",n=o=>typeof o=="string"&&Ui.test(o.trim().toLowerCase());return jo(e,[{field:"type",valid:o=>n(o.type),message:"must match /^[a-z0-9_/-]+$/ — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-type"},{field:"id",valid:o=>t(o.id),message:"must be a finite number or non-empty string"},{field:"root",valid:o=>o.root===void 0||!!o.root&&typeof o.root=="object"&&n(o.root.type)&&t(o.root.id),message:"when present, must be { type, id } with the same shapes as the ref itself"},{field:"related",valid:o=>o.related===void 0||Array.isArray(o.related)&&o.related.every(s=>!!s&&typeof s=="object"&&typeof s.id=="string"&&s.id.trim()!==""&&typeof s.group=="string"&&s.group.trim()!==""&&typeof s.label=="string"&&s.label.trim()!==""&&typeof s.url=="string"&&s.url.trim()!==""&&(s.groupLabel===void 0||typeof s.groupLabel=="string")&&(s.icon===void 0||typeof s.icon=="string")&&(s.count===void 0||typeof s.count=="number"&&Number.isFinite(s.count))),message:"when present, must be an array of { id, group, label, url, groupLabel?, icon?, count? } entries with non-empty strings"},{field:"links",valid:o=>o.links===void 0||Array.isArray(o.links)&&o.links.every(s=>!!s&&typeof s=="object"&&n(s.type)&&t(s.id)&&(s.rel===void 0||s.rel==="references"||s.rel==="child")),message:"when present, must be an array of { type, id, rel?: 'references'|'child' } entries"}])}function Bi(e,t){const n={type:e.type.trim().toLowerCase(),id:e.id,source:t};if(e.root&&(n.root={type:e.root.type.trim().toLowerCase(),id:e.root.id}),Array.isArray(e.links)&&e.links.length>0&&(n.links=e.links.slice(0,zi).map(o=>{const s={type:o.type.trim().toLowerCase(),id:o.id};return o.rel==="child"&&(s.rel="child"),s})),typeof e.label=="string"&&e.label!==""&&(n.label=e.label),typeof e.previewUrl=="string"&&e.previewUrl!=="")try{new URL(e.previewUrl,window.location.origin).origin===window.location.origin&&(n.previewUrl=e.previewUrl)}catch{}return Array.isArray(e.related)&&e.related.length>0&&(n.related=e.related.slice(0,Fi).map(o=>{const s={id:o.id,group:o.group,label:o.label,url:o.url};return typeof o.groupLabel=="string"&&o.groupLabel!==""&&(s.groupLabel=o.groupLabel),typeof o.icon=="string"&&o.icon!==""&&(s.icon=o.icon),typeof o.count=="number"&&(s.count=o.count),s})),n}function $n(e){return!e||!e.related?"":e.related.map(t=>`${t.id}\0${t.group}\0${t.label}\0${t.url}\0${t.groupLabel??""}\0${t.icon??""}\0${t.count??""}`).join("|")}function pt(e){return e?[Le(e),Mn(e),...(e.links??[]).map(t=>Le(t)+(t.rel==="child"?"!child":""))].join("|"):""}function Gi(e,t,n={}){const o=n.source??"api";if(typeof e!="string"||e===""){Ye("WindowContentRef",["windowId (must be a non-empty string)"],t);return}let s=null;if(t!=null){const d=Pn(t);if(d.length>0){o==="api"&&Ye("WindowContentRef",d,t),jt("WindowContentRef",d,t);return}s=Bi(t,o)}if(s=L(h.WINDOW_LINKS_CONTENT,s,{windowId:e,source:o}),s!==null&&(!s||Pn(s).length>0)){jt("WindowContentRef",["filter (os.window-links.content returned an invalid ref)"],s);return}const i=F.state.contentByWindow.get(e)??null;if(s===null&&i===null||s!==null&&i!==null&&pt(s)===pt(i)&&s.label===i.label&&s.previewUrl===i.previewUrl&&$n(s)===$n(i))return;s===null?F.state.contentByWindow.delete(e):F.state.contentByWindow.set(e,s);const r={windowId:e,content:s,previous:i,source:o};document.dispatchEvent(new CustomEvent("os-window-content-changed",{detail:r})),f(h.WINDOW_CONTENT_CHANGED,r),Ki(),Vi()}function qi(){const e=new Map;for(const[s,i]of F.state.contentByWindow){const r=Mn(i);let d=e.get(r);d||(d={key:r,root:i.root?{...i.root}:{type:i.type,id:i.id},rootWindowIds:[],children:[]},e.set(r,d)),i.root?d.children.push({windowId:s,content:i}):d.rootWindowIds.push(s)}const t=F.state.focusSeq;for(const s of e.values())s.rootWindowIds.sort((i,r)=>(t.get(r)??0)-(t.get(i)??0));const n=Array.from(e.values()),o=L(h.WINDOW_LINK_GROUPS,n);return Array.isArray(o)?o:(typeof console<"u"&&console.warn("[openstation] `os.window-links.groups` filter returned a non-array; falling back to computed groups."),n)}function Vi(){for(const e of Array.from(F.state.listeners))try{e()}catch(t){typeof console<"u"&&console.error("[openstation] window-links listener threw:",t)}}function ji(){return Array.from(F.state.contentByWindow).map(([e,t])=>`${e}=${pt(t)}`).sort().join(";")}function Ki(){const e=ji();if(e===F.state.lastGroupsSignature)return;F.state.lastGroupsSignature=e;const n={groups:qi()};document.dispatchEvent(new CustomEvent("os-window-link-groups-changed",{detail:n})),f(h.WINDOW_LINK_GROUPS_CHANGED,n)}const Yi="desktop-mode-my-wordpress",Xi=Object.freeze({userId:null,userName:"",requestedAt:0});function Hn(){return window.wp?.os}let Ie=null;function Zi(){if(Ie)return Ie;const e=Hn()?.createSharedStore;return typeof e!="function"?null:(Ie=e("desktop-mode/my-wordpress/footprint-target",()=>({...Xi})),Ie)}function Qi(e,t=""){const n=Zi();if(n){n.state.userId=e,n.state.userName=t,n.state.requestedAt=Date.now(),n.notify();return}window._wpdFootprintTarget={userId:e,userName:t,requestedAt:Date.now()}}function Ji(e){const t=Number(e.userId);!Number.isFinite(t)||t<=0||(Qi(t,e.userName??""),Hn()?.openWindow?.(Yi,{source:"my-wordpress/open-user-footprint"}))}const W=window.location.origin,zn=I("desktop-mode/admin-link-deps",()=>({deps:null}));function er(e,t){if(t.origin!==W||!e.iframe||t.source!==e.iframe.contentWindow)return;const n=t.data;if(!(!n||typeof n.type!="string")){if(n.type==="os-title-change"&&typeof n.title=="string"&&e.setTitle(n.title),n.type==="os-content-identity"&&Gi(e.id,n.identity??null,{source:"bridge"}),n.type==="os-window-publish"&&typeof n.channel=="string"&&n.channel!==""&&Dt(e.id,n.channel,n.payload),typeof n.type=="string"&&n.type.startsWith("os-bridge-")&&window.__openStationConnectionBridge?.routeIncomingFromIframe(n,e.id),n.type==="os-ready"&&(e._iframeBridgeReady=!0,e._resetActivity(),P(e.id),f(h.IFRAME_READY,{windowId:e.id})),n.type==="os-bridge-beforeunload-response"){if(e._isDestroyed)return;e._closePending=!1,e._iframeCloseTimeout&&(clearTimeout(e._iframeCloseTimeout),e._iframeCloseTimeout=null),n.prevent?Promise.resolve().then(()=>el).then(({osConfirm:o})=>o({title:typeof n.message=="string"&&n.message?n.message:m("Unsaved changes"),message:m("You have unsaved changes. Are you sure you want to close this window?"),confirmLabel:m("Close window"),danger:!0})).then(o=>{o&&e.destroy()}).catch(()=>{e.destroy()}):e.destroy()}if(n.type==="os-navigate"&&typeof n.url=="string"&&n.url!==""&&nr(e,n.url,n.target==="new"?"new":"self"),n.type==="os-iframe-admin-link"&&typeof n.url=="string"&&n.url!==""){const o=zn.state.deps;if(Wn(n.url))e.close();else if(o){const s=typeof n.label=="string"?n.label:"";ar(e,n.url,s,o,n.newContext===!0)}}if(n.type==="os-open-user-footprint"&&typeof n.userId=="number"&&n.userId>0&&Ji({userId:n.userId,userName:typeof n.userName=="string"?n.userName:""}),n.type==="os-notification"&&typeof n.title=="string"&&n.title!==""&&fr(n.title,typeof n.body=="string"?n.body:""),n.type==="os-focus-request"&&(e.element.classList.contains("os-window--overview")||e.onFocusRequest?.(e)),n.type==="os-screen-meta"&&Array.isArray(n.panels)&&pr(e,n.panels),n.type==="os-screen-meta-state"&&mr(e,typeof n.open=="string"?n.open:null),n.type==="os-external-link"&&typeof n.url=="string"&&n.url!==""){const o=typeof n.label=="string"&&n.label!==""?n.label:n.url;Dn(e,n.url,o)}if(n.type==="os-iframe-error"&&f(h.IFRAME_ERROR,{windowId:e.id,kind:n.kind==="unhandledrejection"?"unhandledrejection":"error",message:typeof n.message=="string"?n.message:"",filename:typeof n.filename=="string"?n.filename:null,lineno:typeof n.lineno=="number"?n.lineno:null,colno:typeof n.colno=="number"?n.colno:null,stack:typeof n.stack=="string"?n.stack:null}),n.type==="os-chrome-theme"&&n.tokens&&typeof n.tokens=="object")try{e.setAppearanceTheme(n.tokens)}catch(o){f(h.SHELL_ERROR,{scope:"window-bridge-chrome-theme",windowId:e.id,error:o})}if(n.type==="os-chrome-controls"&&n.config&&typeof n.config=="object")try{e.setAppearanceControls(n.config)}catch(o){f(h.SHELL_ERROR,{scope:"window-bridge-chrome-controls",windowId:e.id,error:o})}if(n.type==="os-chrome-slot"&&typeof n.slot=="string"&&typeof n.html=="string")try{e.setAppearanceSlot(n.slot,{html:n.html})}catch(o){f(h.SHELL_ERROR,{scope:"window-bridge-chrome-slot",windowId:e.id,error:o})}if(n.type==="os-iframe-activity"){if(n.phase==="start")e._markActivityStart();else if(n.phase==="end"){const o=!!n.failed,s=typeof n.status=="number"?n.status:0;e._markActivitySettled(!o,o?tr(s):void 0)}}if(n.type==="os-iframe-network"){const o={windowId:e.id,method:typeof n.method=="string"?n.method:"GET",url:typeof n.url=="string"?n.url:"",status:typeof n.status=="number"?n.status:0,duration:typeof n.duration=="number"?n.duration:0,failed:!!n.failed};n.requestHeaders&&typeof n.requestHeaders=="object"&&(o.requestHeaders=n.requestHeaders),n.responseHeaders&&typeof n.responseHeaders=="object"&&(o.responseHeaders=n.responseHeaders),f(h.IFRAME_NETWORK_COMPLETED,o)}}}function tr(e){return e<=0?m("Request failed."):Q(m("Request failed (HTTP %d)."),e)}function nr(e,t,n){let o;try{o=new URL(t,W)}catch{return}if(o.origin===W){if(n==="new"){window.open(o.toString(),"_blank","noopener,noreferrer");return}e.iframe&&(e.iframe.src=o.toString())}}const or=new Set(["trash","untrash","delete","spam","unspam","spamcomment","unspamcomment","trashcomment","untrashcomment","deletecomment","approvecomment","unapprovecomment"]);function sr(e){const t=e.searchParams.get("action");return t&&or.has(t)&&(e.searchParams.has("_wpnonce")||e.searchParams.has("_wp_nonce"))?!0:Hi(e.toString(),e)!==null}function Fn(e,t){if(e.searchParams.has("_wp_http_referer"))return e;let n="";try{n=t.iframe?.contentWindow?.location.href??""}catch{}if(n||(n=t.config.url||""),!n)return e;try{const o=new URL(n,W);if(o.origin!==W)return e;const s=new URL(e.href),i=new URL(o.href);return i.searchParams.delete("openstation_chromeless"),s.searchParams.set("_wp_http_referer",i.pathname+(i.search?i.search:"")),s}catch{return e}}function ir(e,t){let n="";try{n=e.getCurrentUrl?.()??""}catch{return""}if(!n||n.startsWith("#")||n==="about:blank")return"";try{const o=new URL(n,t.adminUrl);return o.origin!==W?"":t.deriveSlug(o.toString())}catch{return""}}function rr(e,t,n){if(t===(e.config.baseId||e.id))return!0;const o=ir(e,n);return o!==""&&o===t}function ar(e,t,n,o,s=!1){let i;try{i=new URL(t,o.adminUrl)}catch{return}if(i.origin!==W)return;if(s){mt(e,i,n,o);return}const r=i.toString(),d=o.deriveSlug(r),a=rr(e,d,o);if(!a&&sr(i)){const l=Fn(i,e),c=e.iframe?.contentWindow;if(c)try{c.location.assign(l.href)}catch{e.iframe&&(e.iframe.src=l.href)}return}if(a){const l=e.iframe?.contentWindow;if(l)try{l.location.assign(r)}catch{e.iframe&&(e.iframe.src=r)}return}mt(e,i,n,o)}function mt(e,t,n,o){const s=t.toString(),i=o.deriveSlug(s),r=o.findDockEntry(s),d=n.trim(),a=r?.title||(d!==""?d:i),l=Fn(t,e);o.openWindow({id:i,baseId:i,url:l.toString(),parentUrl:r?.url??s,title:a,titleFromPage:!r,icon:r?.icon??"dashicons-admin-generic",submenu:r?.submenu,selfLabel:r?.selfLabel,multi:r?.multi})}function Te(e){if(!e||e.startsWith("#"))return"";try{const t=new URL(e,W);return t.origin!==W?"":t.pathname.split("/").pop()??""}catch{return""}}const lr=new Set(["revision.php"]);function cr(e,t){try{const o=e.iframe?.contentWindow?.performance?.getEntriesByType?.("navigation")?.[0]?.name??"";if(o&&Te(o)===Te(t))return o}catch{}return t}function dr(e,t){const n=Te(e.config.url??"");if(!n||!lr.has(n))return!1;const o=Te(t);if(!o||o===n)return!1;if(Wn(t))return e.close(),!0;const s=zn.state.deps;if(!s)return!1;let i;try{i=new URL(cr(e,t),s.adminUrl)}catch{return!1}return i.origin!==W?!1:(mt(e,i,"",s),e.close(),!0)}function ur(e){if(!e.config.titleFromPage)return;let t="";try{t=e.iframe?.contentDocument?.title??""}catch{return}const n=hr(t);n!==""&&n!==e.config.title&&e.setTitle(n)}function hr(e){const t=e.trim(),n=t.indexOf(" ‹ ");return(n>0?t.slice(0,n):t).trim()}function fr(e,t){const n=t!==""?`${e} — ${t}`:e;it({message:n})}function pr(e,t){const n=e.element.querySelector(".os-window__screen-meta");if(!n)return;n.innerHTML="";const o={"screen-options":{icon:"dashicons-admin-generic",label:"Screen Options"},help:{icon:"dashicons-editor-help",label:"Help"}};for(const s of t){const i=o[s];if(!i)continue;const r=document.createElement("button");r.className="os-window__meta-btn",r.setAttribute("type","button"),r.setAttribute("aria-label",i.label),r.setAttribute("aria-pressed","false"),r.dataset.panel=s,r.innerHTML=`<span class="dashicons ${i.icon}" aria-hidden="true"></span>`,r.addEventListener("click",d=>{d.stopPropagation(),e.iframe?.contentWindow?.postMessage({type:"os-toggle-panel",panel:s},W)}),n.appendChild(r)}}function mr(e,t){const n=e.element.querySelector(".os-window__screen-meta");n&&n.querySelectorAll(".os-window__meta-btn").forEach(o=>{const s=o.dataset.panel===t;o.classList.toggle("os-window__meta-btn--active",s),o.setAttribute("aria-pressed",s?"true":"false")})}const Un=I("desktop-mode/title-bar-buttons-registry",()=>({registry:new Map,listeners:new Set})),gr=Un.state.registry,gt=Un.state.listeners;function br(){return Array.from(gr.values()).sort((e,t)=>(e.order??100)-(t.order??100))}function _r(e){const t=[],n=[];for(const o of br()){try{if(!o.match(e))continue}catch{continue}o.placement==="right"?n.push(o):t.push(o)}return{left:t,right:n}}function wr(e){return gt.add(e),()=>{gt.delete(e)}}function yr(){const e=Array.from(gt);for(const t of e)try{t()}catch(n){typeof console<"u"&&console.error("[openstation] title-bar-button registry listener threw:",n)}}typeof document<"u"&&document.addEventListener("os-settings-save-lifecycle",e=>{const t=e.detail;t&&t.phase==="saved"&&yr()});const vr=/^dashicons-[a-z0-9-]+$/i,Er=/^\s*<svg[\s>]/i;function Bn(e,t){if(t){if(vr.test(t)){const n=document.createElement("span");n.className=`dashicons ${t}`,n.setAttribute("aria-hidden","true"),e.appendChild(n);return}if(Er.test(t)){const n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.innerHTML=t,e.appendChild(n);return}e.setAttribute("icon",t)}}const Gn=I("desktop-mode/window-themes-registry",()=>({registry:new Map,listeners:new Set})),Ar=Gn.state.registry,qn=Gn.state.listeners;function Vn(){return Array.from(Ar.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}function Sr(e){let t=null;for(const n of Vn()){try{if(!n.match(e))continue}catch(o){typeof console<"u"&&console.warn(`[openstation] window-theme "${n.id}" match() threw — skipping`,o);continue}t=n}return t}function Cr(e){return qn.add(e),()=>{qn.delete(e)}}const Re=new WeakMap;function kr(e,t){let n=null,o={};if(t&&"tokens"in t&&t.tokens)n=null,o={...t.tokens};else if(t&&"themeId"in t&&t.themeId){const i=Lr(t.themeId);i&&(n=i.id,o={...i.tokens})}else{const i=Sr(e);i&&(n=i.id,o={...i.tokens})}const s=L(h.WINDOW_CHROME_THEME,o,{windowId:e.id,themeId:n,config:e.config});return{themeId:n,tokens:s}}function bt(e,t){const n=e.element;if(!n)return;const o=Re.get(n),{themeId:s,tokens:i}=kr(e,t);if(o){for(const d of o.keys)if(!(d in i))try{n.style.removeProperty(d)}catch{}}const r=new Set;for(const[d,a]of Object.entries(i))try{n.style.setProperty(d,a),r.add(d)}catch(l){f(h.SHELL_ERROR,{scope:"window-theme-apply",windowId:e.id,key:d,error:l})}Re.set(n,{themeId:s,keys:r}),f(h.WINDOW_CHROME_THEME_CHANGED,{windowId:e.id,themeId:s,tokens:i})}function xr(e){const t=e.element;if(!t)return;const n=Re.get(t);if(n){for(const o of n.keys)try{t.style.removeProperty(o)}catch{}Re.delete(t)}}function Lr(e){for(const t of Vn())if(t.id===e)return{id:t.id,tokens:t.tokens};return null}const jn=I("desktop-mode/window-controls-registry",()=>({registry:new Map,listeners:new Set})),Ir=jn.state.registry,Kn=jn.state.listeners;function Tr(){return Array.from(Ir.values()).sort((e,t)=>{const n=e.order??100,o=t.order??100;return n!==o?n-o:e.id.localeCompare(t.id)})}function Rr(e){const t=[],n=[],o=[];for(const s of Tr()){try{if(!s.match(e))continue}catch(r){typeof console<"u"&&console.warn(`[openstation] window-control "${s.id}" match() threw — skipping`,r);continue}const i=s.placement??"left";i==="right"?n.push(s):i==="controls"?o.push(s):t.push(s)}return{left:t,right:n,controls:o}}function Nr(e){return Kn.add(e),()=>{Kn.delete(e)}}function Or(e,t){const n=Rr(e),o=new Set(t?.hide??[]);let s=n.left.filter(l=>!o.has(l.id)),i=n.right.filter(l=>!o.has(l.id)),r=n.controls.filter(l=>!o.has(l.id));if(t?.custom){for(const l of t.custom){if(o.has(l.id))continue;const c={id:l.id,label:l.label,icon:l.icon,placement:l.placement??"controls",order:l.order??100,match:()=>!0,onClick:l.onClick?(u,g)=>l.onClick(g):void 0,render:l.render?u=>l.render(u):void 0};c.placement==="left"?s.push(c):c.placement==="right"?i.push(c):r.push(c)}s=_t(s),i=_t(i),r=_t(r)}t?.order&&t.order.length>0&&(r=Dr(r,t.order));const d=t?.placement??"right",a={windowId:e.id,config:e.config};return s=L(h.WINDOW_CHROME_CONTROLS,s,{...a,placement:"left"}),i=L(h.WINDOW_CHROME_CONTROLS,i,{...a,placement:"right"}),r=L(h.WINDOW_CHROME_CONTROLS,r,{...a,placement:"controls"}),{left:s,right:i,controls:r,placement:d}}function _t(e){return[...e].sort((t,n)=>{const o=t.order??100,s=n.order??100;return o!==s?o-s:t.id.localeCompare(n.id)})}function Dr(e,t){const n=new Map;for(const i of e)n.set(i.id,i);const o=[],s=new Set;for(const i of t){const r=n.get(i);r&&!s.has(i)&&(o.push(r),s.add(i))}for(const i of e)s.has(i.id)||o.push(i);return o}function Wr(e,t){const n=document.createElement("os-window-button");n.setAttribute("aria-label",e.label||e.id),n.classList.add("os-window__btn");const o=Mr(e.id);if(n.classList.add(`os-window__btn--${o}`),e.id==="core/close"&&n.setAttribute("danger",""),typeof e.render=="function")try{e.render(n,t)}catch(s){return f(h.SHELL_ERROR,{scope:"window-control-render",id:e.id,windowId:t.id,error:s}),{element:n}}else if(ot(n,e.id)||Bn(n,e.icon??""),typeof e.onClick=="function"){const s=i=>{i.stopPropagation();try{e.onClick(t,i)}catch(r){f(h.SHELL_ERROR,{scope:"window-control-onclick",id:e.id,windowId:t.id,error:r})}};return n.addEventListener("os-button-activate",s),{element:n,teardown:()=>{n.removeEventListener("os-button-activate",s)}}}return{element:n}}function Mr(e){return e.startsWith("core/")?e.slice(5):e.replace(/\//g,"-")}function Pr(e,t){const n=[];for(;t.firstChild;)t.removeChild(t.firstChild);const o=Or(e,e.config.appearance?.controls);t.classList.toggle("os-window__controls--left",o.placement==="left");for(const s of o.controls){const{element:i,teardown:r}=Wr(s,e);t.appendChild(i),r&&n.push(r)}return f(h.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"controls"}),()=>{for(const s of n)try{s()}catch{}}}function $r(e){if(!e)return 214;let t=5381;for(let n=0;n<e.length;n++)t=Math.imul(t,33)+e.charCodeAt(n);return(t%360+360)%360}function Hr(e){return typeof e!="string"||e===""||e.length>4096||!/^(https?:\/\/|data:image\/)/i.test(e)?!1:!/['"()\\<>\s]/.test(e)}function Yn(e,t,n){if(!Hr(t))return!1;const o=`url("${t}") center / contain no-repeat`;return e.style.backgroundImage="none",e.style.backgroundColor=n,e.style.setProperty("-webkit-mask",o),e.style.setProperty("mask",o),!0}const Xn="data:image/svg+xml;base64,",Ne=new Map;function zr(e){const t=Ne.get(e);if(t!==void 0)return t;let n=!1;try{n=atob(e.slice(Xn.length)).includes("currentColor")}catch{}return Ne.size>=256&&Ne.clear(),Ne.set(e,n),n}function Fr(e,t){const n=t.className??"",o=t.title??"";let s=null;if(t.slot){const a=yn(t.slot);a!==null&&(e=a),s=vn(t.slot)}if(typeof e=="string"&&e.startsWith("dashicons-")){const a=document.createElement("span");return a.className=`dashicons ${e} ${n}`.trim(),a.setAttribute("aria-hidden","true"),s!==null&&(a.style.color=s),a}if(s!==null&&typeof e=="string"){const a=document.createElement("span");if(a.className=n,a.setAttribute("aria-hidden","true"),a.style.display="inline-block",Yn(a,e,s))return a}if(typeof e=="string"&&e.startsWith("data:image/svg+xml;base64,")){const a=e.slice(Xn.length);if(/^[A-Za-z0-9+/=]+$/.test(a)){const l=document.createElement("span");return l.className=n,l.setAttribute("aria-hidden","true"),l.style.display="inline-block",zr(e)&&Yn(l,e,"currentColor")||(l.style.backgroundImage=`url("${e}")`,l.style.backgroundRepeat="no-repeat",l.style.backgroundPosition="center",l.style.backgroundSize="contain"),l}}if(typeof e=="string"&&/^data:image\/(png|jpeg|jpg|gif|webp|x-icon|vnd\.microsoft\.icon);base64,/i.test(e)){const a=e.indexOf(","),l=a>=0?e.slice(a+1):"";if(/^[A-Za-z0-9+/=]+$/.test(l))return Zn(e,n)}if(typeof e=="string"&&(e.startsWith("http://")||e.startsWith("https://")))return Zn(e,n);const i=document.createElement("span");i.className=`${n} os-icon-letter`.trim(),i.setAttribute("aria-hidden","true");const r=Ur(o);i.textContent=r;const d=$r(o);return i.style.backgroundColor=`hsl( ${d}, 60%, 45% )`,i.style.color="#fff",i.style.display="inline-flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.fontWeight="600",i.style.borderRadius="4px",i}function Zn(e,t){const n=document.createElement("img");return n.className=t,n.src=e,n.alt="",n.setAttribute("aria-hidden","true"),n.draggable=!1,n}function Ur(e){const t=(e??"").trim();if(t==="")return"?";const n=t.split(/\s+/);if(n.length>=2)return(n[0][0]+n[1][0]).toUpperCase();const o=n[0];return o.length>=2?o.slice(0,2).toUpperCase():o.toUpperCase()}const Qn=I("desktop-mode/window-slots-registry",()=>({registry:new Map,listeners:new Set})),Br=Qn.state.registry,Jn=Qn.state.listeners;function Gr(){return Array.from(Br.values()).sort((e,t)=>{const n=e.order??100,o=t.order??100;return n!==o?n-o:e.id.localeCompare(t.id)})}function qr(e,t){const n=[];for(const o of Gr())if(o.slot===t){try{if(!o.match(e))continue}catch(s){typeof console<"u"&&console.warn(`[openstation] window-slot "${o.id}" match() threw — skipping`,s);continue}n.push(o)}return n}function Vr(e){return Jn.add(e),()=>{Jn.delete(e)}}const eo=["before-titlebar","before-icon","icon","title","after-title","before-controls","after-controls","after-titlebar"],to=new WeakMap;function no(e,t){return e.querySelector(`[data-slot="${t}"]`)}function jr(e){const t=new Map;for(const n of eo){const o=no(e,n);o&&t.set(n,Array.from(o.childNodes).map(s=>s.cloneNode(!0)))}return t}function ce(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Kr(e,t){ce(e);for(const n of t)e.appendChild(n.cloneNode(!0))}function Yr(e,t){const n=e.querySelector(".os-window__title");n&&(n.textContent=t)}function Xr(e){const t=[],n=e.element;if(!n)return()=>{};let o=to.get(n);o||(o=jr(n),to.set(n,o));const s=e.config.appearance?.slots??{};for(const i of eo){const r=no(n,i);if(!r)continue;const d=o.get(i)??[],a=s[i],l=qr(e,i);if(a===null)ce(r);else if(a&&"html"in a)ce(r),r.textContent=a.html;else if(a&&"render"in a){a.replace!==!1&&ce(r);try{const u=a.render(r);typeof u=="function"&&t.push(u)}catch(u){f(h.SHELL_ERROR,{scope:"window-slot-inline-render",windowId:e.id,slot:i,error:u})}}else Kr(r,d),i==="title"&&Yr(r,e.config.title);if(a!==null){let c=!1;for(const u of l){u.replace!==!1&&!c&&(ce(r),c=!0);try{const b=u.render(r,{window:e,slot:i});typeof b=="function"&&t.push(b)}catch(b){f(h.SHELL_ERROR,{scope:"window-slot-registry-render",windowId:e.id,slot:i,id:u.id,error:b})}}}L(h.WINDOW_CHROME_SLOT,r,{windowId:e.id,slot:i,config:e.config})}return f(h.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"slots"}),()=>{for(const i of t)try{i()}catch{}}}const oo=I("desktop-mode/window-chrome-registry",()=>({registry:new Map,listeners:new Set})),Zr=oo.state.registry,so=oo.state.listeners;function Qr(e){return Zr.get(e.toLowerCase())??null}function Jr(e){return so.add(e),()=>{so.delete(e)}}const Oe="core/standard",wt="os-window--custom-chrome";function io(e){const t=e.config.appearance?.chrome??Oe;return L(h.WINDOW_CHROME_RENDER,t,{windowId:e.id,config:e.config})}function ro(e){return{title:e.config.title,icon:e.config.icon,focused:e.element.classList.contains("os-window--focused"),state:e.state}}function ea(e){const t=io(e);if(t===Oe)return null;const n=Qr(t);if(!n)return null;try{if(n.match&&!n.match(e))return null}catch{return null}e.element.classList.add(wt);let o;try{o=n.render(e.element,{window:e,state:ro(e)})}catch(s){return e.element.classList.remove(wt),f(h.SHELL_ERROR,{scope:"window-chrome-render",windowId:e.id,chromeId:t,error:s}),null}return f(h.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"chrome",chromeId:t}),{id:t,handle:o}}const ao=I("desktop-mode/window-actions-registry",()=>({registry:new Map,listeners:new Set})),ta=ao.state.registry,lo=ao.state.listeners;function na(){return Array.from(ta.values()).sort((e,t)=>(e.order??100)-(t.order??100))}function oa(e){return lo.add(e),()=>{lo.delete(e)}}function sa(e,t){if(typeof e.label=="function")try{return String(e.label(t)??"")}catch{return""}return e.label}function ia(e,t){if(typeof e.icon=="function")try{return String(e.icon(t)??"")}catch{return""}return e.icon??""}function ra(e,t){if(!e.checkable||typeof e.checked!="function")return!1;try{return!!e.checked(t)}catch{return!1}}function aa(e,t){if(typeof e.isVisible!="function")return!0;try{return!!e.isVisible(t)}catch{return!1}}function co(e){const t=e.element.querySelector(".os-window__menu-panel");t&&(t.hidden?uo(e):U(e))}function uo(e){const t=e.element.querySelector(".os-window__menu-panel"),n=e.element.querySelector(".os-window__menu-btn");if(!t||!n)return;t.hidden=!1,n.setAttribute("aria-expanded","true");const o=t.querySelector(".os-window__menu-item--startup");o&&yt(e,o),fo(e,t),e._unsubscribeWindowActions?.(),e._unsubscribeWindowActions=oa(()=>{t.hidden||fo(e,t)}),f(h.WINDOW_MENU_OPENED,{windowId:e.id,element:t}),e._boundOnDocumentPointerDown||(e._boundOnDocumentPointerDown=i=>{const r=i.target;r&&(t.contains(r)||n.contains(r)||U(e))}),setTimeout(()=>{e._boundOnDocumentPointerDown&&document.addEventListener("pointerdown",e._boundOnDocumentPointerDown,!0)},0),t.querySelector('[role="menuitem"]')?.focus()}function U(e){const t=e.element.querySelector(".os-window__menu-panel"),n=e.element.querySelector(".os-window__menu-btn");t&&(t.hidden=!0),n&&n.setAttribute("aria-expanded","false"),e._boundOnDocumentPointerDown&&document.removeEventListener("pointerdown",e._boundOnDocumentPointerDown,!0),e._unsubscribeWindowActions?.(),e._unsubscribeWindowActions=null}function ho(e){e.hasAttribute("checked")?e.removeAttribute("checked"):e.setAttribute("checked","")}function yt(e,t){const n=window.wp?.os?.config?.defaultWindow;let o=!1;if(n&&n.enabled&&typeof n.url=="string")if(e.config.native)o=n.url===`native:${e.id}`;else try{const s=G(e.getCurrentUrl()),i=G(n.url);o=s===i}catch{o=!1}o?t.setAttribute("checked",""):t.removeAttribute("checked")}function fo(e,t){for(const n of Array.from(t.querySelectorAll(".os-window__menu-item--action")))n.remove();for(const n of na()){if(!aa(n,e))continue;const o=sa(n,e);if(!o)continue;const s=document.createElement("os-menu-item");if(s.setAttribute("value",n.id),s.classList.add("os-window__menu-item"),s.classList.add("os-window__menu-item--action"),s.setAttribute("data-action-id",n.id),s.textContent=o,n.checkable)s.setAttribute("role","menuitemcheckbox"),ra(n,e)&&s.setAttribute("checked","");else{s.setAttribute("role","menuitem");const r=ia(n,e);r&&s.setAttribute("icon",r)}const i=n.closeOnSelect??!n.checkable;s.addEventListener("os-menu-item-click",r=>{r.stopPropagation(),n.checkable&&ho(s),i&&U(e);try{n.onSelect(e)}catch(d){typeof console<"u"&&console.error(`[openstation] window action "${n.id}" threw:`,d)}}),t.appendChild(s)}}function po(e,t){let n=!1;return()=>{n||(n=!0,requestAnimationFrame(()=>{if(n=!1,!(t==="drag"&&!e._isDragging)&&!(t==="resize"&&!e._isResizing)&&!(e._isDestroyed||!e.element.isConnected))try{f(h.WINDOW_BOUNDS_CHANGED,{windowId:e.id,x:e.element.offsetLeft,y:e.element.offsetTop,width:e.element.offsetWidth,height:e.element.offsetHeight,state:e.state,phase:t})}catch{}}))}}function la(e,t){const n=t.target;if(n.closest(".os-window__btn")||n.closest(".os-window__custom-buttons")||n.closest(".os-window__controls")||n.closest(".os-window__screen-meta")||n.closest(".os-window__menu-btn")||n.closest(".os-window__menu-panel"))return;const o=e.state==="maximized",s=e.state==="snapped-left"||e.state==="snapped-right",i=o||s,r=t.clientX,d=t.clientY,a=t.pointerId,l=i?ca(e,t):null;e._titleBar.setPointerCapture(a);const c=e.snapConfigProvider?.()??{enabled:!1,cellWidth:0,cellHeight:0},u=po(e,"drag");let g=!1;const b=(y,v)=>{if(g)return;g=!0;let A,x;if(l){const M=da(e,l,y,v);A=M.left,x=M.top}else A=e.element.offsetLeft,x=e.element.offsetTop;e.element.classList.add("os-window--dragging"),c.enabled&&e.element.classList.add("os-window--snap-drag"),e._isDragging=!0,e._dragOffsetX=y-A,e._dragOffsetY=v-x,f(h.WINDOW_DRAG_START,{windowId:e.id})};i||b(r,d);const _=y=>{if(!g){const M=y.clientX-r,ge=y.clientY-d;if(M*M+ge*ge<ui)return;b(y.clientX,y.clientY)}if(!e._isDragging)return;let v=y.clientX-e._dragOffsetX,A=y.clientY-e._dragOffsetY;const x=e.element.parentElement;if(x){const M=fa(v,A,e.element.offsetWidth,x.clientWidth,x.clientHeight);v=M.x,A=M.y}c.enabled&&(v=Math.round(v/c.cellWidth)*c.cellWidth,A=Math.round(A/c.cellHeight)*c.cellHeight),e.element.style.left=`${v}px`,e.element.style.top=`${A}px`,e.onDragMove?.(e,y.clientX,y.clientY),u()},C=()=>{try{e._titleBar.releasePointerCapture(a)}catch{}},w=()=>{e._titleBar.removeEventListener("pointermove",_),e._titleBar.removeEventListener("pointerup",E),e._titleBar.removeEventListener("pointercancel",E),e._titleBar.removeEventListener("lostpointercapture",E)},E=()=>{if(!g){C(),w();return}if(!e._isDragging||(e._isDragging=!1,e.element.classList.remove("os-window--dragging"),e.element.classList.remove("os-window--snap-drag"),C(),w(),e.onDragEnd?.(e)??!1))return;e._emitChange("moved");const v={windowId:e.id,x:e.element.offsetLeft,y:e.element.offsetTop};f(h.WINDOW_DRAG_END,v),f(h.WINDOW_MOVED,v)};e._titleBar.addEventListener("pointermove",_),e._titleBar.addEventListener("pointerup",E),e._titleBar.addEventListener("pointercancel",E),e._titleBar.addEventListener("lostpointercapture",E)}function ca(e,t){const n=e._titleBar.getBoundingClientRect(),o=n.width>0?(t.clientX-n.left)/n.width:.5,s=e.element.parentElement,i=s?Math.min(960,Math.round(s.clientWidth*.6)):640,r=s?Math.min(640,Math.round(s.clientHeight*.7)):480,d=e._savedGeometry?.width??i,a=e._savedGeometry?.height??r,l=s?.getBoundingClientRect();return{isMaximized:e.state==="maximized",cursorRatioX:o,titleBarHeight:n.height,areaLeft:l?.left??0,areaTop:l?.top??0,targetW:d,targetH:a}}function da(e,t,n,o){e.element.classList.remove("os-window--maximized","os-window--snapped-left","os-window--snapped-right"),e.element.style.width=`${t.targetW}px`,e.element.style.height=`${t.targetH}px`;const s=Math.max(z,Math.round(n-t.areaLeft-t.targetW*t.cursorRatioX)),i=Math.max(z,Math.round(o-t.areaTop-t.titleBarHeight/2));return e.element.style.left=`${s}px`,e.element.style.top=`${i}px`,e.state="normal",e._emitChange("state"),t.isMaximized&&f(h.WINDOW_UNMAXIMIZED,{windowId:e.id}),{left:s,top:i}}function ua(e,t){if(e.state==="maximized"||e.state==="fullscreen")return;t.preventDefault(),t.stopPropagation();const n=t.target,o=n.dataset.dir??"se";e._isResizing=!0,e._resizeStartX=t.clientX,e._resizeStartY=t.clientY,e._resizeStartW=e.element.offsetWidth,e._resizeStartH=e.element.offsetHeight;const s=e.element.offsetLeft,i=e.element.offsetTop;n.setPointerCapture(t.pointerId),e.element.classList.add("os-window--resizing"),f(h.WINDOW_RESIZE_START,{windowId:e.id});const r=po(e,"resize"),d=e.snapConfigProvider?.()??{enabled:!1,cellWidth:0,cellHeight:0};d.enabled&&e.element.classList.add("os-window--snap-drag"),(e.state==="snapped-left"||e.state==="snapped-right")&&(e.element.classList.remove("os-window--snapped-left","os-window--snapped-right"),e.state="normal");const a=c=>{if(!e._isResizing)return;const u=c.clientX-e._resizeStartX,g=c.clientY-e._resizeStartY,b=ha(o,u,g,s,i,e._resizeStartW,e._resizeStartH,e.config.minWidth,e.config.minHeight,d);e.element.style.left=`${b.x}px`,e.element.style.top=`${b.y}px`,e.element.style.width=`${b.width}px`,e.element.style.height=`${b.height}px`,r()},l=()=>{if(!e._isResizing)return;e._isResizing=!1,e.element.classList.remove("os-window--resizing"),e.element.classList.remove("os-window--snap-drag"),n.removeEventListener("pointermove",a),n.removeEventListener("pointerup",l),n.removeEventListener("pointercancel",l),n.removeEventListener("lostpointercapture",l),e._emitChange("resized");const c={windowId:e.id,width:e.element.offsetWidth,height:e.element.offsetHeight};f(h.WINDOW_RESIZE_END,c),f(h.WINDOW_RESIZED,c)};n.addEventListener("pointermove",a),n.addEventListener("pointerup",l),n.addEventListener("pointercancel",l),n.addEventListener("lostpointercapture",l)}function ha(e,t,n,o,s,i,r,d,a,l){let c=i,u=r,g=o,b=s;if((e==="ne"||e==="se")&&(c=Math.max(d,i+t)),e==="nw"||e==="sw"){const _=Math.max(d,i-t);g=o+(i-_),c=_}if((e==="se"||e==="sw")&&(u=Math.max(a,r+n)),e==="ne"||e==="nw"){const _=Math.max(a,r-n);b=s+(r-_),u=_}if(l.enabled){const _=Math.max(d,Math.round(c/l.cellWidth)*l.cellWidth),C=Math.max(a,Math.round(u/l.cellHeight)*l.cellHeight);(e==="nw"||e==="sw")&&(g=o+(c-_)),(e==="nw"||e==="ne")&&(b=s+(u-C)),c=_,u=C}if(g<z){const _=z-g;g=z,c=Math.max(d,c-_)}if(b<z){const _=z-b;b=z,u=Math.max(a,u-_)}return{x:g,y:b,width:c,height:u}}function fa(e,t,n,o,s){const i=lt-n,r=o-lt,d=Math.max(i,Math.min(e,r)),a=z,l=s-lt,c=Math.max(a,Math.min(t,l));return{x:d,y:c}}const vt=window.location.origin,pa="os-window-open",ma=300,He=class He{constructor(t){if(this.state="normal",this._activityCount=0,this._activityPhase="idle",this._activityError=null,this._activityClearTimer=null,this._activitySavingStartedAt=0,this._activitySettleTimer=null,this._isDragging=!1,this._isResizing=!1,this._isDestroyed=!1,this._dragOffsetX=0,this._dragOffsetY=0,this._resizeStartX=0,this._resizeStartY=0,this._resizeStartW=0,this._resizeStartH=0,this._savedGeometry=null,this._savedFullscreenState=null,this._stateBeforeMinimize=null,this._externalTabs=new Map,this._externalTabSeq=0,this._titleBarButtonsUnsubscribe=null,this._windowThemesUnsubscribe=null,this._windowControlsUnsubscribe=null,this._windowControlsTeardown=null,this._windowSlotsUnsubscribe=null,this._windowSlotsTeardown=null,this._chromeHandle=null,this._chromeId=Oe,this._windowChromesUnsubscribe=null,this._nativeRenderTeardown=null,this._nativeRenderCtxDispose=null,this._closeSafetyNetTimer=null,this._clearOpeningClassRemoval=null,this._onCloseTransitionEnd=null,this._isFinalized=!1,this._iframeBridgeReady=!1,this._iframeCloseTimeout=null,this._closePending=!1,this._activeTabId="primary",this.onFocusRequest=null,this.onClose=null,this.onMinimize=null,this.onRestore=null,this.onOpenAnother=null,this.onOpenInNewWindow=null,this.onToggleStartup=null,this.snapConfigProvider=null,this.onDragMove=null,this.onDragEnd=null,this._boundOnDocumentPointerDown=null,this._unsubscribeWindowActions=null,this._bodyResizeObserver=null,this._tabOverflowTeardown=null,this._swapBuffer=null,this._swapBufferTimer=null,this._suppressCloseFilter=!1,this.id=t.id,this.config=t,this.element=xi(t),this.iframe=t.native?null:this.element.querySelector(".os-window__iframe"),this._titleBar=this.element.querySelector(".os-window__titlebar"),this._titleEl=this.element.querySelector(".os-window__title"),this._boundOnMessage=n=>er(this,n),this.bindEvents(),this.iframe&&this._wireContentFocusForwarder(this.iframe),this.renderCustomTitleBarButtons(),this._titleBarButtonsUnsubscribe=wr(()=>{this.renderCustomTitleBarButtons()}),bt(this,this.config.appearance?.theme),this._windowThemesUnsubscribe=Cr(()=>{this._isDestroyed||bt(this,this.config.appearance?.theme)}),this.repaintWindowControls(),this._windowControlsUnsubscribe=Nr(()=>{this._isDestroyed||this.repaintWindowControls()}),this.repaintWindowSlots(),this._windowSlotsUnsubscribe=Vr(()=>{this._isDestroyed||this.repaintWindowSlots()}),this.remountWindowChrome(),this._windowChromesUnsubscribe=Jr(()=>{if(this._isDestroyed)return;io(this)!==this._chromeId&&this.remountWindowChrome()}),this._bodyResizeObserver=this.installBodyResizeObserver(),t.initialState==="minimized"){this.state="minimized",this.element.classList.add("os-window--minimized"),this.iframe&&(this.iframe.style.visibility="hidden"),this.element.style.setProperty("content-visibility","hidden");return}(t.initialState==="snapped-left"||t.initialState==="snapped-right")&&this.element.classList.add(`os-window--${t.initialState}`),document.hidden||(this.element.classList.add("os-window--opening"),this._armOpeningClassRemoval()),t.initialState&&t.initialState!=="normal"&&requestAnimationFrame(()=>this.applyInitialState(t.initialState))}_armOpeningClassRemoval(){const t=this.element;let n=null,o=!1;const s=()=>{o||(o=!0,this._clearOpeningClassRemoval=null,n!==null&&(window.clearTimeout(n),n=null),t.removeEventListener("animationend",i),t.removeEventListener("animationcancel",i),t.classList.remove("os-window--opening"))},i=r=>{r.target!==t||r.animationName!==pa||s()};t.addEventListener("animationend",i),t.addEventListener("animationcancel",i),n=window.setTimeout(()=>{n=null,s()},ma),this._clearOpeningClassRemoval=s}hydrateNative(){if(!this.config.native||!this.config.render)return;const t=this.element.querySelector(".os-window__body");if(!t)return;const n=L(h.NATIVE_WINDOW_BEFORE_RENDER,t,{windowId:this.id,config:this.config}),o=n instanceof HTMLElement?n:t,{ctx:s,dispose:i}=Go(this.id,this.config.params??{});this._nativeRenderCtxDispose=i;const r=this.config.render(o,s),d=l=>{typeof l=="function"&&(this._nativeRenderTeardown=l)};r instanceof Promise?r.then(l=>{this._isDestroyed||(d(l),P(this.id))},l=>{typeof console<"u"&&console.error(`[openstation] native render rejected for "${this.id}":`,l),f(h.SHELL_ERROR,{scope:"window-open",id:this.id,error:l}),!this._isDestroyed&&P(this.id)}):(d(r),requestAnimationFrame(()=>{this._isDestroyed||P(this.id)})),f(h.NATIVE_WINDOW_AFTER_RENDER,{windowId:this.id,body:o,config:this.config});const a=this.config.autofocus;a&&requestAnimationFrame(()=>{if(this._isDestroyed)return;if(typeof a=="string"){o.querySelector(a)?.focus();return}o.hasAttribute("tabindex")||(o.tabIndex=-1),o.focus()})}applyInitialState(t){t==="minimized"?this.minimize():t==="maximized"?this.toggleMaximize():t==="fullscreen"?this.toggleFullscreen():t==="snapped-left"?this.applySnap("left"):t==="snapped-right"&&this.applySnap("right")}_emitChange(t){document.dispatchEvent(new CustomEvent("os-window-changed",{detail:{windowId:this.id,reason:t,state:this.state}}))}snapGeometry(t){const n=this.snapConfigProvider?.();if(!n||!n.enabled)return t;const o=Math.max(this.config.minWidth,Math.round(t.width/n.cellWidth)*n.cellWidth),s=Math.max(this.config.minHeight,Math.round(t.height/n.cellHeight)*n.cellHeight);return{x:Math.round(t.x/n.cellWidth)*n.cellWidth,y:Math.round(t.y/n.cellHeight)*n.cellHeight,width:o,height:s}}getCurrentUrl(){if(!this.iframe)return this.config.url||`#${this.id}`;try{const t=this.iframe.contentWindow?.location.href;if(t&&t!=="about:blank")return t}catch{}return this.iframe.src}bindEvents(){this.element.addEventListener("pointerdown",()=>{this.element.classList.contains("os-window--overview")||this.onFocusRequest?.(this)}),this.element.addEventListener("focusin",()=>{this.element.classList.contains("os-window--overview")||this.onFocusRequest?.(this)}),this._titleBar.addEventListener("pointerdown",i=>la(this,i)),this.element.querySelectorAll(".os-window__resize-handle").forEach(i=>{i.addEventListener("pointerdown",r=>ua(this,r))});const n=this.element.querySelector(".os-window__menu-btn"),o=this.element.querySelector(".os-window__menu-panel");if(n&&o){n.addEventListener("click",c=>{c.stopPropagation(),co(this)});const i=o.querySelector(".os-window__menu-item--open-another");i&&i.addEventListener("os-menu-item-click",c=>{c.stopPropagation(),U(this),this.onOpenAnother?.(this)});const r=o.querySelector(".os-window__menu-item--open-in-new-window");r&&r.addEventListener("os-menu-item-click",c=>{c.stopPropagation(),U(this),this.onOpenInNewWindow?.(this)});const d=o.querySelector(".os-window__menu-item--reload");d&&d.addEventListener("os-menu-item-click",c=>{c.stopPropagation(),U(this),this.reload()});const a=o.querySelector(".os-window__menu-item--open-external");a&&a.addEventListener("os-menu-item-click",c=>{c.stopPropagation(),U(this),this.detach()});const l=o.querySelector(".os-window__menu-item--startup");l&&(yt(this,l),l.addEventListener("os-menu-item-click",c=>{c.stopPropagation(),ho(l),this.onToggleStartup?.(this)}),document.addEventListener("os-default-window-changed",()=>{yt(this,l)})),o.addEventListener("keydown",c=>{c.key==="Escape"&&(c.stopPropagation(),U(this),n.focus())})}this._titleBar.addEventListener("dblclick",i=>{i.target?.closest('button, [role="button"], [role="menuitem"], [role="menuitemcheckbox"], os-window-button, os-menu, os-menu-item, .os-window__menu-panel, .os-window__custom-buttons, input, select, textarea, a')||this.toggleMaximize()});const s=this.element.querySelector(".os-window__tabs");if(s&&(s.addEventListener("click",i=>Di(this,i)),s.addEventListener("keydown",i=>Fo(s,i)),this._tabOverflowTeardown=Mi(s)),this.iframe){const i=this.iframe;this._wireTabNavSync(i),window.addEventListener("message",this._boundOnMessage)}}addExternalTab(t,n){Dn(this,t,n)}setTabs(t,n){Uo(this.element,t,n)}activateTab(t){Ke(this.element,t)}setZIndex(t){this.element.style.zIndex=String(t)}setFocused(t){this.element.classList.toggle("os-window--focused",t),this._notifyChromeStateChanged()}setTitle(t){const n=this.element.querySelector(".os-window__title");n&&(this._titleEl=n,n.textContent=t),this.config.title=t,f(h.WINDOW_TITLE_CHANGED,{windowId:this.id,title:t}),this._notifyChromeStateChanged()}repaintWindowControls(){const t=this.element.querySelector(".os-window__controls");if(t){if(this._windowControlsTeardown){try{this._windowControlsTeardown()}catch{}this._windowControlsTeardown=null}this._windowControlsTeardown=Pr(this,t)}}repaintThemedChrome(){const t=this.element.querySelector(".os-window__slot--icon");if(t){const o=t.querySelector(".os-window__icon");o&&o.replaceWith(Fr(this.config.icon,{title:this.config.title,className:"os-window__icon",slot:Ds(this.config.id)}))}const n=this.element.querySelector(".os-window__menu-btn");n&&(n.querySelectorAll(":scope > .dashicons").forEach(o=>o.remove()),n.removeAttribute("icon-src"),n.setAttribute("icon","menu"),ot(n,"core/menu"))}setAppearanceControls(t){this.config.appearance={...this.config.appearance??{},controls:t??void 0},this.repaintWindowControls()}repaintWindowSlots(){if(this._windowSlotsTeardown){try{this._windowSlotsTeardown()}catch{}this._windowSlotsTeardown=null}this._windowSlotsTeardown=Xr(this)}remountWindowChrome(){if(this._chromeHandle){try{this._chromeHandle.destroy()}catch{}this._chromeHandle=null}this.element.classList.remove(wt);const t=ea(this);t?(this._chromeHandle=t.handle,this._chromeId=t.id):this._chromeId=Oe}setAppearanceChrome(t){this.config.appearance={...this.config.appearance??{},chrome:t??void 0},this.remountWindowChrome()}_notifyChromeStateChanged(){if(!this._isDestroyed&&this._chromeHandle?.update)try{this._chromeHandle.update(ro(this))}catch{}}setAppearanceSlot(t,n){const s={...this.config.appearance?.slots??{}};n===void 0?delete s[t]:s[t]=n,this.config.appearance={...this.config.appearance??{},slots:s},this.repaintWindowSlots()}setAppearanceTheme(t){let n;t==null?n=void 0:typeof t=="string"?n={themeId:t}:typeof t=="object"&&("themeId"in t||"tokens"in t)?n=t:typeof t=="object"&&(n={tokens:t}),this.config.appearance={...this.config.appearance??{},theme:n},bt(this,n)}applySnap(t){this._applySnapVisuals(t)&&(this.state=t==="left"?"snapped-left":"snapped-right",this._emitChange("state"))}_applySnapVisuals(t){const n=this.element.parentElement;if(!n)return!1;const o=Math.floor(n.clientWidth/2),s=n.clientHeight;return this.element.classList.remove("os-window--maximized","os-window--fullscreen","os-window--snapped-left","os-window--snapped-right"),this.element.classList.add(`os-window--snapped-${t}`),this.element.style.left=t==="left"?"0px":`${o}px`,this.element.style.top="0px",this.element.style.width=`${o}px`,this.element.style.height=`${s}px`,!0}isMinimized(){return this.state==="minimized"}isMaximized(){return this.state==="maximized"}isFullscreen(){return this.state==="fullscreen"}isSnapped(t){return t==="left"?this.state==="snapped-left":t==="right"?this.state==="snapped-right":this.state==="snapped-left"||this.state==="snapped-right"}isFocused(){return this.element.classList.contains("os-window--focused")}minimize(){this.state!=="minimized"&&(this._stateBeforeMinimize=this.state,this.state="minimized",this.element.classList.add("os-window--minimized"),this.element.addEventListener("transitionend",t=>{t.propertyName==="opacity"&&this.state==="minimized"&&!this.element.classList.contains("os-window--overview")&&(this.iframe&&(this.iframe.style.visibility="hidden"),this.element.style.setProperty("content-visibility","hidden"))},{once:!0}),this.onMinimize?.(this),this._emitChange("state"),f(h.WINDOW_MINIMIZED,{windowId:this.id,element:this.element}),this._stateBeforeMinimize==="fullscreen"&&te())}restore(){this.element.style.removeProperty("content-visibility"),this.iframe&&(this.iframe.style.visibility="");const t=this.state==="minimized";this.element.classList.remove("os-window--minimized"),t&&(this.state=this._stateBeforeMinimize??"normal",this._stateBeforeMinimize=null,this.state==="fullscreen"&&(te(),this.updateFocusButtonState())),t&&this.onRestore?.(this),this.onFocusRequest?.(this),this._emitChange("state"),t&&f(h.WINDOW_RESTORED,{windowId:this.id,element:this.element})}maximize(){this.state!=="maximized"&&(this.state==="normal"&&(this._savedGeometry={x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight}),this._applyMaximizeVisuals()&&(this.state="maximized",this._emitChange("state"),f(h.WINDOW_MAXIMIZED,{windowId:this.id,element:this.element})))}_applyMaximizeVisuals(){const t=this.element.parentElement;return t?(this.element.classList.remove("os-window--fullscreen","os-window--snapped-left","os-window--snapped-right"),this.element.classList.add("os-window--maximized"),this.element.style.left="0px",this.element.style.top="0px",this.element.style.width=`${t.clientWidth}px`,this.element.style.height=`${t.clientHeight}px`,!0):!1}toggleMaximize(){if(this.element.parentElement){if(this.state==="maximized"){if(this.element.classList.remove("os-window--maximized"),this._savedGeometry){const n=this.snapGeometry(this._savedGeometry);this.element.style.left=`${n.x}px`,this.element.style.top=`${n.y}px`,this.element.style.width=`${n.width}px`,this.element.style.height=`${n.height}px`,this._savedGeometry=n}this.state="normal",this._emitChange("state"),f(h.WINDOW_UNMAXIMIZED,{windowId:this.id,element:this.element});return}if(this.state==="fullscreen"){this._savedFullscreenState=null,this._applyMaximizeVisuals(),this.state="maximized",te(),this.updateFocusButtonState(),this._emitChange("state"),f(h.WINDOW_FULLSCREEN_EXITED,{windowId:this.id,element:this.element}),f(h.WINDOW_MAXIMIZED,{windowId:this.id,element:this.element});return}this.maximize()}}toggleFullscreen(){if(this.state==="fullscreen"){this.element.classList.remove("os-window--fullscreen");const t=this._savedFullscreenState;this._savedFullscreenState=null;let n=!1;if(t&&t.state==="maximized")this._applyMaximizeVisuals(),this.state="maximized",n=!0;else if(t&&(t.state==="snapped-left"||t.state==="snapped-right")){const o=t.state==="snapped-left"?"left":"right";this._applySnapVisuals(o),this.state=t.state}else t?(this.element.style.left=`${t.x}px`,this.element.style.top=`${t.y}px`,this.element.style.width=`${t.width}px`,this.element.style.height=`${t.height}px`,this.state="normal"):this.state="normal";te(),this.updateFocusButtonState(),this._emitChange("state"),f(h.WINDOW_FULLSCREEN_EXITED,{windowId:this.id,element:this.element}),n&&f(h.WINDOW_MAXIMIZED,{windowId:this.id,element:this.element});return}this.state==="normal"&&(this._savedGeometry={x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight}),this._savedFullscreenState={state:this.state,x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight},this.element.classList.remove("os-window--maximized","os-window--snapped-left","os-window--snapped-right"),this.element.classList.add("os-window--fullscreen"),this.state="fullscreen",te(),this.updateFocusButtonState(),this._emitChange("state"),f(h.WINDOW_FULLSCREEN_ENTERED,{windowId:this.id,element:this.element})}updateFocusButtonState(){const t=this.element.querySelector(".os-window__btn--focus");if(!t)return;const n=this.state==="fullscreen";t.classList.toggle("os-window__btn--active",n),t.setAttribute("aria-pressed",n?"true":"false"),t.setAttribute("aria-label",m(n?"Exit fullscreen":"Enter fullscreen"))}detach(){const t=this.getCurrentUrl();let n;try{n=new URL(t,vt)}catch{return}n.origin===vt&&(n.searchParams.delete("openstation_chromeless"),n.searchParams.delete("desktop_mode_portal"),n.searchParams.set("desktop_mode_classic","1"),window.open(n.toString(),"_blank","noopener"),f(h.WINDOW_DETACHED,{windowId:this.id,url:n.toString()}))}reload(){if(this.element.querySelector(".os-window__body")?.classList.contains("os-window__body--loading"))return;if(this.config.native){this._reloadNative();return}let n,o;if(this._activeTabId==="primary"){if(!this.iframe)return;const s=this.iframe;n=this.getCurrentUrl(),o=()=>{try{s.contentWindow?.location.reload()}catch{s.src=s.src}}}else{const s=this._externalTabs.get(this._activeTabId);if(!s)return;n=s.url,o=()=>{try{s.iframe.contentWindow?.location.reload()}catch{s.iframe.src=s.url}}}this._spinReloadButton(),this.markContentLoading(),o(),f(h.WINDOW_RELOADED,{windowId:this.id,url:n})}_reloadNative(){if(!this.config.render)return;const t=this.element.querySelector(".os-window__body");if(t){if(this._nativeRenderCtxDispose){try{this._nativeRenderCtxDispose()}catch(n){f(h.SHELL_ERROR,{scope:"native-window-ctx-dispose",id:this.id,error:n})}this._nativeRenderCtxDispose=null}if(this._nativeRenderTeardown){try{this._nativeRenderTeardown()}catch(n){f(h.SHELL_ERROR,{scope:"native-window-teardown",id:this.id,error:n})}this._nativeRenderTeardown=null}t.replaceChildren(),this._spinReloadButton(),this.markContentLoading(),this.hydrateNative(),f(h.WINDOW_RELOADED,{windowId:this.id,url:this.config.url??""})}}navigateTo(t){if(this.config.native||!this.iframe)return!1;const n=xe(t);if(!n)return!1;this.markContentLoading();const o=this.iframe.contentWindow;if(o)try{return o.location.assign(n),!0}catch{}return this.iframe.src=n,!0}_wireContentFocusForwarder(t){const n=()=>{let o=null;try{o=t.contentDocument}catch{return}o&&(o.location&&o.location.pathname.indexOf("/wp-admin/")!==-1||o.addEventListener("pointerdown",()=>{this.element.classList.contains("os-window--overview")||this.onFocusRequest?.(this)},{capture:!0,passive:!0}))};t.addEventListener("load",n),n()}_wireTabNavSync(t){t.addEventListener("load",()=>{try{const n=t.contentWindow?.location.href;if(!n||dr(this,n))return;ur(this),ut(this,n)}catch{}})}_discardSwapBuffer(){this._swapBufferTimer!==null&&(window.clearTimeout(this._swapBufferTimer),this._swapBufferTimer=null),this._swapBuffer&&(this._swapBuffer.remove(),this._swapBuffer=null,this.iframe?.classList.remove("os-window__iframe--swap-front"))}swapReload(t){if(this.config.native||!this.iframe||this._isDestroyed)return;if(this._activeTabId!=="primary"){this.reload();return}const n=t?xe(t):this.getCurrentUrl();if(!n)return;this._discardSwapBuffer();const o=this.iframe;o.classList.add("os-window__iframe--swap-front");const s=document.createElement("iframe");s.className="os-window__iframe os-window__iframe--buffer",s.setAttribute("aria-hidden","true"),s.setAttribute("name",`os-frame-${this.id}-buffer`),this._swapBuffer=s,this._swapBufferTimer=window.setTimeout(()=>{this._swapBuffer===s&&this._discardSwapBuffer()},2e4),s.addEventListener("load",()=>{if(this._swapBuffer!==s||this._isDestroyed)return;this._swapBuffer=null,this._swapBufferTimer!==null&&(window.clearTimeout(this._swapBufferTimer),this._swapBufferTimer=null);let i=0,r=0;try{i=o.contentWindow?.scrollX??0,r=o.contentWindow?.scrollY??0}catch{}if(i||r)try{s.contentWindow?.scrollTo(i,r)}catch{}s.classList.remove("os-window__iframe--buffer"),s.removeAttribute("aria-hidden"),s.setAttribute("name",`os-frame-${this.id}`),o.remove(),this.iframe=s,P(this.id),at(s),s.addEventListener("load",()=>{P(this.id),at(s)}),this._wireContentFocusForwarder(s),this._wireTabNavSync(s),ut(this,n),f(h.WINDOW_RELOADED,{windowId:this.id,url:n,silent:!0})},{once:!0}),o.insertAdjacentElement("afterend",s),s.src=n}_spinReloadButton(){const t=this.element.querySelector(".os-window__btn--reload");t instanceof HTMLElement&&(t.classList.remove("os-window__btn--spinning"),t.offsetWidth,t.classList.add("os-window__btn--spinning"),t.addEventListener("animationend",()=>{t.classList.remove("os-window__btn--spinning")},{once:!0}))}renderCustomTitleBarButtons(){const t=this.element.querySelector(".os-window__custom-buttons--left"),n=this.element.querySelector(".os-window__custom-buttons--right");if(!t||!n)return;t.innerHTML="",n.innerHTML="";const{left:o,right:s}=_r(this),i=(r,d)=>{for(const a of d){const l=document.createElement("os-window-button");if(Bn(l,a.icon),l.setAttribute("aria-label",a.label),l.setAttribute("title",a.label),l.classList.add("os-window__btn"),l.classList.add("os-window__btn--custom"),l.dataset.buttonId=a.id,r.appendChild(l),typeof a.render=="function")try{a.render(l,this)}catch(c){typeof console<"u"&&console.error("[openstation] title-bar-button render threw:",a.id,c)}else typeof a.onClick=="function"&&l.addEventListener("os-button-activate",c=>{try{a.onClick(this,c)}catch(u){typeof console<"u"&&console.error("[openstation] title-bar-button onClick threw:",a.id,u)}})}};i(t,o),i(n,s)}send(t,n){if(typeof t!="string"||t==="")return;const o=this.iframe??$o(this.id);if(!o){Do(this.id,t,n);return}const s=()=>{try{o.contentWindow?.postMessage({type:"os-window-send",channel:t,payload:n},vt)}catch(i){typeof console<"u"&&console.error("[openstation] Window.send: postMessage failed",i)}};if(Wt(this.id)){s();return}Wo(this.id,t,n,s)}on(t,n){return typeof t!="string"||t===""||typeof n!="function"?()=>{}:No(this.id,t,n)}markContentLoading(){Ee(this.id)}markContentLoaded(){P(this.id)}whenContentReady(){return Wt(this.id)?Promise.resolve():new Promise(t=>{const n=this.id,o=s=>{const i=s.detail;!i||i.windowId!==n||(document.removeEventListener("os-window-content-loaded",o),t())};document.addEventListener("os-window-content-loaded",o)})}markActivity(t,n={}){this._activityPhase=t,this._activityError=n.error??null,this._paintActivityIndicator()}_resetActivity(){this._activitySettleTimer!==null&&(window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=null),this._activityClearTimer!==null&&(window.clearTimeout(this._activityClearTimer),this._activityClearTimer=null),this._activityCount=0,this._activityPhase="idle",this._activityError=null,this._paintActivityIndicator()}trackActivity(t){return this._markActivityStart(),t.then(n=>(this._markActivitySettled(!0),n),n=>{const o=n instanceof Error?n.message:String(n);throw this._markActivitySettled(!1,o),n})}_markActivityStart(){this._activityCount++,this._activitySettleTimer!==null&&(window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=null),this._activityCount===1&&(this._activityPhase="saving",this._activityError=null,this._activitySavingStartedAt=Date.now(),this._paintActivityIndicator())}_markActivitySettled(t,n){if(this._activityCount>0&&this._activityCount--,this._activityCount>0){!t&&n&&(this._activityError=n);return}const o=Date.now()-this._activitySavingStartedAt,s=He.MIN_SAVING_DISPLAY_MS-o;if(s>0){this._activitySettleTimer!==null&&window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=window.setTimeout(()=>{this._activitySettleTimer=null,this._finalizeActivitySettle(t,n)},s);return}this._finalizeActivitySettle(t,n)}_finalizeActivitySettle(t,n){this._activityPhase=t&&!this._activityError?"saved":"failed",!t&&n&&(this._activityError=n),this._paintActivityIndicator(),this._activityClearTimer!==null&&(window.clearTimeout(this._activityClearTimer),this._activityClearTimer=null),this._activityPhase==="saved"&&(this._activityClearTimer=window.setTimeout(()=>{this._activityClearTimer=null,this._activityPhase="idle",this._activityError=null,this._paintActivityIndicator()},2200))}_paintActivityIndicator(){if(this._isDestroyed)return;const t=this._activityPhase;t==="idle"?this._titleBar.removeAttribute("data-os-activity"):this._titleBar.setAttribute("data-os-activity",t);const n=this._titleBar.querySelector(".os-window__activity-status");if(n){const s=t==="failed";n.setAttribute("role",s?"alert":"status"),n.setAttribute("aria-live",s?"assertive":"polite"),n.textContent=this._activityStatusText()}this._titleBar.querySelectorAll("[data-os-activity-indicator]").forEach(s=>{s.setAttribute("phase",t),this._activityError?s.setAttribute("error",this._activityError):s.removeAttribute("error")})}_activityStatusText(){switch(this._activityPhase){case"saved":return m("Saved");case"failed":return this._activityError?Q(m("Not saved. %s"),this._activityError):m("Not saved.");default:return""}}requestAttention(t,n={}){const o=Ge.filter("os/window-attention-requested",{windowId:this.id,mode:t,durationMs:n.durationMs,intensity:n.intensity},n);if(!o||o.cancel===!0)return;const s=o.mode??t,i={...n,durationMs:typeof o.durationMs=="number"?o.durationMs:n.durationMs,intensity:typeof o.intensity=="string"?o.intensity:n.intensity},r=L("os.window.attention",s,{windowId:this.id,opts:i}),d=window.wp,a=d?.os?.dock,l=d?.os?.taskbar;let c=!1;if(typeof a?.setAttention=="function"&&(a.setAttention(this.id,r,i),c=!0),typeof l?.setAttention=="function"&&(l.setAttention(this.id,r,i),c=!0),!c&&r!==null){this.setHighlight("persistent");const u=i.durationMs??4e3;u>0&&window.setTimeout(()=>{this.setHighlight(null)},u)}else!c&&r===null&&this.setHighlight(null)}shake(){if(L("os.window.shake",!0,{windowId:this.id})===!1)return;const n=this.element;n.classList.remove("os-window--shaking"),n.offsetWidth,n.classList.add("os-window--shaking");const o=()=>{n.classList.remove("os-window--shaking"),n.removeEventListener("animationend",o)};n.addEventListener("animationend",o)}setHighlight(t,n){const o=this.element;o&&(o.classList.remove("wp-window--highlight-preview","wp-window--highlight-persistent"),t==="preview"?o.classList.add("wp-window--highlight-preview"):t==="persistent"&&o.classList.add("wp-window--highlight-persistent"),n?.color?o.style.setProperty("--wp-window-highlight-color",n.color):t===null&&o.style.removeProperty("--wp-window-highlight-color"),f(h.WINDOW_HIGHLIGHT_CHANGED,{windowId:this.id,mode:t,color:n?.color}))}close(){if(!this._isDestroyed){if(this.config.native&&!this._suppressCloseFilter){if(L(h.NATIVE_WINDOW_BEFORE_CLOSE,!0,{windowId:this.id,config:this.config})===!1)return}else if(!this.config.native&&!this._suppressCloseFilter&&this._iframeBridgeReady&&this.iframe){if(this._closePending)return;this._closePending=!0;try{this.iframe.contentWindow?.postMessage({type:"os-bridge-beforeunload-query"},location.origin),this._iframeCloseTimeout=setTimeout(()=>{this._isDestroyed||(this._suppressCloseFilter=!0,this._closePending=!1,this.close())},500);return}catch{this._closePending=!1}}if(this._isDestroyed=!0,this._discardSwapBuffer(),this._activityClearTimer!==null&&(window.clearTimeout(this._activityClearTimer),this._activityClearTimer=null),this._activitySettleTimer!==null&&(window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=null),this._titleBarButtonsUnsubscribe&&(this._titleBarButtonsUnsubscribe(),this._titleBarButtonsUnsubscribe=null),this._windowThemesUnsubscribe&&(this._windowThemesUnsubscribe(),this._windowThemesUnsubscribe=null),this._windowControlsUnsubscribe&&(this._windowControlsUnsubscribe(),this._windowControlsUnsubscribe=null),this._windowSlotsUnsubscribe&&(this._windowSlotsUnsubscribe(),this._windowSlotsUnsubscribe=null),this._windowChromesUnsubscribe&&(this._windowChromesUnsubscribe(),this._windowChromesUnsubscribe=null),this._nativeRenderCtxDispose){try{this._nativeRenderCtxDispose()}catch(t){f(h.SHELL_ERROR,{scope:"native-window-ctx-dispose",id:this.id,error:t})}this._nativeRenderCtxDispose=null}this._bodyResizeObserver?.disconnect(),this._bodyResizeObserver=null,this._tabOverflowTeardown?.(),this._tabOverflowTeardown=null,Mo(this.id);try{this.config.onClose?.()}catch(t){f(h.SHELL_ERROR,{scope:"native-window-close",id:this.id,error:t})}this.onClose?.(this),this.element.classList.add("os-window--closing"),this._onCloseTransitionEnd=t=>{t.propertyName==="opacity"&&this._finalizeClose()},this.element.addEventListener("transitionend",this._onCloseTransitionEnd),this._closeSafetyNetTimer=setTimeout(()=>this._finalizeClose(),300)}}destroy(){if(!this._isFinalized){if(!this._isDestroyed){this._suppressCloseFilter=!0;try{this.close()}finally{this._suppressCloseFilter=!1}}this._finalizeClose()}}_finalizeClose(){if(!this._isFinalized){if(this._isFinalized=!0,this._closeSafetyNetTimer!==null&&(clearTimeout(this._closeSafetyNetTimer),this._closeSafetyNetTimer=null),this._iframeCloseTimeout!==null&&(clearTimeout(this._iframeCloseTimeout),this._iframeCloseTimeout=null),this._clearOpeningClassRemoval&&this._clearOpeningClassRemoval(),this._onCloseTransitionEnd&&(this.element.removeEventListener("transitionend",this._onCloseTransitionEnd),this._onCloseTransitionEnd=null),this._windowControlsTeardown){try{this._windowControlsTeardown()}catch{}this._windowControlsTeardown=null}if(this._windowSlotsTeardown){try{this._windowSlotsTeardown()}catch{}this._windowSlotsTeardown=null}if(this._chromeHandle){try{this._chromeHandle.destroy()}catch{}this._chromeHandle=null}if(xr(this),this._nativeRenderTeardown){try{this._nativeRenderTeardown()}catch(t){f(h.SHELL_ERROR,{scope:"native-window-teardown",id:this.id,error:t})}this._nativeRenderTeardown=null}window.removeEventListener("message",this._boundOnMessage),this._boundOnDocumentPointerDown&&document.removeEventListener("pointerdown",this._boundOnDocumentPointerDown,!0),this._unsubscribeWindowActions?.(),this._unsubscribeWindowActions=null,this.element.remove(),te()}}installBodyResizeObserver(){const t=this.element.querySelector(".os-window__body");if(!t||typeof ResizeObserver>"u")return null;const n=new ResizeObserver(o=>{const s=o[0];if(!s)return;const i=s.contentRect,r=Math.round(i.width),d=Math.round(i.height);try{this.config.onResize?.(r,d)}catch(a){f(h.SHELL_ERROR,{scope:"native-window-resize",id:this.id,error:a})}f(h.WINDOW_BODY_RESIZED,{windowId:this.id,width:r,height:d})});return n.observe(t),n}getSnapshot(){if(this.element.offsetParent===null){const n=o=>{const s=parseFloat(o);return Number.isFinite(s)?Math.round(s):0};return{id:this.id,x:n(this.element.style.left),y:n(this.element.style.top),width:n(this.element.style.width),height:n(this.element.style.height),state:this.state}}return{id:this.id,x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight,state:this.state}}getExternalTabCount(){return Ni(this)}getExternalTabsSnapshot(){return Oi(this)}toggleActionsMenu(){co(this)}closeActionsMenu(){U(this)}openActionsMenu(){uo(this)}};He.MIN_SAVING_DISPLAY_MS=1200;let Et=He;function S(e,...t){return{__wpdHtml:!0,strings:e,values:t}}function ga(e){return!!e&&e.__wpdHtml===!0}const ba="$$wpd$$",T=/\$\$wpd\$\$(\d+)\$\$/g;function _a(e){let t=e[0];for(let n=1;n<e.length;n++)t+=`${ba}${n-1}$$`+e[n];return t}const mo=new WeakMap;function go(e){const t=mo.get(e);if(t)return t;const n=document.createElement("template");n.innerHTML=_a(e);const o=[],s=(d,a)=>{if(d.nodeType===Node.ELEMENT_NODE){const u=d;for(const g of Array.from(u.attributes)){const b=g.name,_=g.value,C=b[0];if(T.test(_))if(T.lastIndex=0,C==="@"){const w=T.exec(_);T.lastIndex=0,o.push({path:a,kind:"event",name:b.slice(1),valueIndex:w?Number(w[1]):0}),u.removeAttribute(b)}else if(C==="."){const w=T.exec(_);T.lastIndex=0,o.push({path:a,kind:"prop",name:b.slice(1),valueIndex:w?Number(w[1]):0}),u.removeAttribute(b)}else if(C==="?"){const w=T.exec(_);T.lastIndex=0,o.push({path:a,kind:"bool",name:b.slice(1),valueIndex:w?Number(w[1]):0}),u.removeAttribute(b)}else{const w=[],E=[];let y=0,v;for(T.lastIndex=0;(v=T.exec(_))!==null;)w.push(_.slice(y,v.index)),E.push(Number(v[1])),y=v.index+v[0].length;w.push(_.slice(y)),o.push({path:a,kind:"attr",name:b,template:w,valueIndices:E}),u.setAttribute(b,"")}}}const l=Array.from(d.childNodes);let c=0;for(let u=0;u<l.length;u++){const g=l[u],b=u+c;if(g.nodeType===Node.TEXT_NODE){const _=g.textContent||"";if(!T.test(_)){T.lastIndex=0;continue}T.lastIndex=0;const C=g.parentNode;let w=0,E;const y=[],v=[];for(T.lastIndex=0;(E=T.exec(_))!==null;){E.index>w&&y.push(document.createTextNode(_.slice(w,E.index)));const A=document.createTextNode("");y.push(A),v.push({path:[...a,b+y.length-1],kind:"node",valueIndex:Number(E[1])}),w=E.index+E[0].length}w<_.length&&y.push(document.createTextNode(_.slice(w)));for(const A of y)C.insertBefore(A,g);C.removeChild(g),c+=y.length-1,o.push(...v)}else s(g,[...a,b])}};s(n.content,[]);const r={template:n,buildParts:d=>{const a=[];for(const l of o){let c=d;for(const u of l.path)c=c.childNodes[u];l.kind==="node"?a.push({kind:"node",valueIndex:l.valueIndex,child:{anchor:c,state:null}}):l.kind==="attr"?a.push({kind:"attr",element:c,name:l.name,template:l.template,valueIndices:l.valueIndices}):l.kind==="event"?a.push({kind:"event",valueIndex:l.valueIndex,element:c,name:l.name}):l.kind==="prop"?a.push({kind:"prop",valueIndex:l.valueIndex,element:c,name:l.name}):l.kind==="bool"&&a.push({kind:"bool",valueIndex:l.valueIndex,element:c,name:l.name})}return a}};return mo.set(e,r),r}const bo=new WeakMap;function wa(e,t){for(const n of e.nodes)if(n.parentNode!==t)return!1;return!0}function ya(e,t){const n=bo.get(t);if(n&&n.strings===e.strings&&wa(n,t)){De(n.parts,e.values);return}const o=go(e.strings),s=o.template.content.cloneNode(!0),i=o.buildParts(s),r=Array.from(s.childNodes);for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(s),De(i,e.values),bo.set(t,{strings:e.strings,parts:i,nodes:r})}function De(e,t){for(const n of e)if(n.kind==="node")At(n.child,t[n.valueIndex]);else if(n.kind==="attr"){let o=n.template[0];for(let s=0;s<n.valueIndices.length;s++)o+=_o(t[n.valueIndices[s]]),o+=n.template[s+1];o!==n.last&&(n.last=o,o===""?n.element.removeAttribute(n.name):n.element.setAttribute(n.name,o))}else if(n.kind==="event"){const o=t[n.valueIndex];o!==n.current&&(n.current&&n.element.removeEventListener(n.name,n.current),o&&n.element.addEventListener(n.name,o),n.current=o)}else if(n.kind==="prop"){const o=t[n.valueIndex];o!==n.last&&(n.last=o,n.element[n.name]=o)}else if(n.kind==="bool"){const o=!!t[n.valueIndex];o!==n.last&&(n.last=o,o?n.element.setAttribute(n.name,""):n.element.removeAttribute(n.name))}}function At(e,t){if(t==null||t===!1){e.state&&(X(e.state),e.state=null);return}if(Array.isArray(t)){Sa(e,t);return}if(ga(t)){Aa(e,t);return}if(t instanceof Node){va(e,t);return}Ea(e,_o(t))}function va(e,t){const n=e.state;n?.shape==="node"&&n.node===t||(n&&X(n),We(e,[t]),e.state={shape:"node",node:t})}function Ea(e,t){const n=e.state;if(n?.shape==="text"){n.text!==t&&(n.node.textContent=t,n.text=t);return}n&&X(n);const o=document.createTextNode(t);We(e,[o]),e.state={shape:"text",node:o,text:t}}function Aa(e,t){const n=e.state;if(n?.shape==="template"&&n.strings===t.strings){De(n.parts,t.values);return}n&&X(n);const o=go(t.strings),s=o.template.content.cloneNode(!0),i=o.buildParts(s),r=Array.from(s.childNodes);We(e,[s]),De(i,t.values),e.state={shape:"template",strings:t.strings,parts:i,nodes:r}}function Sa(e,t){const n=e.state;if(n?.shape==="array"&&n.entries.length===t.length){for(let s=0;s<t.length;s++)At(n.entries[s],t[s]);return}n&&X(n);const o=[];for(const s of t){const i=document.createTextNode("");We(e,[i]);const r={anchor:i,state:null};At(r,s),o.push(r)}e.state={shape:"array",entries:o}}function We(e,t){const n=e.anchor.parentNode;if(n)for(const o of t)n.insertBefore(o,e.anchor)}function X(e){if(e.shape==="text"){e.node.remove();return}if(e.shape==="template"){for(const t of e.parts)t.kind==="node"&&t.child.state&&(X(t.child.state),t.child.state=null);for(const t of e.nodes)t.parentNode&&t.parentNode.removeChild(t);return}if(e.shape==="node"){e.node.parentNode&&e.node.parentNode.removeChild(e.node);return}for(const t of e.entries)t.state&&X(t.state),t.anchor.remove()}function _o(e){return e==null||e===!1?"":String(e)}const Y=class Y 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(wo)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(t,n,o){if(n===o)return;const s=Ca(t);this._propValues[s]=o,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(t){if(t==null){this.removeAttribute("class");return}const o=(Array.isArray(t)?t:String(t).split(/\s+/)).map(s=>String(s).trim()).filter(s=>s!=="");this.className=o.join(" ")}requestUpdate(){this._scheduleRender()}emit(t,n){return this.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0}))}_installPropAccessors(){const t=this.constructor;for(const n of t.props){if(Object.getOwnPropertyDescriptor(this,n))continue;const o=wo(n);Object.defineProperty(this,n,{get:()=>n in this._propValues?this._propValues[n]:this.getAttribute(o),set:s=>{let i;s==null||s===!1?i=null:s===!0?i="":i=String(s),this._propValues[n]=i,i===null?this.removeAttribute(o):this.setAttribute(o,i),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&ya(this.render(),this._renderRoot)}))}_adoptStyles(){const t=this.constructor;if(t.styles.length!==0)if(t.shadow&&this.shadowRoot){const n=t.styles.map(o=>o.sheet).filter(o=>o!==null);if(this.shadowRoot.adoptedStyleSheets=n,n.length!==t.styles.length){for(const o of t.styles)if(!o.sheet){const s=document.createElement("style");s.textContent=o.cssText,this.shadowRoot.appendChild(s)}}}else this._adoptLightStyles(t)}_adoptLightStyles(t){if(!Y._lightStylesAdopted.has(t)){Y._lightStylesAdopted.add(t);for(const n of t.styles){const o=document.createElement("style");o.dataset.osUi=this.tagName.toLowerCase(),o.textContent=n.cssText,document.head.appendChild(o)}}}};Y.props=[],Y.styles=[],Y.shadow=!0,Y._lightStylesAdopted=new WeakSet;let B=Y;function Z(e,t){customElements.get(e)||customElements.define(e,t)}function wo(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Ca(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}const ka=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function k(e,...t){let n=e[0];for(let o=1;o<e.length;o++){const s=t[o-1];if(typeof s=="string"||typeof s=="number")n+=String(s);else if(s&&s.__wpdCss)n+=s.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof s);n+=e[o]}if(ka){const o=new CSSStyleSheet;return o.replaceSync(n),{__wpdCss:!0,sheet:o,cssText:n}}return{__wpdCss:!0,sheet:null,cssText:n}}const xa=k`:host{display:inline-flex}button{display:flex;align-items:center;justify-content:center;width:30px;height:30px;padding:0;border:none;border-radius:var( --os-ui-btn-radius,5px );background-color:var( --os-ui-btn-bg,transparent );background-image:var( --os-ui-btn-bg-image,none );background-repeat:var( --os-ui-btn-bg-image-repeat,no-repeat );background-size:var( --os-ui-btn-bg-image-size,auto );background-position:var( --os-ui-btn-bg-image-position,center );color:var( --os-ui-btn-color,currentColor );cursor:pointer;transition:background-color 0.15s ease,color 0.15s ease,transform 80ms ease}button:active{transform:scale( 0.9 )}@media ( prefers-reduced-motion:reduce ){button:active{transform:none}}button:hover{color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) )}button:focus-visible{color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );outline:2px solid var( --os-ui-btn-outline,currentColor );outline-offset:1px}:host( [ active ] ) button{color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-active,var( --os-ui-hover,rgba( 0,0,0,0.08 ) ) )}:host( [ danger ] ) button:hover{color:var( --os-ui-fg-on-accent,#fff );background-color:var( --os-ui-btn-danger-hover,var( --os-ui-danger,#d63638 ) )}svg{display:block;pointer-events:none;flex-shrink:0}svg:empty{display:none}.themed-icon{display:block;width:14px;height:14px;flex-shrink:0;pointer-events:none;background-color:var( --os-ui-btn-icon-color,currentColor )}::slotted( span ){line-height:1}::slotted( svg ){display:block}`,La={minimize:'<path d="M3 6h6" stroke="currentColor" stroke-width="1.25" stroke-linecap="round"/>',maximize:'<rect x="3" y="3" width="6" height="6" rx="1" stroke="currentColor" stroke-width="1.25" fill="none"/>',fullscreen:'<path d="M4.5 2H2v2.5M10 4.5V2H7.5M4.5 10H2V7.5M10 7.5V10H7.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',"fullscreen-exit":'<path d="M2 4.5H4.5V2M7.5 2V4.5H10M2 7.5H4.5V10M7.5 10V7.5H10" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',detach:'<path d="M5 2H2.5v7.5H10V7M6.5 2H10v3.5M10 2L5.5 6.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',reload:'<g transform="translate(0.6 0.6) scale(0.021)" fill="currentColor"><path d="m504.554 233.704-76.447 91.467c-6.329 7.572-15.417 11.479-24.571 11.479a31.872 31.872 0 0 1-20.504-7.447l-91.467-76.447c-13.561-11.334-15.366-31.515-4.032-45.075s31.515-15.366 45.075-4.032l37.506 31.347c-10.274-74.891-74.668-132.774-152.337-132.774C132.984 102.223 64 171.207 64 256s68.984 153.777 153.777 153.777c17.673 0 32 14.327 32 32s-14.327 32-32 32c-58.17 0-112.859-22.653-153.991-63.785C22.653 368.859 0 314.17 0 256s22.653-112.859 63.786-153.992c41.132-41.132 95.821-63.785 153.991-63.785s112.859 22.653 153.992 63.785c32.517 32.516 53.471 73.508 60.829 117.991l22.849-27.339c11.334-13.56 31.515-15.364 45.075-4.032 13.56 11.335 15.365 31.516 4.032 45.076z"/></g>',close:'<path d="M3.25 3.25l5.5 5.5M3.25 8.75l5.5-5.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round"/>',menu:'<circle cx="3" cy="6" r="1.2" fill="currentColor"/><circle cx="6" cy="6" r="1.2" fill="currentColor"/><circle cx="9" cy="6" r="1.2" fill="currentColor"/>'};function Ia(e){const t=(e??"").trim();return t===""||t.length>4096||!/^(https?:\/\/|data:image\/)/i.test(t)||/['"()\\<>\s]/.test(t)?"":t}const de=class de extends B{constructor(){super(...arguments),this._activateWired=!1}static get observedAttributes(){return[...super.observedAttributes,"aria-label"]}render(){const t=Ia(this["icon-src"]||this.getAttribute("icon-src")||""),n=t?"":this.icon||"",o=La[n]||"",s=this.getAttribute("aria-label")||"";return t?S`
2 - <button type="button" aria-label="${s}">
1 +(function(){"use strict";function Re(){const e=window.wp?.hooks;if(!e)throw new Error("[openstation] `window.wp.hooks` is not available. The plugin declares `wp-hooks` as a script dependency; if you are seeing this error, verify the enqueue order.");return e}function Vt(e,t,n,o){Re().addAction(e,t,n,o)}function Kt(e,t){return Re().removeAction(e,t)}function T(e,t,...n){return Re().applyFilters(e,t,...n)}function m(e,...t){Re().doAction(e,...t)}const f={INIT:"os.init",WALLPAPERS:"os.wallpapers",GAMES:"os.games",UNFOCUS_EFFECTS:"os.unfocus-effects",WINDOW_REVEALS:"os.window-reveals",WALLPAPER_MOUNTING:"os.wallpaper.mounting",WALLPAPER_MOUNTED:"os.wallpaper.mounted",WALLPAPER_UNMOUNTING:"os.wallpaper.unmounting",WALLPAPER_MOUNT_FAILED:"os.wallpaper.mount-failed",WALLPAPER_VISIBILITY:"os.wallpaper.visibility",WALLPAPER_SUSPEND:"os.wallpaper.suspend",WALLPAPER_PREVIEW_PARAMS:"os.wallpaper.preview-params",WALLPAPER_SETTINGS_CHANGED:"os.wallpaper.settings-changed",IFRAME_READY:"os.iframe.ready",IFRAME_ERROR:"os.iframe.error",IFRAME_NETWORK_COMPLETED:"os.iframe.network-completed",SHELL_ERROR:"os.shell.error",BROADCAST:"os.broadcast",MONITOR_ENTRY:"os.monitor.entry",WALLPAPER_SURFACES:"os.wallpaper.surfaces",DESKTOP_THEME_CHANGED:"os.os-theme.changed",DESKTOP_THEME_ICON:"os.os-theme.icon",DESKTOP_THEME_ICON_COLOR:"os.os-theme.icon-color",WALLPAPERS_SERVER_CHANGED:"os.wallpapers.server-changed",EXTENDED_OPTIONS_CHANGED:"os.extended-options.changed",WINDOW_GEOMETRY:"os.window.geometry",WINDOW_OPENED:"os.window.opened",WINDOW_CONTENT_LOADING:"os.window.content-loading",WINDOW_CONTENT_LOADED:"os.window.content-loaded",WINDOW_LOADING_OVERLAY:"os.window.loading-overlay",WINDOW_REOPENED:"os.window.reopened",WINDOW_MENU_OPENED:"os.window.menu-opened",WINDOW_CLOSING:"os.window.closing",WINDOW_CLOSED:"os.window.closed",WINDOW_FOCUSED:"os.window.focused",WINDOW_BLURRED:"os.window.blurred",WINDOW_MINIMIZED:"os.window.minimized",WINDOW_RESTORED:"os.window.restored",WINDOW_CHILD_BLOCKED:"os.window.child-blocked",WINDOW_MAXIMIZED:"os.window.maximized",WINDOW_UNMAXIMIZED:"os.window.unmaximized",WINDOW_FULLSCREEN_ENTERED:"os.window.fullscreen-entered",WINDOW_FULLSCREEN_EXITED:"os.window.fullscreen-exited",WINDOW_AUTO_EXIT_FULLSCREEN:"os.window.auto-exit-fullscreen",WINDOW_FOCUS_ON_DRAG_HOVER:"os.window.focus-on-drag-hover",WINDOW_BOUNDS_CHANGED:"os.window.bounds-changed",WINDOW_MOVED:"os.window.moved",WINDOW_RESIZED:"os.window.resized",WINDOW_DRAG_START:"os.window.drag-start",WINDOW_DRAG_END:"os.window.drag-end",WINDOW_RESIZE_START:"os.window.resize-start",WINDOW_RESIZE_END:"os.window.resize-end",WINDOW_DETACHED:"os.window.detached",WINDOW_RELOADED:"os.window.reloaded",WINDOW_TITLE_CHANGED:"os.window.title-changed",WINDOW_HIGHLIGHT_CHANGED:"os.window.highlight-changed",WINDOW_BODY_RESIZED:"os.window.body-resized",NATIVE_WINDOW_BEFORE_RENDER:"os.native-window.before-render",NATIVE_WINDOW_AFTER_RENDER:"os.native-window.after-render",NATIVE_WINDOW_BEFORE_CLOSE:"os.native-window.before-close",WINDOW_CHROME_THEME:"os.window.chrome.theme",WINDOW_CHROME_CONTROLS:"os.window.chrome.controls",WINDOW_CHROME_SLOT:"os.window.chrome.slot",WINDOW_CHROME_RENDER:"os.window.chrome.render",WINDOW_CHROME_APPLIED:"os.window.chrome.applied",WINDOW_CHROME_THEME_CHANGED:"os.window.chrome.theme-changed",DESKTOP_ICON_CLICKED:"os.os-icon.clicked",DESKTOP_ICONS_RENDERED:"os.os-icons.rendered",ICON_BADGE_CHANGED:"os.icon.badge-changed",COMPONENTS_REGISTERED:"os.components.registered",DOCK_ITEM_APPENDED:"os.dock.item-appended",DOCK_ITEM_REMOVED:"os.dock.item-removed",DOCK_BEFORE_RENDER:"os.dock.before-render",DOCK_AFTER_RENDER:"os.dock.after-render",DOCK_REFRESH_ACTIVE:"os.dock.refresh-active",DOCK_TILE_CLASS:"os.dock.tile-class",DOCK_TILE_ELEMENT:"os.dock.tile-element",DOCK_TILE_RENDERED:"os.dock.tile-rendered",DOCK_TILE_TOOLTIP:"os.dock.tile-tooltip",DOCK_PEEK_CARD_CONTENT:"os.dock.peek-card-content",DOCK_PEEK_CARD_ELEMENT:"os.dock.peek-card-element",CONSTELLATION_PANEL:"os.constellation.panel",CONSTELLATION_OPENED:"os.constellation.opened",CONSTELLATION_CLOSED:"os.constellation.closed",OVERVIEW_ENTERING:"os.overview.entering",OVERVIEW_ENTERED:"os.overview.entered",OVERVIEW_EXITING:"os.overview.exiting",OVERVIEW_EXITED:"os.overview.exited",OVERVIEW_WINDOW_HOVER:"os.overview.window-hover",OVERVIEW_WINDOW_UNHOVER:"os.overview.window-unhover",OVERVIEW_WINDOW_CLICK:"os.overview.window-click",WORK_AREA_CHANGED:"os.work-area.changed",ARRANGE_CASCADE_STARTING:"os.arrange.cascade.starting",ARRANGE_CASCADE_APPLIED:"os.arrange.cascade.applied",ARRANGE_TILE_STARTING:"os.arrange.tile.starting",ARRANGE_TILE_APPLIED:"os.arrange.tile.applied",ARRANGE_TILE_DIMENSIONS:"os.arrange.tile.dimensions",ARRANGE_COLUMNS_STARTING:"os.arrange.columns.starting",ARRANGE_COLUMNS_APPLIED:"os.arrange.columns.applied",ARRANGE_FOCUS_SPLIT:"os.arrange.focus.split",ARRANGE_FOCUS_STARTING:"os.arrange.focus.starting",ARRANGE_FOCUS_APPLIED:"os.arrange.focus.applied",ARRANGE_SNAP_CHANGED:"os.arrange.snap.changed",ARRANGE_SNAP_CELL_SIZE:"os.arrange.snap.cell-size",POINTER_SHAKE:"os.pointer.shake",GRID_SNAP_DIMENSIONS:"os.grid-snap.dimensions",GRID_SNAP_ARMED:"os.grid-snap.armed",GRID_SNAP_CHANGED:"os.grid-snap.changed",GRID_SNAP_ANCHOR_RESET:"os.grid-snap.anchor-reset",GRID_SNAP_CANCELED:"os.grid-snap.canceled",GRID_SNAP_COMMITTED:"os.grid-snap.committed",GRID_SNAP_REFLOWED:"os.grid-snap.reflowed",SNAP_ZONE_PENDING:"os.snap.zone-pending",SNAP_ZONE_CANCELED:"os.snap.zone-canceled",SNAP_ZONE_COMMITTED:"os.snap.zone-committed",SNAP_SPLIT_FILLED:"os.snap.split-filled",WIDGETS:"os.widgets",WIDGET_MOUNTING:"os.widget.mounting",WIDGET_MOUNTED:"os.widget.mounted",WIDGET_UNMOUNTING:"os.widget.unmounting",WIDGET_MOUNT_FAILED:"os.widget.mount-failed",WIDGET_ADDED:"os.widget.added",WIDGET_REMOVED:"os.widget.removed",DESKTOP_CREATED:"os.os.created",DESKTOP_CLOSED:"os.os.closed",DESKTOP_SWITCHED:"os.os.switched",DESKTOP_RENAMED:"os.os.renamed",WINDOW_DESKTOP_CHANGED:"os.os.window-moved",PRIMARY_DESKTOP_ID:"os.primary-desktop-id",WORKSPACE_PRESETS:"os.workspaces.presets",WORKSPACE_PROFILE:"os.workspaces.profile",WORKSPACE_UPDATED:"os.workspaces.updated",WORKSPACE_PROVISIONED:"os.workspaces.provisioned",WINDOWS_BEFORE_CLOSE_ALL:"os.windows.before-close-all",WINDOWS_CLOSE_ALL:"os.windows.close-all",WINDOWS_AFTER_CLOSE_ALL:"os.windows.after-close-all",COMMAND_BEFORE_RUN:"os.command.before-run",COMMAND_AFTER_RUN:"os.command.after-run",COMMAND_ERROR:"os.command.error",SHELL_RESIZED:"os.shell.resized",SHELL_VISIBILITY:"os.shell.visibility",CONNECTION_OPENED:"os.connection.opened",CONNECTION_CLOSED:"os.connection.closed",CONNECTION_MESSAGE:"os.connection.message",IFRAME_CONNECTION_REQUEST:"os.iframe.connection-request",WINDOW_CONTENT_CHANGED:"os.window-links.content-changed",WINDOW_LINK_GROUPS_CHANGED:"os.window-links.groups-changed",WINDOW_LINKS_CONTENT:"os.window-links.content",WINDOW_LINK_GROUPS:"os.window-links.groups",WINDOW_LINK_EDGES:"os.window-links.edges",RELATED_ENTITIES_ITEMS:"os.related-entities.items",WINDOW_LINK_RENDERERS:"os.window-links.renderers",WINDOW_LINK_RENDERER:"os.window-links.renderer",EDITOR_PREVIEW_WINDOW_CONFIG:"os.editor-preview.window-config",EDITOR_PREVIEW_LIVE:"os.editor-preview.live",EDITOR_PREVIEW_OPENED:"os.editor-preview.opened",EDITOR_PREVIEW_CLOSED:"os.editor-preview.closed",REVISIONS_WINDOW_CONFIG:"os.revisions.window-config",REVISIONS_OPENED:"os.revisions.opened",FILE_DROP_FILES_DETECTED:"os.drop.files-detected",FILE_DROP_FILES_REJECTED:"os.drop.files-rejected",FILE_DROP_DIALOG_FIELDS:"os.drop.dialog-fields",FILE_DROP_BEFORE_UPLOAD:"os.drop.before-upload",FILE_DROP_UPLOAD_STARTED:"os.drop.upload-started",FILE_DROP_UPLOAD_PROGRESS:"os.drop.upload-progress",FILE_DROP_AFTER_UPLOAD:"os.drop.after-upload",FILE_DROP_UPLOAD_FAILED:"os.drop.upload-failed",AUTH_LOST:"os.auth.lost",AUTH_RESTORED:"os.auth.restored",MODE_CHANGED:"os.mode.changed",SESSION_SNAPSHOT:"os.session.snapshot"},Jo="os.activity.";function et(e){return Jo+String(e).replace(/[^a-zA-Z0-9_.-]/g,".")}let ei=0;const tt={publish(e,t){m(et(e),t)},subscribe(e,t){const n=`os/activity-sub/${++ei}`,o=et(e);Vt(o,n,s=>t(s));let i=!1;return()=>{i||(i=!0,Kt(o,n))}},filter(e,t,...n){return T(et(e),t,...n)}},jt="__openStationSharedStores";function ti(){const e=window;let t=e[jt];return t||(t=new Map,e[jt]=t),t}function k(e,t){const n=ti();let o=n.get(e);o||(o={state:t(),listeners:new Set,rebuild:t},n.set(e,o));const i={get state(){return o.state},set state(s){o.state=s},getState(){return o.state},notify(){for(const s of Array.from(o.listeners))try{s(o.state)}catch(r){console.error(`[desktop-mode/shared-store:${e}] subscriber threw:`,r)}},subscribe(s){return o.listeners.add(s),()=>{o.listeners.delete(s)}},setState(s){const r=o.state;if(typeof r!="object"||r===null){console.warn(`[desktop-mode/shared-store:${e}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(r,s),i.notify()},reset(){const s=o.rebuild(),r=o.state;if(typeof r=="object"&&r!==null&&typeof s=="object"&&s!==null){const c=r;for(const a of Object.keys(c))delete c[a];Object.assign(c,s)}else o.state=s;o.listeners.clear()}};return i}const B=k("desktop-mode/window-channels",()=>({parentSubs:new Map,nativeSubs:new Map,readyWindows:new Set,loadingWindows:new Set,pendingSends:new Map}));function Oe(e,t,n,o){let i=e.get(t);if(!i){if(!o)return;i=new Map,e.set(t,i)}let s=i.get(n);if(!s){if(!o)return;s=new Set,i.set(n,s)}return s}function Yt(e,t,n,o){const i={channel:n,windowId:t},s=Oe(e,t,n,!1);if(s)for(const c of Array.from(s))try{c(o,i)}catch(a){typeof console<"u"&&console.error(`[openstation] window-channel subscriber for "${n}" threw:`,a)}const r=Oe(e,t,"*",!1);if(r)for(const c of Array.from(r))try{c(o,i)}catch(a){typeof console<"u"&&console.error(`[openstation] window-channel wildcard subscriber for "${t}" threw:`,a)}}function ni(e,t,n){const o=Oe(B.state.parentSubs,e,t,!0);o.add(n);let i=!1;return()=>{i||(i=!0,o.delete(n))}}function Xt(e,t,n){Yt(B.state.parentSubs,e,t,n)}function oi(e,t,n){const o=Oe(B.state.nativeSubs,e,t,!0);o.add(n);let i=!1;return()=>{i||(i=!0,o.delete(n))}}function ii(e,t,n){Yt(B.state.nativeSubs,e,t,n)}function Zt(e){return B.state.readyWindows.has(e)}function De(e){const{loadingWindows:t}=B.state;t.has(e)||(t.add(e),m(f.WINDOW_CONTENT_LOADING,{windowId:e}),typeof document<"u"&&document.dispatchEvent(new CustomEvent("os-window-content-loading",{detail:{windowId:e}})))}function $(e){const{readyWindows:t,loadingWindows:n,pendingSends:o}=B.state;if(!t.has(e)){t.add(e);const i=o.get(e);if(i){o.delete(e);for(const s of i)try{s.flush()}catch(r){typeof console<"u"&&console.error(`[openstation] flushing queued window-send for "${s.channel}" threw:`,r)}}}n.delete(e)&&(m(f.WINDOW_CONTENT_LOADED,{windowId:e}),typeof document<"u"&&document.dispatchEvent(new CustomEvent("os-window-content-loaded",{detail:{windowId:e}})))}function si(e,t,n,o){const{pendingSends:i}=B.state;let s=i.get(e);s||(s=[],i.set(e,s)),s.push({channel:t,payload:n,flush:o})}function ri(e){const t=B.state;t.parentSubs.delete(e),t.nativeSubs.delete(e),t.readyWindows.delete(e),t.loadingWindows.delete(e),t.pendingSends.delete(e)}const ai=k("desktop-mode/connection",()=>({connSeq:0,connections:new Map,connectionsByTarget:new Map,syntheticIframes:new Map}));function li(e){return ai.state.syntheticIframes.get(e)??null}const ci="data-os-mode";function Qt(e=typeof document<"u"?document.documentElement:null){return!!e&&e.getAttribute(ci)==="mobile"}const di=Object.freeze({top:0,right:0,bottom:0,left:0});function ui(e,t,n){return{x:n.left,y:n.top,width:Math.max(0,e-n.left-n.right),height:Math.max(0,t-n.top-n.bottom)}}const hi="os/work-area";function fi(){return{insets:{...di},rect:{x:0,y:0,width:0,height:0},viewport:{x:0,y:0,width:0,height:0},area:{width:0,height:0}}}const nt=k(hi,()=>({snapshot:fi(),installed:!1,areaEl:null}));function We(e){const t=e??nt.state.areaEl;if(!t)return{...nt.state.snapshot.rect};const n=t.clientWidth||t.getBoundingClientRect().width,o=t.clientHeight||t.getBoundingClientRect().height;return ui(n,o,nt.state.snapshot.insets)}const Jt="desktop-mode";function ot(){return window.wp?.i18n}function _(e,t=Jt){return ot()?.__(e,t)??e}function pi(e,t,n=Jt){return ot()?._x(e,t,n)??e}function se(e,...t){const n=ot()?.sprintf;if(n)return n(e,...t);let o=0;return e.replace(/%(?:(\d+)\$)?[sd]/g,(i,s)=>{const r=s?Number.parseInt(s,10)-1:o++;return String(t[r]??"")})}function y(e,...t){return{__wpdHtml:!0,strings:e,values:t}}function mi(e){return!!e&&e.__wpdHtml===!0}const gi="$$wpd$$",L=/\$\$wpd\$\$(\d+)\$\$/g,_i="$$wpd-node$$",bi=/^\$\$wpd-node\$\$(\d+)\$\$$/,wi=new Set(["style","script","textarea","title"]);function yi(e){let t="",n=!1,o=null,i=!1,s=null,r="",c=!1;for(let a=0;a<e.length;a++){const d=e[a];t+=d;for(let l=0;l<d.length;l++){const u=d[l];if(i){d.startsWith("-->",l)&&(i=!1,l+=2);continue}if(s!==null){u==="<"&&d[l+1]==="/"&&d.slice(l+2,l+2+s.length).toLowerCase()===s&&(l+=1+s.length,s=null,n=!0,c=!1,r="");continue}if(o!==null){u===o&&(o=null);continue}if(n){u==='"'||u==="'"?(o=u,c=!1):u===">"?(n=!1,c=!1,wi.has(r)&&(s=r),r=""):c&&(/[a-zA-Z0-9-]/.test(u)?r+=u.toLowerCase():c=!1);continue}if(d.startsWith("<!--",l)){i=!0,l+=3;continue}const p=d[l+1]??"";u==="<"&&/[a-zA-Z/!]/.test(p)&&(n=!0,r="",c=/[a-zA-Z]/.test(p))}a<e.length-1&&(t+=n||i||s!==null?`${gi}${a}$$`:`<!--${_i}${a}$$-->`)}return t}const en=new WeakMap;function tn(e){const t=en.get(e);if(t)return t;const n=document.createElement("template");n.innerHTML=yi(e);const o=[],i=(c,a)=>{if(c.nodeType===Node.ELEMENT_NODE){const u=c;for(const p of Array.from(u.attributes)){const g=p.name,b=p.value,v=g[0];if(L.test(b))if(L.lastIndex=0,v==="@"){const w=L.exec(b);L.lastIndex=0,o.push({path:a,kind:"event",name:g.slice(1),valueIndex:w?Number(w[1]):0}),u.removeAttribute(g)}else if(v==="."){const w=L.exec(b);L.lastIndex=0,o.push({path:a,kind:"prop",name:g.slice(1),valueIndex:w?Number(w[1]):0}),u.removeAttribute(g)}else if(v==="?"){const w=L.exec(b);L.lastIndex=0,o.push({path:a,kind:"bool",name:g.slice(1),valueIndex:w?Number(w[1]):0}),u.removeAttribute(g)}else{const w=[],S=[];let A=0,x;for(L.lastIndex=0;(x=L.exec(b))!==null;)w.push(b.slice(A,x.index)),S.push(Number(x[1])),A=x.index+x[0].length;w.push(b.slice(A)),o.push({path:a,kind:"attr",name:g,template:w,valueIndices:S}),u.setAttribute(g,"")}}}const d=Array.from(c.childNodes);let l=0;for(let u=0;u<d.length;u++){const p=d[u],g=u+l;if(p.nodeType===Node.COMMENT_NODE){const b=bi.exec(p.data);if(b){const v=document.createTextNode("");p.parentNode.replaceChild(v,p),o.push({path:[...a,g],kind:"node",valueIndex:Number(b[1])})}continue}if(p.nodeType===Node.TEXT_NODE){const b=p.textContent||"";if(!L.test(b)){L.lastIndex=0;continue}L.lastIndex=0;const v=p.parentNode;let w=0,S;const A=[],x=[];for(L.lastIndex=0;(S=L.exec(b))!==null;){S.index>w&&A.push(document.createTextNode(b.slice(w,S.index)));const N=document.createTextNode("");A.push(N),x.push({path:[...a,g+A.length-1],kind:"node",valueIndex:Number(S[1])}),w=S.index+S[0].length}w<b.length&&A.push(document.createTextNode(b.slice(w)));for(const N of A)v.insertBefore(N,p);v.removeChild(p),l+=A.length-1,o.push(...x)}else i(p,[...a,g])}};i(n.content,[]);const r={template:n,buildParts:c=>{const a=[];for(const d of o){let l=c;for(const u of d.path)l=l.childNodes[u];d.kind==="node"?a.push({kind:"node",valueIndex:d.valueIndex,child:{anchor:l,state:null}}):d.kind==="attr"?a.push({kind:"attr",element:l,name:d.name,template:d.template,valueIndices:d.valueIndices}):d.kind==="event"?a.push({kind:"event",valueIndex:d.valueIndex,element:l,name:d.name}):d.kind==="prop"?a.push({kind:"prop",valueIndex:d.valueIndex,element:l,name:d.name}):d.kind==="bool"&&a.push({kind:"bool",valueIndex:d.valueIndex,element:l,name:d.name})}return a}};return en.set(e,r),r}const nn=new WeakMap;function vi(e,t){for(const n of e.nodes)if(n.parentNode!==t)return!1;return!0}function Ei(e,t){const n=nn.get(t);if(n&&n.strings===e.strings&&vi(n,t)){Me(n.parts,e.values);return}const o=tn(e.strings),i=o.template.content.cloneNode(!0),s=o.buildParts(i),r=Array.from(i.childNodes);for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(i),Me(s,e.values),nn.set(t,{strings:e.strings,parts:s,nodes:r})}function Me(e,t){for(const n of e)if(n.kind==="node")Pe(n.child,t[n.valueIndex]);else if(n.kind==="attr"){let o=n.template[0];for(let i=0;i<n.valueIndices.length;i++)o+=on(t[n.valueIndices[i]]),o+=n.template[i+1];o!==n.last&&(n.last=o,o===""?n.element.removeAttribute(n.name):n.element.setAttribute(n.name,o))}else if(n.kind==="event"){const o=t[n.valueIndex];o!==n.current&&(n.current&&n.element.removeEventListener(n.name,n.current),o&&n.element.addEventListener(n.name,o),n.current=o)}else if(n.kind==="prop"){const o=t[n.valueIndex];o!==n.last&&(n.last=o,n.element[n.name]=o)}else if(n.kind==="bool"){const o=!!t[n.valueIndex];o!==n.last&&(n.last=o,o?n.element.setAttribute(n.name,""):n.element.removeAttribute(n.name))}}function Pe(e,t){if(t==null||t===!1){e.state&&(Y(e.state),e.state=null);return}if(Array.isArray(t)){Ci(e,t);return}if(mi(t)){xi(e,t);return}if(t instanceof Node){Ai(e,t);return}Si(e,on(t))}function Ai(e,t){const n=e.state;n?.shape==="node"&&n.node===t||(n&&Y(n),de(e,[t]),e.state={shape:"node",node:t})}function Si(e,t){const n=e.state;if(n?.shape==="text"){n.text!==t&&(n.node.textContent=t,n.text=t);return}n&&Y(n);const o=document.createTextNode(t);de(e,[o]),e.state={shape:"text",node:o,text:t}}function xi(e,t){const n=e.state;if(n?.shape==="template"&&n.strings===t.strings){Me(n.parts,t.values);return}n&&Y(n);const o=tn(t.strings),i=o.template.content.cloneNode(!0),s=o.buildParts(i),r=Array.from(i.childNodes);de(e,[i]),Me(s,t.values),e.state={shape:"template",strings:t.strings,parts:s,nodes:r}}function Ci(e,t){const n=e.state;if(n?.shape==="array"){const i=Math.min(n.entries.length,t.length);for(let s=0;s<i;s++)Pe(n.entries[s],t[s]);if(t.length<n.entries.length){for(let s=t.length;s<n.entries.length;s++){const r=n.entries[s];r.state&&Y(r.state),r.anchor.remove()}n.entries.length=t.length}else for(let s=n.entries.length;s<t.length;s++){const r=document.createTextNode("");de(e,[r]);const c={anchor:r,state:null};Pe(c,t[s]),n.entries.push(c)}return}n&&Y(n);const o=[];for(const i of t){const s=document.createTextNode("");de(e,[s]);const r={anchor:s,state:null};Pe(r,i),o.push(r)}e.state={shape:"array",entries:o}}function de(e,t){const n=e.anchor.parentNode;if(n)for(const o of t)n.insertBefore(o,e.anchor)}function Y(e){if(e.shape==="text"){e.node.remove();return}if(e.shape==="template"){for(const t of e.parts)t.kind==="node"&&t.child.state&&(Y(t.child.state),t.child.state=null);for(const t of e.nodes)t.parentNode&&t.parentNode.removeChild(t);return}if(e.shape==="node"){e.node.parentNode&&e.node.parentNode.removeChild(e.node);return}for(const t of e.entries)t.state&&Y(t.state),t.anchor.remove()}function on(e){return e==null||e===!1?"":String(e)}const ie=class ie 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(sn)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(t,n,o){if(n===o)return;const i=ki(t);this._propValues[i]=o,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(t){if(t==null){this.removeAttribute("class");return}const o=(Array.isArray(t)?t:String(t).split(/\s+/)).map(i=>String(i).trim()).filter(i=>i!=="");this.className=o.join(" ")}requestUpdate(){this._scheduleRender()}emit(t,n){return this.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0}))}_installPropAccessors(){const t=this.constructor;for(const n of t.props){if(Object.getOwnPropertyDescriptor(this,n))continue;const o=sn(n);Object.defineProperty(this,n,{get:()=>n in this._propValues?this._propValues[n]:this.getAttribute(o),set:i=>{let s;i==null||i===!1?s=null:i===!0?s="":s=String(i),this._propValues[n]=s,s===null?this.removeAttribute(o):this.setAttribute(o,s),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&Ei(this.render(),this._renderRoot)}))}_adoptStyles(){const t=this.constructor;if(t.styles.length!==0)if(t.shadow&&this.shadowRoot){const n=t.styles.map(o=>o.sheet).filter(o=>o!==null);if(this.shadowRoot.adoptedStyleSheets=n,n.length!==t.styles.length){for(const o of t.styles)if(!o.sheet){const i=document.createElement("style");i.textContent=o.cssText,this.shadowRoot.appendChild(i)}}}else this._adoptLightStyles(t)}_adoptLightStyles(t){if(!ie._lightStylesAdopted.has(t)){ie._lightStylesAdopted.add(t);for(const n of t.styles){const o=document.createElement("style");o.dataset.osUi=this.tagName.toLowerCase(),o.textContent=n.cssText,document.head.appendChild(o)}}}};ie.props=[],ie.styles=[],ie.shadow=!0,ie._lightStylesAdopted=new WeakSet;let z=ie;function X(e,t){customElements.get(e)||customElements.define(e,t)}function sn(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function ki(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}const Ti=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function C(e,...t){let n=e[0];for(let o=1;o<e.length;o++){const i=t[o-1];if(typeof i=="string"||typeof i=="number")n+=String(i);else if(i&&i.__wpdCss)n+=i.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof i);n+=e[o]}if(Ti){const o=new CSSStyleSheet;return o.replaceSync(n),{__wpdCss:!0,sheet:o,cssText:n}}return{__wpdCss:!0,sheet:null,cssText:n}}const Ii=C`:host{--_bg:var( --os-tooltip-bg,var( --os-ui-scrim,rgba( 0,0,0,0.85 ) ) );--_fg:var( --os-tooltip-fg,var( --os-ui-fg-on-accent,#fff ) );position:fixed;top:0;left:0;z-index:calc( var( --os-z-fullscreen,99999 ) + 1 );display:block;max-width:280px;pointer-events:none;opacity:0;visibility:hidden;transform:translateY( -2px );transition:opacity 0.15s ease,transform 0.15s ease,visibility 0s linear 0.15s}:host( [ open ] ){opacity:1;visibility:visible;transform:none;transition:opacity 0.15s ease,transform 0.15s ease,visibility 0s}.surface{display:flex;flex-direction:column;gap:2px;padding:6px 12px;border-radius:6px;background:var( --_bg );color:var( --_fg );font-size:12px;font-weight:400;line-height:1.4;overflow-wrap:anywhere}.heading{font-weight:600}.heading + .text{opacity:0.8}@media ( prefers-reduced-motion:reduce ){:host,:host( [ open ] ){transform:none;transition:none}}`,Li=500,Z=8,Ee=class Ee extends z{connectedCallback(){super.connectedCallback?.(),this.setAttribute("role","tooltip")}render(){const t=this.heading,n=this.text;return y`
2 + <div part="surface" class="surface">
3 + ${t?y`<strong class="heading">${t}</strong>`:""}
4 + ${n?y`<span class="text">${n}</span>`:""}
5 + </div>
6 + `}};Ee.props=["heading","text","open"],Ee.styles=[Ii],Ee.help=void 0;let it=Ee;X("os-tooltip",it);let re=null,$e=null,ue=null,ze=null,he=null;function Ni(){return(!re||!re.isConnected)&&(re=document.createElement("os-tooltip"),document.body.appendChild(re)),re}function Ri(e){const t=typeof e=="function"?e():e;if(!t)return null;const n=typeof t=="string"?{text:t}:t;return n.heading||n.text?n:null}function st(){ue!==null&&(clearTimeout(ue),ue=null,ze=null),he!==null&&(cancelAnimationFrame(he),he=null)}function rn(e){e.key==="Escape"&&ln()}function Oi(e,t,n){let o=e.bottom+Z;o+t.height>n.height-Z&&e.top-Z-t.height>=Z&&(o=e.top-Z-t.height);const i=e.left+(e.width-t.width)/2,s=Math.max(Z,n.width-t.width-Z),r=Math.min(Math.max(i,Z),s);return{top:Math.round(o),left:Math.round(r)}}function an(e,t){if(st(),!e.isConnected||e.getAttribute("aria-expanded")==="true")return;const n=Ri(t);if(!n)return;const o=Ni();$e=e,n.heading?o.setAttribute("heading",n.heading):o.removeAttribute("heading"),n.text?o.setAttribute("text",n.text):o.removeAttribute("text"),he=requestAnimationFrame(()=>{if(he=null,$e!==e||!e.isConnected)return;const i=o.getBoundingClientRect(),{top:s,left:r}=Oi(e.getBoundingClientRect(),{width:i.width,height:i.height},{width:window.innerWidth,height:window.innerHeight});o.style.top=`${s}px`,o.style.left=`${r}px`,o.setAttribute("open",""),document.addEventListener("keydown",rn,!0)})}function ln(){st(),$e=null,re?.removeAttribute("open"),document.removeEventListener("keydown",rn,!0)}function Di(e){const t=e.composedPath()[0];if(!(t instanceof Element))return!1;try{return t.matches(":focus-visible")}catch{return!1}}function Wi(e,t,n={}){const o=n.delay??Li,i=c=>{c.pointerType!=="touch"&&(st(),ze=e,ue=setTimeout(()=>{ue=null,ze=null,an(e,t)},o))},s=c=>{Di(c)&&an(e,t)},r=()=>{($e===e||ze===e)&&ln()};return e.addEventListener("pointerenter",i),e.addEventListener("pointerleave",r),e.addEventListener("pointerdown",r),e.addEventListener("focusin",s),e.addEventListener("focusout",r),()=>{e.removeEventListener("pointerenter",i),e.removeEventListener("pointerleave",r),e.removeEventListener("pointerdown",r),e.removeEventListener("focusin",s),e.removeEventListener("focusout",r),r()}}const Mi="openstation";function Pi(e,t){let n;if(typeof e=="string")try{n=new URL(e,t??(typeof window<"u"?window.location.href:void 0))}catch{return!1}else n=e;return n.pathname.slice(n.pathname.lastIndexOf("/")+1)==="admin.php"&&n.searchParams.get("page")===Mi}const cn="os_tab",$i=k("desktop-mode/native-url-remap",()=>({remaps:[],deps:null}));function rt(e,t={}){const{deps:n,remaps:o}=$i.state;if(!n||!e)return!1;let i;try{i=new URL(e,n.adminUrl)}catch{return!1}const s=n.getSnapshot();for(const r of o){if(!r.matches(e,i)||r.enabled&&!r.enabled(s))continue;if(r.onMatch)try{r.onMatch(e,i)}catch(u){console.warn(`[openstation] URL remap onMatch hook threw for "${r.id}":`,u)}let c;const a=i.searchParams.get(cn);if(r.params)try{c=r.params(e,i)??void 0}catch(u){console.warn(`[openstation] URL remap params hook threw for "${r.id}":`,u)}a&&/^[a-z0-9_-]+$/.test(a)&&(c={...c??{},tab:a});const d=t.newInstance&&n.openNewById?n.openNewById:n.openById;if(c?d(r.nativeWindowId,{params:c}):d(r.nativeWindowId))return!0}return!1}const zi="os-window-tab-change";function at(e){return Array.from(e.querySelectorAll(".os-window__tab"))}function dn(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function un(e,t){return`${e.id||"os-window"}-tab-${dn(t)}`}function hn(e,t){return`${e.id||"os-window"}-panel-${dn(t)}`}function fn(e){const t=e.querySelector(".os-window__tab-plate");if(!t)return;const n=e.querySelector(".os-window__tab--active");if(!n){t.dataset.empty="",e.dataset.tabPlateEmpty="";return}delete t.dataset.empty,delete e.dataset.tabPlateEmpty,e.style.setProperty("--_tab-plate-x",`${n.offsetLeft}px`),e.style.setProperty("--_tab-plate-w",`${n.offsetWidth}px`),e.style.setProperty("--_tab-strip-w",`${e.clientWidth}px`),n.offsetWidth>0&&(t.dataset.placed="")}function fe(e){if(e){if(e.querySelector(":scope > .os-window__tab")){e.setAttribute("role","tablist");const t=e.dataset.tablistLabel;t&&e.setAttribute("aria-label",t);return}e.setAttribute("role","presentation"),e.removeAttribute("aria-label")}}function pn(e){const t=at(e);if(t.length===0)return;const n=t.find(o=>o.classList.contains("os-window__tab--active"))??t[0];for(const o of t){const i=o===n?0:-1;o.tabIndex!==i&&(o.tabIndex=i)}}function Hi(e,t){const n=t;if(n.altKey||n.ctrlKey||n.metaKey)return;const i=n.target?.closest(".os-window__tab");if(!i)return;const s=at(e),r=s.indexOf(i);if(r<0)return;const c=getComputedStyle(e).direction==="rtl";let a;switch(n.key){case"ArrowRight":a=s[c?r-1:r+1];break;case"ArrowLeft":a=s[c?r+1:r-1];break;case"Home":a=s[0];break;case"End":a=s[s.length-1];break;default:return}!a||a===i||(n.preventDefault(),i.tabIndex=-1,a.tabIndex=0,a.focus(),a.scrollIntoView?.({block:"nearest",inline:"nearest"}))}function mn(e){const t=new Map;for(const n of at(e))n.dataset.kind==="panel"&&n.dataset.panel&&t.set(n.dataset.panel,n);return t}function gn(e){const t=e.querySelector(".os-window__body");return t?Array.from(t.querySelectorAll("os-tabpanel[ for ]")).filter(n=>!n.parentElement?.closest("os-tabpanel, os-tabs")):[]}function lt(e,t){const n=e.querySelector(".os-window__tabs");if(!n)return;let o=!1;for(const[i,s]of mn(n)){const r=i===t;o=o||r,s.classList.toggle("os-window__tab--active",r),s.setAttribute("aria-selected",r?"true":"false")}if(o){for(const i of gn(e)){const s=i.getAttribute("for")===t;i.toggleAttribute("hidden",!s),i.setAttribute("aria-hidden",s?"false":"true")}pn(n),fn(n),e.dispatchEvent(new CustomEvent(zi,{bubbles:!0,detail:{value:t}}))}}function Fi(e,t,n){const o=e.querySelector(".os-window__tabs");if(!o)return;const i=mn(o),s=Array.from(i.entries()).find(([,l])=>l.classList.contains("os-window__tab--active"))?.[0];let r=o.querySelector(".os-window__tab-plate");for(const l of t){let u=i.get(l.value);if(u)i.delete(l.value);else{const p=document.createElement("button");p.type="button",u=p,u.className="os-window__tab",u.dataset.kind="panel",u.dataset.panel=l.value,u.setAttribute("role","tab"),u.setAttribute("aria-selected","false"),u.tabIndex=-1}u.textContent!==l.label&&(u.textContent=l.label),u.id=un(e,l.value),u.setAttribute("aria-controls",hn(e,l.value)),u.previousElementSibling!==r&&o.insertBefore(u,r?r.nextSibling:o.firstChild),r=u}for(const l of i.values())l.remove();fe(o);const c=o.querySelector(":scope > .os-window__tab")!==null;for(const l of gn(e)){const u=l.getAttribute("for");u&&(l.id=hn(e,u),c?l.setAttribute("aria-labelledby",un(e,u)):l.removeAttribute("aria-labelledby"))}const a=l=>l!==void 0&&t.some(u=>u.value===l),d=[n,s,t[0]?.value].find(a);d!==void 0&&lt(e,d)}let Ui=0;function Gi(e,t={}){const n=++Ui,o=l=>`desktop-mode/native-render-ctx/${e}/${n}/${l}`,i=new AbortController,s=[],r=(l,u,p,g)=>{const b=o(u);Vt(l,b,w=>{p(w)&&g(w)});const v=()=>{Kt(l,b)};return s.push(v),v},c=l=>!!l&&typeof l=="object"&&l.windowId===e;return{ctx:{window:{send(l,u){typeof l!="string"||l===""||Xt(e,l,u)},on(l,u){return typeof l!="string"||l===""||typeof u!="function"?()=>{}:oi(e,l,u)},markLoading(){De(e)},markReady(){$(e)}},markLoading(){De(e)},markReady(){$(e)},signal:i.signal,onResize(l){return typeof l!="function"?()=>{}:r(f.WINDOW_BODY_RESIZED,"on-resize",c,u=>{const{width:p,height:g}=u;try{l(p,g)}catch(b){m(f.SHELL_ERROR,{scope:"native-render-ctx/onResize",id:e,error:b})}})},onHide(l){return typeof l!="function"?()=>{}:r(f.WINDOW_MINIMIZED,"on-hide",c,()=>{try{l()}catch(u){m(f.SHELL_ERROR,{scope:"native-render-ctx/onHide",id:e,error:u})}})},onShow(l){return typeof l!="function"?()=>{}:r(f.WINDOW_RESTORED,"on-show",c,()=>{try{l()}catch(u){m(f.SHELL_ERROR,{scope:"native-render-ctx/onShow",id:e,error:u})}})},params:t},dispose:()=>{try{i.abort()}catch{}for(;s.length;){const l=s.pop();try{l?.()}catch{}}}}}const _n=["post_type","page","taxonomy","path","post","c","tag_ID","item","p"].filter(e=>e!=="p"),ct=[];function Bi(e){if(!e.pathname.endsWith("/admin.php")||!e.searchParams.get("page"))return ct;const t=e.searchParams.get("action");return t==="edit"&&e.searchParams.get("id")?["id"]:t==="new"?["action"]:ct}function bn(e){try{const t=new URL(e,window.location.origin),n=new URLSearchParams,o=[..._n,...Bi(t)];for(const s of o){const r=t.searchParams.get(s);r?n.set(s,r):s==="post_type"&&(t.pathname.endsWith("/edit.php")||t.pathname.endsWith("/post-new.php"))&&n.set(s,"post")}n.sort();const i=n.toString();return t.pathname.replace(/\/+$/,"")+(i?`?${i}`:"")}catch{return e}}function Q(e){try{const t=new URL(e,window.location.origin);return t.searchParams.delete("openstation_chromeless"),t.searchParams.delete("desktop_mode_portal"),t.pathname.replace(/\/+$/,"")+"?"+t.searchParams.toString()}catch{return e}}const wn="X-WP-Nonce";function qi(e,t){const n=Vi();if(!n)return t;const o=Ki(e);if(!o||!ji(o))return t;const i=t?.headers??(typeof Request<"u"&&e instanceof Request?e.headers:void 0),s=new Headers(i??{});return s.has(wn)?t:(s.set(wn,n),{...t??{},headers:s})}function Vi(){if(typeof window>"u")return;const t=window.openStationConfig?.restNonce;return typeof t=="string"&&t.length>0?t:void 0}function Ki(e){try{const t=typeof window<"u"&&window.location?window.location.href:void 0;return typeof e=="string"?new URL(e,t):e instanceof URL?e:typeof Request<"u"&&e instanceof Request?new URL(e.url,t):null}catch{return null}}function ji(e){return typeof window>"u"||!window.location||e.origin!==window.location.origin?!1:!!(e.pathname.includes("/wp-json/")||e.searchParams.has("rest_route"))}function Yi(e,t,n={}){const o=window.wp?.os?.fetch;if(typeof o=="function")return o(e,t,n);const i=qi(e,t);return fetch(e,i)}const yn=k("desktop-mode/dock-rail-registry",()=>({registry:new Map,listeners:new Set,activeId:"default"}));yn.state.registry,yn.state.listeners;function Xi(e,t){if(!e||typeof e!="object")return["def (not an object)"];const n=e,o=[];for(const i of t)i.valid(n)||o.push(`${i.field} (${i.message})`);return o}class Zi extends Error{constructor(t,n,o){super(`[openstation] ${t} registration rejected — fields: `+n.join(", ")+"."),this.name="RegistrationError",this.kind=t,this.errors=n,this.def=o}}function dt(e,t,n){if(t.length!==0)throw new Zi(e,t,n)}function vn(e,t,n){typeof console>"u"||console.warn(`[openstation] ${e} registration rejected — fields: `+t.join(", ")+".",n)}const J=[[0,0],[100,0],[100,100],[0,100]],Qi=48,Ji=80,ut=6,ht=8,En=4,An=3,Sn=64,ft=105,ee=2;function xn(e){return`${Math.round(e*1e3)/1e3}%`}function te(e){return e.slice().reverse()}function pe(e,t,n,o){return[[e,t],[n,t],[n,o],[e,o]]}function es(e,t,n,o){const i=[];for(let s=0;s<o;s++){const r=s/o*Math.PI*2;i.push([e+Math.cos(r)*n,t+Math.sin(r)*n])}return i}function H(e,t=[]){const n=[],o=i=>{n.push(`${xn(i[0])} ${xn(i[1])}`)};for(const i of e)o(i);if(t.length>0){o(e[0]);for(const i of t){for(const s of i)o(s);o(i[0]),o(e[0])}}return`polygon( ${n.join(", ")} )`}function Cn(e){return H(J,[te(es(50,50,e,Qi))])}function kn(e){return H(J,[te(pe(50-e,-ee,50+e,100+ee))])}function Tn(e){const t=100/ut,n=[];for(let o=0;o<ut;o++){const i=o*t;n.push(te(pe(-ee,i,100+ee,i+e)))}return H(J,n)}function In(e){return H(J,[te(pe(-ee,50-e,100+ee,50+e))])}function Ln(e){const t=100/ht,n=[];for(let o=0;o<ht;o++){const i=o*t;n.push(te(pe(i,-ee,i+e,100+ee)))}return H(J,n)}function Nn(e){return H(J,[te([[50,50-e],[50+e,50],[50,50+e],[50-e,50]])])}function Rn(e){const t=100/En,n=100/An,o=[];for(let i=0;i<An;i++)for(let s=0;s<En;s++){const r=s*t+t/2,c=i*n+n/2,a=t/2*e,d=n/2*e;o.push(te(pe(r-a,c-d,r+a,c+d)))}return H(J,o)}function On(e){const t=-Math.PI/2,n=e/180*Math.PI,o=[[50,50]];for(let i=0;i<Sn;i++){const s=t+i/(Sn-1)*n;o.push([50+Math.cos(s)*ft,50+Math.sin(s)*ft])}return H(J,[te(o)])}function ts(){return{from:Cn(0),to:Cn(Ji)}}function ns(){return{from:kn(0),to:kn(52)}}function os(){return{from:Tn(0),to:Tn(100/ut+.5)}}function is(){return{from:In(0),to:In(52)}}function ss(){return{from:Ln(0),to:Ln(100/ht+.5)}}function rs(){return{from:Nn(0),to:Nn(ft)}}function as(){return{from:Rn(0),to:Rn(1.04)}}function ls(){return{from:On(0),to:On(360)}}function cs(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 100% 0% )"}}function ds(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 0% 100% )"}}function us(){return{from:H([[-60,0],[100,0],[100,100],[0,100]]),to:H([[100,0],[260,0],[260,100],[160,100]])}}const pt=6,mt=100,ae=mt/2,He=200,Dn=90,Wn=["#5c5c6d","#525261","#484855","#3e3e49","#34343d","#2a2a31"],hs="#101014",fs=1.25,le="http://www.w3.org/2000/svg";let ps=0;function Fe(e){return Math.round(e*1e3)/1e3}function gt(e){return e/pt*Math.PI*2-Math.PI/2}function ms(e){const n=gt(e)+Math.PI/pt+Math.PI/2;return{x:Math.cos(n),y:Math.sin(n)}}function gs(e){const t=gt(e),n=gt(e+1);return[[ae,ae],[ae+Math.cos(t)*He,ae+Math.sin(t)*He],[ae+Math.cos(n)*He,ae+Math.sin(n)*He]]}function Mn(e,t){const n=gs(e),o=document.createElementNS(le,"path");return o.setAttribute("d",`M ${n.map(([i,s])=>`${Fe(i)} ${Fe(s)}`).join(" L ")} Z`),t?o.setAttribute("fill","#fff"):(o.setAttribute("fill",Wn[e%Wn.length]),o.setAttribute("stroke",hs),o.setAttribute("stroke-width",String(fs)),o.setAttribute("vector-effect","non-scaling-stroke"),o.setAttribute("stroke-linejoin","round")),o}function _s(){const e=`os-iris-${++ps}`,t=document.createElementNS(le,"svg");t.setAttribute("viewBox",`0 0 ${mt} ${mt}`),t.setAttribute("preserveAspectRatio","none"),t.setAttribute("aria-hidden","true"),t.style.width="100%",t.style.height="100%",t.style.display="block";const n=document.createElementNS(le,"defs"),o=document.createElementNS(le,"mask");o.setAttribute("id",e);const i=document.createElementNS(le,"g"),s=document.createElementNS(le,"g");s.setAttribute("mask",`url(#${e})`);const r=[];for(let a=0;a<pt;a++){const d=Mn(a,!0),l=Mn(a,!1);i.appendChild(d),s.appendChild(l),r.push({el:d,index:a},{el:l,index:a})}o.appendChild(i),n.appendChild(o),t.appendChild(n),t.appendChild(s);const c=document.createElement("div");return c.appendChild(t),{element:c,play:a=>r.map(({el:d,index:l})=>{const u=ms(l),p=Fe(u.x*Dn),g=Fe(u.y*Dn);return d.animate([{transform:"translate( 0px, 0px )"},{transform:`translate( ${p}px, ${g}px )`}],{duration:a.duration,easing:a.easing,delay:a.delay,fill:"both"})})}}const _t="none",bs=70,ws=600,Pn=k("desktop-mode/window-reveal-registry",()=>({registry:new Map,listeners:new Set})),$n=Pn.state.registry,ys=Pn.state.listeners,zn=/^[a-z0-9_/-]+$/;function Hn(e){const t=/^\s*([a-zA-Z-]+)\s*\(/.exec(e);return t?t[1].toLowerCase():""}const vs=0;function Es(e){return typeof e!="number"||!Number.isFinite(e)?bs:Math.min(ws,Math.max(0,e))}function As(e){return typeof e.render=="function"?[]:Array.isArray(e.layers)&&e.layers.length>0?e.layers:typeof e.from=="string"&&typeof e.to=="string"?[{from:e.from,to:e.to}]:[]}function Fn(e,t){const n=[],o=typeof e.from=="string"&&e.from.trim()!=="",i=typeof e.to=="string"&&e.to.trim()!=="";if(o||n.push(`${t}.from (missing — the clip-path covering the window)`),i||n.push(`${t}.to (missing — the clip-path uncovering the window)`),o&&i){const s=Hn(e.from),r=Hn(e.to);s===""||r===""?n.push(`${t}.from|to (must be shape functions, e.g. \`inset( … )\` or \`polygon( … )\` — bare keywords like \`none\` cannot be animated)`):s!==r&&n.push(`${t}.from|to (must use the same shape function to interpolate — got \`${s}()\` and \`${r}()\`)`)}return n}function Ss(e){if(typeof KeyframeEffect!="function")return!0;try{return new KeyframeEffect(null,null,{easing:e}),!0}catch{return!1}}function W(e){const t=[];if(!e||typeof e!="object")t.push("def (not an object)");else{typeof e.id!="string"||e.id.trim()===""?t.push("id (missing)"):zn.test(e.id.trim().toLowerCase())?e.id.trim().toLowerCase()===_t&&t.push('id ("none" is reserved)'):t.push(`id (must match ${zn} — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-id)`),(typeof e.label!="string"||e.label.trim()==="")&&t.push("label (missing)");const o=e.render!==void 0,i=Array.isArray(e.layers),s=e.from!==void 0||e.to!==void 0;o&&typeof e.render!="function"?t.push("render (not a function)"):o&&(i||s)?t.push("render|layers|from|to (supply exactly one of: a from/to pair, a layers array, or a render function)"):o||(i&&s?t.push("layers|from|to (supply EITHER a single from/to pair OR a layers array, not both)"):i?(e.layers.length===0&&t.push("layers (empty — supply at least one matched pair)"),e.layers.forEach((r,c)=>{if(!r||typeof r!="object"){t.push(`layers[ ${c} ] (not an object)`);return}t.push(...Fn(r,`layers[ ${c} ]`))})):t.push(...Fn(e,"").map(r=>r.replace(/^\./,"")))),e.easing!==void 0&&(typeof e.easing!="string"||e.easing.trim()===""?t.push("easing (not a non-empty string)"):Ss(e.easing)||t.push("easing (not an easing the browser can parse — `Element.animate()` would throw at play time, with the covering surface already over the window)"))}dt("WindowReveal",t,e);const n=e.id.trim().toLowerCase();$n.set(n,{...e,id:n}),ks()}function xs(){const e=Array.from($n.values()),t=T(f.WINDOW_REVEALS,e);return Array.isArray(t)?t:(typeof console<"u"&&console.warn("[openstation] `os.window-reveals` filter returned a non-array; falling back to registry list."),e)}function Cs(e){return xs().find(t=>t.id===e)}function ks(){const e=Array.from(ys);for(const t of e)try{t()}catch(n){typeof console<"u"&&console.error("[openstation] window-reveal registry listener threw:",n)}}W({id:"sweep",label:_("Sweep"),description:_("A straight edge travels across the window, uncovering the page behind it."),...ds(),duration:420}),W({id:"iris",label:_("Iris"),description:_("The page opens out from the centre of the window, like a camera shutter."),...ts(),duration:520}),W({id:"curtain",label:_("Curtain"),description:_("Two panels part from the middle of the window and slide off the sides."),...ns(),duration:480}),W({id:"blinds",label:_("Blinds"),description:_("Six horizontal slats retract at once, letting the page through between them."),...os(),duration:560}),W({id:"diagonal",label:_("Diagonal"),description:_("A slanted edge sweeps off the trailing corner of the window."),...us(),duration:460}),W({id:"rise",label:_("Rise"),description:_("The page rises into the window from the bottom edge upward."),...cs(),duration:440}),W({id:"shutter",label:_("Shutter"),description:_("Two panels part from the middle of the window and slide off the top and bottom."),...is(),duration:480}),W({id:"slats",label:_("Slats"),description:_("Eight vertical slats retract at once, letting the page through between them."),...ss(),duration:560}),W({id:"diamond",label:_("Diamond"),description:_("The page opens out from the centre of the window through a growing rhombus."),...rs(),duration:520}),W({id:"mosaic",label:_("Mosaic"),description:_("The page arrives as a grid of tiles, each opening out from its own centre."),...as(),duration:600}),W({id:"obturator",label:_("Camera shutter"),description:_("Six wedges slide aside in unison, opening a hexagonal aperture from the centre like the iris of a camera lens."),render:_s,duration:720,edgeLag:0}),W({id:"radar",label:_("Radar"),description:_("A spoke sweeps a full turn around the centre of the window, uncovering the page behind it."),...ls(),duration:760});const Un={dockSize:["compact","default","large"],desktopLayout:["classic","unified"],dockPlacement:["bottom","left","right"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"]},Gn=["dockRailRenderer","windowReveal","accent"],Bn={windowRevealDuration:{min:80,max:4e3}},Ts=/^[a-z0-9_-]+$/;[...Object.keys(Un),...Gn,...Object.keys(Bn)];function Is(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t=e,n={},o={};for(const[i,s]of Object.entries(Un)){const r=t[i];typeof r=="string"&&s.includes(r)&&(n[i]=r)}for(const i of Gn){const s=t[i];typeof s=="string"&&Ts.test(s)&&(n[i]=s)}for(const[i,s]of Object.entries(Bn)){const r=t[i];typeof r=="number"&&Number.isFinite(r)&&(o[i]=Math.min(s.max,Math.max(s.min,Math.round(r))))}return{...n,...o}}const Ls=/^[a-z0-9_-]+$/,qn=128;function Ns(e){return typeof e!="string"||e===""||e.length>2048?!1:e.startsWith("dashicons-")||e.startsWith("https://")||e.startsWith("http://")||e.startsWith("data:image/")}function Rs(e){if(!e||typeof e!="object")return null;const t=e,n=typeof t.slug=="string"?t.slug:"";if(!Ls.test(n))return null;const o={};if(t.icons&&typeof t.icons=="object"){let a=0;for(const[d,l]of Object.entries(t.icons)){if(a>=qn)break;d===""||!Ns(l)||(o[d]=l,a+=1)}}const i={};if(t.tokens&&typeof t.tokens=="object")for(const[a,d]of Object.entries(t.tokens))typeof d=="string"&&(i[a]=d);const s=[];if(Array.isArray(t.fonts))for(const a of t.fonts)typeof a=="string"&&a!==""&&s.push(a);const r={};if(t.iconColors&&typeof t.iconColors=="object"){let a=0;for(const[d,l]of Object.entries(t.iconColors)){if(a>=qn)break;d===""||typeof l!="string"||l===""||(r[d]=l,a+=1)}}const c=a=>typeof t[a]=="string"?t[a]:"";return{id:c("id")||n,slug:n,name:c("name")||n,version:c("version"),author:c("author"),description:c("description"),previewUrl:c("previewUrl"),cssUrl:c("cssUrl"),cssText:c("cssText"),tokens:i,fonts:s,icons:o,iconColors:r,recommendedOsSettings:Is(t.recommendedOsSettings),installedAt:typeof t.installedAt=="number"?t.installedAt:0,source:t.source==="code"?"code":"upload",cssDeferred:t.cssDeferred===!0}}function Os(){const t=window.openStationConfig?.serverDesktopThemes,n=[];if(Array.isArray(t))for(const o of t){const i=Rs(o);i&&n.push(i)}return{themes:n,activeId:null,activeIcons:null,activeIconColors:null}}const Ds=k("desktop-mode/desktop-themes",Os);function Vn(){return Ds}function Kn(e){const t=Vn().state;if(t.activeIcons===null||!e)return null;const n=t.activeIcons[e];if(typeof n!="string"||n==="")return null;const o=T(f.DESKTOP_THEME_ICON,n,{slot:e,themeId:t.activeId??""});return typeof o=="string"&&o!==""?o:null}function jn(e){const t=Vn().state;if(t.activeIconColors===null||!e)return null;const n=t.activeIconColors[e];if(typeof n!="string"||n==="")return null;const o=T(f.DESKTOP_THEME_ICON_COLOR,n,{slot:e,themeId:t.activeId??""});return typeof o=="string"&&o!==""?Ws(o):null}function Ws(e){const t=e.trim();if(t===""||t.length>64||/[;{}<>"'\\]/.test(t))return null;let n=0;for(const o of t)if(o==="(")n+=1;else if(o===")"&&(n-=1,n<0))return null;return n===0?t:null}const me={OS_SETTINGS:"OS_SETTINGS",RECYCLE_BIN:"RECYCLE_BIN",BUG_REPORT:"BUG_REPORT",EXIT_OPENSTATION:"EXIT_OPENSTATION",PWA_INSTALL:"PWA_INSTALL"},Ms={"desktop-mode-os-settings":me.OS_SETTINGS,"desktop-mode-recycle-bin":me.RECYCLE_BIN,"desktop-mode-bug-report":me.BUG_REPORT,"os-exit":me.EXIT_OPENSTATION,"os-pwa-install":me.PWA_INSTALL};function Ps(e){if(typeof e!="string"||e==="")return"";const t=Ms[e];if(t)return t;const n=e.toLowerCase().replace(/[^a-z0-9_-]/g,"");return n===""?"":`APP:${n}`}function $s(e){if(typeof e!="string"||e==="")return"";const t=e.replace(/^core\//,"").toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"");return t===""?"":`WINDOW_CONTROL_${t}`}function bt(e,t){const n=$s(t),o=Kn(n),i=jn(n);if(o===null&&i===null)return!1;if(i!==null?e.style.setProperty("--os-ui-btn-icon-color",i):e.style.removeProperty("--os-ui-btn-icon-color"),o===null)return e.style.setProperty("color",i),!1;if(o.startsWith("dashicons-")){e.removeAttribute("icon-src"),e.removeAttribute("icon");const s=document.createElement("span");return s.className=`dashicons ${o}`,s.setAttribute("aria-hidden","true"),i!==null&&(s.style.color=i),e.appendChild(s),!0}return e.setAttribute("icon-src",o),!0}let wt=null;function Ue(){return!!window.openStationShellOverlays}function zs(e){return new Promise((t,n)=>{const o=document.querySelector('script[data-os-shell-overlays="1"]'),i=()=>{if(Ue()){t();return}n(new Error("[openstation] shell-overlays bundle loaded but did not set `window.openStationShellOverlays`."))};if(o){Ue()?i():(o.addEventListener("load",i),o.addEventListener("error",()=>n(new Error("failed to load shell-overlays bundle"))));return}const s=document.createElement("script");s.src=e,s.async=!0,s.dataset.osShellOverlays="1",s.addEventListener("load",i),s.addEventListener("error",()=>n(new Error("failed to load shell-overlays bundle"))),document.head.appendChild(s)})}function Hs(e){return Ue()||!e?Promise.resolve():(wt||(wt=zs(e)),wt)}function Fs(){return window.openStationConfig?.shellOverlaysBundleUrl??""}function Us(e,t){const n=Fs();if(Ue()||!n){t();return}Hs(n).then(()=>{e()&&t()}).catch(o=>{typeof console<"u"&&console.warn("[openstation] shell-overlays failed to load; menu/dialog suppressed:",o)})}const Gs=4e3,Bs=200,qs=1200;function yt(e){const t=tt.filter("os/toast-requested",{...e});if(!t||t.cancel===!0)return()=>{};let n=!1,o=null;return Us(()=>!n,()=>{o=js(t)}),()=>{n=!0,o&&o()}}const Vs={success:"positive",warning:"warning",error:"critical","shell-error":"critical"};function Ks(e){return e?window.openStationConfig?.toastTypes?.find(o=>o.id===e)?.tone??Vs[e]??null:null}function js(e){const t=Qs(),n=document.createElement("os-toast");n.textContent=e.message;const o=Ks(e.type);o&&n.setAttribute("tone",o),e.action&&(n.setAttribute("action",e.action.label),n.addEventListener("os-toast-action",()=>{e.action?.onClick(),d()})),e.dismissible&&(n.setAttribute("dismissible",""),n.addEventListener("os-toast-dismiss",()=>{e.onDismiss?.(),d()})),t.appendChild(n);let i=!1,s=null,r=e.duration??Gs,c=0;const a=()=>{s!==null&&(window.clearTimeout(s),s=null)},d=()=>{i||(i=!0,a(),Zs(n),n.setAttribute("state","out"),window.setTimeout(()=>{n.remove(),Xs()},Bs))},l=()=>{i||e.persistent||s!==null||(c=Date.now(),s=window.setTimeout(d,r))},u=()=>{s!==null&&(r=Math.max(0,r-(Date.now()-c)),a())};return requestAnimationFrame(()=>{n.setAttribute("state","in")}),n.addEventListener("os-toast-hold",p=>{if(p.detail?.held){u();return}r=Math.max(r,qs),l()}),Ys(n),l(),tt.publish("os/toast-shown",{...e}),d}let Ge=null,ge=0;function Yn(e){const t=e.target;t instanceof HTMLElement&&(t.closest("os-toast-container")||(Ge=t))}function Ys(e){ge===0&&document.addEventListener("focusin",Yn,!0),ge+=1;const t=e.ownerDocument,n=t.activeElement;n instanceof HTMLElement&&n!==t.body&&!n.closest("os-toast-container")&&(Ge=n)}function Xs(){ge=Math.max(0,ge-1),ge===0&&document.removeEventListener("focusin",Yn,!0)}function Zs(e){const t=e.ownerDocument.activeElement;t!==e&&!e.contains(t)||Ge?.isConnected===!0&&Ge.focus()}function Qs(){const e=document.querySelector("os-toast-container");if(e)return e;const t=document.createElement("os-toast-container");return document.body.appendChild(t),t}const Js="http://localhost/";function er(e,t){const n=typeof window<"u"&&window.location?window.location.href:Js,o=new URL(e,n),i=t.replace(/^\/+/,""),s=i.indexOf("?"),r=s===-1?i:i.slice(0,s),c=s===-1?"":i.slice(s+1);if(o.searchParams.has("rest_route")){const a=o.searchParams.get("rest_route")??"/",d=a.endsWith("/")?a:a+"/";o.searchParams.set("rest_route",d+r)}else{const a=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";o.pathname=a+r}return c&&new URLSearchParams(c).forEach((d,l)=>{o.searchParams.append(l,d)}),o.toString()}`${btoa('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none" stroke="currentColor" stroke-width="6" stroke-linejoin="round"><rect x="6" y="6" width="27" height="27" rx="5"/><rect x="43" y="6" width="15" height="15" rx="5"/><rect x="43" y="31" width="15" height="27" rx="5"/><rect x="6" y="43" width="27" height="15" rx="5"/></svg>')}`,`${btoa('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none" stroke="currentColor" stroke-width="6" stroke-linecap="round"><path d="M10 22h44M10 42h44"/><circle cx="24" cy="22" r="7" fill="currentColor" stroke="none"/><circle cx="42" cy="42" r="7" fill="currentColor" stroke="none"/></svg>')}`,`${btoa('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M10 2.5Q10.9 8.5 17.5 10Q10.9 11.5 10 17.5Q9.1 11.5 2.5 10Q9.1 8.5 10 2.5Z"/><path d="M17.9 14Q18.35 17.1 21.5 17.6Q18.35 18.1 17.9 21.2Q17.45 18.1 14.3 17.6Q17.45 17.1 17.9 14Z"/></svg>')}`;function tr(e){try{(window.top??window).location.assign(e)}catch{window.location.assign(e)}}const Xn=800;function nr(e,t=Xn){window.setTimeout(()=>{if(e){tr(e);return}try{(window.top??window).location.reload()}catch{window.location.reload()}},t)}const or="desktop-mode/v1",ir=3e4,sr=3,_e=k("desktop-mode/plugin-presence",()=>({confirmInFlight:!1,lastConfirmAt:null,exiting:!1,booted:!1,negativeConfirms:0}));function vt(){return window.wp?.os?.config??{}}function rr(){const e=vt().adminUrl||"/wp-admin/";let t;try{t=new URL(e,window.location.href).pathname}catch{t="/wp-admin/"}return t.endsWith("/")?t:`${t}/`}function ar(){const e=vt().restUrl;return e?er(e,or):null}function lr(){_e.state.negativeConfirms=0}async function cr(){const e=_e.state;if(e.exiting||e.confirmInFlight||e.negativeConfirms>=sr)return;const t=ar();if(!t)return;const n=Date.now();if(!(e.lastConfirmAt!==null&&n-e.lastConfirmAt<ir)){e.lastConfirmAt=n,e.confirmInFlight=!0;try{const o=await Yi(t,{credentials:"same-origin"},{silent:!0,source:"desktop-mode/plugin-presence"});if(o.status!==404){e.negativeConfirms+=1;return}if((await o.json())?.code!=="rest_no_route"){e.negativeConfirms+=1;return}dr()}catch{}finally{e.confirmInFlight=!1}}}function dr(){if(!_e.state.exiting){_e.state.exiting=!0,nr(vt().adminUrl||"");try{yt({message:_("OpenStation is no longer active. Returning to the WordPress dashboard…"),duration:Xn})}catch{}}}function Et(e){if(_e.state.exiting)return;let t=null;try{t=e.contentDocument}catch{return}if(!(!t?.body||!t.location)&&t.location.pathname.startsWith(rr())){if(t.body.classList.contains("os-chromeless")){lr();return}cr()}}const q=0,At=40,Zn=5,ur=Zn*Zn,hr=3e3,fr=250,pr=15e3,mr=120,St="os-window__loading",Qn="os-window__loading--visible",gr=k("desktop-mode/window-reveal-active",()=>({id:_t,duration:vs}));function _r(){const e=gr.state.id;return!e||e===_t?null:Cs(e)??null}const xt="os-window__reveal",br="os-window__reveal--edge",wr="os-window__reveal--custom",Jn="data-os-reveal",eo="data-os-reveal-layer",yr=k("desktop-mode/window-reveal-rendered",()=>({plays:new WeakMap})).state.plays;function to(e,t,n,o){const i=document.createElement("div");i.className=o?`${xt} ${br}`:xt;const s=o?e.edgeColor:t.color??e.surfaceColor;return typeof s=="string"&&s!==""&&(i.style.background=s),i.setAttribute("aria-hidden","true"),i.setAttribute(Jn,e.id),i.setAttribute(eo,String(n)),i.style.clipPath=t.from,i}function vr(){const e=_r();if(!e)return[];if(typeof e.render=="function"){let o;try{o=e.render()}catch(s){return typeof console<"u"&&console.error(`[openstation] window reveal "${e.id}" render threw:`,s),[]}if(!o?.element||typeof o.play!="function")return[];const i=o.element;return i.classList.add(xt),i.classList.add(wr),i.setAttribute("aria-hidden","true"),i.setAttribute(Jn,e.id),i.setAttribute(eo,"0"),yr.set(i,o.play),[i]}const t=As(e);if(t.length===0)return[];const n=[];return Es(e.edgeLag)>0&&t.forEach((o,i)=>n.push(to(e,o,i,!0))),t.forEach((o,i)=>n.push(to(e,o,i,!1))),n}const no="os-window__body--loading",oo="data-os-loading-at",io="data-os-loading-cycle";function Er(e){return e.getAttribute(io)??"0"}function Ar(e){e.setAttribute(oo,String(Date.now())),e.setAttribute(io,String(Number(Er(e))+1))}function Sr(e,t){const n=Number(e.getAttribute(oo)),o=Number.isFinite(n)&&n>0?Date.now()-n:0,i=mr-o;if(i<=0){t.classList.add(Qn);return}window.setTimeout(()=>{t.isConnected&&e.classList.contains(no)&&t.classList.add(Qn)},i)}const xr=Symbol.for("desktop-mode/window-config");function Cr(e,t){e[xr]=t}const Ct=window.location.origin;function kr(e){try{return new URL(e,Ct).searchParams.has(cn)}catch{return!1}}function be(e){const t=new URL(e,Ct);return t.origin!==Ct||Pi(t)?null:(t.searchParams.set("openstation_chromeless","1"),t.toString())}function ne(){const e=document.querySelectorAll(".os-window--fullscreen:not(.os-window--minimized)").length>0;document.body.classList.toggle("os-has-fullscreen-window",e)}function Tr(){const e=document.createElement("div");e.className=St,e.setAttribute("role","status"),e.setAttribute("aria-live","polite");const t=document.createElement("os-spinner");return t.setAttribute("preset","classic"),t.setAttribute("size","clamp(96px, 14vw, 192px)"),t.setAttribute("label",_("Loading window content")),e.appendChild(t),e}function Ir(e){let t=Tr();const n={windowId:e.id,config:e};if(typeof e.loading?.render=="function")try{e.loading.render(t,n)}catch(o){typeof console<"u"&&console.error(`[openstation] loading.render threw for "${e.id}":`,o)}try{const o=T(f.WINDOW_LOADING_OVERLAY,t,n);o instanceof HTMLElement&&(t=o)}catch(o){typeof console<"u"&&console.error(`[openstation] WINDOW_LOADING_OVERLAY filter threw for "${e.id}":`,o)}return t&&!t.classList.contains(St)&&t.classList.add(St),t}function oe(e){const t=document.createElement("span");return t.className=`os-window__slot os-window__slot--${e}`,t.dataset.slot=e,t}function Lr(e){const t=document.createElement("div");t.className="os-window",e.native&&t.classList.add("os-window--native"),t.id=`wp-window-${e.id}`,t.setAttribute("role","dialog"),t.setAttribute("aria-labelledby",`wp-window-title-${e.id}`),t.setAttribute("aria-busy","true"),t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.width=`${e.width}px`,t.style.height=`${e.height}px`;const n=document.createElement("div");n.className="os-window__titlebar";const o=document.createElement("os-window-button");o.setAttribute("icon","menu"),bt(o,"core/menu"),o.setAttribute("aria-label",_("Window actions")),o.setAttribute("aria-haspopup","menu"),o.setAttribute("aria-expanded","false"),o.classList.add("os-window__btn"),o.classList.add("os-window__menu-btn");const i=document.createElement("os-menu");i.classList.add("os-window__menu-panel"),i.hidden=!0;const s=document.createElement("os-menu-item");if(s.setAttribute("role","menuitemcheckbox"),s.setAttribute("value","startup"),s.classList.add("os-window__menu-item"),s.classList.add("os-window__menu-item--startup"),s.textContent=_("Open on startup"),i.appendChild(s),e.multi){const h=document.createElement("os-menu-item");h.setAttribute("role","menuitem"),h.setAttribute("value","open-another"),h.setAttribute("icon","dashicons-plus-alt2"),h.classList.add("os-window__menu-item"),h.classList.add("os-window__menu-item--open-another"),h.textContent=se(_("Open another %s"),e.title),i.appendChild(h)}if(!e.native){const h=document.createElement("os-menu-item");h.setAttribute("role","menuitem"),h.setAttribute("value","open-in-new-window"),h.setAttribute("icon","dashicons-plus-alt"),h.classList.add("os-window__menu-item"),h.classList.add("os-window__menu-item--open-in-new-window"),h.textContent=_("Open in new window"),i.appendChild(h)}if(!e.native||e.render){const h=document.createElement("os-menu-item");h.setAttribute("role","menuitem"),h.setAttribute("value","reload"),h.setAttribute("icon","dashicons-update"),h.classList.add("os-window__menu-item"),h.classList.add("os-window__menu-item--reload"),h.textContent=_("Reload"),i.appendChild(h)}if(!e.native){const h=document.createElement("os-menu-item");h.setAttribute("role","menuitem"),h.setAttribute("value","open-external"),h.setAttribute("icon","dashicons-external"),h.classList.add("os-window__menu-item"),h.classList.add("os-window__menu-item--open-external"),h.textContent=_("Open in classic wp-admin"),i.appendChild(h)}const r=oe("icon"),c=oe("title"),a=document.createElement("span");a.className="os-window__title",a.id=`wp-window-title-${e.id}`,a.textContent=e.title,c.appendChild(a);const d=oe("before-titlebar"),l=oe("before-icon"),u=oe("after-title"),p=oe("before-controls"),g=oe("after-controls"),b=oe("after-titlebar"),v=document.createElement("div");v.className="os-window__controls";const w=document.createElement("div");w.className="os-window__screen-meta";const S=document.createElement("span");S.className="os-window__custom-buttons os-window__custom-buttons--left";const A=document.createElement("span");A.className="os-window__custom-buttons os-window__custom-buttons--right";const x=document.createElement("os-save-status");x.className="os-window__status",x.setAttribute("mode","icon"),x.setAttribute("variant","ring"),x.setAttribute("phase","idle"),x.setAttribute("data-os-activity-indicator","");const N=document.createElement("span");N.className="os-window__activity-status",N.setAttribute("role","status"),N.setAttribute("aria-live","polite"),n.appendChild(N),n.appendChild(x),n.appendChild(l),n.appendChild(r),n.appendChild(c),n.appendChild(u),n.appendChild(S),n.appendChild(w),o&&i&&i.children.length>0&&(n.appendChild(o),n.appendChild(i)),n.appendChild(A),n.appendChild(p),n.appendChild(v),n.appendChild(g);for(const h of Array.from(n.children))h.setAttribute("data-os-default-chrome","");const D=document.createElement("div");if(D.className=`os-window__body ${no}`,Ar(D),e.native)D.classList.add("os-window__body--native");else{const h=document.createElement("iframe");h.className="os-window__iframe",h.setAttribute("name",`os-frame-${e.id}`);const E=e.url?be(e.url):null;h.src=E??"about:blank",D.appendChild(h);const I=()=>{$(e.id),Et(h)};h.addEventListener("load",I)}const Ie=Ir(e);D.appendChild(Ie),Sr(D,Ie);for(const h of vr())D.appendChild(h);De(e.id);const j=[];for(const h of["ne","nw","se","sw"]){const E=document.createElement("div");E.className=`os-window__resize-handle os-window__resize-handle--${h}`,E.dataset.dir=h,E.setAttribute("aria-hidden","true"),j.push(E)}t.appendChild(d),t.appendChild(n),t.appendChild(b);{const h=document.createElement("nav");h.className="os-window__tabs";const E=document.createElement("span");E.className="os-window__tab-plate",E.setAttribute("aria-hidden","true");const I=document.createElement("span");I.className="os-window__tab-plate-fill";const F=document.createElement("span");F.className="os-window__tab-plate-joint",E.appendChild(I),E.appendChild(F),h.appendChild(E),e.native?h.dataset.tablistLabel=se(_("%s sections"),e.title):h.dataset.tablistLabel=se(_("%s sub-pages"),e.title);const P=(e.submenu??[]).filter(U=>!U.offSite&&!kr(U.url));if(P.length>0&&e.url){const U=Q(e.url),Le=e.parentUrl??e.url,ec=Q(Le),tc=P.some(Ne=>Q(Ne.url)===ec)?[...P]:[{title:e.selfLabel||e.title,url:Le},...P];for(const Ne of tc){const G=document.createElement("button");G.className="os-window__tab",G.dataset.kind="submenu",G.setAttribute("type","button"),G.setAttribute("role","tab"),G.dataset.url=Ne.url,G.textContent=Ne.title,Q(Ne.url)===U?(G.classList.add("os-window__tab--active"),G.setAttribute("aria-selected","true")):G.setAttribute("aria-selected","false"),h.appendChild(G)}}fe(h),t.appendChild(h)}t.appendChild(D);for(const h of j)t.appendChild(h);return Cr(t,e),t}const so=window.location.origin;let ro=0;function Nr(e,{timeoutMs:t=fr}={}){const n=e?.contentWindow;if(!n)return Promise.resolve(!1);ro+=1;const o=`os-unsaved-guard-${Date.now()}-${ro}`;return new Promise(i=>{let s=null,r=!1;const c=d=>{r||(r=!0,window.removeEventListener("message",a),s!==null&&window.clearTimeout(s),i(d))},a=d=>{if(d.origin!==so)return;const l=d?.data;!l||typeof l!="object"||l.type!=="os-bridge-beforeunload-response"||l.requestId!==o||c(l.prevent===!0)};window.addEventListener("message",a),s=window.setTimeout(()=>c(!1),t);try{n.postMessage({type:"os-bridge-beforeunload-query",requestId:o},so)}catch{c(!1)}})}function kt(e,{commit:t,navigate:n}){if(!e._iframeBridgeReady||!e.iframe){t(),n();return}e._unsavedGuardPending=!0,Nr(e.iframe).then(o=>{if(e._unsavedGuardPending=!1,!e._isDestroyed){if(!o){t(),n();return}e._deferNavigationCommit(t,pr),n()}})}function Rr(e,t){let n;try{n=new URL(t,window.location.origin)}catch{return null}const o=bn(t);let i=null,s=-1;for(const r of e){const c=r.dataset.url;if(!c||bn(c)!==o)continue;let a;try{a=new URL(c,window.location.origin)}catch{continue}let d=0,l=!1;for(const[u,p]of a.searchParams){if(u==="openstation_chromeless"||u==="desktop_mode_portal"||_n.includes(u))continue;if(n.searchParams.get(u)!==p){l=!0;break}d++}!l&&d>s&&(i=r,s=d)}return i}function we(e,t){const n=e.element.querySelectorAll('.os-window__tab[data-kind="submenu"]');if(!n.length)return;if(e._activeTabId!=="primary"){for(const s of n)s.classList.remove("os-window__tab--active"),s.setAttribute("aria-selected","false");return}const o=Q(t);let i=null;for(const s of n){const r=s.dataset.url;if(r&&Q(r)===o){i=s;break}}if(i||(i=Rr(n,t)),!i){if(Array.from(n).some(c=>c.classList.contains("os-window__tab--active")))return;let r=!1;try{const c=new URL(t,window.location.origin);r=c.pathname.endsWith("/admin.php")&&c.searchParams.has("page")}catch{return}if(!r||!n[0])return;i=n[0]}for(const s of n){const r=s===i;s.classList.toggle("os-window__tab--active",r),s.setAttribute("aria-selected",r?"true":"false")}}function ao(e,t,n){if(!e.iframe)return;const o=e.element.querySelector(".os-window__tabs"),i=e.element.querySelector(".os-window__body");if(!o||!i)return;Or(e,o);const s=`ext-${++e._externalTabSeq}`,r=document.createElement("button");r.className="os-window__tab os-window__tab--external",r.dataset.kind="external",r.dataset.tabId=s,r.setAttribute("type","button"),r.setAttribute("role","tab"),r.setAttribute("aria-selected","false"),r.title=t;const c=document.createElement("span");c.className="os-window__tab-label",c.textContent=n,r.appendChild(c);const a=document.createElement("os-tab-chip");a.setAttribute("variant","detach"),a.dataset.tabAction="detach",a.dataset.tabId=s,a.setAttribute("aria-label",_("Open in a new browser tab")),a.title=_("Open in a new browser tab"),r.appendChild(a);const d=document.createElement("os-tab-chip");d.setAttribute("variant","close"),d.dataset.tabAction="close",d.dataset.tabId=s,d.setAttribute("aria-label",_("Close tab")),d.title=_("Close tab"),r.appendChild(d),o.appendChild(r),fe(o);const l=document.createElement("iframe");l.className="os-window__iframe os-window__iframe--external",l.dataset.tabId=s,l.style.display="none",l.src=t,i.appendChild(l);let u=!1;const p=()=>{u=!0};l.addEventListener("load",p,{once:!0});const g=window.setTimeout(()=>{u||(l.removeEventListener("load",p),Wr(e,s))},hr),b=()=>{l.removeEventListener("load",p),window.clearTimeout(g)};e._externalTabs.set(s,{tabEl:r,iframe:l,url:t,label:n,cancelProbe:b}),ye(e,s),r.scrollIntoView({behavior:"smooth",inline:"end",block:"nearest"}),e._emitChange("state")}function Or(e,t){if(t.querySelector('[data-kind="main"]')||t.querySelector('[data-kind="submenu"]'))return;const n=document.createElement("button");n.className="os-window__tab os-window__tab--main os-window__tab--active",n.dataset.kind="main",n.setAttribute("type","button"),n.setAttribute("role","tab"),n.setAttribute("aria-selected","true"),n.textContent=e.config.title||"Main",t.prepend(n),fe(t)}function ye(e,t){if(e._activeTabId===t)return;e._activeTabId=t,e.iframe&&(e.iframe.style.display=t==="primary"?"":"none");for(const[o,i]of e._externalTabs)i.iframe.style.display=t===o?"":"none";e.element.querySelectorAll(".os-window__tab").forEach(o=>{let i;o.dataset.kind==="main"?i=t==="primary":o.dataset.kind==="external"?i=o.dataset.tabId===t:i=t==="primary"&&o.classList.contains("os-window__tab--active"),o.classList.toggle("os-window__tab--active",i),o.setAttribute("aria-selected",i?"true":"false")})}function Tt(e,t){const n=e._externalTabs.get(t);n&&(n.cancelProbe(),n.tabEl.remove(),n.iframe.remove(),e._externalTabs.delete(t),e._activeTabId===t&&ye(e,"primary"),e._externalTabs.size===0&&e.element.querySelector(".os-window__tab--main")?.remove(),fe(e.element.querySelector(".os-window__tabs")),e._emitChange("state"))}function Dr(e,t){const n=e._externalTabs.get(t);if(!n)return;let o=n.url;try{const i=n.iframe.contentWindow?.location.href;i&&i!=="about:blank"&&(o=i)}catch{}window.open(o,"_blank","noopener"),Tt(e,t)}function Wr(e,t){const n=e._externalTabs.get(t);if(!n)return;const{url:o,label:i}=n;Tt(e,t),yt({message:se(_(`Opened "%s" in a new browser tab — this site doesn't allow embedding.`),i),action:{label:_("Open"),onClick:()=>{window.open(o,"_blank","noopener")}}}),window.open(o,"_blank","noopener")}function Mr(e){return e._externalTabs.size}function Pr(e){const t=[];for(const n of e._externalTabs.values()){let o=n.url;try{const i=n.iframe.contentWindow?.location.href;i&&i!=="about:blank"&&(o=i)}catch{}t.push({url:o,label:n.label})}return t}function $r(e,t){const n=t.target,o=n.closest("[data-tab-action]");if(o){t.stopPropagation();const c=o.dataset.tabAction,a=o.dataset.tabId;if(!a)return;c==="close"?Tt(e,a):c==="detach"&&Dr(e,a);return}const i=n.closest(".os-window__tab");if(!i)return;t.stopPropagation();const s=i.dataset.kind,r=i.dataset.tabId;if(s==="external"&&r){ye(e,r);return}if(s==="main"){ye(e,"primary");return}if(s==="panel"&&i.dataset.panel){lt(e.element,i.dataset.panel);return}if(i.dataset.url){const c=i.dataset.url;if(rt(c))return;const a=be(c);ye(e,"primary");const d=()=>{e.markContentLoading(),we(e,c)};a&&e.iframe?kt(e,{commit:d,navigate:()=>{e.iframe&&(e.iframe.src=a)}}):we(e,c)}}const It=1;function zr(e,t){const n=Math.max(0,e.scrollWidth-e.clientWidth);if(n<=It){delete e.dataset.overflow;return}const o=Math.abs(e.scrollLeft),i=o<=It,s=o>=n-It,r=t??window.getComputedStyle(e).direction==="rtl",c=r?!s:!i,a=r?!i:!s;c&&a?e.dataset.overflow="both":c?e.dataset.overflow="left":a?e.dataset.overflow="right":delete e.dataset.overflow}function Hr(e){let t=null,n=null;const o=()=>{n===null&&(n=window.requestAnimationFrame(()=>{n=null,t===null&&(t=window.getComputedStyle(e).direction==="rtl"),zr(e,t),fn(e),pn(e)}))},i=()=>{t=null,o()};e.addEventListener("scroll",o,{passive:!0});const s=typeof ResizeObserver>"u"?null:new ResizeObserver(i);s?.observe(e);const r=typeof MutationObserver>"u"?null:new MutationObserver(i);return r?.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),o(),()=>{e.removeEventListener("scroll",o),s?.disconnect(),r?.disconnect(),n!==null&&(window.cancelAnimationFrame(n),n=null)}}const Fr=k("desktop-mode/destructive-admin-actions",()=>({entries:[]}));function Ur(e,t){for(const n of Fr.state.entries)try{if(n.matches(e,t))return n.id}catch(o){console.warn(`[openstation] destructive-action predicate threw for "${n.id}":`,o)}return null}const Gr=32,Br=64,qr=/^[a-z0-9_/-]+$/,V=k("desktop-mode/window-links",()=>({contentByWindow:new Map,focusSeq:new Map,seq:0,listeners:new Set,lastGroupsSignature:"",manager:null,started:!1}));function Be(e){return`${e.type}:${e.id}`}function lo(e){return e.root?Be(e.root):Be(e)}function co(e){const t=o=>typeof o=="number"&&Number.isFinite(o)||typeof o=="string"&&o.trim()!=="",n=o=>typeof o=="string"&&qr.test(o.trim().toLowerCase());return Xi(e,[{field:"type",valid:o=>n(o.type),message:"must match /^[a-z0-9_/-]+$/ — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-type"},{field:"id",valid:o=>t(o.id),message:"must be a finite number or non-empty string"},{field:"root",valid:o=>o.root===void 0||!!o.root&&typeof o.root=="object"&&n(o.root.type)&&t(o.root.id),message:"when present, must be { type, id } with the same shapes as the ref itself"},{field:"related",valid:o=>o.related===void 0||Array.isArray(o.related)&&o.related.every(i=>!!i&&typeof i=="object"&&typeof i.id=="string"&&i.id.trim()!==""&&typeof i.group=="string"&&i.group.trim()!==""&&typeof i.label=="string"&&i.label.trim()!==""&&typeof i.url=="string"&&i.url.trim()!==""&&(i.groupLabel===void 0||typeof i.groupLabel=="string")&&(i.icon===void 0||typeof i.icon=="string")&&(i.count===void 0||typeof i.count=="number"&&Number.isFinite(i.count))),message:"when present, must be an array of { id, group, label, url, groupLabel?, icon?, count? } entries with non-empty strings"},{field:"links",valid:o=>o.links===void 0||Array.isArray(o.links)&&o.links.every(i=>!!i&&typeof i=="object"&&n(i.type)&&t(i.id)&&(i.rel===void 0||i.rel==="references"||i.rel==="child")),message:"when present, must be an array of { type, id, rel?: 'references'|'child' } entries"},{field:"revisionCount",valid:o=>o.revisionCount===void 0||typeof o.revisionCount=="number"&&Number.isFinite(o.revisionCount),message:"when present, must be a finite number"}])}function uo(e){if(!(typeof e!="string"||e===""))try{return new URL(e,window.location.origin).origin===window.location.origin?e:void 0}catch{return}}function Vr(e,t){const n={type:e.type.trim().toLowerCase(),id:e.id,source:t};e.root&&(n.root={type:e.root.type.trim().toLowerCase(),id:e.root.id}),Array.isArray(e.links)&&e.links.length>0&&(n.links=e.links.slice(0,Gr).map(s=>{const r={type:s.type.trim().toLowerCase(),id:s.id};return s.rel==="child"&&(r.rel="child"),r})),typeof e.label=="string"&&e.label!==""&&(n.label=e.label);const o=uo(e.previewUrl);o&&(n.previewUrl=o);const i=uo(e.revisionsUrl);return i&&(n.revisionsUrl=i,typeof e.revisionCount=="number"&&Number.isFinite(e.revisionCount)&&(n.revisionCount=Math.max(0,Math.trunc(e.revisionCount)))),Array.isArray(e.related)&&e.related.length>0&&(n.related=e.related.slice(0,Br).map(s=>{const r={id:s.id,group:s.group,label:s.label,url:s.url};return typeof s.groupLabel=="string"&&s.groupLabel!==""&&(r.groupLabel=s.groupLabel),typeof s.icon=="string"&&s.icon!==""&&(r.icon=s.icon),typeof s.count=="number"&&(r.count=s.count),r})),n}function ho(e){return!e||!e.related?"":e.related.map(t=>`${t.id}\0${t.group}\0${t.label}\0${t.url}\0${t.groupLabel??""}\0${t.icon??""}\0${t.count??""}`).join("|")}function Lt(e){return e?[Be(e),lo(e),...(e.links??[]).map(t=>Be(t)+(t.rel==="child"?"!child":""))].join("|"):""}function Kr(e,t,n={}){const o=n.source??"api";if(typeof e!="string"||e===""){dt("WindowContentRef",["windowId (must be a non-empty string)"],t);return}let i=null;if(t!=null){const c=co(t);if(c.length>0){o==="api"&&dt("WindowContentRef",c,t),vn("WindowContentRef",c,t);return}i=Vr(t,o)}if(i=T(f.WINDOW_LINKS_CONTENT,i,{windowId:e,source:o}),i!==null&&(!i||co(i).length>0)){vn("WindowContentRef",["filter (os.window-links.content returned an invalid ref)"],i);return}const s=V.state.contentByWindow.get(e)??null;if(i===null&&s===null||i!==null&&s!==null&&Lt(i)===Lt(s)&&i.label===s.label&&i.previewUrl===s.previewUrl&&i.revisionsUrl===s.revisionsUrl&&i.revisionCount===s.revisionCount&&ho(i)===ho(s))return;i===null?V.state.contentByWindow.delete(e):V.state.contentByWindow.set(e,i);const r={windowId:e,content:i,previous:s,source:o};document.dispatchEvent(new CustomEvent("os-window-content-changed",{detail:r})),m(f.WINDOW_CONTENT_CHANGED,r),Zr(),Yr()}function jr(){const e=new Map;for(const[i,s]of V.state.contentByWindow){const r=lo(s);let c=e.get(r);c||(c={key:r,root:s.root?{...s.root}:{type:s.type,id:s.id},rootWindowIds:[],children:[]},e.set(r,c)),s.root?c.children.push({windowId:i,content:s}):c.rootWindowIds.push(i)}const t=V.state.focusSeq;for(const i of e.values())i.rootWindowIds.sort((s,r)=>(t.get(r)??0)-(t.get(s)??0));const n=Array.from(e.values()),o=T(f.WINDOW_LINK_GROUPS,n);return Array.isArray(o)?o:(typeof console<"u"&&console.warn("[openstation] `os.window-links.groups` filter returned a non-array; falling back to computed groups."),n)}function Yr(){for(const e of Array.from(V.state.listeners))try{e()}catch(t){typeof console<"u"&&console.error("[openstation] window-links listener threw:",t)}}function Xr(){return Array.from(V.state.contentByWindow).map(([e,t])=>`${e}=${Lt(t)}`).sort().join(";")}function Zr(){const e=Xr();if(e===V.state.lastGroupsSignature)return;V.state.lastGroupsSignature=e;const n={groups:jr()};document.dispatchEvent(new CustomEvent("os-window-link-groups-changed",{detail:n})),m(f.WINDOW_LINK_GROUPS_CHANGED,n)}const Qr="my-wordpress",Jr=Object.freeze({userId:null,userName:"",requestedAt:0});function fo(){return window.wp?.os}let qe=null;function ea(){if(qe)return qe;const e=fo()?.createSharedStore;return typeof e!="function"?null:(qe=e("desktop-mode/my-wordpress/footprint-target",()=>({...Jr})),qe)}function ta(e,t=""){const n=ea();if(n){n.state.userId=e,n.state.userName=t,n.state.requestedAt=Date.now(),n.notify();return}window._wpdFootprintTarget={userId:e,userName:t,requestedAt:Date.now()}}function na(e){const t=Number(e.userId);if(!Number.isFinite(t)||t<=0)return;const n=e.userName??"";ta(t,n),fo()?.openWindow?.(Qr,{source:"my-wordpress/open-user-footprint",params:{footprint:t,fpName:n}})}const M=window.location.origin,Nt=k("desktop-mode/admin-link-deps",()=>({deps:null}));function oa(e,t){if(t.origin!==M||!e.iframe||t.source!==e.iframe.contentWindow)return;const n=t.data;if(!(!n||typeof n.type!="string")){if(n.type==="os-title-change"&&typeof n.title=="string"&&(e._hasExplicitTitle=!0,e.setTitle(n.title)),n.type==="os-content-identity"&&Kr(e.id,n.identity??null,{source:"bridge"}),n.type==="os-window-publish"&&typeof n.channel=="string"&&n.channel!==""&&Xt(e.id,n.channel,n.payload),typeof n.type=="string"&&n.type.startsWith("os-bridge-")&&window.__openStationConnectionBridge?.routeIncomingFromIframe(n,e.id),n.type==="os-iframe-navigated"&&(e._hasExplicitTitle=!1,e._settleNavigationActivity()),n.type==="os-ready"&&(e._iframeBridgeReady=!0,e._clearDeferredNavigation(),e._settleNavigationActivity(!0)||e._resetActivity(),$(e.id),m(f.IFRAME_READY,{windowId:e.id})),n.type==="os-iframe-unloading"&&e._commitDeferredNavigation(),n.type==="os-bridge-beforeunload-response"){if(e._isDestroyed||typeof n.requestId=="string"&&n.requestId!=="")return;e._closePending=!1,e._iframeCloseTimeout&&(clearTimeout(e._iframeCloseTimeout),e._iframeCloseTimeout=null),n.prevent?Promise.resolve().then(()=>Jl).then(({osConfirm:o})=>o({title:typeof n.message=="string"&&n.message?n.message:_("Unsaved changes"),message:_("You have unsaved changes. Are you sure you want to close this window?"),confirmLabel:_("Close window"),danger:!0})).then(o=>{o&&e.destroy()}).catch(()=>{e.destroy()}):e.destroy()}if(n.type==="os-navigate"&&typeof n.url=="string"&&n.url!==""&&sa(e,n.url,n.target==="new"?"new":"self"),n.type==="os-iframe-other-admin-link"&&typeof n.url=="string"&&n.url!==""&&Nt.state.deps?.openOtherAdmin?.(n.url),n.type==="os-iframe-admin-link"&&typeof n.url=="string"&&n.url!==""){const o=Nt.state.deps;if(rt(n.url))e.close();else if(o){const i=typeof n.label=="string"?n.label:"";da(e,n.url,i,o,n.newContext===!0)}}if(n.type==="os-open-user-footprint"&&typeof n.userId=="number"&&n.userId>0&&na({userId:n.userId,userName:typeof n.userName=="string"?n.userName:""}),n.type==="os-notification"&&typeof n.title=="string"&&n.title!==""&&ga(n.title,typeof n.body=="string"?n.body:""),n.type==="os-focus-request"&&(e.element.classList.contains("os-window--overview")||e.onFocusRequest?.(e)),n.type==="os-screen-meta"&&Array.isArray(n.panels)&&_a(e,n.panels),n.type==="os-screen-meta-state"&&ba(e,typeof n.open=="string"?n.open:null),n.type==="os-external-link"&&typeof n.url=="string"&&n.url!==""){const o=typeof n.label=="string"&&n.label!==""?n.label:n.url;ao(e,n.url,o)}if(n.type==="os-iframe-error"&&m(f.IFRAME_ERROR,{windowId:e.id,kind:n.kind==="unhandledrejection"?"unhandledrejection":"error",message:typeof n.message=="string"?n.message:"",filename:typeof n.filename=="string"?n.filename:null,lineno:typeof n.lineno=="number"?n.lineno:null,colno:typeof n.colno=="number"?n.colno:null,stack:typeof n.stack=="string"?n.stack:null}),n.type==="os-chrome-theme"&&n.tokens&&typeof n.tokens=="object")try{e.setAppearanceTheme(n.tokens)}catch(o){m(f.SHELL_ERROR,{scope:"window-bridge-chrome-theme",windowId:e.id,error:o})}if(n.type==="os-chrome-controls"&&n.config&&typeof n.config=="object")try{e.setAppearanceControls(n.config)}catch(o){m(f.SHELL_ERROR,{scope:"window-bridge-chrome-controls",windowId:e.id,error:o})}if(n.type==="os-chrome-slot"&&typeof n.slot=="string"&&typeof n.html=="string")try{e.setAppearanceSlot(n.slot,{html:n.html})}catch(o){m(f.SHELL_ERROR,{scope:"window-bridge-chrome-slot",windowId:e.id,error:o})}if(n.type==="os-iframe-activity"){if(n.phase==="start")e._markActivityStart(),n.navigation&&e._noteNavigationActivity();else if(n.phase==="end"){const o=!!n.failed,i=typeof n.status=="number"?n.status:0;e._markActivitySettled(!o,o?ia(i):void 0)}}if(n.type==="os-iframe-network"){const o={windowId:e.id,method:typeof n.method=="string"?n.method:"GET",url:typeof n.url=="string"?n.url:"",status:typeof n.status=="number"?n.status:0,duration:typeof n.duration=="number"?n.duration:0,failed:!!n.failed};n.requestHeaders&&typeof n.requestHeaders=="object"&&(o.requestHeaders=n.requestHeaders),n.responseHeaders&&typeof n.responseHeaders=="object"&&(o.responseHeaders=n.responseHeaders),m(f.IFRAME_NETWORK_COMPLETED,o)}}}function ia(e){return e<=0?_("Request failed."):se(_("Request failed (HTTP %d)."),e)}function sa(e,t,n){let o;try{o=new URL(t,M)}catch{return}if(o.origin===M){if(n==="new"){window.open(o.toString(),"_blank","noopener,noreferrer");return}e.iframe&&(e.iframe.src=o.toString())}}const ra=new Set(["trash","untrash","delete","spam","unspam","spamcomment","unspamcomment","trashcomment","untrashcomment","deletecomment","approvecomment","unapprovecomment"]);function aa(e){const t=e.searchParams.get("action");return t&&ra.has(t)&&(e.searchParams.has("_wpnonce")||e.searchParams.has("_wp_nonce"))?!0:Ur(e.toString(),e)!==null}function po(e,t){if(e.searchParams.has("_wp_http_referer"))return e;let n="";try{n=t.iframe?.contentWindow?.location.href??""}catch{}if(n||(n=t.config.url||""),!n)return e;try{const o=new URL(n,M);if(o.origin!==M)return e;const i=new URL(e.href),s=new URL(o.href);return s.searchParams.delete("openstation_chromeless"),i.searchParams.set("_wp_http_referer",s.pathname+(s.search?s.search:"")),i}catch{return e}}function la(e,t){let n="";try{n=e.getCurrentUrl?.()??""}catch{return""}if(!n||n.startsWith("#")||n==="about:blank")return"";try{const o=new URL(n,t.adminUrl);return o.origin!==M?"":t.deriveSlug(o.toString())}catch{return""}}function ca(e,t,n){if(t===(e.config.baseId||e.id))return!0;const o=la(e,n);return o!==""&&o===t}function da(e,t,n,o,i=!1){let s;try{s=new URL(t,o.adminUrl)}catch{return}if(s.origin!==M)return;if(i){Rt(e,s,n,o);return}const r=s.toString(),c=o.deriveSlug(r),a=ca(e,c,o);if(!a&&aa(s)){const d=po(s,e),l=e.iframe?.contentWindow;if(l)try{l.location.assign(d.href)}catch{e.iframe&&(e.iframe.src=d.href)}return}if(a){const d=e.iframe?.contentWindow;if(d)try{d.location.assign(r)}catch{e.iframe&&(e.iframe.src=r)}return}Rt(e,s,n,o)}function Rt(e,t,n,o){const i=t.toString(),s=o.deriveSlug(i),r=o.findDockEntry(i),c=n.trim(),a=r?.title||(c!==""?c:s),d=po(t,e);o.openWindow({id:s,baseId:s,url:d.toString(),parentUrl:r?.url??i,title:a,titleFromPage:!r,icon:r?.icon??"dashicons-admin-generic",submenu:r?.submenu,selfLabel:r?.selfLabel,multi:r?.multi})}function Ve(e){if(!e||e.startsWith("#"))return"";try{const t=new URL(e,M);return t.origin!==M?"":t.pathname.split("/").pop()??""}catch{return""}}const ua=new Set(["revision.php"]);function ha(e,t){try{const o=e.iframe?.contentWindow?.performance?.getEntriesByType?.("navigation")?.[0]?.name??"";if(o&&Ve(o)===Ve(t))return o}catch{}return t}function fa(e,t){const n=Ve(e.config.url??"");if(!n||!ua.has(n))return!1;const o=Ve(t);if(!o||o===n)return!1;if(rt(t))return e.close(),!0;const i=Nt.state.deps;if(!i)return!1;let s;try{s=new URL(ha(e,t),i.adminUrl)}catch{return!1}return s.origin!==M?!1:(Rt(e,s,"",i),e.close(),!0)}function pa(e){if(!e.config.titleFromPage||e._hasExplicitTitle)return;let t="";try{t=e.iframe?.contentDocument?.title??""}catch{return}const n=ma(t);n!==""&&n!==e.config.title&&e.setTitle(n)}function ma(e){const t=e.trim(),n=t.indexOf(" ‹ ");return(n>0?t.slice(0,n):t).trim()}function ga(e,t){const n=t!==""?`${e} — ${t}`:e;yt({message:n})}function _a(e,t){const n=e.element.querySelector(".os-window__screen-meta");if(!n)return;n.innerHTML="";const o={"screen-options":{icon:"dashicons-admin-generic",label:"Screen Options"},help:{icon:"dashicons-editor-help",label:"Help"}};for(const i of t){const s=o[i];if(!s)continue;const r=document.createElement("button");r.className="os-window__meta-btn",r.setAttribute("type","button"),r.setAttribute("aria-label",s.label),r.setAttribute("aria-pressed","false"),r.dataset.panel=i,r.innerHTML=`<span class="dashicons ${s.icon}" aria-hidden="true"></span>`,r.addEventListener("click",c=>{c.stopPropagation(),e.iframe?.contentWindow?.postMessage({type:"os-toggle-panel",panel:i},M)}),n.appendChild(r)}}function ba(e,t){const n=e.element.querySelector(".os-window__screen-meta");n&&n.querySelectorAll(".os-window__meta-btn").forEach(o=>{const i=o.dataset.panel===t;o.classList.toggle("os-window__meta-btn--active",i),o.setAttribute("aria-pressed",i?"true":"false")})}const mo=k("desktop-mode/title-bar-buttons-registry",()=>({registry:new Map,listeners:new Set})),wa=mo.state.registry,Ot=mo.state.listeners;function ya(){return Array.from(wa.values()).sort((e,t)=>(e.order??100)-(t.order??100))}function va(e){const t=[],n=[];for(const o of ya()){try{if(!o.match(e))continue}catch{continue}o.placement==="right"?n.push(o):t.push(o)}return{left:t,right:n}}function Ea(e){return Ot.add(e),()=>{Ot.delete(e)}}function Aa(){const e=Array.from(Ot);for(const t of e)try{t()}catch(n){typeof console<"u"&&console.error("[openstation] title-bar-button registry listener threw:",n)}}typeof document<"u"&&document.addEventListener("os-settings-save-lifecycle",e=>{const t=e.detail;t&&t.phase==="saved"&&Aa()});const Sa=/^dashicons-[a-z0-9-]+$/i,xa=/^\s*<svg[\s>]/i;function go(e,t){if(t){if(Sa.test(t)){const n=document.createElement("span");n.className=`dashicons ${t}`,n.setAttribute("aria-hidden","true"),e.appendChild(n);return}if(xa.test(t)){const n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.innerHTML=t,e.appendChild(n);return}e.setAttribute("icon",t)}}const _o=k("desktop-mode/window-themes-registry",()=>({registry:new Map,listeners:new Set})),Ca=_o.state.registry,bo=_o.state.listeners;function wo(){return Array.from(Ca.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}function ka(e){let t=null;for(const n of wo()){try{if(!n.match(e))continue}catch(o){typeof console<"u"&&console.warn(`[openstation] window-theme "${n.id}" match() threw — skipping`,o);continue}t=n}return t}function Ta(e){return bo.add(e),()=>{bo.delete(e)}}const Ke=new WeakMap;function Ia(e,t){let n=null,o={};if(t&&"tokens"in t&&t.tokens)n=null,o={...t.tokens};else if(t&&"themeId"in t&&t.themeId){const s=Na(t.themeId);s&&(n=s.id,o={...s.tokens})}else{const s=ka(e);s&&(n=s.id,o={...s.tokens})}const i=T(f.WINDOW_CHROME_THEME,o,{windowId:e.id,themeId:n,config:e.config});return{themeId:n,tokens:i}}function Dt(e,t){const n=e.element;if(!n)return;const o=Ke.get(n),{themeId:i,tokens:s}=Ia(e,t);if(o){for(const c of o.keys)if(!(c in s))try{n.style.removeProperty(c)}catch{}}const r=new Set;for(const[c,a]of Object.entries(s))try{n.style.setProperty(c,a),r.add(c)}catch(d){m(f.SHELL_ERROR,{scope:"window-theme-apply",windowId:e.id,key:c,error:d})}Ke.set(n,{themeId:i,keys:r}),m(f.WINDOW_CHROME_THEME_CHANGED,{windowId:e.id,themeId:i,tokens:s})}function La(e){const t=e.element;if(!t)return;const n=Ke.get(t);if(n){for(const o of n.keys)try{t.style.removeProperty(o)}catch{}Ke.delete(t)}}function Na(e){for(const t of wo())if(t.id===e)return{id:t.id,tokens:t.tokens};return null}const yo=k("desktop-mode/window-controls-registry",()=>({registry:new Map,listeners:new Set})),Ra=yo.state.registry,vo=yo.state.listeners;function Oa(){return Array.from(Ra.values()).sort((e,t)=>{const n=e.order??100,o=t.order??100;return n!==o?n-o:e.id.localeCompare(t.id)})}function Da(e){const t=[],n=[],o=[];for(const i of Oa()){try{if(!i.match(e))continue}catch(r){typeof console<"u"&&console.warn(`[openstation] window-control "${i.id}" match() threw — skipping`,r);continue}const s=i.placement??"left";s==="right"?n.push(i):s==="controls"?o.push(i):t.push(i)}return{left:t,right:n,controls:o}}function Wa(e){return vo.add(e),()=>{vo.delete(e)}}function Ma(e,t){const n=Da(e),o=new Set(t?.hide??[]);let i=n.left.filter(d=>!o.has(d.id)),s=n.right.filter(d=>!o.has(d.id)),r=n.controls.filter(d=>!o.has(d.id));if(t?.custom){for(const d of t.custom){if(o.has(d.id))continue;const l={id:d.id,label:d.label,icon:d.icon,placement:d.placement??"controls",order:d.order??100,match:()=>!0,onClick:d.onClick?(u,p)=>d.onClick(p):void 0,render:d.render?u=>d.render(u):void 0};l.placement==="left"?i.push(l):l.placement==="right"?s.push(l):r.push(l)}i=Wt(i),s=Wt(s),r=Wt(r)}t?.order&&t.order.length>0&&(r=Pa(r,t.order));const c=t?.placement??"right",a={windowId:e.id,config:e.config};return i=T(f.WINDOW_CHROME_CONTROLS,i,{...a,placement:"left"}),s=T(f.WINDOW_CHROME_CONTROLS,s,{...a,placement:"right"}),r=T(f.WINDOW_CHROME_CONTROLS,r,{...a,placement:"controls"}),{left:i,right:s,controls:r,placement:c}}function Wt(e){return[...e].sort((t,n)=>{const o=t.order??100,i=n.order??100;return o!==i?o-i:t.id.localeCompare(n.id)})}function Pa(e,t){const n=new Map;for(const s of e)n.set(s.id,s);const o=[],i=new Set;for(const s of t){const r=n.get(s);r&&!i.has(s)&&(o.push(r),i.add(s))}for(const s of e)i.has(s.id)||o.push(s);return o}function $a(e,t){const n=document.createElement("os-window-button");n.setAttribute("aria-label",e.label||e.id),n.classList.add("os-window__btn");const o=za(e.id);if(n.classList.add(`os-window__btn--${o}`),e.id==="core/close"&&n.setAttribute("danger",""),typeof e.render=="function")try{e.render(n,t)}catch(i){return m(f.SHELL_ERROR,{scope:"window-control-render",id:e.id,windowId:t.id,error:i}),{element:n}}else if(bt(n,e.id)||go(n,e.icon??""),typeof e.onClick=="function"){const i=s=>{s.stopPropagation();try{e.onClick(t,s)}catch(r){m(f.SHELL_ERROR,{scope:"window-control-onclick",id:e.id,windowId:t.id,error:r})}};return n.addEventListener("os-button-activate",i),{element:n,teardown:()=>{n.removeEventListener("os-button-activate",i)}}}return{element:n}}function za(e){return e.startsWith("core/")?e.slice(5):e.replace(/\//g,"-")}function Ha(e,t){const n=[];for(;t.firstChild;)t.removeChild(t.firstChild);const o=Ma(e,e.config.appearance?.controls);t.classList.toggle("os-window__controls--left",o.placement==="left");for(const i of o.controls){const{element:s,teardown:r}=$a(i,e);t.appendChild(s),r&&n.push(r)}return m(f.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"controls"}),()=>{for(const i of n)try{i()}catch{}}}function Fa(e){if(!e)return 214;let t=5381;for(let n=0;n<e.length;n++)t=Math.imul(t,33)+e.charCodeAt(n);return(t%360+360)%360}function Ua(e){return typeof e!="string"||e===""||e.length>4096||!/^(https?:\/\/|data:image\/)/i.test(e)?!1:!/['"()\\<>\s]/.test(e)}function Eo(e,t,n){if(!Ua(t))return!1;const o=`url("${t}") center / contain no-repeat`;return e.style.backgroundImage="none",e.style.backgroundColor=n,e.style.setProperty("-webkit-mask",o),e.style.setProperty("mask",o),!0}const Ao="data:image/svg+xml;base64,",je=new Map;function Ga(e){const t=je.get(e);if(t!==void 0)return t;let n=!1;try{n=atob(e.slice(Ao.length)).includes("currentColor")}catch{}return je.size>=256&&je.clear(),je.set(e,n),n}function Ba(e,t){const n=t.className??"",o=t.title??"";let i=null;if(t.slot){const a=Kn(t.slot);a!==null&&(e=a),i=jn(t.slot)}if(typeof e=="string"&&e.startsWith("dashicons-")){const a=document.createElement("span");return a.className=`dashicons ${e} ${n}`.trim(),a.setAttribute("aria-hidden","true"),i!==null&&(a.style.color=i),a}if(i!==null&&typeof e=="string"){const a=document.createElement("span");if(a.className=n,a.setAttribute("aria-hidden","true"),a.style.display="inline-block",Eo(a,e,i))return a}if(typeof e=="string"&&e.startsWith("data:image/svg+xml;base64,")){const a=e.slice(Ao.length);if(/^[A-Za-z0-9+/=]+$/.test(a)){const d=document.createElement("span");return d.className=n,d.setAttribute("aria-hidden","true"),d.style.display="inline-block",Ga(e)&&Eo(d,e,"currentColor")||(d.style.backgroundImage=`url("${e}")`,d.style.backgroundRepeat="no-repeat",d.style.backgroundPosition="center",d.style.backgroundSize="contain"),d}}if(typeof e=="string"&&/^data:image\/(png|jpeg|jpg|gif|webp|x-icon|vnd\.microsoft\.icon);base64,/i.test(e)){const a=e.indexOf(","),d=a>=0?e.slice(a+1):"";if(/^[A-Za-z0-9+/=]+$/.test(d))return So(e,n)}if(typeof e=="string"&&(e.startsWith("http://")||e.startsWith("https://")))return So(e,n);const s=document.createElement("span");s.className=`${n} os-icon-letter`.trim(),s.setAttribute("aria-hidden","true");const r=qa(o);s.textContent=r;const c=Fa(o);return s.style.backgroundColor=`hsl( ${c}, 60%, 45% )`,s.style.color="#fff",s.style.display="inline-flex",s.style.alignItems="center",s.style.justifyContent="center",s.style.fontWeight="600",s.style.borderRadius="4px",s}function So(e,t){const n=document.createElement("img");return n.className=t,n.src=e,n.alt="",n.setAttribute("aria-hidden","true"),n.draggable=!1,n}function qa(e){const t=(e??"").trim();if(t==="")return"?";const n=t.split(/\s+/);if(n.length>=2)return(n[0][0]+n[1][0]).toUpperCase();const o=n[0];return o.length>=2?o.slice(0,2).toUpperCase():o.toUpperCase()}const xo=k("desktop-mode/window-slots-registry",()=>({registry:new Map,listeners:new Set})),Va=xo.state.registry,Co=xo.state.listeners;function Ka(){return Array.from(Va.values()).sort((e,t)=>{const n=e.order??100,o=t.order??100;return n!==o?n-o:e.id.localeCompare(t.id)})}function ja(e,t){const n=[];for(const o of Ka())if(o.slot===t){try{if(!o.match(e))continue}catch(i){typeof console<"u"&&console.warn(`[openstation] window-slot "${o.id}" match() threw — skipping`,i);continue}n.push(o)}return n}function Ya(e){return Co.add(e),()=>{Co.delete(e)}}const ko=["before-titlebar","before-icon","icon","title","after-title","before-controls","after-controls","after-titlebar"],To=new WeakMap;function Io(e,t){return e.querySelector(`[data-slot="${t}"]`)}function Xa(e){const t=new Map;for(const n of ko){const o=Io(e,n);o&&t.set(n,Array.from(o.childNodes).map(i=>i.cloneNode(!0)))}return t}function ve(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Za(e,t){ve(e);for(const n of t)e.appendChild(n.cloneNode(!0))}function Qa(e,t){const n=e.querySelector(".os-window__title");n&&(n.textContent=t)}function Ja(e){const t=[],n=e.element;if(!n)return()=>{};let o=To.get(n);o||(o=Xa(n),To.set(n,o));const i=e.config.appearance?.slots??{};for(const s of ko){const r=Io(n,s);if(!r)continue;const c=o.get(s)??[],a=i[s],d=ja(e,s);if(a===null)ve(r);else if(a&&"html"in a)ve(r),r.textContent=a.html;else if(a&&"render"in a){a.replace!==!1&&ve(r);try{const u=a.render(r);typeof u=="function"&&t.push(u)}catch(u){m(f.SHELL_ERROR,{scope:"window-slot-inline-render",windowId:e.id,slot:s,error:u})}}else Za(r,c),s==="title"&&Qa(r,e.config.title);if(a!==null){let l=!1;for(const u of d){u.replace!==!1&&!l&&(ve(r),l=!0);try{const g=u.render(r,{window:e,slot:s});typeof g=="function"&&t.push(g)}catch(g){m(f.SHELL_ERROR,{scope:"window-slot-registry-render",windowId:e.id,slot:s,id:u.id,error:g})}}}T(f.WINDOW_CHROME_SLOT,r,{windowId:e.id,slot:s,config:e.config})}return m(f.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"slots"}),()=>{for(const s of t)try{s()}catch{}}}const Lo=k("desktop-mode/window-chrome-registry",()=>({registry:new Map,listeners:new Set})),el=Lo.state.registry,No=Lo.state.listeners;function tl(e){return el.get(e.toLowerCase())??null}function nl(e){return No.add(e),()=>{No.delete(e)}}const Ye="core/standard",Mt="os-window--custom-chrome";function Ro(e){const t=e.config.appearance?.chrome??Ye;return T(f.WINDOW_CHROME_RENDER,t,{windowId:e.id,config:e.config})}function Oo(e){return{title:e.config.title,icon:e.config.icon,focused:e.element.classList.contains("os-window--focused"),state:e.state}}function ol(e){const t=Ro(e);if(t===Ye)return null;const n=tl(t);if(!n)return null;try{if(n.match&&!n.match(e))return null}catch{return null}e.element.classList.add(Mt);let o;try{o=n.render(e.element,{window:e,state:Oo(e)})}catch(i){return e.element.classList.remove(Mt),m(f.SHELL_ERROR,{scope:"window-chrome-render",windowId:e.id,chromeId:t,error:i}),null}return m(f.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"chrome",chromeId:t}),{id:t,handle:o}}const Do=k("desktop-mode/window-actions-registry",()=>({registry:new Map,listeners:new Set})),il=Do.state.registry,Wo=Do.state.listeners;function Mo(){return Array.from(il.values()).sort((e,t)=>(e.order??100)-(t.order??100))}function sl(e){return Wo.add(e),()=>{Wo.delete(e)}}function Po(e,t){if(typeof e.label=="function")try{return String(e.label(t)??"")}catch{return""}return e.label}function rl(e,t){if(typeof e.icon=="function")try{return String(e.icon(t)??"")}catch{return""}return e.icon??""}function al(e,t){if(!e.checkable||typeof e.checked!="function")return!1;try{return!!e.checked(t)}catch{return!1}}function $o(e,t){if(typeof e.isVisible!="function")return!0;try{return!!e.isVisible(t)}catch{return!1}}function ll(e){const t=e.element.querySelector(".os-window__menu-panel");if(!t)return[];const n=Array.from(t.querySelectorAll("os-menu-item:not(.os-window__menu-item--action)")).map(o=>o.textContent?.trim()??"");for(const o of Mo())$o(o,e)&&n.push(Po(o,e));return n.filter(Boolean)}function zo(e){const t=e.element.querySelector(".os-window__menu-panel");t&&(t.hidden?Ho(e):K(e))}function Ho(e){const t=e.element.querySelector(".os-window__menu-panel"),n=e.element.querySelector(".os-window__menu-btn");if(!t||!n)return;t.hidden=!1,n.setAttribute("aria-expanded","true");const o=t.querySelector(".os-window__menu-item--startup");o&&Pt(e,o),Uo(e,t),e._unsubscribeWindowActions?.(),e._unsubscribeWindowActions=sl(()=>{t.hidden||Uo(e,t)}),m(f.WINDOW_MENU_OPENED,{windowId:e.id,element:t}),e._boundOnDocumentPointerDown||(e._boundOnDocumentPointerDown=s=>{const r=s.target;r&&(t.contains(r)||n.contains(r)||K(e))}),setTimeout(()=>{e._boundOnDocumentPointerDown&&document.addEventListener("pointerdown",e._boundOnDocumentPointerDown,!0)},0),t.querySelector('[role="menuitem"]')?.focus()}function K(e){const t=e.element.querySelector(".os-window__menu-panel"),n=e.element.querySelector(".os-window__menu-btn");t&&(t.hidden=!0),n&&n.setAttribute("aria-expanded","false"),e._boundOnDocumentPointerDown&&document.removeEventListener("pointerdown",e._boundOnDocumentPointerDown,!0),e._unsubscribeWindowActions?.(),e._unsubscribeWindowActions=null}function Fo(e){e.hasAttribute("checked")?e.removeAttribute("checked"):e.setAttribute("checked","")}function Pt(e,t){const n=window.wp?.os?.config?.defaultWindow;let o=!1;if(n&&n.enabled&&typeof n.url=="string")if(e.config.native)o=n.url===`native:${e.id}`;else try{const i=Q(e.getCurrentUrl()),s=Q(n.url);o=i===s}catch{o=!1}o?t.setAttribute("checked",""):t.removeAttribute("checked")}function Uo(e,t){for(const n of Array.from(t.querySelectorAll(".os-window__menu-item--action")))n.remove();for(const n of Mo()){if(!$o(n,e))continue;const o=Po(n,e);if(!o)continue;const i=document.createElement("os-menu-item");if(i.setAttribute("value",n.id),i.classList.add("os-window__menu-item"),i.classList.add("os-window__menu-item--action"),i.setAttribute("data-action-id",n.id),i.textContent=o,n.checkable)i.setAttribute("role","menuitemcheckbox"),al(n,e)&&i.setAttribute("checked","");else{i.setAttribute("role","menuitem");const r=rl(n,e);r&&i.setAttribute("icon",r)}const s=n.closeOnSelect??!n.checkable;i.addEventListener("os-menu-item-click",r=>{r.stopPropagation(),n.checkable&&Fo(i),s&&K(e);try{n.onSelect(e)}catch(c){typeof console<"u"&&console.error(`[openstation] window action "${n.id}" threw:`,c)}}),t.appendChild(i)}}const cl={minDurationMs:1e3,minReversals:5,minAmplitudePx:14,maxGapMs:320,cooldownMs:600},dl="os-pointer-shake";function ul(e={}){const t={...cl,...e};let n={origin:0,dir:0,extent:0},o={origin:0,dir:0,extent:0},i=[],s=!1,r=-1/0;const c=()=>{n={origin:0,dir:0,extent:0},o={origin:0,dir:0,extent:0},i=[],s=!1},a=(l,u)=>{if(l.dir===0){const g=u-l.origin;return Math.abs(g)>=t.minAmplitudePx&&(l.dir=g>0?1:-1,l.extent=Math.abs(g)),!1}const p=(u-l.origin)*l.dir;if(p>=l.extent)return l.extent=p,!1;if(l.extent-p>=t.minAmplitudePx){const g=l.origin+l.dir*l.extent;return l.origin=g,l.dir=l.dir===1?-1:1,l.extent=l.extent-p,l.extent>=0}return!1};return{feed:(l,u,p)=>{if(p<r)return null;if(!s)return s=!0,n.origin=l,o.origin=u,null;const g=i[i.length-1];g&&p-g.t>t.maxGapMs&&(i=[]);const b=a(n,l),v=a(o,u);if(b&&i.push({t:p,axis:"x"}),v&&i.push({t:p,axis:"y"}),!b&&!v||i.length<t.minReversals)return null;const w=p-i[0].t;if(w<t.minDurationMs)return null;let S=0;for(const x of i)x.axis==="x"&&S++;const A={x:l,y:u,durationMs:w,reversals:i.length,axis:S*2>=i.length?"x":"y"};return c(),r=p+t.cooldownMs,A},reset:c}}function hl(e,t){e.dispatchEvent(new CustomEvent(dl,{detail:t,bubbles:!0,composed:!0}))}function Go(e,t){let n=!1;return()=>{n||(n=!0,requestAnimationFrame(()=>{if(n=!1,!(t==="drag"&&!e._isDragging)&&!(t==="resize"&&!e._isResizing)&&!(e._isDestroyed||!e.element.isConnected))try{m(f.WINDOW_BOUNDS_CHANGED,{windowId:e.id,x:e.element.offsetLeft,y:e.element.offsetTop,width:e.element.offsetWidth,height:e.element.offsetHeight,state:e.state,phase:t})}catch{}}))}}function fl(e,t){const n=t.target;if(n.closest(".os-window__btn")||n.closest(".os-window__custom-buttons")||n.closest(".os-window__controls")||n.closest(".os-window__screen-meta")||n.closest(".os-window__menu-btn")||n.closest(".os-window__menu-panel")||Qt())return;const o=e.state==="maximized",i=e.state==="snapped-left"||e.state==="snapped-right",s=o||i,r=t.clientX,c=t.clientY,a=t.pointerId,d=s?pl(e,t):null;e._titleBar.setPointerCapture(a);const l=e.snapConfigProvider?.()??{enabled:!1,cellWidth:0,cellHeight:0},u=Go(e,"drag"),p=ul();let g=!1,b=r,v=c;const w=(h,E,I)=>{h===g||!e._isDragging||(g=h,e.onDragGesture?.(e,{type:"modifier",active:h,clientX:E,clientY:I}))},S=h=>{h.key==="Alt"&&(h.preventDefault(),w(h.type==="keydown",b,v))};let A=!1;const x=(h,E)=>{if(A)return;A=!0;let I,F;if(d){const P=ml(e,d,h,E);I=P.left,F=P.top}else I=e.element.offsetLeft,F=e.element.offsetTop;e.element.classList.add("os-window--dragging"),l.enabled&&e.element.classList.add("os-window--snap-drag"),e._isDragging=!0,e._dragOffsetX=h-I,e._dragOffsetY=E-F,window.addEventListener("keydown",S),window.addEventListener("keyup",S),m(f.WINDOW_DRAG_START,{windowId:e.id})};s||x(r,c);const N=h=>{if(!A){const U=h.clientX-r,Le=h.clientY-c;if(U*U+Le*Le<ur)return;x(h.clientX,h.clientY)}if(!e._isDragging)return;let E=h.clientX-e._dragOffsetX,I=h.clientY-e._dragOffsetY;const F=e.element.parentElement;if(F){const U=bl(E,I,e.element.offsetWidth,{x:0,y:0,width:F.clientWidth,height:F.clientHeight});E=U.x,I=U.y}l.enabled&&(E=Math.round(E/l.cellWidth)*l.cellWidth,I=Math.round(I/l.cellHeight)*l.cellHeight),e.element.style.left=`${E}px`,e.element.style.top=`${I}px`,b=h.clientX,v=h.clientY,w(h.altKey,h.clientX,h.clientY),e.onDragMove?.(e,h.clientX,h.clientY);const P=p.feed(h.clientX,h.clientY,h.timeStamp);P&&(hl(e.element,P),m(f.POINTER_SHAKE,{...P,windowId:e.id}),e.onDragGesture?.(e,{type:"shake",clientX:h.clientX,clientY:h.clientY})),u()},D=()=>{try{e._titleBar.releasePointerCapture(a)}catch{}},Ie=()=>{e._titleBar.removeEventListener("pointermove",N),e._titleBar.removeEventListener("pointerup",j),e._titleBar.removeEventListener("pointercancel",j),e._titleBar.removeEventListener("lostpointercapture",j),window.removeEventListener("keydown",S),window.removeEventListener("keyup",S),p.reset()},j=()=>{if(!A){D(),Ie();return}if(!e._isDragging||(e._isDragging=!1,e.element.classList.remove("os-window--dragging"),e.element.classList.remove("os-window--snap-drag"),D(),Ie(),e.onDragEnd?.(e)??!1))return;e._gridSpan=null,e._emitChange("moved");const E={windowId:e.id,x:e.element.offsetLeft,y:e.element.offsetTop};m(f.WINDOW_DRAG_END,E),m(f.WINDOW_MOVED,E)};e._titleBar.addEventListener("pointermove",N),e._titleBar.addEventListener("pointerup",j),e._titleBar.addEventListener("pointercancel",j),e._titleBar.addEventListener("lostpointercapture",j)}function pl(e,t){const n=e._titleBar.getBoundingClientRect(),o=n.width>0?(t.clientX-n.left)/n.width:.5,i=e.element.parentElement,s=i?We(i):null,r=s?Math.min(960,Math.round(s.width*.6)):640,c=s?Math.min(640,Math.round(s.height*.7)):480,a=e._savedGeometry?.width??r,d=e._savedGeometry?.height??c,l=i?.getBoundingClientRect();return{isMaximized:e.state==="maximized",cursorRatioX:o,titleBarHeight:n.height,areaLeft:l?.left??0,areaTop:l?.top??0,targetW:a,targetH:d}}function ml(e,t,n,o){e.element.classList.remove("os-window--maximized","os-window--snapped-left","os-window--snapped-right"),e.element.style.width=`${t.targetW}px`,e.element.style.height=`${t.targetH}px`;const i=Math.max(q,Math.round(n-t.areaLeft-t.targetW*t.cursorRatioX)),s=Math.max(q,Math.round(o-t.areaTop-t.titleBarHeight/2));return e.element.style.left=`${i}px`,e.element.style.top=`${s}px`,e.state="normal",e._emitChange("state"),t.isMaximized&&m(f.WINDOW_UNMAXIMIZED,{windowId:e.id}),{left:i,top:s}}function gl(e,t){if(e.state==="maximized"||e.state==="fullscreen")return;t.preventDefault(),t.stopPropagation();const n=t.target,o=n.dataset.dir??"se";e._isResizing=!0,e._resizeStartX=t.clientX,e._resizeStartY=t.clientY,e._resizeStartW=e.element.offsetWidth,e._resizeStartH=e.element.offsetHeight;const i=e.element.offsetLeft,s=e.element.offsetTop;n.setPointerCapture(t.pointerId),e.element.classList.add("os-window--resizing"),m(f.WINDOW_RESIZE_START,{windowId:e.id});const r=Go(e,"resize"),c=e.snapConfigProvider?.()??{enabled:!1,cellWidth:0,cellHeight:0};c.enabled&&e.element.classList.add("os-window--snap-drag"),(e.state==="snapped-left"||e.state==="snapped-right")&&(e.element.classList.remove("os-window--snapped-left","os-window--snapped-right"),e.state="normal");const a=l=>{if(!e._isResizing)return;const u=l.clientX-e._resizeStartX,p=l.clientY-e._resizeStartY,g=_l(o,u,p,i,s,e._resizeStartW,e._resizeStartH,e.config.minWidth,e.config.minHeight,c);e.element.style.left=`${g.x}px`,e.element.style.top=`${g.y}px`,e.element.style.width=`${g.width}px`,e.element.style.height=`${g.height}px`,r()},d=()=>{if(!e._isResizing)return;e._isResizing=!1,e.element.classList.remove("os-window--resizing"),e.element.classList.remove("os-window--snap-drag"),n.removeEventListener("pointermove",a),n.removeEventListener("pointerup",d),n.removeEventListener("pointercancel",d),n.removeEventListener("lostpointercapture",d),e._gridSpan=null,e._emitChange("resized");const l={windowId:e.id,width:e.element.offsetWidth,height:e.element.offsetHeight};m(f.WINDOW_RESIZE_END,l),m(f.WINDOW_RESIZED,l)};n.addEventListener("pointermove",a),n.addEventListener("pointerup",d),n.addEventListener("pointercancel",d),n.addEventListener("lostpointercapture",d)}function _l(e,t,n,o,i,s,r,c,a,d){let l=s,u=r,p=o,g=i;if((e==="ne"||e==="se")&&(l=Math.max(c,s+t)),e==="nw"||e==="sw"){const b=Math.max(c,s-t);p=o+(s-b),l=b}if((e==="se"||e==="sw")&&(u=Math.max(a,r+n)),e==="ne"||e==="nw"){const b=Math.max(a,r-n);g=i+(r-b),u=b}if(d.enabled){const b=Math.max(c,Math.round(l/d.cellWidth)*d.cellWidth),v=Math.max(a,Math.round(u/d.cellHeight)*d.cellHeight);(e==="nw"||e==="sw")&&(p=o+(l-b)),(e==="nw"||e==="ne")&&(g=i+(u-v)),l=b,u=v}if(p<q){const b=q-p;p=q,l=Math.max(c,l-b)}if(g<q){const b=q-g;g=q,u=Math.max(a,u-b)}return{x:p,y:g,width:l,height:u}}function bl(e,t,n,o){const i=o.x+At-n,s=o.x+o.width-At,r=Math.max(i,Math.min(e,s)),c=o.y+q,a=o.y+o.height-At,d=Math.max(c,Math.min(t,a));return{x:r,y:d}}const wl="os-speculate-doc",Bo=new Map,yl=1e3;function vl(e){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker.controller)return;let t;try{const i=new URL(e,window.location.href);if(i.origin!==window.location.origin)return;t=i.toString()}catch{return}const n=Date.now(),o=Bo.get(t);if(!(o!==void 0&&n-o<yl)){Bo.set(t,n);try{navigator.serviceWorker.controller.postMessage({type:wl,url:t})}catch{}}}const $t=window.location.origin,El="os-window-open",Al=300;function Sl(e){if(!window.wp?.os?.getOsSettings?.().windowPrewarmEnabled)return;const n=be(e);n&&vl(n)}const xl=120,ce=class ce{constructor(t){if(this.state="normal",this._hasExplicitTitle=!1,this._activityCount=0,this._activityPhase="idle",this._activityError=null,this._activityClearTimer=null,this._activitySavingStartedAt=0,this._activitySettleTimer=null,this._navigationActivity="none",this._navigationActivityTimer=null,this._isDragging=!1,this._isResizing=!1,this._isDestroyed=!1,this._dragOffsetX=0,this._dragOffsetY=0,this._resizeStartX=0,this._resizeStartY=0,this._resizeStartW=0,this._resizeStartH=0,this._savedGeometry=null,this._gridSpan=null,this._savedFullscreenState=null,this._stateBeforeMinimize=null,this._minimizeAnimation=null,this._restoreAnimation=null,this._externalTabs=new Map,this._externalTabSeq=0,this._titleBarButtonsUnsubscribe=null,this._windowThemesUnsubscribe=null,this._windowControlsUnsubscribe=null,this._windowControlsTeardown=null,this._windowSlotsUnsubscribe=null,this._windowSlotsTeardown=null,this._chromeHandle=null,this._chromeId=Ye,this._windowChromesUnsubscribe=null,this._nativeRenderTeardown=null,this._nativeRenderCtxDispose=null,this._closeSafetyNetTimer=null,this._clearOpeningClassRemoval=null,this._onCloseTransitionEnd=null,this._isFinalized=!1,this._iframeBridgeReady=!1,this._iframeCloseTimeout=null,this._closePending=!1,this._unsavedGuardPending=!1,this._deferredNavigationCommit=null,this._deferredNavigationTimer=null,this._activeTabId="primary",this.onFocusRequest=null,this.onClose=null,this.onMinimize=null,this.onRestore=null,this.onOpenAnother=null,this.onOpenInNewWindow=null,this.onToggleStartup=null,this.snapConfigProvider=null,this.onDragMove=null,this.onDragEnd=null,this.onDragGesture=null,this._boundOnDocumentPointerDown=null,this._unsubscribeWindowActions=null,this._bodyResizeObserver=null,this._tabOverflowTeardown=null,this._tabSpeculateTimer=null,this._swapBuffer=null,this._swapBufferTimer=null,this._suppressCloseFilter=!1,this.id=t.id,this.config=t,this.element=Lr(t),this.iframe=t.native?null:this.element.querySelector(".os-window__iframe"),this._titleBar=this.element.querySelector(".os-window__titlebar"),this._titleEl=this.element.querySelector(".os-window__title"),this._boundOnMessage=n=>oa(this,n),this.bindEvents(),this.iframe&&this._wireContentFocusForwarder(this.iframe),this.renderCustomTitleBarButtons(),this._titleBarButtonsUnsubscribe=Ea(()=>{this.renderCustomTitleBarButtons()}),Dt(this,this.config.appearance?.theme),this._windowThemesUnsubscribe=Ta(()=>{this._isDestroyed||Dt(this,this.config.appearance?.theme)}),this.repaintWindowControls(),this._windowControlsUnsubscribe=Wa(()=>{this._isDestroyed||this.repaintWindowControls()}),this.repaintWindowSlots(),this._windowSlotsUnsubscribe=Ya(()=>{this._isDestroyed||this.repaintWindowSlots()}),this.remountWindowChrome(),this._windowChromesUnsubscribe=nl(()=>{if(this._isDestroyed)return;Ro(this)!==this._chromeId&&this.remountWindowChrome()}),this._bodyResizeObserver=this.installBodyResizeObserver(),t.initialState==="minimized"){this.state="minimized",this.element.classList.add("os-window--minimized"),this.iframe&&(this.iframe.style.visibility="hidden"),this.element.style.setProperty("content-visibility","hidden");return}(t.initialState==="snapped-left"||t.initialState==="snapped-right")&&this.element.classList.add(`os-window--${t.initialState}`),document.hidden||(this.element.classList.add("os-window--opening"),this._armOpeningClassRemoval()),t.initialState&&t.initialState!=="normal"&&requestAnimationFrame(()=>this.applyInitialState(t.initialState))}_armOpeningClassRemoval(){const t=this.element;let n=null,o=!1;const i=()=>{o||(o=!0,this._clearOpeningClassRemoval=null,n!==null&&(window.clearTimeout(n),n=null),t.removeEventListener("animationend",s),t.removeEventListener("animationcancel",s),t.classList.remove("os-window--opening"))},s=r=>{r.target!==t||r.animationName!==El||i()};t.addEventListener("animationend",s),t.addEventListener("animationcancel",s),n=window.setTimeout(()=>{n=null,i()},Al),this._clearOpeningClassRemoval=i}hydrateNative(){if(!this.config.native||!this.config.render)return;const t=this.element.querySelector(".os-window__body");if(!t)return;const n=T(f.NATIVE_WINDOW_BEFORE_RENDER,t,{windowId:this.id,config:this.config}),o=n instanceof HTMLElement?n:t,{ctx:i,dispose:s}=Gi(this.id,this.config.params??{});this._nativeRenderCtxDispose=s;const r=this.config.render(o,i),c=d=>{typeof d=="function"&&(this._nativeRenderTeardown=d)};r instanceof Promise?r.then(d=>{this._isDestroyed||(c(d),$(this.id))},d=>{typeof console<"u"&&console.error(`[openstation] native render rejected for "${this.id}":`,d),m(f.SHELL_ERROR,{scope:"window-open",id:this.id,error:d}),!this._isDestroyed&&$(this.id)}):(c(r),requestAnimationFrame(()=>{this._isDestroyed||$(this.id)})),m(f.NATIVE_WINDOW_AFTER_RENDER,{windowId:this.id,body:o,config:this.config});const a=this.config.autofocus;a&&requestAnimationFrame(()=>{if(this._isDestroyed)return;if(typeof a=="string"){o.querySelector(a)?.focus();return}o.hasAttribute("tabindex")||(o.tabIndex=-1),o.focus()})}applyInitialState(t){t==="minimized"?this.minimize():t==="maximized"?this.toggleMaximize():t==="fullscreen"?this.toggleFullscreen():t==="snapped-left"?this.applySnap("left"):t==="snapped-right"&&this.applySnap("right")}_emitChange(t){t==="state"&&(this._gridSpan=null),document.dispatchEvent(new CustomEvent("os-window-changed",{detail:{windowId:this.id,reason:t,state:this.state}}))}snapGeometry(t){const n=this.snapConfigProvider?.();if(!n||!n.enabled)return t;const o=Math.max(this.config.minWidth,Math.round(t.width/n.cellWidth)*n.cellWidth),i=Math.max(this.config.minHeight,Math.round(t.height/n.cellHeight)*n.cellHeight);return{x:Math.round(t.x/n.cellWidth)*n.cellWidth,y:Math.round(t.y/n.cellHeight)*n.cellHeight,width:o,height:i}}getCurrentUrl(){if(!this.iframe)return this.config.url||`#${this.id}`;try{const t=this.iframe.contentWindow?.location.href;if(t&&t!=="about:blank")return t}catch{}return this.iframe.src}bindEvents(){this.element.addEventListener("pointerdown",()=>{this.element.classList.contains("os-window--overview")||this.onFocusRequest?.(this)}),this.element.addEventListener("focusin",()=>{this.element.classList.contains("os-window--overview")||this.onFocusRequest?.(this)}),this._titleBar.addEventListener("pointerdown",s=>fl(this,s)),this.element.querySelectorAll(".os-window__resize-handle").forEach(s=>{s.addEventListener("pointerdown",r=>gl(this,r))});const n=this.element.querySelector(".os-window__menu-btn"),o=this.element.querySelector(".os-window__menu-panel");if(n&&o){n.addEventListener("click",l=>{l.stopPropagation(),zo(this)}),Wi(n,()=>({heading:_("Window actions"),text:ll(this).reduce((l,u)=>l?se(pi("%1$s, %2$s","list of menu item names"),l,u):u,"")}));const s=o.querySelector(".os-window__menu-item--open-another");s&&s.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),K(this),this.onOpenAnother?.(this)});const r=o.querySelector(".os-window__menu-item--open-in-new-window");r&&r.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),K(this),this.onOpenInNewWindow?.(this)});const c=o.querySelector(".os-window__menu-item--reload");c&&c.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),K(this),this.reload()});const a=o.querySelector(".os-window__menu-item--open-external");a&&a.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),K(this),this.detach()});const d=o.querySelector(".os-window__menu-item--startup");d&&(Pt(this,d),d.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),Fo(d),this.onToggleStartup?.(this)}),document.addEventListener("os-default-window-changed",()=>{Pt(this,d)})),o.addEventListener("keydown",l=>{l.key==="Escape"&&(l.stopPropagation(),K(this),n.focus())})}this._titleBar.addEventListener("dblclick",s=>{s.target?.closest('button, [role="button"], [role="menuitem"], [role="menuitemcheckbox"], os-window-button, os-menu, os-menu-item, .os-window__menu-panel, .os-window__custom-buttons, input, select, textarea, a')||Qt()||this.toggleMaximize()});const i=this.element.querySelector(".os-window__tabs");if(i&&(i.addEventListener("click",s=>$r(this,s)),i.addEventListener("keydown",s=>Hi(i,s)),i.addEventListener("pointerover",s=>{const r=s;if(r.pointerType!=="mouse")return;const c=r.target?.closest?.(".os-window__tab[data-url]"),a=c?.dataset.url;a&&(c?.classList.contains("is-active")||(this._tabSpeculateTimer&&window.clearTimeout(this._tabSpeculateTimer),this._tabSpeculateTimer=window.setTimeout(()=>{this._tabSpeculateTimer=null,Sl(a)},xl)))}),i.addEventListener("pointerleave",()=>{this._tabSpeculateTimer&&(window.clearTimeout(this._tabSpeculateTimer),this._tabSpeculateTimer=null)}),this._tabOverflowTeardown=Hr(i)),this.iframe){const s=this.iframe;this._wireTabNavSync(s),window.addEventListener("message",this._boundOnMessage)}}addExternalTab(t,n){ao(this,t,n)}setTabs(t,n){Fi(this.element,t,n)}activateTab(t){lt(this.element,t)}setZIndex(t){this.element.style.zIndex=String(t)}setFocused(t){this.element.classList.toggle("os-window--focused",t),this._notifyChromeStateChanged()}setTitle(t){const n=this.element.querySelector(".os-window__title");n&&(this._titleEl=n,n.textContent=t),this.config.title=t,m(f.WINDOW_TITLE_CHANGED,{windowId:this.id,title:t}),this._notifyChromeStateChanged()}repaintWindowControls(){const t=this.element.querySelector(".os-window__controls");if(t){if(this._windowControlsTeardown){try{this._windowControlsTeardown()}catch{}this._windowControlsTeardown=null}this._windowControlsTeardown=Ha(this,t)}}repaintThemedChrome(){const t=this.element.querySelector(".os-window__slot--icon");if(t){const o=t.querySelector(".os-window__icon");o&&o.replaceWith(Ba(this.config.icon,{title:this.config.title,className:"os-window__icon",slot:Ps(this.config.id)}))}const n=this.element.querySelector(".os-window__menu-btn");n&&(n.querySelectorAll(":scope > .dashicons").forEach(o=>o.remove()),n.removeAttribute("icon-src"),n.setAttribute("icon","menu"),bt(n,"core/menu"))}setAppearanceControls(t){this.config.appearance={...this.config.appearance??{},controls:t??void 0},this.repaintWindowControls()}repaintWindowSlots(){if(this._windowSlotsTeardown){try{this._windowSlotsTeardown()}catch{}this._windowSlotsTeardown=null}this._windowSlotsTeardown=Ja(this)}remountWindowChrome(){if(this._chromeHandle){try{this._chromeHandle.destroy()}catch{}this._chromeHandle=null}this.element.classList.remove(Mt);const t=ol(this);t?(this._chromeHandle=t.handle,this._chromeId=t.id):this._chromeId=Ye}setAppearanceChrome(t){this.config.appearance={...this.config.appearance??{},chrome:t??void 0},this.remountWindowChrome()}_notifyChromeStateChanged(){if(!this._isDestroyed&&this._chromeHandle?.update)try{this._chromeHandle.update(Oo(this))}catch{}}setAppearanceSlot(t,n){const i={...this.config.appearance?.slots??{}};n===void 0?delete i[t]:i[t]=n,this.config.appearance={...this.config.appearance??{},slots:i},this.repaintWindowSlots()}setAppearanceTheme(t){let n;t==null?n=void 0:typeof t=="string"?n={themeId:t}:typeof t=="object"&&("themeId"in t||"tokens"in t)?n=t:typeof t=="object"&&(n={tokens:t}),this.config.appearance={...this.config.appearance??{},theme:n},Dt(this,n)}applySnap(t){this._applySnapVisuals(t)&&(this.state=t==="left"?"snapped-left":"snapped-right",this._emitChange("state"))}snapTo(t){this.state==="normal"&&(this._savedGeometry={x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight}),this.applySnap(t)}_applySnapVisuals(t){const n=this.element.parentElement;if(!n)return!1;const o=We(n),i=Math.floor(o.width/2);return this.element.classList.remove("os-window--maximized","os-window--fullscreen","os-window--snapped-left","os-window--snapped-right"),this.element.classList.add(`os-window--snapped-${t}`),this.element.style.left=`${t==="left"?o.x:o.x+o.width-i}px`,this.element.style.top=`${o.y}px`,this.element.style.width=`${i}px`,this.element.style.height=`${o.height}px`,!0}unsnap(){if(!this.isSnapped())return;this.element.classList.remove("os-window--snapped-left","os-window--snapped-right");const t=this.element.parentElement;if(t){const n=We(t),o=this._savedGeometry,i=o?.width??Math.min(960,Math.round(n.width*.6)),s=o?.height??Math.min(640,Math.round(n.height*.7)),r=o?.x??n.x+Math.round((n.width-i)/2),c=o?.y??n.y+Math.round((n.height-s)/2);this.element.style.left=`${r}px`,this.element.style.top=`${c}px`,this.element.style.width=`${i}px`,this.element.style.height=`${s}px`}this.state="normal",this._emitChange("state")}isMinimized(){return this.state==="minimized"}isMaximized(){return this.state==="maximized"}isFullscreen(){return this.state==="fullscreen"}isSnapped(t){return t==="left"?this.state==="snapped-left":t==="right"?this.state==="snapped-right":this.state==="snapped-left"||this.state==="snapped-right"}isFocused(){return this.element.classList.contains("os-window--focused")}_prefersReducedMotion(){try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}_getDockTarget(){const t=[],n=s=>{typeof s=="string"&&s!==""&&!t.includes(s)&&t.push(s)};n(this.id),n(this.config.baseId);for(const s of t){let r=s;try{typeof CSS<"u"&&typeof CSS.escape=="function"&&(r=CSS.escape(s))}catch{r=s}const c=[`.os-dock__item[data-os-window-base-id="${r}"] .os-dock__item-primary`,`.os-dock__item[data-os-window-base-id="${r}"]`,`.os-dock__item[data-menu-slug="${r}"] .os-dock__item-primary`,`.os-dock__item[data-system-id="${r}"] .os-dock__item-primary`,`.os-dock__item[data-nav-id="${r}"] .os-dock__item-primary`,`.os-dock__item[data-menu-slug="${r}"]`,`.os-dock__item[data-system-id="${r}"]`,`.os-dock__item[data-nav-id="${r}"]`];for(const a of c){const d=document.querySelector(a);if(d){const l=d.getBoundingClientRect();if(l.width>0&&l.height>0)return d}}}const o=['.os-dock__item[data-os-window-base-id="os-system"] .os-dock__item-primary','.os-dock__item[data-system-id="os-system"] .os-dock__item-primary','.os-dock__item[data-os-window-base-id="os-system"]','.os-dock__item[data-system-id="os-system"]'];if(this.id==="desktop-mode-os-settings"||this.id==="os-settings"||this.config.baseId==="desktop-mode-os-settings")for(const s of o){const r=document.querySelector(s);if(r){const c=r.getBoundingClientRect();if(c.width>0&&c.height>0)return r}}const i=document.querySelector("#os-dock")??document.querySelector(".os-dock");if(i){const s=i.getBoundingClientRect();if(s.width>0&&s.height>0)return i}return null}_clearGenieStyles(){this.element.style.removeProperty("will-change"),this.element.style.removeProperty("transform"),this.element.style.removeProperty("opacity")}_cancelGenieAnimation(t){const n=t==="minimize",o=n?this._minimizeAnimation:this._restoreAnimation;if(o){try{o.cancel()}catch{}n?(this._minimizeAnimation=null,this.element.classList.remove("os-window--minimizing")):(this._restoreAnimation=null,this.element.classList.remove("os-window--restoring")),this._clearGenieStyles()}}_buildGenieTransform(t,n,o){const i=n.left+n.width/2-(t.left+t.width/2),s=n.top+n.height/2-(t.top+t.height/2),r=Math.min(n.width/t.width,n.height/t.height);return{dx:i,dy:s,scale:Math.max(.06,Math.min(r,o))}}_canGenieAnimate(t){return!!t&&!this._prefersReducedMotion()&&typeof this.element.animate=="function"&&!document.hidden&&!this.element.classList.contains("os-window--overview")}_installMinimizeContentVisibilityGuard(){const t=()=>{this.state==="minimized"&&!this.element.classList.contains("os-window--overview")&&(this.iframe&&(this.iframe.style.visibility="hidden"),this.element.style.setProperty("content-visibility","hidden"))};t(),this.element.addEventListener("transitionend",n=>{n.propertyName==="opacity"&&t()},{once:!0})}minimize(){if(this.state==="minimized")return;this._cancelGenieAnimation("restore"),this._cancelGenieAnimation("minimize"),this._stateBeforeMinimize=this.state;const t=this._getDockTarget();if(this._canGenieAnimate(t)){const n=this.element.getBoundingClientRect(),o=t.getBoundingClientRect();if(n.width>0&&n.height>0&&o.width>0&&o.height>0){this.state="minimized",this.element.classList.add("os-window--minimizing"),this.element.style.willChange="transform";const{dx:s,dy:r,scale:c}=this._buildGenieTransform(n,o,.22);let a=null;try{a=this.element.animate([{transform:"translate(0px, 0px) scale(1)",opacity:1},{offset:.6,transform:`translate(${s*.6}px, ${r*.6}px) scale(${1-(1-c)*.6})`,opacity:1},{transform:`translate(${s}px, ${r}px) scale(${c})`,opacity:0}],{duration:480,easing:"cubic-bezier(0.32, 0.72, 0, 1)",fill:"forwards"})}catch{a=null}if(a){this._minimizeAnimation=a,a.onfinish=()=>{if(this._minimizeAnimation===a){this._minimizeAnimation=null,this.element.classList.add("os-window--minimized"),this.element.classList.remove("os-window--minimizing"),this._clearGenieStyles();try{a.cancel()}catch{}this._installMinimizeContentVisibilityGuard()}},a.oncancel=()=>{this._minimizeAnimation===a&&(this._minimizeAnimation=null,this.element.classList.remove("os-window--minimizing"),this._clearGenieStyles())},this.onMinimize?.(this),this._emitChange("state"),m(f.WINDOW_MINIMIZED,{windowId:this.id,element:this.element}),this._stateBeforeMinimize==="fullscreen"&&ne();return}this.element.classList.remove("os-window--minimizing"),this._clearGenieStyles()}}this.state="minimized",this.element.classList.add("os-window--minimized"),this._installMinimizeContentVisibilityGuard(),this.onMinimize?.(this),this._emitChange("state"),m(f.WINDOW_MINIMIZED,{windowId:this.id,element:this.element}),this._stateBeforeMinimize==="fullscreen"&&ne()}restore(){this._cancelGenieAnimation("minimize"),this._cancelGenieAnimation("restore");const t=this.state==="minimized",n=t?this._getDockTarget():null;if(t&&this._canGenieAnimate(n)){this.element.style.removeProperty("content-visibility"),this.iframe&&(this.iframe.style.visibility=""),this.element.classList.remove("os-window--minimized"),this.element.classList.add("os-window--restoring"),this.element.style.willChange="transform";const o=this._stateBeforeMinimize??"normal";this.state=o,this._stateBeforeMinimize=null,o==="fullscreen"&&(ne(),this.updateFocusButtonState());const i=this.element.getBoundingClientRect(),s=n.getBoundingClientRect();if(i.width>0&&i.height>0&&s.width>0&&s.height>0){const{dx:c,dy:a,scale:d}=this._buildGenieTransform(i,s,.24);let l=null;try{l=this.element.animate([{transform:`translate(${c}px, ${a}px) scale(${d})`,opacity:0},{offset:.4,transform:`translate(${c*.4}px, ${a*.4}px) scale(${1-(1-d)*.4})`,opacity:1},{transform:"translate(0px, 0px) scale(1)",opacity:1}],{duration:480,easing:"cubic-bezier(0.32, 0.72, 0, 1)",fill:"forwards"})}catch{l=null}if(l){this._restoreAnimation=l;const u=()=>{if(this._restoreAnimation===l){this._restoreAnimation=null,this.element.classList.remove("os-window--restoring"),this._clearGenieStyles();try{l.cancel()}catch{}}};l.onfinish=u,l.oncancel=()=>{this._restoreAnimation===l&&(this._restoreAnimation=null,this.element.classList.remove("os-window--restoring"),this._clearGenieStyles())},this.onRestore?.(this),this.onFocusRequest?.(this),this._emitChange("state"),m(f.WINDOW_RESTORED,{windowId:this.id,element:this.element});return}}this.element.classList.remove("os-window--restoring"),this._clearGenieStyles(),this.onRestore?.(this),this.onFocusRequest?.(this),this._emitChange("state"),m(f.WINDOW_RESTORED,{windowId:this.id,element:this.element});return}this.element.style.removeProperty("content-visibility"),this.iframe&&(this.iframe.style.visibility=""),this.element.classList.remove("os-window--minimized"),t&&(this.state=this._stateBeforeMinimize??"normal",this._stateBeforeMinimize=null,this.state==="fullscreen"&&(ne(),this.updateFocusButtonState())),t&&this.onRestore?.(this),this.onFocusRequest?.(this),this._emitChange("state"),t&&m(f.WINDOW_RESTORED,{windowId:this.id,element:this.element})}maximize(){this.state!=="maximized"&&(this.state==="normal"&&(this._savedGeometry={x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight}),this._applyMaximizeVisuals()&&(this.state="maximized",this._emitChange("state"),m(f.WINDOW_MAXIMIZED,{windowId:this.id,element:this.element})))}_applyMaximizeVisuals(){const t=this.element.parentElement;if(!t)return!1;this.element.classList.remove("os-window--fullscreen","os-window--snapped-left","os-window--snapped-right"),this.element.classList.add("os-window--maximized");const n=We(t);return this.element.style.left=`${n.x}px`,this.element.style.top=`${n.y}px`,this.element.style.width=`${n.width}px`,this.element.style.height=`${n.height}px`,!0}toggleMaximize(){if(this.element.parentElement){if(this.state==="maximized"){if(this.element.classList.remove("os-window--maximized"),this._savedGeometry){const n=this.snapGeometry(this._savedGeometry);this.element.style.left=`${n.x}px`,this.element.style.top=`${n.y}px`,this.element.style.width=`${n.width}px`,this.element.style.height=`${n.height}px`,this._savedGeometry=n}this.state="normal",this._emitChange("state"),m(f.WINDOW_UNMAXIMIZED,{windowId:this.id,element:this.element});return}if(this.state==="fullscreen"){this._savedFullscreenState=null,this._applyMaximizeVisuals(),this.state="maximized",ne(),this.updateFocusButtonState(),this._emitChange("state"),m(f.WINDOW_FULLSCREEN_EXITED,{windowId:this.id,element:this.element}),m(f.WINDOW_MAXIMIZED,{windowId:this.id,element:this.element});return}this.maximize()}}toggleFullscreen(){if(this.state==="fullscreen"){this.element.classList.remove("os-window--fullscreen");const t=this._savedFullscreenState;this._savedFullscreenState=null;let n=!1;if(t&&t.state==="maximized")this._applyMaximizeVisuals(),this.state="maximized",n=!0;else if(t&&(t.state==="snapped-left"||t.state==="snapped-right")){const o=t.state==="snapped-left"?"left":"right";this._applySnapVisuals(o),this.state=t.state}else t?(this.element.style.left=`${t.x}px`,this.element.style.top=`${t.y}px`,this.element.style.width=`${t.width}px`,this.element.style.height=`${t.height}px`,this.state="normal"):this.state="normal";ne(),this.updateFocusButtonState(),this._emitChange("state"),m(f.WINDOW_FULLSCREEN_EXITED,{windowId:this.id,element:this.element}),n&&m(f.WINDOW_MAXIMIZED,{windowId:this.id,element:this.element});return}this.state==="normal"&&(this._savedGeometry={x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight}),this._savedFullscreenState={state:this.state,x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight},this.element.classList.remove("os-window--maximized","os-window--snapped-left","os-window--snapped-right"),this.element.classList.add("os-window--fullscreen"),this.state="fullscreen",ne(),this.updateFocusButtonState(),this._emitChange("state"),m(f.WINDOW_FULLSCREEN_ENTERED,{windowId:this.id,element:this.element})}updateFocusButtonState(){const t=this.element.querySelector(".os-window__btn--focus");if(!t)return;const n=this.state==="fullscreen";t.classList.toggle("os-window__btn--active",n),t.setAttribute("aria-pressed",n?"true":"false"),t.setAttribute("aria-label",_(n?"Exit fullscreen":"Enter fullscreen"))}detach(){const t=this.getCurrentUrl();let n;try{n=new URL(t,$t)}catch{return}n.origin===$t&&(n.searchParams.delete("openstation_chromeless"),n.searchParams.delete("desktop_mode_portal"),n.searchParams.set("desktop_mode_classic","1"),window.open(n.toString(),"_blank","noopener"),m(f.WINDOW_DETACHED,{windowId:this.id,url:n.toString()}))}reload(){if(this.element.querySelector(".os-window__body")?.classList.contains("os-window__body--loading")||this._unsavedGuardPending)return;if(this.config.native){this._reloadNative();return}let n,o;if(this._activeTabId==="primary"){if(!this.iframe)return;const r=this.iframe;n=this.getCurrentUrl(),o=()=>{try{r.contentWindow?.location.reload()}catch{r.src=r.src}}}else{const r=this._externalTabs.get(this._activeTabId);if(!r)return;n=r.url,o=()=>{try{r.iframe.contentWindow?.location.reload()}catch{r.iframe.src=r.url}}}this._spinReloadButton();const i=()=>{this.markContentLoading()},s=()=>{o(),m(f.WINDOW_RELOADED,{windowId:this.id,url:n})};this._activeTabId==="primary"?kt(this,{commit:i,navigate:s}):(i(),s())}_reloadNative(){if(!this.config.render)return;const t=this.element.querySelector(".os-window__body");if(t){if(this._nativeRenderCtxDispose){try{this._nativeRenderCtxDispose()}catch(n){m(f.SHELL_ERROR,{scope:"native-window-ctx-dispose",id:this.id,error:n})}this._nativeRenderCtxDispose=null}if(this._nativeRenderTeardown){try{this._nativeRenderTeardown()}catch(n){m(f.SHELL_ERROR,{scope:"native-window-teardown",id:this.id,error:n})}this._nativeRenderTeardown=null}t.replaceChildren(),this._spinReloadButton(),this.markContentLoading(),this.hydrateNative(),m(f.WINDOW_RELOADED,{windowId:this.id,url:this.config.url??""})}}navigateTo(t){if(this.config.native||!this.iframe)return!1;const n=be(t);return n?(kt(this,{commit:()=>{this.markContentLoading(),we(this,t)},navigate:()=>{const o=this.iframe?.contentWindow;if(o)try{o.location.assign(n);return}catch{}this.iframe&&(this.iframe.src=n)}}),!0):!1}_wireContentFocusForwarder(t){const n=()=>{let o=null;try{o=t.contentDocument}catch{return}o&&(o.location&&o.location.pathname.indexOf("/wp-admin/")!==-1||o.addEventListener("pointerdown",()=>{this.element.classList.contains("os-window--overview")||this.onFocusRequest?.(this)},{capture:!0,passive:!0}))};t.addEventListener("load",n),n()}_wireTabNavSync(t){t.addEventListener("load",()=>{try{const n=t.contentWindow?.location.href;if(!n||fa(this,n))return;pa(this),we(this,n)}catch{}})}_discardSwapBuffer(){this._swapBufferTimer!==null&&(window.clearTimeout(this._swapBufferTimer),this._swapBufferTimer=null),this._swapBuffer&&(this._swapBuffer.remove(),this._swapBuffer=null,this.iframe?.classList.remove("os-window__iframe--swap-front"))}swapReload(t){if(this.config.native||!this.iframe||this._isDestroyed)return;if(this._activeTabId!=="primary"){this.reload();return}const n=t?be(t):this.getCurrentUrl();if(!n)return;this._discardSwapBuffer();const o=this.iframe;o.classList.add("os-window__iframe--swap-front");const i=document.createElement("iframe");i.className="os-window__iframe os-window__iframe--buffer",i.setAttribute("aria-hidden","true"),i.setAttribute("name",`os-frame-${this.id}-buffer`),this._swapBuffer=i,this._swapBufferTimer=window.setTimeout(()=>{this._swapBuffer===i&&this._discardSwapBuffer()},2e4),i.addEventListener("load",()=>{if(this._swapBuffer!==i||this._isDestroyed)return;this._swapBuffer=null,this._swapBufferTimer!==null&&(window.clearTimeout(this._swapBufferTimer),this._swapBufferTimer=null);let s=0,r=0;try{s=o.contentWindow?.scrollX??0,r=o.contentWindow?.scrollY??0}catch{}if(s||r)try{i.contentWindow?.scrollTo(s,r)}catch{}i.classList.remove("os-window__iframe--buffer"),i.removeAttribute("aria-hidden"),i.setAttribute("name",`os-frame-${this.id}`),o.remove(),this.iframe=i,$(this.id),Et(i),i.addEventListener("load",()=>{$(this.id),Et(i)}),this._wireContentFocusForwarder(i),this._wireTabNavSync(i),we(this,n),m(f.WINDOW_RELOADED,{windowId:this.id,url:n,silent:!0})},{once:!0}),o.insertAdjacentElement("afterend",i),i.src=n}_spinReloadButton(){const t=this.element.querySelector(".os-window__btn--reload");t instanceof HTMLElement&&(t.classList.remove("os-window__btn--spinning"),t.offsetWidth,t.classList.add("os-window__btn--spinning"),t.addEventListener("animationend",()=>{t.classList.remove("os-window__btn--spinning")},{once:!0}))}renderCustomTitleBarButtons(){const t=this.element.querySelector(".os-window__custom-buttons--left"),n=this.element.querySelector(".os-window__custom-buttons--right");if(!t||!n)return;t.innerHTML="",n.innerHTML="";const{left:o,right:i}=va(this),s=(r,c)=>{for(const a of c){const d=document.createElement("os-window-button");if(go(d,a.icon),d.setAttribute("aria-label",a.label),d.setAttribute("title",a.label),d.classList.add("os-window__btn"),d.classList.add("os-window__btn--custom"),d.dataset.buttonId=a.id,r.appendChild(d),typeof a.render=="function")try{a.render(d,this)}catch(l){typeof console<"u"&&console.error("[openstation] title-bar-button render threw:",a.id,l)}else typeof a.onClick=="function"&&d.addEventListener("os-button-activate",l=>{try{a.onClick(this,l)}catch(u){typeof console<"u"&&console.error("[openstation] title-bar-button onClick threw:",a.id,u)}})}};s(t,o),s(n,i)}send(t,n){if(typeof t!="string"||t==="")return;const o=this.iframe??li(this.id);if(!o){ii(this.id,t,n);return}const i=()=>{try{o.contentWindow?.postMessage({type:"os-window-send",channel:t,payload:n},$t)}catch(s){typeof console<"u"&&console.error("[openstation] Window.send: postMessage failed",s)}};if(Zt(this.id)){i();return}si(this.id,t,n,i)}on(t,n){return typeof t!="string"||t===""||typeof n!="function"?()=>{}:ni(this.id,t,n)}markContentLoading(){De(this.id)}markContentLoaded(){$(this.id)}whenContentReady(){return Zt(this.id)?Promise.resolve():new Promise(t=>{const n=this.id,o=i=>{const s=i.detail;!s||s.windowId!==n||(document.removeEventListener("os-window-content-loaded",o),t())};document.addEventListener("os-window-content-loaded",o)})}markActivity(t,n={}){this._activityPhase=t,this._activityError=n.error??null,this._paintActivityIndicator()}_resetActivity(){this._activitySettleTimer!==null&&(window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=null),this._activityClearTimer!==null&&(window.clearTimeout(this._activityClearTimer),this._activityClearTimer=null),this._activityCount=0,this._activityPhase="idle",this._activityError=null,this._paintActivityIndicator()}_deferNavigationCommit(t,n){this._clearDeferredNavigation(),this._deferredNavigationCommit=t,this._deferredNavigationTimer=window.setTimeout(()=>{this._deferredNavigationTimer=null,this._deferredNavigationCommit=null},n)}_commitDeferredNavigation(){const t=this._deferredNavigationCommit;this._clearDeferredNavigation(),!(!t||this._isDestroyed)&&t()}_clearDeferredNavigation(){this._deferredNavigationTimer!==null&&(window.clearTimeout(this._deferredNavigationTimer),this._deferredNavigationTimer=null),this._deferredNavigationCommit=null}_noteNavigationActivity(){this._navigationActivity="pending",this._navigationActivityTimer!==null&&window.clearTimeout(this._navigationActivityTimer),this._navigationActivityTimer=window.setTimeout(()=>{this._navigationActivityTimer=null,this._navigationActivity="none",this._resetActivity()},ce.NAVIGATION_ACTIVITY_TIMEOUT_MS)}_settleNavigationActivity(t=!1){const n=this._navigationActivity!=="none";return this._navigationActivity==="pending"&&(this._navigationActivity="settled",this._navigationActivityTimer!==null&&(window.clearTimeout(this._navigationActivityTimer),this._navigationActivityTimer=null),this._resetActivity(),this._finalizeActivitySettle(!0)),t&&(this._navigationActivity="none"),n}trackActivity(t){return this._markActivityStart(),t.then(n=>(this._markActivitySettled(!0),n),n=>{const o=n instanceof Error?n.message:String(n);throw this._markActivitySettled(!1,o),n})}_markActivityStart(){this._activityCount++,this._activitySettleTimer!==null&&(window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=null),this._activityCount===1&&(this._activityPhase="saving",this._activityError=null,this._activitySavingStartedAt=Date.now(),this._paintActivityIndicator())}_markActivitySettled(t,n){if(this._activityCount>0&&this._activityCount--,this._activityCount>0){!t&&n&&(this._activityError=n);return}const o=Date.now()-this._activitySavingStartedAt,i=ce.MIN_SAVING_DISPLAY_MS-o;if(i>0){this._activitySettleTimer!==null&&window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=window.setTimeout(()=>{this._activitySettleTimer=null,this._finalizeActivitySettle(t,n)},i);return}this._finalizeActivitySettle(t,n)}_finalizeActivitySettle(t,n){this._activityPhase=t&&!this._activityError?"saved":"failed",!t&&n&&(this._activityError=n),this._paintActivityIndicator(),this._activityClearTimer!==null&&(window.clearTimeout(this._activityClearTimer),this._activityClearTimer=null),this._activityPhase==="saved"&&(this._activityClearTimer=window.setTimeout(()=>{this._activityClearTimer=null,this._activityPhase="idle",this._activityError=null,this._paintActivityIndicator()},2200))}_paintActivityIndicator(){if(this._isDestroyed)return;const t=this._activityPhase;t==="idle"?this._titleBar.removeAttribute("data-os-activity"):this._titleBar.setAttribute("data-os-activity",t);const n=this._titleBar.querySelector(".os-window__activity-status");if(n){const i=t==="failed";n.setAttribute("role",i?"alert":"status"),n.setAttribute("aria-live",i?"assertive":"polite"),n.textContent=this._activityStatusText()}this._titleBar.querySelectorAll("[data-os-activity-indicator]").forEach(i=>{i.setAttribute("phase",t),this._activityError?i.setAttribute("error",this._activityError):i.removeAttribute("error")})}_activityStatusText(){switch(this._activityPhase){case"saved":return _("Saved");case"failed":return this._activityError?se(_("Not saved. %s"),this._activityError):_("Not saved.");default:return""}}requestAttention(t,n={}){const o=tt.filter("os/window-attention-requested",{windowId:this.id,mode:t,durationMs:n.durationMs,intensity:n.intensity},n);if(!o||o.cancel===!0)return;const i=o.mode??t,s={...n,durationMs:typeof o.durationMs=="number"?o.durationMs:n.durationMs,intensity:typeof o.intensity=="string"?o.intensity:n.intensity},r=T("os.window.attention",i,{windowId:this.id,opts:s}),c=window.wp,a=c?.os?.dock,d=c?.os?.taskbar;let l=!1;if(typeof a?.setAttention=="function"&&(a.setAttention(this.id,r,s),l=!0),typeof d?.setAttention=="function"&&(d.setAttention(this.id,r,s),l=!0),!l&&r!==null){this.setHighlight("persistent");const u=s.durationMs??4e3;u>0&&window.setTimeout(()=>{this.setHighlight(null)},u)}else!l&&r===null&&this.setHighlight(null)}shake(){if(T("os.window.shake",!0,{windowId:this.id})===!1)return;const n=this.element;n.classList.remove("os-window--shaking"),n.offsetWidth,n.classList.add("os-window--shaking");const o=()=>{n.classList.remove("os-window--shaking"),n.removeEventListener("animationend",o)};n.addEventListener("animationend",o)}setHighlight(t,n){const o=this.element;o&&(o.classList.remove("wp-window--highlight-preview","wp-window--highlight-persistent"),t==="preview"?o.classList.add("wp-window--highlight-preview"):t==="persistent"&&o.classList.add("wp-window--highlight-persistent"),n?.color?o.style.setProperty("--wp-window-highlight-color",n.color):t===null&&o.style.removeProperty("--wp-window-highlight-color"),m(f.WINDOW_HIGHLIGHT_CHANGED,{windowId:this.id,mode:t,color:n?.color}))}close(){if(!this._isDestroyed){if(this.config.native&&!this._suppressCloseFilter){if(T(f.NATIVE_WINDOW_BEFORE_CLOSE,!0,{windowId:this.id,config:this.config})===!1)return}else if(!this.config.native&&!this._suppressCloseFilter&&this._iframeBridgeReady&&this.iframe){if(this._closePending)return;this._closePending=!0;try{this.iframe.contentWindow?.postMessage({type:"os-bridge-beforeunload-query"},location.origin),this._iframeCloseTimeout=setTimeout(()=>{this._isDestroyed||(this._suppressCloseFilter=!0,this._closePending=!1,this.close())},500);return}catch{this._closePending=!1}}if(this._isDestroyed=!0,this._discardSwapBuffer(),this._clearDeferredNavigation(),this._activityClearTimer!==null&&(window.clearTimeout(this._activityClearTimer),this._activityClearTimer=null),this._activitySettleTimer!==null&&(window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=null),this._navigationActivityTimer!==null&&(window.clearTimeout(this._navigationActivityTimer),this._navigationActivityTimer=null),this._titleBarButtonsUnsubscribe&&(this._titleBarButtonsUnsubscribe(),this._titleBarButtonsUnsubscribe=null),this._windowThemesUnsubscribe&&(this._windowThemesUnsubscribe(),this._windowThemesUnsubscribe=null),this._windowControlsUnsubscribe&&(this._windowControlsUnsubscribe(),this._windowControlsUnsubscribe=null),this._windowSlotsUnsubscribe&&(this._windowSlotsUnsubscribe(),this._windowSlotsUnsubscribe=null),this._windowChromesUnsubscribe&&(this._windowChromesUnsubscribe(),this._windowChromesUnsubscribe=null),this._nativeRenderCtxDispose){try{this._nativeRenderCtxDispose()}catch(t){m(f.SHELL_ERROR,{scope:"native-window-ctx-dispose",id:this.id,error:t})}this._nativeRenderCtxDispose=null}this._bodyResizeObserver?.disconnect(),this._bodyResizeObserver=null,this._tabSpeculateTimer&&(window.clearTimeout(this._tabSpeculateTimer),this._tabSpeculateTimer=null),this._tabOverflowTeardown?.(),this._tabOverflowTeardown=null,ri(this.id);try{this.config.onClose?.()}catch(t){m(f.SHELL_ERROR,{scope:"native-window-close",id:this.id,error:t})}this.onClose?.(this),this.element.classList.add("os-window--closing"),this._onCloseTransitionEnd=t=>{t.propertyName==="opacity"&&this._finalizeClose()},this.element.addEventListener("transitionend",this._onCloseTransitionEnd),this._closeSafetyNetTimer=setTimeout(()=>this._finalizeClose(),300)}}destroy(){if(!this._isFinalized){if(!this._isDestroyed){this._suppressCloseFilter=!0;try{this.close()}finally{this._suppressCloseFilter=!1}}this._finalizeClose()}}_finalizeClose(){if(!this._isFinalized){if(this._isFinalized=!0,this._closeSafetyNetTimer!==null&&(clearTimeout(this._closeSafetyNetTimer),this._closeSafetyNetTimer=null),this._iframeCloseTimeout!==null&&(clearTimeout(this._iframeCloseTimeout),this._iframeCloseTimeout=null),this._clearOpeningClassRemoval&&this._clearOpeningClassRemoval(),this._onCloseTransitionEnd&&(this.element.removeEventListener("transitionend",this._onCloseTransitionEnd),this._onCloseTransitionEnd=null),this._cancelGenieAnimation("minimize"),this._cancelGenieAnimation("restore"),this._windowControlsTeardown){try{this._windowControlsTeardown()}catch{}this._windowControlsTeardown=null}if(this._windowSlotsTeardown){try{this._windowSlotsTeardown()}catch{}this._windowSlotsTeardown=null}if(this._chromeHandle){try{this._chromeHandle.destroy()}catch{}this._chromeHandle=null}if(La(this),this._nativeRenderTeardown){try{this._nativeRenderTeardown()}catch(t){m(f.SHELL_ERROR,{scope:"native-window-teardown",id:this.id,error:t})}this._nativeRenderTeardown=null}window.removeEventListener("message",this._boundOnMessage),this._boundOnDocumentPointerDown&&document.removeEventListener("pointerdown",this._boundOnDocumentPointerDown,!0),this._unsubscribeWindowActions?.(),this._unsubscribeWindowActions=null,this.element.remove(),ne()}}installBodyResizeObserver(){const t=this.element.querySelector(".os-window__body");if(!t||typeof ResizeObserver>"u")return null;const n=new ResizeObserver(o=>{const i=o[0];if(!i)return;const s=i.contentRect,r=Math.round(s.width),c=Math.round(s.height);try{this.config.onResize?.(r,c)}catch(a){m(f.SHELL_ERROR,{scope:"native-window-resize",id:this.id,error:a})}m(f.WINDOW_BODY_RESIZED,{windowId:this.id,width:r,height:c})});return n.observe(t),n}getSnapshot(){if(this.element.offsetParent===null){const n=o=>{const i=parseFloat(o);return Number.isFinite(i)?Math.round(i):0};return{id:this.id,x:n(this.element.style.left),y:n(this.element.style.top),width:n(this.element.style.width),height:n(this.element.style.height),state:this.state}}return{id:this.id,x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight,state:this.state}}getExternalTabCount(){return Mr(this)}getExternalTabsSnapshot(){return Pr(this)}toggleActionsMenu(){zo(this)}closeActionsMenu(){K(this)}openActionsMenu(){Ho(this)}};ce.NAVIGATION_ACTIVITY_TIMEOUT_MS=3e4,ce.MIN_SAVING_DISPLAY_MS=1200;let zt=ce;const Cl=C`:host{display:inline-flex}button{display:flex;align-items:center;justify-content:center;width:30px;height:30px;padding:0;border:none;border-radius:var( --os-ui-btn-radius,5px );background-color:var( --os-ui-btn-bg,transparent );background-image:var( --os-ui-btn-bg-image,none );background-repeat:var( --os-ui-btn-bg-image-repeat,no-repeat );background-size:var( --os-ui-btn-bg-image-size,auto );background-position:var( --os-ui-btn-bg-image-position,center );color:var( --os-ui-btn-color,currentColor );cursor:pointer;transition:background-color 0.15s ease,color 0.15s ease,transform 80ms ease}button:active:not(:disabled){transform:scale( 0.9 )}@media ( prefers-reduced-motion:reduce ){button:active:not(:disabled){transform:none}}button:disabled{opacity:0.5;cursor:default}button:hover:not(:disabled){color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) )}button:focus-visible{color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );outline:2px solid var( --os-ui-btn-outline,currentColor );outline-offset:1px}:host( [ active ] ) button{color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-active,var( --os-ui-hover,rgba( 0,0,0,0.08 ) ) )}:host( [ danger ] ) button:hover{color:var( --os-ui-fg-on-accent,#fff );background-color:var( --os-ui-btn-danger-hover,var( --os-ui-danger,#d63638 ) )}svg{display:block;pointer-events:none;flex-shrink:0}svg:empty{display:none}.themed-icon{display:block;width:14px;height:14px;flex-shrink:0;pointer-events:none;background-color:var( --os-ui-btn-icon-color,currentColor )}::slotted( span ){line-height:1}::slotted( svg ){display:block}`,kl={minimize:'<path d="M3 6h6" stroke="currentColor" stroke-width="1.25" stroke-linecap="round"/>',maximize:'<rect x="3" y="3" width="6" height="6" rx="1" stroke="currentColor" stroke-width="1.25" fill="none"/>',fullscreen:'<path d="M4.5 2H2v2.5M10 4.5V2H7.5M4.5 10H2V7.5M10 7.5V10H7.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',"fullscreen-exit":'<path d="M2 4.5H4.5V2M7.5 2V4.5H10M2 7.5H4.5V10M7.5 10V7.5H10" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',detach:'<path d="M5 2H2.5v7.5H10V7M6.5 2H10v3.5M10 2L5.5 6.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',reload:'<g transform="translate(0.6 0.6) scale(0.021)" fill="currentColor"><path d="m504.554 233.704-76.447 91.467c-6.329 7.572-15.417 11.479-24.571 11.479a31.872 31.872 0 0 1-20.504-7.447l-91.467-76.447c-13.561-11.334-15.366-31.515-4.032-45.075s31.515-15.366 45.075-4.032l37.506 31.347c-10.274-74.891-74.668-132.774-152.337-132.774C132.984 102.223 64 171.207 64 256s68.984 153.777 153.777 153.777c17.673 0 32 14.327 32 32s-14.327 32-32 32c-58.17 0-112.859-22.653-153.991-63.785C22.653 368.859 0 314.17 0 256s22.653-112.859 63.786-153.992c41.132-41.132 95.821-63.785 153.991-63.785s112.859 22.653 153.992 63.785c32.517 32.516 53.471 73.508 60.829 117.991l22.849-27.339c11.334-13.56 31.515-15.364 45.075-4.032 13.56 11.335 15.365 31.516 4.032 45.076z"/></g>',close:'<path d="M3.25 3.25l5.5 5.5M3.25 8.75l5.5-5.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round"/>',menu:'<circle cx="3" cy="6" r="1.2" fill="currentColor"/><circle cx="6" cy="6" r="1.2" fill="currentColor"/><circle cx="9" cy="6" r="1.2" fill="currentColor"/>'};function Tl(e){const t=(e??"").trim();return t===""||t.length>4096||!/^(https?:\/\/|data:image\/)/i.test(t)||/['"()\\<>\s]/.test(t)?"":t}const Ae=class Ae extends z{constructor(){super(...arguments),this._activateWired=!1}static get observedAttributes(){return[...super.observedAttributes,"aria-label","aria-pressed"]}render(){const t=Tl(this["icon-src"]||this.getAttribute("icon-src")||""),n=t?"":this.icon||"",o=kl[n]||"",i=this.getAttribute("aria-label")||"";return t?y`
7 + <button type="button" aria-label="${i}" aria-pressed="${this.getAttribute("aria-pressed")||""}" ?disabled="${this.hasAttribute("disabled")}">
3 8 <span
4 9 class="themed-icon"
5 10 aria-hidden="true"
6 11 style="-webkit-mask: url('${t}') center / contain no-repeat; mask: url('${t}') center / contain no-repeat;"
@@ -6,10 +11,10 @@
6 11 style="-webkit-mask: url('${t}') center / contain no-repeat; mask: url('${t}') center / contain no-repeat;"
7 12 ></span>
8 13 <slot></slot>
9 14 </button>
10 - `:S`
11 - <button type="button" aria-label="${s}">
15 + `:y`
16 + <button type="button" aria-label="${i}" aria-pressed="${this.getAttribute("aria-pressed")||""}" ?disabled="${this.hasAttribute("disabled")}">
12 17 <svg
13 18 width="14"
14 19 height="14"
15 20 viewBox="0 0 12 12"
@@ -18,18 +23,18 @@
18 23 ></svg>
19 24 <slot></slot>
20 25 </button>
21 26 <span data-svg-buffer style="display:none">${o}</span>
22 - `}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg()),queueMicrotask(()=>this._wireActivateEvent())}attributeChangedCallback(t,n,o){super.attributeChangedCallback(t,n,o),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const t=this.shadowRoot;if(!t)return;const n=t.querySelector("svg"),o=t.querySelector("[data-svg-buffer]");if(n&&o){const s=o.textContent||"";n.innerHTML!==s&&(n.innerHTML=s)}}_wireActivateEvent(){if(this._activateWired)return;const t=this.shadowRoot;if(!t)return;const n=t.querySelector("button");n&&(this._activateWired=!0,n.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("os-button-activate",{bubbles:!0,composed:!0,cancelable:!0}))}))}};de.props=["icon","icon-src","active","danger"],de.styles=[xa],de.help=void 0;let St=de;Z("os-window-button",St);const Ta=k`:host{display:inline-flex;align-items:center;gap:6px;font-size:var( --os-ui-save-status-font-size,11px );line-height:1;color:var( --os-ui-save-status-fg,currentColor );vertical-align:middle;min-width:0;opacity:1;pointer-events:auto}.os-save-status__indicator{display:inline-flex;align-items:center;justify-content:center;width:var( --os-ui-save-status-size,12px );height:var( --os-ui-save-status-size,12px );border-radius:50%;flex-shrink:0;box-sizing:border-box;background:var( --os-ui-save-status-bg,transparent );border:2px solid var( --os-ui-save-status-idle-color,color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 55%,transparent ) );color:var( --wp-admin-theme-color,#2271b1 );transition:background-color 0.2s ease,border-color 0.2s ease,box-shadow 0.2s ease}:host( [ phase='pending' ] ) .os-save-status__indicator,:host( [ phase='saving' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-bg,var( --wp-admin-theme-color,#2271b1 ) );border-color:transparent;color:var( --wp-admin-theme-color,#2271b1 );animation:os-save-status-pulse 1.2s ease-in-out infinite}:host( [ animation='modem' ][ phase='pending' ] ) .os-save-status__indicator,:host( [ animation='modem' ][ phase='saving' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-bg,var( --wp-admin-theme-color,#2271b1 ) );border-color:transparent;color:var( --wp-admin-theme-color,#2271b1 );animation:os-save-status-modem-stutter 1.8s ease-in-out infinite,os-save-status-modem-glow 2.4s ease-in-out infinite}@keyframes os-save-status-modem-stutter{0%,4%{opacity:1}5%,30%{opacity:0.22}31%,36%{opacity:1}37%,39%{opacity:0.22}40%,44%{opacity:1}45%,67%{opacity:0.22}68%,76%{opacity:1}77%,100%{opacity:0.22}}@keyframes os-save-status-modem-glow{0%,12%{box-shadow:0 0 0 0 transparent}13%,22%{box-shadow:0 0 4px 0 currentColor}23%,50%{box-shadow:0 0 0 0 transparent}51%,58%{box-shadow:0 0 4px 0 currentColor}59%,84%{box-shadow:0 0 0 0 transparent}85%,94%{box-shadow:0 0 5px 0 currentColor}95%,100%{box-shadow:0 0 0 0 transparent}}@media ( prefers-reduced-motion:reduce ){:host( [ phase='pending' ] ) .os-save-status__indicator,:host( [ phase='saving' ] ) .os-save-status__indicator,:host( [ animation='modem' ][ phase='pending' ] ) .os-save-status__indicator,:host( [ animation='modem' ][ phase='saving' ] ) .os-save-status__indicator{animation:none;opacity:0.85}}:host( [ phase='saved' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-saved-bg,var( --os-ui-success-fg,#1d6f42 ) );border-color:transparent;color:var( --os-ui-save-status-saved-bg,var( --os-ui-success-fg,#1d6f42 ) )}:host( [ phase='failed' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) );border-color:transparent;color:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) );animation:os-save-status-pulse 0.8s ease-in-out 2}:host( [ variant='ring' ] ) .os-save-status__indicator{background:transparent}:host( [ variant='ring' ][ phase='pending' ] ) .os-save-status__indicator,:host( [ variant='ring' ][ phase='saving' ] ) .os-save-status__indicator{background:transparent;border-color:var( --os-ui-save-status-ring-color,var( --os-ui-save-status-bg,var( --wp-admin-theme-color,#2271b1 ) ) );animation:os-save-status-ring-pulse 1.6s var( --os-ui-ease-loop,ease-in-out ) infinite}:host( [ variant='ring' ][ phase='failed' ] ) .os-save-status__indicator{background:transparent;border-color:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) );animation:os-save-status-ring-alert 0.62s var( --os-ui-ease-out,ease-out ) 1}:host( [ variant='ring' ][ phase='failed' ] ) .os-save-status__glyph{color:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) )}:host( [ variant='ring' ][ phase='saved' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-saved-bg,var( --wp-admin-theme-color,#2271b1 ) );border-color:transparent;animation:os-save-status-ring-land 0.42s var( --os-ui-ease-out,ease-out ) 1}:host( [ variant='ring' ][ phase='saved' ] ) .os-save-status__glyph,:host( [ variant='ring' ][ phase='failed' ] ) .os-save-status__glyph{animation:os-save-status-glyph-in 0.24s var( --os-ui-ease-out,ease-out ) 0.08s 1 backwards}@keyframes os-save-status-ring-pulse{0%,100%{opacity:0.45;scale:0.9}50%{opacity:1;scale:1}}@keyframes os-save-status-ring-land{0%{scale:0.82}55%{scale:1.06}100%{scale:1}}@keyframes os-save-status-ring-alert{0%{scale:0.9}25%{scale:1.08}50%{scale:0.98}75%{scale:1.04}100%{scale:1}}@keyframes os-save-status-glyph-in{0%{opacity:0;scale:0.4}100%{opacity:1;scale:1}}@media ( prefers-reduced-motion:reduce ){:host( [ variant='ring' ] ) .os-save-status__indicator,:host( [ variant='ring' ] ) .os-save-status__glyph{animation:none;opacity:1;scale:1}}@keyframes os-save-status-pulse{0%,100%{opacity:0.55;transform:scale( 0.9 )}50%{opacity:1;transform:scale( 1 )}}:host( [ mode='pill' ] ) .os-save-status{display:inline-flex;align-items:center;gap:6px;padding:2px 10px;border-radius:999px;background:var( --os-ui-save-status-pill-bg,transparent );font-weight:500;white-space:nowrap}:host( [ mode='pill' ][ phase='saving' ] ) .os-save-status,:host( [ mode='pill' ][ phase='pending' ] ) .os-save-status{background:var( --os-ui-save-status-pill-bg,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) );color:var( --os-ui-save-status-pill-fg,var( --os-ui-fg-muted,#50575e ) )}:host( [ mode='pill' ][ phase='saved' ] ) .os-save-status{background:var( --os-ui-save-status-pill-bg,rgba( 30,132,73,0.12 ) );color:var( --os-ui-save-status-pill-fg,var( --os-ui-success-fg,#1d6f42 ) )}:host( [ mode='pill' ][ phase='failed' ] ) .os-save-status{background:var( --os-ui-save-status-pill-bg,rgba( 214,54,56,0.12 ) );color:var( --os-ui-save-status-pill-fg,var( --os-ui-danger-hover,#a02622 ) )}.os-save-status__label{min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host( [ phase='saved' ] ) .os-save-status__glyph,:host( [ phase='failed' ] ) .os-save-status__glyph{display:inline-block;color:var( --os-ui-fg-on-accent,#fff );width:calc( var( --os-ui-save-status-size,12px ) * 0.66 );height:calc( var( --os-ui-save-status-size,12px ) * 0.66 )}.os-save-status__glyph{display:none}.os-save-status__glyph svg{display:block;width:100%;height:100%}`,yo="os-settings-save-lifecycle",Ra=2200,Na=6e3,ue=class ue extends B{constructor(){super(...arguments),this._autoTimer=null,this._docListener=null}connectedCallback(){super.connectedCallback(),this.auto!==null&&this._installAutoListener()}disconnectedCallback(){this._removeAutoListener(),this._autoTimer!==null&&(window.clearTimeout(this._autoTimer),this._autoTimer=null)}attributeChangedCallback(t,n,o){if(super.attributeChangedCallback(t,n,o),(t==="auto"||t==="event")&&(this._removeAutoListener(),this.auto!==null&&this._installAutoListener()),t==="phase"){this._scheduleAutoClear();const s={phase:this.phase??"idle",error:this.error??void 0};this.emit("os-save-status-change",s)}}render(){const t=this.phase??"idle",n=this.mode??"dot",s=(this.error??"")||this._labelForPhase(t);return s?this.setAttribute("title",s):this.removeAttribute("title"),this.setAttribute("aria-live",t==="failed"?"assertive":"polite"),this.setAttribute("role",t==="failed"?"alert":"status"),S`
27 + `}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg()),queueMicrotask(()=>this._wireActivateEvent())}attributeChangedCallback(t,n,o){super.attributeChangedCallback(t,n,o),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const t=this.shadowRoot;if(!t)return;const n=t.querySelector("svg"),o=t.querySelector("[data-svg-buffer]");if(n&&o){const i=o.textContent||"";n.innerHTML!==i&&(n.innerHTML=i)}}_wireActivateEvent(){if(this._activateWired)return;const t=this.shadowRoot;if(!t)return;const n=t.querySelector("button");n&&(this._activateWired=!0,n.addEventListener("click",()=>{this.hasAttribute("disabled")||this.dispatchEvent(new CustomEvent("os-button-activate",{bubbles:!0,composed:!0,cancelable:!0}))}))}};Ae.props=["icon","icon-src","active","danger","disabled"],Ae.styles=[Cl],Ae.help=void 0;let Ht=Ae;X("os-window-button",Ht);const Il=C`:host{display:inline-flex;align-items:center;gap:6px;font-size:var( --os-ui-save-status-font-size,11px );line-height:1;color:var( --os-ui-save-status-fg,currentColor );vertical-align:middle;min-width:0;opacity:1;pointer-events:auto}.os-save-status__indicator{display:inline-flex;align-items:center;justify-content:center;width:var( --os-ui-save-status-size,12px );height:var( --os-ui-save-status-size,12px );border-radius:50%;flex-shrink:0;box-sizing:border-box;background:var( --os-ui-save-status-bg,transparent );border:2px solid var( --os-ui-save-status-idle-color,color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 55%,transparent ) );color:var( --wp-admin-theme-color,#2271b1 );transition:background-color 0.2s ease,border-color 0.2s ease,box-shadow 0.2s ease}:host( [ phase='pending' ] ) .os-save-status__indicator,:host( [ phase='saving' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-bg,var( --wp-admin-theme-color,#2271b1 ) );border-color:transparent;color:var( --wp-admin-theme-color,#2271b1 );animation:os-save-status-pulse 1.2s ease-in-out infinite}:host( [ animation='modem' ][ phase='pending' ] ) .os-save-status__indicator,:host( [ animation='modem' ][ phase='saving' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-bg,var( --wp-admin-theme-color,#2271b1 ) );border-color:transparent;color:var( --wp-admin-theme-color,#2271b1 );animation:os-save-status-modem-stutter 1.8s ease-in-out infinite,os-save-status-modem-glow 2.4s ease-in-out infinite}@keyframes os-save-status-modem-stutter{0%,4%{opacity:1}5%,30%{opacity:0.22}31%,36%{opacity:1}37%,39%{opacity:0.22}40%,44%{opacity:1}45%,67%{opacity:0.22}68%,76%{opacity:1}77%,100%{opacity:0.22}}@keyframes os-save-status-modem-glow{0%,12%{box-shadow:0 0 0 0 transparent}13%,22%{box-shadow:0 0 4px 0 currentColor}23%,50%{box-shadow:0 0 0 0 transparent}51%,58%{box-shadow:0 0 4px 0 currentColor}59%,84%{box-shadow:0 0 0 0 transparent}85%,94%{box-shadow:0 0 5px 0 currentColor}95%,100%{box-shadow:0 0 0 0 transparent}}@media ( prefers-reduced-motion:reduce ){:host( [ phase='pending' ] ) .os-save-status__indicator,:host( [ phase='saving' ] ) .os-save-status__indicator,:host( [ animation='modem' ][ phase='pending' ] ) .os-save-status__indicator,:host( [ animation='modem' ][ phase='saving' ] ) .os-save-status__indicator{animation:none;opacity:0.85}}:host( [ phase='saved' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-saved-bg,var( --os-ui-success-fg,#1d6f42 ) );border-color:transparent;color:var( --os-ui-save-status-saved-bg,var( --os-ui-success-fg,#1d6f42 ) )}:host( [ phase='failed' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) );border-color:transparent;color:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) );animation:os-save-status-pulse 0.8s ease-in-out 2}:host( [ variant='ring' ] ) .os-save-status__indicator{background:transparent}:host( [ variant='ring' ][ phase='pending' ] ) .os-save-status__indicator,:host( [ variant='ring' ][ phase='saving' ] ) .os-save-status__indicator{background:transparent;border-color:var( --os-ui-save-status-ring-color,var( --os-ui-save-status-bg,var( --wp-admin-theme-color,#2271b1 ) ) );animation:os-save-status-ring-pulse 1.6s var( --os-ui-ease-loop,ease-in-out ) infinite}:host( [ variant='ring' ][ phase='failed' ] ) .os-save-status__indicator{background:transparent;border-color:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) );animation:os-save-status-ring-alert 0.62s var( --os-ui-ease-out,ease-out ) 1}:host( [ variant='ring' ][ phase='failed' ] ) .os-save-status__glyph{color:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) )}:host( [ variant='ring' ][ phase='saved' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-saved-bg,var( --wp-admin-theme-color,#2271b1 ) );border-color:transparent;animation:os-save-status-ring-land 0.42s var( --os-ui-ease-out,ease-out ) 1}:host( [ variant='ring' ][ phase='saved' ] ) .os-save-status__glyph,:host( [ variant='ring' ][ phase='failed' ] ) .os-save-status__glyph{animation:os-save-status-glyph-in 0.24s var( --os-ui-ease-out,ease-out ) 0.08s 1 backwards}@keyframes os-save-status-ring-pulse{0%,100%{opacity:0.45;scale:0.9}50%{opacity:1;scale:1}}@keyframes os-save-status-ring-land{0%{scale:0.82}55%{scale:1.06}100%{scale:1}}@keyframes os-save-status-ring-alert{0%{scale:0.9}25%{scale:1.08}50%{scale:0.98}75%{scale:1.04}100%{scale:1}}@keyframes os-save-status-glyph-in{0%{opacity:0;scale:0.4}100%{opacity:1;scale:1}}@media ( prefers-reduced-motion:reduce ){:host( [ variant='ring' ] ) .os-save-status__indicator,:host( [ variant='ring' ] ) .os-save-status__glyph{animation:none;opacity:1;scale:1}}@keyframes os-save-status-pulse{0%,100%{opacity:0.55;transform:scale( 0.9 )}50%{opacity:1;transform:scale( 1 )}}:host( [ mode='pill' ] ) .os-save-status{display:inline-flex;align-items:center;gap:6px;padding:2px 10px;border-radius:999px;background:var( --os-ui-save-status-pill-bg,transparent );font-weight:500;white-space:nowrap}:host( [ mode='pill' ][ phase='saving' ] ) .os-save-status,:host( [ mode='pill' ][ phase='pending' ] ) .os-save-status{background:var( --os-ui-save-status-pill-bg,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) );color:var( --os-ui-save-status-pill-fg,var( --os-ui-fg-muted,#50575e ) )}:host( [ mode='pill' ][ phase='saved' ] ) .os-save-status{background:var( --os-ui-save-status-pill-bg,rgba( 30,132,73,0.12 ) );color:var( --os-ui-save-status-pill-fg,var( --os-ui-success-fg,#1d6f42 ) )}:host( [ mode='pill' ][ phase='failed' ] ) .os-save-status{background:var( --os-ui-save-status-pill-bg,rgba( 214,54,56,0.12 ) );color:var( --os-ui-save-status-pill-fg,var( --os-ui-danger-hover,#a02622 ) )}.os-save-status__label{min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host( [ phase='saved' ] ) .os-save-status__glyph,:host( [ phase='failed' ] ) .os-save-status__glyph{display:inline-block;color:var( --os-ui-fg-on-accent,#fff );width:calc( var( --os-ui-save-status-size,12px ) * 0.66 );height:calc( var( --os-ui-save-status-size,12px ) * 0.66 )}.os-save-status__glyph{display:none}.os-save-status__glyph svg{display:block;width:100%;height:100%}`,qo="os-settings-save-lifecycle",Ll=2200,Nl=6e3,Se=class Se extends z{constructor(){super(...arguments),this._autoTimer=null,this._docListener=null}connectedCallback(){super.connectedCallback(),this.auto!==null&&this._installAutoListener()}disconnectedCallback(){this._removeAutoListener(),this._autoTimer!==null&&(window.clearTimeout(this._autoTimer),this._autoTimer=null)}attributeChangedCallback(t,n,o){if(super.attributeChangedCallback(t,n,o),(t==="auto"||t==="event")&&(this._removeAutoListener(),this.auto!==null&&this._installAutoListener()),t==="phase"){this._scheduleAutoClear();const i={phase:this.phase??"idle",error:this.error??void 0};this.emit("os-save-status-change",i)}}render(){const t=this.phase??"idle",n=this.mode??"dot",i=(this.error??"")||this._labelForPhase(t);return i?this.setAttribute("title",i):this.removeAttribute("title"),this.setAttribute("aria-live",t==="failed"?"assertive":"polite"),this.setAttribute("role",t==="failed"?"alert":"status"),y`
23 28 <span class="os-save-status">
24 29 <span class="os-save-status__indicator" aria-hidden="true">
25 30 <span class="os-save-status__glyph">${this._renderGlyph(t)}</span>
26 31 </span>
27 - ${n==="pill"?S`<span class="os-save-status__label"
32 + ${n==="pill"?y`<span class="os-save-status__label"
28 33 >${this._labelForPhase(t)}</span
29 - >`:S``}
34 + >`:y``}
30 35 </span>
31 - `}_renderGlyph(t){return t==="saved"?Oa():t==="failed"?Da():""}_labelForPhase(t){switch(t){case"pending":case"saving":return this["saving-label"]??"Saving…";case"saved":return this["saved-label"]??"Saved";case"failed":return(this.error??"")||"Couldn’t save";default:return this["idle-label"]??""}}_installAutoListener(){const t=this.event||yo;this._docListener=n=>{const o=n.detail;!o||typeof o.phase!="string"||(this.phase=o.phase,o.error?this.error=o.error:o.phase!=="failed"&&this.error&&this.removeAttribute("error"))},document.addEventListener(t,this._docListener)}_removeAutoListener(){if(!this._docListener)return;const t=this.event||yo;document.removeEventListener(t,this._docListener),this._docListener=null}_scheduleAutoClear(){this._autoTimer!==null&&(window.clearTimeout(this._autoTimer),this._autoTimer=null);const t=this.phase??"idle",n=this._autoClearMsFor(t);n<=0||(this._autoTimer=window.setTimeout(()=>{this._autoTimer=null,this.phase="idle"},n))}_autoClearMsFor(t){if(t==="saved"){const n=this["auto-clear-saved-ms"];return parseInt(n||"",10)||Ra}if(t==="failed"){const n=this["auto-clear-failed-ms"];return parseInt(n||"",10)||Na}return 0}};ue.props=["phase","mode","variant","animation","auto","event","error","saving-label","saved-label","idle-label","auto-clear-saved-ms","auto-clear-failed-ms"],ue.styles=[Ta],ue.help=void 0;let Ct=ue;Z("os-save-status",Ct);function Oa(){return S`
36 + `}_renderGlyph(t){return t==="saved"?Rl():t==="failed"?Ol():""}_labelForPhase(t){switch(t){case"pending":case"saving":return this["saving-label"]??"Saving…";case"saved":return this["saved-label"]??"Saved";case"failed":return(this.error??"")||"Couldn’t save";default:return this["idle-label"]??""}}_installAutoListener(){const t=this.event||qo;this._docListener=n=>{const o=n.detail;!o||typeof o.phase!="string"||(this.phase=o.phase,o.error?this.error=o.error:o.phase!=="failed"&&this.error&&this.removeAttribute("error"))},document.addEventListener(t,this._docListener)}_removeAutoListener(){if(!this._docListener)return;const t=this.event||qo;document.removeEventListener(t,this._docListener),this._docListener=null}_scheduleAutoClear(){this._autoTimer!==null&&(window.clearTimeout(this._autoTimer),this._autoTimer=null);const t=this.phase??"idle",n=this._autoClearMsFor(t);n<=0||(this._autoTimer=window.setTimeout(()=>{this._autoTimer=null,this.phase="idle"},n))}_autoClearMsFor(t){if(t==="saved"){const n=this["auto-clear-saved-ms"];return parseInt(n||"",10)||Ll}if(t==="failed"){const n=this["auto-clear-failed-ms"];return parseInt(n||"",10)||Nl}return 0}};Se.props=["phase","mode","variant","animation","auto","event","error","saving-label","saved-label","idle-label","auto-clear-saved-ms","auto-clear-failed-ms"],Se.styles=[Il],Se.help=void 0;let Ft=Se;X("os-save-status",Ft);function Rl(){return y`
32 37 <svg
33 38 viewBox="0 0 12 12"
34 39 aria-hidden="true"
35 40 focusable="false"
@@ -40,9 +45,9 @@
40 45 stroke-linejoin="round"
41 46 >
42 47 <path d="M2.5 6 L5 8.5 L9.5 4" />
43 48 </svg>
44 - `}function Da(){return S`
49 + `}function Ol(){return y`
45 50 <svg
46 51 viewBox="0 0 12 12"
47 52 aria-hidden="true"
48 53 focusable="false"
@@ -51,10 +56,10 @@
51 56 <path
52 57 d="M5 2 H7 V7 H5 z M5 8.5 H7 V10.5 H5 z"
53 58 />
54 59 </svg>
55 - `}const Wa=k`: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}}`,vo=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}}),R=61.26,N=61.26,Eo=58.453,Ma='<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"/>',he=class he extends B{constructor(){super(...arguments),this._paintScheduled=!1}connectedCallback(){super.connectedCallback(),this._schedulePaint()}render(){return S`<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 t=this.shadowRoot?.querySelector(".root");t&&(t.innerHTML=this._buildSvg())}_syncCssVars(){const t=(n,o,s)=>{const i=this.getAttribute(n);i===null?this.style.removeProperty(o):this.style.setProperty(o,s?s(i):i)};t("color","--os-ui-spinner-color"),t("accent","--os-ui-spinner-accent"),t("size","--os-ui-spinner-size",n=>/^-?\d+(\.\d+)?$/.test(n.trim())?`${n}px`:n)}_effectiveConfig(){const t=this.getAttribute("preset")??"classic",n=vo[t]??vo.classic,o=(r,d)=>{const a=this.getAttribute(r);if(a===null)return d;const l=parseFloat(a);return Number.isFinite(l)?l:d},s=(r,d)=>{const a=this.getAttribute(r);if(a===null)return d;const l=a.toLowerCase();return l==="-1"||l==="ccw"||l==="reverse"?-1:1},i=()=>{const r=this.getAttribute("pulse");return r==="scale"||r==="opacity"||r==="both"||r==="none"?r:n.pulse};return{sp1:o("sp1",n.sp1),sp2:o("sp2",n.sp2),sp3:o("sp3",n.sp3),a1:o("a1",n.a1),a2:o("a2",n.a2),a3:o("a3",n.a3),gap:o("gap",n.gap),dir2:s("dir2",n.dir2),dir3:s("dir3",n.dir3),pulse:i(),dots:Math.max(0,Math.floor(o("dots",n.dots)))}}_buildInlineSvg(t){const n=Ao(this.getAttribute("label")??"Loading"),o=9,s=(t.sp1/10).toFixed(2);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-label="${n}"><circle cx="12" cy="12" r="${o}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-opacity="0.22"/><circle cx="12" cy="12" r="${o}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-dasharray="${Me(o,t.a1)}" style="transform-origin:12px 12px;animation: os-spinner-spin ${s}s linear infinite"/></svg>`}_buildSvg(){const t=this._effectiveConfig();if(this.getAttribute("preset")==="inline")return this._buildInlineSvg(t);const n=Ao(this.getAttribute("label")??"Loading"),o=t.gap*3+14,s=-o,i=122.52+o*2,r=Eo+t.gap+2,d=r+t.gap+2,a=d+t.gap+1.5,l=`animation: os-spinner-spin ${(t.sp1/10).toFixed(2)}s linear infinite`,c=`animation: os-spinner-spin ${(t.sp2/10).toFixed(2)}s linear infinite${t.dir2<0?" reverse":""}`,u=`animation: os-spinner-spin ${(t.sp3/10).toFixed(2)}s linear infinite${t.dir3<0?" reverse":""}`,g=(t.sp1*1.8/10).toFixed(1),b=(t.sp1*2.3/10).toFixed(1);let _="";t.pulse==="scale"?_=`animation: os-spinner-scale ${g}s ease-in-out infinite`:t.pulse==="opacity"?_=`animation: os-spinner-opacity ${b}s ease-in-out infinite`:t.pulse==="both"&&(_=`animation: os-spinner-scale ${g}s ease-in-out infinite, os-spinner-opacity ${b}s ease-in-out infinite`);let C="";if(t.dots>0){const w=a+t.gap+1,E=2*Math.PI*w,y=1.6,v=(t.sp1*.65/10).toFixed(2);for(let A=0;A<t.dots;A++){const x=-(A/t.dots)*E;C+=`<circle cx="${R}" cy="${N}" r="${w.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="${y}" stroke-dasharray="${y.toFixed(2)} ${(E-y).toFixed(2)}" stroke-dashoffset="${x.toFixed(2)}" stroke-linecap="round" stroke-opacity="0.65" style="transform-origin:${R}px ${N}px;animation: os-spinner-spin ${v}s linear infinite"/>`}}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${s} ${s} ${i} ${i}" role="img" aria-label="${n}"><g style="transform-origin:${R}px ${N}px${_?";"+_:""}"><circle cx="${R}" cy="${N}" r="${Eo}" fill="currentColor"/><g class="mark">${Ma}</g></g><circle cx="${R}" cy="${N}" r="${r.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.6" stroke-opacity="0.2"/><circle cx="${R}" cy="${N}" r="${r.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="2.2" stroke-dasharray="${Me(r,t.a1)}" stroke-linecap="round" style="transform-origin:${R}px ${N}px;${l}"/><circle cx="${R}" cy="${N}" r="${d.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.5" stroke-opacity="0.15"/><circle cx="${R}" cy="${N}" r="${d.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.6" stroke-opacity="0.8" stroke-dasharray="${Me(d,t.a2)}" stroke-linecap="round" style="transform-origin:${R}px ${N}px;${c}"/><circle cx="${R}" cy="${N}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.4" stroke-opacity="0.12"/><circle cx="${R}" cy="${N}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.0" stroke-opacity="0.6" stroke-dasharray="${Me(a,t.a3)}" stroke-linecap="round" style="transform-origin:${R}px ${N}px;${u}"/>`+C+"</svg>"}};he.props=["preset","size","color","accent","sp1","sp2","sp3","a1","a2","a3","gap","dir2","dir3","pulse","dots","label"],he.styles=[Wa],he.help=void 0;let kt=he;function Me(e,t){const n=2*Math.PI*e,o=t/100*n,s=n-o;return`${o.toFixed(2)} ${s.toFixed(2)}`}function Ao(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}Z("os-spinner",kt);const Pe=k`:host{--_holo-fill:var( --os-ui-holo-fill,${"linear-gradient( 124deg, #afa2e8 0%, #f5a8ea 46%, #8ee9f7 100% )"} );--_holo-ink:var( --os-ui-holo-ink,#0c0b0f );--_holo-sheen:var( --os-ui-holo-sheen,linear-gradient( 124deg,rgba( 159,214,255,0.1 ) 0%,rgba( 236,155,255,0.12 ) 34%,rgba( 242,82,252,0.1 ) 58%,rgba( 147,240,198,0.09 ) 100% ) );--_holo-edge:var( --os-ui-holo-edge,linear-gradient( 124deg,rgba( 154,242,255,0.7 ) 0%,rgba( 236,155,255,0.85 ) 38%,rgba( 242,82,252,0.7 ) 62%,rgba( 159,152,255,0.6 ) 100% ) );--_holo-edge-quiet:var( --os-ui-holo-edge-quiet,linear-gradient( 124deg,rgba( 154,242,255,0.22 ) 0%,rgba( 236,155,255,0.28 ) 38%,rgba( 242,82,252,0.22 ) 62%,rgba( 159,152,255,0.2 ) 100% ) );--_holo-glow:var( --os-ui-holo-glow,0 0 0 1px rgba( 242,82,252,0.28 ),0 2px 10px rgba( 242,82,252,0.22 ) );--_holo-glow-strong:var( --os-ui-holo-glow-strong,0 0 0 1px rgba( 242,82,252,0.42 ),0 4px 18px rgba( 242,82,252,0.38 ),0 1px 3px rgba( 12,11,15,0.6 ) );--_holo-track:var( --os-ui-holo-track,rgba( 255,251,255,0.16 ) );--_holo-track-edge:var( --os-ui-holo-track-edge,#8c8f94 );--_holo-ring-color:var( --os-ui-accent-dim,#2271b1 );--_holo-focus:var( --os-ui-focus-ring,0 0 0 2px rgba( 12,11,15,0.9 ),0 0 0 4px #f252fc,0 0 12px 2px rgba( 242,82,252,0.45 ) );--_holo-focus-field:var( --os-ui-focus-ring-field,0 0 0 1px #f252fc,0 0 0 4px rgba( 242,82,252,0.18 ) );--_holo-t:var( --os-ui-holo-transition,220ms );--_holo-t-fast:var( --os-ui-motion-fast,140ms );--_holo-t-slow:var( --os-ui-motion-slow,340ms );--_holo-t-ambient:var( --os-ui-motion-ambient,12s );--_holo-spring:var( --os-ui-ease-spring,cubic-bezier( 0.32,1.5,0.55,1 ) );--_holo-ease:var( --os-ui-ease-out,cubic-bezier( 0.22,0.9,0.28,1 ) );--_holo-loop:var( --os-ui-ease-loop,cubic-bezier( 0.45,0,0.55,1 ) )}`,Pa=k` .os-holo-fill{background-color:transparent;background-image:var( --_holo-fill );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;color:var( --_holo-ink );transition:background-position var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,filter var( --_holo-t ) ease}.os-holo-fill:hover{background-position:74% 66%}.os-holo-fill:active{background-position:88% 82%;filter:brightness( 0.94 )}@media ( prefers-reduced-motion:reduce ){.os-holo-fill{transition-duration:1ms}.os-holo-fill:hover,.os-holo-fill:active{background-position:22% 28%}}`,$a=k` .os-holo-sheen{position:relative;isolation:isolate}.os-holo-sheen::before{content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;background-image:var( --_holo-sheen );background-size:200% 200%;background-position:20% 30%;opacity:0;pointer-events:none;transition:opacity var( --_holo-t ) ease,background-position var( --_holo-t ) ease}.os-holo-sheen:hover::before,.os-holo-sheen:focus-visible::before{opacity:1;background-position:76% 68%}@media ( prefers-reduced-motion:reduce ){.os-holo-sheen::before{transition-duration:1ms}.os-holo-sheen:hover::before,.os-holo-sheen:focus-visible::before{background-position:20% 30%}}`,Ha=k` .os-holo-edge{position:relative}.os-holo-edge::after{content:'';position:absolute;inset:0;border-radius:inherit;padding:1px;background-image:var( --_holo-edge-quiet );opacity:0;pointer-events:none;-webkit-mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );mask-composite:exclude;transition:opacity var( --_holo-t ) ease}.os-holo-edge:hover::after,.os-holo-edge:focus-visible::after{background-image:var( --_holo-edge );opacity:1}.os-holo-edge.is-lit::after{background-image:var( --_holo-edge );opacity:1}@media ( prefers-reduced-motion:reduce ){.os-holo-edge::after{transition-duration:1ms}}`,za=k` .os-holo-glint{position:absolute;inset:0;border-radius:inherit;overflow:hidden;pointer-events:none}.os-holo-glint::before{content:'';position:absolute;top:-60%;bottom:-60%;width:45%;inset-inline-start:-60%;background:linear-gradient( 90deg,transparent 0%,rgba( 255,251,255,0.14 ) 45%,rgba( 255,251,255,0.22 ) 50%,rgba( 255,251,255,0.14 ) 55%,transparent 100% );transform:rotate( 18deg ) translateX( 0 );opacity:0}:hover>.os-holo-glint::before,:focus-visible>.os-holo-glint::before,:host(:hover )>.os-holo-glint::before,:host(:focus-visible )>.os-holo-glint::before{animation:os-holo-glint var( --_holo-t-slow ) var( --_holo-ease )}@keyframes os-holo-glint{0%{opacity:0;transform:rotate( 18deg ) translateX( 0 )}15%{opacity:1}85%{opacity:1}100%{opacity:0;transform:rotate( 18deg ) translateX( 240vw )}}@media ( prefers-reduced-motion:reduce ){:hover>.os-holo-glint::before,:focus-visible>.os-holo-glint::before,:host(:hover )>.os-holo-glint::before,:host(:focus-visible )>.os-holo-glint::before{animation:none}}`,Fa=k` .os-holo-ring{position:absolute;inset:0;border-radius:inherit;box-shadow:0 0 0 0 var( --_holo-ring-color );opacity:0;pointer-events:none}:active:not(:disabled )>.os-holo-ring,:host(:active:not( [ disabled ] ) )>.os-holo-ring{animation:os-holo-ring var( --_holo-t-slow ) var( --_holo-ease )}@keyframes os-holo-ring{0%{opacity:0.45;box-shadow:0 0 0 0 var( --_holo-ring-color )}100%{opacity:0;box-shadow:0 0 0 10px transparent}}@media ( prefers-reduced-motion:reduce ){:active:not(:disabled )>.os-holo-ring,:host(:active:not( [ disabled ] ) )>.os-holo-ring{animation:none}}`,Ua=k` .os-holo-shimmer{background-image:var( --_holo-fill );background-size:300% 300%;background-repeat:no-repeat;animation:os-holo-shimmer 2.4s var( --_holo-loop ) infinite}@keyframes os-holo-shimmer{0%{background-position:0% 50%}100%{background-position:100% 50%}}@media ( prefers-reduced-motion:reduce ){.os-holo-shimmer{animation:none;background-position:30% 50%}}`,So=k` .os-holo-enter{animation:os-holo-enter var( --_holo-t ) var( --_holo-spring )}@keyframes os-holo-enter{from{opacity:0;transform:scale( 0.96 )}}@media ( prefers-reduced-motion:reduce ){.os-holo-enter{animation:none}}`,Ba=k` input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ),select,textarea{transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):hover:not(:disabled ),select:hover:not(:disabled ),textarea:hover:not(:disabled ){border-color:var( --os-ui-border-strong,#8c8f94 )}input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):focus,input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):focus-visible,select:focus,select:focus-visible,textarea:focus,textarea:focus-visible{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}input::placeholder,textarea::placeholder{color:var( --os-ui-fg-faint,#8c8f94 );opacity:1}input::selection,textarea::selection{background:var( --os-ui-selection-bg,rgba( 159,152,255,0.6 ) );color:var( --os-ui-selection-fg,#fffbff )}@media ( prefers-reduced-motion:reduce ){input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ),select,textarea{transition-duration:1ms}}`,Ga=k` input[ type='checkbox' ],input[ type='radio' ]{appearance:none;-webkit-appearance:none;position:relative;flex:0 0 auto;box-sizing:border-box;width:16px;height:16px;margin:0;padding:0;border:1px solid var( --_holo-track-edge );border-radius:4px;background-color:var( --_holo-track );background-image:none;background-repeat:no-repeat;cursor:inherit;transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='radio' ]{border-radius:50%}input[ type='checkbox' ]:hover:not(:disabled ),input[ type='radio' ]:hover:not(:disabled ){border-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:focus-visible,input[ type='radio' ]:focus-visible{outline:none;box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked,input[ type='checkbox' ]:indeterminate,input[ type='radio' ]:checked{border-color:transparent;background-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:checked:focus-visible,input[ type='radio' ]:checked:focus-visible{box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:46%;width:3.5px;height:7.5px;border:solid var( --os-ui-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}}`,qa=k` @keyframes os-holo-drift{0%{background-position:16% 26%}50%{background-position:84% 74%}100%{background-position:16% 26%}}.os-holo-alive{animation:os-holo-drift var( --_holo-t-ambient ) var( --_holo-loop ) infinite}@media ( prefers-reduced-motion:reduce ){.os-holo-alive{animation:none}}`;k` ${Pe} ${Pa} ${$a} ${Ha} ${za} ${Fa} ${Ua} ${So} ${Ba} ${Ga} ${qa} `;const Va=k` ${Pe} ${So}:host{display:block;animation:os-holo-enter var( --_holo-t ) var( --_holo-spring );transform-origin:top left;min-width:220px;padding:4px;background:var( --os-window-bg,#fff );background-image:var( --os-ui-menu-bg-image,none );background-repeat:var( --os-ui-menu-bg-image-repeat,repeat );background-size:var( --os-ui-menu-bg-image-size,auto );background-position:var( --os-ui-menu-bg-image-position,center );color:var( --os-ui-fg,#1d2327 );border:1px solid var( --os-window-border,#c3c4c7 );border-radius:8px;box-shadow:0 8px 24px rgba( 0,0,0,0.18 ),0 2px 6px rgba( 0,0,0,0.08 )}:host(:dir( rtl ) ){transform-origin:top right}@media ( prefers-reduced-motion:reduce ){:host{animation:none}}:host( [ hidden ] ){display:none}`,ja=k`:host{display:block}button{display:flex;align-items:center;gap:10px;width:100%;min-height:32px;padding:6px 10px;border:none;border-radius:6px;background:transparent;color:inherit;font:inherit;font-size:13px;line-height:1.3;text-align:start;cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease}button:hover,button:focus-visible{background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) );color:var( --os-ui-fg,#000 );outline:none}button:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.os-menu-item__icon{flex-shrink:0;width:18px;height:18px;font-size:18px;line-height:1;color:var( --wp-admin-theme-color,#2271b1 )}.os-menu-item__icon[ hidden ]{display:none}.os-menu-item__label{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.os-menu-item__check{flex-shrink:0;width:16px;height:16px;border-radius:3px;border:1.5px solid var( --os-ui-border,rgba( 0,0,0,0.25 ) );position:relative;background:transparent;transition:background-color 0.12s ease,border-color 0.12s ease}.os-menu-item__check[ hidden ]{display:none}:host( [ checked ] ) .os-menu-item__check{background-color:transparent;background-image:var( --os-ui-holo-fill,linear-gradient( 124deg,#afa2e8 0%,#f5a8ea 46%,#8ee9f7 100% ) );background-size:200% 200%;background-position:25% 30%;border-color:transparent;box-shadow:var( --os-ui-holo-glow,0 0 0 1px rgba( 242,82,252,0.28 ),0 2px 10px rgba( 242,82,252,0.22 ) )}:host( [ checked ] ) .os-menu-item__check::after{content:'';position:absolute;top:1px;left:4px;width:4px;height:8px;border:solid var( --os-ui-holo-ink,#0c0b0f );border-width:0 2px 2px 0;transform:rotate( 45deg )}`,ze=class ze extends B{connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}render(){return S`<slot></slot>`}};ze.styles=[Va],ze.help=void 0;let xt=ze;Z("os-menu",xt);const fe=class fe extends B{connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","menuitem")}render(){const t=this.icon||"",n=this.getAttribute("role")==="menuitemcheckbox",o=this.checked!==null;return n&&this.setAttribute("aria-checked",o?"true":"false"),S`
56 - <button type="button" @click=${s=>this._onPick(s)}>
60 + `}const Dl=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}}`,Vo=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}}),R=61.26,O=61.26,Ko=58.453,Wl='<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"/>',xe=class xe extends z{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 t=this.shadowRoot?.querySelector(".root");t&&(t.innerHTML=this._buildSvg())}_syncCssVars(){const t=(n,o,i)=>{const s=this.getAttribute(n);s===null?this.style.removeProperty(o):this.style.setProperty(o,i?i(s):s)};t("color","--os-ui-spinner-color"),t("accent","--os-ui-spinner-accent"),t("size","--os-ui-spinner-size",n=>/^-?\d+(\.\d+)?$/.test(n.trim())?`${n}px`:n)}_effectiveConfig(){const t=this.getAttribute("preset")??"classic",n=Vo[t]??Vo.classic,o=(r,c)=>{const a=this.getAttribute(r);if(a===null)return c;const d=parseFloat(a);return Number.isFinite(d)?d:c},i=(r,c)=>{const a=this.getAttribute(r);if(a===null)return c;const d=a.toLowerCase();return d==="-1"||d==="ccw"||d==="reverse"?-1:1},s=()=>{const r=this.getAttribute("pulse");return r==="scale"||r==="opacity"||r==="both"||r==="none"?r:n.pulse};return{sp1:o("sp1",n.sp1),sp2:o("sp2",n.sp2),sp3:o("sp3",n.sp3),a1:o("a1",n.a1),a2:o("a2",n.a2),a3:o("a3",n.a3),gap:o("gap",n.gap),dir2:i("dir2",n.dir2),dir3:i("dir3",n.dir3),pulse:s(),dots:Math.max(0,Math.floor(o("dots",n.dots)))}}_buildInlineSvg(t){const n=jo(this.getAttribute("label")??"Loading"),o=9,i=(t.sp1/10).toFixed(2);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-label="${n}"><circle cx="12" cy="12" r="${o}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-opacity="0.22"/><circle cx="12" cy="12" r="${o}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-dasharray="${Xe(o,t.a1)}" style="transform-origin:12px 12px;animation: os-spinner-spin ${i}s linear infinite"/></svg>`}_buildSvg(){const t=this._effectiveConfig();if(this.getAttribute("preset")==="inline")return this._buildInlineSvg(t);const n=jo(this.getAttribute("label")??"Loading"),o=t.gap*3+14,i=-o,s=122.52+o*2,r=Ko+t.gap+2,c=r+t.gap+2,a=c+t.gap+1.5,d=`animation: os-spinner-spin ${(t.sp1/10).toFixed(2)}s linear infinite`,l=`animation: os-spinner-spin ${(t.sp2/10).toFixed(2)}s linear infinite${t.dir2<0?" reverse":""}`,u=`animation: os-spinner-spin ${(t.sp3/10).toFixed(2)}s linear infinite${t.dir3<0?" reverse":""}`,p=(t.sp1*1.8/10).toFixed(1),g=(t.sp1*2.3/10).toFixed(1);let b="";t.pulse==="scale"?b=`animation: os-spinner-scale ${p}s ease-in-out infinite`:t.pulse==="opacity"?b=`animation: os-spinner-opacity ${g}s ease-in-out infinite`:t.pulse==="both"&&(b=`animation: os-spinner-scale ${p}s ease-in-out infinite, os-spinner-opacity ${g}s ease-in-out infinite`);let v="";if(t.dots>0){const w=a+t.gap+1,S=2*Math.PI*w,A=1.6,x=(t.sp1*.65/10).toFixed(2);for(let N=0;N<t.dots;N++){const D=-(N/t.dots)*S;v+=`<circle cx="${R}" cy="${O}" r="${w.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="${A}" stroke-dasharray="${A.toFixed(2)} ${(S-A).toFixed(2)}" stroke-dashoffset="${D.toFixed(2)}" stroke-linecap="round" stroke-opacity="0.65" style="transform-origin:${R}px ${O}px;animation: os-spinner-spin ${x}s linear infinite"/>`}}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${i} ${i} ${s} ${s}" role="img" aria-label="${n}"><g style="transform-origin:${R}px ${O}px${b?";"+b:""}"><circle cx="${R}" cy="${O}" r="${Ko}" fill="currentColor"/><g class="mark">${Wl}</g></g><circle cx="${R}" cy="${O}" r="${r.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.6" stroke-opacity="0.2"/><circle cx="${R}" cy="${O}" r="${r.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="2.2" stroke-dasharray="${Xe(r,t.a1)}" stroke-linecap="round" style="transform-origin:${R}px ${O}px;${d}"/><circle cx="${R}" cy="${O}" r="${c.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.5" stroke-opacity="0.15"/><circle cx="${R}" cy="${O}" r="${c.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.6" stroke-opacity="0.8" stroke-dasharray="${Xe(c,t.a2)}" stroke-linecap="round" style="transform-origin:${R}px ${O}px;${l}"/><circle cx="${R}" cy="${O}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.4" stroke-opacity="0.12"/><circle cx="${R}" cy="${O}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.0" stroke-opacity="0.6" stroke-dasharray="${Xe(a,t.a3)}" stroke-linecap="round" style="transform-origin:${R}px ${O}px;${u}"/>`+v+"</svg>"}};xe.props=["preset","size","color","accent","sp1","sp2","sp3","a1","a2","a3","gap","dir2","dir3","pulse","dots","label"],xe.styles=[Dl],xe.help=void 0;let Ut=xe;function Xe(e,t){const n=2*Math.PI*e,o=t/100*n,i=n-o;return`${o.toFixed(2)} ${i.toFixed(2)}`}function jo(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}X("os-spinner",Ut);const Ze=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 ) )}`,Ml=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%}}`,Pl=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%}}`,$l=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}}`,zl=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}}`,Hl=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}}`,Fl=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%}}`,Yo=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}}`,Ul=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}}`,Gl=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-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}}`,Bl=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` ${Ze} ${Ml} ${Pl} ${$l} ${zl} ${Hl} ${Fl} ${Yo} ${Ul} ${Gl} ${Bl} `;const ql=C` ${Ze} ${Yo}:host{display:block;animation:os-holo-enter var( --_holo-t ) var( --_holo-spring );transform-origin:top left;min-width:220px;padding:4px;background:var( --os-window-bg,#fff );background-image:var( --os-ui-menu-bg-image,none );background-repeat:var( --os-ui-menu-bg-image-repeat,repeat );background-size:var( --os-ui-menu-bg-image-size,auto );background-position:var( --os-ui-menu-bg-image-position,center );color:var( --os-ui-fg,#1d2327 );border:1px solid var( --os-window-border,#c3c4c7 );border-radius:8px;box-shadow:0 8px 24px rgba( 0,0,0,0.18 ),0 2px 6px rgba( 0,0,0,0.08 )}:host(:dir( rtl ) ){transform-origin:top right}@media ( prefers-reduced-motion:reduce ){:host{animation:none}}:host( [ hidden ] ){display:none}`,Vl=C`:host{display:block}button{display:flex;align-items:center;gap:10px;width:100%;min-height:32px;padding:6px 10px;border:none;border-radius:6px;background:transparent;color:inherit;font:inherit;font-size:13px;line-height:1.3;text-align:start;cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease}button:hover,button:focus-visible{background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) );color:var( --os-ui-fg,#000 );outline:none}button:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.os-menu-item__icon{flex-shrink:0;width:18px;height:18px;font-size:18px;line-height:1;color:var( --wp-admin-theme-color,#2271b1 )}.os-menu-item__icon[ hidden ]{display:none}.os-menu-item__label{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.os-menu-item__check{flex-shrink:0;width:16px;height:16px;border-radius:3px;border:1.5px solid var( --os-ui-border,rgba( 0,0,0,0.25 ) );position:relative;background:transparent;transition:background-color 0.12s ease,border-color 0.12s ease}.os-menu-item__check[ hidden ]{display:none}:host( [ checked ] ) .os-menu-item__check{background-color:transparent;background-image:var( --os-ui-holo-fill,linear-gradient( 124deg,#afa2e8 0%,#f5a8ea 46%,#8ee9f7 100% ) );background-size:200% 200%;background-position:25% 30%;border-color:transparent;box-shadow:var( --os-ui-holo-glow,0 0 0 1px rgba( 242,82,252,0.28 ),0 2px 10px rgba( 242,82,252,0.22 ) )}:host( [ checked ] ) .os-menu-item__check::after{content:'';position:absolute;top:1px;left:4px;width:4px;height:8px;border:solid var( --os-ui-holo-ink,#0c0b0f );border-width:0 2px 2px 0;transform:rotate( 45deg )}`,Je=class Je extends z{connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}render(){return y`<slot></slot>`}};Je.styles=[ql],Je.help=void 0;let Gt=Je;X("os-menu",Gt);const Ce=class Ce extends z{connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","menuitem")}render(){const t=this.icon||"",n=this.getAttribute("role")==="menuitemcheckbox",o=this.checked!==null;return n&&this.setAttribute("aria-checked",o?"true":"false"),y`
61 + <button type="button" @click=${i=>this._onPick(i)}>
57 62 <span
58 63 class="os-menu-item__check"
59 64 ?hidden=${!n}
60 65 ></span>
@@ -66,9 +71,9 @@
66 71 <span class="os-menu-item__label">
67 72 <slot></slot>
68 73 </span>
69 74 </button>
70 - `}_onPick(t){t.preventDefault(),this.emit("os-menu-item-click",{value:this.value})}};fe.props=["icon","value","checked"],fe.styles=[ja],fe.help={title:"Menu item",summary:'Single row inside a <os-menu>. Supports three looks: plain label, left-aligned dashicon (icon="dashicons-…"), or a checkbox indicator (role="menuitemcheckbox" + checked).',status:"stable",props:[{name:"icon",type:"string (dashicons class)",description:'Dashicons class rendered on the left. Ignored when role="menuitemcheckbox".'},{name:"value",type:"string",description:"Identifier emitted in os-menu-item-click.detail.value."},{name:"checked",type:"boolean attribute",description:'Visible check indicator. Only honoured when role="menuitemcheckbox".'}],slots:[{name:"(default)",description:"Menu item label."}],events:[{name:"os-menu-item-click",description:"Fires when the item is clicked; bubbles so the <os-menu> parent can delegate.",detail:"{ value: string | null }"}],example:S`
75 + `}_onPick(t){t.preventDefault(),this.emit("os-menu-item-click",{value:this.value})}};Ce.props=["icon","value","checked"],Ce.styles=[Vl],Ce.help={title:"Menu item",summary:'Single row inside a <os-menu>. Supports three looks: plain label, left-aligned dashicon (icon="dashicons-…"), or a checkbox indicator (role="menuitemcheckbox" + checked).',status:"stable",props:[{name:"icon",type:"string (dashicons class)",description:'Dashicons class rendered on the left. Ignored when role="menuitemcheckbox".'},{name:"value",type:"string",description:"Identifier emitted in os-menu-item-click.detail.value."},{name:"checked",type:"boolean attribute",description:'Visible check indicator. Only honoured when role="menuitemcheckbox".'}],slots:[{name:"(default)",description:"Menu item label."}],events:[{name:"os-menu-item-click",description:"Fires when the item is clicked; bubbles so the <os-menu> parent can delegate.",detail:"{ value: string | null }"}],example:y`
71 76 <os-menu>
72 77 <os-menu-item value="plain">Plain item</os-menu-item>
73 78 <os-menu-item value="icon" icon="dashicons-external">
74 79 With an icon
@@ -76,9 +81,9 @@
76 81 <os-menu-item value="startup" role="menuitemcheckbox" checked>
77 82 Checked (menuitemcheckbox)
78 83 </os-menu-item>
79 84 </os-menu>
80 - `};let Lt=fe;Z("os-menu-item",Lt);const Ka=k` ${Pe}:host{display:inline-flex}button{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:4px;background:transparent;color:var( --os-ui-fg-muted,rgba( 0,0,0,0.45 ) );cursor:pointer;transition:background-color 0.15s ease,color 0.15s ease,transform 0.12s ease}:host( [ variant='detach' ] ) button:hover{color:var( --wp-admin-theme-color,#2271b1 );background:var( --os-ui-accent-soft,rgba( 34,113,177,0.12 ) );transform:translateY( -1px )}:host( [ variant='detach' ] ) button:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );background:var( --os-ui-accent-soft,rgba( 34,113,177,0.12 ) );box-shadow:var( --_holo-focus )}:host( [ variant='close' ] ) button:hover{color:var( --os-ui-fg-on-accent,#fff );background:var( --os-ui-danger,#d63638 )}:host( [ variant='close' ] ) button:focus-visible{color:var( --os-ui-fg-on-accent,#fff );background:var( --os-ui-danger,#d63638 );outline:none;box-shadow:0 0 0 2px rgba( 12,11,15,0.9 ),0 0 0 4px var( --os-ui-danger,#d63638 ),0 0 12px 2px rgba( 214,54,56,0.45 )}svg{display:block;pointer-events:none;width:12px;height:12px}@media ( prefers-reduced-motion:reduce ){button{transition-duration:0.01ms}:host( [ variant='detach' ] ) button:hover{transform:none}}`,Ya={detach:'<path d="M5 2H2.5v7.5H10V7M6.5 2H10v3.5M10 2L5.5 6.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',close:'<path d="M2.5 2.5l7 7M9.5 2.5l-7 7" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>'},pe=class pe extends B{render(){const t=this.variant||"",n=Ya[t]||"";return S`
85 + `};let Bt=Ce;X("os-menu-item",Bt);const Kl=C` ${Ze}:host{display:inline-flex}button{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:4px;background:transparent;color:var( --os-ui-fg-muted,rgba( 0,0,0,0.45 ) );cursor:pointer;transition:background-color 0.15s ease,color 0.15s ease,transform 0.12s ease}:host( [ variant='detach' ] ) button:hover{color:var( --wp-admin-theme-color,#2271b1 );background:var( --os-ui-accent-soft,rgba( 34,113,177,0.12 ) );transform:translateY( -1px )}:host( [ variant='detach' ] ) button:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );background:var( --os-ui-accent-soft,rgba( 34,113,177,0.12 ) );box-shadow:var( --_holo-focus )}:host( [ variant='close' ] ) button:hover{color:var( --os-ui-fg-on-accent,#fff );background:var( --os-ui-danger,#d63638 )}:host( [ variant='close' ] ) button:focus-visible{color:var( --os-ui-fg-on-accent,#fff );background:var( --os-ui-danger,#d63638 );outline:none;box-shadow:0 0 0 2px rgba( 12,11,15,0.9 ),0 0 0 4px var( --os-ui-danger,#d63638 ),0 0 12px 2px rgba( 214,54,56,0.45 )}svg{display:block;pointer-events:none;width:12px;height:12px}@media ( prefers-reduced-motion:reduce ){button{transition-duration:0.01ms}:host( [ variant='detach' ] ) button:hover{transform:none}}`,jl={detach:'<path d="M5 2H2.5v7.5H10V7M6.5 2H10v3.5M10 2L5.5 6.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',close:'<path d="M2.5 2.5l7 7M9.5 2.5l-7 7" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>'},ke=class ke extends z{render(){const t=this.variant||"",n=jl[t]||"";return y`
81 86 <button type="button">
82 87 <svg
83 88 viewBox="0 0 12 12"
84 89 aria-hidden="true"
@@ -86,29 +91,33 @@
86 91 ></svg>
87 92 <slot></slot>
88 93 </button>
89 94 <span data-svg-buffer style="display:none">${n}</span>
90 - `}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg())}attributeChangedCallback(t,n,o){super.attributeChangedCallback(t,n,o),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const t=this.shadowRoot;if(!t)return;const n=t.querySelector("svg"),o=t.querySelector("[data-svg-buffer]");if(n&&o){const s=o.textContent||"";n.innerHTML!==s&&(n.innerHTML=s)}}};pe.props=["variant"],pe.styles=[Ka],pe.help=void 0;let It=pe;Z("os-tab-chip",It);const Xa={createWindow(e){return new Et(e)}};window.openStationWindowSystem=Xa;const Za=k` ${Pe}:host{display:none;position:fixed;inset:0;align-items:center;justify-content:center;background:var( --os-ui-scrim,rgba( 0,0,0,0.45 ) );background-image:var( --os-ui-scrim-image,none );background-repeat:var( --os-ui-scrim-image-repeat,repeat );background-size:var( --os-ui-scrim-image-size,auto );background-position:var( --os-ui-scrim-image-position,center );backdrop-filter:blur( 2px );z-index:10000}:host( [ open ] ){display:flex;animation:os-confirm-scrim var( --_holo-t ) var( --_holo-ease )}:host( [ open ] ) .dialog{animation:os-confirm-dialog var( --_holo-t ) var( --_holo-spring )}@keyframes os-confirm-scrim{from{opacity:0}}@keyframes os-confirm-dialog{from{opacity:0;transform:scale( 0.96 ) translateY( 8px )}}@media ( prefers-reduced-motion:reduce ){:host( [ open ] ),:host( [ open ] ) .dialog{animation:none}}.dialog{width:min( 420px,92vw );background-color:var( --os-ui-confirm-dialog-bg,#1d2327 );background-image:var( --os-ui-dialog-bg-image,none );background-repeat:var( --os-ui-dialog-bg-image-repeat,repeat );background-size:var( --os-ui-dialog-bg-image-size,auto );background-position:var( --os-ui-dialog-bg-image-position,center );color:var( --os-ui-confirm-dialog-fg,var( --os-fg,#fff ) );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.08 ) );border-radius:10px;box-shadow:0 20px 50px rgba( 0,0,0,0.6 );padding:20px 22px 18px;display:flex;flex-direction:column;gap:10px;position:relative}.close{position:absolute;top:8px;right:10px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;background:transparent;border:0;border-radius:6px;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );cursor:pointer;font-size:22px;line-height:1;padding:0}.close:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) );color:inherit}.btn:focus,.close:focus{outline:none;box-shadow:var( --_holo-focus )}.dialog:focus,.dialog:focus-visible{outline:none}.title{margin:0 0 4px;font-size:16px;font-weight:600}.message{margin:0;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );line-height:1.45;white-space:pre-line}.actions{display:flex;justify-content:flex-end;gap:8px;margin-top:6px}.btn{border:0;border-radius:6px;padding:8px 14px;font-size:13px;cursor:pointer;font-weight:500}.btn--secondary{background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) );color:inherit}.btn--secondary:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.14 ) )}.btn--primary{background:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.btn--primary:hover{filter:brightness( 1.08 )}.btn--danger{background:var( --os-ui-danger,#d63638 );color:var( --os-ui-fg-on-accent,#fff )}.btn--danger:hover{filter:brightness( 1.08 )}`,Co='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Qa(e){let t=e?.activeElement??null;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t&&t!==e?.body?t:null}function ko(e){const t=e.composedPath(),n=t.length>0?t[0]:e.target;return n instanceof HTMLElement?n:null}function xo(e){return e!==null&&e.matches(Co)}const me=class me extends B{constructor(){super(...arguments),this._prevFocus=null,this._focusTries=0,this._onKey=t=>{if(t.key==="Escape"){t.preventDefault(),this._cancel();return}if(t.key==="Tab"){this._trapTab(t);return}if(t.key==="Enter"&&!t.isComposing){if(xo(ko(t))||this.hasAttribute("danger"))return;t.preventDefault(),this._confirm()}},this._focusInitial=()=>{if(!this.hasAttribute("open"))return;const t=this.isConnected?this._initialFocusTarget():null;if(t){t.focus();return}if(this._focusTries++<5){queueMicrotask(this._focusInitial);return}this.isConnected&&this.focus()},this._onBackdrop=t=>{const n=t.composedPath();(n.length>0?n[0]:t.target)===this&&this._cancel()},this._confirm=()=>{this.emit("os-confirm",{confirmed:!0}),this.removeAttribute("open")},this._cancel=()=>{this.emit("os-cancel",{confirmed:!1}),this.removeAttribute("open")}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","dialog"),this.setAttribute("aria-modal","true"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),this.addEventListener("keydown",this._onKey),this.addEventListener("click",this._onBackdrop)}disconnectedCallback(){this.removeEventListener("keydown",this._onKey),this.removeEventListener("click",this._onBackdrop),this._restoreFocus()}attributeChangedCallback(t,n,o){super.attributeChangedCallback(t,n,o),t==="open"&&(o!==null?(this._prevFocus=Qa(this.ownerDocument),this._focusTries=0,queueMicrotask(this._focusInitial)):this._restoreFocus())}_focusables(){const t=this.shadowRoot;return t?Array.from(t.querySelectorAll(Co)):[]}_trapTab(t){const n=this._focusables();if(n.length===0)return;const o=n[0],s=n[n.length-1],i=ko(t),r=!xo(i);t.shiftKey&&(r||i===o)?(t.preventDefault(),s.focus()):!t.shiftKey&&(r||i===s)&&(t.preventDefault(),o.focus())}_initialFocusTarget(){const t=this.shadowRoot;if(!t)return null;const n=t.querySelector(".btn--secondary"),o=t.querySelector(".dialog");return this.hasAttribute("danger")?n??t.querySelector(".close")??o:t.querySelector(".btn--primary, .btn--danger")??n??o}_restoreFocus(){const t=this._prevFocus;this._prevFocus=null,!(!t||!t.isConnected)&&t.focus()}render(){const t=this.title??"",n=this.message??"",o=this["confirm-label"]||"Confirm",s=this["cancel-label"]||"Cancel",i=this.hasAttribute("danger"),r=this.hasAttribute("hide-cancel"),d=this.hasAttribute("dismissable");return S`
95 + `}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg())}attributeChangedCallback(t,n,o){super.attributeChangedCallback(t,n,o),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const t=this.shadowRoot;if(!t)return;const n=t.querySelector("svg"),o=t.querySelector("[data-svg-buffer]");if(n&&o){const i=o.textContent||"";n.innerHTML!==i&&(n.innerHTML=i)}}};ke.props=["variant"],ke.styles=[Kl],ke.help=void 0;let qt=ke;X("os-tab-chip",qt);const Yl={createWindow(e){return new zt(e)}};window.openStationWindowSystem=Yl;const Xl=C` ${Ze}: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 )}`,Xo='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Zl(e){let t=e?.activeElement??null;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t&&t!==e?.body?t:null}function Zo(e){const t=e.composedPath(),n=t.length>0?t[0]:e.target;return n instanceof HTMLElement?n:null}function Qo(e){return e!==null&&e.matches(Xo)}const Te=class Te extends z{constructor(){super(...arguments),this._prevFocus=null,this._focusTries=0,this._onKey=t=>{if(t.key==="Escape"){t.preventDefault(),this._cancel();return}if(t.key==="Tab"){this._trapTab(t);return}if(t.key==="Enter"&&!t.isComposing){if(Qo(Zo(t))||this.hasAttribute("danger"))return;t.preventDefault(),this._confirm()}},this._focusInitial=()=>{if(!this.hasAttribute("open"))return;const t=this.isConnected?this._initialFocusTarget():null;if(t){t.focus();return}if(this._focusTries++<5){queueMicrotask(this._focusInitial);return}this.isConnected&&this.focus()},this._onBackdrop=t=>{const n=t.composedPath();(n.length>0?n[0]:t.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(t,n,o){super.attributeChangedCallback(t,n,o),t==="open"&&(o!==null?(this._prevFocus=Zl(this.ownerDocument),this._focusTries=0,queueMicrotask(this._focusInitial)):this._restoreFocus())}_focusables(){const t=this.shadowRoot;return t?Array.from(t.querySelectorAll(Xo)):[]}_trapTab(t){const n=this._focusables();if(n.length===0)return;const o=n[0],i=n[n.length-1],s=Zo(t),r=!Qo(s);t.shiftKey&&(r||s===o)?(t.preventDefault(),i.focus()):!t.shiftKey&&(r||s===i)&&(t.preventDefault(),o.focus())}_initialFocusTarget(){const t=this.shadowRoot;if(!t)return null;const n=t.querySelector(".btn--secondary"),o=t.querySelector(".dialog");return this.hasAttribute("danger")?n??t.querySelector(".close")??o:t.querySelector(".btn--primary, .btn--danger")??n??o}_restoreFocus(){const t=this._prevFocus;this._prevFocus=null,!(!t||!t.isConnected)&&t.focus()}_remembered(){return this.shadowRoot?.querySelector(".remember__box")?.checked===!0}render(){const t=this.title??"",n=this.message??"",o=this["confirm-label"]||"Confirm",i=this["cancel-label"]||"Cancel",s=this.hasAttribute("danger"),r=this.hasAttribute("hide-cancel"),c=this.hasAttribute("dismissable"),a=this["remember-label"]??"";return y`
91 96 <div class="dialog" tabindex="-1">
92 - ${d?S`<button
97 + ${c?y`<button
93 98 type="button"
94 99 class="close"
95 100 aria-label="Close"
96 101 @click=${()=>this._cancel()}
97 - >&times;</button>`:S``}
98 - ${t?S`<h2 class="title">${t}</h2>`:S``}
99 - ${n?S`<p class="message">${n}</p>`:S``}
102 + >&times;</button>`:y``}
103 + ${t?y`<h2 class="title">${t}</h2>`:y``}
104 + ${n?y`<p class="message">${n}</p>`:y``}
105 + ${a?y`<label class="remember">
106 + <input type="checkbox" class="remember__box" />
107 + <span class="remember__label">${a}</span>
108 + </label>`:y``}
100 109 <div class="actions">
101 - ${r?S``:S`<button
110 + ${r?y``:y`<button
102 111 type="button"
103 112 class="btn btn--secondary"
104 113 @click=${()=>this._cancel()}
105 114 >
106 - ${s}
115 + ${i}
107 116 </button>`}
108 117 <button
109 118 type="button"
110 - class="btn ${i?"btn--danger":"btn--primary"}"
119 + class="btn ${s?"btn--danger":"btn--primary"}"
111 120 @click=${()=>this._confirm()}
112 121 >
113 122 ${o}
114 123 </button>
@@ -113,5 +122,5 @@
113 122 ${o}
114 123 </button>
115 124 </div>
116 125 </div>
117 - `}};me.props=["open","title","message","confirm-label","cancel-label","danger","hide-cancel","dismissable"],me.styles=[Za],me.help=void 0;let $e=me;Z("os-confirm-dialog",$e);function Ja(e){return new Promise(t=>{const n=document.createElement("os-confirm-dialog");n.setAttribute("open",""),e.title&&n.setAttribute("title",e.title),n.setAttribute("message",e.message),e.confirmLabel&&n.setAttribute("confirm-label",e.confirmLabel),e.cancelLabel&&n.setAttribute("cancel-label",e.cancelLabel),e.danger&&n.setAttribute("danger",""),e.hideCancel&&n.setAttribute("hide-cancel",""),e.dismissable&&n.setAttribute("dismissable","");const o=s=>{n.remove(),t(s)};n.addEventListener("os-confirm",()=>o(!0)),n.addEventListener("os-cancel",()=>o(!1)),document.body.appendChild(n)})}const el=Object.freeze(Object.defineProperty({__proto__:null,OsConfirmDialog:$e,osConfirm:Ja},Symbol.toStringTag,{value:"Module"}))})();
126 + `}};Te.props=["open","title","message","confirm-label","cancel-label","danger","hide-cancel","dismissable","remember-label"],Te.styles=[Xl],Te.help=void 0;let Qe=Te;X("os-confirm-dialog",Qe);function Ql(e){return new Promise(t=>{const n=document.createElement("os-confirm-dialog");n.setAttribute("open",""),e.title&&n.setAttribute("title",e.title),n.setAttribute("message",e.message),e.confirmLabel&&n.setAttribute("confirm-label",e.confirmLabel),e.cancelLabel&&n.setAttribute("cancel-label",e.cancelLabel),e.danger&&n.setAttribute("danger",""),e.hideCancel&&n.setAttribute("hide-cancel",""),e.dismissable&&n.setAttribute("dismissable",""),e.rememberLabel&&n.setAttribute("remember-label",e.rememberLabel);const o=i=>{n.remove(),t(i)};n.addEventListener("os-confirm",i=>{e.onRemember?.(i.detail?.remember===!0),o(!0)}),n.addEventListener("os-cancel",()=>o(!1)),document.body.appendChild(n)})}const Jl=Object.freeze(Object.defineProperty({__proto__:null,OsConfirmDialog:Qe,osConfirm:Ql},Symbol.toStringTag,{value:"Module"}))})();