| @@ -1,6 +1,6 @@ | ||
| 1 | -(function(){"use strict";function Te(){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 Ot(e,t,n,o){Te().addAction(e,t,n,o)}function Dt(e,t){return Te().removeAction(e,t)}function x(e,t,...n){return Te().applyFilters(e,t,...n)}function m(e,...t){Te().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",ARRANGE_CUSTOM_ACTION:"os.arrange.custom-action",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"},Wo="os.activity.";function Ve(e){return Wo+String(e).replace(/[^a-zA-Z0-9_.-]/g,".")}let Mo=0;const Ke={publish(e,t){m(Ve(e),t)},subscribe(e,t){const n=`os/activity-sub/${++Mo}`,o=Ve(e);Ot(o,n,i=>t(i));let s=!1;return()=>{s||(s=!0,Dt(o,n))}},filter(e,t,...n){return x(Ve(e),t,...n)}},Wt="__openStationSharedStores";function Po(){const e=window;let t=e[Wt];return t||(t=new Map,e[Wt]=t),t}function k(e,t){const n=Po();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 z=k("desktop-mode/window-channels",()=>({parentSubs:new Map,nativeSubs:new Map,readyWindows:new Set,loadingWindows:new Set,pendingSends:new Map}));function xe(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 Mt(e,t,n,o){const s={channel:n,windowId:t},i=xe(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=xe(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 $o(e,t,n){const o=xe(z.state.parentSubs,e,t,!0);o.add(n);let s=!1;return()=>{s||(s=!0,o.delete(n))}}function Pt(e,t,n){Mt(z.state.parentSubs,e,t,n)}function Ho(e,t,n){const o=xe(z.state.nativeSubs,e,t,!0);o.add(n);let s=!1;return()=>{s||(s=!0,o.delete(n))}}function Fo(e,t,n){Mt(z.state.nativeSubs,e,t,n)}function $t(e){return z.state.readyWindows.has(e)}function Ie(e){const{loadingWindows:t}=z.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}=z.state;if(!t.has(e)){t.add(e);const s=o.get(e);if(s){o.delete(e);for(const i of s)try{i.flush()}catch(r){typeof console<"u"&&console.error(`[openstation] flushing queued window-send for "${i.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 Uo(e,t,n,o){const{pendingSends:s}=z.state;let i=s.get(e);i||(i=[],s.set(e,i)),i.push({channel:t,payload:n,flush:o})}function zo(e){const t=z.state;t.parentSubs.delete(e),t.nativeSubs.delete(e),t.readyWindows.delete(e),t.loadingWindows.delete(e),t.pendingSends.delete(e)}const Go=k("desktop-mode/connection",()=>({connSeq:0,connections:new Map,connectionsByTarget:new Map,syntheticIframes:new Map}));function Bo(e){return Go.state.syntheticIframes.get(e)??null}const qo="data-os-mode";function Ht(e=typeof document<"u"?document.documentElement:null){return!!e&&e.getAttribute(qo)==="mobile"}const Vo="desktop-mode";function Ft(){return window.wp?.i18n}function _(e,t=Vo){return Ft()?.__(e,t)??e}function oe(e,...t){const n=Ft()?.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 Ko="os-window-tab-change";function je(e){return Array.from(e.querySelectorAll(".os-window__tab"))}function Ut(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function zt(e,t){return`${e.id||"os-window"}-tab-${Ut(t)}`}function Gt(e,t){return`${e.id||"os-window"}-panel-${Ut(t)}`}function Bt(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 le(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 qt(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 jo(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 Vt(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 Kt(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 Ye(e,t){const n=e.querySelector(".os-window__tabs");if(!n)return;let o=!1;for(const[s,i]of Vt(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 Kt(e)){const i=s.getAttribute("for")===t;s.toggleAttribute("hidden",!i),s.setAttribute("aria-hidden",i?"false":"true")}qt(n),Bt(n),e.dispatchEvent(new CustomEvent(Ko,{bubbles:!0,detail:{value:t}}))}}function Yo(e,t,n){const o=e.querySelector(".os-window__tabs");if(!o)return;const s=Vt(o),i=Array.from(s.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=s.get(l.value);if(u)s.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=zt(e,l.value),u.setAttribute("aria-controls",Gt(e,l.value)),u.previousElementSibling!==r&&o.insertBefore(u,r?r.nextSibling:o.firstChild),r=u}for(const l of s.values())l.remove();le(o);const d=o.querySelector(":scope > .os-window__tab")!==null;for(const l of Kt(e)){const u=l.getAttribute("for");u&&(l.id=Gt(e,u),d?l.setAttribute("aria-labelledby",zt(e,u)):l.removeAttribute("aria-labelledby"))}const a=l=>l!==void 0&&t.some(u=>u.value===l),c=[n,i,t[0]?.value].find(a);c!==void 0&&Ye(e,c)}let Xo=0;function Zo(e,t={}){const n=++Xo,o=l=>`desktop-mode/native-render-ctx/${e}/${n}/${l}`,s=new AbortController,i=[],r=(l,u,p,g)=>{const b=o(u);Ot(l,b,w=>{p(w)&&g(w)});const v=()=>{Dt(l,b)};return i.push(v),v},d=l=>!!l&&typeof l=="object"&&l.windowId===e;return{ctx:{window:{send(l,u){typeof l!="string"||l===""||Pt(e,l,u)},on(l,u){return typeof l!="string"||l===""||typeof u!="function"?()=>{}:Ho(e,l,u)},markLoading(){Ie(e)},markReady(){$(e)}},markLoading(){Ie(e)},markReady(){$(e)},signal:s.signal,onResize(l){return typeof l!="function"?()=>{}:r(f.WINDOW_BODY_RESIZED,"on-resize",d,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",d,()=>{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",d,()=>{try{l()}catch(u){m(f.SHELL_ERROR,{scope:"native-render-ctx/onShow",id:e,error:u})}})},params:t},dispose:()=>{try{s.abort()}catch{}for(;i.length;){const l=i.pop();try{l?.()}catch{}}}}}const jt=["post_type","page","taxonomy","path","post","c","tag_ID","item","p"].filter(e=>e!=="p"),Xe=[];function Qo(e){if(!e.pathname.endsWith("/admin.php")||!e.searchParams.get("page"))return Xe;const t=e.searchParams.get("action");return t==="edit"&&e.searchParams.get("id")?["id"]:t==="new"?["action"]:Xe}function Yt(e){try{const t=new URL(e,window.location.origin),n=new URLSearchParams,o=[...jt,...Qo(t)];for(const i of o){const r=t.searchParams.get(i);r?n.set(i,r):i==="post_type"&&(t.pathname.endsWith("/edit.php")||t.pathname.endsWith("/post-new.php"))&&n.set(i,"post")}n.sort();const s=n.toString();return t.pathname.replace(/\/+$/,"")+(s?`?${s}`:"")}catch{return e}}function Y(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 Jo="openstation";function es(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")===Jo}const Xt="X-WP-Nonce";function ts(e,t){const n=ns();if(!n)return t;const o=os(e);if(!o||!ss(o))return t;const s=t?.headers??(typeof Request<"u"&&e instanceof Request?e.headers:void 0),i=new Headers(s??{});return i.has(Xt)?t:(i.set(Xt,n),{...t??{},headers:i})}function ns(){if(typeof window>"u")return;const t=window.openStationConfig?.restNonce;return typeof t=="string"&&t.length>0?t:void 0}function os(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 ss(e){return typeof window>"u"||!window.location||e.origin!==window.location.origin?!1:!!(e.pathname.includes("/wp-json/")||e.searchParams.has("rest_route"))}function is(e,t,n={}){const o=window.wp?.os?.fetch;if(typeof o=="function")return o(e,t,n);const s=ts(e,t);return fetch(e,s)}const Zt=k("desktop-mode/dock-rail-registry",()=>({registry:new Map,listeners:new Set,activeId:"default"}));Zt.state.registry,Zt.state.listeners;function rs(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 as 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 Ze(e,t,n){if(t.length!==0)throw new as(e,t,n)}function Qt(e,t,n){typeof console>"u"||console.warn(`[openstation] ${e} registration rejected — fields: `+t.join(", ")+".",n)}const X=[[0,0],[100,0],[100,100],[0,100]],ls=48,cs=80,Qe=6,Je=8,Jt=4,en=3,tn=64,et=105,Z=2;function nn(e){return`${Math.round(e*1e3)/1e3}%`}function Q(e){return e.slice().reverse()}function ce(e,t,n,o){return[[e,t],[n,t],[n,o],[e,o]]}function ds(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 H(e,t=[]){const n=[],o=s=>{n.push(`${nn(s[0])} ${nn(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 on(e){return H(X,[Q(ds(50,50,e,ls))])}function sn(e){return H(X,[Q(ce(50-e,-Z,50+e,100+Z))])}function rn(e){const t=100/Qe,n=[];for(let o=0;o<Qe;o++){const s=o*t;n.push(Q(ce(-Z,s,100+Z,s+e)))}return H(X,n)}function an(e){return H(X,[Q(ce(-Z,50-e,100+Z,50+e))])}function ln(e){const t=100/Je,n=[];for(let o=0;o<Je;o++){const s=o*t;n.push(Q(ce(s,-Z,s+e,100+Z)))}return H(X,n)}function cn(e){return H(X,[Q([[50,50-e],[50+e,50],[50,50+e],[50-e,50]])])}function dn(e){const t=100/Jt,n=100/en,o=[];for(let s=0;s<en;s++)for(let i=0;i<Jt;i++){const r=i*t+t/2,d=s*n+n/2,a=t/2*e,c=n/2*e;o.push(Q(ce(r-a,d-c,r+a,d+c)))}return H(X,o)}function un(e){const t=-Math.PI/2,n=e/180*Math.PI,o=[[50,50]];for(let s=0;s<tn;s++){const i=t+s/(tn-1)*n;o.push([50+Math.cos(i)*et,50+Math.sin(i)*et])}return H(X,[Q(o)])}function us(){return{from:on(0),to:on(cs)}}function hs(){return{from:sn(0),to:sn(52)}}function fs(){return{from:rn(0),to:rn(100/Qe+.5)}}function ps(){return{from:an(0),to:an(52)}}function ms(){return{from:ln(0),to:ln(100/Je+.5)}}function gs(){return{from:cn(0),to:cn(et)}}function _s(){return{from:dn(0),to:dn(1.04)}}function bs(){return{from:un(0),to:un(360)}}function ws(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 100% 0% )"}}function vs(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 0% 100% )"}}function ys(){return{from:H([[-60,0],[100,0],[100,100],[0,100]]),to:H([[100,0],[260,0],[260,100],[160,100]])}}const tt=6,nt=100,se=nt/2,Le=200,hn=90,fn=["#5c5c6d","#525261","#484855","#3e3e49","#34343d","#2a2a31"],Es="#101014",As=1.25,ie="http://www.w3.org/2000/svg";let Ss=0;function Ne(e){return Math.round(e*1e3)/1e3}function ot(e){return e/tt*Math.PI*2-Math.PI/2}function Cs(e){const n=ot(e)+Math.PI/tt+Math.PI/2;return{x:Math.cos(n),y:Math.sin(n)}}function ks(e){const t=ot(e),n=ot(e+1);return[[se,se],[se+Math.cos(t)*Le,se+Math.sin(t)*Le],[se+Math.cos(n)*Le,se+Math.sin(n)*Le]]}function pn(e,t){const n=ks(e),o=document.createElementNS(ie,"path");return o.setAttribute("d",`M ${n.map(([s,i])=>`${Ne(s)} ${Ne(i)}`).join(" L ")} Z`),t?o.setAttribute("fill","#fff"):(o.setAttribute("fill",fn[e%fn.length]),o.setAttribute("stroke",Es),o.setAttribute("stroke-width",String(As)),o.setAttribute("vector-effect","non-scaling-stroke"),o.setAttribute("stroke-linejoin","round")),o}function Ts(){const e=`os-iris-${++Ss}`,t=document.createElementNS(ie,"svg");t.setAttribute("viewBox",`0 0 ${nt} ${nt}`),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(ie,"defs"),o=document.createElementNS(ie,"mask");o.setAttribute("id",e);const s=document.createElementNS(ie,"g"),i=document.createElementNS(ie,"g");i.setAttribute("mask",`url(#${e})`);const r=[];for(let a=0;a<tt;a++){const c=pn(a,!0),l=pn(a,!1);s.appendChild(c),i.appendChild(l),r.push({el:c,index:a},{el:l,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:c,index:l})=>{const u=Cs(l),p=Ne(u.x*hn),g=Ne(u.y*hn);return c.animate([{transform:"translate( 0px, 0px )"},{transform:`translate( ${p}px, ${g}px )`}],{duration:a.duration,easing:a.easing,delay:a.delay,fill:"both"})})}}const st="none",xs=70,Is=600,mn=k("desktop-mode/window-reveal-registry",()=>({registry:new Map,listeners:new Set})),gn=mn.state.registry,Ls=mn.state.listeners,_n=/^[a-z0-9_/-]+$/;function bn(e){const t=/^\s*([a-zA-Z-]+)\s*\(/.exec(e);return t?t[1].toLowerCase():""}const Ns=0;function Rs(e){return typeof e!="number"||!Number.isFinite(e)?xs:Math.min(Is,Math.max(0,e))}function Os(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 wn(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=bn(e.from),r=bn(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 Ds(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)"):_n.test(e.id.trim().toLowerCase())?e.id.trim().toLowerCase()===st&&t.push('id ("none" is reserved)'):t.push(`id (must match ${_n} — 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(...wn(r,`layers[ ${d} ]`))})):t.push(...wn(e,"").map(r=>r.replace(/^\./,"")))),e.easing!==void 0&&(typeof e.easing!="string"||e.easing.trim()===""?t.push("easing (not a non-empty string)"):Ds(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)"))}Ze("WindowReveal",t,e);const n=e.id.trim().toLowerCase();gn.set(n,{...e,id:n}),Ps()}function Ws(){const e=Array.from(gn.values()),t=x(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 Ms(e){return Ws().find(t=>t.id===e)}function Ps(){const e=Array.from(Ls);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."),...vs(),duration:420}),W({id:"iris",label:_("Iris"),description:_("The page opens out from the centre of the window, like a camera shutter."),...us(),duration:520}),W({id:"curtain",label:_("Curtain"),description:_("Two panels part from the middle of the window and slide off the sides."),...hs(),duration:480}),W({id:"blinds",label:_("Blinds"),description:_("Six horizontal slats retract at once, letting the page through between them."),...fs(),duration:560}),W({id:"diagonal",label:_("Diagonal"),description:_("A slanted edge sweeps off the trailing corner of the window."),...ys(),duration:460}),W({id:"rise",label:_("Rise"),description:_("The page rises into the window from the bottom edge upward."),...ws(),duration:440}),W({id:"shutter",label:_("Shutter"),description:_("Two panels part from the middle of the window and slide off the top and bottom."),...ps(),duration:480}),W({id:"slats",label:_("Slats"),description:_("Eight vertical slats retract at once, letting the page through between them."),...ms(),duration:560}),W({id:"diamond",label:_("Diamond"),description:_("The page opens out from the centre of the window through a growing rhombus."),...gs(),duration:520}),W({id:"mosaic",label:_("Mosaic"),description:_("The page arrives as a grid of tiles, each opening out from its own centre."),..._s(),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:Ts,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."),...bs(),duration:760});const vn={dockSize:["compact","default","large"],desktopLayout:["classic","unified"],dockPlacement:["bottom","left","right"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"]},yn=["dockRailRenderer","windowReveal","accent"],En={windowRevealDuration:{min:80,max:4e3}},$s=/^[a-z0-9_-]+$/;[...Object.keys(vn),...yn,...Object.keys(En)];function Hs(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t=e,n={},o={};for(const[s,i]of Object.entries(vn)){const r=t[s];typeof r=="string"&&i.includes(r)&&(n[s]=r)}for(const s of yn){const i=t[s];typeof i=="string"&&$s.test(i)&&(n[s]=i)}for(const[s,i]of Object.entries(En)){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 Fs=/^[a-z0-9_-]+$/,An=128;function Us(e){return typeof e!="string"||e===""||e.length>2048?!1:e.startsWith("dashicons-")||e.startsWith("https://")||e.startsWith("http://")||e.startsWith("data:image/")}function zs(e){if(!e||typeof e!="object")return null;const t=e,n=typeof t.slug=="string"?t.slug:"";if(!Fs.test(n))return null;const o={};if(t.icons&&typeof t.icons=="object"){let a=0;for(const[c,l]of Object.entries(t.icons)){if(a>=An)break;c===""||!Us(l)||(o[c]=l,a+=1)}}const s={};if(t.tokens&&typeof t.tokens=="object")for(const[a,c]of Object.entries(t.tokens))typeof c=="string"&&(s[a]=c);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[c,l]of Object.entries(t.iconColors)){if(a>=An)break;c===""||typeof l!="string"||l===""||(r[c]=l,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:Hs(t.recommendedOsSettings),installedAt:typeof t.installedAt=="number"?t.installedAt:0,source:t.source==="code"?"code":"upload",cssDeferred:t.cssDeferred===!0}}function Gs(){const t=window.openStationConfig?.serverDesktopThemes,n=[];if(Array.isArray(t))for(const o of t){const s=zs(o);s&&n.push(s)}return{themes:n,activeId:null,activeIcons:null,activeIconColors:null}}const Bs=k("desktop-mode/desktop-themes",Gs);function Sn(){return Bs}function Cn(e){const t=Sn().state;if(t.activeIcons===null||!e)return null;const n=t.activeIcons[e];if(typeof n!="string"||n==="")return null;const o=x(f.DESKTOP_THEME_ICON,n,{slot:e,themeId:t.activeId??""});return typeof o=="string"&&o!==""?o:null}function kn(e){const t=Sn().state;if(t.activeIconColors===null||!e)return null;const n=t.activeIconColors[e];if(typeof n!="string"||n==="")return null;const o=x(f.DESKTOP_THEME_ICON_COLOR,n,{slot:e,themeId:t.activeId??""});return typeof o=="string"&&o!==""?qs(o):null}function qs(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 de={OS_SETTINGS:"OS_SETTINGS",RECYCLE_BIN:"RECYCLE_BIN",BUG_REPORT:"BUG_REPORT",EXIT_OPENSTATION:"EXIT_OPENSTATION",PWA_INSTALL:"PWA_INSTALL"},Vs={"desktop-mode-os-settings":de.OS_SETTINGS,"desktop-mode-recycle-bin":de.RECYCLE_BIN,"desktop-mode-bug-report":de.BUG_REPORT,"os-exit":de.EXIT_OPENSTATION,"os-pwa-install":de.PWA_INSTALL};function Ks(e){if(typeof e!="string"||e==="")return"";const t=Vs[e];if(t)return t;const n=e.toLowerCase().replace(/[^a-z0-9_-]/g,"");return n===""?"":`APP:${n}`}function js(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 it(e,t){const n=js(t),o=Cn(n),s=kn(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 rt=null;function Re(){return!!window.openStationShellOverlays}function Ys(e){return new Promise((t,n)=>{const o=document.querySelector('script[data-os-shell-overlays="1"]'),s=()=>{if(Re()){t();return}n(new Error("[openstation] shell-overlays bundle loaded but did not set `window.openStationShellOverlays`."))};if(o){Re()?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 Xs(e){return Re()||!e?Promise.resolve():(rt||(rt=Ys(e)),rt)}function Zs(){return window.openStationConfig?.shellOverlaysBundleUrl??""}function Qs(e,t){const n=Zs();if(Re()||!n){t();return}Xs(n).then(()=>{e()&&t()}).catch(o=>{typeof console<"u"&&console.warn("[openstation] shell-overlays failed to load; menu/dialog suppressed:",o)})}const Js=4e3,ei=200,ti=1200;function at(e){const t=Ke.filter("os/toast-requested",{...e});if(!t||t.cancel===!0)return()=>{};let n=!1,o=null;return Qs(()=>!n,()=>{o=ni(t)}),()=>{n=!0,o&&o()}}function ni(e){const t=ri(),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??Js,r=0;const d=()=>{s!==null&&(window.clearTimeout(s),s=null)},a=()=>{o||(o=!0,d(),ii(n),n.setAttribute("state","out"),window.setTimeout(()=>{n.remove(),si()},ei))},c=()=>{o||e.persistent||s!==null||(r=Date.now(),s=window.setTimeout(a,i))},l=()=>{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){l();return}i=Math.max(i,ti),c()}),oi(n),c(),Ke.publish("os/toast-shown",{...e}),a}let Oe=null,ue=0;function Tn(e){const t=e.target;t instanceof HTMLElement&&(t.closest("os-toast-container")||(Oe=t))}function oi(e){ue===0&&document.addEventListener("focusin",Tn,!0),ue+=1;const t=e.ownerDocument,n=t.activeElement;n instanceof HTMLElement&&n!==t.body&&!n.closest("os-toast-container")&&(Oe=n)}function si(){ue=Math.max(0,ue-1),ue===0&&document.removeEventListener("focusin",Tn,!0)}function ii(e){const t=e.ownerDocument.activeElement;t!==e&&!e.contains(t)||Oe?.isConnected===!0&&Oe.focus()}function ri(){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 ai="http://localhost/";function li(e,t){const n=typeof window<"u"&&window.location?window.location.href:ai,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")??"/",c=a.endsWith("/")?a:a+"/";o.searchParams.set("rest_route",c+r)}else{const a=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";o.pathname=a+r}return d&&new URLSearchParams(d).forEach((c,l)=>{o.searchParams.append(l,c)}),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 ci(e){try{(window.top??window).location.assign(e)}catch{window.location.assign(e)}}const xn=800;function di(e,t=xn){window.setTimeout(()=>{if(e){ci(e);return}try{(window.top??window).location.reload()}catch{window.location.reload()}},t)}const ui="desktop-mode/v1",hi=3e4,fi=3,he=k("desktop-mode/plugin-presence",()=>({confirmInFlight:!1,lastConfirmAt:null,exiting:!1,booted:!1,negativeConfirms:0}));function lt(){return window.wp?.os?.config??{}}function pi(){const e=lt().adminUrl||"/wp-admin/";let t;try{t=new URL(e,window.location.href).pathname}catch{t="/wp-admin/"}return t.endsWith("/")?t:`${t}/`}function mi(){const e=lt().restUrl;return e?li(e,ui):null}function gi(){he.state.negativeConfirms=0}async function _i(){const e=he.state;if(e.exiting||e.confirmInFlight||e.negativeConfirms>=fi)return;const t=mi();if(!t)return;const n=Date.now();if(!(e.lastConfirmAt!==null&&n-e.lastConfirmAt<hi)){e.lastConfirmAt=n,e.confirmInFlight=!0;try{const o=await is(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}bi()}catch{}finally{e.confirmInFlight=!1}}}function bi(){if(!he.state.exiting){he.state.exiting=!0,di(lt().adminUrl||"");try{at({message:_("OpenStation is no longer active. Returning to the WordPress dashboard…"),duration:xn})}catch{}}}function ct(e){if(he.state.exiting)return;let t=null;try{t=e.contentDocument}catch{return}if(!(!t?.body||!t.location)&&t.location.pathname.startsWith(pi())){if(t.body.classList.contains("os-chromeless")){gi();return}_i()}}const G=0,dt=40,In=5,wi=In*In,vi=3e3,yi=250,Ei=15e3,Ai=120,ut="os-window__loading",Ln="os-window__loading--visible",Si=k("desktop-mode/window-reveal-active",()=>({id:st,duration:Ns}));function Ci(){const e=Si.state.id;return!e||e===st?null:Ms(e)??null}const ht="os-window__reveal",ki="os-window__reveal--edge",Ti="os-window__reveal--custom",Nn="data-os-reveal",Rn="data-os-reveal-layer",xi=k("desktop-mode/window-reveal-rendered",()=>({plays:new WeakMap})).state.plays;function On(e,t,n,o){const s=document.createElement("div");s.className=o?`${ht} ${ki}`:ht;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(Nn,e.id),s.setAttribute(Rn,String(n)),s.style.clipPath=t.from,s}function Ii(){const e=Ci();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(ht),s.classList.add(Ti),s.setAttribute("aria-hidden","true"),s.setAttribute(Nn,e.id),s.setAttribute(Rn,"0"),xi.set(s,o.play),[s]}const t=Os(e);if(t.length===0)return[];const n=[];return Rs(e.edgeLag)>0&&t.forEach((o,s)=>n.push(On(e,o,s,!0))),t.forEach((o,s)=>n.push(On(e,o,s,!1))),n}const Dn="os-window__body--loading",Wn="data-os-loading-at",Mn="data-os-loading-cycle";function Li(e){return e.getAttribute(Mn)??"0"}function Ni(e){e.setAttribute(Wn,String(Date.now())),e.setAttribute(Mn,String(Number(Li(e))+1))}function Ri(e,t){const n=Number(e.getAttribute(Wn)),o=Number.isFinite(n)&&n>0?Date.now()-n:0,s=Ai-o;if(s<=0){t.classList.add(Ln);return}window.setTimeout(()=>{t.isConnected&&e.classList.contains(Dn)&&t.classList.add(Ln)},s)}const Oi=Symbol.for("desktop-mode/window-config");function Di(e,t){e[Oi]=t}const Pn=window.location.origin;function fe(e){const t=new URL(e,Pn);return t.origin!==Pn||es(t)?null:(t.searchParams.set("openstation_chromeless","1"),t.toString())}function re(){const e=document.querySelectorAll(".os-window--fullscreen:not(.os-window--minimized)").length>0;document.body.classList.toggle("os-has-fullscreen-window",e)}function Wi(){const e=document.createElement("div");e.className=ut,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 Mi(e){let t=Wi();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=x(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(ut)&&t.classList.add(ut),t}function J(e){const t=document.createElement("span");return t.className=`os-window__slot os-window__slot--${e}`,t.dataset.slot=e,t}function Pi(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"),it(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 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=_("Open on startup"),s.appendChild(i),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=oe(_("Open another %s"),e.title),s.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"),s.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"),s.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 browser tab"),s.appendChild(h)}const r=J("icon"),d=J("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 c=J("before-titlebar"),l=J("before-icon"),u=J("after-title"),p=J("before-controls"),g=J("after-controls"),b=J("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 E=document.createElement("span");E.className="os-window__custom-buttons os-window__custom-buttons--right";const C=document.createElement("os-save-status");C.className="os-window__status",C.setAttribute("mode","icon"),C.setAttribute("variant","ring"),C.setAttribute("phase","idle"),C.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(C),n.appendChild(l),n.appendChild(r),n.appendChild(d),n.appendChild(u),n.appendChild(S),n.appendChild(w),o&&s&&s.children.length>0&&(n.appendChild(o),n.appendChild(s)),n.appendChild(E),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 ${Dn}`,Ni(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 y=e.url?fe(e.url):null;h.src=y??"about:blank",D.appendChild(h);const I=()=>{$(e.id),ct(h)};h.addEventListener("load",I)}const Se=Mi(e);D.appendChild(Se),Ri(D,Se);for(const h of Ii())D.appendChild(h);Ie(e.id);const K=[];for(const h of["ne","nw","se","sw"]){const y=document.createElement("div");y.className=`os-window__resize-handle os-window__resize-handle--${h}`,y.dataset.dir=h,y.setAttribute("aria-hidden","true"),K.push(y)}t.appendChild(c),t.appendChild(n),t.appendChild(b);{const h=document.createElement("nav");h.className="os-window__tabs";const y=document.createElement("span");y.className="os-window__tab-plate",y.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",y.appendChild(I),y.appendChild(F),h.appendChild(y),e.native?h.dataset.tablistLabel=oe(_("%s sections"),e.title):h.dataset.tablistLabel=oe(_("%s sub-pages"),e.title);const P=(e.submenu??[]).filter(j=>!j.offSite);if(P.length>0&&e.url){const j=Y(e.url),Ce=e.parentUrl??e.url,Il=Y(Ce),Ll=P.some(ke=>Y(ke.url)===Il)?[...P]:[{title:e.selfLabel||e.title,url:Ce},...P];for(const ke of Ll){const U=document.createElement("button");U.className="os-window__tab",U.dataset.kind="submenu",U.setAttribute("type","button"),U.setAttribute("role","tab"),U.dataset.url=ke.url,U.textContent=ke.title,Y(ke.url)===j?(U.classList.add("os-window__tab--active"),U.setAttribute("aria-selected","true")):U.setAttribute("aria-selected","false"),h.appendChild(U)}}le(h),t.appendChild(h)}t.appendChild(D);for(const h of K)t.appendChild(h);return Di(t,e),t}const $n=window.location.origin;let Hn=0;function $i(e,{timeoutMs:t=yi}={}){const n=e?.contentWindow;if(!n)return Promise.resolve(!1);Hn+=1;const o=`os-unsaved-guard-${Date.now()}-${Hn}`;return new Promise(s=>{let i=null,r=!1;const d=c=>{r||(r=!0,window.removeEventListener("message",a),i!==null&&window.clearTimeout(i),s(c))},a=c=>{if(c.origin!==$n)return;const l=c?.data;!l||typeof l!="object"||l.type!=="os-bridge-beforeunload-response"||l.requestId!==o||d(l.prevent===!0)};window.addEventListener("message",a),i=window.setTimeout(()=>d(!1),t);try{n.postMessage({type:"os-bridge-beforeunload-query",requestId:o},$n)}catch{d(!1)}})}function ft(e,{commit:t,navigate:n}){if(!e._iframeBridgeReady||!e.iframe){t(),n();return}e._unsavedGuardPending=!0,$i(e.iframe).then(o=>{if(e._unsavedGuardPending=!1,!e._isDestroyed){if(!o){t(),n();return}e._deferNavigationCommit(t,Ei),n()}})}function Hi(e,t){let n;try{n=new URL(t,window.location.origin)}catch{return null}const o=Yt(t);let s=null,i=-1;for(const r of e){const d=r.dataset.url;if(!d||Yt(d)!==o)continue;let a;try{a=new URL(d,window.location.origin)}catch{continue}let c=0,l=!1;for(const[u,p]of a.searchParams){if(u==="openstation_chromeless"||u==="desktop_mode_portal"||jt.includes(u))continue;if(n.searchParams.get(u)!==p){l=!0;break}c++}!l&&c>i&&(s=r,i=c)}return s}function pe(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=Y(t);let s=null;for(const i of n){const r=i.dataset.url;if(r&&Y(r)===o){s=i;break}}if(s||(s=Hi(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 Fn(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;Fi(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",_("Open in a new browser tab")),a.title=_("Open in a new browser tab"),r.appendChild(a);const c=document.createElement("os-tab-chip");c.setAttribute("variant","close"),c.dataset.tabAction="close",c.dataset.tabId=i,c.setAttribute("aria-label",_("Close tab")),c.title=_("Close tab"),r.appendChild(c),o.appendChild(r),le(o);const l=document.createElement("iframe");l.className="os-window__iframe os-window__iframe--external",l.dataset.tabId=i,l.style.display="none",l.src=t,s.appendChild(l);let u=!1;const p=()=>{u=!0};l.addEventListener("load",p,{once:!0});const g=window.setTimeout(()=>{u||(l.removeEventListener("load",p),zi(e,i))},vi),b=()=>{l.removeEventListener("load",p),window.clearTimeout(g)};e._externalTabs.set(i,{tabEl:r,iframe:l,url:t,label:n,cancelProbe:b}),me(e,i),r.scrollIntoView({behavior:"smooth",inline:"end",block:"nearest"}),e._emitChange("state")}function Fi(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),le(t)}function me(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 pt(e,t){const n=e._externalTabs.get(t);n&&(n.cancelProbe(),n.tabEl.remove(),n.iframe.remove(),e._externalTabs.delete(t),e._activeTabId===t&&me(e,"primary"),e._externalTabs.size===0&&e.element.querySelector(".os-window__tab--main")?.remove(),le(e.element.querySelector(".os-window__tabs")),e._emitChange("state"))}function Ui(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"),pt(e,t)}function zi(e,t){const n=e._externalTabs.get(t);if(!n)return;const{url:o,label:s}=n;pt(e,t),at({message:oe(_(`Opened "%s" in a new browser tab — this site doesn't allow embedding.`),s),action:{label:_("Open"),onClick:()=>{window.open(o,"_blank","noopener")}}}),window.open(o,"_blank","noopener")}function Gi(e){return e._externalTabs.size}function Bi(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 qi(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"?pt(e,a):d==="detach"&&Ui(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){me(e,r);return}if(i==="main"){me(e,"primary");return}if(i==="panel"&&s.dataset.panel){Ye(e.element,s.dataset.panel);return}if(s.dataset.url){const d=s.dataset.url,a=fe(d);me(e,"primary");const c=()=>{e.markContentLoading(),pe(e,d)};a&&e.iframe?ft(e,{commit:c,navigate:()=>{e.iframe&&(e.iframe.src=a)}}):pe(e,d)}}const mt=1;function Vi(e,t){const n=Math.max(0,e.scrollWidth-e.clientWidth);if(n<=mt){delete e.dataset.overflow;return}const o=Math.abs(e.scrollLeft),s=o<=mt,i=o>=n-mt,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 Ki(e){let t=null,n=null;const o=()=>{n===null&&(n=window.requestAnimationFrame(()=>{n=null,t===null&&(t=window.getComputedStyle(e).direction==="rtl"),Vi(e,t),Bt(e),qt(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 ji=k("desktop-mode/native-url-remap",()=>({remaps:[],deps:null}));function Un(e){const{deps:t,remaps:n}=ji.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 Yi=k("desktop-mode/destructive-admin-actions",()=>({entries:[]}));function Xi(e,t){for(const n of Yi.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,Qi=64,Ji=/^[a-z0-9_/-]+$/,B=k("desktop-mode/window-links",()=>({contentByWindow:new Map,focusSeq:new Map,seq:0,listeners:new Set,lastGroupsSignature:"",manager:null,started:!1}));function De(e){return`${e.type}:${e.id}`}function zn(e){return e.root?De(e.root):De(e)}function Gn(e){const t=o=>typeof o=="number"&&Number.isFinite(o)||typeof o=="string"&&o.trim()!=="",n=o=>typeof o=="string"&&Ji.test(o.trim().toLowerCase());return rs(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"},{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 Bn(e){if(!(typeof e!="string"||e===""))try{return new URL(e,window.location.origin).origin===window.location.origin?e:void 0}catch{return}}function er(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,Zi).map(i=>{const r={type:i.type.trim().toLowerCase(),id:i.id};return i.rel==="child"&&(r.rel="child"),r})),typeof e.label=="string"&&e.label!==""&&(n.label=e.label);const o=Bn(e.previewUrl);o&&(n.previewUrl=o);const s=Bn(e.revisionsUrl);return s&&(n.revisionsUrl=s,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,Qi).map(i=>{const r={id:i.id,group:i.group,label:i.label,url:i.url};return typeof i.groupLabel=="string"&&i.groupLabel!==""&&(r.groupLabel=i.groupLabel),typeof i.icon=="string"&&i.icon!==""&&(r.icon=i.icon),typeof i.count=="number"&&(r.count=i.count),r})),n}function qn(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 gt(e){return e?[De(e),zn(e),...(e.links??[]).map(t=>De(t)+(t.rel==="child"?"!child":""))].join("|"):""}function tr(e,t,n={}){const o=n.source??"api";if(typeof e!="string"||e===""){Ze("WindowContentRef",["windowId (must be a non-empty string)"],t);return}let s=null;if(t!=null){const d=Gn(t);if(d.length>0){o==="api"&&Ze("WindowContentRef",d,t),Qt("WindowContentRef",d,t);return}s=er(t,o)}if(s=x(f.WINDOW_LINKS_CONTENT,s,{windowId:e,source:o}),s!==null&&(!s||Gn(s).length>0)){Qt("WindowContentRef",["filter (os.window-links.content returned an invalid ref)"],s);return}const i=B.state.contentByWindow.get(e)??null;if(s===null&&i===null||s!==null&&i!==null&>(s)===gt(i)&&s.label===i.label&&s.previewUrl===i.previewUrl&&s.revisionsUrl===i.revisionsUrl&&s.revisionCount===i.revisionCount&&qn(s)===qn(i))return;s===null?B.state.contentByWindow.delete(e):B.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})),m(f.WINDOW_CONTENT_CHANGED,r),ir(),or()}function nr(){const e=new Map;for(const[s,i]of B.state.contentByWindow){const r=zn(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=B.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=x(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 or(){for(const e of Array.from(B.state.listeners))try{e()}catch(t){typeof console<"u"&&console.error("[openstation] window-links listener threw:",t)}}function sr(){return Array.from(B.state.contentByWindow).map(([e,t])=>`${e}=${gt(t)}`).sort().join(";")}function ir(){const e=sr();if(e===B.state.lastGroupsSignature)return;B.state.lastGroupsSignature=e;const n={groups:nr()};document.dispatchEvent(new CustomEvent("os-window-link-groups-changed",{detail:n})),m(f.WINDOW_LINK_GROUPS_CHANGED,n)}const rr="my-wordpress",ar=Object.freeze({userId:null,userName:"",requestedAt:0});function Vn(){return window.wp?.os}let We=null;function lr(){if(We)return We;const e=Vn()?.createSharedStore;return typeof e!="function"?null:(We=e("desktop-mode/my-wordpress/footprint-target",()=>({...ar})),We)}function cr(e,t=""){const n=lr();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 dr(e){const t=Number(e.userId);!Number.isFinite(t)||t<=0||(cr(t,e.userName??""),Vn()?.openWindow?.(rr,{source:"my-wordpress/open-user-footprint"}))}const M=window.location.origin,_t=k("desktop-mode/admin-link-deps",()=>({deps:null}));function ur(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.setTitle(n.title),n.type==="os-content-identity"&&tr(e.id,n.identity??null,{source:"bridge"}),n.type==="os-window-publish"&&typeof n.channel=="string"&&n.channel!==""&&Pt(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._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(()=>xl).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!==""&&fr(e,n.url,n.target==="new"?"new":"self"),n.type==="os-iframe-other-admin-link"&&typeof n.url=="string"&&n.url!==""&&_t.state.deps?.openOtherAdmin?.(n.url),n.type==="os-iframe-admin-link"&&typeof n.url=="string"&&n.url!==""){const o=_t.state.deps;if(Un(n.url))e.close();else if(o){const s=typeof n.label=="string"?n.label:"";br(e,n.url,s,o,n.newContext===!0)}}if(n.type==="os-open-user-footprint"&&typeof n.userId=="number"&&n.userId>0&&dr({userId:n.userId,userName:typeof n.userName=="string"?n.userName:""}),n.type==="os-notification"&&typeof n.title=="string"&&n.title!==""&&Sr(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)&&Cr(e,n.panels),n.type==="os-screen-meta-state"&&kr(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;Fn(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,s=typeof n.status=="number"?n.status:0;e._markActivitySettled(!o,o?hr(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),m(f.IFRAME_NETWORK_COMPLETED,o)}}}function hr(e){return e<=0?_("Request failed."):oe(_("Request failed (HTTP %d)."),e)}function fr(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 pr=new Set(["trash","untrash","delete","spam","unspam","spamcomment","unspamcomment","trashcomment","untrashcomment","deletecomment","approvecomment","unapprovecomment"]);function mr(e){const t=e.searchParams.get("action");return t&&pr.has(t)&&(e.searchParams.has("_wpnonce")||e.searchParams.has("_wp_nonce"))?!0:Xi(e.toString(),e)!==null}function Kn(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 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 gr(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 _r(e,t,n){if(t===(e.config.baseId||e.id))return!0;const o=gr(e,n);return o!==""&&o===t}function br(e,t,n,o,s=!1){let i;try{i=new URL(t,o.adminUrl)}catch{return}if(i.origin!==M)return;if(s){bt(e,i,n,o);return}const r=i.toString(),d=o.deriveSlug(r),a=_r(e,d,o);if(!a&&mr(i)){const c=Kn(i,e),l=e.iframe?.contentWindow;if(l)try{l.location.assign(c.href)}catch{e.iframe&&(e.iframe.src=c.href)}return}if(a){const c=e.iframe?.contentWindow;if(c)try{c.location.assign(r)}catch{e.iframe&&(e.iframe.src=r)}return}bt(e,i,n,o)}function bt(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),c=Kn(t,e);o.openWindow({id:i,baseId:i,url:c.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 Me(e){if(!e||e.startsWith("#"))return"";try{const t=new URL(e,M);return t.origin!==M?"":t.pathname.split("/").pop()??""}catch{return""}}const wr=new Set(["revision.php"]);function vr(e,t){try{const o=e.iframe?.contentWindow?.performance?.getEntriesByType?.("navigation")?.[0]?.name??"";if(o&&Me(o)===Me(t))return o}catch{}return t}function yr(e,t){const n=Me(e.config.url??"");if(!n||!wr.has(n))return!1;const o=Me(t);if(!o||o===n)return!1;if(Un(t))return e.close(),!0;const s=_t.state.deps;if(!s)return!1;let i;try{i=new URL(vr(e,t),s.adminUrl)}catch{return!1}return i.origin!==M?!1:(bt(e,i,"",s),e.close(),!0)}function Er(e){if(!e.config.titleFromPage)return;let t="";try{t=e.iframe?.contentDocument?.title??""}catch{return}const n=Ar(t);n!==""&&n!==e.config.title&&e.setTitle(n)}function Ar(e){const t=e.trim(),n=t.indexOf(" ‹ ");return(n>0?t.slice(0,n):t).trim()}function Sr(e,t){const n=t!==""?`${e} — ${t}`:e;at({message:n})}function Cr(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},M)}),n.appendChild(r)}}function kr(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 jn=k("desktop-mode/title-bar-buttons-registry",()=>({registry:new Map,listeners:new Set})),Tr=jn.state.registry,wt=jn.state.listeners;function xr(){return Array.from(Tr.values()).sort((e,t)=>(e.order??100)-(t.order??100))}function Ir(e){const t=[],n=[];for(const o of xr()){try{if(!o.match(e))continue}catch{continue}o.placement==="right"?n.push(o):t.push(o)}return{left:t,right:n}}function Lr(e){return wt.add(e),()=>{wt.delete(e)}}function Nr(){const e=Array.from(wt);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"&&Nr()});const Rr=/^dashicons-[a-z0-9-]+$/i,Or=/^\s*<svg[\s>]/i;function Yn(e,t){if(t){if(Rr.test(t)){const n=document.createElement("span");n.className=`dashicons ${t}`,n.setAttribute("aria-hidden","true"),e.appendChild(n);return}if(Or.test(t)){const n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.innerHTML=t,e.appendChild(n);return}e.setAttribute("icon",t)}}const Xn=k("desktop-mode/window-themes-registry",()=>({registry:new Map,listeners:new Set})),Dr=Xn.state.registry,Zn=Xn.state.listeners;function Qn(){return Array.from(Dr.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}function Wr(e){let t=null;for(const n of Qn()){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 Mr(e){return Zn.add(e),()=>{Zn.delete(e)}}const Pe=new WeakMap;function Pr(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=Hr(t.themeId);i&&(n=i.id,o={...i.tokens})}else{const i=Wr(e);i&&(n=i.id,o={...i.tokens})}const s=x(f.WINDOW_CHROME_THEME,o,{windowId:e.id,themeId:n,config:e.config});return{themeId:n,tokens:s}}function vt(e,t){const n=e.element;if(!n)return;const o=Pe.get(n),{themeId:s,tokens:i}=Pr(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(c){m(f.SHELL_ERROR,{scope:"window-theme-apply",windowId:e.id,key:d,error:c})}Pe.set(n,{themeId:s,keys:r}),m(f.WINDOW_CHROME_THEME_CHANGED,{windowId:e.id,themeId:s,tokens:i})}function $r(e){const t=e.element;if(!t)return;const n=Pe.get(t);if(n){for(const o of n.keys)try{t.style.removeProperty(o)}catch{}Pe.delete(t)}}function Hr(e){for(const t of Qn())if(t.id===e)return{id:t.id,tokens:t.tokens};return null}const Jn=k("desktop-mode/window-controls-registry",()=>({registry:new Map,listeners:new Set})),Fr=Jn.state.registry,eo=Jn.state.listeners;function Ur(){return Array.from(Fr.values()).sort((e,t)=>{const n=e.order??100,o=t.order??100;return n!==o?n-o:e.id.localeCompare(t.id)})}function zr(e){const t=[],n=[],o=[];for(const s of Ur()){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 Gr(e){return eo.add(e),()=>{eo.delete(e)}}function Br(e,t){const n=zr(e),o=new Set(t?.hide??[]);let s=n.left.filter(c=>!o.has(c.id)),i=n.right.filter(c=>!o.has(c.id)),r=n.controls.filter(c=>!o.has(c.id));if(t?.custom){for(const c of t.custom){if(o.has(c.id))continue;const l={id:c.id,label:c.label,icon:c.icon,placement:c.placement??"controls",order:c.order??100,match:()=>!0,onClick:c.onClick?(u,p)=>c.onClick(p):void 0,render:c.render?u=>c.render(u):void 0};l.placement==="left"?s.push(l):l.placement==="right"?i.push(l):r.push(l)}s=yt(s),i=yt(i),r=yt(r)}t?.order&&t.order.length>0&&(r=qr(r,t.order));const d=t?.placement??"right",a={windowId:e.id,config:e.config};return s=x(f.WINDOW_CHROME_CONTROLS,s,{...a,placement:"left"}),i=x(f.WINDOW_CHROME_CONTROLS,i,{...a,placement:"right"}),r=x(f.WINDOW_CHROME_CONTROLS,r,{...a,placement:"controls"}),{left:s,right:i,controls:r,placement:d}}function yt(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 qr(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 Vr(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=Kr(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 m(f.SHELL_ERROR,{scope:"window-control-render",id:e.id,windowId:t.id,error:s}),{element:n}}else if(it(n,e.id)||Yn(n,e.icon??""),typeof e.onClick=="function"){const s=i=>{i.stopPropagation();try{e.onClick(t,i)}catch(r){m(f.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 Kr(e){return e.startsWith("core/")?e.slice(5):e.replace(/\//g,"-")}function jr(e,t){const n=[];for(;t.firstChild;)t.removeChild(t.firstChild);const o=Br(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}=Vr(s,e);t.appendChild(i),r&&n.push(r)}return m(f.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"controls"}),()=>{for(const s of n)try{s()}catch{}}}function Yr(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 Xr(e){return typeof e!="string"||e===""||e.length>4096||!/^(https?:\/\/|data:image\/)/i.test(e)?!1:!/['"()\\<>\s]/.test(e)}function to(e,t,n){if(!Xr(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 no="data:image/svg+xml;base64,",$e=new Map;function Zr(e){const t=$e.get(e);if(t!==void 0)return t;let n=!1;try{n=atob(e.slice(no.length)).includes("currentColor")}catch{}return $e.size>=256&&$e.clear(),$e.set(e,n),n}function Qr(e,t){const n=t.className??"",o=t.title??"";let s=null;if(t.slot){const a=Cn(t.slot);a!==null&&(e=a),s=kn(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",to(a,e,s))return a}if(typeof e=="string"&&e.startsWith("data:image/svg+xml;base64,")){const a=e.slice(no.length);if(/^[A-Za-z0-9+/=]+$/.test(a)){const c=document.createElement("span");return c.className=n,c.setAttribute("aria-hidden","true"),c.style.display="inline-block",Zr(e)&&to(c,e,"currentColor")||(c.style.backgroundImage=`url("${e}")`,c.style.backgroundRepeat="no-repeat",c.style.backgroundPosition="center",c.style.backgroundSize="contain"),c}}if(typeof e=="string"&&/^data:image\/(png|jpeg|jpg|gif|webp|x-icon|vnd\.microsoft\.icon);base64,/i.test(e)){const a=e.indexOf(","),c=a>=0?e.slice(a+1):"";if(/^[A-Za-z0-9+/=]+$/.test(c))return oo(e,n)}if(typeof e=="string"&&(e.startsWith("http://")||e.startsWith("https://")))return oo(e,n);const i=document.createElement("span");i.className=`${n} os-icon-letter`.trim(),i.setAttribute("aria-hidden","true");const r=Jr(o);i.textContent=r;const d=Yr(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 oo(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 Jr(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 so=k("desktop-mode/window-slots-registry",()=>({registry:new Map,listeners:new Set})),ea=so.state.registry,io=so.state.listeners;function ta(){return Array.from(ea.values()).sort((e,t)=>{const n=e.order??100,o=t.order??100;return n!==o?n-o:e.id.localeCompare(t.id)})}function na(e,t){const n=[];for(const o of ta())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 oa(e){return io.add(e),()=>{io.delete(e)}}const ro=["before-titlebar","before-icon","icon","title","after-title","before-controls","after-controls","after-titlebar"],ao=new WeakMap;function lo(e,t){return e.querySelector(`[data-slot="${t}"]`)}function sa(e){const t=new Map;for(const n of ro){const o=lo(e,n);o&&t.set(n,Array.from(o.childNodes).map(s=>s.cloneNode(!0)))}return t}function ge(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function ia(e,t){ge(e);for(const n of t)e.appendChild(n.cloneNode(!0))}function ra(e,t){const n=e.querySelector(".os-window__title");n&&(n.textContent=t)}function aa(e){const t=[],n=e.element;if(!n)return()=>{};let o=ao.get(n);o||(o=sa(n),ao.set(n,o));const s=e.config.appearance?.slots??{};for(const i of ro){const r=lo(n,i);if(!r)continue;const d=o.get(i)??[],a=s[i],c=na(e,i);if(a===null)ge(r);else if(a&&"html"in a)ge(r),r.textContent=a.html;else if(a&&"render"in a){a.replace!==!1&&ge(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:i,error:u})}}else ia(r,d),i==="title"&&ra(r,e.config.title);if(a!==null){let l=!1;for(const u of c){u.replace!==!1&&!l&&(ge(r),l=!0);try{const g=u.render(r,{window:e,slot:i});typeof g=="function"&&t.push(g)}catch(g){m(f.SHELL_ERROR,{scope:"window-slot-registry-render",windowId:e.id,slot:i,id:u.id,error:g})}}}x(f.WINDOW_CHROME_SLOT,r,{windowId:e.id,slot:i,config:e.config})}return m(f.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"slots"}),()=>{for(const i of t)try{i()}catch{}}}const co=k("desktop-mode/window-chrome-registry",()=>({registry:new Map,listeners:new Set})),la=co.state.registry,uo=co.state.listeners;function ca(e){return la.get(e.toLowerCase())??null}function da(e){return uo.add(e),()=>{uo.delete(e)}}const He="core/standard",Et="os-window--custom-chrome";function ho(e){const t=e.config.appearance?.chrome??He;return x(f.WINDOW_CHROME_RENDER,t,{windowId:e.id,config:e.config})}function fo(e){return{title:e.config.title,icon:e.config.icon,focused:e.element.classList.contains("os-window--focused"),state:e.state}}function ua(e){const t=ho(e);if(t===He)return null;const n=ca(t);if(!n)return null;try{if(n.match&&!n.match(e))return null}catch{return null}e.element.classList.add(Et);let o;try{o=n.render(e.element,{window:e,state:fo(e)})}catch(s){return e.element.classList.remove(Et),m(f.SHELL_ERROR,{scope:"window-chrome-render",windowId:e.id,chromeId:t,error:s}),null}return m(f.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"chrome",chromeId:t}),{id:t,handle:o}}const po=k("desktop-mode/window-actions-registry",()=>({registry:new Map,listeners:new Set})),ha=po.state.registry,mo=po.state.listeners;function fa(){return Array.from(ha.values()).sort((e,t)=>(e.order??100)-(t.order??100))}function pa(e){return mo.add(e),()=>{mo.delete(e)}}function ma(e,t){if(typeof e.label=="function")try{return String(e.label(t)??"")}catch{return""}return e.label}function ga(e,t){if(typeof e.icon=="function")try{return String(e.icon(t)??"")}catch{return""}return e.icon??""}function _a(e,t){if(!e.checkable||typeof e.checked!="function")return!1;try{return!!e.checked(t)}catch{return!1}}function ba(e,t){if(typeof e.isVisible!="function")return!0;try{return!!e.isVisible(t)}catch{return!1}}function go(e){const t=e.element.querySelector(".os-window__menu-panel");t&&(t.hidden?_o(e):q(e))}function _o(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&&At(e,o),wo(e,t),e._unsubscribeWindowActions?.(),e._unsubscribeWindowActions=pa(()=>{t.hidden||wo(e,t)}),m(f.WINDOW_MENU_OPENED,{windowId:e.id,element:t}),e._boundOnDocumentPointerDown||(e._boundOnDocumentPointerDown=i=>{const r=i.target;r&&(t.contains(r)||n.contains(r)||q(e))}),setTimeout(()=>{e._boundOnDocumentPointerDown&&document.addEventListener("pointerdown",e._boundOnDocumentPointerDown,!0)},0),t.querySelector('[role="menuitem"]')?.focus()}function q(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 bo(e){e.hasAttribute("checked")?e.removeAttribute("checked"):e.setAttribute("checked","")}function At(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=Y(e.getCurrentUrl()),i=Y(n.url);o=s===i}catch{o=!1}o?t.setAttribute("checked",""):t.removeAttribute("checked")}function wo(e,t){for(const n of Array.from(t.querySelectorAll(".os-window__menu-item--action")))n.remove();for(const n of fa()){if(!ba(n,e))continue;const o=ma(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"),_a(n,e)&&s.setAttribute("checked","");else{s.setAttribute("role","menuitem");const r=ga(n,e);r&&s.setAttribute("icon",r)}const i=n.closeOnSelect??!n.checkable;s.addEventListener("os-menu-item-click",r=>{r.stopPropagation(),n.checkable&&bo(s),i&&q(e);try{n.onSelect(e)}catch(d){typeof console<"u"&&console.error(`[openstation] window action "${n.id}" threw:`,d)}}),t.appendChild(s)}}const wa=Object.freeze({top:0,right:0,bottom:0,left:0});function va(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 ya="os/work-area";function Ea(){return{insets:{...wa},rect:{x:0,y:0,width:0,height:0},viewport:{x:0,y:0,width:0,height:0},area:{width:0,height:0}}}const St=k(ya,()=>({snapshot:Ea(),installed:!1,areaEl:null}));function Aa(e){const t=e??St.state.areaEl;if(!t)return{...St.state.snapshot.rect};const n=t.clientWidth||t.getBoundingClientRect().width,o=t.clientHeight||t.getBoundingClientRect().height;return va(n,o,St.state.snapshot.insets)}const Sa={minDurationMs:1e3,minReversals:5,minAmplitudePx:14,maxGapMs:320,cooldownMs:600},Ca="os-pointer-shake";function ka(e={}){const t={...Sa,...e};let n={origin:0,dir:0,extent:0},o={origin:0,dir:0,extent:0},s=[],i=!1,r=-1/0;const d=()=>{n={origin:0,dir:0,extent:0},o={origin:0,dir:0,extent:0},s=[],i=!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(!i)return i=!0,n.origin=l,o.origin=u,null;const g=s[s.length-1];g&&p-g.t>t.maxGapMs&&(s=[]);const b=a(n,l),v=a(o,u);if(b&&s.push({t:p,axis:"x"}),v&&s.push({t:p,axis:"y"}),!b&&!v||s.length<t.minReversals)return null;const w=p-s[0].t;if(w<t.minDurationMs)return null;let S=0;for(const C of s)C.axis==="x"&&S++;const E={x:l,y:u,durationMs:w,reversals:s.length,axis:S*2>=s.length?"x":"y"};return d(),r=p+t.cooldownMs,E},reset:d}}function Ta(e,t){e.dispatchEvent(new CustomEvent(Ca,{detail:t,bubbles:!0,composed:!0}))}function vo(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 xa(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")||Ht())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,c=i?Ia(e,t):null;e._titleBar.setPointerCapture(a);const l=e.snapConfigProvider?.()??{enabled:!1,cellWidth:0,cellHeight:0},u=vo(e,"drag"),p=ka();let g=!1,b=r,v=d;const w=(h,y,I)=>{h===g||!e._isDragging||(g=h,e.onDragGesture?.(e,{type:"modifier",active:h,clientX:y,clientY:I}))},S=h=>{h.key==="Alt"&&(h.preventDefault(),w(h.type==="keydown",b,v))};let E=!1;const C=(h,y)=>{if(E)return;E=!0;let I,F;if(c){const P=La(e,c,h,y);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=y-F,window.addEventListener("keydown",S),window.addEventListener("keyup",S),m(f.WINDOW_DRAG_START,{windowId:e.id})};i||C(r,d);const N=h=>{if(!E){const j=h.clientX-r,Ce=h.clientY-d;if(j*j+Ce*Ce<wi)return;C(h.clientX,h.clientY)}if(!e._isDragging)return;let y=h.clientX-e._dragOffsetX,I=h.clientY-e._dragOffsetY;const F=e.element.parentElement;if(F){const j=Oa(y,I,e.element.offsetWidth,{x:0,y:0,width:F.clientWidth,height:F.clientHeight});y=j.x,I=j.y}l.enabled&&(y=Math.round(y/l.cellWidth)*l.cellWidth,I=Math.round(I/l.cellHeight)*l.cellHeight),e.element.style.left=`${y}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&&(Ta(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{}},Se=()=>{e._titleBar.removeEventListener("pointermove",N),e._titleBar.removeEventListener("pointerup",K),e._titleBar.removeEventListener("pointercancel",K),e._titleBar.removeEventListener("lostpointercapture",K),window.removeEventListener("keydown",S),window.removeEventListener("keyup",S),p.reset()},K=()=>{if(!E){D(),Se();return}if(!e._isDragging||(e._isDragging=!1,e.element.classList.remove("os-window--dragging"),e.element.classList.remove("os-window--snap-drag"),D(),Se(),e.onDragEnd?.(e)??!1))return;e._gridSpan=null,e._emitChange("moved");const y={windowId:e.id,x:e.element.offsetLeft,y:e.element.offsetTop};m(f.WINDOW_DRAG_END,y),m(f.WINDOW_MOVED,y)};e._titleBar.addEventListener("pointermove",N),e._titleBar.addEventListener("pointerup",K),e._titleBar.addEventListener("pointercancel",K),e._titleBar.addEventListener("lostpointercapture",K)}function Ia(e,t){const n=e._titleBar.getBoundingClientRect(),o=n.width>0?(t.clientX-n.left)/n.width:.5,s=e.element.parentElement,i=s?Aa(s):null,r=i?Math.min(960,Math.round(i.width*.6)):640,d=i?Math.min(640,Math.round(i.height*.7)):480,a=e._savedGeometry?.width??r,c=e._savedGeometry?.height??d,l=s?.getBoundingClientRect();return{isMaximized:e.state==="maximized",cursorRatioX:o,titleBarHeight:n.height,areaLeft:l?.left??0,areaTop:l?.top??0,targetW:a,targetH:c}}function La(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(G,Math.round(n-t.areaLeft-t.targetW*t.cursorRatioX)),i=Math.max(G,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&&m(f.WINDOW_UNMAXIMIZED,{windowId:e.id}),{left:s,top:i}}function Na(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"),m(f.WINDOW_RESIZE_START,{windowId:e.id});const r=vo(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=l=>{if(!e._isResizing)return;const u=l.clientX-e._resizeStartX,p=l.clientY-e._resizeStartY,g=Ra(o,u,p,s,i,e._resizeStartW,e._resizeStartH,e.config.minWidth,e.config.minHeight,d);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()},c=()=>{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",c),n.removeEventListener("pointercancel",c),n.removeEventListener("lostpointercapture",c),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",c),n.addEventListener("pointercancel",c),n.addEventListener("lostpointercapture",c)}function Ra(e,t,n,o,s,i,r,d,a,c){let l=i,u=r,p=o,g=s;if((e==="ne"||e==="se")&&(l=Math.max(d,i+t)),e==="nw"||e==="sw"){const b=Math.max(d,i-t);p=o+(i-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=s+(r-b),u=b}if(c.enabled){const b=Math.max(d,Math.round(l/c.cellWidth)*c.cellWidth),v=Math.max(a,Math.round(u/c.cellHeight)*c.cellHeight);(e==="nw"||e==="sw")&&(p=o+(l-b)),(e==="nw"||e==="ne")&&(g=s+(u-v)),l=b,u=v}if(p<G){const b=G-p;p=G,l=Math.max(d,l-b)}if(g<G){const b=G-g;g=G,u=Math.max(a,u-b)}return{x:p,y:g,width:l,height:u}}function Oa(e,t,n,o){const s=o.x+dt-n,i=o.x+o.width-dt,r=Math.max(s,Math.min(e,i)),d=o.y+G,a=o.y+o.height-dt,c=Math.max(d,Math.min(t,a));return{x:r,y:c}}const Da="os-speculate-doc",yo=new Map,Wa=1e3;function Ma(e){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker.controller)return;let t;try{const s=new URL(e,window.location.href);if(s.origin!==window.location.origin)return;t=s.toString()}catch{return}const n=Date.now(),o=yo.get(t);if(!(o!==void 0&&n-o<Wa)){yo.set(t,n);try{navigator.serviceWorker.controller.postMessage({type:Da,url:t})}catch{}}}const Ct=window.location.origin,Pa="os-window-open",$a=300;function Ha(e){if(!window.wp?.os?.getOsSettings?.().windowPrewarmEnabled)return;const n=fe(e);n&&Ma(n)}const Fa=120,ae=class ae{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._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._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=He,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=Pi(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=>ur(this,n),this.bindEvents(),this.iframe&&this._wireContentFocusForwarder(this.iframe),this.renderCustomTitleBarButtons(),this._titleBarButtonsUnsubscribe=Lr(()=>{this.renderCustomTitleBarButtons()}),vt(this,this.config.appearance?.theme),this._windowThemesUnsubscribe=Mr(()=>{this._isDestroyed||vt(this,this.config.appearance?.theme)}),this.repaintWindowControls(),this._windowControlsUnsubscribe=Gr(()=>{this._isDestroyed||this.repaintWindowControls()}),this.repaintWindowSlots(),this._windowSlotsUnsubscribe=oa(()=>{this._isDestroyed||this.repaintWindowSlots()}),this.remountWindowChrome(),this._windowChromesUnsubscribe=da(()=>{if(this._isDestroyed)return;ho(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()},$a),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=x(f.NATIVE_WINDOW_BEFORE_RENDER,t,{windowId:this.id,config:this.config}),o=n instanceof HTMLElement?n:t,{ctx:s,dispose:i}=Zo(this.id,this.config.params??{});this._nativeRenderCtxDispose=i;const r=this.config.render(o,s),d=c=>{typeof c=="function"&&(this._nativeRenderTeardown=c)};r instanceof Promise?r.then(c=>{this._isDestroyed||(d(c),$(this.id))},c=>{typeof console<"u"&&console.error(`[openstation] native render rejected for "${this.id}":`,c),m(f.SHELL_ERROR,{scope:"window-open",id:this.id,error:c}),!this._isDestroyed&&$(this.id)}):(d(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),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=>xa(this,i)),this.element.querySelectorAll(".os-window__resize-handle").forEach(i=>{i.addEventListener("pointerdown",r=>Na(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(),go(this)});const i=o.querySelector(".os-window__menu-item--open-another");i&&i.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),q(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(),q(this),this.onOpenInNewWindow?.(this)});const d=o.querySelector(".os-window__menu-item--reload");d&&d.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),q(this),this.reload()});const a=o.querySelector(".os-window__menu-item--open-external");a&&a.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),q(this),this.detach()});const c=o.querySelector(".os-window__menu-item--startup");c&&(At(this,c),c.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),bo(c),this.onToggleStartup?.(this)}),document.addEventListener("os-default-window-changed",()=>{At(this,c)})),o.addEventListener("keydown",l=>{l.key==="Escape"&&(l.stopPropagation(),q(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')||Ht()||this.toggleMaximize()});const s=this.element.querySelector(".os-window__tabs");if(s&&(s.addEventListener("click",i=>qi(this,i)),s.addEventListener("keydown",i=>jo(s,i)),s.addEventListener("pointerover",i=>{const r=i;if(r.pointerType!=="mouse")return;const d=r.target?.closest?.(".os-window__tab[data-url]"),a=d?.dataset.url;a&&(d?.classList.contains("is-active")||(this._tabSpeculateTimer&&window.clearTimeout(this._tabSpeculateTimer),this._tabSpeculateTimer=window.setTimeout(()=>{this._tabSpeculateTimer=null,Ha(a)},Fa)))}),s.addEventListener("pointerleave",()=>{this._tabSpeculateTimer&&(window.clearTimeout(this._tabSpeculateTimer),this._tabSpeculateTimer=null)}),this._tabOverflowTeardown=Ki(s)),this.iframe){const i=this.iframe;this._wireTabNavSync(i),window.addEventListener("message",this._boundOnMessage)}}addExternalTab(t,n){Fn(this,t,n)}setTabs(t,n){Yo(this.element,t,n)}activateTab(t){Ye(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=jr(this,t)}}repaintThemedChrome(){const t=this.element.querySelector(".os-window__slot--icon");if(t){const o=t.querySelector(".os-window__icon");o&&o.replaceWith(Qr(this.config.icon,{title:this.config.title,className:"os-window__icon",slot:Ks(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"),it(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=aa(this)}remountWindowChrome(){if(this._chromeHandle){try{this._chromeHandle.destroy()}catch{}this._chromeHandle=null}this.element.classList.remove(Et);const t=ua(this);t?(this._chromeHandle=t.handle,this._chromeId=t.id):this._chromeId=He}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(fo(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},vt(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"),m(f.WINDOW_MINIMIZED,{windowId:this.id,element:this.element}),this._stateBeforeMinimize==="fullscreen"&&re())}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"&&(re(),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;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"),m(f.WINDOW_UNMAXIMIZED,{windowId:this.id,element:this.element});return}if(this.state==="fullscreen"){this._savedFullscreenState=null,this._applyMaximizeVisuals(),this.state="maximized",re(),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";re(),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",re(),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,Ct)}catch{return}n.origin===Ct&&(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 s=()=>{this.markContentLoading()},i=()=>{o(),m(f.WINDOW_RELOADED,{windowId:this.id,url:n})};this._activeTabId==="primary"?ft(this,{commit:s,navigate:i}):(s(),i())}_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=fe(t);return n?(ft(this,{commit:()=>{this.markContentLoading(),pe(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||yr(this,n))return;Er(this),pe(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?fe(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,$(this.id),ct(s),s.addEventListener("load",()=>{$(this.id),ct(s)}),this._wireContentFocusForwarder(s),this._wireTabNavSync(s),pe(this,n),m(f.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}=Ir(this),i=(r,d)=>{for(const a of d){const c=document.createElement("os-window-button");if(Yn(c,a.icon),c.setAttribute("aria-label",a.label),c.setAttribute("title",a.label),c.classList.add("os-window__btn"),c.classList.add("os-window__btn--custom"),c.dataset.buttonId=a.id,r.appendChild(c),typeof a.render=="function")try{a.render(c,this)}catch(l){typeof console<"u"&&console.error("[openstation] title-bar-button render threw:",a.id,l)}else typeof a.onClick=="function"&&c.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)}})}};i(t,o),i(n,s)}send(t,n){if(typeof t!="string"||t==="")return;const o=this.iframe??Bo(this.id);if(!o){Fo(this.id,t,n);return}const s=()=>{try{o.contentWindow?.postMessage({type:"os-window-send",channel:t,payload:n},Ct)}catch(i){typeof console<"u"&&console.error("[openstation] Window.send: postMessage failed",i)}};if($t(this.id)){s();return}Uo(this.id,t,n,s)}on(t,n){return typeof t!="string"||t===""||typeof n!="function"?()=>{}:$o(this.id,t,n)}markContentLoading(){Ie(this.id)}markContentLoaded(){$(this.id)}whenContentReady(){return $t(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()}_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()},ae.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,s=ae.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 _("Saved");case"failed":return this._activityError?oe(_("Not saved. %s"),this._activityError):_("Not saved.");default:return""}}requestAttention(t,n={}){const o=Ke.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=x("os.window.attention",s,{windowId:this.id,opts:i}),d=window.wp,a=d?.os?.dock,c=d?.os?.taskbar;let l=!1;if(typeof a?.setAttention=="function"&&(a.setAttention(this.id,r,i),l=!0),typeof c?.setAttention=="function"&&(c.setAttention(this.id,r,i),l=!0),!l&&r!==null){this.setHighlight("persistent");const u=i.durationMs??4e3;u>0&&window.setTimeout(()=>{this.setHighlight(null)},u)}else!l&&r===null&&this.setHighlight(null)}shake(){if(x("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(x(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,zo(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._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($r(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(),re()}}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){m(f.SHELL_ERROR,{scope:"native-window-resize",id:this.id,error:a})}m(f.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 Gi(this)}getExternalTabsSnapshot(){return Bi(this)}toggleActionsMenu(){go(this)}closeActionsMenu(){q(this)}openActionsMenu(){_o(this)}};ae.NAVIGATION_ACTIVITY_TIMEOUT_MS=3e4,ae.MIN_SAVING_DISPLAY_MS=1200;let kt=ae;function A(e,...t){return{__wpdHtml:!0,strings:e,values:t}}function Ua(e){return!!e&&e.__wpdHtml===!0}const za="$$wpd$$",L=/\$\$wpd\$\$(\d+)\$\$/g,Ga="$$wpd-node$$",Ba=/^\$\$wpd-node\$\$(\d+)\$\$$/,qa=new Set(["style","script","textarea","title"]);function Va(e){let t="",n=!1,o=null,s=!1,i=null,r="",d=!1;for(let a=0;a<e.length;a++){const c=e[a];t+=c;for(let l=0;l<c.length;l++){const u=c[l];if(s){c.startsWith("-->",l)&&(s=!1,l+=2);continue}if(i!==null){u==="<"&&c[l+1]==="/"&&c.slice(l+2,l+2+i.length).toLowerCase()===i&&(l+=1+i.length,i=null,n=!0,d=!1,r="");continue}if(o!==null){u===o&&(o=null);continue}if(n){u==='"'||u==="'"?(o=u,d=!1):u===">"?(n=!1,d=!1,qa.has(r)&&(i=r),r=""):d&&(/[a-zA-Z0-9-]/.test(u)?r+=u.toLowerCase():d=!1);continue}if(c.startsWith("<!--",l)){s=!0,l+=3;continue}const p=c[l+1]??"";u==="<"&&/[a-zA-Z/!]/.test(p)&&(n=!0,r="",d=/[a-zA-Z]/.test(p))}a<e.length-1&&(t+=n||s||i!==null?`${za}${a}$$`:`<!--${Ga}${a}$$-->`)}return t}const Eo=new WeakMap;function Ao(e){const t=Eo.get(e);if(t)return t;const n=document.createElement("template");n.innerHTML=Va(e);const o=[],s=(d,a)=>{if(d.nodeType===Node.ELEMENT_NODE){const u=d;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 E=0,C;for(L.lastIndex=0;(C=L.exec(b))!==null;)w.push(b.slice(E,C.index)),S.push(Number(C[1])),E=C.index+C[0].length;w.push(b.slice(E)),o.push({path:a,kind:"attr",name:g,template:w,valueIndices:S}),u.setAttribute(g,"")}}}const c=Array.from(d.childNodes);let l=0;for(let u=0;u<c.length;u++){const p=c[u],g=u+l;if(p.nodeType===Node.COMMENT_NODE){const b=Ba.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 E=[],C=[];for(L.lastIndex=0;(S=L.exec(b))!==null;){S.index>w&&E.push(document.createTextNode(b.slice(w,S.index)));const N=document.createTextNode("");E.push(N),C.push({path:[...a,g+E.length-1],kind:"node",valueIndex:Number(S[1])}),w=S.index+S[0].length}w<b.length&&E.push(document.createTextNode(b.slice(w)));for(const N of E)v.insertBefore(N,p);v.removeChild(p),l+=E.length-1,o.push(...C)}else s(p,[...a,g])}};s(n.content,[]);const r={template:n,buildParts:d=>{const a=[];for(const c of o){let l=d;for(const u of c.path)l=l.childNodes[u];c.kind==="node"?a.push({kind:"node",valueIndex:c.valueIndex,child:{anchor:l,state:null}}):c.kind==="attr"?a.push({kind:"attr",element:l,name:c.name,template:c.template,valueIndices:c.valueIndices}):c.kind==="event"?a.push({kind:"event",valueIndex:c.valueIndex,element:l,name:c.name}):c.kind==="prop"?a.push({kind:"prop",valueIndex:c.valueIndex,element:l,name:c.name}):c.kind==="bool"&&a.push({kind:"bool",valueIndex:c.valueIndex,element:l,name:c.name})}return a}};return Eo.set(e,r),r}const So=new WeakMap;function Ka(e,t){for(const n of e.nodes)if(n.parentNode!==t)return!1;return!0}function ja(e,t){const n=So.get(t);if(n&&n.strings===e.strings&&Ka(n,t)){Fe(n.parts,e.values);return}const o=Ao(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),Fe(i,e.values),So.set(t,{strings:e.strings,parts:i,nodes:r})}function Fe(e,t){for(const n of e)if(n.kind==="node")Ue(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+=Co(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 Ue(e,t){if(t==null||t===!1){e.state&&(ee(e.state),e.state=null);return}if(Array.isArray(t)){Qa(e,t);return}if(Ua(t)){Za(e,t);return}if(t instanceof Node){Ya(e,t);return}Xa(e,Co(t))}function Ya(e,t){const n=e.state;n?.shape==="node"&&n.node===t||(n&&ee(n),_e(e,[t]),e.state={shape:"node",node:t})}function Xa(e,t){const n=e.state;if(n?.shape==="text"){n.text!==t&&(n.node.textContent=t,n.text=t);return}n&&ee(n);const o=document.createTextNode(t);_e(e,[o]),e.state={shape:"text",node:o,text:t}}function Za(e,t){const n=e.state;if(n?.shape==="template"&&n.strings===t.strings){Fe(n.parts,t.values);return}n&&ee(n);const o=Ao(t.strings),s=o.template.content.cloneNode(!0),i=o.buildParts(s),r=Array.from(s.childNodes);_e(e,[s]),Fe(i,t.values),e.state={shape:"template",strings:t.strings,parts:i,nodes:r}}function Qa(e,t){const n=e.state;if(n?.shape==="array"){const s=Math.min(n.entries.length,t.length);for(let i=0;i<s;i++)Ue(n.entries[i],t[i]);if(t.length<n.entries.length){for(let i=t.length;i<n.entries.length;i++){const r=n.entries[i];r.state&&ee(r.state),r.anchor.remove()}n.entries.length=t.length}else for(let i=n.entries.length;i<t.length;i++){const r=document.createTextNode("");_e(e,[r]);const d={anchor:r,state:null};Ue(d,t[i]),n.entries.push(d)}return}n&&ee(n);const o=[];for(const s of t){const i=document.createTextNode("");_e(e,[i]);const r={anchor:i,state:null};Ue(r,s),o.push(r)}e.state={shape:"array",entries:o}}function _e(e,t){const n=e.anchor.parentNode;if(n)for(const o of t)n.insertBefore(o,e.anchor)}function ee(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&&(ee(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&&ee(t.state),t.anchor.remove()}function Co(e){return e==null||e===!1?"":String(e)}const te=class te 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(ko)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(t,n,o){if(n===o)return;const s=Ja(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=ko(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&&ja(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(!te._lightStylesAdopted.has(t)){te._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)}}}};te.props=[],te.styles=[],te.shadow=!0,te._lightStylesAdopted=new WeakSet;let V=te;function ne(e,t){customElements.get(e)||customElements.define(e,t)}function ko(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Ja(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}const el=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function T(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(el){const o=new CSSStyleSheet;return o.replaceSync(n),{__wpdCss:!0,sheet:o,cssText:n}}return{__wpdCss:!0,sheet:null,cssText:n}}const tl=T`: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}`,nl={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 ol(e){const t=(e??"").trim();return t===""||t.length>4096||!/^(https?:\/\/|data:image\/)/i.test(t)||/['"()\\<>\s]/.test(t)?"":t}const be=class be extends V{constructor(){super(...arguments),this._activateWired=!1}static get observedAttributes(){return[...super.observedAttributes,"aria-label"]}render(){const t=ol(this["icon-src"]||this.getAttribute("icon-src")||""),n=t?"":this.icon||"",o=nl[n]||"",s=this.getAttribute("aria-label")||"";return t?A` | |
| 2 | - <button type="button" aria-label="${s}"> | |
| 1 | +(function(){"use strict";function xe(){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 Mt(e,t,n,o){xe().addAction(e,t,n,o)}function Pt(e,t){return xe().removeAction(e,t)}function T(e,t,...n){return xe().applyFilters(e,t,...n)}function m(e,...t){xe().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"},Po="os.activity.";function Ve(e){return Po+String(e).replace(/[^a-zA-Z0-9_.-]/g,".")}let $o=0;const Ke={publish(e,t){m(Ve(e),t)},subscribe(e,t){const n=`os/activity-sub/${++$o}`,o=Ve(e);Mt(o,n,s=>t(s));let i=!1;return()=>{i||(i=!0,Pt(o,n))}},filter(e,t,...n){return T(Ve(e),t,...n)}},$t="__openStationSharedStores";function zo(){const e=window;let t=e[$t];return t||(t=new Map,e[$t]=t),t}function k(e,t){const n=zo();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 d=r;for(const a of Object.keys(d))delete d[a];Object.assign(d,s)}else o.state=s;o.listeners.clear()}};return i}const G=k("desktop-mode/window-channels",()=>({parentSubs:new Map,nativeSubs:new Map,readyWindows:new Set,loadingWindows:new Set,pendingSends:new Map}));function Te(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 zt(e,t,n,o){const i={channel:n,windowId:t},s=Te(e,t,n,!1);if(s)for(const d of Array.from(s))try{d(o,i)}catch(a){typeof console<"u"&&console.error(`[openstation] window-channel subscriber for "${n}" threw:`,a)}const r=Te(e,t,"*",!1);if(r)for(const d of Array.from(r))try{d(o,i)}catch(a){typeof console<"u"&&console.error(`[openstation] window-channel wildcard subscriber for "${t}" threw:`,a)}}function Ho(e,t,n){const o=Te(G.state.parentSubs,e,t,!0);o.add(n);let i=!1;return()=>{i||(i=!0,o.delete(n))}}function Ht(e,t,n){zt(G.state.parentSubs,e,t,n)}function Fo(e,t,n){const o=Te(G.state.nativeSubs,e,t,!0);o.add(n);let i=!1;return()=>{i||(i=!0,o.delete(n))}}function Uo(e,t,n){zt(G.state.nativeSubs,e,t,n)}function Ft(e){return G.state.readyWindows.has(e)}function Ie(e){const{loadingWindows:t}=G.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}=G.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 Go(e,t,n,o){const{pendingSends:i}=G.state;let s=i.get(e);s||(s=[],i.set(e,s)),s.push({channel:t,payload:n,flush:o})}function Bo(e){const t=G.state;t.parentSubs.delete(e),t.nativeSubs.delete(e),t.readyWindows.delete(e),t.loadingWindows.delete(e),t.pendingSends.delete(e)}const qo=k("desktop-mode/connection",()=>({connSeq:0,connections:new Map,connectionsByTarget:new Map,syntheticIframes:new Map}));function Vo(e){return qo.state.syntheticIframes.get(e)??null}const Ko="data-os-mode";function Ut(e=typeof document<"u"?document.documentElement:null){return!!e&&e.getAttribute(Ko)==="mobile"}const jo=Object.freeze({top:0,right:0,bottom:0,left:0});function Yo(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 Xo="os/work-area";function Zo(){return{insets:{...jo},rect:{x:0,y:0,width:0,height:0},viewport:{x:0,y:0,width:0,height:0},area:{width:0,height:0}}}const je=k(Xo,()=>({snapshot:Zo(),installed:!1,areaEl:null}));function Ye(e){const t=e??je.state.areaEl;if(!t)return{...je.state.snapshot.rect};const n=t.clientWidth||t.getBoundingClientRect().width,o=t.clientHeight||t.getBoundingClientRect().height;return Yo(n,o,je.state.snapshot.insets)}const Qo="desktop-mode";function Gt(){return window.wp?.i18n}function _(e,t=Qo){return Gt()?.__(e,t)??e}function ie(e,...t){const n=Gt()?.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]??"")})}const Jo="openstation";function ei(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")===Jo}const Bt="os_tab",ti=k("desktop-mode/native-url-remap",()=>({remaps:[],deps:null}));function Xe(e,t={}){const{deps:n,remaps:o}=ti.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 d;const a=i.searchParams.get(Bt);if(r.params)try{d=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)&&(d={...d??{},tab:a});const c=t.newInstance&&n.openNewById?n.openNewById:n.openById;if(d?c(r.nativeWindowId,{params:d}):c(r.nativeWindowId))return!0}return!1}const ni="os-window-tab-change";function Ze(e){return Array.from(e.querySelectorAll(".os-window__tab"))}function qt(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function Vt(e,t){return`${e.id||"os-window"}-tab-${qt(t)}`}function Kt(e,t){return`${e.id||"os-window"}-panel-${qt(t)}`}function jt(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 le(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 Yt(e){const t=Ze(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 oi(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=Ze(e),r=s.indexOf(i);if(r<0)return;const d=getComputedStyle(e).direction==="rtl";let a;switch(n.key){case"ArrowRight":a=s[d?r-1:r+1];break;case"ArrowLeft":a=s[d?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 Xt(e){const t=new Map;for(const n of Ze(e))n.dataset.kind==="panel"&&n.dataset.panel&&t.set(n.dataset.panel,n);return t}function Zt(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 Qe(e,t){const n=e.querySelector(".os-window__tabs");if(!n)return;let o=!1;for(const[i,s]of Xt(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 Zt(e)){const s=i.getAttribute("for")===t;i.toggleAttribute("hidden",!s),i.setAttribute("aria-hidden",s?"false":"true")}Yt(n),jt(n),e.dispatchEvent(new CustomEvent(ni,{bubbles:!0,detail:{value:t}}))}}function ii(e,t,n){const o=e.querySelector(".os-window__tabs");if(!o)return;const i=Xt(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=Vt(e,l.value),u.setAttribute("aria-controls",Kt(e,l.value)),u.previousElementSibling!==r&&o.insertBefore(u,r?r.nextSibling:o.firstChild),r=u}for(const l of i.values())l.remove();le(o);const d=o.querySelector(":scope > .os-window__tab")!==null;for(const l of Zt(e)){const u=l.getAttribute("for");u&&(l.id=Kt(e,u),d?l.setAttribute("aria-labelledby",Vt(e,u)):l.removeAttribute("aria-labelledby"))}const a=l=>l!==void 0&&t.some(u=>u.value===l),c=[n,s,t[0]?.value].find(a);c!==void 0&&Qe(e,c)}let si=0;function ri(e,t={}){const n=++si,o=l=>`desktop-mode/native-render-ctx/${e}/${n}/${l}`,i=new AbortController,s=[],r=(l,u,p,g)=>{const b=o(u);Mt(l,b,w=>{p(w)&&g(w)});const y=()=>{Pt(l,b)};return s.push(y),y},d=l=>!!l&&typeof l=="object"&&l.windowId===e;return{ctx:{window:{send(l,u){typeof l!="string"||l===""||Ht(e,l,u)},on(l,u){return typeof l!="string"||l===""||typeof u!="function"?()=>{}:Fo(e,l,u)},markLoading(){Ie(e)},markReady(){$(e)}},markLoading(){Ie(e)},markReady(){$(e)},signal:i.signal,onResize(l){return typeof l!="function"?()=>{}:r(f.WINDOW_BODY_RESIZED,"on-resize",d,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",d,()=>{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",d,()=>{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 Qt=["post_type","page","taxonomy","path","post","c","tag_ID","item","p"].filter(e=>e!=="p"),Je=[];function ai(e){if(!e.pathname.endsWith("/admin.php")||!e.searchParams.get("page"))return Je;const t=e.searchParams.get("action");return t==="edit"&&e.searchParams.get("id")?["id"]:t==="new"?["action"]:Je}function Jt(e){try{const t=new URL(e,window.location.origin),n=new URLSearchParams,o=[...Qt,...ai(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 Y(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 en="X-WP-Nonce";function li(e,t){const n=ci();if(!n)return t;const o=di(e);if(!o||!ui(o))return t;const i=t?.headers??(typeof Request<"u"&&e instanceof Request?e.headers:void 0),s=new Headers(i??{});return s.has(en)?t:(s.set(en,n),{...t??{},headers:s})}function ci(){if(typeof window>"u")return;const t=window.openStationConfig?.restNonce;return typeof t=="string"&&t.length>0?t:void 0}function di(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 ui(e){return typeof window>"u"||!window.location||e.origin!==window.location.origin?!1:!!(e.pathname.includes("/wp-json/")||e.searchParams.has("rest_route"))}function hi(e,t,n={}){const o=window.wp?.os?.fetch;if(typeof o=="function")return o(e,t,n);const i=li(e,t);return fetch(e,i)}const tn=k("desktop-mode/dock-rail-registry",()=>({registry:new Map,listeners:new Set,activeId:"default"}));tn.state.registry,tn.state.listeners;function fi(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 pi 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 et(e,t,n){if(t.length!==0)throw new pi(e,t,n)}function nn(e,t,n){typeof console>"u"||console.warn(`[openstation] ${e} registration rejected — fields: `+t.join(", ")+".",n)}const X=[[0,0],[100,0],[100,100],[0,100]],mi=48,gi=80,tt=6,nt=8,on=4,sn=3,rn=64,ot=105,Z=2;function an(e){return`${Math.round(e*1e3)/1e3}%`}function Q(e){return e.slice().reverse()}function ce(e,t,n,o){return[[e,t],[n,t],[n,o],[e,o]]}function _i(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 z(e,t=[]){const n=[],o=i=>{n.push(`${an(i[0])} ${an(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 ln(e){return z(X,[Q(_i(50,50,e,mi))])}function cn(e){return z(X,[Q(ce(50-e,-Z,50+e,100+Z))])}function dn(e){const t=100/tt,n=[];for(let o=0;o<tt;o++){const i=o*t;n.push(Q(ce(-Z,i,100+Z,i+e)))}return z(X,n)}function un(e){return z(X,[Q(ce(-Z,50-e,100+Z,50+e))])}function hn(e){const t=100/nt,n=[];for(let o=0;o<nt;o++){const i=o*t;n.push(Q(ce(i,-Z,i+e,100+Z)))}return z(X,n)}function fn(e){return z(X,[Q([[50,50-e],[50+e,50],[50,50+e],[50-e,50]])])}function pn(e){const t=100/on,n=100/sn,o=[];for(let i=0;i<sn;i++)for(let s=0;s<on;s++){const r=s*t+t/2,d=i*n+n/2,a=t/2*e,c=n/2*e;o.push(Q(ce(r-a,d-c,r+a,d+c)))}return z(X,o)}function mn(e){const t=-Math.PI/2,n=e/180*Math.PI,o=[[50,50]];for(let i=0;i<rn;i++){const s=t+i/(rn-1)*n;o.push([50+Math.cos(s)*ot,50+Math.sin(s)*ot])}return z(X,[Q(o)])}function bi(){return{from:ln(0),to:ln(gi)}}function wi(){return{from:cn(0),to:cn(52)}}function yi(){return{from:dn(0),to:dn(100/tt+.5)}}function vi(){return{from:un(0),to:un(52)}}function Ei(){return{from:hn(0),to:hn(100/nt+.5)}}function Ai(){return{from:fn(0),to:fn(ot)}}function Si(){return{from:pn(0),to:pn(1.04)}}function Ci(){return{from:mn(0),to:mn(360)}}function ki(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 100% 0% )"}}function xi(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 0% 100% )"}}function Ti(){return{from:z([[-60,0],[100,0],[100,100],[0,100]]),to:z([[100,0],[260,0],[260,100],[160,100]])}}const it=6,st=100,se=st/2,Le=200,gn=90,_n=["#5c5c6d","#525261","#484855","#3e3e49","#34343d","#2a2a31"],Ii="#101014",Li=1.25,re="http://www.w3.org/2000/svg";let Ni=0;function Ne(e){return Math.round(e*1e3)/1e3}function rt(e){return e/it*Math.PI*2-Math.PI/2}function Ri(e){const n=rt(e)+Math.PI/it+Math.PI/2;return{x:Math.cos(n),y:Math.sin(n)}}function Oi(e){const t=rt(e),n=rt(e+1);return[[se,se],[se+Math.cos(t)*Le,se+Math.sin(t)*Le],[se+Math.cos(n)*Le,se+Math.sin(n)*Le]]}function bn(e,t){const n=Oi(e),o=document.createElementNS(re,"path");return o.setAttribute("d",`M ${n.map(([i,s])=>`${Ne(i)} ${Ne(s)}`).join(" L ")} Z`),t?o.setAttribute("fill","#fff"):(o.setAttribute("fill",_n[e%_n.length]),o.setAttribute("stroke",Ii),o.setAttribute("stroke-width",String(Li)),o.setAttribute("vector-effect","non-scaling-stroke"),o.setAttribute("stroke-linejoin","round")),o}function Di(){const e=`os-iris-${++Ni}`,t=document.createElementNS(re,"svg");t.setAttribute("viewBox",`0 0 ${st} ${st}`),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(re,"defs"),o=document.createElementNS(re,"mask");o.setAttribute("id",e);const i=document.createElementNS(re,"g"),s=document.createElementNS(re,"g");s.setAttribute("mask",`url(#${e})`);const r=[];for(let a=0;a<it;a++){const c=bn(a,!0),l=bn(a,!1);i.appendChild(c),s.appendChild(l),r.push({el:c,index:a},{el:l,index:a})}o.appendChild(i),n.appendChild(o),t.appendChild(n),t.appendChild(s);const d=document.createElement("div");return d.appendChild(t),{element:d,play:a=>r.map(({el:c,index:l})=>{const u=Ri(l),p=Ne(u.x*gn),g=Ne(u.y*gn);return c.animate([{transform:"translate( 0px, 0px )"},{transform:`translate( ${p}px, ${g}px )`}],{duration:a.duration,easing:a.easing,delay:a.delay,fill:"both"})})}}const at="none",Wi=70,Mi=600,wn=k("desktop-mode/window-reveal-registry",()=>({registry:new Map,listeners:new Set})),yn=wn.state.registry,Pi=wn.state.listeners,vn=/^[a-z0-9_/-]+$/;function En(e){const t=/^\s*([a-zA-Z-]+)\s*\(/.exec(e);return t?t[1].toLowerCase():""}const $i=0;function zi(e){return typeof e!="number"||!Number.isFinite(e)?Wi:Math.min(Mi,Math.max(0,e))}function Hi(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 An(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=En(e.from),r=En(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 Fi(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)"):vn.test(e.id.trim().toLowerCase())?e.id.trim().toLowerCase()===at&&t.push('id ("none" is reserved)'):t.push(`id (must match ${vn} — 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,d)=>{if(!r||typeof r!="object"){t.push(`layers[ ${d} ] (not an object)`);return}t.push(...An(r,`layers[ ${d} ]`))})):t.push(...An(e,"").map(r=>r.replace(/^\./,"")))),e.easing!==void 0&&(typeof e.easing!="string"||e.easing.trim()===""?t.push("easing (not a non-empty string)"):Fi(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)"))}et("WindowReveal",t,e);const n=e.id.trim().toLowerCase();yn.set(n,{...e,id:n}),Bi()}function Ui(){const e=Array.from(yn.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 Gi(e){return Ui().find(t=>t.id===e)}function Bi(){const e=Array.from(Pi);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."),...xi(),duration:420}),W({id:"iris",label:_("Iris"),description:_("The page opens out from the centre of the window, like a camera shutter."),...bi(),duration:520}),W({id:"curtain",label:_("Curtain"),description:_("Two panels part from the middle of the window and slide off the sides."),...wi(),duration:480}),W({id:"blinds",label:_("Blinds"),description:_("Six horizontal slats retract at once, letting the page through between them."),...yi(),duration:560}),W({id:"diagonal",label:_("Diagonal"),description:_("A slanted edge sweeps off the trailing corner of the window."),...Ti(),duration:460}),W({id:"rise",label:_("Rise"),description:_("The page rises into the window from the bottom edge upward."),...ki(),duration:440}),W({id:"shutter",label:_("Shutter"),description:_("Two panels part from the middle of the window and slide off the top and bottom."),...vi(),duration:480}),W({id:"slats",label:_("Slats"),description:_("Eight vertical slats retract at once, letting the page through between them."),...Ei(),duration:560}),W({id:"diamond",label:_("Diamond"),description:_("The page opens out from the centre of the window through a growing rhombus."),...Ai(),duration:520}),W({id:"mosaic",label:_("Mosaic"),description:_("The page arrives as a grid of tiles, each opening out from its own centre."),...Si(),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:Di,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."),...Ci(),duration:760});const Sn={dockSize:["compact","default","large"],desktopLayout:["classic","unified"],dockPlacement:["bottom","left","right"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"]},Cn=["dockRailRenderer","windowReveal","accent"],kn={windowRevealDuration:{min:80,max:4e3}},qi=/^[a-z0-9_-]+$/;[...Object.keys(Sn),...Cn,...Object.keys(kn)];function Vi(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t=e,n={},o={};for(const[i,s]of Object.entries(Sn)){const r=t[i];typeof r=="string"&&s.includes(r)&&(n[i]=r)}for(const i of Cn){const s=t[i];typeof s=="string"&&qi.test(s)&&(n[i]=s)}for(const[i,s]of Object.entries(kn)){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 Ki=/^[a-z0-9_-]+$/,xn=128;function ji(e){return typeof e!="string"||e===""||e.length>2048?!1:e.startsWith("dashicons-")||e.startsWith("https://")||e.startsWith("http://")||e.startsWith("data:image/")}function Yi(e){if(!e||typeof e!="object")return null;const t=e,n=typeof t.slug=="string"?t.slug:"";if(!Ki.test(n))return null;const o={};if(t.icons&&typeof t.icons=="object"){let a=0;for(const[c,l]of Object.entries(t.icons)){if(a>=xn)break;c===""||!ji(l)||(o[c]=l,a+=1)}}const i={};if(t.tokens&&typeof t.tokens=="object")for(const[a,c]of Object.entries(t.tokens))typeof c=="string"&&(i[a]=c);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[c,l]of Object.entries(t.iconColors)){if(a>=xn)break;c===""||typeof l!="string"||l===""||(r[c]=l,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:i,fonts:s,icons:o,iconColors:r,recommendedOsSettings:Vi(t.recommendedOsSettings),installedAt:typeof t.installedAt=="number"?t.installedAt:0,source:t.source==="code"?"code":"upload",cssDeferred:t.cssDeferred===!0}}function Xi(){const t=window.openStationConfig?.serverDesktopThemes,n=[];if(Array.isArray(t))for(const o of t){const i=Yi(o);i&&n.push(i)}return{themes:n,activeId:null,activeIcons:null,activeIconColors:null}}const Zi=k("desktop-mode/desktop-themes",Xi);function Tn(){return Zi}function In(e){const t=Tn().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 Ln(e){const t=Tn().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!==""?Qi(o):null}function Qi(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 de={OS_SETTINGS:"OS_SETTINGS",RECYCLE_BIN:"RECYCLE_BIN",BUG_REPORT:"BUG_REPORT",EXIT_OPENSTATION:"EXIT_OPENSTATION",PWA_INSTALL:"PWA_INSTALL"},Ji={"desktop-mode-os-settings":de.OS_SETTINGS,"desktop-mode-recycle-bin":de.RECYCLE_BIN,"desktop-mode-bug-report":de.BUG_REPORT,"os-exit":de.EXIT_OPENSTATION,"os-pwa-install":de.PWA_INSTALL};function es(e){if(typeof e!="string"||e==="")return"";const t=Ji[e];if(t)return t;const n=e.toLowerCase().replace(/[^a-z0-9_-]/g,"");return n===""?"":`APP:${n}`}function ts(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 lt(e,t){const n=ts(t),o=In(n),i=Ln(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 ct=null;function Re(){return!!window.openStationShellOverlays}function ns(e){return new Promise((t,n)=>{const o=document.querySelector('script[data-os-shell-overlays="1"]'),i=()=>{if(Re()){t();return}n(new Error("[openstation] shell-overlays bundle loaded but did not set `window.openStationShellOverlays`."))};if(o){Re()?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 os(e){return Re()||!e?Promise.resolve():(ct||(ct=ns(e)),ct)}function is(){return window.openStationConfig?.shellOverlaysBundleUrl??""}function ss(e,t){const n=is();if(Re()||!n){t();return}os(n).then(()=>{e()&&t()}).catch(o=>{typeof console<"u"&&console.warn("[openstation] shell-overlays failed to load; menu/dialog suppressed:",o)})}const rs=4e3,as=200,ls=1200;function dt(e){const t=Ke.filter("os/toast-requested",{...e});if(!t||t.cancel===!0)return()=>{};let n=!1,o=null;return ss(()=>!n,()=>{o=us(t)}),()=>{n=!0,o&&o()}}const cs={success:"positive",warning:"warning",error:"critical","shell-error":"critical"};function ds(e){return e?window.openStationConfig?.toastTypes?.find(o=>o.id===e)?.tone??cs[e]??null:null}function us(e){const t=ms(),n=document.createElement("os-toast");n.textContent=e.message;const o=ds(e.type);o&&n.setAttribute("tone",o),e.action&&(n.setAttribute("action",e.action.label),n.addEventListener("os-toast-action",()=>{e.action?.onClick(),c()})),e.dismissible&&(n.setAttribute("dismissible",""),n.addEventListener("os-toast-dismiss",()=>{e.onDismiss?.(),c()})),t.appendChild(n);let i=!1,s=null,r=e.duration??rs,d=0;const a=()=>{s!==null&&(window.clearTimeout(s),s=null)},c=()=>{i||(i=!0,a(),ps(n),n.setAttribute("state","out"),window.setTimeout(()=>{n.remove(),fs()},as))},l=()=>{i||e.persistent||s!==null||(d=Date.now(),s=window.setTimeout(c,r))},u=()=>{s!==null&&(r=Math.max(0,r-(Date.now()-d)),a())};return requestAnimationFrame(()=>{n.setAttribute("state","in")}),n.addEventListener("os-toast-hold",p=>{if(p.detail?.held){u();return}r=Math.max(r,ls),l()}),hs(n),l(),Ke.publish("os/toast-shown",{...e}),c}let Oe=null,ue=0;function Nn(e){const t=e.target;t instanceof HTMLElement&&(t.closest("os-toast-container")||(Oe=t))}function hs(e){ue===0&&document.addEventListener("focusin",Nn,!0),ue+=1;const t=e.ownerDocument,n=t.activeElement;n instanceof HTMLElement&&n!==t.body&&!n.closest("os-toast-container")&&(Oe=n)}function fs(){ue=Math.max(0,ue-1),ue===0&&document.removeEventListener("focusin",Nn,!0)}function ps(e){const t=e.ownerDocument.activeElement;t!==e&&!e.contains(t)||Oe?.isConnected===!0&&Oe.focus()}function ms(){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 gs="http://localhost/";function _s(e,t){const n=typeof window<"u"&&window.location?window.location.href:gs,o=new URL(e,n),i=t.replace(/^\/+/,""),s=i.indexOf("?"),r=s===-1?i:i.slice(0,s),d=s===-1?"":i.slice(s+1);if(o.searchParams.has("rest_route")){const a=o.searchParams.get("rest_route")??"/",c=a.endsWith("/")?a:a+"/";o.searchParams.set("rest_route",c+r)}else{const a=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";o.pathname=a+r}return d&&new URLSearchParams(d).forEach((c,l)=>{o.searchParams.append(l,c)}),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>')}`;function bs(e){try{(window.top??window).location.assign(e)}catch{window.location.assign(e)}}const Rn=800;function ws(e,t=Rn){window.setTimeout(()=>{if(e){bs(e);return}try{(window.top??window).location.reload()}catch{window.location.reload()}},t)}const ys="desktop-mode/v1",vs=3e4,Es=3,he=k("desktop-mode/plugin-presence",()=>({confirmInFlight:!1,lastConfirmAt:null,exiting:!1,booted:!1,negativeConfirms:0}));function ut(){return window.wp?.os?.config??{}}function As(){const e=ut().adminUrl||"/wp-admin/";let t;try{t=new URL(e,window.location.href).pathname}catch{t="/wp-admin/"}return t.endsWith("/")?t:`${t}/`}function Ss(){const e=ut().restUrl;return e?_s(e,ys):null}function Cs(){he.state.negativeConfirms=0}async function ks(){const e=he.state;if(e.exiting||e.confirmInFlight||e.negativeConfirms>=Es)return;const t=Ss();if(!t)return;const n=Date.now();if(!(e.lastConfirmAt!==null&&n-e.lastConfirmAt<vs)){e.lastConfirmAt=n,e.confirmInFlight=!0;try{const o=await hi(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}xs()}catch{}finally{e.confirmInFlight=!1}}}function xs(){if(!he.state.exiting){he.state.exiting=!0,ws(ut().adminUrl||"");try{dt({message:_("OpenStation is no longer active. Returning to the WordPress dashboard…"),duration:Rn})}catch{}}}function ht(e){if(he.state.exiting)return;let t=null;try{t=e.contentDocument}catch{return}if(!(!t?.body||!t.location)&&t.location.pathname.startsWith(As())){if(t.body.classList.contains("os-chromeless")){Cs();return}ks()}}const B=0,ft=40,On=5,Ts=On*On,Is=3e3,Ls=250,Ns=15e3,Rs=120,pt="os-window__loading",Dn="os-window__loading--visible",Os=k("desktop-mode/window-reveal-active",()=>({id:at,duration:$i}));function Ds(){const e=Os.state.id;return!e||e===at?null:Gi(e)??null}const mt="os-window__reveal",Ws="os-window__reveal--edge",Ms="os-window__reveal--custom",Wn="data-os-reveal",Mn="data-os-reveal-layer",Ps=k("desktop-mode/window-reveal-rendered",()=>({plays:new WeakMap})).state.plays;function Pn(e,t,n,o){const i=document.createElement("div");i.className=o?`${mt} ${Ws}`:mt;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(Wn,e.id),i.setAttribute(Mn,String(n)),i.style.clipPath=t.from,i}function $s(){const e=Ds();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(mt),i.classList.add(Ms),i.setAttribute("aria-hidden","true"),i.setAttribute(Wn,e.id),i.setAttribute(Mn,"0"),Ps.set(i,o.play),[i]}const t=Hi(e);if(t.length===0)return[];const n=[];return zi(e.edgeLag)>0&&t.forEach((o,i)=>n.push(Pn(e,o,i,!0))),t.forEach((o,i)=>n.push(Pn(e,o,i,!1))),n}const $n="os-window__body--loading",zn="data-os-loading-at",Hn="data-os-loading-cycle";function zs(e){return e.getAttribute(Hn)??"0"}function Hs(e){e.setAttribute(zn,String(Date.now())),e.setAttribute(Hn,String(Number(zs(e))+1))}function Fs(e,t){const n=Number(e.getAttribute(zn)),o=Number.isFinite(n)&&n>0?Date.now()-n:0,i=Rs-o;if(i<=0){t.classList.add(Dn);return}window.setTimeout(()=>{t.isConnected&&e.classList.contains($n)&&t.classList.add(Dn)},i)}const Us=Symbol.for("desktop-mode/window-config");function Gs(e,t){e[Us]=t}const gt=window.location.origin;function Bs(e){try{return new URL(e,gt).searchParams.has(Bt)}catch{return!1}}function fe(e){const t=new URL(e,gt);return t.origin!==gt||ei(t)?null:(t.searchParams.set("openstation_chromeless","1"),t.toString())}function J(){const e=document.querySelectorAll(".os-window--fullscreen:not(.os-window--minimized)").length>0;document.body.classList.toggle("os-has-fullscreen-window",e)}function qs(){const e=document.createElement("div");e.className=pt,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 Vs(e){let t=qs();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(pt)&&t.classList.add(pt),t}function ee(e){const t=document.createElement("span");return t.className=`os-window__slot os-window__slot--${e}`,t.dataset.slot=e,t}function Ks(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"),lt(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=ie(_("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 browser tab"),i.appendChild(h)}const r=ee("icon"),d=ee("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 c=ee("before-titlebar"),l=ee("before-icon"),u=ee("after-title"),p=ee("before-controls"),g=ee("after-controls"),b=ee("after-titlebar"),y=document.createElement("div");y.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 E=document.createElement("span");E.className="os-window__custom-buttons os-window__custom-buttons--right";const C=document.createElement("os-save-status");C.className="os-window__status",C.setAttribute("mode","icon"),C.setAttribute("variant","ring"),C.setAttribute("phase","idle"),C.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(C),n.appendChild(l),n.appendChild(r),n.appendChild(d),n.appendChild(u),n.appendChild(S),n.appendChild(w),o&&i&&i.children.length>0&&(n.appendChild(o),n.appendChild(i)),n.appendChild(E),n.appendChild(p),n.appendChild(y),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 ${$n}`,Hs(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 v=e.url?fe(e.url):null;h.src=v??"about:blank",D.appendChild(h);const I=()=>{$(e.id),ht(h)};h.addEventListener("load",I)}const Se=Vs(e);D.appendChild(Se),Fs(D,Se);for(const h of $s())D.appendChild(h);Ie(e.id);const j=[];for(const h of["ne","nw","se","sw"]){const v=document.createElement("div");v.className=`os-window__resize-handle os-window__resize-handle--${h}`,v.dataset.dir=h,v.setAttribute("aria-hidden","true"),j.push(v)}t.appendChild(c),t.appendChild(n),t.appendChild(b);{const h=document.createElement("nav");h.className="os-window__tabs";const v=document.createElement("span");v.className="os-window__tab-plate",v.setAttribute("aria-hidden","true");const I=document.createElement("span");I.className="os-window__tab-plate-fill";const H=document.createElement("span");H.className="os-window__tab-plate-joint",v.appendChild(I),v.appendChild(H),h.appendChild(v),e.native?h.dataset.tablistLabel=ie(_("%s sections"),e.title):h.dataset.tablistLabel=ie(_("%s sub-pages"),e.title);const P=(e.submenu??[]).filter(F=>!F.offSite&&!Bs(F.url));if(P.length>0&&e.url){const F=Y(e.url),Ce=e.parentUrl??e.url,Ol=Y(Ce),Dl=P.some(ke=>Y(ke.url)===Ol)?[...P]:[{title:e.selfLabel||e.title,url:Ce},...P];for(const ke of Dl){const U=document.createElement("button");U.className="os-window__tab",U.dataset.kind="submenu",U.setAttribute("type","button"),U.setAttribute("role","tab"),U.dataset.url=ke.url,U.textContent=ke.title,Y(ke.url)===F?(U.classList.add("os-window__tab--active"),U.setAttribute("aria-selected","true")):U.setAttribute("aria-selected","false"),h.appendChild(U)}}le(h),t.appendChild(h)}t.appendChild(D);for(const h of j)t.appendChild(h);return Gs(t,e),t}const Fn=window.location.origin;let Un=0;function js(e,{timeoutMs:t=Ls}={}){const n=e?.contentWindow;if(!n)return Promise.resolve(!1);Un+=1;const o=`os-unsaved-guard-${Date.now()}-${Un}`;return new Promise(i=>{let s=null,r=!1;const d=c=>{r||(r=!0,window.removeEventListener("message",a),s!==null&&window.clearTimeout(s),i(c))},a=c=>{if(c.origin!==Fn)return;const l=c?.data;!l||typeof l!="object"||l.type!=="os-bridge-beforeunload-response"||l.requestId!==o||d(l.prevent===!0)};window.addEventListener("message",a),s=window.setTimeout(()=>d(!1),t);try{n.postMessage({type:"os-bridge-beforeunload-query",requestId:o},Fn)}catch{d(!1)}})}function _t(e,{commit:t,navigate:n}){if(!e._iframeBridgeReady||!e.iframe){t(),n();return}e._unsavedGuardPending=!0,js(e.iframe).then(o=>{if(e._unsavedGuardPending=!1,!e._isDestroyed){if(!o){t(),n();return}e._deferNavigationCommit(t,Ns),n()}})}function Ys(e,t){let n;try{n=new URL(t,window.location.origin)}catch{return null}const o=Jt(t);let i=null,s=-1;for(const r of e){const d=r.dataset.url;if(!d||Jt(d)!==o)continue;let a;try{a=new URL(d,window.location.origin)}catch{continue}let c=0,l=!1;for(const[u,p]of a.searchParams){if(u==="openstation_chromeless"||u==="desktop_mode_portal"||Qt.includes(u))continue;if(n.searchParams.get(u)!==p){l=!0;break}c++}!l&&c>s&&(i=r,s=c)}return i}function pe(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=Y(t);let i=null;for(const s of n){const r=s.dataset.url;if(r&&Y(r)===o){i=s;break}}if(i||(i=Ys(n,t)),!i){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;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 Gn(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;Xs(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 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=s,a.setAttribute("aria-label",_("Open in a new browser tab")),a.title=_("Open in a new browser tab"),r.appendChild(a);const c=document.createElement("os-tab-chip");c.setAttribute("variant","close"),c.dataset.tabAction="close",c.dataset.tabId=s,c.setAttribute("aria-label",_("Close tab")),c.title=_("Close tab"),r.appendChild(c),o.appendChild(r),le(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),Qs(e,s))},Is),b=()=>{l.removeEventListener("load",p),window.clearTimeout(g)};e._externalTabs.set(s,{tabEl:r,iframe:l,url:t,label:n,cancelProbe:b}),me(e,s),r.scrollIntoView({behavior:"smooth",inline:"end",block:"nearest"}),e._emitChange("state")}function Xs(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),le(t)}function me(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 bt(e,t){const n=e._externalTabs.get(t);n&&(n.cancelProbe(),n.tabEl.remove(),n.iframe.remove(),e._externalTabs.delete(t),e._activeTabId===t&&me(e,"primary"),e._externalTabs.size===0&&e.element.querySelector(".os-window__tab--main")?.remove(),le(e.element.querySelector(".os-window__tabs")),e._emitChange("state"))}function Zs(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"),bt(e,t)}function Qs(e,t){const n=e._externalTabs.get(t);if(!n)return;const{url:o,label:i}=n;bt(e,t),dt({message:ie(_(`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 Js(e){return e._externalTabs.size}function er(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 tr(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"?bt(e,a):d==="detach"&&Zs(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){me(e,r);return}if(s==="main"){me(e,"primary");return}if(s==="panel"&&i.dataset.panel){Qe(e.element,i.dataset.panel);return}if(i.dataset.url){const d=i.dataset.url;if(Xe(d))return;const a=fe(d);me(e,"primary");const c=()=>{e.markContentLoading(),pe(e,d)};a&&e.iframe?_t(e,{commit:c,navigate:()=>{e.iframe&&(e.iframe.src=a)}}):pe(e,d)}}const wt=1;function nr(e,t){const n=Math.max(0,e.scrollWidth-e.clientWidth);if(n<=wt){delete e.dataset.overflow;return}const o=Math.abs(e.scrollLeft),i=o<=wt,s=o>=n-wt,r=t??window.getComputedStyle(e).direction==="rtl",d=r?!s:!i,a=r?!i:!s;d&&a?e.dataset.overflow="both":d?e.dataset.overflow="left":a?e.dataset.overflow="right":delete e.dataset.overflow}function or(e){let t=null,n=null;const o=()=>{n===null&&(n=window.requestAnimationFrame(()=>{n=null,t===null&&(t=window.getComputedStyle(e).direction==="rtl"),nr(e,t),jt(e),Yt(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 ir=k("desktop-mode/destructive-admin-actions",()=>({entries:[]}));function sr(e,t){for(const n of ir.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 rr=32,ar=64,lr=/^[a-z0-9_/-]+$/,q=k("desktop-mode/window-links",()=>({contentByWindow:new Map,focusSeq:new Map,seq:0,listeners:new Set,lastGroupsSignature:"",manager:null,started:!1}));function De(e){return`${e.type}:${e.id}`}function Bn(e){return e.root?De(e.root):De(e)}function qn(e){const t=o=>typeof o=="number"&&Number.isFinite(o)||typeof o=="string"&&o.trim()!=="",n=o=>typeof o=="string"&&lr.test(o.trim().toLowerCase());return fi(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 Vn(e){if(!(typeof e!="string"||e===""))try{return new URL(e,window.location.origin).origin===window.location.origin?e:void 0}catch{return}}function cr(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,rr).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=Vn(e.previewUrl);o&&(n.previewUrl=o);const i=Vn(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,ar).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 Kn(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 yt(e){return e?[De(e),Bn(e),...(e.links??[]).map(t=>De(t)+(t.rel==="child"?"!child":""))].join("|"):""}function dr(e,t,n={}){const o=n.source??"api";if(typeof e!="string"||e===""){et("WindowContentRef",["windowId (must be a non-empty string)"],t);return}let i=null;if(t!=null){const d=qn(t);if(d.length>0){o==="api"&&et("WindowContentRef",d,t),nn("WindowContentRef",d,t);return}i=cr(t,o)}if(i=T(f.WINDOW_LINKS_CONTENT,i,{windowId:e,source:o}),i!==null&&(!i||qn(i).length>0)){nn("WindowContentRef",["filter (os.window-links.content returned an invalid ref)"],i);return}const s=q.state.contentByWindow.get(e)??null;if(i===null&&s===null||i!==null&&s!==null&&yt(i)===yt(s)&&i.label===s.label&&i.previewUrl===s.previewUrl&&i.revisionsUrl===s.revisionsUrl&&i.revisionCount===s.revisionCount&&Kn(i)===Kn(s))return;i===null?q.state.contentByWindow.delete(e):q.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),pr(),hr()}function ur(){const e=new Map;for(const[i,s]of q.state.contentByWindow){const r=Bn(s);let d=e.get(r);d||(d={key:r,root:s.root?{...s.root}:{type:s.type,id:s.id},rootWindowIds:[],children:[]},e.set(r,d)),s.root?d.children.push({windowId:i,content:s}):d.rootWindowIds.push(i)}const t=q.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 hr(){for(const e of Array.from(q.state.listeners))try{e()}catch(t){typeof console<"u"&&console.error("[openstation] window-links listener threw:",t)}}function fr(){return Array.from(q.state.contentByWindow).map(([e,t])=>`${e}=${yt(t)}`).sort().join(";")}function pr(){const e=fr();if(e===q.state.lastGroupsSignature)return;q.state.lastGroupsSignature=e;const n={groups:ur()};document.dispatchEvent(new CustomEvent("os-window-link-groups-changed",{detail:n})),m(f.WINDOW_LINK_GROUPS_CHANGED,n)}const mr="my-wordpress",gr=Object.freeze({userId:null,userName:"",requestedAt:0});function jn(){return window.wp?.os}let We=null;function _r(){if(We)return We;const e=jn()?.createSharedStore;return typeof e!="function"?null:(We=e("desktop-mode/my-wordpress/footprint-target",()=>({...gr})),We)}function br(e,t=""){const n=_r();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 wr(e){const t=Number(e.userId);if(!Number.isFinite(t)||t<=0)return;const n=e.userName??"";br(t,n),jn()?.openWindow?.(mr,{source:"my-wordpress/open-user-footprint",params:{footprint:t,fpName:n}})}const M=window.location.origin,vt=k("desktop-mode/admin-link-deps",()=>({deps:null}));function yr(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.setTitle(n.title),n.type==="os-content-identity"&&dr(e.id,n.identity??null,{source:"bridge"}),n.type==="os-window-publish"&&typeof n.channel=="string"&&n.channel!==""&&Ht(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._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(()=>Rl).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!==""&&Er(e,n.url,n.target==="new"?"new":"self"),n.type==="os-iframe-other-admin-link"&&typeof n.url=="string"&&n.url!==""&&vt.state.deps?.openOtherAdmin?.(n.url),n.type==="os-iframe-admin-link"&&typeof n.url=="string"&&n.url!==""){const o=vt.state.deps;if(Xe(n.url))e.close();else if(o){const i=typeof n.label=="string"?n.label:"";xr(e,n.url,i,o,n.newContext===!0)}}if(n.type==="os-open-user-footprint"&&typeof n.userId=="number"&&n.userId>0&&wr({userId:n.userId,userName:typeof n.userName=="string"?n.userName:""}),n.type==="os-notification"&&typeof n.title=="string"&&n.title!==""&&Or(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)&&Dr(e,n.panels),n.type==="os-screen-meta-state"&&Wr(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;Gn(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?vr(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 vr(e){return e<=0?_("Request failed."):ie(_("Request failed (HTTP %d)."),e)}function Er(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 Ar=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&&Ar.has(t)&&(e.searchParams.has("_wpnonce")||e.searchParams.has("_wp_nonce"))?!0:sr(e.toString(),e)!==null}function Yn(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 Cr(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 kr(e,t,n){if(t===(e.config.baseId||e.id))return!0;const o=Cr(e,n);return o!==""&&o===t}function xr(e,t,n,o,i=!1){let s;try{s=new URL(t,o.adminUrl)}catch{return}if(s.origin!==M)return;if(i){Et(e,s,n,o);return}const r=s.toString(),d=o.deriveSlug(r),a=kr(e,d,o);if(!a&&Sr(s)){const c=Yn(s,e),l=e.iframe?.contentWindow;if(l)try{l.location.assign(c.href)}catch{e.iframe&&(e.iframe.src=c.href)}return}if(a){const c=e.iframe?.contentWindow;if(c)try{c.location.assign(r)}catch{e.iframe&&(e.iframe.src=r)}return}Et(e,s,n,o)}function Et(e,t,n,o){const i=t.toString(),s=o.deriveSlug(i),r=o.findDockEntry(i),d=n.trim(),a=r?.title||(d!==""?d:s),c=Yn(t,e);o.openWindow({id:s,baseId:s,url:c.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 Me(e){if(!e||e.startsWith("#"))return"";try{const t=new URL(e,M);return t.origin!==M?"":t.pathname.split("/").pop()??""}catch{return""}}const Tr=new Set(["revision.php"]);function Ir(e,t){try{const o=e.iframe?.contentWindow?.performance?.getEntriesByType?.("navigation")?.[0]?.name??"";if(o&&Me(o)===Me(t))return o}catch{}return t}function Lr(e,t){const n=Me(e.config.url??"");if(!n||!Tr.has(n))return!1;const o=Me(t);if(!o||o===n)return!1;if(Xe(t))return e.close(),!0;const i=vt.state.deps;if(!i)return!1;let s;try{s=new URL(Ir(e,t),i.adminUrl)}catch{return!1}return s.origin!==M?!1:(Et(e,s,"",i),e.close(),!0)}function Nr(e){if(!e.config.titleFromPage)return;let t="";try{t=e.iframe?.contentDocument?.title??""}catch{return}const n=Rr(t);n!==""&&n!==e.config.title&&e.setTitle(n)}function Rr(e){const t=e.trim(),n=t.indexOf(" ‹ ");return(n>0?t.slice(0,n):t).trim()}function Or(e,t){const n=t!==""?`${e} — ${t}`:e;dt({message:n})}function Dr(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",d=>{d.stopPropagation(),e.iframe?.contentWindow?.postMessage({type:"os-toggle-panel",panel:i},M)}),n.appendChild(r)}}function Wr(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 Xn=k("desktop-mode/title-bar-buttons-registry",()=>({registry:new Map,listeners:new Set})),Mr=Xn.state.registry,At=Xn.state.listeners;function Pr(){return Array.from(Mr.values()).sort((e,t)=>(e.order??100)-(t.order??100))}function $r(e){const t=[],n=[];for(const o of Pr()){try{if(!o.match(e))continue}catch{continue}o.placement==="right"?n.push(o):t.push(o)}return{left:t,right:n}}function zr(e){return At.add(e),()=>{At.delete(e)}}function Hr(){const e=Array.from(At);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"&&Hr()});const Fr=/^dashicons-[a-z0-9-]+$/i,Ur=/^\s*<svg[\s>]/i;function Zn(e,t){if(t){if(Fr.test(t)){const n=document.createElement("span");n.className=`dashicons ${t}`,n.setAttribute("aria-hidden","true"),e.appendChild(n);return}if(Ur.test(t)){const n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.innerHTML=t,e.appendChild(n);return}e.setAttribute("icon",t)}}const Qn=k("desktop-mode/window-themes-registry",()=>({registry:new Map,listeners:new Set})),Gr=Qn.state.registry,Jn=Qn.state.listeners;function eo(){return Array.from(Gr.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}function Br(e){let t=null;for(const n of eo()){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 qr(e){return Jn.add(e),()=>{Jn.delete(e)}}const Pe=new WeakMap;function Vr(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=jr(t.themeId);s&&(n=s.id,o={...s.tokens})}else{const s=Br(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 St(e,t){const n=e.element;if(!n)return;const o=Pe.get(n),{themeId:i,tokens:s}=Vr(e,t);if(o){for(const d of o.keys)if(!(d in s))try{n.style.removeProperty(d)}catch{}}const r=new Set;for(const[d,a]of Object.entries(s))try{n.style.setProperty(d,a),r.add(d)}catch(c){m(f.SHELL_ERROR,{scope:"window-theme-apply",windowId:e.id,key:d,error:c})}Pe.set(n,{themeId:i,keys:r}),m(f.WINDOW_CHROME_THEME_CHANGED,{windowId:e.id,themeId:i,tokens:s})}function Kr(e){const t=e.element;if(!t)return;const n=Pe.get(t);if(n){for(const o of n.keys)try{t.style.removeProperty(o)}catch{}Pe.delete(t)}}function jr(e){for(const t of eo())if(t.id===e)return{id:t.id,tokens:t.tokens};return null}const to=k("desktop-mode/window-controls-registry",()=>({registry:new Map,listeners:new Set})),Yr=to.state.registry,no=to.state.listeners;function Xr(){return Array.from(Yr.values()).sort((e,t)=>{const n=e.order??100,o=t.order??100;return n!==o?n-o:e.id.localeCompare(t.id)})}function Zr(e){const t=[],n=[],o=[];for(const i of Xr()){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 Qr(e){return no.add(e),()=>{no.delete(e)}}function Jr(e,t){const n=Zr(e),o=new Set(t?.hide??[]);let i=n.left.filter(c=>!o.has(c.id)),s=n.right.filter(c=>!o.has(c.id)),r=n.controls.filter(c=>!o.has(c.id));if(t?.custom){for(const c of t.custom){if(o.has(c.id))continue;const l={id:c.id,label:c.label,icon:c.icon,placement:c.placement??"controls",order:c.order??100,match:()=>!0,onClick:c.onClick?(u,p)=>c.onClick(p):void 0,render:c.render?u=>c.render(u):void 0};l.placement==="left"?i.push(l):l.placement==="right"?s.push(l):r.push(l)}i=Ct(i),s=Ct(s),r=Ct(r)}t?.order&&t.order.length>0&&(r=ea(r,t.order));const d=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:d}}function Ct(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 ea(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 ta(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=na(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(lt(n,e.id)||Zn(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 na(e){return e.startsWith("core/")?e.slice(5):e.replace(/\//g,"-")}function oa(e,t){const n=[];for(;t.firstChild;)t.removeChild(t.firstChild);const o=Jr(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}=ta(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 ia(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 sa(e){return typeof e!="string"||e===""||e.length>4096||!/^(https?:\/\/|data:image\/)/i.test(e)?!1:!/['"()\\<>\s]/.test(e)}function oo(e,t,n){if(!sa(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 io="data:image/svg+xml;base64,",$e=new Map;function ra(e){const t=$e.get(e);if(t!==void 0)return t;let n=!1;try{n=atob(e.slice(io.length)).includes("currentColor")}catch{}return $e.size>=256&&$e.clear(),$e.set(e,n),n}function aa(e,t){const n=t.className??"",o=t.title??"";let i=null;if(t.slot){const a=In(t.slot);a!==null&&(e=a),i=Ln(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",oo(a,e,i))return a}if(typeof e=="string"&&e.startsWith("data:image/svg+xml;base64,")){const a=e.slice(io.length);if(/^[A-Za-z0-9+/=]+$/.test(a)){const c=document.createElement("span");return c.className=n,c.setAttribute("aria-hidden","true"),c.style.display="inline-block",ra(e)&&oo(c,e,"currentColor")||(c.style.backgroundImage=`url("${e}")`,c.style.backgroundRepeat="no-repeat",c.style.backgroundPosition="center",c.style.backgroundSize="contain"),c}}if(typeof e=="string"&&/^data:image\/(png|jpeg|jpg|gif|webp|x-icon|vnd\.microsoft\.icon);base64,/i.test(e)){const a=e.indexOf(","),c=a>=0?e.slice(a+1):"";if(/^[A-Za-z0-9+/=]+$/.test(c))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=la(o);s.textContent=r;const d=ia(o);return s.style.backgroundColor=`hsl( ${d}, 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 la(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 ro=k("desktop-mode/window-slots-registry",()=>({registry:new Map,listeners:new Set})),ca=ro.state.registry,ao=ro.state.listeners;function da(){return Array.from(ca.values()).sort((e,t)=>{const n=e.order??100,o=t.order??100;return n!==o?n-o:e.id.localeCompare(t.id)})}function ua(e,t){const n=[];for(const o of da())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 ha(e){return ao.add(e),()=>{ao.delete(e)}}const lo=["before-titlebar","before-icon","icon","title","after-title","before-controls","after-controls","after-titlebar"],co=new WeakMap;function uo(e,t){return e.querySelector(`[data-slot="${t}"]`)}function fa(e){const t=new Map;for(const n of lo){const o=uo(e,n);o&&t.set(n,Array.from(o.childNodes).map(i=>i.cloneNode(!0)))}return t}function ge(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function pa(e,t){ge(e);for(const n of t)e.appendChild(n.cloneNode(!0))}function ma(e,t){const n=e.querySelector(".os-window__title");n&&(n.textContent=t)}function ga(e){const t=[],n=e.element;if(!n)return()=>{};let o=co.get(n);o||(o=fa(n),co.set(n,o));const i=e.config.appearance?.slots??{};for(const s of lo){const r=uo(n,s);if(!r)continue;const d=o.get(s)??[],a=i[s],c=ua(e,s);if(a===null)ge(r);else if(a&&"html"in a)ge(r),r.textContent=a.html;else if(a&&"render"in a){a.replace!==!1&&ge(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 pa(r,d),s==="title"&&ma(r,e.config.title);if(a!==null){let l=!1;for(const u of c){u.replace!==!1&&!l&&(ge(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 ho=k("desktop-mode/window-chrome-registry",()=>({registry:new Map,listeners:new Set})),_a=ho.state.registry,fo=ho.state.listeners;function ba(e){return _a.get(e.toLowerCase())??null}function wa(e){return fo.add(e),()=>{fo.delete(e)}}const ze="core/standard",kt="os-window--custom-chrome";function po(e){const t=e.config.appearance?.chrome??ze;return T(f.WINDOW_CHROME_RENDER,t,{windowId:e.id,config:e.config})}function mo(e){return{title:e.config.title,icon:e.config.icon,focused:e.element.classList.contains("os-window--focused"),state:e.state}}function ya(e){const t=po(e);if(t===ze)return null;const n=ba(t);if(!n)return null;try{if(n.match&&!n.match(e))return null}catch{return null}e.element.classList.add(kt);let o;try{o=n.render(e.element,{window:e,state:mo(e)})}catch(i){return e.element.classList.remove(kt),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 go=k("desktop-mode/window-actions-registry",()=>({registry:new Map,listeners:new Set})),va=go.state.registry,_o=go.state.listeners;function Ea(){return Array.from(va.values()).sort((e,t)=>(e.order??100)-(t.order??100))}function Aa(e){return _o.add(e),()=>{_o.delete(e)}}function Sa(e,t){if(typeof e.label=="function")try{return String(e.label(t)??"")}catch{return""}return e.label}function Ca(e,t){if(typeof e.icon=="function")try{return String(e.icon(t)??"")}catch{return""}return e.icon??""}function ka(e,t){if(!e.checkable||typeof e.checked!="function")return!1;try{return!!e.checked(t)}catch{return!1}}function xa(e,t){if(typeof e.isVisible!="function")return!0;try{return!!e.isVisible(t)}catch{return!1}}function bo(e){const t=e.element.querySelector(".os-window__menu-panel");t&&(t.hidden?wo(e):V(e))}function wo(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&&xt(e,o),vo(e,t),e._unsubscribeWindowActions?.(),e._unsubscribeWindowActions=Aa(()=>{t.hidden||vo(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)||V(e))}),setTimeout(()=>{e._boundOnDocumentPointerDown&&document.addEventListener("pointerdown",e._boundOnDocumentPointerDown,!0)},0),t.querySelector('[role="menuitem"]')?.focus()}function V(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 yo(e){e.hasAttribute("checked")?e.removeAttribute("checked"):e.setAttribute("checked","")}function xt(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=Y(e.getCurrentUrl()),s=Y(n.url);o=i===s}catch{o=!1}o?t.setAttribute("checked",""):t.removeAttribute("checked")}function vo(e,t){for(const n of Array.from(t.querySelectorAll(".os-window__menu-item--action")))n.remove();for(const n of Ea()){if(!xa(n,e))continue;const o=Sa(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"),ka(n,e)&&i.setAttribute("checked","");else{i.setAttribute("role","menuitem");const r=Ca(n,e);r&&i.setAttribute("icon",r)}const s=n.closeOnSelect??!n.checkable;i.addEventListener("os-menu-item-click",r=>{r.stopPropagation(),n.checkable&&yo(i),s&&V(e);try{n.onSelect(e)}catch(d){typeof console<"u"&&console.error(`[openstation] window action "${n.id}" threw:`,d)}}),t.appendChild(i)}}const Ta={minDurationMs:1e3,minReversals:5,minAmplitudePx:14,maxGapMs:320,cooldownMs:600},Ia="os-pointer-shake";function La(e={}){const t={...Ta,...e};let n={origin:0,dir:0,extent:0},o={origin:0,dir:0,extent:0},i=[],s=!1,r=-1/0;const d=()=>{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),y=a(o,u);if(b&&i.push({t:p,axis:"x"}),y&&i.push({t:p,axis:"y"}),!b&&!y||i.length<t.minReversals)return null;const w=p-i[0].t;if(w<t.minDurationMs)return null;let S=0;for(const C of i)C.axis==="x"&&S++;const E={x:l,y:u,durationMs:w,reversals:i.length,axis:S*2>=i.length?"x":"y"};return d(),r=p+t.cooldownMs,E},reset:d}}function Na(e,t){e.dispatchEvent(new CustomEvent(Ia,{detail:t,bubbles:!0,composed:!0}))}function Eo(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 Ra(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")||Ut())return;const o=e.state==="maximized",i=e.state==="snapped-left"||e.state==="snapped-right",s=o||i,r=t.clientX,d=t.clientY,a=t.pointerId,c=s?Oa(e,t):null;e._titleBar.setPointerCapture(a);const l=e.snapConfigProvider?.()??{enabled:!1,cellWidth:0,cellHeight:0},u=Eo(e,"drag"),p=La();let g=!1,b=r,y=d;const w=(h,v,I)=>{h===g||!e._isDragging||(g=h,e.onDragGesture?.(e,{type:"modifier",active:h,clientX:v,clientY:I}))},S=h=>{h.key==="Alt"&&(h.preventDefault(),w(h.type==="keydown",b,y))};let E=!1;const C=(h,v)=>{if(E)return;E=!0;let I,H;if(c){const P=Da(e,c,h,v);I=P.left,H=P.top}else I=e.element.offsetLeft,H=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=v-H,window.addEventListener("keydown",S),window.addEventListener("keyup",S),m(f.WINDOW_DRAG_START,{windowId:e.id})};s||C(r,d);const N=h=>{if(!E){const F=h.clientX-r,Ce=h.clientY-d;if(F*F+Ce*Ce<Ts)return;C(h.clientX,h.clientY)}if(!e._isDragging)return;let v=h.clientX-e._dragOffsetX,I=h.clientY-e._dragOffsetY;const H=e.element.parentElement;if(H){const F=Pa(v,I,e.element.offsetWidth,{x:0,y:0,width:H.clientWidth,height:H.clientHeight});v=F.x,I=F.y}l.enabled&&(v=Math.round(v/l.cellWidth)*l.cellWidth,I=Math.round(I/l.cellHeight)*l.cellHeight),e.element.style.left=`${v}px`,e.element.style.top=`${I}px`,b=h.clientX,y=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&&(Na(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{}},Se=()=>{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(!E){D(),Se();return}if(!e._isDragging||(e._isDragging=!1,e.element.classList.remove("os-window--dragging"),e.element.classList.remove("os-window--snap-drag"),D(),Se(),e.onDragEnd?.(e)??!1))return;e._gridSpan=null,e._emitChange("moved");const v={windowId:e.id,x:e.element.offsetLeft,y:e.element.offsetTop};m(f.WINDOW_DRAG_END,v),m(f.WINDOW_MOVED,v)};e._titleBar.addEventListener("pointermove",N),e._titleBar.addEventListener("pointerup",j),e._titleBar.addEventListener("pointercancel",j),e._titleBar.addEventListener("lostpointercapture",j)}function Oa(e,t){const n=e._titleBar.getBoundingClientRect(),o=n.width>0?(t.clientX-n.left)/n.width:.5,i=e.element.parentElement,s=i?Ye(i):null,r=s?Math.min(960,Math.round(s.width*.6)):640,d=s?Math.min(640,Math.round(s.height*.7)):480,a=e._savedGeometry?.width??r,c=e._savedGeometry?.height??d,l=i?.getBoundingClientRect();return{isMaximized:e.state==="maximized",cursorRatioX:o,titleBarHeight:n.height,areaLeft:l?.left??0,areaTop:l?.top??0,targetW:a,targetH:c}}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 i=Math.max(B,Math.round(n-t.areaLeft-t.targetW*t.cursorRatioX)),s=Math.max(B,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 Wa(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=Eo(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=l=>{if(!e._isResizing)return;const u=l.clientX-e._resizeStartX,p=l.clientY-e._resizeStartY,g=Ma(o,u,p,i,s,e._resizeStartW,e._resizeStartH,e.config.minWidth,e.config.minHeight,d);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()},c=()=>{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",c),n.removeEventListener("pointercancel",c),n.removeEventListener("lostpointercapture",c),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",c),n.addEventListener("pointercancel",c),n.addEventListener("lostpointercapture",c)}function Ma(e,t,n,o,i,s,r,d,a,c){let l=s,u=r,p=o,g=i;if((e==="ne"||e==="se")&&(l=Math.max(d,s+t)),e==="nw"||e==="sw"){const b=Math.max(d,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(c.enabled){const b=Math.max(d,Math.round(l/c.cellWidth)*c.cellWidth),y=Math.max(a,Math.round(u/c.cellHeight)*c.cellHeight);(e==="nw"||e==="sw")&&(p=o+(l-b)),(e==="nw"||e==="ne")&&(g=i+(u-y)),l=b,u=y}if(p<B){const b=B-p;p=B,l=Math.max(d,l-b)}if(g<B){const b=B-g;g=B,u=Math.max(a,u-b)}return{x:p,y:g,width:l,height:u}}function Pa(e,t,n,o){const i=o.x+ft-n,s=o.x+o.width-ft,r=Math.max(i,Math.min(e,s)),d=o.y+B,a=o.y+o.height-ft,c=Math.max(d,Math.min(t,a));return{x:r,y:c}}const $a="os-speculate-doc",Ao=new Map,za=1e3;function Ha(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=Ao.get(t);if(!(o!==void 0&&n-o<za)){Ao.set(t,n);try{navigator.serviceWorker.controller.postMessage({type:$a,url:t})}catch{}}}const Tt=window.location.origin,Fa="os-window-open",Ua=300;function Ga(e){if(!window.wp?.os?.getOsSettings?.().windowPrewarmEnabled)return;const n=fe(e);n&&Ha(n)}const Ba=120,ae=class ae{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._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=ze,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=Ks(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=>yr(this,n),this.bindEvents(),this.iframe&&this._wireContentFocusForwarder(this.iframe),this.renderCustomTitleBarButtons(),this._titleBarButtonsUnsubscribe=zr(()=>{this.renderCustomTitleBarButtons()}),St(this,this.config.appearance?.theme),this._windowThemesUnsubscribe=qr(()=>{this._isDestroyed||St(this,this.config.appearance?.theme)}),this.repaintWindowControls(),this._windowControlsUnsubscribe=Qr(()=>{this._isDestroyed||this.repaintWindowControls()}),this.repaintWindowSlots(),this._windowSlotsUnsubscribe=ha(()=>{this._isDestroyed||this.repaintWindowSlots()}),this.remountWindowChrome(),this._windowChromesUnsubscribe=wa(()=>{if(this._isDestroyed)return;po(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!==Fa||i()};t.addEventListener("animationend",s),t.addEventListener("animationcancel",s),n=window.setTimeout(()=>{n=null,i()},Ua),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}=ri(this.id,this.config.params??{});this._nativeRenderCtxDispose=s;const r=this.config.render(o,i),d=c=>{typeof c=="function"&&(this._nativeRenderTeardown=c)};r instanceof Promise?r.then(c=>{this._isDestroyed||(d(c),$(this.id))},c=>{typeof console<"u"&&console.error(`[openstation] native render rejected for "${this.id}":`,c),m(f.SHELL_ERROR,{scope:"window-open",id:this.id,error:c}),!this._isDestroyed&&$(this.id)}):(d(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=>Ra(this,s)),this.element.querySelectorAll(".os-window__resize-handle").forEach(s=>{s.addEventListener("pointerdown",r=>Wa(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(),bo(this)});const s=o.querySelector(".os-window__menu-item--open-another");s&&s.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),V(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(),V(this),this.onOpenInNewWindow?.(this)});const d=o.querySelector(".os-window__menu-item--reload");d&&d.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),V(this),this.reload()});const a=o.querySelector(".os-window__menu-item--open-external");a&&a.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),V(this),this.detach()});const c=o.querySelector(".os-window__menu-item--startup");c&&(xt(this,c),c.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),yo(c),this.onToggleStartup?.(this)}),document.addEventListener("os-default-window-changed",()=>{xt(this,c)})),o.addEventListener("keydown",l=>{l.key==="Escape"&&(l.stopPropagation(),V(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')||Ut()||this.toggleMaximize()});const i=this.element.querySelector(".os-window__tabs");if(i&&(i.addEventListener("click",s=>tr(this,s)),i.addEventListener("keydown",s=>oi(i,s)),i.addEventListener("pointerover",s=>{const r=s;if(r.pointerType!=="mouse")return;const d=r.target?.closest?.(".os-window__tab[data-url]"),a=d?.dataset.url;a&&(d?.classList.contains("is-active")||(this._tabSpeculateTimer&&window.clearTimeout(this._tabSpeculateTimer),this._tabSpeculateTimer=window.setTimeout(()=>{this._tabSpeculateTimer=null,Ga(a)},Ba)))}),i.addEventListener("pointerleave",()=>{this._tabSpeculateTimer&&(window.clearTimeout(this._tabSpeculateTimer),this._tabSpeculateTimer=null)}),this._tabOverflowTeardown=or(i)),this.iframe){const s=this.iframe;this._wireTabNavSync(s),window.addEventListener("message",this._boundOnMessage)}}addExternalTab(t,n){Gn(this,t,n)}setTabs(t,n){ii(this.element,t,n)}activateTab(t){Qe(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=oa(this,t)}}repaintThemedChrome(){const t=this.element.querySelector(".os-window__slot--icon");if(t){const o=t.querySelector(".os-window__icon");o&&o.replaceWith(aa(this.config.icon,{title:this.config.title,className:"os-window__icon",slot:es(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"),lt(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=ga(this)}remountWindowChrome(){if(this._chromeHandle){try{this._chromeHandle.destroy()}catch{}this._chromeHandle=null}this.element.classList.remove(kt);const t=ya(this);t?(this._chromeHandle=t.handle,this._chromeId=t.id):this._chromeId=ze}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(mo(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},St(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=Ye(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}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 d=[`.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 d){const c=document.querySelector(a);if(c){const l=c.getBoundingClientRect();if(l.width>0&&l.height>0)return c}}}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 d=r.getBoundingClientRect();if(d.width>0&&d.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:d}=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-d)*.6})`,opacity:1},{transform:`translate(${s}px, ${r}px) scale(${d})`,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"&&J();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"&&J()}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"&&(J(),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:d,dy:a,scale:c}=this._buildGenieTransform(i,s,.24);let l=null;try{l=this.element.animate([{transform:`translate(${d}px, ${a}px) scale(${c})`,opacity:0},{offset:.4,transform:`translate(${d*.4}px, ${a*.4}px) scale(${1-(1-c)*.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"&&(J(),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=Ye(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",J(),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";J(),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",J(),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,Tt)}catch{return}n.origin===Tt&&(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"?_t(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=fe(t);return n?(_t(this,{commit:()=>{this.markContentLoading(),pe(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||Lr(this,n))return;Nr(this),pe(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?fe(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),ht(i),i.addEventListener("load",()=>{$(this.id),ht(i)}),this._wireContentFocusForwarder(i),this._wireTabNavSync(i),pe(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}=$r(this),s=(r,d)=>{for(const a of d){const c=document.createElement("os-window-button");if(Zn(c,a.icon),c.setAttribute("aria-label",a.label),c.setAttribute("title",a.label),c.classList.add("os-window__btn"),c.classList.add("os-window__btn--custom"),c.dataset.buttonId=a.id,r.appendChild(c),typeof a.render=="function")try{a.render(c,this)}catch(l){typeof console<"u"&&console.error("[openstation] title-bar-button render threw:",a.id,l)}else typeof a.onClick=="function"&&c.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??Vo(this.id);if(!o){Uo(this.id,t,n);return}const i=()=>{try{o.contentWindow?.postMessage({type:"os-window-send",channel:t,payload:n},Tt)}catch(s){typeof console<"u"&&console.error("[openstation] Window.send: postMessage failed",s)}};if(Ft(this.id)){i();return}Go(this.id,t,n,i)}on(t,n){return typeof t!="string"||t===""||typeof n!="function"?()=>{}:Ho(this.id,t,n)}markContentLoading(){Ie(this.id)}markContentLoaded(){$(this.id)}whenContentReady(){return Ft(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()},ae.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=ae.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?ie(_("Not saved. %s"),this._activityError):_("Not saved.");default:return""}}requestAttention(t,n={}){const o=Ke.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}),d=window.wp,a=d?.os?.dock,c=d?.os?.taskbar;let l=!1;if(typeof a?.setAttention=="function"&&(a.setAttention(this.id,r,s),l=!0),typeof c?.setAttention=="function"&&(c.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,Bo(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(Kr(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(),J()}}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),d=Math.round(s.height);try{this.config.onResize?.(r,d)}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:d})});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 Js(this)}getExternalTabsSnapshot(){return er(this)}toggleActionsMenu(){bo(this)}closeActionsMenu(){V(this)}openActionsMenu(){wo(this)}};ae.NAVIGATION_ACTIVITY_TIMEOUT_MS=3e4,ae.MIN_SAVING_DISPLAY_MS=1200;let It=ae;function A(e,...t){return{__wpdHtml:!0,strings:e,values:t}}function qa(e){return!!e&&e.__wpdHtml===!0}const Va="$$wpd$$",L=/\$\$wpd\$\$(\d+)\$\$/g,Ka="$$wpd-node$$",ja=/^\$\$wpd-node\$\$(\d+)\$\$$/,Ya=new Set(["style","script","textarea","title"]);function Xa(e){let t="",n=!1,o=null,i=!1,s=null,r="",d=!1;for(let a=0;a<e.length;a++){const c=e[a];t+=c;for(let l=0;l<c.length;l++){const u=c[l];if(i){c.startsWith("-->",l)&&(i=!1,l+=2);continue}if(s!==null){u==="<"&&c[l+1]==="/"&&c.slice(l+2,l+2+s.length).toLowerCase()===s&&(l+=1+s.length,s=null,n=!0,d=!1,r="");continue}if(o!==null){u===o&&(o=null);continue}if(n){u==='"'||u==="'"?(o=u,d=!1):u===">"?(n=!1,d=!1,Ya.has(r)&&(s=r),r=""):d&&(/[a-zA-Z0-9-]/.test(u)?r+=u.toLowerCase():d=!1);continue}if(c.startsWith("<!--",l)){i=!0,l+=3;continue}const p=c[l+1]??"";u==="<"&&/[a-zA-Z/!]/.test(p)&&(n=!0,r="",d=/[a-zA-Z]/.test(p))}a<e.length-1&&(t+=n||i||s!==null?`${Va}${a}$$`:`<!--${Ka}${a}$$-->`)}return t}const So=new WeakMap;function Co(e){const t=So.get(e);if(t)return t;const n=document.createElement("template");n.innerHTML=Xa(e);const o=[],i=(d,a)=>{if(d.nodeType===Node.ELEMENT_NODE){const u=d;for(const p of Array.from(u.attributes)){const g=p.name,b=p.value,y=g[0];if(L.test(b))if(L.lastIndex=0,y==="@"){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(y==="."){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(y==="?"){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 E=0,C;for(L.lastIndex=0;(C=L.exec(b))!==null;)w.push(b.slice(E,C.index)),S.push(Number(C[1])),E=C.index+C[0].length;w.push(b.slice(E)),o.push({path:a,kind:"attr",name:g,template:w,valueIndices:S}),u.setAttribute(g,"")}}}const c=Array.from(d.childNodes);let l=0;for(let u=0;u<c.length;u++){const p=c[u],g=u+l;if(p.nodeType===Node.COMMENT_NODE){const b=ja.exec(p.data);if(b){const y=document.createTextNode("");p.parentNode.replaceChild(y,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 y=p.parentNode;let w=0,S;const E=[],C=[];for(L.lastIndex=0;(S=L.exec(b))!==null;){S.index>w&&E.push(document.createTextNode(b.slice(w,S.index)));const N=document.createTextNode("");E.push(N),C.push({path:[...a,g+E.length-1],kind:"node",valueIndex:Number(S[1])}),w=S.index+S[0].length}w<b.length&&E.push(document.createTextNode(b.slice(w)));for(const N of E)y.insertBefore(N,p);y.removeChild(p),l+=E.length-1,o.push(...C)}else i(p,[...a,g])}};i(n.content,[]);const r={template:n,buildParts:d=>{const a=[];for(const c of o){let l=d;for(const u of c.path)l=l.childNodes[u];c.kind==="node"?a.push({kind:"node",valueIndex:c.valueIndex,child:{anchor:l,state:null}}):c.kind==="attr"?a.push({kind:"attr",element:l,name:c.name,template:c.template,valueIndices:c.valueIndices}):c.kind==="event"?a.push({kind:"event",valueIndex:c.valueIndex,element:l,name:c.name}):c.kind==="prop"?a.push({kind:"prop",valueIndex:c.valueIndex,element:l,name:c.name}):c.kind==="bool"&&a.push({kind:"bool",valueIndex:c.valueIndex,element:l,name:c.name})}return a}};return So.set(e,r),r}const ko=new WeakMap;function Za(e,t){for(const n of e.nodes)if(n.parentNode!==t)return!1;return!0}function Qa(e,t){const n=ko.get(t);if(n&&n.strings===e.strings&&Za(n,t)){He(n.parts,e.values);return}const o=Co(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),He(s,e.values),ko.set(t,{strings:e.strings,parts:s,nodes:r})}function He(e,t){for(const n of e)if(n.kind==="node")Fe(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+=xo(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 Fe(e,t){if(t==null||t===!1){e.state&&(te(e.state),e.state=null);return}if(Array.isArray(t)){nl(e,t);return}if(qa(t)){tl(e,t);return}if(t instanceof Node){Ja(e,t);return}el(e,xo(t))}function Ja(e,t){const n=e.state;n?.shape==="node"&&n.node===t||(n&&te(n),_e(e,[t]),e.state={shape:"node",node:t})}function el(e,t){const n=e.state;if(n?.shape==="text"){n.text!==t&&(n.node.textContent=t,n.text=t);return}n&&te(n);const o=document.createTextNode(t);_e(e,[o]),e.state={shape:"text",node:o,text:t}}function tl(e,t){const n=e.state;if(n?.shape==="template"&&n.strings===t.strings){He(n.parts,t.values);return}n&&te(n);const o=Co(t.strings),i=o.template.content.cloneNode(!0),s=o.buildParts(i),r=Array.from(i.childNodes);_e(e,[i]),He(s,t.values),e.state={shape:"template",strings:t.strings,parts:s,nodes:r}}function nl(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++)Fe(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&&te(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("");_e(e,[r]);const d={anchor:r,state:null};Fe(d,t[s]),n.entries.push(d)}return}n&&te(n);const o=[];for(const i of t){const s=document.createTextNode("");_e(e,[s]);const r={anchor:s,state:null};Fe(r,i),o.push(r)}e.state={shape:"array",entries:o}}function _e(e,t){const n=e.anchor.parentNode;if(n)for(const o of t)n.insertBefore(o,e.anchor)}function te(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&&(te(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&&te(t.state),t.anchor.remove()}function xo(e){return e==null||e===!1?"":String(e)}const ne=class ne 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(To)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(t,n,o){if(n===o)return;const i=ol(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=To(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&&Qa(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(!ne._lightStylesAdopted.has(t)){ne._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)}}}};ne.props=[],ne.styles=[],ne.shadow=!0,ne._lightStylesAdopted=new WeakSet;let K=ne;function oe(e,t){customElements.get(e)||customElements.define(e,t)}function To(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function ol(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}const il=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function x(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(il){const o=new CSSStyleSheet;return o.replaceSync(n),{__wpdCss:!0,sheet:o,cssText:n}}return{__wpdCss:!0,sheet:null,cssText:n}}const sl=x`: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}`,rl={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 al(e){const t=(e??"").trim();return t===""||t.length>4096||!/^(https?:\/\/|data:image\/)/i.test(t)||/['"()\\<>\s]/.test(t)?"":t}const be=class be extends K{constructor(){super(...arguments),this._activateWired=!1}static get observedAttributes(){return[...super.observedAttributes,"aria-label","aria-pressed"]}render(){const t=al(this["icon-src"]||this.getAttribute("icon-src")||""),n=t?"":this.icon||"",o=rl[n]||"",i=this.getAttribute("aria-label")||"";return t?A` | |
| 2 | + <button type="button" aria-label="${i}" aria-pressed="${this.getAttribute("aria-pressed")||""}" ?disabled="${this.hasAttribute("disabled")}"> | |
| 3 | 3 | <span |
| 4 | 4 | class="themed-icon" |
| 5 | 5 | aria-hidden="true" |
| 6 | 6 | style="-webkit-mask: url('${t}') center / contain no-repeat; mask: url('${t}') center / contain no-repeat;" |
| @@ -7,9 +7,9 @@ | ||
| 7 | 7 | ></span> |
| 8 | 8 | <slot></slot> |
| 9 | 9 | </button> |
| 10 | 10 | `:A` |
| 11 | - <button type="button" aria-label="${s}"> | |
| 11 | + <button type="button" aria-label="${i}" aria-pressed="${this.getAttribute("aria-pressed")||""}" ?disabled="${this.hasAttribute("disabled")}"> | |
| 12 | 12 | <svg |
| 13 | 13 | width="14" |
| 14 | 14 | height="14" |
| 15 | 15 | viewBox="0 0 12 12" |
| @@ -18,9 +18,9 @@ | ||
| 18 | 18 | ></svg> |
| 19 | 19 | <slot></slot> |
| 20 | 20 | </button> |
| 21 | 21 | <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}))}))}};be.props=["icon","icon-src","active","danger"],be.styles=[tl],be.help=void 0;let Tt=be;ne("os-window-button",Tt);const sl=T`: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%}`,To="os-settings-save-lifecycle",il=2200,rl=6e3,we=class we extends V{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"),A` | |
| 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 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}))}))}};be.props=["icon","icon-src","active","danger","disabled"],be.styles=[sl],be.help=void 0;let Lt=be;oe("os-window-button",Lt);const ll=x`: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%}`,Io="os-settings-save-lifecycle",cl=2200,dl=6e3,we=class we extends K{constructor(){super(...arguments),this._autoTimer=null,this._docListener=null}connectedCallback(){super.connectedCallback(),this.auto!==null&&this._installAutoListener()}disconnectedCallback(){this._removeAutoListener(),this._autoTimer!==null&&(window.clearTimeout(this._autoTimer),this._autoTimer=null)}attributeChangedCallback(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"),A` | |
| 23 | 23 | <span class="os-save-status"> |
| 24 | 24 | <span class="os-save-status__indicator" aria-hidden="true"> |
| 25 | 25 | <span class="os-save-status__glyph">${this._renderGlyph(t)}</span> |
| 26 | 26 | </span> |
| @@ -27,9 +27,9 @@ | ||
| 27 | 27 | ${n==="pill"?A`<span class="os-save-status__label" |
| 28 | 28 | >${this._labelForPhase(t)}</span |
| 29 | 29 | >`:A``} |
| 30 | 30 | </span> |
| 31 | - `}_renderGlyph(t){return t==="saved"?al():t==="failed"?ll():""}_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||To;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||To;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)||il}if(t==="failed"){const n=this["auto-clear-failed-ms"];return parseInt(n||"",10)||rl}return 0}};we.props=["phase","mode","variant","animation","auto","event","error","saving-label","saved-label","idle-label","auto-clear-saved-ms","auto-clear-failed-ms"],we.styles=[sl],we.help=void 0;let xt=we;ne("os-save-status",xt);function al(){return A` | |
| 31 | + `}_renderGlyph(t){return t==="saved"?ul():t==="failed"?hl():""}_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||Io;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||Io;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)||cl}if(t==="failed"){const n=this["auto-clear-failed-ms"];return parseInt(n||"",10)||dl}return 0}};we.props=["phase","mode","variant","animation","auto","event","error","saving-label","saved-label","idle-label","auto-clear-saved-ms","auto-clear-failed-ms"],we.styles=[ll],we.help=void 0;let Nt=we;oe("os-save-status",Nt);function ul(){return A` | |
| 32 | 32 | <svg |
| 33 | 33 | viewBox="0 0 12 12" |
| 34 | 34 | aria-hidden="true" |
| 35 | 35 | focusable="false" |
| @@ -40,9 +40,9 @@ | ||
| 40 | 40 | stroke-linejoin="round" |
| 41 | 41 | > |
| 42 | 42 | <path d="M2.5 6 L5 8.5 L9.5 4" /> |
| 43 | 43 | </svg> |
| 44 | - `}function ll(){return A` | |
| 44 | + `}function hl(){return A` | |
| 45 | 45 | <svg |
| 46 | 46 | viewBox="0 0 12 12" |
| 47 | 47 | aria-hidden="true" |
| 48 | 48 | focusable="false" |
| @@ -51,10 +51,10 @@ | ||
| 51 | 51 | <path |
| 52 | 52 | d="M5 2 H7 V7 H5 z M5 8.5 H7 V10.5 H5 z" |
| 53 | 53 | /> |
| 54 | 54 | </svg> |
| 55 | - `}const cl=T`: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}}`,xo=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,Io=58.453,dl='<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"/>',ve=class ve extends V{constructor(){super(...arguments),this._paintScheduled=!1}connectedCallback(){super.connectedCallback(),this._schedulePaint()}render(){return A`<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=xo[t]??xo.classic,o=(r,d)=>{const a=this.getAttribute(r);if(a===null)return d;const c=parseFloat(a);return Number.isFinite(c)?c:d},s=(r,d)=>{const a=this.getAttribute(r);if(a===null)return d;const c=a.toLowerCase();return c==="-1"||c==="ccw"||c==="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=Lo(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="${ze(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=Lo(this.getAttribute("label")??"Loading"),o=t.gap*3+14,s=-o,i=122.52+o*2,r=Io+t.gap+2,d=r+t.gap+2,a=d+t.gap+1.5,c=`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,E=1.6,C=(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="${E}" stroke-dasharray="${E.toFixed(2)} ${(S-E).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 ${C}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 ${O}px${b?";"+b:""}"><circle cx="${R}" cy="${O}" r="${Io}" fill="currentColor"/><g class="mark">${dl}</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="${ze(r,t.a1)}" stroke-linecap="round" style="transform-origin:${R}px ${O}px;${c}"/><circle cx="${R}" cy="${O}" r="${d.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.5" stroke-opacity="0.15"/><circle cx="${R}" cy="${O}" r="${d.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.6" stroke-opacity="0.8" stroke-dasharray="${ze(d,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="${ze(a,t.a3)}" stroke-linecap="round" style="transform-origin:${R}px ${O}px;${u}"/>`+v+"</svg>"}};ve.props=["preset","size","color","accent","sp1","sp2","sp3","a1","a2","a3","gap","dir2","dir3","pulse","dots","label"],ve.styles=[cl],ve.help=void 0;let It=ve;function ze(e,t){const n=2*Math.PI*e,o=t/100*n,s=n-o;return`${o.toFixed(2)} ${s.toFixed(2)}`}function Lo(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}ne("os-spinner",It);const Ge=T`: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 ) )}`,ul=T` .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%}}`,hl=T` .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%}}`,fl=T` .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}}`,pl=T` .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}}`,ml=T` .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}}`,gl=T` .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%}}`,No=T` .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}}`,_l=T` 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}}`,bl=T` 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}}`,wl=T` @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}}`;T` ${Ge} ${ul} ${hl} ${fl} ${pl} ${ml} ${gl} ${No} ${_l} ${bl} ${wl} `;const vl=T` ${Ge} ${No}: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}`,yl=T`: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 )}`,qe=class qe extends V{connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}render(){return A`<slot></slot>`}};qe.styles=[vl],qe.help=void 0;let Lt=qe;ne("os-menu",Lt);const ye=class ye extends V{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"),A` | |
| 56 | - <button type="button" @click=${s=>this._onPick(s)}> | |
| 55 | + `}const fl=x`: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}}`,Lo=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,No=58.453,pl='<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"/>',ye=class ye extends K{constructor(){super(...arguments),this._paintScheduled=!1}connectedCallback(){super.connectedCallback(),this._schedulePaint()}render(){return A`<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=Lo[t]??Lo.classic,o=(r,d)=>{const a=this.getAttribute(r);if(a===null)return d;const c=parseFloat(a);return Number.isFinite(c)?c:d},i=(r,d)=>{const a=this.getAttribute(r);if(a===null)return d;const c=a.toLowerCase();return c==="-1"||c==="ccw"||c==="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=Ro(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="${Ue(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=Ro(this.getAttribute("label")??"Loading"),o=t.gap*3+14,i=-o,s=122.52+o*2,r=No+t.gap+2,d=r+t.gap+2,a=d+t.gap+1.5,c=`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 y="";if(t.dots>0){const w=a+t.gap+1,S=2*Math.PI*w,E=1.6,C=(t.sp1*.65/10).toFixed(2);for(let N=0;N<t.dots;N++){const D=-(N/t.dots)*S;y+=`<circle cx="${R}" cy="${O}" r="${w.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="${E}" stroke-dasharray="${E.toFixed(2)} ${(S-E).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 ${C}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="${No}" fill="currentColor"/><g class="mark">${pl}</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="${Ue(r,t.a1)}" stroke-linecap="round" style="transform-origin:${R}px ${O}px;${c}"/><circle cx="${R}" cy="${O}" r="${d.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.5" stroke-opacity="0.15"/><circle cx="${R}" cy="${O}" r="${d.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.6" stroke-opacity="0.8" stroke-dasharray="${Ue(d,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="${Ue(a,t.a3)}" stroke-linecap="round" style="transform-origin:${R}px ${O}px;${u}"/>`+y+"</svg>"}};ye.props=["preset","size","color","accent","sp1","sp2","sp3","a1","a2","a3","gap","dir2","dir3","pulse","dots","label"],ye.styles=[fl],ye.help=void 0;let Rt=ye;function Ue(e,t){const n=2*Math.PI*e,o=t/100*n,i=n-o;return`${o.toFixed(2)} ${i.toFixed(2)}`}function Ro(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}oe("os-spinner",Rt);const Ge=x`: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=x` .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%}}`,gl=x` .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=x` .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}}`,bl=x` .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}}`,wl=x` .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}}`,yl=x` .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%}}`,Oo=x` .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}}`,vl=x` 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}}`,El=x` 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}}`,Al=x` @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}}`;x` ${Ge} ${ml} ${gl} ${_l} ${bl} ${wl} ${yl} ${Oo} ${vl} ${El} ${Al} `;const Sl=x` ${Ge} ${Oo}: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}`,Cl=x`: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 )}`,qe=class qe extends K{connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}render(){return A`<slot></slot>`}};qe.styles=[Sl],qe.help=void 0;let Ot=qe;oe("os-menu",Ot);const ve=class ve extends K{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"),A` | |
| 56 | + <button type="button" @click=${i=>this._onPick(i)}> | |
| 57 | 57 | <span |
| 58 | 58 | class="os-menu-item__check" |
| 59 | 59 | ?hidden=${!n} |
| 60 | 60 | ></span> |
| @@ -66,9 +66,9 @@ | ||
| 66 | 66 | <span class="os-menu-item__label"> |
| 67 | 67 | <slot></slot> |
| 68 | 68 | </span> |
| 69 | 69 | </button> |
| 70 | - `}_onPick(t){t.preventDefault(),this.emit("os-menu-item-click",{value:this.value})}};ye.props=["icon","value","checked"],ye.styles=[yl],ye.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:A` | |
| 70 | + `}_onPick(t){t.preventDefault(),this.emit("os-menu-item-click",{value:this.value})}};ve.props=["icon","value","checked"],ve.styles=[Cl],ve.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:A` | |
| 71 | 71 | <os-menu> |
| 72 | 72 | <os-menu-item value="plain">Plain item</os-menu-item> |
| 73 | 73 | <os-menu-item value="icon" icon="dashicons-external"> |
| 74 | 74 | With an icon |
| @@ -76,9 +76,9 @@ | ||
| 76 | 76 | <os-menu-item value="startup" role="menuitemcheckbox" checked> |
| 77 | 77 | Checked (menuitemcheckbox) |
| 78 | 78 | </os-menu-item> |
| 79 | 79 | </os-menu> |
| 80 | - `};let Nt=ye;ne("os-menu-item",Nt);const El=T` ${Ge}: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}}`,Al={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"/>'},Ee=class Ee extends V{render(){const t=this.variant||"",n=Al[t]||"";return A` | |
| 80 | + `};let Dt=ve;oe("os-menu-item",Dt);const kl=x` ${Ge}: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}}`,xl={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"/>'},Ee=class Ee extends K{render(){const t=this.variant||"",n=xl[t]||"";return A` | |
| 81 | 81 | <button type="button"> |
| 82 | 82 | <svg |
| 83 | 83 | viewBox="0 0 12 12" |
| 84 | 84 | aria-hidden="true" |
| @@ -86,9 +86,9 @@ | ||
| 86 | 86 | ></svg> |
| 87 | 87 | <slot></slot> |
| 88 | 88 | </button> |
| 89 | 89 | <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)}}};Ee.props=["variant"],Ee.styles=[El],Ee.help=void 0;let Rt=Ee;ne("os-tab-chip",Rt);const Sl={createWindow(e){return new kt(e)}};window.openStationWindowSystem=Sl;const Cl=T` ${Ge}:host{display:none;position:fixed;inset:0;align-items:center;justify-content:center;background:var( --os-ui-scrim,rgba( 0,0,0,0.45 ) );background-image:var( --os-ui-scrim-image,none );background-repeat:var( --os-ui-scrim-image-repeat,repeat );background-size:var( --os-ui-scrim-image-size,auto );background-position:var( --os-ui-scrim-image-position,center );backdrop-filter:blur( 2px );z-index:10000}:host( [ open ] ){display:flex;animation:os-confirm-scrim var( --_holo-t ) var( --_holo-ease )}:host( [ open ] ) .dialog{animation:os-confirm-dialog var( --_holo-t ) var( --_holo-spring )}@keyframes os-confirm-scrim{from{opacity:0}}@keyframes os-confirm-dialog{from{opacity:0;transform:scale( 0.96 ) translateY( 8px )}}@media ( prefers-reduced-motion:reduce ){:host( [ open ] ),:host( [ open ] ) .dialog{animation:none}}.dialog{width:min( 420px,92vw );background-color:var( --os-ui-confirm-dialog-bg,#1d2327 );background-image:var( --os-ui-dialog-bg-image,none );background-repeat:var( --os-ui-dialog-bg-image-repeat,repeat );background-size:var( --os-ui-dialog-bg-image-size,auto );background-position:var( --os-ui-dialog-bg-image-position,center );color:var( --os-ui-confirm-dialog-fg,var( --os-fg,#fff ) );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.08 ) );border-radius:10px;box-shadow:0 20px 50px rgba( 0,0,0,0.6 );padding:20px 22px 18px;display:flex;flex-direction:column;gap:10px;position:relative}.close{position:absolute;top:8px;right:10px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;background:transparent;border:0;border-radius:6px;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );cursor:pointer;font-size:22px;line-height:1;padding:0}.close:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) );color:inherit}.btn:focus,.close:focus{outline:none;box-shadow:var( --_holo-focus )}.dialog:focus,.dialog:focus-visible{outline:none}.title{margin:0 0 4px;font-size:16px;font-weight:600}.message{margin:0;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );line-height:1.45;white-space:pre-line}.remember{display:flex;align-items:center;gap:8px;margin-top:4px;font-size:12px;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );cursor:pointer;user-select:none}.remember__box{margin:0;accent-color:var( --os-ui-accent,#2271b1 );cursor:pointer}.remember__box:focus,.remember__box:focus-visible{outline:none;box-shadow:var( --_holo-focus )}.actions{display:flex;justify-content:flex-end;gap:8px;margin-top:6px}.btn{border:0;border-radius:6px;padding:8px 14px;font-size:13px;cursor:pointer;font-weight:500}.btn--secondary{background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) );color:inherit}.btn--secondary:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.14 ) )}.btn--primary{background:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.btn--primary:hover{filter:brightness( 1.08 )}.btn--danger{background:var( --os-ui-danger,#d63638 );color:var( --os-ui-fg-on-accent,#fff )}.btn--danger:hover{filter:brightness( 1.08 )}`,Ro='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function kl(e){let t=e?.activeElement??null;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t&&t!==e?.body?t:null}function Oo(e){const t=e.composedPath(),n=t.length>0?t[0]:e.target;return n instanceof HTMLElement?n:null}function Do(e){return e!==null&&e.matches(Ro)}const Ae=class Ae extends V{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(Do(Oo(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=kl(this.ownerDocument),this._focusTries=0,queueMicrotask(this._focusInitial)):this._restoreFocus())}_focusables(){const t=this.shadowRoot;return t?Array.from(t.querySelectorAll(Ro)):[]}_trapTab(t){const n=this._focusables();if(n.length===0)return;const o=n[0],s=n[n.length-1],i=Oo(t),r=!Do(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()}_remembered(){return this.shadowRoot?.querySelector(".remember__box")?.checked===!0}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"),a=this["remember-label"]??"";return A` | |
| 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 i=o.textContent||"";n.innerHTML!==i&&(n.innerHTML=i)}}};Ee.props=["variant"],Ee.styles=[kl],Ee.help=void 0;let Wt=Ee;oe("os-tab-chip",Wt);const Tl={createWindow(e){return new It(e)}};window.openStationWindowSystem=Tl;const Il=x` ${Ge}: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 )}`,Do='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Ll(e){let t=e?.activeElement??null;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t&&t!==e?.body?t:null}function Wo(e){const t=e.composedPath(),n=t.length>0?t[0]:e.target;return n instanceof HTMLElement?n:null}function Mo(e){return e!==null&&e.matches(Do)}const Ae=class Ae extends K{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(Mo(Wo(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=Ll(this.ownerDocument),this._focusTries=0,queueMicrotask(this._focusInitial)):this._restoreFocus())}_focusables(){const t=this.shadowRoot;return t?Array.from(t.querySelectorAll(Do)):[]}_trapTab(t){const n=this._focusables();if(n.length===0)return;const o=n[0],i=n[n.length-1],s=Wo(t),r=!Mo(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"),d=this.hasAttribute("dismissable"),a=this["remember-label"]??"";return A` | |
| 91 | 91 | <div class="dialog" tabindex="-1"> |
| 92 | 92 | ${d?A`<button |
| 93 | 93 | type="button" |
| 94 | 94 | class="close" |
| @@ -106,13 +106,13 @@ | ||
| 106 | 106 | type="button" |
| 107 | 107 | class="btn btn--secondary" |
| 108 | 108 | @click=${()=>this._cancel()} |
| 109 | 109 | > |
| 110 | - ${s} | |
| 110 | + ${i} | |
| 111 | 111 | </button>`} |
| 112 | 112 | <button |
| 113 | 113 | type="button" |
| 114 | - class="btn ${i?"btn--danger":"btn--primary"}" | |
| 114 | + class="btn ${s?"btn--danger":"btn--primary"}" | |
| 115 | 115 | @click=${()=>this._confirm()} |
| 116 | 116 | > |
| 117 | 117 | ${o} |
| 118 | 118 | </button> |
| @@ -117,5 +117,5 @@ | ||
| 117 | 117 | ${o} |
| 118 | 118 | </button> |
| 119 | 119 | </div> |
| 120 | 120 | </div> |
| 121 | - `}};Ae.props=["open","title","message","confirm-label","cancel-label","danger","hide-cancel","dismissable","remember-label"],Ae.styles=[Cl],Ae.help=void 0;let Be=Ae;ne("os-confirm-dialog",Be);function Tl(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=s=>{n.remove(),t(s)};n.addEventListener("os-confirm",s=>{e.onRemember?.(s.detail?.remember===!0),o(!0)}),n.addEventListener("os-cancel",()=>o(!1)),document.body.appendChild(n)})}const xl=Object.freeze(Object.defineProperty({__proto__:null,OsConfirmDialog:Be,osConfirm:Tl},Symbol.toStringTag,{value:"Module"}))})(); | |
| 121 | + `}};Ae.props=["open","title","message","confirm-label","cancel-label","danger","hide-cancel","dismissable","remember-label"],Ae.styles=[Il],Ae.help=void 0;let Be=Ae;oe("os-confirm-dialog",Be);function Nl(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 Rl=Object.freeze(Object.defineProperty({__proto__:null,OsConfirmDialog:Be,osConfirm:Nl},Symbol.toStringTag,{value:"Module"}))})(); | |